import { defineComponent as Uj, inject as qj, ref as Wj, onMounted as Gj, onUnmounted as Hj, openBlock as Yj, createElementBlock as Xj, normalizeClass as S_, unref as C_, createElementVNode as Vj } from "../vue.esm-browser.prod.js";
import { v as Kj } from "./index.6a15f04e.es.js";
/*!
 * https://github.com/Starcounter-Jack/JSON-Patch
 * (c) 2017-2022 Joachim Wester
 * MIT licensed
 */
var Jj = globalThis && globalThis.__extends || function() {
  var e = function(t, n) {
    return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(i, r) {
      i.__proto__ = r;
    } || function(i, r) {
      for (var o in r)
        r.hasOwnProperty(o) && (i[o] = r[o]);
    }, e(t, n);
  };
  return function(t, n) {
    e(t, n);
    function i() {
      this.constructor = t;
    }
    t.prototype = n === null ? Object.create(n) : (i.prototype = n.prototype, new i());
  };
}(), Qj = Object.prototype.hasOwnProperty;
function Ay(e, t) {
  return Qj.call(e, t);
}
function _y(e) {
  if (Array.isArray(e)) {
    for (var t = new Array(e.length), n = 0; n < t.length; n++)
      t[n] = "" + n;
    return t;
  }
  if (Object.keys)
    return Object.keys(e);
  var i = [];
  for (var r in e)
    Ay(e, r) && i.push(r);
  return i;
}
function Gn(e) {
  switch (typeof e) {
    case "object":
      return JSON.parse(JSON.stringify(e));
    case "undefined":
      return null;
    default:
      return e;
  }
}
function Oy(e) {
  for (var t = 0, n = e.length, i; t < n; ) {
    if (i = e.charCodeAt(t), i >= 48 && i <= 57) {
      t++;
      continue;
    }
    return !1;
  }
  return !0;
}
function Va(e) {
  return e.indexOf("/") === -1 && e.indexOf("~") === -1 ? e : e.replace(/~/g, "~0").replace(/\//g, "~1");
}
function nD(e) {
  return e.replace(/~1/g, "/").replace(/~0/g, "~");
}
function Sy(e) {
  if (e === void 0)
    return !0;
  if (e) {
    if (Array.isArray(e)) {
      for (var t = 0, n = e.length; t < n; t++)
        if (Sy(e[t]))
          return !0;
    } else if (typeof e == "object") {
      for (var i = _y(e), r = i.length, o = 0; o < r; o++)
        if (Sy(e[i[o]]))
          return !0;
    }
  }
  return !1;
}
function F_(e, t) {
  var n = [e];
  for (var i in t) {
    var r = typeof t[i] == "object" ? JSON.stringify(t[i], null, 2) : t[i];
    typeof r < "u" && n.push(i + ": " + r);
  }
  return n.join(`
`);
}
var iD = function(e) {
  Jj(t, e);
  function t(n, i, r, o, a) {
    var s = this.constructor, u = e.call(this, F_(n, { name: i, index: r, operation: o, tree: a })) || this;
    return u.name = i, u.index = r, u.operation = o, u.tree = a, Object.setPrototypeOf(u, s.prototype), u.message = F_(n, { name: i, index: r, operation: o, tree: a }), u;
  }
  return t;
}(Error), nt = iD, Zj = Gn, Eu = {
  add: function(e, t, n) {
    return e[t] = this.value, { newDocument: n };
  },
  remove: function(e, t, n) {
    var i = e[t];
    return delete e[t], { newDocument: n, removed: i };
  },
  replace: function(e, t, n) {
    var i = e[t];
    return e[t] = this.value, { newDocument: n, removed: i };
  },
  move: function(e, t, n) {
    var i = Qh(n, this.path);
    i && (i = Gn(i));
    var r = cs(n, { op: "remove", path: this.from }).removed;
    return cs(n, { op: "add", path: this.path, value: r }), { newDocument: n, removed: i };
  },
  copy: function(e, t, n) {
    var i = Qh(n, this.from);
    return cs(n, { op: "add", path: this.path, value: Gn(i) }), { newDocument: n };
  },
  test: function(e, t, n) {
    return { newDocument: n, test: tf(e[t], this.value) };
  },
  _get: function(e, t, n) {
    return this.value = e[t], { newDocument: n };
  }
}, e9 = {
  add: function(e, t, n) {
    return Oy(t) ? e.splice(t, 0, this.value) : e[t] = this.value, { newDocument: n, index: t };
  },
  remove: function(e, t, n) {
    var i = e.splice(t, 1);
    return { newDocument: n, removed: i[0] };
  },
  replace: function(e, t, n) {
    var i = e[t];
    return e[t] = this.value, { newDocument: n, removed: i };
  },
  move: Eu.move,
  copy: Eu.copy,
  test: Eu.test,
  _get: Eu._get
};
function Qh(e, t) {
  if (t == "")
    return e;
  var n = { op: "_get", path: t };
  return cs(e, n), n.value;
}
function cs(e, t, n, i, r, o) {
  if (n === void 0 && (n = !1), i === void 0 && (i = !0), r === void 0 && (r = !0), o === void 0 && (o = 0), n && (typeof n == "function" ? n(t, 0, e, t.path) : Zh(t, 0)), t.path === "") {
    var a = { newDocument: e };
    if (t.op === "add")
      return a.newDocument = t.value, a;
    if (t.op === "replace")
      return a.newDocument = t.value, a.removed = e, a;
    if (t.op === "move" || t.op === "copy")
      return a.newDocument = Qh(e, t.from), t.op === "move" && (a.removed = e), a;
    if (t.op === "test") {
      if (a.test = tf(e, t.value), a.test === !1)
        throw new nt("Test operation failed", "TEST_OPERATION_FAILED", o, t, e);
      return a.newDocument = e, a;
    } else {
      if (t.op === "remove")
        return a.removed = e, a.newDocument = null, a;
      if (t.op === "_get")
        return t.value = e, a;
      if (n)
        throw new nt("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", o, t, e);
      return a;
    }
  } else {
    i || (e = Gn(e));
    var s = t.path || "", u = s.split("/"), l = e, c = 1, f = u.length, d = void 0, h = void 0, g = void 0;
    for (typeof n == "function" ? g = n : g = Zh; ; ) {
      if (h = u[c], h && h.indexOf("~") != -1 && (h = nD(h)), r && (h == "__proto__" || h == "prototype" && c > 0 && u[c - 1] == "constructor"))
        throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");
      if (n && d === void 0 && (l[h] === void 0 ? d = u.slice(0, c).join("/") : c == f - 1 && (d = t.path), d !== void 0 && g(t, 0, e, d)), c++, Array.isArray(l)) {
        if (h === "-")
          h = l.length;
        else {
          if (n && !Oy(h))
            throw new nt("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", o, t, e);
          Oy(h) && (h = ~~h);
        }
        if (c >= f) {
          if (n && t.op === "add" && h > l.length)
            throw new nt("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", o, t, e);
          var a = e9[t.op].call(t, l, h, e);
          if (a.test === !1)
            throw new nt("Test operation failed", "TEST_OPERATION_FAILED", o, t, e);
          return a;
        }
      } else if (c >= f) {
        var a = Eu[t.op].call(t, l, h, e);
        if (a.test === !1)
          throw new nt("Test operation failed", "TEST_OPERATION_FAILED", o, t, e);
        return a;
      }
      if (l = l[h], n && c < f && (!l || typeof l != "object"))
        throw new nt("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", o, t, e);
    }
  }
}
function I0(e, t, n, i, r) {
  if (i === void 0 && (i = !0), r === void 0 && (r = !0), n && !Array.isArray(t))
    throw new nt("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
  i || (e = Gn(e));
  for (var o = new Array(t.length), a = 0, s = t.length; a < s; a++)
    o[a] = cs(e, t[a], n, !0, r, a), e = o[a].newDocument;
  return o.newDocument = e, o;
}
function t9(e, t, n) {
  var i = cs(e, t);
  if (i.test === !1)
    throw new nt("Test operation failed", "TEST_OPERATION_FAILED", n, t, e);
  return i.newDocument;
}
function Zh(e, t, n, i) {
  if (typeof e != "object" || e === null || Array.isArray(e))
    throw new nt("Operation is not an object", "OPERATION_NOT_AN_OBJECT", t, e, n);
  if (Eu[e.op]) {
    if (typeof e.path != "string")
      throw new nt("Operation `path` property is not a string", "OPERATION_PATH_INVALID", t, e, n);
    if (e.path.indexOf("/") !== 0 && e.path.length > 0)
      throw new nt('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", t, e, n);
    if ((e.op === "move" || e.op === "copy") && typeof e.from != "string")
      throw new nt("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", t, e, n);
    if ((e.op === "add" || e.op === "replace" || e.op === "test") && e.value === void 0)
      throw new nt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", t, e, n);
    if ((e.op === "add" || e.op === "replace" || e.op === "test") && Sy(e.value))
      throw new nt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", t, e, n);
    if (n) {
      if (e.op == "add") {
        var r = e.path.split("/").length, o = i.split("/").length;
        if (r !== o + 1 && r !== o)
          throw new nt("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", t, e, n);
      } else if (e.op === "replace" || e.op === "remove" || e.op === "_get") {
        if (e.path !== i)
          throw new nt("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", t, e, n);
      } else if (e.op === "move" || e.op === "copy") {
        var a = { op: "_get", path: e.from, value: void 0 }, s = rD([a], n);
        if (s && s.name === "OPERATION_PATH_UNRESOLVABLE")
          throw new nt("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", t, e, n);
      }
    }
  } else
    throw new nt("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", t, e, n);
}
function rD(e, t, n) {
  try {
    if (!Array.isArray(e))
      throw new nt("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
    if (t)
      I0(Gn(t), Gn(e), n || !0);
    else {
      n = n || Zh;
      for (var i = 0; i < e.length; i++)
        n(e[i], i, t, void 0);
    }
  } catch (r) {
    if (r instanceof nt)
      return r;
    throw r;
  }
}
function tf(e, t) {
  if (e === t)
    return !0;
  if (e && t && typeof e == "object" && typeof t == "object") {
    var n = Array.isArray(e), i = Array.isArray(t), r, o, a;
    if (n && i) {
      if (o = e.length, o != t.length)
        return !1;
      for (r = o; r-- !== 0; )
        if (!tf(e[r], t[r]))
          return !1;
      return !0;
    }
    if (n != i)
      return !1;
    var s = Object.keys(e);
    if (o = s.length, o !== Object.keys(t).length)
      return !1;
    for (r = o; r-- !== 0; )
      if (!t.hasOwnProperty(s[r]))
        return !1;
    for (r = o; r-- !== 0; )
      if (a = s[r], !tf(e[a], t[a]))
        return !1;
    return !0;
  }
  return e !== e && t !== t;
}
const n9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  JsonPatchError: nt,
  deepClone: Zj,
  getValueByPointer: Qh,
  applyOperation: cs,
  applyPatch: I0,
  applyReducer: t9,
  validator: Zh,
  validate: rD,
  _areEquals: tf
}, Symbol.toStringTag, { value: "Module" }));
/*!
 * https://github.com/Starcounter-Jack/JSON-Patch
 * (c) 2017-2021 Joachim Wester
 * MIT license
 */
var Wb = /* @__PURE__ */ new WeakMap(), i9 = function() {
  function e(t) {
    this.observers = /* @__PURE__ */ new Map(), this.obj = t;
  }
  return e;
}(), r9 = function() {
  function e(t, n) {
    this.callback = t, this.observer = n;
  }
  return e;
}();
function o9(e) {
  return Wb.get(e);
}
function a9(e, t) {
  return e.observers.get(t);
}
function s9(e, t) {
  e.observers.delete(t.callback);
}
function u9(e, t) {
  t.unobserve();
}
function l9(e, t) {
  var n = [], i, r = o9(e);
  if (!r)
    r = new i9(e), Wb.set(e, r);
  else {
    var o = a9(r, t);
    i = o && o.observer;
  }
  if (i)
    return i;
  if (i = {}, r.value = Gn(e), t) {
    i.callback = t, i.next = null;
    var a = function() {
      Cy(i);
    }, s = function() {
      clearTimeout(i.next), i.next = setTimeout(a);
    };
    typeof window < "u" && (window.addEventListener("mouseup", s), window.addEventListener("keyup", s), window.addEventListener("mousedown", s), window.addEventListener("keydown", s), window.addEventListener("change", s));
  }
  return i.patches = n, i.object = e, i.unobserve = function() {
    Cy(i), clearTimeout(i.next), s9(r, i), typeof window < "u" && (window.removeEventListener("mouseup", s), window.removeEventListener("keyup", s), window.removeEventListener("mousedown", s), window.removeEventListener("keydown", s), window.removeEventListener("change", s));
  }, r.observers.set(t, new r9(t, i)), i;
}
function Cy(e, t) {
  t === void 0 && (t = !1);
  var n = Wb.get(e.object);
  Gb(n.value, e.object, e.patches, "", t), e.patches.length && I0(n.value, e.patches);
  var i = e.patches;
  return i.length > 0 && (e.patches = [], e.callback && e.callback(i)), i;
}
function Gb(e, t, n, i, r) {
  if (t !== e) {
    typeof t.toJSON == "function" && (t = t.toJSON());
    for (var o = _y(t), a = _y(e), s = !1, u = a.length - 1; u >= 0; u--) {
      var l = a[u], c = e[l];
      if (Ay(t, l) && !(t[l] === void 0 && c !== void 0 && Array.isArray(t) === !1)) {
        var f = t[l];
        typeof c == "object" && c != null && typeof f == "object" && f != null && Array.isArray(c) === Array.isArray(f) ? Gb(c, f, n, i + "/" + Va(l), r) : c !== f && (r && n.push({ op: "test", path: i + "/" + Va(l), value: Gn(c) }), n.push({ op: "replace", path: i + "/" + Va(l), value: Gn(f) }));
      } else
        Array.isArray(e) === Array.isArray(t) ? (r && n.push({ op: "test", path: i + "/" + Va(l), value: Gn(c) }), n.push({ op: "remove", path: i + "/" + Va(l) }), s = !0) : (r && n.push({ op: "test", path: i, value: e }), n.push({ op: "replace", path: i, value: t }));
    }
    if (!(!s && o.length == a.length))
      for (var u = 0; u < o.length; u++) {
        var l = o[u];
        !Ay(e, l) && t[l] !== void 0 && n.push({ op: "add", path: i + "/" + Va(l), value: Gn(t[l]) });
      }
  }
}
function c9(e, t, n) {
  n === void 0 && (n = !1);
  var i = [];
  return Gb(e, t, i, "", n), i;
}
const f9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  unobserve: u9,
  observe: l9,
  generate: Cy,
  compare: c9
}, Symbol.toStringTag, { value: "Module" }));
Object.assign({}, n9, f9, {
  JsonPatchError: iD,
  deepClone: Gn,
  escapePathComponent: Va,
  unescapePathComponent: nD
});
var d9 = /("(?:[^\\"]|\\.)*")|[:,]/g, Hm = function(t, n) {
  var i, r, o;
  return n = n || {}, i = JSON.stringify(
    [1],
    void 0,
    n.indent === void 0 ? 2 : n.indent
  ).slice(2, -3), r = i === "" ? 1 / 0 : n.maxLength === void 0 ? 80 : n.maxLength, o = n.replacer, function a(s, u, l) {
    var c, f, d, h, g, p, m, y, v, b, x, E;
    if (s && typeof s.toJSON == "function" && (s = s.toJSON()), x = JSON.stringify(s, o), x === void 0)
      return x;
    if (m = r - u.length - l, x.length <= m && (v = x.replace(
      d9,
      function(A, w) {
        return w || A + " ";
      }
    ), v.length <= m))
      return v;
    if (o != null && (s = JSON.parse(x), o = void 0), typeof s == "object" && s !== null) {
      if (y = u + i, d = [], f = 0, Array.isArray(s))
        for (b = "[", c = "]", m = s.length; f < m; f++)
          d.push(
            a(s[f], y, f === m - 1 ? 0 : 1) || "null"
          );
      else
        for (b = "{", c = "}", p = Object.keys(s), m = p.length; f < m; f++)
          h = p[f], g = JSON.stringify(h) + ": ", E = a(
            s[h],
            y,
            g.length + (f === m - 1 ? 0 : 1)
          ), E !== void 0 && d.push(g + E);
      if (d.length > 0)
        return [b, i + d.join(`,
` + y), c].join(
          `
` + u
        );
    }
    return x;
  }(t, "", 0);
};
function In(e, t, n) {
  return e.fields = t || [], e.fname = n, e;
}
function ot(e) {
  return e == null ? null : e.fname;
}
function Yt(e) {
  return e == null ? null : e.fields;
}
function oD(e) {
  return e.length === 1 ? h9(e[0]) : g9(e);
}
const h9 = (e) => function(t) {
  return t[e];
}, g9 = (e) => {
  const t = e.length;
  return function(n) {
    for (let i = 0; i < t; ++i)
      n = n[e[i]];
    return n;
  };
};
function P(e) {
  throw Error(e);
}
function B0(e) {
  const t = [], n = e.length;
  let i = null, r = 0, o = "", a, s, u;
  e = e + "";
  function l() {
    t.push(o + e.substring(a, s)), o = "", a = s + 1;
  }
  for (a = s = 0; s < n; ++s)
    if (u = e[s], u === "\\")
      o += e.substring(a, s), o += e.substring(++s, ++s), a = s;
    else if (u === i)
      l(), i = null, r = -1;
    else {
      if (i)
        continue;
      a === r && u === '"' || a === r && u === "'" ? (a = s + 1, i = u) : u === "." && !r ? s > a ? l() : a = s + 1 : u === "[" ? (s > a && l(), r = a = s + 1) : u === "]" && (r || P("Access path missing open bracket: " + e), r > 0 && l(), r = 0, a = s + 1);
    }
  return r && P("Access path missing closing bracket: " + e), i && P("Access path missing closing quote: " + e), s > a && (s++, l()), t;
}
function Mn(e, t, n) {
  const i = B0(e);
  return e = i.length === 1 ? i[0] : e, In((n && n.get || oD)(i), [e], t || e);
}
const Pf = Mn("id"), mn = In((e) => e, [], "identity"), Lo = In(() => 0, [], "zero"), vl = In(() => 1, [], "one"), ci = In(() => !0, [], "true"), ko = In(() => !1, [], "false");
function p9(e, t, n) {
  const i = [t].concat([].slice.call(n));
  console[e].apply(console, i);
}
const aD = 0, Hb = 1, sD = 2, uD = 3, lD = 4;
function cD(e, t, n = p9) {
  let i = e || aD;
  return {
    level(r) {
      return arguments.length ? (i = +r, this) : i;
    },
    error() {
      return i >= Hb && n(t || "error", "ERROR", arguments), this;
    },
    warn() {
      return i >= sD && n(t || "warn", "WARN", arguments), this;
    },
    info() {
      return i >= uD && n(t || "log", "INFO", arguments), this;
    },
    debug() {
      return i >= lD && n(t || "log", "DEBUG", arguments), this;
    }
  };
}
var J = Array.isArray;
function ce(e) {
  return e === Object(e);
}
const k_ = (e) => e !== "__proto__";
function z0(...e) {
  return e.reduce((t, n) => {
    for (const i in n)
      if (i === "signals")
        t.signals = m9(t.signals, n.signals);
      else {
        const r = i === "legend" ? {
          layout: 1
        } : i === "style" ? !0 : null;
        U0(t, i, n[i], r);
      }
    return t;
  }, {});
}
function U0(e, t, n, i) {
  if (!k_(t))
    return;
  let r, o;
  if (ce(n) && !J(n)) {
    o = ce(e[t]) ? e[t] : e[t] = {};
    for (r in n)
      i && (i === !0 || i[r]) ? U0(o, r, n[r]) : k_(r) && (o[r] = n[r]);
  } else
    e[t] = n;
}
function m9(e, t) {
  if (e == null)
    return t;
  const n = {}, i = [];
  function r(o) {
    n[o.name] || (n[o.name] = 1, i.push(o));
  }
  return t.forEach(r), e.forEach(r), i;
}
function xe(e) {
  return e[e.length - 1];
}
function Wt(e) {
  return e == null || e === "" ? null : +e;
}
const fD = (e) => (t) => e * Math.exp(t), dD = (e) => (t) => Math.log(e * t), hD = (e) => (t) => Math.sign(t) * Math.log1p(Math.abs(t / e)), gD = (e) => (t) => Math.sign(t) * Math.expm1(Math.abs(t)) * e, eg = (e) => (t) => t < 0 ? -Math.pow(-t, e) : Math.pow(t, e);
function q0(e, t, n, i) {
  const r = n(e[0]), o = n(xe(e)), a = (o - r) * t;
  return [i(r - a), i(o - a)];
}
function pD(e, t) {
  return q0(e, t, Wt, mn);
}
function mD(e, t) {
  var n = Math.sign(e[0]);
  return q0(e, t, dD(n), fD(n));
}
function yD(e, t, n) {
  return q0(e, t, eg(n), eg(1 / n));
}
function vD(e, t, n) {
  return q0(e, t, hD(n), gD(n));
}
function W0(e, t, n, i, r) {
  const o = i(e[0]), a = i(xe(e)), s = t != null ? i(t) : (o + a) / 2;
  return [r(s + (o - s) * n), r(s + (a - s) * n)];
}
function Yb(e, t, n) {
  return W0(e, t, n, Wt, mn);
}
function Xb(e, t, n) {
  const i = Math.sign(e[0]);
  return W0(e, t, n, dD(i), fD(i));
}
function tg(e, t, n, i) {
  return W0(e, t, n, eg(i), eg(1 / i));
}
function Vb(e, t, n, i) {
  return W0(e, t, n, hD(i), gD(i));
}
function bD(e) {
  return 1 + ~~(new Date(e).getMonth() / 3);
}
function xD(e) {
  return 1 + ~~(new Date(e).getUTCMonth() / 3);
}
function oe(e) {
  return e != null ? J(e) ? e : [e] : [];
}
function wD(e, t, n) {
  let i = e[0], r = e[1], o;
  return r < i && (o = r, r = i, i = o), o = r - i, o >= n - t ? [t, n] : [i = Math.min(Math.max(i, t), n - o), i + o];
}
function he(e) {
  return typeof e == "function";
}
const y9 = "descending";
function Kb(e, t, n) {
  n = n || {}, t = oe(t) || [];
  const i = [], r = [], o = {}, a = n.comparator || v9;
  return oe(e).forEach((s, u) => {
    s != null && (i.push(t[u] === y9 ? -1 : 1), r.push(s = he(s) ? s : Mn(s, null, n)), (Yt(s) || []).forEach((l) => o[l] = 1));
  }), r.length === 0 ? null : In(a(r, i), Object.keys(o));
}
const G0 = (e, t) => (e < t || e == null) && t != null ? -1 : (e > t || t == null) && e != null ? 1 : (t = t instanceof Date ? +t : t, (e = e instanceof Date ? +e : e) !== e && t === t ? -1 : t !== t && e === e ? 1 : 0), v9 = (e, t) => e.length === 1 ? b9(e[0], t[0]) : x9(e, t, e.length), b9 = (e, t) => function(n, i) {
  return G0(e(n), e(i)) * t;
}, x9 = (e, t, n) => (t.push(0), function(i, r) {
  let o, a = 0, s = -1;
  for (; a === 0 && ++s < n; )
    o = e[s], a = G0(o(i), o(r));
  return a * t[s];
});
function Zt(e) {
  return he(e) ? e : () => e;
}
function Jb(e, t) {
  let n;
  return (i) => {
    n && clearTimeout(n), n = setTimeout(() => (t(i), n = null), e);
  };
}
function de(e) {
  for (let t, n, i = 1, r = arguments.length; i < r; ++i) {
    t = arguments[i];
    for (n in t)
      e[n] = t[n];
  }
  return e;
}
function vr(e, t) {
  let n = 0, i, r, o, a;
  if (e && (i = e.length))
    if (t == null) {
      for (r = e[n]; n < i && (r == null || r !== r); r = e[++n])
        ;
      for (o = a = r; n < i; ++n)
        r = e[n], r != null && (r < o && (o = r), r > a && (a = r));
    } else {
      for (r = t(e[n]); n < i && (r == null || r !== r); r = t(e[++n]))
        ;
      for (o = a = r; n < i; ++n)
        r = t(e[n]), r != null && (r < o && (o = r), r > a && (a = r));
    }
  return [o, a];
}
function ED(e, t) {
  const n = e.length;
  let i = -1, r, o, a, s, u;
  if (t == null) {
    for (; ++i < n; )
      if (o = e[i], o != null && o >= o) {
        r = a = o;
        break;
      }
    if (i === n)
      return [-1, -1];
    for (s = u = i; ++i < n; )
      o = e[i], o != null && (r > o && (r = o, s = i), a < o && (a = o, u = i));
  } else {
    for (; ++i < n; )
      if (o = t(e[i], i, e), o != null && o >= o) {
        r = a = o;
        break;
      }
    if (i === n)
      return [-1, -1];
    for (s = u = i; ++i < n; )
      o = t(e[i], i, e), o != null && (r > o && (r = o, s = i), a < o && (a = o, u = i));
  }
  return [s, u];
}
const w9 = Object.prototype.hasOwnProperty;
function ae(e, t) {
  return w9.call(e, t);
}
const Rd = {};
function bl(e) {
  let t = {}, n;
  function i(o) {
    return ae(t, o) && t[o] !== Rd;
  }
  const r = {
    size: 0,
    empty: 0,
    object: t,
    has: i,
    get(o) {
      return i(o) ? t[o] : void 0;
    },
    set(o, a) {
      return i(o) || (++r.size, t[o] === Rd && --r.empty), t[o] = a, this;
    },
    delete(o) {
      return i(o) && (--r.size, ++r.empty, t[o] = Rd), this;
    },
    clear() {
      r.size = r.empty = 0, r.object = t = {};
    },
    test(o) {
      return arguments.length ? (n = o, r) : n;
    },
    clean() {
      const o = {};
      let a = 0;
      for (const s in t) {
        const u = t[s];
        u !== Rd && (!n || !n(u)) && (o[s] = u, ++a);
      }
      r.size = a, r.empty = 0, r.object = t = o;
    }
  };
  return e && Object.keys(e).forEach((o) => {
    r.set(o, e[o]);
  }), r;
}
function AD(e, t, n, i, r, o) {
  if (!n && n !== 0)
    return o;
  const a = +n;
  let s = e[0], u = xe(e), l;
  u < s && (l = s, s = u, u = l), l = Math.abs(t - s);
  const c = Math.abs(u - t);
  return l < c && l <= a ? i : c <= a ? r : o;
}
function q(e, t, n) {
  const i = e.prototype = Object.create(t.prototype);
  return Object.defineProperty(i, "constructor", {
    value: e,
    writable: !0,
    enumerable: !0,
    configurable: !0
  }), de(i, n);
}
function Au(e, t, n, i) {
  let r = t[0], o = t[t.length - 1], a;
  return r > o && (a = r, r = o, o = a), n = n === void 0 || n, i = i === void 0 || i, (n ? r <= e : r < e) && (i ? e <= o : e < o);
}
function Qb(e) {
  return typeof e == "boolean";
}
function Vo(e) {
  return Object.prototype.toString.call(e) === "[object Date]";
}
function _D(e) {
  return e && he(e[Symbol.iterator]);
}
function na(e) {
  return typeof e == "number";
}
function OD(e) {
  return Object.prototype.toString.call(e) === "[object RegExp]";
}
function je(e) {
  return typeof e == "string";
}
function Zb(e, t, n) {
  e && (e = t ? oe(e).map((s) => s.replace(/\\(.)/g, "$1")) : oe(e));
  const i = e && e.length, r = n && n.get || oD, o = (s) => r(t ? [s] : B0(s));
  let a;
  if (!i)
    a = function() {
      return "";
    };
  else if (i === 1) {
    const s = o(e[0]);
    a = function(u) {
      return "" + s(u);
    };
  } else {
    const s = e.map(o);
    a = function(u) {
      let l = "" + s[0](u), c = 0;
      for (; ++c < i; )
        l += "|" + s[c](u);
      return l;
    };
  }
  return In(a, e, "key");
}
function SD(e, t) {
  const n = e[0], i = xe(e), r = +t;
  return r ? r === 1 ? i : n + r * (i - n) : n;
}
const E9 = 1e4;
function CD(e) {
  e = +e || E9;
  let t, n, i;
  const r = () => {
    t = {}, n = {}, i = 0;
  }, o = (a, s) => (++i > e && (n = t, t = {}, i = 1), t[a] = s);
  return r(), {
    clear: r,
    has: (a) => ae(t, a) || ae(n, a),
    get: (a) => ae(t, a) ? t[a] : ae(n, a) ? o(a, n[a]) : void 0,
    set: (a, s) => ae(t, a) ? t[a] = s : o(a, s)
  };
}
function FD(e, t, n, i) {
  const r = t.length, o = n.length;
  if (!o)
    return t;
  if (!r)
    return n;
  const a = i || new t.constructor(r + o);
  let s = 0, u = 0, l = 0;
  for (; s < r && u < o; ++l)
    a[l] = e(t[s], n[u]) > 0 ? n[u++] : t[s++];
  for (; s < r; ++s, ++l)
    a[l] = t[s];
  for (; u < o; ++u, ++l)
    a[l] = n[u];
  return a;
}
function gc(e, t) {
  let n = "";
  for (; --t >= 0; )
    n += e;
  return n;
}
function kD(e, t, n, i) {
  const r = n || " ", o = e + "", a = t - o.length;
  return a <= 0 ? o : i === "left" ? gc(r, a) + o : i === "center" ? gc(r, ~~(a / 2)) + o + gc(r, Math.ceil(a / 2)) : o + gc(r, a);
}
function Lf(e) {
  return e && xe(e) - e[0] || 0;
}
function te(e) {
  return J(e) ? "[" + e.map(te) + "]" : ce(e) || je(e) ? JSON.stringify(e).replace("\u2028", "\\u2028").replace("\u2029", "\\u2029") : e;
}
function ex(e) {
  return e == null || e === "" ? null : !e || e === "false" || e === "0" ? !1 : !!e;
}
const A9 = (e) => na(e) || Vo(e) ? e : Date.parse(e);
function tx(e, t) {
  return t = t || A9, e == null || e === "" ? null : t(e);
}
function nx(e) {
  return e == null || e === "" ? null : e + "";
}
function zi(e) {
  const t = {}, n = e.length;
  for (let i = 0; i < n; ++i)
    t[e[i]] = !0;
  return t;
}
function DD(e, t, n, i) {
  const r = i != null ? i : "\u2026", o = e + "", a = o.length, s = Math.max(0, t - r.length);
  return a <= t ? o : n === "left" ? r + o.slice(a - s) : n === "center" ? o.slice(0, Math.ceil(s / 2)) + r + o.slice(a - ~~(s / 2)) : o.slice(0, s) + r;
}
function Mo(e, t, n) {
  if (e)
    if (t) {
      const i = e.length;
      for (let r = 0; r < i; ++r) {
        const o = t(e[r]);
        o && n(o, r, e);
      }
    } else
      e.forEach(n);
}
var D_ = {}, Ym = {}, Xm = 34, Wl = 10, Vm = 13;
function $D(e) {
  return new Function("d", "return {" + e.map(function(t, n) {
    return JSON.stringify(t) + ": d[" + n + '] || ""';
  }).join(",") + "}");
}
function _9(e, t) {
  var n = $D(e);
  return function(i, r) {
    return t(n(i), r, e);
  };
}
function $_(e) {
  var t = /* @__PURE__ */ Object.create(null), n = [];
  return e.forEach(function(i) {
    for (var r in i)
      r in t || n.push(t[r] = r);
  }), n;
}
function An(e, t) {
  var n = e + "", i = n.length;
  return i < t ? new Array(t - i + 1).join(0) + n : n;
}
function O9(e) {
  return e < 0 ? "-" + An(-e, 6) : e > 9999 ? "+" + An(e, 6) : An(e, 4);
}
function S9(e) {
  var t = e.getUTCHours(), n = e.getUTCMinutes(), i = e.getUTCSeconds(), r = e.getUTCMilliseconds();
  return isNaN(e) ? "Invalid Date" : O9(e.getUTCFullYear()) + "-" + An(e.getUTCMonth() + 1, 2) + "-" + An(e.getUTCDate(), 2) + (r ? "T" + An(t, 2) + ":" + An(n, 2) + ":" + An(i, 2) + "." + An(r, 3) + "Z" : i ? "T" + An(t, 2) + ":" + An(n, 2) + ":" + An(i, 2) + "Z" : n || t ? "T" + An(t, 2) + ":" + An(n, 2) + "Z" : "");
}
function C9(e) {
  var t = new RegExp('["' + e + `
\r]`), n = e.charCodeAt(0);
  function i(f, d) {
    var h, g, p = r(f, function(m, y) {
      if (h)
        return h(m, y - 1);
      g = m, h = d ? _9(m, d) : $D(m);
    });
    return p.columns = g || [], p;
  }
  function r(f, d) {
    var h = [], g = f.length, p = 0, m = 0, y, v = g <= 0, b = !1;
    f.charCodeAt(g - 1) === Wl && --g, f.charCodeAt(g - 1) === Vm && --g;
    function x() {
      if (v)
        return Ym;
      if (b)
        return b = !1, D_;
      var A, w = p, _;
      if (f.charCodeAt(w) === Xm) {
        for (; p++ < g && f.charCodeAt(p) !== Xm || f.charCodeAt(++p) === Xm; )
          ;
        return (A = p) >= g ? v = !0 : (_ = f.charCodeAt(p++)) === Wl ? b = !0 : _ === Vm && (b = !0, f.charCodeAt(p) === Wl && ++p), f.slice(w + 1, A - 1).replace(/""/g, '"');
      }
      for (; p < g; ) {
        if ((_ = f.charCodeAt(A = p++)) === Wl)
          b = !0;
        else if (_ === Vm)
          b = !0, f.charCodeAt(p) === Wl && ++p;
        else if (_ !== n)
          continue;
        return f.slice(w, A);
      }
      return v = !0, f.slice(w, g);
    }
    for (; (y = x()) !== Ym; ) {
      for (var E = []; y !== D_ && y !== Ym; )
        E.push(y), y = x();
      d && (E = d(E, m++)) == null || h.push(E);
    }
    return h;
  }
  function o(f, d) {
    return f.map(function(h) {
      return d.map(function(g) {
        return c(h[g]);
      }).join(e);
    });
  }
  function a(f, d) {
    return d == null && (d = $_(f)), [d.map(c).join(e)].concat(o(f, d)).join(`
`);
  }
  function s(f, d) {
    return d == null && (d = $_(f)), o(f, d).join(`
`);
  }
  function u(f) {
    return f.map(l).join(`
`);
  }
  function l(f) {
    return f.map(c).join(e);
  }
  function c(f) {
    return f == null ? "" : f instanceof Date ? S9(f) : t.test(f += "") ? '"' + f.replace(/"/g, '""') + '"' : f;
  }
  return {
    parse: i,
    parseRows: r,
    format: a,
    formatBody: s,
    formatRows: u,
    formatRow: l,
    formatValue: c
  };
}
function F9(e) {
  return e;
}
function k9(e) {
  if (e == null)
    return F9;
  var t, n, i = e.scale[0], r = e.scale[1], o = e.translate[0], a = e.translate[1];
  return function(s, u) {
    u || (t = n = 0);
    var l = 2, c = s.length, f = new Array(c);
    for (f[0] = (t += s[0]) * i + o, f[1] = (n += s[1]) * r + a; l < c; )
      f[l] = s[l], ++l;
    return f;
  };
}
function D9(e, t) {
  for (var n, i = e.length, r = i - t; r < --i; )
    n = e[r], e[r++] = e[i], e[i] = n;
}
function $9(e, t) {
  return typeof t == "string" && (t = e.objects[t]), t.type === "GeometryCollection" ? { type: "FeatureCollection", features: t.geometries.map(function(n) {
    return M_(e, n);
  }) } : M_(e, t);
}
function M_(e, t) {
  var n = t.id, i = t.bbox, r = t.properties == null ? {} : t.properties, o = MD(e, t);
  return n == null && i == null ? { type: "Feature", properties: r, geometry: o } : i == null ? { type: "Feature", id: n, properties: r, geometry: o } : { type: "Feature", id: n, bbox: i, properties: r, geometry: o };
}
function MD(e, t) {
  var n = k9(e.transform), i = e.arcs;
  function r(c, f) {
    f.length && f.pop();
    for (var d = i[c < 0 ? ~c : c], h = 0, g = d.length; h < g; ++h)
      f.push(n(d[h], h));
    c < 0 && D9(f, g);
  }
  function o(c) {
    return n(c);
  }
  function a(c) {
    for (var f = [], d = 0, h = c.length; d < h; ++d)
      r(c[d], f);
    return f.length < 2 && f.push(f[0]), f;
  }
  function s(c) {
    for (var f = a(c); f.length < 4; )
      f.push(f[0]);
    return f;
  }
  function u(c) {
    return c.map(s);
  }
  function l(c) {
    var f = c.type, d;
    switch (f) {
      case "GeometryCollection":
        return { type: f, geometries: c.geometries.map(l) };
      case "Point":
        d = o(c.coordinates);
        break;
      case "MultiPoint":
        d = c.coordinates.map(o);
        break;
      case "LineString":
        d = a(c.arcs);
        break;
      case "MultiLineString":
        d = c.arcs.map(a);
        break;
      case "Polygon":
        d = u(c.arcs);
        break;
      case "MultiPolygon":
        d = c.arcs.map(u);
        break;
      default:
        return null;
    }
    return { type: f, coordinates: d };
  }
  return l(t);
}
function M9(e, t) {
  var n = {}, i = {}, r = {}, o = [], a = -1;
  t.forEach(function(l, c) {
    var f = e.arcs[l < 0 ? ~l : l], d;
    f.length < 3 && !f[1][0] && !f[1][1] && (d = t[++a], t[a] = l, t[c] = d);
  }), t.forEach(function(l) {
    var c = s(l), f = c[0], d = c[1], h, g;
    if (h = r[f])
      if (delete r[h.end], h.push(l), h.end = d, g = i[d]) {
        delete i[g.start];
        var p = g === h ? h : h.concat(g);
        i[p.start = h.start] = r[p.end = g.end] = p;
      } else
        i[h.start] = r[h.end] = h;
    else if (h = i[d])
      if (delete i[h.start], h.unshift(l), h.start = f, g = r[f]) {
        delete r[g.end];
        var m = g === h ? h : g.concat(h);
        i[m.start = g.start] = r[m.end = h.end] = m;
      } else
        i[h.start] = r[h.end] = h;
    else
      h = [l], i[h.start = f] = r[h.end = d] = h;
  });
  function s(l) {
    var c = e.arcs[l < 0 ? ~l : l], f = c[0], d;
    return e.transform ? (d = [0, 0], c.forEach(function(h) {
      d[0] += h[0], d[1] += h[1];
    })) : d = c[c.length - 1], l < 0 ? [d, f] : [f, d];
  }
  function u(l, c) {
    for (var f in l) {
      var d = l[f];
      delete c[d.start], delete d.start, delete d.end, d.forEach(function(h) {
        n[h < 0 ? ~h : h] = 1;
      }), o.push(d);
    }
  }
  return u(r, i), u(i, r), t.forEach(function(l) {
    n[l < 0 ? ~l : l] || o.push([l]);
  }), o;
}
function T9(e) {
  return MD(e, N9.apply(this, arguments));
}
function N9(e, t, n) {
  var i, r, o;
  if (arguments.length > 1)
    i = R9(e, t, n);
  else
    for (r = 0, i = new Array(o = e.arcs.length); r < o; ++r)
      i[r] = r;
  return { type: "MultiLineString", arcs: M9(e, i) };
}
function R9(e, t, n) {
  var i = [], r = [], o;
  function a(f) {
    var d = f < 0 ? ~f : f;
    (r[d] || (r[d] = [])).push({ i: f, g: o });
  }
  function s(f) {
    f.forEach(a);
  }
  function u(f) {
    f.forEach(s);
  }
  function l(f) {
    f.forEach(u);
  }
  function c(f) {
    switch (o = f, f.type) {
      case "GeometryCollection":
        f.geometries.forEach(c);
        break;
      case "LineString":
        s(f.arcs);
        break;
      case "MultiLineString":
      case "Polygon":
        u(f.arcs);
        break;
      case "MultiPolygon":
        l(f.arcs);
        break;
    }
  }
  return c(t), r.forEach(n == null ? function(f) {
    i.push(f[0].i);
  } : function(f) {
    n(f[0].g, f[f.length - 1].g) && i.push(f[0].i);
  }), i;
}
function io(e, t) {
  return e == null || t == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function j9(e, t) {
  return e == null || t == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function If(e) {
  let t, n, i;
  e.length !== 2 ? (t = io, n = (s, u) => io(e(s), u), i = (s, u) => e(s) - u) : (t = e === io || e === j9 ? e : P9, n = e, i = e);
  function r(s, u, l = 0, c = s.length) {
    if (l < c) {
      if (t(u, u) !== 0)
        return c;
      do {
        const f = l + c >>> 1;
        n(s[f], u) < 0 ? l = f + 1 : c = f;
      } while (l < c);
    }
    return l;
  }
  function o(s, u, l = 0, c = s.length) {
    if (l < c) {
      if (t(u, u) !== 0)
        return c;
      do {
        const f = l + c >>> 1;
        n(s[f], u) <= 0 ? l = f + 1 : c = f;
      } while (l < c);
    }
    return l;
  }
  function a(s, u, l = 0, c = s.length) {
    const f = r(s, u, l, c - 1);
    return f > l && i(s[f - 1], u) > -i(s[f], u) ? f - 1 : f;
  }
  return { left: r, center: a, right: o };
}
function P9() {
  return 0;
}
function TD(e) {
  return e === null ? NaN : +e;
}
function* L9(e, t) {
  if (t === void 0)
    for (let n of e)
      n != null && (n = +n) >= n && (yield n);
  else {
    let n = -1;
    for (let i of e)
      (i = t(i, ++n, e)) != null && (i = +i) >= i && (yield i);
  }
}
const ND = If(io), ng = ND.right, I9 = ND.left;
If(TD).center;
const Bf = ng;
function B9(e, t) {
  let n = 0, i, r = 0, o = 0;
  if (t === void 0)
    for (let a of e)
      a != null && (a = +a) >= a && (i = a - r, r += i / ++n, o += i * (a - r));
  else {
    let a = -1;
    for (let s of e)
      (s = t(s, ++a, e)) != null && (s = +s) >= s && (i = s - r, r += i / ++n, o += i * (s - r));
  }
  if (n > 1)
    return o / (n - 1);
}
function z9(e, t) {
  const n = B9(e, t);
  return n && Math.sqrt(n);
}
class gn {
  constructor() {
    this._partials = new Float64Array(32), this._n = 0;
  }
  add(t) {
    const n = this._partials;
    let i = 0;
    for (let r = 0; r < this._n && r < 32; r++) {
      const o = n[r], a = t + o, s = Math.abs(t) < Math.abs(o) ? t - (a - o) : o - (a - t);
      s && (n[i++] = s), t = a;
    }
    return n[i] = t, this._n = i + 1, this;
  }
  valueOf() {
    const t = this._partials;
    let n = this._n, i, r, o, a = 0;
    if (n > 0) {
      for (a = t[--n]; n > 0 && (i = a, r = t[--n], a = i + r, o = r - (a - i), !o); )
        ;
      n > 0 && (o < 0 && t[n - 1] < 0 || o > 0 && t[n - 1] > 0) && (r = o * 2, i = a + r, r == i - a && (a = i));
    }
    return a;
  }
}
class T_ extends Map {
  constructor(t, n = PD) {
    if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: n } }), t != null)
      for (const [i, r] of t)
        this.set(i, r);
  }
  get(t) {
    return super.get(Fy(this, t));
  }
  has(t) {
    return super.has(Fy(this, t));
  }
  set(t, n) {
    return super.set(RD(this, t), n);
  }
  delete(t) {
    return super.delete(jD(this, t));
  }
}
class ig extends Set {
  constructor(t, n = PD) {
    if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: n } }), t != null)
      for (const i of t)
        this.add(i);
  }
  has(t) {
    return super.has(Fy(this, t));
  }
  add(t) {
    return super.add(RD(this, t));
  }
  delete(t) {
    return super.delete(jD(this, t));
  }
}
function Fy({ _intern: e, _key: t }, n) {
  const i = t(n);
  return e.has(i) ? e.get(i) : n;
}
function RD({ _intern: e, _key: t }, n) {
  const i = t(n);
  return e.has(i) ? e.get(i) : (e.set(i, n), n);
}
function jD({ _intern: e, _key: t }, n) {
  const i = t(n);
  return e.has(i) && (n = e.get(i), e.delete(i)), n;
}
function PD(e) {
  return e !== null && typeof e == "object" ? e.valueOf() : e;
}
function U9(e, t) {
  return Array.from(t, (n) => e[n]);
}
function q9(e = io) {
  if (e === io)
    return LD;
  if (typeof e != "function")
    throw new TypeError("compare is not a function");
  return (t, n) => {
    const i = e(t, n);
    return i || i === 0 ? i : (e(n, n) === 0) - (e(t, t) === 0);
  };
}
function LD(e, t) {
  return (e == null || !(e >= e)) - (t == null || !(t >= t)) || (e < t ? -1 : e > t ? 1 : 0);
}
var ky = Math.sqrt(50), Dy = Math.sqrt(10), $y = Math.sqrt(2);
function My(e, t, n) {
  var i, r = -1, o, a, s;
  if (t = +t, e = +e, n = +n, e === t && n > 0)
    return [e];
  if ((i = t < e) && (o = e, e = t, t = o), (s = ID(e, t, n)) === 0 || !isFinite(s))
    return [];
  if (s > 0) {
    let u = Math.round(e / s), l = Math.round(t / s);
    for (u * s < e && ++u, l * s > t && --l, a = new Array(o = l - u + 1); ++r < o; )
      a[r] = (u + r) * s;
  } else {
    s = -s;
    let u = Math.round(e * s), l = Math.round(t * s);
    for (u / s < e && ++u, l / s > t && --l, a = new Array(o = l - u + 1); ++r < o; )
      a[r] = (u + r) / s;
  }
  return i && a.reverse(), a;
}
function ID(e, t, n) {
  var i = (t - e) / Math.max(0, n), r = Math.floor(Math.log(i) / Math.LN10), o = i / Math.pow(10, r);
  return r >= 0 ? (o >= ky ? 10 : o >= Dy ? 5 : o >= $y ? 2 : 1) * Math.pow(10, r) : -Math.pow(10, -r) / (o >= ky ? 10 : o >= Dy ? 5 : o >= $y ? 2 : 1);
}
function ia(e, t, n) {
  var i = Math.abs(t - e) / Math.max(0, n), r = Math.pow(10, Math.floor(Math.log(i) / Math.LN10)), o = i / r;
  return o >= ky ? r *= 10 : o >= Dy ? r *= 5 : o >= $y && (r *= 2), t < e ? -r : r;
}
function fs(e, t) {
  let n;
  if (t === void 0)
    for (const i of e)
      i != null && (n < i || n === void 0 && i >= i) && (n = i);
  else {
    let i = -1;
    for (let r of e)
      (r = t(r, ++i, e)) != null && (n < r || n === void 0 && r >= r) && (n = r);
  }
  return n;
}
function Ty(e, t) {
  let n;
  if (t === void 0)
    for (const i of e)
      i != null && (n > i || n === void 0 && i >= i) && (n = i);
  else {
    let i = -1;
    for (let r of e)
      (r = t(r, ++i, e)) != null && (n > r || n === void 0 && r >= r) && (n = r);
  }
  return n;
}
function BD(e, t, n = 0, i = e.length - 1, r) {
  for (r = r === void 0 ? LD : q9(r); i > n; ) {
    if (i - n > 600) {
      const u = i - n + 1, l = t - n + 1, c = Math.log(u), f = 0.5 * Math.exp(2 * c / 3), d = 0.5 * Math.sqrt(c * f * (u - f) / u) * (l - u / 2 < 0 ? -1 : 1), h = Math.max(n, Math.floor(t - l * f / u + d)), g = Math.min(i, Math.floor(t + (u - l) * f / u + d));
      BD(e, t, h, g, r);
    }
    const o = e[t];
    let a = n, s = i;
    for (Gl(e, n, t), r(e[i], o) > 0 && Gl(e, n, i); a < s; ) {
      for (Gl(e, a, s), ++a, --s; r(e[a], o) < 0; )
        ++a;
      for (; r(e[s], o) > 0; )
        --s;
    }
    r(e[n], o) === 0 ? Gl(e, n, s) : (++s, Gl(e, s, i)), s <= t && (n = s + 1), t <= s && (i = s - 1);
  }
  return e;
}
function Gl(e, t, n) {
  const i = e[t];
  e[t] = e[n], e[n] = i;
}
function Ny(e, t, n) {
  if (e = Float64Array.from(L9(e, n)), !!(i = e.length)) {
    if ((t = +t) <= 0 || i < 2)
      return Ty(e);
    if (t >= 1)
      return fs(e);
    var i, r = (i - 1) * t, o = Math.floor(r), a = fs(BD(e, o).subarray(0, o + 1)), s = Ty(e.subarray(o + 1));
    return a + (s - a) * (r - o);
  }
}
function zD(e, t, n = TD) {
  if (!!(i = e.length)) {
    if ((t = +t) <= 0 || i < 2)
      return +n(e[0], 0, e);
    if (t >= 1)
      return +n(e[i - 1], i - 1, e);
    var i, r = (i - 1) * t, o = Math.floor(r), a = +n(e[o], o, e), s = +n(e[o + 1], o + 1, e);
    return a + (s - a) * (r - o);
  }
}
function W9(e, t) {
  let n = 0, i = 0;
  if (t === void 0)
    for (let r of e)
      r != null && (r = +r) >= r && (++n, i += r);
  else {
    let r = -1;
    for (let o of e)
      (o = t(o, ++r, e)) != null && (o = +o) >= o && (++n, i += o);
  }
  if (n)
    return i / n;
}
function UD(e, t) {
  return Ny(e, 0.5, t);
}
function* G9(e) {
  for (const t of e)
    yield* t;
}
function qD(e) {
  return Array.from(G9(e));
}
function Hn(e, t, n) {
  e = +e, t = +t, n = (r = arguments.length) < 2 ? (t = e, e = 0, 1) : r < 3 ? 1 : +n;
  for (var i = -1, r = Math.max(0, Math.ceil((t - e) / n)) | 0, o = new Array(r); ++i < r; )
    o[i] = e + i * n;
  return o;
}
function WD(e, t) {
  let n = 0;
  if (t === void 0)
    for (let i of e)
      (i = +i) && (n += i);
  else {
    let i = -1;
    for (let r of e)
      (r = +t(r, ++i, e)) && (n += r);
  }
  return n;
}
function H9(e) {
  return Math.abs(e = Math.round(e)) >= 1e21 ? e.toLocaleString("en").replace(/,/g, "") : e.toString(10);
}
function rg(e, t) {
  if ((n = (e = t ? e.toExponential(t - 1) : e.toExponential()).indexOf("e")) < 0)
    return null;
  var n, i = e.slice(0, n);
  return [
    i.length > 1 ? i[0] + i.slice(2) : i,
    +e.slice(n + 1)
  ];
}
function Bu(e) {
  return e = rg(Math.abs(e)), e ? e[1] : NaN;
}
function Y9(e, t) {
  return function(n, i) {
    for (var r = n.length, o = [], a = 0, s = e[0], u = 0; r > 0 && s > 0 && (u + s + 1 > i && (s = Math.max(1, i - u)), o.push(n.substring(r -= s, r + s)), !((u += s + 1) > i)); )
      s = e[a = (a + 1) % e.length];
    return o.reverse().join(t);
  };
}
function X9(e) {
  return function(t) {
    return t.replace(/[0-9]/g, function(n) {
      return e[+n];
    });
  };
}
var V9 = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function xs(e) {
  if (!(t = V9.exec(e)))
    throw new Error("invalid format: " + e);
  var t;
  return new ix({
    fill: t[1],
    align: t[2],
    sign: t[3],
    symbol: t[4],
    zero: t[5],
    width: t[6],
    comma: t[7],
    precision: t[8] && t[8].slice(1),
    trim: t[9],
    type: t[10]
  });
}
xs.prototype = ix.prototype;
function ix(e) {
  this.fill = e.fill === void 0 ? " " : e.fill + "", this.align = e.align === void 0 ? ">" : e.align + "", this.sign = e.sign === void 0 ? "-" : e.sign + "", this.symbol = e.symbol === void 0 ? "" : e.symbol + "", this.zero = !!e.zero, this.width = e.width === void 0 ? void 0 : +e.width, this.comma = !!e.comma, this.precision = e.precision === void 0 ? void 0 : +e.precision, this.trim = !!e.trim, this.type = e.type === void 0 ? "" : e.type + "";
}
ix.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 K9(e) {
  e:
    for (var t = e.length, n = 1, i = -1, r; n < t; ++n)
      switch (e[n]) {
        case ".":
          i = r = n;
          break;
        case "0":
          i === 0 && (i = n), r = n;
          break;
        default:
          if (!+e[n])
            break e;
          i > 0 && (i = 0);
          break;
      }
  return i > 0 ? e.slice(0, i) + e.slice(r + 1) : e;
}
var GD;
function J9(e, t) {
  var n = rg(e, t);
  if (!n)
    return e + "";
  var i = n[0], r = n[1], o = r - (GD = Math.max(-8, Math.min(8, Math.floor(r / 3))) * 3) + 1, a = i.length;
  return o === a ? i : o > a ? i + new Array(o - a + 1).join("0") : o > 0 ? i.slice(0, o) + "." + i.slice(o) : "0." + new Array(1 - o).join("0") + rg(e, Math.max(0, t + o - 1))[0];
}
function N_(e, t) {
  var n = rg(e, t);
  if (!n)
    return e + "";
  var i = n[0], r = n[1];
  return r < 0 ? "0." + new Array(-r).join("0") + i : i.length > r + 1 ? i.slice(0, r + 1) + "." + i.slice(r + 1) : i + new Array(r - i.length + 2).join("0");
}
const R_ = {
  "%": (e, t) => (e * 100).toFixed(t),
  b: (e) => Math.round(e).toString(2),
  c: (e) => e + "",
  d: H9,
  e: (e, t) => e.toExponential(t),
  f: (e, t) => e.toFixed(t),
  g: (e, t) => e.toPrecision(t),
  o: (e) => Math.round(e).toString(8),
  p: (e, t) => N_(e * 100, t),
  r: N_,
  s: J9,
  X: (e) => Math.round(e).toString(16).toUpperCase(),
  x: (e) => Math.round(e).toString(16)
};
function j_(e) {
  return e;
}
var P_ = Array.prototype.map, L_ = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
function HD(e) {
  var t = e.grouping === void 0 || e.thousands === void 0 ? j_ : Y9(P_.call(e.grouping, Number), e.thousands + ""), n = e.currency === void 0 ? "" : e.currency[0] + "", i = e.currency === void 0 ? "" : e.currency[1] + "", r = e.decimal === void 0 ? "." : e.decimal + "", o = e.numerals === void 0 ? j_ : X9(P_.call(e.numerals, String)), a = e.percent === void 0 ? "%" : e.percent + "", s = e.minus === void 0 ? "\u2212" : e.minus + "", u = e.nan === void 0 ? "NaN" : e.nan + "";
  function l(f) {
    f = xs(f);
    var d = f.fill, h = f.align, g = f.sign, p = f.symbol, m = f.zero, y = f.width, v = f.comma, b = f.precision, x = f.trim, E = f.type;
    E === "n" ? (v = !0, E = "g") : R_[E] || (b === void 0 && (b = 12), x = !0, E = "g"), (m || d === "0" && h === "=") && (m = !0, d = "0", h = "=");
    var A = p === "$" ? n : p === "#" && /[boxX]/.test(E) ? "0" + E.toLowerCase() : "", w = p === "$" ? i : /[%p]/.test(E) ? a : "", _ = R_[E], k = /[defgprs%]/.test(E);
    b = b === void 0 ? 6 : /[gprs]/.test(E) ? Math.max(1, Math.min(21, b)) : Math.max(0, Math.min(20, b));
    function C(O) {
      var S = A, D = w, M, F, $;
      if (E === "c")
        D = _(O) + D, O = "";
      else {
        O = +O;
        var T = O < 0 || 1 / O < 0;
        if (O = isNaN(O) ? u : _(Math.abs(O), b), x && (O = K9(O)), T && +O == 0 && g !== "+" && (T = !1), S = (T ? g === "(" ? g : s : g === "-" || g === "(" ? "" : g) + S, D = (E === "s" ? L_[8 + GD / 3] : "") + D + (T && g === "(" ? ")" : ""), k) {
          for (M = -1, F = O.length; ++M < F; )
            if ($ = O.charCodeAt(M), 48 > $ || $ > 57) {
              D = ($ === 46 ? r + O.slice(M + 1) : O.slice(M)) + D, O = O.slice(0, M);
              break;
            }
        }
      }
      v && !m && (O = t(O, 1 / 0));
      var L = S.length + O.length + D.length, I = L < y ? new Array(y - L + 1).join(d) : "";
      switch (v && m && (O = t(I + O, I.length ? y - D.length : 1 / 0), I = ""), h) {
        case "<":
          O = S + O + D + I;
          break;
        case "=":
          O = S + I + O + D;
          break;
        case "^":
          O = I.slice(0, L = I.length >> 1) + S + O + D + I.slice(L);
          break;
        default:
          O = I + S + O + D;
          break;
      }
      return o(O);
    }
    return C.toString = function() {
      return f + "";
    }, C;
  }
  function c(f, d) {
    var h = l((f = xs(f), f.type = "f", f)), g = Math.max(-8, Math.min(8, Math.floor(Bu(d) / 3))) * 3, p = Math.pow(10, -g), m = L_[8 + g / 3];
    return function(y) {
      return h(p * y) + m;
    };
  }
  return {
    format: l,
    formatPrefix: c
  };
}
var jd, H0, rx;
Q9({
  thousands: ",",
  grouping: [3],
  currency: ["$", ""]
});
function Q9(e) {
  return jd = HD(e), H0 = jd.format, rx = jd.formatPrefix, jd;
}
function YD(e) {
  return Math.max(0, -Bu(Math.abs(e)));
}
function XD(e, t) {
  return Math.max(0, Math.max(-8, Math.min(8, Math.floor(Bu(t) / 3))) * 3 - Bu(Math.abs(e)));
}
function VD(e, t) {
  return e = Math.abs(e), t = Math.abs(t) - e, Math.max(0, Bu(t) - Bu(e)) + 1;
}
var Km = new Date(), Jm = new Date();
function Dt(e, t, n, i) {
  function r(o) {
    return e(o = arguments.length === 0 ? new Date() : new Date(+o)), o;
  }
  return r.floor = function(o) {
    return e(o = new Date(+o)), o;
  }, r.ceil = function(o) {
    return e(o = new Date(o - 1)), t(o, 1), e(o), o;
  }, r.round = function(o) {
    var a = r(o), s = r.ceil(o);
    return o - a < s - o ? a : s;
  }, r.offset = function(o, a) {
    return t(o = new Date(+o), a == null ? 1 : Math.floor(a)), o;
  }, r.range = function(o, a, s) {
    var u = [], l;
    if (o = r.ceil(o), s = s == null ? 1 : Math.floor(s), !(o < a) || !(s > 0))
      return u;
    do
      u.push(l = new Date(+o)), t(o, s), e(o);
    while (l < o && o < a);
    return u;
  }, r.filter = function(o) {
    return Dt(function(a) {
      if (a >= a)
        for (; e(a), !o(a); )
          a.setTime(a - 1);
    }, function(a, s) {
      if (a >= a)
        if (s < 0)
          for (; ++s <= 0; )
            for (; t(a, -1), !o(a); )
              ;
        else
          for (; --s >= 0; )
            for (; t(a, 1), !o(a); )
              ;
    });
  }, n && (r.count = function(o, a) {
    return Km.setTime(+o), Jm.setTime(+a), e(Km), e(Jm), Math.floor(n(Km, Jm));
  }, r.every = function(o) {
    return o = Math.floor(o), !isFinite(o) || !(o > 0) ? null : o > 1 ? r.filter(i ? function(a) {
      return i(a) % o === 0;
    } : function(a) {
      return r.count(0, a) % o === 0;
    }) : r;
  }), r;
}
var og = Dt(function() {
}, function(e, t) {
  e.setTime(+e + t);
}, function(e, t) {
  return t - e;
});
og.every = function(e) {
  return e = Math.floor(e), !isFinite(e) || !(e > 0) ? null : e > 1 ? Dt(function(t) {
    t.setTime(Math.floor(t / e) * e);
  }, function(t, n) {
    t.setTime(+t + n * e);
  }, function(t, n) {
    return (n - t) / e;
  }) : og;
};
const ox = og;
og.range;
const Qr = 1e3, ri = Qr * 60, Zr = ri * 60, ws = Zr * 24, ax = ws * 7, I_ = ws * 30, Qm = ws * 365;
var KD = Dt(function(e) {
  e.setTime(e - e.getMilliseconds());
}, function(e, t) {
  e.setTime(+e + t * Qr);
}, function(e, t) {
  return (t - e) / Qr;
}, function(e) {
  return e.getUTCSeconds();
});
const Bo = KD;
KD.range;
var JD = Dt(function(e) {
  e.setTime(e - e.getMilliseconds() - e.getSeconds() * Qr);
}, function(e, t) {
  e.setTime(+e + t * ri);
}, function(e, t) {
  return (t - e) / ri;
}, function(e) {
  return e.getMinutes();
});
const sx = JD;
JD.range;
var QD = Dt(function(e) {
  e.setTime(e - e.getMilliseconds() - e.getSeconds() * Qr - e.getMinutes() * ri);
}, function(e, t) {
  e.setTime(+e + t * Zr);
}, function(e, t) {
  return (t - e) / Zr;
}, function(e) {
  return e.getHours();
});
const ux = QD;
QD.range;
var ZD = Dt(
  (e) => e.setHours(0, 0, 0, 0),
  (e, t) => e.setDate(e.getDate() + t),
  (e, t) => (t - e - (t.getTimezoneOffset() - e.getTimezoneOffset()) * ri) / ws,
  (e) => e.getDate() - 1
);
const Ko = ZD;
ZD.range;
function Us(e) {
  return Dt(function(t) {
    t.setDate(t.getDate() - (t.getDay() + 7 - e) % 7), t.setHours(0, 0, 0, 0);
  }, function(t, n) {
    t.setDate(t.getDate() + n * 7);
  }, function(t, n) {
    return (n - t - (n.getTimezoneOffset() - t.getTimezoneOffset()) * ri) / ax;
  });
}
var xl = Us(0), ag = Us(1), Z9 = Us(2), e7 = Us(3), zu = Us(4), t7 = Us(5), n7 = Us(6);
xl.range;
ag.range;
Z9.range;
e7.range;
zu.range;
t7.range;
n7.range;
var e3 = Dt(function(e) {
  e.setDate(1), e.setHours(0, 0, 0, 0);
}, function(e, t) {
  e.setMonth(e.getMonth() + t);
}, function(e, t) {
  return t.getMonth() - e.getMonth() + (t.getFullYear() - e.getFullYear()) * 12;
}, function(e) {
  return e.getMonth();
});
const sg = e3;
e3.range;
var lx = Dt(function(e) {
  e.setMonth(0, 1), e.setHours(0, 0, 0, 0);
}, function(e, t) {
  e.setFullYear(e.getFullYear() + t);
}, function(e, t) {
  return t.getFullYear() - e.getFullYear();
}, function(e) {
  return e.getFullYear();
});
lx.every = function(e) {
  return !isFinite(e = Math.floor(e)) || !(e > 0) ? null : Dt(function(t) {
    t.setFullYear(Math.floor(t.getFullYear() / e) * e), t.setMonth(0, 1), t.setHours(0, 0, 0, 0);
  }, function(t, n) {
    t.setFullYear(t.getFullYear() + n * e);
  });
};
const ra = lx;
lx.range;
var t3 = Dt(function(e) {
  e.setUTCSeconds(0, 0);
}, function(e, t) {
  e.setTime(+e + t * ri);
}, function(e, t) {
  return (t - e) / ri;
}, function(e) {
  return e.getUTCMinutes();
});
const cx = t3;
t3.range;
var n3 = Dt(function(e) {
  e.setUTCMinutes(0, 0, 0);
}, function(e, t) {
  e.setTime(+e + t * Zr);
}, function(e, t) {
  return (t - e) / Zr;
}, function(e) {
  return e.getUTCHours();
});
const fx = n3;
n3.range;
var i3 = Dt(function(e) {
  e.setUTCHours(0, 0, 0, 0);
}, function(e, t) {
  e.setUTCDate(e.getUTCDate() + t);
}, function(e, t) {
  return (t - e) / ws;
}, function(e) {
  return e.getUTCDate() - 1;
});
const Jo = i3;
i3.range;
function qs(e) {
  return Dt(function(t) {
    t.setUTCDate(t.getUTCDate() - (t.getUTCDay() + 7 - e) % 7), t.setUTCHours(0, 0, 0, 0);
  }, function(t, n) {
    t.setUTCDate(t.getUTCDate() + n * 7);
  }, function(t, n) {
    return (n - t) / ax;
  });
}
var wl = qs(0), ug = qs(1), i7 = qs(2), r7 = qs(3), Uu = qs(4), o7 = qs(5), a7 = qs(6);
wl.range;
ug.range;
i7.range;
r7.range;
Uu.range;
o7.range;
a7.range;
var r3 = Dt(function(e) {
  e.setUTCDate(1), e.setUTCHours(0, 0, 0, 0);
}, function(e, t) {
  e.setUTCMonth(e.getUTCMonth() + t);
}, function(e, t) {
  return t.getUTCMonth() - e.getUTCMonth() + (t.getUTCFullYear() - e.getUTCFullYear()) * 12;
}, function(e) {
  return e.getUTCMonth();
});
const lg = r3;
r3.range;
var dx = Dt(function(e) {
  e.setUTCMonth(0, 1), e.setUTCHours(0, 0, 0, 0);
}, function(e, t) {
  e.setUTCFullYear(e.getUTCFullYear() + t);
}, function(e, t) {
  return t.getUTCFullYear() - e.getUTCFullYear();
}, function(e) {
  return e.getUTCFullYear();
});
dx.every = function(e) {
  return !isFinite(e = Math.floor(e)) || !(e > 0) ? null : Dt(function(t) {
    t.setUTCFullYear(Math.floor(t.getUTCFullYear() / e) * e), t.setUTCMonth(0, 1), t.setUTCHours(0, 0, 0, 0);
  }, function(t, n) {
    t.setUTCFullYear(t.getUTCFullYear() + n * e);
  });
};
const oa = dx;
dx.range;
function o3(e, t, n, i, r, o) {
  const a = [
    [Bo, 1, Qr],
    [Bo, 5, 5 * Qr],
    [Bo, 15, 15 * Qr],
    [Bo, 30, 30 * Qr],
    [o, 1, ri],
    [o, 5, 5 * ri],
    [o, 15, 15 * ri],
    [o, 30, 30 * ri],
    [r, 1, Zr],
    [r, 3, 3 * Zr],
    [r, 6, 6 * Zr],
    [r, 12, 12 * Zr],
    [i, 1, ws],
    [i, 2, 2 * ws],
    [n, 1, ax],
    [t, 1, I_],
    [t, 3, 3 * I_],
    [e, 1, Qm]
  ];
  function s(l, c, f) {
    const d = c < l;
    d && ([l, c] = [c, l]);
    const h = f && typeof f.range == "function" ? f : u(l, c, f), g = h ? h.range(l, +c + 1) : [];
    return d ? g.reverse() : g;
  }
  function u(l, c, f) {
    const d = Math.abs(c - l) / f, h = If(([, , m]) => m).right(a, d);
    if (h === a.length)
      return e.every(ia(l / Qm, c / Qm, f));
    if (h === 0)
      return ox.every(Math.max(ia(l, c, f), 1));
    const [g, p] = a[d / a[h - 1][2] < a[h][2] / d ? h - 1 : h];
    return g.every(p);
  }
  return [s, u];
}
const [s7, u7] = o3(oa, lg, wl, Jo, fx, cx), [l7, c7] = o3(ra, sg, xl, Ko, ux, sx), Rt = "year", Tn = "quarter", Xt = "month", yt = "week", Nn = "date", qt = "day", br = "dayofyear", Kn = "hours", Jn = "minutes", fi = "seconds", Ui = "milliseconds", hx = [Rt, Tn, Xt, yt, Nn, qt, br, Kn, Jn, fi, Ui], Zm = hx.reduce((e, t, n) => (e[t] = 1 + n, e), {});
function gx(e) {
  const t = oe(e).slice(), n = {};
  return t.length || P("Missing time unit."), t.forEach((r) => {
    ae(Zm, r) ? n[r] = 1 : P("Invalid time unit: ".concat(r, "."));
  }), (n[yt] || n[qt] ? 1 : 0) + (n[Tn] || n[Xt] || n[Nn] ? 1 : 0) + (n[br] ? 1 : 0) > 1 && P("Incompatible time units: ".concat(e)), t.sort((r, o) => Zm[r] - Zm[o]), t;
}
const f7 = {
  [Rt]: "%Y ",
  [Tn]: "Q%q ",
  [Xt]: "%b ",
  [Nn]: "%d ",
  [yt]: "W%U ",
  [qt]: "%a ",
  [br]: "%j ",
  [Kn]: "%H:00",
  [Jn]: "00:%M",
  [fi]: ":%S",
  [Ui]: ".%L",
  ["".concat(Rt, "-").concat(Xt)]: "%Y-%m ",
  ["".concat(Rt, "-").concat(Xt, "-").concat(Nn)]: "%Y-%m-%d ",
  ["".concat(Kn, "-").concat(Jn)]: "%H:%M"
};
function a3(e, t) {
  const n = de({}, f7, t), i = gx(e), r = i.length;
  let o = "", a = 0, s, u;
  for (a = 0; a < r; )
    for (s = i.length; s > a; --s)
      if (u = i.slice(a, s).join("-"), n[u] != null) {
        o += n[u], a = s;
        break;
      }
  return o.trim();
}
const Qa = new Date();
function px(e) {
  return Qa.setFullYear(e), Qa.setMonth(0), Qa.setDate(1), Qa.setHours(0, 0, 0, 0), Qa;
}
function s3(e) {
  return l3(new Date(e));
}
function u3(e) {
  return Ry(new Date(e));
}
function l3(e) {
  return Ko.count(px(e.getFullYear()) - 1, e);
}
function Ry(e) {
  return xl.count(px(e.getFullYear()) - 1, e);
}
function jy(e) {
  return px(e).getDay();
}
function d7(e, t, n, i, r, o, a) {
  if (0 <= e && e < 100) {
    const s = new Date(-1, t, n, i, r, o, a);
    return s.setFullYear(e), s;
  }
  return new Date(e, t, n, i, r, o, a);
}
function c3(e) {
  return d3(new Date(e));
}
function f3(e) {
  return Py(new Date(e));
}
function d3(e) {
  const t = Date.UTC(e.getUTCFullYear(), 0, 1);
  return Jo.count(t - 1, e);
}
function Py(e) {
  const t = Date.UTC(e.getUTCFullYear(), 0, 1);
  return wl.count(t - 1, e);
}
function Ly(e) {
  return Qa.setTime(Date.UTC(e, 0, 1)), Qa.getUTCDay();
}
function h7(e, t, n, i, r, o, a) {
  if (0 <= e && e < 100) {
    const s = new Date(Date.UTC(-1, t, n, i, r, o, a));
    return s.setUTCFullYear(n.y), s;
  }
  return new Date(Date.UTC(e, t, n, i, r, o, a));
}
function h3(e, t, n, i, r) {
  const o = t || 1, a = xe(e), s = (y, v, b) => (b = b || y, g7(n[b], i[b], y === a && o, v)), u = new Date(), l = zi(e), c = l[Rt] ? s(Rt) : Zt(2012), f = l[Xt] ? s(Xt) : l[Tn] ? s(Tn) : Lo, d = l[yt] && l[qt] ? s(qt, 1, yt + qt) : l[yt] ? s(yt, 1) : l[qt] ? s(qt, 1) : l[Nn] ? s(Nn, 1) : l[br] ? s(br, 1) : vl, h = l[Kn] ? s(Kn) : Lo, g = l[Jn] ? s(Jn) : Lo, p = l[fi] ? s(fi) : Lo, m = l[Ui] ? s(Ui) : Lo;
  return function(y) {
    u.setTime(+y);
    const v = c(u);
    return r(v, f(u), d(u, v), h(u), g(u), p(u), m(u));
  };
}
function g7(e, t, n, i) {
  const r = n <= 1 ? e : i ? (o, a) => i + n * Math.floor((e(o, a) - i) / n) : (o, a) => n * Math.floor(e(o, a) / n);
  return t ? (o, a) => t(r(o, a), a) : r;
}
function qu(e, t, n) {
  return t + e * 7 - (n + 6) % 7;
}
const p7 = {
  [Rt]: (e) => e.getFullYear(),
  [Tn]: (e) => Math.floor(e.getMonth() / 3),
  [Xt]: (e) => e.getMonth(),
  [Nn]: (e) => e.getDate(),
  [Kn]: (e) => e.getHours(),
  [Jn]: (e) => e.getMinutes(),
  [fi]: (e) => e.getSeconds(),
  [Ui]: (e) => e.getMilliseconds(),
  [br]: (e) => l3(e),
  [yt]: (e) => Ry(e),
  [yt + qt]: (e, t) => qu(Ry(e), e.getDay(), jy(t)),
  [qt]: (e, t) => qu(1, e.getDay(), jy(t))
}, m7 = {
  [Tn]: (e) => 3 * e,
  [yt]: (e, t) => qu(e, 0, jy(t))
};
function g3(e, t) {
  return h3(e, t || 1, p7, m7, d7);
}
const y7 = {
  [Rt]: (e) => e.getUTCFullYear(),
  [Tn]: (e) => Math.floor(e.getUTCMonth() / 3),
  [Xt]: (e) => e.getUTCMonth(),
  [Nn]: (e) => e.getUTCDate(),
  [Kn]: (e) => e.getUTCHours(),
  [Jn]: (e) => e.getUTCMinutes(),
  [fi]: (e) => e.getUTCSeconds(),
  [Ui]: (e) => e.getUTCMilliseconds(),
  [br]: (e) => d3(e),
  [yt]: (e) => Py(e),
  [qt]: (e, t) => qu(1, e.getUTCDay(), Ly(t)),
  [yt + qt]: (e, t) => qu(Py(e), e.getUTCDay(), Ly(t))
}, v7 = {
  [Tn]: (e) => 3 * e,
  [yt]: (e, t) => qu(e, 0, Ly(t))
};
function p3(e, t) {
  return h3(e, t || 1, y7, v7, h7);
}
const b7 = {
  [Rt]: ra,
  [Tn]: sg.every(3),
  [Xt]: sg,
  [yt]: xl,
  [Nn]: Ko,
  [qt]: Ko,
  [br]: Ko,
  [Kn]: ux,
  [Jn]: sx,
  [fi]: Bo,
  [Ui]: ox
}, x7 = {
  [Rt]: oa,
  [Tn]: lg.every(3),
  [Xt]: lg,
  [yt]: wl,
  [Nn]: Jo,
  [qt]: Jo,
  [br]: Jo,
  [Kn]: fx,
  [Jn]: cx,
  [fi]: Bo,
  [Ui]: ox
};
function El(e) {
  return b7[e];
}
function Al(e) {
  return x7[e];
}
function m3(e, t, n) {
  return e ? e.offset(t, n) : void 0;
}
function y3(e, t, n) {
  return m3(El(e), t, n);
}
function v3(e, t, n) {
  return m3(Al(e), t, n);
}
function b3(e, t, n, i) {
  return e ? e.range(t, n, i) : void 0;
}
function x3(e, t, n, i) {
  return b3(El(e), t, n, i);
}
function w3(e, t, n, i) {
  return b3(Al(e), t, n, i);
}
const pc = 1e3, mc = pc * 60, yc = mc * 60, Y0 = yc * 24, w7 = Y0 * 7, B_ = Y0 * 30, Iy = Y0 * 365, E3 = [Rt, Xt, Nn, Kn, Jn, fi, Ui], vc = E3.slice(0, -1), bc = vc.slice(0, -1), xc = bc.slice(0, -1), E7 = xc.slice(0, -1), A7 = [Rt, yt], z_ = [Rt, Xt], A3 = [Rt], Hl = [[vc, 1, pc], [vc, 5, 5 * pc], [vc, 15, 15 * pc], [vc, 30, 30 * pc], [bc, 1, mc], [bc, 5, 5 * mc], [bc, 15, 15 * mc], [bc, 30, 30 * mc], [xc, 1, yc], [xc, 3, 3 * yc], [xc, 6, 6 * yc], [xc, 12, 12 * yc], [E7, 1, Y0], [A7, 1, w7], [z_, 1, B_], [z_, 3, 3 * B_], [A3, 1, Iy]];
function _3(e) {
  const t = e.extent, n = e.maxbins || 40, i = Math.abs(Lf(t)) / n;
  let r = If((s) => s[2]).right(Hl, i), o, a;
  return r === Hl.length ? (o = A3, a = ia(t[0] / Iy, t[1] / Iy, n)) : r ? (r = Hl[i / Hl[r - 1][2] < Hl[r][2] / i ? r - 1 : r], o = r[0], a = r[1]) : (o = E3, a = Math.max(ia(t[0], t[1], n), 1)), {
    units: o,
    step: a
  };
}
function e1(e) {
  if (0 <= e.y && e.y < 100) {
    var t = new Date(-1, e.m, e.d, e.H, e.M, e.S, e.L);
    return t.setFullYear(e.y), t;
  }
  return new Date(e.y, e.m, e.d, e.H, e.M, e.S, e.L);
}
function t1(e) {
  if (0 <= e.y && e.y < 100) {
    var t = new Date(Date.UTC(-1, e.m, e.d, e.H, e.M, e.S, e.L));
    return t.setUTCFullYear(e.y), t;
  }
  return new Date(Date.UTC(e.y, e.m, e.d, e.H, e.M, e.S, e.L));
}
function Yl(e, t, n) {
  return { y: e, m: t, d: n, H: 0, M: 0, S: 0, L: 0 };
}
function O3(e) {
  var t = e.dateTime, n = e.date, i = e.time, r = e.periods, o = e.days, a = e.shortDays, s = e.months, u = e.shortMonths, l = Xl(r), c = Vl(r), f = Xl(o), d = Vl(o), h = Xl(a), g = Vl(a), p = Xl(s), m = Vl(s), y = Xl(u), v = Vl(u), b = {
    a: T,
    A: L,
    b: I,
    B: Y,
    c: null,
    d: Y_,
    e: Y_,
    f: H7,
    g: nP,
    G: rP,
    H: q7,
    I: W7,
    j: G7,
    L: S3,
    m: Y7,
    M: X7,
    p: fe,
    q: Me,
    Q: K_,
    s: J_,
    S: V7,
    u: K7,
    U: J7,
    V: Q7,
    w: Z7,
    W: eP,
    x: null,
    X: null,
    y: tP,
    Y: iP,
    Z: oP,
    "%": V_
  }, x = {
    a: Oe,
    A: Be,
    b: Se,
    B: en,
    c: null,
    d: X_,
    e: X_,
    f: lP,
    g: bP,
    G: wP,
    H: aP,
    I: sP,
    j: uP,
    L: F3,
    m: cP,
    M: fP,
    p: ei,
    q: tn,
    Q: K_,
    s: J_,
    S: dP,
    u: hP,
    U: gP,
    V: pP,
    w: mP,
    W: yP,
    x: null,
    X: null,
    y: vP,
    Y: xP,
    Z: EP,
    "%": V_
  }, E = {
    a: C,
    A: O,
    b: S,
    B: D,
    c: M,
    d: G_,
    e: G_,
    f: I7,
    g: W_,
    G: q_,
    H: H_,
    I: H_,
    j: R7,
    L: L7,
    m: N7,
    M: j7,
    p: k,
    q: T7,
    Q: z7,
    s: U7,
    S: P7,
    u: F7,
    U: k7,
    V: D7,
    w: C7,
    W: $7,
    x: F,
    X: $,
    y: W_,
    Y: q_,
    Z: M7,
    "%": B7
  };
  b.x = A(n, b), b.X = A(i, b), b.c = A(t, b), x.x = A(n, x), x.X = A(i, x), x.c = A(t, x);
  function A(H, le) {
    return function(ve) {
      var z = [], Je = -1, be = 0, pt = H.length, at, Qi, So;
      for (ve instanceof Date || (ve = new Date(+ve)); ++Je < pt; )
        H.charCodeAt(Je) === 37 && (z.push(H.slice(be, Je)), (Qi = U_[at = H.charAt(++Je)]) != null ? at = H.charAt(++Je) : Qi = at === "e" ? " " : "0", (So = le[at]) && (at = So(ve, Qi)), z.push(at), be = Je + 1);
      return z.push(H.slice(be, Je)), z.join("");
    };
  }
  function w(H, le) {
    return function(ve) {
      var z = Yl(1900, void 0, 1), Je = _(z, H, ve += "", 0), be, pt;
      if (Je != ve.length)
        return null;
      if ("Q" in z)
        return new Date(z.Q);
      if ("s" in z)
        return new Date(z.s * 1e3 + ("L" in z ? z.L : 0));
      if (le && !("Z" in z) && (z.Z = 0), "p" in z && (z.H = z.H % 12 + z.p * 12), z.m === void 0 && (z.m = "q" in z ? z.q : 0), "V" in z) {
        if (z.V < 1 || z.V > 53)
          return null;
        "w" in z || (z.w = 1), "Z" in z ? (be = t1(Yl(z.y, 0, 1)), pt = be.getUTCDay(), be = pt > 4 || pt === 0 ? ug.ceil(be) : ug(be), be = Jo.offset(be, (z.V - 1) * 7), z.y = be.getUTCFullYear(), z.m = be.getUTCMonth(), z.d = be.getUTCDate() + (z.w + 6) % 7) : (be = e1(Yl(z.y, 0, 1)), pt = be.getDay(), be = pt > 4 || pt === 0 ? ag.ceil(be) : ag(be), be = Ko.offset(be, (z.V - 1) * 7), z.y = be.getFullYear(), z.m = be.getMonth(), z.d = be.getDate() + (z.w + 6) % 7);
      } else
        ("W" in z || "U" in z) && ("w" in z || (z.w = "u" in z ? z.u % 7 : "W" in z ? 1 : 0), pt = "Z" in z ? t1(Yl(z.y, 0, 1)).getUTCDay() : e1(Yl(z.y, 0, 1)).getDay(), z.m = 0, z.d = "W" in z ? (z.w + 6) % 7 + z.W * 7 - (pt + 5) % 7 : z.w + z.U * 7 - (pt + 6) % 7);
      return "Z" in z ? (z.H += z.Z / 100 | 0, z.M += z.Z % 100, t1(z)) : e1(z);
    };
  }
  function _(H, le, ve, z) {
    for (var Je = 0, be = le.length, pt = ve.length, at, Qi; Je < be; ) {
      if (z >= pt)
        return -1;
      if (at = le.charCodeAt(Je++), at === 37) {
        if (at = le.charAt(Je++), Qi = E[at in U_ ? le.charAt(Je++) : at], !Qi || (z = Qi(H, ve, z)) < 0)
          return -1;
      } else if (at != ve.charCodeAt(z++))
        return -1;
    }
    return z;
  }
  function k(H, le, ve) {
    var z = l.exec(le.slice(ve));
    return z ? (H.p = c.get(z[0].toLowerCase()), ve + z[0].length) : -1;
  }
  function C(H, le, ve) {
    var z = h.exec(le.slice(ve));
    return z ? (H.w = g.get(z[0].toLowerCase()), ve + z[0].length) : -1;
  }
  function O(H, le, ve) {
    var z = f.exec(le.slice(ve));
    return z ? (H.w = d.get(z[0].toLowerCase()), ve + z[0].length) : -1;
  }
  function S(H, le, ve) {
    var z = y.exec(le.slice(ve));
    return z ? (H.m = v.get(z[0].toLowerCase()), ve + z[0].length) : -1;
  }
  function D(H, le, ve) {
    var z = p.exec(le.slice(ve));
    return z ? (H.m = m.get(z[0].toLowerCase()), ve + z[0].length) : -1;
  }
  function M(H, le, ve) {
    return _(H, t, le, ve);
  }
  function F(H, le, ve) {
    return _(H, n, le, ve);
  }
  function $(H, le, ve) {
    return _(H, i, le, ve);
  }
  function T(H) {
    return a[H.getDay()];
  }
  function L(H) {
    return o[H.getDay()];
  }
  function I(H) {
    return u[H.getMonth()];
  }
  function Y(H) {
    return s[H.getMonth()];
  }
  function fe(H) {
    return r[+(H.getHours() >= 12)];
  }
  function Me(H) {
    return 1 + ~~(H.getMonth() / 3);
  }
  function Oe(H) {
    return a[H.getUTCDay()];
  }
  function Be(H) {
    return o[H.getUTCDay()];
  }
  function Se(H) {
    return u[H.getUTCMonth()];
  }
  function en(H) {
    return s[H.getUTCMonth()];
  }
  function ei(H) {
    return r[+(H.getUTCHours() >= 12)];
  }
  function tn(H) {
    return 1 + ~~(H.getUTCMonth() / 3);
  }
  return {
    format: function(H) {
      var le = A(H += "", b);
      return le.toString = function() {
        return H;
      }, le;
    },
    parse: function(H) {
      var le = w(H += "", !1);
      return le.toString = function() {
        return H;
      }, le;
    },
    utcFormat: function(H) {
      var le = A(H += "", x);
      return le.toString = function() {
        return H;
      }, le;
    },
    utcParse: function(H) {
      var le = w(H += "", !0);
      return le.toString = function() {
        return H;
      }, le;
    }
  };
}
var U_ = { "-": "", _: " ", 0: "0" }, $t = /^\s*\d+/, _7 = /^%/, O7 = /[\\^$*+?|[\]().{}]/g;
function ke(e, t, n) {
  var i = e < 0 ? "-" : "", r = (i ? -e : e) + "", o = r.length;
  return i + (o < n ? new Array(n - o + 1).join(t) + r : r);
}
function S7(e) {
  return e.replace(O7, "\\$&");
}
function Xl(e) {
  return new RegExp("^(?:" + e.map(S7).join("|") + ")", "i");
}
function Vl(e) {
  return new Map(e.map((t, n) => [t.toLowerCase(), n]));
}
function C7(e, t, n) {
  var i = $t.exec(t.slice(n, n + 1));
  return i ? (e.w = +i[0], n + i[0].length) : -1;
}
function F7(e, t, n) {
  var i = $t.exec(t.slice(n, n + 1));
  return i ? (e.u = +i[0], n + i[0].length) : -1;
}
function k7(e, t, n) {
  var i = $t.exec(t.slice(n, n + 2));
  return i ? (e.U = +i[0], n + i[0].length) : -1;
}
function D7(e, t, n) {
  var i = $t.exec(t.slice(n, n + 2));
  return i ? (e.V = +i[0], n + i[0].length) : -1;
}
function $7(e, t, n) {
  var i = $t.exec(t.slice(n, n + 2));
  return i ? (e.W = +i[0], n + i[0].length) : -1;
}
function q_(e, t, n) {
  var i = $t.exec(t.slice(n, n + 4));
  return i ? (e.y = +i[0], n + i[0].length) : -1;
}
function W_(e, t, n) {
  var i = $t.exec(t.slice(n, n + 2));
  return i ? (e.y = +i[0] + (+i[0] > 68 ? 1900 : 2e3), n + i[0].length) : -1;
}
function M7(e, t, n) {
  var i = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n, n + 6));
  return i ? (e.Z = i[1] ? 0 : -(i[2] + (i[3] || "00")), n + i[0].length) : -1;
}
function T7(e, t, n) {
  var i = $t.exec(t.slice(n, n + 1));
  return i ? (e.q = i[0] * 3 - 3, n + i[0].length) : -1;
}
function N7(e, t, n) {
  var i = $t.exec(t.slice(n, n + 2));
  return i ? (e.m = i[0] - 1, n + i[0].length) : -1;
}
function G_(e, t, n) {
  var i = $t.exec(t.slice(n, n + 2));
  return i ? (e.d = +i[0], n + i[0].length) : -1;
}
function R7(e, t, n) {
  var i = $t.exec(t.slice(n, n + 3));
  return i ? (e.m = 0, e.d = +i[0], n + i[0].length) : -1;
}
function H_(e, t, n) {
  var i = $t.exec(t.slice(n, n + 2));
  return i ? (e.H = +i[0], n + i[0].length) : -1;
}
function j7(e, t, n) {
  var i = $t.exec(t.slice(n, n + 2));
  return i ? (e.M = +i[0], n + i[0].length) : -1;
}
function P7(e, t, n) {
  var i = $t.exec(t.slice(n, n + 2));
  return i ? (e.S = +i[0], n + i[0].length) : -1;
}
function L7(e, t, n) {
  var i = $t.exec(t.slice(n, n + 3));
  return i ? (e.L = +i[0], n + i[0].length) : -1;
}
function I7(e, t, n) {
  var i = $t.exec(t.slice(n, n + 6));
  return i ? (e.L = Math.floor(i[0] / 1e3), n + i[0].length) : -1;
}
function B7(e, t, n) {
  var i = _7.exec(t.slice(n, n + 1));
  return i ? n + i[0].length : -1;
}
function z7(e, t, n) {
  var i = $t.exec(t.slice(n));
  return i ? (e.Q = +i[0], n + i[0].length) : -1;
}
function U7(e, t, n) {
  var i = $t.exec(t.slice(n));
  return i ? (e.s = +i[0], n + i[0].length) : -1;
}
function Y_(e, t) {
  return ke(e.getDate(), t, 2);
}
function q7(e, t) {
  return ke(e.getHours(), t, 2);
}
function W7(e, t) {
  return ke(e.getHours() % 12 || 12, t, 2);
}
function G7(e, t) {
  return ke(1 + Ko.count(ra(e), e), t, 3);
}
function S3(e, t) {
  return ke(e.getMilliseconds(), t, 3);
}
function H7(e, t) {
  return S3(e, t) + "000";
}
function Y7(e, t) {
  return ke(e.getMonth() + 1, t, 2);
}
function X7(e, t) {
  return ke(e.getMinutes(), t, 2);
}
function V7(e, t) {
  return ke(e.getSeconds(), t, 2);
}
function K7(e) {
  var t = e.getDay();
  return t === 0 ? 7 : t;
}
function J7(e, t) {
  return ke(xl.count(ra(e) - 1, e), t, 2);
}
function C3(e) {
  var t = e.getDay();
  return t >= 4 || t === 0 ? zu(e) : zu.ceil(e);
}
function Q7(e, t) {
  return e = C3(e), ke(zu.count(ra(e), e) + (ra(e).getDay() === 4), t, 2);
}
function Z7(e) {
  return e.getDay();
}
function eP(e, t) {
  return ke(ag.count(ra(e) - 1, e), t, 2);
}
function tP(e, t) {
  return ke(e.getFullYear() % 100, t, 2);
}
function nP(e, t) {
  return e = C3(e), ke(e.getFullYear() % 100, t, 2);
}
function iP(e, t) {
  return ke(e.getFullYear() % 1e4, t, 4);
}
function rP(e, t) {
  var n = e.getDay();
  return e = n >= 4 || n === 0 ? zu(e) : zu.ceil(e), ke(e.getFullYear() % 1e4, t, 4);
}
function oP(e) {
  var t = e.getTimezoneOffset();
  return (t > 0 ? "-" : (t *= -1, "+")) + ke(t / 60 | 0, "0", 2) + ke(t % 60, "0", 2);
}
function X_(e, t) {
  return ke(e.getUTCDate(), t, 2);
}
function aP(e, t) {
  return ke(e.getUTCHours(), t, 2);
}
function sP(e, t) {
  return ke(e.getUTCHours() % 12 || 12, t, 2);
}
function uP(e, t) {
  return ke(1 + Jo.count(oa(e), e), t, 3);
}
function F3(e, t) {
  return ke(e.getUTCMilliseconds(), t, 3);
}
function lP(e, t) {
  return F3(e, t) + "000";
}
function cP(e, t) {
  return ke(e.getUTCMonth() + 1, t, 2);
}
function fP(e, t) {
  return ke(e.getUTCMinutes(), t, 2);
}
function dP(e, t) {
  return ke(e.getUTCSeconds(), t, 2);
}
function hP(e) {
  var t = e.getUTCDay();
  return t === 0 ? 7 : t;
}
function gP(e, t) {
  return ke(wl.count(oa(e) - 1, e), t, 2);
}
function k3(e) {
  var t = e.getUTCDay();
  return t >= 4 || t === 0 ? Uu(e) : Uu.ceil(e);
}
function pP(e, t) {
  return e = k3(e), ke(Uu.count(oa(e), e) + (oa(e).getUTCDay() === 4), t, 2);
}
function mP(e) {
  return e.getUTCDay();
}
function yP(e, t) {
  return ke(ug.count(oa(e) - 1, e), t, 2);
}
function vP(e, t) {
  return ke(e.getUTCFullYear() % 100, t, 2);
}
function bP(e, t) {
  return e = k3(e), ke(e.getUTCFullYear() % 100, t, 2);
}
function xP(e, t) {
  return ke(e.getUTCFullYear() % 1e4, t, 4);
}
function wP(e, t) {
  var n = e.getUTCDay();
  return e = n >= 4 || n === 0 ? Uu(e) : Uu.ceil(e), ke(e.getUTCFullYear() % 1e4, t, 4);
}
function EP() {
  return "+0000";
}
function V_() {
  return "%";
}
function K_(e) {
  return +e;
}
function J_(e) {
  return Math.floor(+e / 1e3);
}
var uu, mx, D3, yx, $3;
AP({
  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 AP(e) {
  return uu = O3(e), mx = uu.format, D3 = uu.parse, yx = uu.utcFormat, $3 = uu.utcParse, uu;
}
function wc(e) {
  const t = {};
  return (n) => t[n] || (t[n] = e(n));
}
function _P(e, t) {
  return (n) => {
    const i = e(n), r = i.indexOf(t);
    if (r < 0)
      return i;
    let o = OP(i, r);
    const a = o < i.length ? i.slice(o) : "";
    for (; --o > r; )
      if (i[o] !== "0") {
        ++o;
        break;
      }
    return i.slice(0, o) + a;
  };
}
function OP(e, t) {
  let n = e.lastIndexOf("e"), i;
  if (n > 0)
    return n;
  for (n = e.length; --n > t; )
    if (i = e.charCodeAt(n), i >= 48 && i <= 57)
      return n + 1;
}
function M3(e) {
  const t = wc(e.format), n = e.formatPrefix;
  return {
    format: t,
    formatPrefix: n,
    formatFloat(i) {
      const r = xs(i || ",");
      if (r.precision == null) {
        switch (r.precision = 12, r.type) {
          case "%":
            r.precision -= 2;
            break;
          case "e":
            r.precision -= 1;
            break;
        }
        return _P(
          t(r),
          t(".1f")(1)[1]
        );
      } else
        return t(r);
    },
    formatSpan(i, r, o, a) {
      a = xs(a == null ? ",f" : a);
      const s = ia(i, r, o), u = Math.max(Math.abs(i), Math.abs(r));
      let l;
      if (a.precision == null)
        switch (a.type) {
          case "s":
            return isNaN(l = XD(s, u)) || (a.precision = l), n(a, u);
          case "":
          case "e":
          case "g":
          case "p":
          case "r": {
            isNaN(l = VD(s, u)) || (a.precision = l - (a.type === "e"));
            break;
          }
          case "f":
          case "%": {
            isNaN(l = YD(s)) || (a.precision = l - (a.type === "%") * 2);
            break;
          }
        }
      return t(a);
    }
  };
}
let By;
T3();
function T3() {
  return By = M3({
    format: H0,
    formatPrefix: rx
  });
}
function N3(e) {
  return M3(HD(e));
}
function cg(e) {
  return arguments.length ? By = N3(e) : By;
}
function Q_(e, t, n) {
  n = n || {}, ce(n) || P("Invalid time multi-format specifier: ".concat(n));
  const i = t(fi), r = t(Jn), o = t(Kn), a = t(Nn), s = t(yt), u = t(Xt), l = t(Tn), c = t(Rt), f = e(n[Ui] || ".%L"), d = e(n[fi] || ":%S"), h = e(n[Jn] || "%I:%M"), g = e(n[Kn] || "%I %p"), p = e(n[Nn] || n[qt] || "%a %d"), m = e(n[yt] || "%b %d"), y = e(n[Xt] || "%B"), v = e(n[Tn] || "%B"), b = e(n[Rt] || "%Y");
  return (x) => (i(x) < x ? f : r(x) < x ? d : o(x) < x ? h : a(x) < x ? g : u(x) < x ? s(x) < x ? p : m : c(x) < x ? l(x) < x ? y : v : b)(x);
}
function R3(e) {
  const t = wc(e.format), n = wc(e.utcFormat);
  return {
    timeFormat: (i) => je(i) ? t(i) : Q_(t, El, i),
    utcFormat: (i) => je(i) ? n(i) : Q_(n, Al, i),
    timeParse: wc(e.parse),
    utcParse: wc(e.utcParse)
  };
}
let zy;
j3();
function j3() {
  return zy = R3({
    format: mx,
    parse: D3,
    utcFormat: yx,
    utcParse: $3
  });
}
function P3(e) {
  return R3(O3(e));
}
function nf(e) {
  return arguments.length ? zy = P3(e) : zy;
}
const Uy = (e, t) => de({}, e, t);
function L3(e, t) {
  const n = e ? N3(e) : cg(), i = t ? P3(t) : nf();
  return Uy(n, i);
}
function vx(e, t) {
  const n = arguments.length;
  return n && n !== 2 && P("defaultLocale expects either zero or two arguments."), n ? Uy(cg(e), nf(t)) : Uy(cg(), nf());
}
function SP() {
  return T3(), j3(), vx();
}
const CP = /^(data:|([A-Za-z]+:)?\/\/)/, FP = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i, kP = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g, Z_ = "file://";
function DP(e, t) {
  return (n) => ({
    options: n || {},
    sanitize: MP,
    load: $P,
    fileAccess: !!t,
    file: TP(t),
    http: RP(e)
  });
}
async function $P(e, t) {
  const n = await this.sanitize(e, t), i = n.href;
  return n.localFile ? this.file(i) : this.http(i, t);
}
async function MP(e, t) {
  t = de({}, this.options, t);
  const n = this.fileAccess, i = {
    href: null
  };
  let r, o, a;
  const s = FP.test(e.replace(kP, ""));
  (e == null || typeof e != "string" || !s) && P("Sanitize failure, invalid URI: " + te(e));
  const u = CP.test(e);
  return (a = t.baseURL) && !u && (!e.startsWith("/") && !a.endsWith("/") && (e = "/" + e), e = a + e), o = (r = e.startsWith(Z_)) || t.mode === "file" || t.mode !== "http" && !u && n, r ? e = e.slice(Z_.length) : e.startsWith("//") && (t.defaultProtocol === "file" ? (e = e.slice(2), o = !0) : e = (t.defaultProtocol || "http") + ":" + e), Object.defineProperty(i, "localFile", {
    value: !!o
  }), i.href = e, t.target && (i.target = t.target + ""), t.rel && (i.rel = t.rel + ""), t.context === "image" && t.crossOrigin && (i.crossOrigin = t.crossOrigin + ""), i;
}
function TP(e) {
  return e ? (t) => new Promise((n, i) => {
    e.readFile(t, (r, o) => {
      r ? i(r) : n(o);
    });
  }) : NP;
}
async function NP() {
  P("No file system access.");
}
function RP(e) {
  return e ? async function(t, n) {
    const i = de({}, this.options.http, n), r = n && n.response, o = await e(t, i);
    return o.ok ? he(o[r]) ? o[r]() : o.text() : P(o.status + "" + o.statusText);
  } : jP;
}
async function jP() {
  P("No HTTP fetch method available.");
}
const PP = (e) => e != null && e === e, LP = (e) => e === "true" || e === "false" || e === !0 || e === !1, IP = (e) => !Number.isNaN(Date.parse(e)), I3 = (e) => !Number.isNaN(+e) && !(e instanceof Date), BP = (e) => I3(e) && Number.isInteger(+e), qy = {
  boolean: ex,
  integer: Wt,
  number: Wt,
  date: tx,
  string: nx,
  unknown: mn
}, Pd = [LP, BP, I3, IP], zP = ["boolean", "integer", "number", "date"];
function B3(e, t) {
  if (!e || !e.length)
    return "unknown";
  const n = e.length, i = Pd.length, r = Pd.map((o, a) => a + 1);
  for (let o = 0, a = 0, s, u; o < n; ++o)
    for (u = t ? e[o][t] : e[o], s = 0; s < i; ++s)
      if (r[s] && PP(u) && !Pd[s](u) && (r[s] = 0, ++a, a === Pd.length))
        return "string";
  return zP[r.reduce((o, a) => o === 0 ? a : o, 0) - 1];
}
function z3(e, t) {
  return t.reduce((n, i) => (n[i] = B3(e, i), n), {});
}
function eO(e) {
  const t = function(n, i) {
    const r = {
      delimiter: e
    };
    return bx(n, i ? de(i, r) : r);
  };
  return t.responseType = "text", t;
}
function bx(e, t) {
  return t.header && (e = t.header.map(te).join(t.delimiter) + `
` + e), C9(t.delimiter).parse(e + "");
}
bx.responseType = "text";
function UP(e) {
  return typeof Buffer == "function" && he(Buffer.isBuffer) ? Buffer.isBuffer(e) : !1;
}
function xx(e, t) {
  const n = t && t.property ? Mn(t.property) : mn;
  return ce(e) && !UP(e) ? qP(n(e), t) : n(JSON.parse(e));
}
xx.responseType = "json";
function qP(e, t) {
  return !J(e) && _D(e) && (e = [...e]), t && t.copy ? JSON.parse(JSON.stringify(e)) : e;
}
const WP = {
  interior: (e, t) => e !== t,
  exterior: (e, t) => e === t
};
function U3(e, t) {
  let n, i, r, o;
  return e = xx(e, t), t && t.feature ? (n = $9, r = t.feature) : t && t.mesh ? (n = T9, r = t.mesh, o = WP[t.filter]) : P("Missing TopoJSON feature or mesh parameter."), i = (i = e.objects[r]) ? n(e, i, o) : P("Invalid TopoJSON object: " + r), i && i.features || [i];
}
U3.responseType = "json";
const Oh = {
  dsv: bx,
  csv: eO(","),
  tsv: eO("	"),
  json: xx,
  topojson: U3
};
function wx(e, t) {
  return arguments.length > 1 ? (Oh[e] = t, this) : ae(Oh, e) ? Oh[e] : null;
}
function q3(e) {
  const t = wx(e);
  return t && t.responseType || "text";
}
function W3(e, t, n, i) {
  t = t || {};
  const r = wx(t.type || "json");
  return r || P("Unknown data format type: " + t.type), e = r(e, t), t.parse && GP(e, t.parse, n, i), ae(e, "columns") && delete e.columns, e;
}
function GP(e, t, n, i) {
  if (!e.length)
    return;
  const r = nf();
  n = n || r.timeParse, i = i || r.utcParse;
  let o = e.columns || Object.keys(e[0]), a, s, u, l, c, f;
  t === "auto" && (t = z3(e, o)), o = Object.keys(t);
  const d = o.map((h) => {
    const g = t[h];
    let p, m;
    if (g && (g.startsWith("date:") || g.startsWith("utc:")))
      return p = g.split(/:(.+)?/, 2), m = p[1], (m[0] === "'" && m[m.length - 1] === "'" || m[0] === '"' && m[m.length - 1] === '"') && (m = m.slice(1, -1)), (p[0] === "utc" ? i : n)(m);
    if (!qy[g])
      throw Error("Illegal format pattern: " + h + ":" + g);
    return qy[g];
  });
  for (u = 0, c = e.length, f = o.length; u < c; ++u)
    for (a = e[u], l = 0; l < f; ++l)
      s = o[l], a[s] = d[l](a[s]);
}
const X0 = DP(
  typeof fetch < "u" && fetch,
  null
);
function V0(e) {
  const t = e || mn, n = [], i = {};
  return n.add = (r) => {
    const o = t(r);
    return i[o] || (i[o] = 1, n.push(r)), n;
  }, n.remove = (r) => {
    const o = t(r);
    if (i[o]) {
      i[o] = 0;
      const a = n.indexOf(r);
      a >= 0 && n.splice(a, 1);
    }
    return n;
  }, n;
}
async function Sh(e, t) {
  try {
    await t(e);
  } catch (n) {
    e.error(n);
  }
}
const G3 = Symbol("vega_id");
let HP = 1;
function K0(e) {
  return !!(e && Z(e));
}
function Z(e) {
  return e[G3];
}
function H3(e, t) {
  return e[G3] = t, e;
}
function Te(e) {
  const t = e === Object(e) ? e : {
    data: e
  };
  return Z(t) ? t : H3(t, HP++);
}
function Ex(e) {
  return J0(e, Te({}));
}
function J0(e, t) {
  for (const n in e)
    t[n] = e[n];
  return t;
}
function Y3(e, t) {
  return H3(t, Z(e));
}
function Ws(e, t) {
  return e ? t ? (n, i) => e(n, i) || Z(t(n)) - Z(t(i)) : (n, i) => e(n, i) || Z(n) - Z(i) : null;
}
function X3(e) {
  return e && e.constructor === Gs;
}
function Gs() {
  const e = [], t = [], n = [], i = [], r = [];
  let o = null, a = !1;
  return {
    constructor: Gs,
    insert(s) {
      const u = oe(s), l = u.length;
      for (let c = 0; c < l; ++c)
        e.push(u[c]);
      return this;
    },
    remove(s) {
      const u = he(s) ? i : t, l = oe(s), c = l.length;
      for (let f = 0; f < c; ++f)
        u.push(l[f]);
      return this;
    },
    modify(s, u, l) {
      const c = {
        field: u,
        value: Zt(l)
      };
      return he(s) ? (c.filter = s, r.push(c)) : (c.tuple = s, n.push(c)), this;
    },
    encode(s, u) {
      return he(s) ? r.push({
        filter: s,
        field: u
      }) : n.push({
        tuple: s,
        field: u
      }), this;
    },
    clean(s) {
      return o = s, this;
    },
    reflow() {
      return a = !0, this;
    },
    pulse(s, u) {
      const l = {}, c = {};
      let f, d, h, g, p, m;
      for (f = 0, d = u.length; f < d; ++f)
        l[Z(u[f])] = 1;
      for (f = 0, d = t.length; f < d; ++f)
        p = t[f], l[Z(p)] = -1;
      for (f = 0, d = i.length; f < d; ++f)
        g = i[f], u.forEach((v) => {
          g(v) && (l[Z(v)] = -1);
        });
      for (f = 0, d = e.length; f < d; ++f)
        p = e[f], m = Z(p), l[m] ? l[m] = 1 : s.add.push(Te(e[f]));
      for (f = 0, d = u.length; f < d; ++f)
        p = u[f], l[Z(p)] < 0 && s.rem.push(p);
      function y(v, b, x) {
        x ? v[b] = x(v) : s.encode = b, a || (c[Z(v)] = v);
      }
      for (f = 0, d = n.length; f < d; ++f)
        h = n[f], p = h.tuple, g = h.field, m = l[Z(p)], m > 0 && (y(p, g, h.value), s.modifies(g));
      for (f = 0, d = r.length; f < d; ++f)
        h = r[f], g = h.filter, u.forEach((v) => {
          g(v) && l[Z(v)] > 0 && y(v, h.field, h.value);
        }), s.modifies(h.field);
      if (a)
        s.mod = t.length || i.length ? u.filter((v) => l[Z(v)] > 0) : u.slice();
      else
        for (m in c)
          s.mod.push(c[m]);
      return (o || o == null && (t.length || i.length)) && s.clean(!0), s;
    }
  };
}
const Ch = "_:mod:_";
function Q0() {
  Object.defineProperty(this, Ch, {
    writable: !0,
    value: {}
  });
}
Q0.prototype = {
  set(e, t, n, i) {
    const r = this, o = r[e], a = r[Ch];
    return t != null && t >= 0 ? (o[t] !== n || i) && (o[t] = n, a[t + ":" + e] = -1, a[e] = -1) : (o !== n || i) && (r[e] = n, a[e] = J(n) ? 1 + n.length : -1), r;
  },
  modified(e, t) {
    const n = this[Ch];
    if (arguments.length) {
      if (J(e)) {
        for (let i = 0; i < e.length; ++i)
          if (n[e[i]])
            return !0;
        return !1;
      }
    } else {
      for (const i in n)
        if (n[i])
          return !0;
      return !1;
    }
    return t != null && t >= 0 ? t + 1 < n[e] || !!n[t + ":" + e] : !!n[e];
  },
  clear() {
    return this[Ch] = {}, this;
  }
};
let YP = 0;
const XP = "pulse", VP = new Q0(), KP = 1, JP = 2;
function qe(e, t, n, i) {
  this.id = ++YP, this.value = e, this.stamp = -1, this.rank = -1, this.qrank = -1, this.flags = 0, t && (this._update = t), n && this.parameters(n, i);
}
function tO(e) {
  return function(t) {
    const n = this.flags;
    return arguments.length === 0 ? !!(n & e) : (this.flags = t ? n | e : n & ~e, this);
  };
}
qe.prototype = {
  targets() {
    return this._targets || (this._targets = V0(Pf));
  },
  set(e) {
    return this.value !== e ? (this.value = e, 1) : 0;
  },
  skip: tO(KP),
  modified: tO(JP),
  parameters(e, t, n) {
    t = t !== !1;
    const i = this._argval = this._argval || new Q0(), r = this._argops = this._argops || [], o = [];
    let a, s, u, l;
    const c = (f, d, h) => {
      h instanceof qe ? (h !== this && (t && h.targets().add(this), o.push(h)), r.push({
        op: h,
        name: f,
        index: d
      })) : i.set(f, d, h);
    };
    for (a in e)
      if (s = e[a], a === XP)
        oe(s).forEach((f) => {
          f instanceof qe ? f !== this && (f.targets().add(this), o.push(f)) : P("Pulse parameters must be operator instances.");
        }), this.source = s;
      else if (J(s))
        for (i.set(a, -1, Array(u = s.length)), l = 0; l < u; ++l)
          c(a, l, s[l]);
      else
        c(a, -1, s);
    return this.marshall().clear(), n && (r.initonly = !0), o;
  },
  marshall(e) {
    const t = this._argval || VP, n = this._argops;
    let i, r, o, a;
    if (n) {
      const s = n.length;
      for (r = 0; r < s; ++r)
        i = n[r], o = i.op, a = o.modified() && o.stamp === e, t.set(i.name, i.index, o.value, a);
      if (n.initonly) {
        for (r = 0; r < s; ++r)
          i = n[r], i.op.targets().remove(this);
        this._argops = null, this._update = null;
      }
    }
    return t;
  },
  detach() {
    const e = this._argops;
    let t, n, i, r;
    if (e)
      for (t = 0, n = e.length; t < n; ++t)
        i = e[t], r = i.op, r._targets && r._targets.remove(this);
    this.pulse = null, this.source = null;
  },
  evaluate(e) {
    const t = this._update;
    if (t) {
      const n = this.marshall(e.stamp), i = t.call(this, n, e);
      if (n.clear(), i !== this.value)
        this.value = i;
      else if (!this.modified())
        return e.StopPropagation;
    }
  },
  run(e) {
    if (e.stamp < this.stamp)
      return e.StopPropagation;
    let t;
    return this.skip() ? (this.skip(!1), t = 0) : t = this.evaluate(e), this.pulse = t || e;
  }
};
function QP(e, t, n, i) {
  let r = 1, o;
  return e instanceof qe ? o = e : e && e.prototype instanceof qe ? o = new e() : he(e) ? o = new qe(null, e) : (r = 0, o = new qe(e, t)), this.rank(o), r && (i = n, n = t), n && this.connect(o, o.parameters(n, i)), this.touch(o), o;
}
function ZP(e, t) {
  const n = e.rank, i = t.length;
  for (let r = 0; r < i; ++r)
    if (n < t[r].rank) {
      this.rerank(e);
      return;
    }
}
let eL = 0;
function Z0(e, t, n) {
  this.id = ++eL, this.value = null, n && (this.receive = n), e && (this._filter = e), t && (this._apply = t);
}
function Do(e, t, n) {
  return new Z0(e, t, n);
}
Z0.prototype = {
  _filter: ci,
  _apply: mn,
  targets() {
    return this._targets || (this._targets = V0(Pf));
  },
  consume(e) {
    return arguments.length ? (this._consume = !!e, this) : !!this._consume;
  },
  receive(e) {
    if (this._filter(e)) {
      const t = this.value = this._apply(e), n = this._targets, i = n ? n.length : 0;
      for (let r = 0; r < i; ++r)
        n[r].receive(t);
      this._consume && (e.preventDefault(), e.stopPropagation());
    }
  },
  filter(e) {
    const t = Do(e);
    return this.targets().add(t), t;
  },
  apply(e) {
    const t = Do(null, e);
    return this.targets().add(t), t;
  },
  merge() {
    const e = Do();
    this.targets().add(e);
    for (let t = 0, n = arguments.length; t < n; ++t)
      arguments[t].targets().add(e);
    return e;
  },
  throttle(e) {
    let t = -1;
    return this.filter(() => {
      const n = Date.now();
      return n - t > e ? (t = n, 1) : 0;
    });
  },
  debounce(e) {
    const t = Do();
    return this.targets().add(Do(null, null, Jb(e, (n) => {
      const i = n.dataflow;
      t.receive(n), i && i.run && i.run();
    }))), t;
  },
  between(e, t) {
    let n = !1;
    return e.targets().add(Do(null, null, () => n = !0)), t.targets().add(Do(null, null, () => n = !1)), this.filter(() => n);
  },
  detach() {
    this._filter = ci, this._targets = null;
  }
};
function tL(e, t, n, i) {
  const r = this, o = Do(n, i), a = function(l) {
    l.dataflow = r;
    try {
      o.receive(l);
    } catch (c) {
      r.error(c);
    } finally {
      r.run();
    }
  };
  let s;
  typeof e == "string" && typeof document < "u" ? s = document.querySelectorAll(e) : s = oe(e);
  const u = s.length;
  for (let l = 0; l < u; ++l)
    s[l].addEventListener(t, a);
  return o;
}
function nL(e, t) {
  const n = this.locale();
  return W3(e, t, n.timeParse, n.utcParse);
}
function iL(e, t, n) {
  return t = this.parse(t, n), this.pulse(e, this.changeset().insert(t));
}
async function rL(e, t) {
  const n = this;
  let i = 0, r;
  try {
    r = await n.loader().load(e, {
      context: "dataflow",
      response: q3(t && t.type)
    });
    try {
      r = n.parse(r, t);
    } catch (o) {
      i = -2, n.warn("Data ingestion failed", e, o);
    }
  } catch (o) {
    i = -1, n.warn("Loading failed", e, o);
  }
  return {
    data: r,
    status: i
  };
}
async function oL(e, t, n) {
  const i = this, r = i._pending || aL(i);
  r.requests += 1;
  const o = await i.request(t, n);
  return i.pulse(e, i.changeset().remove(ci).insert(o.data || [])), r.done(), o;
}
function aL(e) {
  let t;
  const n = new Promise((i) => t = i);
  return n.requests = 0, n.done = () => {
    --n.requests === 0 && (e._pending = null, t(e));
  }, e._pending = n;
}
const sL = {
  skip: !0
};
function uL(e, t, n, i, r) {
  return (e instanceof qe ? cL : lL)(this, e, t, n, i, r), this;
}
function lL(e, t, n, i, r, o) {
  const a = de({}, o, sL);
  let s, u;
  he(n) || (n = Zt(n)), i === void 0 ? s = (l) => e.touch(n(l)) : he(i) ? (u = new qe(null, i, r, !1), s = (l) => {
    u.evaluate(l);
    const c = n(l), f = u.value;
    X3(f) ? e.pulse(c, f, o) : e.update(c, f, a);
  }) : s = (l) => e.update(n(l), i, a), t.apply(s);
}
function cL(e, t, n, i, r, o) {
  if (i === void 0)
    t.targets().add(n);
  else {
    const a = o || {}, s = new qe(null, fL(n, i), r, !1);
    s.modified(a.force), s.rank = t.rank, t.targets().add(s), n && (s.skip(!0), s.value = n.value, s.targets().add(n), e.connect(n, [s]));
  }
}
function fL(e, t) {
  return t = he(t) ? t : Zt(t), e ? function(n, i) {
    const r = t(n, i);
    return e.skip() || (e.skip(r !== this.value).value = r), r;
  } : t;
}
function dL(e) {
  e.rank = ++this._rank;
}
function hL(e) {
  const t = [e];
  let n, i, r;
  for (; t.length; )
    if (this.rank(n = t.pop()), i = n._targets)
      for (r = i.length; --r >= 0; )
        t.push(n = i[r]), n === e && P("Cycle detected in dataflow graph.");
}
const fg = {}, ir = 1 << 0, To = 1 << 1, Wr = 1 << 2, gL = ir | To, nO = ir | Wr, lu = ir | To | Wr, iO = 1 << 3, Kl = 1 << 4, rO = 1 << 5, oO = 1 << 6;
function Qo(e, t, n) {
  this.dataflow = e, this.stamp = t == null ? -1 : t, this.add = [], this.rem = [], this.mod = [], this.fields = null, this.encode = n || null;
}
function n1(e, t) {
  const n = [];
  return Mo(e, t, (i) => n.push(i)), n;
}
function aO(e, t) {
  const n = {};
  return e.visit(t, (i) => {
    n[Z(i)] = 1;
  }), (i) => n[Z(i)] ? null : i;
}
function Ld(e, t) {
  return e ? (n, i) => e(n, i) && t(n, i) : t;
}
Qo.prototype = {
  StopPropagation: fg,
  ADD: ir,
  REM: To,
  MOD: Wr,
  ADD_REM: gL,
  ADD_MOD: nO,
  ALL: lu,
  REFLOW: iO,
  SOURCE: Kl,
  NO_SOURCE: rO,
  NO_FIELDS: oO,
  fork(e) {
    return new Qo(this.dataflow).init(this, e);
  },
  clone() {
    const e = this.fork(lu);
    return e.add = e.add.slice(), e.rem = e.rem.slice(), e.mod = e.mod.slice(), e.source && (e.source = e.source.slice()), e.materialize(lu | Kl);
  },
  addAll() {
    let e = this;
    return !e.source || e.add === e.rem || !e.rem.length && e.source.length === e.add.length || (e = new Qo(this.dataflow).init(this), e.add = e.source, e.rem = []), e;
  },
  init(e, t) {
    const n = this;
    return n.stamp = e.stamp, n.encode = e.encode, e.fields && !(t & oO) && (n.fields = e.fields), t & ir ? (n.addF = e.addF, n.add = e.add) : (n.addF = null, n.add = []), t & To ? (n.remF = e.remF, n.rem = e.rem) : (n.remF = null, n.rem = []), t & Wr ? (n.modF = e.modF, n.mod = e.mod) : (n.modF = null, n.mod = []), t & rO ? (n.srcF = null, n.source = null) : (n.srcF = e.srcF, n.source = e.source, e.cleans && (n.cleans = e.cleans)), n;
  },
  runAfter(e) {
    this.dataflow.runAfter(e);
  },
  changed(e) {
    const t = e || lu;
    return t & ir && this.add.length || t & To && this.rem.length || t & Wr && this.mod.length;
  },
  reflow(e) {
    if (e)
      return this.fork(lu).reflow();
    const t = this.add.length, n = this.source && this.source.length;
    return n && n !== t && (this.mod = this.source, t && this.filter(Wr, aO(this, ir))), this;
  },
  clean(e) {
    return arguments.length ? (this.cleans = !!e, this) : this.cleans;
  },
  modifies(e) {
    const t = this.fields || (this.fields = {});
    return J(e) ? e.forEach((n) => t[n] = !0) : t[e] = !0, this;
  },
  modified(e, t) {
    const n = this.fields;
    return (t || this.mod.length) && n ? arguments.length ? J(e) ? e.some((i) => n[i]) : n[e] : !!n : !1;
  },
  filter(e, t) {
    const n = this;
    return e & ir && (n.addF = Ld(n.addF, t)), e & To && (n.remF = Ld(n.remF, t)), e & Wr && (n.modF = Ld(n.modF, t)), e & Kl && (n.srcF = Ld(n.srcF, t)), n;
  },
  materialize(e) {
    e = e || lu;
    const t = this;
    return e & ir && t.addF && (t.add = n1(t.add, t.addF), t.addF = null), e & To && t.remF && (t.rem = n1(t.rem, t.remF), t.remF = null), e & Wr && t.modF && (t.mod = n1(t.mod, t.modF), t.modF = null), e & Kl && t.srcF && (t.source = t.source.filter(t.srcF), t.srcF = null), t;
  },
  visit(e, t) {
    const n = this, i = t;
    if (e & Kl)
      return Mo(n.source, n.srcF, i), n;
    e & ir && Mo(n.add, n.addF, i), e & To && Mo(n.rem, n.remF, i), e & Wr && Mo(n.mod, n.modF, i);
    const r = n.source;
    if (e & iO && r) {
      const o = n.add.length + n.mod.length;
      o === r.length || (o ? Mo(r, aO(n, nO), i) : Mo(r, n.srcF, i));
    }
    return n;
  }
};
function Ax(e, t, n, i) {
  const r = this, o = n.length;
  let a = 0;
  this.dataflow = e, this.stamp = t, this.fields = null, this.encode = i || null, this.pulses = n;
  for (let s = 0; s < o; ++s) {
    const u = n[s];
    if (u.stamp === t) {
      if (u.fields) {
        const l = r.fields || (r.fields = {});
        for (const c in u.fields)
          l[c] = 1;
      }
      u.changed(r.ADD) && (a |= r.ADD), u.changed(r.REM) && (a |= r.REM), u.changed(r.MOD) && (a |= r.MOD);
    }
  }
  this.changes = a;
}
q(Ax, Qo, {
  fork(e) {
    const t = new Qo(this.dataflow).init(this, e & this.NO_FIELDS);
    return e !== void 0 && (e & t.ADD && this.visit(t.ADD, (n) => t.add.push(n)), e & t.REM && this.visit(t.REM, (n) => t.rem.push(n)), e & t.MOD && this.visit(t.MOD, (n) => t.mod.push(n))), t;
  },
  changed(e) {
    return this.changes & e;
  },
  modified(e) {
    const t = this, n = t.fields;
    return n && t.changes & t.MOD ? J(e) ? e.some((i) => n[i]) : n[e] : 0;
  },
  filter() {
    P("MultiPulse does not support filtering.");
  },
  materialize() {
    P("MultiPulse does not support materialization.");
  },
  visit(e, t) {
    const n = this, i = n.pulses, r = i.length;
    let o = 0;
    if (e & n.SOURCE)
      for (; o < r; ++o)
        i[o].visit(e, t);
    else
      for (; o < r; ++o)
        i[o].stamp === n.stamp && i[o].visit(e, t);
    return n;
  }
});
async function pL(e, t, n) {
  const i = this, r = [];
  if (i._pulse)
    return V3(i);
  if (i._pending && await i._pending, t && await Sh(i, t), !i._touched.length)
    return i.debug("Dataflow invoked, but nothing to do."), i;
  const o = ++i._clock;
  i._pulse = new Qo(i, o, e), i._touched.forEach((c) => i._enqueue(c, !0)), i._touched = V0(Pf);
  let a = 0, s, u, l;
  try {
    for (; i._heap.size() > 0; ) {
      if (s = i._heap.pop(), s.rank !== s.qrank) {
        i._enqueue(s, !0);
        continue;
      }
      u = s.run(i._getPulse(s, e)), u.then ? u = await u : u.async && (r.push(u.async), u = fg), u !== fg && s._targets && s._targets.forEach((c) => i._enqueue(c)), ++a;
    }
  } catch (c) {
    i._heap.clear(), l = c;
  }
  if (i._input = {}, i._pulse = null, i.debug(`Pulse ${o}: ${a} operators`), l && (i._postrun = [], i.error(l)), i._postrun.length) {
    const c = i._postrun.sort((f, d) => d.priority - f.priority);
    i._postrun = [];
    for (let f = 0; f < c.length; ++f)
      await Sh(i, c[f].callback);
  }
  return n && await Sh(i, n), r.length && Promise.all(r).then((c) => i.runAsync(null, () => {
    c.forEach((f) => {
      try {
        f(i);
      } catch (d) {
        i.error(d);
      }
    });
  })), i;
}
async function mL(e, t, n) {
  for (; this._running; )
    await this._running;
  const i = () => this._running = null;
  return (this._running = this.evaluate(e, t, n)).then(i, i), this._running;
}
function yL(e, t, n) {
  return this._pulse ? V3(this) : (this.evaluate(e, t, n), this);
}
function vL(e, t, n) {
  if (this._pulse || t)
    this._postrun.push({
      priority: n || 0,
      callback: e
    });
  else
    try {
      e(this);
    } catch (i) {
      this.error(i);
    }
}
function V3(e) {
  return e.error("Dataflow already running. Use runAsync() to chain invocations."), e;
}
function bL(e, t) {
  const n = e.stamp < this._clock;
  n && (e.stamp = this._clock), (n || t) && (e.qrank = e.rank, this._heap.push(e));
}
function xL(e, t) {
  const n = e.source, i = this._clock;
  return n && J(n) ? new Ax(this, i, n.map((r) => r.pulse), t) : this._input[e.id] || wL(this._pulse, n && n.pulse);
}
function wL(e, t) {
  return t && t.stamp === e.stamp ? t : (e = e.fork(), t && t !== fg && (e.source = t.source), e);
}
const _x = {
  skip: !1,
  force: !1
};
function EL(e, t) {
  const n = t || _x;
  return this._pulse ? this._enqueue(e) : this._touched.add(e), n.skip && e.skip(!0), this;
}
function AL(e, t, n) {
  const i = n || _x;
  return (e.set(t) || i.force) && this.touch(e, i), this;
}
function _L(e, t, n) {
  this.touch(e, n || _x);
  const i = new Qo(this, this._clock + (this._pulse ? 0 : 1)), r = e.pulse && e.pulse.source || [];
  return i.target = e, this._input[e.id] = t.pulse(i, r), this;
}
function OL(e) {
  let t = [];
  return {
    clear: () => t = [],
    size: () => t.length,
    peek: () => t[0],
    push: (n) => (t.push(n), K3(t, 0, t.length - 1, e)),
    pop: () => {
      const n = t.pop();
      let i;
      return t.length ? (i = t[0], t[0] = n, SL(t, 0, e)) : i = n, i;
    }
  };
}
function K3(e, t, n, i) {
  let r, o;
  const a = e[n];
  for (; n > t; ) {
    if (o = n - 1 >> 1, r = e[o], i(a, r) < 0) {
      e[n] = r, n = o;
      continue;
    }
    break;
  }
  return e[n] = a;
}
function SL(e, t, n) {
  const i = t, r = e.length, o = e[t];
  let a = (t << 1) + 1, s;
  for (; a < r; )
    s = a + 1, s < r && n(e[a], e[s]) >= 0 && (a = s), e[t] = e[a], t = a, a = (t << 1) + 1;
  return e[t] = o, K3(e, i, t, n);
}
function Du() {
  this.logger(cD()), this.logLevel(Hb), this._clock = 0, this._rank = 0, this._locale = vx();
  try {
    this._loader = X0();
  } catch {
  }
  this._touched = V0(Pf), this._input = {}, this._pulse = null, this._heap = OL((e, t) => e.qrank - t.qrank), this._postrun = [];
}
function Jl(e) {
  return function() {
    return this._log[e].apply(this, arguments);
  };
}
Du.prototype = {
  stamp() {
    return this._clock;
  },
  loader(e) {
    return arguments.length ? (this._loader = e, this) : this._loader;
  },
  locale(e) {
    return arguments.length ? (this._locale = e, this) : this._locale;
  },
  logger(e) {
    return arguments.length ? (this._log = e, this) : this._log;
  },
  error: Jl("error"),
  warn: Jl("warn"),
  info: Jl("info"),
  debug: Jl("debug"),
  logLevel: Jl("level"),
  cleanThreshold: 1e4,
  add: QP,
  connect: ZP,
  rank: dL,
  rerank: hL,
  pulse: _L,
  touch: EL,
  update: AL,
  changeset: Gs,
  ingest: iL,
  parse: nL,
  preload: oL,
  request: rL,
  events: tL,
  on: uL,
  evaluate: pL,
  run: yL,
  runAsync: mL,
  runAfter: vL,
  _enqueue: bL,
  _getPulse: xL
};
function N(e, t) {
  qe.call(this, e, null, t);
}
q(N, qe, {
  run(e) {
    if (e.stamp < this.stamp)
      return e.StopPropagation;
    let t;
    return this.skip() ? this.skip(!1) : t = this.evaluate(e), t = t || e, t.then ? t = t.then((n) => this.pulse = n) : t !== e.StopPropagation && (this.pulse = t), t;
  },
  evaluate(e) {
    const t = this.marshall(e.stamp), n = this.transform(t, e);
    return t.clear(), n;
  },
  transform() {
  }
});
const Wu = {};
function J3(e) {
  const t = Q3(e);
  return t && t.Definition || null;
}
function Q3(e) {
  return e = e && e.toLowerCase(), ae(Wu, e) ? Wu[e] : null;
}
function* Z3(e, t) {
  if (t == null)
    for (let n of e)
      n != null && n !== "" && (n = +n) >= n && (yield n);
  else {
    let n = -1;
    for (let i of e)
      i = t(i, ++n, e), i != null && i !== "" && (i = +i) >= i && (yield i);
  }
}
function Ox(e, t, n) {
  const i = Float64Array.from(Z3(e, n));
  return i.sort(io), t.map((r) => zD(i, r));
}
function Sx(e, t) {
  return Ox(e, [0.25, 0.5, 0.75], t);
}
function Cx(e, t) {
  const n = e.length, i = z9(e, t), r = Sx(e, t), o = (r[2] - r[0]) / 1.34;
  return 1.06 * (Math.min(i, o) || i || Math.abs(r[0]) || 1) * Math.pow(n, -0.2);
}
function e$(e) {
  const t = e.maxbins || 20, n = e.base || 10, i = Math.log(n), r = e.divide || [5, 2];
  let o = e.extent[0], a = e.extent[1], s, u, l, c, f, d;
  const h = e.span || a - o || Math.abs(o) || 1;
  if (e.step)
    s = e.step;
  else if (e.steps) {
    for (c = h / t, f = 0, d = e.steps.length; f < d && e.steps[f] < c; ++f)
      ;
    s = e.steps[Math.max(0, f - 1)];
  } else {
    for (u = Math.ceil(Math.log(t) / i), l = e.minstep || 0, s = Math.max(l, Math.pow(n, Math.round(Math.log(h) / i) - u)); Math.ceil(h / s) > t; )
      s *= n;
    for (f = 0, d = r.length; f < d; ++f)
      c = s / r[f], c >= l && h / c <= t && (s = c);
  }
  c = Math.log(s);
  const g = c >= 0 ? 0 : ~~(-c / i) + 1, p = Math.pow(n, -g - 1);
  return (e.nice || e.nice === void 0) && (c = Math.floor(o / s + p) * s, o = o < c ? c - s : c, a = Math.ceil(a / s) * s), {
    start: o,
    stop: a === o ? o + s : a,
    step: s
  };
}
var di = Math.random;
function CL(e) {
  di = e;
}
function t$(e, t, n, i) {
  if (!e.length)
    return [void 0, void 0];
  const r = Float64Array.from(Z3(e, i)), o = r.length, a = t;
  let s, u, l, c;
  for (l = 0, c = Array(a); l < a; ++l) {
    for (s = 0, u = 0; u < o; ++u)
      s += r[~~(di() * o)];
    c[l] = s / o;
  }
  return c.sort(io), [Ny(c, n / 2), Ny(c, 1 - n / 2)];
}
function n$(e, t, n, i) {
  i = i || ((d) => d);
  const r = e.length, o = new Float64Array(r);
  let a = 0, s = 1, u = i(e[0]), l = u, c = u + t, f;
  for (; s < r; ++s) {
    if (f = i(e[s]), f >= c) {
      for (l = (u + l) / 2; a < s; ++a)
        o[a] = l;
      c = f + t, u = f;
    }
    l = f;
  }
  for (l = (u + l) / 2; a < s; ++a)
    o[a] = l;
  return n ? FL(o, t + t / 4) : o;
}
function FL(e, t) {
  const n = e.length;
  let i = 0, r = 1, o, a;
  for (; e[i] === e[r]; )
    ++r;
  for (; r < n; ) {
    for (o = r + 1; e[r] === e[o]; )
      ++o;
    if (e[r] - e[r - 1] < t) {
      for (a = r + (i + o - r - r >> 1); a < r; )
        e[a++] = e[r];
      for (; a > r; )
        e[a--] = e[i];
    }
    i = r, r = o;
  }
  return e;
}
function kL(e) {
  return function() {
    return e = (1103515245 * e + 12345) % 2147483647, e / 2147483647;
  };
}
function DL(e, t) {
  t == null && (t = e, e = 0);
  let n, i, r;
  const o = {
    min(a) {
      return arguments.length ? (n = a || 0, r = i - n, o) : n;
    },
    max(a) {
      return arguments.length ? (i = a || 0, r = i - n, o) : i;
    },
    sample() {
      return n + Math.floor(r * di());
    },
    pdf(a) {
      return a === Math.floor(a) && a >= n && a < i ? 1 / r : 0;
    },
    cdf(a) {
      const s = Math.floor(a);
      return s < n ? 0 : s >= i ? 1 : (s - n + 1) / r;
    },
    icdf(a) {
      return a >= 0 && a <= 1 ? n - 1 + Math.floor(a * r) : NaN;
    }
  };
  return o.min(e).max(t);
}
const i$ = Math.sqrt(2 * Math.PI), $L = Math.SQRT2;
let Ql = NaN;
function ep(e, t) {
  e = e || 0, t = t == null ? 1 : t;
  let n = 0, i = 0, r, o;
  if (Ql === Ql)
    n = Ql, Ql = NaN;
  else {
    do
      n = di() * 2 - 1, i = di() * 2 - 1, r = n * n + i * i;
    while (r === 0 || r > 1);
    o = Math.sqrt(-2 * Math.log(r) / r), n *= o, Ql = i * o;
  }
  return e + n * t;
}
function Fx(e, t, n) {
  n = n == null ? 1 : n;
  const i = (e - (t || 0)) / n;
  return Math.exp(-0.5 * i * i) / (n * i$);
}
function tp(e, t, n) {
  t = t || 0, n = n == null ? 1 : n;
  const i = (e - t) / n, r = Math.abs(i);
  let o;
  if (r > 37)
    o = 0;
  else {
    const a = Math.exp(-r * r / 2);
    let s;
    r < 7.07106781186547 ? (s = 0.0352624965998911 * r + 0.700383064443688, s = s * r + 6.37396220353165, s = s * r + 33.912866078383, s = s * r + 112.079291497871, s = s * r + 221.213596169931, s = s * r + 220.206867912376, o = a * s, s = 0.0883883476483184 * r + 1.75566716318264, s = s * r + 16.064177579207, s = s * r + 86.7807322029461, s = s * r + 296.564248779674, s = s * r + 637.333633378831, s = s * r + 793.826512519948, s = s * r + 440.413735824752, o = o / s) : (s = r + 0.65, s = r + 4 / s, s = r + 3 / s, s = r + 2 / s, s = r + 1 / s, o = a / s / 2.506628274631);
  }
  return i > 0 ? 1 - o : o;
}
function np(e, t, n) {
  return e < 0 || e > 1 ? NaN : (t || 0) + (n == null ? 1 : n) * $L * ML(2 * e - 1);
}
function ML(e) {
  let t = -Math.log((1 - e) * (1 + e)), n;
  return t < 6.25 ? (t -= 3.125, n = -364441206401782e-35, n = -16850591381820166e-35 + n * t, n = 128584807152564e-32 + n * t, n = 11157877678025181e-33 + n * t, n = -1333171662854621e-31 + n * t, n = 20972767875968562e-33 + n * t, n = 6637638134358324e-30 + n * t, n = -4054566272975207e-29 + n * t, n = -8151934197605472e-29 + n * t, n = 26335093153082323e-28 + n * t, n = -12975133253453532e-27 + n * t, n = -5415412054294628e-26 + n * t, n = 10512122733215323e-25 + n * t, n = -4112633980346984e-24 + n * t, n = -29070369957882005e-24 + n * t, n = 42347877827932404e-23 + n * t, n = -13654692000834679e-22 + n * t, n = -13882523362786469e-21 + n * t, n = 18673420803405714e-20 + n * t, n = -740702534166267e-18 + n * t, n = -0.006033670871430149 + n * t, n = 0.24015818242558962 + n * t, n = 1.6536545626831027 + n * t) : t < 16 ? (t = Math.sqrt(t) - 3.25, n = 22137376921775787e-25, n = 9075656193888539e-23 + n * t, n = -27517406297064545e-23 + n * t, n = 18239629214389228e-24 + n * t, n = 15027403968909828e-22 + n * t, n = -4013867526981546e-21 + n * t, n = 29234449089955446e-22 + n * t, n = 12475304481671779e-21 + n * t, n = -47318229009055734e-21 + n * t, n = 6828485145957318e-20 + n * t, n = 24031110387097894e-21 + n * t, n = -3550375203628475e-19 + n * t, n = 9532893797373805e-19 + n * t, n = -0.0016882755560235047 + n * t, n = 0.002491442096107851 + n * t, n = -0.003751208507569241 + n * t, n = 0.005370914553590064 + n * t, n = 1.0052589676941592 + n * t, n = 3.0838856104922208 + n * t) : Number.isFinite(t) ? (t = Math.sqrt(t) - 5, n = -27109920616438573e-27, n = -2555641816996525e-25 + n * t, n = 15076572693500548e-25 + n * t, n = -3789465440126737e-24 + n * t, n = 761570120807834e-23 + n * t, n = -1496002662714924e-23 + n * t, n = 2914795345090108e-23 + n * t, n = -6771199775845234e-23 + n * t, n = 22900482228026655e-23 + n * t, n = -99298272942317e-20 + n * t, n = 4526062597223154e-21 + n * t, n = -1968177810553167e-20 + n * t, n = 7599527703001776e-20 + n * t, n = -21503011930044477e-20 + n * t, n = -13871931833623122e-20 + n * t, n = 1.0103004648645344 + n * t, n = 4.849906401408584 + n * t) : n = 1 / 0, n * e;
}
function kx(e, t) {
  let n, i;
  const r = {
    mean(o) {
      return arguments.length ? (n = o || 0, r) : n;
    },
    stdev(o) {
      return arguments.length ? (i = o == null ? 1 : o, r) : i;
    },
    sample: () => ep(n, i),
    pdf: (o) => Fx(o, n, i),
    cdf: (o) => tp(o, n, i),
    icdf: (o) => np(o, n, i)
  };
  return r.mean(e).stdev(t);
}
function Dx(e, t) {
  const n = kx();
  let i = 0;
  const r = {
    data(o) {
      return arguments.length ? (e = o, i = o ? o.length : 0, r.bandwidth(t)) : e;
    },
    bandwidth(o) {
      return arguments.length ? (t = o, !t && e && (t = Cx(e)), r) : t;
    },
    sample() {
      return e[~~(di() * i)] + t * n.sample();
    },
    pdf(o) {
      let a = 0, s = 0;
      for (; s < i; ++s)
        a += n.pdf((o - e[s]) / t);
      return a / t / i;
    },
    cdf(o) {
      let a = 0, s = 0;
      for (; s < i; ++s)
        a += n.cdf((o - e[s]) / t);
      return a / i;
    },
    icdf() {
      throw Error("KDE icdf not supported.");
    }
  };
  return r.data(e);
}
function $x(e, t) {
  return e = e || 0, t = t == null ? 1 : t, Math.exp(e + ep() * t);
}
function Mx(e, t, n) {
  if (e <= 0)
    return 0;
  t = t || 0, n = n == null ? 1 : n;
  const i = (Math.log(e) - t) / n;
  return Math.exp(-0.5 * i * i) / (n * i$ * e);
}
function Tx(e, t, n) {
  return tp(Math.log(e), t, n);
}
function Nx(e, t, n) {
  return Math.exp(np(e, t, n));
}
function r$(e, t) {
  let n, i;
  const r = {
    mean(o) {
      return arguments.length ? (n = o || 0, r) : n;
    },
    stdev(o) {
      return arguments.length ? (i = o == null ? 1 : o, r) : i;
    },
    sample: () => $x(n, i),
    pdf: (o) => Mx(o, n, i),
    cdf: (o) => Tx(o, n, i),
    icdf: (o) => Nx(o, n, i)
  };
  return r.mean(e).stdev(t);
}
function o$(e, t) {
  let n = 0, i;
  function r(a) {
    const s = [];
    let u = 0, l;
    for (l = 0; l < n; ++l)
      u += s[l] = a[l] == null ? 1 : +a[l];
    for (l = 0; l < n; ++l)
      s[l] /= u;
    return s;
  }
  const o = {
    weights(a) {
      return arguments.length ? (i = r(t = a || []), o) : t;
    },
    distributions(a) {
      return arguments.length ? (a ? (n = a.length, e = a) : (n = 0, e = []), o.weights(t)) : e;
    },
    sample() {
      const a = di();
      let s = e[n - 1], u = i[0], l = 0;
      for (; l < n - 1; u += i[++l])
        if (a < u) {
          s = e[l];
          break;
        }
      return s.sample();
    },
    pdf(a) {
      let s = 0, u = 0;
      for (; u < n; ++u)
        s += i[u] * e[u].pdf(a);
      return s;
    },
    cdf(a) {
      let s = 0, u = 0;
      for (; u < n; ++u)
        s += i[u] * e[u].cdf(a);
      return s;
    },
    icdf() {
      throw Error("Mixture icdf not supported.");
    }
  };
  return o.distributions(e).weights(t);
}
function Rx(e, t) {
  return t == null && (t = e == null ? 1 : e, e = 0), e + (t - e) * di();
}
function jx(e, t, n) {
  return n == null && (n = t == null ? 1 : t, t = 0), e >= t && e <= n ? 1 / (n - t) : 0;
}
function Px(e, t, n) {
  return n == null && (n = t == null ? 1 : t, t = 0), e < t ? 0 : e > n ? 1 : (e - t) / (n - t);
}
function Lx(e, t, n) {
  return n == null && (n = t == null ? 1 : t, t = 0), e >= 0 && e <= 1 ? t + e * (n - t) : NaN;
}
function a$(e, t) {
  let n, i;
  const r = {
    min(o) {
      return arguments.length ? (n = o || 0, r) : n;
    },
    max(o) {
      return arguments.length ? (i = o == null ? 1 : o, r) : i;
    },
    sample: () => Rx(n, i),
    pdf: (o) => jx(o, n, i),
    cdf: (o) => Px(o, n, i),
    icdf: (o) => Lx(o, n, i)
  };
  return t == null && (t = e == null ? 1 : e, e = 0), r.min(e).max(t);
}
function zf(e, t, n, i) {
  const r = i - e * e, o = Math.abs(r) < 1e-24 ? 0 : (n - e * t) / r;
  return [t - o * e, o];
}
function ip(e, t, n, i) {
  e = e.filter((h) => {
    let g = t(h), p = n(h);
    return g != null && (g = +g) >= g && p != null && (p = +p) >= p;
  }), i && e.sort((h, g) => t(h) - t(g));
  const r = e.length, o = new Float64Array(r), a = new Float64Array(r);
  let s = 0, u = 0, l = 0, c, f, d;
  for (d of e)
    o[s] = c = +t(d), a[s] = f = +n(d), ++s, u += (c - u) / s, l += (f - l) / s;
  for (s = 0; s < r; ++s)
    o[s] -= u, a[s] -= l;
  return [o, a, u, l];
}
function Uf(e, t, n, i) {
  let r = -1, o, a;
  for (const s of e)
    o = t(s), a = n(s), o != null && (o = +o) >= o && a != null && (a = +a) >= a && i(o, a, ++r);
}
function _l(e, t, n, i, r) {
  let o = 0, a = 0;
  return Uf(e, t, n, (s, u) => {
    const l = u - r(s), c = u - i;
    o += l * l, a += c * c;
  }), 1 - o / a;
}
function Ix(e, t, n) {
  let i = 0, r = 0, o = 0, a = 0, s = 0;
  Uf(e, t, n, (c, f) => {
    ++s, i += (c - i) / s, r += (f - r) / s, o += (c * f - o) / s, a += (c * c - a) / s;
  });
  const u = zf(i, r, o, a), l = (c) => u[0] + u[1] * c;
  return {
    coef: u,
    predict: l,
    rSquared: _l(e, t, n, r, l)
  };
}
function s$(e, t, n) {
  let i = 0, r = 0, o = 0, a = 0, s = 0;
  Uf(e, t, n, (c, f) => {
    ++s, c = Math.log(c), i += (c - i) / s, r += (f - r) / s, o += (c * f - o) / s, a += (c * c - a) / s;
  });
  const u = zf(i, r, o, a), l = (c) => u[0] + u[1] * Math.log(c);
  return {
    coef: u,
    predict: l,
    rSquared: _l(e, t, n, r, l)
  };
}
function u$(e, t, n) {
  const [i, r, o, a] = ip(e, t, n);
  let s = 0, u = 0, l = 0, c = 0, f = 0, d, h, g;
  Uf(e, t, n, (v, b) => {
    d = i[f++], h = Math.log(b), g = d * b, s += (b * h - s) / f, u += (g - u) / f, l += (g * h - l) / f, c += (d * g - c) / f;
  });
  const [p, m] = zf(u / a, s / a, l / a, c / a), y = (v) => Math.exp(p + m * (v - o));
  return {
    coef: [Math.exp(p - m * o), m],
    predict: y,
    rSquared: _l(e, t, n, a, y)
  };
}
function l$(e, t, n) {
  let i = 0, r = 0, o = 0, a = 0, s = 0, u = 0;
  Uf(e, t, n, (f, d) => {
    const h = Math.log(f), g = Math.log(d);
    ++u, i += (h - i) / u, r += (g - r) / u, o += (h * g - o) / u, a += (h * h - a) / u, s += (d - s) / u;
  });
  const l = zf(i, r, o, a), c = (f) => l[0] * Math.pow(f, l[1]);
  return l[0] = Math.exp(l[0]), {
    coef: l,
    predict: c,
    rSquared: _l(e, t, n, s, c)
  };
}
function Bx(e, t, n) {
  const [i, r, o, a] = ip(e, t, n), s = i.length;
  let u = 0, l = 0, c = 0, f = 0, d = 0, h, g, p, m;
  for (h = 0; h < s; )
    g = i[h], p = r[h++], m = g * g, u += (m - u) / h, l += (m * g - l) / h, c += (m * m - c) / h, f += (g * p - f) / h, d += (m * p - d) / h;
  const y = c - u * u, v = u * y - l * l, b = (d * u - f * l) / v, x = (f * y - d * l) / v, E = -b * u, A = (w) => (w = w - o, b * w * w + x * w + E + a);
  return {
    coef: [E - x * o + b * o * o + a, x - 2 * b * o, b],
    predict: A,
    rSquared: _l(e, t, n, a, A)
  };
}
function c$(e, t, n, i) {
  if (i === 1)
    return Ix(e, t, n);
  if (i === 2)
    return Bx(e, t, n);
  const [r, o, a, s] = ip(e, t, n), u = r.length, l = [], c = [], f = i + 1;
  let d, h, g, p, m;
  for (d = 0; d < f; ++d) {
    for (g = 0, p = 0; g < u; ++g)
      p += Math.pow(r[g], d) * o[g];
    for (l.push(p), m = new Float64Array(f), h = 0; h < f; ++h) {
      for (g = 0, p = 0; g < u; ++g)
        p += Math.pow(r[g], d + h);
      m[h] = p;
    }
    c.push(m);
  }
  c.push(l);
  const y = NL(c), v = (b) => {
    b -= a;
    let x = s + y[0] + y[1] * b + y[2] * b * b;
    for (d = 3; d < f; ++d)
      x += y[d] * Math.pow(b, d);
    return x;
  };
  return {
    coef: TL(f, y, -a, s),
    predict: v,
    rSquared: _l(e, t, n, s, v)
  };
}
function TL(e, t, n, i) {
  const r = Array(e);
  let o, a, s, u;
  for (o = 0; o < e; ++o)
    r[o] = 0;
  for (o = e - 1; o >= 0; --o)
    for (s = t[o], u = 1, r[o] += s, a = 1; a <= o; ++a)
      u *= (o + 1 - a) / a, r[o - a] += s * Math.pow(n, a) * u;
  return r[0] += i, r;
}
function NL(e) {
  const t = e.length - 1, n = [];
  let i, r, o, a, s;
  for (i = 0; i < t; ++i) {
    for (a = i, r = i + 1; r < t; ++r)
      Math.abs(e[i][r]) > Math.abs(e[i][a]) && (a = r);
    for (o = i; o < t + 1; ++o)
      s = e[o][i], e[o][i] = e[o][a], e[o][a] = s;
    for (r = i + 1; r < t; ++r)
      for (o = t; o >= i; o--)
        e[o][r] -= e[o][i] * e[i][r] / e[i][i];
  }
  for (r = t - 1; r >= 0; --r) {
    for (s = 0, o = r + 1; o < t; ++o)
      s += e[o][r] * n[o];
    n[r] = (e[t][r] - s) / e[r][r];
  }
  return n;
}
const sO = 2, uO = 1e-12;
function f$(e, t, n, i) {
  const [r, o, a, s] = ip(e, t, n, !0), u = r.length, l = Math.max(2, ~~(i * u)), c = new Float64Array(u), f = new Float64Array(u), d = new Float64Array(u).fill(1);
  for (let h = -1; ++h <= sO; ) {
    const g = [0, l - 1];
    for (let m = 0; m < u; ++m) {
      const y = r[m], v = g[0], b = g[1], x = y - r[v] > r[b] - y ? v : b;
      let E = 0, A = 0, w = 0, _ = 0, k = 0;
      const C = 1 / Math.abs(r[x] - y || 1);
      for (let D = v; D <= b; ++D) {
        const M = r[D], F = o[D], $ = RL(Math.abs(y - M) * C) * d[D], T = M * $;
        E += $, A += T, w += F * $, _ += F * T, k += M * T;
      }
      const [O, S] = zf(A / E, w / E, _ / E, k / E);
      c[m] = O + S * y, f[m] = Math.abs(o[m] - c[m]), jL(r, m + 1, g);
    }
    if (h === sO)
      break;
    const p = UD(f);
    if (Math.abs(p) < uO)
      break;
    for (let m = 0, y, v; m < u; ++m)
      y = f[m] / (6 * p), d[m] = y >= 1 ? uO : (v = 1 - y * y) * v;
  }
  return PL(r, c, a, s);
}
function RL(e) {
  return (e = 1 - e * e * e) * e * e;
}
function jL(e, t, n) {
  const i = e[t];
  let r = n[0], o = n[1] + 1;
  if (!(o >= e.length))
    for (; t > r && e[o] - i <= i - e[r]; )
      n[0] = ++r, n[1] = o, ++o;
}
function PL(e, t, n, i) {
  const r = e.length, o = [];
  let a = 0, s = 0, u = [], l;
  for (; a < r; ++a)
    l = e[a] + n, u[0] === l ? u[1] += (t[a] - u[1]) / ++s : (s = 0, u[1] += i, u = [l, t[a]], o.push(u));
  return u[1] += i, o;
}
const LL = 0.5 * Math.PI / 180;
function rp(e, t, n, i) {
  n = n || 25, i = Math.max(n, i || 200);
  const r = (p) => [p, e(p)], o = t[0], a = t[1], s = a - o, u = s / i, l = [r(o)], c = [];
  if (n === i) {
    for (let p = 1; p < i; ++p)
      l.push(r(o + p / n * s));
    return l.push(r(a)), l;
  } else {
    c.push(r(a));
    for (let p = n; --p > 0; )
      c.push(r(o + p / n * s));
  }
  let f = l[0], d = c[c.length - 1];
  const h = 1 / s, g = IL(f[1], c);
  for (; d; ) {
    const p = r((f[0] + d[0]) / 2);
    p[0] - f[0] >= u && BL(f, p, d, h, g) > LL ? c.push(p) : (f = d, l.push(d), c.pop()), d = c[c.length - 1];
  }
  return l;
}
function IL(e, t) {
  let n = e, i = e;
  const r = t.length;
  for (let o = 0; o < r; ++o) {
    const a = t[o][1];
    a < n && (n = a), a > i && (i = a);
  }
  return 1 / (i - n);
}
function BL(e, t, n, i, r) {
  const o = Math.atan2(r * (n[1] - e[1]), i * (n[0] - e[0])), a = Math.atan2(r * (t[1] - e[1]), i * (t[0] - e[0]));
  return Math.abs(o - a);
}
function zL(e) {
  return (t) => {
    const n = e.length;
    let i = 1, r = String(e[0](t));
    for (; i < n; ++i)
      r += "|" + e[i](t);
    return r;
  };
}
function Wy(e) {
  return !e || !e.length ? function() {
    return "";
  } : e.length === 1 ? e[0] : zL(e);
}
function d$(e, t, n) {
  return n || e + (t ? "_" + t : "");
}
const i1 = () => {
}, UL = {
  init: i1,
  add: i1,
  rem: i1,
  idx: 0
}, rf = {
  values: {
    init: (e) => e.cell.store = !0,
    value: (e) => e.cell.data.values(),
    idx: -1
  },
  count: {
    value: (e) => e.cell.num
  },
  __count__: {
    value: (e) => e.missing + e.valid
  },
  missing: {
    value: (e) => e.missing
  },
  valid: {
    value: (e) => e.valid
  },
  sum: {
    init: (e) => e.sum = 0,
    value: (e) => e.sum,
    add: (e, t) => e.sum += +t,
    rem: (e, t) => e.sum -= t
  },
  product: {
    init: (e) => e.product = 1,
    value: (e) => e.valid ? e.product : void 0,
    add: (e, t) => e.product *= t,
    rem: (e, t) => e.product /= t
  },
  mean: {
    init: (e) => e.mean = 0,
    value: (e) => e.valid ? e.mean : void 0,
    add: (e, t) => (e.mean_d = t - e.mean, e.mean += e.mean_d / e.valid),
    rem: (e, t) => (e.mean_d = t - e.mean, e.mean -= e.valid ? e.mean_d / e.valid : e.mean)
  },
  average: {
    value: (e) => e.valid ? e.mean : void 0,
    req: ["mean"],
    idx: 1
  },
  variance: {
    init: (e) => e.dev = 0,
    value: (e) => e.valid > 1 ? e.dev / (e.valid - 1) : void 0,
    add: (e, t) => e.dev += e.mean_d * (t - e.mean),
    rem: (e, t) => e.dev -= e.mean_d * (t - e.mean),
    req: ["mean"],
    idx: 1
  },
  variancep: {
    value: (e) => e.valid > 1 ? e.dev / e.valid : void 0,
    req: ["variance"],
    idx: 2
  },
  stdev: {
    value: (e) => e.valid > 1 ? Math.sqrt(e.dev / (e.valid - 1)) : void 0,
    req: ["variance"],
    idx: 2
  },
  stdevp: {
    value: (e) => e.valid > 1 ? Math.sqrt(e.dev / e.valid) : void 0,
    req: ["variance"],
    idx: 2
  },
  stderr: {
    value: (e) => e.valid > 1 ? Math.sqrt(e.dev / (e.valid * (e.valid - 1))) : void 0,
    req: ["variance"],
    idx: 2
  },
  distinct: {
    value: (e) => e.cell.data.distinct(e.get),
    req: ["values"],
    idx: 3
  },
  ci0: {
    value: (e) => e.cell.data.ci0(e.get),
    req: ["values"],
    idx: 3
  },
  ci1: {
    value: (e) => e.cell.data.ci1(e.get),
    req: ["values"],
    idx: 3
  },
  median: {
    value: (e) => e.cell.data.q2(e.get),
    req: ["values"],
    idx: 3
  },
  q1: {
    value: (e) => e.cell.data.q1(e.get),
    req: ["values"],
    idx: 3
  },
  q3: {
    value: (e) => e.cell.data.q3(e.get),
    req: ["values"],
    idx: 3
  },
  min: {
    init: (e) => e.min = void 0,
    value: (e) => e.min = Number.isNaN(e.min) ? e.cell.data.min(e.get) : e.min,
    add: (e, t) => {
      (t < e.min || e.min === void 0) && (e.min = t);
    },
    rem: (e, t) => {
      t <= e.min && (e.min = NaN);
    },
    req: ["values"],
    idx: 4
  },
  max: {
    init: (e) => e.max = void 0,
    value: (e) => e.max = Number.isNaN(e.max) ? e.cell.data.max(e.get) : e.max,
    add: (e, t) => {
      (t > e.max || e.max === void 0) && (e.max = t);
    },
    rem: (e, t) => {
      t >= e.max && (e.max = NaN);
    },
    req: ["values"],
    idx: 4
  },
  argmin: {
    init: (e) => e.argmin = void 0,
    value: (e) => e.argmin || e.cell.data.argmin(e.get),
    add: (e, t, n) => {
      t < e.min && (e.argmin = n);
    },
    rem: (e, t) => {
      t <= e.min && (e.argmin = void 0);
    },
    req: ["min", "values"],
    idx: 3
  },
  argmax: {
    init: (e) => e.argmax = void 0,
    value: (e) => e.argmax || e.cell.data.argmax(e.get),
    add: (e, t, n) => {
      t > e.max && (e.argmax = n);
    },
    rem: (e, t) => {
      t >= e.max && (e.argmax = void 0);
    },
    req: ["max", "values"],
    idx: 3
  }
}, qf = Object.keys(rf);
function qL(e, t) {
  return (n) => de({
    name: e,
    out: n || e
  }, UL, t);
}
qf.forEach((e) => {
  rf[e] = qL(e, rf[e]);
});
function h$(e, t) {
  return rf[e](t);
}
function g$(e, t) {
  return e.idx - t.idx;
}
function WL(e) {
  const t = {};
  e.forEach((i) => t[i.name] = i);
  const n = (i) => {
    !i.req || i.req.forEach((r) => {
      t[r] || n(t[r] = rf[r]());
    });
  };
  return e.forEach(n), Object.values(t).sort(g$);
}
function GL() {
  this.valid = 0, this.missing = 0, this._ops.forEach((e) => e.init(this));
}
function HL(e, t) {
  if (e == null || e === "") {
    ++this.missing;
    return;
  }
  e === e && (++this.valid, this._ops.forEach((n) => n.add(this, e, t)));
}
function YL(e, t) {
  if (e == null || e === "") {
    --this.missing;
    return;
  }
  e === e && (--this.valid, this._ops.forEach((n) => n.rem(this, e, t)));
}
function XL(e) {
  return this._out.forEach((t) => e[t.out] = t.value(this)), e;
}
function p$(e, t) {
  const n = t || mn, i = WL(e), r = e.slice().sort(g$);
  function o(a) {
    this._ops = i, this._out = r, this.cell = a, this.init();
  }
  return o.prototype.init = GL, o.prototype.add = HL, o.prototype.rem = YL, o.prototype.set = XL, o.prototype.get = n, o.fields = e.map((a) => a.out), o;
}
function zx(e) {
  this._key = e ? Mn(e) : Z, this.reset();
}
const Pt = zx.prototype;
Pt.reset = function() {
  this._add = [], this._rem = [], this._ext = null, this._get = null, this._q = null;
};
Pt.add = function(e) {
  this._add.push(e);
};
Pt.rem = function(e) {
  this._rem.push(e);
};
Pt.values = function() {
  if (this._get = null, this._rem.length === 0)
    return this._add;
  const e = this._add, t = this._rem, n = this._key, i = e.length, r = t.length, o = Array(i - r), a = {};
  let s, u, l;
  for (s = 0; s < r; ++s)
    a[n(t[s])] = 1;
  for (s = 0, u = 0; s < i; ++s)
    a[n(l = e[s])] ? a[n(l)] = 0 : o[u++] = l;
  return this._rem = [], this._add = o;
};
Pt.distinct = function(e) {
  const t = this.values(), n = {};
  let i = t.length, r = 0, o;
  for (; --i >= 0; )
    o = e(t[i]) + "", ae(n, o) || (n[o] = 1, ++r);
  return r;
};
Pt.extent = function(e) {
  if (this._get !== e || !this._ext) {
    const t = this.values(), n = ED(t, e);
    this._ext = [t[n[0]], t[n[1]]], this._get = e;
  }
  return this._ext;
};
Pt.argmin = function(e) {
  return this.extent(e)[0] || {};
};
Pt.argmax = function(e) {
  return this.extent(e)[1] || {};
};
Pt.min = function(e) {
  const t = this.extent(e)[0];
  return t != null ? e(t) : void 0;
};
Pt.max = function(e) {
  const t = this.extent(e)[1];
  return t != null ? e(t) : void 0;
};
Pt.quartile = function(e) {
  return (this._get !== e || !this._q) && (this._q = Sx(this.values(), e), this._get = e), this._q;
};
Pt.q1 = function(e) {
  return this.quartile(e)[0];
};
Pt.q2 = function(e) {
  return this.quartile(e)[1];
};
Pt.q3 = function(e) {
  return this.quartile(e)[2];
};
Pt.ci = function(e) {
  return (this._get !== e || !this._ci) && (this._ci = t$(this.values(), 1e3, 0.05, e), this._get = e), this._ci;
};
Pt.ci0 = function(e) {
  return this.ci(e)[0];
};
Pt.ci1 = function(e) {
  return this.ci(e)[1];
};
function aa(e) {
  N.call(this, null, e), this._adds = [], this._mods = [], this._alen = 0, this._mlen = 0, this._drop = !0, this._cross = !1, this._dims = [], this._dnames = [], this._measures = [], this._countOnly = !1, this._counts = null, this._prev = null, this._inputs = null, this._outputs = null;
}
aa.Definition = {
  type: "Aggregate",
  metadata: {
    generates: !0,
    changes: !0
  },
  params: [{
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "ops",
    type: "enum",
    array: !0,
    values: qf
  }, {
    name: "fields",
    type: "field",
    null: !0,
    array: !0
  }, {
    name: "as",
    type: "string",
    null: !0,
    array: !0
  }, {
    name: "drop",
    type: "boolean",
    default: !0
  }, {
    name: "cross",
    type: "boolean",
    default: !1
  }, {
    name: "key",
    type: "field"
  }]
};
q(aa, N, {
  transform(e, t) {
    const n = this, i = t.fork(t.NO_SOURCE | t.NO_FIELDS), r = e.modified();
    return n.stamp = i.stamp, n.value && (r || t.modified(n._inputs, !0)) ? (n._prev = n.value, n.value = r ? n.init(e) : {}, t.visit(t.SOURCE, (o) => n.add(o))) : (n.value = n.value || n.init(e), t.visit(t.REM, (o) => n.rem(o)), t.visit(t.ADD, (o) => n.add(o))), i.modifies(n._outputs), n._drop = e.drop !== !1, e.cross && n._dims.length > 1 && (n._drop = !1, n.cross()), t.clean() && n._drop && i.clean(!0).runAfter(() => this.clean()), n.changes(i);
  },
  cross() {
    const e = this, t = e.value, n = e._dnames, i = n.map(() => ({})), r = n.length;
    function o(s) {
      let u, l, c, f;
      for (u in s)
        for (c = s[u].tuple, l = 0; l < r; ++l)
          i[l][f = c[n[l]]] = f;
    }
    o(e._prev), o(t);
    function a(s, u, l) {
      const c = n[l], f = i[l++];
      for (const d in f) {
        const h = s ? s + "|" + d : d;
        u[c] = f[d], l < r ? a(h, u, l) : t[h] || e.cell(h, u);
      }
    }
    a("", {}, 0);
  },
  init(e) {
    const t = this._inputs = [], n = this._outputs = [], i = {};
    function r(m) {
      const y = oe(Yt(m)), v = y.length;
      let b = 0, x;
      for (; b < v; ++b)
        i[x = y[b]] || (i[x] = 1, t.push(x));
    }
    this._dims = oe(e.groupby), this._dnames = this._dims.map((m) => {
      const y = ot(m);
      return r(m), n.push(y), y;
    }), this.cellkey = e.key ? e.key : Wy(this._dims), this._countOnly = !0, this._counts = [], this._measures = [];
    const o = e.fields || [null], a = e.ops || ["count"], s = e.as || [], u = o.length, l = {};
    let c, f, d, h, g, p;
    for (u !== a.length && P("Unmatched number of fields and aggregate ops."), p = 0; p < u; ++p) {
      if (c = o[p], f = a[p], c == null && f !== "count" && P("Null aggregate field specified."), h = ot(c), g = d$(f, h, s[p]), n.push(g), f === "count") {
        this._counts.push(g);
        continue;
      }
      d = l[h], d || (r(c), d = l[h] = [], d.field = c, this._measures.push(d)), f !== "count" && (this._countOnly = !1), d.push(h$(f, g));
    }
    return this._measures = this._measures.map((m) => p$(m, m.field)), {};
  },
  cellkey: Wy(),
  cell(e, t) {
    let n = this.value[e];
    return n ? n.num === 0 && this._drop && n.stamp < this.stamp ? (n.stamp = this.stamp, this._adds[this._alen++] = n) : n.stamp < this.stamp && (n.stamp = this.stamp, this._mods[this._mlen++] = n) : (n = this.value[e] = this.newcell(e, t), this._adds[this._alen++] = n), n;
  },
  newcell(e, t) {
    const n = {
      key: e,
      num: 0,
      agg: null,
      tuple: this.newtuple(t, this._prev && this._prev[e]),
      stamp: this.stamp,
      store: !1
    };
    if (!this._countOnly) {
      const i = this._measures, r = i.length;
      n.agg = Array(r);
      for (let o = 0; o < r; ++o)
        n.agg[o] = new i[o](n);
    }
    return n.store && (n.data = new zx()), n;
  },
  newtuple(e, t) {
    const n = this._dnames, i = this._dims, r = i.length, o = {};
    for (let a = 0; a < r; ++a)
      o[n[a]] = i[a](e);
    return t ? Y3(t.tuple, o) : Te(o);
  },
  clean() {
    const e = this.value;
    for (const t in e)
      e[t].num === 0 && delete e[t];
  },
  add(e) {
    const t = this.cellkey(e), n = this.cell(t, e);
    if (n.num += 1, this._countOnly)
      return;
    n.store && n.data.add(e);
    const i = n.agg;
    for (let r = 0, o = i.length; r < o; ++r)
      i[r].add(i[r].get(e), e);
  },
  rem(e) {
    const t = this.cellkey(e), n = this.cell(t, e);
    if (n.num -= 1, this._countOnly)
      return;
    n.store && n.data.rem(e);
    const i = n.agg;
    for (let r = 0, o = i.length; r < o; ++r)
      i[r].rem(i[r].get(e), e);
  },
  celltuple(e) {
    const t = e.tuple, n = this._counts;
    e.store && e.data.values();
    for (let i = 0, r = n.length; i < r; ++i)
      t[n[i]] = e.num;
    if (!this._countOnly) {
      const i = e.agg;
      for (let r = 0, o = i.length; r < o; ++r)
        i[r].set(t);
    }
    return t;
  },
  changes(e) {
    const t = this._adds, n = this._mods, i = this._prev, r = this._drop, o = e.add, a = e.rem, s = e.mod;
    let u, l, c, f;
    if (i)
      for (l in i)
        u = i[l], (!r || u.num) && a.push(u.tuple);
    for (c = 0, f = this._alen; c < f; ++c)
      o.push(this.celltuple(t[c])), t[c] = null;
    for (c = 0, f = this._mlen; c < f; ++c)
      u = n[c], (u.num === 0 && r ? a : s).push(this.celltuple(u)), n[c] = null;
    return this._alen = this._mlen = 0, this._prev = null, e;
  }
});
const VL = 1e-14;
function Ux(e) {
  N.call(this, null, e);
}
Ux.Definition = {
  type: "Bin",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "field",
    type: "field",
    required: !0
  }, {
    name: "interval",
    type: "boolean",
    default: !0
  }, {
    name: "anchor",
    type: "number"
  }, {
    name: "maxbins",
    type: "number",
    default: 20
  }, {
    name: "base",
    type: "number",
    default: 10
  }, {
    name: "divide",
    type: "number",
    array: !0,
    default: [5, 2]
  }, {
    name: "extent",
    type: "number",
    array: !0,
    length: 2,
    required: !0
  }, {
    name: "span",
    type: "number"
  }, {
    name: "step",
    type: "number"
  }, {
    name: "steps",
    type: "number",
    array: !0
  }, {
    name: "minstep",
    type: "number",
    default: 0
  }, {
    name: "nice",
    type: "boolean",
    default: !0
  }, {
    name: "name",
    type: "string"
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: 2,
    default: ["bin0", "bin1"]
  }]
};
q(Ux, N, {
  transform(e, t) {
    const n = e.interval !== !1, i = this._bins(e), r = i.start, o = i.step, a = e.as || ["bin0", "bin1"], s = a[0], u = a[1];
    let l;
    return e.modified() ? (t = t.reflow(!0), l = t.SOURCE) : l = t.modified(Yt(e.field)) ? t.ADD_MOD : t.ADD, t.visit(l, n ? (c) => {
      const f = i(c);
      c[s] = f, c[u] = f == null ? null : r + o * (1 + (f - r) / o);
    } : (c) => c[s] = i(c)), t.modifies(n ? a : s);
  },
  _bins(e) {
    if (this.value && !e.modified())
      return this.value;
    const t = e.field, n = e$(e), i = n.step;
    let r = n.start, o = r + Math.ceil((n.stop - r) / i) * i, a, s;
    (a = e.anchor) != null && (s = a - (r + i * Math.floor((a - r) / i)), r += s, o += s);
    const u = function(l) {
      let c = Wt(t(l));
      return c == null ? null : c < r ? -1 / 0 : c > o ? 1 / 0 : (c = Math.max(r, Math.min(c, o - i)), r + i * Math.floor(VL + (c - r) / i));
    };
    return u.start = r, u.stop = n.stop, u.step = i, this.value = In(u, Yt(t), e.name || "bin_" + ot(t));
  }
});
function m$(e, t, n) {
  const i = e;
  let r = t || [], o = n || [], a = {}, s = 0;
  return {
    add: (u) => o.push(u),
    remove: (u) => a[i(u)] = ++s,
    size: () => r.length,
    data: (u, l) => (s && (r = r.filter((c) => !a[i(c)]), a = {}, s = 0), l && u && r.sort(u), o.length && (r = u ? FD(u, r, o.sort(u)) : r.concat(o), o = []), r)
  };
}
function qx(e) {
  N.call(this, [], e);
}
qx.Definition = {
  type: "Collect",
  metadata: {
    source: !0
  },
  params: [{
    name: "sort",
    type: "compare"
  }]
};
q(qx, N, {
  transform(e, t) {
    const n = t.fork(t.ALL), i = m$(Z, this.value, n.materialize(n.ADD).add), r = e.sort, o = t.changed() || r && (e.modified("sort") || t.modified(r.fields));
    return n.visit(n.REM, i.remove), this.modified(o), this.value = n.source = i.data(Ws(r), o), t.source && t.source.root && (this.value.root = t.source.root), n;
  }
});
function y$(e) {
  qe.call(this, null, KL, e);
}
q(y$, qe);
function KL(e) {
  return this.value && !e.modified() ? this.value : Kb(e.fields, e.orders);
}
function Wx(e) {
  N.call(this, null, e);
}
Wx.Definition = {
  type: "CountPattern",
  metadata: {
    generates: !0,
    changes: !0
  },
  params: [{
    name: "field",
    type: "field",
    required: !0
  }, {
    name: "case",
    type: "enum",
    values: ["upper", "lower", "mixed"],
    default: "mixed"
  }, {
    name: "pattern",
    type: "string",
    default: '[\\w"]+'
  }, {
    name: "stopwords",
    type: "string",
    default: ""
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: 2,
    default: ["text", "count"]
  }]
};
function JL(e, t, n) {
  switch (t) {
    case "upper":
      e = e.toUpperCase();
      break;
    case "lower":
      e = e.toLowerCase();
      break;
  }
  return e.match(n);
}
q(Wx, N, {
  transform(e, t) {
    const n = (f) => (d) => {
      for (var h = JL(s(d), e.case, o) || [], g, p = 0, m = h.length; p < m; ++p)
        a.test(g = h[p]) || f(g);
    }, i = this._parameterCheck(e, t), r = this._counts, o = this._match, a = this._stop, s = e.field, u = e.as || ["text", "count"], l = n((f) => r[f] = 1 + (r[f] || 0)), c = n((f) => r[f] -= 1);
    return i ? t.visit(t.SOURCE, l) : (t.visit(t.ADD, l), t.visit(t.REM, c)), this._finish(t, u);
  },
  _parameterCheck(e, t) {
    let n = !1;
    return (e.modified("stopwords") || !this._stop) && (this._stop = new RegExp("^" + (e.stopwords || "") + "$", "i"), n = !0), (e.modified("pattern") || !this._match) && (this._match = new RegExp(e.pattern || "[\\w']+", "g"), n = !0), (e.modified("field") || t.modified(e.field.fields)) && (n = !0), n && (this._counts = {}), n;
  },
  _finish(e, t) {
    const n = this._counts, i = this._tuples || (this._tuples = {}), r = t[0], o = t[1], a = e.fork(e.NO_SOURCE | e.NO_FIELDS);
    let s, u, l;
    for (s in n)
      u = i[s], l = n[s] || 0, !u && l ? (i[s] = u = Te({}), u[r] = s, u[o] = l, a.add.push(u)) : l === 0 ? (u && a.rem.push(u), n[s] = null, i[s] = null) : u[o] !== l && (u[o] = l, a.mod.push(u));
    return a.modifies(t);
  }
});
function Gx(e) {
  N.call(this, null, e);
}
Gx.Definition = {
  type: "Cross",
  metadata: {
    generates: !0
  },
  params: [{
    name: "filter",
    type: "expr"
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: 2,
    default: ["a", "b"]
  }]
};
q(Gx, N, {
  transform(e, t) {
    const n = t.fork(t.NO_SOURCE), i = e.as || ["a", "b"], r = i[0], o = i[1], a = !this.value || t.changed(t.ADD_REM) || e.modified("as") || e.modified("filter");
    let s = this.value;
    return a ? (s && (n.rem = s), s = t.materialize(t.SOURCE).source, n.add = this.value = QL(s, r, o, e.filter || ci)) : n.mod = s, n.source = this.value, n.modifies(i);
  }
});
function QL(e, t, n, i) {
  for (var r = [], o = {}, a = e.length, s = 0, u, l; s < a; ++s)
    for (o[t] = l = e[s], u = 0; u < a; ++u)
      o[n] = e[u], i(o) && (r.push(Te(o)), o = {}, o[t] = l);
  return r;
}
const lO = {
  kde: Dx,
  mixture: o$,
  normal: kx,
  lognormal: r$,
  uniform: a$
}, ZL = "distributions", cO = "function", eI = "field";
function v$(e, t) {
  const n = e[cO];
  ae(lO, n) || P("Unknown distribution function: " + n);
  const i = lO[n]();
  for (const r in e)
    r === eI ? i.data((e.from || t()).map(e[r])) : r === ZL ? i[r](e[r].map((o) => v$(o, t))) : typeof i[r] === cO && i[r](e[r]);
  return i;
}
function Hx(e) {
  N.call(this, null, e);
}
const b$ = [{
  key: {
    function: "normal"
  },
  params: [{
    name: "mean",
    type: "number",
    default: 0
  }, {
    name: "stdev",
    type: "number",
    default: 1
  }]
}, {
  key: {
    function: "lognormal"
  },
  params: [{
    name: "mean",
    type: "number",
    default: 0
  }, {
    name: "stdev",
    type: "number",
    default: 1
  }]
}, {
  key: {
    function: "uniform"
  },
  params: [{
    name: "min",
    type: "number",
    default: 0
  }, {
    name: "max",
    type: "number",
    default: 1
  }]
}, {
  key: {
    function: "kde"
  },
  params: [{
    name: "field",
    type: "field",
    required: !0
  }, {
    name: "from",
    type: "data"
  }, {
    name: "bandwidth",
    type: "number",
    default: 0
  }]
}], tI = {
  key: {
    function: "mixture"
  },
  params: [{
    name: "distributions",
    type: "param",
    array: !0,
    params: b$
  }, {
    name: "weights",
    type: "number",
    array: !0
  }]
};
Hx.Definition = {
  type: "Density",
  metadata: {
    generates: !0
  },
  params: [{
    name: "extent",
    type: "number",
    array: !0,
    length: 2
  }, {
    name: "steps",
    type: "number"
  }, {
    name: "minsteps",
    type: "number",
    default: 25
  }, {
    name: "maxsteps",
    type: "number",
    default: 200
  }, {
    name: "method",
    type: "string",
    default: "pdf",
    values: ["pdf", "cdf"]
  }, {
    name: "distribution",
    type: "param",
    params: b$.concat(tI)
  }, {
    name: "as",
    type: "string",
    array: !0,
    default: ["value", "density"]
  }]
};
q(Hx, N, {
  transform(e, t) {
    const n = t.fork(t.NO_SOURCE | t.NO_FIELDS);
    if (!this.value || t.changed() || e.modified()) {
      const i = v$(e.distribution, nI(t)), r = e.steps || e.minsteps || 25, o = e.steps || e.maxsteps || 200;
      let a = e.method || "pdf";
      a !== "pdf" && a !== "cdf" && P("Invalid density method: " + a), !e.extent && !i.data && P("Missing density extent parameter."), a = i[a];
      const s = e.as || ["value", "density"], u = e.extent || vr(i.data()), l = rp(a, u, r, o).map((c) => {
        const f = {};
        return f[s[0]] = c[0], f[s[1]] = c[1], Te(f);
      });
      this.value && (n.rem = this.value), this.value = n.add = n.source = l;
    }
    return n;
  }
});
function nI(e) {
  return () => e.materialize(e.SOURCE).source;
}
function x$(e, t) {
  return e ? e.map((n, i) => t[i] || ot(n)) : null;
}
function Yx(e, t, n) {
  const i = [], r = (f) => f(u);
  let o, a, s, u, l, c;
  if (t == null)
    i.push(e.map(n));
  else
    for (o = {}, a = 0, s = e.length; a < s; ++a)
      u = e[a], l = t.map(r), c = o[l], c || (o[l] = c = [], c.dims = l, i.push(c)), c.push(n(u));
  return i;
}
const w$ = "bin";
function Xx(e) {
  N.call(this, null, e);
}
Xx.Definition = {
  type: "DotBin",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "field",
    type: "field",
    required: !0
  }, {
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "step",
    type: "number"
  }, {
    name: "smooth",
    type: "boolean",
    default: !1
  }, {
    name: "as",
    type: "string",
    default: w$
  }]
};
const iI = (e, t) => Lf(vr(e, t)) / 30;
q(Xx, N, {
  transform(e, t) {
    if (this.value && !(e.modified() || t.changed()))
      return t;
    const n = t.materialize(t.SOURCE).source, i = Yx(t.source, e.groupby, mn), r = e.smooth || !1, o = e.field, a = e.step || iI(n, o), s = Ws((g, p) => o(g) - o(p)), u = e.as || w$, l = i.length;
    let c = 1 / 0, f = -1 / 0, d = 0, h;
    for (; d < l; ++d) {
      const g = i[d].sort(s);
      h = -1;
      for (const p of n$(g, a, r, o))
        p < c && (c = p), p > f && (f = p), g[++h][u] = p;
    }
    return this.value = {
      start: c,
      stop: f,
      step: a
    }, t.reflow(!0).modifies(u);
  }
});
function E$(e) {
  qe.call(this, null, rI, e), this.modified(!0);
}
q(E$, qe);
function rI(e) {
  const t = e.expr;
  return this.value && !e.modified("expr") ? this.value : In((n) => t(n, e), Yt(t), ot(t));
}
function Vx(e) {
  N.call(this, [void 0, void 0], e);
}
Vx.Definition = {
  type: "Extent",
  metadata: {},
  params: [{
    name: "field",
    type: "field",
    required: !0
  }]
};
q(Vx, N, {
  transform(e, t) {
    const n = this.value, i = e.field, r = t.changed() || t.modified(i.fields) || e.modified("field");
    let o = n[0], a = n[1];
    if ((r || o == null) && (o = 1 / 0, a = -1 / 0), t.visit(r ? t.SOURCE : t.ADD, (s) => {
      const u = Wt(i(s));
      u != null && (u < o && (o = u), u > a && (a = u));
    }), !Number.isFinite(o) || !Number.isFinite(a)) {
      let s = ot(i);
      s && (s = ' for field "'.concat(s, '"')), t.dataflow.warn("Infinite extent".concat(s, ": [").concat(o, ", ").concat(a, "]")), o = a = void 0;
    }
    this.value = [o, a];
  }
});
function Kx(e, t) {
  qe.call(this, e), this.parent = t, this.count = 0;
}
q(Kx, qe, {
  connect(e) {
    return this.detachSubflow = e.detachSubflow, this.targets().add(e), e.source = this;
  },
  add(e) {
    this.count += 1, this.value.add.push(e);
  },
  rem(e) {
    this.count -= 1, this.value.rem.push(e);
  },
  mod(e) {
    this.value.mod.push(e);
  },
  init(e) {
    this.value.init(e, e.NO_SOURCE);
  },
  evaluate() {
    return this.value;
  }
});
function op(e) {
  N.call(this, {}, e), this._keys = bl();
  const t = this._targets = [];
  t.active = 0, t.forEach = (n) => {
    for (let i = 0, r = t.active; i < r; ++i)
      n(t[i], i, t);
  };
}
q(op, N, {
  activate(e) {
    this._targets[this._targets.active++] = e;
  },
  subflow(e, t, n, i) {
    const r = this.value;
    let o = ae(r, e) && r[e], a, s;
    return o ? o.value.stamp < n.stamp && (o.init(n), this.activate(o)) : (s = i || (s = this._group[e]) && s.tuple, a = n.dataflow, o = new Kx(n.fork(n.NO_SOURCE), this), a.add(o).connect(t(a, e, s)), r[e] = o, this.activate(o)), o;
  },
  clean() {
    const e = this.value;
    let t = 0;
    for (const n in e)
      if (e[n].count === 0) {
        const i = e[n].detachSubflow;
        i && i(), delete e[n], ++t;
      }
    if (t) {
      const n = this._targets.filter((i) => i && i.count > 0);
      this.initTargets(n);
    }
  },
  initTargets(e) {
    const t = this._targets, n = t.length, i = e ? e.length : 0;
    let r = 0;
    for (; r < i; ++r)
      t[r] = e[r];
    for (; r < n && t[r] != null; ++r)
      t[r] = null;
    t.active = i;
  },
  transform(e, t) {
    const n = t.dataflow, i = e.key, r = e.subflow, o = this._keys, a = e.modified("key"), s = (u) => this.subflow(u, r, t);
    return this._group = e.group || {}, this.initTargets(), t.visit(t.REM, (u) => {
      const l = Z(u), c = o.get(l);
      c !== void 0 && (o.delete(l), s(c).rem(u));
    }), t.visit(t.ADD, (u) => {
      const l = i(u);
      o.set(Z(u), l), s(l).add(u);
    }), a || t.modified(i.fields) ? t.visit(t.MOD, (u) => {
      const l = Z(u), c = o.get(l), f = i(u);
      c === f ? s(f).mod(u) : (o.set(l, f), s(c).rem(u), s(f).add(u));
    }) : t.changed(t.MOD) && t.visit(t.MOD, (u) => {
      s(o.get(Z(u))).mod(u);
    }), a && t.visit(t.REFLOW, (u) => {
      const l = Z(u), c = o.get(l), f = i(u);
      c !== f && (o.set(l, f), s(c).rem(u), s(f).add(u));
    }), t.clean() ? n.runAfter(() => {
      this.clean(), o.clean();
    }) : o.empty > n.cleanThreshold && n.runAfter(o.clean), t;
  }
});
function A$(e) {
  qe.call(this, null, oI, e);
}
q(A$, qe);
function oI(e) {
  return this.value && !e.modified() ? this.value : J(e.name) ? oe(e.name).map((t) => Mn(t)) : Mn(e.name, e.as);
}
function Jx(e) {
  N.call(this, bl(), e);
}
Jx.Definition = {
  type: "Filter",
  metadata: {
    changes: !0
  },
  params: [{
    name: "expr",
    type: "expr",
    required: !0
  }]
};
q(Jx, N, {
  transform(e, t) {
    const n = t.dataflow, i = this.value, r = t.fork(), o = r.add, a = r.rem, s = r.mod, u = e.expr;
    let l = !0;
    t.visit(t.REM, (f) => {
      const d = Z(f);
      i.has(d) ? i.delete(d) : a.push(f);
    }), t.visit(t.ADD, (f) => {
      u(f, e) ? o.push(f) : i.set(Z(f), 1);
    });
    function c(f) {
      const d = Z(f), h = u(f, e), g = i.get(d);
      h && g ? (i.delete(d), o.push(f)) : !h && !g ? (i.set(d, 1), a.push(f)) : l && h && !g && s.push(f);
    }
    return t.visit(t.MOD, c), e.modified() && (l = !1, t.visit(t.REFLOW, c)), i.empty > n.cleanThreshold && n.runAfter(i.clean), r;
  }
});
function Qx(e) {
  N.call(this, [], e);
}
Qx.Definition = {
  type: "Flatten",
  metadata: {
    generates: !0
  },
  params: [{
    name: "fields",
    type: "field",
    array: !0,
    required: !0
  }, {
    name: "index",
    type: "string"
  }, {
    name: "as",
    type: "string",
    array: !0
  }]
};
q(Qx, N, {
  transform(e, t) {
    const n = t.fork(t.NO_SOURCE), i = e.fields, r = x$(i, e.as || []), o = e.index || null, a = r.length;
    return n.rem = this.value, t.visit(t.SOURCE, (s) => {
      const u = i.map((g) => g(s)), l = u.reduce((g, p) => Math.max(g, p.length), 0);
      let c = 0, f, d, h;
      for (; c < l; ++c) {
        for (d = Ex(s), f = 0; f < a; ++f)
          d[r[f]] = (h = u[f][c]) == null ? null : h;
        o && (d[o] = c), n.add.push(d);
      }
    }), this.value = n.source = n.add, o && n.modifies(o), n.modifies(r);
  }
});
function Zx(e) {
  N.call(this, [], e);
}
Zx.Definition = {
  type: "Fold",
  metadata: {
    generates: !0
  },
  params: [{
    name: "fields",
    type: "field",
    array: !0,
    required: !0
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: 2,
    default: ["key", "value"]
  }]
};
q(Zx, N, {
  transform(e, t) {
    const n = t.fork(t.NO_SOURCE), i = e.fields, r = i.map(ot), o = e.as || ["key", "value"], a = o[0], s = o[1], u = i.length;
    return n.rem = this.value, t.visit(t.SOURCE, (l) => {
      for (let c = 0, f; c < u; ++c)
        f = Ex(l), f[a] = r[c], f[s] = i[c](l), n.add.push(f);
    }), this.value = n.source = n.add, n.modifies(o);
  }
});
function e2(e) {
  N.call(this, null, e);
}
e2.Definition = {
  type: "Formula",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "expr",
    type: "expr",
    required: !0
  }, {
    name: "as",
    type: "string",
    required: !0
  }, {
    name: "initonly",
    type: "boolean"
  }]
};
q(e2, N, {
  transform(e, t) {
    const n = e.expr, i = e.as, r = e.modified(), o = e.initonly ? t.ADD : r ? t.SOURCE : t.modified(n.fields) || t.modified(i) ? t.ADD_MOD : t.ADD;
    return r && (t = t.materialize().reflow(!0)), e.initonly || t.modifies(i), t.visit(o, (a) => a[i] = n(a, e));
  }
});
function _$(e) {
  N.call(this, [], e);
}
q(_$, N, {
  transform(e, t) {
    const n = t.fork(t.ALL), i = e.generator;
    let r = this.value, o = e.size - r.length, a, s, u;
    if (o > 0) {
      for (a = []; --o >= 0; )
        a.push(u = Te(i(e))), r.push(u);
      n.add = n.add.length ? n.materialize(n.ADD).add.concat(a) : a;
    } else
      s = r.slice(0, -o), n.rem = n.rem.length ? n.materialize(n.REM).rem.concat(s) : s, r = r.slice(-o);
    return n.source = this.value = r, n;
  }
});
const Id = {
  value: "value",
  median: UD,
  mean: W9,
  min: Ty,
  max: fs
}, aI = [];
function t2(e) {
  N.call(this, [], e);
}
t2.Definition = {
  type: "Impute",
  metadata: {
    changes: !0
  },
  params: [{
    name: "field",
    type: "field",
    required: !0
  }, {
    name: "key",
    type: "field",
    required: !0
  }, {
    name: "keyvals",
    array: !0
  }, {
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "method",
    type: "enum",
    default: "value",
    values: ["value", "mean", "median", "max", "min"]
  }, {
    name: "value",
    default: 0
  }]
};
function sI(e) {
  var t = e.method || Id.value, n;
  if (Id[t] == null)
    P("Unrecognized imputation method: " + t);
  else
    return t === Id.value ? (n = e.value !== void 0 ? e.value : 0, () => n) : Id[t];
}
function uI(e) {
  const t = e.field;
  return (n) => n ? t(n) : NaN;
}
q(t2, N, {
  transform(e, t) {
    var n = t.fork(t.ALL), i = sI(e), r = uI(e), o = ot(e.field), a = ot(e.key), s = (e.groupby || []).map(ot), u = lI(t.source, e.groupby, e.key, e.keyvals), l = [], c = this.value, f = u.domain.length, d, h, g, p, m, y, v, b, x, E;
    for (m = 0, b = u.length; m < b; ++m)
      for (d = u[m], g = d.values, h = NaN, v = 0; v < f; ++v)
        if (d[v] == null) {
          for (p = u.domain[v], E = {
            _impute: !0
          }, y = 0, x = g.length; y < x; ++y)
            E[s[y]] = g[y];
          E[a] = p, E[o] = Number.isNaN(h) ? h = i(d, r) : h, l.push(Te(E));
        }
    return l.length && (n.add = n.materialize(n.ADD).add.concat(l)), c.length && (n.rem = n.materialize(n.REM).rem.concat(c)), this.value = l, n;
  }
});
function lI(e, t, n, i) {
  var r = (y) => y(m), o = [], a = i ? i.slice() : [], s = {}, u = {}, l, c, f, d, h, g, p, m;
  for (a.forEach((y, v) => s[y] = v + 1), d = 0, p = e.length; d < p; ++d)
    m = e[d], g = n(m), h = s[g] || (s[g] = a.push(g)), c = (l = t ? t.map(r) : aI) + "", (f = u[c]) || (f = u[c] = [], o.push(f), f.values = l), f[h - 1] = m;
  return o.domain = a, o;
}
function n2(e) {
  aa.call(this, e);
}
n2.Definition = {
  type: "JoinAggregate",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "fields",
    type: "field",
    null: !0,
    array: !0
  }, {
    name: "ops",
    type: "enum",
    array: !0,
    values: qf
  }, {
    name: "as",
    type: "string",
    null: !0,
    array: !0
  }, {
    name: "key",
    type: "field"
  }]
};
q(n2, aa, {
  transform(e, t) {
    const n = this, i = e.modified();
    let r;
    return n.value && (i || t.modified(n._inputs, !0)) ? (r = n.value = i ? n.init(e) : {}, t.visit(t.SOURCE, (o) => n.add(o))) : (r = n.value = n.value || this.init(e), t.visit(t.REM, (o) => n.rem(o)), t.visit(t.ADD, (o) => n.add(o))), n.changes(), t.visit(t.SOURCE, (o) => {
      de(o, r[n.cellkey(o)].tuple);
    }), t.reflow(i).modifies(this._outputs);
  },
  changes() {
    const e = this._adds, t = this._mods;
    let n, i;
    for (n = 0, i = this._alen; n < i; ++n)
      this.celltuple(e[n]), e[n] = null;
    for (n = 0, i = this._mlen; n < i; ++n)
      this.celltuple(t[n]), t[n] = null;
    this._alen = this._mlen = 0;
  }
});
function i2(e) {
  N.call(this, null, e);
}
i2.Definition = {
  type: "KDE",
  metadata: {
    generates: !0
  },
  params: [{
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "field",
    type: "field",
    required: !0
  }, {
    name: "cumulative",
    type: "boolean",
    default: !1
  }, {
    name: "counts",
    type: "boolean",
    default: !1
  }, {
    name: "bandwidth",
    type: "number",
    default: 0
  }, {
    name: "extent",
    type: "number",
    array: !0,
    length: 2
  }, {
    name: "resolve",
    type: "enum",
    values: ["shared", "independent"],
    default: "independent"
  }, {
    name: "steps",
    type: "number"
  }, {
    name: "minsteps",
    type: "number",
    default: 25
  }, {
    name: "maxsteps",
    type: "number",
    default: 200
  }, {
    name: "as",
    type: "string",
    array: !0,
    default: ["value", "density"]
  }]
};
q(i2, N, {
  transform(e, t) {
    const n = t.fork(t.NO_SOURCE | t.NO_FIELDS);
    if (!this.value || t.changed() || e.modified()) {
      const i = t.materialize(t.SOURCE).source, r = Yx(i, e.groupby, e.field), o = (e.groupby || []).map(ot), a = e.bandwidth, s = e.cumulative ? "cdf" : "pdf", u = e.as || ["value", "density"], l = [];
      let c = e.extent, f = e.steps || e.minsteps || 25, d = e.steps || e.maxsteps || 200;
      s !== "pdf" && s !== "cdf" && P("Invalid density method: " + s), e.resolve === "shared" && (c || (c = vr(i, e.field)), f = d = e.steps || d), r.forEach((h) => {
        const g = Dx(h, a)[s], p = e.counts ? h.length : 1, m = c || vr(h);
        rp(g, m, f, d).forEach((y) => {
          const v = {};
          for (let b = 0; b < o.length; ++b)
            v[o[b]] = h.dims[b];
          v[u[0]] = y[0], v[u[1]] = y[1] * p, l.push(Te(v));
        });
      }), this.value && (n.rem = this.value), this.value = n.add = n.source = l;
    }
    return n;
  }
});
function O$(e) {
  qe.call(this, null, cI, e);
}
q(O$, qe);
function cI(e) {
  return this.value && !e.modified() ? this.value : Zb(e.fields, e.flat);
}
function S$(e) {
  N.call(this, [], e), this._pending = null;
}
q(S$, N, {
  transform(e, t) {
    const n = t.dataflow;
    return this._pending ? r1(this, t, this._pending) : fI(e) ? t.StopPropagation : e.values ? r1(this, t, n.parse(e.values, e.format)) : e.async ? {
      async: n.request(e.url, e.format).then((r) => (this._pending = oe(r.data), (o) => o.touch(this)))
    } : n.request(e.url, e.format).then((i) => r1(this, t, oe(i.data)));
  }
});
function fI(e) {
  return e.modified("async") && !(e.modified("values") || e.modified("url") || e.modified("format"));
}
function r1(e, t, n) {
  n.forEach(Te);
  const i = t.fork(t.NO_FIELDS & t.NO_SOURCE);
  return i.rem = e.value, e.value = i.source = i.add = n, e._pending = null, i.rem.length && i.clean(!0), i;
}
function r2(e) {
  N.call(this, {}, e);
}
r2.Definition = {
  type: "Lookup",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "index",
    type: "index",
    params: [{
      name: "from",
      type: "data",
      required: !0
    }, {
      name: "key",
      type: "field",
      required: !0
    }]
  }, {
    name: "values",
    type: "field",
    array: !0
  }, {
    name: "fields",
    type: "field",
    array: !0,
    required: !0
  }, {
    name: "as",
    type: "string",
    array: !0
  }, {
    name: "default",
    default: null
  }]
};
q(r2, N, {
  transform(e, t) {
    const n = e.fields, i = e.index, r = e.values, o = e.default == null ? null : e.default, a = e.modified(), s = n.length;
    let u = a ? t.SOURCE : t.ADD, l = t, c = e.as, f, d, h;
    return r ? (d = r.length, s > 1 && !c && P('Multi-field lookup requires explicit "as" parameter.'), c && c.length !== s * d && P('The "as" parameter has too few output field names.'), c = c || r.map(ot), f = function(g) {
      for (var p = 0, m = 0, y, v; p < s; ++p)
        if (v = i.get(n[p](g)), v == null)
          for (y = 0; y < d; ++y, ++m)
            g[c[m]] = o;
        else
          for (y = 0; y < d; ++y, ++m)
            g[c[m]] = r[y](v);
    }) : (c || P("Missing output field names."), f = function(g) {
      for (var p = 0, m; p < s; ++p)
        m = i.get(n[p](g)), g[c[p]] = m == null ? o : m;
    }), a ? l = t.reflow(!0) : (h = n.some((g) => t.modified(g.fields)), u |= h ? t.MOD : 0), t.visit(u, f), l.modifies(c);
  }
});
function C$(e) {
  qe.call(this, null, dI, e);
}
q(C$, qe);
function dI(e) {
  if (this.value && !e.modified())
    return this.value;
  const t = e.extents, n = t.length;
  let i = 1 / 0, r = -1 / 0, o, a;
  for (o = 0; o < n; ++o)
    a = t[o], a[0] < i && (i = a[0]), a[1] > r && (r = a[1]);
  return [i, r];
}
function F$(e) {
  qe.call(this, null, hI, e);
}
q(F$, qe);
function hI(e) {
  return this.value && !e.modified() ? this.value : e.values.reduce((t, n) => t.concat(n), []);
}
function k$(e) {
  N.call(this, null, e);
}
q(k$, N, {
  transform(e, t) {
    return this.modified(e.modified()), this.value = e, t.fork(t.NO_SOURCE | t.NO_FIELDS);
  }
});
function o2(e) {
  aa.call(this, e);
}
o2.Definition = {
  type: "Pivot",
  metadata: {
    generates: !0,
    changes: !0
  },
  params: [{
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "field",
    type: "field",
    required: !0
  }, {
    name: "value",
    type: "field",
    required: !0
  }, {
    name: "op",
    type: "enum",
    values: qf,
    default: "sum"
  }, {
    name: "limit",
    type: "number",
    default: 0
  }, {
    name: "key",
    type: "field"
  }]
};
q(o2, aa, {
  _transform: aa.prototype.transform,
  transform(e, t) {
    return this._transform(gI(e, t), t);
  }
});
function gI(e, t) {
  const n = e.field, i = e.value, r = (e.op === "count" ? "__count__" : e.op) || "sum", o = Yt(n).concat(Yt(i)), a = mI(n, e.limit || 0, t);
  return t.changed() && e.set("__pivot__", null, null, !0), {
    key: e.key,
    groupby: e.groupby,
    ops: a.map(() => r),
    fields: a.map((s) => pI(s, n, i, o)),
    as: a.map((s) => s + ""),
    modified: e.modified.bind(e)
  };
}
function pI(e, t, n, i) {
  return In((r) => t(r) === e ? n(r) : NaN, i, e + "");
}
function mI(e, t, n) {
  const i = {}, r = [];
  return n.visit(n.SOURCE, (o) => {
    const a = e(o);
    i[a] || (i[a] = 1, r.push(a));
  }), r.sort(G0), t ? r.slice(0, t) : r;
}
function D$(e) {
  op.call(this, e);
}
q(D$, op, {
  transform(e, t) {
    const n = e.subflow, i = e.field, r = (o) => this.subflow(Z(o), n, t, o);
    return (e.modified("field") || i && t.modified(Yt(i))) && P("PreFacet does not support field modification."), this.initTargets(), i ? (t.visit(t.MOD, (o) => {
      const a = r(o);
      i(o).forEach((s) => a.mod(s));
    }), t.visit(t.ADD, (o) => {
      const a = r(o);
      i(o).forEach((s) => a.add(Te(s)));
    }), t.visit(t.REM, (o) => {
      const a = r(o);
      i(o).forEach((s) => a.rem(s));
    })) : (t.visit(t.MOD, (o) => r(o).mod(o)), t.visit(t.ADD, (o) => r(o).add(o)), t.visit(t.REM, (o) => r(o).rem(o))), t.clean() && t.runAfter(() => this.clean()), t;
  }
});
function a2(e) {
  N.call(this, null, e);
}
a2.Definition = {
  type: "Project",
  metadata: {
    generates: !0,
    changes: !0
  },
  params: [{
    name: "fields",
    type: "field",
    array: !0
  }, {
    name: "as",
    type: "string",
    null: !0,
    array: !0
  }]
};
q(a2, N, {
  transform(e, t) {
    const n = t.fork(t.NO_SOURCE), i = e.fields, r = x$(e.fields, e.as || []), o = i ? (s, u) => yI(s, u, i, r) : J0;
    let a;
    return this.value ? a = this.value : (t = t.addAll(), a = this.value = {}), t.visit(t.REM, (s) => {
      const u = Z(s);
      n.rem.push(a[u]), a[u] = null;
    }), t.visit(t.ADD, (s) => {
      const u = o(s, Te({}));
      a[Z(s)] = u, n.add.push(u);
    }), t.visit(t.MOD, (s) => {
      n.mod.push(o(s, a[Z(s)]));
    }), n;
  }
});
function yI(e, t, n, i) {
  for (let r = 0, o = n.length; r < o; ++r)
    t[i[r]] = n[r](e);
  return t;
}
function $$(e) {
  N.call(this, null, e);
}
q($$, N, {
  transform(e, t) {
    return this.value = e.value, e.modified("value") ? t.fork(t.NO_SOURCE | t.NO_FIELDS) : t.StopPropagation;
  }
});
function s2(e) {
  N.call(this, null, e);
}
s2.Definition = {
  type: "Quantile",
  metadata: {
    generates: !0,
    changes: !0
  },
  params: [{
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "field",
    type: "field",
    required: !0
  }, {
    name: "probs",
    type: "number",
    array: !0
  }, {
    name: "step",
    type: "number",
    default: 0.01
  }, {
    name: "as",
    type: "string",
    array: !0,
    default: ["prob", "value"]
  }]
};
const vI = 1e-14;
q(s2, N, {
  transform(e, t) {
    const n = t.fork(t.NO_SOURCE | t.NO_FIELDS), i = e.as || ["prob", "value"];
    if (this.value && !e.modified() && !t.changed())
      return n.source = this.value, n;
    const r = t.materialize(t.SOURCE).source, o = Yx(r, e.groupby, e.field), a = (e.groupby || []).map(ot), s = [], u = e.step || 0.01, l = e.probs || Hn(u / 2, 1 - vI, u), c = l.length;
    return o.forEach((f) => {
      const d = Ox(f, l);
      for (let h = 0; h < c; ++h) {
        const g = {};
        for (let p = 0; p < a.length; ++p)
          g[a[p]] = f.dims[p];
        g[i[0]] = l[h], g[i[1]] = d[h], s.push(Te(g));
      }
    }), this.value && (n.rem = this.value), this.value = n.add = n.source = s, n;
  }
});
function M$(e) {
  N.call(this, null, e);
}
q(M$, N, {
  transform(e, t) {
    let n, i;
    return this.value ? i = this.value : (n = t = t.addAll(), i = this.value = {}), e.derive && (n = t.fork(t.NO_SOURCE), t.visit(t.REM, (r) => {
      const o = Z(r);
      n.rem.push(i[o]), i[o] = null;
    }), t.visit(t.ADD, (r) => {
      const o = Ex(r);
      i[Z(r)] = o, n.add.push(o);
    }), t.visit(t.MOD, (r) => {
      const o = i[Z(r)];
      for (const a in r)
        o[a] = r[a], n.modifies(a);
      n.mod.push(o);
    })), n;
  }
});
function u2(e) {
  N.call(this, [], e), this.count = 0;
}
u2.Definition = {
  type: "Sample",
  metadata: {},
  params: [{
    name: "size",
    type: "number",
    default: 1e3
  }]
};
q(u2, N, {
  transform(e, t) {
    const n = t.fork(t.NO_SOURCE), i = e.modified("size"), r = e.size, o = this.value.reduce((c, f) => (c[Z(f)] = 1, c), {});
    let a = this.value, s = this.count, u = 0;
    function l(c) {
      let f, d;
      a.length < r ? a.push(c) : (d = ~~((s + 1) * di()), d < a.length && d >= u && (f = a[d], o[Z(f)] && n.rem.push(f), a[d] = c)), ++s;
    }
    if (t.rem.length && (t.visit(t.REM, (c) => {
      const f = Z(c);
      o[f] && (o[f] = -1, n.rem.push(c)), --s;
    }), a = a.filter((c) => o[Z(c)] !== -1)), (t.rem.length || i) && a.length < r && t.source && (u = s = a.length, t.visit(t.SOURCE, (c) => {
      o[Z(c)] || l(c);
    }), u = -1), i && a.length > r) {
      const c = a.length - r;
      for (let f = 0; f < c; ++f)
        o[Z(a[f])] = -1, n.rem.push(a[f]);
      a = a.slice(c);
    }
    return t.mod.length && t.visit(t.MOD, (c) => {
      o[Z(c)] && n.mod.push(c);
    }), t.add.length && t.visit(t.ADD, l), (t.add.length || u < 0) && (n.add = a.filter((c) => !o[Z(c)])), this.count = s, this.value = n.source = a, n;
  }
});
function l2(e) {
  N.call(this, null, e);
}
l2.Definition = {
  type: "Sequence",
  metadata: {
    generates: !0,
    changes: !0
  },
  params: [{
    name: "start",
    type: "number",
    required: !0
  }, {
    name: "stop",
    type: "number",
    required: !0
  }, {
    name: "step",
    type: "number",
    default: 1
  }, {
    name: "as",
    type: "string",
    default: "data"
  }]
};
q(l2, N, {
  transform(e, t) {
    if (this.value && !e.modified())
      return;
    const n = t.materialize().fork(t.MOD), i = e.as || "data";
    return n.rem = this.value ? t.rem.concat(this.value) : t.rem, this.value = Hn(e.start, e.stop, e.step || 1).map((r) => {
      const o = {};
      return o[i] = r, Te(o);
    }), n.add = t.add.concat(this.value), n;
  }
});
function T$(e) {
  N.call(this, null, e), this.modified(!0);
}
q(T$, N, {
  transform(e, t) {
    return this.value = t.source, t.changed() ? t.fork(t.NO_SOURCE | t.NO_FIELDS) : t.StopPropagation;
  }
});
function c2(e) {
  N.call(this, null, e);
}
const N$ = ["unit0", "unit1"];
c2.Definition = {
  type: "TimeUnit",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "field",
    type: "field",
    required: !0
  }, {
    name: "interval",
    type: "boolean",
    default: !0
  }, {
    name: "units",
    type: "enum",
    values: hx,
    array: !0
  }, {
    name: "step",
    type: "number",
    default: 1
  }, {
    name: "maxbins",
    type: "number",
    default: 40
  }, {
    name: "extent",
    type: "date",
    array: !0
  }, {
    name: "timezone",
    type: "enum",
    default: "local",
    values: ["local", "utc"]
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: 2,
    default: N$
  }]
};
q(c2, N, {
  transform(e, t) {
    const n = e.field, i = e.interval !== !1, r = e.timezone === "utc", o = this._floor(e, t), a = (r ? Al : El)(o.unit).offset, s = e.as || N$, u = s[0], l = s[1], c = o.step;
    let f = o.start || 1 / 0, d = o.stop || -1 / 0, h = t.ADD;
    return (e.modified() || t.changed(t.REM) || t.modified(Yt(n))) && (t = t.reflow(!0), h = t.SOURCE, f = 1 / 0, d = -1 / 0), t.visit(h, (g) => {
      const p = n(g);
      let m, y;
      p == null ? (g[u] = null, i && (g[l] = null)) : (g[u] = m = y = o(p), i && (g[l] = y = a(m, c)), m < f && (f = m), y > d && (d = y));
    }), o.start = f, o.stop = d, t.modifies(i ? s : u);
  },
  _floor(e, t) {
    const n = e.timezone === "utc", {
      units: i,
      step: r
    } = e.units ? {
      units: e.units,
      step: e.step || 1
    } : _3({
      extent: e.extent || vr(t.materialize(t.SOURCE).source, e.field),
      maxbins: e.maxbins
    }), o = gx(i), a = this.value || {}, s = (n ? p3 : g3)(o, r);
    return s.unit = xe(o), s.units = o, s.step = r, s.start = a.start, s.stop = a.stop, this.value = s;
  }
});
function R$(e) {
  N.call(this, bl(), e);
}
q(R$, N, {
  transform(e, t) {
    const n = t.dataflow, i = e.field, r = this.value, o = (s) => r.set(i(s), s);
    let a = !0;
    return e.modified("field") || t.modified(i.fields) ? (r.clear(), t.visit(t.SOURCE, o)) : t.changed() ? (t.visit(t.REM, (s) => r.delete(i(s))), t.visit(t.ADD, o)) : a = !1, this.modified(a), r.empty > n.cleanThreshold && n.runAfter(r.clean), t.fork();
  }
});
function j$(e) {
  N.call(this, null, e);
}
q(j$, N, {
  transform(e, t) {
    (!this.value || e.modified("field") || e.modified("sort") || t.changed() || e.sort && t.modified(e.sort.fields)) && (this.value = (e.sort ? t.source.slice().sort(Ws(e.sort)) : t.source).map(e.field));
  }
});
function bI(e, t, n, i) {
  const r = of[e](t, n);
  return {
    init: r.init || Lo,
    update: function(o, a) {
      a[i] = r.next(o);
    }
  };
}
const of = {
  row_number: function() {
    return {
      next: (e) => e.index + 1
    };
  },
  rank: function() {
    let e;
    return {
      init: () => e = 1,
      next: (t) => {
        const n = t.index, i = t.data;
        return n && t.compare(i[n - 1], i[n]) ? e = n + 1 : e;
      }
    };
  },
  dense_rank: function() {
    let e;
    return {
      init: () => e = 1,
      next: (t) => {
        const n = t.index, i = t.data;
        return n && t.compare(i[n - 1], i[n]) ? ++e : e;
      }
    };
  },
  percent_rank: function() {
    const e = of.rank(), t = e.next;
    return {
      init: e.init,
      next: (n) => (t(n) - 1) / (n.data.length - 1)
    };
  },
  cume_dist: function() {
    let e;
    return {
      init: () => e = 0,
      next: (t) => {
        const n = t.data, i = t.compare;
        let r = t.index;
        if (e < r) {
          for (; r + 1 < n.length && !i(n[r], n[r + 1]); )
            ++r;
          e = r;
        }
        return (1 + e) / n.length;
      }
    };
  },
  ntile: function(e, t) {
    t = +t, t > 0 || P("ntile num must be greater than zero.");
    const n = of.cume_dist(), i = n.next;
    return {
      init: n.init,
      next: (r) => Math.ceil(t * i(r))
    };
  },
  lag: function(e, t) {
    return t = +t || 1, {
      next: (n) => {
        const i = n.index - t;
        return i >= 0 ? e(n.data[i]) : null;
      }
    };
  },
  lead: function(e, t) {
    return t = +t || 1, {
      next: (n) => {
        const i = n.index + t, r = n.data;
        return i < r.length ? e(r[i]) : null;
      }
    };
  },
  first_value: function(e) {
    return {
      next: (t) => e(t.data[t.i0])
    };
  },
  last_value: function(e) {
    return {
      next: (t) => e(t.data[t.i1 - 1])
    };
  },
  nth_value: function(e, t) {
    return t = +t, t > 0 || P("nth_value nth must be greater than zero."), {
      next: (n) => {
        const i = n.i0 + (t - 1);
        return i < n.i1 ? e(n.data[i]) : null;
      }
    };
  },
  prev_value: function(e) {
    let t;
    return {
      init: () => t = null,
      next: (n) => {
        const i = e(n.data[n.index]);
        return i != null ? t = i : t;
      }
    };
  },
  next_value: function(e) {
    let t, n;
    return {
      init: () => (t = null, n = -1),
      next: (i) => {
        const r = i.data;
        return i.index <= n ? t : (n = xI(e, r, i.index)) < 0 ? (n = r.length, t = null) : t = e(r[n]);
      }
    };
  }
};
function xI(e, t, n) {
  for (let i = t.length; n < i; ++n)
    if (e(t[n]) != null)
      return n;
  return -1;
}
const wI = Object.keys(of);
function P$(e) {
  const t = oe(e.ops), n = oe(e.fields), i = oe(e.params), r = oe(e.as), o = this.outputs = [], a = this.windows = [], s = {}, u = {}, l = [], c = [];
  let f = !0;
  function d(h) {
    oe(Yt(h)).forEach((g) => s[g] = 1);
  }
  d(e.sort), t.forEach((h, g) => {
    const p = n[g], m = ot(p), y = d$(h, m, r[g]);
    if (d(p), o.push(y), ae(of, h))
      a.push(bI(h, n[g], i[g], y));
    else {
      if (p == null && h !== "count" && P("Null aggregate field specified."), h === "count") {
        l.push(y);
        return;
      }
      f = !1;
      let v = u[m];
      v || (v = u[m] = [], v.field = p, c.push(v)), v.push(h$(h, y));
    }
  }), (l.length || c.length) && (this.cell = EI(c, l, f)), this.inputs = Object.keys(s);
}
const L$ = P$.prototype;
L$.init = function() {
  this.windows.forEach((e) => e.init()), this.cell && this.cell.init();
};
L$.update = function(e, t) {
  const n = this.cell, i = this.windows, r = e.data, o = i && i.length;
  let a;
  if (n) {
    for (a = e.p0; a < e.i0; ++a)
      n.rem(r[a]);
    for (a = e.p1; a < e.i1; ++a)
      n.add(r[a]);
    n.set(t);
  }
  for (a = 0; a < o; ++a)
    i[a].update(e, t);
};
function EI(e, t, n) {
  e = e.map((u) => p$(u, u.field));
  const i = {
    num: 0,
    agg: null,
    store: !1,
    count: t
  };
  if (!n)
    for (var r = e.length, o = i.agg = Array(r), a = 0; a < r; ++a)
      o[a] = new e[a](i);
  if (i.store)
    var s = i.data = new zx();
  return i.add = function(u) {
    if (i.num += 1, !n) {
      s && s.add(u);
      for (let l = 0; l < r; ++l)
        o[l].add(o[l].get(u), u);
    }
  }, i.rem = function(u) {
    if (i.num -= 1, !n) {
      s && s.rem(u);
      for (let l = 0; l < r; ++l)
        o[l].rem(o[l].get(u), u);
    }
  }, i.set = function(u) {
    let l, c;
    for (s && s.values(), l = 0, c = t.length; l < c; ++l)
      u[t[l]] = i.num;
    if (!n)
      for (l = 0, c = o.length; l < c; ++l)
        o[l].set(u);
  }, i.init = function() {
    i.num = 0, s && s.reset();
    for (let u = 0; u < r; ++u)
      o[u].init();
  }, i;
}
function f2(e) {
  N.call(this, {}, e), this._mlen = 0, this._mods = [];
}
f2.Definition = {
  type: "Window",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "sort",
    type: "compare"
  }, {
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "ops",
    type: "enum",
    array: !0,
    values: wI.concat(qf)
  }, {
    name: "params",
    type: "number",
    null: !0,
    array: !0
  }, {
    name: "fields",
    type: "field",
    null: !0,
    array: !0
  }, {
    name: "as",
    type: "string",
    null: !0,
    array: !0
  }, {
    name: "frame",
    type: "number",
    null: !0,
    array: !0,
    length: 2,
    default: [null, 0]
  }, {
    name: "ignorePeers",
    type: "boolean",
    default: !1
  }]
};
q(f2, N, {
  transform(e, t) {
    this.stamp = t.stamp;
    const n = e.modified(), i = Ws(e.sort), r = Wy(e.groupby), o = (s) => this.group(r(s));
    let a = this.state;
    (!a || n) && (a = this.state = new P$(e)), n || t.modified(a.inputs) ? (this.value = {}, t.visit(t.SOURCE, (s) => o(s).add(s))) : (t.visit(t.REM, (s) => o(s).remove(s)), t.visit(t.ADD, (s) => o(s).add(s)));
    for (let s = 0, u = this._mlen; s < u; ++s)
      AI(this._mods[s], a, i, e);
    return this._mlen = 0, this._mods = [], t.reflow(n).modifies(a.outputs);
  },
  group(e) {
    let t = this.value[e];
    return t || (t = this.value[e] = m$(Z), t.stamp = -1), t.stamp < this.stamp && (t.stamp = this.stamp, this._mods[this._mlen++] = t), t;
  }
});
function AI(e, t, n, i) {
  const r = i.sort, o = r && !i.ignorePeers, a = i.frame || [null, 0], s = e.data(n), u = s.length, l = o ? If(r) : null, c = {
    i0: 0,
    i1: 0,
    p0: 0,
    p1: 0,
    index: 0,
    data: s,
    compare: r || Zt(-1)
  };
  t.init();
  for (let f = 0; f < u; ++f)
    _I(c, a, f, u), o && OI(c, l), t.update(c, s[f]);
}
function _I(e, t, n, i) {
  e.p0 = e.i0, e.p1 = e.i1, e.i0 = t[0] == null ? 0 : Math.max(0, n - Math.abs(t[0])), e.i1 = t[1] == null ? i : Math.min(i, n + Math.abs(t[1]) + 1), e.index = n;
}
function OI(e, t) {
  const n = e.i0, i = e.i1 - 1, r = e.compare, o = e.data, a = o.length - 1;
  n > 0 && !r(o[n], o[n - 1]) && (e.i0 = t.left(o, o[n])), i < a && !r(o[i], o[i + 1]) && (e.i1 = t.right(o, o[i]));
}
const SI = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  aggregate: aa,
  bin: Ux,
  collect: qx,
  compare: y$,
  countpattern: Wx,
  cross: Gx,
  density: Hx,
  dotbin: Xx,
  expression: E$,
  extent: Vx,
  facet: op,
  field: A$,
  filter: Jx,
  flatten: Qx,
  fold: Zx,
  formula: e2,
  generate: _$,
  impute: t2,
  joinaggregate: n2,
  kde: i2,
  key: O$,
  load: S$,
  lookup: r2,
  multiextent: C$,
  multivalues: F$,
  params: k$,
  pivot: o2,
  prefacet: D$,
  project: a2,
  proxy: $$,
  quantile: s2,
  relay: M$,
  sample: u2,
  sequence: l2,
  sieve: T$,
  subflow: Kx,
  timeunit: c2,
  tupleindex: R$,
  values: j$,
  window: f2
}, Symbol.toStringTag, { value: "Module" })), Gy = Math.PI, Hy = 2 * Gy, Ka = 1e-6, CI = Hy - Ka;
function Yy() {
  this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";
}
function xa() {
  return new Yy();
}
Yy.prototype = xa.prototype = {
  constructor: Yy,
  moveTo: function(e, t) {
    this._ += "M" + (this._x0 = this._x1 = +e) + "," + (this._y0 = this._y1 = +t);
  },
  closePath: function() {
    this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
  },
  lineTo: function(e, t) {
    this._ += "L" + (this._x1 = +e) + "," + (this._y1 = +t);
  },
  quadraticCurveTo: function(e, t, n, i) {
    this._ += "Q" + +e + "," + +t + "," + (this._x1 = +n) + "," + (this._y1 = +i);
  },
  bezierCurveTo: function(e, t, n, i, r, o) {
    this._ += "C" + +e + "," + +t + "," + +n + "," + +i + "," + (this._x1 = +r) + "," + (this._y1 = +o);
  },
  arcTo: function(e, t, n, i, r) {
    e = +e, t = +t, n = +n, i = +i, r = +r;
    var o = this._x1, a = this._y1, s = n - e, u = i - t, l = o - e, c = a - t, f = l * l + c * c;
    if (r < 0)
      throw new Error("negative radius: " + r);
    if (this._x1 === null)
      this._ += "M" + (this._x1 = e) + "," + (this._y1 = t);
    else if (f > Ka)
      if (!(Math.abs(c * s - u * l) > Ka) || !r)
        this._ += "L" + (this._x1 = e) + "," + (this._y1 = t);
      else {
        var d = n - o, h = i - a, g = s * s + u * u, p = d * d + h * h, m = Math.sqrt(g), y = Math.sqrt(f), v = r * Math.tan((Gy - Math.acos((g + f - p) / (2 * m * y))) / 2), b = v / y, x = v / m;
        Math.abs(b - 1) > Ka && (this._ += "L" + (e + b * l) + "," + (t + b * c)), this._ += "A" + r + "," + r + ",0,0," + +(c * d > l * h) + "," + (this._x1 = e + x * s) + "," + (this._y1 = t + x * u);
      }
  },
  arc: function(e, t, n, i, r, o) {
    e = +e, t = +t, n = +n, o = !!o;
    var a = n * Math.cos(i), s = n * Math.sin(i), u = e + a, l = t + s, c = 1 ^ o, f = o ? i - r : r - i;
    if (n < 0)
      throw new Error("negative radius: " + n);
    this._x1 === null ? this._ += "M" + u + "," + l : (Math.abs(this._x1 - u) > Ka || Math.abs(this._y1 - l) > Ka) && (this._ += "L" + u + "," + l), n && (f < 0 && (f = f % Hy + Hy), f > CI ? this._ += "A" + n + "," + n + ",0,1," + c + "," + (e - a) + "," + (t - s) + "A" + n + "," + n + ",0,1," + c + "," + (this._x1 = u) + "," + (this._y1 = l) : f > Ka && (this._ += "A" + n + "," + n + ",0," + +(f >= Gy) + "," + c + "," + (this._x1 = e + n * Math.cos(r)) + "," + (this._y1 = t + n * Math.sin(r))));
  },
  rect: function(e, t, n, i) {
    this._ += "M" + (this._x0 = this._x1 = +e) + "," + (this._y0 = this._y1 = +t) + "h" + +n + "v" + +i + "h" + -n + "Z";
  },
  toString: function() {
    return this._;
  }
};
function Ne(e) {
  return function() {
    return e;
  };
}
const fO = Math.abs, Lt = Math.atan2, Pa = Math.cos, FI = Math.max, o1 = Math.min, Zi = Math.sin, rs = Math.sqrt, Bt = 1e-12, Gu = Math.PI, dg = Gu / 2, I$ = 2 * Gu;
function kI(e) {
  return e > 1 ? 0 : e < -1 ? Gu : Math.acos(e);
}
function dO(e) {
  return e >= 1 ? dg : e <= -1 ? -dg : Math.asin(e);
}
function DI(e) {
  return e.innerRadius;
}
function $I(e) {
  return e.outerRadius;
}
function MI(e) {
  return e.startAngle;
}
function TI(e) {
  return e.endAngle;
}
function NI(e) {
  return e && e.padAngle;
}
function RI(e, t, n, i, r, o, a, s) {
  var u = n - e, l = i - t, c = a - r, f = s - o, d = f * u - c * l;
  if (!(d * d < Bt))
    return d = (c * (t - o) - f * (e - r)) / d, [e + d * u, t + d * l];
}
function Bd(e, t, n, i, r, o, a) {
  var s = e - n, u = t - i, l = (a ? o : -o) / rs(s * s + u * u), c = l * u, f = -l * s, d = e + c, h = t + f, g = n + c, p = i + f, m = (d + g) / 2, y = (h + p) / 2, v = g - d, b = p - h, x = v * v + b * b, E = r - o, A = d * p - g * h, w = (b < 0 ? -1 : 1) * rs(FI(0, E * E * x - A * A)), _ = (A * b - v * w) / x, k = (-A * v - b * w) / x, C = (A * b + v * w) / x, O = (-A * v + b * w) / x, S = _ - m, D = k - y, M = C - m, F = O - y;
  return S * S + D * D > M * M + F * F && (_ = C, k = O), {
    cx: _,
    cy: k,
    x01: -c,
    y01: -f,
    x11: _ * (r / E - 1),
    y11: k * (r / E - 1)
  };
}
function jI() {
  var e = DI, t = $I, n = Ne(0), i = null, r = MI, o = TI, a = NI, s = null;
  function u() {
    var l, c, f = +e.apply(this, arguments), d = +t.apply(this, arguments), h = r.apply(this, arguments) - dg, g = o.apply(this, arguments) - dg, p = fO(g - h), m = g > h;
    if (s || (s = l = xa()), d < f && (c = d, d = f, f = c), !(d > Bt))
      s.moveTo(0, 0);
    else if (p > I$ - Bt)
      s.moveTo(d * Pa(h), d * Zi(h)), s.arc(0, 0, d, h, g, !m), f > Bt && (s.moveTo(f * Pa(g), f * Zi(g)), s.arc(0, 0, f, g, h, m));
    else {
      var y = h, v = g, b = h, x = g, E = p, A = p, w = a.apply(this, arguments) / 2, _ = w > Bt && (i ? +i.apply(this, arguments) : rs(f * f + d * d)), k = o1(fO(d - f) / 2, +n.apply(this, arguments)), C = k, O = k, S, D;
      if (_ > Bt) {
        var M = dO(_ / f * Zi(w)), F = dO(_ / d * Zi(w));
        (E -= M * 2) > Bt ? (M *= m ? 1 : -1, b += M, x -= M) : (E = 0, b = x = (h + g) / 2), (A -= F * 2) > Bt ? (F *= m ? 1 : -1, y += F, v -= F) : (A = 0, y = v = (h + g) / 2);
      }
      var $ = d * Pa(y), T = d * Zi(y), L = f * Pa(x), I = f * Zi(x);
      if (k > Bt) {
        var Y = d * Pa(v), fe = d * Zi(v), Me = f * Pa(b), Oe = f * Zi(b), Be;
        if (p < Gu && (Be = RI($, T, Me, Oe, Y, fe, L, I))) {
          var Se = $ - Be[0], en = T - Be[1], ei = Y - Be[0], tn = fe - Be[1], H = 1 / Zi(kI((Se * ei + en * tn) / (rs(Se * Se + en * en) * rs(ei * ei + tn * tn))) / 2), le = rs(Be[0] * Be[0] + Be[1] * Be[1]);
          C = o1(k, (f - le) / (H - 1)), O = o1(k, (d - le) / (H + 1));
        }
      }
      A > Bt ? O > Bt ? (S = Bd(Me, Oe, $, T, d, O, m), D = Bd(Y, fe, L, I, d, O, m), s.moveTo(S.cx + S.x01, S.cy + S.y01), O < k ? s.arc(S.cx, S.cy, O, Lt(S.y01, S.x01), Lt(D.y01, D.x01), !m) : (s.arc(S.cx, S.cy, O, Lt(S.y01, S.x01), Lt(S.y11, S.x11), !m), s.arc(0, 0, d, Lt(S.cy + S.y11, S.cx + S.x11), Lt(D.cy + D.y11, D.cx + D.x11), !m), s.arc(D.cx, D.cy, O, Lt(D.y11, D.x11), Lt(D.y01, D.x01), !m))) : (s.moveTo($, T), s.arc(0, 0, d, y, v, !m)) : s.moveTo($, T), !(f > Bt) || !(E > Bt) ? s.lineTo(L, I) : C > Bt ? (S = Bd(L, I, Y, fe, f, -C, m), D = Bd($, T, Me, Oe, f, -C, m), s.lineTo(S.cx + S.x01, S.cy + S.y01), C < k ? s.arc(S.cx, S.cy, C, Lt(S.y01, S.x01), Lt(D.y01, D.x01), !m) : (s.arc(S.cx, S.cy, C, Lt(S.y01, S.x01), Lt(S.y11, S.x11), !m), s.arc(0, 0, f, Lt(S.cy + S.y11, S.cx + S.x11), Lt(D.cy + D.y11, D.cx + D.x11), m), s.arc(D.cx, D.cy, C, Lt(D.y11, D.x11), Lt(D.y01, D.x01), !m))) : s.arc(0, 0, f, x, b, m);
    }
    if (s.closePath(), l)
      return s = null, l + "" || null;
  }
  return u.centroid = function() {
    var l = (+e.apply(this, arguments) + +t.apply(this, arguments)) / 2, c = (+r.apply(this, arguments) + +o.apply(this, arguments)) / 2 - Gu / 2;
    return [Pa(c) * l, Zi(c) * l];
  }, u.innerRadius = function(l) {
    return arguments.length ? (e = typeof l == "function" ? l : Ne(+l), u) : e;
  }, u.outerRadius = function(l) {
    return arguments.length ? (t = typeof l == "function" ? l : Ne(+l), u) : t;
  }, u.cornerRadius = function(l) {
    return arguments.length ? (n = typeof l == "function" ? l : Ne(+l), u) : n;
  }, u.padRadius = function(l) {
    return arguments.length ? (i = l == null ? null : typeof l == "function" ? l : Ne(+l), u) : i;
  }, u.startAngle = function(l) {
    return arguments.length ? (r = typeof l == "function" ? l : Ne(+l), u) : r;
  }, u.endAngle = function(l) {
    return arguments.length ? (o = typeof l == "function" ? l : Ne(+l), u) : o;
  }, u.padAngle = function(l) {
    return arguments.length ? (a = typeof l == "function" ? l : Ne(+l), u) : a;
  }, u.context = function(l) {
    return arguments.length ? (s = l == null ? null : l, u) : s;
  }, u;
}
function B$(e) {
  return typeof e == "object" && "length" in e ? e : Array.from(e);
}
function z$(e) {
  this._context = e;
}
z$.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(e, t) {
    switch (e = +e, t = +t, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
        break;
      case 1:
        this._point = 2;
      default:
        this._context.lineTo(e, t);
        break;
    }
  }
};
function d2(e) {
  return new z$(e);
}
function U$(e) {
  return e[0];
}
function q$(e) {
  return e[1];
}
function W$(e, t) {
  var n = Ne(!0), i = null, r = d2, o = null;
  e = typeof e == "function" ? e : e === void 0 ? U$ : Ne(e), t = typeof t == "function" ? t : t === void 0 ? q$ : Ne(t);
  function a(s) {
    var u, l = (s = B$(s)).length, c, f = !1, d;
    for (i == null && (o = r(d = xa())), u = 0; u <= l; ++u)
      !(u < l && n(c = s[u], u, s)) === f && ((f = !f) ? o.lineStart() : o.lineEnd()), f && o.point(+e(c, u, s), +t(c, u, s));
    if (d)
      return o = null, d + "" || null;
  }
  return a.x = function(s) {
    return arguments.length ? (e = typeof s == "function" ? s : Ne(+s), a) : e;
  }, a.y = function(s) {
    return arguments.length ? (t = typeof s == "function" ? s : Ne(+s), a) : t;
  }, a.defined = function(s) {
    return arguments.length ? (n = typeof s == "function" ? s : Ne(!!s), a) : n;
  }, a.curve = function(s) {
    return arguments.length ? (r = s, i != null && (o = r(i)), a) : r;
  }, a.context = function(s) {
    return arguments.length ? (s == null ? i = o = null : o = r(i = s), a) : i;
  }, a;
}
function G$(e, t, n) {
  var i = null, r = Ne(!0), o = null, a = d2, s = null;
  e = typeof e == "function" ? e : e === void 0 ? U$ : Ne(+e), t = typeof t == "function" ? t : Ne(t === void 0 ? 0 : +t), n = typeof n == "function" ? n : n === void 0 ? q$ : Ne(+n);
  function u(c) {
    var f, d, h, g = (c = B$(c)).length, p, m = !1, y, v = new Array(g), b = new Array(g);
    for (o == null && (s = a(y = xa())), f = 0; f <= g; ++f) {
      if (!(f < g && r(p = c[f], f, c)) === m)
        if (m = !m)
          d = f, s.areaStart(), s.lineStart();
        else {
          for (s.lineEnd(), s.lineStart(), h = f - 1; h >= d; --h)
            s.point(v[h], b[h]);
          s.lineEnd(), s.areaEnd();
        }
      m && (v[f] = +e(p, f, c), b[f] = +t(p, f, c), s.point(i ? +i(p, f, c) : v[f], n ? +n(p, f, c) : b[f]));
    }
    if (y)
      return s = null, y + "" || null;
  }
  function l() {
    return W$().defined(r).curve(a).context(o);
  }
  return u.x = function(c) {
    return arguments.length ? (e = typeof c == "function" ? c : Ne(+c), i = null, u) : e;
  }, u.x0 = function(c) {
    return arguments.length ? (e = typeof c == "function" ? c : Ne(+c), u) : e;
  }, u.x1 = function(c) {
    return arguments.length ? (i = c == null ? null : typeof c == "function" ? c : Ne(+c), u) : i;
  }, u.y = function(c) {
    return arguments.length ? (t = typeof c == "function" ? c : Ne(+c), n = null, u) : t;
  }, u.y0 = function(c) {
    return arguments.length ? (t = typeof c == "function" ? c : Ne(+c), u) : t;
  }, u.y1 = function(c) {
    return arguments.length ? (n = c == null ? null : typeof c == "function" ? c : Ne(+c), u) : n;
  }, u.lineX0 = u.lineY0 = function() {
    return l().x(e).y(t);
  }, u.lineY1 = function() {
    return l().x(e).y(n);
  }, u.lineX1 = function() {
    return l().x(i).y(t);
  }, u.defined = function(c) {
    return arguments.length ? (r = typeof c == "function" ? c : Ne(!!c), u) : r;
  }, u.curve = function(c) {
    return arguments.length ? (a = c, o != null && (s = a(o)), u) : a;
  }, u.context = function(c) {
    return arguments.length ? (c == null ? o = s = null : s = a(o = c), u) : o;
  }, u;
}
const PI = {
  draw(e, t) {
    const n = rs(t / Gu);
    e.moveTo(n, 0), e.arc(0, 0, n, 0, I$);
  }
};
function LI(e, t) {
  let n = null;
  e = typeof e == "function" ? e : Ne(e || PI), t = typeof t == "function" ? t : Ne(t === void 0 ? 64 : +t);
  function i() {
    let r;
    if (n || (n = r = xa()), e.apply(this, arguments).draw(n, +t.apply(this, arguments)), r)
      return n = null, r + "" || null;
  }
  return i.type = function(r) {
    return arguments.length ? (e = typeof r == "function" ? r : Ne(r), i) : e;
  }, i.size = function(r) {
    return arguments.length ? (t = typeof r == "function" ? r : Ne(+r), i) : t;
  }, i.context = function(r) {
    return arguments.length ? (n = r == null ? null : r, i) : n;
  }, i;
}
function sa() {
}
function hg(e, t, n) {
  e._context.bezierCurveTo(
    (2 * e._x0 + e._x1) / 3,
    (2 * e._y0 + e._y1) / 3,
    (e._x0 + 2 * e._x1) / 3,
    (e._y0 + 2 * e._y1) / 3,
    (e._x0 + 4 * e._x1 + t) / 6,
    (e._y0 + 4 * e._y1 + n) / 6
  );
}
function ap(e) {
  this._context = e;
}
ap.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:
        hg(this, this._x1, this._y1);
      case 2:
        this._context.lineTo(this._x1, this._y1);
        break;
    }
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(e, t) {
    switch (e = +e, t = +t, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
        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:
        hg(this, e, t);
        break;
    }
    this._x0 = this._x1, this._x1 = e, this._y0 = this._y1, this._y1 = t;
  }
};
function II(e) {
  return new ap(e);
}
function H$(e) {
  this._context = e;
}
H$.prototype = {
  areaStart: sa,
  areaEnd: sa,
  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(e, t) {
    switch (e = +e, t = +t, this._point) {
      case 0:
        this._point = 1, this._x2 = e, this._y2 = t;
        break;
      case 1:
        this._point = 2, this._x3 = e, this._y3 = t;
        break;
      case 2:
        this._point = 3, this._x4 = e, this._y4 = t, this._context.moveTo((this._x0 + 4 * this._x1 + e) / 6, (this._y0 + 4 * this._y1 + t) / 6);
        break;
      default:
        hg(this, e, t);
        break;
    }
    this._x0 = this._x1, this._x1 = e, this._y0 = this._y1, this._y1 = t;
  }
};
function BI(e) {
  return new H$(e);
}
function Y$(e) {
  this._context = e;
}
Y$.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() {
    (this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(e, t) {
    switch (e = +e, t = +t, this._point) {
      case 0:
        this._point = 1;
        break;
      case 1:
        this._point = 2;
        break;
      case 2:
        this._point = 3;
        var n = (this._x0 + 4 * this._x1 + e) / 6, i = (this._y0 + 4 * this._y1 + t) / 6;
        this._line ? this._context.lineTo(n, i) : this._context.moveTo(n, i);
        break;
      case 3:
        this._point = 4;
      default:
        hg(this, e, t);
        break;
    }
    this._x0 = this._x1, this._x1 = e, this._y0 = this._y1, this._y1 = t;
  }
};
function zI(e) {
  return new Y$(e);
}
function X$(e, t) {
  this._basis = new ap(e), this._beta = t;
}
X$.prototype = {
  lineStart: function() {
    this._x = [], this._y = [], this._basis.lineStart();
  },
  lineEnd: function() {
    var e = this._x, t = this._y, n = e.length - 1;
    if (n > 0)
      for (var i = e[0], r = t[0], o = e[n] - i, a = t[n] - r, s = -1, u; ++s <= n; )
        u = s / n, this._basis.point(
          this._beta * e[s] + (1 - this._beta) * (i + u * o),
          this._beta * t[s] + (1 - this._beta) * (r + u * a)
        );
    this._x = this._y = null, this._basis.lineEnd();
  },
  point: function(e, t) {
    this._x.push(+e), this._y.push(+t);
  }
};
const UI = function e(t) {
  function n(i) {
    return t === 1 ? new ap(i) : new X$(i, t);
  }
  return n.beta = function(i) {
    return e(+i);
  }, n;
}(0.85);
function gg(e, t, n) {
  e._context.bezierCurveTo(
    e._x1 + e._k * (e._x2 - e._x0),
    e._y1 + e._k * (e._y2 - e._y0),
    e._x2 + e._k * (e._x1 - t),
    e._y2 + e._k * (e._y1 - n),
    e._x2,
    e._y2
  );
}
function h2(e, t) {
  this._context = e, this._k = (1 - t) / 6;
}
h2.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:
        gg(this, this._x1, this._y1);
        break;
    }
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(e, t) {
    switch (e = +e, t = +t, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
        break;
      case 1:
        this._point = 2, this._x1 = e, this._y1 = t;
        break;
      case 2:
        this._point = 3;
      default:
        gg(this, e, t);
        break;
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = e, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
  }
};
const qI = function e(t) {
  function n(i) {
    return new h2(i, t);
  }
  return n.tension = function(i) {
    return e(+i);
  }, n;
}(0);
function g2(e, t) {
  this._context = e, this._k = (1 - t) / 6;
}
g2.prototype = {
  areaStart: sa,
  areaEnd: sa,
  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(e, t) {
    switch (e = +e, t = +t, this._point) {
      case 0:
        this._point = 1, this._x3 = e, this._y3 = t;
        break;
      case 1:
        this._point = 2, this._context.moveTo(this._x4 = e, this._y4 = t);
        break;
      case 2:
        this._point = 3, this._x5 = e, this._y5 = t;
        break;
      default:
        gg(this, e, t);
        break;
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = e, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
  }
};
const WI = function e(t) {
  function n(i) {
    return new g2(i, t);
  }
  return n.tension = function(i) {
    return e(+i);
  }, n;
}(0);
function p2(e, t) {
  this._context = e, this._k = (1 - t) / 6;
}
p2.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() {
    (this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(e, t) {
    switch (e = +e, t = +t, 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:
        gg(this, e, t);
        break;
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = e, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
  }
};
const GI = function e(t) {
  function n(i) {
    return new p2(i, t);
  }
  return n.tension = function(i) {
    return e(+i);
  }, n;
}(0);
function m2(e, t, n) {
  var i = e._x1, r = e._y1, o = e._x2, a = e._y2;
  if (e._l01_a > Bt) {
    var s = 2 * e._l01_2a + 3 * e._l01_a * e._l12_a + e._l12_2a, u = 3 * e._l01_a * (e._l01_a + e._l12_a);
    i = (i * s - e._x0 * e._l12_2a + e._x2 * e._l01_2a) / u, r = (r * s - e._y0 * e._l12_2a + e._y2 * e._l01_2a) / u;
  }
  if (e._l23_a > Bt) {
    var l = 2 * e._l23_2a + 3 * e._l23_a * e._l12_a + e._l12_2a, c = 3 * e._l23_a * (e._l23_a + e._l12_a);
    o = (o * l + e._x1 * e._l23_2a - t * e._l12_2a) / c, a = (a * l + e._y1 * e._l23_2a - n * e._l12_2a) / c;
  }
  e._context.bezierCurveTo(i, r, o, a, e._x2, e._y2);
}
function V$(e, t) {
  this._context = e, this._alpha = t;
}
V$.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;
    }
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(e, t) {
    if (e = +e, t = +t, this._point) {
      var n = this._x2 - e, i = this._y2 - t;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + i * i, this._alpha));
    }
    switch (this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
        break;
      case 1:
        this._point = 2;
        break;
      case 2:
        this._point = 3;
      default:
        m2(this, e, t);
        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 = e, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
  }
};
const HI = function e(t) {
  function n(i) {
    return t ? new V$(i, t) : new h2(i, 0);
  }
  return n.alpha = function(i) {
    return e(+i);
  }, n;
}(0.5);
function K$(e, t) {
  this._context = e, this._alpha = t;
}
K$.prototype = {
  areaStart: sa,
  areaEnd: sa,
  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(e, t) {
    if (e = +e, t = +t, this._point) {
      var n = this._x2 - e, i = this._y2 - t;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + i * i, this._alpha));
    }
    switch (this._point) {
      case 0:
        this._point = 1, this._x3 = e, this._y3 = t;
        break;
      case 1:
        this._point = 2, this._context.moveTo(this._x4 = e, this._y4 = t);
        break;
      case 2:
        this._point = 3, this._x5 = e, this._y5 = t;
        break;
      default:
        m2(this, e, t);
        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 = e, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
  }
};
const YI = function e(t) {
  function n(i) {
    return t ? new K$(i, t) : new g2(i, 0);
  }
  return n.alpha = function(i) {
    return e(+i);
  }, n;
}(0.5);
function J$(e, t) {
  this._context = e, this._alpha = t;
}
J$.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() {
    (this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(e, t) {
    if (e = +e, t = +t, this._point) {
      var n = this._x2 - e, i = this._y2 - t;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + i * i, 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:
        m2(this, e, t);
        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 = e, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
  }
};
const XI = function e(t) {
  function n(i) {
    return t ? new J$(i, t) : new p2(i, 0);
  }
  return n.alpha = function(i) {
    return e(+i);
  }, n;
}(0.5);
function Q$(e) {
  this._context = e;
}
Q$.prototype = {
  areaStart: sa,
  areaEnd: sa,
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    this._point && this._context.closePath();
  },
  point: function(e, t) {
    e = +e, t = +t, this._point ? this._context.lineTo(e, t) : (this._point = 1, this._context.moveTo(e, t));
  }
};
function VI(e) {
  return new Q$(e);
}
function hO(e) {
  return e < 0 ? -1 : 1;
}
function gO(e, t, n) {
  var i = e._x1 - e._x0, r = t - e._x1, o = (e._y1 - e._y0) / (i || r < 0 && -0), a = (n - e._y1) / (r || i < 0 && -0), s = (o * r + a * i) / (i + r);
  return (hO(o) + hO(a)) * Math.min(Math.abs(o), Math.abs(a), 0.5 * Math.abs(s)) || 0;
}
function pO(e, t) {
  var n = e._x1 - e._x0;
  return n ? (3 * (e._y1 - e._y0) / n - t) / 2 : t;
}
function a1(e, t, n) {
  var i = e._x0, r = e._y0, o = e._x1, a = e._y1, s = (o - i) / 3;
  e._context.bezierCurveTo(i + s, r + s * t, o - s, a - s * n, o, a);
}
function pg(e) {
  this._context = e;
}
pg.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:
        a1(this, this._t0, pO(this, this._t0));
        break;
    }
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(e, t) {
    var n = NaN;
    if (e = +e, t = +t, !(e === this._x1 && t === this._y1)) {
      switch (this._point) {
        case 0:
          this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
          break;
        case 1:
          this._point = 2;
          break;
        case 2:
          this._point = 3, a1(this, pO(this, n = gO(this, e, t)), n);
          break;
        default:
          a1(this, this._t0, n = gO(this, e, t));
          break;
      }
      this._x0 = this._x1, this._x1 = e, this._y0 = this._y1, this._y1 = t, this._t0 = n;
    }
  }
};
function Z$(e) {
  this._context = new eM(e);
}
(Z$.prototype = Object.create(pg.prototype)).point = function(e, t) {
  pg.prototype.point.call(this, t, e);
};
function eM(e) {
  this._context = e;
}
eM.prototype = {
  moveTo: function(e, t) {
    this._context.moveTo(t, e);
  },
  closePath: function() {
    this._context.closePath();
  },
  lineTo: function(e, t) {
    this._context.lineTo(t, e);
  },
  bezierCurveTo: function(e, t, n, i, r, o) {
    this._context.bezierCurveTo(t, e, i, n, o, r);
  }
};
function KI(e) {
  return new pg(e);
}
function JI(e) {
  return new Z$(e);
}
function tM(e) {
  this._context = e;
}
tM.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x = [], this._y = [];
  },
  lineEnd: function() {
    var e = this._x, t = this._y, n = e.length;
    if (n)
      if (this._line ? this._context.lineTo(e[0], t[0]) : this._context.moveTo(e[0], t[0]), n === 2)
        this._context.lineTo(e[1], t[1]);
      else
        for (var i = mO(e), r = mO(t), o = 0, a = 1; a < n; ++o, ++a)
          this._context.bezierCurveTo(i[0][o], r[0][o], i[1][o], r[1][o], e[a], t[a]);
    (this._line || this._line !== 0 && n === 1) && this._context.closePath(), this._line = 1 - this._line, this._x = this._y = null;
  },
  point: function(e, t) {
    this._x.push(+e), this._y.push(+t);
  }
};
function mO(e) {
  var t, n = e.length - 1, i, r = new Array(n), o = new Array(n), a = new Array(n);
  for (r[0] = 0, o[0] = 2, a[0] = e[0] + 2 * e[1], t = 1; t < n - 1; ++t)
    r[t] = 1, o[t] = 4, a[t] = 4 * e[t] + 2 * e[t + 1];
  for (r[n - 1] = 2, o[n - 1] = 7, a[n - 1] = 8 * e[n - 1] + e[n], t = 1; t < n; ++t)
    i = r[t] / o[t - 1], o[t] -= i, a[t] -= i * a[t - 1];
  for (r[n - 1] = a[n - 1] / o[n - 1], t = n - 2; t >= 0; --t)
    r[t] = (a[t] - r[t + 1]) / o[t];
  for (o[n - 1] = (e[n] + r[n - 1]) / 2, t = 0; t < n - 1; ++t)
    o[t] = 2 * e[t + 1] - r[t + 1];
  return [r, o];
}
function QI(e) {
  return new tM(e);
}
function sp(e, t) {
  this._context = e, this._t = t;
}
sp.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x = this._y = NaN, this._point = 0;
  },
  lineEnd: function() {
    0 < this._t && this._t < 1 && this._point === 2 && this._context.lineTo(this._x, this._y), (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line >= 0 && (this._t = 1 - this._t, this._line = 1 - this._line);
  },
  point: function(e, t) {
    switch (e = +e, t = +t, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
        break;
      case 1:
        this._point = 2;
      default: {
        if (this._t <= 0)
          this._context.lineTo(this._x, t), this._context.lineTo(e, t);
        else {
          var n = this._x * (1 - this._t) + e * this._t;
          this._context.lineTo(n, this._y), this._context.lineTo(n, t);
        }
        break;
      }
    }
    this._x = e, this._y = t;
  }
};
function ZI(e) {
  return new sp(e, 0.5);
}
function eB(e) {
  return new sp(e, 0);
}
function tB(e) {
  return new sp(e, 1);
}
function Zo(e, t) {
  if (typeof document < "u" && document.createElement) {
    const n = document.createElement("canvas");
    if (n && n.getContext)
      return n.width = e, n.height = t, n;
  }
  return null;
}
const nB = () => typeof Image < "u" ? Image : null;
function Sr(e, t) {
  switch (arguments.length) {
    case 0:
      break;
    case 1:
      this.range(e);
      break;
    default:
      this.range(t).domain(e);
      break;
  }
  return this;
}
function wa(e, t) {
  switch (arguments.length) {
    case 0:
      break;
    case 1: {
      typeof e == "function" ? this.interpolator(e) : this.range(e);
      break;
    }
    default: {
      this.domain(e), typeof t == "function" ? this.interpolator(t) : this.range(t);
      break;
    }
  }
  return this;
}
const Xy = Symbol("implicit");
function y2() {
  var e = new T_(), t = [], n = [], i = Xy;
  function r(o) {
    let a = e.get(o);
    if (a === void 0) {
      if (i !== Xy)
        return i;
      e.set(o, a = t.push(o) - 1);
    }
    return n[a % n.length];
  }
  return r.domain = function(o) {
    if (!arguments.length)
      return t.slice();
    t = [], e = new T_();
    for (const a of o)
      e.has(a) || e.set(a, t.push(a) - 1);
    return r;
  }, r.range = function(o) {
    return arguments.length ? (n = Array.from(o), r) : n.slice();
  }, r.unknown = function(o) {
    return arguments.length ? (i = o, r) : i;
  }, r.copy = function() {
    return y2(t, n).unknown(i);
  }, Sr.apply(r, arguments), r;
}
function Ol(e, t, n) {
  e.prototype = t.prototype = n, n.constructor = e;
}
function Wf(e, t) {
  var n = Object.create(e.prototype);
  for (var i in t)
    n[i] = t[i];
  return n;
}
function Ea() {
}
var Es = 0.7, Hu = 1 / Es, $u = "\\s*([+-]?\\d+)\\s*", af = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", dr = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", iB = /^#([0-9a-f]{3,8})$/, rB = new RegExp(`^rgb\\(${$u},${$u},${$u}\\)$`), oB = new RegExp(`^rgb\\(${dr},${dr},${dr}\\)$`), aB = new RegExp(`^rgba\\(${$u},${$u},${$u},${af}\\)$`), sB = new RegExp(`^rgba\\(${dr},${dr},${dr},${af}\\)$`), uB = new RegExp(`^hsl\\(${af},${dr},${dr}\\)$`), lB = new RegExp(`^hsla\\(${af},${dr},${dr},${af}\\)$`), yO = {
  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
};
Ol(Ea, sf, {
  copy(e) {
    return Object.assign(new this.constructor(), this, e);
  },
  displayable() {
    return this.rgb().displayable();
  },
  hex: vO,
  formatHex: vO,
  formatHex8: cB,
  formatHsl: fB,
  formatRgb: bO,
  toString: bO
});
function vO() {
  return this.rgb().formatHex();
}
function cB() {
  return this.rgb().formatHex8();
}
function fB() {
  return nM(this).formatHsl();
}
function bO() {
  return this.rgb().formatRgb();
}
function sf(e) {
  var t, n;
  return e = (e + "").trim().toLowerCase(), (t = iB.exec(e)) ? (n = t[1].length, t = parseInt(t[1], 16), n === 6 ? xO(t) : n === 3 ? new _t(t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, (t & 15) << 4 | t & 15, 1) : n === 8 ? zd(t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, (t & 255) / 255) : n === 4 ? zd(t >> 12 & 15 | t >> 8 & 240, t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, ((t & 15) << 4 | t & 15) / 255) : null) : (t = rB.exec(e)) ? new _t(t[1], t[2], t[3], 1) : (t = oB.exec(e)) ? new _t(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, 1) : (t = aB.exec(e)) ? zd(t[1], t[2], t[3], t[4]) : (t = sB.exec(e)) ? zd(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, t[4]) : (t = uB.exec(e)) ? AO(t[1], t[2] / 100, t[3] / 100, 1) : (t = lB.exec(e)) ? AO(t[1], t[2] / 100, t[3] / 100, t[4]) : yO.hasOwnProperty(e) ? xO(yO[e]) : e === "transparent" ? new _t(NaN, NaN, NaN, 0) : null;
}
function xO(e) {
  return new _t(e >> 16 & 255, e >> 8 & 255, e & 255, 1);
}
function zd(e, t, n, i) {
  return i <= 0 && (e = t = n = NaN), new _t(e, t, n, i);
}
function v2(e) {
  return e instanceof Ea || (e = sf(e)), e ? (e = e.rgb(), new _t(e.r, e.g, e.b, e.opacity)) : new _t();
}
function ua(e, t, n, i) {
  return arguments.length === 1 ? v2(e) : new _t(e, t, n, i == null ? 1 : i);
}
function _t(e, t, n, i) {
  this.r = +e, this.g = +t, this.b = +n, this.opacity = +i;
}
Ol(_t, ua, Wf(Ea, {
  brighter(e) {
    return e = e == null ? Hu : Math.pow(Hu, e), new _t(this.r * e, this.g * e, this.b * e, this.opacity);
  },
  darker(e) {
    return e = e == null ? Es : Math.pow(Es, e), new _t(this.r * e, this.g * e, this.b * e, this.opacity);
  },
  rgb() {
    return this;
  },
  clamp() {
    return new _t(ds(this.r), ds(this.g), ds(this.b), mg(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: wO,
  formatHex: wO,
  formatHex8: dB,
  formatRgb: EO,
  toString: EO
}));
function wO() {
  return `#${os(this.r)}${os(this.g)}${os(this.b)}`;
}
function dB() {
  return `#${os(this.r)}${os(this.g)}${os(this.b)}${os((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function EO() {
  const e = mg(this.opacity);
  return `${e === 1 ? "rgb(" : "rgba("}${ds(this.r)}, ${ds(this.g)}, ${ds(this.b)}${e === 1 ? ")" : `, ${e})`}`;
}
function mg(e) {
  return isNaN(e) ? 1 : Math.max(0, Math.min(1, e));
}
function ds(e) {
  return Math.max(0, Math.min(255, Math.round(e) || 0));
}
function os(e) {
  return e = ds(e), (e < 16 ? "0" : "") + e.toString(16);
}
function AO(e, t, n, i) {
  return i <= 0 ? e = t = n = NaN : n <= 0 || n >= 1 ? e = t = NaN : t <= 0 && (e = NaN), new Fi(e, t, n, i);
}
function nM(e) {
  if (e instanceof Fi)
    return new Fi(e.h, e.s, e.l, e.opacity);
  if (e instanceof Ea || (e = sf(e)), !e)
    return new Fi();
  if (e instanceof Fi)
    return e;
  e = e.rgb();
  var t = e.r / 255, n = e.g / 255, i = e.b / 255, r = Math.min(t, n, i), o = Math.max(t, n, i), a = NaN, s = o - r, u = (o + r) / 2;
  return s ? (t === o ? a = (n - i) / s + (n < i) * 6 : n === o ? a = (i - t) / s + 2 : a = (t - n) / s + 4, s /= u < 0.5 ? o + r : 2 - o - r, a *= 60) : s = u > 0 && u < 1 ? 0 : a, new Fi(a, s, u, e.opacity);
}
function yg(e, t, n, i) {
  return arguments.length === 1 ? nM(e) : new Fi(e, t, n, i == null ? 1 : i);
}
function Fi(e, t, n, i) {
  this.h = +e, this.s = +t, this.l = +n, this.opacity = +i;
}
Ol(Fi, yg, Wf(Ea, {
  brighter(e) {
    return e = e == null ? Hu : Math.pow(Hu, e), new Fi(this.h, this.s, this.l * e, this.opacity);
  },
  darker(e) {
    return e = e == null ? Es : Math.pow(Es, e), new Fi(this.h, this.s, this.l * e, this.opacity);
  },
  rgb() {
    var e = this.h % 360 + (this.h < 0) * 360, t = isNaN(e) || isNaN(this.s) ? 0 : this.s, n = this.l, i = n + (n < 0.5 ? n : 1 - n) * t, r = 2 * n - i;
    return new _t(
      s1(e >= 240 ? e - 240 : e + 120, r, i),
      s1(e, r, i),
      s1(e < 120 ? e + 240 : e - 120, r, i),
      this.opacity
    );
  },
  clamp() {
    return new Fi(_O(this.h), Ud(this.s), Ud(this.l), mg(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 e = mg(this.opacity);
    return `${e === 1 ? "hsl(" : "hsla("}${_O(this.h)}, ${Ud(this.s) * 100}%, ${Ud(this.l) * 100}%${e === 1 ? ")" : `, ${e})`}`;
  }
}));
function _O(e) {
  return e = (e || 0) % 360, e < 0 ? e + 360 : e;
}
function Ud(e) {
  return Math.max(0, Math.min(1, e || 0));
}
function s1(e, t, n) {
  return (e < 60 ? t + (n - t) * e / 60 : e < 180 ? n : e < 240 ? t + (n - t) * (240 - e) / 60 : t) * 255;
}
const iM = Math.PI / 180, rM = 180 / Math.PI, vg = 18, oM = 0.96422, aM = 1, sM = 0.82521, uM = 4 / 29, Mu = 6 / 29, lM = 3 * Mu * Mu, hB = Mu * Mu * Mu;
function cM(e) {
  if (e instanceof hr)
    return new hr(e.l, e.a, e.b, e.opacity);
  if (e instanceof eo)
    return fM(e);
  e instanceof _t || (e = v2(e));
  var t = f1(e.r), n = f1(e.g), i = f1(e.b), r = u1((0.2225045 * t + 0.7168786 * n + 0.0606169 * i) / aM), o, a;
  return t === n && n === i ? o = a = r : (o = u1((0.4360747 * t + 0.3850649 * n + 0.1430804 * i) / oM), a = u1((0.0139322 * t + 0.0971045 * n + 0.7141733 * i) / sM)), new hr(116 * r - 16, 500 * (o - r), 200 * (r - a), e.opacity);
}
function bg(e, t, n, i) {
  return arguments.length === 1 ? cM(e) : new hr(e, t, n, i == null ? 1 : i);
}
function hr(e, t, n, i) {
  this.l = +e, this.a = +t, this.b = +n, this.opacity = +i;
}
Ol(hr, bg, Wf(Ea, {
  brighter(e) {
    return new hr(this.l + vg * (e == null ? 1 : e), this.a, this.b, this.opacity);
  },
  darker(e) {
    return new hr(this.l - vg * (e == null ? 1 : e), this.a, this.b, this.opacity);
  },
  rgb() {
    var e = (this.l + 16) / 116, t = isNaN(this.a) ? e : e + this.a / 500, n = isNaN(this.b) ? e : e - this.b / 200;
    return t = oM * l1(t), e = aM * l1(e), n = sM * l1(n), new _t(
      c1(3.1338561 * t - 1.6168667 * e - 0.4906146 * n),
      c1(-0.9787684 * t + 1.9161415 * e + 0.033454 * n),
      c1(0.0719453 * t - 0.2289914 * e + 1.4052427 * n),
      this.opacity
    );
  }
}));
function u1(e) {
  return e > hB ? Math.pow(e, 1 / 3) : e / lM + uM;
}
function l1(e) {
  return e > Mu ? e * e * e : lM * (e - uM);
}
function c1(e) {
  return 255 * (e <= 31308e-7 ? 12.92 * e : 1.055 * Math.pow(e, 1 / 2.4) - 0.055);
}
function f1(e) {
  return (e /= 255) <= 0.04045 ? e / 12.92 : Math.pow((e + 0.055) / 1.055, 2.4);
}
function gB(e) {
  if (e instanceof eo)
    return new eo(e.h, e.c, e.l, e.opacity);
  if (e instanceof hr || (e = cM(e)), e.a === 0 && e.b === 0)
    return new eo(NaN, 0 < e.l && e.l < 100 ? 0 : NaN, e.l, e.opacity);
  var t = Math.atan2(e.b, e.a) * rM;
  return new eo(t < 0 ? t + 360 : t, Math.sqrt(e.a * e.a + e.b * e.b), e.l, e.opacity);
}
function xg(e, t, n, i) {
  return arguments.length === 1 ? gB(e) : new eo(e, t, n, i == null ? 1 : i);
}
function eo(e, t, n, i) {
  this.h = +e, this.c = +t, this.l = +n, this.opacity = +i;
}
function fM(e) {
  if (isNaN(e.h))
    return new hr(e.l, 0, 0, e.opacity);
  var t = e.h * iM;
  return new hr(e.l, Math.cos(t) * e.c, Math.sin(t) * e.c, e.opacity);
}
Ol(eo, xg, Wf(Ea, {
  brighter(e) {
    return new eo(this.h, this.c, this.l + vg * (e == null ? 1 : e), this.opacity);
  },
  darker(e) {
    return new eo(this.h, this.c, this.l - vg * (e == null ? 1 : e), this.opacity);
  },
  rgb() {
    return fM(this).rgb();
  }
}));
var dM = -0.14861, b2 = 1.78277, x2 = -0.29227, up = -0.90649, uf = 1.97294, OO = uf * up, SO = uf * b2, CO = b2 * x2 - up * dM;
function pB(e) {
  if (e instanceof hs)
    return new hs(e.h, e.s, e.l, e.opacity);
  e instanceof _t || (e = v2(e));
  var t = e.r / 255, n = e.g / 255, i = e.b / 255, r = (CO * i + OO * t - SO * n) / (CO + OO - SO), o = i - r, a = (uf * (n - r) - x2 * o) / up, s = Math.sqrt(a * a + o * o) / (uf * r * (1 - r)), u = s ? Math.atan2(a, o) * rM - 120 : NaN;
  return new hs(u < 0 ? u + 360 : u, s, r, e.opacity);
}
function Vy(e, t, n, i) {
  return arguments.length === 1 ? pB(e) : new hs(e, t, n, i == null ? 1 : i);
}
function hs(e, t, n, i) {
  this.h = +e, this.s = +t, this.l = +n, this.opacity = +i;
}
Ol(hs, Vy, Wf(Ea, {
  brighter(e) {
    return e = e == null ? Hu : Math.pow(Hu, e), new hs(this.h, this.s, this.l * e, this.opacity);
  },
  darker(e) {
    return e = e == null ? Es : Math.pow(Es, e), new hs(this.h, this.s, this.l * e, this.opacity);
  },
  rgb() {
    var e = isNaN(this.h) ? 0 : (this.h + 120) * iM, t = +this.l, n = isNaN(this.s) ? 0 : this.s * t * (1 - t), i = Math.cos(e), r = Math.sin(e);
    return new _t(
      255 * (t + n * (dM * i + b2 * r)),
      255 * (t + n * (x2 * i + up * r)),
      255 * (t + n * (uf * i)),
      this.opacity
    );
  }
}));
function hM(e, t, n, i, r) {
  var o = e * e, a = o * e;
  return ((1 - 3 * e + 3 * o - a) * t + (4 - 6 * o + 3 * a) * n + (1 + 3 * e + 3 * o - 3 * a) * i + a * r) / 6;
}
function gM(e) {
  var t = e.length - 1;
  return function(n) {
    var i = n <= 0 ? n = 0 : n >= 1 ? (n = 1, t - 1) : Math.floor(n * t), r = e[i], o = e[i + 1], a = i > 0 ? e[i - 1] : 2 * r - o, s = i < t - 1 ? e[i + 2] : 2 * o - r;
    return hM((n - i / t) * t, a, r, o, s);
  };
}
function pM(e) {
  var t = e.length;
  return function(n) {
    var i = Math.floor(((n %= 1) < 0 ? ++n : n) * t), r = e[(i + t - 1) % t], o = e[i % t], a = e[(i + 1) % t], s = e[(i + 2) % t];
    return hM((n - i / t) * t, r, o, a, s);
  };
}
const lp = (e) => () => e;
function mM(e, t) {
  return function(n) {
    return e + n * t;
  };
}
function mB(e, t, n) {
  return e = Math.pow(e, n), t = Math.pow(t, n) - e, n = 1 / n, function(i) {
    return Math.pow(e + i * t, n);
  };
}
function cp(e, t) {
  var n = t - e;
  return n ? mM(e, n > 180 || n < -180 ? n - 360 * Math.round(n / 360) : n) : lp(isNaN(e) ? t : e);
}
function yB(e) {
  return (e = +e) == 1 ? Ot : function(t, n) {
    return n - t ? mB(t, n, e) : lp(isNaN(t) ? n : t);
  };
}
function Ot(e, t) {
  var n = t - e;
  return n ? mM(e, n) : lp(isNaN(e) ? t : e);
}
const Ky = function e(t) {
  var n = yB(t);
  function i(r, o) {
    var a = n((r = ua(r)).r, (o = ua(o)).r), s = n(r.g, o.g), u = n(r.b, o.b), l = Ot(r.opacity, o.opacity);
    return function(c) {
      return r.r = a(c), r.g = s(c), r.b = u(c), r.opacity = l(c), r + "";
    };
  }
  return i.gamma = e, i;
}(1);
function yM(e) {
  return function(t) {
    var n = t.length, i = new Array(n), r = new Array(n), o = new Array(n), a, s;
    for (a = 0; a < n; ++a)
      s = ua(t[a]), i[a] = s.r || 0, r[a] = s.g || 0, o[a] = s.b || 0;
    return i = e(i), r = e(r), o = e(o), s.opacity = 1, function(u) {
      return s.r = i(u), s.g = r(u), s.b = o(u), s + "";
    };
  };
}
var vB = yM(gM), bB = yM(pM);
function w2(e, t) {
  t || (t = []);
  var n = e ? Math.min(t.length, e.length) : 0, i = t.slice(), r;
  return function(o) {
    for (r = 0; r < n; ++r)
      i[r] = e[r] * (1 - o) + t[r] * o;
    return i;
  };
}
function vM(e) {
  return ArrayBuffer.isView(e) && !(e instanceof DataView);
}
function xB(e, t) {
  return (vM(t) ? w2 : bM)(e, t);
}
function bM(e, t) {
  var n = t ? t.length : 0, i = e ? Math.min(n, e.length) : 0, r = new Array(i), o = new Array(n), a;
  for (a = 0; a < i; ++a)
    r[a] = Aa(e[a], t[a]);
  for (; a < n; ++a)
    o[a] = t[a];
  return function(s) {
    for (a = 0; a < i; ++a)
      o[a] = r[a](s);
    return o;
  };
}
function xM(e, t) {
  var n = new Date();
  return e = +e, t = +t, function(i) {
    return n.setTime(e * (1 - i) + t * i), n;
  };
}
function Oi(e, t) {
  return e = +e, t = +t, function(n) {
    return e * (1 - n) + t * n;
  };
}
function wM(e, t) {
  var n = {}, i = {}, r;
  (e === null || typeof e != "object") && (e = {}), (t === null || typeof t != "object") && (t = {});
  for (r in t)
    r in e ? n[r] = Aa(e[r], t[r]) : i[r] = t[r];
  return function(o) {
    for (r in n)
      i[r] = n[r](o);
    return i;
  };
}
var Jy = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, d1 = new RegExp(Jy.source, "g");
function wB(e) {
  return function() {
    return e;
  };
}
function EB(e) {
  return function(t) {
    return e(t) + "";
  };
}
function EM(e, t) {
  var n = Jy.lastIndex = d1.lastIndex = 0, i, r, o, a = -1, s = [], u = [];
  for (e = e + "", t = t + ""; (i = Jy.exec(e)) && (r = d1.exec(t)); )
    (o = r.index) > n && (o = t.slice(n, o), s[a] ? s[a] += o : s[++a] = o), (i = i[0]) === (r = r[0]) ? s[a] ? s[a] += r : s[++a] = r : (s[++a] = null, u.push({ i: a, x: Oi(i, r) })), n = d1.lastIndex;
  return n < t.length && (o = t.slice(n), s[a] ? s[a] += o : s[++a] = o), s.length < 2 ? u[0] ? EB(u[0].x) : wB(t) : (t = u.length, function(l) {
    for (var c = 0, f; c < t; ++c)
      s[(f = u[c]).i] = f.x(l);
    return s.join("");
  });
}
function Aa(e, t) {
  var n = typeof t, i;
  return t == null || n === "boolean" ? lp(t) : (n === "number" ? Oi : n === "string" ? (i = sf(t)) ? (t = i, Ky) : EM : t instanceof sf ? Ky : t instanceof Date ? xM : vM(t) ? w2 : Array.isArray(t) ? bM : typeof t.valueOf != "function" && typeof t.toString != "function" || isNaN(t) ? wM : Oi)(e, t);
}
function AB(e) {
  var t = e.length;
  return function(n) {
    return e[Math.max(0, Math.min(t - 1, Math.floor(n * t)))];
  };
}
function _B(e, t) {
  var n = cp(+e, +t);
  return function(i) {
    var r = n(i);
    return r - 360 * Math.floor(r / 360);
  };
}
function Gf(e, t) {
  return e = +e, t = +t, function(n) {
    return Math.round(e * (1 - n) + t * n);
  };
}
var FO = 180 / Math.PI, Qy = {
  translateX: 0,
  translateY: 0,
  rotate: 0,
  skewX: 0,
  scaleX: 1,
  scaleY: 1
};
function AM(e, t, n, i, r, o) {
  var a, s, u;
  return (a = Math.sqrt(e * e + t * t)) && (e /= a, t /= a), (u = e * n + t * i) && (n -= e * u, i -= t * u), (s = Math.sqrt(n * n + i * i)) && (n /= s, i /= s, u /= s), e * i < t * n && (e = -e, t = -t, u = -u, a = -a), {
    translateX: r,
    translateY: o,
    rotate: Math.atan2(t, e) * FO,
    skewX: Math.atan(u) * FO,
    scaleX: a,
    scaleY: s
  };
}
var qd;
function OB(e) {
  const t = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(e + "");
  return t.isIdentity ? Qy : AM(t.a, t.b, t.c, t.d, t.e, t.f);
}
function SB(e) {
  return e == null || (qd || (qd = document.createElementNS("http://www.w3.org/2000/svg", "g")), qd.setAttribute("transform", e), !(e = qd.transform.baseVal.consolidate())) ? Qy : (e = e.matrix, AM(e.a, e.b, e.c, e.d, e.e, e.f));
}
function _M(e, t, n, i) {
  function r(l) {
    return l.length ? l.pop() + " " : "";
  }
  function o(l, c, f, d, h, g) {
    if (l !== f || c !== d) {
      var p = h.push("translate(", null, t, null, n);
      g.push({ i: p - 4, x: Oi(l, f) }, { i: p - 2, x: Oi(c, d) });
    } else
      (f || d) && h.push("translate(" + f + t + d + n);
  }
  function a(l, c, f, d) {
    l !== c ? (l - c > 180 ? c += 360 : c - l > 180 && (l += 360), d.push({ i: f.push(r(f) + "rotate(", null, i) - 2, x: Oi(l, c) })) : c && f.push(r(f) + "rotate(" + c + i);
  }
  function s(l, c, f, d) {
    l !== c ? d.push({ i: f.push(r(f) + "skewX(", null, i) - 2, x: Oi(l, c) }) : c && f.push(r(f) + "skewX(" + c + i);
  }
  function u(l, c, f, d, h, g) {
    if (l !== f || c !== d) {
      var p = h.push(r(h) + "scale(", null, ",", null, ")");
      g.push({ i: p - 4, x: Oi(l, f) }, { i: p - 2, x: Oi(c, d) });
    } else
      (f !== 1 || d !== 1) && h.push(r(h) + "scale(" + f + "," + d + ")");
  }
  return function(l, c) {
    var f = [], d = [];
    return l = e(l), c = e(c), o(l.translateX, l.translateY, c.translateX, c.translateY, f, d), a(l.rotate, c.rotate, f, d), s(l.skewX, c.skewX, f, d), u(l.scaleX, l.scaleY, c.scaleX, c.scaleY, f, d), l = c = null, function(h) {
      for (var g = -1, p = d.length, m; ++g < p; )
        f[(m = d[g]).i] = m.x(h);
      return f.join("");
    };
  };
}
var CB = _M(OB, "px, ", "px)", "deg)"), FB = _M(SB, ", ", ")", ")"), kB = 1e-12;
function kO(e) {
  return ((e = Math.exp(e)) + 1 / e) / 2;
}
function DB(e) {
  return ((e = Math.exp(e)) - 1 / e) / 2;
}
function $B(e) {
  return ((e = Math.exp(2 * e)) - 1) / (e + 1);
}
const MB = function e(t, n, i) {
  function r(o, a) {
    var s = o[0], u = o[1], l = o[2], c = a[0], f = a[1], d = a[2], h = c - s, g = f - u, p = h * h + g * g, m, y;
    if (p < kB)
      y = Math.log(d / l) / t, m = function(w) {
        return [
          s + w * h,
          u + w * g,
          l * Math.exp(t * w * y)
        ];
      };
    else {
      var v = Math.sqrt(p), b = (d * d - l * l + i * p) / (2 * l * n * v), x = (d * d - l * l - i * p) / (2 * d * n * v), E = Math.log(Math.sqrt(b * b + 1) - b), A = Math.log(Math.sqrt(x * x + 1) - x);
      y = (A - E) / t, m = function(w) {
        var _ = w * y, k = kO(E), C = l / (n * v) * (k * $B(t * _ + E) - DB(E));
        return [
          s + C * h,
          u + C * g,
          l * k / kO(t * _ + E)
        ];
      };
    }
    return m.duration = y * 1e3 * t / Math.SQRT2, m;
  }
  return r.rho = function(o) {
    var a = Math.max(1e-3, +o), s = a * a, u = s * s;
    return e(a, s, u);
  }, r;
}(Math.SQRT2, 2, 4);
function OM(e) {
  return function(t, n) {
    var i = e((t = yg(t)).h, (n = yg(n)).h), r = Ot(t.s, n.s), o = Ot(t.l, n.l), a = Ot(t.opacity, n.opacity);
    return function(s) {
      return t.h = i(s), t.s = r(s), t.l = o(s), t.opacity = a(s), t + "";
    };
  };
}
const TB = OM(cp);
var NB = OM(Ot);
function RB(e, t) {
  var n = Ot((e = bg(e)).l, (t = bg(t)).l), i = Ot(e.a, t.a), r = Ot(e.b, t.b), o = Ot(e.opacity, t.opacity);
  return function(a) {
    return e.l = n(a), e.a = i(a), e.b = r(a), e.opacity = o(a), e + "";
  };
}
function SM(e) {
  return function(t, n) {
    var i = e((t = xg(t)).h, (n = xg(n)).h), r = Ot(t.c, n.c), o = Ot(t.l, n.l), a = Ot(t.opacity, n.opacity);
    return function(s) {
      return t.h = i(s), t.c = r(s), t.l = o(s), t.opacity = a(s), t + "";
    };
  };
}
const jB = SM(cp);
var PB = SM(Ot);
function CM(e) {
  return function t(n) {
    n = +n;
    function i(r, o) {
      var a = e((r = Vy(r)).h, (o = Vy(o)).h), s = Ot(r.s, o.s), u = Ot(r.l, o.l), l = Ot(r.opacity, o.opacity);
      return function(c) {
        return r.h = a(c), r.s = s(c), r.l = u(Math.pow(c, n)), r.opacity = l(c), r + "";
      };
    }
    return i.gamma = t, i;
  }(1);
}
const LB = CM(cp);
var IB = CM(Ot);
function E2(e, t) {
  t === void 0 && (t = e, e = Aa);
  for (var n = 0, i = t.length - 1, r = t[0], o = new Array(i < 0 ? 0 : i); n < i; )
    o[n] = e(r, r = t[++n]);
  return function(a) {
    var s = Math.max(0, Math.min(i - 1, Math.floor(a *= i)));
    return o[s](a - s);
  };
}
function BB(e, t) {
  for (var n = new Array(t), i = 0; i < t; ++i)
    n[i] = e(i / (t - 1));
  return n;
}
const zB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  interpolate: Aa,
  interpolateArray: xB,
  interpolateBasis: gM,
  interpolateBasisClosed: pM,
  interpolateDate: xM,
  interpolateDiscrete: AB,
  interpolateHue: _B,
  interpolateNumber: Oi,
  interpolateNumberArray: w2,
  interpolateObject: wM,
  interpolateRound: Gf,
  interpolateString: EM,
  interpolateTransformCss: CB,
  interpolateTransformSvg: FB,
  interpolateZoom: MB,
  interpolateRgb: Ky,
  interpolateRgbBasis: vB,
  interpolateRgbBasisClosed: bB,
  interpolateHsl: TB,
  interpolateHslLong: NB,
  interpolateLab: RB,
  interpolateHcl: jB,
  interpolateHclLong: PB,
  interpolateCubehelix: LB,
  interpolateCubehelixLong: IB,
  piecewise: E2,
  quantize: BB
}, Symbol.toStringTag, { value: "Module" }));
function UB(e) {
  return function() {
    return e;
  };
}
function Zy(e) {
  return +e;
}
var DO = [0, 1];
function Dn(e) {
  return e;
}
function ev(e, t) {
  return (t -= e = +e) ? function(n) {
    return (n - e) / t;
  } : UB(isNaN(t) ? NaN : 0.5);
}
function qB(e, t) {
  var n;
  return e > t && (n = e, e = t, t = n), function(i) {
    return Math.max(e, Math.min(t, i));
  };
}
function WB(e, t, n) {
  var i = e[0], r = e[1], o = t[0], a = t[1];
  return r < i ? (i = ev(r, i), o = n(a, o)) : (i = ev(i, r), o = n(o, a)), function(s) {
    return o(i(s));
  };
}
function GB(e, t, n) {
  var i = Math.min(e.length, t.length) - 1, r = new Array(i), o = new Array(i), a = -1;
  for (e[i] < e[0] && (e = e.slice().reverse(), t = t.slice().reverse()); ++a < i; )
    r[a] = ev(e[a], e[a + 1]), o[a] = n(t[a], t[a + 1]);
  return function(s) {
    var u = Bf(e, s, 1, i) - 1;
    return o[u](r[u](s));
  };
}
function Hf(e, t) {
  return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());
}
function fp() {
  var e = DO, t = DO, n = Aa, i, r, o, a = Dn, s, u, l;
  function c() {
    var d = Math.min(e.length, t.length);
    return a !== Dn && (a = qB(e[0], e[d - 1])), s = d > 2 ? GB : WB, u = l = null, f;
  }
  function f(d) {
    return d == null || isNaN(d = +d) ? o : (u || (u = s(e.map(i), t, n)))(i(a(d)));
  }
  return f.invert = function(d) {
    return a(r((l || (l = s(t, e.map(i), Oi)))(d)));
  }, f.domain = function(d) {
    return arguments.length ? (e = Array.from(d, Zy), c()) : e.slice();
  }, f.range = function(d) {
    return arguments.length ? (t = Array.from(d), c()) : t.slice();
  }, f.rangeRound = function(d) {
    return t = Array.from(d), n = Gf, c();
  }, f.clamp = function(d) {
    return arguments.length ? (a = d ? !0 : Dn, c()) : a !== Dn;
  }, f.interpolate = function(d) {
    return arguments.length ? (n = d, c()) : n;
  }, f.unknown = function(d) {
    return arguments.length ? (o = d, f) : o;
  }, function(d, h) {
    return i = d, r = h, c();
  };
}
function FM() {
  return fp()(Dn, Dn);
}
function kM(e, t, n, i) {
  var r = ia(e, t, n), o;
  switch (i = xs(i == null ? ",f" : i), i.type) {
    case "s": {
      var a = Math.max(Math.abs(e), Math.abs(t));
      return i.precision == null && !isNaN(o = XD(r, a)) && (i.precision = o), rx(i, a);
    }
    case "":
    case "e":
    case "g":
    case "p":
    case "r": {
      i.precision == null && !isNaN(o = VD(r, Math.max(Math.abs(e), Math.abs(t)))) && (i.precision = o - (i.type === "e"));
      break;
    }
    case "f":
    case "%": {
      i.precision == null && !isNaN(o = YD(r)) && (i.precision = o - (i.type === "%") * 2);
      break;
    }
  }
  return H0(i);
}
function Hs(e) {
  var t = e.domain;
  return e.ticks = function(n) {
    var i = t();
    return My(i[0], i[i.length - 1], n == null ? 10 : n);
  }, e.tickFormat = function(n, i) {
    var r = t();
    return kM(r[0], r[r.length - 1], n == null ? 10 : n, i);
  }, e.nice = function(n) {
    n == null && (n = 10);
    var i = t(), r = 0, o = i.length - 1, a = i[r], s = i[o], u, l, c = 10;
    for (s < a && (l = a, a = s, s = l, l = r, r = o, o = l); c-- > 0; ) {
      if (l = ID(a, s, n), l === u)
        return i[r] = a, i[o] = s, t(i);
      if (l > 0)
        a = Math.floor(a / l) * l, s = Math.ceil(s / l) * l;
      else if (l < 0)
        a = Math.ceil(a * l) / l, s = Math.floor(s * l) / l;
      else
        break;
      u = l;
    }
    return e;
  }, e;
}
function DM() {
  var e = FM();
  return e.copy = function() {
    return Hf(e, DM());
  }, Sr.apply(e, arguments), Hs(e);
}
function $M(e) {
  var t;
  function n(i) {
    return i == null || isNaN(i = +i) ? t : i;
  }
  return n.invert = n, n.domain = n.range = function(i) {
    return arguments.length ? (e = Array.from(i, Zy), n) : e.slice();
  }, n.unknown = function(i) {
    return arguments.length ? (t = i, n) : t;
  }, n.copy = function() {
    return $M(e).unknown(t);
  }, e = arguments.length ? Array.from(e, Zy) : [0, 1], Hs(n);
}
function MM(e, t) {
  e = e.slice();
  var n = 0, i = e.length - 1, r = e[n], o = e[i], a;
  return o < r && (a = n, n = i, i = a, a = r, r = o, o = a), e[n] = t.floor(r), e[i] = t.ceil(o), e;
}
function $O(e) {
  return Math.log(e);
}
function MO(e) {
  return Math.exp(e);
}
function HB(e) {
  return -Math.log(-e);
}
function YB(e) {
  return -Math.exp(-e);
}
function XB(e) {
  return isFinite(e) ? +("1e" + e) : e < 0 ? 0 : e;
}
function VB(e) {
  return e === 10 ? XB : e === Math.E ? Math.exp : (t) => Math.pow(e, t);
}
function KB(e) {
  return e === Math.E ? Math.log : e === 10 && Math.log10 || e === 2 && Math.log2 || (e = Math.log(e), (t) => Math.log(t) / e);
}
function TO(e) {
  return (t, n) => -e(-t, n);
}
function A2(e) {
  const t = e($O, MO), n = t.domain;
  let i = 10, r, o;
  function a() {
    return r = KB(i), o = VB(i), n()[0] < 0 ? (r = TO(r), o = TO(o), e(HB, YB)) : e($O, MO), t;
  }
  return t.base = function(s) {
    return arguments.length ? (i = +s, a()) : i;
  }, t.domain = function(s) {
    return arguments.length ? (n(s), a()) : n();
  }, t.ticks = (s) => {
    const u = n();
    let l = u[0], c = u[u.length - 1];
    const f = c < l;
    f && ([l, c] = [c, l]);
    let d = r(l), h = r(c), g, p;
    const m = s == null ? 10 : +s;
    let y = [];
    if (!(i % 1) && h - d < m) {
      if (d = Math.floor(d), h = Math.ceil(h), l > 0) {
        for (; d <= h; ++d)
          for (g = 1; g < i; ++g)
            if (p = d < 0 ? g / o(-d) : g * o(d), !(p < l)) {
              if (p > c)
                break;
              y.push(p);
            }
      } else
        for (; d <= h; ++d)
          for (g = i - 1; g >= 1; --g)
            if (p = d > 0 ? g / o(-d) : g * o(d), !(p < l)) {
              if (p > c)
                break;
              y.push(p);
            }
      y.length * 2 < m && (y = My(l, c, m));
    } else
      y = My(d, h, Math.min(h - d, m)).map(o);
    return f ? y.reverse() : y;
  }, t.tickFormat = (s, u) => {
    if (s == null && (s = 10), u == null && (u = i === 10 ? "s" : ","), typeof u != "function" && (!(i % 1) && (u = xs(u)).precision == null && (u.trim = !0), u = H0(u)), s === 1 / 0)
      return u;
    const l = Math.max(1, i * s / t.ticks().length);
    return (c) => {
      let f = c / o(Math.round(r(c)));
      return f * i < i - 0.5 && (f *= i), f <= l ? u(c) : "";
    };
  }, t.nice = () => n(MM(n(), {
    floor: (s) => o(Math.floor(r(s))),
    ceil: (s) => o(Math.ceil(r(s)))
  })), t;
}
function TM() {
  const e = A2(fp()).domain([1, 10]);
  return e.copy = () => Hf(e, TM()).base(e.base()), Sr.apply(e, arguments), e;
}
function NO(e) {
  return function(t) {
    return Math.sign(t) * Math.log1p(Math.abs(t / e));
  };
}
function RO(e) {
  return function(t) {
    return Math.sign(t) * Math.expm1(Math.abs(t)) * e;
  };
}
function _2(e) {
  var t = 1, n = e(NO(t), RO(t));
  return n.constant = function(i) {
    return arguments.length ? e(NO(t = +i), RO(t)) : t;
  }, Hs(n);
}
function NM() {
  var e = _2(fp());
  return e.copy = function() {
    return Hf(e, NM()).constant(e.constant());
  }, Sr.apply(e, arguments);
}
function jO(e) {
  return function(t) {
    return t < 0 ? -Math.pow(-t, e) : Math.pow(t, e);
  };
}
function JB(e) {
  return e < 0 ? -Math.sqrt(-e) : Math.sqrt(e);
}
function QB(e) {
  return e < 0 ? -e * e : e * e;
}
function O2(e) {
  var t = e(Dn, Dn), n = 1;
  function i() {
    return n === 1 ? e(Dn, Dn) : n === 0.5 ? e(JB, QB) : e(jO(n), jO(1 / n));
  }
  return t.exponent = function(r) {
    return arguments.length ? (n = +r, i()) : n;
  }, Hs(t);
}
function S2() {
  var e = O2(fp());
  return e.copy = function() {
    return Hf(e, S2()).exponent(e.exponent());
  }, Sr.apply(e, arguments), e;
}
function ZB() {
  return S2.apply(null, arguments).exponent(0.5);
}
function RM() {
  var e = [], t = [], n = [], i;
  function r() {
    var a = 0, s = Math.max(1, t.length);
    for (n = new Array(s - 1); ++a < s; )
      n[a - 1] = zD(e, a / s);
    return o;
  }
  function o(a) {
    return a == null || isNaN(a = +a) ? i : t[Bf(n, a)];
  }
  return o.invertExtent = function(a) {
    var s = t.indexOf(a);
    return s < 0 ? [NaN, NaN] : [
      s > 0 ? n[s - 1] : e[0],
      s < n.length ? n[s] : e[e.length - 1]
    ];
  }, o.domain = function(a) {
    if (!arguments.length)
      return e.slice();
    e = [];
    for (let s of a)
      s != null && !isNaN(s = +s) && e.push(s);
    return e.sort(io), r();
  }, o.range = function(a) {
    return arguments.length ? (t = Array.from(a), r()) : t.slice();
  }, o.unknown = function(a) {
    return arguments.length ? (i = a, o) : i;
  }, o.quantiles = function() {
    return n.slice();
  }, o.copy = function() {
    return RM().domain(e).range(t).unknown(i);
  }, Sr.apply(o, arguments);
}
function jM() {
  var e = 0, t = 1, n = 1, i = [0.5], r = [0, 1], o;
  function a(u) {
    return u != null && u <= u ? r[Bf(i, u, 0, n)] : o;
  }
  function s() {
    var u = -1;
    for (i = new Array(n); ++u < n; )
      i[u] = ((u + 1) * t - (u - n) * e) / (n + 1);
    return a;
  }
  return a.domain = function(u) {
    return arguments.length ? ([e, t] = u, e = +e, t = +t, s()) : [e, t];
  }, a.range = function(u) {
    return arguments.length ? (n = (r = Array.from(u)).length - 1, s()) : r.slice();
  }, a.invertExtent = function(u) {
    var l = r.indexOf(u);
    return l < 0 ? [NaN, NaN] : l < 1 ? [e, i[0]] : l >= n ? [i[n - 1], t] : [i[l - 1], i[l]];
  }, a.unknown = function(u) {
    return arguments.length && (o = u), a;
  }, a.thresholds = function() {
    return i.slice();
  }, a.copy = function() {
    return jM().domain([e, t]).range(r).unknown(o);
  }, Sr.apply(Hs(a), arguments);
}
function PM() {
  var e = [0.5], t = [0, 1], n, i = 1;
  function r(o) {
    return o != null && o <= o ? t[Bf(e, o, 0, i)] : n;
  }
  return r.domain = function(o) {
    return arguments.length ? (e = Array.from(o), i = Math.min(e.length, t.length - 1), r) : e.slice();
  }, r.range = function(o) {
    return arguments.length ? (t = Array.from(o), i = Math.min(e.length, t.length - 1), r) : t.slice();
  }, r.invertExtent = function(o) {
    var a = t.indexOf(o);
    return [e[a - 1], e[a]];
  }, r.unknown = function(o) {
    return arguments.length ? (n = o, r) : n;
  }, r.copy = function() {
    return PM().domain(e).range(t).unknown(n);
  }, Sr.apply(r, arguments);
}
function ez(e) {
  return new Date(e);
}
function tz(e) {
  return e instanceof Date ? +e : +new Date(+e);
}
function C2(e, t, n, i, r, o, a, s, u, l) {
  var c = FM(), f = c.invert, d = c.domain, h = l(".%L"), g = l(":%S"), p = l("%I:%M"), m = l("%I %p"), y = l("%a %d"), v = l("%b %d"), b = l("%B"), x = l("%Y");
  function E(A) {
    return (u(A) < A ? h : s(A) < A ? g : a(A) < A ? p : o(A) < A ? m : i(A) < A ? r(A) < A ? y : v : n(A) < A ? b : x)(A);
  }
  return c.invert = function(A) {
    return new Date(f(A));
  }, c.domain = function(A) {
    return arguments.length ? d(Array.from(A, tz)) : d().map(ez);
  }, c.ticks = function(A) {
    var w = d();
    return e(w[0], w[w.length - 1], A == null ? 10 : A);
  }, c.tickFormat = function(A, w) {
    return w == null ? E : l(w);
  }, c.nice = function(A) {
    var w = d();
    return (!A || typeof A.range != "function") && (A = t(w[0], w[w.length - 1], A == null ? 10 : A)), A ? d(MM(w, A)) : c;
  }, c.copy = function() {
    return Hf(c, C2(e, t, n, i, r, o, a, s, u, l));
  }, c;
}
function nz() {
  return Sr.apply(C2(l7, c7, ra, sg, xl, Ko, ux, sx, Bo, mx).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments);
}
function iz() {
  return Sr.apply(C2(s7, u7, oa, lg, wl, Jo, fx, cx, Bo, yx).domain([Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2)]), arguments);
}
function dp() {
  var e = 0, t = 1, n, i, r, o, a = Dn, s = !1, u;
  function l(f) {
    return f == null || isNaN(f = +f) ? u : a(r === 0 ? 0.5 : (f = (o(f) - n) * r, s ? Math.max(0, Math.min(1, f)) : f));
  }
  l.domain = function(f) {
    return arguments.length ? ([e, t] = f, n = o(e = +e), i = o(t = +t), r = n === i ? 0 : 1 / (i - n), l) : [e, t];
  }, l.clamp = function(f) {
    return arguments.length ? (s = !!f, l) : s;
  }, l.interpolator = function(f) {
    return arguments.length ? (a = f, l) : a;
  };
  function c(f) {
    return function(d) {
      var h, g;
      return arguments.length ? ([h, g] = d, a = f(h, g), l) : [a(0), a(1)];
    };
  }
  return l.range = c(Aa), l.rangeRound = c(Gf), l.unknown = function(f) {
    return arguments.length ? (u = f, l) : u;
  }, function(f) {
    return o = f, n = f(e), i = f(t), r = n === i ? 0 : 1 / (i - n), l;
  };
}
function _a(e, t) {
  return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown());
}
function F2() {
  var e = Hs(dp()(Dn));
  return e.copy = function() {
    return _a(e, F2());
  }, wa.apply(e, arguments);
}
function LM() {
  var e = A2(dp()).domain([1, 10]);
  return e.copy = function() {
    return _a(e, LM()).base(e.base());
  }, wa.apply(e, arguments);
}
function IM() {
  var e = _2(dp());
  return e.copy = function() {
    return _a(e, IM()).constant(e.constant());
  }, wa.apply(e, arguments);
}
function k2() {
  var e = O2(dp());
  return e.copy = function() {
    return _a(e, k2()).exponent(e.exponent());
  }, wa.apply(e, arguments);
}
function rz() {
  return k2.apply(null, arguments).exponent(0.5);
}
function hp() {
  var e = 0, t = 0.5, n = 1, i = 1, r, o, a, s, u, l = Dn, c, f = !1, d;
  function h(p) {
    return isNaN(p = +p) ? d : (p = 0.5 + ((p = +c(p)) - o) * (i * p < i * o ? s : u), l(f ? Math.max(0, Math.min(1, p)) : p));
  }
  h.domain = function(p) {
    return arguments.length ? ([e, t, n] = p, r = c(e = +e), o = c(t = +t), a = c(n = +n), s = r === o ? 0 : 0.5 / (o - r), u = o === a ? 0 : 0.5 / (a - o), i = o < r ? -1 : 1, h) : [e, t, n];
  }, h.clamp = function(p) {
    return arguments.length ? (f = !!p, h) : f;
  }, h.interpolator = function(p) {
    return arguments.length ? (l = p, h) : l;
  };
  function g(p) {
    return function(m) {
      var y, v, b;
      return arguments.length ? ([y, v, b] = m, l = E2(p, [y, v, b]), h) : [l(0), l(0.5), l(1)];
    };
  }
  return h.range = g(Aa), h.rangeRound = g(Gf), h.unknown = function(p) {
    return arguments.length ? (d = p, h) : d;
  }, function(p) {
    return c = p, r = p(e), o = p(t), a = p(n), s = r === o ? 0 : 0.5 / (o - r), u = o === a ? 0 : 0.5 / (a - o), i = o < r ? -1 : 1, h;
  };
}
function BM() {
  var e = Hs(hp()(Dn));
  return e.copy = function() {
    return _a(e, BM());
  }, wa.apply(e, arguments);
}
function zM() {
  var e = A2(hp()).domain([0.1, 1, 10]);
  return e.copy = function() {
    return _a(e, zM()).base(e.base());
  }, wa.apply(e, arguments);
}
function UM() {
  var e = _2(hp());
  return e.copy = function() {
    return _a(e, UM()).constant(e.constant());
  }, wa.apply(e, arguments);
}
function D2() {
  var e = O2(hp());
  return e.copy = function() {
    return _a(e, D2()).exponent(e.exponent());
  }, wa.apply(e, arguments);
}
function oz() {
  return D2.apply(null, arguments).exponent(0.5);
}
function $2(e, t, n) {
  const i = e - t + n * 2;
  return e ? i > 0 ? i : 1 : 0;
}
const az = "identity", Yu = "linear", fo = "log", Yf = "pow", Xf = "sqrt", gp = "symlog", As = "time", _s = "utc", gr = "sequential", Sl = "diverging", Xu = "quantile", pp = "quantize", mp = "threshold", M2 = "ordinal", tv = "point", qM = "band", T2 = "bin-ordinal", wt = "continuous", Vf = "discrete", Kf = "discretizing", vi = "interpolating", N2 = "temporal";
function sz(e) {
  return function(t) {
    let n = t[0], i = t[1], r;
    return i < n && (r = n, n = i, i = r), [e.invert(n), e.invert(i)];
  };
}
function uz(e) {
  return function(t) {
    const n = e.range();
    let i = t[0], r = t[1], o = -1, a, s, u, l;
    for (r < i && (s = i, i = r, r = s), u = 0, l = n.length; u < l; ++u)
      n[u] >= i && n[u] <= r && (o < 0 && (o = u), a = u);
    if (!(o < 0))
      return i = e.invertExtent(n[o]), r = e.invertExtent(n[a]), [i[0] === void 0 ? i[1] : i[0], r[1] === void 0 ? r[0] : r[1]];
  };
}
function R2() {
  const e = y2().unknown(void 0), t = e.domain, n = e.range;
  let i = [0, 1], r, o, a = !1, s = 0, u = 0, l = 0.5;
  delete e.unknown;
  function c() {
    const f = t().length, d = i[1] < i[0], h = i[1 - d], g = $2(f, s, u);
    let p = i[d - 0];
    r = (h - p) / (g || 1), a && (r = Math.floor(r)), p += (h - p - r * (f - s)) * l, o = r * (1 - s), a && (p = Math.round(p), o = Math.round(o));
    const m = Hn(f).map((y) => p + r * y);
    return n(d ? m.reverse() : m);
  }
  return e.domain = function(f) {
    return arguments.length ? (t(f), c()) : t();
  }, e.range = function(f) {
    return arguments.length ? (i = [+f[0], +f[1]], c()) : i.slice();
  }, e.rangeRound = function(f) {
    return i = [+f[0], +f[1]], a = !0, c();
  }, e.bandwidth = function() {
    return o;
  }, e.step = function() {
    return r;
  }, e.round = function(f) {
    return arguments.length ? (a = !!f, c()) : a;
  }, e.padding = function(f) {
    return arguments.length ? (u = Math.max(0, Math.min(1, f)), s = u, c()) : s;
  }, e.paddingInner = function(f) {
    return arguments.length ? (s = Math.max(0, Math.min(1, f)), c()) : s;
  }, e.paddingOuter = function(f) {
    return arguments.length ? (u = Math.max(0, Math.min(1, f)), c()) : u;
  }, e.align = function(f) {
    return arguments.length ? (l = Math.max(0, Math.min(1, f)), c()) : l;
  }, e.invertRange = function(f) {
    if (f[0] == null || f[1] == null)
      return;
    const d = i[1] < i[0], h = d ? n().reverse() : n(), g = h.length - 1;
    let p = +f[0], m = +f[1], y, v, b;
    if (!(p !== p || m !== m) && (m < p && (b = p, p = m, m = b), !(m < h[0] || p > i[1 - d])))
      return y = Math.max(0, ng(h, p) - 1), v = p === m ? y : ng(h, m) - 1, p - h[y] > o + 1e-10 && ++y, d && (b = y, y = g - v, v = g - b), y > v ? void 0 : t().slice(y, v + 1);
  }, e.invert = function(f) {
    const d = e.invertRange([f, f]);
    return d && d[0];
  }, e.copy = function() {
    return R2().domain(t()).range(i).round(a).paddingInner(s).paddingOuter(u).align(l);
  }, c();
}
function WM(e) {
  const t = e.copy;
  return e.padding = e.paddingOuter, delete e.paddingInner, e.copy = function() {
    return WM(t());
  }, e;
}
function lz() {
  return WM(R2().paddingInner(1));
}
var cz = Array.prototype.map;
function fz(e) {
  return cz.call(e, Wt);
}
const dz = Array.prototype.slice;
function GM() {
  let e = [], t = [];
  function n(i) {
    return i == null || i !== i ? void 0 : t[(Bf(e, i) - 1) % t.length];
  }
  return n.domain = function(i) {
    return arguments.length ? (e = fz(i), n) : e.slice();
  }, n.range = function(i) {
    return arguments.length ? (t = dz.call(i), n) : t.slice();
  }, n.tickFormat = function(i, r) {
    return kM(e[0], xe(e), i == null ? 10 : i, r);
  }, n.copy = function() {
    return GM().domain(n.domain()).range(n.range());
  }, n;
}
const wg = {};
function hz(e, t, n) {
  const i = function() {
    const o = t();
    return o.invertRange || (o.invertRange = o.invert ? sz(o) : o.invertExtent ? uz(o) : void 0), o.type = e, o;
  };
  return i.metadata = zi(oe(n)), i;
}
function De(e, t, n) {
  return arguments.length > 1 ? (wg[e] = hz(e, t, n), this) : HM(e) ? wg[e] : void 0;
}
De(az, $M);
De(Yu, DM, wt);
De(fo, TM, [wt, fo]);
De(Yf, S2, wt);
De(Xf, ZB, wt);
De(gp, NM, wt);
De(As, nz, [wt, N2]);
De(_s, iz, [wt, N2]);
De(gr, F2, [wt, vi]);
De("".concat(gr, "-").concat(Yu), F2, [wt, vi]);
De("".concat(gr, "-").concat(fo), LM, [wt, vi, fo]);
De("".concat(gr, "-").concat(Yf), k2, [wt, vi]);
De("".concat(gr, "-").concat(Xf), rz, [wt, vi]);
De("".concat(gr, "-").concat(gp), IM, [wt, vi]);
De("".concat(Sl, "-").concat(Yu), BM, [wt, vi]);
De("".concat(Sl, "-").concat(fo), zM, [wt, vi, fo]);
De("".concat(Sl, "-").concat(Yf), D2, [wt, vi]);
De("".concat(Sl, "-").concat(Xf), oz, [wt, vi]);
De("".concat(Sl, "-").concat(gp), UM, [wt, vi]);
De(Xu, RM, [Kf, Xu]);
De(pp, jM, Kf);
De(mp, PM, Kf);
De(T2, GM, [Vf, Kf]);
De(M2, y2, Vf);
De(qM, R2, Vf);
De(tv, lz, Vf);
function HM(e) {
  return ae(wg, e);
}
function Ys(e, t) {
  const n = wg[e];
  return n && n.metadata[t];
}
function j2(e) {
  return Ys(e, wt);
}
function Vu(e) {
  return Ys(e, Vf);
}
function nv(e) {
  return Ys(e, Kf);
}
function YM(e) {
  return Ys(e, fo);
}
function gz(e) {
  return Ys(e, N2);
}
function XM(e) {
  return Ys(e, vi);
}
function VM(e) {
  return Ys(e, Xu);
}
const pz = ["clamp", "base", "constant", "exponent"];
function KM(e, t) {
  const n = t[0], i = xe(t) - n;
  return function(r) {
    return e(n + r * i);
  };
}
function yp(e, t, n) {
  return E2(P2(t || "rgb", n), e);
}
function JM(e, t) {
  const n = new Array(t), i = t + 1;
  for (let r = 0; r < t; )
    n[r] = e(++r / i);
  return n;
}
function QM(e, t, n) {
  const i = n - t;
  let r, o, a;
  return !i || !Number.isFinite(i) ? Zt(0.5) : (r = (o = e.type).indexOf("-"), o = r < 0 ? o : o.slice(r + 1), a = De(o)().domain([t, n]).range([0, 1]), pz.forEach((s) => e[s] ? a[s](e[s]()) : 0), a);
}
function P2(e, t) {
  const n = zB[mz(e)];
  return t != null && n && n.gamma ? n.gamma(t) : n;
}
function mz(e) {
  return "interpolate" + e.toLowerCase().split("-").map((t) => t[0].toUpperCase() + t.slice(1)).join("");
}
const yz = {
  blues: "cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",
  greens: "d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",
  greys: "e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",
  oranges: "fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",
  purples: "e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",
  reds: "fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",
  blueGreen: "d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",
  bluePurple: "ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",
  greenBlue: "d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",
  orangeRed: "fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",
  purpleBlue: "dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",
  purpleBlueGreen: "dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",
  purpleRed: "dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",
  redPurple: "fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",
  yellowGreen: "e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",
  yellowOrangeBrown: "feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",
  yellowOrangeRed: "fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",
  blueOrange: "134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",
  brownBlueGreen: "704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",
  purpleGreen: "5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",
  purpleOrange: "4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",
  redBlue: "8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",
  redGrey: "8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",
  yellowGreenBlue: "eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",
  redYellowBlue: "a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",
  redYellowGreen: "a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",
  pinkYellowGreen: "8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",
  spectral: "9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",
  viridis: "440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",
  magma: "0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",
  inferno: "0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",
  plasma: "0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",
  cividis: "00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",
  rainbow: "6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",
  sinebow: "ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",
  turbo: "23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",
  browns: "eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",
  tealBlues: "bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",
  teals: "bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",
  warmGreys: "dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",
  goldGreen: "f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",
  goldOrange: "f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",
  goldRed: "f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",
  lightGreyRed: "efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",
  lightGreyTeal: "e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",
  lightMulti: "e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",
  lightOrange: "f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",
  lightTealBlue: "e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",
  darkBlue: "3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",
  darkGold: "3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",
  darkGreen: "3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",
  darkMulti: "3737371f5287197d8c29a86995ce3fffe800ffffff",
  darkRed: "3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"
}, vz = {
  category10: "1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",
  category20: "1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",
  category20b: "393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",
  category20c: "3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",
  tableau10: "4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",
  tableau20: "4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",
  accent: "7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",
  dark2: "1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",
  paired: "a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",
  pastel1: "fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",
  pastel2: "b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",
  set1: "e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",
  set2: "66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",
  set3: "8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"
};
function ZM(e) {
  const t = e.length / 6 | 0, n = new Array(t);
  for (let i = 0; i < t; )
    n[i] = "#" + e.slice(i * 6, ++i * 6);
  return n;
}
function e5(e, t) {
  for (const n in e)
    L2(n, t(e[n]));
}
const PO = {};
e5(vz, ZM);
e5(yz, (e) => yp(ZM(e)));
function L2(e, t) {
  return e = e && e.toLowerCase(), arguments.length > 1 ? (PO[e] = t, this) : PO[e];
}
const Fh = "symbol", bz = "discrete", xz = "gradient", wz = (e) => J(e) ? e.map((t) => String(t)) : String(e), Ez = (e, t) => e[1] - t[1], Az = (e, t) => t[1] - e[1];
function I2(e, t, n) {
  let i;
  return na(t) && (e.bins && (t = Math.max(t, e.bins.length)), n != null && (t = Math.min(t, Math.floor(Lf(e.domain()) / n || 1)))), ce(t) && (i = t.step, t = t.interval), je(t) && (t = e.type === As ? El(t) : e.type == _s ? Al(t) : P("Only time and utc scales accept interval strings."), i && (t = t.every(i))), t;
}
function t5(e, t, n) {
  let i = e.range(), r = i[0], o = xe(i), a = Ez;
  if (r > o && (i = o, o = r, r = i, a = Az), r = Math.floor(r), o = Math.ceil(o), t = t.map((s) => [s, e(s)]).filter((s) => r <= s[1] && s[1] <= o).sort(a).map((s) => s[0]), n > 0 && t.length > 1) {
    const s = [t[0], xe(t)];
    for (; t.length > n && t.length >= 3; )
      t = t.filter((u, l) => !(l % 2));
    t.length < 3 && (t = s);
  }
  return t;
}
function B2(e, t) {
  return e.bins ? t5(e, e.bins) : e.ticks ? e.ticks(t) : e.domain();
}
function n5(e, t, n, i, r, o) {
  const a = t.type;
  let s = wz;
  if (a === As || r === As)
    s = e.timeFormat(i);
  else if (a === _s || r === _s)
    s = e.utcFormat(i);
  else if (YM(a)) {
    const u = e.formatFloat(i);
    if (o || t.bins)
      s = u;
    else {
      const l = i5(t, n, !1);
      s = (c) => l(c) ? u(c) : "";
    }
  } else if (t.tickFormat) {
    const u = t.domain();
    s = e.formatSpan(u[0], u[u.length - 1], n, i);
  } else
    i && (s = e.format(i));
  return s;
}
function i5(e, t, n) {
  const i = B2(e, t), r = e.base(), o = Math.log(r), a = Math.max(1, r * t / i.length), s = (u) => {
    let l = u / Math.pow(r, Math.round(Math.log(u) / o));
    return l * r < r - 0.5 && (l *= r), l <= a;
  };
  return n ? i.filter(s) : s;
}
const iv = {
  [Xu]: "quantiles",
  [pp]: "thresholds",
  [mp]: "domain"
}, r5 = {
  [Xu]: "quantiles",
  [pp]: "domain"
};
function o5(e, t) {
  return e.bins ? Sz(e.bins) : e.type === fo ? i5(e, t, !0) : iv[e.type] ? Oz(e[iv[e.type]]()) : B2(e, t);
}
function _z(e, t, n) {
  const i = t[r5[t.type]](), r = i.length;
  let o = r > 1 ? i[1] - i[0] : i[0], a;
  for (a = 1; a < r; ++a)
    o = Math.min(o, i[a] - i[a - 1]);
  return e.formatSpan(0, o, 3 * 10, n);
}
function Oz(e) {
  const t = [-1 / 0].concat(e);
  return t.max = 1 / 0, t;
}
function Sz(e) {
  const t = e.slice(0, -1);
  return t.max = xe(e), t;
}
const Cz = (e) => iv[e.type] || e.bins;
function a5(e, t, n, i, r, o, a) {
  const s = r5[t.type] && o !== As && o !== _s ? _z(e, t, r) : n5(e, t, n, r, o, a);
  return i === Fh && Cz(t) ? Fz(s) : i === bz ? kz(s) : Dz(s);
}
const Fz = (e) => (t, n, i) => {
  const r = LO(i[n + 1], LO(i.max, 1 / 0)), o = IO(t, e), a = IO(r, e);
  return o && a ? o + " \u2013 " + a : a ? "< " + a : "\u2265 " + o;
}, LO = (e, t) => e != null ? e : t, kz = (e) => (t, n) => n ? e(t) : null, Dz = (e) => (t) => e(t), IO = (e, t) => Number.isFinite(e) ? t(e) : null;
function $z(e) {
  const t = e.domain(), n = t.length - 1;
  let i = +t[0], r = +xe(t), o = r - i;
  if (e.type === mp) {
    const a = n ? o / n : 0.1;
    i -= a, r += a, o = r - i;
  }
  return (a) => (a - i) / o;
}
function Mz(e, t, n, i) {
  const r = i || t.type;
  return je(n) && gz(r) && (n = n.replace(/%a/g, "%A").replace(/%b/g, "%B")), !n && r === As ? e.timeFormat("%A, %d %B %Y, %X") : !n && r === _s ? e.utcFormat("%A, %d %B %Y, %X UTC") : a5(e, t, 5, null, n, i, !0);
}
function s5(e, t, n) {
  n = n || {};
  const i = Math.max(3, n.maxlen || 7), r = Mz(e, t, n.format, n.formatType);
  if (nv(t.type)) {
    const o = o5(t).slice(1).map(r), a = o.length;
    return "".concat(a, " boundar").concat(a === 1 ? "y" : "ies", ": ").concat(o.join(", "));
  } else if (Vu(t.type)) {
    const o = t.domain(), a = o.length, s = a > i ? o.slice(0, i - 2).map(r).join(", ") + ", ending with " + o.slice(-1).map(r) : o.map(r).join(", ");
    return "".concat(a, " value").concat(a === 1 ? "" : "s", ": ").concat(s);
  } else {
    const o = t.domain();
    return "values from ".concat(r(o[0]), " to ").concat(r(xe(o)));
  }
}
let u5 = 0;
function Tz() {
  u5 = 0;
}
const Eg = "p_";
function z2(e) {
  return e && e.gradient;
}
function l5(e, t, n) {
  const i = e.gradient;
  let r = e.id, o = i === "radial" ? Eg : "";
  return r || (r = e.id = "gradient_" + u5++, i === "radial" ? (e.x1 = er(e.x1, 0.5), e.y1 = er(e.y1, 0.5), e.r1 = er(e.r1, 0), e.x2 = er(e.x2, 0.5), e.y2 = er(e.y2, 0.5), e.r2 = er(e.r2, 0.5), o = Eg) : (e.x1 = er(e.x1, 0), e.y1 = er(e.y1, 0), e.x2 = er(e.x2, 1), e.y2 = er(e.y2, 0))), t[r] = e, "url(" + (n || "") + "#" + o + r + ")";
}
function er(e, t) {
  return e != null ? e : t;
}
function c5(e, t) {
  var n = [], i;
  return i = {
    gradient: "linear",
    x1: e ? e[0] : 0,
    y1: e ? e[1] : 0,
    x2: t ? t[0] : 1,
    y2: t ? t[1] : 0,
    stops: n,
    stop: function(r, o) {
      return n.push({
        offset: r,
        color: o
      }), i;
    }
  };
}
const BO = {
  basis: {
    curve: II
  },
  "basis-closed": {
    curve: BI
  },
  "basis-open": {
    curve: zI
  },
  bundle: {
    curve: UI,
    tension: "beta",
    value: 0.85
  },
  cardinal: {
    curve: qI,
    tension: "tension",
    value: 0
  },
  "cardinal-open": {
    curve: GI,
    tension: "tension",
    value: 0
  },
  "cardinal-closed": {
    curve: WI,
    tension: "tension",
    value: 0
  },
  "catmull-rom": {
    curve: HI,
    tension: "alpha",
    value: 0.5
  },
  "catmull-rom-closed": {
    curve: YI,
    tension: "alpha",
    value: 0.5
  },
  "catmull-rom-open": {
    curve: XI,
    tension: "alpha",
    value: 0.5
  },
  linear: {
    curve: d2
  },
  "linear-closed": {
    curve: VI
  },
  monotone: {
    horizontal: JI,
    vertical: KI
  },
  natural: {
    curve: QI
  },
  step: {
    curve: ZI
  },
  "step-after": {
    curve: tB
  },
  "step-before": {
    curve: eB
  }
};
function U2(e, t, n) {
  var i = ae(BO, e) && BO[e], r = null;
  return i && (r = i.curve || i[t || "vertical"], i.tension && n != null && (r = r[i.tension](n))), r;
}
const Nz = {
  m: 2,
  l: 2,
  h: 1,
  v: 1,
  z: 0,
  c: 6,
  s: 4,
  q: 4,
  t: 2,
  a: 7
}, Rz = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi, jz = /^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/, Pz = /^((\s+,?\s*)|(,\s*))/, Lz = /^[01]/;
function Ku(e) {
  const t = [];
  return (e.match(Rz) || []).forEach((i) => {
    let r = i[0];
    const o = r.toLowerCase(), a = Nz[o], s = Iz(o, a, i.slice(1).trim()), u = s.length;
    if (u < a || u && u % a !== 0)
      throw Error("Invalid SVG path, incorrect parameter count");
    if (t.push([r, ...s.slice(0, a)]), u !== a) {
      o === "m" && (r = r === "M" ? "L" : "l");
      for (let l = a; l < u; l += a)
        t.push([r, ...s.slice(l, l + a)]);
    }
  }), t;
}
function Iz(e, t, n) {
  const i = [];
  for (let r = 0; t && r < n.length; )
    for (let o = 0; o < t; ++o) {
      const a = e === "a" && (o === 3 || o === 4) ? Lz : jz, s = n.slice(r).match(a);
      if (s === null)
        throw Error("Invalid SVG path, incorrect parameter type");
      r += s[0].length, i.push(+s[0]);
      const u = n.slice(r).match(Pz);
      u !== null && (r += u[0].length);
    }
  return i;
}
const la = Math.PI / 180, Bz = 1e-14, Za = Math.PI / 2, or = Math.PI * 2, cu = Math.sqrt(3) / 2;
var h1 = {}, g1 = {}, f5 = [].join;
function zz(e, t, n, i, r, o, a, s, u) {
  const l = f5.call(arguments);
  if (h1[l])
    return h1[l];
  const c = a * la, f = Math.sin(c), d = Math.cos(c);
  n = Math.abs(n), i = Math.abs(i);
  const h = d * (s - e) * 0.5 + f * (u - t) * 0.5, g = d * (u - t) * 0.5 - f * (s - e) * 0.5;
  let p = h * h / (n * n) + g * g / (i * i);
  p > 1 && (p = Math.sqrt(p), n *= p, i *= p);
  const m = d / n, y = f / n, v = -f / i, b = d / i, x = m * s + y * u, E = v * s + b * u, A = m * e + y * t, w = v * e + b * t;
  let k = 1 / ((A - x) * (A - x) + (w - E) * (w - E)) - 0.25;
  k < 0 && (k = 0);
  let C = Math.sqrt(k);
  o == r && (C = -C);
  const O = 0.5 * (x + A) - C * (w - E), S = 0.5 * (E + w) + C * (A - x), D = Math.atan2(E - S, x - O);
  let F = Math.atan2(w - S, A - O) - D;
  F < 0 && o === 1 ? F += or : F > 0 && o === 0 && (F -= or);
  const $ = Math.ceil(Math.abs(F / (Za + 1e-3))), T = [];
  for (let L = 0; L < $; ++L) {
    const I = D + L * F / $, Y = D + (L + 1) * F / $;
    T[L] = [O, S, I, Y, n, i, f, d];
  }
  return h1[l] = T;
}
function Uz(e) {
  const t = f5.call(e);
  if (g1[t])
    return g1[t];
  var n = e[0], i = e[1], r = e[2], o = e[3], a = e[4], s = e[5], u = e[6], l = e[7];
  const c = l * a, f = -u * s, d = u * a, h = l * s, g = Math.cos(r), p = Math.sin(r), m = Math.cos(o), y = Math.sin(o), v = 0.5 * (o - r), b = Math.sin(v * 0.5), x = 8 / 3 * b * b / Math.sin(v), E = n + g - x * p, A = i + p + x * g, w = n + m, _ = i + y, k = w + x * y, C = _ - x * m;
  return g1[t] = [c * E + f * A, d * E + h * A, c * k + f * C, d * k + h * C, c * w + f * _, d * w + h * _];
}
const ni = ["l", 0, 0, 0, 0, 0, 0, 0];
function qz(e, t, n) {
  const i = ni[0] = e[0];
  if (i === "a" || i === "A")
    ni[1] = t * e[1], ni[2] = n * e[2], ni[3] = e[3], ni[4] = e[4], ni[5] = e[5], ni[6] = t * e[6], ni[7] = n * e[7];
  else if (i === "h" || i === "H")
    ni[1] = t * e[1];
  else if (i === "v" || i === "V")
    ni[1] = n * e[1];
  else
    for (var r = 1, o = e.length; r < o; ++r)
      ni[r] = (r % 2 == 1 ? t : n) * e[r];
  return ni;
}
function lf(e, t, n, i, r, o) {
  var a, s = null, u = 0, l = 0, c = 0, f = 0, d, h, g, p, m = 0, y = 0;
  n == null && (n = 0), i == null && (i = 0), r == null && (r = 1), o == null && (o = r), e.beginPath && e.beginPath();
  for (var v = 0, b = t.length; v < b; ++v) {
    switch (a = t[v], (r !== 1 || o !== 1) && (a = qz(a, r, o)), a[0]) {
      case "l":
        u += a[1], l += a[2], e.lineTo(u + n, l + i);
        break;
      case "L":
        u = a[1], l = a[2], e.lineTo(u + n, l + i);
        break;
      case "h":
        u += a[1], e.lineTo(u + n, l + i);
        break;
      case "H":
        u = a[1], e.lineTo(u + n, l + i);
        break;
      case "v":
        l += a[1], e.lineTo(u + n, l + i);
        break;
      case "V":
        l = a[1], e.lineTo(u + n, l + i);
        break;
      case "m":
        u += a[1], l += a[2], m = u, y = l, e.moveTo(u + n, l + i);
        break;
      case "M":
        u = a[1], l = a[2], m = u, y = l, e.moveTo(u + n, l + i);
        break;
      case "c":
        d = u + a[5], h = l + a[6], c = u + a[3], f = l + a[4], e.bezierCurveTo(
          u + a[1] + n,
          l + a[2] + i,
          c + n,
          f + i,
          d + n,
          h + i
        ), u = d, l = h;
        break;
      case "C":
        u = a[5], l = a[6], c = a[3], f = a[4], e.bezierCurveTo(a[1] + n, a[2] + i, c + n, f + i, u + n, l + i);
        break;
      case "s":
        d = u + a[3], h = l + a[4], c = 2 * u - c, f = 2 * l - f, e.bezierCurveTo(c + n, f + i, u + a[1] + n, l + a[2] + i, d + n, h + i), c = u + a[1], f = l + a[2], u = d, l = h;
        break;
      case "S":
        d = a[3], h = a[4], c = 2 * u - c, f = 2 * l - f, e.bezierCurveTo(c + n, f + i, a[1] + n, a[2] + i, d + n, h + i), u = d, l = h, c = a[1], f = a[2];
        break;
      case "q":
        d = u + a[3], h = l + a[4], c = u + a[1], f = l + a[2], e.quadraticCurveTo(c + n, f + i, d + n, h + i), u = d, l = h;
        break;
      case "Q":
        d = a[3], h = a[4], e.quadraticCurveTo(a[1] + n, a[2] + i, d + n, h + i), u = d, l = h, c = a[1], f = a[2];
        break;
      case "t":
        d = u + a[1], h = l + a[2], s[0].match(/[QqTt]/) === null ? (c = u, f = l) : s[0] === "t" ? (c = 2 * u - g, f = 2 * l - p) : s[0] === "q" && (c = 2 * u - c, f = 2 * l - f), g = c, p = f, e.quadraticCurveTo(c + n, f + i, d + n, h + i), u = d, l = h, c = u + a[1], f = l + a[2];
        break;
      case "T":
        d = a[1], h = a[2], c = 2 * u - c, f = 2 * l - f, e.quadraticCurveTo(c + n, f + i, d + n, h + i), u = d, l = h;
        break;
      case "a":
        zO(e, u + n, l + i, [a[1], a[2], a[3], a[4], a[5], a[6] + u + n, a[7] + l + i]), u += a[6], l += a[7];
        break;
      case "A":
        zO(e, u + n, l + i, [a[1], a[2], a[3], a[4], a[5], a[6] + n, a[7] + i]), u = a[6], l = a[7];
        break;
      case "z":
      case "Z":
        u = m, l = y, e.closePath();
        break;
    }
    s = a;
  }
}
function zO(e, t, n, i) {
  const r = zz(
    i[5],
    i[6],
    i[0],
    i[1],
    i[3],
    i[4],
    i[2],
    t,
    n
  );
  for (let o = 0; o < r.length; ++o) {
    const a = Uz(r[o]);
    e.bezierCurveTo(a[0], a[1], a[2], a[3], a[4], a[5]);
  }
}
const UO = 0.5773502691896257, qO = {
  circle: {
    draw: function(e, t) {
      const n = Math.sqrt(t) / 2;
      e.moveTo(n, 0), e.arc(0, 0, n, 0, or);
    }
  },
  cross: {
    draw: function(e, t) {
      var n = Math.sqrt(t) / 2, i = n / 2.5;
      e.moveTo(-n, -i), e.lineTo(-n, i), e.lineTo(-i, i), e.lineTo(-i, n), e.lineTo(i, n), e.lineTo(i, i), e.lineTo(n, i), e.lineTo(n, -i), e.lineTo(i, -i), e.lineTo(i, -n), e.lineTo(-i, -n), e.lineTo(-i, -i), e.closePath();
    }
  },
  diamond: {
    draw: function(e, t) {
      const n = Math.sqrt(t) / 2;
      e.moveTo(-n, 0), e.lineTo(0, -n), e.lineTo(n, 0), e.lineTo(0, n), e.closePath();
    }
  },
  square: {
    draw: function(e, t) {
      var n = Math.sqrt(t), i = -n / 2;
      e.rect(i, i, n, n);
    }
  },
  arrow: {
    draw: function(e, t) {
      var n = Math.sqrt(t) / 2, i = n / 7, r = n / 2.5, o = n / 8;
      e.moveTo(-i, n), e.lineTo(i, n), e.lineTo(i, -o), e.lineTo(r, -o), e.lineTo(0, -n), e.lineTo(-r, -o), e.lineTo(-i, -o), e.closePath();
    }
  },
  wedge: {
    draw: function(e, t) {
      var n = Math.sqrt(t) / 2, i = cu * n, r = i - n * UO, o = n / 4;
      e.moveTo(0, -i - r), e.lineTo(-o, i - r), e.lineTo(o, i - r), e.closePath();
    }
  },
  triangle: {
    draw: function(e, t) {
      var n = Math.sqrt(t) / 2, i = cu * n, r = i - n * UO;
      e.moveTo(0, -i - r), e.lineTo(-n, i - r), e.lineTo(n, i - r), e.closePath();
    }
  },
  "triangle-up": {
    draw: function(e, t) {
      var n = Math.sqrt(t) / 2, i = cu * n;
      e.moveTo(0, -i), e.lineTo(-n, i), e.lineTo(n, i), e.closePath();
    }
  },
  "triangle-down": {
    draw: function(e, t) {
      var n = Math.sqrt(t) / 2, i = cu * n;
      e.moveTo(0, i), e.lineTo(-n, -i), e.lineTo(n, -i), e.closePath();
    }
  },
  "triangle-right": {
    draw: function(e, t) {
      var n = Math.sqrt(t) / 2, i = cu * n;
      e.moveTo(i, 0), e.lineTo(-i, -n), e.lineTo(-i, n), e.closePath();
    }
  },
  "triangle-left": {
    draw: function(e, t) {
      var n = Math.sqrt(t) / 2, i = cu * n;
      e.moveTo(-i, 0), e.lineTo(i, -n), e.lineTo(i, n), e.closePath();
    }
  },
  stroke: {
    draw: function(e, t) {
      const n = Math.sqrt(t) / 2;
      e.moveTo(-n, 0), e.lineTo(n, 0);
    }
  }
};
function d5(e) {
  return ae(qO, e) ? qO[e] : Wz(e);
}
var p1 = {};
function Wz(e) {
  if (!ae(p1, e)) {
    const t = Ku(e);
    p1[e] = {
      draw: function(n, i) {
        lf(n, t, 0, 0, Math.sqrt(i) / 2);
      }
    };
  }
  return p1[e];
}
const Co = 0.448084975506;
function Gz(e) {
  return e.x;
}
function Hz(e) {
  return e.y;
}
function Yz(e) {
  return e.width;
}
function Xz(e) {
  return e.height;
}
function Br(e) {
  return typeof e == "function" ? e : () => +e;
}
function Wd(e, t, n) {
  return Math.max(t, Math.min(e, n));
}
function h5() {
  var e = Gz, t = Hz, n = Yz, i = Xz, r = Br(0), o = r, a = r, s = r, u = null;
  function l(c, f, d) {
    var h, g = f != null ? f : +e.call(this, c), p = d != null ? d : +t.call(this, c), m = +n.call(this, c), y = +i.call(this, c), v = Math.min(m, y) / 2, b = Wd(+r.call(this, c), 0, v), x = Wd(+o.call(this, c), 0, v), E = Wd(+a.call(this, c), 0, v), A = Wd(+s.call(this, c), 0, v);
    if (u || (u = h = xa()), b <= 0 && x <= 0 && E <= 0 && A <= 0)
      u.rect(g, p, m, y);
    else {
      var w = g + m, _ = p + y;
      u.moveTo(g + b, p), u.lineTo(w - x, p), u.bezierCurveTo(w - Co * x, p, w, p + Co * x, w, p + x), u.lineTo(w, _ - A), u.bezierCurveTo(w, _ - Co * A, w - Co * A, _, w - A, _), u.lineTo(g + E, _), u.bezierCurveTo(g + Co * E, _, g, _ - Co * E, g, _ - E), u.lineTo(g, p + b), u.bezierCurveTo(g, p + Co * b, g + Co * b, p, g + b, p), u.closePath();
    }
    if (h)
      return u = null, h + "" || null;
  }
  return l.x = function(c) {
    return arguments.length ? (e = Br(c), l) : e;
  }, l.y = function(c) {
    return arguments.length ? (t = Br(c), l) : t;
  }, l.width = function(c) {
    return arguments.length ? (n = Br(c), l) : n;
  }, l.height = function(c) {
    return arguments.length ? (i = Br(c), l) : i;
  }, l.cornerRadius = function(c, f, d, h) {
    return arguments.length ? (r = Br(c), o = f != null ? Br(f) : r, s = d != null ? Br(d) : r, a = h != null ? Br(h) : o, l) : r;
  }, l.context = function(c) {
    return arguments.length ? (u = c == null ? null : c, l) : u;
  }, l;
}
function g5() {
  var e, t, n, i, r = null, o, a, s, u;
  function l(f, d, h) {
    const g = h / 2;
    if (o) {
      var p = s - d, m = f - a;
      if (p || m) {
        var y = Math.sqrt(p * p + m * m), v = (p /= y) * u, b = (m /= y) * u, x = Math.atan2(m, p);
        r.moveTo(a - v, s - b), r.lineTo(f - p * g, d - m * g), r.arc(f, d, g, x - Math.PI, x), r.lineTo(a + v, s + b), r.arc(a, s, u, x, x + Math.PI);
      } else
        r.arc(f, d, g, 0, or);
      r.closePath();
    } else
      o = 1;
    a = f, s = d, u = g;
  }
  function c(f) {
    var d, h = f.length, g, p = !1, m;
    for (r == null && (r = m = xa()), d = 0; d <= h; ++d)
      !(d < h && i(g = f[d], d, f)) === p && (p = !p) && (o = 0), p && l(+e(g, d, f), +t(g, d, f), +n(g, d, f));
    if (m)
      return r = null, m + "" || null;
  }
  return c.x = function(f) {
    return arguments.length ? (e = f, c) : e;
  }, c.y = function(f) {
    return arguments.length ? (t = f, c) : t;
  }, c.size = function(f) {
    return arguments.length ? (n = f, c) : n;
  }, c.defined = function(f) {
    return arguments.length ? (i = f, c) : i;
  }, c.context = function(f) {
    return arguments.length ? (f == null ? r = null : r = f, c) : r;
  }, c;
}
function Jf(e, t) {
  return e != null ? e : t;
}
const Qf = (e) => e.x || 0, Zf = (e) => e.y || 0, Vz = (e) => e.width || 0, Kz = (e) => e.height || 0, Jz = (e) => (e.x || 0) + (e.width || 0), Qz = (e) => (e.y || 0) + (e.height || 0), Zz = (e) => e.startAngle || 0, eU = (e) => e.endAngle || 0, tU = (e) => e.padAngle || 0, nU = (e) => e.innerRadius || 0, iU = (e) => e.outerRadius || 0, rU = (e) => e.cornerRadius || 0, oU = (e) => Jf(e.cornerRadiusTopLeft, e.cornerRadius) || 0, aU = (e) => Jf(e.cornerRadiusTopRight, e.cornerRadius) || 0, sU = (e) => Jf(e.cornerRadiusBottomRight, e.cornerRadius) || 0, uU = (e) => Jf(e.cornerRadiusBottomLeft, e.cornerRadius) || 0, lU = (e) => Jf(e.size, 64), cU = (e) => e.size || 1, vp = (e) => e.defined !== !1, fU = (e) => d5(e.shape || "circle"), dU = jI().startAngle(Zz).endAngle(eU).padAngle(tU).innerRadius(nU).outerRadius(iU).cornerRadius(rU), hU = G$().x(Qf).y1(Zf).y0(Qz).defined(vp), gU = G$().y(Zf).x1(Qf).x0(Jz).defined(vp), pU = W$().x(Qf).y(Zf).defined(vp), mU = h5().x(Qf).y(Zf).width(Vz).height(Kz).cornerRadius(oU, aU, sU, uU), yU = LI().type(fU).size(lU), vU = g5().x(Qf).y(Zf).defined(vp).size(cU);
function q2(e) {
  return e.cornerRadius || e.cornerRadiusTopLeft || e.cornerRadiusTopRight || e.cornerRadiusBottomRight || e.cornerRadiusBottomLeft;
}
function bU(e, t) {
  return dU.context(e)(t);
}
function xU(e, t) {
  const n = t[0], i = n.interpolate || "linear";
  return (n.orient === "horizontal" ? gU : hU).curve(U2(i, n.orient, n.tension)).context(e)(t);
}
function wU(e, t) {
  const n = t[0], i = n.interpolate || "linear";
  return pU.curve(U2(i, n.orient, n.tension)).context(e)(t);
}
function Cl(e, t, n, i) {
  return mU.context(e)(t, n, i);
}
function EU(e, t) {
  return (t.mark.shape || t.shape).context(e)(t);
}
function AU(e, t) {
  return yU.context(e)(t);
}
function _U(e, t) {
  return vU.context(e)(t);
}
var p5 = 1;
function m5() {
  p5 = 1;
}
function W2(e, t, n) {
  var i = t.clip, r = e._defs, o = t.clip_id || (t.clip_id = "clip" + p5++), a = r.clipping[o] || (r.clipping[o] = {
    id: o
  });
  return he(i) ? a.path = i(null) : q2(n) ? a.path = Cl(null, n, 0, 0) : (a.width = n.width || 0, a.height = n.height || 0), "url(#" + o + ")";
}
function dt(e) {
  this.clear(), e && this.union(e);
}
dt.prototype = {
  clone() {
    return new dt(this);
  },
  clear() {
    return this.x1 = +Number.MAX_VALUE, this.y1 = +Number.MAX_VALUE, this.x2 = -Number.MAX_VALUE, this.y2 = -Number.MAX_VALUE, this;
  },
  empty() {
    return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;
  },
  equals(e) {
    return this.x1 === e.x1 && this.y1 === e.y1 && this.x2 === e.x2 && this.y2 === e.y2;
  },
  set(e, t, n, i) {
    return n < e ? (this.x2 = e, this.x1 = n) : (this.x1 = e, this.x2 = n), i < t ? (this.y2 = t, this.y1 = i) : (this.y1 = t, this.y2 = i), this;
  },
  add(e, t) {
    return e < this.x1 && (this.x1 = e), t < this.y1 && (this.y1 = t), e > this.x2 && (this.x2 = e), t > this.y2 && (this.y2 = t), this;
  },
  expand(e) {
    return this.x1 -= e, this.y1 -= e, this.x2 += e, this.y2 += e, this;
  },
  round() {
    return this.x1 = Math.floor(this.x1), this.y1 = Math.floor(this.y1), this.x2 = Math.ceil(this.x2), this.y2 = Math.ceil(this.y2), this;
  },
  scale(e) {
    return this.x1 *= e, this.y1 *= e, this.x2 *= e, this.y2 *= e, this;
  },
  translate(e, t) {
    return this.x1 += e, this.x2 += e, this.y1 += t, this.y2 += t, this;
  },
  rotate(e, t, n) {
    const i = this.rotatedPoints(e, t, n);
    return this.clear().add(i[0], i[1]).add(i[2], i[3]).add(i[4], i[5]).add(i[6], i[7]);
  },
  rotatedPoints(e, t, n) {
    var {
      x1: i,
      y1: r,
      x2: o,
      y2: a
    } = this, s = Math.cos(e), u = Math.sin(e), l = t - t * s + n * u, c = n - t * u - n * s;
    return [s * i - u * r + l, u * i + s * r + c, s * i - u * a + l, u * i + s * a + c, s * o - u * r + l, u * o + s * r + c, s * o - u * a + l, u * o + s * a + c];
  },
  union(e) {
    return e.x1 < this.x1 && (this.x1 = e.x1), e.y1 < this.y1 && (this.y1 = e.y1), e.x2 > this.x2 && (this.x2 = e.x2), e.y2 > this.y2 && (this.y2 = e.y2), this;
  },
  intersect(e) {
    return e.x1 > this.x1 && (this.x1 = e.x1), e.y1 > this.y1 && (this.y1 = e.y1), e.x2 < this.x2 && (this.x2 = e.x2), e.y2 < this.y2 && (this.y2 = e.y2), this;
  },
  encloses(e) {
    return e && this.x1 <= e.x1 && this.x2 >= e.x2 && this.y1 <= e.y1 && this.y2 >= e.y2;
  },
  alignsWith(e) {
    return e && (this.x1 == e.x1 || this.x2 == e.x2 || this.y1 == e.y1 || this.y2 == e.y2);
  },
  intersects(e) {
    return e && !(this.x2 < e.x1 || this.x1 > e.x2 || this.y2 < e.y1 || this.y1 > e.y2);
  },
  contains(e, t) {
    return !(e < this.x1 || e > this.x2 || t < this.y1 || t > this.y2);
  },
  width() {
    return this.x2 - this.x1;
  },
  height() {
    return this.y2 - this.y1;
  }
};
function bp(e) {
  this.mark = e, this.bounds = this.bounds || new dt();
}
function xp(e) {
  bp.call(this, e), this.items = this.items || [];
}
q(xp, bp);
function G2(e) {
  this._pending = 0, this._loader = e || X0();
}
function WO(e) {
  e._pending += 1;
}
function Zl(e) {
  e._pending -= 1;
}
G2.prototype = {
  pending() {
    return this._pending;
  },
  sanitizeURL(e) {
    const t = this;
    return WO(t), t._loader.sanitize(e, {
      context: "href"
    }).then((n) => (Zl(t), n)).catch(() => (Zl(t), null));
  },
  loadImage(e) {
    const t = this, n = nB();
    return WO(t), t._loader.sanitize(e, {
      context: "image"
    }).then((i) => {
      const r = i.href;
      if (!r || !n)
        throw {
          url: r
        };
      const o = new n(), a = ae(i, "crossOrigin") ? i.crossOrigin : "anonymous";
      return a != null && (o.crossOrigin = a), o.onload = () => Zl(t), o.onerror = () => Zl(t), o.src = r, o;
    }).catch((i) => (Zl(t), {
      complete: !1,
      width: 0,
      height: 0,
      src: i && i.url || ""
    }));
  },
  ready() {
    const e = this;
    return new Promise((t) => {
      function n(i) {
        e.pending() ? setTimeout(() => {
          n(!0);
        }, 10) : t(i);
      }
      n(!1);
    });
  }
};
function yo(e, t, n) {
  if (t.stroke && t.opacity !== 0 && t.strokeOpacity !== 0) {
    const i = t.strokeWidth != null ? +t.strokeWidth : 1;
    e.expand(i + (n ? OU(t, i) : 0));
  }
  return e;
}
function OU(e, t) {
  return e.strokeJoin && e.strokeJoin !== "miter" ? 0 : t;
}
const SU = or - 1e-8;
let wp, kh, Dh, as, rv, $h, ov, av;
const zo = (e, t) => wp.add(e, t), Mh = (e, t) => zo(kh = e, Dh = t), GO = (e) => zo(e, wp.y1), HO = (e) => zo(wp.x1, e), es = (e, t) => rv * e + ov * t, ts = (e, t) => $h * e + av * t, m1 = (e, t) => zo(es(e, t), ts(e, t)), y1 = (e, t) => Mh(es(e, t), ts(e, t));
function ed(e, t) {
  return wp = e, t ? (as = t * la, rv = av = Math.cos(as), $h = Math.sin(as), ov = -$h) : (rv = av = 1, as = $h = ov = 0), CU;
}
const CU = {
  beginPath() {
  },
  closePath() {
  },
  moveTo: y1,
  lineTo: y1,
  rect(e, t, n, i) {
    as ? (m1(e + n, t), m1(e + n, t + i), m1(e, t + i), y1(e, t)) : (zo(e + n, t + i), Mh(e, t));
  },
  quadraticCurveTo(e, t, n, i) {
    const r = es(e, t), o = ts(e, t), a = es(n, i), s = ts(n, i);
    YO(kh, r, a, GO), YO(Dh, o, s, HO), Mh(a, s);
  },
  bezierCurveTo(e, t, n, i, r, o) {
    const a = es(e, t), s = ts(e, t), u = es(n, i), l = ts(n, i), c = es(r, o), f = ts(r, o);
    XO(kh, a, u, c, GO), XO(Dh, s, l, f, HO), Mh(c, f);
  },
  arc(e, t, n, i, r, o) {
    if (i += as, r += as, kh = n * Math.cos(r) + e, Dh = n * Math.sin(r) + t, Math.abs(r - i) > SU)
      zo(e - n, t - n), zo(e + n, t + n);
    else {
      const a = (l) => zo(n * Math.cos(l) + e, n * Math.sin(l) + t);
      let s, u;
      if (a(i), a(r), r !== i)
        if (i = i % or, i < 0 && (i += or), r = r % or, r < 0 && (r += or), r < i && (o = !o, s = i, i = r, r = s), o)
          for (r -= or, s = i - i % Za, u = 0; u < 4 && s > r; ++u, s -= Za)
            a(s);
        else
          for (s = i - i % Za + Za, u = 0; u < 4 && s < r; ++u, s = s + Za)
            a(s);
    }
  }
};
function YO(e, t, n, i) {
  const r = (e - t) / (e + n - 2 * t);
  0 < r && r < 1 && i(e + (t - e) * r);
}
function XO(e, t, n, i, r) {
  const o = i - e + 3 * t - 3 * n, a = e + n - 2 * t, s = e - t;
  let u = 0, l = 0, c;
  Math.abs(o) > Bz ? (c = a * a + s * o, c >= 0 && (c = Math.sqrt(c), u = (-a + c) / o, l = (-a - c) / o)) : u = 0.5 * s / a, 0 < u && u < 1 && r(VO(u, e, t, n, i)), 0 < l && l < 1 && r(VO(l, e, t, n, i));
}
function VO(e, t, n, i, r) {
  const o = 1 - e, a = o * o, s = e * e;
  return a * o * t + 3 * a * e * n + 3 * o * s * i + s * e * r;
}
var ea = (ea = Zo(1, 1)) ? ea.getContext("2d") : null;
const sv = new dt();
function H2(e) {
  return function(t, n) {
    if (!ea)
      return !0;
    e(ea, t), sv.clear().union(t.bounds).intersect(n).round();
    const {
      x1: i,
      y1: r,
      x2: o,
      y2: a
    } = sv;
    for (let s = r; s <= a; ++s)
      for (let u = i; u <= o; ++u)
        if (ea.isPointInPath(u, s))
          return !0;
    return !1;
  };
}
function Y2(e, t) {
  return t.contains(e.x || 0, e.y || 0);
}
function y5(e, t) {
  const n = e.x || 0, i = e.y || 0, r = e.width || 0, o = e.height || 0;
  return t.intersects(sv.set(n, i, n + r, i + o));
}
function v5(e, t) {
  const n = e.x || 0, i = e.y || 0, r = e.x2 != null ? e.x2 : n, o = e.y2 != null ? e.y2 : i;
  return _u(t, n, i, r, o);
}
function _u(e, t, n, i, r) {
  const {
    x1: o,
    y1: a,
    x2: s,
    y2: u
  } = e, l = i - t, c = r - n;
  let f = 0, d = 1, h, g, p, m;
  for (m = 0; m < 4; ++m) {
    if (m === 0 && (h = -l, g = -(o - t)), m === 1 && (h = l, g = s - t), m === 2 && (h = -c, g = -(a - n)), m === 3 && (h = c, g = u - n), Math.abs(h) < 1e-10 && g < 0)
      return !1;
    if (p = g / h, h < 0) {
      if (p > d)
        return !1;
      p > f && (f = p);
    } else if (h > 0) {
      if (p < f)
        return !1;
      p < d && (d = p);
    }
  }
  return !0;
}
function Ju(e, t) {
  e.globalCompositeOperation = t.blend || "source-over";
}
function wi(e, t) {
  return e == null ? t : e;
}
function KO(e, t) {
  const n = t.length;
  for (let i = 0; i < n; ++i)
    e.addColorStop(t[i].offset, t[i].color);
  return e;
}
function FU(e, t, n) {
  const i = n.width(), r = n.height();
  let o;
  if (t.gradient === "radial")
    o = e.createRadialGradient(n.x1 + wi(t.x1, 0.5) * i, n.y1 + wi(t.y1, 0.5) * r, Math.max(i, r) * wi(t.r1, 0), n.x1 + wi(t.x2, 0.5) * i, n.y1 + wi(t.y2, 0.5) * r, Math.max(i, r) * wi(t.r2, 0.5));
  else {
    const a = wi(t.x1, 0), s = wi(t.y1, 0), u = wi(t.x2, 1), l = wi(t.y2, 0);
    if (a === u || s === l || i === r)
      o = e.createLinearGradient(n.x1 + a * i, n.y1 + s * r, n.x1 + u * i, n.y1 + l * r);
    else {
      const c = Zo(Math.ceil(i), Math.ceil(r)), f = c.getContext("2d");
      return f.scale(i, r), f.fillStyle = KO(f.createLinearGradient(a, s, u, l), t.stops), f.fillRect(0, 0, i, r), e.createPattern(c, "no-repeat");
    }
  }
  return KO(o, t.stops);
}
function b5(e, t, n) {
  return z2(n) ? FU(e, n, t.bounds) : n;
}
function Ag(e, t, n) {
  return n *= t.fillOpacity == null ? 1 : t.fillOpacity, n > 0 ? (e.globalAlpha = n, e.fillStyle = b5(e, t, t.fill), !0) : !1;
}
var kU = [];
function Qu(e, t, n) {
  var i = (i = t.strokeWidth) != null ? i : 1;
  return i <= 0 ? !1 : (n *= t.strokeOpacity == null ? 1 : t.strokeOpacity, n > 0 ? (e.globalAlpha = n, e.strokeStyle = b5(e, t, t.stroke), e.lineWidth = i, e.lineCap = t.strokeCap || "butt", e.lineJoin = t.strokeJoin || "miter", e.miterLimit = t.strokeMiterLimit || 10, e.setLineDash && (e.setLineDash(t.strokeDash || kU), e.lineDashOffset = t.strokeDashOffset || 0), !0) : !1);
}
function DU(e, t) {
  return e.zindex - t.zindex || e.index - t.index;
}
function X2(e) {
  if (!e.zdirty)
    return e.zitems;
  var t = e.items, n = [], i, r, o;
  for (r = 0, o = t.length; r < o; ++r)
    i = t[r], i.index = r, i.zindex && n.push(i);
  return e.zdirty = !1, e.zitems = n.sort(DU);
}
function qi(e, t) {
  var n = e.items, i, r;
  if (!n || !n.length)
    return;
  const o = X2(e);
  if (o && o.length) {
    for (i = 0, r = n.length; i < r; ++i)
      n[i].zindex || t(n[i]);
    n = o;
  }
  for (i = 0, r = n.length; i < r; ++i)
    t(n[i]);
}
function _g(e, t) {
  var n = e.items, i, r;
  if (!n || !n.length)
    return null;
  const o = X2(e);
  for (o && o.length && (n = o), r = n.length; --r >= 0; )
    if (i = t(n[r]))
      return i;
  if (n === o) {
    for (n = e.items, r = n.length; --r >= 0; )
      if (!n[r].zindex && (i = t(n[r])))
        return i;
  }
  return null;
}
function V2(e) {
  return function(t, n, i) {
    qi(n, (r) => {
      (!i || i.intersects(r.bounds)) && x5(e, t, r, r);
    });
  };
}
function $U(e) {
  return function(t, n, i) {
    n.items.length && (!i || i.intersects(n.bounds)) && x5(e, t, n.items[0], n.items);
  };
}
function x5(e, t, n, i) {
  var r = n.opacity == null ? 1 : n.opacity;
  r !== 0 && (e(t, i) || (Ju(t, n), n.fill && Ag(t, n, r) && t.fill(), n.stroke && Qu(t, n, r) && t.stroke()));
}
function Ep(e) {
  return e = e || ci, function(t, n, i, r, o, a) {
    return i *= t.pixelRatio, r *= t.pixelRatio, _g(n, (s) => {
      const u = s.bounds;
      if (!(u && !u.contains(o, a) || !u) && e(t, s, i, r, o, a))
        return s;
    });
  };
}
function td(e, t) {
  return function(n, i, r, o) {
    var a = Array.isArray(i) ? i[0] : i, s = t == null ? a.fill : t, u = a.stroke && n.isPointInStroke, l, c;
    return u && (l = a.strokeWidth, c = a.strokeCap, n.lineWidth = l != null ? l : 1, n.lineCap = c != null ? c : "butt"), e(n, i) ? !1 : s && n.isPointInPath(r, o) || u && n.isPointInStroke(r, o);
  };
}
function K2(e) {
  return Ep(td(e));
}
function gs(e, t) {
  return "translate(" + e + "," + t + ")";
}
function J2(e) {
  return "rotate(" + e + ")";
}
function MU(e, t) {
  return "scale(" + e + "," + t + ")";
}
function w5(e) {
  return gs(e.x || 0, e.y || 0);
}
function TU(e) {
  return gs(e.x || 0, e.y || 0) + (e.angle ? " " + J2(e.angle) : "");
}
function NU(e) {
  return gs(e.x || 0, e.y || 0) + (e.angle ? " " + J2(e.angle) : "") + (e.scaleX || e.scaleY ? " " + MU(e.scaleX || 1, e.scaleY || 1) : "");
}
function Q2(e, t, n) {
  function i(a, s) {
    a("transform", TU(s)), a("d", t(null, s));
  }
  function r(a, s) {
    return t(ed(a, s.angle), s), yo(a, s).translate(s.x || 0, s.y || 0);
  }
  function o(a, s) {
    var u = s.x || 0, l = s.y || 0, c = s.angle || 0;
    a.translate(u, l), c && a.rotate(c *= la), a.beginPath(), t(a, s), c && a.rotate(-c), a.translate(-u, -l);
  }
  return {
    type: e,
    tag: "path",
    nested: !1,
    attr: i,
    bound: r,
    draw: V2(o),
    pick: K2(o),
    isect: n || H2(o)
  };
}
var RU = Q2("arc", bU);
function jU(e, t) {
  for (var n = e[0].orient === "horizontal" ? t[1] : t[0], i = e[0].orient === "horizontal" ? "y" : "x", r = e.length, o = 1 / 0, a, s; --r >= 0; )
    e[r].defined !== !1 && (s = Math.abs(e[r][i] - n), s < o && (o = s, a = e[r]));
  return a;
}
function PU(e, t) {
  for (var n = Math.pow(e[0].strokeWidth || 1, 2), i = e.length, r, o, a; --i >= 0; )
    if (e[i].defined !== !1 && (r = e[i].x - t[0], o = e[i].y - t[1], a = r * r + o * o, a < n))
      return e[i];
  return null;
}
function LU(e, t) {
  for (var n = e.length, i, r, o; --n >= 0; )
    if (e[n].defined !== !1 && (i = e[n].x - t[0], r = e[n].y - t[1], o = i * i + r * r, i = e[n].size || 1, o < i * i))
      return e[n];
  return null;
}
function Z2(e, t, n) {
  function i(u, l) {
    var c = l.mark.items;
    c.length && u("d", t(null, c));
  }
  function r(u, l) {
    var c = l.items;
    return c.length === 0 ? u : (t(ed(u), c), yo(u, c[0]));
  }
  function o(u, l) {
    u.beginPath(), t(u, l);
  }
  const a = td(o);
  function s(u, l, c, f, d, h) {
    var g = l.items, p = l.bounds;
    return !g || !g.length || p && !p.contains(d, h) ? null : (c *= u.pixelRatio, f *= u.pixelRatio, a(u, g, c, f) ? g[0] : null);
  }
  return {
    type: e,
    tag: "path",
    nested: !0,
    attr: i,
    bound: r,
    draw: $U(o),
    pick: s,
    isect: Y2,
    tip: n
  };
}
var IU = Z2("area", xU, jU);
function BU(e, t) {
  var n = t.clip;
  e.save(), he(n) ? (e.beginPath(), n(e), e.clip()) : E5(e, t.group);
}
function E5(e, t) {
  e.beginPath(), q2(t) ? Cl(e, t, 0, 0) : e.rect(0, 0, t.width || 0, t.height || 0), e.clip();
}
function A5(e) {
  const t = wi(e.strokeWidth, 1);
  return e.strokeOffset != null ? e.strokeOffset : e.stroke && t > 0.5 && t < 1.5 ? 0.5 - Math.abs(t - 1) : 0;
}
function zU(e, t) {
  e("transform", w5(t));
}
function _5(e, t) {
  const n = A5(t);
  e("d", Cl(null, t, n, n));
}
function UU(e, t) {
  e("class", "background"), e("aria-hidden", !0), _5(e, t);
}
function qU(e, t) {
  e("class", "foreground"), e("aria-hidden", !0), t.strokeForeground ? _5(e, t) : e("d", "");
}
function WU(e, t, n) {
  const i = t.clip ? W2(n, t, t) : null;
  e("clip-path", i);
}
function GU(e, t) {
  if (!t.clip && t.items) {
    const n = t.items, i = n.length;
    for (let r = 0; r < i; ++r)
      e.union(n[r].bounds);
  }
  return (t.clip || t.width || t.height) && !t.noBound && e.add(0, 0).add(t.width || 0, t.height || 0), yo(e, t), e.translate(t.x || 0, t.y || 0);
}
function cf(e, t, n, i) {
  const r = A5(t);
  e.beginPath(), Cl(e, t, (n || 0) + r, (i || 0) + r);
}
const HU = td(cf), YU = td(cf, !1), XU = td(cf, !0);
function VU(e, t, n) {
  qi(t, (i) => {
    const r = i.x || 0, o = i.y || 0, a = i.strokeForeground, s = i.opacity == null ? 1 : i.opacity;
    (i.stroke || i.fill) && s && (cf(e, i, r, o), Ju(e, i), i.fill && Ag(e, i, s) && e.fill(), i.stroke && !a && Qu(e, i, s) && e.stroke()), e.save(), e.translate(r, o), i.clip && E5(e, i), n && n.translate(-r, -o), qi(i, (u) => {
      this.draw(e, u, n);
    }), n && n.translate(r, o), e.restore(), a && i.stroke && s && (cf(e, i, r, o), Ju(e, i), Qu(e, i, s) && e.stroke());
  });
}
function KU(e, t, n, i, r, o) {
  if (t.bounds && !t.bounds.contains(r, o) || !t.items)
    return null;
  const a = n * e.pixelRatio, s = i * e.pixelRatio;
  return _g(t, (u) => {
    let l, c, f;
    const d = u.bounds;
    if (d && !d.contains(r, o))
      return;
    c = u.x || 0, f = u.y || 0;
    const h = c + (u.width || 0), g = f + (u.height || 0), p = u.clip;
    if (p && (r < c || r > h || o < f || o > g))
      return;
    if (e.save(), e.translate(c, f), c = r - c, f = o - f, p && q2(u) && !XU(e, u, a, s))
      return e.restore(), null;
    const m = u.strokeForeground, y = t.interactive !== !1;
    return y && m && u.stroke && YU(e, u, a, s) ? (e.restore(), u) : (l = _g(u, (v) => JU(v, c, f) ? this.pick(v, n, i, c, f) : null), !l && y && (u.fill || !m && u.stroke) && HU(e, u, a, s) && (l = u), e.restore(), l || null);
  });
}
function JU(e, t, n) {
  return (e.interactive !== !1 || e.marktype === "group") && e.bounds && e.bounds.contains(t, n);
}
var QU = {
  type: "group",
  tag: "g",
  nested: !1,
  attr: zU,
  bound: GU,
  draw: VU,
  pick: KU,
  isect: y5,
  content: WU,
  background: UU,
  foreground: qU
}, ff = {
  xmlns: "http://www.w3.org/2000/svg",
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
  version: "1.1"
};
function ew(e, t) {
  var n = e.image;
  return (!n || e.url && e.url !== n.url) && (n = {
    complete: !1,
    width: 0,
    height: 0
  }, t.loadImage(e.url).then((i) => {
    e.image = i, e.image.url = e.url;
  })), n;
}
function tw(e, t) {
  return e.width != null ? e.width : !t || !t.width ? 0 : e.aspect !== !1 && e.height ? e.height * t.width / t.height : t.width;
}
function nw(e, t) {
  return e.height != null ? e.height : !t || !t.height ? 0 : e.aspect !== !1 && e.width ? e.width * t.height / t.width : t.height;
}
function Ap(e, t) {
  return e === "center" ? t / 2 : e === "right" ? t : 0;
}
function _p(e, t) {
  return e === "middle" ? t / 2 : e === "bottom" ? t : 0;
}
function ZU(e, t, n) {
  const i = ew(t, n), r = tw(t, i), o = nw(t, i), a = (t.x || 0) - Ap(t.align, r), s = (t.y || 0) - _p(t.baseline, o), u = !i.src && i.toDataURL ? i.toDataURL() : i.src || "";
  e("href", u, ff["xmlns:xlink"], "xlink:href"), e("transform", gs(a, s)), e("width", r), e("height", o), e("preserveAspectRatio", t.aspect === !1 ? "none" : "xMidYMid");
}
function eq(e, t) {
  const n = t.image, i = tw(t, n), r = nw(t, n), o = (t.x || 0) - Ap(t.align, i), a = (t.y || 0) - _p(t.baseline, r);
  return e.set(o, a, o + i, a + r);
}
function tq(e, t, n) {
  qi(t, (i) => {
    if (n && !n.intersects(i.bounds))
      return;
    const r = ew(i, this);
    let o = tw(i, r), a = nw(i, r);
    if (o === 0 || a === 0)
      return;
    let s = (i.x || 0) - Ap(i.align, o), u = (i.y || 0) - _p(i.baseline, a), l, c, f, d;
    i.aspect !== !1 && (c = r.width / r.height, f = i.width / i.height, c === c && f === f && c !== f && (f < c ? (d = o / c, u += (a - d) / 2, a = d) : (d = a * c, s += (o - d) / 2, o = d))), (r.complete || r.toDataURL) && (Ju(e, i), e.globalAlpha = (l = i.opacity) != null ? l : 1, e.imageSmoothingEnabled = i.smooth !== !1, e.drawImage(r, s, u, o, a));
  });
}
var nq = {
  type: "image",
  tag: "image",
  nested: !1,
  attr: ZU,
  bound: eq,
  draw: tq,
  pick: Ep(),
  isect: ci,
  get: ew,
  xOffset: Ap,
  yOffset: _p
}, iq = Z2("line", wU, PU);
function rq(e, t) {
  var n = t.scaleX || 1, i = t.scaleY || 1;
  (n !== 1 || i !== 1) && e("vector-effect", "non-scaling-stroke"), e("transform", NU(t)), e("d", t.path);
}
function Th(e, t) {
  var n = t.path;
  if (n == null)
    return !0;
  var i = t.x || 0, r = t.y || 0, o = t.scaleX || 1, a = t.scaleY || 1, s = (t.angle || 0) * la, u = t.pathCache;
  (!u || u.path !== n) && ((t.pathCache = u = Ku(n)).path = n), s && e.rotate && e.translate ? (e.translate(i, r), e.rotate(s), lf(e, u, 0, 0, o, a), e.rotate(-s), e.translate(-i, -r)) : lf(e, u, i, r, o, a);
}
function oq(e, t) {
  return Th(ed(e, t.angle), t) ? e.set(0, 0, 0, 0) : yo(e, t, !0);
}
var aq = {
  type: "path",
  tag: "path",
  nested: !1,
  attr: rq,
  bound: oq,
  draw: V2(Th),
  pick: K2(Th),
  isect: H2(Th)
};
function sq(e, t) {
  e("d", Cl(null, t));
}
function uq(e, t) {
  var n, i;
  return yo(e.set(n = t.x || 0, i = t.y || 0, n + t.width || 0, i + t.height || 0), t);
}
function JO(e, t) {
  e.beginPath(), Cl(e, t);
}
var lq = {
  type: "rect",
  tag: "path",
  nested: !1,
  attr: sq,
  bound: uq,
  draw: V2(JO),
  pick: K2(JO),
  isect: y5
};
function cq(e, t) {
  e("transform", w5(t)), e("x2", t.x2 != null ? t.x2 - (t.x || 0) : 0), e("y2", t.y2 != null ? t.y2 - (t.y || 0) : 0);
}
function fq(e, t) {
  var n, i;
  return yo(e.set(n = t.x || 0, i = t.y || 0, t.x2 != null ? t.x2 : n, t.y2 != null ? t.y2 : i), t);
}
function O5(e, t, n) {
  var i, r, o, a;
  return t.stroke && Qu(e, t, n) ? (i = t.x || 0, r = t.y || 0, o = t.x2 != null ? t.x2 : i, a = t.y2 != null ? t.y2 : r, e.beginPath(), e.moveTo(i, r), e.lineTo(o, a), !0) : !1;
}
function dq(e, t, n) {
  qi(t, (i) => {
    if (!(n && !n.intersects(i.bounds))) {
      var r = i.opacity == null ? 1 : i.opacity;
      r && O5(e, i, r) && (Ju(e, i), e.stroke());
    }
  });
}
function hq(e, t, n, i) {
  return e.isPointInStroke ? O5(e, t, 1) && e.isPointInStroke(n, i) : !1;
}
var gq = {
  type: "rule",
  tag: "line",
  nested: !1,
  attr: cq,
  bound: fq,
  draw: dq,
  pick: Ep(hq),
  isect: v5
}, pq = Q2("shape", EU), mq = Q2("symbol", AU, Y2);
const QO = CD();
var Pi = {
  height: Cr,
  measureWidth: iw,
  estimateWidth: uv,
  width: uv,
  canvas: S5
};
S5(!0);
function S5(e) {
  Pi.width = e && ea ? iw : uv;
}
function uv(e, t) {
  return C5(fa(e, t), Cr(e));
}
function C5(e, t) {
  return ~~(0.8 * e.length * t);
}
function iw(e, t) {
  return Cr(e) <= 0 || !(t = fa(e, t)) ? 0 : F5(t, Op(e));
}
function F5(e, t) {
  const n = "(".concat(t, ") ").concat(e);
  let i = QO.get(n);
  return i === void 0 && (ea.font = t, i = ea.measureText(e).width, QO.set(n, i)), i;
}
function Cr(e) {
  return e.fontSize != null ? +e.fontSize || 0 : 11;
}
function ca(e) {
  return e.lineHeight != null ? e.lineHeight : Cr(e) + 2;
}
function yq(e) {
  return J(e) ? e.length > 1 ? e : e[0] : e;
}
function nd(e) {
  return yq(e.lineBreak && e.text && !J(e.text) ? e.text.split(e.lineBreak) : e.text);
}
function rw(e) {
  const t = nd(e);
  return (J(t) ? t.length - 1 : 0) * ca(e);
}
function fa(e, t) {
  const n = t == null ? "" : (t + "").trim();
  return e.limit > 0 && n.length ? bq(e, n) : n;
}
function vq(e) {
  if (Pi.width === iw) {
    const t = Op(e);
    return (n) => F5(n, t);
  } else {
    const t = Cr(e);
    return (n) => C5(n, t);
  }
}
function bq(e, t) {
  var n = +e.limit, i = vq(e);
  if (i(t) < n)
    return t;
  var r = e.ellipsis || "\u2026", o = e.dir === "rtl", a = 0, s = t.length, u;
  if (n -= i(r), o) {
    for (; a < s; )
      u = a + s >>> 1, i(t.slice(u)) > n ? a = u + 1 : s = u;
    return r + t.slice(a);
  } else {
    for (; a < s; )
      u = 1 + (a + s >>> 1), i(t.slice(0, u)) < n ? a = u : s = u - 1;
    return t.slice(0, a) + r;
  }
}
function id(e, t) {
  var n = e.font;
  return (t && n ? String(n).replace(/"/g, "'") : n) || "sans-serif";
}
function Op(e, t) {
  return (e.fontStyle ? e.fontStyle + " " : "") + (e.fontVariant ? e.fontVariant + " " : "") + (e.fontWeight ? e.fontWeight + " " : "") + Cr(e) + "px " + id(e, t);
}
function ow(e) {
  var t = e.baseline, n = Cr(e);
  return Math.round(t === "top" ? 0.79 * n : t === "middle" ? 0.3 * n : t === "bottom" ? -0.21 * n : t === "line-top" ? 0.29 * n + 0.5 * ca(e) : t === "line-bottom" ? 0.29 * n - 0.5 * ca(e) : 0);
}
const xq = {
  left: "start",
  center: "middle",
  right: "end"
}, Lc = new dt();
function Sp(e) {
  var t = e.x || 0, n = e.y || 0, i = e.radius || 0, r;
  return i && (r = (e.theta || 0) - Za, t += i * Math.cos(r), n += i * Math.sin(r)), Lc.x1 = t, Lc.y1 = n, Lc;
}
function wq(e, t) {
  var n = t.dx || 0, i = (t.dy || 0) + ow(t), r = Sp(t), o = r.x1, a = r.y1, s = t.angle || 0, u;
  e("text-anchor", xq[t.align] || "start"), s ? (u = gs(o, a) + " " + J2(s), (n || i) && (u += " " + gs(n, i))) : u = gs(o + n, a + i), e("transform", u);
}
function aw(e, t, n) {
  var i = Pi.height(t), r = t.align, o = Sp(t), a = o.x1, s = o.y1, u = t.dx || 0, l = (t.dy || 0) + ow(t) - Math.round(0.8 * i), c = nd(t), f;
  if (J(c) ? (i += ca(t) * (c.length - 1), f = c.reduce((d, h) => Math.max(d, Pi.width(t, h)), 0)) : f = Pi.width(t, c), r === "center" ? u -= f / 2 : r === "right" && (u -= f), e.set(u += a, l += s, u + f, l + i), t.angle && !n)
    e.rotate(t.angle * la, a, s);
  else if (n === 2)
    return e.rotatedPoints(t.angle * la, a, s);
  return e;
}
function Eq(e, t, n) {
  qi(t, (i) => {
    var r = i.opacity == null ? 1 : i.opacity, o, a, s, u, l, c, f;
    if (!(n && !n.intersects(i.bounds) || r === 0 || i.fontSize <= 0 || i.text == null || i.text.length === 0)) {
      if (e.font = Op(i), e.textAlign = i.align || "left", o = Sp(i), a = o.x1, s = o.y1, i.angle && (e.save(), e.translate(a, s), e.rotate(i.angle * la), a = s = 0), a += i.dx || 0, s += (i.dy || 0) + ow(i), c = nd(i), Ju(e, i), J(c))
        for (l = ca(i), u = 0; u < c.length; ++u)
          f = fa(i, c[u]), i.fill && Ag(e, i, r) && e.fillText(f, a, s), i.stroke && Qu(e, i, r) && e.strokeText(f, a, s), s += l;
      else
        f = fa(i, c), i.fill && Ag(e, i, r) && e.fillText(f, a, s), i.stroke && Qu(e, i, r) && e.strokeText(f, a, s);
      i.angle && e.restore();
    }
  });
}
function Aq(e, t, n, i, r, o) {
  if (t.fontSize <= 0)
    return !1;
  if (!t.angle)
    return !0;
  var a = Sp(t), s = a.x1, u = a.y1, l = aw(Lc, t, 1), c = -t.angle * la, f = Math.cos(c), d = Math.sin(c), h = f * r - d * o + (s - f * s + d * u), g = d * r + f * o + (u - d * s - f * u);
  return l.contains(h, g);
}
function _q(e, t) {
  const n = aw(Lc, e, 2);
  return _u(t, n[0], n[1], n[2], n[3]) || _u(t, n[0], n[1], n[4], n[5]) || _u(t, n[4], n[5], n[6], n[7]) || _u(t, n[2], n[3], n[6], n[7]);
}
var Oq = {
  type: "text",
  tag: "text",
  nested: !1,
  attr: wq,
  bound: aw,
  draw: Eq,
  pick: Ep(Aq),
  isect: _q
}, Sq = Z2("trail", _U, LU), Qn = {
  arc: RU,
  area: IU,
  group: QU,
  image: nq,
  line: iq,
  path: aq,
  rect: lq,
  rule: gq,
  shape: pq,
  symbol: mq,
  text: Oq,
  trail: Sq
};
function lv(e, t, n) {
  var i = Qn[e.mark.marktype], r = t || i.bound;
  return i.nested && (e = e.mark), r(e.bounds || (e.bounds = new dt()), e, n);
}
var ZO = {
  mark: null
};
function k5(e, t, n) {
  var i = Qn[e.marktype], r = i.bound, o = e.items, a = o && o.length, s, u, l, c;
  if (i.nested)
    return a ? l = o[0] : (ZO.mark = e, l = ZO), c = lv(l, r, n), t = t && t.union(c) || c, t;
  if (t = t || e.bounds && e.bounds.clear() || new dt(), a)
    for (s = 0, u = o.length; s < u; ++s)
      t.union(lv(o[s], r, n));
  return e.bounds = t;
}
const Cq = [
  "marktype",
  "name",
  "role",
  "interactive",
  "clip",
  "items",
  "zindex",
  "x",
  "y",
  "width",
  "height",
  "align",
  "baseline",
  "fill",
  "fillOpacity",
  "opacity",
  "blend",
  "stroke",
  "strokeOpacity",
  "strokeWidth",
  "strokeCap",
  "strokeDash",
  "strokeDashOffset",
  "strokeForeground",
  "strokeOffset",
  "startAngle",
  "endAngle",
  "innerRadius",
  "outerRadius",
  "cornerRadius",
  "padAngle",
  "cornerRadiusTopLeft",
  "cornerRadiusTopRight",
  "cornerRadiusBottomLeft",
  "cornerRadiusBottomRight",
  "interpolate",
  "tension",
  "orient",
  "defined",
  "url",
  "aspect",
  "smooth",
  "path",
  "scaleX",
  "scaleY",
  "x2",
  "y2",
  "size",
  "shape",
  "text",
  "angle",
  "theta",
  "radius",
  "dir",
  "dx",
  "dy",
  "ellipsis",
  "limit",
  "lineBreak",
  "lineHeight",
  "font",
  "fontSize",
  "fontWeight",
  "fontStyle",
  "fontVariant",
  "description",
  "aria",
  "ariaRole",
  "ariaRoleDescription"
];
function D5(e, t) {
  return JSON.stringify(e, Cq, t);
}
function $5(e) {
  const t = typeof e == "string" ? JSON.parse(e) : e;
  return M5(t);
}
function M5(e) {
  var t = e.marktype, n = e.items, i, r, o;
  if (n)
    for (r = 0, o = n.length; r < o; ++r)
      i = t ? "mark" : "group", n[r][i] = e, n[r].zindex && (n[r][i].zdirty = !0), (t || i) === "group" && M5(n[r]);
  return t && k5(e), e;
}
function sw(e) {
  arguments.length ? this.root = $5(e) : (this.root = T5({
    marktype: "group",
    name: "root",
    role: "frame"
  }), this.root.items = [new xp(this.root)]);
}
sw.prototype = {
  toJSON(e) {
    return D5(this.root, e || 0);
  },
  mark(e, t, n) {
    t = t || this.root.items[0];
    const i = T5(e, t);
    return t.items[n] = i, i.zindex && (i.group.zdirty = !0), i;
  }
};
function T5(e, t) {
  const n = {
    bounds: new dt(),
    clip: !!e.clip,
    group: t,
    interactive: e.interactive !== !1,
    items: [],
    marktype: e.marktype,
    name: e.name || void 0,
    role: e.role || void 0,
    zindex: e.zindex || 0
  };
  return e.aria != null && (n.aria = e.aria), e.description && (n.description = e.description), n;
}
function Uo(e, t, n) {
  return !e && typeof document < "u" && document.createElement && (e = document), e ? n ? e.createElementNS(n, t) : e.createElement(t) : null;
}
function uw(e, t) {
  t = t.toLowerCase();
  for (var n = e.childNodes, i = 0, r = n.length; i < r; ++i)
    if (n[i].tagName.toLowerCase() === t)
      return n[i];
}
function Cn(e, t, n, i) {
  var r = e.childNodes[t], o;
  return (!r || r.tagName.toLowerCase() !== n.toLowerCase()) && (o = r || null, r = Uo(e.ownerDocument, n, i), e.insertBefore(r, o)), r;
}
function ki(e, t) {
  for (var n = e.childNodes, i = n.length; i > t; )
    e.removeChild(n[--i]);
  return e;
}
function N5(e) {
  return "mark-" + e.marktype + (e.role ? " role-" + e.role : "") + (e.name ? " " + e.name : "");
}
function Cp(e, t) {
  const n = t.getBoundingClientRect();
  return [e.clientX - n.left - (t.clientLeft || 0), e.clientY - n.top - (t.clientTop || 0)];
}
function Fq(e, t, n, i) {
  var r = e && e.mark, o, a;
  if (r && (o = Qn[r.marktype]).tip) {
    for (a = Cp(t, n), a[0] -= i[0], a[1] -= i[1]; e = e.mark.group; )
      a[0] -= e.x || 0, a[1] -= e.y || 0;
    e = o.tip(r.items, a);
  }
  return e;
}
function da(e, t) {
  this._active = null, this._handlers = {}, this._loader = e || X0(), this._tooltip = t || kq;
}
function kq(e, t, n, i) {
  e.element().setAttribute("title", i || "");
}
da.prototype = {
  initialize(e, t, n) {
    return this._el = e, this._obj = n || null, this.origin(t);
  },
  element() {
    return this._el;
  },
  canvas() {
    return this._el && this._el.firstChild;
  },
  origin(e) {
    return arguments.length ? (this._origin = e || [0, 0], this) : this._origin.slice();
  },
  scene(e) {
    return arguments.length ? (this._scene = e, this) : this._scene;
  },
  on() {
  },
  off() {
  },
  _handlerIndex(e, t, n) {
    for (let i = e ? e.length : 0; --i >= 0; )
      if (e[i].type === t && (!n || e[i].handler === n))
        return i;
    return -1;
  },
  handlers(e) {
    const t = this._handlers, n = [];
    if (e)
      n.push(...t[this.eventName(e)]);
    else
      for (const i in t)
        n.push(...t[i]);
    return n;
  },
  eventName(e) {
    const t = e.indexOf(".");
    return t < 0 ? e : e.slice(0, t);
  },
  handleHref(e, t, n) {
    this._loader.sanitize(n, {
      context: "href"
    }).then((i) => {
      const r = new MouseEvent(e.type, e), o = Uo(null, "a");
      for (const a in i)
        o.setAttribute(a, i[a]);
      o.dispatchEvent(r);
    }).catch(() => {
    });
  },
  handleTooltip(e, t, n) {
    if (t && t.tooltip != null) {
      t = Fq(t, e, this.canvas(), this._origin);
      const i = n && t && t.tooltip || null;
      this._tooltip.call(this._obj, this, e, t, i);
    }
  },
  getItemBoundingClientRect(e) {
    const t = this.canvas();
    if (!t)
      return;
    const n = t.getBoundingClientRect(), i = this._origin, r = e.bounds, o = r.width(), a = r.height();
    let s = r.x1 + i[0] + n.left, u = r.y1 + i[1] + n.top;
    for (; e.mark && (e = e.mark.group); )
      s += e.x || 0, u += e.y || 0;
    return {
      x: s,
      y: u,
      width: o,
      height: a,
      left: s,
      top: u,
      right: s + o,
      bottom: u + a
    };
  }
};
function Fr(e) {
  this._el = null, this._bgcolor = null, this._loader = new G2(e);
}
Fr.prototype = {
  initialize(e, t, n, i, r) {
    return this._el = e, this.resize(t, n, i, r);
  },
  element() {
    return this._el;
  },
  canvas() {
    return this._el && this._el.firstChild;
  },
  background(e) {
    return arguments.length === 0 ? this._bgcolor : (this._bgcolor = e, this);
  },
  resize(e, t, n, i) {
    return this._width = e, this._height = t, this._origin = n || [0, 0], this._scale = i || 1, this;
  },
  dirty() {
  },
  render(e) {
    const t = this;
    return t._call = function() {
      t._render(e);
    }, t._call(), t._call = null, t;
  },
  _render() {
  },
  renderAsync(e) {
    const t = this.render(e);
    return this._ready ? this._ready.then(() => t) : Promise.resolve(t);
  },
  _load(e, t) {
    var n = this, i = n._loader[e](t);
    if (!n._ready) {
      const r = n._call;
      n._ready = n._loader.ready().then((o) => {
        o && r(), n._ready = null;
      });
    }
    return i;
  },
  sanitizeURL(e) {
    return this._load("sanitizeURL", e);
  },
  loadImage(e) {
    return this._load("loadImage", e);
  }
};
const Dq = "keydown", $q = "keypress", Mq = "keyup", R5 = "dragenter", Nh = "dragleave", j5 = "dragover", cv = "mousedown", Tq = "mouseup", Og = "mousemove", Ic = "mouseout", P5 = "mouseover", Sg = "click", Nq = "dblclick", Rq = "wheel", L5 = "mousewheel", Cg = "touchstart", Fg = "touchmove", kg = "touchend", jq = [Dq, $q, Mq, R5, Nh, j5, cv, Tq, Og, Ic, P5, Sg, Nq, Rq, L5, Cg, Fg, kg], fv = Og, df = Ic, dv = Sg;
function rd(e, t) {
  da.call(this, e, t), this._down = null, this._touch = null, this._first = !0, this._events = {};
}
const Pq = (e) => e === Cg || e === Fg || e === kg ? [Cg, Fg, kg] : [e];
function eS(e, t) {
  Pq(t).forEach((n) => Lq(e, n));
}
function Lq(e, t) {
  const n = e.canvas();
  n && !e._events[t] && (e._events[t] = 1, n.addEventListener(t, e[t] ? (i) => e[t](i) : (i) => e.fire(t, i)));
}
function tS(e, t, n) {
  return function(i) {
    const r = this._active, o = this.pickEvent(i);
    o === r ? this.fire(e, i) : ((!r || !r.exit) && this.fire(n, i), this._active = o, this.fire(t, i), this.fire(e, i));
  };
}
function nS(e) {
  return function(t) {
    this.fire(e, t), this._active = null;
  };
}
q(rd, da, {
  initialize(e, t, n) {
    return this._canvas = e && uw(e, "canvas"), [Sg, cv, Og, Ic, Nh].forEach((i) => eS(this, i)), da.prototype.initialize.call(this, e, t, n);
  },
  canvas() {
    return this._canvas;
  },
  context() {
    return this._canvas.getContext("2d");
  },
  events: jq,
  DOMMouseScroll(e) {
    this.fire(L5, e);
  },
  mousemove: tS(Og, P5, Ic),
  dragover: tS(j5, R5, Nh),
  mouseout: nS(Ic),
  dragleave: nS(Nh),
  mousedown(e) {
    this._down = this._active, this.fire(cv, e);
  },
  click(e) {
    this._down === this._active && (this.fire(Sg, e), this._down = null);
  },
  touchstart(e) {
    this._touch = this.pickEvent(e.changedTouches[0]), this._first && (this._active = this._touch, this._first = !1), this.fire(Cg, e, !0);
  },
  touchmove(e) {
    this.fire(Fg, e, !0);
  },
  touchend(e) {
    this.fire(kg, e, !0), this._touch = null;
  },
  fire(e, t, n) {
    const i = n ? this._touch : this._active, r = this._handlers[e];
    if (t.vegaType = e, e === dv && i && i.href ? this.handleHref(t, i, i.href) : (e === fv || e === df) && this.handleTooltip(t, i, e !== df), r)
      for (let o = 0, a = r.length; o < a; ++o)
        r[o].handler.call(this._obj, t, i);
  },
  on(e, t) {
    const n = this.eventName(e), i = this._handlers;
    return this._handlerIndex(i[n], e, t) < 0 && (eS(this, e), (i[n] || (i[n] = [])).push({
      type: e,
      handler: t
    })), this;
  },
  off(e, t) {
    const n = this.eventName(e), i = this._handlers[n], r = this._handlerIndex(i, e, t);
    return r >= 0 && i.splice(r, 1), this;
  },
  pickEvent(e) {
    const t = Cp(e, this._canvas), n = this._origin;
    return this.pick(this._scene, t[0], t[1], t[0] - n[0], t[1] - n[1]);
  },
  pick(e, t, n, i, r) {
    const o = this.context();
    return Qn[e.marktype].pick.call(this, o, e, t, n, i, r);
  }
});
function Iq() {
  return typeof window < "u" && window.devicePixelRatio || 1;
}
var Bq = Iq();
function zq(e, t, n, i, r, o) {
  const a = typeof HTMLElement < "u" && e instanceof HTMLElement && e.parentNode != null, s = e.getContext("2d"), u = a ? Bq : r;
  e.width = t * u, e.height = n * u;
  for (const l in o)
    s[l] = o[l];
  return a && u !== 1 && (e.style.width = t + "px", e.style.height = n + "px"), s.pixelRatio = u, s.setTransform(u, 0, 0, u, u * i[0], u * i[1]), e;
}
function Dg(e) {
  Fr.call(this, e), this._options = {}, this._redraw = !1, this._dirty = new dt(), this._tempb = new dt();
}
const iS = Fr.prototype, Uq = (e, t, n) => new dt().set(0, 0, t, n).translate(-e[0], -e[1]);
function qq(e, t, n) {
  return t.expand(1).round(), e.pixelRatio % 1 && t.scale(e.pixelRatio).round().scale(1 / e.pixelRatio), t.translate(-(n[0] % 1), -(n[1] % 1)), e.beginPath(), e.rect(t.x1, t.y1, t.width(), t.height()), e.clip(), t;
}
q(Dg, Fr, {
  initialize(e, t, n, i, r, o) {
    return this._options = o || {}, this._canvas = this._options.externalContext ? null : Zo(1, 1, this._options.type), e && this._canvas && (ki(e, 0).appendChild(this._canvas), this._canvas.setAttribute("class", "marks")), iS.initialize.call(this, e, t, n, i, r);
  },
  resize(e, t, n, i) {
    if (iS.resize.call(this, e, t, n, i), this._canvas)
      zq(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context);
    else {
      const r = this._options.externalContext;
      r || P("CanvasRenderer is missing a valid canvas or context"), r.scale(this._scale, this._scale), r.translate(this._origin[0], this._origin[1]);
    }
    return this._redraw = !0, this;
  },
  canvas() {
    return this._canvas;
  },
  context() {
    return this._options.externalContext || (this._canvas ? this._canvas.getContext("2d") : null);
  },
  dirty(e) {
    const t = this._tempb.clear().union(e.bounds);
    let n = e.mark.group;
    for (; n; )
      t.translate(n.x || 0, n.y || 0), n = n.mark.group;
    this._dirty.union(t);
  },
  _render(e) {
    const t = this.context(), n = this._origin, i = this._width, r = this._height, o = this._dirty, a = Uq(n, i, r);
    t.save();
    const s = this._redraw || o.empty() ? (this._redraw = !1, a.expand(1)) : qq(t, a.intersect(o), n);
    return this.clear(-n[0], -n[1], i, r), this.draw(t, e, s), t.restore(), o.clear(), this;
  },
  draw(e, t, n) {
    const i = Qn[t.marktype];
    t.clip && BU(e, t), i.draw.call(this, e, t, n), t.clip && e.restore();
  },
  clear(e, t, n, i) {
    const r = this._options, o = this.context();
    r.type !== "pdf" && !r.externalContext && o.clearRect(e, t, n, i), this._bgcolor != null && (o.fillStyle = this._bgcolor, o.fillRect(e, t, n, i));
  }
});
function lw(e, t) {
  da.call(this, e, t);
  const n = this;
  n._hrefHandler = hv(n, (i, r) => {
    r && r.href && n.handleHref(i, r, r.href);
  }), n._tooltipHandler = hv(n, (i, r) => {
    n.handleTooltip(i, r, i.type !== df);
  });
}
const hv = (e, t) => (n) => {
  let i = n.target.__data__;
  i = Array.isArray(i) ? i[0] : i, n.vegaType = n.type, t.call(e._obj, n, i);
};
q(lw, da, {
  initialize(e, t, n) {
    let i = this._svg;
    return i && (i.removeEventListener(dv, this._hrefHandler), i.removeEventListener(fv, this._tooltipHandler), i.removeEventListener(df, this._tooltipHandler)), this._svg = i = e && uw(e, "svg"), i && (i.addEventListener(dv, this._hrefHandler), i.addEventListener(fv, this._tooltipHandler), i.addEventListener(df, this._tooltipHandler)), da.prototype.initialize.call(this, e, t, n);
  },
  canvas() {
    return this._svg;
  },
  on(e, t) {
    const n = this.eventName(e), i = this._handlers;
    if (this._handlerIndex(i[n], e, t) < 0) {
      const o = {
        type: e,
        handler: t,
        listener: hv(this, t)
      };
      (i[n] || (i[n] = [])).push(o), this._svg && this._svg.addEventListener(n, o.listener);
    }
    return this;
  },
  off(e, t) {
    const n = this.eventName(e), i = this._handlers[n], r = this._handlerIndex(i, e, t);
    return r >= 0 && (this._svg && this._svg.removeEventListener(n, i[r].listener), i.splice(r, 1)), this;
  }
});
const I5 = "aria-hidden", cw = "aria-label", fw = "role", dw = "aria-roledescription", B5 = "graphics-object", hw = "graphics-symbol", z5 = (e, t, n) => ({
  [fw]: e,
  [dw]: t,
  [cw]: n || void 0
}), Wq = zi(["axis-domain", "axis-grid", "axis-label", "axis-tick", "axis-title", "legend-band", "legend-entry", "legend-gradient", "legend-label", "legend-title", "legend-symbol", "title"]), rS = {
  axis: {
    desc: "axis",
    caption: Yq
  },
  legend: {
    desc: "legend",
    caption: Xq
  },
  "title-text": {
    desc: "title",
    caption: (e) => "Title text '".concat(aS(e), "'")
  },
  "title-subtitle": {
    desc: "subtitle",
    caption: (e) => "Subtitle text '".concat(aS(e), "'")
  }
}, oS = {
  ariaRole: fw,
  ariaRoleDescription: dw,
  description: cw
};
function U5(e, t) {
  const n = t.aria === !1;
  if (e(I5, n || void 0), n || t.description == null)
    for (const i in oS)
      e(oS[i], void 0);
  else {
    const i = t.mark.marktype;
    e(cw, t.description), e(fw, t.ariaRole || (i === "group" ? B5 : hw)), e(dw, t.ariaRoleDescription || "".concat(i, " mark"));
  }
}
function q5(e) {
  return e.aria === !1 ? {
    [I5]: !0
  } : Wq[e.role] ? null : rS[e.role] ? Hq(e, rS[e.role]) : Gq(e);
}
function Gq(e) {
  const t = e.marktype, n = t === "group" || t === "text" || e.items.some((i) => i.description != null && i.aria !== !1);
  return z5(n ? B5 : hw, "".concat(t, " mark container"), e.description);
}
function Hq(e, t) {
  try {
    const n = e.items[0], i = t.caption || (() => "");
    return z5(t.role || hw, t.desc, n.description || i(n));
  } catch {
    return null;
  }
}
function aS(e) {
  return oe(e.text).join(" ");
}
function Yq(e) {
  const t = e.datum, n = e.orient, i = t.title ? W5(e) : null, r = e.context, o = r.scales[t.scale].value, a = r.dataflow.locale(), s = o.type, u = n === "left" || n === "right" ? "Y" : "X";
  return "".concat(u, "-axis") + (i ? " titled '".concat(i, "'") : "") + " for a ".concat(Vu(s) ? "discrete" : s, " scale") + " with ".concat(s5(a, o, e));
}
function Xq(e) {
  const t = e.datum, n = t.title ? W5(e) : null, i = "".concat(t.type || "", " legend").trim(), r = t.scales, o = Object.keys(r), a = e.context, s = a.scales[r[o[0]]].value, u = a.dataflow.locale();
  return Kq(i) + (n ? " titled '".concat(n, "'") : "") + " for ".concat(Vq(o)) + " with ".concat(s5(u, s, e));
}
function W5(e) {
  try {
    return oe(xe(e.items).items[0].text).join(" ");
  } catch {
    return null;
  }
}
function Vq(e) {
  return e = e.map((t) => t + (t === "fill" || t === "stroke" ? " color" : "")), e.length < 2 ? e[0] : e.slice(0, -1).join(", ") + " and " + xe(e);
}
function Kq(e) {
  return e.length ? e[0].toUpperCase() + e.slice(1) : e;
}
const G5 = (e) => (e + "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), Jq = (e) => G5(e).replace(/"/g, "&quot;").replace(/\t/g, "&#x9;").replace(/\n/g, "&#xA;").replace(/\r/g, "&#xD;");
function gw() {
  let e = "", t = "", n = "";
  const i = [], r = () => t = n = "", o = (u) => {
    t && (e += "".concat(t, ">").concat(n), r()), i.push(u);
  }, a = (u, l) => (l != null && (t += " ".concat(u, '="').concat(Jq(l), '"')), s), s = {
    open(u) {
      o(u), t = "<" + u;
      for (var l = arguments.length, c = new Array(l > 1 ? l - 1 : 0), f = 1; f < l; f++)
        c[f - 1] = arguments[f];
      for (const d of c)
        for (const h in d)
          a(h, d[h]);
      return s;
    },
    close() {
      const u = i.pop();
      return t ? e += t + (n ? ">".concat(n, "</").concat(u, ">") : "/>") : e += "</".concat(u, ">"), r(), s;
    },
    attr: a,
    text: (u) => (n += G5(u), s),
    toString: () => e
  };
  return s;
}
const H5 = (e) => Y5(gw(), e) + "";
function Y5(e, t) {
  if (e.open(t.tagName), t.hasAttributes()) {
    const n = t.attributes, i = n.length;
    for (let r = 0; r < i; ++r)
      e.attr(n[r].name, n[r].value);
  }
  if (t.hasChildNodes()) {
    const n = t.childNodes;
    for (const i of n)
      i.nodeType === 3 ? e.text(i.nodeValue) : Y5(e, i);
  }
  return e.close();
}
const $g = {
  fill: "fill",
  fillOpacity: "fill-opacity",
  stroke: "stroke",
  strokeOpacity: "stroke-opacity",
  strokeWidth: "stroke-width",
  strokeCap: "stroke-linecap",
  strokeJoin: "stroke-linejoin",
  strokeDash: "stroke-dasharray",
  strokeDashOffset: "stroke-dashoffset",
  strokeMiterLimit: "stroke-miterlimit",
  opacity: "opacity"
}, Mg = {
  blend: "mix-blend-mode"
}, X5 = {
  fill: "none",
  "stroke-miterlimit": 10
}, ec = 0, sS = "http://www.w3.org/2000/xmlns/", mt = ff.xmlns;
function pw(e) {
  Fr.call(this, e), this._dirtyID = 0, this._dirty = [], this._svg = null, this._root = null, this._defs = null;
}
const v1 = Fr.prototype;
q(pw, Fr, {
  initialize(e, t, n, i, r) {
    return this._defs = {}, this._clearDefs(), e && (this._svg = Cn(e, 0, "svg", mt), this._svg.setAttributeNS(sS, "xmlns", mt), this._svg.setAttributeNS(sS, "xmlns:xlink", ff["xmlns:xlink"]), this._svg.setAttribute("version", ff.version), this._svg.setAttribute("class", "marks"), ki(e, 1), this._root = Cn(this._svg, ec, "g", mt), qo(this._root, X5), ki(this._svg, ec + 1)), this.background(this._bgcolor), v1.initialize.call(this, e, t, n, i, r);
  },
  background(e) {
    return arguments.length && this._svg && this._svg.style.setProperty("background-color", e), v1.background.apply(this, arguments);
  },
  resize(e, t, n, i) {
    return v1.resize.call(this, e, t, n, i), this._svg && (qo(this._svg, {
      width: this._width * this._scale,
      height: this._height * this._scale,
      viewBox: "0 0 ".concat(this._width, " ").concat(this._height)
    }), this._root.setAttribute("transform", "translate(".concat(this._origin, ")"))), this._dirty = [], this;
  },
  canvas() {
    return this._svg;
  },
  svg() {
    const e = this._svg, t = this._bgcolor;
    if (!e)
      return null;
    let n;
    t && (e.removeAttribute("style"), n = Cn(e, ec, "rect", mt), qo(n, {
      width: this._width,
      height: this._height,
      fill: t
    }));
    const i = H5(e);
    return t && (e.removeChild(n), this._svg.style.setProperty("background-color", t)), i;
  },
  _render(e) {
    return this._dirtyCheck() && (this._dirtyAll && this._clearDefs(), this.mark(this._root, e), ki(this._root, 1)), this.defs(), this._dirty = [], ++this._dirtyID, this;
  },
  dirty(e) {
    e.dirty !== this._dirtyID && (e.dirty = this._dirtyID, this._dirty.push(e));
  },
  isDirty(e) {
    return this._dirtyAll || !e._svg || !e._svg.ownerSVGElement || e.dirty === this._dirtyID;
  },
  _dirtyCheck() {
    this._dirtyAll = !0;
    const e = this._dirty;
    if (!e.length || !this._dirtyID)
      return !0;
    const t = ++this._dirtyID;
    let n, i, r, o, a, s, u;
    for (a = 0, s = e.length; a < s; ++a)
      if (n = e[a], i = n.mark, i.marktype !== r && (r = i.marktype, o = Qn[r]), i.zdirty && i.dirty !== t && (this._dirtyAll = !1, uS(n, t), i.items.forEach((l) => {
        l.dirty = t;
      })), !i.zdirty) {
        if (n.exit) {
          o.nested && i.items.length ? (u = i.items[0], u._svg && this._update(o, u._svg, u)) : n._svg && (u = n._svg.parentNode, u && u.removeChild(n._svg)), n._svg = null;
          continue;
        }
        n = o.nested ? i.items[0] : n, n._update !== t && (!n._svg || !n._svg.ownerSVGElement ? (this._dirtyAll = !1, uS(n, t)) : this._update(o, n._svg, n), n._update = t);
      }
    return !this._dirtyAll;
  },
  mark(e, t, n) {
    if (!this.isDirty(t))
      return t._svg;
    const i = this._svg, r = Qn[t.marktype], o = t.interactive === !1 ? "none" : null, a = r.tag === "g", s = lS(t, e, n, "g", i);
    s.setAttribute("class", N5(t));
    const u = q5(t);
    for (const d in u)
      on(s, d, u[d]);
    a || on(s, "pointer-events", o), on(s, "clip-path", t.clip ? W2(this, t, t.group) : null);
    let l = null, c = 0;
    const f = (d) => {
      const h = this.isDirty(d), g = lS(d, s, l, r.tag, i);
      h && (this._update(r, g, d), a && eW(this, g, d)), l = g, ++c;
    };
    return r.nested ? t.items.length && f(t.items[0]) : qi(t, f), ki(s, c), s;
  },
  _update(e, t, n) {
    to = t, Ut = t.__values__, U5(Bc, n), e.attr(Bc, n, this);
    const i = nW[e.type];
    i && i.call(this, e, t, n), to && this.style(to, n);
  },
  style(e, t) {
    if (t != null) {
      for (const n in $g) {
        let i = n === "font" ? id(t) : t[n];
        if (i === Ut[n])
          continue;
        const r = $g[n];
        i == null ? e.removeAttribute(r) : (z2(i) && (i = l5(i, this._defs.gradient, V5())), e.setAttribute(r, i + "")), Ut[n] = i;
      }
      for (const n in Mg)
        Rh(e, Mg[n], t[n]);
    }
  },
  defs() {
    const e = this._svg, t = this._defs;
    let n = t.el, i = 0;
    for (const r in t.gradient)
      n || (t.el = n = Cn(e, ec + 1, "defs", mt)), i = Qq(n, t.gradient[r], i);
    for (const r in t.clipping)
      n || (t.el = n = Cn(e, ec + 1, "defs", mt)), i = Zq(n, t.clipping[r], i);
    n && (i === 0 ? (e.removeChild(n), t.el = null) : ki(n, i));
  },
  _clearDefs() {
    const e = this._defs;
    e.gradient = {}, e.clipping = {};
  }
});
function uS(e, t) {
  for (; e && e.dirty !== t; e = e.mark.group)
    if (e.dirty = t, e.mark && e.mark.dirty !== t)
      e.mark.dirty = t;
    else
      return;
}
function Qq(e, t, n) {
  let i, r, o;
  if (t.gradient === "radial") {
    let a = Cn(e, n++, "pattern", mt);
    qo(a, {
      id: Eg + t.id,
      viewBox: "0,0,1,1",
      width: "100%",
      height: "100%",
      preserveAspectRatio: "xMidYMid slice"
    }), a = Cn(a, 0, "rect", mt), qo(a, {
      width: 1,
      height: 1,
      fill: "url(".concat(V5(), "#").concat(t.id, ")")
    }), e = Cn(e, n++, "radialGradient", mt), qo(e, {
      id: t.id,
      fx: t.x1,
      fy: t.y1,
      fr: t.r1,
      cx: t.x2,
      cy: t.y2,
      r: t.r2
    });
  } else
    e = Cn(e, n++, "linearGradient", mt), qo(e, {
      id: t.id,
      x1: t.x1,
      x2: t.x2,
      y1: t.y1,
      y2: t.y2
    });
  for (i = 0, r = t.stops.length; i < r; ++i)
    o = Cn(e, i, "stop", mt), o.setAttribute("offset", t.stops[i].offset), o.setAttribute("stop-color", t.stops[i].color);
  return ki(e, i), n;
}
function Zq(e, t, n) {
  let i;
  return e = Cn(e, n, "clipPath", mt), e.setAttribute("id", t.id), t.path ? (i = Cn(e, 0, "path", mt), i.setAttribute("d", t.path)) : (i = Cn(e, 0, "rect", mt), qo(i, {
    x: 0,
    y: 0,
    width: t.width,
    height: t.height
  })), ki(e, 1), n + 1;
}
function eW(e, t, n) {
  t = t.lastChild.previousSibling;
  let i, r = 0;
  qi(n, (o) => {
    i = e.mark(t, o, i), ++r;
  }), ki(t, 1 + r);
}
function lS(e, t, n, i, r) {
  let o = e._svg, a;
  if (!o && (a = t.ownerDocument, o = Uo(a, i, mt), e._svg = o, e.mark && (o.__data__ = e, o.__values__ = {
    fill: "default"
  }, i === "g"))) {
    const s = Uo(a, "path", mt);
    o.appendChild(s), s.__data__ = e;
    const u = Uo(a, "g", mt);
    o.appendChild(u), u.__data__ = e;
    const l = Uo(a, "path", mt);
    o.appendChild(l), l.__data__ = e, l.__values__ = {
      fill: "default"
    };
  }
  return (o.ownerSVGElement !== r || tW(o, n)) && t.insertBefore(o, n ? n.nextSibling : t.firstChild), o;
}
function tW(e, t) {
  return e.parentNode && e.parentNode.childNodes.length > 1 && e.previousSibling != t;
}
let to = null, Ut = null;
const nW = {
  group(e, t, n) {
    const i = to = t.childNodes[2];
    Ut = i.__values__, e.foreground(Bc, n, this), Ut = t.__values__, to = t.childNodes[1], e.content(Bc, n, this);
    const r = to = t.childNodes[0];
    e.background(Bc, n, this);
    const o = n.mark.interactive === !1 ? "none" : null;
    if (o !== Ut.events && (on(i, "pointer-events", o), on(r, "pointer-events", o), Ut.events = o), n.strokeForeground && n.stroke) {
      const a = n.fill;
      on(i, "display", null), this.style(r, n), on(r, "stroke", null), a && (n.fill = null), Ut = i.__values__, this.style(i, n), a && (n.fill = a), to = null;
    } else
      on(i, "display", "none");
  },
  image(e, t, n) {
    n.smooth === !1 ? (Rh(t, "image-rendering", "optimizeSpeed"), Rh(t, "image-rendering", "pixelated")) : Rh(t, "image-rendering", null);
  },
  text(e, t, n) {
    const i = nd(n);
    let r, o, a, s;
    J(i) ? (o = i.map((u) => fa(n, u)), r = o.join(`
`), r !== Ut.text && (ki(t, 0), a = t.ownerDocument, s = ca(n), o.forEach((u, l) => {
      const c = Uo(a, "tspan", mt);
      c.__data__ = n, c.textContent = u, l && (c.setAttribute("x", 0), c.setAttribute("dy", s)), t.appendChild(c);
    }), Ut.text = r)) : (o = fa(n, i), o !== Ut.text && (t.textContent = o, Ut.text = o)), on(t, "font-family", id(n)), on(t, "font-size", Cr(n) + "px"), on(t, "font-style", n.fontStyle), on(t, "font-variant", n.fontVariant), on(t, "font-weight", n.fontWeight);
  }
};
function Bc(e, t, n) {
  t !== Ut[e] && (n ? iW(to, e, t, n) : on(to, e, t), Ut[e] = t);
}
function Rh(e, t, n) {
  n !== Ut[t] && (n == null ? e.style.removeProperty(t) : e.style.setProperty(t, n + ""), Ut[t] = n);
}
function qo(e, t) {
  for (const n in t)
    on(e, n, t[n]);
}
function on(e, t, n) {
  n != null ? e.setAttribute(t, n) : e.removeAttribute(t);
}
function iW(e, t, n, i) {
  n != null ? e.setAttributeNS(i, t, n) : e.removeAttributeNS(i, t);
}
function V5() {
  let e;
  return typeof window > "u" ? "" : (e = window.location).hash ? e.href.slice(0, -e.hash.length) : e.href;
}
function mw(e) {
  Fr.call(this, e), this._text = null, this._defs = {
    gradient: {},
    clipping: {}
  };
}
q(mw, Fr, {
  svg() {
    return this._text;
  },
  _render(e) {
    const t = gw();
    t.open("svg", de({}, ff, {
      class: "marks",
      width: this._width * this._scale,
      height: this._height * this._scale,
      viewBox: "0 0 ".concat(this._width, " ").concat(this._height)
    }));
    const n = this._bgcolor;
    return n && n !== "transparent" && n !== "none" && t.open("rect", {
      width: this._width,
      height: this._height,
      fill: n
    }).close(), t.open("g", X5, {
      transform: "translate(" + this._origin + ")"
    }), this.mark(t, e), t.close(), this.defs(t), this._text = t.close() + "", this;
  },
  mark(e, t) {
    const n = Qn[t.marktype], i = n.tag, r = [U5, n.attr];
    e.open("g", {
      class: N5(t),
      "clip-path": t.clip ? W2(this, t, t.group) : null
    }, q5(t), {
      "pointer-events": i !== "g" && t.interactive === !1 ? "none" : null
    });
    const o = (a) => {
      const s = this.href(a);
      if (s && e.open("a", s), e.open(i, this.attr(t, a, r, i !== "g" ? i : null)), i === "text") {
        const u = nd(a);
        if (J(u)) {
          const l = {
            x: 0,
            dy: ca(a)
          };
          for (let c = 0; c < u.length; ++c)
            e.open("tspan", c ? l : null).text(fa(a, u[c])).close();
        } else
          e.text(fa(a, u));
      } else if (i === "g") {
        const u = a.strokeForeground, l = a.fill, c = a.stroke;
        u && c && (a.stroke = null), e.open("path", this.attr(t, a, n.background, "bgrect")).close(), e.open("g", this.attr(t, a, n.content)), qi(a, (f) => this.mark(e, f)), e.close(), u && c ? (l && (a.fill = null), a.stroke = c, e.open("path", this.attr(t, a, n.foreground, "bgrect")).close(), l && (a.fill = l)) : e.open("path", this.attr(t, a, n.foreground, "bgfore")).close();
      }
      e.close(), s && e.close();
    };
    return n.nested ? t.items && t.items.length && o(t.items[0]) : qi(t, o), e.close();
  },
  href(e) {
    const t = e.href;
    let n;
    if (t) {
      if (n = this._hrefs && this._hrefs[t])
        return n;
      this.sanitizeURL(t).then((i) => {
        i["xlink:href"] = i.href, i.href = null, (this._hrefs || (this._hrefs = {}))[t] = i;
      });
    }
    return null;
  },
  attr(e, t, n, i) {
    const r = {}, o = (a, s, u, l) => {
      r[l || a] = s;
    };
    return Array.isArray(n) ? n.forEach((a) => a(o, t, this)) : n(o, t, this), i && rW(r, t, e, i, this._defs), r;
  },
  defs(e) {
    const t = this._defs.gradient, n = this._defs.clipping;
    if (Object.keys(t).length + Object.keys(n).length !== 0) {
      e.open("defs");
      for (const r in t) {
        const o = t[r], a = o.stops;
        o.gradient === "radial" ? (e.open("pattern", {
          id: Eg + r,
          viewBox: "0,0,1,1",
          width: "100%",
          height: "100%",
          preserveAspectRatio: "xMidYMid slice"
        }), e.open("rect", {
          width: "1",
          height: "1",
          fill: "url(#" + r + ")"
        }).close(), e.close(), e.open("radialGradient", {
          id: r,
          fx: o.x1,
          fy: o.y1,
          fr: o.r1,
          cx: o.x2,
          cy: o.y2,
          r: o.r2
        })) : e.open("linearGradient", {
          id: r,
          x1: o.x1,
          x2: o.x2,
          y1: o.y1,
          y2: o.y2
        });
        for (let s = 0; s < a.length; ++s)
          e.open("stop", {
            offset: a[s].offset,
            "stop-color": a[s].color
          }).close();
        e.close();
      }
      for (const r in n) {
        const o = n[r];
        e.open("clipPath", {
          id: r
        }), o.path ? e.open("path", {
          d: o.path
        }).close() : e.open("rect", {
          x: 0,
          y: 0,
          width: o.width,
          height: o.height
        }).close(), e.close();
      }
      e.close();
    }
  }
});
function rW(e, t, n, i, r) {
  let o;
  if (t == null || (i === "bgrect" && n.interactive === !1 && (e["pointer-events"] = "none"), i === "bgfore" && (n.interactive === !1 && (e["pointer-events"] = "none"), e.display = "none", t.fill !== null)))
    return e;
  i === "image" && t.smooth === !1 && (o = ["image-rendering: optimizeSpeed;", "image-rendering: pixelated;"]), i === "text" && (e["font-family"] = id(t), e["font-size"] = Cr(t) + "px", e["font-style"] = t.fontStyle, e["font-variant"] = t.fontVariant, e["font-weight"] = t.fontWeight);
  for (const a in $g) {
    let s = t[a];
    const u = $g[a];
    s === "transparent" && (u === "fill" || u === "stroke") || s != null && (z2(s) && (s = l5(s, r.gradient, "")), e[u] = s);
  }
  for (const a in Mg) {
    const s = t[a];
    s != null && (o = o || [], o.push("".concat(Mg[a], ": ").concat(s, ";")));
  }
  return o && (e.style = o.join(" ")), e;
}
const K5 = "canvas", J5 = "png", Q5 = "svg", Z5 = "none", Wo = {
  Canvas: K5,
  PNG: J5,
  SVG: Q5,
  None: Z5
}, Zu = {};
Zu[K5] = Zu[J5] = {
  renderer: Dg,
  headless: Dg,
  handler: rd
};
Zu[Q5] = {
  renderer: pw,
  headless: mw,
  handler: lw
};
Zu[Z5] = {};
function Fp(e, t) {
  return e = String(e || "").toLowerCase(), arguments.length > 1 ? (Zu[e] = t, this) : Zu[e];
}
function eT(e, t, n) {
  const i = [], r = new dt().union(t), o = e.marktype;
  return o ? tT(e, r, n, i) : o === "group" ? nT(e, r, n, i) : P("Intersect scene must be mark node or group item.");
}
function tT(e, t, n, i) {
  if (oW(e, t, n)) {
    const r = e.items, o = e.marktype, a = r.length;
    let s = 0;
    if (o === "group")
      for (; s < a; ++s)
        nT(r[s], t, n, i);
    else
      for (const u = Qn[o].isect; s < a; ++s) {
        const l = r[s];
        iT(l, t, u) && i.push(l);
      }
  }
  return i;
}
function oW(e, t, n) {
  return e.bounds && t.intersects(e.bounds) && (e.marktype === "group" || e.interactive !== !1 && (!n || n(e)));
}
function nT(e, t, n, i) {
  n && n(e.mark) && iT(e, t, Qn.group.isect) && i.push(e);
  const r = e.items, o = r && r.length;
  if (o) {
    const a = e.x || 0, s = e.y || 0;
    t.translate(-a, -s);
    for (let u = 0; u < o; ++u)
      tT(r[u], t, n, i);
    t.translate(a, s);
  }
  return i;
}
function iT(e, t, n) {
  const i = e.bounds;
  return t.encloses(i) || t.intersects(i) && n(e, t);
}
const b1 = new dt();
function rT(e) {
  const t = e.clip;
  if (he(t))
    t(ed(b1.clear()));
  else if (t)
    b1.set(0, 0, e.group.width, e.group.height);
  else
    return;
  e.bounds.intersect(b1);
}
const aW = 1e-9;
function yw(e, t, n) {
  return e === t ? !0 : n === "path" ? oT(e, t) : e instanceof Date && t instanceof Date ? +e == +t : na(e) && na(t) ? Math.abs(e - t) <= aW : !e || !t || !ce(e) && !ce(t) ? e == t : sW(e, t);
}
function oT(e, t) {
  return yw(Ku(e), Ku(t));
}
function sW(e, t) {
  var n = Object.keys(e), i = Object.keys(t), r, o;
  if (n.length !== i.length)
    return !1;
  for (n.sort(), i.sort(), o = n.length - 1; o >= 0; o--)
    if (n[o] != i[o])
      return !1;
  for (o = n.length - 1; o >= 0; o--)
    if (r = n[o], !yw(e[r], t[r], r))
      return !1;
  return typeof e == typeof t;
}
function uW() {
  m5(), Tz();
}
const el = "top", Di = "left", Ni = "right", ha = "bottom", lW = "top-left", cW = "top-right", fW = "bottom-left", dW = "bottom-right", vw = "start", gv = "middle", an = "end", hW = "x", gW = "y", kp = "group", bw = "axis", xw = "title", pW = "frame", mW = "scope", ww = "legend", aT = "row-header", sT = "row-footer", uT = "row-title", lT = "column-header", cT = "column-footer", fT = "column-title", yW = "padding", vW = "symbol", dT = "fit", bW = "fit-x", xW = "fit-y", wW = "pad", Ew = "none", Gd = "all", pv = "each", Aw = "flush", Go = "column", Ho = "row";
function hT(e) {
  N.call(this, null, e);
}
q(hT, N, {
  transform(e, t) {
    const n = t.dataflow, i = e.mark, r = i.marktype, o = Qn[r], a = o.bound;
    let s = i.bounds, u;
    if (o.nested)
      i.items.length && n.dirty(i.items[0]), s = Hd(i, a), i.items.forEach((l) => {
        l.bounds.clear().union(s);
      });
    else if (r === kp || e.modified())
      switch (t.visit(t.MOD, (l) => n.dirty(l)), s.clear(), i.items.forEach((l) => s.union(Hd(l, a))), i.role) {
        case bw:
        case ww:
        case xw:
          t.reflow();
      }
    else
      u = t.changed(t.REM), t.visit(t.ADD, (l) => {
        s.union(Hd(l, a));
      }), t.visit(t.MOD, (l) => {
        u = u || s.alignsWith(l.bounds), n.dirty(l), s.union(Hd(l, a));
      }), u && (s.clear(), i.items.forEach((l) => s.union(l.bounds)));
    return rT(i), t.modifies("bounds");
  }
});
function Hd(e, t, n) {
  return t(e.bounds.clear(), e, n);
}
const cS = ":vega_identifier:";
function _w(e) {
  N.call(this, 0, e);
}
_w.Definition = {
  type: "Identifier",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "as",
    type: "string",
    required: !0
  }]
};
q(_w, N, {
  transform(e, t) {
    const n = EW(t.dataflow), i = e.as;
    let r = n.value;
    return t.visit(t.ADD, (o) => o[i] = o[i] || ++r), n.set(this.value = r), t;
  }
});
function EW(e) {
  return e._signals[cS] || (e._signals[cS] = e.add(0));
}
function gT(e) {
  N.call(this, null, e);
}
q(gT, N, {
  transform(e, t) {
    let n = this.value;
    n || (n = t.dataflow.scenegraph().mark(e.markdef, AW(e), e.index), n.group.context = e.context, e.context.group || (e.context.group = n.group), n.source = this.source, n.clip = e.clip, n.interactive = e.interactive, this.value = n);
    const i = n.marktype === kp ? xp : bp;
    return t.visit(t.ADD, (r) => i.call(r, n)), (e.modified("clip") || e.modified("interactive")) && (n.clip = e.clip, n.interactive = !!e.interactive, n.zdirty = !0, t.reflow()), n.items = t.source, t;
  }
});
function AW(e) {
  const t = e.groups, n = e.parent;
  return t && t.size === 1 ? t.get(Object.keys(t.object)[0]) : t && n ? t.lookup(n) : null;
}
function pT(e) {
  N.call(this, null, e);
}
const fS = {
  parity: (e) => e.filter((t, n) => n % 2 ? t.opacity = 0 : 1),
  greedy: (e, t) => {
    let n;
    return e.filter((i, r) => !r || !mT(n.bounds, i.bounds, t) ? (n = i, 1) : i.opacity = 0);
  }
}, mT = (e, t, n) => n > Math.max(t.x1 - e.x2, e.x1 - t.x2, t.y1 - e.y2, e.y1 - t.y2), dS = (e, t) => {
  for (var n = 1, i = e.length, r = e[0].bounds, o; n < i; r = o, ++n)
    if (mT(r, o = e[n].bounds, t))
      return !0;
}, _W = (e) => {
  const t = e.bounds;
  return t.width() > 1 && t.height() > 1;
}, OW = (e, t, n) => {
  var i = e.range(), r = new dt();
  return t === el || t === ha ? r.set(i[0], -1 / 0, i[1], 1 / 0) : r.set(-1 / 0, i[0], 1 / 0, i[1]), r.expand(n || 1), (o) => r.encloses(o.bounds);
}, hS = (e) => (e.forEach((t) => t.opacity = 1), e), gS = (e, t) => e.reflow(t.modified()).modifies("opacity");
q(pT, N, {
  transform(e, t) {
    const n = fS[e.method] || fS.parity, i = e.separation || 0;
    let r = t.materialize(t.SOURCE).source, o, a;
    if (!r || !r.length)
      return;
    if (!e.method)
      return e.modified("method") && (hS(r), t = gS(t, e)), t;
    if (r = r.filter(_W), !r.length)
      return;
    if (e.sort && (r = r.slice().sort(e.sort)), o = hS(r), t = gS(t, e), o.length >= 3 && dS(o, i)) {
      do
        o = n(o, i);
      while (o.length >= 3 && dS(o, i));
      o.length < 3 && !xe(r).opacity && (o.length > 1 && (xe(o).opacity = 0), xe(r).opacity = 1);
    }
    e.boundScale && e.boundTolerance >= 0 && (a = OW(e.boundScale, e.boundOrient, +e.boundTolerance), r.forEach((u) => {
      a(u) || (u.opacity = 0);
    }));
    const s = o[0].mark.bounds.clear();
    return r.forEach((u) => {
      u.opacity && s.union(u.bounds);
    }), t;
  }
});
function yT(e) {
  N.call(this, null, e);
}
q(yT, N, {
  transform(e, t) {
    const n = t.dataflow;
    if (t.visit(t.ALL, (i) => n.dirty(i)), t.fields && t.fields.zindex) {
      const i = t.source && t.source[0];
      i && (i.mark.zdirty = !0);
    }
  }
});
const zt = new dt();
function Ou(e, t, n) {
  return e[t] === n ? 0 : (e[t] = n, 1);
}
function SW(e) {
  var t = e.items[0].orient;
  return t === Di || t === Ni;
}
function CW(e) {
  let t = +e.grid;
  return [
    e.ticks ? t++ : -1,
    e.labels ? t++ : -1,
    t + +e.domain
  ];
}
function FW(e, t, n, i) {
  var r = t.items[0], o = r.datum, a = r.translate != null ? r.translate : 0.5, s = r.orient, u = CW(o), l = r.range, c = r.offset, f = r.position, d = r.minExtent, h = r.maxExtent, g = o.title && r.items[u[2]].items[0], p = r.titlePadding, m = r.bounds, y = g && rw(g), v = 0, b = 0, x, E;
  switch (zt.clear().union(m), m.clear(), (x = u[0]) > -1 && m.union(r.items[x].bounds), (x = u[1]) > -1 && m.union(r.items[x].bounds), s) {
    case el:
      v = f || 0, b = -c, E = Math.max(d, Math.min(h, -m.y1)), m.add(0, -E).add(l, 0), g && Yd(e, g, E, p, y, 0, -1, m);
      break;
    case Di:
      v = -c, b = f || 0, E = Math.max(d, Math.min(h, -m.x1)), m.add(-E, 0).add(0, l), g && Yd(e, g, E, p, y, 1, -1, m);
      break;
    case Ni:
      v = n + c, b = f || 0, E = Math.max(d, Math.min(h, m.x2)), m.add(0, 0).add(E, l), g && Yd(e, g, E, p, y, 1, 1, m);
      break;
    case ha:
      v = f || 0, b = i + c, E = Math.max(d, Math.min(h, m.y2)), m.add(0, 0).add(l, E), g && Yd(e, g, E, p, 0, 0, 1, m);
      break;
    default:
      v = r.x, b = r.y;
  }
  return yo(m.translate(v, b), r), Ou(r, "x", v + a) | Ou(r, "y", b + a) && (r.bounds = zt, e.dirty(r), r.bounds = m, e.dirty(r)), r.mark.bounds.clear().union(m);
}
function Yd(e, t, n, i, r, o, a, s) {
  const u = t.bounds;
  if (t.auto) {
    const l = a * (n + r + i);
    let c = 0, f = 0;
    e.dirty(t), o ? c = (t.x || 0) - (t.x = l) : f = (t.y || 0) - (t.y = l), t.mark.bounds.clear().union(u.translate(-c, -f)), e.dirty(t);
  }
  s.union(u);
}
const pS = (e, t) => Math.floor(Math.min(e, t)), mS = (e, t) => Math.ceil(Math.max(e, t));
function kW(e) {
  var t = e.items, n = t.length, i = 0, r, o;
  const a = {
    marks: [],
    rowheaders: [],
    rowfooters: [],
    colheaders: [],
    colfooters: [],
    rowtitle: null,
    coltitle: null
  };
  for (; i < n; ++i)
    if (r = t[i], o = r.items, r.marktype === kp)
      switch (r.role) {
        case bw:
        case ww:
        case xw:
          break;
        case aT:
          a.rowheaders.push(...o);
          break;
        case sT:
          a.rowfooters.push(...o);
          break;
        case lT:
          a.colheaders.push(...o);
          break;
        case cT:
          a.colfooters.push(...o);
          break;
        case uT:
          a.rowtitle = o[0];
          break;
        case fT:
          a.coltitle = o[0];
          break;
        default:
          a.marks.push(...o);
      }
  return a;
}
function DW(e) {
  return new dt().set(0, 0, e.width || 0, e.height || 0);
}
function $W(e) {
  const t = e.bounds.clone();
  return t.empty() ? t.set(0, 0, 0, 0) : t.translate(-(e.x || 0), -(e.y || 0));
}
function Ke(e, t, n) {
  const i = ce(e) ? e[t] : e;
  return i != null ? i : n !== void 0 ? n : 0;
}
function yS(e) {
  return e < 0 ? Math.ceil(-e) : 0;
}
function vT(e, t, n) {
  var i = !n.nodirty, r = n.bounds === Aw ? DW : $W, o = zt.set(0, 0, 0, 0), a = Ke(n.align, Go), s = Ke(n.align, Ho), u = Ke(n.padding, Go), l = Ke(n.padding, Ho), c = n.columns || t.length, f = c <= 0 ? 1 : Math.ceil(t.length / c), d = t.length, h = Array(d), g = Array(c), p = 0, m = Array(d), y = Array(f), v = 0, b = Array(d), x = Array(d), E = Array(d), A, w, _, k, C, O, S, D, M, F, $;
  for (w = 0; w < c; ++w)
    g[w] = 0;
  for (w = 0; w < f; ++w)
    y[w] = 0;
  for (w = 0; w < d; ++w)
    O = t[w], C = E[w] = r(O), O.x = O.x || 0, b[w] = 0, O.y = O.y || 0, x[w] = 0, _ = w % c, k = ~~(w / c), p = Math.max(p, S = Math.ceil(C.x2)), v = Math.max(v, D = Math.ceil(C.y2)), g[_] = Math.max(g[_], S), y[k] = Math.max(y[k], D), h[w] = u + yS(C.x1), m[w] = l + yS(C.y1), i && e.dirty(t[w]);
  for (w = 0; w < d; ++w)
    w % c === 0 && (h[w] = 0), w < c && (m[w] = 0);
  if (a === pv)
    for (_ = 1; _ < c; ++_) {
      for ($ = 0, w = _; w < d; w += c)
        $ < h[w] && ($ = h[w]);
      for (w = _; w < d; w += c)
        h[w] = $ + g[_ - 1];
    }
  else if (a === Gd) {
    for ($ = 0, w = 0; w < d; ++w)
      w % c && $ < h[w] && ($ = h[w]);
    for (w = 0; w < d; ++w)
      w % c && (h[w] = $ + p);
  } else
    for (a = !1, _ = 1; _ < c; ++_)
      for (w = _; w < d; w += c)
        h[w] += g[_ - 1];
  if (s === pv)
    for (k = 1; k < f; ++k) {
      for ($ = 0, w = k * c, A = w + c; w < A; ++w)
        $ < m[w] && ($ = m[w]);
      for (w = k * c; w < A; ++w)
        m[w] = $ + y[k - 1];
    }
  else if (s === Gd) {
    for ($ = 0, w = c; w < d; ++w)
      $ < m[w] && ($ = m[w]);
    for (w = c; w < d; ++w)
      m[w] = $ + v;
  } else
    for (s = !1, k = 1; k < f; ++k)
      for (w = k * c, A = w + c; w < A; ++w)
        m[w] += y[k - 1];
  for (M = 0, w = 0; w < d; ++w)
    M = h[w] + (w % c ? M : 0), b[w] += M - t[w].x;
  for (_ = 0; _ < c; ++_)
    for (F = 0, w = _; w < d; w += c)
      F += m[w], x[w] += F - t[w].y;
  if (a && Ke(n.center, Go) && f > 1)
    for (w = 0; w < d; ++w)
      C = a === Gd ? p : g[w % c], M = C - E[w].x2 - t[w].x - b[w], M > 0 && (b[w] += M / 2);
  if (s && Ke(n.center, Ho) && c !== 1)
    for (w = 0; w < d; ++w)
      C = s === Gd ? v : y[~~(w / c)], F = C - E[w].y2 - t[w].y - x[w], F > 0 && (x[w] += F / 2);
  for (w = 0; w < d; ++w)
    o.union(E[w].translate(b[w], x[w]));
  switch (M = Ke(n.anchor, hW), F = Ke(n.anchor, gW), Ke(n.anchor, Go)) {
    case an:
      M -= o.width();
      break;
    case gv:
      M -= o.width() / 2;
  }
  switch (Ke(n.anchor, Ho)) {
    case an:
      F -= o.height();
      break;
    case gv:
      F -= o.height() / 2;
  }
  for (M = Math.round(M), F = Math.round(F), o.clear(), w = 0; w < d; ++w)
    t[w].mark.bounds.clear();
  for (w = 0; w < d; ++w)
    O = t[w], O.x += b[w] += M, O.y += x[w] += F, o.union(O.mark.bounds.union(O.bounds.translate(b[w], x[w]))), i && e.dirty(O);
  return o;
}
function MW(e, t, n) {
  var i = kW(t), r = i.marks, o = n.bounds === Aw ? TW : NW, a = n.offset, s = n.columns || r.length, u = s <= 0 ? 1 : Math.ceil(r.length / s), l = u * s, c, f, d, h, g, p, m;
  const y = vT(e, r, n);
  y.empty() && y.set(0, 0, 0, 0), i.rowheaders && (p = Ke(n.headerBand, Ho, null), c = Xd(e, i.rowheaders, r, s, u, -Ke(a, "rowHeader"), pS, 0, o, "x1", 0, s, 1, p)), i.colheaders && (p = Ke(n.headerBand, Go, null), f = Xd(e, i.colheaders, r, s, s, -Ke(a, "columnHeader"), pS, 1, o, "y1", 0, 1, s, p)), i.rowfooters && (p = Ke(n.footerBand, Ho, null), d = Xd(e, i.rowfooters, r, s, u, Ke(a, "rowFooter"), mS, 0, o, "x2", s - 1, s, 1, p)), i.colfooters && (p = Ke(n.footerBand, Go, null), h = Xd(e, i.colfooters, r, s, s, Ke(a, "columnFooter"), mS, 1, o, "y2", l - s, 1, s, p)), i.rowtitle && (g = Ke(n.titleAnchor, Ho), m = Ke(a, "rowTitle"), m = g === an ? d + m : c - m, p = Ke(n.titleBand, Ho, 0.5), vS(e, i.rowtitle, m, 0, y, p)), i.coltitle && (g = Ke(n.titleAnchor, Go), m = Ke(a, "columnTitle"), m = g === an ? h + m : f - m, p = Ke(n.titleBand, Go, 0.5), vS(e, i.coltitle, m, 1, y, p));
}
function TW(e, t) {
  return t === "x1" ? e.x || 0 : t === "y1" ? e.y || 0 : t === "x2" ? (e.x || 0) + (e.width || 0) : t === "y2" ? (e.y || 0) + (e.height || 0) : void 0;
}
function NW(e, t) {
  return e.bounds[t];
}
function Xd(e, t, n, i, r, o, a, s, u, l, c, f, d, h) {
  var g = n.length, p = 0, m = 0, y, v, b, x, E, A, w, _, k;
  if (!g)
    return p;
  for (y = c; y < g; y += f)
    n[y] && (p = a(p, u(n[y], l)));
  if (!t.length)
    return p;
  for (t.length > r && (e.warn("Grid headers exceed limit: " + r), t = t.slice(0, r)), p += o, v = 0, x = t.length; v < x; ++v)
    e.dirty(t[v]), t[v].mark.bounds.clear();
  for (y = c, v = 0, x = t.length; v < x; ++v, y += f) {
    for (A = t[v], E = A.mark.bounds, b = y; b >= 0 && (w = n[b]) == null; b -= d)
      ;
    s ? (_ = h == null ? w.x : Math.round(w.bounds.x1 + h * w.bounds.width()), k = p) : (_ = p, k = h == null ? w.y : Math.round(w.bounds.y1 + h * w.bounds.height())), E.union(A.bounds.translate(_ - (A.x || 0), k - (A.y || 0))), A.x = _, A.y = k, e.dirty(A), m = a(m, E[l]);
  }
  return m;
}
function vS(e, t, n, i, r, o) {
  if (!!t) {
    e.dirty(t);
    var a = n, s = n;
    i ? a = Math.round(r.x1 + o * r.width()) : s = Math.round(r.y1 + o * r.height()), t.bounds.translate(a - (t.x || 0), s - (t.y || 0)), t.mark.bounds.clear().union(t.bounds), t.x = a, t.y = s, e.dirty(t);
  }
}
function RW(e, t) {
  const n = e[t] || {};
  return (i, r) => n[i] != null ? n[i] : e[i] != null ? e[i] : r;
}
function jW(e, t) {
  let n = -1 / 0;
  return e.forEach((i) => {
    i.offset != null && (n = Math.max(n, i.offset));
  }), n > -1 / 0 ? n : t;
}
function PW(e, t, n, i, r, o, a) {
  const s = RW(n, t), u = jW(e, s("offset", 0)), l = s("anchor", vw), c = l === an ? 1 : l === gv ? 0.5 : 0, f = {
    align: pv,
    bounds: s("bounds", Aw),
    columns: s("direction") === "vertical" ? 1 : e.length,
    padding: s("margin", 8),
    center: s("center"),
    nodirty: !0
  };
  switch (t) {
    case Di:
      f.anchor = {
        x: Math.floor(i.x1) - u,
        column: an,
        y: c * (a || i.height() + 2 * i.y1),
        row: l
      };
      break;
    case Ni:
      f.anchor = {
        x: Math.ceil(i.x2) + u,
        y: c * (a || i.height() + 2 * i.y1),
        row: l
      };
      break;
    case el:
      f.anchor = {
        y: Math.floor(r.y1) - u,
        row: an,
        x: c * (o || r.width() + 2 * r.x1),
        column: l
      };
      break;
    case ha:
      f.anchor = {
        y: Math.ceil(r.y2) + u,
        x: c * (o || r.width() + 2 * r.x1),
        column: l
      };
      break;
    case lW:
      f.anchor = {
        x: u,
        y: u
      };
      break;
    case cW:
      f.anchor = {
        x: o - u,
        y: u,
        column: an
      };
      break;
    case fW:
      f.anchor = {
        x: u,
        y: a - u,
        row: an
      };
      break;
    case dW:
      f.anchor = {
        x: o - u,
        y: a - u,
        column: an,
        row: an
      };
      break;
  }
  return f;
}
function LW(e, t) {
  var n = t.items[0], i = n.datum, r = n.orient, o = n.bounds, a = n.x, s = n.y, u, l;
  return n._bounds ? n._bounds.clear().union(o) : n._bounds = o.clone(), o.clear(), BW(e, n, n.items[0].items[0]), o = IW(n, o), u = 2 * n.padding, l = 2 * n.padding, o.empty() || (u = Math.ceil(o.width() + u), l = Math.ceil(o.height() + l)), i.type === vW && zW(n.items[0].items[0].items[0].items), r !== Ew && (n.x = a = 0, n.y = s = 0), n.width = u, n.height = l, yo(o.set(a, s, a + u, s + l), n), n.mark.bounds.clear().union(o), n;
}
function IW(e, t) {
  return e.items.forEach((n) => t.union(n.bounds)), t.x1 = e.padding, t.y1 = e.padding, t;
}
function BW(e, t, n) {
  var i = t.padding, r = i - n.x, o = i - n.y;
  if (!t.datum.title)
    (r || o) && tc(e, n, r, o);
  else {
    var a = t.items[1].items[0], s = a.anchor, u = t.titlePadding || 0, l = i - a.x, c = i - a.y;
    switch (a.orient) {
      case Di:
        r += Math.ceil(a.bounds.width()) + u;
        break;
      case Ni:
      case ha:
        break;
      default:
        o += a.bounds.height() + u;
    }
    switch ((r || o) && tc(e, n, r, o), a.orient) {
      case Di:
        c += fu(t, n, a, s, 1, 1);
        break;
      case Ni:
        l += fu(t, n, a, an, 0, 0) + u, c += fu(t, n, a, s, 1, 1);
        break;
      case ha:
        l += fu(t, n, a, s, 0, 0), c += fu(t, n, a, an, -1, 0, 1) + u;
        break;
      default:
        l += fu(t, n, a, s, 0, 0);
    }
    (l || c) && tc(e, a, l, c), (l = Math.round(a.bounds.x1 - i)) < 0 && (tc(e, n, -l, 0), tc(e, a, -l, 0));
  }
}
function fu(e, t, n, i, r, o, a) {
  const s = e.datum.type !== "symbol", u = n.datum.vgrad, l = s && (o || !u) && !a ? t.items[0] : t, c = l.bounds[r ? "y2" : "x2"] - e.padding, f = u && o ? c : 0, d = u && o ? 0 : c, h = r <= 0 ? 0 : rw(n);
  return Math.round(i === vw ? f : i === an ? d - h : 0.5 * (c - h));
}
function tc(e, t, n, i) {
  t.x += n, t.y += i, t.bounds.translate(n, i), t.mark.bounds.translate(n, i), e.dirty(t);
}
function zW(e) {
  const t = e.reduce((n, i) => (n[i.column] = Math.max(i.bounds.x2 - i.x, n[i.column] || 0), n), {});
  e.forEach((n) => {
    n.width = t[n.column], n.height = n.bounds.y2 - n.y;
  });
}
function UW(e, t, n, i, r) {
  var o = t.items[0], a = o.frame, s = o.orient, u = o.anchor, l = o.offset, c = o.padding, f = o.items[0].items[0], d = o.items[1] && o.items[1].items[0], h = s === Di || s === Ni ? i : n, g = 0, p = 0, m = 0, y = 0, v = 0, b;
  if (a !== kp ? s === Di ? (g = r.y2, h = r.y1) : s === Ni ? (g = r.y1, h = r.y2) : (g = r.x1, h = r.x2) : s === Di && (g = i, h = 0), b = u === vw ? g : u === an ? h : (g + h) / 2, d && d.text) {
    switch (s) {
      case el:
      case ha:
        v = f.bounds.height() + c;
        break;
      case Di:
        y = f.bounds.width() + c;
        break;
      case Ni:
        y = -f.bounds.width() - c;
        break;
    }
    zt.clear().union(d.bounds), zt.translate(y - (d.x || 0), v - (d.y || 0)), Ou(d, "x", y) | Ou(d, "y", v) && (e.dirty(d), d.bounds.clear().union(zt), d.mark.bounds.clear().union(zt), e.dirty(d)), zt.clear().union(d.bounds);
  } else
    zt.clear();
  switch (zt.union(f.bounds), s) {
    case el:
      p = b, m = r.y1 - zt.height() - l;
      break;
    case Di:
      p = r.x1 - zt.width() - l, m = b;
      break;
    case Ni:
      p = r.x2 + zt.width() + l, m = b;
      break;
    case ha:
      p = b, m = r.y2 + l;
      break;
    default:
      p = o.x, m = o.y;
  }
  return Ou(o, "x", p) | Ou(o, "y", m) && (zt.translate(p, m), e.dirty(o), o.bounds.clear().union(zt), t.bounds.clear().union(zt), e.dirty(o)), o.bounds;
}
function bT(e) {
  N.call(this, null, e);
}
q(bT, N, {
  transform(e, t) {
    const n = t.dataflow;
    return e.mark.items.forEach((i) => {
      e.layout && MW(n, i, e.layout), WW(n, i, e);
    }), qW(e.mark.group) ? t.reflow() : t;
  }
});
function qW(e) {
  return e && e.mark.role !== "legend-entry";
}
function WW(e, t, n) {
  var i = t.items, r = Math.max(0, t.width || 0), o = Math.max(0, t.height || 0), a = new dt().set(0, 0, r, o), s = a.clone(), u = a.clone(), l = [], c, f, d, h, g, p;
  for (g = 0, p = i.length; g < p; ++g)
    switch (f = i[g], f.role) {
      case bw:
        h = SW(f) ? s : u, h.union(FW(e, f, r, o));
        break;
      case xw:
        c = f;
        break;
      case ww:
        l.push(LW(e, f));
        break;
      case pW:
      case mW:
      case aT:
      case sT:
      case uT:
      case lT:
      case cT:
      case fT:
        s.union(f.bounds), u.union(f.bounds);
        break;
      default:
        a.union(f.bounds);
    }
  if (l.length) {
    const m = {};
    l.forEach((y) => {
      d = y.orient || Ni, d !== Ew && (m[d] || (m[d] = [])).push(y);
    });
    for (const y in m) {
      const v = m[y];
      vT(e, v, PW(v, y, n.legends, s, u, r, o));
    }
    l.forEach((y) => {
      const v = y.bounds;
      if (v.equals(y._bounds) || (y.bounds = y._bounds, e.dirty(y), y.bounds = v, e.dirty(y)), n.autosize && n.autosize.type === dT)
        switch (y.orient) {
          case Di:
          case Ni:
            a.add(v.x1, 0).add(v.x2, 0);
            break;
          case el:
          case ha:
            a.add(0, v.y1).add(0, v.y2);
        }
      else
        a.union(v);
    });
  }
  a.union(s).union(u), c && a.union(UW(e, c, r, o, a)), t.clip && a.set(0, 0, t.width || 0, t.height || 0), GW(e, t, a, n);
}
function GW(e, t, n, i) {
  const r = i.autosize || {}, o = r.type;
  if (e._autosize < 1 || !o)
    return;
  let a = e._width, s = e._height, u = Math.max(0, t.width || 0), l = Math.max(0, Math.ceil(-n.x1)), c = Math.max(0, t.height || 0), f = Math.max(0, Math.ceil(-n.y1));
  const d = Math.max(0, Math.ceil(n.x2 - u)), h = Math.max(0, Math.ceil(n.y2 - c));
  if (r.contains === yW) {
    const g = e.padding();
    a -= g.left + g.right, s -= g.top + g.bottom;
  }
  o === Ew ? (l = 0, f = 0, u = a, c = s) : o === dT ? (u = Math.max(0, a - l - d), c = Math.max(0, s - f - h)) : o === bW ? (u = Math.max(0, a - l - d), s = c + f + h) : o === xW ? (a = u + l + d, c = Math.max(0, s - f - h)) : o === wW && (a = u + l + d, s = c + f + h), e._resizeView(a, s, u, c, [l, f], r.resize);
}
const HW = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  bound: hT,
  identifier: _w,
  mark: gT,
  overlap: pT,
  render: yT,
  viewlayout: bT
}, Symbol.toStringTag, { value: "Module" }));
function xT(e) {
  N.call(this, null, e);
}
q(xT, N, {
  transform(e, t) {
    if (this.value && !e.modified())
      return t.StopPropagation;
    var n = t.dataflow.locale(), i = t.fork(t.NO_SOURCE | t.NO_FIELDS), r = this.value, o = e.scale, a = e.count == null ? e.values ? e.values.length : 10 : e.count, s = I2(o, a, e.minstep), u = e.format || n5(n, o, s, e.formatSpecifier, e.formatType, !!e.values), l = e.values ? t5(o, e.values, s) : B2(o, s);
    return r && (i.rem = r), r = l.map((c, f) => Te({
      index: f / (l.length - 1 || 1),
      value: c,
      label: u(c)
    })), e.extra && r.length && r.push(Te({
      index: -1,
      extra: {
        value: r[0].value
      },
      label: ""
    })), i.source = r, i.add = r, this.value = r, i;
  }
});
function wT(e) {
  N.call(this, null, e);
}
function YW() {
  return Te({});
}
function XW(e) {
  const t = bl().test((n) => n.exit);
  return t.lookup = (n) => t.get(e(n)), t;
}
q(wT, N, {
  transform(e, t) {
    var n = t.dataflow, i = t.fork(t.NO_SOURCE | t.NO_FIELDS), r = e.item || YW, o = e.key || Z, a = this.value;
    return J(i.encode) && (i.encode = null), a && (e.modified("key") || t.modified(o)) && P("DataJoin does not support modified key function or fields."), a || (t = t.addAll(), this.value = a = XW(o)), t.visit(t.ADD, (s) => {
      const u = o(s);
      let l = a.get(u);
      l ? l.exit ? (a.empty--, i.add.push(l)) : i.mod.push(l) : (l = r(s), a.set(u, l), i.add.push(l)), l.datum = s, l.exit = !1;
    }), t.visit(t.MOD, (s) => {
      const u = o(s), l = a.get(u);
      l && (l.datum = s, i.mod.push(l));
    }), t.visit(t.REM, (s) => {
      const u = o(s), l = a.get(u);
      s === l.datum && !l.exit && (i.rem.push(l), l.exit = !0, ++a.empty);
    }), t.changed(t.ADD_MOD) && i.modifies("datum"), (t.clean() || e.clean && a.empty > n.cleanThreshold) && n.runAfter(a.clean), i;
  }
});
function ET(e) {
  N.call(this, null, e);
}
q(ET, N, {
  transform(e, t) {
    var n = t.fork(t.ADD_REM), i = e.mod || !1, r = e.encoders, o = t.encode;
    if (J(o))
      if (n.changed() || o.every((f) => r[f]))
        o = o[0], n.encode = null;
      else
        return t.StopPropagation;
    var a = o === "enter", s = r.update || ko, u = r.enter || ko, l = r.exit || ko, c = (o && !a ? r[o] : s) || ko;
    if (t.changed(t.ADD) && (t.visit(t.ADD, (f) => {
      u(f, e), s(f, e);
    }), n.modifies(u.output), n.modifies(s.output), c !== ko && c !== s && (t.visit(t.ADD, (f) => {
      c(f, e);
    }), n.modifies(c.output))), t.changed(t.REM) && l !== ko && (t.visit(t.REM, (f) => {
      l(f, e);
    }), n.modifies(l.output)), a || c !== ko) {
      const f = t.MOD | (e.modified() ? t.REFLOW : 0);
      a ? (t.visit(f, (d) => {
        const h = u(d, e) || i;
        (c(d, e) || h) && n.mod.push(d);
      }), n.mod.length && n.modifies(u.output)) : t.visit(f, (d) => {
        (c(d, e) || i) && n.mod.push(d);
      }), n.mod.length && n.modifies(c.output);
    }
    return n.changed() ? n : t.StopPropagation;
  }
});
function AT(e) {
  N.call(this, [], e);
}
q(AT, N, {
  transform(e, t) {
    if (this.value != null && !e.modified())
      return t.StopPropagation;
    var n = t.dataflow.locale(), i = t.fork(t.NO_SOURCE | t.NO_FIELDS), r = this.value, o = e.type || Fh, a = e.scale, s = +e.limit, u = I2(a, e.count == null ? 5 : e.count, e.minstep), l = !!e.values || o === Fh, c = e.format || a5(n, a, u, o, e.formatSpecifier, e.formatType, l), f = e.values || o5(a, u), d, h, g, p, m;
    return r && (i.rem = r), o === Fh ? (s && f.length > s ? (t.dataflow.warn("Symbol legend count exceeds limit, filtering items."), r = f.slice(0, s - 1), m = !0) : r = f, he(g = e.size) ? (!e.values && a(r[0]) === 0 && (r = r.slice(1)), p = r.reduce((y, v) => Math.max(y, g(v, e)), 0)) : g = Zt(p = g || 8), r = r.map((y, v) => Te({
      index: v,
      label: c(y, v, r),
      value: y,
      offset: p,
      size: g(y, e)
    })), m && (m = f[r.length], r.push(Te({
      index: r.length,
      label: "\u2026".concat(f.length - r.length, " entries"),
      value: m,
      offset: p,
      size: g(m, e)
    })))) : o === xz ? (d = a.domain(), h = QM(a, d[0], xe(d)), f.length < 3 && !e.values && d[0] !== xe(d) && (f = [d[0], xe(d)]), r = f.map((y, v) => Te({
      index: v,
      label: c(y, v, f),
      value: y,
      perc: h(y)
    }))) : (g = f.length - 1, h = $z(a), r = f.map((y, v) => Te({
      index: v,
      label: c(y, v, f),
      value: y,
      perc: v ? h(y) : 0,
      perc2: v === g ? 1 : h(f[v + 1])
    }))), i.source = r, i.add = r, this.value = r, i;
  }
});
const VW = (e) => e.source.x, KW = (e) => e.source.y, JW = (e) => e.target.x, QW = (e) => e.target.y;
function Ow(e) {
  N.call(this, {}, e);
}
Ow.Definition = {
  type: "LinkPath",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "sourceX",
    type: "field",
    default: "source.x"
  }, {
    name: "sourceY",
    type: "field",
    default: "source.y"
  }, {
    name: "targetX",
    type: "field",
    default: "target.x"
  }, {
    name: "targetY",
    type: "field",
    default: "target.y"
  }, {
    name: "orient",
    type: "enum",
    default: "vertical",
    values: ["horizontal", "vertical", "radial"]
  }, {
    name: "shape",
    type: "enum",
    default: "line",
    values: ["line", "arc", "curve", "diagonal", "orthogonal"]
  }, {
    name: "require",
    type: "signal"
  }, {
    name: "as",
    type: "string",
    default: "path"
  }]
};
q(Ow, N, {
  transform(e, t) {
    var n = e.sourceX || VW, i = e.sourceY || KW, r = e.targetX || JW, o = e.targetY || QW, a = e.as || "path", s = e.orient || "vertical", u = e.shape || "line", l = bS.get(u + "-" + s) || bS.get(u);
    return l || P("LinkPath unsupported type: " + e.shape + (e.orient ? "-" + e.orient : "")), t.visit(t.SOURCE, (c) => {
      c[a] = l(n(c), i(c), r(c), o(c));
    }), t.reflow(e.modified()).modifies(a);
  }
});
const _T = (e, t, n, i) => "M" + e + "," + t + "L" + n + "," + i, ZW = (e, t, n, i) => _T(t * Math.cos(e), t * Math.sin(e), i * Math.cos(n), i * Math.sin(n)), OT = (e, t, n, i) => {
  var r = n - e, o = i - t, a = Math.sqrt(r * r + o * o) / 2, s = 180 * Math.atan2(o, r) / Math.PI;
  return "M" + e + "," + t + "A" + a + "," + a + " " + s + " 0 1 " + n + "," + i;
}, eG = (e, t, n, i) => OT(t * Math.cos(e), t * Math.sin(e), i * Math.cos(n), i * Math.sin(n)), ST = (e, t, n, i) => {
  const r = n - e, o = i - t, a = 0.2 * (r + o), s = 0.2 * (o - r);
  return "M" + e + "," + t + "C" + (e + a) + "," + (t + s) + " " + (n + s) + "," + (i - a) + " " + n + "," + i;
}, tG = (e, t, n, i) => ST(t * Math.cos(e), t * Math.sin(e), i * Math.cos(n), i * Math.sin(n)), nG = (e, t, n, i) => "M" + e + "," + t + "V" + i + "H" + n, iG = (e, t, n, i) => "M" + e + "," + t + "H" + n + "V" + i, rG = (e, t, n, i) => {
  const r = Math.cos(e), o = Math.sin(e), a = Math.cos(n), s = Math.sin(n), u = Math.abs(n - e) > Math.PI ? n <= e : n > e;
  return "M" + t * r + "," + t * o + "A" + t + "," + t + " 0 0," + (u ? 1 : 0) + " " + t * a + "," + t * s + "L" + i * a + "," + i * s;
}, oG = (e, t, n, i) => {
  const r = (e + n) / 2;
  return "M" + e + "," + t + "C" + r + "," + t + " " + r + "," + i + " " + n + "," + i;
}, aG = (e, t, n, i) => {
  const r = (t + i) / 2;
  return "M" + e + "," + t + "C" + e + "," + r + " " + n + "," + r + " " + n + "," + i;
}, sG = (e, t, n, i) => {
  const r = Math.cos(e), o = Math.sin(e), a = Math.cos(n), s = Math.sin(n), u = (t + i) / 2;
  return "M" + t * r + "," + t * o + "C" + u * r + "," + u * o + " " + u * a + "," + u * s + " " + i * a + "," + i * s;
}, bS = bl({
  line: _T,
  "line-radial": ZW,
  arc: OT,
  "arc-radial": eG,
  curve: ST,
  "curve-radial": tG,
  "orthogonal-horizontal": nG,
  "orthogonal-vertical": iG,
  "orthogonal-radial": rG,
  "diagonal-horizontal": oG,
  "diagonal-vertical": aG,
  "diagonal-radial": sG
});
function Sw(e) {
  N.call(this, null, e);
}
Sw.Definition = {
  type: "Pie",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "field",
    type: "field"
  }, {
    name: "startAngle",
    type: "number",
    default: 0
  }, {
    name: "endAngle",
    type: "number",
    default: 6.283185307179586
  }, {
    name: "sort",
    type: "boolean",
    default: !1
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: 2,
    default: ["startAngle", "endAngle"]
  }]
};
q(Sw, N, {
  transform(e, t) {
    var n = e.as || ["startAngle", "endAngle"], i = n[0], r = n[1], o = e.field || vl, a = e.startAngle || 0, s = e.endAngle != null ? e.endAngle : 2 * Math.PI, u = t.source, l = u.map(o), c = l.length, f = a, d = (s - a) / WD(l), h = Hn(c), g, p, m;
    for (e.sort && h.sort((y, v) => l[y] - l[v]), g = 0; g < c; ++g)
      m = l[h[g]], p = u[h[g]], p[i] = f, p[r] = f += m * d;
    return this.value = l, t.reflow(e.modified()).modifies(n);
  }
});
const uG = 5;
function lG(e) {
  const t = e.type;
  return !e.bins && (t === Yu || t === Yf || t === Xf);
}
function CT(e) {
  return j2(e) && e !== gr;
}
const cG = zi(["set", "modified", "clear", "type", "scheme", "schemeExtent", "schemeCount", "domain", "domainMin", "domainMid", "domainMax", "domainRaw", "domainImplicit", "nice", "zero", "bins", "range", "rangeStep", "round", "reverse", "interpolate", "interpolateGamma"]);
function FT(e) {
  N.call(this, null, e), this.modified(!0);
}
q(FT, N, {
  transform(e, t) {
    var n = t.dataflow, i = this.value, r = fG(e);
    (!i || r !== i.type) && (this.value = i = De(r)());
    for (r in e)
      if (!cG[r]) {
        if (r === "padding" && CT(i.type))
          continue;
        he(i[r]) ? i[r](e[r]) : n.warn("Unsupported scale property: " + r);
      }
    return yG(i, e, mG(i, e, hG(i, e, n))), t.fork(t.NO_SOURCE | t.NO_FIELDS);
  }
});
function fG(e) {
  var t = e.type, n = "", i;
  return t === gr ? gr + "-" + Yu : (dG(e) && (i = e.rawDomain ? e.rawDomain.length : e.domain ? e.domain.length + +(e.domainMid != null) : 0, n = i === 2 ? gr + "-" : i === 3 ? Sl + "-" : ""), (n + t || Yu).toLowerCase());
}
function dG(e) {
  const t = e.type;
  return j2(t) && t !== As && t !== _s && (e.scheme || e.range && e.range.length && e.range.every(je));
}
function hG(e, t, n) {
  const i = gG(e, t.domainRaw, n);
  if (i > -1)
    return i;
  var r = t.domain, o = e.type, a = t.zero || t.zero === void 0 && lG(e), s, u;
  if (!r)
    return 0;
  if (CT(o) && t.padding && r[0] !== xe(r) && (r = pG(o, r, t.range, t.padding, t.exponent, t.constant)), (a || t.domainMin != null || t.domainMax != null || t.domainMid != null) && (s = (r = r.slice()).length - 1 || 1, a && (r[0] > 0 && (r[0] = 0), r[s] < 0 && (r[s] = 0)), t.domainMin != null && (r[0] = t.domainMin), t.domainMax != null && (r[s] = t.domainMax), t.domainMid != null)) {
    u = t.domainMid;
    const l = u > r[s] ? s + 1 : u < r[0] ? 0 : s;
    l !== s && n.warn("Scale domainMid exceeds domain min or max.", u), r.splice(l, 0, u);
  }
  return e.domain(kT(o, r, n)), o === M2 && e.unknown(t.domainImplicit ? Xy : void 0), t.nice && e.nice && e.nice(t.nice !== !0 && I2(e, t.nice) || null), r.length;
}
function gG(e, t, n) {
  return t ? (e.domain(kT(e.type, t, n)), t.length) : -1;
}
function pG(e, t, n, i, r, o) {
  var a = Math.abs(xe(n) - n[0]), s = a / (a - 2 * i), u = e === fo ? Xb(t, null, s) : e === Xf ? tg(t, null, s, 0.5) : e === Yf ? tg(t, null, s, r || 1) : e === gp ? Vb(t, null, s, o || 1) : Yb(t, null, s);
  return t = t.slice(), t[0] = u[0], t[t.length - 1] = u[1], t;
}
function kT(e, t, n) {
  if (YM(e)) {
    var i = Math.abs(t.reduce((r, o) => r + (o < 0 ? -1 : o > 0 ? 1 : 0), 0));
    i !== t.length && n.warn("Log scale domain includes zero: " + te(t));
  }
  return t;
}
function mG(e, t, n) {
  let i = t.bins;
  if (i && !J(i)) {
    const r = e.domain(), o = r[0], a = xe(r), s = i.step;
    let u = i.start == null ? o : i.start, l = i.stop == null ? a : i.stop;
    s || P("Scale bins parameter missing step property."), u < o && (u = s * Math.ceil(o / s)), l > a && (l = s * Math.floor(a / s)), i = Hn(u, l + s / 2, s);
  }
  return i ? e.bins = i : e.bins && delete e.bins, e.type === T2 && (i ? !t.domain && !t.domainRaw && (e.domain(i), n = i.length) : e.bins = e.domain()), n;
}
function yG(e, t, n) {
  var i = e.type, r = t.round || !1, o = t.range;
  if (t.rangeStep != null)
    o = vG(i, t, n);
  else if (t.scheme && (o = bG(i, t, n), he(o))) {
    if (e.interpolator)
      return e.interpolator(o);
    P("Scale type ".concat(i, " does not support interpolating color schemes."));
  }
  if (o && XM(i))
    return e.interpolator(yp(mv(o, t.reverse), t.interpolate, t.interpolateGamma));
  o && t.interpolate && e.interpolate ? e.interpolate(P2(t.interpolate, t.interpolateGamma)) : he(e.round) ? e.round(r) : he(e.rangeRound) && e.interpolate(r ? Gf : Aa), o && e.range(mv(o, t.reverse));
}
function vG(e, t, n) {
  e !== qM && e !== tv && P("Only band and point scales support rangeStep.");
  var i = (t.paddingOuter != null ? t.paddingOuter : t.padding) || 0, r = e === tv ? 1 : (t.paddingInner != null ? t.paddingInner : t.padding) || 0;
  return [0, t.rangeStep * $2(n, r, i)];
}
function bG(e, t, n) {
  var i = t.schemeExtent, r, o;
  return J(t.scheme) ? o = yp(t.scheme, t.interpolate, t.interpolateGamma) : (r = t.scheme.toLowerCase(), o = L2(r), o || P("Unrecognized scheme name: ".concat(t.scheme))), n = e === mp ? n + 1 : e === T2 ? n - 1 : e === Xu || e === pp ? +t.schemeCount || uG : n, XM(e) ? xS(o, i, t.reverse) : he(o) ? JM(xS(o, i), n) : e === M2 ? o : o.slice(0, n);
}
function xS(e, t, n) {
  return he(e) && (t || n) ? KM(e, mv(t || [0, 1], n)) : e;
}
function mv(e, t) {
  return t ? e.slice().reverse() : e;
}
function DT(e) {
  N.call(this, null, e);
}
q(DT, N, {
  transform(e, t) {
    const n = e.modified("sort") || t.changed(t.ADD) || t.modified(e.sort.fields) || t.modified("datum");
    return n && t.source.sort(Ws(e.sort)), this.modified(n), t;
  }
});
const wS = "zero", $T = "center", MT = "normalize", TT = ["y0", "y1"];
function Cw(e) {
  N.call(this, null, e);
}
Cw.Definition = {
  type: "Stack",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "field",
    type: "field"
  }, {
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "sort",
    type: "compare"
  }, {
    name: "offset",
    type: "enum",
    default: wS,
    values: [wS, $T, MT]
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: 2,
    default: TT
  }]
};
q(Cw, N, {
  transform(e, t) {
    var n = e.as || TT, i = n[0], r = n[1], o = Ws(e.sort), a = e.field || vl, s = e.offset === $T ? xG : e.offset === MT ? wG : EG, u, l, c, f;
    for (u = AG(t.source, e.groupby, o, a), l = 0, c = u.length, f = u.max; l < c; ++l)
      s(u[l], f, a, i, r);
    return t.reflow(e.modified()).modifies(n);
  }
});
function xG(e, t, n, i, r) {
  for (var o = (t - e.sum) / 2, a = e.length, s = 0, u; s < a; ++s)
    u = e[s], u[i] = o, u[r] = o += Math.abs(n(u));
}
function wG(e, t, n, i, r) {
  for (var o = 1 / e.sum, a = 0, s = e.length, u = 0, l = 0, c; u < s; ++u)
    c = e[u], c[i] = a, c[r] = a = o * (l += Math.abs(n(c)));
}
function EG(e, t, n, i, r) {
  for (var o = 0, a = 0, s = e.length, u = 0, l, c; u < s; ++u)
    c = e[u], l = +n(c), l < 0 ? (c[i] = a, c[r] = a += l) : (c[i] = o, c[r] = o += l);
}
function AG(e, t, n, i) {
  var r = [], o = (p) => p(c), a, s, u, l, c, f, d, h, g;
  if (t == null)
    r.push(e.slice());
  else
    for (a = {}, s = 0, u = e.length; s < u; ++s)
      c = e[s], f = t.map(o), d = a[f], d || (a[f] = d = [], r.push(d)), d.push(c);
  for (f = 0, g = 0, l = r.length; f < l; ++f) {
    for (d = r[f], s = 0, h = 0, u = d.length; s < u; ++s)
      h += Math.abs(i(d[s]));
    d.sum = h, h > g && (g = h), n && d.sort(n);
  }
  return r.max = g, r;
}
const _G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  axisticks: xT,
  datajoin: wT,
  encode: ET,
  legendentries: AT,
  linkpath: Ow,
  pie: Sw,
  scale: FT,
  sortitems: DT,
  stack: Cw
}, Symbol.toStringTag, { value: "Module" }));
var ne = 1e-6, Tg = 1e-12, me = Math.PI, rt = me / 2, Ng = me / 4, yn = me * 2, st = 180 / me, ye = me / 180, Ae = Math.abs, Fl = Math.atan, hi = Math.atan2, re = Math.cos, Vd = Math.ceil, NT = Math.exp, yv = Math.hypot, Rg = Math.log, x1 = Math.pow, ee = Math.sin, oi = Math.sign || function(e) {
  return e > 0 ? 1 : e < 0 ? -1 : 0;
}, vn = Math.sqrt, Fw = Math.tan;
function RT(e) {
  return e > 1 ? 0 : e < -1 ? me : Math.acos(e);
}
function Rn(e) {
  return e > 1 ? rt : e < -1 ? -rt : Math.asin(e);
}
function Mt() {
}
function jg(e, t) {
  e && AS.hasOwnProperty(e.type) && AS[e.type](e, t);
}
var ES = {
  Feature: function(e, t) {
    jg(e.geometry, t);
  },
  FeatureCollection: function(e, t) {
    for (var n = e.features, i = -1, r = n.length; ++i < r; )
      jg(n[i].geometry, t);
  }
}, AS = {
  Sphere: function(e, t) {
    t.sphere();
  },
  Point: function(e, t) {
    e = e.coordinates, t.point(e[0], e[1], e[2]);
  },
  MultiPoint: function(e, t) {
    for (var n = e.coordinates, i = -1, r = n.length; ++i < r; )
      e = n[i], t.point(e[0], e[1], e[2]);
  },
  LineString: function(e, t) {
    vv(e.coordinates, t, 0);
  },
  MultiLineString: function(e, t) {
    for (var n = e.coordinates, i = -1, r = n.length; ++i < r; )
      vv(n[i], t, 0);
  },
  Polygon: function(e, t) {
    _S(e.coordinates, t);
  },
  MultiPolygon: function(e, t) {
    for (var n = e.coordinates, i = -1, r = n.length; ++i < r; )
      _S(n[i], t);
  },
  GeometryCollection: function(e, t) {
    for (var n = e.geometries, i = -1, r = n.length; ++i < r; )
      jg(n[i], t);
  }
};
function vv(e, t, n) {
  var i = -1, r = e.length - n, o;
  for (t.lineStart(); ++i < r; )
    o = e[i], t.point(o[0], o[1], o[2]);
  t.lineEnd();
}
function _S(e, t) {
  var n = -1, i = e.length;
  for (t.polygonStart(); ++n < i; )
    vv(e[n], t, 1);
  t.polygonEnd();
}
function Jr(e, t) {
  e && ES.hasOwnProperty(e.type) ? ES[e.type](e, t) : jg(e, t);
}
var Pg = new gn(), Lg = new gn(), jT, PT, bv, xv, wv, xr = {
  point: Mt,
  lineStart: Mt,
  lineEnd: Mt,
  polygonStart: function() {
    Pg = new gn(), xr.lineStart = OG, xr.lineEnd = SG;
  },
  polygonEnd: function() {
    var e = +Pg;
    Lg.add(e < 0 ? yn + e : e), this.lineStart = this.lineEnd = this.point = Mt;
  },
  sphere: function() {
    Lg.add(yn);
  }
};
function OG() {
  xr.point = CG;
}
function SG() {
  LT(jT, PT);
}
function CG(e, t) {
  xr.point = LT, jT = e, PT = t, e *= ye, t *= ye, bv = e, xv = re(t = t / 2 + Ng), wv = ee(t);
}
function LT(e, t) {
  e *= ye, t *= ye, t = t / 2 + Ng;
  var n = e - bv, i = n >= 0 ? 1 : -1, r = i * n, o = re(t), a = ee(t), s = wv * a, u = xv * o + s * re(r), l = s * i * ee(r);
  Pg.add(hi(l, u)), bv = e, xv = o, wv = a;
}
function FG(e) {
  return Lg = new gn(), Jr(e, xr), Lg * 2;
}
function Ig(e) {
  return [hi(e[1], e[0]), Rn(e[2])];
}
function Os(e) {
  var t = e[0], n = e[1], i = re(n);
  return [i * re(t), i * ee(t), ee(n)];
}
function Kd(e, t) {
  return e[0] * t[0] + e[1] * t[1] + e[2] * t[2];
}
function tl(e, t) {
  return [e[1] * t[2] - e[2] * t[1], e[2] * t[0] - e[0] * t[2], e[0] * t[1] - e[1] * t[0]];
}
function w1(e, t) {
  e[0] += t[0], e[1] += t[1], e[2] += t[2];
}
function Jd(e, t) {
  return [e[0] * t, e[1] * t, e[2] * t];
}
function Bg(e) {
  var t = vn(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]);
  e[0] /= t, e[1] /= t, e[2] /= t;
}
var Qe, Sn, tt, Wn, Ja, IT, BT, Tu, zc, No, ho, Hr = {
  point: Ev,
  lineStart: OS,
  lineEnd: SS,
  polygonStart: function() {
    Hr.point = UT, Hr.lineStart = kG, Hr.lineEnd = DG, zc = new gn(), xr.polygonStart();
  },
  polygonEnd: function() {
    xr.polygonEnd(), Hr.point = Ev, Hr.lineStart = OS, Hr.lineEnd = SS, Pg < 0 ? (Qe = -(tt = 180), Sn = -(Wn = 90)) : zc > ne ? Wn = 90 : zc < -ne && (Sn = -90), ho[0] = Qe, ho[1] = tt;
  },
  sphere: function() {
    Qe = -(tt = 180), Sn = -(Wn = 90);
  }
};
function Ev(e, t) {
  No.push(ho = [Qe = e, tt = e]), t < Sn && (Sn = t), t > Wn && (Wn = t);
}
function zT(e, t) {
  var n = Os([e * ye, t * ye]);
  if (Tu) {
    var i = tl(Tu, n), r = [i[1], -i[0], 0], o = tl(r, i);
    Bg(o), o = Ig(o);
    var a = e - Ja, s = a > 0 ? 1 : -1, u = o[0] * st * s, l, c = Ae(a) > 180;
    c ^ (s * Ja < u && u < s * e) ? (l = o[1] * st, l > Wn && (Wn = l)) : (u = (u + 360) % 360 - 180, c ^ (s * Ja < u && u < s * e) ? (l = -o[1] * st, l < Sn && (Sn = l)) : (t < Sn && (Sn = t), t > Wn && (Wn = t))), c ? e < Ja ? qn(Qe, e) > qn(Qe, tt) && (tt = e) : qn(e, tt) > qn(Qe, tt) && (Qe = e) : tt >= Qe ? (e < Qe && (Qe = e), e > tt && (tt = e)) : e > Ja ? qn(Qe, e) > qn(Qe, tt) && (tt = e) : qn(e, tt) > qn(Qe, tt) && (Qe = e);
  } else
    No.push(ho = [Qe = e, tt = e]);
  t < Sn && (Sn = t), t > Wn && (Wn = t), Tu = n, Ja = e;
}
function OS() {
  Hr.point = zT;
}
function SS() {
  ho[0] = Qe, ho[1] = tt, Hr.point = Ev, Tu = null;
}
function UT(e, t) {
  if (Tu) {
    var n = e - Ja;
    zc.add(Ae(n) > 180 ? n + (n > 0 ? 360 : -360) : n);
  } else
    IT = e, BT = t;
  xr.point(e, t), zT(e, t);
}
function kG() {
  xr.lineStart();
}
function DG() {
  UT(IT, BT), xr.lineEnd(), Ae(zc) > ne && (Qe = -(tt = 180)), ho[0] = Qe, ho[1] = tt, Tu = null;
}
function qn(e, t) {
  return (t -= e) < 0 ? t + 360 : t;
}
function $G(e, t) {
  return e[0] - t[0];
}
function CS(e, t) {
  return e[0] <= e[1] ? e[0] <= t && t <= e[1] : t < e[0] || e[1] < t;
}
function MG(e) {
  var t, n, i, r, o, a, s;
  if (Wn = tt = -(Qe = Sn = 1 / 0), No = [], Jr(e, Hr), n = No.length) {
    for (No.sort($G), t = 1, i = No[0], o = [i]; t < n; ++t)
      r = No[t], CS(i, r[0]) || CS(i, r[1]) ? (qn(i[0], r[1]) > qn(i[0], i[1]) && (i[1] = r[1]), qn(r[0], i[1]) > qn(i[0], i[1]) && (i[0] = r[0])) : o.push(i = r);
    for (a = -1 / 0, n = o.length - 1, t = 0, i = o[n]; t <= n; i = r, ++t)
      r = o[t], (s = qn(i[1], r[0])) > a && (a = s, Qe = r[0], tt = i[1]);
  }
  return No = ho = null, Qe === 1 / 0 || Sn === 1 / 0 ? [[NaN, NaN], [NaN, NaN]] : [[Qe, Sn], [tt, Wn]];
}
var Ec, zg, Ug, qg, Wg, Gg, Hg, Yg, Av, _v, Ov, qT, WT, sn, un, ln, Ri = {
  sphere: Mt,
  point: kw,
  lineStart: FS,
  lineEnd: kS,
  polygonStart: function() {
    Ri.lineStart = RG, Ri.lineEnd = jG;
  },
  polygonEnd: function() {
    Ri.lineStart = FS, Ri.lineEnd = kS;
  }
};
function kw(e, t) {
  e *= ye, t *= ye;
  var n = re(t);
  od(n * re(e), n * ee(e), ee(t));
}
function od(e, t, n) {
  ++Ec, Ug += (e - Ug) / Ec, qg += (t - qg) / Ec, Wg += (n - Wg) / Ec;
}
function FS() {
  Ri.point = TG;
}
function TG(e, t) {
  e *= ye, t *= ye;
  var n = re(t);
  sn = n * re(e), un = n * ee(e), ln = ee(t), Ri.point = NG, od(sn, un, ln);
}
function NG(e, t) {
  e *= ye, t *= ye;
  var n = re(t), i = n * re(e), r = n * ee(e), o = ee(t), a = hi(vn((a = un * o - ln * r) * a + (a = ln * i - sn * o) * a + (a = sn * r - un * i) * a), sn * i + un * r + ln * o);
  zg += a, Gg += a * (sn + (sn = i)), Hg += a * (un + (un = r)), Yg += a * (ln + (ln = o)), od(sn, un, ln);
}
function kS() {
  Ri.point = kw;
}
function RG() {
  Ri.point = PG;
}
function jG() {
  GT(qT, WT), Ri.point = kw;
}
function PG(e, t) {
  qT = e, WT = t, e *= ye, t *= ye, Ri.point = GT;
  var n = re(t);
  sn = n * re(e), un = n * ee(e), ln = ee(t), od(sn, un, ln);
}
function GT(e, t) {
  e *= ye, t *= ye;
  var n = re(t), i = n * re(e), r = n * ee(e), o = ee(t), a = un * o - ln * r, s = ln * i - sn * o, u = sn * r - un * i, l = yv(a, s, u), c = Rn(l), f = l && -c / l;
  Av.add(f * a), _v.add(f * s), Ov.add(f * u), zg += c, Gg += c * (sn + (sn = i)), Hg += c * (un + (un = r)), Yg += c * (ln + (ln = o)), od(sn, un, ln);
}
function LG(e) {
  Ec = zg = Ug = qg = Wg = Gg = Hg = Yg = 0, Av = new gn(), _v = new gn(), Ov = new gn(), Jr(e, Ri);
  var t = +Av, n = +_v, i = +Ov, r = yv(t, n, i);
  return r < Tg && (t = Gg, n = Hg, i = Yg, zg < ne && (t = Ug, n = qg, i = Wg), r = yv(t, n, i), r < Tg) ? [NaN, NaN] : [hi(n, t) * st, Rn(i / r) * st];
}
function Sv(e, t) {
  function n(i, r) {
    return i = e(i, r), t(i[0], i[1]);
  }
  return e.invert && t.invert && (n.invert = function(i, r) {
    return i = t.invert(i, r), i && e.invert(i[0], i[1]);
  }), n;
}
function Cv(e, t) {
  return [Ae(e) > me ? e + Math.round(-e / yn) * yn : e, t];
}
Cv.invert = Cv;
function HT(e, t, n) {
  return (e %= yn) ? t || n ? Sv($S(e), MS(t, n)) : $S(e) : t || n ? MS(t, n) : Cv;
}
function DS(e) {
  return function(t, n) {
    return t += e, [t > me ? t - yn : t < -me ? t + yn : t, n];
  };
}
function $S(e) {
  var t = DS(e);
  return t.invert = DS(-e), t;
}
function MS(e, t) {
  var n = re(e), i = ee(e), r = re(t), o = ee(t);
  function a(s, u) {
    var l = re(u), c = re(s) * l, f = ee(s) * l, d = ee(u), h = d * n + c * i;
    return [
      hi(f * r - h * o, c * n - d * i),
      Rn(h * r + f * o)
    ];
  }
  return a.invert = function(s, u) {
    var l = re(u), c = re(s) * l, f = ee(s) * l, d = ee(u), h = d * r - f * o;
    return [
      hi(f * r + d * o, c * n + h * i),
      Rn(h * n - c * i)
    ];
  }, a;
}
function IG(e) {
  e = HT(e[0] * ye, e[1] * ye, e.length > 2 ? e[2] * ye : 0);
  function t(n) {
    return n = e(n[0] * ye, n[1] * ye), n[0] *= st, n[1] *= st, n;
  }
  return t.invert = function(n) {
    return n = e.invert(n[0] * ye, n[1] * ye), n[0] *= st, n[1] *= st, n;
  }, t;
}
function BG(e, t, n, i, r, o) {
  if (!!n) {
    var a = re(t), s = ee(t), u = i * n;
    r == null ? (r = t + i * yn, o = t - u / 2) : (r = TS(a, r), o = TS(a, o), (i > 0 ? r < o : r > o) && (r += i * yn));
    for (var l, c = r; i > 0 ? c > o : c < o; c -= u)
      l = Ig([a, -s * re(c), -s * ee(c)]), e.point(l[0], l[1]);
  }
}
function TS(e, t) {
  t = Os(t), t[0] -= e, Bg(t);
  var n = RT(-t[1]);
  return ((-t[2] < 0 ? -n : n) + yn - ne) % yn;
}
function YT() {
  var e = [], t;
  return {
    point: function(n, i, r) {
      t.push([n, i, r]);
    },
    lineStart: function() {
      e.push(t = []);
    },
    lineEnd: Mt,
    rejoin: function() {
      e.length > 1 && e.push(e.pop().concat(e.shift()));
    },
    result: function() {
      var n = e;
      return e = [], t = null, n;
    }
  };
}
function jh(e, t) {
  return Ae(e[0] - t[0]) < ne && Ae(e[1] - t[1]) < ne;
}
function Qd(e, t, n, i) {
  this.x = e, this.z = t, this.o = n, this.e = i, this.v = !1, this.n = this.p = null;
}
function XT(e, t, n, i, r) {
  var o = [], a = [], s, u;
  if (e.forEach(function(g) {
    if (!((p = g.length - 1) <= 0)) {
      var p, m = g[0], y = g[p], v;
      if (jh(m, y)) {
        if (!m[2] && !y[2]) {
          for (r.lineStart(), s = 0; s < p; ++s)
            r.point((m = g[s])[0], m[1]);
          r.lineEnd();
          return;
        }
        y[0] += 2 * ne;
      }
      o.push(v = new Qd(m, g, null, !0)), a.push(v.o = new Qd(m, null, v, !1)), o.push(v = new Qd(y, g, null, !1)), a.push(v.o = new Qd(y, null, v, !0));
    }
  }), !!o.length) {
    for (a.sort(t), NS(o), NS(a), s = 0, u = a.length; s < u; ++s)
      a[s].e = n = !n;
    for (var l = o[0], c, f; ; ) {
      for (var d = l, h = !0; d.v; )
        if ((d = d.n) === l)
          return;
      c = d.z, r.lineStart();
      do {
        if (d.v = d.o.v = !0, d.e) {
          if (h)
            for (s = 0, u = c.length; s < u; ++s)
              r.point((f = c[s])[0], f[1]);
          else
            i(d.x, d.n.x, 1, r);
          d = d.n;
        } else {
          if (h)
            for (c = d.p.z, s = c.length - 1; s >= 0; --s)
              r.point((f = c[s])[0], f[1]);
          else
            i(d.x, d.p.x, -1, r);
          d = d.p;
        }
        d = d.o, c = d.z, h = !h;
      } while (!d.v);
      r.lineEnd();
    }
  }
}
function NS(e) {
  if (!!(t = e.length)) {
    for (var t, n = 0, i = e[0], r; ++n < t; )
      i.n = r = e[n], r.p = i, i = r;
    i.n = r = e[0], r.p = i;
  }
}
function E1(e) {
  return Ae(e[0]) <= me ? e[0] : oi(e[0]) * ((Ae(e[0]) + me) % yn - me);
}
function zG(e, t) {
  var n = E1(t), i = t[1], r = ee(i), o = [ee(n), -re(n), 0], a = 0, s = 0, u = new gn();
  r === 1 ? i = rt + ne : r === -1 && (i = -rt - ne);
  for (var l = 0, c = e.length; l < c; ++l)
    if (!!(d = (f = e[l]).length))
      for (var f, d, h = f[d - 1], g = E1(h), p = h[1] / 2 + Ng, m = ee(p), y = re(p), v = 0; v < d; ++v, g = x, m = A, y = w, h = b) {
        var b = f[v], x = E1(b), E = b[1] / 2 + Ng, A = ee(E), w = re(E), _ = x - g, k = _ >= 0 ? 1 : -1, C = k * _, O = C > me, S = m * A;
        if (u.add(hi(S * k * ee(C), y * w + S * re(C))), a += O ? _ + k * yn : _, O ^ g >= n ^ x >= n) {
          var D = tl(Os(h), Os(b));
          Bg(D);
          var M = tl(o, D);
          Bg(M);
          var F = (O ^ _ >= 0 ? -1 : 1) * Rn(M[2]);
          (i > F || i === F && (D[0] || D[1])) && (s += O ^ _ >= 0 ? 1 : -1);
        }
      }
  return (a < -ne || a < ne && u < -Tg) ^ s & 1;
}
function VT(e, t, n, i) {
  return function(r) {
    var o = t(r), a = YT(), s = t(a), u = !1, l, c, f, d = {
      point: h,
      lineStart: p,
      lineEnd: m,
      polygonStart: function() {
        d.point = y, d.lineStart = v, d.lineEnd = b, c = [], l = [];
      },
      polygonEnd: function() {
        d.point = h, d.lineStart = p, d.lineEnd = m, c = qD(c);
        var x = zG(l, i);
        c.length ? (u || (r.polygonStart(), u = !0), XT(c, qG, x, n, r)) : x && (u || (r.polygonStart(), u = !0), r.lineStart(), n(null, null, 1, r), r.lineEnd()), u && (r.polygonEnd(), u = !1), c = l = null;
      },
      sphere: function() {
        r.polygonStart(), r.lineStart(), n(null, null, 1, r), r.lineEnd(), r.polygonEnd();
      }
    };
    function h(x, E) {
      e(x, E) && r.point(x, E);
    }
    function g(x, E) {
      o.point(x, E);
    }
    function p() {
      d.point = g, o.lineStart();
    }
    function m() {
      d.point = h, o.lineEnd();
    }
    function y(x, E) {
      f.push([x, E]), s.point(x, E);
    }
    function v() {
      s.lineStart(), f = [];
    }
    function b() {
      y(f[0][0], f[0][1]), s.lineEnd();
      var x = s.clean(), E = a.result(), A, w = E.length, _, k, C;
      if (f.pop(), l.push(f), f = null, !!w) {
        if (x & 1) {
          if (k = E[0], (_ = k.length - 1) > 0) {
            for (u || (r.polygonStart(), u = !0), r.lineStart(), A = 0; A < _; ++A)
              r.point((C = k[A])[0], C[1]);
            r.lineEnd();
          }
          return;
        }
        w > 1 && x & 2 && E.push(E.pop().concat(E.shift())), c.push(E.filter(UG));
      }
    }
    return d;
  };
}
function UG(e) {
  return e.length > 1;
}
function qG(e, t) {
  return ((e = e.x)[0] < 0 ? e[1] - rt - ne : rt - e[1]) - ((t = t.x)[0] < 0 ? t[1] - rt - ne : rt - t[1]);
}
const RS = VT(
  function() {
    return !0;
  },
  WG,
  HG,
  [-me, -rt]
);
function WG(e) {
  var t = NaN, n = NaN, i = NaN, r;
  return {
    lineStart: function() {
      e.lineStart(), r = 1;
    },
    point: function(o, a) {
      var s = o > 0 ? me : -me, u = Ae(o - t);
      Ae(u - me) < ne ? (e.point(t, n = (n + a) / 2 > 0 ? rt : -rt), e.point(i, n), e.lineEnd(), e.lineStart(), e.point(s, n), e.point(o, n), r = 0) : i !== s && u >= me && (Ae(t - i) < ne && (t -= i * ne), Ae(o - s) < ne && (o -= s * ne), n = GG(t, n, o, a), e.point(i, n), e.lineEnd(), e.lineStart(), e.point(s, n), r = 0), e.point(t = o, n = a), i = s;
    },
    lineEnd: function() {
      e.lineEnd(), t = n = NaN;
    },
    clean: function() {
      return 2 - r;
    }
  };
}
function GG(e, t, n, i) {
  var r, o, a = ee(e - n);
  return Ae(a) > ne ? Fl((ee(t) * (o = re(i)) * ee(n) - ee(i) * (r = re(t)) * ee(e)) / (r * o * a)) : (t + i) / 2;
}
function HG(e, t, n, i) {
  var r;
  if (e == null)
    r = n * rt, i.point(-me, r), i.point(0, r), i.point(me, r), i.point(me, 0), i.point(me, -r), i.point(0, -r), i.point(-me, -r), i.point(-me, 0), i.point(-me, r);
  else if (Ae(e[0] - t[0]) > ne) {
    var o = e[0] < t[0] ? me : -me;
    r = n * o / 2, i.point(-o, r), i.point(0, r), i.point(o, r);
  } else
    i.point(t[0], t[1]);
}
function YG(e) {
  var t = re(e), n = 6 * ye, i = t > 0, r = Ae(t) > ne;
  function o(c, f, d, h) {
    BG(h, e, n, d, c, f);
  }
  function a(c, f) {
    return re(c) * re(f) > t;
  }
  function s(c) {
    var f, d, h, g, p;
    return {
      lineStart: function() {
        g = h = !1, p = 1;
      },
      point: function(m, y) {
        var v = [m, y], b, x = a(m, y), E = i ? x ? 0 : l(m, y) : x ? l(m + (m < 0 ? me : -me), y) : 0;
        if (!f && (g = h = x) && c.lineStart(), x !== h && (b = u(f, v), (!b || jh(f, b) || jh(v, b)) && (v[2] = 1)), x !== h)
          p = 0, x ? (c.lineStart(), b = u(v, f), c.point(b[0], b[1])) : (b = u(f, v), c.point(b[0], b[1], 2), c.lineEnd()), f = b;
        else if (r && f && i ^ x) {
          var A;
          !(E & d) && (A = u(v, f, !0)) && (p = 0, i ? (c.lineStart(), c.point(A[0][0], A[0][1]), c.point(A[1][0], A[1][1]), c.lineEnd()) : (c.point(A[1][0], A[1][1]), c.lineEnd(), c.lineStart(), c.point(A[0][0], A[0][1], 3)));
        }
        x && (!f || !jh(f, v)) && c.point(v[0], v[1]), f = v, h = x, d = E;
      },
      lineEnd: function() {
        h && c.lineEnd(), f = null;
      },
      clean: function() {
        return p | (g && h) << 1;
      }
    };
  }
  function u(c, f, d) {
    var h = Os(c), g = Os(f), p = [1, 0, 0], m = tl(h, g), y = Kd(m, m), v = m[0], b = y - v * v;
    if (!b)
      return !d && c;
    var x = t * y / b, E = -t * v / b, A = tl(p, m), w = Jd(p, x), _ = Jd(m, E);
    w1(w, _);
    var k = A, C = Kd(w, k), O = Kd(k, k), S = C * C - O * (Kd(w, w) - 1);
    if (!(S < 0)) {
      var D = vn(S), M = Jd(k, (-C - D) / O);
      if (w1(M, w), M = Ig(M), !d)
        return M;
      var F = c[0], $ = f[0], T = c[1], L = f[1], I;
      $ < F && (I = F, F = $, $ = I);
      var Y = $ - F, fe = Ae(Y - me) < ne, Me = fe || Y < ne;
      if (!fe && L < T && (I = T, T = L, L = I), Me ? fe ? T + L > 0 ^ M[1] < (Ae(M[0] - F) < ne ? T : L) : T <= M[1] && M[1] <= L : Y > me ^ (F <= M[0] && M[0] <= $)) {
        var Oe = Jd(k, (-C + D) / O);
        return w1(Oe, w), [M, Ig(Oe)];
      }
    }
  }
  function l(c, f) {
    var d = i ? e : me - e, h = 0;
    return c < -d ? h |= 1 : c > d && (h |= 2), f < -d ? h |= 4 : f > d && (h |= 8), h;
  }
  return VT(a, s, o, i ? [0, -e] : [-me, e - me]);
}
function XG(e, t, n, i, r, o) {
  var a = e[0], s = e[1], u = t[0], l = t[1], c = 0, f = 1, d = u - a, h = l - s, g;
  if (g = n - a, !(!d && g > 0)) {
    if (g /= d, d < 0) {
      if (g < c)
        return;
      g < f && (f = g);
    } else if (d > 0) {
      if (g > f)
        return;
      g > c && (c = g);
    }
    if (g = r - a, !(!d && g < 0)) {
      if (g /= d, d < 0) {
        if (g > f)
          return;
        g > c && (c = g);
      } else if (d > 0) {
        if (g < c)
          return;
        g < f && (f = g);
      }
      if (g = i - s, !(!h && g > 0)) {
        if (g /= h, h < 0) {
          if (g < c)
            return;
          g < f && (f = g);
        } else if (h > 0) {
          if (g > f)
            return;
          g > c && (c = g);
        }
        if (g = o - s, !(!h && g < 0)) {
          if (g /= h, h < 0) {
            if (g > f)
              return;
            g > c && (c = g);
          } else if (h > 0) {
            if (g < c)
              return;
            g < f && (f = g);
          }
          return c > 0 && (e[0] = a + c * d, e[1] = s + c * h), f < 1 && (t[0] = a + f * d, t[1] = s + f * h), !0;
        }
      }
    }
  }
}
var Ac = 1e9, Zd = -Ac;
function KT(e, t, n, i) {
  function r(l, c) {
    return e <= l && l <= n && t <= c && c <= i;
  }
  function o(l, c, f, d) {
    var h = 0, g = 0;
    if (l == null || (h = a(l, f)) !== (g = a(c, f)) || u(l, c) < 0 ^ f > 0)
      do
        d.point(h === 0 || h === 3 ? e : n, h > 1 ? i : t);
      while ((h = (h + f + 4) % 4) !== g);
    else
      d.point(c[0], c[1]);
  }
  function a(l, c) {
    return Ae(l[0] - e) < ne ? c > 0 ? 0 : 3 : Ae(l[0] - n) < ne ? c > 0 ? 2 : 1 : Ae(l[1] - t) < ne ? c > 0 ? 1 : 0 : c > 0 ? 3 : 2;
  }
  function s(l, c) {
    return u(l.x, c.x);
  }
  function u(l, c) {
    var f = a(l, 1), d = a(c, 1);
    return f !== d ? f - d : f === 0 ? c[1] - l[1] : f === 1 ? l[0] - c[0] : f === 2 ? l[1] - c[1] : c[0] - l[0];
  }
  return function(l) {
    var c = l, f = YT(), d, h, g, p, m, y, v, b, x, E, A, w = {
      point: _,
      lineStart: S,
      lineEnd: D,
      polygonStart: C,
      polygonEnd: O
    };
    function _(F, $) {
      r(F, $) && c.point(F, $);
    }
    function k() {
      for (var F = 0, $ = 0, T = h.length; $ < T; ++$)
        for (var L = h[$], I = 1, Y = L.length, fe = L[0], Me, Oe, Be = fe[0], Se = fe[1]; I < Y; ++I)
          Me = Be, Oe = Se, fe = L[I], Be = fe[0], Se = fe[1], Oe <= i ? Se > i && (Be - Me) * (i - Oe) > (Se - Oe) * (e - Me) && ++F : Se <= i && (Be - Me) * (i - Oe) < (Se - Oe) * (e - Me) && --F;
      return F;
    }
    function C() {
      c = f, d = [], h = [], A = !0;
    }
    function O() {
      var F = k(), $ = A && F, T = (d = qD(d)).length;
      ($ || T) && (l.polygonStart(), $ && (l.lineStart(), o(null, null, 1, l), l.lineEnd()), T && XT(d, s, F, o, l), l.polygonEnd()), c = l, d = h = g = null;
    }
    function S() {
      w.point = M, h && h.push(g = []), E = !0, x = !1, v = b = NaN;
    }
    function D() {
      d && (M(p, m), y && x && f.rejoin(), d.push(f.result())), w.point = _, x && c.lineEnd();
    }
    function M(F, $) {
      var T = r(F, $);
      if (h && g.push([F, $]), E)
        p = F, m = $, y = T, E = !1, T && (c.lineStart(), c.point(F, $));
      else if (T && x)
        c.point(F, $);
      else {
        var L = [v = Math.max(Zd, Math.min(Ac, v)), b = Math.max(Zd, Math.min(Ac, b))], I = [F = Math.max(Zd, Math.min(Ac, F)), $ = Math.max(Zd, Math.min(Ac, $))];
        XG(L, I, e, t, n, i) ? (x || (c.lineStart(), c.point(L[0], L[1])), c.point(I[0], I[1]), T || c.lineEnd(), A = !1) : T && (c.lineStart(), c.point(F, $), A = !1);
      }
      v = F, b = $, x = T;
    }
    return w;
  };
}
function jS(e, t, n) {
  var i = Hn(e, t - ne, n).concat(t);
  return function(r) {
    return i.map(function(o) {
      return [r, o];
    });
  };
}
function PS(e, t, n) {
  var i = Hn(e, t - ne, n).concat(t);
  return function(r) {
    return i.map(function(o) {
      return [o, r];
    });
  };
}
function VG() {
  var e, t, n, i, r, o, a, s, u = 10, l = u, c = 90, f = 360, d, h, g, p, m = 2.5;
  function y() {
    return { type: "MultiLineString", coordinates: v() };
  }
  function v() {
    return Hn(Vd(i / c) * c, n, c).map(g).concat(Hn(Vd(s / f) * f, a, f).map(p)).concat(Hn(Vd(t / u) * u, e, u).filter(function(b) {
      return Ae(b % c) > ne;
    }).map(d)).concat(Hn(Vd(o / l) * l, r, l).filter(function(b) {
      return Ae(b % f) > ne;
    }).map(h));
  }
  return y.lines = function() {
    return v().map(function(b) {
      return { type: "LineString", coordinates: b };
    });
  }, y.outline = function() {
    return {
      type: "Polygon",
      coordinates: [
        g(i).concat(
          p(a).slice(1),
          g(n).reverse().slice(1),
          p(s).reverse().slice(1)
        )
      ]
    };
  }, y.extent = function(b) {
    return arguments.length ? y.extentMajor(b).extentMinor(b) : y.extentMinor();
  }, y.extentMajor = function(b) {
    return arguments.length ? (i = +b[0][0], n = +b[1][0], s = +b[0][1], a = +b[1][1], i > n && (b = i, i = n, n = b), s > a && (b = s, s = a, a = b), y.precision(m)) : [[i, s], [n, a]];
  }, y.extentMinor = function(b) {
    return arguments.length ? (t = +b[0][0], e = +b[1][0], o = +b[0][1], r = +b[1][1], t > e && (b = t, t = e, e = b), o > r && (b = o, o = r, r = b), y.precision(m)) : [[t, o], [e, r]];
  }, y.step = function(b) {
    return arguments.length ? y.stepMajor(b).stepMinor(b) : y.stepMinor();
  }, y.stepMajor = function(b) {
    return arguments.length ? (c = +b[0], f = +b[1], y) : [c, f];
  }, y.stepMinor = function(b) {
    return arguments.length ? (u = +b[0], l = +b[1], y) : [u, l];
  }, y.precision = function(b) {
    return arguments.length ? (m = +b, d = jS(o, r, 90), h = PS(t, e, m), g = jS(s, a, 90), p = PS(i, n, m), y) : m;
  }, y.extentMajor([[-180, -90 + ne], [180, 90 - ne]]).extentMinor([[-180, -80 - ne], [180, 80 + ne]]);
}
const hf = (e) => e;
var A1 = new gn(), Fv = new gn(), JT, QT, kv, Dv, Io = {
  point: Mt,
  lineStart: Mt,
  lineEnd: Mt,
  polygonStart: function() {
    Io.lineStart = KG, Io.lineEnd = QG;
  },
  polygonEnd: function() {
    Io.lineStart = Io.lineEnd = Io.point = Mt, A1.add(Ae(Fv)), Fv = new gn();
  },
  result: function() {
    var e = A1 / 2;
    return A1 = new gn(), e;
  }
};
function KG() {
  Io.point = JG;
}
function JG(e, t) {
  Io.point = ZT, JT = kv = e, QT = Dv = t;
}
function ZT(e, t) {
  Fv.add(Dv * e - kv * t), kv = e, Dv = t;
}
function QG() {
  ZT(JT, QT);
}
const LS = Io;
var nl = 1 / 0, Xg = nl, gf = -nl, Vg = gf, ZG = {
  point: eH,
  lineStart: Mt,
  lineEnd: Mt,
  polygonStart: Mt,
  polygonEnd: Mt,
  result: function() {
    var e = [[nl, Xg], [gf, Vg]];
    return gf = Vg = -(Xg = nl = 1 / 0), e;
  }
};
function eH(e, t) {
  e < nl && (nl = e), e > gf && (gf = e), t < Xg && (Xg = t), t > Vg && (Vg = t);
}
const Kg = ZG;
var $v = 0, Mv = 0, _c = 0, Jg = 0, Qg = 0, Su = 0, Tv = 0, Nv = 0, Oc = 0, eN, tN, ar, sr, $i = {
  point: Ss,
  lineStart: IS,
  lineEnd: BS,
  polygonStart: function() {
    $i.lineStart = iH, $i.lineEnd = rH;
  },
  polygonEnd: function() {
    $i.point = Ss, $i.lineStart = IS, $i.lineEnd = BS;
  },
  result: function() {
    var e = Oc ? [Tv / Oc, Nv / Oc] : Su ? [Jg / Su, Qg / Su] : _c ? [$v / _c, Mv / _c] : [NaN, NaN];
    return $v = Mv = _c = Jg = Qg = Su = Tv = Nv = Oc = 0, e;
  }
};
function Ss(e, t) {
  $v += e, Mv += t, ++_c;
}
function IS() {
  $i.point = tH;
}
function tH(e, t) {
  $i.point = nH, Ss(ar = e, sr = t);
}
function nH(e, t) {
  var n = e - ar, i = t - sr, r = vn(n * n + i * i);
  Jg += r * (ar + e) / 2, Qg += r * (sr + t) / 2, Su += r, Ss(ar = e, sr = t);
}
function BS() {
  $i.point = Ss;
}
function iH() {
  $i.point = oH;
}
function rH() {
  nN(eN, tN);
}
function oH(e, t) {
  $i.point = nN, Ss(eN = ar = e, tN = sr = t);
}
function nN(e, t) {
  var n = e - ar, i = t - sr, r = vn(n * n + i * i);
  Jg += r * (ar + e) / 2, Qg += r * (sr + t) / 2, Su += r, r = sr * e - ar * t, Tv += r * (ar + e), Nv += r * (sr + t), Oc += r * 3, Ss(ar = e, sr = t);
}
const zS = $i;
function iN(e) {
  this._context = e;
}
iN.prototype = {
  _radius: 4.5,
  pointRadius: function(e) {
    return this._radius = e, this;
  },
  polygonStart: function() {
    this._line = 0;
  },
  polygonEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    this._line === 0 && this._context.closePath(), this._point = NaN;
  },
  point: function(e, t) {
    switch (this._point) {
      case 0: {
        this._context.moveTo(e, t), this._point = 1;
        break;
      }
      case 1: {
        this._context.lineTo(e, t);
        break;
      }
      default: {
        this._context.moveTo(e + this._radius, t), this._context.arc(e, t, this._radius, 0, yn);
        break;
      }
    }
  },
  result: Mt
};
var Rv = new gn(), _1, rN, oN, Sc, Cc, Zg = {
  point: Mt,
  lineStart: function() {
    Zg.point = aH;
  },
  lineEnd: function() {
    _1 && aN(rN, oN), Zg.point = Mt;
  },
  polygonStart: function() {
    _1 = !0;
  },
  polygonEnd: function() {
    _1 = null;
  },
  result: function() {
    var e = +Rv;
    return Rv = new gn(), e;
  }
};
function aH(e, t) {
  Zg.point = aN, rN = Sc = e, oN = Cc = t;
}
function aN(e, t) {
  Sc -= e, Cc -= t, Rv.add(vn(Sc * Sc + Cc * Cc)), Sc = e, Cc = t;
}
const US = Zg;
function sN() {
  this._string = [];
}
sN.prototype = {
  _radius: 4.5,
  _circle: qS(4.5),
  pointRadius: function(e) {
    return (e = +e) !== this._radius && (this._radius = e, this._circle = null), this;
  },
  polygonStart: function() {
    this._line = 0;
  },
  polygonEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    this._line === 0 && this._string.push("Z"), this._point = NaN;
  },
  point: function(e, t) {
    switch (this._point) {
      case 0: {
        this._string.push("M", e, ",", t), this._point = 1;
        break;
      }
      case 1: {
        this._string.push("L", e, ",", t);
        break;
      }
      default: {
        this._circle == null && (this._circle = qS(this._radius)), this._string.push("M", e, ",", t, this._circle);
        break;
      }
    }
  },
  result: function() {
    if (this._string.length) {
      var e = this._string.join("");
      return this._string = [], e;
    } else
      return null;
  }
};
function qS(e) {
  return "m0," + e + "a" + e + "," + e + " 0 1,1 0," + -2 * e + "a" + e + "," + e + " 0 1,1 0," + 2 * e + "z";
}
function uN(e, t) {
  var n = 4.5, i, r;
  function o(a) {
    return a && (typeof n == "function" && r.pointRadius(+n.apply(this, arguments)), Jr(a, i(r))), r.result();
  }
  return o.area = function(a) {
    return Jr(a, i(LS)), LS.result();
  }, o.measure = function(a) {
    return Jr(a, i(US)), US.result();
  }, o.bounds = function(a) {
    return Jr(a, i(Kg)), Kg.result();
  }, o.centroid = function(a) {
    return Jr(a, i(zS)), zS.result();
  }, o.projection = function(a) {
    return arguments.length ? (i = a == null ? (e = null, hf) : (e = a).stream, o) : e;
  }, o.context = function(a) {
    return arguments.length ? (r = a == null ? (t = null, new sN()) : new iN(t = a), typeof n != "function" && r.pointRadius(n), o) : t;
  }, o.pointRadius = function(a) {
    return arguments.length ? (n = typeof a == "function" ? a : (r.pointRadius(+a), +a), o) : n;
  }, o.projection(e).context(t);
}
function Dp(e) {
  return function(t) {
    var n = new jv();
    for (var i in e)
      n[i] = e[i];
    return n.stream = t, n;
  };
}
function jv() {
}
jv.prototype = {
  constructor: jv,
  point: function(e, t) {
    this.stream.point(e, t);
  },
  sphere: function() {
    this.stream.sphere();
  },
  lineStart: function() {
    this.stream.lineStart();
  },
  lineEnd: function() {
    this.stream.lineEnd();
  },
  polygonStart: function() {
    this.stream.polygonStart();
  },
  polygonEnd: function() {
    this.stream.polygonEnd();
  }
};
function Dw(e, t, n) {
  var i = e.clipExtent && e.clipExtent();
  return e.scale(150).translate([0, 0]), i != null && e.clipExtent(null), Jr(n, e.stream(Kg)), t(Kg.result()), i != null && e.clipExtent(i), e;
}
function $p(e, t, n) {
  return Dw(e, function(i) {
    var r = t[1][0] - t[0][0], o = t[1][1] - t[0][1], a = Math.min(r / (i[1][0] - i[0][0]), o / (i[1][1] - i[0][1])), s = +t[0][0] + (r - a * (i[1][0] + i[0][0])) / 2, u = +t[0][1] + (o - a * (i[1][1] + i[0][1])) / 2;
    e.scale(150 * a).translate([s, u]);
  }, n);
}
function $w(e, t, n) {
  return $p(e, [[0, 0], t], n);
}
function Mw(e, t, n) {
  return Dw(e, function(i) {
    var r = +t, o = r / (i[1][0] - i[0][0]), a = (r - o * (i[1][0] + i[0][0])) / 2, s = -o * i[0][1];
    e.scale(150 * o).translate([a, s]);
  }, n);
}
function Tw(e, t, n) {
  return Dw(e, function(i) {
    var r = +t, o = r / (i[1][1] - i[0][1]), a = -o * i[0][0], s = (r - o * (i[1][1] + i[0][1])) / 2;
    e.scale(150 * o).translate([a, s]);
  }, n);
}
var WS = 16, sH = re(30 * ye);
function GS(e, t) {
  return +t ? lH(e, t) : uH(e);
}
function uH(e) {
  return Dp({
    point: function(t, n) {
      t = e(t, n), this.stream.point(t[0], t[1]);
    }
  });
}
function lH(e, t) {
  function n(i, r, o, a, s, u, l, c, f, d, h, g, p, m) {
    var y = l - i, v = c - r, b = y * y + v * v;
    if (b > 4 * t && p--) {
      var x = a + d, E = s + h, A = u + g, w = vn(x * x + E * E + A * A), _ = Rn(A /= w), k = Ae(Ae(A) - 1) < ne || Ae(o - f) < ne ? (o + f) / 2 : hi(E, x), C = e(k, _), O = C[0], S = C[1], D = O - i, M = S - r, F = v * D - y * M;
      (F * F / b > t || Ae((y * D + v * M) / b - 0.5) > 0.3 || a * d + s * h + u * g < sH) && (n(i, r, o, a, s, u, O, S, k, x /= w, E /= w, A, p, m), m.point(O, S), n(O, S, k, x, E, A, l, c, f, d, h, g, p, m));
    }
  }
  return function(i) {
    var r, o, a, s, u, l, c, f, d, h, g, p, m = {
      point: y,
      lineStart: v,
      lineEnd: x,
      polygonStart: function() {
        i.polygonStart(), m.lineStart = E;
      },
      polygonEnd: function() {
        i.polygonEnd(), m.lineStart = v;
      }
    };
    function y(_, k) {
      _ = e(_, k), i.point(_[0], _[1]);
    }
    function v() {
      f = NaN, m.point = b, i.lineStart();
    }
    function b(_, k) {
      var C = Os([_, k]), O = e(_, k);
      n(f, d, c, h, g, p, f = O[0], d = O[1], c = _, h = C[0], g = C[1], p = C[2], WS, i), i.point(f, d);
    }
    function x() {
      m.point = y, i.lineEnd();
    }
    function E() {
      v(), m.point = A, m.lineEnd = w;
    }
    function A(_, k) {
      b(r = _, k), o = f, a = d, s = h, u = g, l = p, m.point = b;
    }
    function w() {
      n(f, d, c, h, g, p, o, a, r, s, u, l, WS, i), m.lineEnd = x, x();
    }
    return m;
  };
}
var cH = Dp({
  point: function(e, t) {
    this.stream.point(e * ye, t * ye);
  }
});
function fH(e) {
  return Dp({
    point: function(t, n) {
      var i = e(t, n);
      return this.stream.point(i[0], i[1]);
    }
  });
}
function dH(e, t, n, i, r) {
  function o(a, s) {
    return a *= i, s *= r, [t + e * a, n - e * s];
  }
  return o.invert = function(a, s) {
    return [(a - t) / e * i, (n - s) / e * r];
  }, o;
}
function HS(e, t, n, i, r, o) {
  if (!o)
    return dH(e, t, n, i, r);
  var a = re(o), s = ee(o), u = a * e, l = s * e, c = a / e, f = s / e, d = (s * n - a * t) / e, h = (s * t + a * n) / e;
  function g(p, m) {
    return p *= i, m *= r, [u * p - l * m + t, n - l * p - u * m];
  }
  return g.invert = function(p, m) {
    return [i * (c * p - f * m + d), r * (h - f * p - c * m)];
  }, g;
}
function kr(e) {
  return lN(function() {
    return e;
  })();
}
function lN(e) {
  var t, n = 150, i = 480, r = 250, o = 0, a = 0, s = 0, u = 0, l = 0, c, f = 0, d = 1, h = 1, g = null, p = RS, m = null, y, v, b, x = hf, E = 0.5, A, w, _, k, C;
  function O(F) {
    return _(F[0] * ye, F[1] * ye);
  }
  function S(F) {
    return F = _.invert(F[0], F[1]), F && [F[0] * st, F[1] * st];
  }
  O.stream = function(F) {
    return k && C === F ? k : k = cH(fH(c)(p(A(x(C = F)))));
  }, O.preclip = function(F) {
    return arguments.length ? (p = F, g = void 0, M()) : p;
  }, O.postclip = function(F) {
    return arguments.length ? (x = F, m = y = v = b = null, M()) : x;
  }, O.clipAngle = function(F) {
    return arguments.length ? (p = +F ? YG(g = F * ye) : (g = null, RS), M()) : g * st;
  }, O.clipExtent = function(F) {
    return arguments.length ? (x = F == null ? (m = y = v = b = null, hf) : KT(m = +F[0][0], y = +F[0][1], v = +F[1][0], b = +F[1][1]), M()) : m == null ? null : [[m, y], [v, b]];
  }, O.scale = function(F) {
    return arguments.length ? (n = +F, D()) : n;
  }, O.translate = function(F) {
    return arguments.length ? (i = +F[0], r = +F[1], D()) : [i, r];
  }, O.center = function(F) {
    return arguments.length ? (o = F[0] % 360 * ye, a = F[1] % 360 * ye, D()) : [o * st, a * st];
  }, O.rotate = function(F) {
    return arguments.length ? (s = F[0] % 360 * ye, u = F[1] % 360 * ye, l = F.length > 2 ? F[2] % 360 * ye : 0, D()) : [s * st, u * st, l * st];
  }, O.angle = function(F) {
    return arguments.length ? (f = F % 360 * ye, D()) : f * st;
  }, O.reflectX = function(F) {
    return arguments.length ? (d = F ? -1 : 1, D()) : d < 0;
  }, O.reflectY = function(F) {
    return arguments.length ? (h = F ? -1 : 1, D()) : h < 0;
  }, O.precision = function(F) {
    return arguments.length ? (A = GS(w, E = F * F), M()) : vn(E);
  }, O.fitExtent = function(F, $) {
    return $p(O, F, $);
  }, O.fitSize = function(F, $) {
    return $w(O, F, $);
  }, O.fitWidth = function(F, $) {
    return Mw(O, F, $);
  }, O.fitHeight = function(F, $) {
    return Tw(O, F, $);
  };
  function D() {
    var F = HS(n, 0, 0, d, h, f).apply(null, t(o, a)), $ = HS(n, i - F[0], r - F[1], d, h, f);
    return c = HT(s, u, l), w = Sv(t, $), _ = Sv(c, w), A = GS(w, E), M();
  }
  function M() {
    return k = C = null, O;
  }
  return function() {
    return t = e.apply(this, arguments), O.invert = t.invert && S, D();
  };
}
function Nw(e) {
  var t = 0, n = me / 3, i = lN(e), r = i(t, n);
  return r.parallels = function(o) {
    return arguments.length ? i(t = o[0] * ye, n = o[1] * ye) : [t * st, n * st];
  }, r;
}
function hH(e) {
  var t = re(e);
  function n(i, r) {
    return [i * t, ee(r) / t];
  }
  return n.invert = function(i, r) {
    return [i / t, Rn(r * t)];
  }, n;
}
function gH(e, t) {
  var n = ee(e), i = (n + ee(t)) / 2;
  if (Ae(i) < ne)
    return hH(e);
  var r = 1 + n * (2 * i - n), o = vn(r) / i;
  function a(s, u) {
    var l = vn(r - 2 * i * ee(u)) / i;
    return [l * ee(s *= i), o - l * re(s)];
  }
  return a.invert = function(s, u) {
    var l = o - u, c = hi(s, Ae(l)) * oi(l);
    return l * i < 0 && (c -= me * oi(s) * oi(l)), [c / i, Rn((r - (s * s + l * l) * i * i) / (2 * i))];
  }, a;
}
function e0() {
  return Nw(gH).scale(155.424).center([0, 33.6442]);
}
function cN() {
  return e0().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]);
}
function pH(e) {
  var t = e.length;
  return {
    point: function(n, i) {
      for (var r = -1; ++r < t; )
        e[r].point(n, i);
    },
    sphere: function() {
      for (var n = -1; ++n < t; )
        e[n].sphere();
    },
    lineStart: function() {
      for (var n = -1; ++n < t; )
        e[n].lineStart();
    },
    lineEnd: function() {
      for (var n = -1; ++n < t; )
        e[n].lineEnd();
    },
    polygonStart: function() {
      for (var n = -1; ++n < t; )
        e[n].polygonStart();
    },
    polygonEnd: function() {
      for (var n = -1; ++n < t; )
        e[n].polygonEnd();
    }
  };
}
function mH() {
  var e, t, n = cN(), i, r = e0().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), o, a = e0().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), s, u, l = { point: function(d, h) {
    u = [d, h];
  } };
  function c(d) {
    var h = d[0], g = d[1];
    return u = null, i.point(h, g), u || (o.point(h, g), u) || (s.point(h, g), u);
  }
  c.invert = function(d) {
    var h = n.scale(), g = n.translate(), p = (d[0] - g[0]) / h, m = (d[1] - g[1]) / h;
    return (m >= 0.12 && m < 0.234 && p >= -0.425 && p < -0.214 ? r : m >= 0.166 && m < 0.234 && p >= -0.214 && p < -0.115 ? a : n).invert(d);
  }, c.stream = function(d) {
    return e && t === d ? e : e = pH([n.stream(t = d), r.stream(d), a.stream(d)]);
  }, c.precision = function(d) {
    return arguments.length ? (n.precision(d), r.precision(d), a.precision(d), f()) : n.precision();
  }, c.scale = function(d) {
    return arguments.length ? (n.scale(d), r.scale(d * 0.35), a.scale(d), c.translate(n.translate())) : n.scale();
  }, c.translate = function(d) {
    if (!arguments.length)
      return n.translate();
    var h = n.scale(), g = +d[0], p = +d[1];
    return i = n.translate(d).clipExtent([[g - 0.455 * h, p - 0.238 * h], [g + 0.455 * h, p + 0.238 * h]]).stream(l), o = r.translate([g - 0.307 * h, p + 0.201 * h]).clipExtent([[g - 0.425 * h + ne, p + 0.12 * h + ne], [g - 0.214 * h - ne, p + 0.234 * h - ne]]).stream(l), s = a.translate([g - 0.205 * h, p + 0.212 * h]).clipExtent([[g - 0.214 * h + ne, p + 0.166 * h + ne], [g - 0.115 * h - ne, p + 0.234 * h - ne]]).stream(l), f();
  }, c.fitExtent = function(d, h) {
    return $p(c, d, h);
  }, c.fitSize = function(d, h) {
    return $w(c, d, h);
  }, c.fitWidth = function(d, h) {
    return Mw(c, d, h);
  }, c.fitHeight = function(d, h) {
    return Tw(c, d, h);
  };
  function f() {
    return e = t = null, c;
  }
  return c.scale(1070);
}
function fN(e) {
  return function(t, n) {
    var i = re(t), r = re(n), o = e(i * r);
    return o === 1 / 0 ? [2, 0] : [
      o * r * ee(t),
      o * ee(n)
    ];
  };
}
function ad(e) {
  return function(t, n) {
    var i = vn(t * t + n * n), r = e(i), o = ee(r), a = re(r);
    return [
      hi(t * o, i * a),
      Rn(i && n * o / i)
    ];
  };
}
var dN = fN(function(e) {
  return vn(2 / (1 + e));
});
dN.invert = ad(function(e) {
  return 2 * Rn(e / 2);
});
function yH() {
  return kr(dN).scale(124.75).clipAngle(180 - 1e-3);
}
var hN = fN(function(e) {
  return (e = RT(e)) && e / ee(e);
});
hN.invert = ad(function(e) {
  return e;
});
function vH() {
  return kr(hN).scale(79.4188).clipAngle(180 - 1e-3);
}
function Mp(e, t) {
  return [e, Rg(Fw((rt + t) / 2))];
}
Mp.invert = function(e, t) {
  return [e, 2 * Fl(NT(t)) - rt];
};
function bH() {
  return gN(Mp).scale(961 / yn);
}
function gN(e) {
  var t = kr(e), n = t.center, i = t.scale, r = t.translate, o = t.clipExtent, a = null, s, u, l;
  t.scale = function(f) {
    return arguments.length ? (i(f), c()) : i();
  }, t.translate = function(f) {
    return arguments.length ? (r(f), c()) : r();
  }, t.center = function(f) {
    return arguments.length ? (n(f), c()) : n();
  }, t.clipExtent = function(f) {
    return arguments.length ? (f == null ? a = s = u = l = null : (a = +f[0][0], s = +f[0][1], u = +f[1][0], l = +f[1][1]), c()) : a == null ? null : [[a, s], [u, l]];
  };
  function c() {
    var f = me * i(), d = t(IG(t.rotate()).invert([0, 0]));
    return o(a == null ? [[d[0] - f, d[1] - f], [d[0] + f, d[1] + f]] : e === Mp ? [[Math.max(d[0] - f, a), s], [Math.min(d[0] + f, u), l]] : [[a, Math.max(d[1] - f, s)], [u, Math.min(d[1] + f, l)]]);
  }
  return c();
}
function eh(e) {
  return Fw((rt + e) / 2);
}
function xH(e, t) {
  var n = re(e), i = e === t ? ee(e) : Rg(n / re(t)) / Rg(eh(t) / eh(e)), r = n * x1(eh(e), i) / i;
  if (!i)
    return Mp;
  function o(a, s) {
    r > 0 ? s < -rt + ne && (s = -rt + ne) : s > rt - ne && (s = rt - ne);
    var u = r / x1(eh(s), i);
    return [u * ee(i * a), r - u * re(i * a)];
  }
  return o.invert = function(a, s) {
    var u = r - s, l = oi(i) * vn(a * a + u * u), c = hi(a, Ae(u)) * oi(u);
    return u * i < 0 && (c -= me * oi(a) * oi(u)), [c / i, 2 * Fl(x1(r / l, 1 / i)) - rt];
  }, o;
}
function wH() {
  return Nw(xH).scale(109.5).parallels([30, 30]);
}
function t0(e, t) {
  return [e, t];
}
t0.invert = t0;
function EH() {
  return kr(t0).scale(152.63);
}
function AH(e, t) {
  var n = re(e), i = e === t ? ee(e) : (n - re(t)) / (t - e), r = n / i + e;
  if (Ae(i) < ne)
    return t0;
  function o(a, s) {
    var u = r - s, l = i * a;
    return [u * ee(l), r - u * re(l)];
  }
  return o.invert = function(a, s) {
    var u = r - s, l = hi(a, Ae(u)) * oi(u);
    return u * i < 0 && (l -= me * oi(a) * oi(u)), [l / i, r - oi(i) * vn(a * a + u * u)];
  }, o;
}
function _H() {
  return Nw(AH).scale(131.154).center([0, 13.9389]);
}
var Uc = 1.340264, qc = -0.081106, Wc = 893e-6, Gc = 3796e-6, n0 = vn(3) / 2, OH = 12;
function pN(e, t) {
  var n = Rn(n0 * ee(t)), i = n * n, r = i * i * i;
  return [
    e * re(n) / (n0 * (Uc + 3 * qc * i + r * (7 * Wc + 9 * Gc * i))),
    n * (Uc + qc * i + r * (Wc + Gc * i))
  ];
}
pN.invert = function(e, t) {
  for (var n = t, i = n * n, r = i * i * i, o = 0, a, s, u; o < OH && (s = n * (Uc + qc * i + r * (Wc + Gc * i)) - t, u = Uc + 3 * qc * i + r * (7 * Wc + 9 * Gc * i), n -= a = s / u, i = n * n, r = i * i * i, !(Ae(a) < Tg)); ++o)
    ;
  return [
    n0 * e * (Uc + 3 * qc * i + r * (7 * Wc + 9 * Gc * i)) / re(n),
    Rn(ee(n) / n0)
  ];
};
function SH() {
  return kr(pN).scale(177.158);
}
function mN(e, t) {
  var n = re(t), i = re(e) * n;
  return [n * ee(e) / i, ee(t) / i];
}
mN.invert = ad(Fl);
function CH() {
  return kr(mN).scale(144.049).clipAngle(60);
}
function FH() {
  var e = 1, t = 0, n = 0, i = 1, r = 1, o = 0, a, s, u = null, l, c, f, d = 1, h = 1, g = Dp({
    point: function(x, E) {
      var A = b([x, E]);
      this.stream.point(A[0], A[1]);
    }
  }), p = hf, m, y;
  function v() {
    return d = e * i, h = e * r, m = y = null, b;
  }
  function b(x) {
    var E = x[0] * d, A = x[1] * h;
    if (o) {
      var w = A * a - E * s;
      E = E * a + A * s, A = w;
    }
    return [E + t, A + n];
  }
  return b.invert = function(x) {
    var E = x[0] - t, A = x[1] - n;
    if (o) {
      var w = A * a + E * s;
      E = E * a - A * s, A = w;
    }
    return [E / d, A / h];
  }, b.stream = function(x) {
    return m && y === x ? m : m = g(p(y = x));
  }, b.postclip = function(x) {
    return arguments.length ? (p = x, u = l = c = f = null, v()) : p;
  }, b.clipExtent = function(x) {
    return arguments.length ? (p = x == null ? (u = l = c = f = null, hf) : KT(u = +x[0][0], l = +x[0][1], c = +x[1][0], f = +x[1][1]), v()) : u == null ? null : [[u, l], [c, f]];
  }, b.scale = function(x) {
    return arguments.length ? (e = +x, v()) : e;
  }, b.translate = function(x) {
    return arguments.length ? (t = +x[0], n = +x[1], v()) : [t, n];
  }, b.angle = function(x) {
    return arguments.length ? (o = x % 360 * ye, s = ee(o), a = re(o), v()) : o * st;
  }, b.reflectX = function(x) {
    return arguments.length ? (i = x ? -1 : 1, v()) : i < 0;
  }, b.reflectY = function(x) {
    return arguments.length ? (r = x ? -1 : 1, v()) : r < 0;
  }, b.fitExtent = function(x, E) {
    return $p(b, x, E);
  }, b.fitSize = function(x, E) {
    return $w(b, x, E);
  }, b.fitWidth = function(x, E) {
    return Mw(b, x, E);
  }, b.fitHeight = function(x, E) {
    return Tw(b, x, E);
  }, b;
}
function yN(e, t) {
  var n = t * t, i = n * n;
  return [
    e * (0.8707 - 0.131979 * n + i * (-0.013791 + i * (3971e-6 * n - 1529e-6 * i))),
    t * (1.007226 + n * (0.015085 + i * (-0.044475 + 0.028874 * n - 5916e-6 * i)))
  ];
}
yN.invert = function(e, t) {
  var n = t, i = 25, r;
  do {
    var o = n * n, a = o * o;
    n -= r = (n * (1.007226 + o * (0.015085 + a * (-0.044475 + 0.028874 * o - 5916e-6 * a))) - t) / (1.007226 + o * (0.015085 * 3 + a * (-0.044475 * 7 + 0.028874 * 9 * o - 5916e-6 * 11 * a)));
  } while (Ae(r) > ne && --i > 0);
  return [
    e / (0.8707 + (o = n * n) * (-0.131979 + o * (-0.013791 + o * o * o * (3971e-6 - 1529e-6 * o)))),
    n
  ];
};
function kH() {
  return kr(yN).scale(175.295);
}
function vN(e, t) {
  return [re(t) * ee(e), ee(t)];
}
vN.invert = ad(Rn);
function DH() {
  return kr(vN).scale(249.5).clipAngle(90 + ne);
}
function bN(e, t) {
  var n = re(t), i = 1 + re(e) * n;
  return [n * ee(e) / i, ee(t) / i];
}
bN.invert = ad(function(e) {
  return 2 * Fl(e);
});
function $H() {
  return kr(bN).scale(250).clipAngle(142);
}
function xN(e, t) {
  return [Rg(Fw((rt + t) / 2)), -e];
}
xN.invert = function(e, t) {
  return [-t, 2 * Fl(NT(e)) - rt];
};
function MH() {
  var e = gN(xN), t = e.center, n = e.rotate;
  return e.center = function(i) {
    return arguments.length ? t([-i[1], i[0]]) : (i = t(), [i[1], -i[0]]);
  }, e.rotate = function(i) {
    return arguments.length ? n([i[0], i[1], i.length > 2 ? i[2] + 90 : 90]) : (i = n(), [i[0], i[1], i[2] - 90]);
  }, n([0, 0, 90]).scale(159.155);
}
var TH = Math.abs, Pv = Math.cos, i0 = Math.sin, NH = 1e-6, wN = Math.PI, Lv = wN / 2, YS = RH(2);
function XS(e) {
  return e > 1 ? Lv : e < -1 ? -Lv : Math.asin(e);
}
function RH(e) {
  return e > 0 ? Math.sqrt(e) : 0;
}
function jH(e, t) {
  var n = e * i0(t), i = 30, r;
  do
    t -= r = (t + i0(t) - n) / (1 + Pv(t));
  while (TH(r) > NH && --i > 0);
  return t / 2;
}
function PH(e, t, n) {
  function i(r, o) {
    return [e * r * Pv(o = jH(n, o)), t * i0(o)];
  }
  return i.invert = function(r, o) {
    return o = XS(o / t), [r / (e * Pv(o)), XS((2 * o + i0(2 * o)) / n)];
  }, i;
}
var LH = PH(YS / Lv, YS, wN);
function IH() {
  return kr(LH).scale(169.529);
}
const BH = uN(), Iv = [
  "clipAngle",
  "clipExtent",
  "scale",
  "translate",
  "center",
  "rotate",
  "parallels",
  "precision",
  "reflectX",
  "reflectY",
  "coefficient",
  "distance",
  "fraction",
  "lobes",
  "parallel",
  "radius",
  "ratio",
  "spacing",
  "tilt"
];
function zH(e, t) {
  return function n() {
    const i = t();
    return i.type = e, i.path = uN().projection(i), i.copy = i.copy || function() {
      const r = n();
      return Iv.forEach((o) => {
        i[o] && r[o](i[o]());
      }), r.path.pointRadius(i.path.pointRadius()), r;
    }, i;
  };
}
function Rw(e, t) {
  if (!e || typeof e != "string")
    throw new Error("Projection type must be a name string.");
  return e = e.toLowerCase(), arguments.length > 1 ? (r0[e] = zH(e, t), this) : r0[e] || null;
}
function EN(e) {
  return e && e.path || BH;
}
const r0 = {
  albers: cN,
  albersusa: mH,
  azimuthalequalarea: yH,
  azimuthalequidistant: vH,
  conicconformal: wH,
  conicequalarea: e0,
  conicequidistant: _H,
  equalEarth: SH,
  equirectangular: EH,
  gnomonic: CH,
  identity: FH,
  mercator: bH,
  mollweide: IH,
  naturalEarth1: kH,
  orthographic: DH,
  stereographic: $H,
  transversemercator: MH
};
for (const e in r0)
  Rw(e, r0[e]);
function UH() {
}
const zr = [[], [[[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 AN() {
  var e = 1, t = 1, n = s;
  function i(u, l) {
    return l.map((c) => r(u, c));
  }
  function r(u, l) {
    var c = [], f = [];
    return o(u, l, (d) => {
      n(d, u, l), qH(d) > 0 ? c.push([d]) : f.push(d);
    }), f.forEach((d) => {
      for (var h = 0, g = c.length, p; h < g; ++h)
        if (WH((p = c[h])[0], d) !== -1) {
          p.push(d);
          return;
        }
    }), {
      type: "MultiPolygon",
      value: l,
      coordinates: c
    };
  }
  function o(u, l, c) {
    var f = new Array(), d = new Array(), h, g, p, m, y, v;
    for (h = g = -1, m = u[0] >= l, zr[m << 1].forEach(b); ++h < e - 1; )
      p = m, m = u[h + 1] >= l, zr[p | m << 1].forEach(b);
    for (zr[m << 0].forEach(b); ++g < t - 1; ) {
      for (h = -1, m = u[g * e + e] >= l, y = u[g * e] >= l, zr[m << 1 | y << 2].forEach(b); ++h < e - 1; )
        p = m, m = u[g * e + e + h + 1] >= l, v = y, y = u[g * e + h + 1] >= l, zr[p | m << 1 | y << 2 | v << 3].forEach(b);
      zr[m | y << 3].forEach(b);
    }
    for (h = -1, y = u[g * e] >= l, zr[y << 2].forEach(b); ++h < e - 1; )
      v = y, y = u[g * e + h + 1] >= l, zr[y << 2 | v << 3].forEach(b);
    zr[y << 3].forEach(b);
    function b(x) {
      var E = [x[0][0] + h, x[0][1] + g], A = [x[1][0] + h, x[1][1] + g], w = a(E), _ = a(A), k, C;
      (k = d[w]) ? (C = f[_]) ? (delete d[k.end], delete f[C.start], k === C ? (k.ring.push(A), c(k.ring)) : f[k.start] = d[C.end] = {
        start: k.start,
        end: C.end,
        ring: k.ring.concat(C.ring)
      }) : (delete d[k.end], k.ring.push(A), d[k.end = _] = k) : (k = f[_]) ? (C = d[w]) ? (delete f[k.start], delete d[C.end], k === C ? (k.ring.push(A), c(k.ring)) : f[C.start] = d[k.end] = {
        start: C.start,
        end: k.end,
        ring: C.ring.concat(k.ring)
      }) : (delete f[k.start], k.ring.unshift(E), f[k.start = w] = k) : f[w] = d[_] = {
        start: w,
        end: _,
        ring: [E, A]
      };
    }
  }
  function a(u) {
    return u[0] * 2 + u[1] * (e + 1) * 4;
  }
  function s(u, l, c) {
    u.forEach((f) => {
      var d = f[0], h = f[1], g = d | 0, p = h | 0, m, y = l[p * e + g];
      d > 0 && d < e && g === d && (m = l[p * e + g - 1], f[0] = d + (c - m) / (y - m) - 0.5), h > 0 && h < t && p === h && (m = l[(p - 1) * e + g], f[1] = h + (c - m) / (y - m) - 0.5);
    });
  }
  return i.contour = r, i.size = function(u) {
    if (!arguments.length)
      return [e, t];
    var l = Math.floor(u[0]), c = Math.floor(u[1]);
    return l >= 0 && c >= 0 || P("invalid size"), e = l, t = c, i;
  }, i.smooth = function(u) {
    return arguments.length ? (n = u ? s : UH, i) : n === s;
  }, i;
}
function qH(e) {
  for (var t = 0, n = e.length, i = e[n - 1][1] * e[0][0] - e[n - 1][0] * e[0][1]; ++t < n; )
    i += e[t - 1][1] * e[t][0] - e[t - 1][0] * e[t][1];
  return i;
}
function WH(e, t) {
  for (var n = -1, i = t.length, r; ++n < i; )
    if (r = GH(e, t[n]))
      return r;
  return 0;
}
function GH(e, t) {
  for (var n = t[0], i = t[1], r = -1, o = 0, a = e.length, s = a - 1; o < a; s = o++) {
    var u = e[o], l = u[0], c = u[1], f = e[s], d = f[0], h = f[1];
    if (HH(u, f, t))
      return 0;
    c > i != h > i && n < (d - l) * (i - c) / (h - c) + l && (r = -r);
  }
  return r;
}
function HH(e, t, n) {
  var i;
  return YH(e, t, n) && XH(e[i = +(e[0] === t[0])], n[i], t[i]);
}
function YH(e, t, n) {
  return (t[0] - e[0]) * (n[1] - e[1]) === (n[0] - e[0]) * (t[1] - e[1]);
}
function XH(e, t, n) {
  return e <= t && t <= n || n <= t && t <= e;
}
function _N(e, t, n) {
  return function(i) {
    var r = vr(i), o = n ? Math.min(r[0], 0) : r[0], a = r[1], s = a - o, u = t ? ia(o, a, e) : s / (e + 1);
    return Hn(o + u, a, u);
  };
}
function jw(e) {
  N.call(this, null, e);
}
jw.Definition = {
  type: "Isocontour",
  metadata: {
    generates: !0
  },
  params: [{
    name: "field",
    type: "field"
  }, {
    name: "thresholds",
    type: "number",
    array: !0
  }, {
    name: "levels",
    type: "number"
  }, {
    name: "nice",
    type: "boolean",
    default: !1
  }, {
    name: "resolve",
    type: "enum",
    values: ["shared", "independent"],
    default: "independent"
  }, {
    name: "zero",
    type: "boolean",
    default: !0
  }, {
    name: "smooth",
    type: "boolean",
    default: !0
  }, {
    name: "scale",
    type: "number",
    expr: !0
  }, {
    name: "translate",
    type: "number",
    array: !0,
    expr: !0
  }, {
    name: "as",
    type: "string",
    null: !0,
    default: "contour"
  }]
};
q(jw, N, {
  transform(e, t) {
    if (this.value && !t.changed() && !e.modified())
      return t.StopPropagation;
    var n = t.fork(t.NO_SOURCE | t.NO_FIELDS), i = t.materialize(t.SOURCE).source, r = e.field || mn, o = AN().smooth(e.smooth !== !1), a = e.thresholds || VH(i, r, e), s = e.as === null ? null : e.as || "contour", u = [];
    return i.forEach((l) => {
      const c = r(l), f = o.size([c.width, c.height])(c.values, J(a) ? a : a(c.values));
      KH(f, c, l, e), f.forEach((d) => {
        u.push(J0(l, Te(s != null ? {
          [s]: d
        } : d)));
      });
    }), this.value && (n.rem = this.value), this.value = n.source = n.add = u, n;
  }
});
function VH(e, t, n) {
  const i = _N(n.levels || 10, n.nice, n.zero !== !1);
  return n.resolve !== "shared" ? i : i(e.map((r) => fs(t(r).values)));
}
function KH(e, t, n, i) {
  let r = i.scale || t.scale, o = i.translate || t.translate;
  if (he(r) && (r = r(n, i)), he(o) && (o = o(n, i)), (r === 1 || r == null) && !o)
    return;
  const a = (na(r) ? r : r[0]) || 1, s = (na(r) ? r : r[1]) || 1, u = o && o[0] || 0, l = o && o[1] || 0;
  e.forEach(ON(t, a, s, u, l));
}
function ON(e, t, n, i, r) {
  const o = e.x1 || 0, a = e.y1 || 0, s = t * n < 0;
  function u(f) {
    f.forEach(l);
  }
  function l(f) {
    s && f.reverse(), f.forEach(c);
  }
  function c(f) {
    f[0] = (f[0] - o) * t + i, f[1] = (f[1] - a) * n + r;
  }
  return function(f) {
    return f.coordinates.forEach(u), f;
  };
}
function VS(e, t, n) {
  const i = e >= 0 ? e : Cx(t, n);
  return Math.round((Math.sqrt(4 * i * i + 1) - 1) / 2);
}
function O1(e) {
  return he(e) ? e : Zt(+e);
}
function SN() {
  var e = (u) => u[0], t = (u) => u[1], n = vl, i = [-1, -1], r = 960, o = 500, a = 2;
  function s(u, l) {
    const c = VS(i[0], u, e) >> a, f = VS(i[1], u, t) >> a, d = c ? c + 2 : 0, h = f ? f + 2 : 0, g = 2 * d + (r >> a), p = 2 * h + (o >> a), m = new Float32Array(g * p), y = new Float32Array(g * p);
    let v = m;
    u.forEach((x) => {
      const E = d + (+e(x) >> a), A = h + (+t(x) >> a);
      E >= 0 && E < g && A >= 0 && A < p && (m[E + A * g] += +n(x));
    }), c > 0 && f > 0 ? (du(g, p, m, y, c), hu(g, p, y, m, f), du(g, p, m, y, c), hu(g, p, y, m, f), du(g, p, m, y, c), hu(g, p, y, m, f)) : c > 0 ? (du(g, p, m, y, c), du(g, p, y, m, c), du(g, p, m, y, c), v = y) : f > 0 && (hu(g, p, m, y, f), hu(g, p, y, m, f), hu(g, p, m, y, f), v = y);
    const b = l ? Math.pow(2, -2 * a) : 1 / WD(v);
    for (let x = 0, E = g * p; x < E; ++x)
      v[x] *= b;
    return {
      values: v,
      scale: 1 << a,
      width: g,
      height: p,
      x1: d,
      y1: h,
      x2: d + (r >> a),
      y2: h + (o >> a)
    };
  }
  return s.x = function(u) {
    return arguments.length ? (e = O1(u), s) : e;
  }, s.y = function(u) {
    return arguments.length ? (t = O1(u), s) : t;
  }, s.weight = function(u) {
    return arguments.length ? (n = O1(u), s) : n;
  }, s.size = function(u) {
    if (!arguments.length)
      return [r, o];
    var l = +u[0], c = +u[1];
    return l >= 0 && c >= 0 || P("invalid size"), r = l, o = c, s;
  }, s.cellSize = function(u) {
    return arguments.length ? ((u = +u) >= 1 || P("invalid cell size"), a = Math.floor(Math.log(u) / Math.LN2), s) : 1 << a;
  }, s.bandwidth = function(u) {
    return arguments.length ? (u = oe(u), u.length === 1 && (u = [+u[0], +u[0]]), u.length !== 2 && P("invalid bandwidth"), i = u, s) : i;
  }, s;
}
function du(e, t, n, i, r) {
  const o = (r << 1) + 1;
  for (let a = 0; a < t; ++a)
    for (let s = 0, u = 0; s < e + r; ++s)
      s < e && (u += n[s + a * e]), s >= r && (s >= o && (u -= n[s - o + a * e]), i[s - r + a * e] = u / Math.min(s + 1, e - 1 + o - s, o));
}
function hu(e, t, n, i, r) {
  const o = (r << 1) + 1;
  for (let a = 0; a < e; ++a)
    for (let s = 0, u = 0; s < t + r; ++s)
      s < t && (u += n[a + s * e]), s >= r && (s >= o && (u -= n[a + (s - o) * e]), i[a + (s - r) * e] = u / Math.min(s + 1, t - 1 + o - s, o));
}
function Pw(e) {
  N.call(this, null, e);
}
Pw.Definition = {
  type: "KDE2D",
  metadata: {
    generates: !0
  },
  params: [{
    name: "size",
    type: "number",
    array: !0,
    length: 2,
    required: !0
  }, {
    name: "x",
    type: "field",
    required: !0
  }, {
    name: "y",
    type: "field",
    required: !0
  }, {
    name: "weight",
    type: "field"
  }, {
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "cellSize",
    type: "number"
  }, {
    name: "bandwidth",
    type: "number",
    array: !0,
    length: 2
  }, {
    name: "counts",
    type: "boolean",
    default: !1
  }, {
    name: "as",
    type: "string",
    default: "grid"
  }]
};
const JH = ["x", "y", "weight", "size", "cellSize", "bandwidth"];
function CN(e, t) {
  return JH.forEach((n) => t[n] != null ? e[n](t[n]) : 0), e;
}
q(Pw, N, {
  transform(e, t) {
    if (this.value && !t.changed() && !e.modified())
      return t.StopPropagation;
    var n = t.fork(t.NO_SOURCE | t.NO_FIELDS), i = t.materialize(t.SOURCE).source, r = QH(i, e.groupby), o = (e.groupby || []).map(ot), a = CN(SN(), e), s = e.as || "grid", u = [];
    function l(c, f) {
      for (let d = 0; d < o.length; ++d)
        c[o[d]] = f[d];
      return c;
    }
    return u = r.map((c) => Te(l({
      [s]: a(c, e.counts)
    }, c.dims))), this.value && (n.rem = this.value), this.value = n.source = n.add = u, n;
  }
});
function QH(e, t) {
  var n = [], i = (c) => c(s), r, o, a, s, u, l;
  if (t == null)
    n.push(e);
  else
    for (r = {}, o = 0, a = e.length; o < a; ++o)
      s = e[o], u = t.map(i), l = r[u], l || (r[u] = l = [], l.dims = u, n.push(l)), l.push(s);
  return n;
}
function Lw(e) {
  N.call(this, null, e);
}
Lw.Definition = {
  type: "Contour",
  metadata: {
    generates: !0
  },
  params: [{
    name: "size",
    type: "number",
    array: !0,
    length: 2,
    required: !0
  }, {
    name: "values",
    type: "number",
    array: !0
  }, {
    name: "x",
    type: "field"
  }, {
    name: "y",
    type: "field"
  }, {
    name: "weight",
    type: "field"
  }, {
    name: "cellSize",
    type: "number"
  }, {
    name: "bandwidth",
    type: "number"
  }, {
    name: "count",
    type: "number"
  }, {
    name: "nice",
    type: "boolean",
    default: !1
  }, {
    name: "thresholds",
    type: "number",
    array: !0
  }, {
    name: "smooth",
    type: "boolean",
    default: !0
  }]
};
q(Lw, N, {
  transform(e, t) {
    if (this.value && !t.changed() && !e.modified())
      return t.StopPropagation;
    var n = t.fork(t.NO_SOURCE | t.NO_FIELDS), i = AN().smooth(e.smooth !== !1), r = e.values, o = e.thresholds || _N(e.count || 10, e.nice, !!r), a = e.size, s, u;
    return r || (r = t.materialize(t.SOURCE).source, s = CN(SN(), e)(r, !0), u = ON(s, s.scale || 1, s.scale || 1, 0, 0), a = [s.width, s.height], r = s.values), o = J(o) ? o : o(r), r = i.size(a)(r, o), u && r.forEach(u), this.value && (n.rem = this.value), this.value = n.source = n.add = (r || []).map(Te), n;
  }
});
const Bv = "Feature", Iw = "FeatureCollection", ZH = "MultiPoint";
function Bw(e) {
  N.call(this, null, e);
}
Bw.Definition = {
  type: "GeoJSON",
  metadata: {},
  params: [{
    name: "fields",
    type: "field",
    array: !0,
    length: 2
  }, {
    name: "geojson",
    type: "field"
  }]
};
q(Bw, N, {
  transform(e, t) {
    var n = this._features, i = this._points, r = e.fields, o = r && r[0], a = r && r[1], s = e.geojson || !r && mn, u = t.ADD, l;
    l = e.modified() || t.changed(t.REM) || t.modified(Yt(s)) || o && t.modified(Yt(o)) || a && t.modified(Yt(a)), (!this.value || l) && (u = t.SOURCE, this._features = n = [], this._points = i = []), s && t.visit(u, (c) => n.push(s(c))), o && a && (t.visit(u, (c) => {
      var f = o(c), d = a(c);
      f != null && d != null && (f = +f) === f && (d = +d) === d && i.push([f, d]);
    }), n = n.concat({
      type: Bv,
      geometry: {
        type: ZH,
        coordinates: i
      }
    })), this.value = {
      type: Iw,
      features: n
    };
  }
});
function zw(e) {
  N.call(this, null, e);
}
zw.Definition = {
  type: "GeoPath",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "projection",
    type: "projection"
  }, {
    name: "field",
    type: "field"
  }, {
    name: "pointRadius",
    type: "number",
    expr: !0
  }, {
    name: "as",
    type: "string",
    default: "path"
  }]
};
q(zw, N, {
  transform(e, t) {
    var n = t.fork(t.ALL), i = this.value, r = e.field || mn, o = e.as || "path", a = n.SOURCE;
    !i || e.modified() ? (this.value = i = EN(e.projection), n.materialize().reflow()) : a = r === mn || t.modified(r.fields) ? n.ADD_MOD : n.ADD;
    const s = eY(i, e.pointRadius);
    return n.visit(a, (u) => u[o] = i(r(u))), i.pointRadius(s), n.modifies(o);
  }
});
function eY(e, t) {
  const n = e.pointRadius();
  return e.context(null), t != null && e.pointRadius(t), n;
}
function Uw(e) {
  N.call(this, null, e);
}
Uw.Definition = {
  type: "GeoPoint",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "projection",
    type: "projection",
    required: !0
  }, {
    name: "fields",
    type: "field",
    array: !0,
    required: !0,
    length: 2
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: 2,
    default: ["x", "y"]
  }]
};
q(Uw, N, {
  transform(e, t) {
    var n = e.projection, i = e.fields[0], r = e.fields[1], o = e.as || ["x", "y"], a = o[0], s = o[1], u;
    function l(c) {
      const f = n([i(c), r(c)]);
      f ? (c[a] = f[0], c[s] = f[1]) : (c[a] = void 0, c[s] = void 0);
    }
    return e.modified() ? t = t.materialize().reflow(!0).visit(t.SOURCE, l) : (u = t.modified(i.fields) || t.modified(r.fields), t.visit(u ? t.ADD_MOD : t.ADD, l)), t.modifies(o);
  }
});
function qw(e) {
  N.call(this, null, e);
}
qw.Definition = {
  type: "GeoShape",
  metadata: {
    modifies: !0,
    nomod: !0
  },
  params: [{
    name: "projection",
    type: "projection"
  }, {
    name: "field",
    type: "field",
    default: "datum"
  }, {
    name: "pointRadius",
    type: "number",
    expr: !0
  }, {
    name: "as",
    type: "string",
    default: "shape"
  }]
};
q(qw, N, {
  transform(e, t) {
    var n = t.fork(t.ALL), i = this.value, r = e.as || "shape", o = n.ADD;
    return (!i || e.modified()) && (this.value = i = tY(EN(e.projection), e.field || Mn("datum"), e.pointRadius), n.materialize().reflow(), o = n.SOURCE), n.visit(o, (a) => a[r] = i), n.modifies(r);
  }
});
function tY(e, t, n) {
  const i = n == null ? (r) => e(t(r)) : (r) => {
    var o = e.pointRadius(), a = e.pointRadius(n)(t(r));
    return e.pointRadius(o), a;
  };
  return i.context = (r) => (e.context(r), i), i;
}
function Ww(e) {
  N.call(this, [], e), this.generator = VG();
}
Ww.Definition = {
  type: "Graticule",
  metadata: {
    changes: !0,
    generates: !0
  },
  params: [{
    name: "extent",
    type: "array",
    array: !0,
    length: 2,
    content: {
      type: "number",
      array: !0,
      length: 2
    }
  }, {
    name: "extentMajor",
    type: "array",
    array: !0,
    length: 2,
    content: {
      type: "number",
      array: !0,
      length: 2
    }
  }, {
    name: "extentMinor",
    type: "array",
    array: !0,
    length: 2,
    content: {
      type: "number",
      array: !0,
      length: 2
    }
  }, {
    name: "step",
    type: "number",
    array: !0,
    length: 2
  }, {
    name: "stepMajor",
    type: "number",
    array: !0,
    length: 2,
    default: [90, 360]
  }, {
    name: "stepMinor",
    type: "number",
    array: !0,
    length: 2,
    default: [10, 10]
  }, {
    name: "precision",
    type: "number",
    default: 2.5
  }]
};
q(Ww, N, {
  transform(e, t) {
    var n = this.value, i = this.generator, r;
    if (!n.length || e.modified())
      for (const o in e)
        he(i[o]) && i[o](e[o]);
    return r = i(), n.length ? t.mod.push(Y3(n[0], r)) : t.add.push(Te(r)), n[0] = r, t;
  }
});
function Gw(e) {
  N.call(this, null, e);
}
Gw.Definition = {
  type: "heatmap",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "field",
    type: "field"
  }, {
    name: "color",
    type: "string",
    expr: !0
  }, {
    name: "opacity",
    type: "number",
    expr: !0
  }, {
    name: "resolve",
    type: "enum",
    values: ["shared", "independent"],
    default: "independent"
  }, {
    name: "as",
    type: "string",
    default: "image"
  }]
};
q(Gw, N, {
  transform(e, t) {
    if (!t.changed() && !e.modified())
      return t.StopPropagation;
    var n = t.materialize(t.SOURCE).source, i = e.resolve === "shared", r = e.field || mn, o = iY(e.opacity, e), a = nY(e.color, e), s = e.as || "image", u = {
      $x: 0,
      $y: 0,
      $value: 0,
      $max: i ? fs(n.map((l) => fs(r(l).values))) : 0
    };
    return n.forEach((l) => {
      const c = r(l), f = de({}, l, u);
      i || (f.$max = fs(c.values || [])), l[s] = rY(c, f, a.dep ? a : Zt(a(f)), o.dep ? o : Zt(o(f)));
    }), t.reflow(!0).modifies(s);
  }
});
function nY(e, t) {
  let n;
  return he(e) ? (n = (i) => ua(e(i, t)), n.dep = FN(e)) : n = Zt(ua(e || "#888")), n;
}
function iY(e, t) {
  let n;
  return he(e) ? (n = (i) => e(i, t), n.dep = FN(e)) : e ? n = Zt(e) : (n = (i) => i.$value / i.$max || 0, n.dep = !0), n;
}
function FN(e) {
  if (!he(e))
    return !1;
  const t = zi(Yt(e));
  return t.$x || t.$y || t.$value || t.$max;
}
function rY(e, t, n, i) {
  const r = e.width, o = e.height, a = e.x1 || 0, s = e.y1 || 0, u = e.x2 || r, l = e.y2 || o, c = e.values, f = c ? (m) => c[m] : Lo, d = Zo(u - a, l - s), h = d.getContext("2d"), g = h.getImageData(0, 0, u - a, l - s), p = g.data;
  for (let m = s, y = 0; m < l; ++m) {
    t.$y = m - s;
    for (let v = a, b = m * r; v < u; ++v, y += 4) {
      t.$x = v - a, t.$value = f(v + b);
      const x = n(t);
      p[y + 0] = x.r, p[y + 1] = x.g, p[y + 2] = x.b, p[y + 3] = ~~(255 * i(t));
    }
  }
  return h.putImageData(g, 0, 0), d;
}
function kN(e) {
  N.call(this, null, e), this.modified(!0);
}
q(kN, N, {
  transform(e, t) {
    let n = this.value;
    return !n || e.modified("type") ? (this.value = n = aY(e.type), Iv.forEach((i) => {
      e[i] != null && KS(n, i, e[i]);
    })) : Iv.forEach((i) => {
      e.modified(i) && KS(n, i, e[i]);
    }), e.pointRadius != null && n.path.pointRadius(e.pointRadius), e.fit && oY(n, e), t.fork(t.NO_SOURCE | t.NO_FIELDS);
  }
});
function oY(e, t) {
  const n = sY(t.fit);
  t.extent ? e.fitExtent(t.extent, n) : t.size && e.fitSize(t.size, n);
}
function aY(e) {
  const t = Rw((e || "mercator").toLowerCase());
  return t || P("Unrecognized projection type: " + e), t();
}
function KS(e, t, n) {
  he(e[t]) && e[t](n);
}
function sY(e) {
  return e = oe(e), e.length === 1 ? e[0] : {
    type: Iw,
    features: e.reduce((t, n) => t.concat(uY(n)), [])
  };
}
function uY(e) {
  return e.type === Iw ? e.features : oe(e).filter((t) => t != null).map((t) => t.type === Bv ? t : {
    type: Bv,
    geometry: t
  });
}
const lY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  contour: Lw,
  geojson: Bw,
  geopath: zw,
  geopoint: Uw,
  geoshape: qw,
  graticule: Ww,
  heatmap: Gw,
  isocontour: jw,
  kde2d: Pw,
  projection: kN
}, Symbol.toStringTag, { value: "Module" }));
function cY(e, t) {
  var n, i = 1;
  e == null && (e = 0), t == null && (t = 0);
  function r() {
    var o, a = n.length, s, u = 0, l = 0;
    for (o = 0; o < a; ++o)
      s = n[o], u += s.x, l += s.y;
    for (u = (u / a - e) * i, l = (l / a - t) * i, o = 0; o < a; ++o)
      s = n[o], s.x -= u, s.y -= l;
  }
  return r.initialize = function(o) {
    n = o;
  }, r.x = function(o) {
    return arguments.length ? (e = +o, r) : e;
  }, r.y = function(o) {
    return arguments.length ? (t = +o, r) : t;
  }, r.strength = function(o) {
    return arguments.length ? (i = +o, r) : i;
  }, r;
}
function fY(e) {
  const t = +this._x.call(null, e), n = +this._y.call(null, e);
  return DN(this.cover(t, n), t, n, e);
}
function DN(e, t, n, i) {
  if (isNaN(t) || isNaN(n))
    return e;
  var r, o = e._root, a = { data: i }, s = e._x0, u = e._y0, l = e._x1, c = e._y1, f, d, h, g, p, m, y, v;
  if (!o)
    return e._root = a, e;
  for (; o.length; )
    if ((p = t >= (f = (s + l) / 2)) ? s = f : l = f, (m = n >= (d = (u + c) / 2)) ? u = d : c = d, r = o, !(o = o[y = m << 1 | p]))
      return r[y] = a, e;
  if (h = +e._x.call(null, o.data), g = +e._y.call(null, o.data), t === h && n === g)
    return a.next = o, r ? r[y] = a : e._root = a, e;
  do
    r = r ? r[y] = new Array(4) : e._root = new Array(4), (p = t >= (f = (s + l) / 2)) ? s = f : l = f, (m = n >= (d = (u + c) / 2)) ? u = d : c = d;
  while ((y = m << 1 | p) === (v = (g >= d) << 1 | h >= f));
  return r[v] = o, r[y] = a, e;
}
function dY(e) {
  var t, n, i = e.length, r, o, a = new Array(i), s = new Array(i), u = 1 / 0, l = 1 / 0, c = -1 / 0, f = -1 / 0;
  for (n = 0; n < i; ++n)
    isNaN(r = +this._x.call(null, t = e[n])) || isNaN(o = +this._y.call(null, t)) || (a[n] = r, s[n] = o, r < u && (u = r), r > c && (c = r), o < l && (l = o), o > f && (f = o));
  if (u > c || l > f)
    return this;
  for (this.cover(u, l).cover(c, f), n = 0; n < i; ++n)
    DN(this, a[n], s[n], e[n]);
  return this;
}
function hY(e, t) {
  if (isNaN(e = +e) || isNaN(t = +t))
    return this;
  var n = this._x0, i = this._y0, r = this._x1, o = this._y1;
  if (isNaN(n))
    r = (n = Math.floor(e)) + 1, o = (i = Math.floor(t)) + 1;
  else {
    for (var a = r - n || 1, s = this._root, u, l; n > e || e >= r || i > t || t >= o; )
      switch (l = (t < i) << 1 | e < n, u = new Array(4), u[l] = s, s = u, a *= 2, l) {
        case 0:
          r = n + a, o = i + a;
          break;
        case 1:
          n = r - a, o = i + a;
          break;
        case 2:
          r = n + a, i = o - a;
          break;
        case 3:
          n = r - a, i = o - a;
          break;
      }
    this._root && this._root.length && (this._root = s);
  }
  return this._x0 = n, this._y0 = i, this._x1 = r, this._y1 = o, this;
}
function gY() {
  var e = [];
  return this.visit(function(t) {
    if (!t.length)
      do
        e.push(t.data);
      while (t = t.next);
  }), e;
}
function pY(e) {
  return arguments.length ? this.cover(+e[0][0], +e[0][1]).cover(+e[1][0], +e[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]];
}
function fn(e, t, n, i, r) {
  this.node = e, this.x0 = t, this.y0 = n, this.x1 = i, this.y1 = r;
}
function mY(e, t, n) {
  var i, r = this._x0, o = this._y0, a, s, u, l, c = this._x1, f = this._y1, d = [], h = this._root, g, p;
  for (h && d.push(new fn(h, r, o, c, f)), n == null ? n = 1 / 0 : (r = e - n, o = t - n, c = e + n, f = t + n, n *= n); g = d.pop(); )
    if (!(!(h = g.node) || (a = g.x0) > c || (s = g.y0) > f || (u = g.x1) < r || (l = g.y1) < o))
      if (h.length) {
        var m = (a + u) / 2, y = (s + l) / 2;
        d.push(
          new fn(h[3], m, y, u, l),
          new fn(h[2], a, y, m, l),
          new fn(h[1], m, s, u, y),
          new fn(h[0], a, s, m, y)
        ), (p = (t >= y) << 1 | e >= m) && (g = d[d.length - 1], d[d.length - 1] = d[d.length - 1 - p], d[d.length - 1 - p] = g);
      } else {
        var v = e - +this._x.call(null, h.data), b = t - +this._y.call(null, h.data), x = v * v + b * b;
        if (x < n) {
          var E = Math.sqrt(n = x);
          r = e - E, o = t - E, c = e + E, f = t + E, i = h.data;
        }
      }
  return i;
}
function yY(e) {
  if (isNaN(c = +this._x.call(null, e)) || isNaN(f = +this._y.call(null, e)))
    return this;
  var t, n = this._root, i, r, o, a = this._x0, s = this._y0, u = this._x1, l = this._y1, c, f, d, h, g, p, m, y;
  if (!n)
    return this;
  if (n.length)
    for (; ; ) {
      if ((g = c >= (d = (a + u) / 2)) ? a = d : u = d, (p = f >= (h = (s + l) / 2)) ? s = h : l = h, t = n, !(n = n[m = p << 1 | g]))
        return this;
      if (!n.length)
        break;
      (t[m + 1 & 3] || t[m + 2 & 3] || t[m + 3 & 3]) && (i = t, y = m);
    }
  for (; n.data !== e; )
    if (r = n, !(n = n.next))
      return this;
  return (o = n.next) && delete n.next, r ? (o ? r.next = o : delete r.next, this) : t ? (o ? t[m] = o : delete t[m], (n = t[0] || t[1] || t[2] || t[3]) && n === (t[3] || t[2] || t[1] || t[0]) && !n.length && (i ? i[y] = n : this._root = n), this) : (this._root = o, this);
}
function vY(e) {
  for (var t = 0, n = e.length; t < n; ++t)
    this.remove(e[t]);
  return this;
}
function bY() {
  return this._root;
}
function xY() {
  var e = 0;
  return this.visit(function(t) {
    if (!t.length)
      do
        ++e;
      while (t = t.next);
  }), e;
}
function wY(e) {
  var t = [], n, i = this._root, r, o, a, s, u;
  for (i && t.push(new fn(i, this._x0, this._y0, this._x1, this._y1)); n = t.pop(); )
    if (!e(i = n.node, o = n.x0, a = n.y0, s = n.x1, u = n.y1) && i.length) {
      var l = (o + s) / 2, c = (a + u) / 2;
      (r = i[3]) && t.push(new fn(r, l, c, s, u)), (r = i[2]) && t.push(new fn(r, o, c, l, u)), (r = i[1]) && t.push(new fn(r, l, a, s, c)), (r = i[0]) && t.push(new fn(r, o, a, l, c));
    }
  return this;
}
function EY(e) {
  var t = [], n = [], i;
  for (this._root && t.push(new fn(this._root, this._x0, this._y0, this._x1, this._y1)); i = t.pop(); ) {
    var r = i.node;
    if (r.length) {
      var o, a = i.x0, s = i.y0, u = i.x1, l = i.y1, c = (a + u) / 2, f = (s + l) / 2;
      (o = r[0]) && t.push(new fn(o, a, s, c, f)), (o = r[1]) && t.push(new fn(o, c, s, u, f)), (o = r[2]) && t.push(new fn(o, a, f, c, l)), (o = r[3]) && t.push(new fn(o, c, f, u, l));
    }
    n.push(i);
  }
  for (; i = n.pop(); )
    e(i.node, i.x0, i.y0, i.x1, i.y1);
  return this;
}
function AY(e) {
  return e[0];
}
function _Y(e) {
  return arguments.length ? (this._x = e, this) : this._x;
}
function OY(e) {
  return e[1];
}
function SY(e) {
  return arguments.length ? (this._y = e, this) : this._y;
}
function Hw(e, t, n) {
  var i = new Yw(t == null ? AY : t, n == null ? OY : n, NaN, NaN, NaN, NaN);
  return e == null ? i : i.addAll(e);
}
function Yw(e, t, n, i, r, o) {
  this._x = e, this._y = t, this._x0 = n, this._y0 = i, this._x1 = r, this._y1 = o, this._root = void 0;
}
function JS(e) {
  for (var t = { data: e.data }, n = t; e = e.next; )
    n = n.next = { data: e.data };
  return t;
}
var xn = Hw.prototype = Yw.prototype;
xn.copy = function() {
  var e = new Yw(this._x, this._y, this._x0, this._y0, this._x1, this._y1), t = this._root, n, i;
  if (!t)
    return e;
  if (!t.length)
    return e._root = JS(t), e;
  for (n = [{ source: t, target: e._root = new Array(4) }]; t = n.pop(); )
    for (var r = 0; r < 4; ++r)
      (i = t.source[r]) && (i.length ? n.push({ source: i, target: t.target[r] = new Array(4) }) : t.target[r] = JS(i));
  return e;
};
xn.add = fY;
xn.addAll = dY;
xn.cover = hY;
xn.data = gY;
xn.extent = pY;
xn.find = mY;
xn.remove = yY;
xn.removeAll = vY;
xn.root = bY;
xn.size = xY;
xn.visit = wY;
xn.visitAfter = EY;
xn.x = _Y;
xn.y = SY;
function hn(e) {
  return function() {
    return e;
  };
}
function Yo(e) {
  return (e() - 0.5) * 1e-6;
}
function CY(e) {
  return e.x + e.vx;
}
function FY(e) {
  return e.y + e.vy;
}
function kY(e) {
  var t, n, i, r = 1, o = 1;
  typeof e != "function" && (e = hn(e == null ? 1 : +e));
  function a() {
    for (var l, c = t.length, f, d, h, g, p, m, y = 0; y < o; ++y)
      for (f = Hw(t, CY, FY).visitAfter(s), l = 0; l < c; ++l)
        d = t[l], p = n[d.index], m = p * p, h = d.x + d.vx, g = d.y + d.vy, f.visit(v);
    function v(b, x, E, A, w) {
      var _ = b.data, k = b.r, C = p + k;
      if (_) {
        if (_.index > d.index) {
          var O = h - _.x - _.vx, S = g - _.y - _.vy, D = O * O + S * S;
          D < C * C && (O === 0 && (O = Yo(i), D += O * O), S === 0 && (S = Yo(i), D += S * S), D = (C - (D = Math.sqrt(D))) / D * r, d.vx += (O *= D) * (C = (k *= k) / (m + k)), d.vy += (S *= D) * C, _.vx -= O * (C = 1 - C), _.vy -= S * C);
        }
        return;
      }
      return x > h + C || A < h - C || E > g + C || w < g - C;
    }
  }
  function s(l) {
    if (l.data)
      return l.r = n[l.data.index];
    for (var c = l.r = 0; c < 4; ++c)
      l[c] && l[c].r > l.r && (l.r = l[c].r);
  }
  function u() {
    if (!!t) {
      var l, c = t.length, f;
      for (n = new Array(c), l = 0; l < c; ++l)
        f = t[l], n[f.index] = +e(f, l, t);
    }
  }
  return a.initialize = function(l, c) {
    t = l, i = c, u();
  }, a.iterations = function(l) {
    return arguments.length ? (o = +l, a) : o;
  }, a.strength = function(l) {
    return arguments.length ? (r = +l, a) : r;
  }, a.radius = function(l) {
    return arguments.length ? (e = typeof l == "function" ? l : hn(+l), u(), a) : e;
  }, a;
}
function DY(e) {
  return e.index;
}
function QS(e, t) {
  var n = e.get(t);
  if (!n)
    throw new Error("node not found: " + t);
  return n;
}
function $Y(e) {
  var t = DY, n = f, i, r = hn(30), o, a, s, u, l, c = 1;
  e == null && (e = []);
  function f(m) {
    return 1 / Math.min(s[m.source.index], s[m.target.index]);
  }
  function d(m) {
    for (var y = 0, v = e.length; y < c; ++y)
      for (var b = 0, x, E, A, w, _, k, C; b < v; ++b)
        x = e[b], E = x.source, A = x.target, w = A.x + A.vx - E.x - E.vx || Yo(l), _ = A.y + A.vy - E.y - E.vy || Yo(l), k = Math.sqrt(w * w + _ * _), k = (k - o[b]) / k * m * i[b], w *= k, _ *= k, A.vx -= w * (C = u[b]), A.vy -= _ * C, E.vx += w * (C = 1 - C), E.vy += _ * C;
  }
  function h() {
    if (!!a) {
      var m, y = a.length, v = e.length, b = new Map(a.map((E, A) => [t(E, A, a), E])), x;
      for (m = 0, s = new Array(y); m < v; ++m)
        x = e[m], x.index = m, typeof x.source != "object" && (x.source = QS(b, x.source)), typeof x.target != "object" && (x.target = QS(b, x.target)), s[x.source.index] = (s[x.source.index] || 0) + 1, s[x.target.index] = (s[x.target.index] || 0) + 1;
      for (m = 0, u = new Array(v); m < v; ++m)
        x = e[m], u[m] = s[x.source.index] / (s[x.source.index] + s[x.target.index]);
      i = new Array(v), g(), o = new Array(v), p();
    }
  }
  function g() {
    if (!!a)
      for (var m = 0, y = e.length; m < y; ++m)
        i[m] = +n(e[m], m, e);
  }
  function p() {
    if (!!a)
      for (var m = 0, y = e.length; m < y; ++m)
        o[m] = +r(e[m], m, e);
  }
  return d.initialize = function(m, y) {
    a = m, l = y, h();
  }, d.links = function(m) {
    return arguments.length ? (e = m, h(), d) : e;
  }, d.id = function(m) {
    return arguments.length ? (t = m, d) : t;
  }, d.iterations = function(m) {
    return arguments.length ? (c = +m, d) : c;
  }, d.strength = function(m) {
    return arguments.length ? (n = typeof m == "function" ? m : hn(+m), g(), d) : n;
  }, d.distance = function(m) {
    return arguments.length ? (r = typeof m == "function" ? m : hn(+m), p(), d) : r;
  }, d;
}
var MY = { value: () => {
} };
function $N() {
  for (var e = 0, t = arguments.length, n = {}, i; e < t; ++e) {
    if (!(i = arguments[e] + "") || i in n || /[\s.]/.test(i))
      throw new Error("illegal type: " + i);
    n[i] = [];
  }
  return new Ph(n);
}
function Ph(e) {
  this._ = e;
}
function TY(e, t) {
  return e.trim().split(/^|\s+/).map(function(n) {
    var i = "", r = n.indexOf(".");
    if (r >= 0 && (i = n.slice(r + 1), n = n.slice(0, r)), n && !t.hasOwnProperty(n))
      throw new Error("unknown type: " + n);
    return { type: n, name: i };
  });
}
Ph.prototype = $N.prototype = {
  constructor: Ph,
  on: function(e, t) {
    var n = this._, i = TY(e + "", n), r, o = -1, a = i.length;
    if (arguments.length < 2) {
      for (; ++o < a; )
        if ((r = (e = i[o]).type) && (r = NY(n[r], e.name)))
          return r;
      return;
    }
    if (t != null && typeof t != "function")
      throw new Error("invalid callback: " + t);
    for (; ++o < a; )
      if (r = (e = i[o]).type)
        n[r] = ZS(n[r], e.name, t);
      else if (t == null)
        for (r in n)
          n[r] = ZS(n[r], e.name, null);
    return this;
  },
  copy: function() {
    var e = {}, t = this._;
    for (var n in t)
      e[n] = t[n].slice();
    return new Ph(e);
  },
  call: function(e, t) {
    if ((r = arguments.length - 2) > 0)
      for (var n = new Array(r), i = 0, r, o; i < r; ++i)
        n[i] = arguments[i + 2];
    if (!this._.hasOwnProperty(e))
      throw new Error("unknown type: " + e);
    for (o = this._[e], i = 0, r = o.length; i < r; ++i)
      o[i].value.apply(t, n);
  },
  apply: function(e, t, n) {
    if (!this._.hasOwnProperty(e))
      throw new Error("unknown type: " + e);
    for (var i = this._[e], r = 0, o = i.length; r < o; ++r)
      i[r].value.apply(t, n);
  }
};
function NY(e, t) {
  for (var n = 0, i = e.length, r; n < i; ++n)
    if ((r = e[n]).name === t)
      return r.value;
}
function ZS(e, t, n) {
  for (var i = 0, r = e.length; i < r; ++i)
    if (e[i].name === t) {
      e[i] = MY, e = e.slice(0, i).concat(e.slice(i + 1));
      break;
    }
  return n != null && e.push({ name: t, value: n }), e;
}
var il = 0, Fc = 0, nc = 0, MN = 1e3, o0, kc, a0 = 0, Cs = 0, Tp = 0, pf = typeof performance == "object" && performance.now ? performance : Date, TN = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(e) {
  setTimeout(e, 17);
};
function Xw() {
  return Cs || (TN(RY), Cs = pf.now() + Tp);
}
function RY() {
  Cs = 0;
}
function s0() {
  this._call = this._time = this._next = null;
}
s0.prototype = NN.prototype = {
  constructor: s0,
  restart: function(e, t, n) {
    if (typeof e != "function")
      throw new TypeError("callback is not a function");
    n = (n == null ? Xw() : +n) + (t == null ? 0 : +t), !this._next && kc !== this && (kc ? kc._next = this : o0 = this, kc = this), this._call = e, this._time = n, zv();
  },
  stop: function() {
    this._call && (this._call = null, this._time = 1 / 0, zv());
  }
};
function NN(e, t, n) {
  var i = new s0();
  return i.restart(e, t, n), i;
}
function jY() {
  Xw(), ++il;
  for (var e = o0, t; e; )
    (t = Cs - e._time) >= 0 && e._call.call(void 0, t), e = e._next;
  --il;
}
function eC() {
  Cs = (a0 = pf.now()) + Tp, il = Fc = 0;
  try {
    jY();
  } finally {
    il = 0, LY(), Cs = 0;
  }
}
function PY() {
  var e = pf.now(), t = e - a0;
  t > MN && (Tp -= t, a0 = e);
}
function LY() {
  for (var e, t = o0, n, i = 1 / 0; t; )
    t._call ? (i > t._time && (i = t._time), e = t, t = t._next) : (n = t._next, t._next = null, t = e ? e._next = n : o0 = n);
  kc = e, zv(i);
}
function zv(e) {
  if (!il) {
    Fc && (Fc = clearTimeout(Fc));
    var t = e - Cs;
    t > 24 ? (e < 1 / 0 && (Fc = setTimeout(eC, e - pf.now() - Tp)), nc && (nc = clearInterval(nc))) : (nc || (a0 = pf.now(), nc = setInterval(PY, MN)), il = 1, TN(eC));
  }
}
function IY(e, t, n) {
  var i = new s0(), r = t;
  return t == null ? (i.restart(e, t, n), i) : (i._restart = i.restart, i.restart = function(o, a, s) {
    a = +a, s = s == null ? Xw() : +s, i._restart(function u(l) {
      l += r, i._restart(u, r += a, s), o(l);
    }, a, s);
  }, i.restart(e, t, n), i);
}
const BY = 1664525, zY = 1013904223, tC = 4294967296;
function UY() {
  let e = 1;
  return () => (e = (BY * e + zY) % tC) / tC;
}
function qY(e) {
  return e.x;
}
function WY(e) {
  return e.y;
}
var GY = 10, HY = Math.PI * (3 - Math.sqrt(5));
function YY(e) {
  var t, n = 1, i = 1e-3, r = 1 - Math.pow(i, 1 / 300), o = 0, a = 0.6, s = /* @__PURE__ */ new Map(), u = NN(f), l = $N("tick", "end"), c = UY();
  e == null && (e = []);
  function f() {
    d(), l.call("tick", t), n < i && (u.stop(), l.call("end", t));
  }
  function d(p) {
    var m, y = e.length, v;
    p === void 0 && (p = 1);
    for (var b = 0; b < p; ++b)
      for (n += (o - n) * r, s.forEach(function(x) {
        x(n);
      }), m = 0; m < y; ++m)
        v = e[m], v.fx == null ? v.x += v.vx *= a : (v.x = v.fx, v.vx = 0), v.fy == null ? v.y += v.vy *= a : (v.y = v.fy, v.vy = 0);
    return t;
  }
  function h() {
    for (var p = 0, m = e.length, y; p < m; ++p) {
      if (y = e[p], y.index = p, y.fx != null && (y.x = y.fx), y.fy != null && (y.y = y.fy), isNaN(y.x) || isNaN(y.y)) {
        var v = GY * Math.sqrt(0.5 + p), b = p * HY;
        y.x = v * Math.cos(b), y.y = v * Math.sin(b);
      }
      (isNaN(y.vx) || isNaN(y.vy)) && (y.vx = y.vy = 0);
    }
  }
  function g(p) {
    return p.initialize && p.initialize(e, c), p;
  }
  return h(), t = {
    tick: d,
    restart: function() {
      return u.restart(f), t;
    },
    stop: function() {
      return u.stop(), t;
    },
    nodes: function(p) {
      return arguments.length ? (e = p, h(), s.forEach(g), t) : e;
    },
    alpha: function(p) {
      return arguments.length ? (n = +p, t) : n;
    },
    alphaMin: function(p) {
      return arguments.length ? (i = +p, t) : i;
    },
    alphaDecay: function(p) {
      return arguments.length ? (r = +p, t) : +r;
    },
    alphaTarget: function(p) {
      return arguments.length ? (o = +p, t) : o;
    },
    velocityDecay: function(p) {
      return arguments.length ? (a = 1 - p, t) : 1 - a;
    },
    randomSource: function(p) {
      return arguments.length ? (c = p, s.forEach(g), t) : c;
    },
    force: function(p, m) {
      return arguments.length > 1 ? (m == null ? s.delete(p) : s.set(p, g(m)), t) : s.get(p);
    },
    find: function(p, m, y) {
      var v = 0, b = e.length, x, E, A, w, _;
      for (y == null ? y = 1 / 0 : y *= y, v = 0; v < b; ++v)
        w = e[v], x = p - w.x, E = m - w.y, A = x * x + E * E, A < y && (_ = w, y = A);
      return _;
    },
    on: function(p, m) {
      return arguments.length > 1 ? (l.on(p, m), t) : l.on(p);
    }
  };
}
function XY() {
  var e, t, n, i, r = hn(-30), o, a = 1, s = 1 / 0, u = 0.81;
  function l(h) {
    var g, p = e.length, m = Hw(e, qY, WY).visitAfter(f);
    for (i = h, g = 0; g < p; ++g)
      t = e[g], m.visit(d);
  }
  function c() {
    if (!!e) {
      var h, g = e.length, p;
      for (o = new Array(g), h = 0; h < g; ++h)
        p = e[h], o[p.index] = +r(p, h, e);
    }
  }
  function f(h) {
    var g = 0, p, m, y = 0, v, b, x;
    if (h.length) {
      for (v = b = x = 0; x < 4; ++x)
        (p = h[x]) && (m = Math.abs(p.value)) && (g += p.value, y += m, v += m * p.x, b += m * p.y);
      h.x = v / y, h.y = b / y;
    } else {
      p = h, p.x = p.data.x, p.y = p.data.y;
      do
        g += o[p.data.index];
      while (p = p.next);
    }
    h.value = g;
  }
  function d(h, g, p, m) {
    if (!h.value)
      return !0;
    var y = h.x - t.x, v = h.y - t.y, b = m - g, x = y * y + v * v;
    if (b * b / u < x)
      return x < s && (y === 0 && (y = Yo(n), x += y * y), v === 0 && (v = Yo(n), x += v * v), x < a && (x = Math.sqrt(a * x)), t.vx += y * h.value * i / x, t.vy += v * h.value * i / x), !0;
    if (h.length || x >= s)
      return;
    (h.data !== t || h.next) && (y === 0 && (y = Yo(n), x += y * y), v === 0 && (v = Yo(n), x += v * v), x < a && (x = Math.sqrt(a * x)));
    do
      h.data !== t && (b = o[h.data.index] * i / x, t.vx += y * b, t.vy += v * b);
    while (h = h.next);
  }
  return l.initialize = function(h, g) {
    e = h, n = g, c();
  }, l.strength = function(h) {
    return arguments.length ? (r = typeof h == "function" ? h : hn(+h), c(), l) : r;
  }, l.distanceMin = function(h) {
    return arguments.length ? (a = h * h, l) : Math.sqrt(a);
  }, l.distanceMax = function(h) {
    return arguments.length ? (s = h * h, l) : Math.sqrt(s);
  }, l.theta = function(h) {
    return arguments.length ? (u = h * h, l) : Math.sqrt(u);
  }, l;
}
function VY(e) {
  var t = hn(0.1), n, i, r;
  typeof e != "function" && (e = hn(e == null ? 0 : +e));
  function o(s) {
    for (var u = 0, l = n.length, c; u < l; ++u)
      c = n[u], c.vx += (r[u] - c.x) * i[u] * s;
  }
  function a() {
    if (!!n) {
      var s, u = n.length;
      for (i = new Array(u), r = new Array(u), s = 0; s < u; ++s)
        i[s] = isNaN(r[s] = +e(n[s], s, n)) ? 0 : +t(n[s], s, n);
    }
  }
  return o.initialize = function(s) {
    n = s, a();
  }, o.strength = function(s) {
    return arguments.length ? (t = typeof s == "function" ? s : hn(+s), a(), o) : t;
  }, o.x = function(s) {
    return arguments.length ? (e = typeof s == "function" ? s : hn(+s), a(), o) : e;
  }, o;
}
function KY(e) {
  var t = hn(0.1), n, i, r;
  typeof e != "function" && (e = hn(e == null ? 0 : +e));
  function o(s) {
    for (var u = 0, l = n.length, c; u < l; ++u)
      c = n[u], c.vy += (r[u] - c.y) * i[u] * s;
  }
  function a() {
    if (!!n) {
      var s, u = n.length;
      for (i = new Array(u), r = new Array(u), s = 0; s < u; ++s)
        i[s] = isNaN(r[s] = +e(n[s], s, n)) ? 0 : +t(n[s], s, n);
    }
  }
  return o.initialize = function(s) {
    n = s, a();
  }, o.strength = function(s) {
    return arguments.length ? (t = typeof s == "function" ? s : hn(+s), a(), o) : t;
  }, o.y = function(s) {
    return arguments.length ? (e = typeof s == "function" ? s : hn(+s), a(), o) : e;
  }, o;
}
const nC = {
  center: cY,
  collide: kY,
  nbody: XY,
  link: $Y,
  x: VY,
  y: KY
}, Dc = "forces", Uv = ["alpha", "alphaMin", "alphaTarget", "velocityDecay", "forces"], JY = ["static", "iterations"], RN = ["x", "y", "vx", "vy"];
function Vw(e) {
  N.call(this, null, e);
}
Vw.Definition = {
  type: "Force",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "static",
    type: "boolean",
    default: !1
  }, {
    name: "restart",
    type: "boolean",
    default: !1
  }, {
    name: "iterations",
    type: "number",
    default: 300
  }, {
    name: "alpha",
    type: "number",
    default: 1
  }, {
    name: "alphaMin",
    type: "number",
    default: 1e-3
  }, {
    name: "alphaTarget",
    type: "number",
    default: 0
  }, {
    name: "velocityDecay",
    type: "number",
    default: 0.4
  }, {
    name: "forces",
    type: "param",
    array: !0,
    params: [{
      key: {
        force: "center"
      },
      params: [{
        name: "x",
        type: "number",
        default: 0
      }, {
        name: "y",
        type: "number",
        default: 0
      }]
    }, {
      key: {
        force: "collide"
      },
      params: [{
        name: "radius",
        type: "number",
        expr: !0
      }, {
        name: "strength",
        type: "number",
        default: 0.7
      }, {
        name: "iterations",
        type: "number",
        default: 1
      }]
    }, {
      key: {
        force: "nbody"
      },
      params: [{
        name: "strength",
        type: "number",
        default: -30
      }, {
        name: "theta",
        type: "number",
        default: 0.9
      }, {
        name: "distanceMin",
        type: "number",
        default: 1
      }, {
        name: "distanceMax",
        type: "number"
      }]
    }, {
      key: {
        force: "link"
      },
      params: [{
        name: "links",
        type: "data"
      }, {
        name: "id",
        type: "field"
      }, {
        name: "distance",
        type: "number",
        default: 30,
        expr: !0
      }, {
        name: "strength",
        type: "number",
        expr: !0
      }, {
        name: "iterations",
        type: "number",
        default: 1
      }]
    }, {
      key: {
        force: "x"
      },
      params: [{
        name: "strength",
        type: "number",
        default: 0.1
      }, {
        name: "x",
        type: "field"
      }]
    }, {
      key: {
        force: "y"
      },
      params: [{
        name: "strength",
        type: "number",
        default: 0.1
      }, {
        name: "y",
        type: "field"
      }]
    }]
  }, {
    name: "as",
    type: "string",
    array: !0,
    modify: !1,
    default: RN
  }]
};
q(Vw, N, {
  transform(e, t) {
    var n = this.value, i = t.changed(t.ADD_REM), r = e.modified(Uv), o = e.iterations || 300;
    if (n ? (i && (t.modifies("index"), n.nodes(t.source)), (r || t.changed(t.MOD)) && jN(n, e, 0, t)) : (this.value = n = ZY(t.source, e), n.on("tick", QY(t.dataflow, this)), e.static || (i = !0, n.tick()), t.modifies("index")), r || i || e.modified(JY) || t.changed() && e.restart) {
      if (n.alpha(Math.max(n.alpha(), e.alpha || 1)).alphaDecay(1 - Math.pow(n.alphaMin(), 1 / o)), e.static)
        for (n.stop(); --o >= 0; )
          n.tick();
      else if (n.stopped() && n.restart(), !i)
        return t.StopPropagation;
    }
    return this.finish(e, t);
  },
  finish(e, t) {
    const n = t.dataflow;
    for (let s = this._argops, u = 0, l = s.length, c; u < l; ++u)
      if (c = s[u], !(c.name !== Dc || c.op._argval.force !== "link")) {
        for (var i = c.op._argops, r = 0, o = i.length, a; r < o; ++r)
          if (i[r].name === "links" && (a = i[r].op.source)) {
            n.pulse(a, n.changeset().reflow());
            break;
          }
      }
    return t.reflow(e.modified()).modifies(RN);
  }
});
function QY(e, t) {
  return () => e.touch(t).run();
}
function ZY(e, t) {
  const n = YY(e), i = n.stop, r = n.restart;
  let o = !1;
  return n.stopped = () => o, n.restart = () => (o = !1, r()), n.stop = () => (o = !0, i()), jN(n, t, !0).on("end", () => o = !0);
}
function jN(e, t, n, i) {
  var r = oe(t.forces), o, a, s, u;
  for (o = 0, a = Uv.length; o < a; ++o)
    s = Uv[o], s !== Dc && t.modified(s) && e[s](t[s]);
  for (o = 0, a = r.length; o < a; ++o)
    u = Dc + o, s = n || t.modified(Dc, o) ? tX(r[o]) : i && eX(r[o], i) ? e.force(u) : null, s && e.force(u, s);
  for (a = e.numForces || 0; o < a; ++o)
    e.force(Dc + o, null);
  return e.numForces = r.length, e;
}
function eX(e, t) {
  var n, i;
  for (n in e)
    if (he(i = e[n]) && t.modified(Yt(i)))
      return 1;
  return 0;
}
function tX(e) {
  var t, n;
  ae(nC, e.force) || P("Unrecognized force: " + e.force), t = nC[e.force]();
  for (n in e)
    he(t[n]) && nX(t[n], e[n], e);
  return t;
}
function nX(e, t, n) {
  e(he(t) ? (i) => t(i, n) : t);
}
const iX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  force: Vw
}, Symbol.toStringTag, { value: "Module" }));
function rX(e, t) {
  return e.parent === t.parent ? 1 : 2;
}
function oX(e) {
  return e.reduce(aX, 0) / e.length;
}
function aX(e, t) {
  return e + t.x;
}
function sX(e) {
  return 1 + e.reduce(uX, 0);
}
function uX(e, t) {
  return Math.max(e, t.y);
}
function lX(e) {
  for (var t; t = e.children; )
    e = t[0];
  return e;
}
function cX(e) {
  for (var t; t = e.children; )
    e = t[t.length - 1];
  return e;
}
function fX() {
  var e = rX, t = 1, n = 1, i = !1;
  function r(o) {
    var a, s = 0;
    o.eachAfter(function(d) {
      var h = d.children;
      h ? (d.x = oX(h), d.y = sX(h)) : (d.x = a ? s += e(d, a) : 0, d.y = 0, a = d);
    });
    var u = lX(o), l = cX(o), c = u.x - e(u, l) / 2, f = l.x + e(l, u) / 2;
    return o.eachAfter(i ? function(d) {
      d.x = (d.x - o.x) * t, d.y = (o.y - d.y) * n;
    } : function(d) {
      d.x = (d.x - c) / (f - c) * t, d.y = (1 - (o.y ? d.y / o.y : 1)) * n;
    });
  }
  return r.separation = function(o) {
    return arguments.length ? (e = o, r) : e;
  }, r.size = function(o) {
    return arguments.length ? (i = !1, t = +o[0], n = +o[1], r) : i ? null : [t, n];
  }, r.nodeSize = function(o) {
    return arguments.length ? (i = !0, t = +o[0], n = +o[1], r) : i ? [t, n] : null;
  }, r;
}
function dX(e) {
  var t = 0, n = e.children, i = n && n.length;
  if (!i)
    t = 1;
  else
    for (; --i >= 0; )
      t += n[i].value;
  e.value = t;
}
function hX() {
  return this.eachAfter(dX);
}
function gX(e, t) {
  let n = -1;
  for (const i of this)
    e.call(t, i, ++n, this);
  return this;
}
function pX(e, t) {
  for (var n = this, i = [n], r, o, a = -1; n = i.pop(); )
    if (e.call(t, n, ++a, this), r = n.children)
      for (o = r.length - 1; o >= 0; --o)
        i.push(r[o]);
  return this;
}
function mX(e, t) {
  for (var n = this, i = [n], r = [], o, a, s, u = -1; n = i.pop(); )
    if (r.push(n), o = n.children)
      for (a = 0, s = o.length; a < s; ++a)
        i.push(o[a]);
  for (; n = r.pop(); )
    e.call(t, n, ++u, this);
  return this;
}
function yX(e, t) {
  let n = -1;
  for (const i of this)
    if (e.call(t, i, ++n, this))
      return i;
}
function vX(e) {
  return this.eachAfter(function(t) {
    for (var n = +e(t.data) || 0, i = t.children, r = i && i.length; --r >= 0; )
      n += i[r].value;
    t.value = n;
  });
}
function bX(e) {
  return this.eachBefore(function(t) {
    t.children && t.children.sort(e);
  });
}
function xX(e) {
  for (var t = this, n = wX(t, e), i = [t]; t !== n; )
    t = t.parent, i.push(t);
  for (var r = i.length; e !== n; )
    i.splice(r, 0, e), e = e.parent;
  return i;
}
function wX(e, t) {
  if (e === t)
    return e;
  var n = e.ancestors(), i = t.ancestors(), r = null;
  for (e = n.pop(), t = i.pop(); e === t; )
    r = e, e = n.pop(), t = i.pop();
  return r;
}
function EX() {
  for (var e = this, t = [e]; e = e.parent; )
    t.push(e);
  return t;
}
function AX() {
  return Array.from(this);
}
function _X() {
  var e = [];
  return this.eachBefore(function(t) {
    t.children || e.push(t);
  }), e;
}
function OX() {
  var e = this, t = [];
  return e.each(function(n) {
    n !== e && t.push({ source: n.parent, target: n });
  }), t;
}
function* SX() {
  var e = this, t, n = [e], i, r, o;
  do
    for (t = n.reverse(), n = []; e = t.pop(); )
      if (yield e, i = e.children)
        for (r = 0, o = i.length; r < o; ++r)
          n.push(i[r]);
  while (n.length);
}
function Kw(e, t) {
  e instanceof Map ? (e = [void 0, e], t === void 0 && (t = kX)) : t === void 0 && (t = FX);
  for (var n = new rl(e), i, r = [n], o, a, s, u; i = r.pop(); )
    if ((a = t(i.data)) && (u = (a = Array.from(a)).length))
      for (i.children = a, s = u - 1; s >= 0; --s)
        r.push(o = a[s] = new rl(a[s])), o.parent = i, o.depth = i.depth + 1;
  return n.eachBefore(PN);
}
function CX() {
  return Kw(this).eachBefore(DX);
}
function FX(e) {
  return e.children;
}
function kX(e) {
  return Array.isArray(e) ? e[1] : null;
}
function DX(e) {
  e.data.value !== void 0 && (e.value = e.data.value), e.data = e.data.data;
}
function PN(e) {
  var t = 0;
  do
    e.height = t;
  while ((e = e.parent) && e.height < ++t);
}
function rl(e) {
  this.data = e, this.depth = this.height = 0, this.parent = null;
}
rl.prototype = Kw.prototype = {
  constructor: rl,
  count: hX,
  each: gX,
  eachAfter: mX,
  eachBefore: pX,
  find: yX,
  sum: vX,
  sort: bX,
  path: xX,
  ancestors: EX,
  descendants: AX,
  leaves: _X,
  links: OX,
  copy: CX,
  [Symbol.iterator]: SX
};
function Lh(e) {
  return e == null ? null : LN(e);
}
function LN(e) {
  if (typeof e != "function")
    throw new Error();
  return e;
}
function ns() {
  return 0;
}
function xu(e) {
  return function() {
    return e;
  };
}
const $X = 1664525, MX = 1013904223, iC = 4294967296;
function TX() {
  let e = 1;
  return () => (e = ($X * e + MX) % iC) / iC;
}
function NX(e) {
  return typeof e == "object" && "length" in e ? e : Array.from(e);
}
function RX(e, t) {
  let n = e.length, i, r;
  for (; n; )
    r = t() * n-- | 0, i = e[n], e[n] = e[r], e[r] = i;
  return e;
}
function jX(e, t) {
  for (var n = 0, i = (e = RX(Array.from(e), t)).length, r = [], o, a; n < i; )
    o = e[n], a && IN(a, o) ? ++n : (a = LX(r = PX(r, o)), n = 0);
  return a;
}
function PX(e, t) {
  var n, i;
  if (S1(t, e))
    return [t];
  for (n = 0; n < e.length; ++n)
    if (th(t, e[n]) && S1($c(e[n], t), e))
      return [e[n], t];
  for (n = 0; n < e.length - 1; ++n)
    for (i = n + 1; i < e.length; ++i)
      if (th($c(e[n], e[i]), t) && th($c(e[n], t), e[i]) && th($c(e[i], t), e[n]) && S1(BN(e[n], e[i], t), e))
        return [e[n], e[i], t];
  throw new Error();
}
function th(e, t) {
  var n = e.r - t.r, i = t.x - e.x, r = t.y - e.y;
  return n < 0 || n * n < i * i + r * r;
}
function IN(e, t) {
  var n = e.r - t.r + Math.max(e.r, t.r, 1) * 1e-9, i = t.x - e.x, r = t.y - e.y;
  return n > 0 && n * n > i * i + r * r;
}
function S1(e, t) {
  for (var n = 0; n < t.length; ++n)
    if (!IN(e, t[n]))
      return !1;
  return !0;
}
function LX(e) {
  switch (e.length) {
    case 1:
      return IX(e[0]);
    case 2:
      return $c(e[0], e[1]);
    case 3:
      return BN(e[0], e[1], e[2]);
  }
}
function IX(e) {
  return {
    x: e.x,
    y: e.y,
    r: e.r
  };
}
function $c(e, t) {
  var n = e.x, i = e.y, r = e.r, o = t.x, a = t.y, s = t.r, u = o - n, l = a - i, c = s - r, f = Math.sqrt(u * u + l * l);
  return {
    x: (n + o + u / f * c) / 2,
    y: (i + a + l / f * c) / 2,
    r: (f + r + s) / 2
  };
}
function BN(e, t, n) {
  var i = e.x, r = e.y, o = e.r, a = t.x, s = t.y, u = t.r, l = n.x, c = n.y, f = n.r, d = i - a, h = i - l, g = r - s, p = r - c, m = u - o, y = f - o, v = i * i + r * r - o * o, b = v - a * a - s * s + u * u, x = v - l * l - c * c + f * f, E = h * g - d * p, A = (g * x - p * b) / (E * 2) - i, w = (p * m - g * y) / E, _ = (h * b - d * x) / (E * 2) - r, k = (d * y - h * m) / E, C = w * w + k * k - 1, O = 2 * (o + A * w + _ * k), S = A * A + _ * _ - o * o, D = -(Math.abs(C) > 1e-6 ? (O + Math.sqrt(O * O - 4 * C * S)) / (2 * C) : S / O);
  return {
    x: i + A + w * D,
    y: r + _ + k * D,
    r: D
  };
}
function rC(e, t, n) {
  var i = e.x - t.x, r, o, a = e.y - t.y, s, u, l = i * i + a * a;
  l ? (o = t.r + n.r, o *= o, u = e.r + n.r, u *= u, o > u ? (r = (l + u - o) / (2 * l), s = Math.sqrt(Math.max(0, u / l - r * r)), n.x = e.x - r * i - s * a, n.y = e.y - r * a + s * i) : (r = (l + o - u) / (2 * l), s = Math.sqrt(Math.max(0, o / l - r * r)), n.x = t.x + r * i - s * a, n.y = t.y + r * a + s * i)) : (n.x = t.x + n.r, n.y = t.y);
}
function oC(e, t) {
  var n = e.r + t.r - 1e-6, i = t.x - e.x, r = t.y - e.y;
  return n > 0 && n * n > i * i + r * r;
}
function aC(e) {
  var t = e._, n = e.next._, i = t.r + n.r, r = (t.x * n.r + n.x * t.r) / i, o = (t.y * n.r + n.y * t.r) / i;
  return r * r + o * o;
}
function nh(e) {
  this._ = e, this.next = null, this.previous = null;
}
function BX(e, t) {
  if (!(o = (e = NX(e)).length))
    return 0;
  var n, i, r, o, a, s, u, l, c, f, d;
  if (n = e[0], n.x = 0, n.y = 0, !(o > 1))
    return n.r;
  if (i = e[1], n.x = -i.r, i.x = n.r, i.y = 0, !(o > 2))
    return n.r + i.r;
  rC(i, n, r = e[2]), n = new nh(n), i = new nh(i), r = new nh(r), n.next = r.previous = i, i.next = n.previous = r, r.next = i.previous = n;
  e:
    for (u = 3; u < o; ++u) {
      rC(n._, i._, r = e[u]), r = new nh(r), l = i.next, c = n.previous, f = i._.r, d = n._.r;
      do
        if (f <= d) {
          if (oC(l._, r._)) {
            i = l, n.next = i, i.previous = n, --u;
            continue e;
          }
          f += l._.r, l = l.next;
        } else {
          if (oC(c._, r._)) {
            n = c, n.next = i, i.previous = n, --u;
            continue e;
          }
          d += c._.r, c = c.previous;
        }
      while (l !== c.next);
      for (r.previous = n, r.next = i, n.next = i.previous = i = r, a = aC(n); (r = r.next) !== i; )
        (s = aC(r)) < a && (n = r, a = s);
      i = n.next;
    }
  for (n = [i._], r = i; (r = r.next) !== i; )
    n.push(r._);
  for (r = jX(n, t), u = 0; u < o; ++u)
    n = e[u], n.x -= r.x, n.y -= r.y;
  return r.r;
}
function zX(e) {
  return Math.sqrt(e.value);
}
function UX() {
  var e = null, t = 1, n = 1, i = ns;
  function r(o) {
    const a = TX();
    return o.x = t / 2, o.y = n / 2, e ? o.eachBefore(sC(e)).eachAfter(C1(i, 0.5, a)).eachBefore(uC(1)) : o.eachBefore(sC(zX)).eachAfter(C1(ns, 1, a)).eachAfter(C1(i, o.r / Math.min(t, n), a)).eachBefore(uC(Math.min(t, n) / (2 * o.r))), o;
  }
  return r.radius = function(o) {
    return arguments.length ? (e = Lh(o), r) : e;
  }, r.size = function(o) {
    return arguments.length ? (t = +o[0], n = +o[1], r) : [t, n];
  }, r.padding = function(o) {
    return arguments.length ? (i = typeof o == "function" ? o : xu(+o), r) : i;
  }, r;
}
function sC(e) {
  return function(t) {
    t.children || (t.r = Math.max(0, +e(t) || 0));
  };
}
function C1(e, t, n) {
  return function(i) {
    if (r = i.children) {
      var r, o, a = r.length, s = e(i) * t || 0, u;
      if (s)
        for (o = 0; o < a; ++o)
          r[o].r += s;
      if (u = BX(r, n), s)
        for (o = 0; o < a; ++o)
          r[o].r -= s;
      i.r = u + s;
    }
  };
}
function uC(e) {
  return function(t) {
    var n = t.parent;
    t.r *= e, n && (t.x = n.x + e * t.x, t.y = n.y + e * t.y);
  };
}
function zN(e) {
  e.x0 = Math.round(e.x0), e.y0 = Math.round(e.y0), e.x1 = Math.round(e.x1), e.y1 = Math.round(e.y1);
}
function sd(e, t, n, i, r) {
  for (var o = e.children, a, s = -1, u = o.length, l = e.value && (i - t) / e.value; ++s < u; )
    a = o[s], a.y0 = n, a.y1 = r, a.x0 = t, a.x1 = t += a.value * l;
}
function qX() {
  var e = 1, t = 1, n = 0, i = !1;
  function r(a) {
    var s = a.height + 1;
    return a.x0 = a.y0 = n, a.x1 = e, a.y1 = t / s, a.eachBefore(o(t, s)), i && a.eachBefore(zN), a;
  }
  function o(a, s) {
    return function(u) {
      u.children && sd(u, u.x0, a * (u.depth + 1) / s, u.x1, a * (u.depth + 2) / s);
      var l = u.x0, c = u.y0, f = u.x1 - n, d = u.y1 - n;
      f < l && (l = f = (l + f) / 2), d < c && (c = d = (c + d) / 2), u.x0 = l, u.y0 = c, u.x1 = f, u.y1 = d;
    };
  }
  return r.round = function(a) {
    return arguments.length ? (i = !!a, r) : i;
  }, r.size = function(a) {
    return arguments.length ? (e = +a[0], t = +a[1], r) : [e, t];
  }, r.padding = function(a) {
    return arguments.length ? (n = +a, r) : n;
  }, r;
}
var WX = { depth: -1 }, lC = {}, F1 = {};
function GX(e) {
  return e.id;
}
function HX(e) {
  return e.parentId;
}
function cC() {
  var e = GX, t = HX, n;
  function i(r) {
    var o = Array.from(r), a = e, s = t, u, l, c, f, d, h, g, p, m = /* @__PURE__ */ new Map();
    if (n != null) {
      const y = o.map((x, E) => YX(n(x, E, r))), v = y.map(fC), b = new Set(y).add("");
      for (const x of v)
        b.has(x) || (b.add(x), y.push(x), v.push(fC(x)), o.push(F1));
      a = (x, E) => y[E], s = (x, E) => v[E];
    }
    for (c = 0, u = o.length; c < u; ++c)
      l = o[c], h = o[c] = new rl(l), (g = a(l, c, r)) != null && (g += "") && (p = h.id = g, m.set(p, m.has(p) ? lC : h)), (g = s(l, c, r)) != null && (g += "") && (h.parent = g);
    for (c = 0; c < u; ++c)
      if (h = o[c], g = h.parent) {
        if (d = m.get(g), !d)
          throw new Error("missing: " + g);
        if (d === lC)
          throw new Error("ambiguous: " + g);
        d.children ? d.children.push(h) : d.children = [h], h.parent = d;
      } else {
        if (f)
          throw new Error("multiple roots");
        f = h;
      }
    if (!f)
      throw new Error("no root");
    if (n != null) {
      for (; f.data === F1 && f.children.length === 1; )
        f = f.children[0], --u;
      for (let y = o.length - 1; y >= 0 && (h = o[y], h.data === F1); --y)
        h.data = null;
    }
    if (f.parent = WX, f.eachBefore(function(y) {
      y.depth = y.parent.depth + 1, --u;
    }).eachBefore(PN), f.parent = null, u > 0)
      throw new Error("cycle");
    return f;
  }
  return i.id = function(r) {
    return arguments.length ? (e = Lh(r), i) : e;
  }, i.parentId = function(r) {
    return arguments.length ? (t = Lh(r), i) : t;
  }, i.path = function(r) {
    return arguments.length ? (n = Lh(r), i) : n;
  }, i;
}
function YX(e) {
  e = `${e}`;
  let t = e.length;
  return qv(e, t - 1) && !qv(e, t - 2) && (e = e.slice(0, -1)), e[0] === "/" ? e : `/${e}`;
}
function fC(e) {
  let t = e.length;
  if (t < 2)
    return "";
  for (; --t > 1 && !qv(e, t); )
    ;
  return e.slice(0, t);
}
function qv(e, t) {
  if (e[t] === "/") {
    let n = 0;
    for (; t > 0 && e[--t] === "\\"; )
      ++n;
    if ((n & 1) === 0)
      return !0;
  }
  return !1;
}
function XX(e, t) {
  return e.parent === t.parent ? 1 : 2;
}
function k1(e) {
  var t = e.children;
  return t ? t[0] : e.t;
}
function D1(e) {
  var t = e.children;
  return t ? t[t.length - 1] : e.t;
}
function VX(e, t, n) {
  var i = n / (t.i - e.i);
  t.c -= i, t.s += n, e.c += i, t.z += n, t.m += n;
}
function KX(e) {
  for (var t = 0, n = 0, i = e.children, r = i.length, o; --r >= 0; )
    o = i[r], o.z += t, o.m += t, t += o.s + (n += o.c);
}
function JX(e, t, n) {
  return e.a.parent === t.parent ? e.a : n;
}
function Ih(e, t) {
  this._ = e, 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 = t;
}
Ih.prototype = Object.create(rl.prototype);
function QX(e) {
  for (var t = new Ih(e, 0), n, i = [t], r, o, a, s; n = i.pop(); )
    if (o = n._.children)
      for (n.children = new Array(s = o.length), a = s - 1; a >= 0; --a)
        i.push(r = n.children[a] = new Ih(o[a], a)), r.parent = n;
  return (t.parent = new Ih(null, 0)).children = [t], t;
}
function ZX() {
  var e = XX, t = 1, n = 1, i = null;
  function r(l) {
    var c = QX(l);
    if (c.eachAfter(o), c.parent.m = -c.z, c.eachBefore(a), i)
      l.eachBefore(u);
    else {
      var f = l, d = l, h = l;
      l.eachBefore(function(v) {
        v.x < f.x && (f = v), v.x > d.x && (d = v), v.depth > h.depth && (h = v);
      });
      var g = f === d ? 1 : e(f, d) / 2, p = g - f.x, m = t / (d.x + g + p), y = n / (h.depth || 1);
      l.eachBefore(function(v) {
        v.x = (v.x + p) * m, v.y = v.depth * y;
      });
    }
    return l;
  }
  function o(l) {
    var c = l.children, f = l.parent.children, d = l.i ? f[l.i - 1] : null;
    if (c) {
      KX(l);
      var h = (c[0].z + c[c.length - 1].z) / 2;
      d ? (l.z = d.z + e(l._, d._), l.m = l.z - h) : l.z = h;
    } else
      d && (l.z = d.z + e(l._, d._));
    l.parent.A = s(l, d, l.parent.A || f[0]);
  }
  function a(l) {
    l._.x = l.z + l.parent.m, l.m += l.parent.m;
  }
  function s(l, c, f) {
    if (c) {
      for (var d = l, h = l, g = c, p = d.parent.children[0], m = d.m, y = h.m, v = g.m, b = p.m, x; g = D1(g), d = k1(d), g && d; )
        p = k1(p), h = D1(h), h.a = l, x = g.z + v - d.z - m + e(g._, d._), x > 0 && (VX(JX(g, l, f), l, x), m += x, y += x), v += g.m, m += d.m, b += p.m, y += h.m;
      g && !D1(h) && (h.t = g, h.m += v - y), d && !k1(p) && (p.t = d, p.m += m - b, f = l);
    }
    return f;
  }
  function u(l) {
    l.x *= t, l.y = l.depth * n;
  }
  return r.separation = function(l) {
    return arguments.length ? (e = l, r) : e;
  }, r.size = function(l) {
    return arguments.length ? (i = !1, t = +l[0], n = +l[1], r) : i ? null : [t, n];
  }, r.nodeSize = function(l) {
    return arguments.length ? (i = !0, t = +l[0], n = +l[1], r) : i ? [t, n] : null;
  }, r;
}
function Np(e, t, n, i, r) {
  for (var o = e.children, a, s = -1, u = o.length, l = e.value && (r - n) / e.value; ++s < u; )
    a = o[s], a.x0 = t, a.x1 = i, a.y0 = n, a.y1 = n += a.value * l;
}
var UN = (1 + Math.sqrt(5)) / 2;
function qN(e, t, n, i, r, o) {
  for (var a = [], s = t.children, u, l, c = 0, f = 0, d = s.length, h, g, p = t.value, m, y, v, b, x, E, A; c < d; ) {
    h = r - n, g = o - i;
    do
      m = s[f++].value;
    while (!m && f < d);
    for (y = v = m, E = Math.max(g / h, h / g) / (p * e), A = m * m * E, x = Math.max(v / A, A / y); f < d; ++f) {
      if (m += l = s[f].value, l < y && (y = l), l > v && (v = l), A = m * m * E, b = Math.max(v / A, A / y), b > x) {
        m -= l;
        break;
      }
      x = b;
    }
    a.push(u = { value: m, dice: h < g, children: s.slice(c, f) }), u.dice ? sd(u, n, i, r, p ? i += g * m / p : o) : Np(u, n, i, p ? n += h * m / p : r, o), p -= m, c = f;
  }
  return a;
}
const WN = function e(t) {
  function n(i, r, o, a, s) {
    qN(t, i, r, o, a, s);
  }
  return n.ratio = function(i) {
    return e((i = +i) > 1 ? i : 1);
  }, n;
}(UN);
function eV() {
  var e = WN, t = !1, n = 1, i = 1, r = [0], o = ns, a = ns, s = ns, u = ns, l = ns;
  function c(d) {
    return d.x0 = d.y0 = 0, d.x1 = n, d.y1 = i, d.eachBefore(f), r = [0], t && d.eachBefore(zN), d;
  }
  function f(d) {
    var h = r[d.depth], g = d.x0 + h, p = d.y0 + h, m = d.x1 - h, y = d.y1 - h;
    m < g && (g = m = (g + m) / 2), y < p && (p = y = (p + y) / 2), d.x0 = g, d.y0 = p, d.x1 = m, d.y1 = y, d.children && (h = r[d.depth + 1] = o(d) / 2, g += l(d) - h, p += a(d) - h, m -= s(d) - h, y -= u(d) - h, m < g && (g = m = (g + m) / 2), y < p && (p = y = (p + y) / 2), e(d, g, p, m, y));
  }
  return c.round = function(d) {
    return arguments.length ? (t = !!d, c) : t;
  }, c.size = function(d) {
    return arguments.length ? (n = +d[0], i = +d[1], c) : [n, i];
  }, c.tile = function(d) {
    return arguments.length ? (e = LN(d), c) : e;
  }, c.padding = function(d) {
    return arguments.length ? c.paddingInner(d).paddingOuter(d) : c.paddingInner();
  }, c.paddingInner = function(d) {
    return arguments.length ? (o = typeof d == "function" ? d : xu(+d), c) : o;
  }, c.paddingOuter = function(d) {
    return arguments.length ? c.paddingTop(d).paddingRight(d).paddingBottom(d).paddingLeft(d) : c.paddingTop();
  }, c.paddingTop = function(d) {
    return arguments.length ? (a = typeof d == "function" ? d : xu(+d), c) : a;
  }, c.paddingRight = function(d) {
    return arguments.length ? (s = typeof d == "function" ? d : xu(+d), c) : s;
  }, c.paddingBottom = function(d) {
    return arguments.length ? (u = typeof d == "function" ? d : xu(+d), c) : u;
  }, c.paddingLeft = function(d) {
    return arguments.length ? (l = typeof d == "function" ? d : xu(+d), c) : l;
  }, c;
}
function tV(e, t, n, i, r) {
  var o = e.children, a, s = o.length, u, l = new Array(s + 1);
  for (l[0] = u = a = 0; a < s; ++a)
    l[a + 1] = u += o[a].value;
  c(0, s, e.value, t, n, i, r);
  function c(f, d, h, g, p, m, y) {
    if (f >= d - 1) {
      var v = o[f];
      v.x0 = g, v.y0 = p, v.x1 = m, v.y1 = y;
      return;
    }
    for (var b = l[f], x = h / 2 + b, E = f + 1, A = d - 1; E < A; ) {
      var w = E + A >>> 1;
      l[w] < x ? E = w + 1 : A = w;
    }
    x - l[E - 1] < l[E] - x && f + 1 < E && --E;
    var _ = l[E] - b, k = h - _;
    if (m - g > y - p) {
      var C = h ? (g * k + m * _) / h : m;
      c(f, E, _, g, p, C, y), c(E, d, k, C, p, m, y);
    } else {
      var O = h ? (p * k + y * _) / h : y;
      c(f, E, _, g, p, m, O), c(E, d, k, g, O, m, y);
    }
  }
}
function nV(e, t, n, i, r) {
  (e.depth & 1 ? Np : sd)(e, t, n, i, r);
}
const iV = function e(t) {
  function n(i, r, o, a, s) {
    if ((u = i._squarify) && u.ratio === t)
      for (var u, l, c, f, d = -1, h, g = u.length, p = i.value; ++d < g; ) {
        for (l = u[d], c = l.children, f = l.value = 0, h = c.length; f < h; ++f)
          l.value += c[f].value;
        l.dice ? sd(l, r, o, a, p ? o += (s - o) * l.value / p : s) : Np(l, r, o, p ? r += (a - r) * l.value / p : a, s), p -= l.value;
      }
    else
      i._squarify = u = qN(t, i, r, o, a, s), u.ratio = t;
  }
  return n.ratio = function(i) {
    return e((i = +i) > 1 ? i : 1);
  }, n;
}(UN);
function Wv(e, t, n) {
  const i = {};
  return e.each((r) => {
    const o = r.data;
    n(o) && (i[t(o)] = r);
  }), e.lookup = i, e;
}
function Jw(e) {
  N.call(this, null, e);
}
Jw.Definition = {
  type: "Nest",
  metadata: {
    treesource: !0,
    changes: !0
  },
  params: [{
    name: "keys",
    type: "field",
    array: !0
  }, {
    name: "generate",
    type: "boolean"
  }]
};
const rV = (e) => e.values;
q(Jw, N, {
  transform(e, t) {
    t.source || P("Nest transform requires an upstream data source.");
    var n = e.generate, i = e.modified(), r = t.clone(), o = this.value;
    return (!o || i || t.changed()) && (o && o.each((a) => {
      a.children && K0(a.data) && r.rem.push(a.data);
    }), this.value = o = Kw({
      values: oe(e.keys).reduce((a, s) => (a.key(s), a), oV()).entries(r.source)
    }, rV), n && o.each((a) => {
      a.children && (a = Te(a.data), r.add.push(a), r.source.push(a));
    }), Wv(o, Z, Z)), r.source.root = o, r;
  }
});
function oV() {
  const e = [], t = {
    entries: (r) => i(n(r, 0), 0),
    key: (r) => (e.push(r), t)
  };
  function n(r, o) {
    if (o >= e.length)
      return r;
    const a = r.length, s = e[o++], u = {}, l = {};
    let c = -1, f, d, h;
    for (; ++c < a; )
      f = s(d = r[c]) + "", (h = u[f]) ? h.push(d) : u[f] = [d];
    for (f in u)
      l[f] = n(u[f], o);
    return l;
  }
  function i(r, o) {
    if (++o > e.length)
      return r;
    const a = [];
    for (const s in r)
      a.push({
        key: s,
        values: i(r[s], o)
      });
    return a;
  }
  return t;
}
function vo(e) {
  N.call(this, null, e);
}
const aV = (e, t) => e.parent === t.parent ? 1 : 2;
q(vo, N, {
  transform(e, t) {
    (!t.source || !t.source.root) && P(this.constructor.name + " transform requires a backing tree data source.");
    const n = this.layout(e.method), i = this.fields, r = t.source.root, o = e.as || i;
    e.field ? r.sum(e.field) : r.count(), e.sort && r.sort(Ws(e.sort, (a) => a.data)), sV(n, this.params, e), n.separation && n.separation(e.separation !== !1 ? aV : vl);
    try {
      this.value = n(r);
    } catch (a) {
      P(a);
    }
    return r.each((a) => uV(a, i, o)), t.reflow(e.modified()).modifies(o).modifies("leaf");
  }
});
function sV(e, t, n) {
  for (let i, r = 0, o = t.length; r < o; ++r)
    i = t[r], i in n && e[i](n[i]);
}
function uV(e, t, n) {
  const i = e.data, r = t.length - 1;
  for (let o = 0; o < r; ++o)
    i[n[o]] = e[t[o]];
  i[n[r]] = e.children ? e.children.length : 0;
}
const Gv = ["x", "y", "r", "depth", "children"];
function Qw(e) {
  vo.call(this, e);
}
Qw.Definition = {
  type: "Pack",
  metadata: {
    tree: !0,
    modifies: !0
  },
  params: [{
    name: "field",
    type: "field"
  }, {
    name: "sort",
    type: "compare"
  }, {
    name: "padding",
    type: "number",
    default: 0
  }, {
    name: "radius",
    type: "field",
    default: null
  }, {
    name: "size",
    type: "number",
    array: !0,
    length: 2
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: Gv.length,
    default: Gv
  }]
};
q(Qw, vo, {
  layout: UX,
  params: ["radius", "size", "padding"],
  fields: Gv
});
const Hv = ["x0", "y0", "x1", "y1", "depth", "children"];
function Zw(e) {
  vo.call(this, e);
}
Zw.Definition = {
  type: "Partition",
  metadata: {
    tree: !0,
    modifies: !0
  },
  params: [{
    name: "field",
    type: "field"
  }, {
    name: "sort",
    type: "compare"
  }, {
    name: "padding",
    type: "number",
    default: 0
  }, {
    name: "round",
    type: "boolean",
    default: !1
  }, {
    name: "size",
    type: "number",
    array: !0,
    length: 2
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: Hv.length,
    default: Hv
  }]
};
q(Zw, vo, {
  layout: qX,
  params: ["size", "round", "padding"],
  fields: Hv
});
function eE(e) {
  N.call(this, null, e);
}
eE.Definition = {
  type: "Stratify",
  metadata: {
    treesource: !0
  },
  params: [{
    name: "key",
    type: "field",
    required: !0
  }, {
    name: "parentKey",
    type: "field",
    required: !0
  }]
};
q(eE, N, {
  transform(e, t) {
    t.source || P("Stratify transform requires an upstream data source.");
    let n = this.value;
    const i = e.modified(), r = t.fork(t.ALL).materialize(t.SOURCE), o = !n || i || t.changed(t.ADD_REM) || t.modified(e.key.fields) || t.modified(e.parentKey.fields);
    return r.source = r.source.slice(), o && (n = r.source.length ? Wv(cC().id(e.key).parentId(e.parentKey)(r.source), e.key, ci) : Wv(cC()([{}]), e.key, e.key)), r.source.root = this.value = n, r;
  }
});
const dC = {
  tidy: ZX,
  cluster: fX
}, Yv = ["x", "y", "depth", "children"];
function tE(e) {
  vo.call(this, e);
}
tE.Definition = {
  type: "Tree",
  metadata: {
    tree: !0,
    modifies: !0
  },
  params: [{
    name: "field",
    type: "field"
  }, {
    name: "sort",
    type: "compare"
  }, {
    name: "method",
    type: "enum",
    default: "tidy",
    values: ["tidy", "cluster"]
  }, {
    name: "size",
    type: "number",
    array: !0,
    length: 2
  }, {
    name: "nodeSize",
    type: "number",
    array: !0,
    length: 2
  }, {
    name: "separation",
    type: "boolean",
    default: !0
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: Yv.length,
    default: Yv
  }]
};
q(tE, vo, {
  layout(e) {
    const t = e || "tidy";
    if (ae(dC, t))
      return dC[t]();
    P("Unrecognized Tree layout method: " + t);
  },
  params: ["size", "nodeSize"],
  fields: Yv
});
function nE(e) {
  N.call(this, [], e);
}
nE.Definition = {
  type: "TreeLinks",
  metadata: {
    tree: !0,
    generates: !0,
    changes: !0
  },
  params: []
};
q(nE, N, {
  transform(e, t) {
    const n = this.value, i = t.source && t.source.root, r = t.fork(t.NO_SOURCE), o = {};
    return i || P("TreeLinks transform requires a tree data source."), t.changed(t.ADD_REM) ? (r.rem = n, t.visit(t.SOURCE, (a) => o[Z(a)] = 1), i.each((a) => {
      const s = a.data, u = a.parent && a.parent.data;
      u && o[Z(s)] && o[Z(u)] && r.add.push(Te({
        source: u,
        target: s
      }));
    }), this.value = r.add) : t.changed(t.MOD) && (t.visit(t.MOD, (a) => o[Z(a)] = 1), n.forEach((a) => {
      (o[Z(a.source)] || o[Z(a.target)]) && r.mod.push(a);
    })), r;
  }
});
const hC = {
  binary: tV,
  dice: sd,
  slice: Np,
  slicedice: nV,
  squarify: WN,
  resquarify: iV
}, Xv = ["x0", "y0", "x1", "y1", "depth", "children"];
function iE(e) {
  vo.call(this, e);
}
iE.Definition = {
  type: "Treemap",
  metadata: {
    tree: !0,
    modifies: !0
  },
  params: [{
    name: "field",
    type: "field"
  }, {
    name: "sort",
    type: "compare"
  }, {
    name: "method",
    type: "enum",
    default: "squarify",
    values: ["squarify", "resquarify", "binary", "dice", "slice", "slicedice"]
  }, {
    name: "padding",
    type: "number",
    default: 0
  }, {
    name: "paddingInner",
    type: "number",
    default: 0
  }, {
    name: "paddingOuter",
    type: "number",
    default: 0
  }, {
    name: "paddingTop",
    type: "number",
    default: 0
  }, {
    name: "paddingRight",
    type: "number",
    default: 0
  }, {
    name: "paddingBottom",
    type: "number",
    default: 0
  }, {
    name: "paddingLeft",
    type: "number",
    default: 0
  }, {
    name: "ratio",
    type: "number",
    default: 1.618033988749895
  }, {
    name: "round",
    type: "boolean",
    default: !1
  }, {
    name: "size",
    type: "number",
    array: !0,
    length: 2
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: Xv.length,
    default: Xv
  }]
};
q(iE, vo, {
  layout() {
    const e = eV();
    return e.ratio = (t) => {
      const n = e.tile();
      n.ratio && e.tile(n.ratio(t));
    }, e.method = (t) => {
      ae(hC, t) ? e.tile(hC[t]) : P("Unrecognized Treemap layout method: " + t);
    }, e;
  },
  params: ["method", "ratio", "size", "round", "padding", "paddingInner", "paddingOuter", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
  fields: Xv
});
const lV = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  nest: Jw,
  pack: Qw,
  partition: Zw,
  stratify: eE,
  tree: tE,
  treelinks: nE,
  treemap: iE
}, Symbol.toStringTag, { value: "Module" })), $1 = 4278190080;
function cV(e, t) {
  const n = e.bitmap();
  return (t || []).forEach((i) => n.set(e(i.boundary[0]), e(i.boundary[3]))), [n, void 0];
}
function fV(e, t, n, i, r) {
  const o = e.width, a = e.height, s = i || r, u = Zo(o, a).getContext("2d"), l = Zo(o, a).getContext("2d"), c = s && Zo(o, a).getContext("2d");
  n.forEach((_) => Bh(u, _, !1)), Bh(l, t, !1), s && Bh(c, t, !0);
  const f = M1(u, o, a), d = M1(l, o, a), h = s && M1(c, o, a), g = e.bitmap(), p = s && e.bitmap();
  let m, y, v, b, x, E, A, w;
  for (y = 0; y < a; ++y)
    for (m = 0; m < o; ++m)
      x = y * o + m, E = f[x] & $1, w = d[x] & $1, A = s && h[x] & $1, (E || A || w) && (v = e(m), b = e(y), !r && (E || w) && g.set(v, b), s && (E || A) && p.set(v, b));
  return [g, p];
}
function M1(e, t, n) {
  return new Uint32Array(e.getImageData(0, 0, t, n).data.buffer);
}
function Bh(e, t, n) {
  if (!t.length)
    return;
  const i = t[0].mark.marktype;
  i === "group" ? t.forEach((r) => {
    r.items.forEach((o) => Bh(e, o.items, n));
  }) : Qn[i].draw(e, {
    items: n ? t.map(dV) : t
  });
}
function dV(e) {
  const t = J0(e, {});
  return t.stroke && t.strokeOpacity !== 0 || t.fill && t.fillOpacity !== 0 ? {
    ...t,
    strokeOpacity: 1,
    stroke: "#000",
    fillOpacity: 0
  } : t;
}
const Ur = 5, nn = 31, mf = 32, Ro = new Uint32Array(mf + 1), Si = new Uint32Array(mf + 1);
Si[0] = 0;
Ro[0] = ~Si[0];
for (let e = 1; e <= mf; ++e)
  Si[e] = Si[e - 1] << 1 | 1, Ro[e] = ~Si[e];
function hV(e, t) {
  const n = new Uint32Array(~~((e * t + mf) / mf));
  function i(o, a) {
    n[o] |= a;
  }
  function r(o, a) {
    n[o] &= a;
  }
  return {
    array: n,
    get: (o, a) => {
      const s = a * e + o;
      return n[s >>> Ur] & 1 << (s & nn);
    },
    set: (o, a) => {
      const s = a * e + o;
      i(s >>> Ur, 1 << (s & nn));
    },
    clear: (o, a) => {
      const s = a * e + o;
      r(s >>> Ur, ~(1 << (s & nn)));
    },
    getRange: (o, a, s, u) => {
      let l = u, c, f, d, h;
      for (; l >= a; --l)
        if (c = l * e + o, f = l * e + s, d = c >>> Ur, h = f >>> Ur, d === h) {
          if (n[d] & Ro[c & nn] & Si[(f & nn) + 1])
            return !0;
        } else {
          if (n[d] & Ro[c & nn] || n[h] & Si[(f & nn) + 1])
            return !0;
          for (let g = d + 1; g < h; ++g)
            if (n[g])
              return !0;
        }
      return !1;
    },
    setRange: (o, a, s, u) => {
      let l, c, f, d, h;
      for (; a <= u; ++a)
        if (l = a * e + o, c = a * e + s, f = l >>> Ur, d = c >>> Ur, f === d)
          i(f, Ro[l & nn] & Si[(c & nn) + 1]);
        else
          for (i(f, Ro[l & nn]), i(d, Si[(c & nn) + 1]), h = f + 1; h < d; ++h)
            i(h, 4294967295);
    },
    clearRange: (o, a, s, u) => {
      let l, c, f, d, h;
      for (; a <= u; ++a)
        if (l = a * e + o, c = a * e + s, f = l >>> Ur, d = c >>> Ur, f === d)
          r(f, Si[l & nn] | Ro[(c & nn) + 1]);
        else
          for (r(f, Si[l & nn]), r(d, Ro[(c & nn) + 1]), h = f + 1; h < d; ++h)
            r(h, 0);
    },
    outOfBounds: (o, a, s, u) => o < 0 || a < 0 || u >= t || s >= e
  };
}
function gV(e, t, n) {
  const i = Math.max(1, Math.sqrt(e * t / 1e6)), r = ~~((e + 2 * n + i) / i), o = ~~((t + 2 * n + i) / i), a = (s) => ~~((s + n) / i);
  return a.invert = (s) => s * i - n, a.bitmap = () => hV(r, o), a.ratio = i, a.padding = n, a.width = e, a.height = t, a;
}
function pV(e, t, n, i) {
  const r = e.width, o = e.height;
  return function(a) {
    const s = a.datum.datum.items[i].items, u = s.length, l = a.datum.fontSize, c = Pi.width(a.datum, a.datum.text);
    let f = 0, d, h, g, p, m, y, v;
    for (let b = 0; b < u; ++b)
      d = s[b].x, g = s[b].y, h = s[b].x2 === void 0 ? d : s[b].x2, p = s[b].y2 === void 0 ? g : s[b].y2, m = (d + h) / 2, y = (g + p) / 2, v = Math.abs(h - d + p - g), v >= f && (f = v, a.x = m, a.y = y);
    return m = c / 2, y = l / 2, d = a.x - m, h = a.x + m, g = a.y - y, p = a.y + y, a.align = "center", d < 0 && h <= r ? a.align = "left" : 0 <= d && r < h && (a.align = "right"), a.baseline = "middle", g < 0 && p <= o ? a.baseline = "top" : 0 <= g && o < p && (a.baseline = "bottom"), !0;
  };
}
function u0(e, t, n, i, r, o) {
  let a = n / 2;
  return e - a < 0 || e + a > r || t - (a = i / 2) < 0 || t + a > o;
}
function Xo(e, t, n, i, r, o, a, s) {
  const u = r * o / (i * 2), l = e(t - u), c = e(t + u), f = e(n - (o = o / 2)), d = e(n + o);
  return a.outOfBounds(l, f, c, d) || a.getRange(l, f, c, d) || s && s.getRange(l, f, c, d);
}
function mV(e, t, n, i) {
  const r = e.width, o = e.height, a = t[0], s = t[1];
  function u(l, c, f, d, h) {
    const g = e.invert(l), p = e.invert(c);
    let m = f, y = o, v;
    if (!u0(g, p, d, h, r, o) && !Xo(e, g, p, h, d, m, a, s) && !Xo(e, g, p, h, d, h, a, null)) {
      for (; y - m >= 1; )
        v = (m + y) / 2, Xo(e, g, p, h, d, v, a, s) ? y = v : m = v;
      if (m > f)
        return [g, p, m, !0];
    }
  }
  return function(l) {
    const c = l.datum.datum.items[i].items, f = c.length, d = l.datum.fontSize, h = Pi.width(l.datum, l.datum.text);
    let g = n ? d : 0, p = !1, m = !1, y = 0, v, b, x, E, A, w, _, k, C, O, S, D, M, F, $, T, L;
    for (let I = 0; I < f; ++I) {
      for (v = c[I].x, x = c[I].y, b = c[I].x2 === void 0 ? v : c[I].x2, E = c[I].y2 === void 0 ? x : c[I].y2, v > b && (L = v, v = b, b = L), x > E && (L = x, x = E, E = L), C = e(v), S = e(b), O = ~~((C + S) / 2), D = e(x), F = e(E), M = ~~((D + F) / 2), _ = O; _ >= C; --_)
        for (k = M; k >= D; --k)
          T = u(_, k, g, h, d), T && ([l.x, l.y, g, p] = T);
      for (_ = O; _ <= S; ++_)
        for (k = M; k <= F; ++k)
          T = u(_, k, g, h, d), T && ([l.x, l.y, g, p] = T);
      !p && !n && ($ = Math.abs(b - v + E - x), A = (v + b) / 2, w = (x + E) / 2, $ >= y && !u0(A, w, h, d, r, o) && !Xo(e, A, w, d, h, d, a, null) && (y = $, l.x = A, l.y = w, m = !0));
    }
    return p || m ? (A = h / 2, w = d / 2, a.setRange(e(l.x - A), e(l.y - w), e(l.x + A), e(l.y + w)), l.align = "center", l.baseline = "middle", !0) : !1;
  };
}
const yV = [-1, -1, 1, 1], vV = [-1, 1, -1, 1];
function bV(e, t, n, i) {
  const r = e.width, o = e.height, a = t[0], s = t[1], u = e.bitmap();
  return function(l) {
    const c = l.datum.datum.items[i].items, f = c.length, d = l.datum.fontSize, h = Pi.width(l.datum, l.datum.text), g = [];
    let p = n ? d : 0, m = !1, y = !1, v = 0, b, x, E, A, w, _, k, C, O, S, D, M;
    for (let F = 0; F < f; ++F) {
      for (b = c[F].x, E = c[F].y, x = c[F].x2 === void 0 ? b : c[F].x2, A = c[F].y2 === void 0 ? E : c[F].y2, g.push([e((b + x) / 2), e((E + A) / 2)]); g.length; )
        if ([k, C] = g.pop(), !(a.get(k, C) || s.get(k, C) || u.get(k, C))) {
          u.set(k, C);
          for (let $ = 0; $ < 4; ++$)
            w = k + yV[$], _ = C + vV[$], u.outOfBounds(w, _, w, _) || g.push([w, _]);
          if (w = e.invert(k), _ = e.invert(C), O = p, S = o, !u0(w, _, h, d, r, o) && !Xo(e, w, _, d, h, O, a, s) && !Xo(e, w, _, d, h, d, a, null)) {
            for (; S - O >= 1; )
              D = (O + S) / 2, Xo(e, w, _, d, h, D, a, s) ? S = D : O = D;
            O > p && (l.x = w, l.y = _, p = O, m = !0);
          }
        }
      !m && !n && (M = Math.abs(x - b + A - E), w = (b + x) / 2, _ = (E + A) / 2, M >= v && !u0(w, _, h, d, r, o) && !Xo(e, w, _, d, h, d, a, null) && (v = M, l.x = w, l.y = _, y = !0));
    }
    return m || y ? (w = h / 2, _ = d / 2, a.setRange(e(l.x - w), e(l.y - _), e(l.x + w), e(l.y + _)), l.align = "center", l.baseline = "middle", !0) : !1;
  };
}
const xV = ["right", "center", "left"], wV = ["bottom", "middle", "top"];
function EV(e, t, n, i) {
  const r = e.width, o = e.height, a = t[0], s = t[1], u = i.length;
  return function(l) {
    var c;
    const f = l.boundary, d = l.datum.fontSize;
    if (f[2] < 0 || f[5] < 0 || f[0] > r || f[3] > o)
      return !1;
    let h = (c = l.textWidth) !== null && c !== void 0 ? c : 0, g, p, m, y, v, b, x, E, A, w, _, k, C, O, S;
    for (let D = 0; D < u; ++D) {
      if (g = (n[D] & 3) - 1, p = (n[D] >>> 2 & 3) - 1, m = g === 0 && p === 0 || i[D] < 0, y = g && p ? Math.SQRT1_2 : 1, v = i[D] < 0 ? -1 : 1, b = f[1 + g] + i[D] * g * y, _ = f[4 + p] + v * d * p / 2 + i[D] * p * y, E = _ - d / 2, A = _ + d / 2, k = e(b), O = e(E), S = e(A), !h)
        if (gC(k, k, O, S, a, s, b, b, E, A, f, m))
          h = Pi.width(l.datum, l.datum.text);
        else
          continue;
      if (w = b + v * h * g / 2, b = w - h / 2, x = w + h / 2, k = e(b), C = e(x), gC(k, C, O, S, a, s, b, x, E, A, f, m))
        return l.x = g ? g * v < 0 ? x : b : w, l.y = p ? p * v < 0 ? A : E : _, l.align = xV[g * v + 1], l.baseline = wV[p * v + 1], a.setRange(k, O, C, S), !0;
    }
    return !1;
  };
}
function gC(e, t, n, i, r, o, a, s, u, l, c, f) {
  return !(r.outOfBounds(e, n, t, i) || (f && o || r).getRange(e, n, t, i));
}
const T1 = 0, N1 = 4, R1 = 8, j1 = 0, P1 = 1, L1 = 2, AV = {
  "top-left": T1 + j1,
  top: T1 + P1,
  "top-right": T1 + L1,
  left: N1 + j1,
  middle: N1 + P1,
  right: N1 + L1,
  "bottom-left": R1 + j1,
  bottom: R1 + P1,
  "bottom-right": R1 + L1
}, _V = {
  naive: pV,
  "reduced-search": mV,
  floodfill: bV
};
function OV(e, t, n, i, r, o, a, s, u, l, c) {
  if (!e.length)
    return e;
  const f = Math.max(i.length, r.length), d = SV(i, f), h = CV(r, f), g = FV(e[0].datum), p = g === "group" && e[0].datum.items[u].marktype, m = p === "area", y = kV(g, p, s, u), v = l === null || l === 1 / 0, b = m && c === "naive";
  let x = -1, E = -1;
  const A = e.map((C) => {
    const O = v ? Pi.width(C, C.text) : void 0;
    return x = Math.max(x, O), E = Math.max(E, C.fontSize), {
      datum: C,
      opacity: 0,
      x: void 0,
      y: void 0,
      align: void 0,
      baseline: void 0,
      boundary: y(C),
      textWidth: O
    };
  });
  l = l === null || l === 1 / 0 ? Math.max(x, E) + Math.max(...i) : l;
  const w = gV(t[0], t[1], l);
  let _;
  if (!b) {
    n && A.sort((S, D) => n(S.datum, D.datum));
    let C = !1;
    for (let S = 0; S < h.length && !C; ++S)
      C = h[S] === 5 || d[S] < 0;
    const O = (g && a || m) && e.map((S) => S.datum);
    _ = o.length || O ? fV(w, O || [], o, C, m) : cV(w, a && A);
  }
  const k = m ? _V[c](w, _, a, u) : EV(w, _, h, d);
  return A.forEach((C) => C.opacity = +k(C)), A;
}
function SV(e, t) {
  const n = new Float64Array(t), i = e.length;
  for (let r = 0; r < i; ++r)
    n[r] = e[r] || 0;
  for (let r = i; r < t; ++r)
    n[r] = n[i - 1];
  return n;
}
function CV(e, t) {
  const n = new Int8Array(t), i = e.length;
  for (let r = 0; r < i; ++r)
    n[r] |= AV[e[r]];
  for (let r = i; r < t; ++r)
    n[r] = n[i - 1];
  return n;
}
function FV(e) {
  return e && e.mark && e.mark.marktype;
}
function kV(e, t, n, i) {
  const r = (o) => [o.x, o.x, o.x, o.y, o.y, o.y];
  return e ? e === "line" || e === "area" ? (o) => r(o.datum) : t === "line" ? (o) => {
    const a = o.datum.items[i].items;
    return r(a.length ? a[n === "start" ? 0 : a.length - 1] : {
      x: NaN,
      y: NaN
    });
  } : (o) => {
    const a = o.datum.bounds;
    return [a.x1, (a.x1 + a.x2) / 2, a.x2, a.y1, (a.y1 + a.y2) / 2, a.y2];
  } : r;
}
const Vv = ["x", "y", "opacity", "align", "baseline"], GN = ["top-left", "left", "bottom-left", "top", "bottom", "top-right", "right", "bottom-right"];
function rE(e) {
  N.call(this, null, e);
}
rE.Definition = {
  type: "Label",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "size",
    type: "number",
    array: !0,
    length: 2,
    required: !0
  }, {
    name: "sort",
    type: "compare"
  }, {
    name: "anchor",
    type: "string",
    array: !0,
    default: GN
  }, {
    name: "offset",
    type: "number",
    array: !0,
    default: [1]
  }, {
    name: "padding",
    type: "number",
    default: 0,
    null: !0
  }, {
    name: "lineAnchor",
    type: "string",
    values: ["start", "end"],
    default: "end"
  }, {
    name: "markIndex",
    type: "number",
    default: 0
  }, {
    name: "avoidBaseMark",
    type: "boolean",
    default: !0
  }, {
    name: "avoidMarks",
    type: "data",
    array: !0
  }, {
    name: "method",
    type: "string",
    default: "naive"
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: Vv.length,
    default: Vv
  }]
};
q(rE, N, {
  transform(e, t) {
    function n(o) {
      const a = e[o];
      return he(a) && t.modified(a.fields);
    }
    const i = e.modified();
    if (!(i || t.changed(t.ADD_REM) || n("sort")))
      return;
    (!e.size || e.size.length !== 2) && P("Size parameter should be specified as a [width, height] array.");
    const r = e.as || Vv;
    return OV(t.materialize(t.SOURCE).source || [], e.size, e.sort, oe(e.offset == null ? 1 : e.offset), oe(e.anchor || GN), e.avoidMarks || [], e.avoidBaseMark !== !1, e.lineAnchor || "end", e.markIndex || 0, e.padding === void 0 ? 0 : e.padding, e.method || "naive").forEach((o) => {
      const a = o.datum;
      a[r[0]] = o.x, a[r[1]] = o.y, a[r[2]] = o.opacity, a[r[3]] = o.align, a[r[4]] = o.baseline;
    }), t.reflow(i).modifies(r);
  }
});
const DV = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  label: rE
}, Symbol.toStringTag, { value: "Module" }));
function HN(e, t) {
  var n = [], i = function(c) {
    return c(s);
  }, r, o, a, s, u, l;
  if (t == null)
    n.push(e);
  else
    for (r = {}, o = 0, a = e.length; o < a; ++o)
      s = e[o], u = t.map(i), l = r[u], l || (r[u] = l = [], l.dims = u, n.push(l)), l.push(s);
  return n;
}
function oE(e) {
  N.call(this, null, e);
}
oE.Definition = {
  type: "Loess",
  metadata: {
    generates: !0
  },
  params: [{
    name: "x",
    type: "field",
    required: !0
  }, {
    name: "y",
    type: "field",
    required: !0
  }, {
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "bandwidth",
    type: "number",
    default: 0.3
  }, {
    name: "as",
    type: "string",
    array: !0
  }]
};
q(oE, N, {
  transform(e, t) {
    const n = t.fork(t.NO_SOURCE | t.NO_FIELDS);
    if (!this.value || t.changed() || e.modified()) {
      const i = t.materialize(t.SOURCE).source, r = HN(i, e.groupby), o = (e.groupby || []).map(ot), a = o.length, s = e.as || [ot(e.x), ot(e.y)], u = [];
      r.forEach((l) => {
        f$(l, e.x, e.y, e.bandwidth || 0.3).forEach((c) => {
          const f = {};
          for (let d = 0; d < a; ++d)
            f[o[d]] = l.dims[d];
          f[s[0]] = c[0], f[s[1]] = c[1], u.push(Te(f));
        });
      }), this.value && (n.rem = this.value), this.value = n.add = n.source = u;
    }
    return n;
  }
});
const Kv = {
  linear: Ix,
  log: s$,
  exp: u$,
  pow: l$,
  quad: Bx,
  poly: c$
}, $V = (e, t) => e === "poly" ? t : e === "quad" ? 2 : 1;
function aE(e) {
  N.call(this, null, e);
}
aE.Definition = {
  type: "Regression",
  metadata: {
    generates: !0
  },
  params: [{
    name: "x",
    type: "field",
    required: !0
  }, {
    name: "y",
    type: "field",
    required: !0
  }, {
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "method",
    type: "string",
    default: "linear",
    values: Object.keys(Kv)
  }, {
    name: "order",
    type: "number",
    default: 3
  }, {
    name: "extent",
    type: "number",
    array: !0,
    length: 2
  }, {
    name: "params",
    type: "boolean",
    default: !1
  }, {
    name: "as",
    type: "string",
    array: !0
  }]
};
q(aE, N, {
  transform(e, t) {
    const n = t.fork(t.NO_SOURCE | t.NO_FIELDS);
    if (!this.value || t.changed() || e.modified()) {
      const i = t.materialize(t.SOURCE).source, r = HN(i, e.groupby), o = (e.groupby || []).map(ot), a = e.method || "linear", s = e.order || 3, u = $V(a, s), l = e.as || [ot(e.x), ot(e.y)], c = Kv[a], f = [];
      let d = e.extent;
      ae(Kv, a) || P("Invalid regression method: " + a), d != null && a === "log" && d[0] <= 0 && (t.dataflow.warn("Ignoring extent with values <= 0 for log regression."), d = null), r.forEach((h) => {
        if (h.length <= u) {
          t.dataflow.warn("Skipping regression with more parameters than data points.");
          return;
        }
        const p = c(h, e.x, e.y, s);
        if (e.params) {
          f.push(Te({
            keys: h.dims,
            coef: p.coef,
            rSquared: p.rSquared
          }));
          return;
        }
        const m = d || vr(h, e.x), y = (v) => {
          const b = {};
          for (let x = 0; x < o.length; ++x)
            b[o[x]] = h.dims[x];
          b[l[0]] = v[0], b[l[1]] = v[1], f.push(Te(b));
        };
        a === "linear" ? m.forEach((v) => y([v, p.predict(v)])) : rp(p.predict, m, 25, 200).forEach(y);
      }), this.value && (n.rem = this.value), this.value = n.add = n.source = f;
    }
    return n;
  }
});
const MV = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  loess: oE,
  regression: aE
}, Symbol.toStringTag, { value: "Module" })), ro = 11102230246251565e-32, It = 134217729, TV = (3 + 8 * ro) * ro;
function I1(e, t, n, i, r) {
  let o, a, s, u, l = t[0], c = i[0], f = 0, d = 0;
  c > l == c > -l ? (o = l, l = t[++f]) : (o = c, c = i[++d]);
  let h = 0;
  if (f < e && d < n)
    for (c > l == c > -l ? (a = l + o, s = o - (a - l), l = t[++f]) : (a = c + o, s = o - (a - c), c = i[++d]), o = a, s !== 0 && (r[h++] = s); f < e && d < n; )
      c > l == c > -l ? (a = o + l, u = a - o, s = o - (a - u) + (l - u), l = t[++f]) : (a = o + c, u = a - o, s = o - (a - u) + (c - u), c = i[++d]), o = a, s !== 0 && (r[h++] = s);
  for (; f < e; )
    a = o + l, u = a - o, s = o - (a - u) + (l - u), l = t[++f], o = a, s !== 0 && (r[h++] = s);
  for (; d < n; )
    a = o + c, u = a - o, s = o - (a - u) + (c - u), c = i[++d], o = a, s !== 0 && (r[h++] = s);
  return (o !== 0 || h === 0) && (r[h++] = o), h;
}
function NV(e, t) {
  let n = t[0];
  for (let i = 1; i < e; i++)
    n += t[i];
  return n;
}
function ud(e) {
  return new Float64Array(e);
}
const RV = (3 + 16 * ro) * ro, jV = (2 + 12 * ro) * ro, PV = (9 + 64 * ro) * ro * ro, gu = ud(4), pC = ud(8), mC = ud(12), yC = ud(16), rn = ud(4);
function LV(e, t, n, i, r, o, a) {
  let s, u, l, c, f, d, h, g, p, m, y, v, b, x, E, A, w, _;
  const k = e - r, C = n - r, O = t - o, S = i - o;
  x = k * S, d = It * k, h = d - (d - k), g = k - h, d = It * S, p = d - (d - S), m = S - p, E = g * m - (x - h * p - g * p - h * m), A = O * C, d = It * O, h = d - (d - O), g = O - h, d = It * C, p = d - (d - C), m = C - p, w = g * m - (A - h * p - g * p - h * m), y = E - w, f = E - y, gu[0] = E - (y + f) + (f - w), v = x + y, f = v - x, b = x - (v - f) + (y - f), y = b - A, f = b - y, gu[1] = b - (y + f) + (f - A), _ = v + y, f = _ - v, gu[2] = v - (_ - f) + (y - f), gu[3] = _;
  let D = NV(4, gu), M = jV * a;
  if (D >= M || -D >= M || (f = e - k, s = e - (k + f) + (f - r), f = n - C, l = n - (C + f) + (f - r), f = t - O, u = t - (O + f) + (f - o), f = i - S, c = i - (S + f) + (f - o), s === 0 && u === 0 && l === 0 && c === 0) || (M = PV * a + TV * Math.abs(D), D += k * c + S * s - (O * l + C * u), D >= M || -D >= M))
    return D;
  x = s * S, d = It * s, h = d - (d - s), g = s - h, d = It * S, p = d - (d - S), m = S - p, E = g * m - (x - h * p - g * p - h * m), A = u * C, d = It * u, h = d - (d - u), g = u - h, d = It * C, p = d - (d - C), m = C - p, w = g * m - (A - h * p - g * p - h * m), y = E - w, f = E - y, rn[0] = E - (y + f) + (f - w), v = x + y, f = v - x, b = x - (v - f) + (y - f), y = b - A, f = b - y, rn[1] = b - (y + f) + (f - A), _ = v + y, f = _ - v, rn[2] = v - (_ - f) + (y - f), rn[3] = _;
  const F = I1(4, gu, 4, rn, pC);
  x = k * c, d = It * k, h = d - (d - k), g = k - h, d = It * c, p = d - (d - c), m = c - p, E = g * m - (x - h * p - g * p - h * m), A = O * l, d = It * O, h = d - (d - O), g = O - h, d = It * l, p = d - (d - l), m = l - p, w = g * m - (A - h * p - g * p - h * m), y = E - w, f = E - y, rn[0] = E - (y + f) + (f - w), v = x + y, f = v - x, b = x - (v - f) + (y - f), y = b - A, f = b - y, rn[1] = b - (y + f) + (f - A), _ = v + y, f = _ - v, rn[2] = v - (_ - f) + (y - f), rn[3] = _;
  const $ = I1(F, pC, 4, rn, mC);
  x = s * c, d = It * s, h = d - (d - s), g = s - h, d = It * c, p = d - (d - c), m = c - p, E = g * m - (x - h * p - g * p - h * m), A = u * l, d = It * u, h = d - (d - u), g = u - h, d = It * l, p = d - (d - l), m = l - p, w = g * m - (A - h * p - g * p - h * m), y = E - w, f = E - y, rn[0] = E - (y + f) + (f - w), v = x + y, f = v - x, b = x - (v - f) + (y - f), y = b - A, f = b - y, rn[1] = b - (y + f) + (f - A), _ = v + y, f = _ - v, rn[2] = v - (_ - f) + (y - f), rn[3] = _;
  const T = I1($, mC, 4, rn, yC);
  return yC[T - 1];
}
function ih(e, t, n, i, r, o) {
  const a = (t - o) * (n - r), s = (e - r) * (i - o), u = a - s;
  if (a === 0 || s === 0 || a > 0 != s > 0)
    return u;
  const l = Math.abs(a + s);
  return Math.abs(u) >= RV * l ? u : -LV(e, t, n, i, r, o, l);
}
const vC = Math.pow(2, -52), rh = new Uint32Array(512);
class l0 {
  static from(t, n = qV, i = WV) {
    const r = t.length, o = new Float64Array(r * 2);
    for (let a = 0; a < r; a++) {
      const s = t[a];
      o[2 * a] = n(s), o[2 * a + 1] = i(s);
    }
    return new l0(o);
  }
  constructor(t) {
    const n = t.length >> 1;
    if (n > 0 && typeof t[0] != "number")
      throw new Error("Expected coords to contain numbers.");
    this.coords = t;
    const i = Math.max(2 * n - 5, 0);
    this._triangles = new Uint32Array(i * 3), this._halfedges = new Int32Array(i * 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: t, _hullPrev: n, _hullNext: i, _hullTri: r, _hullHash: o } = this, a = t.length >> 1;
    let s = 1 / 0, u = 1 / 0, l = -1 / 0, c = -1 / 0;
    for (let C = 0; C < a; C++) {
      const O = t[2 * C], S = t[2 * C + 1];
      O < s && (s = O), S < u && (u = S), O > l && (l = O), S > c && (c = S), this._ids[C] = C;
    }
    const f = (s + l) / 2, d = (u + c) / 2;
    let h = 1 / 0, g, p, m;
    for (let C = 0; C < a; C++) {
      const O = B1(f, d, t[2 * C], t[2 * C + 1]);
      O < h && (g = C, h = O);
    }
    const y = t[2 * g], v = t[2 * g + 1];
    h = 1 / 0;
    for (let C = 0; C < a; C++) {
      if (C === g)
        continue;
      const O = B1(y, v, t[2 * C], t[2 * C + 1]);
      O < h && O > 0 && (p = C, h = O);
    }
    let b = t[2 * p], x = t[2 * p + 1], E = 1 / 0;
    for (let C = 0; C < a; C++) {
      if (C === g || C === p)
        continue;
      const O = zV(y, v, b, x, t[2 * C], t[2 * C + 1]);
      O < E && (m = C, E = O);
    }
    let A = t[2 * m], w = t[2 * m + 1];
    if (E === 1 / 0) {
      for (let S = 0; S < a; S++)
        this._dists[S] = t[2 * S] - t[0] || t[2 * S + 1] - t[1];
      Cu(this._ids, this._dists, 0, a - 1);
      const C = new Uint32Array(a);
      let O = 0;
      for (let S = 0, D = -1 / 0; S < a; S++) {
        const M = this._ids[S];
        this._dists[M] > D && (C[O++] = M, D = this._dists[M]);
      }
      this.hull = C.subarray(0, O), this.triangles = new Uint32Array(0), this.halfedges = new Uint32Array(0);
      return;
    }
    if (ih(y, v, b, x, A, w) < 0) {
      const C = p, O = b, S = x;
      p = m, b = A, x = w, m = C, A = O, w = S;
    }
    const _ = UV(y, v, b, x, A, w);
    this._cx = _.x, this._cy = _.y;
    for (let C = 0; C < a; C++)
      this._dists[C] = B1(t[2 * C], t[2 * C + 1], _.x, _.y);
    Cu(this._ids, this._dists, 0, a - 1), this._hullStart = g;
    let k = 3;
    i[g] = n[m] = p, i[p] = n[g] = m, i[m] = n[p] = g, r[g] = 0, r[p] = 1, r[m] = 2, o.fill(-1), o[this._hashKey(y, v)] = g, o[this._hashKey(b, x)] = p, o[this._hashKey(A, w)] = m, this.trianglesLen = 0, this._addTriangle(g, p, m, -1, -1, -1);
    for (let C = 0, O, S; C < this._ids.length; C++) {
      const D = this._ids[C], M = t[2 * D], F = t[2 * D + 1];
      if (C > 0 && Math.abs(M - O) <= vC && Math.abs(F - S) <= vC || (O = M, S = F, D === g || D === p || D === m))
        continue;
      let $ = 0;
      for (let fe = 0, Me = this._hashKey(M, F); fe < this._hashSize && ($ = o[(Me + fe) % this._hashSize], !($ !== -1 && $ !== i[$])); fe++)
        ;
      $ = n[$];
      let T = $, L;
      for (; L = i[T], ih(M, F, t[2 * T], t[2 * T + 1], t[2 * L], t[2 * L + 1]) >= 0; )
        if (T = L, T === $) {
          T = -1;
          break;
        }
      if (T === -1)
        continue;
      let I = this._addTriangle(T, D, i[T], -1, -1, r[T]);
      r[D] = this._legalize(I + 2), r[T] = I, k++;
      let Y = i[T];
      for (; L = i[Y], ih(M, F, t[2 * Y], t[2 * Y + 1], t[2 * L], t[2 * L + 1]) < 0; )
        I = this._addTriangle(Y, D, L, r[D], -1, r[Y]), r[D] = this._legalize(I + 2), i[Y] = Y, k--, Y = L;
      if (T === $)
        for (; L = n[T], ih(M, F, t[2 * L], t[2 * L + 1], t[2 * T], t[2 * T + 1]) < 0; )
          I = this._addTriangle(L, D, T, -1, r[T], r[L]), this._legalize(I + 2), r[L] = I, i[T] = T, k--, T = L;
      this._hullStart = n[D] = T, i[T] = n[Y] = D, i[D] = Y, o[this._hashKey(M, F)] = D, o[this._hashKey(t[2 * T], t[2 * T + 1])] = T;
    }
    this.hull = new Uint32Array(k);
    for (let C = 0, O = this._hullStart; C < k; C++)
      this.hull[C] = O, O = i[O];
    this.triangles = this._triangles.subarray(0, this.trianglesLen), this.halfedges = this._halfedges.subarray(0, this.trianglesLen);
  }
  _hashKey(t, n) {
    return Math.floor(IV(t - this._cx, n - this._cy) * this._hashSize) % this._hashSize;
  }
  _legalize(t) {
    const { _triangles: n, _halfedges: i, coords: r } = this;
    let o = 0, a = 0;
    for (; ; ) {
      const s = i[t], u = t - t % 3;
      if (a = u + (t + 2) % 3, s === -1) {
        if (o === 0)
          break;
        t = rh[--o];
        continue;
      }
      const l = s - s % 3, c = u + (t + 1) % 3, f = l + (s + 2) % 3, d = n[a], h = n[t], g = n[c], p = n[f];
      if (BV(
        r[2 * d],
        r[2 * d + 1],
        r[2 * h],
        r[2 * h + 1],
        r[2 * g],
        r[2 * g + 1],
        r[2 * p],
        r[2 * p + 1]
      )) {
        n[t] = p, n[s] = d;
        const y = i[f];
        if (y === -1) {
          let b = this._hullStart;
          do {
            if (this._hullTri[b] === f) {
              this._hullTri[b] = t;
              break;
            }
            b = this._hullPrev[b];
          } while (b !== this._hullStart);
        }
        this._link(t, y), this._link(s, i[a]), this._link(a, f);
        const v = l + (s + 1) % 3;
        o < rh.length && (rh[o++] = v);
      } else {
        if (o === 0)
          break;
        t = rh[--o];
      }
    }
    return a;
  }
  _link(t, n) {
    this._halfedges[t] = n, n !== -1 && (this._halfedges[n] = t);
  }
  _addTriangle(t, n, i, r, o, a) {
    const s = this.trianglesLen;
    return this._triangles[s] = t, this._triangles[s + 1] = n, this._triangles[s + 2] = i, this._link(s, r), this._link(s + 1, o), this._link(s + 2, a), this.trianglesLen += 3, s;
  }
}
function IV(e, t) {
  const n = e / (Math.abs(e) + Math.abs(t));
  return (t > 0 ? 3 - n : 1 + n) / 4;
}
function B1(e, t, n, i) {
  const r = e - n, o = t - i;
  return r * r + o * o;
}
function BV(e, t, n, i, r, o, a, s) {
  const u = e - a, l = t - s, c = n - a, f = i - s, d = r - a, h = o - s, g = u * u + l * l, p = c * c + f * f, m = d * d + h * h;
  return u * (f * m - p * h) - l * (c * m - p * d) + g * (c * h - f * d) < 0;
}
function zV(e, t, n, i, r, o) {
  const a = n - e, s = i - t, u = r - e, l = o - t, c = a * a + s * s, f = u * u + l * l, d = 0.5 / (a * l - s * u), h = (l * c - s * f) * d, g = (a * f - u * c) * d;
  return h * h + g * g;
}
function UV(e, t, n, i, r, o) {
  const a = n - e, s = i - t, u = r - e, l = o - t, c = a * a + s * s, f = u * u + l * l, d = 0.5 / (a * l - s * u), h = e + (l * c - s * f) * d, g = t + (a * f - u * c) * d;
  return { x: h, y: g };
}
function Cu(e, t, n, i) {
  if (i - n <= 20)
    for (let r = n + 1; r <= i; r++) {
      const o = e[r], a = t[o];
      let s = r - 1;
      for (; s >= n && t[e[s]] > a; )
        e[s + 1] = e[s--];
      e[s + 1] = o;
    }
  else {
    const r = n + i >> 1;
    let o = n + 1, a = i;
    ic(e, r, o), t[e[n]] > t[e[i]] && ic(e, n, i), t[e[o]] > t[e[i]] && ic(e, o, i), t[e[n]] > t[e[o]] && ic(e, n, o);
    const s = e[o], u = t[s];
    for (; ; ) {
      do
        o++;
      while (t[e[o]] < u);
      do
        a--;
      while (t[e[a]] > u);
      if (a < o)
        break;
      ic(e, o, a);
    }
    e[n + 1] = e[a], e[a] = s, i - o + 1 >= a - n ? (Cu(e, t, o, i), Cu(e, t, n, a - 1)) : (Cu(e, t, n, a - 1), Cu(e, t, o, i));
  }
}
function ic(e, t, n) {
  const i = e[t];
  e[t] = e[n], e[n] = i;
}
function qV(e) {
  return e[0];
}
function WV(e) {
  return e[1];
}
const bC = 1e-6;
class ss {
  constructor() {
    this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";
  }
  moveTo(t, n) {
    this._ += `M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +n}`;
  }
  closePath() {
    this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
  }
  lineTo(t, n) {
    this._ += `L${this._x1 = +t},${this._y1 = +n}`;
  }
  arc(t, n, i) {
    t = +t, n = +n, i = +i;
    const r = t + i, o = n;
    if (i < 0)
      throw new Error("negative radius");
    this._x1 === null ? this._ += `M${r},${o}` : (Math.abs(this._x1 - r) > bC || Math.abs(this._y1 - o) > bC) && (this._ += "L" + r + "," + o), i && (this._ += `A${i},${i},0,1,1,${t - i},${n}A${i},${i},0,1,1,${this._x1 = r},${this._y1 = o}`);
  }
  rect(t, n, i, r) {
    this._ += `M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +n}h${+i}v${+r}h${-i}Z`;
  }
  value() {
    return this._ || null;
  }
}
class Jv {
  constructor() {
    this._ = [];
  }
  moveTo(t, n) {
    this._.push([t, n]);
  }
  closePath() {
    this._.push(this._[0].slice());
  }
  lineTo(t, n) {
    this._.push([t, n]);
  }
  value() {
    return this._.length ? this._ : null;
  }
}
class GV {
  constructor(t, [n, i, r, o] = [0, 0, 960, 500]) {
    if (!((r = +r) >= (n = +n)) || !((o = +o) >= (i = +i)))
      throw new Error("invalid bounds");
    this.delaunay = t, this._circumcenters = new Float64Array(t.points.length * 2), this.vectors = new Float64Array(t.points.length * 2), this.xmax = r, this.xmin = n, this.ymax = o, this.ymin = i, this._init();
  }
  update() {
    return this.delaunay.update(), this._init(), this;
  }
  _init() {
    const { delaunay: { points: t, hull: n, triangles: i }, vectors: r } = this, o = this.circumcenters = this._circumcenters.subarray(0, i.length / 3 * 2);
    for (let h = 0, g = 0, p = i.length, m, y; h < p; h += 3, g += 2) {
      const v = i[h] * 2, b = i[h + 1] * 2, x = i[h + 2] * 2, E = t[v], A = t[v + 1], w = t[b], _ = t[b + 1], k = t[x], C = t[x + 1], O = w - E, S = _ - A, D = k - E, M = C - A, F = (O * M - S * D) * 2;
      if (Math.abs(F) < 1e-9) {
        let $ = 1e9;
        const T = i[0] * 2;
        $ *= Math.sign((t[T] - E) * M - (t[T + 1] - A) * D), m = (E + k) / 2 - $ * M, y = (A + C) / 2 + $ * D;
      } else {
        const $ = 1 / F, T = O * O + S * S, L = D * D + M * M;
        m = E + (M * T - S * L) * $, y = A + (O * L - D * T) * $;
      }
      o[g] = m, o[g + 1] = y;
    }
    let a = n[n.length - 1], s, u = a * 4, l, c = t[2 * a], f, d = t[2 * a + 1];
    r.fill(0);
    for (let h = 0; h < n.length; ++h)
      a = n[h], s = u, l = c, f = d, u = a * 4, c = t[2 * a], d = t[2 * a + 1], r[s + 2] = r[u] = f - d, r[s + 3] = r[u + 1] = c - l;
  }
  render(t) {
    const n = t == null ? t = new ss() : void 0, { delaunay: { halfedges: i, inedges: r, hull: o }, circumcenters: a, vectors: s } = this;
    if (o.length <= 1)
      return null;
    for (let c = 0, f = i.length; c < f; ++c) {
      const d = i[c];
      if (d < c)
        continue;
      const h = Math.floor(c / 3) * 2, g = Math.floor(d / 3) * 2, p = a[h], m = a[h + 1], y = a[g], v = a[g + 1];
      this._renderSegment(p, m, y, v, t);
    }
    let u, l = o[o.length - 1];
    for (let c = 0; c < o.length; ++c) {
      u = l, l = o[c];
      const f = Math.floor(r[l] / 3) * 2, d = a[f], h = a[f + 1], g = u * 4, p = this._project(d, h, s[g + 2], s[g + 3]);
      p && this._renderSegment(d, h, p[0], p[1], t);
    }
    return n && n.value();
  }
  renderBounds(t) {
    const n = t == null ? t = new ss() : void 0;
    return t.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin), n && n.value();
  }
  renderCell(t, n) {
    const i = n == null ? n = new ss() : void 0, r = this._clip(t);
    if (r === null || !r.length)
      return;
    n.moveTo(r[0], r[1]);
    let o = r.length;
    for (; r[0] === r[o - 2] && r[1] === r[o - 1] && o > 1; )
      o -= 2;
    for (let a = 2; a < o; a += 2)
      (r[a] !== r[a - 2] || r[a + 1] !== r[a - 1]) && n.lineTo(r[a], r[a + 1]);
    return n.closePath(), i && i.value();
  }
  *cellPolygons() {
    const { delaunay: { points: t } } = this;
    for (let n = 0, i = t.length / 2; n < i; ++n) {
      const r = this.cellPolygon(n);
      r && (r.index = n, yield r);
    }
  }
  cellPolygon(t) {
    const n = new Jv();
    return this.renderCell(t, n), n.value();
  }
  _renderSegment(t, n, i, r, o) {
    let a;
    const s = this._regioncode(t, n), u = this._regioncode(i, r);
    s === 0 && u === 0 ? (o.moveTo(t, n), o.lineTo(i, r)) : (a = this._clipSegment(t, n, i, r, s, u)) && (o.moveTo(a[0], a[1]), o.lineTo(a[2], a[3]));
  }
  contains(t, n, i) {
    return n = +n, n !== n || (i = +i, i !== i) ? !1 : this.delaunay._step(t, n, i) === t;
  }
  *neighbors(t) {
    const n = this._clip(t);
    if (n)
      for (const i of this.delaunay.neighbors(t)) {
        const r = this._clip(i);
        if (r) {
          e:
            for (let o = 0, a = n.length; o < a; o += 2)
              for (let s = 0, u = r.length; s < u; s += 2)
                if (n[o] == r[s] && n[o + 1] == r[s + 1] && n[(o + 2) % a] == r[(s + u - 2) % u] && n[(o + 3) % a] == r[(s + u - 1) % u]) {
                  yield i;
                  break e;
                }
        }
      }
  }
  _cell(t) {
    const { circumcenters: n, delaunay: { inedges: i, halfedges: r, triangles: o } } = this, a = i[t];
    if (a === -1)
      return null;
    const s = [];
    let u = a;
    do {
      const l = Math.floor(u / 3);
      if (s.push(n[l * 2], n[l * 2 + 1]), u = u % 3 === 2 ? u - 2 : u + 1, o[u] !== t)
        break;
      u = r[u];
    } while (u !== a && u !== -1);
    return s;
  }
  _clip(t) {
    if (t === 0 && this.delaunay.hull.length === 1)
      return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];
    const n = this._cell(t);
    if (n === null)
      return null;
    const { vectors: i } = this, r = t * 4;
    return i[r] || i[r + 1] ? this._clipInfinite(t, n, i[r], i[r + 1], i[r + 2], i[r + 3]) : this._clipFinite(t, n);
  }
  _clipFinite(t, n) {
    const i = n.length;
    let r = null, o, a, s = n[i - 2], u = n[i - 1], l, c = this._regioncode(s, u), f, d = 0;
    for (let h = 0; h < i; h += 2)
      if (o = s, a = u, s = n[h], u = n[h + 1], l = c, c = this._regioncode(s, u), l === 0 && c === 0)
        f = d, d = 0, r ? r.push(s, u) : r = [s, u];
      else {
        let g, p, m, y, v;
        if (l === 0) {
          if ((g = this._clipSegment(o, a, s, u, l, c)) === null)
            continue;
          [p, m, y, v] = g;
        } else {
          if ((g = this._clipSegment(s, u, o, a, c, l)) === null)
            continue;
          [y, v, p, m] = g, f = d, d = this._edgecode(p, m), f && d && this._edge(t, f, d, r, r.length), r ? r.push(p, m) : r = [p, m];
        }
        f = d, d = this._edgecode(y, v), f && d && this._edge(t, f, d, r, r.length), r ? r.push(y, v) : r = [y, v];
      }
    if (r)
      f = d, d = this._edgecode(r[0], r[1]), f && d && this._edge(t, f, d, r, r.length);
    else if (this.contains(t, (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 r;
  }
  _clipSegment(t, n, i, r, o, a) {
    for (; ; ) {
      if (o === 0 && a === 0)
        return [t, n, i, r];
      if (o & a)
        return null;
      let s, u, l = o || a;
      l & 8 ? (s = t + (i - t) * (this.ymax - n) / (r - n), u = this.ymax) : l & 4 ? (s = t + (i - t) * (this.ymin - n) / (r - n), u = this.ymin) : l & 2 ? (u = n + (r - n) * (this.xmax - t) / (i - t), s = this.xmax) : (u = n + (r - n) * (this.xmin - t) / (i - t), s = this.xmin), o ? (t = s, n = u, o = this._regioncode(t, n)) : (i = s, r = u, a = this._regioncode(i, r));
    }
  }
  _clipInfinite(t, n, i, r, o, a) {
    let s = Array.from(n), u;
    if ((u = this._project(s[0], s[1], i, r)) && s.unshift(u[0], u[1]), (u = this._project(s[s.length - 2], s[s.length - 1], o, a)) && s.push(u[0], u[1]), s = this._clipFinite(t, s))
      for (let l = 0, c = s.length, f, d = this._edgecode(s[c - 2], s[c - 1]); l < c; l += 2)
        f = d, d = this._edgecode(s[l], s[l + 1]), f && d && (l = this._edge(t, f, d, s, l), c = s.length);
    else
      this.contains(t, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2) && (s = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]);
    return s;
  }
  _edge(t, n, i, r, o) {
    for (; n !== i; ) {
      let a, s;
      switch (n) {
        case 5:
          n = 4;
          continue;
        case 4:
          n = 6, a = this.xmax, s = this.ymin;
          break;
        case 6:
          n = 2;
          continue;
        case 2:
          n = 10, a = this.xmax, s = this.ymax;
          break;
        case 10:
          n = 8;
          continue;
        case 8:
          n = 9, a = this.xmin, s = this.ymax;
          break;
        case 9:
          n = 1;
          continue;
        case 1:
          n = 5, a = this.xmin, s = this.ymin;
          break;
      }
      (r[o] !== a || r[o + 1] !== s) && this.contains(t, a, s) && (r.splice(o, 0, a, s), o += 2);
    }
    if (r.length > 4)
      for (let a = 0; a < r.length; a += 2) {
        const s = (a + 2) % r.length, u = (a + 4) % r.length;
        (r[a] === r[s] && r[s] === r[u] || r[a + 1] === r[s + 1] && r[s + 1] === r[u + 1]) && (r.splice(s, 2), a -= 2);
      }
    return o;
  }
  _project(t, n, i, r) {
    let o = 1 / 0, a, s, u;
    if (r < 0) {
      if (n <= this.ymin)
        return null;
      (a = (this.ymin - n) / r) < o && (u = this.ymin, s = t + (o = a) * i);
    } else if (r > 0) {
      if (n >= this.ymax)
        return null;
      (a = (this.ymax - n) / r) < o && (u = this.ymax, s = t + (o = a) * i);
    }
    if (i > 0) {
      if (t >= this.xmax)
        return null;
      (a = (this.xmax - t) / i) < o && (s = this.xmax, u = n + (o = a) * r);
    } else if (i < 0) {
      if (t <= this.xmin)
        return null;
      (a = (this.xmin - t) / i) < o && (s = this.xmin, u = n + (o = a) * r);
    }
    return [s, u];
  }
  _edgecode(t, n) {
    return (t === this.xmin ? 1 : t === this.xmax ? 2 : 0) | (n === this.ymin ? 4 : n === this.ymax ? 8 : 0);
  }
  _regioncode(t, n) {
    return (t < this.xmin ? 1 : t > this.xmax ? 2 : 0) | (n < this.ymin ? 4 : n > this.ymax ? 8 : 0);
  }
}
const HV = 2 * Math.PI, pu = Math.pow;
function YV(e) {
  return e[0];
}
function XV(e) {
  return e[1];
}
function VV(e) {
  const { triangles: t, coords: n } = e;
  for (let i = 0; i < t.length; i += 3) {
    const r = 2 * t[i], o = 2 * t[i + 1], a = 2 * t[i + 2];
    if ((n[a] - n[r]) * (n[o + 1] - n[r + 1]) - (n[o] - n[r]) * (n[a + 1] - n[r + 1]) > 1e-10)
      return !1;
  }
  return !0;
}
function KV(e, t, n) {
  return [e + Math.sin(e + t) * n, t + Math.cos(e - t) * n];
}
class sE {
  static from(t, n = YV, i = XV, r) {
    return new sE("length" in t ? JV(t, n, i, r) : Float64Array.from(QV(t, n, i, r)));
  }
  constructor(t) {
    this._delaunator = new l0(t), this.inedges = new Int32Array(t.length / 2), this._hullIndex = new Int32Array(t.length / 2), this.points = this._delaunator.coords, this._init();
  }
  update() {
    return this._delaunator.update(), this._init(), this;
  }
  _init() {
    const t = this._delaunator, n = this.points;
    if (t.hull && t.hull.length > 2 && VV(t)) {
      this.collinear = Int32Array.from({ length: n.length / 2 }, (d, h) => h).sort((d, h) => n[2 * d] - n[2 * h] || n[2 * d + 1] - n[2 * h + 1]);
      const u = this.collinear[0], l = this.collinear[this.collinear.length - 1], c = [n[2 * u], n[2 * u + 1], n[2 * l], n[2 * l + 1]], f = 1e-8 * Math.hypot(c[3] - c[1], c[2] - c[0]);
      for (let d = 0, h = n.length / 2; d < h; ++d) {
        const g = KV(n[2 * d], n[2 * d + 1], f);
        n[2 * d] = g[0], n[2 * d + 1] = g[1];
      }
      this._delaunator = new l0(n);
    } else
      delete this.collinear;
    const i = this.halfedges = this._delaunator.halfedges, r = this.hull = this._delaunator.hull, o = this.triangles = this._delaunator.triangles, a = this.inedges.fill(-1), s = this._hullIndex.fill(-1);
    for (let u = 0, l = i.length; u < l; ++u) {
      const c = o[u % 3 === 2 ? u - 2 : u + 1];
      (i[u] === -1 || a[c] === -1) && (a[c] = u);
    }
    for (let u = 0, l = r.length; u < l; ++u)
      s[r[u]] = u;
    r.length <= 2 && r.length > 0 && (this.triangles = new Int32Array(3).fill(-1), this.halfedges = new Int32Array(3).fill(-1), this.triangles[0] = r[0], a[r[0]] = 1, r.length === 2 && (a[r[1]] = 0, this.triangles[1] = r[1], this.triangles[2] = r[1]));
  }
  voronoi(t) {
    return new GV(this, t);
  }
  *neighbors(t) {
    const { inedges: n, hull: i, _hullIndex: r, halfedges: o, triangles: a, collinear: s } = this;
    if (s) {
      const f = s.indexOf(t);
      f > 0 && (yield s[f - 1]), f < s.length - 1 && (yield s[f + 1]);
      return;
    }
    const u = n[t];
    if (u === -1)
      return;
    let l = u, c = -1;
    do {
      if (yield c = a[l], l = l % 3 === 2 ? l - 2 : l + 1, a[l] !== t)
        return;
      if (l = o[l], l === -1) {
        const f = i[(r[t] + 1) % i.length];
        f !== c && (yield f);
        return;
      }
    } while (l !== u);
  }
  find(t, n, i = 0) {
    if (t = +t, t !== t || (n = +n, n !== n))
      return -1;
    const r = i;
    let o;
    for (; (o = this._step(i, t, n)) >= 0 && o !== i && o !== r; )
      i = o;
    return o;
  }
  _step(t, n, i) {
    const { inedges: r, hull: o, _hullIndex: a, halfedges: s, triangles: u, points: l } = this;
    if (r[t] === -1 || !l.length)
      return (t + 1) % (l.length >> 1);
    let c = t, f = pu(n - l[t * 2], 2) + pu(i - l[t * 2 + 1], 2);
    const d = r[t];
    let h = d;
    do {
      let g = u[h];
      const p = pu(n - l[g * 2], 2) + pu(i - l[g * 2 + 1], 2);
      if (p < f && (f = p, c = g), h = h % 3 === 2 ? h - 2 : h + 1, u[h] !== t)
        break;
      if (h = s[h], h === -1) {
        if (h = o[(a[t] + 1) % o.length], h !== g && pu(n - l[h * 2], 2) + pu(i - l[h * 2 + 1], 2) < f)
          return h;
        break;
      }
    } while (h !== d);
    return c;
  }
  render(t) {
    const n = t == null ? t = new ss() : void 0, { points: i, halfedges: r, triangles: o } = this;
    for (let a = 0, s = r.length; a < s; ++a) {
      const u = r[a];
      if (u < a)
        continue;
      const l = o[a] * 2, c = o[u] * 2;
      t.moveTo(i[l], i[l + 1]), t.lineTo(i[c], i[c + 1]);
    }
    return this.renderHull(t), n && n.value();
  }
  renderPoints(t, n) {
    n === void 0 && (!t || typeof t.moveTo != "function") && (n = t, t = null), n = n == null ? 2 : +n;
    const i = t == null ? t = new ss() : void 0, { points: r } = this;
    for (let o = 0, a = r.length; o < a; o += 2) {
      const s = r[o], u = r[o + 1];
      t.moveTo(s + n, u), t.arc(s, u, n, 0, HV);
    }
    return i && i.value();
  }
  renderHull(t) {
    const n = t == null ? t = new ss() : void 0, { hull: i, points: r } = this, o = i[0] * 2, a = i.length;
    t.moveTo(r[o], r[o + 1]);
    for (let s = 1; s < a; ++s) {
      const u = 2 * i[s];
      t.lineTo(r[u], r[u + 1]);
    }
    return t.closePath(), n && n.value();
  }
  hullPolygon() {
    const t = new Jv();
    return this.renderHull(t), t.value();
  }
  renderTriangle(t, n) {
    const i = n == null ? n = new ss() : void 0, { points: r, triangles: o } = this, a = o[t *= 3] * 2, s = o[t + 1] * 2, u = o[t + 2] * 2;
    return n.moveTo(r[a], r[a + 1]), n.lineTo(r[s], r[s + 1]), n.lineTo(r[u], r[u + 1]), n.closePath(), i && i.value();
  }
  *trianglePolygons() {
    const { triangles: t } = this;
    for (let n = 0, i = t.length / 3; n < i; ++n)
      yield this.trianglePolygon(n);
  }
  trianglePolygon(t) {
    const n = new Jv();
    return this.renderTriangle(t, n), n.value();
  }
}
function JV(e, t, n, i) {
  const r = e.length, o = new Float64Array(r * 2);
  for (let a = 0; a < r; ++a) {
    const s = e[a];
    o[a * 2] = t.call(i, s, a, e), o[a * 2 + 1] = n.call(i, s, a, e);
  }
  return o;
}
function* QV(e, t, n, i) {
  let r = 0;
  for (const o of e)
    yield t.call(i, o, r, e), yield n.call(i, o, r, e), ++r;
}
function uE(e) {
  N.call(this, null, e);
}
uE.Definition = {
  type: "Voronoi",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "x",
    type: "field",
    required: !0
  }, {
    name: "y",
    type: "field",
    required: !0
  }, {
    name: "size",
    type: "number",
    array: !0,
    length: 2
  }, {
    name: "extent",
    type: "array",
    array: !0,
    length: 2,
    default: [[-1e5, -1e5], [1e5, 1e5]],
    content: {
      type: "number",
      array: !0,
      length: 2
    }
  }, {
    name: "as",
    type: "string",
    default: "path"
  }]
};
const ZV = [-1e5, -1e5, 1e5, 1e5];
q(uE, N, {
  transform(e, t) {
    const n = e.as || "path", i = t.source;
    if (!i || !i.length)
      return t;
    let r = e.size;
    r = r ? [0, 0, r[0], r[1]] : (r = e.extent) ? [r[0][0], r[0][1], r[1][0], r[1][1]] : ZV;
    const o = this.value = sE.from(i, e.x, e.y).voronoi(r);
    for (let a = 0, s = i.length; a < s; ++a) {
      const u = o.cellPolygon(a);
      i[a][n] = u ? eK(u) : null;
    }
    return t.reflow(e.modified()).modifies(n);
  }
});
function eK(e) {
  const t = e[0][0], n = e[0][1];
  let i = e.length - 1;
  for (; e[i][0] === t && e[i][1] === n; --i)
    ;
  return "M" + e.slice(0, i + 1).join("L") + "Z";
}
const tK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  voronoi: uE
}, Symbol.toStringTag, { value: "Module" }));
var z1 = Math.PI / 180, Mc = 1 << 11 >> 5, zh = 1 << 11;
function nK() {
  var e = [256, 256], t, n, i, r, o, a, s, u = YN, l = [], c = Math.random, f = {};
  f.layout = function() {
    for (var g = d(Zo()), p = uK((e[0] >> 5) * e[1]), m = null, y = l.length, v = -1, b = [], x = l.map((A) => ({
      text: t(A),
      font: n(A),
      style: r(A),
      weight: o(A),
      rotate: a(A),
      size: ~~(i(A) + 1e-14),
      padding: s(A),
      xoff: 0,
      yoff: 0,
      x1: 0,
      y1: 0,
      x0: 0,
      y0: 0,
      hasText: !1,
      sprite: null,
      datum: A
    })).sort((A, w) => w.size - A.size); ++v < y; ) {
      var E = x[v];
      E.x = e[0] * (c() + 0.5) >> 1, E.y = e[1] * (c() + 0.5) >> 1, iK(g, E, x, v), E.hasText && h(p, E, m) && (b.push(E), m ? oK(m, E) : m = [{
        x: E.x + E.x0,
        y: E.y + E.y0
      }, {
        x: E.x + E.x1,
        y: E.y + E.y1
      }], E.x -= e[0] >> 1, E.y -= e[1] >> 1);
    }
    return b;
  };
  function d(g) {
    g.width = g.height = 1;
    var p = Math.sqrt(g.getContext("2d").getImageData(0, 0, 1, 1).data.length >> 2);
    g.width = (Mc << 5) / p, g.height = zh / p;
    var m = g.getContext("2d");
    return m.fillStyle = m.strokeStyle = "red", m.textAlign = "center", {
      context: m,
      ratio: p
    };
  }
  function h(g, p, m) {
    for (var y = p.x, v = p.y, b = Math.sqrt(e[0] * e[0] + e[1] * e[1]), x = u(e), E = c() < 0.5 ? 1 : -1, A = -E, w, _, k; (w = x(A += E)) && (_ = ~~w[0], k = ~~w[1], !(Math.min(Math.abs(_), Math.abs(k)) >= b)); )
      if (p.x = y + _, p.y = v + k, !(p.x + p.x0 < 0 || p.y + p.y0 < 0 || p.x + p.x1 > e[0] || p.y + p.y1 > e[1]) && (!m || !rK(p, g, e[0])) && (!m || aK(p, m))) {
        for (var C = p.sprite, O = p.width >> 5, S = e[0] >> 5, D = p.x - (O << 4), M = D & 127, F = 32 - M, $ = p.y1 - p.y0, T = (p.y + p.y0) * S + (D >> 5), L, I = 0; I < $; I++) {
          L = 0;
          for (var Y = 0; Y <= O; Y++)
            g[T + Y] |= L << F | (Y < O ? (L = C[I * O + Y]) >>> M : 0);
          T += S;
        }
        return p.sprite = null, !0;
      }
    return !1;
  }
  return f.words = function(g) {
    return arguments.length ? (l = g, f) : l;
  }, f.size = function(g) {
    return arguments.length ? (e = [+g[0], +g[1]], f) : e;
  }, f.font = function(g) {
    return arguments.length ? (n = La(g), f) : n;
  }, f.fontStyle = function(g) {
    return arguments.length ? (r = La(g), f) : r;
  }, f.fontWeight = function(g) {
    return arguments.length ? (o = La(g), f) : o;
  }, f.rotate = function(g) {
    return arguments.length ? (a = La(g), f) : a;
  }, f.text = function(g) {
    return arguments.length ? (t = La(g), f) : t;
  }, f.spiral = function(g) {
    return arguments.length ? (u = lK[g] || g, f) : u;
  }, f.fontSize = function(g) {
    return arguments.length ? (i = La(g), f) : i;
  }, f.padding = function(g) {
    return arguments.length ? (s = La(g), f) : s;
  }, f.random = function(g) {
    return arguments.length ? (c = g, f) : c;
  }, f;
}
function iK(e, t, n, i) {
  if (!t.sprite) {
    var r = e.context, o = e.ratio;
    r.clearRect(0, 0, (Mc << 5) / o, zh / o);
    var a = 0, s = 0, u = 0, l = n.length, c, f, d, h, g;
    for (--i; ++i < l; ) {
      if (t = n[i], r.save(), r.font = t.style + " " + t.weight + " " + ~~((t.size + 1) / o) + "px " + t.font, c = r.measureText(t.text + "m").width * o, d = t.size << 1, t.rotate) {
        var p = Math.sin(t.rotate * z1), m = Math.cos(t.rotate * z1), y = c * m, v = c * p, b = d * m, x = d * p;
        c = Math.max(Math.abs(y + x), Math.abs(y - x)) + 31 >> 5 << 5, d = ~~Math.max(Math.abs(v + b), Math.abs(v - b));
      } else
        c = c + 31 >> 5 << 5;
      if (d > u && (u = d), a + c >= Mc << 5 && (a = 0, s += u, u = 0), s + d >= zh)
        break;
      r.translate((a + (c >> 1)) / o, (s + (d >> 1)) / o), t.rotate && r.rotate(t.rotate * z1), r.fillText(t.text, 0, 0), t.padding && (r.lineWidth = 2 * t.padding, r.strokeText(t.text, 0, 0)), r.restore(), t.width = c, t.height = d, t.xoff = a, t.yoff = s, t.x1 = c >> 1, t.y1 = d >> 1, t.x0 = -t.x1, t.y0 = -t.y1, t.hasText = !0, a += c;
    }
    for (var E = r.getImageData(0, 0, (Mc << 5) / o, zh / o).data, A = []; --i >= 0; )
      if (t = n[i], !!t.hasText) {
        for (c = t.width, f = c >> 5, d = t.y1 - t.y0, h = 0; h < d * f; h++)
          A[h] = 0;
        if (a = t.xoff, a == null)
          return;
        s = t.yoff;
        var w = 0, _ = -1;
        for (g = 0; g < d; g++) {
          for (h = 0; h < c; h++) {
            var k = f * g + (h >> 5), C = E[(s + g) * (Mc << 5) + (a + h) << 2] ? 1 << 31 - h % 32 : 0;
            A[k] |= C, w |= C;
          }
          w ? _ = g : (t.y0++, d--, g--, s++);
        }
        t.y1 = t.y0 + _, t.sprite = A.slice(0, (t.y1 - t.y0) * f);
      }
  }
}
function rK(e, t, n) {
  n >>= 5;
  for (var i = e.sprite, r = e.width >> 5, o = e.x - (r << 4), a = o & 127, s = 32 - a, u = e.y1 - e.y0, l = (e.y + e.y0) * n + (o >> 5), c, f = 0; f < u; f++) {
    c = 0;
    for (var d = 0; d <= r; d++)
      if ((c << s | (d < r ? (c = i[f * r + d]) >>> a : 0)) & t[l + d])
        return !0;
    l += n;
  }
  return !1;
}
function oK(e, t) {
  var n = e[0], i = e[1];
  t.x + t.x0 < n.x && (n.x = t.x + t.x0), t.y + t.y0 < n.y && (n.y = t.y + t.y0), t.x + t.x1 > i.x && (i.x = t.x + t.x1), t.y + t.y1 > i.y && (i.y = t.y + t.y1);
}
function aK(e, t) {
  return e.x + e.x1 > t[0].x && e.x + e.x0 < t[1].x && e.y + e.y1 > t[0].y && e.y + e.y0 < t[1].y;
}
function YN(e) {
  var t = e[0] / e[1];
  return function(n) {
    return [t * (n *= 0.1) * Math.cos(n), n * Math.sin(n)];
  };
}
function sK(e) {
  var t = 4, n = t * e[0] / e[1], i = 0, r = 0;
  return function(o) {
    var a = o < 0 ? -1 : 1;
    switch (Math.sqrt(1 + 4 * a * o) - a & 3) {
      case 0:
        i += n;
        break;
      case 1:
        r += t;
        break;
      case 2:
        i -= n;
        break;
      default:
        r -= t;
        break;
    }
    return [i, r];
  };
}
function uK(e) {
  for (var t = [], n = -1; ++n < e; )
    t[n] = 0;
  return t;
}
function La(e) {
  return typeof e == "function" ? e : function() {
    return e;
  };
}
var lK = {
  archimedean: YN,
  rectangular: sK
};
const XN = ["x", "y", "font", "fontSize", "fontStyle", "fontWeight", "angle"], cK = ["text", "font", "rotate", "fontSize", "fontStyle", "fontWeight"];
function lE(e) {
  N.call(this, nK(), e);
}
lE.Definition = {
  type: "Wordcloud",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "size",
    type: "number",
    array: !0,
    length: 2
  }, {
    name: "font",
    type: "string",
    expr: !0,
    default: "sans-serif"
  }, {
    name: "fontStyle",
    type: "string",
    expr: !0,
    default: "normal"
  }, {
    name: "fontWeight",
    type: "string",
    expr: !0,
    default: "normal"
  }, {
    name: "fontSize",
    type: "number",
    expr: !0,
    default: 14
  }, {
    name: "fontSizeRange",
    type: "number",
    array: "nullable",
    default: [10, 50]
  }, {
    name: "rotate",
    type: "number",
    expr: !0,
    default: 0
  }, {
    name: "text",
    type: "field"
  }, {
    name: "spiral",
    type: "string",
    values: ["archimedean", "rectangular"]
  }, {
    name: "padding",
    type: "number",
    expr: !0
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: 7,
    default: XN
  }]
};
q(lE, N, {
  transform(e, t) {
    e.size && !(e.size[0] && e.size[1]) && P("Wordcloud size dimensions must be non-zero.");
    function n(g) {
      const p = e[g];
      return he(p) && t.modified(p.fields);
    }
    const i = e.modified();
    if (!(i || t.changed(t.ADD_REM) || cK.some(n)))
      return;
    const r = t.materialize(t.SOURCE).source, o = this.value, a = e.as || XN;
    let s = e.fontSize || 14, u;
    if (he(s) ? u = e.fontSizeRange : s = Zt(s), u) {
      const g = s, p = De("sqrt")().domain(vr(r, g)).range(u);
      s = (m) => p(g(m));
    }
    r.forEach((g) => {
      g[a[0]] = NaN, g[a[1]] = NaN, g[a[3]] = 0;
    });
    const l = o.words(r).text(e.text).size(e.size || [500, 500]).padding(e.padding || 1).spiral(e.spiral || "archimedean").rotate(e.rotate || 0).font(e.font || "sans-serif").fontStyle(e.fontStyle || "normal").fontWeight(e.fontWeight || "normal").fontSize(s).random(di).layout(), c = o.size(), f = c[0] >> 1, d = c[1] >> 1, h = l.length;
    for (let g = 0, p, m; g < h; ++g)
      p = l[g], m = p.datum, m[a[0]] = p.x + f, m[a[1]] = p.y + d, m[a[2]] = p.font, m[a[3]] = p.size, m[a[4]] = p.style, m[a[5]] = p.weight, m[a[6]] = p.rotate;
    return t.reflow(i).modifies(a);
  }
});
const fK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  wordcloud: lE
}, Symbol.toStringTag, { value: "Module" })), dK = (e) => new Uint8Array(e), hK = (e) => new Uint16Array(e), Hc = (e) => new Uint32Array(e);
function gK() {
  let e = 8, t = [], n = Hc(0), i = oh(0, e), r = oh(0, e);
  return {
    data: () => t,
    seen: () => n = pK(n, t.length),
    add(o) {
      for (let a = 0, s = t.length, u = o.length, l; a < u; ++a)
        l = o[a], l._index = s++, t.push(l);
    },
    remove(o, a) {
      const s = t.length, u = Array(s - o), l = t;
      let c, f, d;
      for (f = 0; !a[f] && f < s; ++f)
        u[f] = t[f], l[f] = f;
      for (d = f; f < s; ++f)
        c = t[f], a[f] ? l[f] = -1 : (l[f] = d, i[d] = i[f], r[d] = r[f], u[d] = c, c._index = d++), i[f] = 0;
      return t = u, l;
    },
    size: () => t.length,
    curr: () => i,
    prev: () => r,
    reset: (o) => r[o] = i[o],
    all: () => e < 257 ? 255 : e < 65537 ? 65535 : 4294967295,
    set(o, a) {
      i[o] |= a;
    },
    clear(o, a) {
      i[o] &= ~a;
    },
    resize(o, a) {
      const s = i.length;
      (o > s || a > e) && (e = Math.max(a, e), i = oh(o, e, i), r = oh(o, e));
    }
  };
}
function pK(e, t, n) {
  return e.length >= t ? e : (n = n || new e.constructor(t), n.set(e), n);
}
function oh(e, t, n) {
  const i = (t < 257 ? dK : t < 65537 ? hK : Hc)(e);
  return n && i.set(n), i;
}
function xC(e, t, n) {
  const i = 1 << t;
  return {
    one: i,
    zero: ~i,
    range: n.slice(),
    bisect: e.bisect,
    index: e.index,
    size: e.size,
    onAdd(r, o) {
      const a = this, s = a.bisect(a.range, r.value), u = r.index, l = s[0], c = s[1], f = u.length;
      let d;
      for (d = 0; d < l; ++d)
        o[u[d]] |= i;
      for (d = c; d < f; ++d)
        o[u[d]] |= i;
      return a;
    }
  };
}
function wC() {
  let e = Hc(0), t = [], n = 0;
  function i(s, u, l) {
    if (!u.length)
      return [];
    const c = n, f = u.length, d = Hc(f);
    let h = Array(f), g, p, m;
    for (m = 0; m < f; ++m)
      h[m] = s(u[m]), d[m] = m;
    if (h = mK(h, d), c)
      g = t, p = e, t = Array(c + f), e = Hc(c + f), yK(l, g, p, c, h, d, f, t, e);
    else {
      if (l > 0)
        for (m = 0; m < f; ++m)
          d[m] += l;
      t = h, e = d;
    }
    return n = c + f, {
      index: d,
      value: h
    };
  }
  function r(s, u) {
    const l = n;
    let c, f, d;
    for (f = 0; !u[e[f]] && f < l; ++f)
      ;
    for (d = f; f < l; ++f)
      u[c = e[f]] || (e[d] = c, t[d] = t[f], ++d);
    n = l - s;
  }
  function o(s) {
    for (let u = 0, l = n; u < l; ++u)
      e[u] = s[e[u]];
  }
  function a(s, u) {
    let l;
    return u ? l = u.length : (u = t, l = n), [I9(u, s[0], 0, l), ng(u, s[1], 0, l)];
  }
  return {
    insert: i,
    remove: r,
    bisect: a,
    reindex: o,
    index: () => e,
    size: () => n
  };
}
function mK(e, t) {
  return e.sort.call(t, (n, i) => {
    const r = e[n], o = e[i];
    return r < o ? -1 : r > o ? 1 : 0;
  }), U9(e, t);
}
function yK(e, t, n, i, r, o, a, s, u) {
  let l = 0, c = 0, f;
  for (f = 0; l < i && c < a; ++f)
    t[l] < r[c] ? (s[f] = t[l], u[f] = n[l++]) : (s[f] = r[c], u[f] = o[c++] + e);
  for (; l < i; ++l, ++f)
    s[f] = t[l], u[f] = n[l];
  for (; c < a; ++c, ++f)
    s[f] = r[c], u[f] = o[c] + e;
}
function cE(e) {
  N.call(this, gK(), e), this._indices = null, this._dims = null;
}
cE.Definition = {
  type: "CrossFilter",
  metadata: {},
  params: [{
    name: "fields",
    type: "field",
    array: !0,
    required: !0
  }, {
    name: "query",
    type: "array",
    array: !0,
    required: !0,
    content: {
      type: "number",
      array: !0,
      length: 2
    }
  }]
};
q(cE, N, {
  transform(e, t) {
    if (this._dims) {
      var n = e.modified("fields") || e.fields.some((i) => t.modified(i.fields));
      return n ? this.reinit(e, t) : this.eval(e, t);
    } else
      return this.init(e, t);
  },
  init(e, t) {
    const n = e.fields, i = e.query, r = this._indices = {}, o = this._dims = [], a = i.length;
    let s = 0, u, l;
    for (; s < a; ++s)
      u = n[s].fname, l = r[u] || (r[u] = wC()), o.push(xC(l, s, i[s]));
    return this.eval(e, t);
  },
  reinit(e, t) {
    const n = t.materialize().fork(), i = e.fields, r = e.query, o = this._indices, a = this._dims, s = this.value, u = s.curr(), l = s.prev(), c = s.all(), f = n.rem = n.add, d = n.mod, h = r.length, g = {};
    let p, m, y, v, b, x, E, A, w;
    if (l.set(u), t.rem.length && (b = this.remove(e, t, n)), t.add.length && s.add(t.add), t.mod.length)
      for (x = {}, v = t.mod, E = 0, A = v.length; E < A; ++E)
        x[v[E]._index] = 1;
    for (E = 0; E < h; ++E)
      w = i[E], (!a[E] || e.modified("fields", E) || t.modified(w.fields)) && (y = w.fname, (p = g[y]) || (o[y] = m = wC(), g[y] = p = m.insert(w, t.source, 0)), a[E] = xC(m, E, r[E]).onAdd(p, u));
    for (E = 0, A = s.data().length; E < A; ++E)
      b[E] || (l[E] !== u[E] ? f.push(E) : x[E] && u[E] !== c && d.push(E));
    return s.mask = (1 << h) - 1, n;
  },
  eval(e, t) {
    const n = t.materialize().fork(), i = this._dims.length;
    let r = 0;
    return t.rem.length && (this.remove(e, t, n), r |= (1 << i) - 1), e.modified("query") && !e.modified("fields") && (r |= this.update(e, t, n)), t.add.length && (this.insert(e, t, n), r |= (1 << i) - 1), t.mod.length && (this.modify(t, n), r |= (1 << i) - 1), this.value.mask = r, n;
  },
  insert(e, t, n) {
    const i = t.add, r = this.value, o = this._dims, a = this._indices, s = e.fields, u = {}, l = n.add, c = r.size() + i.length, f = o.length;
    let d = r.size(), h, g, p;
    r.resize(c, f), r.add(i);
    const m = r.curr(), y = r.prev(), v = r.all();
    for (h = 0; h < f; ++h)
      g = s[h].fname, p = u[g] || (u[g] = a[g].insert(s[h], i, d)), o[h].onAdd(p, m);
    for (; d < c; ++d)
      y[d] = v, m[d] !== v && l.push(d);
  },
  modify(e, t) {
    const n = t.mod, i = this.value, r = i.curr(), o = i.all(), a = e.mod;
    let s, u, l;
    for (s = 0, u = a.length; s < u; ++s)
      l = a[s]._index, r[l] !== o && n.push(l);
  },
  remove(e, t, n) {
    const i = this._indices, r = this.value, o = r.curr(), a = r.prev(), s = r.all(), u = {}, l = n.rem, c = t.rem;
    let f, d, h, g;
    for (f = 0, d = c.length; f < d; ++f)
      h = c[f]._index, u[h] = 1, a[h] = g = o[h], o[h] = s, g !== s && l.push(h);
    for (h in i)
      i[h].remove(d, u);
    return this.reindex(t, d, u), u;
  },
  reindex(e, t, n) {
    const i = this._indices, r = this.value;
    e.runAfter(() => {
      const o = r.remove(t, n);
      for (const a in i)
        i[a].reindex(o);
    });
  },
  update(e, t, n) {
    const i = this._dims, r = e.query, o = t.stamp, a = i.length;
    let s = 0, u, l;
    for (n.filters = 0, l = 0; l < a; ++l)
      e.modified("query", l) && (u = l, ++s);
    if (s === 1)
      s = i[u].one, this.incrementOne(i[u], r[u], n.add, n.rem);
    else
      for (l = 0, s = 0; l < a; ++l)
        !e.modified("query", l) || (s |= i[l].one, this.incrementAll(i[l], r[l], o, n.add), n.rem = n.add);
    return s;
  },
  incrementAll(e, t, n, i) {
    const r = this.value, o = r.seen(), a = r.curr(), s = r.prev(), u = e.index(), l = e.bisect(e.range), c = e.bisect(t), f = c[0], d = c[1], h = l[0], g = l[1], p = e.one;
    let m, y, v;
    if (f < h)
      for (m = f, y = Math.min(h, d); m < y; ++m)
        v = u[m], o[v] !== n && (s[v] = a[v], o[v] = n, i.push(v)), a[v] ^= p;
    else if (f > h)
      for (m = h, y = Math.min(f, g); m < y; ++m)
        v = u[m], o[v] !== n && (s[v] = a[v], o[v] = n, i.push(v)), a[v] ^= p;
    if (d > g)
      for (m = Math.max(f, g), y = d; m < y; ++m)
        v = u[m], o[v] !== n && (s[v] = a[v], o[v] = n, i.push(v)), a[v] ^= p;
    else if (d < g)
      for (m = Math.max(h, d), y = g; m < y; ++m)
        v = u[m], o[v] !== n && (s[v] = a[v], o[v] = n, i.push(v)), a[v] ^= p;
    e.range = t.slice();
  },
  incrementOne(e, t, n, i) {
    const r = this.value, o = r.curr(), a = e.index(), s = e.bisect(e.range), u = e.bisect(t), l = u[0], c = u[1], f = s[0], d = s[1], h = e.one;
    let g, p, m;
    if (l < f)
      for (g = l, p = Math.min(f, c); g < p; ++g)
        m = a[g], o[m] ^= h, n.push(m);
    else if (l > f)
      for (g = f, p = Math.min(l, d); g < p; ++g)
        m = a[g], o[m] ^= h, i.push(m);
    if (c > d)
      for (g = Math.max(l, d), p = c; g < p; ++g)
        m = a[g], o[m] ^= h, n.push(m);
    else if (c < d)
      for (g = Math.max(f, c), p = d; g < p; ++g)
        m = a[g], o[m] ^= h, i.push(m);
    e.range = t.slice();
  }
});
function fE(e) {
  N.call(this, null, e);
}
fE.Definition = {
  type: "ResolveFilter",
  metadata: {},
  params: [{
    name: "ignore",
    type: "number",
    required: !0,
    description: "A bit mask indicating which filters to ignore."
  }, {
    name: "filter",
    type: "object",
    required: !0,
    description: "Per-tuple filter bitmaps from a CrossFilter transform."
  }]
};
q(fE, N, {
  transform(e, t) {
    const n = ~(e.ignore || 0), i = e.filter, r = i.mask;
    if ((r & n) === 0)
      return t.StopPropagation;
    const o = t.fork(t.ALL), a = i.data(), s = i.curr(), u = i.prev(), l = (c) => s[c] & n ? null : a[c];
    return o.filter(o.MOD, l), r & r - 1 ? (o.filter(o.ADD, (c) => {
      const f = s[c] & n;
      return !f && f ^ u[c] & n ? a[c] : null;
    }), o.filter(o.REM, (c) => {
      const f = s[c] & n;
      return f && !(f ^ (f ^ u[c] & n)) ? a[c] : null;
    })) : (o.filter(o.ADD, l), o.filter(o.REM, (c) => (s[c] & n) === r ? a[c] : null)), o.filter(o.SOURCE, (c) => l(c._index));
  }
});
const vK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  crossfilter: cE,
  resolvefilter: fE
}, Symbol.toStringTag, { value: "Module" })), bK = "RawCode", Fs = "Literal", xK = "Property", wK = "Identifier", EK = "ArrayExpression", AK = "BinaryExpression", VN = "CallExpression", _K = "ConditionalExpression", OK = "LogicalExpression", SK = "MemberExpression", CK = "ObjectExpression", FK = "UnaryExpression";
function Gi(e) {
  this.type = e;
}
Gi.prototype.visit = function(e) {
  let t, n, i;
  if (e(this))
    return 1;
  for (t = kK(this), n = 0, i = t.length; n < i; ++n)
    if (t[n].visit(e))
      return 1;
};
function kK(e) {
  switch (e.type) {
    case EK:
      return e.elements;
    case AK:
    case OK:
      return [e.left, e.right];
    case VN:
      return [e.callee].concat(e.arguments);
    case _K:
      return [e.test, e.consequent, e.alternate];
    case SK:
      return [e.object, e.property];
    case CK:
      return e.properties;
    case xK:
      return [e.key, e.value];
    case FK:
      return [e.argument];
    case wK:
    case Fs:
    case bK:
    default:
      return [];
  }
}
var Dr, X, R, Vt, Pe, Rp = 1, ld = 2, ks = 3, Oa = 4, jp = 5, Xs = 6, _n = 7, cd = 8, DK = 9;
Dr = {};
Dr[Rp] = "Boolean";
Dr[ld] = "<end>";
Dr[ks] = "Identifier";
Dr[Oa] = "Keyword";
Dr[jp] = "Null";
Dr[Xs] = "Numeric";
Dr[_n] = "Punctuator";
Dr[cd] = "String";
Dr[DK] = "RegularExpression";
var $K = "ArrayExpression", MK = "BinaryExpression", TK = "CallExpression", NK = "ConditionalExpression", KN = "Identifier", RK = "Literal", jK = "LogicalExpression", PK = "MemberExpression", LK = "ObjectExpression", IK = "Property", BK = "UnaryExpression", St = "Unexpected token %0", zK = "Unexpected number", UK = "Unexpected string", qK = "Unexpected identifier", WK = "Unexpected reserved word", GK = "Unexpected end of input", Qv = "Invalid regular expression", U1 = "Invalid regular expression: missing /", JN = "Octal literals are not allowed in strict mode.", HK = "Duplicate data property in object literal not allowed in strict mode", Tt = "ILLEGAL", yf = "Disabled.", YK = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), XK = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");
function Pp(e, t) {
  if (!e)
    throw new Error("ASSERT: " + t);
}
function Yr(e) {
  return e >= 48 && e <= 57;
}
function dE(e) {
  return "0123456789abcdefABCDEF".indexOf(e) >= 0;
}
function Yc(e) {
  return "01234567".indexOf(e) >= 0;
}
function VK(e) {
  return e === 32 || e === 9 || e === 11 || e === 12 || e === 160 || e >= 5760 && [5760, 6158, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279].indexOf(e) >= 0;
}
function vf(e) {
  return e === 10 || e === 13 || e === 8232 || e === 8233;
}
function fd(e) {
  return e === 36 || e === 95 || e >= 65 && e <= 90 || e >= 97 && e <= 122 || e === 92 || e >= 128 && YK.test(String.fromCharCode(e));
}
function c0(e) {
  return e === 36 || e === 95 || e >= 65 && e <= 90 || e >= 97 && e <= 122 || e >= 48 && e <= 57 || e === 92 || e >= 128 && XK.test(String.fromCharCode(e));
}
const KK = {
  if: 1,
  in: 1,
  do: 1,
  var: 1,
  for: 1,
  new: 1,
  try: 1,
  let: 1,
  this: 1,
  else: 1,
  case: 1,
  void: 1,
  with: 1,
  enum: 1,
  while: 1,
  break: 1,
  catch: 1,
  throw: 1,
  const: 1,
  yield: 1,
  class: 1,
  super: 1,
  return: 1,
  typeof: 1,
  delete: 1,
  switch: 1,
  export: 1,
  import: 1,
  public: 1,
  static: 1,
  default: 1,
  finally: 1,
  extends: 1,
  package: 1,
  private: 1,
  function: 1,
  continue: 1,
  debugger: 1,
  interface: 1,
  protected: 1,
  instanceof: 1,
  implements: 1
};
function QN() {
  for (; R < Vt; ) {
    const e = X.charCodeAt(R);
    if (VK(e) || vf(e))
      ++R;
    else
      break;
  }
}
function Zv(e) {
  var t, n, i, r = 0;
  for (n = e === "u" ? 4 : 2, t = 0; t < n; ++t)
    R < Vt && dE(X[R]) ? (i = X[R++], r = r * 16 + "0123456789abcdef".indexOf(i.toLowerCase())) : Ce({}, St, Tt);
  return String.fromCharCode(r);
}
function JK() {
  var e, t, n, i;
  for (e = X[R], t = 0, e === "}" && Ce({}, St, Tt); R < Vt && (e = X[R++], !!dE(e)); )
    t = t * 16 + "0123456789abcdef".indexOf(e.toLowerCase());
  return (t > 1114111 || e !== "}") && Ce({}, St, Tt), t <= 65535 ? String.fromCharCode(t) : (n = (t - 65536 >> 10) + 55296, i = (t - 65536 & 1023) + 56320, String.fromCharCode(n, i));
}
function ZN() {
  var e, t;
  for (e = X.charCodeAt(R++), t = String.fromCharCode(e), e === 92 && (X.charCodeAt(R) !== 117 && Ce({}, St, Tt), ++R, e = Zv("u"), (!e || e === "\\" || !fd(e.charCodeAt(0))) && Ce({}, St, Tt), t = e); R < Vt && (e = X.charCodeAt(R), !!c0(e)); )
    ++R, t += String.fromCharCode(e), e === 92 && (t = t.substr(0, t.length - 1), X.charCodeAt(R) !== 117 && Ce({}, St, Tt), ++R, e = Zv("u"), (!e || e === "\\" || !c0(e.charCodeAt(0))) && Ce({}, St, Tt), t += e);
  return t;
}
function QK() {
  var e, t;
  for (e = R++; R < Vt; ) {
    if (t = X.charCodeAt(R), t === 92)
      return R = e, ZN();
    if (c0(t))
      ++R;
    else
      break;
  }
  return X.slice(e, R);
}
function ZK() {
  var e, t, n;
  return e = R, t = X.charCodeAt(R) === 92 ? ZN() : QK(), t.length === 1 ? n = ks : KK.hasOwnProperty(t) ? n = Oa : t === "null" ? n = jp : t === "true" || t === "false" ? n = Rp : n = ks, {
    type: n,
    value: t,
    start: e,
    end: R
  };
}
function q1() {
  var e = R, t = X.charCodeAt(R), n, i = X[R], r, o, a;
  switch (t) {
    case 46:
    case 40:
    case 41:
    case 59:
    case 44:
    case 123:
    case 125:
    case 91:
    case 93:
    case 58:
    case 63:
    case 126:
      return ++R, {
        type: _n,
        value: String.fromCharCode(t),
        start: e,
        end: R
      };
    default:
      if (n = X.charCodeAt(R + 1), n === 61)
        switch (t) {
          case 43:
          case 45:
          case 47:
          case 60:
          case 62:
          case 94:
          case 124:
          case 37:
          case 38:
          case 42:
            return R += 2, {
              type: _n,
              value: String.fromCharCode(t) + String.fromCharCode(n),
              start: e,
              end: R
            };
          case 33:
          case 61:
            return R += 2, X.charCodeAt(R) === 61 && ++R, {
              type: _n,
              value: X.slice(e, R),
              start: e,
              end: R
            };
        }
  }
  if (a = X.substr(R, 4), a === ">>>=")
    return R += 4, {
      type: _n,
      value: a,
      start: e,
      end: R
    };
  if (o = a.substr(0, 3), o === ">>>" || o === "<<=" || o === ">>=")
    return R += 3, {
      type: _n,
      value: o,
      start: e,
      end: R
    };
  if (r = o.substr(0, 2), i === r[1] && "+-<>&|".indexOf(i) >= 0 || r === "=>")
    return R += 2, {
      type: _n,
      value: r,
      start: e,
      end: R
    };
  if (r === "//" && Ce({}, St, Tt), "<>=!+-*%&|^/".indexOf(i) >= 0)
    return ++R, {
      type: _n,
      value: i,
      start: e,
      end: R
    };
  Ce({}, St, Tt);
}
function eJ(e) {
  let t = "";
  for (; R < Vt && dE(X[R]); )
    t += X[R++];
  return t.length === 0 && Ce({}, St, Tt), fd(X.charCodeAt(R)) && Ce({}, St, Tt), {
    type: Xs,
    value: parseInt("0x" + t, 16),
    start: e,
    end: R
  };
}
function tJ(e) {
  let t = "0" + X[R++];
  for (; R < Vt && Yc(X[R]); )
    t += X[R++];
  return (fd(X.charCodeAt(R)) || Yr(X.charCodeAt(R))) && Ce({}, St, Tt), {
    type: Xs,
    value: parseInt(t, 8),
    octal: !0,
    start: e,
    end: R
  };
}
function EC() {
  var e, t, n;
  if (n = X[R], Pp(Yr(n.charCodeAt(0)) || n === ".", "Numeric literal must start with a decimal digit or a decimal point"), t = R, e = "", n !== ".") {
    if (e = X[R++], n = X[R], e === "0") {
      if (n === "x" || n === "X")
        return ++R, eJ(t);
      if (Yc(n))
        return tJ(t);
      n && Yr(n.charCodeAt(0)) && Ce({}, St, Tt);
    }
    for (; Yr(X.charCodeAt(R)); )
      e += X[R++];
    n = X[R];
  }
  if (n === ".") {
    for (e += X[R++]; Yr(X.charCodeAt(R)); )
      e += X[R++];
    n = X[R];
  }
  if (n === "e" || n === "E")
    if (e += X[R++], n = X[R], (n === "+" || n === "-") && (e += X[R++]), Yr(X.charCodeAt(R)))
      for (; Yr(X.charCodeAt(R)); )
        e += X[R++];
    else
      Ce({}, St, Tt);
  return fd(X.charCodeAt(R)) && Ce({}, St, Tt), {
    type: Xs,
    value: parseFloat(e),
    start: t,
    end: R
  };
}
function nJ() {
  var e = "", t, n, i, r, o = !1;
  for (t = X[R], Pp(t === "'" || t === '"', "String literal must starts with a quote"), n = R, ++R; R < Vt; )
    if (i = X[R++], i === t) {
      t = "";
      break;
    } else if (i === "\\")
      if (i = X[R++], !i || !vf(i.charCodeAt(0)))
        switch (i) {
          case "u":
          case "x":
            X[R] === "{" ? (++R, e += JK()) : e += Zv(i);
            break;
          case "n":
            e += `
`;
            break;
          case "r":
            e += "\r";
            break;
          case "t":
            e += "	";
            break;
          case "b":
            e += "\b";
            break;
          case "f":
            e += "\f";
            break;
          case "v":
            e += "\v";
            break;
          default:
            Yc(i) ? (r = "01234567".indexOf(i), r !== 0 && (o = !0), R < Vt && Yc(X[R]) && (o = !0, r = r * 8 + "01234567".indexOf(X[R++]), "0123".indexOf(i) >= 0 && R < Vt && Yc(X[R]) && (r = r * 8 + "01234567".indexOf(X[R++]))), e += String.fromCharCode(r)) : e += i;
            break;
        }
      else
        i === "\r" && X[R] === `
` && ++R;
    else {
      if (vf(i.charCodeAt(0)))
        break;
      e += i;
    }
  return t !== "" && Ce({}, St, Tt), {
    type: cd,
    value: e,
    octal: o,
    start: n,
    end: R
  };
}
function iJ(e, t) {
  let n = e;
  t.indexOf("u") >= 0 && (n = n.replace(/\\u\{([0-9a-fA-F]+)\}/g, (i, r) => {
    if (parseInt(r, 16) <= 1114111)
      return "x";
    Ce({}, Qv);
  }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x"));
  try {
    new RegExp(n);
  } catch {
    Ce({}, Qv);
  }
  try {
    return new RegExp(e, t);
  } catch {
    return null;
  }
}
function rJ() {
  var e, t, n, i, r;
  for (e = X[R], Pp(e === "/", "Regular expression literal must start with a slash"), t = X[R++], n = !1, i = !1; R < Vt; )
    if (e = X[R++], t += e, e === "\\")
      e = X[R++], vf(e.charCodeAt(0)) && Ce({}, U1), t += e;
    else if (vf(e.charCodeAt(0)))
      Ce({}, U1);
    else if (n)
      e === "]" && (n = !1);
    else if (e === "/") {
      i = !0;
      break;
    } else
      e === "[" && (n = !0);
  return i || Ce({}, U1), r = t.substr(1, t.length - 2), {
    value: r,
    literal: t
  };
}
function oJ() {
  var e, t, n;
  for (t = "", n = ""; R < Vt && (e = X[R], !!c0(e.charCodeAt(0))); )
    ++R, e === "\\" && R < Vt ? Ce({}, St, Tt) : (n += e, t += e);
  return n.search(/[^gimuy]/g) >= 0 && Ce({}, Qv, n), {
    value: n,
    literal: t
  };
}
function aJ() {
  var e, t, n, i;
  return Pe = null, QN(), e = R, t = rJ(), n = oJ(), i = iJ(t.value, n.value), {
    literal: t.literal + n.literal,
    value: i,
    regex: {
      pattern: t.value,
      flags: n.value
    },
    start: e,
    end: R
  };
}
function sJ(e) {
  return e.type === ks || e.type === Oa || e.type === Rp || e.type === jp;
}
function e6() {
  if (QN(), R >= Vt)
    return {
      type: ld,
      start: R,
      end: R
    };
  const e = X.charCodeAt(R);
  return fd(e) ? ZK() : e === 40 || e === 41 || e === 59 ? q1() : e === 39 || e === 34 ? nJ() : e === 46 ? Yr(X.charCodeAt(R + 1)) ? EC() : q1() : Yr(e) ? EC() : q1();
}
function Fn() {
  const e = Pe;
  return R = e.end, Pe = e6(), R = e.end, e;
}
function t6() {
  const e = R;
  Pe = e6(), R = e;
}
function uJ(e) {
  const t = new Gi($K);
  return t.elements = e, t;
}
function AC(e, t, n) {
  const i = new Gi(e === "||" || e === "&&" ? jK : MK);
  return i.operator = e, i.left = t, i.right = n, i;
}
function lJ(e, t) {
  const n = new Gi(TK);
  return n.callee = e, n.arguments = t, n;
}
function cJ(e, t, n) {
  const i = new Gi(NK);
  return i.test = e, i.consequent = t, i.alternate = n, i;
}
function hE(e) {
  const t = new Gi(KN);
  return t.name = e, t;
}
function Tc(e) {
  const t = new Gi(RK);
  return t.value = e.value, t.raw = X.slice(e.start, e.end), e.regex && (t.raw === "//" && (t.raw = "/(?:)/"), t.regex = e.regex), t;
}
function _C(e, t, n) {
  const i = new Gi(PK);
  return i.computed = e === "[", i.object = t, i.property = n, i.computed || (n.member = !0), i;
}
function fJ(e) {
  const t = new Gi(LK);
  return t.properties = e, t;
}
function OC(e, t, n) {
  const i = new Gi(IK);
  return i.key = t, i.value = n, i.kind = e, i;
}
function dJ(e, t) {
  const n = new Gi(BK);
  return n.operator = e, n.argument = t, n.prefix = !0, n;
}
function Ce(e, t) {
  var n, i = Array.prototype.slice.call(arguments, 2), r = t.replace(/%(\d)/g, (o, a) => (Pp(a < i.length, "Message reference must be in range"), i[a]));
  throw n = new Error(r), n.index = R, n.description = r, n;
}
function Lp(e) {
  e.type === ld && Ce(e, GK), e.type === Xs && Ce(e, zK), e.type === cd && Ce(e, UK), e.type === ks && Ce(e, qK), e.type === Oa && Ce(e, WK), Ce(e, St, e.value);
}
function Kt(e) {
  const t = Fn();
  (t.type !== _n || t.value !== e) && Lp(t);
}
function He(e) {
  return Pe.type === _n && Pe.value === e;
}
function W1(e) {
  return Pe.type === Oa && Pe.value === e;
}
function hJ() {
  const e = [];
  for (R = Pe.start, Kt("["); !He("]"); )
    He(",") ? (Fn(), e.push(null)) : (e.push(Ds()), He("]") || Kt(","));
  return Fn(), uJ(e);
}
function SC() {
  R = Pe.start;
  const e = Fn();
  return e.type === cd || e.type === Xs ? (e.octal && Ce(e, JN), Tc(e)) : hE(e.value);
}
function gJ() {
  var e, t, n, i;
  if (R = Pe.start, e = Pe, e.type === ks)
    return n = SC(), Kt(":"), i = Ds(), OC("init", n, i);
  if (e.type === ld || e.type === _n)
    Lp(e);
  else
    return t = SC(), Kt(":"), i = Ds(), OC("init", t, i);
}
function pJ() {
  var e = [], t, n, i, r = {}, o = String;
  for (R = Pe.start, Kt("{"); !He("}"); )
    t = gJ(), t.key.type === KN ? n = t.key.name : n = o(t.key.value), i = "$" + n, Object.prototype.hasOwnProperty.call(r, i) ? Ce({}, HK) : r[i] = !0, e.push(t), He("}") || Kt(",");
  return Kt("}"), fJ(e);
}
function mJ() {
  Kt("(");
  const e = gE();
  return Kt(")"), e;
}
const yJ = {
  if: 1
};
function vJ() {
  var e, t, n;
  if (He("("))
    return mJ();
  if (He("["))
    return hJ();
  if (He("{"))
    return pJ();
  if (e = Pe.type, R = Pe.start, e === ks || yJ[Pe.value])
    n = hE(Fn().value);
  else if (e === cd || e === Xs)
    Pe.octal && Ce(Pe, JN), n = Tc(Fn());
  else {
    if (e === Oa)
      throw new Error(yf);
    e === Rp ? (t = Fn(), t.value = t.value === "true", n = Tc(t)) : e === jp ? (t = Fn(), t.value = null, n = Tc(t)) : He("/") || He("/=") ? (n = Tc(aJ()), t6()) : Lp(Fn());
  }
  return n;
}
function bJ() {
  const e = [];
  if (Kt("("), !He(")"))
    for (; R < Vt && (e.push(Ds()), !He(")")); )
      Kt(",");
  return Kt(")"), e;
}
function xJ() {
  R = Pe.start;
  const e = Fn();
  return sJ(e) || Lp(e), hE(e.value);
}
function wJ() {
  return Kt("."), xJ();
}
function EJ() {
  Kt("[");
  const e = gE();
  return Kt("]"), e;
}
function AJ() {
  var e, t, n;
  for (e = vJ(); ; )
    if (He("."))
      n = wJ(), e = _C(".", e, n);
    else if (He("("))
      t = bJ(), e = lJ(e, t);
    else if (He("["))
      n = EJ(), e = _C("[", e, n);
    else
      break;
  return e;
}
function CC() {
  const e = AJ();
  if (Pe.type === _n && (He("++") || He("--")))
    throw new Error(yf);
  return e;
}
function Uh() {
  var e, t;
  if (Pe.type !== _n && Pe.type !== Oa)
    t = CC();
  else {
    if (He("++") || He("--"))
      throw new Error(yf);
    if (He("+") || He("-") || He("~") || He("!"))
      e = Fn(), t = Uh(), t = dJ(e.value, t);
    else {
      if (W1("delete") || W1("void") || W1("typeof"))
        throw new Error(yf);
      t = CC();
    }
  }
  return t;
}
function FC(e) {
  let t = 0;
  if (e.type !== _n && e.type !== Oa)
    return 0;
  switch (e.value) {
    case "||":
      t = 1;
      break;
    case "&&":
      t = 2;
      break;
    case "|":
      t = 3;
      break;
    case "^":
      t = 4;
      break;
    case "&":
      t = 5;
      break;
    case "==":
    case "!=":
    case "===":
    case "!==":
      t = 6;
      break;
    case "<":
    case ">":
    case "<=":
    case ">=":
    case "instanceof":
    case "in":
      t = 7;
      break;
    case "<<":
    case ">>":
    case ">>>":
      t = 8;
      break;
    case "+":
    case "-":
      t = 9;
      break;
    case "*":
    case "/":
    case "%":
      t = 11;
      break;
  }
  return t;
}
function _J() {
  var e, t, n, i, r, o, a, s, u, l;
  if (e = Pe, u = Uh(), i = Pe, r = FC(i), r === 0)
    return u;
  for (i.prec = r, Fn(), t = [e, Pe], a = Uh(), o = [u, i, a]; (r = FC(Pe)) > 0; ) {
    for (; o.length > 2 && r <= o[o.length - 2].prec; )
      a = o.pop(), s = o.pop().value, u = o.pop(), t.pop(), n = AC(s, u, a), o.push(n);
    i = Fn(), i.prec = r, o.push(i), t.push(Pe), n = Uh(), o.push(n);
  }
  for (l = o.length - 1, n = o[l], t.pop(); l > 1; )
    t.pop(), n = AC(o[l - 1].value, o[l - 2], n), l -= 2;
  return n;
}
function Ds() {
  var e, t, n;
  return e = _J(), He("?") && (Fn(), t = Ds(), Kt(":"), n = Ds(), e = cJ(e, t, n)), e;
}
function gE() {
  const e = Ds();
  if (He(","))
    throw new Error(yf);
  return e;
}
function n6(e) {
  X = e, R = 0, Vt = X.length, Pe = null, t6();
  const t = gE();
  if (Pe.type !== ld)
    throw new Error("Unexpect token after expression.");
  return t;
}
var i6 = {
  NaN: "NaN",
  E: "Math.E",
  LN2: "Math.LN2",
  LN10: "Math.LN10",
  LOG2E: "Math.LOG2E",
  LOG10E: "Math.LOG10E",
  PI: "Math.PI",
  SQRT1_2: "Math.SQRT1_2",
  SQRT2: "Math.SQRT2",
  MIN_VALUE: "Number.MIN_VALUE",
  MAX_VALUE: "Number.MAX_VALUE"
};
function r6(e) {
  function t(a, s, u, l) {
    let c = e(s[0]);
    return u && (c = u + "(" + c + ")", u.lastIndexOf("new ", 0) === 0 && (c = "(" + c + ")")), c + "." + a + (l < 0 ? "" : l === 0 ? "()" : "(" + s.slice(1).map(e).join(",") + ")");
  }
  function n(a, s, u) {
    return (l) => t(a, l, s, u);
  }
  const i = "new Date", r = "String", o = "RegExp";
  return {
    isNaN: "Number.isNaN",
    isFinite: "Number.isFinite",
    abs: "Math.abs",
    acos: "Math.acos",
    asin: "Math.asin",
    atan: "Math.atan",
    atan2: "Math.atan2",
    ceil: "Math.ceil",
    cos: "Math.cos",
    exp: "Math.exp",
    floor: "Math.floor",
    log: "Math.log",
    max: "Math.max",
    min: "Math.min",
    pow: "Math.pow",
    random: "Math.random",
    round: "Math.round",
    sin: "Math.sin",
    sqrt: "Math.sqrt",
    tan: "Math.tan",
    clamp: function(a) {
      a.length < 3 && P("Missing arguments to clamp function."), a.length > 3 && P("Too many arguments to clamp function.");
      const s = a.map(e);
      return "Math.max(" + s[1] + ", Math.min(" + s[2] + "," + s[0] + "))";
    },
    now: "Date.now",
    utc: "Date.UTC",
    datetime: i,
    date: n("getDate", i, 0),
    day: n("getDay", i, 0),
    year: n("getFullYear", i, 0),
    month: n("getMonth", i, 0),
    hours: n("getHours", i, 0),
    minutes: n("getMinutes", i, 0),
    seconds: n("getSeconds", i, 0),
    milliseconds: n("getMilliseconds", i, 0),
    time: n("getTime", i, 0),
    timezoneoffset: n("getTimezoneOffset", i, 0),
    utcdate: n("getUTCDate", i, 0),
    utcday: n("getUTCDay", i, 0),
    utcyear: n("getUTCFullYear", i, 0),
    utcmonth: n("getUTCMonth", i, 0),
    utchours: n("getUTCHours", i, 0),
    utcminutes: n("getUTCMinutes", i, 0),
    utcseconds: n("getUTCSeconds", i, 0),
    utcmilliseconds: n("getUTCMilliseconds", i, 0),
    length: n("length", null, -1),
    parseFloat: "parseFloat",
    parseInt: "parseInt",
    upper: n("toUpperCase", r, 0),
    lower: n("toLowerCase", r, 0),
    substring: n("substring", r),
    split: n("split", r),
    trim: n("trim", r, 0),
    regexp: o,
    test: n("test", o),
    if: function(a) {
      a.length < 3 && P("Missing arguments to if function."), a.length > 3 && P("Too many arguments to if function.");
      const s = a.map(e);
      return "(" + s[0] + "?" + s[1] + ":" + s[2] + ")";
    }
  };
}
function OJ(e) {
  const t = e && e.length - 1;
  return t && (e[0] === '"' && e[t] === '"' || e[0] === "'" && e[t] === "'") ? e.slice(1, -1) : e;
}
function o6(e) {
  e = e || {};
  const t = e.allowed ? zi(e.allowed) : {}, n = e.forbidden ? zi(e.forbidden) : {}, i = e.constants || i6, r = (e.functions || r6)(f), o = e.globalvar, a = e.fieldvar, s = he(o) ? o : (g) => `${o}["${g}"]`;
  let u = {}, l = {}, c = 0;
  function f(g) {
    if (je(g))
      return g;
    const p = d[g.type];
    return p == null && P("Unsupported type: " + g.type), p(g);
  }
  const d = {
    Literal: (g) => g.raw,
    Identifier: (g) => {
      const p = g.name;
      return c > 0 ? p : ae(n, p) ? P("Illegal identifier: " + p) : ae(i, p) ? i[p] : ae(t, p) ? p : (u[p] = 1, s(p));
    },
    MemberExpression: (g) => {
      const p = !g.computed, m = f(g.object);
      p && (c += 1);
      const y = f(g.property);
      return m === a && (l[OJ(y)] = 1), p && (c -= 1), m + (p ? "." + y : "[" + y + "]");
    },
    CallExpression: (g) => {
      g.callee.type !== "Identifier" && P("Illegal callee type: " + g.callee.type);
      const p = g.callee.name, m = g.arguments, y = ae(r, p) && r[p];
      return y || P("Unrecognized function: " + p), he(y) ? y(m) : y + "(" + m.map(f).join(",") + ")";
    },
    ArrayExpression: (g) => "[" + g.elements.map(f).join(",") + "]",
    BinaryExpression: (g) => "(" + f(g.left) + " " + g.operator + " " + f(g.right) + ")",
    UnaryExpression: (g) => "(" + g.operator + f(g.argument) + ")",
    ConditionalExpression: (g) => "(" + f(g.test) + "?" + f(g.consequent) + ":" + f(g.alternate) + ")",
    LogicalExpression: (g) => "(" + f(g.left) + g.operator + f(g.right) + ")",
    ObjectExpression: (g) => "{" + g.properties.map(f).join(",") + "}",
    Property: (g) => {
      c += 1;
      const p = f(g.key);
      return c -= 1, p + ":" + f(g.value);
    }
  };
  function h(g) {
    const p = {
      code: f(g),
      globals: Object.keys(u),
      fields: Object.keys(l)
    };
    return u = {}, l = {}, p;
  }
  return h.functions = r, h.constants = i, h;
}
function kC(e, t) {
  return e == null || t == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function SJ(e) {
  let t = e, n = e, i = e;
  e.length !== 2 && (t = (s, u) => e(s) - u, n = kC, i = (s, u) => kC(e(s), u));
  function r(s, u, l = 0, c = s.length) {
    if (l < c) {
      if (n(u, u) !== 0)
        return c;
      do {
        const f = l + c >>> 1;
        i(s[f], u) < 0 ? l = f + 1 : c = f;
      } while (l < c);
    }
    return l;
  }
  function o(s, u, l = 0, c = s.length) {
    if (l < c) {
      if (n(u, u) !== 0)
        return c;
      do {
        const f = l + c >>> 1;
        i(s[f], u) <= 0 ? l = f + 1 : c = f;
      } while (l < c);
    }
    return l;
  }
  function a(s, u, l = 0, c = s.length) {
    const f = r(s, u, l, c - 1);
    return f > l && t(s[f - 1], u) > -t(s[f], u) ? f - 1 : f;
  }
  return { left: r, center: a, right: o };
}
function CJ(e, ...t) {
  e = new ig(e), t = t.map(FJ);
  e:
    for (const n of e)
      for (const i of t)
        if (!i.has(n)) {
          e.delete(n);
          continue e;
        }
  return e;
}
function FJ(e) {
  return e instanceof ig ? e : new ig(e);
}
function kJ(...e) {
  const t = new ig();
  for (const n of e)
    for (const i of n)
      t.add(i);
  return t;
}
const pE = "intersect", DC = "union", DJ = "vlMulti", $J = "vlPoint", $C = "or", MJ = "and", rr = "_vgsid_", bf = Mn(rr), TJ = "E", NJ = "R", RJ = "R-E", jJ = "R-LE", PJ = "R-RE", f0 = "index:unit";
function MC(e, t) {
  for (var n = t.fields, i = t.values, r = n.length, o = 0, a, s; o < r; ++o)
    if (s = n[o], s.getter = Mn.getter || Mn(s.field), a = s.getter(e), Vo(a) && (a = Wt(a)), Vo(i[o]) && (i[o] = Wt(i[o])), Vo(i[o][0]) && (i[o] = i[o].map(Wt)), s.type === TJ) {
      if (J(i[o]) ? i[o].indexOf(a) < 0 : a !== i[o])
        return !1;
    } else if (s.type === NJ) {
      if (!Au(a, i[o]))
        return !1;
    } else if (s.type === PJ) {
      if (!Au(a, i[o], !0, !1))
        return !1;
    } else if (s.type === RJ) {
      if (!Au(a, i[o], !1, !1))
        return !1;
    } else if (s.type === jJ && !Au(a, i[o], !1, !0))
      return !1;
  return !0;
}
function LJ(e, t, n) {
  for (var i = this.context.data[e], r = i ? i.values.value : [], o = i ? i[f0] && i[f0].value : void 0, a = n === pE, s = r.length, u = 0, l, c, f, d, h; u < s; ++u)
    if (l = r[u], o && a) {
      if (c = c || {}, f = c[d = l.unit] || 0, f === -1)
        continue;
      if (h = MC(t, l), c[d] = h ? -1 : ++f, h && o.size === 1)
        return !0;
      if (!h && f === o.get(d).count)
        return !1;
    } else if (h = MC(t, l), a ^ h)
      return h;
  return s && a;
}
const a6 = SJ(bf), IJ = a6.left, BJ = a6.right;
function zJ(e, t, n) {
  const i = this.context.data[e], r = i ? i.values.value : [], o = i ? i[f0] && i[f0].value : void 0, a = n === pE, s = bf(t), u = IJ(r, s);
  if (u === r.length || bf(r[u]) !== s)
    return !1;
  if (o && a) {
    if (o.size === 1)
      return !0;
    if (BJ(r, s) - u < o.size)
      return !1;
  }
  return !0;
}
function UJ(e, t) {
  return e.map((n) => de(t.fields ? {
    values: t.fields.map((i) => (i.getter || (i.getter = Mn(i.field)))(n.datum))
  } : {
    [rr]: bf(n.datum)
  }, t));
}
function qJ(e, t, n, i) {
  for (var r = this.context.data[e], o = r ? r.values.value : [], a = {}, s = {}, u = {}, l, c, f, d, h, g, p, m, y, v, b = o.length, x = 0, E, A; x < b; ++x)
    if (l = o[x], d = l.unit, c = l.fields, f = l.values, c && f) {
      for (E = 0, A = c.length; E < A; ++E)
        h = c[E], p = a[h.field] || (a[h.field] = {}), m = p[d] || (p[d] = []), u[h.field] = y = h.type.charAt(0), v = G1["".concat(y, "_union")], p[d] = v(m, oe(f[E]));
      n && (m = s[d] || (s[d] = []), m.push(oe(f).reduce((w, _, k) => (w[c[k].field] = _, w), {})));
    } else
      h = rr, g = bf(l), p = a[h] || (a[h] = {}), m = p[d] || (p[d] = []), m.push(g), n && (m = s[d] || (s[d] = []), m.push({
        [rr]: g
      }));
  if (t = t || DC, a[rr] ? a[rr] = G1["".concat(rr, "_").concat(t)](...Object.values(a[rr])) : Object.keys(a).forEach((w) => {
    a[w] = Object.keys(a[w]).map((_) => a[w][_]).reduce((_, k) => _ === void 0 ? k : G1["".concat(u[w], "_").concat(t)](_, k));
  }), o = Object.keys(s), n && o.length) {
    const w = i ? $J : DJ;
    a[w] = t === DC ? {
      [$C]: o.reduce((_, k) => (_.push(...s[k]), _), [])
    } : {
      [MJ]: o.map((_) => ({
        [$C]: s[_]
      }))
    };
  }
  return a;
}
var G1 = {
  ["".concat(rr, "_union")]: kJ,
  ["".concat(rr, "_intersect")]: CJ,
  E_union: function(e, t) {
    if (!e.length)
      return t;
    for (var n = 0, i = t.length; n < i; ++n)
      e.indexOf(t[n]) < 0 && e.push(t[n]);
    return e;
  },
  E_intersect: function(e, t) {
    return e.length ? e.filter((n) => t.indexOf(n) >= 0) : t;
  },
  R_union: function(e, t) {
    var n = Wt(t[0]), i = Wt(t[1]);
    return n > i && (n = t[1], i = t[0]), e.length ? (e[0] > n && (e[0] = n), e[1] < i && (e[1] = i), e) : [n, i];
  },
  R_intersect: function(e, t) {
    var n = Wt(t[0]), i = Wt(t[1]);
    return n > i && (n = t[1], i = t[0]), e.length ? i < e[0] || e[1] < n ? [] : (e[0] < n && (e[0] = n), e[1] > i && (e[1] = i), e) : [n, i];
  }
};
const WJ = ":", GJ = "@";
function mE(e, t, n, i) {
  t[0].type !== Fs && P("First argument to selection functions must be a string literal.");
  const r = t[0].value, o = t.length >= 2 && xe(t).value, a = "unit", s = GJ + a, u = WJ + r;
  o === pE && !ae(i, s) && (i[s] = n.getData(r).indataRef(n, a)), ae(i, u) || (i[u] = n.getData(r).tuplesRef());
}
function s6(e) {
  const t = this.context.data[e];
  return t ? t.values.value : [];
}
function HJ(e, t, n) {
  const i = this.context.data[e]["index:" + t], r = i ? i.value.get(n) : void 0;
  return r && r.count;
}
function YJ(e, t) {
  const n = this.context.dataflow, i = this.context.data[e], r = i.input;
  return n.pulse(r, n.changeset().remove(ci).insert(t)), 1;
}
function XJ(e, t, n) {
  if (e) {
    const i = this.context.dataflow, r = e.mark.source;
    i.pulse(r, i.changeset().encode(e, t));
  }
  return n !== void 0 ? n : e;
}
const dd = (e) => function(t, n) {
  return this.context.dataflow.locale()[e](n)(t);
}, VJ = dd("format"), u6 = dd("timeFormat"), KJ = dd("utcFormat"), JJ = dd("timeParse"), QJ = dd("utcParse"), ah = new Date(2e3, 0, 1);
function Ip(e, t, n) {
  return !Number.isInteger(e) || !Number.isInteger(t) ? "" : (ah.setYear(2e3), ah.setMonth(e), ah.setDate(t), u6.call(this, ah, n));
}
function ZJ(e) {
  return Ip.call(this, e, 1, "%B");
}
function eQ(e) {
  return Ip.call(this, e, 1, "%b");
}
function tQ(e) {
  return Ip.call(this, 0, 2 + e, "%A");
}
function nQ(e) {
  return Ip.call(this, 0, 2 + e, "%a");
}
const iQ = ":", rQ = "@", eb = "%", l6 = "$";
function yE(e, t, n, i) {
  t[0].type !== Fs && P("First argument to data functions must be a string literal.");
  const r = t[0].value, o = iQ + r;
  if (!ae(o, i))
    try {
      i[o] = n.getData(r).tuplesRef();
    } catch {
    }
}
function oQ(e, t, n, i) {
  t[0].type !== Fs && P("First argument to indata must be a string literal."), t[1].type !== Fs && P("Second argument to indata must be a string literal.");
  const r = t[0].value, o = t[1].value, a = rQ + o;
  ae(a, i) || (i[a] = n.getData(r).indataRef(n, o));
}
function $n(e, t, n, i) {
  if (t[0].type === Fs)
    TC(n, i, t[0].value);
  else
    for (e in n.scales)
      TC(n, i, e);
}
function TC(e, t, n) {
  const i = eb + n;
  if (!ae(t, i))
    try {
      t[i] = e.scaleRef(n);
    } catch {
    }
}
function bo(e, t) {
  let n;
  return he(e) ? e : je(e) ? (n = t.scales[e]) && n.value : void 0;
}
function aQ(e, t, n) {
  t.__bandwidth = (r) => r && r.bandwidth ? r.bandwidth() : 0, n._bandwidth = $n, n._range = $n, n._scale = $n;
  const i = (r) => "_[" + (r.type === Fs ? te(eb + r.value) : te(eb) + "+" + e(r)) + "]";
  return {
    _bandwidth: (r) => "this.__bandwidth(".concat(i(r[0]), ")"),
    _range: (r) => "".concat(i(r[0]), ".range()"),
    _scale: (r) => "".concat(i(r[0]), "(").concat(e(r[1]), ")")
  };
}
function vE(e, t) {
  return function(n, i, r) {
    if (n) {
      const o = bo(n, (r || this).context);
      return o && o.path[e](i);
    } else
      return t(i);
  };
}
const sQ = vE("area", FG), uQ = vE("bounds", MG), lQ = vE("centroid", LG);
function cQ(e) {
  const t = this.context.group;
  let n = !1;
  if (t)
    for (; e; ) {
      if (e === t) {
        n = !0;
        break;
      }
      e = e.mark.group;
    }
  return n;
}
function bE(e, t, n) {
  try {
    e[t].apply(e, ["EXPRESSION"].concat([].slice.call(n)));
  } catch (i) {
    e.warn(i);
  }
  return n[n.length - 1];
}
function fQ() {
  return bE(this.context.dataflow, "warn", arguments);
}
function dQ() {
  return bE(this.context.dataflow, "info", arguments);
}
function hQ() {
  return bE(this.context.dataflow, "debug", arguments);
}
function H1(e) {
  const t = e / 255;
  return t <= 0.03928 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4);
}
function tb(e) {
  const t = ua(e), n = H1(t.r), i = H1(t.g), r = H1(t.b);
  return 0.2126 * n + 0.7152 * i + 0.0722 * r;
}
function gQ(e, t) {
  const n = tb(e), i = tb(t), r = Math.max(n, i), o = Math.min(n, i);
  return (r + 0.05) / (o + 0.05);
}
function pQ() {
  const e = [].slice.call(arguments);
  return e.unshift({}), de(...e);
}
function c6(e, t) {
  return e === t || e !== e && t !== t ? !0 : J(e) ? J(t) && e.length === t.length ? mQ(e, t) : !1 : ce(e) && ce(t) ? f6(e, t) : !1;
}
function mQ(e, t) {
  for (let n = 0, i = e.length; n < i; ++n)
    if (!c6(e[n], t[n]))
      return !1;
  return !0;
}
function f6(e, t) {
  for (const n in e)
    if (!c6(e[n], t[n]))
      return !1;
  return !0;
}
function NC(e) {
  return (t) => f6(e, t);
}
function yQ(e, t, n, i, r, o) {
  const a = this.context.dataflow, s = this.context.data[e], u = s.input, l = a.stamp();
  let c = s.changes, f, d;
  if (a._trigger === !1 || !(u.value.length || t || i))
    return 0;
  if ((!c || c.stamp < l) && (s.changes = c = a.changeset(), c.stamp = l, a.runAfter(() => {
    s.modified = !0, a.pulse(u, c).run();
  }, !0, 1)), n && (f = n === !0 ? ci : J(n) || K0(n) ? n : NC(n), c.remove(f)), t && c.insert(t), i && (f = NC(i), u.value.some(f) ? c.remove(f) : c.insert(i)), r)
    for (d in o)
      c.modify(r, d, o[d]);
  return 1;
}
function vQ(e) {
  const t = e.touches, n = t[0].clientX - t[1].clientX, i = t[0].clientY - t[1].clientY;
  return Math.sqrt(n * n + i * i);
}
function bQ(e) {
  const t = e.touches;
  return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX);
}
const RC = {};
function xQ(e, t) {
  const n = RC[t] || (RC[t] = Mn(t));
  return J(e) ? e.map(n) : n(e);
}
function xE(e) {
  return J(e) || ArrayBuffer.isView(e) ? e : null;
}
function wE(e) {
  return xE(e) || (je(e) ? e : null);
}
function wQ(e) {
  for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
    n[i - 1] = arguments[i];
  return xE(e).join(...n);
}
function EQ(e) {
  for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
    n[i - 1] = arguments[i];
  return wE(e).indexOf(...n);
}
function AQ(e) {
  for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
    n[i - 1] = arguments[i];
  return wE(e).lastIndexOf(...n);
}
function _Q(e) {
  for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
    n[i - 1] = arguments[i];
  return wE(e).slice(...n);
}
function OQ(e, t, n) {
  return he(n) && P("Function argument passed to replace."), String(e).replace(t, n);
}
function SQ(e) {
  return xE(e).slice().reverse();
}
function CQ(e, t, n) {
  return $2(e || 0, t || 0, n || 0);
}
function FQ(e, t) {
  const n = bo(e, (t || this).context);
  return n && n.bandwidth ? n.bandwidth() : 0;
}
function kQ(e, t) {
  const n = bo(e, (t || this).context);
  return n ? n.copy() : void 0;
}
function DQ(e, t) {
  const n = bo(e, (t || this).context);
  return n ? n.domain() : [];
}
function $Q(e, t, n) {
  const i = bo(e, (n || this).context);
  return i ? J(t) ? (i.invertRange || i.invert)(t) : (i.invert || i.invertExtent)(t) : void 0;
}
function MQ(e, t) {
  const n = bo(e, (t || this).context);
  return n && n.range ? n.range() : [];
}
function TQ(e, t, n) {
  const i = bo(e, (n || this).context);
  return i ? i(t) : void 0;
}
function NQ(e, t, n, i, r) {
  e = bo(e, (r || this).context);
  const o = c5(t, n);
  let a = e.domain(), s = a[0], u = xe(a), l = mn;
  return u - s ? l = QM(e, s, u) : e = (e.interpolator ? De("sequential")().interpolator(e.interpolator()) : De("linear")().interpolate(e.interpolate()).range(e.range())).domain([s = 0, u = 1]), e.ticks && (a = e.ticks(+i || 15), s !== a[0] && a.unshift(s), u !== xe(a) && a.push(u)), a.forEach((c) => o.stop(l(c), e(c))), o;
}
function RQ(e, t, n) {
  const i = bo(e, (n || this).context);
  return function(r) {
    return i ? i.path.context(r)(t) : "";
  };
}
function jQ(e) {
  let t = null;
  return function(n) {
    return n ? lf(n, t = t || Ku(e)) : e;
  };
}
const d6 = (e) => e.data;
function h6(e, t) {
  const n = s6.call(t, e);
  return n.root && n.root.lookup || {};
}
function PQ(e, t, n) {
  const i = h6(e, this), r = i[t], o = i[n];
  return r && o ? r.path(o).map(d6) : void 0;
}
function LQ(e, t) {
  const n = h6(e, this)[t];
  return n ? n.ancestors().map(d6) : void 0;
}
const g6 = () => typeof window < "u" && window || null;
function IQ() {
  const e = g6();
  return e ? e.screen : {};
}
function BQ() {
  const e = g6();
  return e ? [e.innerWidth, e.innerHeight] : [void 0, void 0];
}
function zQ() {
  const e = this.context.dataflow, t = e.container && e.container();
  return t ? [t.clientWidth, t.clientHeight] : [void 0, void 0];
}
function p6(e, t, n) {
  if (!e)
    return [];
  const [i, r] = e, o = new dt().set(i[0], i[1], r[0], r[1]), a = n || this.context.dataflow.scenegraph().root;
  return eT(a, o, UQ(t));
}
function UQ(e) {
  let t = null;
  if (e) {
    const n = oe(e.marktype), i = oe(e.markname);
    t = (r) => (!n.length || n.some((o) => r.marktype === o)) && (!i.length || i.some((o) => r.name === o));
  }
  return t;
}
function qQ(e, t, n) {
  let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 5;
  const r = e[e.length - 1];
  return r === void 0 || Math.sqrt((r[0] - t) ** 2 + (r[1] - n) ** 2) > i ? (e.push([t, n]), [...e]) : e;
}
function WQ(e) {
  return (e != null ? e : []).reduce((t, n, i) => {
    let [r, o] = n;
    return t += i == 0 ? "M ".concat(r, ",").concat(o, " ") : i === e.length - 1 ? " Z" : "L ".concat(r, ",").concat(o, " ");
  }, "");
}
function GQ(e, t, n) {
  const {
    x: i,
    y: r,
    mark: o
  } = n, a = new dt().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER);
  for (const [u, l] of t)
    u < a.x1 && (a.x1 = u), u > a.x2 && (a.x2 = u), l < a.y1 && (a.y1 = l), l > a.y2 && (a.y2 = l);
  return a.translate(i, r), p6([[a.x1, a.y1], [a.x2, a.y2]], e, o).filter((u) => HQ(u.x, u.y, t));
}
function HQ(e, t, n) {
  let i = 0;
  for (let r = 0, o = n.length - 1; r < n.length; o = r++) {
    const [a, s] = n[o], [u, l] = n[r];
    l > t != s > t && e < (a - u) * (t - l) / (s - l) + u && i++;
  }
  return i & 1;
}
const xf = {
  random() {
    return di();
  },
  cumulativeNormal: tp,
  cumulativeLogNormal: Tx,
  cumulativeUniform: Px,
  densityNormal: Fx,
  densityLogNormal: Mx,
  densityUniform: jx,
  quantileNormal: np,
  quantileLogNormal: Nx,
  quantileUniform: Lx,
  sampleNormal: ep,
  sampleLogNormal: $x,
  sampleUniform: Rx,
  isArray: J,
  isBoolean: Qb,
  isDate: Vo,
  isDefined(e) {
    return e !== void 0;
  },
  isNumber: na,
  isObject: ce,
  isRegExp: OD,
  isString: je,
  isTuple: K0,
  isValid(e) {
    return e != null && e === e;
  },
  toBoolean: ex,
  toDate(e) {
    return tx(e);
  },
  toNumber: Wt,
  toString: nx,
  indexof: EQ,
  join: wQ,
  lastindexof: AQ,
  replace: OQ,
  reverse: SQ,
  slice: _Q,
  flush: AD,
  lerp: SD,
  merge: pQ,
  pad: kD,
  peek: xe,
  pluck: xQ,
  span: Lf,
  inrange: Au,
  truncate: DD,
  rgb: ua,
  lab: bg,
  hcl: xg,
  hsl: yg,
  luminance: tb,
  contrast: gQ,
  sequence: Hn,
  format: VJ,
  utcFormat: KJ,
  utcParse: QJ,
  utcOffset: v3,
  utcSequence: w3,
  timeFormat: u6,
  timeParse: JJ,
  timeOffset: y3,
  timeSequence: x3,
  timeUnitSpecifier: a3,
  monthFormat: ZJ,
  monthAbbrevFormat: eQ,
  dayFormat: tQ,
  dayAbbrevFormat: nQ,
  quarter: bD,
  utcquarter: xD,
  week: u3,
  utcweek: f3,
  dayofyear: s3,
  utcdayofyear: c3,
  warn: fQ,
  info: dQ,
  debug: hQ,
  extent(e) {
    return vr(e);
  },
  inScope: cQ,
  intersect: p6,
  clampRange: wD,
  pinchDistance: vQ,
  pinchAngle: bQ,
  screen: IQ,
  containerSize: zQ,
  windowSize: BQ,
  bandspace: CQ,
  setdata: YJ,
  pathShape: jQ,
  panLinear: pD,
  panLog: mD,
  panPow: yD,
  panSymlog: vD,
  zoomLinear: Yb,
  zoomLog: Xb,
  zoomPow: tg,
  zoomSymlog: Vb,
  encode: XJ,
  modify: yQ,
  lassoAppend: qQ,
  lassoPath: WQ,
  intersectLasso: GQ
}, YQ = ["view", "item", "group", "xy", "x", "y"], XQ = "event.vega.", m6 = "this.", EE = {}, y6 = {
  forbidden: ["_"],
  allowed: ["datum", "event", "item"],
  fieldvar: "datum",
  globalvar: (e) => "_[".concat(te(l6 + e), "]"),
  functions: VQ,
  constants: i6,
  visitors: EE
}, nb = o6(y6);
function VQ(e) {
  const t = r6(e);
  YQ.forEach((n) => t[n] = XQ + n);
  for (const n in xf)
    t[n] = m6 + n;
  return de(t, aQ(e, xf, EE)), t;
}
function gt(e, t, n) {
  return arguments.length === 1 ? xf[e] : (xf[e] = t, n && (EE[e] = n), nb && (nb.functions[e] = m6 + e), this);
}
gt("bandwidth", FQ, $n);
gt("copy", kQ, $n);
gt("domain", DQ, $n);
gt("range", MQ, $n);
gt("invert", $Q, $n);
gt("scale", TQ, $n);
gt("gradient", NQ, $n);
gt("geoArea", sQ, $n);
gt("geoBounds", uQ, $n);
gt("geoCentroid", lQ, $n);
gt("geoShape", RQ, $n);
gt("indata", HJ, oQ);
gt("data", s6, yE);
gt("treePath", PQ, yE);
gt("treeAncestors", LQ, yE);
gt("vlSelectionTest", LJ, mE);
gt("vlSelectionIdTest", zJ, mE);
gt("vlSelectionResolve", qJ, mE);
gt("vlSelectionTuples", UJ);
function wr(e, t) {
  const n = {};
  let i;
  try {
    e = je(e) ? e : te(e) + "", i = n6(e);
  } catch {
    P("Expression parse error: " + e);
  }
  i.visit((o) => {
    if (o.type !== VN)
      return;
    const a = o.callee.name, s = y6.visitors[a];
    s && s(a, o.arguments, t, n);
  });
  const r = nb(i);
  return r.globals.forEach((o) => {
    const a = l6 + o;
    !ae(n, a) && t.getSignal(o) && (n[a] = t.signalRef(o));
  }), {
    $expr: de({
      code: r.code
    }, t.options.ast ? {
      ast: i
    } : null),
    $fields: r.fields,
    $params: n
  };
}
function KQ(e) {
  const t = this, n = e.operators || [];
  return e.background && (t.background = e.background), e.eventConfig && (t.eventConfig = e.eventConfig), e.locale && (t.locale = e.locale), n.forEach((i) => t.parseOperator(i)), n.forEach((i) => t.parseOperatorParameters(i)), (e.streams || []).forEach((i) => t.parseStream(i)), (e.updates || []).forEach((i) => t.parseUpdate(i)), t.resolve();
}
const JQ = zi(["rule"]), jC = zi(["group", "image", "rect"]);
function QQ(e, t) {
  let n = "";
  return JQ[t] || (e.x2 && (e.x ? (jC[t] && (n += "if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"), n += "o.width=o.x2-o.x;") : n += "o.x=o.x2-(o.width||0);"), e.xc && (n += "o.x=o.xc-(o.width||0)/2;"), e.y2 && (e.y ? (jC[t] && (n += "if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"), n += "o.height=o.y2-o.y;") : n += "o.y=o.y2-(o.height||0);"), e.yc && (n += "o.y=o.yc-(o.height||0)/2;")), n;
}
function AE(e) {
  return (e + "").toLowerCase();
}
function ZQ(e) {
  return AE(e) === "operator";
}
function eZ(e) {
  return AE(e) === "collect";
}
function rc(e, t, n) {
  n[n.length - 1] !== ";" && (n = "return(" + n + ");");
  const i = Function(...t.concat(n));
  return e && e.functions ? i.bind(e.functions) : i;
}
function tZ(e, t, n, i) {
  return "((u = ".concat(e, ") < (v = ").concat(t, ") || u == null) && v != null ? ").concat(n, `
  : (u > v || v == null) && u != null ? `).concat(i, `
  : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? `).concat(n, `
  : v !== v && u === u ? `).concat(i, " : ");
}
var nZ = {
  operator: (e, t) => rc(e, ["_"], t.code),
  parameter: (e, t) => rc(e, ["datum", "_"], t.code),
  event: (e, t) => rc(e, ["event"], t.code),
  handler: (e, t) => {
    const n = "var datum=event.item&&event.item.datum;return ".concat(t.code, ";");
    return rc(e, ["_", "event"], n);
  },
  encode: (e, t) => {
    const {
      marktype: n,
      channels: i
    } = t;
    let r = "var o=item,datum=o.datum,m=0,$;";
    for (const o in i) {
      const a = "o[" + te(o) + "]";
      r += "$=".concat(i[o].code, ";if(").concat(a, "!==$)").concat(a, "=$,m=1;");
    }
    return r += QQ(i, n), r += "return m;", rc(e, ["item", "_"], r);
  },
  codegen: {
    get(e) {
      const t = "[".concat(e.map(te).join("]["), "]"), n = Function("_", "return _".concat(t, ";"));
      return n.path = t, n;
    },
    comparator(e, t) {
      let n;
      const i = (o, a) => {
        const s = t[a];
        let u, l;
        return o.path ? (u = "a".concat(o.path), l = "b".concat(o.path)) : ((n = n || {})["f" + a] = o, u = "this.f".concat(a, "(a)"), l = "this.f".concat(a, "(b)")), tZ(u, l, -s, s);
      }, r = Function("a", "b", "var u, v; return " + e.map(i).join("") + "0;");
      return n ? r.bind(n) : r;
    }
  }
};
function iZ(e) {
  const t = this;
  ZQ(e.type) || !e.type ? t.operator(e, e.update ? t.operatorExpression(e.update) : null) : t.transform(e, e.type);
}
function rZ(e) {
  const t = this;
  if (e.params) {
    const n = t.get(e.id);
    n || P("Invalid operator id: " + e.id), t.dataflow.connect(n, n.parameters(t.parseParameters(e.params), e.react, e.initonly));
  }
}
function oZ(e, t) {
  t = t || {};
  const n = this;
  for (const i in e) {
    const r = e[i];
    t[i] = J(r) ? r.map((o) => PC(o, n, t)) : PC(r, n, t);
  }
  return t;
}
function PC(e, t, n) {
  if (!e || !ce(e))
    return e;
  for (let i = 0, r = LC.length, o; i < r; ++i)
    if (o = LC[i], ae(e, o.key))
      return o.parse(e, t, n);
  return e;
}
var LC = [{
  key: "$ref",
  parse: aZ
}, {
  key: "$key",
  parse: uZ
}, {
  key: "$expr",
  parse: sZ
}, {
  key: "$field",
  parse: lZ
}, {
  key: "$encode",
  parse: fZ
}, {
  key: "$compare",
  parse: cZ
}, {
  key: "$context",
  parse: dZ
}, {
  key: "$subflow",
  parse: hZ
}, {
  key: "$tupleid",
  parse: gZ
}];
function aZ(e, t) {
  return t.get(e.$ref) || P("Operator not defined: " + e.$ref);
}
function sZ(e, t, n) {
  e.$params && t.parseParameters(e.$params, n);
  const i = "e:" + e.$expr.code + "_" + e.$name;
  return t.fn[i] || (t.fn[i] = In(t.parameterExpression(e.$expr), e.$fields, e.$name));
}
function uZ(e, t) {
  const n = "k:" + e.$key + "_" + !!e.$flat;
  return t.fn[n] || (t.fn[n] = Zb(e.$key, e.$flat, t.expr.codegen));
}
function lZ(e, t) {
  if (!e.$field)
    return null;
  const n = "f:" + e.$field + "_" + e.$name;
  return t.fn[n] || (t.fn[n] = Mn(e.$field, e.$name, t.expr.codegen));
}
function cZ(e, t) {
  const n = "c:" + e.$compare + "_" + e.$order, i = oe(e.$compare).map((r) => r && r.$tupleid ? Z : r);
  return t.fn[n] || (t.fn[n] = Kb(i, e.$order, t.expr.codegen));
}
function fZ(e, t) {
  const n = e.$encode, i = {};
  for (const r in n) {
    const o = n[r];
    i[r] = In(t.encodeExpression(o.$expr), o.$fields), i[r].output = o.$output;
  }
  return i;
}
function dZ(e, t) {
  return t;
}
function hZ(e, t) {
  const n = e.$subflow;
  return function(i, r, o) {
    const a = t.fork().parse(n), s = a.get(n.operators[0].id), u = a.signals.parent;
    return u && u.set(o), s.detachSubflow = () => t.detach(a), s;
  };
}
function gZ() {
  return Z;
}
function pZ(e) {
  var t = this, n = e.filter != null ? t.eventExpression(e.filter) : void 0, i = e.stream != null ? t.get(e.stream) : void 0, r;
  e.source ? i = t.events(e.source, e.type, n) : e.merge && (r = e.merge.map((o) => t.get(o)), i = r[0].merge.apply(r[0], r.slice(1))), e.between && (r = e.between.map((o) => t.get(o)), i = i.between(r[0], r[1])), e.filter && (i = i.filter(n)), e.throttle != null && (i = i.throttle(+e.throttle)), e.debounce != null && (i = i.debounce(+e.debounce)), i == null && P("Invalid stream definition: " + JSON.stringify(e)), e.consume && i.consume(!0), t.stream(e, i);
}
function mZ(e) {
  var t = this, n = ce(n = e.source) ? n.$ref : n, i = t.get(n), r = null, o = e.update, a = void 0;
  i || P("Source not defined: " + e.source), r = e.target && e.target.$expr ? t.eventExpression(e.target.$expr) : t.get(e.target), o && o.$expr && (o.$params && (a = t.parseParameters(o.$params)), o = t.handlerExpression(o.$expr)), t.update(e, i, r, o, a);
}
const yZ = {
  skip: !0
};
function vZ(e) {
  var t = this, n = {};
  if (e.signals) {
    var i = n.signals = {};
    Object.keys(t.signals).forEach((o) => {
      const a = t.signals[o];
      e.signals(o, a) && (i[o] = a.value);
    });
  }
  if (e.data) {
    var r = n.data = {};
    Object.keys(t.data).forEach((o) => {
      const a = t.data[o];
      e.data(o, a) && (r[o] = a.input.value);
    });
  }
  return t.subcontext && e.recurse !== !1 && (n.subcontext = t.subcontext.map((o) => o.getState(e))), n;
}
function bZ(e) {
  var t = this, n = t.dataflow, i = e.data, r = e.signals;
  Object.keys(r || {}).forEach((o) => {
    n.update(t.signals[o], r[o], yZ);
  }), Object.keys(i || {}).forEach((o) => {
    n.pulse(t.data[o].input, n.changeset().remove(ci).insert(i[o]));
  }), (e.subcontext || []).forEach((o, a) => {
    const s = t.subcontext[a];
    s && s.setState(o);
  });
}
function v6(e, t, n, i) {
  return new b6(e, t, n, i);
}
function b6(e, t, n, i) {
  this.dataflow = e, this.transforms = t, this.events = e.events.bind(e), this.expr = i || nZ, this.signals = {}, this.scales = {}, this.nodes = {}, this.data = {}, this.fn = {}, n && (this.functions = Object.create(n), this.functions.context = this);
}
function IC(e) {
  this.dataflow = e.dataflow, this.transforms = e.transforms, this.events = e.events, this.expr = e.expr, this.signals = Object.create(e.signals), this.scales = Object.create(e.scales), this.nodes = Object.create(e.nodes), this.data = Object.create(e.data), this.fn = Object.create(e.fn), e.functions && (this.functions = Object.create(e.functions), this.functions.context = this);
}
b6.prototype = IC.prototype = {
  fork() {
    const e = new IC(this);
    return (this.subcontext || (this.subcontext = [])).push(e), e;
  },
  detach(e) {
    this.subcontext = this.subcontext.filter((n) => n !== e);
    const t = Object.keys(e.nodes);
    for (const n of t)
      e.nodes[n]._targets = null;
    for (const n of t)
      e.nodes[n].detach();
    e.nodes = null;
  },
  get(e) {
    return this.nodes[e];
  },
  set(e, t) {
    return this.nodes[e] = t;
  },
  add(e, t) {
    const n = this, i = n.dataflow, r = e.value;
    if (n.set(e.id, t), eZ(e.type) && r && (r.$ingest ? i.ingest(t, r.$ingest, r.$format) : r.$request ? i.preload(t, r.$request, r.$format) : i.pulse(t, i.changeset().insert(r))), e.root && (n.root = t), e.parent) {
      let o = n.get(e.parent.$ref);
      o ? (i.connect(o, [t]), t.targets().add(o)) : (n.unresolved = n.unresolved || []).push(() => {
        o = n.get(e.parent.$ref), i.connect(o, [t]), t.targets().add(o);
      });
    }
    if (e.signal && (n.signals[e.signal] = t), e.scale && (n.scales[e.scale] = t), e.data)
      for (const o in e.data) {
        const a = n.data[o] || (n.data[o] = {});
        e.data[o].forEach((s) => a[s] = t);
      }
  },
  resolve() {
    return (this.unresolved || []).forEach((e) => e()), delete this.unresolved, this;
  },
  operator(e, t) {
    this.add(e, this.dataflow.add(e.value, t));
  },
  transform(e, t) {
    this.add(e, this.dataflow.add(this.transforms[AE(t)]));
  },
  stream(e, t) {
    this.set(e.id, t);
  },
  update(e, t, n, i, r) {
    this.dataflow.on(t, n, i, r, e.options);
  },
  operatorExpression(e) {
    return this.expr.operator(this, e);
  },
  parameterExpression(e) {
    return this.expr.parameter(this, e);
  },
  eventExpression(e) {
    return this.expr.event(this, e);
  },
  handlerExpression(e) {
    return this.expr.handler(this, e);
  },
  encodeExpression(e) {
    return this.expr.encode(this, e);
  },
  parse: KQ,
  parseOperator: iZ,
  parseOperatorParameters: rZ,
  parseParameters: oZ,
  parseStream: pZ,
  parseUpdate: mZ,
  getState: vZ,
  setState: bZ
};
function xZ(e) {
  const t = e.container();
  t && (t.setAttribute("role", "graphics-document"), t.setAttribute("aria-roleDescription", "visualization"), x6(t, e.description()));
}
function x6(e, t) {
  e && (t == null ? e.removeAttribute("aria-label") : e.setAttribute("aria-label", t));
}
function wZ(e) {
  e.add(null, (t) => (e._background = t.bg, e._resize = 1, t.bg), {
    bg: e._signals.background
  });
}
const Y1 = "default";
function EZ(e) {
  const t = e._signals.cursor || (e._signals.cursor = e.add({
    user: Y1,
    item: null
  }));
  e.on(e.events("view", "mousemove"), t, (n, i) => {
    const r = t.value, o = r ? je(r) ? r : r.user : Y1, a = i.item && i.item.cursor || null;
    return r && o === r.user && a == r.item ? r : {
      user: o,
      item: a
    };
  }), e.add(null, function(n) {
    let i = n.cursor, r = this.value;
    return je(i) || (r = i.item, i = i.user), ib(e, i && i !== Y1 ? i : r || i), r;
  }, {
    cursor: t
  });
}
function ib(e, t) {
  const n = e.globalCursor() ? typeof document < "u" && document.body : e.container();
  if (n)
    return t == null ? n.style.removeProperty("cursor") : n.style.cursor = t;
}
function d0(e, t) {
  var n = e._runtime.data;
  return ae(n, t) || P("Unrecognized data set: " + t), n[t];
}
function AZ(e, t) {
  return arguments.length < 2 ? d0(this, e).values.value : Bp.call(this, e, Gs().remove(ci).insert(t));
}
function Bp(e, t) {
  X3(t) || P("Second argument to changes must be a changeset.");
  const n = d0(this, e);
  return n.modified = !0, this.pulse(n.input, t);
}
function _Z(e, t) {
  return Bp.call(this, e, Gs().insert(t));
}
function OZ(e, t) {
  return Bp.call(this, e, Gs().remove(t));
}
function w6(e) {
  var t = e.padding();
  return Math.max(0, e._viewWidth + t.left + t.right);
}
function E6(e) {
  var t = e.padding();
  return Math.max(0, e._viewHeight + t.top + t.bottom);
}
function zp(e) {
  var t = e.padding(), n = e._origin;
  return [t.left + n[0], t.top + n[1]];
}
function SZ(e) {
  var t = zp(e), n = w6(e), i = E6(e);
  e._renderer.background(e.background()), e._renderer.resize(n, i, t), e._handler.origin(t), e._resizeListeners.forEach((r) => {
    try {
      r(n, i);
    } catch (o) {
      e.error(o);
    }
  });
}
function CZ(e, t, n) {
  var i = e._renderer, r = i && i.canvas(), o, a, s;
  return r && (s = zp(e), a = t.changedTouches ? t.changedTouches[0] : t, o = Cp(a, r), o[0] -= s[0], o[1] -= s[1]), t.dataflow = e, t.item = n, t.vega = FZ(e, n, o), t;
}
function FZ(e, t, n) {
  const i = t ? t.mark.marktype === "group" ? t : t.mark.group : null;
  function r(a) {
    var s = i, u;
    if (a) {
      for (u = t; u; u = u.mark.group)
        if (u.mark.name === a) {
          s = u;
          break;
        }
    }
    return s && s.mark && s.mark.interactive ? s : {};
  }
  function o(a) {
    if (!a)
      return n;
    je(a) && (a = r(a));
    const s = n.slice();
    for (; a; )
      s[0] -= a.x || 0, s[1] -= a.y || 0, a = a.mark && a.mark.group;
    return s;
  }
  return {
    view: Zt(e),
    item: Zt(t || {}),
    group: r,
    xy: o,
    x: (a) => o(a)[0],
    y: (a) => o(a)[1]
  };
}
const BC = "view", kZ = "timer", DZ = "window", $Z = {
  trap: !1
};
function MZ(e) {
  const t = de({
    defaults: {}
  }, e), n = (i, r) => {
    r.forEach((o) => {
      J(i[o]) && (i[o] = zi(i[o]));
    });
  };
  return n(t.defaults, ["prevent", "allow"]), n(t, ["view", "window", "selector"]), t;
}
function A6(e, t, n, i) {
  e._eventListeners.push({
    type: n,
    sources: oe(t),
    handler: i
  });
}
function TZ(e, t) {
  var n = e._eventConfig.defaults, i = n.prevent, r = n.allow;
  return i === !1 || r === !0 ? !1 : i === !0 || r === !1 ? !0 : i ? i[t] : r ? !r[t] : e.preventDefault();
}
function sh(e, t, n) {
  const i = e._eventConfig && e._eventConfig[t];
  return i === !1 || ce(i) && !i[n] ? (e.warn("Blocked ".concat(t, " ").concat(n, " event listener.")), !1) : !0;
}
function NZ(e, t, n) {
  var i = this, r = new Z0(n), o = function(l, c) {
    i.runAsync(null, () => {
      e === BC && TZ(i, t) && l.preventDefault(), r.receive(CZ(i, l, c));
    });
  }, a;
  if (e === kZ)
    sh(i, "timer", t) && i.timer(o, t);
  else if (e === BC)
    sh(i, "view", t) && i.addEventListener(t, o, $Z);
  else if (e === DZ ? sh(i, "window", t) && typeof window < "u" && (a = [window]) : typeof document < "u" && sh(i, "selector", t) && (a = document.querySelectorAll(e)), !a)
    i.warn("Can not resolve event source: " + e);
  else {
    for (var s = 0, u = a.length; s < u; ++s)
      a[s].addEventListener(t, o);
    A6(i, a, t, o);
  }
  return r;
}
function zC(e) {
  return e.item;
}
function UC(e) {
  return e.item.mark.source;
}
function qC(e) {
  return function(t, n) {
    return n.vega.view().changeset().encode(n.item, e);
  };
}
function RZ(e, t) {
  return e = [e || "hover"], t = [t || "update", e[0]], this.on(this.events("view", "mouseover", zC), UC, qC(e)), this.on(this.events("view", "mouseout", zC), UC, qC(t)), this;
}
function jZ() {
  var e = this._tooltip, t = this._timers, n = this._eventListeners, i, r, o;
  for (i = t.length; --i >= 0; )
    t[i].stop();
  for (i = n.length; --i >= 0; )
    for (o = n[i], r = o.sources.length; --r >= 0; )
      o.sources[r].removeEventListener(o.type, o.handler);
  return e && e.call(this, this._handler, null, null, null), this;
}
function Yn(e, t, n) {
  const i = document.createElement(e);
  for (const r in t)
    i.setAttribute(r, t[r]);
  return n != null && (i.textContent = n), i;
}
const PZ = "vega-bind", LZ = "vega-bind-name", IZ = "vega-bind-radio";
function BZ(e, t, n) {
  if (!t)
    return;
  const i = n.param;
  let r = n.state;
  return r || (r = n.state = {
    elements: null,
    active: !1,
    set: null,
    update: (a) => {
      a != e.signal(i.signal) && e.runAsync(null, () => {
        r.source = !0, e.signal(i.signal, a);
      });
    }
  }, i.debounce && (r.update = Jb(i.debounce, r.update))), (i.input == null && i.element ? zZ : qZ)(r, t, i, e), r.active || (e.on(e._signals[i.signal], null, () => {
    r.source ? r.source = !1 : r.set(e.signal(i.signal));
  }), r.active = !0), r;
}
function zZ(e, t, n, i) {
  const r = n.event || "input", o = () => e.update(t.value);
  i.signal(n.signal, t.value), t.addEventListener(r, o), A6(i, t, r, o), e.set = (a) => {
    t.value = a, t.dispatchEvent(UZ(r));
  };
}
function UZ(e) {
  return typeof Event < "u" ? new Event(e) : {
    type: e
  };
}
function qZ(e, t, n, i) {
  const r = i.signal(n.signal), o = Yn("div", {
    class: PZ
  }), a = n.input === "radio" ? o : o.appendChild(Yn("label"));
  a.appendChild(Yn("span", {
    class: LZ
  }, n.name || n.signal)), t.appendChild(o);
  let s = WZ;
  switch (n.input) {
    case "checkbox":
      s = GZ;
      break;
    case "select":
      s = HZ;
      break;
    case "radio":
      s = YZ;
      break;
    case "range":
      s = XZ;
      break;
  }
  s(e, a, n, r);
}
function WZ(e, t, n, i) {
  const r = Yn("input");
  for (const o in n)
    o !== "signal" && o !== "element" && r.setAttribute(o === "input" ? "type" : o, n[o]);
  r.setAttribute("name", n.signal), r.value = i, t.appendChild(r), r.addEventListener("input", () => e.update(r.value)), e.elements = [r], e.set = (o) => r.value = o;
}
function GZ(e, t, n, i) {
  const r = {
    type: "checkbox",
    name: n.signal
  };
  i && (r.checked = !0);
  const o = Yn("input", r);
  t.appendChild(o), o.addEventListener("change", () => e.update(o.checked)), e.elements = [o], e.set = (a) => o.checked = !!a || null;
}
function HZ(e, t, n, i) {
  const r = Yn("select", {
    name: n.signal
  }), o = n.labels || [];
  n.options.forEach((a, s) => {
    const u = {
      value: a
    };
    h0(a, i) && (u.selected = !0), r.appendChild(Yn("option", u, (o[s] || a) + ""));
  }), t.appendChild(r), r.addEventListener("change", () => {
    e.update(n.options[r.selectedIndex]);
  }), e.elements = [r], e.set = (a) => {
    for (let s = 0, u = n.options.length; s < u; ++s)
      if (h0(n.options[s], a)) {
        r.selectedIndex = s;
        return;
      }
  };
}
function YZ(e, t, n, i) {
  const r = Yn("span", {
    class: IZ
  }), o = n.labels || [];
  t.appendChild(r), e.elements = n.options.map((a, s) => {
    const u = {
      type: "radio",
      name: n.signal,
      value: a
    };
    h0(a, i) && (u.checked = !0);
    const l = Yn("input", u);
    l.addEventListener("change", () => e.update(a));
    const c = Yn("label", {}, (o[s] || a) + "");
    return c.prepend(l), r.appendChild(c), l;
  }), e.set = (a) => {
    const s = e.elements, u = s.length;
    for (let l = 0; l < u; ++l)
      h0(s[l].value, a) && (s[l].checked = !0);
  };
}
function XZ(e, t, n, i) {
  i = i !== void 0 ? i : (+n.max + +n.min) / 2;
  const r = n.max != null ? n.max : Math.max(100, +i) || 100, o = n.min || Math.min(0, r, +i) || 0, a = n.step || ia(o, r, 100), s = Yn("input", {
    type: "range",
    name: n.signal,
    min: o,
    max: r,
    step: a
  });
  s.value = i;
  const u = Yn("span", {}, +i);
  t.appendChild(s), t.appendChild(u);
  const l = () => {
    u.textContent = s.value, e.update(+s.value);
  };
  s.addEventListener("input", l), s.addEventListener("change", l), e.elements = [s], e.set = (c) => {
    s.value = c, u.textContent = c;
  };
}
function h0(e, t) {
  return e === t || e + "" == t + "";
}
function _6(e, t, n, i, r, o) {
  return t = t || new i(e.loader()), t.initialize(n, w6(e), E6(e), zp(e), r, o).background(e.background());
}
function _E(e, t) {
  return t ? function() {
    try {
      t.apply(this, arguments);
    } catch (n) {
      e.error(n);
    }
  } : null;
}
function VZ(e, t, n, i) {
  const r = new i(e.loader(), _E(e, e.tooltip())).scene(e.scenegraph().root).initialize(n, zp(e), e);
  return t && t.handlers().forEach((o) => {
    r.on(o.type, o.handler);
  }), r;
}
function KZ(e, t) {
  const n = this, i = n._renderType, r = n._eventConfig.bind, o = Fp(i);
  e = n._el = e ? X1(n, e, !0) : null, xZ(n), o || n.error("Unrecognized renderer type: " + i);
  const a = o.handler || rd, s = e ? o.renderer : o.headless;
  return n._renderer = s ? _6(n, n._renderer, e, s) : null, n._handler = VZ(n, n._handler, e, a), n._redraw = !0, e && r !== "none" && (t = t ? n._elBind = X1(n, t, !0) : e.appendChild(Yn("form", {
    class: "vega-bindings"
  })), n._bind.forEach((u) => {
    u.param.element && r !== "container" && (u.element = X1(n, u.param.element, !!u.param.input));
  }), n._bind.forEach((u) => {
    BZ(n, u.element || t, u);
  })), n;
}
function X1(e, t, n) {
  if (typeof t == "string")
    if (typeof document < "u") {
      if (t = document.querySelector(t), !t)
        return e.error("Signal bind element not found: " + t), null;
    } else
      return e.error("DOM document instance not found."), null;
  if (t && n)
    try {
      t.textContent = "";
    } catch (i) {
      t = null, e.error(i);
    }
  return t;
}
const oc = (e) => +e || 0, JZ = (e) => ({
  top: e,
  bottom: e,
  left: e,
  right: e
});
function WC(e) {
  return ce(e) ? {
    top: oc(e.top),
    bottom: oc(e.bottom),
    left: oc(e.left),
    right: oc(e.right)
  } : JZ(oc(e));
}
async function OE(e, t, n, i) {
  const r = Fp(t), o = r && r.headless;
  return o || P("Unrecognized renderer type: " + t), await e.runAsync(), _6(e, null, null, o, n, i).renderAsync(e._scenegraph.root);
}
async function QZ(e, t) {
  e !== Wo.Canvas && e !== Wo.SVG && e !== Wo.PNG && P("Unrecognized image type: " + e);
  const n = await OE(this, e, t);
  return e === Wo.SVG ? ZZ(n.svg(), "image/svg+xml") : n.canvas().toDataURL("image/png");
}
function ZZ(e, t) {
  const n = new Blob([e], {
    type: t
  });
  return window.URL.createObjectURL(n);
}
async function eee(e, t) {
  return (await OE(this, Wo.Canvas, e, t)).canvas();
}
async function tee(e) {
  return (await OE(this, Wo.SVG, e)).svg();
}
function nee(e, t, n) {
  return v6(e, Wu, xf, n).parse(t);
}
function iee(e) {
  var t = this._runtime.scales;
  return ae(t, e) || P("Unrecognized scale or projection: " + e), t[e].value;
}
var O6 = "width", S6 = "height", SE = "padding", GC = {
  skip: !0
};
function C6(e, t) {
  var n = e.autosize(), i = e.padding();
  return t - (n && n.contains === SE ? i.left + i.right : 0);
}
function F6(e, t) {
  var n = e.autosize(), i = e.padding();
  return t - (n && n.contains === SE ? i.top + i.bottom : 0);
}
function ree(e) {
  var t = e._signals, n = t[O6], i = t[S6], r = t[SE];
  function o() {
    e._autosize = e._resize = 1;
  }
  e._resizeWidth = e.add(null, (s) => {
    e._width = s.size, e._viewWidth = C6(e, s.size), o();
  }, {
    size: n
  }), e._resizeHeight = e.add(null, (s) => {
    e._height = s.size, e._viewHeight = F6(e, s.size), o();
  }, {
    size: i
  });
  const a = e.add(null, o, {
    pad: r
  });
  e._resizeWidth.rank = n.rank + 1, e._resizeHeight.rank = i.rank + 1, a.rank = r.rank + 1;
}
function oee(e, t, n, i, r, o) {
  this.runAfter((a) => {
    let s = 0;
    a._autosize = 0, a.width() !== n && (s = 1, a.signal(O6, n, GC), a._resizeWidth.skip(!0)), a.height() !== i && (s = 1, a.signal(S6, i, GC), a._resizeHeight.skip(!0)), a._viewWidth !== e && (a._resize = 1, a._viewWidth = e), a._viewHeight !== t && (a._resize = 1, a._viewHeight = t), (a._origin[0] !== r[0] || a._origin[1] !== r[1]) && (a._resize = 1, a._origin = r), s && a.run("enter"), o && a.runAfter((u) => u.resize());
  }, !1, 1);
}
function aee(e) {
  return this._runtime.getState(e || {
    data: see,
    signals: uee,
    recurse: !0
  });
}
function see(e, t) {
  return t.modified && J(t.input.value) && e.indexOf("_:vega:_");
}
function uee(e, t) {
  return !(e === "parent" || t instanceof Wu.proxy);
}
function lee(e) {
  return this.runAsync(null, (t) => {
    t._trigger = !1, t._runtime.setState(e);
  }, (t) => {
    t._trigger = !0;
  }), this;
}
function cee(e, t) {
  function n(i) {
    e({
      timestamp: Date.now(),
      elapsed: i
    });
  }
  this._timers.push(IY(n, t));
}
function fee(e, t, n, i) {
  const r = e.element();
  r && r.setAttribute("title", dee(i));
}
function dee(e) {
  return e == null ? "" : J(e) ? k6(e) : ce(e) && !Vo(e) ? hee(e) : e + "";
}
function hee(e) {
  return Object.keys(e).map((t) => {
    const n = e[t];
    return t + ": " + (J(n) ? k6(n) : D6(n));
  }).join(`
`);
}
function k6(e) {
  return "[" + e.map(D6).join(", ") + "]";
}
function D6(e) {
  return J(e) ? "[\u2026]" : ce(e) && !Vo(e) ? "{\u2026}" : e;
}
function $6(e, t) {
  const n = this;
  if (t = t || {}, Du.call(n), t.loader && n.loader(t.loader), t.logger && n.logger(t.logger), t.logLevel != null && n.logLevel(t.logLevel), t.locale || e.locale) {
    const o = de({}, e.locale, t.locale);
    n.locale(L3(o.number, o.time));
  }
  n._el = null, n._elBind = null, n._renderType = t.renderer || Wo.Canvas, n._scenegraph = new sw();
  const i = n._scenegraph.root;
  n._renderer = null, n._tooltip = t.tooltip || fee, n._redraw = !0, n._handler = new rd().scene(i), n._globalCursor = !1, n._preventDefault = !1, n._timers = [], n._eventListeners = [], n._resizeListeners = [], n._eventConfig = MZ(e.eventConfig), n.globalCursor(n._eventConfig.globalCursor);
  const r = nee(n, e, t.expr);
  n._runtime = r, n._signals = r.signals, n._bind = (e.bindings || []).map((o) => ({
    state: null,
    param: de({}, o)
  })), r.root && r.root.set(i), i.source = r.data.root.input, n.pulse(r.data.root.input, n.changeset().insert(i.items)), n._width = n.width(), n._height = n.height(), n._viewWidth = C6(n, n._width), n._viewHeight = F6(n, n._height), n._origin = [0, 0], n._resize = 0, n._autosize = 1, ree(n), wZ(n), EZ(n), n.description(e.description), t.hover && n.hover(), t.container && n.initialize(t.container, t.bind);
}
function uh(e, t) {
  return ae(e._signals, t) ? e._signals[t] : P("Unrecognized signal name: " + te(t));
}
function M6(e, t) {
  const n = (e._targets || []).filter((i) => i._update && i._update.handler === t);
  return n.length ? n[0] : null;
}
function HC(e, t, n, i) {
  let r = M6(n, i);
  return r || (r = _E(e, () => i(t, n.value)), r.handler = i, e.on(n, null, r)), e;
}
function YC(e, t, n) {
  const i = M6(t, n);
  return i && t._targets.remove(i), e;
}
q($6, Du, {
  async evaluate(e, t, n) {
    if (await Du.prototype.evaluate.call(this, e, t), this._redraw || this._resize)
      try {
        this._renderer && (this._resize && (this._resize = 0, SZ(this)), await this._renderer.renderAsync(this._scenegraph.root)), this._redraw = !1;
      } catch (i) {
        this.error(i);
      }
    return n && Sh(this, n), this;
  },
  dirty(e) {
    this._redraw = !0, this._renderer && this._renderer.dirty(e);
  },
  description(e) {
    if (arguments.length) {
      const t = e != null ? e + "" : null;
      return t !== this._desc && x6(this._el, this._desc = t), this;
    }
    return this._desc;
  },
  container() {
    return this._el;
  },
  scenegraph() {
    return this._scenegraph;
  },
  origin() {
    return this._origin.slice();
  },
  signal(e, t, n) {
    const i = uh(this, e);
    return arguments.length === 1 ? i.value : this.update(i, t, n);
  },
  width(e) {
    return arguments.length ? this.signal("width", e) : this.signal("width");
  },
  height(e) {
    return arguments.length ? this.signal("height", e) : this.signal("height");
  },
  padding(e) {
    return arguments.length ? this.signal("padding", WC(e)) : WC(this.signal("padding"));
  },
  autosize(e) {
    return arguments.length ? this.signal("autosize", e) : this.signal("autosize");
  },
  background(e) {
    return arguments.length ? this.signal("background", e) : this.signal("background");
  },
  renderer(e) {
    return arguments.length ? (Fp(e) || P("Unrecognized renderer type: " + e), e !== this._renderType && (this._renderType = e, this._resetRenderer()), this) : this._renderType;
  },
  tooltip(e) {
    return arguments.length ? (e !== this._tooltip && (this._tooltip = e, this._resetRenderer()), this) : this._tooltip;
  },
  loader(e) {
    return arguments.length ? (e !== this._loader && (Du.prototype.loader.call(this, e), this._resetRenderer()), this) : this._loader;
  },
  resize() {
    return this._autosize = 1, this.touch(uh(this, "autosize"));
  },
  _resetRenderer() {
    this._renderer && (this._renderer = null, this.initialize(this._el, this._elBind));
  },
  _resizeView: oee,
  addEventListener(e, t, n) {
    let i = t;
    return n && n.trap === !1 || (i = _E(this, t), i.raw = t), this._handler.on(e, i), this;
  },
  removeEventListener(e, t) {
    for (var n = this._handler.handlers(e), i = n.length, r, o; --i >= 0; )
      if (o = n[i].type, r = n[i].handler, e === o && (t === r || t === r.raw)) {
        this._handler.off(o, r);
        break;
      }
    return this;
  },
  addResizeListener(e) {
    const t = this._resizeListeners;
    return t.indexOf(e) < 0 && t.push(e), this;
  },
  removeResizeListener(e) {
    var t = this._resizeListeners, n = t.indexOf(e);
    return n >= 0 && t.splice(n, 1), this;
  },
  addSignalListener(e, t) {
    return HC(this, e, uh(this, e), t);
  },
  removeSignalListener(e, t) {
    return YC(this, uh(this, e), t);
  },
  addDataListener(e, t) {
    return HC(this, e, d0(this, e).values, t);
  },
  removeDataListener(e, t) {
    return YC(this, d0(this, e).values, t);
  },
  globalCursor(e) {
    if (arguments.length) {
      if (this._globalCursor !== !!e) {
        const t = ib(this, null);
        this._globalCursor = !!e, t && ib(this, t);
      }
      return this;
    } else
      return this._globalCursor;
  },
  preventDefault(e) {
    return arguments.length ? (this._preventDefault = e, this) : this._preventDefault;
  },
  timer: cee,
  events: NZ,
  finalize: jZ,
  hover: RZ,
  data: AZ,
  change: Bp,
  insert: _Z,
  remove: OZ,
  scale: iee,
  initialize: KZ,
  toImageURL: QZ,
  toCanvas: eee,
  toSVG: tee,
  getState: aee,
  setState: lee
});
const gee = "view", g0 = "[", p0 = "]", T6 = "{", N6 = "}", pee = ":", R6 = ",", mee = "@", yee = ">", vee = /[[\]{}]/, bee = {
  "*": 1,
  arc: 1,
  area: 1,
  group: 1,
  image: 1,
  line: 1,
  path: 1,
  rect: 1,
  rule: 1,
  shape: 1,
  symbol: 1,
  text: 1,
  trail: 1
};
let j6, P6;
function L6(e, t, n) {
  return j6 = t || gee, P6 = n || bee, I6(e.trim()).map(rb);
}
function xee(e) {
  return P6[e];
}
function Xc(e, t, n, i, r) {
  const o = e.length;
  let a = 0, s;
  for (; t < o; ++t) {
    if (s = e[t], !a && s === n)
      return t;
    r && r.indexOf(s) >= 0 ? --a : i && i.indexOf(s) >= 0 && ++a;
  }
  return t;
}
function I6(e) {
  const t = [], n = e.length;
  let i = 0, r = 0;
  for (; r < n; )
    r = Xc(e, r, R6, g0 + T6, p0 + N6), t.push(e.substring(i, r).trim()), i = ++r;
  if (t.length === 0)
    throw "Empty event selector: " + e;
  return t;
}
function rb(e) {
  return e[0] === "[" ? wee(e) : Eee(e);
}
function wee(e) {
  const t = e.length;
  let n = 1, i;
  if (n = Xc(e, n, p0, g0, p0), n === t)
    throw "Empty between selector: " + e;
  if (i = I6(e.substring(1, n)), i.length !== 2)
    throw "Between selector must have two elements: " + e;
  if (e = e.slice(n + 1).trim(), e[0] !== yee)
    throw "Expected '>' after between selector: " + e;
  i = i.map(rb);
  const r = rb(e.slice(1).trim());
  return r.between ? {
    between: i,
    stream: r
  } : (r.between = i, r);
}
function Eee(e) {
  const t = {
    source: j6
  }, n = [];
  let i = [0, 0], r = 0, o = 0, a = e.length, s = 0, u, l;
  if (e[a - 1] === N6) {
    if (s = e.lastIndexOf(T6), s >= 0) {
      try {
        i = Aee(e.substring(s + 1, a - 1));
      } catch {
        throw "Invalid throttle specification: " + e;
      }
      e = e.slice(0, s).trim(), a = e.length;
    } else
      throw "Unmatched right brace: " + e;
    s = 0;
  }
  if (!a)
    throw e;
  if (e[0] === mee && (r = ++s), u = Xc(e, s, pee), u < a && (n.push(e.substring(o, u).trim()), o = s = ++u), s = Xc(e, s, g0), s === a)
    n.push(e.substring(o, a).trim());
  else if (n.push(e.substring(o, s).trim()), l = [], o = ++s, o === a)
    throw "Unmatched left bracket: " + e;
  for (; s < a; ) {
    if (s = Xc(e, s, p0), s === a)
      throw "Unmatched left bracket: " + e;
    if (l.push(e.substring(o, s).trim()), s < a - 1 && e[++s] !== g0)
      throw "Expected left bracket: " + e;
    o = ++s;
  }
  if (!(a = n.length) || vee.test(n[a - 1]))
    throw "Invalid event selector: " + e;
  return a > 1 ? (t.type = n[1], r ? t.markname = n[0].slice(1) : xee(n[0]) ? t.marktype = n[0] : t.source = n[0]) : t.type = n[0], t.type.slice(-1) === "!" && (t.consume = !0, t.type = t.type.slice(0, -1)), l != null && (t.filter = l), i[0] && (t.throttle = i[0]), i[1] && (t.debounce = i[1]), t;
}
function Aee(e) {
  const t = e.split(R6);
  if (!e.length || t.length > 2)
    throw e;
  return t.map((n) => {
    const i = +n;
    if (i !== i)
      throw e;
    return i;
  });
}
function _ee(e) {
  return ce(e) ? e : {
    type: e || "pad"
  };
}
const ac = (e) => +e || 0, Oee = (e) => ({
  top: e,
  bottom: e,
  left: e,
  right: e
});
function See(e) {
  return ce(e) ? e.signal ? e : {
    top: ac(e.top),
    bottom: ac(e.bottom),
    left: ac(e.left),
    right: ac(e.right)
  } : Oee(ac(e));
}
const Ct = (e) => ce(e) && !J(e) ? de({}, e) : {
  value: e
};
function XC(e, t, n, i) {
  return n != null ? (ce(n) && !J(n) || J(n) && n.length && ce(n[0]) ? e.update[t] = n : e[i || "enter"][t] = {
    value: n
  }, 1) : 0;
}
function jt(e, t, n) {
  for (const i in t)
    XC(e, i, t[i]);
  for (const i in n)
    XC(e, i, n[i], "update");
}
function kl(e, t, n) {
  for (const i in t)
    n && ae(n, i) || (e[i] = de(e[i] || {}, t[i]));
  return e;
}
function wu(e, t) {
  return t && (t.enter && t.enter[e] || t.update && t.update[e]);
}
const CE = "mark", FE = "frame", kE = "scope", Cee = "axis", Fee = "axis-domain", kee = "axis-grid", Dee = "axis-label", $ee = "axis-tick", Mee = "axis-title", Tee = "legend", Nee = "legend-band", Ree = "legend-entry", jee = "legend-gradient", B6 = "legend-label", Pee = "legend-symbol", Lee = "legend-title", Iee = "title", Bee = "title-text", zee = "title-subtitle";
function Uee(e, t, n, i, r) {
  const o = {}, a = {};
  let s, u, l, c;
  u = "lineBreak", t === "text" && r[u] != null && !wu(u, e) && V1(o, u, r[u]), (n == "legend" || String(n).startsWith("axis")) && (n = null), c = n === FE ? r.group : n === CE ? de({}, r.mark, r[t]) : null;
  for (u in c)
    l = wu(u, e) || (u === "fill" || u === "stroke") && (wu("fill", e) || wu("stroke", e)), l || V1(o, u, c[u]);
  oe(i).forEach((f) => {
    const d = r.style && r.style[f];
    for (const h in d)
      wu(h, e) || V1(o, h, d[h]);
  }), e = de({}, e);
  for (u in o)
    c = o[u], c.signal ? (s = s || {})[u] = c : a[u] = c;
  return e.enter = de(a, e.enter), s && (e.update = de(s, e.update)), e;
}
function V1(e, t, n) {
  e[t] = n && n.signal ? {
    signal: n.signal
  } : {
    value: n
  };
}
const z6 = (e) => je(e) ? te(e) : e.signal ? `(${e.signal})` : U6(e);
function Up(e) {
  if (e.gradient != null)
    return Wee(e);
  let t = e.signal ? `(${e.signal})` : e.color ? qee(e.color) : e.field != null ? U6(e.field) : e.value !== void 0 ? te(e.value) : void 0;
  return e.scale != null && (t = Gee(e, t)), t === void 0 && (t = null), e.exponent != null && (t = `pow(${t},${qh(e.exponent)})`), e.mult != null && (t += `*${qh(e.mult)}`), e.offset != null && (t += `+${qh(e.offset)}`), e.round && (t = `round(${t})`), t;
}
const lh = (e, t, n, i) => `(${e}(${[t, n, i].map(Up).join(",")})+'')`;
function qee(e) {
  return e.c ? lh("hcl", e.h, e.c, e.l) : e.h || e.s ? lh("hsl", e.h, e.s, e.l) : e.l || e.a ? lh("lab", e.l, e.a, e.b) : e.r || e.g || e.b ? lh("rgb", e.r, e.g, e.b) : null;
}
function Wee(e) {
  const t = [e.start, e.stop, e.count].map((n) => n == null ? null : te(n));
  for (; t.length && xe(t) == null; )
    t.pop();
  return t.unshift(z6(e.gradient)), `gradient(${t.join(",")})`;
}
function qh(e) {
  return ce(e) ? "(" + Up(e) + ")" : e;
}
function U6(e) {
  return q6(ce(e) ? e : {
    datum: e
  });
}
function q6(e) {
  let t, n, i;
  if (e.signal)
    t = "datum", i = e.signal;
  else if (e.group || e.parent) {
    for (n = Math.max(1, e.level || 1), t = "item"; n-- > 0; )
      t += ".mark.group";
    e.parent ? (i = e.parent, t += ".datum") : i = e.group;
  } else
    e.datum ? (t = "datum", i = e.datum) : P("Invalid field reference: " + te(e));
  return e.signal || (i = je(i) ? B0(i).map(te).join("][") : q6(i)), t + "[" + i + "]";
}
function Gee(e, t) {
  const n = z6(e.scale);
  return e.range != null ? t = `lerp(_range(${n}), ${+e.range})` : (t !== void 0 && (t = `_scale(${n}, ${t})`), e.band && (t = (t ? t + "+" : "") + `_bandwidth(${n})` + (+e.band == 1 ? "" : "*" + qh(e.band)), e.extra && (t = `(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)), t == null && (t = "0")), t;
}
function Hee(e) {
  let t = "";
  return e.forEach((n) => {
    const i = Up(n);
    t += n.test ? `(${n.test})?${i}:` : i;
  }), xe(t) === ":" && (t += "null"), t;
}
function W6(e, t, n, i, r, o) {
  const a = {};
  o = o || {}, o.encoders = {
    $encode: a
  }, e = Uee(e, t, n, i, r.config);
  for (const s in e)
    a[s] = Yee(e[s], t, o, r);
  return o;
}
function Yee(e, t, n, i) {
  const r = {}, o = {};
  for (const a in e)
    e[a] != null && (r[a] = Vee(Xee(e[a]), i, n, o));
  return {
    $expr: {
      marktype: t,
      channels: r
    },
    $fields: Object.keys(o),
    $output: Object.keys(e)
  };
}
function Xee(e) {
  return J(e) ? Hee(e) : Up(e);
}
function Vee(e, t, n, i) {
  const r = wr(e, t);
  return r.$fields.forEach((o) => i[o] = 1), de(n, r.$params), r.$expr;
}
const Kee = "outer", Jee = ["value", "update", "init", "react", "bind"];
function VC(e, t) {
  P(e + ' for "outer" push: ' + te(t));
}
function G6(e, t) {
  const n = e.name;
  if (e.push === Kee)
    t.signals[n] || VC("No prior signal definition", n), Jee.forEach((i) => {
      e[i] !== void 0 && VC("Invalid property ", i);
    });
  else {
    const i = t.addSignal(n, e.value);
    e.react === !1 && (i.react = !1), e.bind && t.addBinding(n, e.bind);
  }
}
function ob(e, t, n, i) {
  this.id = -1, this.type = e, this.value = t, this.params = n, i && (this.parent = i);
}
function qp(e, t, n, i) {
  return new ob(e, t, n, i);
}
function m0(e, t) {
  return qp("operator", e, t);
}
function Q(e) {
  const t = {
    $ref: e.id
  };
  return e.id < 0 && (e.refs = e.refs || []).push(t), t;
}
function wf(e, t) {
  return t ? {
    $field: e,
    $name: t
  } : {
    $field: e
  };
}
const ab = wf("key");
function KC(e, t) {
  return {
    $compare: e,
    $order: t
  };
}
function Qee(e, t) {
  const n = {
    $key: e
  };
  return t && (n.$flat = !0), n;
}
const Zee = "ascending", ete = "descending";
function tte(e) {
  return ce(e) ? (e.order === ete ? "-" : "+") + Wp(e.op, e.field) : "";
}
function Wp(e, t) {
  return (e && e.signal ? "$" + e.signal : e || "") + (e && t ? "_" : "") + (t && t.signal ? "$" + t.signal : t || "");
}
const DE = "scope", sb = "view";
function bt(e) {
  return e && e.signal;
}
function nte(e) {
  return e && e.expr;
}
function Wh(e) {
  if (bt(e))
    return !0;
  if (ce(e)) {
    for (const t in e)
      if (Wh(e[t]))
        return !0;
  }
  return !1;
}
function _i(e, t) {
  return e != null ? e : t;
}
function ps(e) {
  return e && e.signal || e;
}
const JC = "timer";
function Ef(e, t) {
  return (e.merge ? rte : e.stream ? ote : e.type ? ate : P("Invalid stream specification: " + te(e)))(e, t);
}
function ite(e) {
  return e === DE ? sb : e || sb;
}
function rte(e, t) {
  const n = e.merge.map((r) => Ef(r, t)), i = $E({
    merge: n
  }, e, t);
  return t.addStream(i).id;
}
function ote(e, t) {
  const n = Ef(e.stream, t), i = $E({
    stream: n
  }, e, t);
  return t.addStream(i).id;
}
function ate(e, t) {
  let n;
  e.type === JC ? (n = t.event(JC, e.throttle), e = {
    between: e.between,
    filter: e.filter
  }) : n = t.event(ite(e.source), e.type);
  const i = $E({
    stream: n
  }, e, t);
  return Object.keys(i).length === 1 ? n : t.addStream(i).id;
}
function $E(e, t, n) {
  let i = t.between;
  return i && (i.length !== 2 && P('Stream "between" parameter must have 2 entries: ' + te(t)), e.between = [Ef(i[0], n), Ef(i[1], n)]), i = t.filter ? [].concat(t.filter) : [], (t.marktype || t.markname || t.markrole) && i.push(ste(t.marktype, t.markname, t.markrole)), t.source === DE && i.push("inScope(event.item)"), i.length && (e.filter = wr("(" + i.join(")&&(") + ")", n).$expr), (i = t.throttle) != null && (e.throttle = +i), (i = t.debounce) != null && (e.debounce = +i), t.consume && (e.consume = !0), e;
}
function ste(e, t, n) {
  const i = "event.item";
  return i + (e && e !== "*" ? "&&" + i + ".mark.marktype==='" + e + "'" : "") + (n ? "&&" + i + ".mark.role==='" + n + "'" : "") + (t ? "&&" + i + ".mark.name==='" + t + "'" : "");
}
const ute = {
  code: "_.$value",
  ast: {
    type: "Identifier",
    value: "value"
  }
};
function lte(e, t, n) {
  const i = e.encode, r = {
    target: n
  };
  let o = e.events, a = e.update, s = [];
  o || P("Signal update missing events specification."), je(o) && (o = L6(o, t.isSubscope() ? DE : sb)), o = oe(o).filter((u) => u.signal || u.scale ? (s.push(u), 0) : 1), s.length > 1 && (s = [fte(s)]), o.length && s.push(o.length > 1 ? {
    merge: o
  } : o[0]), i != null && (a && P("Signal encode and update are mutually exclusive."), a = "encode(item()," + te(i) + ")"), r.update = je(a) ? wr(a, t) : a.expr != null ? wr(a.expr, t) : a.value != null ? a.value : a.signal != null ? {
    $expr: ute,
    $params: {
      $value: t.signalRef(a.signal)
    }
  } : P("Invalid signal update specification."), e.force && (r.options = {
    force: !0
  }), s.forEach((u) => t.addUpdate(de(cte(u, t), r)));
}
function cte(e, t) {
  return {
    source: e.signal ? t.signalRef(e.signal) : e.scale ? t.scaleRef(e.scale) : Ef(e, t)
  };
}
function fte(e) {
  return {
    signal: "[" + e.map((t) => t.scale ? 'scale("' + t.scale + '")' : t.signal) + "]"
  };
}
function dte(e, t) {
  const n = t.getSignal(e.name);
  let i = e.update;
  e.init && (i ? P("Signals can not include both init and update expressions.") : (i = e.init, n.initonly = !0)), i && (i = wr(i, t), n.update = i.$expr, n.params = i.$params), e.on && e.on.forEach((r) => lte(r, t, n.id));
}
const ze = (e) => (t, n, i) => qp(e, n, t || void 0, i), H6 = ze("aggregate"), hte = ze("axisticks"), Y6 = ze("bound"), Hi = ze("collect"), QC = ze("compare"), gte = ze("datajoin"), X6 = ze("encode"), pte = ze("expression"), mte = ze("facet"), yte = ze("field"), vte = ze("key"), bte = ze("legendentries"), xte = ze("load"), wte = ze("mark"), Ete = ze("multiextent"), Ate = ze("multivalues"), _te = ze("overlap"), Ote = ze("params"), V6 = ze("prefacet"), Ste = ze("projection"), Cte = ze("proxy"), Fte = ze("relay"), K6 = ze("render"), kte = ze("scale"), Vs = ze("sieve"), Dte = ze("sortitems"), J6 = ze("viewlayout"), $te = ze("values");
let Mte = 0;
const Q6 = {
  min: "min",
  max: "max",
  count: "sum"
};
function Tte(e, t) {
  const n = e.type || "linear";
  HM(n) || P("Unrecognized scale type: " + te(n)), t.addScale(e.name, {
    type: n,
    domain: void 0
  });
}
function Nte(e, t) {
  const n = t.getScale(e.name).params;
  let i;
  n.domain = Z6(e.domain, e, t), e.range != null && (n.range = tR(e, t, n)), e.interpolate != null && Wte(e.interpolate, n), e.nice != null && (n.nice = qte(e.nice)), e.bins != null && (n.bins = Ute(e.bins, t));
  for (i in e)
    ae(n, i) || i === "name" || (n[i] = ai(e[i], t));
}
function ai(e, t) {
  return ce(e) ? e.signal ? t.signalRef(e.signal) : P("Unsupported object: " + te(e)) : e;
}
function Gh(e, t) {
  return e.signal ? t.signalRef(e.signal) : e.map((n) => ai(n, t));
}
function Gp(e) {
  P("Can not find data set: " + te(e));
}
function Z6(e, t, n) {
  if (!e) {
    (t.domainMin != null || t.domainMax != null) && P("No scale domain defined for domainMin/domainMax to override.");
    return;
  }
  return e.signal ? n.signalRef(e.signal) : (J(e) ? Rte : e.fields ? Pte : jte)(e, t, n);
}
function Rte(e, t, n) {
  return e.map((i) => ai(i, n));
}
function jte(e, t, n) {
  const i = n.getData(e.data);
  return i || Gp(e.data), Vu(t.type) ? i.valuesRef(n, e.field, eR(e.sort, !1)) : VM(t.type) ? i.domainRef(n, e.field) : i.extentRef(n, e.field);
}
function Pte(e, t, n) {
  const i = e.data, r = e.fields.reduce((o, a) => (a = je(a) ? {
    data: i,
    field: a
  } : J(a) || a.signal ? Lte(a, n) : a, o.push(a), o), []);
  return (Vu(t.type) ? Ite : VM(t.type) ? Bte : zte)(e, n, r);
}
function Lte(e, t) {
  const n = "_:vega:_" + Mte++, i = Hi({});
  if (J(e))
    i.value = {
      $ingest: e
    };
  else if (e.signal) {
    const r = "setdata(" + te(n) + "," + e.signal + ")";
    i.params.input = t.signalRef(r);
  }
  return t.addDataPipeline(n, [i, Vs({})]), {
    data: n,
    field: "data"
  };
}
function Ite(e, t, n) {
  const i = eR(e.sort, !0);
  let r, o;
  const a = n.map((l) => {
    const c = t.getData(l.data);
    return c || Gp(l.data), c.countsRef(t, l.field, i);
  }), s = {
    groupby: ab,
    pulse: a
  };
  i && (r = i.op || "count", o = i.field ? Wp(r, i.field) : "count", s.ops = [Q6[r]], s.fields = [t.fieldRef(o)], s.as = [o]), r = t.add(H6(s));
  const u = t.add(Hi({
    pulse: Q(r)
  }));
  return o = t.add($te({
    field: ab,
    sort: t.sortRef(i),
    pulse: Q(u)
  })), Q(o);
}
function eR(e, t) {
  return e && (!e.field && !e.op ? ce(e) ? e.field = "key" : e = {
    field: "key"
  } : !e.field && e.op !== "count" ? P("No field provided for sort aggregate op: " + e.op) : t && e.field && e.op && !Q6[e.op] && P("Multiple domain scales can not be sorted using " + e.op)), e;
}
function Bte(e, t, n) {
  const i = n.map((r) => {
    const o = t.getData(r.data);
    return o || Gp(r.data), o.domainRef(t, r.field);
  });
  return Q(t.add(Ate({
    values: i
  })));
}
function zte(e, t, n) {
  const i = n.map((r) => {
    const o = t.getData(r.data);
    return o || Gp(r.data), o.extentRef(t, r.field);
  });
  return Q(t.add(Ete({
    extents: i
  })));
}
function Ute(e, t) {
  return e.signal || J(e) ? Gh(e, t) : t.objectProperty(e);
}
function qte(e) {
  return ce(e) ? {
    interval: ai(e.interval),
    step: ai(e.step)
  } : ai(e);
}
function Wte(e, t) {
  t.interpolate = ai(e.type || e), e.gamma != null && (t.interpolateGamma = ai(e.gamma));
}
function tR(e, t, n) {
  const i = t.config.range;
  let r = e.range;
  if (r.signal)
    return t.signalRef(r.signal);
  if (je(r)) {
    if (i && ae(i, r))
      return e = de({}, e, {
        range: i[r]
      }), tR(e, t, n);
    r === "width" ? r = [0, {
      signal: "width"
    }] : r === "height" ? r = Vu(e.type) ? [0, {
      signal: "height"
    }] : [{
      signal: "height"
    }, 0] : P("Unrecognized scale range value: " + te(r));
  } else if (r.scheme) {
    n.scheme = J(r.scheme) ? Gh(r.scheme, t) : ai(r.scheme, t), r.extent && (n.schemeExtent = Gh(r.extent, t)), r.count && (n.schemeCount = ai(r.count, t));
    return;
  } else if (r.step) {
    n.rangeStep = ai(r.step, t);
    return;
  } else {
    if (Vu(e.type) && !J(r))
      return Z6(r, e, t);
    J(r) || P("Unsupported range type: " + te(r));
  }
  return r.map((o) => (J(o) ? Gh : ai)(o, t));
}
function Gte(e, t) {
  const n = t.config.projection || {}, i = {};
  for (const r in e)
    r !== "name" && (i[r] = ub(e[r], r, t));
  for (const r in n)
    i[r] == null && (i[r] = ub(n[r], r, t));
  t.addProjection(e.name, i);
}
function ub(e, t, n) {
  return J(e) ? e.map((i) => ub(i, t, n)) : ce(e) ? e.signal ? n.signalRef(e.signal) : t === "fit" ? e : P("Unsupported parameter object: " + te(e)) : e;
}
const Yi = "top", Dl = "left", $l = "right", ga = "bottom", nR = "center", Hte = "vertical", Yte = "start", Xte = "middle", Vte = "end", lb = "index", ME = "label", Kte = "offset", ol = "perc", Jte = "perc2", ui = "value", hd = "guide-label", TE = "guide-title", Qte = "group-title", Zte = "group-subtitle", ZC = "symbol", Hh = "gradient", cb = "discrete", fb = "size", ene = "shape", tne = "fill", nne = "stroke", ine = "strokeWidth", rne = "strokeDash", one = "opacity", NE = [fb, ene, tne, nne, ine, rne, one], gd = {
  name: 1,
  style: 1,
  interactive: 1
}, Ee = {
  value: 0
}, li = {
  value: 1
}, Hp = "group", iR = "rect", RE = "rule", ane = "symbol", Ks = "text";
function Af(e) {
  return e.type = Hp, e.interactive = e.interactive || !1, e;
}
function Bn(e, t) {
  const n = (i, r) => _i(e[i], _i(t[i], r));
  return n.isVertical = (i) => Hte === _i(e.direction, t.direction || (i ? t.symbolDirection : t.gradientDirection)), n.gradientLength = () => _i(e.gradientLength, t.gradientLength || t.gradientWidth), n.gradientThickness = () => _i(e.gradientThickness, t.gradientThickness || t.gradientHeight), n.entryColumns = () => _i(e.columns, _i(t.columns, +n.isVertical(!0))), n;
}
function rR(e, t) {
  const n = t && (t.update && t.update[e] || t.enter && t.enter[e]);
  return n && n.signal ? n : n ? n.value : null;
}
function sne(e, t, n) {
  const i = t.config.style[n];
  return i && i[e];
}
function Yp(e, t, n) {
  return `item.anchor === '${Yte}' ? ${e} : item.anchor === '${Vte}' ? ${t} : ${n}`;
}
const jE = Yp(te(Dl), te($l), te(nR));
function une(e) {
  const t = e("tickBand");
  let n = e("tickOffset"), i, r;
  return t ? t.signal ? (i = {
    signal: `(${t.signal}) === 'extent' ? 1 : 0.5`
  }, r = {
    signal: `(${t.signal}) === 'extent'`
  }, ce(n) || (n = {
    signal: `(${t.signal}) === 'extent' ? 0 : ${n}`
  })) : t === "extent" ? (i = 1, r = !0, n = 0) : (i = 0.5, r = !1) : (i = e("bandPosition"), r = e("tickExtra")), {
    extra: r,
    band: i,
    offset: n
  };
}
function oR(e, t) {
  return t ? e ? ce(e) ? Object.assign({}, e, {
    offset: oR(e.offset, t)
  }) : {
    value: e,
    offset: t
  } : t : e;
}
function Zn(e, t) {
  return t ? (e.name = t.name, e.style = t.style || e.style, e.interactive = !!t.interactive, e.encode = kl(e.encode, t, gd)) : e.interactive = !1, e;
}
function lne(e, t, n, i) {
  const r = Bn(e, n), o = r.isVertical(), a = r.gradientThickness(), s = r.gradientLength();
  let u, l, c, f, d;
  o ? (l = [0, 1], c = [0, 0], f = a, d = s) : (l = [0, 0], c = [1, 0], f = s, d = a);
  const h = {
    enter: u = {
      opacity: Ee,
      x: Ee,
      y: Ee,
      width: Ct(f),
      height: Ct(d)
    },
    update: de({}, u, {
      opacity: li,
      fill: {
        gradient: t,
        start: l,
        stop: c
      }
    }),
    exit: {
      opacity: Ee
    }
  };
  return jt(h, {
    stroke: r("gradientStrokeColor"),
    strokeWidth: r("gradientStrokeWidth")
  }, {
    opacity: r("gradientOpacity")
  }), Zn({
    type: iR,
    role: jee,
    encode: h
  }, i);
}
function cne(e, t, n, i, r) {
  const o = Bn(e, n), a = o.isVertical(), s = o.gradientThickness(), u = o.gradientLength();
  let l, c, f, d, h = "";
  a ? (l = "y", f = "y2", c = "x", d = "width", h = "1-") : (l = "x", f = "x2", c = "y", d = "height");
  const g = {
    opacity: Ee,
    fill: {
      scale: t,
      field: ui
    }
  };
  g[l] = {
    signal: h + "datum." + ol,
    mult: u
  }, g[c] = Ee, g[f] = {
    signal: h + "datum." + Jte,
    mult: u
  }, g[d] = Ct(s);
  const p = {
    enter: g,
    update: de({}, g, {
      opacity: li
    }),
    exit: {
      opacity: Ee
    }
  };
  return jt(p, {
    stroke: o("gradientStrokeColor"),
    strokeWidth: o("gradientStrokeWidth")
  }, {
    opacity: o("gradientOpacity")
  }), Zn({
    type: iR,
    role: Nee,
    key: ui,
    from: r,
    encode: p
  }, i);
}
const fne = `datum.${ol}<=0?"${Dl}":datum.${ol}>=1?"${$l}":"${nR}"`, dne = `datum.${ol}<=0?"${ga}":datum.${ol}>=1?"${Yi}":"${Xte}"`;
function eF(e, t, n, i) {
  const r = Bn(e, t), o = r.isVertical(), a = Ct(r.gradientThickness()), s = r.gradientLength();
  let u = r("labelOverlap"), l, c, f, d, h = "";
  const g = {
    enter: l = {
      opacity: Ee
    },
    update: c = {
      opacity: li,
      text: {
        field: ME
      }
    },
    exit: {
      opacity: Ee
    }
  };
  return jt(g, {
    fill: r("labelColor"),
    fillOpacity: r("labelOpacity"),
    font: r("labelFont"),
    fontSize: r("labelFontSize"),
    fontStyle: r("labelFontStyle"),
    fontWeight: r("labelFontWeight"),
    limit: _i(e.labelLimit, t.gradientLabelLimit)
  }), o ? (l.align = {
    value: "left"
  }, l.baseline = c.baseline = {
    signal: dne
  }, f = "y", d = "x", h = "1-") : (l.align = c.align = {
    signal: fne
  }, l.baseline = {
    value: "top"
  }, f = "x", d = "y"), l[f] = c[f] = {
    signal: h + "datum." + ol,
    mult: s
  }, l[d] = c[d] = a, a.offset = _i(e.labelOffset, t.gradientLabelOffset) || 0, u = u ? {
    separation: r("labelSeparation"),
    method: u,
    order: "datum." + lb
  } : void 0, Zn({
    type: Ks,
    role: B6,
    style: hd,
    key: ui,
    from: i,
    encode: g,
    overlap: u
  }, n);
}
function hne(e, t, n, i, r) {
  const o = Bn(e, t), a = n.entries, s = !!(a && a.interactive), u = a ? a.name : void 0, l = o("clipHeight"), c = o("symbolOffset"), f = {
    data: "value"
  }, d = `(${r}) ? datum.${Kte} : datum.${fb}`, h = l ? Ct(l) : {
    field: fb
  }, g = `datum.${lb}`, p = `max(1, ${r})`;
  let m, y, v, b, x;
  h.mult = 0.5, m = {
    enter: y = {
      opacity: Ee,
      x: {
        signal: d,
        mult: 0.5,
        offset: c
      },
      y: h
    },
    update: v = {
      opacity: li,
      x: y.x,
      y: y.y
    },
    exit: {
      opacity: Ee
    }
  };
  let E = null, A = null;
  e.fill || (E = t.symbolBaseFillColor, A = t.symbolBaseStrokeColor), jt(m, {
    fill: o("symbolFillColor", E),
    shape: o("symbolType"),
    size: o("symbolSize"),
    stroke: o("symbolStrokeColor", A),
    strokeDash: o("symbolDash"),
    strokeDashOffset: o("symbolDashOffset"),
    strokeWidth: o("symbolStrokeWidth")
  }, {
    opacity: o("symbolOpacity")
  }), NE.forEach((C) => {
    e[C] && (v[C] = y[C] = {
      scale: e[C],
      field: ui
    });
  });
  const w = Zn({
    type: ane,
    role: Pee,
    key: ui,
    from: f,
    clip: l ? !0 : void 0,
    encode: m
  }, n.symbols), _ = Ct(c);
  _.offset = o("labelOffset"), m = {
    enter: y = {
      opacity: Ee,
      x: {
        signal: d,
        offset: _
      },
      y: h
    },
    update: v = {
      opacity: li,
      text: {
        field: ME
      },
      x: y.x,
      y: y.y
    },
    exit: {
      opacity: Ee
    }
  }, jt(m, {
    align: o("labelAlign"),
    baseline: o("labelBaseline"),
    fill: o("labelColor"),
    fillOpacity: o("labelOpacity"),
    font: o("labelFont"),
    fontSize: o("labelFontSize"),
    fontStyle: o("labelFontStyle"),
    fontWeight: o("labelFontWeight"),
    limit: o("labelLimit")
  });
  const k = Zn({
    type: Ks,
    role: B6,
    style: hd,
    key: ui,
    from: f,
    encode: m
  }, n.labels);
  return m = {
    enter: {
      noBound: {
        value: !l
      },
      width: Ee,
      height: l ? Ct(l) : Ee,
      opacity: Ee
    },
    exit: {
      opacity: Ee
    },
    update: v = {
      opacity: li,
      row: {
        signal: null
      },
      column: {
        signal: null
      }
    }
  }, o.isVertical(!0) ? (b = `ceil(item.mark.items.length / ${p})`, v.row.signal = `${g}%${b}`, v.column.signal = `floor(${g} / ${b})`, x = {
    field: ["row", g]
  }) : (v.row.signal = `floor(${g} / ${p})`, v.column.signal = `${g} % ${p}`, x = {
    field: g
  }), v.column.signal = `(${r})?${v.column.signal}:${g}`, i = {
    facet: {
      data: i,
      name: "value",
      groupby: lb
    }
  }, Af({
    role: kE,
    from: i,
    encode: kl(m, a, gd),
    marks: [w, k],
    name: u,
    interactive: s,
    sort: x
  });
}
function gne(e, t) {
  const n = Bn(e, t);
  return {
    align: n("gridAlign"),
    columns: n.entryColumns(),
    center: {
      row: !0,
      column: !1
    },
    padding: {
      row: n("rowPadding"),
      column: n("columnPadding")
    }
  };
}
const PE = 'item.orient === "left"', LE = 'item.orient === "right"', Xp = `(${PE} || ${LE})`, pne = `datum.vgrad && ${Xp}`, mne = Yp('"top"', '"bottom"', '"middle"'), yne = Yp('"right"', '"left"', '"center"'), vne = `datum.vgrad && ${LE} ? (${yne}) : (${Xp} && !(datum.vgrad && ${PE})) ? "left" : ${jE}`, bne = `item._anchor || (${Xp} ? "middle" : "start")`, xne = `${pne} ? (${PE} ? -90 : 90) : 0`, wne = `${Xp} ? (datum.vgrad ? (${LE} ? "bottom" : "top") : ${mne}) : "top"`;
function Ene(e, t, n, i) {
  const r = Bn(e, t), o = {
    enter: {
      opacity: Ee
    },
    update: {
      opacity: li,
      x: {
        field: {
          group: "padding"
        }
      },
      y: {
        field: {
          group: "padding"
        }
      }
    },
    exit: {
      opacity: Ee
    }
  };
  return jt(o, {
    orient: r("titleOrient"),
    _anchor: r("titleAnchor"),
    anchor: {
      signal: bne
    },
    angle: {
      signal: xne
    },
    align: {
      signal: vne
    },
    baseline: {
      signal: wne
    },
    text: e.title,
    fill: r("titleColor"),
    fillOpacity: r("titleOpacity"),
    font: r("titleFont"),
    fontSize: r("titleFontSize"),
    fontStyle: r("titleFontStyle"),
    fontWeight: r("titleFontWeight"),
    limit: r("titleLimit"),
    lineHeight: r("titleLineHeight")
  }, {
    align: r("titleAlign"),
    baseline: r("titleBaseline")
  }), Zn({
    type: Ks,
    role: Lee,
    style: TE,
    from: i,
    encode: o
  }, n);
}
function Ane(e, t) {
  let n;
  return ce(e) && (e.signal ? n = e.signal : e.path ? n = "pathShape(" + tF(e.path) + ")" : e.sphere && (n = "geoShape(" + tF(e.sphere) + ', {type: "Sphere"})')), n ? t.signalRef(n) : !!e;
}
function tF(e) {
  return ce(e) && e.signal ? e.signal : te(e);
}
function aR(e) {
  const t = e.role || "";
  return !t.indexOf("axis") || !t.indexOf("legend") || !t.indexOf("title") ? t : e.type === Hp ? kE : t || CE;
}
function _ne(e) {
  return {
    marktype: e.type,
    name: e.name || void 0,
    role: e.role || aR(e),
    zindex: +e.zindex || void 0,
    aria: e.aria,
    description: e.description
  };
}
function One(e, t) {
  return e && e.signal ? t.signalRef(e.signal) : e !== !1;
}
function IE(e, t) {
  const n = J3(e.type);
  n || P("Unrecognized transform type: " + te(e.type));
  const i = qp(n.type.toLowerCase(), null, sR(n, e, t));
  return e.signal && t.addSignal(e.signal, t.proxy(i)), i.metadata = n.metadata || {}, i;
}
function sR(e, t, n) {
  const i = {}, r = e.params.length;
  for (let o = 0; o < r; ++o) {
    const a = e.params[o];
    i[a.name] = Sne(a, t, n);
  }
  return i;
}
function Sne(e, t, n) {
  const i = e.type, r = t[e.name];
  if (i === "index")
    return Cne(e, t, n);
  if (r === void 0) {
    e.required && P("Missing required " + te(t.type) + " parameter: " + te(e.name));
    return;
  } else {
    if (i === "param")
      return Fne(e, t, n);
    if (i === "projection")
      return n.projectionRef(t[e.name]);
  }
  return e.array && !bt(r) ? r.map((o) => nF(e, o, n)) : nF(e, r, n);
}
function nF(e, t, n) {
  const i = e.type;
  if (bt(t))
    return rF(i) ? P("Expression references can not be signals.") : K1(i) ? n.fieldRef(t) : oF(i) ? n.compareRef(t) : n.signalRef(t.signal);
  {
    const r = e.expr || K1(i);
    return r && kne(t) ? n.exprRef(t.expr, t.as) : r && Dne(t) ? wf(t.field, t.as) : rF(i) ? wr(t, n) : $ne(i) ? Q(n.getData(t).values) : K1(i) ? wf(t) : oF(i) ? n.compareRef(t) : t;
  }
}
function Cne(e, t, n) {
  return je(t.from) || P('Lookup "from" parameter must be a string literal.'), n.getData(t.from).lookupRef(n, t.key);
}
function Fne(e, t, n) {
  const i = t[e.name];
  return e.array ? (J(i) || P("Expected an array of sub-parameters. Instead: " + te(i)), i.map((r) => iF(e, r, n))) : iF(e, i, n);
}
function iF(e, t, n) {
  const i = e.params.length;
  let r;
  for (let a = 0; a < i; ++a) {
    r = e.params[a];
    for (const s in r.key)
      if (r.key[s] !== t[s]) {
        r = null;
        break;
      }
    if (r)
      break;
  }
  r || P("Unsupported parameter: " + te(t));
  const o = de(sR(r, t, n), r.key);
  return Q(n.add(Ote(o)));
}
const kne = (e) => e && e.expr, Dne = (e) => e && e.field, $ne = (e) => e === "data", rF = (e) => e === "expr", K1 = (e) => e === "field", oF = (e) => e === "compare";
function Mne(e, t, n) {
  let i, r, o, a, s;
  return e ? (i = e.facet) && (t || P("Only group marks can be faceted."), i.field != null ? a = s = Yh(i, n) : (e.data ? s = Q(n.getData(e.data).aggregate) : (o = IE(de({
    type: "aggregate",
    groupby: oe(i.groupby)
  }, i.aggregate), n), o.params.key = n.keyRef(i.groupby), o.params.pulse = Yh(i, n), a = s = Q(n.add(o))), r = n.keyRef(i.groupby, !0))) : a = Q(n.add(Hi(null, [{}]))), a || (a = Yh(e, n)), {
    key: r,
    pulse: a,
    parent: s
  };
}
function Yh(e, t) {
  return e.$ref ? e : e.data && e.data.$ref ? e.data : Q(t.getData(e.data).output);
}
function $s(e, t, n, i, r) {
  this.scope = e, this.input = t, this.output = n, this.values = i, this.aggregate = r, this.index = {};
}
$s.fromEntries = function(e, t) {
  const n = t.length, i = t[n - 1], r = t[n - 2];
  let o = t[0], a = null, s = 1;
  for (o && o.type === "load" && (o = t[1]), e.add(t[0]); s < n; ++s)
    t[s].params.pulse = Q(t[s - 1]), e.add(t[s]), t[s].type === "aggregate" && (a = t[s]);
  return new $s(e, o, r, i, a);
};
function uR(e) {
  return je(e) ? e : null;
}
function aF(e, t, n) {
  const i = Wp(n.op, n.field);
  let r;
  if (t.ops) {
    for (let o = 0, a = t.as.length; o < a; ++o)
      if (t.as[o] === i)
        return;
  } else
    t.ops = ["count"], t.fields = [null], t.as = ["count"];
  n.op && (t.ops.push((r = n.op.signal) ? e.signalRef(r) : n.op), t.fields.push(e.fieldRef(n.field)), t.as.push(i));
}
function sc(e, t, n, i, r, o, a) {
  const s = t[n] || (t[n] = {}), u = tte(o);
  let l = uR(r), c, f;
  if (l != null && (e = t.scope, l = l + (u ? "|" + u : ""), c = s[l]), !c) {
    const d = o ? {
      field: ab,
      pulse: t.countsRef(e, r, o)
    } : {
      field: e.fieldRef(r),
      pulse: Q(t.output)
    };
    u && (d.sort = e.sortRef(o)), f = e.add(qp(i, void 0, d)), a && (t.index[r] = f), c = Q(f), l != null && (s[l] = c);
  }
  return c;
}
$s.prototype = {
  countsRef(e, t, n) {
    const i = this, r = i.counts || (i.counts = {}), o = uR(t);
    let a, s, u;
    return o != null && (e = i.scope, a = r[o]), a ? n && n.field && aF(e, a.agg.params, n) : (u = {
      groupby: e.fieldRef(t, "key"),
      pulse: Q(i.output)
    }, n && n.field && aF(e, u, n), s = e.add(H6(u)), a = e.add(Hi({
      pulse: Q(s)
    })), a = {
      agg: s,
      ref: Q(a)
    }, o != null && (r[o] = a)), a.ref;
  },
  tuplesRef() {
    return Q(this.values);
  },
  extentRef(e, t) {
    return sc(e, this, "extent", "extent", t, !1);
  },
  domainRef(e, t) {
    return sc(e, this, "domain", "values", t, !1);
  },
  valuesRef(e, t, n) {
    return sc(e, this, "vals", "values", t, n || !0);
  },
  lookupRef(e, t) {
    return sc(e, this, "lookup", "tupleindex", t, !1);
  },
  indataRef(e, t) {
    return sc(e, this, "indata", "tupleindex", t, !0, !0);
  }
};
function Tne(e, t, n) {
  const i = e.from.facet, r = i.name, o = Yh(i, t);
  let a;
  i.name || P("Facet must have a name: " + te(i)), i.data || P("Facet must reference a data set: " + te(i)), i.field ? a = t.add(V6({
    field: t.fieldRef(i.field),
    pulse: o
  })) : i.groupby ? a = t.add(mte({
    key: t.keyRef(i.groupby),
    group: Q(t.proxy(n.parent)),
    pulse: o
  })) : P("Facet must specify groupby or field: " + te(i));
  const s = t.fork(), u = s.add(Hi()), l = s.add(Vs({
    pulse: Q(u)
  }));
  s.addData(r, new $s(s, u, u, l)), s.addSignal("parent", null), a.params.subflow = {
    $subflow: s.parse(e).toRuntime()
  };
}
function Nne(e, t, n) {
  const i = t.add(V6({
    pulse: n.pulse
  })), r = t.fork();
  r.add(Vs()), r.addSignal("parent", null), i.params.subflow = {
    $subflow: r.parse(e).toRuntime()
  };
}
function lR(e, t, n) {
  const i = e.remove, r = e.insert, o = e.toggle, a = e.modify, s = e.values, u = t.add(m0()), l = "if(" + e.trigger + ',modify("' + n + '",' + [r, i, o, a, s].map((f) => f == null ? "null" : f).join(",") + "),0)", c = wr(l, t);
  u.update = c.$expr, u.params = c.$params;
}
function Vp(e, t) {
  const n = aR(e), i = e.type === Hp, r = e.from && e.from.facet, o = e.overlap;
  let a = e.layout || n === kE || n === FE, s, u, l, c, f, d, h;
  const g = n === CE || a || r, p = Mne(e.from, i, t);
  u = t.add(gte({
    key: p.key || (e.key ? wf(e.key) : void 0),
    pulse: p.pulse,
    clean: !i
  }));
  const m = Q(u);
  u = l = t.add(Hi({
    pulse: m
  })), u = t.add(wte({
    markdef: _ne(e),
    interactive: One(e.interactive, t),
    clip: Ane(e.clip, t),
    context: {
      $context: !0
    },
    groups: t.lookup(),
    parent: t.signals.parent ? t.signalRef("parent") : null,
    index: t.markpath(),
    pulse: Q(u)
  }));
  const y = Q(u);
  u = c = t.add(X6(W6(e.encode, e.type, n, e.style, t, {
    mod: !1,
    pulse: y
  }))), u.params.parent = t.encode(), e.transform && e.transform.forEach((A) => {
    const w = IE(A, t), _ = w.metadata;
    (_.generates || _.changes) && P("Mark transforms should not generate new data."), _.nomod || (c.params.mod = !0), w.params.pulse = Q(u), t.add(u = w);
  }), e.sort && (u = t.add(Dte({
    sort: t.compareRef(e.sort),
    pulse: Q(u)
  })));
  const v = Q(u);
  (r || a) && (a = t.add(J6({
    layout: t.objectProperty(e.layout),
    legends: t.legends,
    mark: y,
    pulse: v
  })), d = Q(a));
  const b = t.add(Y6({
    mark: y,
    pulse: d || v
  }));
  h = Q(b), i && (g && (s = t.operators, s.pop(), a && s.pop()), t.pushState(v, d || h, m), r ? Tne(e, t, p) : g ? Nne(e, t, p) : t.parse(e), t.popState(), g && (a && s.push(a), s.push(b))), o && (h = Rne(o, h, t));
  const x = t.add(K6({
    pulse: h
  })), E = t.add(Vs({
    pulse: Q(x)
  }, void 0, t.parent()));
  e.name != null && (f = e.name, t.addData(f, new $s(t, l, x, E)), e.on && e.on.forEach((A) => {
    (A.insert || A.remove || A.toggle) && P("Marks only support modify triggers."), lR(A, t, f);
  }));
}
function Rne(e, t, n) {
  const i = e.method, r = e.bound, o = e.separation, a = {
    separation: bt(o) ? n.signalRef(o.signal) : o,
    method: bt(i) ? n.signalRef(i.signal) : i,
    pulse: t
  };
  if (e.order && (a.sort = n.compareRef({
    field: e.order
  })), r) {
    const s = r.tolerance;
    a.boundTolerance = bt(s) ? n.signalRef(s.signal) : +s, a.boundScale = n.scaleRef(r.scale), a.boundOrient = r.orient;
  }
  return Q(n.add(_te(a)));
}
function jne(e, t) {
  const n = t.config.legend, i = e.encode || {}, r = Bn(e, n), o = i.legend || {}, a = o.name || void 0, s = o.interactive, u = o.style, l = {};
  let c = 0, f, d, h;
  NE.forEach((b) => e[b] ? (l[b] = e[b], c = c || e[b]) : 0), c || P("Missing valid scale for legend.");
  const g = Pne(e, t.scaleType(c)), p = {
    title: e.title != null,
    scales: l,
    type: g,
    vgrad: g !== "symbol" && r.isVertical()
  }, m = Q(t.add(Hi(null, [p]))), y = {
    enter: {
      x: {
        value: 0
      },
      y: {
        value: 0
      }
    }
  }, v = Q(t.add(bte(d = {
    type: g,
    scale: t.scaleRef(c),
    count: t.objectProperty(r("tickCount")),
    limit: t.property(r("symbolLimit")),
    values: t.objectProperty(e.values),
    minstep: t.property(e.tickMinStep),
    formatType: t.property(e.formatType),
    formatSpecifier: t.property(e.format)
  })));
  return g === Hh ? (h = [lne(e, c, n, i.gradient), eF(e, n, i.labels, v)], d.count = d.count || t.signalRef(`max(2,2*floor((${ps(r.gradientLength())})/100))`)) : g === cb ? h = [cne(e, c, n, i.gradient, v), eF(e, n, i.labels, v)] : (f = gne(e, n), h = [hne(e, n, i, v, ps(f.columns))], d.size = Bne(e, t, h[0].marks)), h = [Af({
    role: Ree,
    from: m,
    encode: y,
    marks: h,
    layout: f,
    interactive: s
  })], p.title && h.push(Ene(e, n, i.title, m)), Vp(Af({
    role: Tee,
    from: m,
    encode: kl(Ine(r, e, n), o, gd),
    marks: h,
    aria: r("aria"),
    description: r("description"),
    zindex: r("zindex"),
    name: a,
    interactive: s,
    style: u
  }), t);
}
function Pne(e, t) {
  let n = e.type || ZC;
  return !e.type && Lne(e) === 1 && (e.fill || e.stroke) && (n = j2(t) ? Hh : nv(t) ? cb : ZC), n !== Hh ? n : nv(t) ? cb : Hh;
}
function Lne(e) {
  return NE.reduce((t, n) => t + (e[n] ? 1 : 0), 0);
}
function Ine(e, t, n) {
  const i = {
    enter: {},
    update: {}
  };
  return jt(i, {
    orient: e("orient"),
    offset: e("offset"),
    padding: e("padding"),
    titlePadding: e("titlePadding"),
    cornerRadius: e("cornerRadius"),
    fill: e("fillColor"),
    stroke: e("strokeColor"),
    strokeWidth: n.strokeWidth,
    strokeDash: n.strokeDash,
    x: e("legendX"),
    y: e("legendY"),
    format: t.format,
    formatType: t.formatType
  }), i;
}
function Bne(e, t, n) {
  const i = ps(sF("size", e, n)), r = ps(sF("strokeWidth", e, n)), o = ps(zne(n[1].encode, t, hd));
  return wr(`max(ceil(sqrt(${i})+${r}),${o})`, t);
}
function sF(e, t, n) {
  return t[e] ? `scale("${t[e]}",datum)` : rR(e, n[0].encode);
}
function zne(e, t, n) {
  return rR("fontSize", e) || sne("fontSize", t, n);
}
const Une = `item.orient==="${Dl}"?-90:item.orient==="${$l}"?90:0`;
function qne(e, t) {
  e = je(e) ? {
    text: e
  } : e;
  const n = Bn(e, t.config.title), i = e.encode || {}, r = i.group || {}, o = r.name || void 0, a = r.interactive, s = r.style, u = [], l = {}, c = Q(t.add(Hi(null, [l])));
  return u.push(Hne(e, n, Wne(e), c)), e.subtitle && u.push(Yne(e, n, i.subtitle, c)), Vp(Af({
    role: Iee,
    from: c,
    encode: Gne(n, r),
    marks: u,
    aria: n("aria"),
    description: n("description"),
    zindex: n("zindex"),
    name: o,
    interactive: a,
    style: s
  }), t);
}
function Wne(e) {
  const t = e.encode;
  return t && t.title || de({
    name: e.name,
    interactive: e.interactive,
    style: e.style
  }, t);
}
function Gne(e, t) {
  const n = {
    enter: {},
    update: {}
  };
  return jt(n, {
    orient: e("orient"),
    anchor: e("anchor"),
    align: {
      signal: jE
    },
    angle: {
      signal: Une
    },
    limit: e("limit"),
    frame: e("frame"),
    offset: e("offset") || 0,
    padding: e("subtitlePadding")
  }), kl(n, t, gd);
}
function Hne(e, t, n, i) {
  const r = {
    value: 0
  }, o = e.text, a = {
    enter: {
      opacity: r
    },
    update: {
      opacity: {
        value: 1
      }
    },
    exit: {
      opacity: r
    }
  };
  return jt(a, {
    text: o,
    align: {
      signal: "item.mark.group.align"
    },
    angle: {
      signal: "item.mark.group.angle"
    },
    limit: {
      signal: "item.mark.group.limit"
    },
    baseline: "top",
    dx: t("dx"),
    dy: t("dy"),
    fill: t("color"),
    font: t("font"),
    fontSize: t("fontSize"),
    fontStyle: t("fontStyle"),
    fontWeight: t("fontWeight"),
    lineHeight: t("lineHeight")
  }, {
    align: t("align"),
    angle: t("angle"),
    baseline: t("baseline")
  }), Zn({
    type: Ks,
    role: Bee,
    style: Qte,
    from: i,
    encode: a
  }, n);
}
function Yne(e, t, n, i) {
  const r = {
    value: 0
  }, o = e.subtitle, a = {
    enter: {
      opacity: r
    },
    update: {
      opacity: {
        value: 1
      }
    },
    exit: {
      opacity: r
    }
  };
  return jt(a, {
    text: o,
    align: {
      signal: "item.mark.group.align"
    },
    angle: {
      signal: "item.mark.group.angle"
    },
    limit: {
      signal: "item.mark.group.limit"
    },
    baseline: "top",
    dx: t("dx"),
    dy: t("dy"),
    fill: t("subtitleColor"),
    font: t("subtitleFont"),
    fontSize: t("subtitleFontSize"),
    fontStyle: t("subtitleFontStyle"),
    fontWeight: t("subtitleFontWeight"),
    lineHeight: t("subtitleLineHeight")
  }, {
    align: t("align"),
    angle: t("angle"),
    baseline: t("baseline")
  }), Zn({
    type: Ks,
    role: zee,
    style: Zte,
    from: i,
    encode: a
  }, n);
}
function Xne(e, t) {
  const n = [];
  e.transform && e.transform.forEach((i) => {
    n.push(IE(i, t));
  }), e.on && e.on.forEach((i) => {
    lR(i, t, e.name);
  }), t.addDataPipeline(e.name, Vne(e, t, n));
}
function Vne(e, t, n) {
  const i = [];
  let r = null, o = !1, a = !1, s, u, l, c, f;
  for (e.values ? bt(e.values) || Wh(e.format) ? (i.push(uF(t, e)), i.push(r = Ia())) : i.push(r = Ia({
    $ingest: e.values,
    $format: e.format
  })) : e.url ? Wh(e.url) || Wh(e.format) ? (i.push(uF(t, e)), i.push(r = Ia())) : i.push(r = Ia({
    $request: e.url,
    $format: e.format
  })) : e.source && (r = s = oe(e.source).map((d) => Q(t.getData(d).output)), i.push(null)), u = 0, l = n.length; u < l; ++u)
    c = n[u], f = c.metadata, !r && !f.source && i.push(r = Ia()), i.push(c), f.generates && (a = !0), f.modifies && !a && (o = !0), f.source ? r = c : f.changes && (r = null);
  return s && (l = s.length - 1, i[0] = Fte({
    derive: o,
    pulse: l ? s : s[0]
  }), (o || l) && i.splice(1, 0, Ia())), r || i.push(Ia()), i.push(Vs({})), i;
}
function Ia(e) {
  const t = Hi({}, e);
  return t.metadata = {
    source: !0
  }, t;
}
function uF(e, t) {
  return xte({
    url: t.url ? e.property(t.url) : void 0,
    async: t.async ? e.property(t.async) : void 0,
    values: t.values ? e.property(t.values) : void 0,
    format: e.objectProperty(t.format)
  });
}
const cR = (e) => e === ga || e === Yi, Kp = (e, t, n) => bt(e) ? Zne(e.signal, t, n) : e === Dl || e === Yi ? t : n, Ft = (e, t, n) => bt(e) ? Jne(e.signal, t, n) : cR(e) ? t : n, Li = (e, t, n) => bt(e) ? Qne(e.signal, t, n) : cR(e) ? n : t, fR = (e, t, n) => bt(e) ? eie(e.signal, t, n) : e === Yi ? {
  value: t
} : {
  value: n
}, Kne = (e, t, n) => bt(e) ? tie(e.signal, t, n) : e === $l ? {
  value: t
} : {
  value: n
}, Jne = (e, t, n) => dR(`${e} === '${Yi}' || ${e} === '${ga}'`, t, n), Qne = (e, t, n) => dR(`${e} !== '${Yi}' && ${e} !== '${ga}'`, t, n), Zne = (e, t, n) => BE(`${e} === '${Dl}' || ${e} === '${Yi}'`, t, n), eie = (e, t, n) => BE(`${e} === '${Yi}'`, t, n), tie = (e, t, n) => BE(`${e} === '${$l}'`, t, n), dR = (e, t, n) => (t = t != null ? Ct(t) : t, n = n != null ? Ct(n) : n, lF(t) && lF(n) ? (t = t ? t.signal || te(t.value) : null, n = n ? n.signal || te(n.value) : null, {
  signal: `${e} ? (${t}) : (${n})`
}) : [de({
  test: e
}, t)].concat(n || [])), lF = (e) => e == null || Object.keys(e).length === 1, BE = (e, t, n) => ({
  signal: `${e} ? (${Fu(t)}) : (${Fu(n)})`
}), nie = (e, t, n, i, r) => ({
  signal: (i != null ? `${e} === '${Dl}' ? (${Fu(i)}) : ` : "") + (n != null ? `${e} === '${ga}' ? (${Fu(n)}) : ` : "") + (r != null ? `${e} === '${$l}' ? (${Fu(r)}) : ` : "") + (t != null ? `${e} === '${Yi}' ? (${Fu(t)}) : ` : "") + "(null)"
}), Fu = (e) => bt(e) ? e.signal : e == null ? null : te(e), iie = (e, t) => t === 0 ? 0 : bt(e) ? {
  signal: `(${e.signal}) * ${t}`
} : {
  value: e * t
}, Nu = (e, t) => {
  const n = e.signal;
  return n && n.endsWith("(null)") ? {
    signal: n.slice(0, -6) + t.signal
  } : e;
};
function mu(e, t, n, i) {
  let r;
  if (t && ae(t, e))
    return t[e];
  if (ae(n, e))
    return n[e];
  if (e.startsWith("title")) {
    switch (e) {
      case "titleColor":
        r = "fill";
        break;
      case "titleFont":
      case "titleFontSize":
      case "titleFontWeight":
        r = e[5].toLowerCase() + e.slice(6);
    }
    return i[TE][r];
  } else if (e.startsWith("label")) {
    switch (e) {
      case "labelColor":
        r = "fill";
        break;
      case "labelFont":
      case "labelFontSize":
        r = e[5].toLowerCase() + e.slice(6);
    }
    return i[hd][r];
  }
  return null;
}
function cF(e) {
  const t = {};
  for (const n of e)
    if (!!n)
      for (const i in n)
        t[i] = 1;
  return Object.keys(t);
}
function rie(e, t) {
  var n = t.config, i = n.style, r = n.axis, o = t.scaleType(e.scale) === "band" && n.axisBand, a = e.orient, s, u, l;
  if (bt(a)) {
    const f = cF([n.axisX, n.axisY]), d = cF([n.axisTop, n.axisBottom, n.axisLeft, n.axisRight]);
    s = {};
    for (l of f)
      s[l] = Ft(a, mu(l, n.axisX, r, i), mu(l, n.axisY, r, i));
    u = {};
    for (l of d)
      u[l] = nie(a.signal, mu(l, n.axisTop, r, i), mu(l, n.axisBottom, r, i), mu(l, n.axisLeft, r, i), mu(l, n.axisRight, r, i));
  } else
    s = a === Yi || a === ga ? n.axisX : n.axisY, u = n["axis" + a[0].toUpperCase() + a.slice(1)];
  return s || u || o ? de({}, r, s, u, o) : r;
}
function oie(e, t, n, i) {
  const r = Bn(e, t), o = e.orient;
  let a, s;
  const u = {
    enter: a = {
      opacity: Ee
    },
    update: s = {
      opacity: li
    },
    exit: {
      opacity: Ee
    }
  };
  jt(u, {
    stroke: r("domainColor"),
    strokeCap: r("domainCap"),
    strokeDash: r("domainDash"),
    strokeDashOffset: r("domainDashOffset"),
    strokeWidth: r("domainWidth"),
    strokeOpacity: r("domainOpacity")
  });
  const l = fF(e, 0), c = fF(e, 1);
  return a.x = s.x = Ft(o, l, Ee), a.x2 = s.x2 = Ft(o, c), a.y = s.y = Li(o, l, Ee), a.y2 = s.y2 = Li(o, c), Zn({
    type: RE,
    role: Fee,
    from: i,
    encode: u
  }, n);
}
function fF(e, t) {
  return {
    scale: e.scale,
    range: t
  };
}
function aie(e, t, n, i, r) {
  const o = Bn(e, t), a = e.orient, s = e.gridScale, u = Kp(a, 1, -1), l = sie(e.offset, u);
  let c, f, d;
  const h = {
    enter: c = {
      opacity: Ee
    },
    update: d = {
      opacity: li
    },
    exit: f = {
      opacity: Ee
    }
  };
  jt(h, {
    stroke: o("gridColor"),
    strokeCap: o("gridCap"),
    strokeDash: o("gridDash"),
    strokeDashOffset: o("gridDashOffset"),
    strokeOpacity: o("gridOpacity"),
    strokeWidth: o("gridWidth")
  });
  const g = {
    scale: e.scale,
    field: ui,
    band: r.band,
    extra: r.extra,
    offset: r.offset,
    round: o("tickRound")
  }, p = Ft(a, {
    signal: "height"
  }, {
    signal: "width"
  }), m = s ? {
    scale: s,
    range: 0,
    mult: u,
    offset: l
  } : {
    value: 0,
    offset: l
  }, y = s ? {
    scale: s,
    range: 1,
    mult: u,
    offset: l
  } : de(p, {
    mult: u,
    offset: l
  });
  return c.x = d.x = Ft(a, g, m), c.y = d.y = Li(a, g, m), c.x2 = d.x2 = Li(a, y), c.y2 = d.y2 = Ft(a, y), f.x = Ft(a, g), f.y = Li(a, g), Zn({
    type: RE,
    role: kee,
    key: ui,
    from: i,
    encode: h
  }, n);
}
function sie(e, t) {
  if (t !== 1)
    if (!ce(e))
      e = bt(t) ? {
        signal: `(${t.signal}) * (${e || 0})`
      } : t * (e || 0);
    else {
      let n = e = de({}, e);
      for (; n.mult != null; )
        if (ce(n.mult))
          n = n.mult = de({}, n.mult);
        else
          return n.mult = bt(t) ? {
            signal: `(${n.mult}) * (${t.signal})`
          } : n.mult * t, e;
      n.mult = t;
    }
  return e;
}
function uie(e, t, n, i, r, o) {
  const a = Bn(e, t), s = e.orient, u = Kp(s, -1, 1);
  let l, c, f;
  const d = {
    enter: l = {
      opacity: Ee
    },
    update: f = {
      opacity: li
    },
    exit: c = {
      opacity: Ee
    }
  };
  jt(d, {
    stroke: a("tickColor"),
    strokeCap: a("tickCap"),
    strokeDash: a("tickDash"),
    strokeDashOffset: a("tickDashOffset"),
    strokeOpacity: a("tickOpacity"),
    strokeWidth: a("tickWidth")
  });
  const h = Ct(r);
  h.mult = u;
  const g = {
    scale: e.scale,
    field: ui,
    band: o.band,
    extra: o.extra,
    offset: o.offset,
    round: a("tickRound")
  };
  return f.y = l.y = Ft(s, Ee, g), f.y2 = l.y2 = Ft(s, h), c.x = Ft(s, g), f.x = l.x = Li(s, Ee, g), f.x2 = l.x2 = Li(s, h), c.y = Li(s, g), Zn({
    type: RE,
    role: $ee,
    key: ui,
    from: i,
    encode: d
  }, n);
}
function J1(e, t, n, i, r) {
  return {
    signal: 'flush(range("' + e + '"), scale("' + e + '", datum.value), ' + t + "," + n + "," + i + "," + r + ")"
  };
}
function lie(e, t, n, i, r, o) {
  const a = Bn(e, t), s = e.orient, u = e.scale, l = Kp(s, -1, 1), c = ps(a("labelFlush")), f = ps(a("labelFlushOffset")), d = a("labelAlign"), h = a("labelBaseline");
  let g = c === 0 || !!c, p;
  const m = Ct(r);
  m.mult = l, m.offset = Ct(a("labelPadding") || 0), m.offset.mult = l;
  const y = {
    scale: u,
    field: ui,
    band: 0.5,
    offset: oR(o.offset, a("labelOffset"))
  }, v = Ft(s, g ? J1(u, c, '"left"', '"right"', '"center"') : {
    value: "center"
  }, Kne(s, "left", "right")), b = Ft(s, fR(s, "bottom", "top"), g ? J1(u, c, '"top"', '"bottom"', '"middle"') : {
    value: "middle"
  }), x = J1(u, c, `-(${f})`, f, 0);
  g = g && f;
  const E = {
    opacity: Ee,
    x: Ft(s, y, m),
    y: Li(s, y, m)
  }, A = {
    enter: E,
    update: p = {
      opacity: li,
      text: {
        field: ME
      },
      x: E.x,
      y: E.y,
      align: v,
      baseline: b
    },
    exit: {
      opacity: Ee,
      x: E.x,
      y: E.y
    }
  };
  jt(A, {
    dx: !d && g ? Ft(s, x) : null,
    dy: !h && g ? Li(s, x) : null
  }), jt(A, {
    angle: a("labelAngle"),
    fill: a("labelColor"),
    fillOpacity: a("labelOpacity"),
    font: a("labelFont"),
    fontSize: a("labelFontSize"),
    fontWeight: a("labelFontWeight"),
    fontStyle: a("labelFontStyle"),
    limit: a("labelLimit"),
    lineHeight: a("labelLineHeight")
  }, {
    align: d,
    baseline: h
  });
  const w = a("labelBound");
  let _ = a("labelOverlap");
  return _ = _ || w ? {
    separation: a("labelSeparation"),
    method: _,
    order: "datum.index",
    bound: w ? {
      scale: u,
      orient: s,
      tolerance: w
    } : null
  } : void 0, p.align !== v && (p.align = Nu(p.align, v)), p.baseline !== b && (p.baseline = Nu(p.baseline, b)), Zn({
    type: Ks,
    role: Dee,
    style: hd,
    key: ui,
    from: i,
    encode: A,
    overlap: _
  }, n);
}
function cie(e, t, n, i) {
  const r = Bn(e, t), o = e.orient, a = Kp(o, -1, 1);
  let s, u;
  const l = {
    enter: s = {
      opacity: Ee,
      anchor: Ct(r("titleAnchor", null)),
      align: {
        signal: jE
      }
    },
    update: u = de({}, s, {
      opacity: li,
      text: Ct(e.title)
    }),
    exit: {
      opacity: Ee
    }
  }, c = {
    signal: `lerp(range("${e.scale}"), ${Yp(0, 1, 0.5)})`
  };
  return u.x = Ft(o, c), u.y = Li(o, c), s.angle = Ft(o, Ee, iie(a, 90)), s.baseline = Ft(o, fR(o, ga, Yi), {
    value: ga
  }), u.angle = s.angle, u.baseline = s.baseline, jt(l, {
    fill: r("titleColor"),
    fillOpacity: r("titleOpacity"),
    font: r("titleFont"),
    fontSize: r("titleFontSize"),
    fontStyle: r("titleFontStyle"),
    fontWeight: r("titleFontWeight"),
    limit: r("titleLimit"),
    lineHeight: r("titleLineHeight")
  }, {
    align: r("titleAlign"),
    angle: r("titleAngle"),
    baseline: r("titleBaseline")
  }), fie(r, o, l, n), l.update.align = Nu(l.update.align, s.align), l.update.angle = Nu(l.update.angle, s.angle), l.update.baseline = Nu(l.update.baseline, s.baseline), Zn({
    type: Ks,
    role: Mee,
    style: TE,
    from: i,
    encode: l
  }, n);
}
function fie(e, t, n, i) {
  const r = (s, u) => s != null ? (n.update[u] = Nu(Ct(s), n.update[u]), !1) : !wu(u, i), o = r(e("titleX"), "x"), a = r(e("titleY"), "y");
  n.enter.auto = a === o ? Ct(a) : Ft(t, Ct(a), Ct(o));
}
function die(e, t) {
  const n = rie(e, t), i = e.encode || {}, r = i.axis || {}, o = r.name || void 0, a = r.interactive, s = r.style, u = Bn(e, n), l = une(u), c = {
    scale: e.scale,
    ticks: !!u("ticks"),
    labels: !!u("labels"),
    grid: !!u("grid"),
    domain: !!u("domain"),
    title: e.title != null
  }, f = Q(t.add(Hi({}, [c]))), d = Q(t.add(hte({
    scale: t.scaleRef(e.scale),
    extra: t.property(l.extra),
    count: t.objectProperty(e.tickCount),
    values: t.objectProperty(e.values),
    minstep: t.property(e.tickMinStep),
    formatType: t.property(e.formatType),
    formatSpecifier: t.property(e.format)
  }))), h = [];
  let g;
  return c.grid && h.push(aie(e, n, i.grid, d, l)), c.ticks && (g = u("tickSize"), h.push(uie(e, n, i.ticks, d, g, l))), c.labels && (g = c.ticks ? g : 0, h.push(lie(e, n, i.labels, d, g, l))), c.domain && h.push(oie(e, n, i.domain, f)), c.title && h.push(cie(e, n, i.title, f)), Vp(Af({
    role: Cee,
    from: f,
    encode: kl(hie(u, e), r, gd),
    marks: h,
    aria: u("aria"),
    description: u("description"),
    zindex: u("zindex"),
    name: o,
    interactive: a,
    style: s
  }), t);
}
function hie(e, t) {
  const n = {
    enter: {},
    update: {}
  };
  return jt(n, {
    orient: e("orient"),
    offset: e("offset") || 0,
    position: _i(t.position, 0),
    titlePadding: e("titlePadding"),
    minExtent: e("minExtent"),
    maxExtent: e("maxExtent"),
    range: {
      signal: `abs(span(range("${t.scale}")))`
    },
    translate: e("translate"),
    format: t.format,
    formatType: t.formatType
  }), n;
}
function hR(e, t, n) {
  const i = oe(e.signals), r = oe(e.scales);
  return n || i.forEach((o) => G6(o, t)), oe(e.projections).forEach((o) => Gte(o, t)), r.forEach((o) => Tte(o, t)), oe(e.data).forEach((o) => Xne(o, t)), r.forEach((o) => Nte(o, t)), (n || i).forEach((o) => dte(o, t)), oe(e.axes).forEach((o) => die(o, t)), oe(e.marks).forEach((o) => Vp(o, t)), oe(e.legends).forEach((o) => jne(o, t)), e.title && qne(e.title, t), t.parseLambdas(), t;
}
const gie = (e) => kl({
  enter: {
    x: {
      value: 0
    },
    y: {
      value: 0
    }
  },
  update: {
    width: {
      signal: "width"
    },
    height: {
      signal: "height"
    }
  }
}, e);
function pie(e, t) {
  const n = t.config, i = Q(t.root = t.add(m0())), r = mie(e, n);
  r.forEach((l) => G6(l, t)), t.description = e.description || n.description, t.eventConfig = n.events, t.legends = t.objectProperty(n.legend && n.legend.layout), t.locale = n.locale;
  const o = t.add(Hi()), a = t.add(X6(W6(gie(e.encode), Hp, FE, e.style, t, {
    pulse: Q(o)
  }))), s = t.add(J6({
    layout: t.objectProperty(e.layout),
    legends: t.legends,
    autosize: t.signalRef("autosize"),
    mark: i,
    pulse: Q(a)
  }));
  t.operators.pop(), t.pushState(Q(a), Q(s), null), hR(e, t, r), t.operators.push(s);
  let u = t.add(Y6({
    mark: i,
    pulse: Q(s)
  }));
  return u = t.add(K6({
    pulse: Q(u)
  })), u = t.add(Vs({
    pulse: Q(u)
  })), t.addData("root", new $s(t, o, o, u)), t;
}
function uc(e, t) {
  return t && t.signal ? {
    name: e,
    update: t.signal
  } : {
    name: e,
    value: t
  };
}
function mie(e, t) {
  const n = (a) => _i(e[a], t[a]), i = [uc("background", n("background")), uc("autosize", _ee(n("autosize"))), uc("padding", See(n("padding"))), uc("width", n("width") || 0), uc("height", n("height") || 0)], r = i.reduce((a, s) => (a[s.name] = s, a), {}), o = {};
  return oe(e.signals).forEach((a) => {
    ae(r, a.name) ? a = de(r[a.name], a) : i.push(a), o[a.name] = a;
  }), oe(t.signals).forEach((a) => {
    !ae(o, a.name) && !ae(r, a.name) && i.push(a);
  }), i;
}
function gR(e, t) {
  this.config = e || {}, this.options = t || {}, this.bindings = [], this.field = {}, this.signals = {}, this.lambdas = {}, this.scales = {}, this.events = {}, this.data = {}, this.streams = [], this.updates = [], this.operators = [], this.eventConfig = null, this.locale = null, this._id = 0, this._subid = 0, this._nextsub = [0], this._parent = [], this._encode = [], this._lookup = [], this._markpath = [];
}
function dF(e) {
  this.config = e.config, this.options = e.options, this.legends = e.legends, this.field = Object.create(e.field), this.signals = Object.create(e.signals), this.lambdas = Object.create(e.lambdas), this.scales = Object.create(e.scales), this.events = Object.create(e.events), this.data = Object.create(e.data), this.streams = [], this.updates = [], this.operators = [], this._id = 0, this._subid = ++e._nextsub[0], this._nextsub = e._nextsub, this._parent = e._parent.slice(), this._encode = e._encode.slice(), this._lookup = e._lookup.slice(), this._markpath = e._markpath;
}
gR.prototype = dF.prototype = {
  parse(e) {
    return hR(e, this);
  },
  fork() {
    return new dF(this);
  },
  isSubscope() {
    return this._subid > 0;
  },
  toRuntime() {
    return this.finish(), {
      description: this.description,
      operators: this.operators,
      streams: this.streams,
      updates: this.updates,
      bindings: this.bindings,
      eventConfig: this.eventConfig,
      locale: this.locale
    };
  },
  id() {
    return (this._subid ? this._subid + ":" : 0) + this._id++;
  },
  add(e) {
    return this.operators.push(e), e.id = this.id(), e.refs && (e.refs.forEach((t) => {
      t.$ref = e.id;
    }), e.refs = null), e;
  },
  proxy(e) {
    const t = e instanceof ob ? Q(e) : e;
    return this.add(Cte({
      value: t
    }));
  },
  addStream(e) {
    return this.streams.push(e), e.id = this.id(), e;
  },
  addUpdate(e) {
    return this.updates.push(e), e;
  },
  finish() {
    let e, t;
    this.root && (this.root.root = !0);
    for (e in this.signals)
      this.signals[e].signal = e;
    for (e in this.scales)
      this.scales[e].scale = e;
    function n(i, r, o) {
      let a, s;
      i && (a = i.data || (i.data = {}), s = a[r] || (a[r] = []), s.push(o));
    }
    for (e in this.data) {
      t = this.data[e], n(t.input, e, "input"), n(t.output, e, "output"), n(t.values, e, "values");
      for (const i in t.index)
        n(t.index[i], e, "index:" + i);
    }
    return this;
  },
  pushState(e, t, n) {
    this._encode.push(Q(this.add(Vs({
      pulse: e
    })))), this._parent.push(t), this._lookup.push(n ? Q(this.proxy(n)) : null), this._markpath.push(-1);
  },
  popState() {
    this._encode.pop(), this._parent.pop(), this._lookup.pop(), this._markpath.pop();
  },
  parent() {
    return xe(this._parent);
  },
  encode() {
    return xe(this._encode);
  },
  lookup() {
    return xe(this._lookup);
  },
  markpath() {
    const e = this._markpath;
    return ++e[e.length - 1];
  },
  fieldRef(e, t) {
    if (je(e))
      return wf(e, t);
    e.signal || P("Unsupported field reference: " + te(e));
    const n = e.signal;
    let i = this.field[n];
    if (!i) {
      const r = {
        name: this.signalRef(n)
      };
      t && (r.as = t), this.field[n] = i = Q(this.add(yte(r)));
    }
    return i;
  },
  compareRef(e) {
    let t = !1;
    const n = (o) => bt(o) ? (t = !0, this.signalRef(o.signal)) : nte(o) ? (t = !0, this.exprRef(o.expr)) : o, i = oe(e.field).map(n), r = oe(e.order).map(n);
    return t ? Q(this.add(QC({
      fields: i,
      orders: r
    }))) : KC(i, r);
  },
  keyRef(e, t) {
    let n = !1;
    const i = (o) => bt(o) ? (n = !0, Q(r[o.signal])) : o, r = this.signals;
    return e = oe(e).map(i), n ? Q(this.add(vte({
      fields: e,
      flat: t
    }))) : Qee(e, t);
  },
  sortRef(e) {
    if (!e)
      return e;
    const t = Wp(e.op, e.field), n = e.order || Zee;
    return n.signal ? Q(this.add(QC({
      fields: t,
      orders: this.signalRef(n.signal)
    }))) : KC(t, n);
  },
  event(e, t) {
    const n = e + ":" + t;
    if (!this.events[n]) {
      const i = this.id();
      this.streams.push({
        id: i,
        source: e,
        type: t
      }), this.events[n] = i;
    }
    return this.events[n];
  },
  hasOwnSignal(e) {
    return ae(this.signals, e);
  },
  addSignal(e, t) {
    this.hasOwnSignal(e) && P("Duplicate signal name: " + te(e));
    const n = t instanceof ob ? t : this.add(m0(t));
    return this.signals[e] = n;
  },
  getSignal(e) {
    return this.signals[e] || P("Unrecognized signal name: " + te(e)), this.signals[e];
  },
  signalRef(e) {
    return this.signals[e] ? Q(this.signals[e]) : (ae(this.lambdas, e) || (this.lambdas[e] = this.add(m0(null))), Q(this.lambdas[e]));
  },
  parseLambdas() {
    const e = Object.keys(this.lambdas);
    for (let t = 0, n = e.length; t < n; ++t) {
      const i = e[t], r = wr(i, this), o = this.lambdas[i];
      o.params = r.$params, o.update = r.$expr;
    }
  },
  property(e) {
    return e && e.signal ? this.signalRef(e.signal) : e;
  },
  objectProperty(e) {
    return !e || !ce(e) ? e : this.signalRef(e.signal || zE(e));
  },
  exprRef(e, t) {
    const n = {
      expr: wr(e, this)
    };
    return t && (n.expr.$name = t), Q(this.add(pte(n)));
  },
  addBinding(e, t) {
    this.bindings || P("Nested signals do not support binding: " + te(e)), this.bindings.push(de({
      signal: e
    }, t));
  },
  addScaleProj(e, t) {
    ae(this.scales, e) && P("Duplicate scale or projection name: " + te(e)), this.scales[e] = this.add(t);
  },
  addScale(e, t) {
    this.addScaleProj(e, kte(t));
  },
  addProjection(e, t) {
    this.addScaleProj(e, Ste(t));
  },
  getScale(e) {
    return this.scales[e] || P("Unrecognized scale name: " + te(e)), this.scales[e];
  },
  scaleRef(e) {
    return Q(this.getScale(e));
  },
  scaleType(e) {
    return this.getScale(e).params.type;
  },
  projectionRef(e) {
    return this.scaleRef(e);
  },
  projectionType(e) {
    return this.scaleType(e);
  },
  addData(e, t) {
    return ae(this.data, e) && P("Duplicate data set name: " + te(e)), this.data[e] = t;
  },
  getData(e) {
    return this.data[e] || P("Undefined data set name: " + te(e)), this.data[e];
  },
  addDataPipeline(e, t) {
    return ae(this.data, e) && P("Duplicate data set name: " + te(e)), this.addData(e, $s.fromEntries(this, t));
  }
};
function zE(e) {
  return (J(e) ? yie : vie)(e);
}
function yie(e) {
  const t = e.length;
  let n = "[";
  for (let i = 0; i < t; ++i) {
    const r = e[i];
    n += (i > 0 ? "," : "") + (ce(r) ? r.signal || zE(r) : te(r));
  }
  return n + "]";
}
function vie(e) {
  let t = "{", n = 0, i, r;
  for (i in e)
    r = e[i], t += (++n > 1 ? "," : "") + te(i) + ":" + (ce(r) ? r.signal || zE(r) : te(r));
  return t + "}";
}
function bie() {
  const e = "sans-serif", i = "#4c78a8", r = "#000", o = "#888", a = "#ddd";
  return {
    description: "Vega visualization",
    padding: 0,
    autosize: "pad",
    background: null,
    events: {
      defaults: {
        allow: ["wheel"]
      }
    },
    group: null,
    mark: null,
    arc: {
      fill: i
    },
    area: {
      fill: i
    },
    image: null,
    line: {
      stroke: i,
      strokeWidth: 2
    },
    path: {
      stroke: i
    },
    rect: {
      fill: i
    },
    rule: {
      stroke: r
    },
    shape: {
      stroke: i
    },
    symbol: {
      fill: i,
      size: 64
    },
    text: {
      fill: r,
      font: e,
      fontSize: 11
    },
    trail: {
      fill: i,
      size: 2
    },
    style: {
      "guide-label": {
        fill: r,
        font: e,
        fontSize: 10
      },
      "guide-title": {
        fill: r,
        font: e,
        fontSize: 11,
        fontWeight: "bold"
      },
      "group-title": {
        fill: r,
        font: e,
        fontSize: 13,
        fontWeight: "bold"
      },
      "group-subtitle": {
        fill: r,
        font: e,
        fontSize: 12
      },
      point: {
        size: 30,
        strokeWidth: 2,
        shape: "circle"
      },
      circle: {
        size: 30,
        strokeWidth: 2
      },
      square: {
        size: 30,
        strokeWidth: 2,
        shape: "square"
      },
      cell: {
        fill: "transparent",
        stroke: a
      }
    },
    title: {
      orient: "top",
      anchor: "middle",
      offset: 4,
      subtitlePadding: 3
    },
    axis: {
      minExtent: 0,
      maxExtent: 200,
      bandPosition: 0.5,
      domain: !0,
      domainWidth: 1,
      domainColor: o,
      grid: !1,
      gridWidth: 1,
      gridColor: a,
      labels: !0,
      labelAngle: 0,
      labelLimit: 180,
      labelOffset: 0,
      labelPadding: 2,
      ticks: !0,
      tickColor: o,
      tickOffset: 0,
      tickRound: !0,
      tickSize: 5,
      tickWidth: 1,
      titlePadding: 4
    },
    axisBand: {
      tickOffset: -0.5
    },
    projection: {
      type: "mercator"
    },
    legend: {
      orient: "right",
      padding: 0,
      gridAlign: "each",
      columnPadding: 10,
      rowPadding: 2,
      symbolDirection: "vertical",
      gradientDirection: "vertical",
      gradientLength: 200,
      gradientThickness: 16,
      gradientStrokeColor: a,
      gradientStrokeWidth: 0,
      gradientLabelOffset: 2,
      labelAlign: "left",
      labelBaseline: "middle",
      labelLimit: 160,
      labelOffset: 4,
      labelOverlap: !0,
      symbolLimit: 30,
      symbolType: "circle",
      symbolSize: 100,
      symbolOffset: 0,
      symbolStrokeWidth: 1.5,
      symbolBaseFillColor: "transparent",
      symbolBaseStrokeColor: o,
      titleLimit: 180,
      titleOrient: "top",
      titlePadding: 5,
      layout: {
        offset: 18,
        direction: "horizontal",
        left: {
          direction: "vertical"
        },
        right: {
          direction: "vertical"
        }
      }
    },
    range: {
      category: {
        scheme: "tableau10"
      },
      ordinal: {
        scheme: "blues"
      },
      heatmap: {
        scheme: "yellowgreenblue"
      },
      ramp: {
        scheme: "blues"
      },
      diverging: {
        scheme: "blueorange",
        extent: [1, 0]
      },
      symbol: ["circle", "square", "triangle-up", "cross", "diamond", "triangle-right", "triangle-down", "triangle-left"]
    }
  };
}
function xie(e, t, n) {
  return ce(e) || P("Input Vega specification must be an object."), t = z0(bie(), t, e.config), pie(e, new gR(t, n)).toRuntime();
}
var wie = "5.22.1";
de(Wu, SI, HW, _G, lY, iX, DV, lV, MV, tK, fK, vK);
const Eie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  version: wie,
  Dataflow: Du,
  EventStream: Z0,
  MultiPulse: Ax,
  Operator: qe,
  Parameters: Q0,
  Pulse: Qo,
  Transform: N,
  changeset: Gs,
  definition: J3,
  ingest: Te,
  isTuple: K0,
  transform: Q3,
  transforms: Wu,
  tupleid: Z,
  interpolate: P2,
  interpolateColors: yp,
  interpolateRange: KM,
  quantizeInterpolator: JM,
  scale: De,
  scheme: L2,
  projection: Rw,
  View: $6,
  defaultLocale: vx,
  formatLocale: cg,
  locale: L3,
  resetDefaultLocale: SP,
  timeFormatLocale: nf,
  expressionFunction: gt,
  parse: xie,
  runtimeContext: v6,
  codegenExpression: o6,
  parseExpression: n6,
  parseSelector: L6,
  Debug: lD,
  Error: Hb,
  Info: uD,
  None: aD,
  Warn: sD,
  accessor: In,
  accessorFields: Yt,
  accessorName: ot,
  array: oe,
  ascending: G0,
  clampRange: wD,
  compare: Kb,
  constant: Zt,
  debounce: Jb,
  error: P,
  extend: de,
  extent: vr,
  extentIndex: ED,
  falsy: ko,
  fastmap: bl,
  field: Mn,
  flush: AD,
  hasOwnProperty: ae,
  id: Pf,
  identity: mn,
  inherits: q,
  inrange: Au,
  isArray: J,
  isBoolean: Qb,
  isDate: Vo,
  isFunction: he,
  isIterable: _D,
  isNumber: na,
  isObject: ce,
  isRegExp: OD,
  isString: je,
  key: Zb,
  lerp: SD,
  logger: cD,
  lruCache: CD,
  merge: FD,
  mergeConfig: z0,
  one: vl,
  pad: kD,
  panLinear: pD,
  panLog: mD,
  panPow: yD,
  panSymlog: vD,
  peek: xe,
  quarter: bD,
  repeat: gc,
  span: Lf,
  splitAccessPath: B0,
  stringValue: te,
  toBoolean: ex,
  toDate: tx,
  toNumber: Wt,
  toSet: zi,
  toString: nx,
  truncate: DD,
  truthy: ci,
  utcquarter: xD,
  visitArray: Mo,
  writeConfig: U0,
  zero: Lo,
  zoomLinear: Yb,
  zoomLog: Xb,
  zoomPow: tg,
  zoomSymlog: Vb,
  bandwidthNRD: Cx,
  bin: e$,
  bootstrapCI: t$,
  cumulativeLogNormal: Tx,
  cumulativeNormal: tp,
  cumulativeUniform: Px,
  densityLogNormal: Mx,
  densityNormal: Fx,
  densityUniform: jx,
  dotbin: n$,
  quantileLogNormal: Nx,
  quantileNormal: np,
  quantileUniform: Lx,
  quantiles: Ox,
  quartiles: Sx,
  get random() {
    return di;
  },
  randomInteger: DL,
  randomKDE: Dx,
  randomLCG: kL,
  randomLogNormal: r$,
  randomMixture: o$,
  randomNormal: kx,
  randomUniform: a$,
  regressionExp: u$,
  regressionLinear: Ix,
  regressionLoess: f$,
  regressionLog: s$,
  regressionPoly: c$,
  regressionPow: l$,
  regressionQuad: Bx,
  sampleCurve: rp,
  sampleLogNormal: $x,
  sampleNormal: ep,
  sampleUniform: Rx,
  setRandom: CL,
  DATE: Nn,
  DAY: qt,
  DAYOFYEAR: br,
  HOURS: Kn,
  MILLISECONDS: Ui,
  MINUTES: Jn,
  MONTH: Xt,
  QUARTER: Tn,
  SECONDS: fi,
  TIME_UNITS: hx,
  WEEK: yt,
  YEAR: Rt,
  dayofyear: s3,
  timeBin: _3,
  timeFloor: g3,
  timeInterval: El,
  timeOffset: y3,
  timeSequence: x3,
  timeUnitSpecifier: a3,
  timeUnits: gx,
  utcFloor: p3,
  utcInterval: Al,
  utcOffset: v3,
  utcSequence: w3,
  utcdayofyear: c3,
  utcweek: f3,
  week: u3,
  format: Oh,
  formats: wx,
  inferType: B3,
  inferTypes: z3,
  loader: X0,
  read: W3,
  responseType: q3,
  typeParsers: qy,
  path: xa,
  Bounds: dt,
  CanvasHandler: rd,
  CanvasRenderer: Dg,
  Gradient: c5,
  GroupItem: xp,
  Handler: da,
  Item: bp,
  Marks: Qn,
  RenderType: Wo,
  Renderer: Fr,
  ResourceLoader: G2,
  SVGHandler: lw,
  SVGRenderer: pw,
  SVGStringRenderer: mw,
  Scenegraph: sw,
  boundClip: rT,
  boundContext: ed,
  boundItem: lv,
  boundMark: k5,
  boundStroke: yo,
  domChild: Cn,
  domClear: ki,
  domCreate: Uo,
  domFind: uw,
  font: Op,
  fontFamily: id,
  fontSize: Cr,
  intersect: eT,
  intersectBoxLine: _u,
  intersectPath: H2,
  intersectPoint: Y2,
  intersectRule: v5,
  lineHeight: ca,
  markup: gw,
  multiLineOffset: rw,
  pathCurves: U2,
  pathEqual: oT,
  pathParse: Ku,
  pathRectangle: h5,
  pathRender: lf,
  pathSymbols: d5,
  pathTrail: g5,
  point: Cp,
  renderModule: Fp,
  resetSVGClipId: m5,
  resetSVGDefIds: uW,
  sceneEqual: yw,
  sceneFromJSON: $5,
  scenePickVisit: _g,
  sceneToJSON: D5,
  sceneVisit: qi,
  sceneZOrder: X2,
  serializeXML: H5,
  textMetrics: Pi
}, Symbol.toStringTag, { value: "Module" }));
function Aie(e, t, n) {
  let i;
  t.x2 && (t.x ? (n && e.x > e.x2 && (i = e.x, e.x = e.x2, e.x2 = i), e.width = e.x2 - e.x) : e.x = e.x2 - (e.width || 0)), t.xc && (e.x = e.xc - (e.width || 0) / 2), t.y2 && (t.y ? (n && e.y > e.y2 && (i = e.y, e.y = e.y2, e.y2 = i), e.height = e.y2 - e.y) : e.y = e.y2 - (e.height || 0)), t.yc && (e.y = e.yc - (e.height || 0) / 2);
}
var _ie = {
  NaN: NaN,
  E: Math.E,
  LN2: Math.LN2,
  LN10: Math.LN10,
  LOG2E: Math.LOG2E,
  LOG10E: Math.LOG10E,
  PI: Math.PI,
  SQRT1_2: Math.SQRT1_2,
  SQRT2: Math.SQRT2,
  MIN_VALUE: Number.MIN_VALUE,
  MAX_VALUE: Number.MAX_VALUE
}, Oie = {
  "*": (e, t) => e * t,
  "+": (e, t) => e + t,
  "-": (e, t) => e - t,
  "/": (e, t) => e / t,
  "%": (e, t) => e % t,
  ">": (e, t) => e > t,
  "<": (e, t) => e < t,
  "<=": (e, t) => e <= t,
  ">=": (e, t) => e >= t,
  "==": (e, t) => e == t,
  "!=": (e, t) => e != t,
  "===": (e, t) => e === t,
  "!==": (e, t) => e !== t,
  "&": (e, t) => e & t,
  "|": (e, t) => e | t,
  "^": (e, t) => e ^ t,
  "<<": (e, t) => e << t,
  ">>": (e, t) => e >> t,
  ">>>": (e, t) => e >>> t
}, Sie = {
  "+": (e) => +e,
  "-": (e) => -e,
  "~": (e) => ~e,
  "!": (e) => !e
};
const Cie = Array.prototype.slice, Ba = (e, t, n) => {
  const i = n ? n(t[0]) : t[0];
  return i[e].apply(i, Cie.call(t, 1));
}, Fie = (e, t, n, i, r, o, a) => new Date(e, t || 0, n != null ? n : 1, i || 0, r || 0, o || 0, a || 0);
var kie = {
  isNaN: Number.isNaN,
  isFinite: Number.isFinite,
  abs: Math.abs,
  acos: Math.acos,
  asin: Math.asin,
  atan: Math.atan,
  atan2: Math.atan2,
  ceil: Math.ceil,
  cos: Math.cos,
  exp: Math.exp,
  floor: Math.floor,
  log: Math.log,
  max: Math.max,
  min: Math.min,
  pow: Math.pow,
  random: Math.random,
  round: Math.round,
  sin: Math.sin,
  sqrt: Math.sqrt,
  tan: Math.tan,
  clamp: (e, t, n) => Math.max(t, Math.min(n, e)),
  now: Date.now,
  utc: Date.UTC,
  datetime: Fie,
  date: (e) => new Date(e).getDate(),
  day: (e) => new Date(e).getDay(),
  year: (e) => new Date(e).getFullYear(),
  month: (e) => new Date(e).getMonth(),
  hours: (e) => new Date(e).getHours(),
  minutes: (e) => new Date(e).getMinutes(),
  seconds: (e) => new Date(e).getSeconds(),
  milliseconds: (e) => new Date(e).getMilliseconds(),
  time: (e) => new Date(e).getTime(),
  timezoneoffset: (e) => new Date(e).getTimezoneOffset(),
  utcdate: (e) => new Date(e).getUTCDate(),
  utcday: (e) => new Date(e).getUTCDay(),
  utcyear: (e) => new Date(e).getUTCFullYear(),
  utcmonth: (e) => new Date(e).getUTCMonth(),
  utchours: (e) => new Date(e).getUTCHours(),
  utcminutes: (e) => new Date(e).getUTCMinutes(),
  utcseconds: (e) => new Date(e).getUTCSeconds(),
  utcmilliseconds: (e) => new Date(e).getUTCMilliseconds(),
  length: (e) => e.length,
  join: function() {
    return Ba("join", arguments);
  },
  indexof: function() {
    return Ba("indexOf", arguments);
  },
  lastindexof: function() {
    return Ba("lastIndexOf", arguments);
  },
  slice: function() {
    return Ba("slice", arguments);
  },
  reverse: (e) => e.slice().reverse(),
  parseFloat,
  parseInt,
  upper: (e) => String(e).toUpperCase(),
  lower: (e) => String(e).toLowerCase(),
  substring: function() {
    return Ba("substring", arguments, String);
  },
  split: function() {
    return Ba("split", arguments, String);
  },
  replace: function() {
    return Ba("replace", arguments, String);
  },
  trim: (e) => String(e).trim(),
  regexp: RegExp,
  test: (e, t) => RegExp(e).test(t)
};
const Die = ["view", "item", "group", "xy", "x", "y"], $ie = {
  Literal: (e, t) => t.value,
  Identifier: (e, t) => {
    const n = t.name;
    return e.memberDepth > 0 ? n : n === "datum" ? e.datum : n === "event" ? e.event : n === "item" ? e.item : _ie[n] || e.params["$" + n];
  },
  MemberExpression: (e, t) => {
    const n = !t.computed, i = e(t.object);
    n && (e.memberDepth += 1);
    const r = e(t.property);
    return n && (e.memberDepth -= 1), i[r];
  },
  CallExpression: (e, t) => {
    const n = t.arguments;
    let i = t.callee.name;
    return i.startsWith("_") && (i = i.slice(1)), i === "if" ? e(n[0]) ? e(n[1]) : e(n[2]) : (e.fn[i] || kie[i]).apply(e.fn, n.map(e));
  },
  ArrayExpression: (e, t) => t.elements.map(e),
  BinaryExpression: (e, t) => Oie[t.operator](e(t.left), e(t.right)),
  UnaryExpression: (e, t) => Sie[t.operator](e(t.argument)),
  ConditionalExpression: (e, t) => e(t.test) ? e(t.consequent) : e(t.alternate),
  LogicalExpression: (e, t) => t.operator === "&&" ? e(t.left) && e(t.right) : e(t.left) || e(t.right),
  ObjectExpression: (e, t) => t.properties.reduce((n, i) => {
    e.memberDepth += 1;
    const r = e(i.key);
    return e.memberDepth -= 1, n[r] = e(i.value), n;
  }, {})
};
function lc(e, t, n, i, r, o) {
  const a = (s) => $ie[s.type](a, s);
  return a.memberDepth = 0, a.fn = Object.create(t), a.params = n, a.datum = i, a.event = r, a.item = o, Die.forEach((s) => a.fn[s] = (...u) => r.vega[s](...u)), a(e);
}
var Mie = {
  operator(e, t) {
    const n = t.ast, i = e.functions;
    return (r) => lc(n, i, r);
  },
  parameter(e, t) {
    const n = t.ast, i = e.functions;
    return (r, o) => lc(n, i, o, r);
  },
  event(e, t) {
    const n = t.ast, i = e.functions;
    return (r) => lc(n, i, void 0, void 0, r);
  },
  handler(e, t) {
    const n = t.ast, i = e.functions;
    return (r, o) => {
      const a = o.item && o.item.datum;
      return lc(n, i, r, a, o);
    };
  },
  encode(e, t) {
    const {
      marktype: n,
      channels: i
    } = t, r = e.functions, o = n === "group" || n === "image" || n === "rect";
    return (a, s) => {
      const u = a.datum;
      let l = 0, c;
      for (const f in i)
        c = lc(i[f].ast, r, s, u, void 0, a), a[f] !== c && (a[f] = c, l = 1);
      return n !== "rule" && Aie(a, i, o), l;
    };
  }
};
const Tie = "4.17.0";
function Ml(e, t, n) {
  return e.fields = t || [], e.fname = n, e;
}
function Nie(e) {
  return e.length === 1 ? Rie(e[0]) : jie(e);
}
const Rie = (e) => function(t) {
  return t[e];
}, jie = (e) => {
  const t = e.length;
  return function(n) {
    for (let i = 0; i < t; ++i)
      n = n[e[i]];
    return n;
  };
};
function Q1(e) {
  throw Error(e);
}
function Js(e) {
  const t = [], n = e.length;
  let i = null, r = 0, o = "", a, s, u;
  e = e + "";
  function l() {
    t.push(o + e.substring(a, s)), o = "", a = s + 1;
  }
  for (a = s = 0; s < n; ++s)
    if (u = e[s], u === "\\")
      o += e.substring(a, s), o += e.substring(++s, ++s), a = s;
    else if (u === i)
      l(), i = null, r = -1;
    else {
      if (i)
        continue;
      a === r && u === '"' || a === r && u === "'" ? (a = s + 1, i = u) : u === "." && !r ? s > a ? l() : a = s + 1 : u === "[" ? (s > a && l(), r = a = s + 1) : u === "]" && (r || Q1("Access path missing open bracket: " + e), r > 0 && l(), r = 0, a = s + 1);
    }
  return r && Q1("Access path missing closing bracket: " + e), i && Q1("Access path missing closing quote: " + e), s > a && (s++, l()), t;
}
function Pie(e, t, n) {
  const i = Js(e);
  return e = i.length === 1 ? i[0] : e, Ml((n && n.get || Nie)(i), [e], t || e);
}
Pie("id");
const Lie = Ml((e) => e, [], "identity");
Ml(() => 0, [], "zero");
Ml(() => 1, [], "one");
Ml(() => !0, [], "true");
Ml(() => !1, [], "false");
function ch(e, t, n) {
  const i = [t].concat([].slice.call(n));
  console[e].apply(console, i);
}
const Iie = 0, Bie = 1, pR = 2, zie = 3, Uie = 4;
function qie(e, t) {
  let n = e || Iie;
  return {
    level(i) {
      return arguments.length ? (n = +i, this) : n;
    },
    error() {
      return n >= Bie && ch(t || "error", "ERROR", arguments), this;
    },
    warn() {
      return n >= pR && ch(t || "warn", "WARN", arguments), this;
    },
    info() {
      return n >= zie && ch(t || "log", "INFO", arguments), this;
    },
    debug() {
      return n >= Uie && ch(t || "log", "DEBUG", arguments), this;
    }
  };
}
var K = Array.isArray;
function ut(e) {
  return e === Object(e);
}
const hF = (e) => e !== "__proto__";
function mR(...e) {
  return e.reduce((t, n) => {
    for (const i in n)
      if (i === "signals")
        t.signals = Wie(t.signals, n.signals);
      else {
        const r = i === "legend" ? {
          layout: 1
        } : i === "style" ? !0 : null;
        UE(t, i, n[i], r);
      }
    return t;
  }, {});
}
function UE(e, t, n, i) {
  if (!hF(t))
    return;
  let r, o;
  if (ut(n) && !K(n)) {
    o = ut(e[t]) ? e[t] : e[t] = {};
    for (r in n)
      i && (i === !0 || i[r]) ? UE(o, r, n[r]) : hF(r) && (o[r] = n[r]);
  } else
    e[t] = n;
}
function Wie(e, t) {
  if (e == null)
    return t;
  const n = {}, i = [];
  function r(o) {
    n[o.name] || (n[o.name] = 1, i.push(o));
  }
  return t.forEach(r), e.forEach(r), i;
}
function lt(e) {
  return e != null ? K(e) ? e : [e] : [];
}
function Gie(e) {
  return typeof e == "function";
}
const Hie = Object.prototype.hasOwnProperty;
function ku(e, t) {
  return Hie.call(e, t);
}
function pd(e) {
  return typeof e == "boolean";
}
function ht(e) {
  return typeof e == "number";
}
function ge(e) {
  return typeof e == "string";
}
function _e(e) {
  return K(e) ? "[" + e.map(_e) + "]" : ut(e) || ge(e) ? JSON.stringify(e).replace("\u2028", "\\u2028").replace("\u2029", "\\u2029") : e;
}
function Qs(e) {
  const t = {}, n = e.length;
  for (let i = 0; i < n; ++i)
    t[e[i]] = !0;
  return t;
}
Array.prototype.flat || Object.defineProperty(Array.prototype, "flat", { configurable: !0, value: function e() {
  var t = isNaN(arguments[0]) ? 1 : Number(arguments[0]);
  return t ? Array.prototype.reduce.call(this, function(n, i) {
    return Array.isArray(i) ? n.push.apply(n, e.call(i, t - 1)) : n.push(i), n;
  }, []) : Array.prototype.slice.call(this);
}, writable: !0 }), Array.prototype.flatMap || Object.defineProperty(Array.prototype, "flatMap", { configurable: !0, value: function(e) {
  return Array.prototype.map.apply(this, arguments).flat();
}, writable: !0 });
var yR = { exports: {} };
(function(e) {
  var t = function() {
    function n(d, h) {
      return h != null && d instanceof h;
    }
    var i;
    try {
      i = Map;
    } catch {
      i = function() {
      };
    }
    var r;
    try {
      r = Set;
    } catch {
      r = function() {
      };
    }
    var o;
    try {
      o = Promise;
    } catch {
      o = function() {
      };
    }
    function a(d, h, g, p, m) {
      typeof h == "object" && (g = h.depth, p = h.prototype, m = h.includeNonEnumerable, h = h.circular);
      var y = [], v = [], b = typeof Buffer < "u";
      typeof h > "u" && (h = !0), typeof g > "u" && (g = 1 / 0);
      function x(E, A) {
        if (E === null)
          return null;
        if (A === 0)
          return E;
        var w, _;
        if (typeof E != "object")
          return E;
        if (n(E, i))
          w = new i();
        else if (n(E, r))
          w = new r();
        else if (n(E, o))
          w = new o(function(T, L) {
            E.then(function(I) {
              T(x(I, A - 1));
            }, function(I) {
              L(x(I, A - 1));
            });
          });
        else if (a.__isArray(E))
          w = [];
        else if (a.__isRegExp(E))
          w = new RegExp(E.source, f(E)), E.lastIndex && (w.lastIndex = E.lastIndex);
        else if (a.__isDate(E))
          w = new Date(E.getTime());
        else {
          if (b && Buffer.isBuffer(E))
            return Buffer.allocUnsafe ? w = Buffer.allocUnsafe(E.length) : w = new Buffer(E.length), E.copy(w), w;
          n(E, Error) ? w = Object.create(E) : typeof p > "u" ? (_ = Object.getPrototypeOf(E), w = Object.create(_)) : (w = Object.create(p), _ = p);
        }
        if (h) {
          var k = y.indexOf(E);
          if (k != -1)
            return v[k];
          y.push(E), v.push(w);
        }
        n(E, i) && E.forEach(function(T, L) {
          var I = x(L, A - 1), Y = x(T, A - 1);
          w.set(I, Y);
        }), n(E, r) && E.forEach(function(T) {
          var L = x(T, A - 1);
          w.add(L);
        });
        for (var C in E) {
          var O;
          _ && (O = Object.getOwnPropertyDescriptor(_, C)), !(O && O.set == null) && (w[C] = x(E[C], A - 1));
        }
        if (Object.getOwnPropertySymbols)
          for (var S = Object.getOwnPropertySymbols(E), C = 0; C < S.length; C++) {
            var D = S[C], M = Object.getOwnPropertyDescriptor(E, D);
            M && !M.enumerable && !m || (w[D] = x(E[D], A - 1), M.enumerable || Object.defineProperty(w, D, {
              enumerable: !1
            }));
          }
        if (m)
          for (var F = Object.getOwnPropertyNames(E), C = 0; C < F.length; C++) {
            var $ = F[C], M = Object.getOwnPropertyDescriptor(E, $);
            M && M.enumerable || (w[$] = x(E[$], A - 1), Object.defineProperty(w, $, {
              enumerable: !1
            }));
          }
        return w;
      }
      return x(d, g);
    }
    a.clonePrototype = function(h) {
      if (h === null)
        return null;
      var g = function() {
      };
      return g.prototype = h, new g();
    };
    function s(d) {
      return Object.prototype.toString.call(d);
    }
    a.__objToStr = s;
    function u(d) {
      return typeof d == "object" && s(d) === "[object Date]";
    }
    a.__isDate = u;
    function l(d) {
      return typeof d == "object" && s(d) === "[object Array]";
    }
    a.__isArray = l;
    function c(d) {
      return typeof d == "object" && s(d) === "[object RegExp]";
    }
    a.__isRegExp = c;
    function f(d) {
      var h = "";
      return d.global && (h += "g"), d.ignoreCase && (h += "i"), d.multiline && (h += "m"), h;
    }
    return a.__getRegExpFlags = f, a;
  }();
  e.exports && (e.exports = t);
})(yR);
const Yie = yR.exports;
var Xie = function e(t, n) {
  if (t === n)
    return !0;
  if (t && n && typeof t == "object" && typeof n == "object") {
    if (t.constructor !== n.constructor)
      return !1;
    var i, r, o;
    if (Array.isArray(t)) {
      if (i = t.length, i != n.length)
        return !1;
      for (r = i; r-- !== 0; )
        if (!e(t[r], n[r]))
          return !1;
      return !0;
    }
    if (t.constructor === RegExp)
      return t.source === n.source && t.flags === n.flags;
    if (t.valueOf !== Object.prototype.valueOf)
      return t.valueOf() === n.valueOf();
    if (t.toString !== Object.prototype.toString)
      return t.toString() === n.toString();
    if (o = Object.keys(t), i = o.length, i !== Object.keys(n).length)
      return !1;
    for (r = i; r-- !== 0; )
      if (!Object.prototype.hasOwnProperty.call(n, o[r]))
        return !1;
    for (r = i; r-- !== 0; ) {
      var a = o[r];
      if (!e(t[a], n[a]))
        return !1;
    }
    return !0;
  }
  return t !== t && n !== n;
}, _f = function(e, t) {
  t || (t = {}), typeof t == "function" && (t = { cmp: t });
  var n = typeof t.cycles == "boolean" ? t.cycles : !1, i = t.cmp && function(o) {
    return function(a) {
      return function(s, u) {
        var l = { key: s, value: a[s] }, c = { key: u, value: a[u] };
        return o(l, c);
      };
    };
  }(t.cmp), r = [];
  return function o(a) {
    if (a && a.toJSON && typeof a.toJSON == "function" && (a = a.toJSON()), a !== void 0) {
      if (typeof a == "number")
        return isFinite(a) ? "" + a : "null";
      if (typeof a != "object")
        return JSON.stringify(a);
      var s, u;
      if (Array.isArray(a)) {
        for (u = "[", s = 0; s < a.length; s++)
          s && (u += ","), u += o(a[s]) || "null";
        return u + "]";
      }
      if (a === null)
        return "null";
      if (r.indexOf(a) !== -1) {
        if (n)
          return JSON.stringify("__cycle__");
        throw new TypeError("Converting circular structure to JSON");
      }
      var l = r.push(a) - 1, c = Object.keys(a).sort(i && i(a));
      for (u = "", s = 0; s < c.length; s++) {
        var f = c[s], d = o(a[f]);
        !d || (u && (u += ","), u += JSON.stringify(f) + ":" + d);
      }
      return r.splice(l, 1), "{" + u + "}";
    }
  }(e);
};
function qE(e) {
  return !!e.or;
}
function WE(e) {
  return !!e.and;
}
function GE(e) {
  return !!e.not;
}
function Xh(e, t) {
  if (GE(e))
    Xh(e.not, t);
  else if (WE(e))
    for (const n of e.and)
      Xh(n, t);
  else if (qE(e))
    for (const n of e.or)
      Xh(n, t);
  else
    t(e);
}
function Vh(e, t) {
  return GE(e) ? { not: Vh(e.not, t) } : WE(e) ? { and: e.and.map((n) => Vh(n, t)) } : qE(e) ? { or: e.or.map((n) => Vh(n, t)) } : t(e);
}
const Tl = Xie, pe = Yie;
function al(e, t) {
  const n = {};
  for (const i of t)
    ku(e, i) && (n[i] = e[i]);
  return n;
}
function Xn(e, t) {
  const n = Object.assign({}, e);
  for (const i of t)
    delete n[i];
  return n;
}
Set.prototype.toJSON = function() {
  return `Set(${[...this].map((e) => _f(e)).join(",")})`;
};
const Ge = _f;
function we(e) {
  if (ht(e))
    return e;
  const t = ge(e) ? e : _f(e);
  if (t.length < 250)
    return t;
  let n = 0;
  for (let i = 0; i < t.length; i++) {
    const r = t.charCodeAt(i);
    n = (n << 5) - n + r, n = n & n;
  }
  return n;
}
function db(e) {
  return e === !1 || e === null;
}
function ie(e, t) {
  return e.indexOf(t) > -1;
}
function sl(e, t) {
  let n = 0;
  for (const [i, r] of e.entries())
    if (t(r, i, n++))
      return !0;
  return !1;
}
function HE(e, t) {
  let n = 0;
  for (const [i, r] of e.entries())
    if (!t(r, i, n++))
      return !1;
  return !0;
}
function vR(e, ...t) {
  for (const n of t)
    Vie(e, n != null ? n : {});
  return e;
}
function Vie(e, t) {
  for (const n of B(t))
    UE(e, n, t[n], !0);
}
function lr(e, t) {
  const n = [], i = {};
  let r;
  for (const o of e)
    r = t(o), !(r in i) && (i[r] = 1, n.push(o));
  return n;
}
function Kie(e, t) {
  const n = B(e), i = B(t);
  if (n.length !== i.length)
    return !1;
  for (const r of n)
    if (e[r] !== t[r])
      return !1;
  return !0;
}
function bR(e, t) {
  if (e.size !== t.size)
    return !1;
  for (const n of e)
    if (!t.has(n))
      return !1;
  return !0;
}
function YE(e, t) {
  for (const n of e)
    if (t.has(n))
      return !0;
  return !1;
}
function hb(e) {
  const t = /* @__PURE__ */ new Set();
  for (const n of e) {
    const r = Js(n).map((a, s) => s === 0 ? a : `[${a}]`), o = r.map((a, s) => r.slice(0, s + 1).join(""));
    for (const a of o)
      t.add(a);
  }
  return t;
}
function XE(e, t) {
  return e === void 0 || t === void 0 ? !0 : YE(hb(e), hb(t));
}
function Ie(e) {
  return B(e).length === 0;
}
const B = Object.keys, oo = Object.values, md = Object.entries;
function Of(e) {
  return e === !0 || e === !1;
}
function Xe(e) {
  const t = e.replace(/\W/g, "_");
  return (e.match(/^\d+/) ? "_" : "") + t;
}
function Ru(e, t) {
  return GE(e) ? "!(" + Ru(e.not, t) + ")" : WE(e) ? "(" + e.and.map((n) => Ru(n, t)).join(") && (") + ")" : qE(e) ? "(" + e.or.map((n) => Ru(n, t)).join(") || (") + ")" : t(e);
}
function y0(e, t) {
  if (t.length === 0)
    return !0;
  const n = t.shift();
  return n in e && y0(e[n], t) && delete e[n], Ie(e);
}
function yd(e) {
  return e.charAt(0).toUpperCase() + e.substr(1);
}
function VE(e, t = "datum") {
  const n = Js(e), i = [];
  for (let r = 1; r <= n.length; r++) {
    const o = `[${n.slice(0, r).map(_e).join("][")}]`;
    i.push(`${t}${o}`);
  }
  return i.join(" && ");
}
function xR(e, t = "datum") {
  return `${t}[${_e(Js(e).join("."))}]`;
}
function Jie(e) {
  return e.replace(/(\[|\]|\.|'|")/g, "\\$1");
}
function go(e) {
  return `${Js(e).map(Jie).join("\\.")}`;
}
function Ms(e, t, n) {
  return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"), "g"), n);
}
function KE(e) {
  return `${Js(e).join(".")}`;
}
function ul(e) {
  return e ? Js(e).length : 0;
}
function ct(...e) {
  for (const t of e)
    if (t !== void 0)
      return t;
}
let wR = 42;
function ER(e) {
  const t = ++wR;
  return e ? String(e) + t : t;
}
function Qie() {
  wR = 42;
}
function AR(e) {
  return _R(e) ? e : `__${e}`;
}
function _R(e) {
  return e.indexOf("__") === 0;
}
function Sf(e) {
  if (e !== void 0)
    return (e % 360 + 360) % 360;
}
function Jp(e) {
  return ht(e) ? !0 : !isNaN(e) && !isNaN(parseFloat(e));
}
const gF = {
  labelAlign: {
    part: "labels",
    vgProp: "align"
  },
  labelBaseline: {
    part: "labels",
    vgProp: "baseline"
  },
  labelColor: {
    part: "labels",
    vgProp: "fill"
  },
  labelFont: {
    part: "labels",
    vgProp: "font"
  },
  labelFontSize: {
    part: "labels",
    vgProp: "fontSize"
  },
  labelFontStyle: {
    part: "labels",
    vgProp: "fontStyle"
  },
  labelFontWeight: {
    part: "labels",
    vgProp: "fontWeight"
  },
  labelOpacity: {
    part: "labels",
    vgProp: "opacity"
  },
  labelOffset: null,
  labelPadding: null,
  gridColor: {
    part: "grid",
    vgProp: "stroke"
  },
  gridDash: {
    part: "grid",
    vgProp: "strokeDash"
  },
  gridDashOffset: {
    part: "grid",
    vgProp: "strokeDashOffset"
  },
  gridOpacity: {
    part: "grid",
    vgProp: "opacity"
  },
  gridWidth: {
    part: "grid",
    vgProp: "strokeWidth"
  },
  tickColor: {
    part: "ticks",
    vgProp: "stroke"
  },
  tickDash: {
    part: "ticks",
    vgProp: "strokeDash"
  },
  tickDashOffset: {
    part: "ticks",
    vgProp: "strokeDashOffset"
  },
  tickOpacity: {
    part: "ticks",
    vgProp: "opacity"
  },
  tickSize: null,
  tickWidth: {
    part: "ticks",
    vgProp: "strokeWidth"
  }
};
function vd(e) {
  return e && e.condition;
}
const OR = ["domain", "grid", "labels", "ticks", "title"], Zie = {
  grid: "grid",
  gridCap: "grid",
  gridColor: "grid",
  gridDash: "grid",
  gridDashOffset: "grid",
  gridOpacity: "grid",
  gridScale: "grid",
  gridWidth: "grid",
  orient: "main",
  bandPosition: "both",
  aria: "main",
  description: "main",
  domain: "main",
  domainCap: "main",
  domainColor: "main",
  domainDash: "main",
  domainDashOffset: "main",
  domainOpacity: "main",
  domainWidth: "main",
  format: "main",
  formatType: "main",
  labelAlign: "main",
  labelAngle: "main",
  labelBaseline: "main",
  labelBound: "main",
  labelColor: "main",
  labelFlush: "main",
  labelFlushOffset: "main",
  labelFont: "main",
  labelFontSize: "main",
  labelFontStyle: "main",
  labelFontWeight: "main",
  labelLimit: "main",
  labelLineHeight: "main",
  labelOffset: "main",
  labelOpacity: "main",
  labelOverlap: "main",
  labelPadding: "main",
  labels: "main",
  labelSeparation: "main",
  maxExtent: "main",
  minExtent: "main",
  offset: "both",
  position: "main",
  tickCap: "main",
  tickColor: "main",
  tickDash: "main",
  tickDashOffset: "main",
  tickMinStep: "main",
  tickOffset: "both",
  tickOpacity: "main",
  tickRound: "both",
  ticks: "main",
  tickSize: "main",
  tickWidth: "both",
  title: "main",
  titleAlign: "main",
  titleAnchor: "main",
  titleAngle: "main",
  titleBaseline: "main",
  titleColor: "main",
  titleFont: "main",
  titleFontSize: "main",
  titleFontStyle: "main",
  titleFontWeight: "main",
  titleLimit: "main",
  titleLineHeight: "main",
  titleOpacity: "main",
  titlePadding: "main",
  titleX: "main",
  titleY: "main",
  encode: "both",
  scale: "both",
  tickBand: "both",
  tickCount: "both",
  tickExtra: "both",
  translate: "both",
  values: "both",
  zindex: "both"
}, SR = {
  orient: 1,
  aria: 1,
  bandPosition: 1,
  description: 1,
  domain: 1,
  domainCap: 1,
  domainColor: 1,
  domainDash: 1,
  domainDashOffset: 1,
  domainOpacity: 1,
  domainWidth: 1,
  format: 1,
  formatType: 1,
  grid: 1,
  gridCap: 1,
  gridColor: 1,
  gridDash: 1,
  gridDashOffset: 1,
  gridOpacity: 1,
  gridWidth: 1,
  labelAlign: 1,
  labelAngle: 1,
  labelBaseline: 1,
  labelBound: 1,
  labelColor: 1,
  labelFlush: 1,
  labelFlushOffset: 1,
  labelFont: 1,
  labelFontSize: 1,
  labelFontStyle: 1,
  labelFontWeight: 1,
  labelLimit: 1,
  labelLineHeight: 1,
  labelOffset: 1,
  labelOpacity: 1,
  labelOverlap: 1,
  labelPadding: 1,
  labels: 1,
  labelSeparation: 1,
  maxExtent: 1,
  minExtent: 1,
  offset: 1,
  position: 1,
  tickBand: 1,
  tickCap: 1,
  tickColor: 1,
  tickCount: 1,
  tickDash: 1,
  tickDashOffset: 1,
  tickExtra: 1,
  tickMinStep: 1,
  tickOffset: 1,
  tickOpacity: 1,
  tickRound: 1,
  ticks: 1,
  tickSize: 1,
  tickWidth: 1,
  title: 1,
  titleAlign: 1,
  titleAnchor: 1,
  titleAngle: 1,
  titleBaseline: 1,
  titleColor: 1,
  titleFont: 1,
  titleFontSize: 1,
  titleFontStyle: 1,
  titleFontWeight: 1,
  titleLimit: 1,
  titleLineHeight: 1,
  titleOpacity: 1,
  titlePadding: 1,
  titleX: 1,
  titleY: 1,
  translate: 1,
  values: 1,
  zindex: 1
}, ere = Object.assign(Object.assign({}, SR), { style: 1, labelExpr: 1, encoding: 1 });
function pF(e) {
  return !!ere[e];
}
const tre = {
  axis: 1,
  axisBand: 1,
  axisBottom: 1,
  axisDiscrete: 1,
  axisLeft: 1,
  axisPoint: 1,
  axisQuantitative: 1,
  axisRight: 1,
  axisTemporal: 1,
  axisTop: 1,
  axisX: 1,
  axisXBand: 1,
  axisXDiscrete: 1,
  axisXPoint: 1,
  axisXQuantitative: 1,
  axisXTemporal: 1,
  axisY: 1,
  axisYBand: 1,
  axisYDiscrete: 1,
  axisYPoint: 1,
  axisYQuantitative: 1,
  axisYTemporal: 1
}, CR = B(tre), nre = {
  argmax: 1,
  argmin: 1,
  average: 1,
  count: 1,
  distinct: 1,
  product: 1,
  max: 1,
  mean: 1,
  median: 1,
  min: 1,
  missing: 1,
  q1: 1,
  q3: 1,
  ci0: 1,
  ci1: 1,
  stderr: 1,
  stdev: 1,
  stdevp: 1,
  sum: 1,
  valid: 1,
  values: 1,
  variance: 1,
  variancep: 1
}, ire = {
  count: 1,
  min: 1,
  max: 1
};
function po(e) {
  return !!e && !!e.argmin;
}
function Sa(e) {
  return !!e && !!e.argmax;
}
function JE(e) {
  return ge(e) && !!nre[e];
}
const rre = ["count", "valid", "missing", "distinct"];
function FR(e) {
  return ge(e) && ie(rre, e);
}
function ore(e) {
  return ge(e) && ie(["min", "max"], e);
}
const are = ["count", "sum", "distinct", "valid", "missing"], sre = ["mean", "average", "median", "q1", "q3", "min", "max"], ure = Qs(sre);
var bd = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
const ao = "row", so = "column", Qp = "facet", et = "x", xt = "y", Xi = "x2", $r = "y2", Mr = "radius", xo = "radius2", Vi = "theta", wo = "theta2", Tr = "latitude", Nr = "longitude", Ki = "latitude2", gi = "longitude2", jn = "color", Rr = "fill", jr = "stroke", Pn = "shape", Eo = "size", Zs = "angle", Ao = "opacity", Ca = "fillOpacity", Fa = "strokeOpacity", ka = "strokeWidth", Da = "strokeDash", xd = "text", wd = "order", Ed = "detail", Zp = "key", Ts = "tooltip", em = "href", tm = "url", nm = "description", lre = {
  x: 1,
  y: 1,
  x2: 1,
  y2: 1
}, kR = {
  theta: 1,
  theta2: 1,
  radius: 1,
  radius2: 1
};
function DR(e) {
  return e in kR;
}
const QE = {
  longitude: 1,
  longitude2: 1,
  latitude: 1,
  latitude2: 1
};
function cre(e) {
  switch (e) {
    case Tr:
      return "y";
    case Ki:
      return "y2";
    case Nr:
      return "x";
    case gi:
      return "x2";
  }
}
function fre(e) {
  return e in QE;
}
const dre = B(QE), $R = Object.assign(Object.assign(Object.assign(Object.assign({}, lre), kR), QE), {
  color: 1,
  fill: 1,
  stroke: 1,
  opacity: 1,
  fillOpacity: 1,
  strokeOpacity: 1,
  strokeWidth: 1,
  strokeDash: 1,
  size: 1,
  angle: 1,
  shape: 1,
  order: 1,
  text: 1,
  detail: 1,
  key: 1,
  tooltip: 1,
  href: 1,
  url: 1,
  description: 1
});
function ju(e) {
  return e === jn || e === Rr || e === jr;
}
const MR = {
  row: 1,
  column: 1,
  facet: 1
}, si = B(MR), ZE = Object.assign(Object.assign({}, $R), MR), hre = B(ZE), gre = bd(ZE, ["order", "detail", "tooltip"]), pre = bd(gre, ["row", "column", "facet"]);
function mre(e) {
  return !!pre[e];
}
function TR(e) {
  return !!ZE[e];
}
const yre = [Xi, $r, Ki, gi, wo, xo];
function NR(e) {
  return eu(e) !== e;
}
function eu(e) {
  switch (e) {
    case Xi:
      return et;
    case $r:
      return xt;
    case Ki:
      return Tr;
    case gi:
      return Nr;
    case wo:
      return Vi;
    case xo:
      return Mr;
  }
  return e;
}
function pa(e) {
  if (DR(e))
    switch (e) {
      case Vi:
        return "startAngle";
      case wo:
        return "endAngle";
      case Mr:
        return "outerRadius";
      case xo:
        return "innerRadius";
    }
  return e;
}
function Pr(e) {
  switch (e) {
    case et:
      return Xi;
    case xt:
      return $r;
    case Tr:
      return Ki;
    case Nr:
      return gi;
    case Vi:
      return wo;
    case Mr:
      return xo;
  }
}
function Lr(e) {
  switch (e) {
    case et:
    case Xi:
      return "width";
    case xt:
    case $r:
      return "height";
  }
}
function vre(e) {
  switch (e) {
    case et:
      return "xOffset";
    case xt:
      return "yOffset";
    case Xi:
      return "x2Offset";
    case $r:
      return "y2Offset";
    case Vi:
      return "thetaOffset";
    case Mr:
      return "radiusOffset";
    case wo:
      return "theta2Offset";
    case xo:
      return "radius2Offset";
  }
}
const eA = bd($R, ["x", "y", "x2", "y2", "latitude", "longitude", "latitude2", "longitude2", "theta", "theta2", "radius", "radius2"]), bre = B(eA), $a = {
  x: 1,
  y: 1
}, pi = B($a);
function Er(e) {
  return e in $a;
}
const tA = {
  theta: 1,
  radius: 1
}, xre = B(tA);
function im(e) {
  return e === "width" ? et : xt;
}
const RR = bd(eA, ["text", "tooltip", "href", "url", "description", "detail", "key", "order"]), wre = B(RR);
function Ere(e) {
  return !!eA[e];
}
function Are(e) {
  switch (e) {
    case jn:
    case Rr:
    case jr:
    case Eo:
    case Pn:
    case Ao:
    case ka:
    case Da:
      return !0;
    case Ca:
    case Fa:
    case Zs:
      return !1;
  }
}
const jR = Object.assign(Object.assign(Object.assign({}, $a), tA), RR), rm = B(jR);
function Ma(e) {
  return !!jR[e];
}
function _re(e, t) {
  return Sre(e)[t];
}
const PR = {
  arc: "always",
  area: "always",
  bar: "always",
  circle: "always",
  geoshape: "always",
  image: "always",
  line: "always",
  rule: "always",
  point: "always",
  rect: "always",
  square: "always",
  trail: "always",
  text: "always",
  tick: "always"
}, Ore = bd(PR, ["geoshape"]);
function Sre(e) {
  switch (e) {
    case jn:
    case Rr:
    case jr:
    case nm:
    case Ed:
    case Zp:
    case Ts:
    case em:
    case wd:
    case Ao:
    case Ca:
    case Fa:
    case ka:
    case Qp:
    case ao:
    case so:
      return PR;
    case et:
    case xt:
    case Tr:
    case Nr:
      return Ore;
    case Xi:
    case $r:
    case Ki:
    case gi:
      return {
        area: "always",
        bar: "always",
        image: "always",
        rect: "always",
        rule: "always",
        circle: "binned",
        point: "binned",
        square: "binned",
        tick: "binned",
        line: "binned",
        trail: "binned"
      };
    case Eo:
      return {
        point: "always",
        tick: "always",
        rule: "always",
        circle: "always",
        square: "always",
        bar: "always",
        text: "always",
        line: "always",
        trail: "always"
      };
    case Da:
      return {
        line: "always",
        point: "always",
        tick: "always",
        rule: "always",
        circle: "always",
        square: "always",
        bar: "always",
        geoshape: "always"
      };
    case Pn:
      return { point: "always", geoshape: "always" };
    case xd:
      return { text: "always" };
    case Zs:
      return { point: "always", square: "always", text: "always" };
    case tm:
      return { image: "always" };
    case Vi:
      return { text: "always", arc: "always" };
    case Mr:
      return { text: "always", arc: "always" };
    case wo:
    case xo:
      return { arc: "always" };
  }
}
function Z1(e) {
  switch (e) {
    case et:
    case xt:
    case Vi:
    case Mr:
    case Eo:
    case Zs:
    case ka:
    case Ao:
    case Ca:
    case Fa:
    case Xi:
    case $r:
    case wo:
    case xo:
      return;
    case Qp:
    case ao:
    case so:
    case Pn:
    case Da:
    case xd:
    case Ts:
    case em:
    case tm:
    case nm:
      return "discrete";
    case jn:
    case Rr:
    case jr:
      return "flexible";
    case Tr:
    case Nr:
    case Ki:
    case gi:
    case Ed:
    case Zp:
    case wd:
      return;
  }
}
function LR(e) {
  return pd(e) && (e = ym(e, void 0)), "bin" + B(e).map((t) => om(e[t]) ? Xe(`_${t}_${md(e[t])}`) : Xe(`_${t}_${e[t]}`)).join("");
}
function Ve(e) {
  return e === !0 || Ad(e) && !e.binned;
}
function cn(e) {
  return e === "binned" || Ad(e) && e.binned === !0;
}
function Ad(e) {
  return ut(e);
}
function om(e) {
  return e == null ? void 0 : e.selection;
}
function mF(e) {
  switch (e) {
    case ao:
    case so:
    case Eo:
    case jn:
    case Rr:
    case jr:
    case ka:
    case Ao:
    case Ca:
    case Fa:
    case Pn:
      return 6;
    case Da:
      return 4;
    default:
      return 10;
  }
}
function nA(e) {
  return `Invalid specification ${JSON.stringify(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`;
}
const Cre = 'Autosize "fit" only works for single views and layered views.';
function yF(e) {
  return `${e == "width" ? "Width" : "Height"} "container" only works for single views and layered views.`;
}
function vF(e) {
  const t = e == "width" ? "Width" : "Height", n = e == "width" ? "x" : "y";
  return `${t} "container" only works well with autosize "fit" or "fit-${n}".`;
}
function bF(e) {
  return e ? `Dropping "fit-${e}" because spec has discrete ${Lr(e)}.` : 'Dropping "fit" because spec has discrete size.';
}
function iA(e) {
  return `Unknown field for ${e}. Cannot calculate view size.`;
}
function xF(e) {
  return `Cannot project a selection on encoding channel "${e}", which has no field.`;
}
function Fre(e, t) {
  return `Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`;
}
function kre(e) {
  return `The "nearest" transform is not supported for ${e} marks.`;
}
function IR(e) {
  return `Selection not supported for ${e} yet.`;
}
function Dre(e) {
  return `Cannot find a selection named "${e}".`;
}
const $re = "Scale bindings are currently only supported for scales with unbinned, continuous domains.", Mre = "Legend bindings are only supported for selections over an individual field or encoding channel.";
function Tre(e) {
  return `Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`;
}
const Nre = "The same selection must be used to override scale domains in a layered view.", Rre = 'Interval selections should be initialized using "x" and/or "y" keys.';
function jre(e) {
  return `Unknown repeated value "${e}".`;
}
function wF(e) {
  return `The "columns" property cannot be used when "${e}" has nested row/column.`;
}
const Pre = "Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).";
function Lre(e) {
  return `Unrecognized parse "${e}".`;
}
function EF(e, t, n) {
  return `An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`;
}
const Ire = "Attempt to add the same child twice.";
function Bre(e) {
  return `Ignoring an invalid transform: ${Ge(e)}.`;
}
const zre = 'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.';
function AF(e) {
  return `Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`;
}
function Ure(e) {
  const { parentProjection: t, projection: n } = e;
  return `Layer's shared projection ${Ge(t)} is overridden by a child projection ${Ge(n)}.`;
}
const qre = "Arc marks uses theta channel rather than angle, replacing angle with theta.";
function Wre(e, t, n) {
  return `Channel ${e} is a ${t}. Converted to {value: ${Ge(n)}}.`;
}
function BR(e) {
  return `Invalid field type "${e}".`;
}
function Gre(e, t) {
  return `Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`;
}
function Hre(e) {
  return `Invalid aggregation operator "${e}".`;
}
function zR(e, t) {
  const { fill: n, stroke: i } = t;
  return `Dropping color ${e} as the plot also has ${n && i ? "fill and stroke" : n ? "fill" : "stroke"}.`;
}
function gb(e, t) {
  return `Dropping ${Ge(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`;
}
const Yre = "Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.";
function am(e, t, n) {
  return `${e} dropped as it is incompatible with "${t}"${n ? ` when ${n}` : ""}.`;
}
function Xre(e) {
  return `${e}-encoding is dropped as ${e} is not a valid encoding channel.`;
}
function Vre(e) {
  return `${e} encoding should be discrete (ordinal / nominal / binned).`;
}
function Kre(e) {
  return `Facet encoding dropped as ${e.join(" and ")} ${e.length > 1 ? "are" : "is"} also specified.`;
}
function ey(e, t) {
  return `Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t === "ordinal" ? "order" : "magnitude"}.`;
}
function Jre(e) {
  return `The ${e} for range marks cannot be an expression`;
}
function Qre(e, t) {
  return `Line mark is for continuous lines and thus cannot be used with ${e && t ? "x2 and y2" : e ? "x2" : "y2"}. We will use the rule mark (line segments) instead.`;
}
function Zre(e, t) {
  return `Specified orient "${e}" overridden with "${t}".`;
}
const eoe = `Scale's "rangeStep" is deprecated and will be removed in Vega-Lite 5.0. Please use "width"/"height": {"step": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.`;
function toe(e) {
  return `Cannot use the scale property "${e}" with non-color channel.`;
}
function noe(e) {
  return `Using unaggregated domain with raw field has no effect (${Ge(e)}).`;
}
function ioe(e) {
  return `Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`;
}
function roe(e) {
  return `Unaggregated domain is currently unsupported for log scale (${Ge(e)}).`;
}
function ooe(e) {
  return `Cannot apply size to non-oriented mark "${e}".`;
}
function aoe(e, t, n) {
  return `Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`;
}
function soe(e, t) {
  return `FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`;
}
function UR(e, t, n) {
  return `${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`;
}
function qR(e) {
  return `The step for "${e}" is dropped because the ${e === "width" ? "x" : "y"} is continuous.`;
}
function uoe(e, t, n, i) {
  return `Conflicting ${t.toString()} property "${e.toString()}" (${Ge(n)} and ${Ge(i)}). Using ${Ge(n)}.`;
}
function loe(e, t, n, i) {
  return `Conflicting ${t.toString()} property "${e.toString()}" (${Ge(n)} and ${Ge(i)}). Using the union of the two domains.`;
}
function coe(e) {
  return `Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`;
}
function foe(e) {
  return `Dropping sort property ${Ge(e)} as unioned domains only support boolean or op "count", "min", and "max".`;
}
const _F = "Domains that should be unioned has conflicting sort properties. Sort will be set to true.", doe = "Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.", hoe = "Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.", goe = "Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.";
function poe(e) {
  return `Cannot stack "${e}" if there is already "${e}2".`;
}
function moe(e) {
  return `Cannot stack non-linear scale (${e}).`;
}
function yoe(e) {
  return `Stacking is applied even though the aggregate function is non-summative ("${e}").`;
}
function v0(e, t) {
  return `Invalid ${e}: ${Ge(t)}.`;
}
function voe(e) {
  return `Dropping day from datetime ${Ge(e)} as day cannot be combined with other units.`;
}
function boe(e, t) {
  return `${t ? "extent " : ""}${t && e ? "and " : ""}${e ? "center " : ""}${t && e ? "are " : "is "}not needed when data are aggregated.`;
}
function xoe(e, t, n) {
  return `${e} is not usually used with ${t} for ${n}.`;
}
function woe(e, t) {
  return `Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`;
}
function OF(e) {
  return `1D error band does not support ${e}.`;
}
function WR(e) {
  return `Channel ${e} is required for "binned" bin.`;
}
function Eoe(e) {
  return `Channel ${e} should not be used with "binned" bin.`;
}
function Aoe(e) {
  return `Domain for ${e} is required for threshold scale.`;
}
globalThis && globalThis.__classPrivateFieldSet;
globalThis && globalThis.__classPrivateFieldGet;
const GR = qie(pR);
let ll = GR;
function _oe(e) {
  return ll = e, ll;
}
function Ooe() {
  return ll = GR, ll;
}
function U(...e) {
  ll.warn(...e);
}
function Soe(...e) {
  ll.debug(...e);
}
function tu(e) {
  if (e && ut(e)) {
    for (const t of oA)
      if (t in e)
        return !0;
  }
  return !1;
}
const HR = [
  "january",
  "february",
  "march",
  "april",
  "may",
  "june",
  "july",
  "august",
  "september",
  "october",
  "november",
  "december"
], Coe = HR.map((e) => e.substr(0, 3)), YR = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"], Foe = YR.map((e) => e.substr(0, 3));
function koe(e) {
  if (Jp(e) && (e = +e), ht(e))
    return e > 4 && U(v0("quarter", e)), e - 1;
  throw new Error(v0("quarter", e));
}
function Doe(e) {
  if (Jp(e) && (e = +e), ht(e))
    return e - 1;
  {
    const t = e.toLowerCase(), n = HR.indexOf(t);
    if (n !== -1)
      return n;
    const i = t.substr(0, 3), r = Coe.indexOf(i);
    if (r !== -1)
      return r;
    throw new Error(v0("month", e));
  }
}
function $oe(e) {
  if (Jp(e) && (e = +e), ht(e))
    return e % 7;
  {
    const t = e.toLowerCase(), n = YR.indexOf(t);
    if (n !== -1)
      return n;
    const i = t.substr(0, 3), r = Foe.indexOf(i);
    if (r !== -1)
      return r;
    throw new Error(v0("day", e));
  }
}
function rA(e, t) {
  const n = [];
  if (t && e.day !== void 0 && B(e).length > 1 && (U(voe(e)), e = pe(e), delete e.day), e.year !== void 0 ? n.push(e.year) : n.push(2012), e.month !== void 0) {
    const i = t ? Doe(e.month) : e.month;
    n.push(i);
  } else if (e.quarter !== void 0) {
    const i = t ? koe(e.quarter) : e.quarter;
    n.push(ht(i) ? i * 3 : i + "*3");
  } else
    n.push(0);
  if (e.date !== void 0)
    n.push(e.date);
  else if (e.day !== void 0) {
    const i = t ? $oe(e.day) : e.day;
    n.push(ht(i) ? i + 1 : i + "+1");
  } else
    n.push(1);
  for (const i of ["hours", "minutes", "seconds", "milliseconds"]) {
    const r = e[i];
    n.push(typeof r > "u" ? 0 : r);
  }
  return n;
}
function Cf(e) {
  const n = rA(e, !0).join(", ");
  return e.utc ? `utc(${n})` : `datetime(${n})`;
}
function Moe(e) {
  const n = rA(e, !1).join(", ");
  return e.utc ? `utc(${n})` : `datetime(${n})`;
}
function Toe(e) {
  const t = rA(e, !0);
  return e.utc ? +new Date(Date.UTC(...t)) : +new Date(...t);
}
var Noe = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
const XR = {
  year: 1,
  quarter: 1,
  month: 1,
  week: 1,
  day: 1,
  dayofyear: 1,
  date: 1,
  hours: 1,
  minutes: 1,
  seconds: 1,
  milliseconds: 1
}, oA = B(XR);
function Roe(e) {
  return !!XR[e];
}
function aA(e) {
  return e.startsWith("utc");
}
function joe(e) {
  return e.substr(3);
}
const Poe = {
  "year-month": "%b %Y ",
  "year-month-date": "%b %d, %Y "
};
function sA(e) {
  const t = [];
  for (const n of oA)
    VR(e, n) && t.push(n);
  return t;
}
function VR(e, t) {
  const n = e.indexOf(t);
  return !(n < 0 || n > 0 && t === "seconds" && e.charAt(n - 1) === "i" || e.length > n + 3 && t === "day" && e.charAt(n + 3) === "o" || n > 0 && t === "year" && e.charAt(n - 1) === "f");
}
function Loe(e, t, { end: n } = { end: !1 }) {
  const i = VE(t), r = aA(e) ? "utc" : "";
  function o(u) {
    return u === "quarter" ? `(${r}quarter(${i})-1)` : `${r}${u}(${i})`;
  }
  let a;
  const s = {};
  for (const u of oA)
    VR(e, u) && (s[u] = o(u), a = u);
  return n && (s[a] += "+1"), Moe(s);
}
function KR(e) {
  if (!e)
    return;
  const t = sA(e);
  return `timeUnitSpecifier(${_f(t)}, ${_f(Poe)})`;
}
function Ioe(e, t, n) {
  if (!e)
    return;
  const i = KR(e);
  return `${n || aA(e) ? "utc" : "time"}Format(${t}, ${i})`;
}
function bn(e) {
  if (!e)
    return;
  let t;
  return ge(e) ? t = {
    unit: e
  } : ut(e) && (t = Object.assign(Object.assign({}, e), e.unit ? { unit: e.unit } : {})), aA(t.unit) && (t.utc = !0, t.unit = joe(t.unit)), t;
}
function Boe(e) {
  const t = bn(e), { utc: n } = t, i = Noe(t, ["utc"]);
  return i.unit ? (n ? "utc" : "") + B(i).map((r) => Xe(`${r === "unit" ? "" : `_${r}_`}${i[r]}`)).join("") : (n ? "utc" : "") + "timeunit" + B(i).map((r) => Xe(`_${r}_${i[r]}`)).join("");
}
function se(e) {
  return e && !!e.signal;
}
function Ta(e) {
  return !!e.step;
}
function zoe(e) {
  return K(e) ? !1 : "fields" in e && !("data" in e);
}
function Uoe(e) {
  return K(e) ? !1 : "fields" in e && "data" in e;
}
function no(e) {
  return K(e) ? !1 : "field" in e && "data" in e;
}
const qoe = {
  aria: 1,
  description: 1,
  ariaRole: 1,
  ariaRoleDescription: 1,
  blend: 1,
  opacity: 1,
  fill: 1,
  fillOpacity: 1,
  stroke: 1,
  strokeCap: 1,
  strokeWidth: 1,
  strokeOpacity: 1,
  strokeDash: 1,
  strokeDashOffset: 1,
  strokeJoin: 1,
  strokeOffset: 1,
  strokeMiterLimit: 1,
  startAngle: 1,
  endAngle: 1,
  padAngle: 1,
  innerRadius: 1,
  outerRadius: 1,
  size: 1,
  shape: 1,
  interpolate: 1,
  tension: 1,
  orient: 1,
  align: 1,
  baseline: 1,
  text: 1,
  dir: 1,
  dx: 1,
  dy: 1,
  ellipsis: 1,
  limit: 1,
  radius: 1,
  theta: 1,
  angle: 1,
  font: 1,
  fontSize: 1,
  fontWeight: 1,
  fontStyle: 1,
  lineBreak: 1,
  lineHeight: 1,
  cursor: 1,
  href: 1,
  tooltip: 1,
  cornerRadius: 1,
  cornerRadiusTopLeft: 1,
  cornerRadiusTopRight: 1,
  cornerRadiusBottomLeft: 1,
  cornerRadiusBottomRight: 1,
  aspect: 1,
  width: 1,
  height: 1,
  url: 1,
  smooth: 1
}, Woe = B(qoe), Goe = {
  arc: 1,
  area: 1,
  group: 1,
  image: 1,
  line: 1,
  path: 1,
  rect: 1,
  rule: 1,
  shape: 1,
  symbol: 1,
  text: 1,
  trail: 1
}, pb = [
  "cornerRadius",
  "cornerRadiusTopLeft",
  "cornerRadiusTopRight",
  "cornerRadiusBottomLeft",
  "cornerRadiusBottomRight"
];
function Hoe(e) {
  return e == null ? void 0 : e.selection;
}
function uA(e) {
  return e && !!e.field && e.equal !== void 0;
}
function lA(e) {
  return e && !!e.field && e.lt !== void 0;
}
function cA(e) {
  return e && !!e.field && e.lte !== void 0;
}
function fA(e) {
  return e && !!e.field && e.gt !== void 0;
}
function dA(e) {
  return e && !!e.field && e.gte !== void 0;
}
function hA(e) {
  if (e && e.field) {
    if (K(e.range) && e.range.length === 2)
      return !0;
    if (se(e.range))
      return !0;
  }
  return !1;
}
function gA(e) {
  return e && !!e.field && (K(e.oneOf) || K(e.in));
}
function Yoe(e) {
  return e && !!e.field && e.valid !== void 0;
}
function JR(e) {
  return gA(e) || uA(e) || hA(e) || lA(e) || fA(e) || cA(e) || dA(e);
}
function tr(e, t) {
  return vm(e, { timeUnit: t, wrapTime: !0 });
}
function Xoe(e, t) {
  return e.map((n) => tr(n, t));
}
function QR(e, t = !0) {
  var n;
  const { field: i } = e, r = (n = bn(e.timeUnit)) === null || n === void 0 ? void 0 : n.unit, o = r ? "time(" + Loe(r, i) + ")" : W(e, { expr: "datum" });
  if (uA(e))
    return o + "===" + tr(e.equal, r);
  if (lA(e)) {
    const a = e.lt;
    return `${o}<${tr(a, r)}`;
  } else if (fA(e)) {
    const a = e.gt;
    return `${o}>${tr(a, r)}`;
  } else if (cA(e)) {
    const a = e.lte;
    return `${o}<=${tr(a, r)}`;
  } else if (dA(e)) {
    const a = e.gte;
    return `${o}>=${tr(a, r)}`;
  } else {
    if (gA(e))
      return `indexof([${Xoe(e.oneOf, r).join(",")}], ${o}) !== -1`;
    if (Yoe(e))
      return pA(o, e.valid);
    if (hA(e)) {
      const { range: a } = e, s = se(a) ? { signal: `${a.signal}[0]` } : a[0], u = se(a) ? { signal: `${a.signal}[1]` } : a[1];
      if (s !== null && u !== null && t)
        return "inrange(" + o + ", [" + tr(s, r) + ", " + tr(u, r) + "])";
      const l = [];
      return s !== null && l.push(`${o} >= ${tr(s, r)}`), u !== null && l.push(`${o} <= ${tr(u, r)}`), l.length > 0 ? l.join(" && ") : "true";
    }
  }
  throw new Error(`Invalid field predicate: ${JSON.stringify(e)}`);
}
function pA(e, t = !0) {
  return t ? `isValid(${e}) && isFinite(+${e})` : `!isValid(${e}) || !isFinite(+${e})`;
}
function Voe(e) {
  var t;
  return JR(e) && e.timeUnit ? Object.assign(Object.assign({}, e), { timeUnit: (t = bn(e.timeUnit)) === null || t === void 0 ? void 0 : t.unit }) : e;
}
const _d = {
  quantitative: "quantitative",
  ordinal: "ordinal",
  temporal: "temporal",
  nominal: "nominal",
  geojson: "geojson"
}, Ns = _d.quantitative, mA = _d.ordinal, cl = _d.temporal, yA = _d.nominal, Nl = _d.geojson;
function Koe(e) {
  if (e)
    switch (e = e.toLowerCase(), e) {
      case "q":
      case Ns:
        return "quantitative";
      case "t":
      case cl:
        return "temporal";
      case "o":
      case mA:
        return "ordinal";
      case "n":
      case yA:
        return "nominal";
      case Nl:
        return "geojson";
    }
}
var Joe = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
const ft = {
  LINEAR: "linear",
  LOG: "log",
  POW: "pow",
  SQRT: "sqrt",
  SYMLOG: "symlog",
  IDENTITY: "identity",
  SEQUENTIAL: "sequential",
  TIME: "time",
  UTC: "utc",
  QUANTILE: "quantile",
  QUANTIZE: "quantize",
  THRESHOLD: "threshold",
  BIN_ORDINAL: "bin-ordinal",
  ORDINAL: "ordinal",
  POINT: "point",
  BAND: "band"
}, mb = {
  linear: "numeric",
  log: "numeric",
  pow: "numeric",
  sqrt: "numeric",
  symlog: "numeric",
  identity: "numeric",
  sequential: "numeric",
  time: "time",
  utc: "time",
  ordinal: "ordinal",
  "bin-ordinal": "bin-ordinal",
  point: "ordinal-position",
  band: "ordinal-position",
  quantile: "discretizing",
  quantize: "discretizing",
  threshold: "discretizing"
};
function Qoe(e, t) {
  const n = mb[e], i = mb[t];
  return n === i || n === "ordinal-position" && i === "time" || i === "ordinal-position" && n === "time";
}
const Zoe = {
  linear: 0,
  log: 1,
  pow: 1,
  sqrt: 1,
  symlog: 1,
  identity: 1,
  sequential: 1,
  time: 0,
  utc: 0,
  point: 10,
  band: 11,
  ordinal: 0,
  "bin-ordinal": 0,
  quantile: 0,
  quantize: 0,
  threshold: 0
};
function SF(e) {
  return Zoe[e];
}
const ZR = ["linear", "log", "pow", "sqrt", "symlog", "time", "utc"], eae = Qs(ZR), tae = ["linear", "log", "pow", "sqrt", "symlog"], nae = Qs(tae);
function iae(e) {
  return e in nae;
}
const rae = ["quantile", "quantize", "threshold"], oae = Qs(rae), aae = ZR.concat([
  "quantile",
  "quantize",
  "threshold",
  "sequential",
  "identity"
]), sae = Qs(aae), uae = ["ordinal", "bin-ordinal", "point", "band"], lae = Qs(uae);
function Ln(e) {
  return e in lae;
}
function mi(e) {
  return e in sae;
}
function ji(e) {
  return e in eae;
}
function b0(e) {
  return e in oae;
}
const cae = {
  pointPadding: 0.5,
  barBandPaddingInner: 0.1,
  rectBandPaddingInner: 0,
  minBandSize: 2,
  minFontSize: 8,
  maxFontSize: 40,
  minOpacity: 0.3,
  maxOpacity: 0.8,
  minSize: 9,
  minStrokeWidth: 1,
  maxStrokeWidth: 4,
  quantileCount: 4,
  quantizeCount: 4
};
function fae(e) {
  return !ge(e) && !!e.name;
}
function e8(e) {
  return e == null ? void 0 : e.selection;
}
function dae(e) {
  return e && e.unionWith;
}
const hae = {
  type: 1,
  domain: 1,
  domainMax: 1,
  domainMin: 1,
  domainMid: 1,
  align: 1,
  range: 1,
  rangeMax: 1,
  rangeMin: 1,
  scheme: 1,
  bins: 1,
  reverse: 1,
  round: 1,
  clamp: 1,
  nice: 1,
  base: 1,
  exponent: 1,
  constant: 1,
  interpolate: 1,
  zero: 1,
  padding: 1,
  paddingInner: 1,
  paddingOuter: 1
}, gae = Joe(hae, ["type", "domain", "range", "rangeMax", "rangeMin", "scheme"]), pae = B(gae);
function yb(e, t) {
  switch (t) {
    case "type":
    case "domain":
    case "reverse":
    case "range":
      return !0;
    case "scheme":
    case "interpolate":
      return !ie(["point", "band", "identity"], e);
    case "bins":
      return !ie(["point", "band", "identity", "ordinal"], e);
    case "round":
      return ji(e) || e === "band" || e === "point";
    case "padding":
    case "rangeMin":
    case "rangeMax":
      return ji(e) || ie(["point", "band"], e);
    case "paddingOuter":
    case "align":
      return ie(["point", "band"], e);
    case "paddingInner":
      return e === "band";
    case "domainMax":
    case "domainMid":
    case "domainMin":
    case "clamp":
      return ji(e);
    case "nice":
      return ji(e) || e === "quantize" || e === "threshold";
    case "exponent":
      return e === "pow";
    case "base":
      return e === "log";
    case "constant":
      return e === "symlog";
    case "zero":
      return mi(e) && !ie([
        "log",
        "time",
        "utc",
        "threshold",
        "quantile"
      ], e);
  }
}
function t8(e, t) {
  switch (t) {
    case "interpolate":
    case "scheme":
    case "domainMid":
      return ju(e) ? void 0 : toe(e);
    case "align":
    case "type":
    case "bins":
    case "domain":
    case "domainMax":
    case "domainMin":
    case "range":
    case "base":
    case "exponent":
    case "constant":
    case "nice":
    case "padding":
    case "paddingInner":
    case "paddingOuter":
    case "rangeMax":
    case "rangeMin":
    case "reverse":
    case "round":
    case "clamp":
    case "zero":
      return;
  }
}
function mae(e, t) {
  return ie([mA, yA], t) ? e === void 0 || Ln(e) : t === cl ? ie([ft.TIME, ft.UTC, void 0], e) : t === Ns ? ie([
    ft.LOG,
    ft.POW,
    ft.SQRT,
    ft.SYMLOG,
    ft.QUANTILE,
    ft.QUANTIZE,
    ft.THRESHOLD,
    ft.LINEAR,
    void 0
  ], e) : !0;
}
function yae(e, t) {
  if (!Ma(e))
    return !1;
  switch (e) {
    case et:
    case xt:
    case Vi:
    case Mr:
      return ji(t) || ie(["band", "point"], t);
    case Eo:
    case ka:
    case Ao:
    case Ca:
    case Fa:
    case Zs:
      return ji(t) || b0(t) || ie(["band", "point", "ordinal"], t);
    case jn:
    case Rr:
    case jr:
      return t !== "band";
    case Da:
      return t === "ordinal" || b0(t);
    case Pn:
      return t === "ordinal";
  }
}
function Od(e) {
  return e && !!e.expr;
}
function Ci(e) {
  const t = B(e || {}), n = {};
  for (const i of t)
    n[i] = dn(e[i]);
  return n;
}
const wn = {
  arc: "arc",
  area: "area",
  bar: "bar",
  image: "image",
  line: "line",
  point: "point",
  rect: "rect",
  rule: "rule",
  text: "text",
  tick: "tick",
  trail: "trail",
  circle: "circle",
  square: "square",
  geoshape: "geoshape"
}, n8 = wn.arc, sm = wn.area, um = wn.bar, vae = wn.image, lm = wn.line, cm = wn.point, bae = wn.rect, x0 = wn.rule, i8 = wn.text, vA = wn.tick, xae = wn.trail, bA = wn.circle, xA = wn.square, r8 = wn.geoshape;
function Na(e) {
  return ie(["line", "area", "trail"], e);
}
function CF(e) {
  return ie(["rect", "bar", "image", "arc"], e);
}
const o8 = B(wn);
function mo(e) {
  return e.type;
}
Qs(o8);
const wae = [
  "stroke",
  "strokeWidth",
  "strokeDash",
  "strokeDashOffset",
  "strokeOpacity",
  "strokeJoin",
  "strokeMiterLimit"
], Eae = ["fill", "fillOpacity"], Aae = [...wae, ...Eae], _ae = {
  color: 1,
  filled: 1,
  invalid: 1,
  order: 1,
  radius2: 1,
  theta2: 1,
  timeUnitBand: 1,
  timeUnitBandPosition: 1
}, FF = B(_ae), Oae = {
  area: ["line", "point"],
  bar: ["binSpacing", "continuousBandSize", "discreteBandSize"],
  rect: ["binSpacing", "continuousBandSize", "discreteBandSize"],
  line: ["point"],
  tick: ["bandSize", "thickness"]
}, Sae = {
  color: "#4c78a8",
  invalid: "filter",
  timeUnitBand: 1
}, Cae = {
  mark: 1,
  arc: 1,
  area: 1,
  bar: 1,
  circle: 1,
  image: 1,
  line: 1,
  point: 1,
  rect: 1,
  rule: 1,
  square: 1,
  text: 1,
  tick: 1,
  trail: 1,
  geoshape: 1
}, a8 = B(Cae), Fae = {
  horizontal: ["cornerRadiusTopRight", "cornerRadiusBottomRight"],
  vertical: ["cornerRadiusTopLeft", "cornerRadiusTopRight"]
}, s8 = 5, kae = {
  binSpacing: 1,
  continuousBandSize: s8,
  timeUnitBandPosition: 0.5
}, Dae = {
  binSpacing: 0,
  continuousBandSize: s8,
  timeUnitBandPosition: 0.5
}, $ae = {
  thickness: 1
};
function Mae(e) {
  return mo(e) ? e.type : e;
}
function wA(e) {
  const { channel: t, channelDef: n, markDef: i, scale: r, config: o } = e, a = l8(e);
  return G(n) && !FR(n.aggregate) && r && ji(r.get("type")) && r.get("zero") === !1 ? u8({
    fieldDef: n,
    channel: t,
    markDef: i,
    ref: a,
    config: o
  }) : a;
}
function u8({ fieldDef: e, channel: t, markDef: n, ref: i, config: r }) {
  return Na(n.type) || Re("invalid", n, r) === null ? i : [Tae(e, t), i];
}
function Tae(e, t) {
  const n = EA(e, !0), r = eu(t) === "y" ? { field: { group: "height" } } : { value: 0 };
  return Object.assign({ test: n }, r);
}
function EA(e, t = !0) {
  return pA(ge(e) ? e : W(e, { expr: "datum" }), !t);
}
function Nae(e) {
  const { datum: t } = e;
  return tu(t) ? Cf(t) : `${JSON.stringify(t)}`;
}
function ms(e, t, n, i) {
  const r = {};
  if (t && (r.scale = t), Ra(e)) {
    const { datum: o } = e;
    tu(o) ? r.signal = Cf(o) : se(o) ? r.signal = o.signal : Od(o) ? r.signal = o.expr : r.value = o;
  } else
    r.field = W(e, n);
  if (i) {
    const { offset: o, band: a } = i;
    o && (r.offset = o), a && (r.band = a);
  }
  return r;
}
function w0({ scaleName: e, fieldOrDatumDef: t, fieldOrDatumDef2: n, offset: i, startSuffix: r, band: o = 0.5 }) {
  const a = 0 < o && o < 1 ? "datum" : void 0, s = W(t, { expr: a, suffix: r }), u = n !== void 0 ? W(n, { expr: a }) : W(t, { suffix: "end", expr: a }), l = {};
  if (o === 0 || o === 1) {
    l.scale = e;
    const c = o === 0 ? s : u;
    l.field = c;
  } else {
    const c = `${o} * ${s} + ${1 - o} * ${u}`;
    l.signal = `scale("${e}", ${c})`;
  }
  return i && (l.offset = i), l;
}
function l8({ channel: e, channelDef: t, channel2Def: n, markDef: i, config: r, scaleName: o, scale: a, stack: s, offset: u, defaultRef: l, band: c }) {
  var f;
  if (t) {
    if (ue(t)) {
      if (yi(t)) {
        c = c != null ? c : Cd({
          channel: e,
          fieldDef: t,
          fieldDef2: n,
          markDef: i,
          stack: s,
          config: r,
          isMidPoint: !0
        });
        const { bin: h, timeUnit: g, type: p } = t;
        if (Ve(h) || c && g && p === cl)
          return s && s.impute ? ms(t, o, { binSuffix: "mid" }, { offset: u }) : c ? w0({ scaleName: o, fieldOrDatumDef: t, band: c, offset: u }) : ms(t, o, Fd(t, e) ? { binSuffix: "range" } : {}, {
            offset: u
          });
        if (cn(h)) {
          if (G(n))
            return w0({
              scaleName: o,
              fieldOrDatumDef: t,
              fieldOrDatumDef2: n,
              band: c,
              offset: u
            });
          U(WR(e === et ? Xi : $r));
        }
      }
      const d = a == null ? void 0 : a.get("type");
      return ms(
        t,
        o,
        Ln(d) ? { binSuffix: "range" } : {},
        {
          offset: u,
          band: d === "band" ? (f = c != null ? c : t.band) !== null && f !== void 0 ? f : 0.5 : void 0
        }
      );
    } else if (Wi(t)) {
      const d = t.value, h = u ? { offset: u } : {};
      return Object.assign(Object.assign({}, Vc(e, d)), h);
    }
  }
  return Gie(l) && (l = l()), l && Object.assign(Object.assign({}, l), u ? { offset: u } : {});
}
function Vc(e, t) {
  return ie(["x", "x2"], e) && t === "width" ? { field: { group: "width" } } : ie(["y", "y2"], e) && t === "height" ? { field: { group: "height" } } : Ze(t);
}
function Rs(e) {
  return e && e !== "number" && e !== "time";
}
function c8(e, t, n) {
  return `${e}(${t}${n ? `, ${JSON.stringify(n)}` : ""})`;
}
const Rae = " \u2013 ";
function AA({ fieldOrDatumDef: e, format: t, formatType: n, expr: i, normalizeStack: r, config: o }) {
  var a, s;
  if (Rs(n))
    return _A({
      fieldOrDatumDef: e,
      format: t,
      formatType: n,
      expr: i,
      config: o
    });
  const u = f8(e, i, r);
  if (fl(e)) {
    const l = Pae(u, G(e) ? (a = bn(e.timeUnit)) === null || a === void 0 ? void 0 : a.unit : void 0, t, o.timeFormat, mm(e) && ((s = e.scale) === null || s === void 0 ? void 0 : s.type) === ft.UTC);
    return l ? { signal: l } : void 0;
  }
  if (t = g8(jo(e), t, o), G(e) && Ve(e.bin)) {
    const l = W(e, { expr: i, binSuffix: "end" });
    return {
      signal: fm(u, l, t, n, o)
    };
  } else
    return t || jo(e) === "quantitative" ? {
      signal: `${p8(u, t)}`
    } : { signal: `isValid(${u}) ? ${u} : ""+${u}` };
}
function f8(e, t, n) {
  return G(e) ? n ? `${W(e, { expr: t, suffix: "end" })}-${W(e, {
    expr: t,
    suffix: "start"
  })}` : W(e, { expr: t }) : Nae(e);
}
function _A({ fieldOrDatumDef: e, format: t, formatType: n, expr: i, normalizeStack: r, config: o, field: a }) {
  if (a = a != null ? a : f8(e, i, r), G(e) && Ve(e.bin)) {
    const s = W(e, { expr: i, binSuffix: "end" });
    return {
      signal: fm(a, s, t, n, o)
    };
  }
  return { signal: c8(n, a, t) };
}
function d8(e, t, n, i, r, o) {
  var a;
  if (!Rs(i)) {
    if (fl(e)) {
      const s = G(e) ? (a = bn(e.timeUnit)) === null || a === void 0 ? void 0 : a.unit : void 0;
      return jae(n, s, r, o);
    }
    return g8(t, n, r);
  }
}
function h8(e, t, n) {
  if (e && (se(e) || e === "number" || e === "time"))
    return e;
  if (fl(t) && n !== "time" && n !== "utc")
    return "time";
}
function g8(e, t, n) {
  if (ge(t))
    return t;
  if (e === Ns)
    return n.numberFormat;
}
function jae(e, t, n, i) {
  return e || (t ? {
    signal: KR(t)
  } : i ? void 0 : n.timeFormat);
}
function p8(e, t) {
  return `format(${e}, "${t || ""}")`;
}
function kF(e, t, n, i) {
  var r;
  return Rs(n) ? c8(n, e, t) : p8(e, (r = ge(t) ? t : void 0) !== null && r !== void 0 ? r : i.numberFormat);
}
function fm(e, t, n, i, r) {
  const o = kF(e, n, i, r), a = kF(t, n, i, r);
  return `${pA(e, !1)} ? "null" : ${o} + "${Rae}" + ${a}`;
}
function Pae(e, t, n, i, r) {
  return !t || n ? (n = ge(n) ? n : i, `${r ? "utc" : "time"}Format(${e}, '${n}')`) : Ioe(t, e, r);
}
const dm = "min", Lae = {
  x: 1,
  y: 1,
  color: 1,
  fill: 1,
  stroke: 1,
  strokeWidth: 1,
  size: 1,
  shape: 1,
  fillOpacity: 1,
  strokeOpacity: 1,
  opacity: 1,
  text: 1
};
function DF(e) {
  return e in Lae;
}
function m8(e) {
  return !!e && !!e.encoding;
}
function pr(e) {
  return !!e && (e.op === "count" || !!e.field);
}
function y8(e) {
  return !!e && K(e);
}
function Sd(e) {
  return "row" in e || "column" in e;
}
function OA(e) {
  return !!e && "header" in e;
}
function hm(e) {
  return "facet" in e;
}
var vb = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function Iae(e) {
  return e.selection;
}
function Bae(e) {
  return e && !ge(e) && "repeat" in e;
}
function $F(e) {
  const { field: t, timeUnit: n, bin: i, aggregate: r } = e;
  return Object.assign(Object.assign(Object.assign(Object.assign({}, n ? { timeUnit: n } : {}), i ? { bin: i } : {}), r ? { aggregate: r } : {}), { field: t });
}
function SA(e) {
  return "sort" in e;
}
function Cd({ channel: e, fieldDef: t, fieldDef2: n, markDef: i, stack: r, config: o, isMidPoint: a }) {
  if (ue(t) && t.band !== void 0)
    return t.band;
  if (G(t)) {
    const { timeUnit: s, bin: u } = t;
    if (s && !n)
      return a ? js("timeUnitBandPosition", i, o) : CF(i.type) ? js("timeUnitBand", i, o) : 0;
    if (Ve(u))
      return CF(i.type) && !a ? 1 : 0.5;
  }
  if ((r == null ? void 0 : r.fieldChannel) === e && a)
    return 0.5;
}
function CA(e, t, n, i, r, o) {
  return Ve(t.bin) || t.timeUnit && yi(t) && t.type === "temporal" ? !!Cd({ channel: e, fieldDef: t, fieldDef2: n, stack: i, markDef: r, config: o }) : !1;
}
function FA(e) {
  return !!e && "condition" in e;
}
function gm(e) {
  const t = e && e.condition;
  return !!t && !K(t) && G(t);
}
function pm(e) {
  const t = e && e.condition;
  return !!t && !K(t) && ue(t);
}
function zae(e) {
  const t = e && e.condition;
  return !!t && (K(t) || Wi(t));
}
function G(e) {
  return !!e && (!!e.field || e.aggregate === "count");
}
function jo(e) {
  return e && e.type;
}
function Ra(e) {
  return !!e && "datum" in e;
}
function cr(e) {
  return yi(e) && w8(e) || bb(e);
}
function bb(e) {
  return Ra(e) && ht(e.datum);
}
function ue(e) {
  return G(e) || Ra(e);
}
function yi(e) {
  return !!e && ("field" in e || e.aggregate === "count") && "type" in e;
}
function Wi(e) {
  return e && "value" in e && "value" in e;
}
function mm(e) {
  return !!e && ("scale" in e || "sort" in e);
}
function kA(e) {
  return e && ("axis" in e || "stack" in e || "impute" in e);
}
function v8(e) {
  return !!e && "legend" in e;
}
function b8(e) {
  return !!e && ("format" in e || "formatType" in e);
}
function Uae(e) {
  return Xn(e, ["legend", "axis", "header", "scale"]);
}
function qae(e) {
  return "op" in e;
}
function W(e, t = {}) {
  var n, i, r;
  let o = e.field;
  const a = t.prefix;
  let s = t.suffix, u = "";
  if (Wae(e))
    o = AR("count");
  else {
    let l;
    if (!t.nofn)
      if (qae(e))
        l = e.op;
      else {
        const { bin: c, aggregate: f, timeUnit: d } = e;
        Ve(c) ? (l = LR(c), s = ((n = t.binSuffix) !== null && n !== void 0 ? n : "") + ((i = t.suffix) !== null && i !== void 0 ? i : "")) : f ? Sa(f) ? (u = `["${o}"]`, o = `argmax_${f.argmax}`) : po(f) ? (u = `["${o}"]`, o = `argmin_${f.argmin}`) : l = String(f) : d && (l = Boe(d), s = (!ie(["range", "mid"], t.binSuffix) && t.binSuffix || "") + ((r = t.suffix) !== null && r !== void 0 ? r : ""));
      }
    l && (o = o ? `${l}_${o}` : l);
  }
  return s && (o = `${o}_${s}`), a && (o = `${a}_${o}`), t.forAs ? KE(o) : t.expr ? xR(o, t.expr) + u : go(o) + u;
}
function x8(e) {
  switch (e.type) {
    case "nominal":
    case "ordinal":
    case "geojson":
      return !0;
    case "quantitative":
      return G(e) && !!e.bin;
    case "temporal":
      return !1;
  }
  throw new Error(BR(e.type));
}
function w8(e) {
  return !x8(e);
}
function Wae(e) {
  return e.aggregate === "count";
}
function Gae(e, t) {
  var n;
  const { field: i, bin: r, timeUnit: o, aggregate: a } = e;
  if (a === "count")
    return t.countTitle;
  if (Ve(r))
    return `${i} (binned)`;
  if (o) {
    const s = (n = bn(o)) === null || n === void 0 ? void 0 : n.unit;
    if (s)
      return `${i} (${sA(s).join("-")})`;
  } else if (a)
    return Sa(a) ? `${i} for max ${a.argmax}` : po(a) ? `${i} for min ${a.argmin}` : `${yd(a)} of ${i}`;
  return i;
}
function Hae(e) {
  const { aggregate: t, bin: n, timeUnit: i, field: r } = e;
  if (Sa(t))
    return `${r} for argmax(${t.argmax})`;
  if (po(t))
    return `${r} for argmin(${t.argmin})`;
  const o = bn(i), a = t || (o == null ? void 0 : o.unit) || (o == null ? void 0 : o.maxbins) && "timeunit" || Ve(n) && "bin";
  return a ? a.toUpperCase() + "(" + r + ")" : r;
}
const E8 = (e, t) => {
  switch (t.fieldTitle) {
    case "plain":
      return e.field;
    case "functional":
      return Hae(e);
    default:
      return Gae(e, t);
  }
};
let A8 = E8;
function _8(e) {
  A8 = e;
}
function Yae() {
  _8(E8);
}
function Pu(e, t, { allowDisabling: n, includeDefault: i = !0 }) {
  var r, o;
  const a = (r = DA(e)) === null || r === void 0 ? void 0 : r.title;
  if (!G(e))
    return a;
  const s = e, u = i ? $A(s, t) : void 0;
  return n ? ct(a, s.title, u) : (o = a != null ? a : s.title) !== null && o !== void 0 ? o : u;
}
function DA(e) {
  if (kA(e) && e.axis)
    return e.axis;
  if (v8(e) && e.legend)
    return e.legend;
  if (OA(e) && e.header)
    return e.header;
}
function $A(e, t) {
  return A8(e, t);
}
function E0(e) {
  var t;
  if (b8(e)) {
    const { format: n, formatType: i } = e;
    return { format: n, formatType: i };
  } else {
    const n = (t = DA(e)) !== null && t !== void 0 ? t : {}, { format: i, formatType: r } = n;
    return { format: i, formatType: r };
  }
}
function Xae(e, t) {
  var n;
  switch (t) {
    case "latitude":
    case "longitude":
      return "quantitative";
    case "row":
    case "column":
    case "facet":
    case "shape":
    case "strokeDash":
      return "nominal";
    case "order":
      return "ordinal";
  }
  if (SA(e) && K(e.sort))
    return "ordinal";
  const { aggregate: i, bin: r, timeUnit: o } = e;
  if (o)
    return "temporal";
  if (r || i && !Sa(i) && !po(i))
    return "quantitative";
  if (mm(e) && ((n = e.scale) === null || n === void 0 ? void 0 : n.type))
    switch (mb[e.scale.type]) {
      case "numeric":
      case "discretizing":
        return "quantitative";
      case "time":
        return "temporal";
    }
  return "nominal";
}
function Ar(e) {
  if (G(e))
    return e;
  if (gm(e))
    return e.condition;
}
function vt(e) {
  if (ue(e))
    return e;
  if (pm(e))
    return e.condition;
}
function O8(e, t, n, i = {}) {
  if (ge(e) || ht(e) || pd(e)) {
    const r = ge(e) ? "string" : ht(e) ? "number" : "boolean";
    return U(Wre(t, r, e)), { value: e };
  }
  return ue(e) ? A0(e, t, n, i) : pm(e) ? Object.assign(Object.assign({}, e), {
    condition: A0(e.condition, t, n, i)
  }) : e;
}
function A0(e, t, n, i) {
  if (b8(e)) {
    const { format: r, formatType: o } = e, a = vb(e, ["format", "formatType"]);
    if (Rs(o) && !n.customFormatTypes)
      return U(AF(t)), A0(a, t, n, i);
  } else {
    const r = kA(e) ? "axis" : v8(e) ? "legend" : OA(e) ? "header" : null;
    if (r && e[r]) {
      const o = e[r], { format: a, formatType: s } = o, u = vb(o, ["format", "formatType"]);
      if (Rs(s) && !n.customFormatTypes)
        return U(AF(t)), A0(Object.assign(Object.assign({}, e), { [r]: u }), t, n, i);
    }
  }
  return G(e) ? MA(e, t, i) : Vae(e);
}
function Vae(e) {
  let t = e.type;
  if (t)
    return e;
  const { datum: n } = e;
  return t = ht(n) ? "quantitative" : ge(n) ? "nominal" : tu(n) ? "temporal" : void 0, Object.assign(Object.assign({}, e), { type: t });
}
function MA(e, t, { compositeMark: n = !1 } = {}) {
  const { aggregate: i, timeUnit: r, bin: o, field: a } = e, s = Object.assign({}, e);
  if (!n && i && !JE(i) && !Sa(i) && !po(i) && (U(Hre(i)), delete s.aggregate), r && (s.timeUnit = bn(r)), a && (s.field = `${a}`), Ve(o) && (s.bin = ym(o, t)), cn(o) && !Er(t) && U(Eoe(t)), yi(s)) {
    const { type: u } = s, l = Koe(u);
    u !== l && (s.type = l), u !== "quantitative" && FR(i) && (U(Gre(u, i)), s.type = "quantitative");
  } else if (!NR(t)) {
    const u = Xae(s, t);
    s.type = u;
  }
  if (yi(s)) {
    const { compatible: u, warning: l } = Kae(s, t) || {};
    u === !1 && U(l);
  }
  if (SA(s) && ge(s.sort)) {
    const { sort: u } = s;
    if (DF(u))
      return Object.assign(Object.assign({}, s), { sort: { encoding: u } });
    const l = u.substr(1);
    if (u.charAt(0) === "-" && DF(l))
      return Object.assign(Object.assign({}, s), { sort: { encoding: l, order: "descending" } });
  }
  if (OA(s)) {
    const { header: u } = s, { orient: l } = u, c = vb(u, ["orient"]);
    if (l)
      return Object.assign(Object.assign({}, s), { header: Object.assign(Object.assign({}, c), { labelOrient: u.labelOrient || l, titleOrient: u.titleOrient || l }) });
  }
  return s;
}
function ym(e, t) {
  return pd(e) ? { maxbins: mF(t) } : e === "binned" ? {
    binned: !0
  } : !e.maxbins && !e.step ? Object.assign(Object.assign({}, e), { maxbins: mF(t) }) : e;
}
const za = { compatible: !0 };
function Kae(e, t) {
  const n = e.type;
  if (n === "geojson" && t !== "shape")
    return {
      compatible: !1,
      warning: `Channel ${t} should not be used with a geojson data.`
    };
  switch (t) {
    case ao:
    case so:
    case Qp:
      return w8(e) ? {
        compatible: !1,
        warning: Vre(t)
      } : za;
    case et:
    case xt:
    case jn:
    case Rr:
    case jr:
    case xd:
    case Ed:
    case Zp:
    case Ts:
    case em:
    case tm:
    case Zs:
    case Vi:
    case Mr:
    case nm:
      return za;
    case Nr:
    case gi:
    case Tr:
    case Ki:
      return n !== Ns ? {
        compatible: !1,
        warning: `Channel ${t} should be used with a quantitative field only, not ${e.type} field.`
      } : za;
    case Ao:
    case Ca:
    case Fa:
    case ka:
    case Eo:
    case wo:
    case xo:
    case Xi:
    case $r:
      return n === "nominal" && !e.sort ? {
        compatible: !1,
        warning: `Channel ${t} should not be used with an unsorted discrete field.`
      } : za;
    case Da:
      return ie(["ordinal", "nominal"], e.type) ? za : {
        compatible: !1,
        warning: "StrokeDash channel should be used with only discrete data."
      };
    case Pn:
      return ie(["ordinal", "nominal", "geojson"], e.type) ? za : {
        compatible: !1,
        warning: "Shape channel should be used with only either discrete or geojson data."
      };
    case wd:
      return e.type === "nominal" && !("sort" in e) ? {
        compatible: !1,
        warning: "Channel order is inappropriate for nominal field, which has no inherent order."
      } : za;
  }
}
function fl(e) {
  const { formatType: t } = E0(e);
  return t === "time" || !t && Jae(e);
}
function Jae(e) {
  return e && (e.type === "temporal" || G(e) && !!e.timeUnit);
}
function vm(e, { timeUnit: t, type: n, wrapTime: i, undefinedIfExprNotRequired: r }) {
  var o;
  const a = t && ((o = bn(t)) === null || o === void 0 ? void 0 : o.unit);
  let s = a || n === "temporal", u;
  return Od(e) ? u = e.expr : se(e) ? u = e.signal : tu(e) ? (s = !0, u = Cf(e)) : (ge(e) || ht(e)) && s && (u = `datetime(${JSON.stringify(e)})`, Roe(a) && (ht(e) && e < 1e4 || ge(e) && isNaN(Date.parse(e))) && (u = Cf({ [a]: e }))), u ? i && s ? `time(${u})` : u : r ? void 0 : JSON.stringify(e);
}
function S8(e, t) {
  const { type: n } = e;
  return t.map((i) => {
    const r = vm(i, {
      timeUnit: G(e) ? e.timeUnit : void 0,
      type: n,
      undefinedIfExprNotRequired: !0
    });
    return r !== void 0 ? { signal: r } : i;
  });
}
function Fd(e, t) {
  return Ve(e.bin) ? Ma(t) && ie(["ordinal", "nominal"], e.type) : (console.warn("Only call this method for binned field defs."), !1);
}
var Qae = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function C8(e) {
  const {
    anchor: t,
    frame: n,
    offset: i,
    orient: r,
    color: o,
    subtitleColor: a,
    subtitleFont: s,
    subtitleFontSize: u,
    subtitleFontStyle: l,
    subtitleFontWeight: c,
    subtitleLineHeight: f,
    subtitlePadding: d
  } = e, h = Qae(e, ["anchor", "frame", "offset", "orient", "color", "subtitleColor", "subtitleFont", "subtitleFontSize", "subtitleFontStyle", "subtitleFontWeight", "subtitleLineHeight", "subtitlePadding"]), g = Object.assign(Object.assign({}, h), o ? { fill: o } : {}), p = Object.assign(Object.assign(Object.assign(Object.assign({}, t ? { anchor: t } : {}), n ? { frame: n } : {}), i ? { offset: i } : {}), r ? { orient: r } : {}), m = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, a ? { subtitleColor: a } : {}), s ? { subtitleFont: s } : {}), u ? { subtitleFontSize: u } : {}), l ? { subtitleFontStyle: l } : {}), c ? { subtitleFontWeight: c } : {}), f ? { subtitleLineHeight: f } : {}), d ? { subtitlePadding: d } : {}), y = al(g, ["align", "baseline", "dx", "dy", "limit"]);
  return { titleMarkConfig: g, subtitleMarkConfig: y, nonMark: p, subtitle: m };
}
function Po(e) {
  return ge(e) || K(e) && ge(e[0]);
}
var TA = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function F8(e) {
  const t = K(e.condition) ? e.condition.map(MF) : MF(e.condition);
  return Object.assign(Object.assign({}, dn(e)), { condition: t });
}
function dn(e) {
  if (Od(e)) {
    const { expr: t } = e, n = TA(e, ["expr"]);
    return Object.assign({ signal: t }, n);
  }
  return e;
}
function MF(e) {
  if (Od(e)) {
    const { expr: t } = e, n = TA(e, ["expr"]);
    return Object.assign({ signal: t }, n);
  }
  return e;
}
function Ze(e) {
  if (Od(e)) {
    const { expr: t } = e, n = TA(e, ["expr"]);
    return Object.assign({ signal: t }, n);
  }
  return se(e) ? e : e !== void 0 ? { value: e } : void 0;
}
function TF(e) {
  return se(e) ? e.signal : _e(e.value);
}
function uo(e) {
  return se(e) ? e.signal : e == null ? null : _e(e);
}
function Zae(e, t, n) {
  for (const i of n) {
    const r = js(i, t.markDef, t.config);
    r !== void 0 && (e[i] = Ze(r));
  }
  return e;
}
function k8(e) {
  var t;
  return [].concat(e.type, (t = e.style) !== null && t !== void 0 ? t : []);
}
function Re(e, t, n, i = {}) {
  const { vgChannel: r, ignoreVgConfig: o } = i;
  return r && t[r] !== void 0 ? t[r] : t[e] !== void 0 ? t[e] : o && (!r || r === e) ? void 0 : js(e, t, n, i);
}
function js(e, t, n, { vgChannel: i } = {}) {
  return ct(
    i ? _0(e, t, n.style) : void 0,
    _0(e, t, n.style),
    i ? n[t.type][i] : void 0,
    n[t.type][e],
    i ? n.mark[i] : n.mark[e]
  );
}
function _0(e, t, n) {
  return D8(e, k8(t), n);
}
function D8(e, t, n) {
  t = lt(t);
  let i;
  for (const r of t) {
    const o = n[r];
    o && o[e] !== void 0 && (i = o[e]);
  }
  return i;
}
function $8(e, t) {
  return lt(e).reduce((n, i) => {
    var r;
    return n.field.push(W(i, t)), n.order.push((r = i.sort) !== null && r !== void 0 ? r : "ascending"), n;
  }, { field: [], order: [] });
}
function M8(e, t) {
  const n = [...e];
  return t.forEach((i) => {
    for (const r of n)
      if (Tl(r, i))
        return;
    n.push(i);
  }), n;
}
function T8(e, t) {
  return Tl(e, t) || !t ? e : e ? [...lt(e), ...lt(t)].join(", ") : t;
}
function N8(e, t) {
  const n = e.value, i = t.value;
  if (n == null || i === null)
    return {
      explicit: e.explicit,
      value: null
    };
  if ((Po(n) || se(n)) && (Po(i) || se(i)))
    return {
      explicit: e.explicit,
      value: T8(n, i)
    };
  if (Po(n) || se(n))
    return {
      explicit: e.explicit,
      value: n
    };
  if (Po(i) || se(i))
    return {
      explicit: e.explicit,
      value: i
    };
  if (!Po(n) && !se(n) && !Po(i) && !se(i))
    return {
      explicit: e.explicit,
      value: M8(n, i)
    };
  throw new Error("It should never reach here");
}
function _o(e) {
  return "mark" in e;
}
class bm {
  constructor(t, n) {
    this.name = t, this.run = n;
  }
  hasMatchingType(t) {
    return _o(t) ? Mae(t.mark) === this.name : !1;
  }
}
var ese = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function ys(e, t) {
  const n = e && e[t];
  return n ? K(n) ? sl(n, (i) => !!i.field) : G(n) || gm(n) : !1;
}
function NA(e) {
  return sl(hre, (t) => {
    if (ys(e, t)) {
      const n = e[t];
      if (K(n))
        return sl(n, (i) => !!i.aggregate);
      {
        const i = Ar(n);
        return i && !!i.aggregate;
      }
    }
    return !1;
  });
}
function R8(e, t) {
  const n = [], i = [], r = [], o = [], a = {};
  return RA(e, (s, u) => {
    if (G(s)) {
      const { field: l, aggregate: c, bin: f, timeUnit: d } = s, h = ese(s, ["field", "aggregate", "bin", "timeUnit"]);
      if (c || d || f) {
        const g = DA(s), p = g && g.title;
        let m = W(s, { forAs: !0 });
        const y = Object.assign(Object.assign(Object.assign({}, p ? [] : { title: Pu(s, t, { allowDisabling: !0 }) }), h), {
          field: m
        });
        if (c) {
          let v;
          if (Sa(c) ? (v = "argmax", m = W({ op: "argmax", field: c.argmax }, { forAs: !0 }), y.field = `${m}.${l}`) : po(c) ? (v = "argmin", m = W({ op: "argmin", field: c.argmin }, { forAs: !0 }), y.field = `${m}.${l}`) : c !== "boxplot" && c !== "errorbar" && c !== "errorband" && (v = c), v) {
            const b = {
              op: v,
              as: m
            };
            l && (b.field = l), o.push(b);
          }
        } else if (n.push(m), yi(s) && Ve(f)) {
          if (i.push({ bin: f, field: l, as: m }), n.push(W(s, { binSuffix: "end" })), Fd(s, u) && n.push(W(s, { binSuffix: "range" })), Er(u)) {
            const v = {
              field: m + "_end"
            };
            a[u + "2"] = v;
          }
          y.bin = "binned", NR(u) || (y.type = Ns);
        } else if (d) {
          r.push({
            timeUnit: d,
            field: l,
            as: m
          });
          const v = yi(s) && s.type !== cl && "time";
          v && (u === xd || u === Ts ? y.formatType = v : Ere(u) ? y.legend = Object.assign({ formatType: v }, y.legend) : Er(u) && (y.axis = Object.assign({ formatType: v }, y.axis)));
        }
        a[u] = y;
      } else
        n.push(l), a[u] = e[u];
    } else
      a[u] = e[u];
  }), {
    bins: i,
    timeUnits: r,
    aggregate: o,
    groupby: n,
    encoding: a
  };
}
function tse(e, t, n) {
  const i = _re(t, n);
  if (i) {
    if (i === "binned") {
      const r = e[t === Xi ? et : xt];
      return !!(G(r) && G(e[t]) && cn(r.bin));
    }
  } else
    return !1;
  return !0;
}
function nse(e, t, n, i) {
  return B(e).reduce((r, o) => {
    if (!TR(o))
      return U(Xre(o)), r;
    const a = e[o];
    if (o === "angle" && t === "arc" && !e.theta && (U(qre), o = Vi), !tse(e, o, t))
      return U(am(o, t)), r;
    if (o === Eo && t === "line") {
      const s = Ar(e[o]);
      if (s != null && s.aggregate)
        return U(Yre), r;
    }
    if (o === jn && (n ? "fill" in e : "stroke" in e))
      return U(zR("encoding", { fill: "fill" in e, stroke: "stroke" in e })), r;
    if (o === Ed || o === wd && !K(a) && !Wi(a) || o === Ts && K(a))
      a && (r[o] = lt(a).reduce((s, u) => (G(u) ? s.push(MA(u, o)) : U(gb(u, o)), s), []));
    else {
      if (o === Ts && a === null)
        r[o] = null;
      else if (!G(a) && !Ra(a) && !Wi(a) && !FA(a) && !se(a))
        return U(gb(a, o)), r;
      r[o] = O8(a, o, i);
    }
    return r;
  }, {});
}
function xm(e, t) {
  const n = {};
  for (const i of B(e)) {
    const r = O8(e[i], i, t, { compositeMark: !0 });
    n[i] = r;
  }
  return n;
}
function ise(e) {
  const t = [];
  for (const n of B(e))
    if (ys(e, n)) {
      const i = e[n], r = lt(i);
      for (const o of r)
        G(o) ? t.push(o) : gm(o) && t.push(o.condition);
    }
  return t;
}
function RA(e, t, n) {
  if (!!e)
    for (const i of B(e)) {
      const r = e[i];
      if (K(r))
        for (const o of r)
          t.call(n, o, i);
      else
        t.call(n, r, i);
    }
}
function rse(e, t, n, i) {
  return e ? B(e).reduce((r, o) => {
    const a = e[o];
    return K(a) ? a.reduce((s, u) => t.call(i, s, u, o), r) : t.call(i, r, a, o);
  }, n) : n;
}
function j8(e, t) {
  return B(t).reduce((n, i) => {
    switch (i) {
      case et:
      case xt:
      case em:
      case nm:
      case tm:
      case Xi:
      case $r:
      case Vi:
      case wo:
      case Mr:
      case xo:
      case Tr:
      case Nr:
      case Ki:
      case gi:
      case xd:
      case Pn:
      case Zs:
      case Ts:
        return n;
      case wd:
        if (e === "line" || e === "trail")
          return n;
      case Ed:
      case Zp: {
        const r = t[i];
        if (K(r) || G(r))
          for (const o of lt(r))
            o.aggregate || n.push(W(o, {}));
        return n;
      }
      case Eo:
        if (e === "trail")
          return n;
      case jn:
      case Rr:
      case jr:
      case Ao:
      case Ca:
      case Fa:
      case Da:
      case ka: {
        const r = Ar(t[i]);
        return r && !r.aggregate && n.push(W(r, {})), n;
      }
    }
  }, []);
}
var P8 = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function ose(e) {
  const { tooltip: t } = e, n = P8(e, ["tooltip"]);
  if (!t)
    return { filteredEncoding: n };
  let i, r;
  if (K(t)) {
    for (const o of t)
      o.aggregate ? (i || (i = []), i.push(o)) : (r || (r = []), r.push(o));
    i && (n.tooltip = i);
  } else
    t.aggregate ? n.tooltip = t : r = t;
  return K(r) && r.length === 1 && (r = r[0]), { customTooltipWithoutAggregatedField: r, filteredEncoding: n };
}
function xb(e, t, n, i = !0) {
  if ("tooltip" in n)
    return { tooltip: n.tooltip };
  const r = e.map(({ fieldPrefix: a, titlePrefix: s }) => {
    const u = i ? ` of ${jA(t)}` : "";
    return {
      field: a + t.field,
      type: t.type,
      title: se(s) ? { signal: s + `"${escape(u)}"` } : s + u
    };
  }), o = ise(n).map(Uae);
  return {
    tooltip: [
      ...r,
      ...lr(o, we)
    ]
  };
}
function jA(e) {
  const { title: t, field: n } = e;
  return ct(t, n);
}
function PA(e, t, n, i, r) {
  const { scale: o, axis: a } = n;
  return ({ partName: s, mark: u, positionPrefix: l, endPositionPrefix: c = void 0, extraEncoding: f = {} }) => {
    const d = jA(n);
    return L8(e, s, r, {
      mark: u,
      encoding: Object.assign(Object.assign(Object.assign({ [t]: Object.assign(Object.assign(Object.assign({ field: l + "_" + n.field, type: n.type }, d !== void 0 ? { title: d } : {}), o !== void 0 ? { scale: o } : {}), a !== void 0 ? { axis: a } : {}) }, ge(c) ? {
        [t + "2"]: {
          field: c + "_" + n.field
        }
      } : {}), i), f)
    });
  };
}
function L8(e, t, n, i) {
  const { clip: r, color: o, opacity: a } = e, s = e.type;
  return e[t] || e[t] === void 0 && n[t] ? [
    Object.assign(Object.assign({}, i), { mark: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, n[t]), r ? { clip: r } : {}), o ? { color: o } : {}), a ? { opacity: a } : {}), mo(i.mark) ? i.mark : { type: i.mark }), { style: `${s}-${t}` }), pd(e[t]) ? {} : e[t]) })
  ] : [];
}
function I8(e, t, n) {
  const { encoding: i } = e, r = t === "vertical" ? "y" : "x", o = i[r], a = i[r + "2"], s = i[r + "Error"], u = i[r + "Error2"];
  return {
    continuousAxisChannelDef: fh(o, n),
    continuousAxisChannelDef2: fh(a, n),
    continuousAxisChannelDefError: fh(s, n),
    continuousAxisChannelDefError2: fh(u, n),
    continuousAxis: r
  };
}
function fh(e, t) {
  if (e && e.aggregate) {
    const { aggregate: n } = e, i = P8(e, ["aggregate"]);
    return n !== t && U(woe(n, t)), i;
  } else
    return e;
}
function B8(e, t) {
  const { mark: n, encoding: i } = e, { x: r, y: o } = i;
  if (mo(n) && n.orient)
    return n.orient;
  if (cr(r)) {
    if (cr(o)) {
      const a = G(r) && r.aggregate, s = G(o) && o.aggregate;
      if (!a && s === t)
        return "vertical";
      if (!s && a === t)
        return "horizontal";
      if (a === t && s === t)
        throw new Error("Both x and y cannot have aggregate");
      return fl(o) && !fl(r) ? "horizontal" : "vertical";
    }
    return "horizontal";
  } else {
    if (cr(o))
      return "vertical";
    throw new Error(`Need a valid continuous axis for ${t}s`);
  }
}
var Kh = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
const O0 = "boxplot", ase = ["box", "median", "outliers", "rule", "ticks"], sse = new bm(O0, U8);
function z8(e) {
  return ht(e) ? "tukey" : e;
}
function U8(e, { config: t }) {
  var n, i;
  e = Object.assign(Object.assign({}, e), { encoding: xm(e.encoding, t) });
  const { mark: r, encoding: o, selection: a, projection: s } = e, u = Kh(e, ["mark", "encoding", "selection", "projection"]), l = mo(r) ? r : { type: r };
  a && U(IR("boxplot"));
  const c = (n = l.extent) !== null && n !== void 0 ? n : t.boxplot.extent, f = Re(
    "size",
    l,
    t
  ), d = z8(c), { bins: h, timeUnits: g, transform: p, continuousAxisChannelDef: m, continuousAxis: y, groupby: v, aggregate: b, encodingWithoutContinuousAxis: x, ticksOrient: E, boxOrient: A, customTooltipWithoutAggregatedField: w } = use(e, c, t), { color: _, size: k } = x, C = Kh(x, ["color", "size"]), O = (at) => PA(l, y, m, at, t.boxplot), S = O(C), D = O(x), M = O(Object.assign(Object.assign({}, C), k ? { size: k } : {})), F = xb([
    { fieldPrefix: d === "min-max" ? "upper_whisker_" : "max_", titlePrefix: "Max" },
    { fieldPrefix: "upper_box_", titlePrefix: "Q3" },
    { fieldPrefix: "mid_box_", titlePrefix: "Median" },
    { fieldPrefix: "lower_box_", titlePrefix: "Q1" },
    { fieldPrefix: d === "min-max" ? "lower_whisker_" : "min_", titlePrefix: "Min" }
  ], m, x), $ = { type: "tick", color: "black", opacity: 1, orient: E, invalid: null, aria: !1 }, T = d === "min-max" ? F : xb([
    { fieldPrefix: "upper_whisker_", titlePrefix: "Upper Whisker" },
    { fieldPrefix: "lower_whisker_", titlePrefix: "Lower Whisker" }
  ], m, x), L = [
    ...S({
      partName: "rule",
      mark: { type: "rule", invalid: null, aria: !1 },
      positionPrefix: "lower_whisker",
      endPositionPrefix: "lower_box",
      extraEncoding: T
    }),
    ...S({
      partName: "rule",
      mark: { type: "rule", invalid: null, aria: !1 },
      positionPrefix: "upper_box",
      endPositionPrefix: "upper_whisker",
      extraEncoding: T
    }),
    ...S({
      partName: "ticks",
      mark: $,
      positionPrefix: "lower_whisker",
      extraEncoding: T
    }),
    ...S({
      partName: "ticks",
      mark: $,
      positionPrefix: "upper_whisker",
      extraEncoding: T
    })
  ], I = [
    ...d !== "tukey" ? L : [],
    ...D({
      partName: "box",
      mark: Object.assign(Object.assign({ type: "bar" }, f ? { size: f } : {}), { orient: A, invalid: null, ariaRoleDescription: "box" }),
      positionPrefix: "lower_box",
      endPositionPrefix: "upper_box",
      extraEncoding: F
    }),
    ...M({
      partName: "median",
      mark: Object.assign(Object.assign(Object.assign({ type: "tick", invalid: null }, ut(t.boxplot.median) && t.boxplot.median.color ? { color: t.boxplot.median.color } : {}), f ? { size: f } : {}), { orient: E, aria: !1 }),
      positionPrefix: "mid_box",
      extraEncoding: F
    })
  ];
  if (d === "min-max")
    return Object.assign(Object.assign({}, u), { transform: ((i = u.transform) !== null && i !== void 0 ? i : []).concat(p), layer: I });
  const Y = `datum["lower_box_${m.field}"]`, fe = `datum["upper_box_${m.field}"]`, Me = `(${fe} - ${Y})`, Oe = `${Y} - ${c} * ${Me}`, Be = `${fe} + ${c} * ${Me}`, Se = `datum["${m.field}"]`, en = {
    joinaggregate: q8(m.field),
    groupby: v
  }, ei = {
    transform: [
      {
        filter: `(${Oe} <= ${Se}) && (${Se} <= ${Be})`
      },
      {
        aggregate: [
          {
            op: "min",
            field: m.field,
            as: "lower_whisker_" + m.field
          },
          {
            op: "max",
            field: m.field,
            as: "upper_whisker_" + m.field
          },
          {
            op: "min",
            field: "lower_box_" + m.field,
            as: "lower_box_" + m.field
          },
          {
            op: "max",
            field: "upper_box_" + m.field,
            as: "upper_box_" + m.field
          },
          ...b
        ],
        groupby: v
      }
    ],
    layer: L
  }, tn = Kh(C, ["tooltip"]), { scale: H, axis: le } = m, ve = jA(m), z = Xn(le, ["title"]), Je = L8(l, "outliers", t.boxplot, {
    transform: [{ filter: `(${Se} < ${Oe}) || (${Se} > ${Be})` }],
    mark: "point",
    encoding: Object.assign(Object.assign(Object.assign({ [y]: Object.assign(Object.assign(Object.assign({ field: m.field, type: m.type }, ve !== void 0 ? { title: ve } : {}), H !== void 0 ? { scale: H } : {}), Ie(z) ? {} : { axis: z }) }, tn), _ ? { color: _ } : {}), w ? { tooltip: w } : {})
  })[0];
  let be;
  const pt = [...h, ...g, en];
  return Je ? be = {
    transform: pt,
    layer: [Je, ei]
  } : (be = ei, be.transform.unshift(...pt)), Object.assign(Object.assign({}, u), { layer: [
    be,
    {
      transform: p,
      layer: I
    }
  ] });
}
function q8(e) {
  return [
    {
      op: "q1",
      field: e,
      as: "lower_box_" + e
    },
    {
      op: "q3",
      field: e,
      as: "upper_box_" + e
    }
  ];
}
function use(e, t, n) {
  const i = B8(e, O0), { continuousAxisChannelDef: r, continuousAxis: o } = I8(e, i, O0), a = r.field, s = z8(t), u = [
    ...q8(a),
    {
      op: "median",
      field: a,
      as: "mid_box_" + a
    },
    {
      op: "min",
      field: a,
      as: (s === "min-max" ? "lower_whisker_" : "min_") + a
    },
    {
      op: "max",
      field: a,
      as: (s === "min-max" ? "upper_whisker_" : "max_") + a
    }
  ], l = s === "min-max" || s === "tukey" ? [] : [
    {
      calculate: `datum["upper_box_${a}"] - datum["lower_box_${a}"]`,
      as: "iqr_" + a
    },
    {
      calculate: `min(datum["upper_box_${a}"] + datum["iqr_${a}"] * ${t}, datum["max_${a}"])`,
      as: "upper_whisker_" + a
    },
    {
      calculate: `max(datum["lower_box_${a}"] - datum["iqr_${a}"] * ${t}, datum["min_${a}"])`,
      as: "lower_whisker_" + a
    }
  ], c = e.encoding, f = o;
  c[f];
  const d = Kh(c, [typeof f == "symbol" ? f : f + ""]), { customTooltipWithoutAggregatedField: h, filteredEncoding: g } = ose(d), { bins: p, timeUnits: m, aggregate: y, groupby: v, encoding: b } = R8(g, n), x = i === "vertical" ? "horizontal" : "vertical", E = i, A = [
    ...p,
    ...m,
    {
      aggregate: [...y, ...u],
      groupby: v
    },
    ...l
  ];
  return {
    bins: p,
    timeUnits: m,
    transform: A,
    groupby: v,
    aggregate: y,
    continuousAxisChannelDef: r,
    continuousAxis: o,
    encodingWithoutContinuousAxis: b,
    ticksOrient: x,
    boxOrient: E,
    customTooltipWithoutAggregatedField: h
  };
}
var NF = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
const LA = "errorbar", lse = ["ticks", "rule"], cse = new bm(LA, W8);
function W8(e, { config: t }) {
  e = Object.assign(Object.assign({}, e), { encoding: xm(e.encoding, t) });
  const { transform: n, continuousAxisChannelDef: i, continuousAxis: r, encodingWithoutContinuousAxis: o, ticksOrient: a, markDef: s, outerSpec: u, tooltipEncoding: l } = G8(e, LA, t);
  delete o.size;
  const c = PA(s, r, i, o, t.errorbar), f = s.thickness, d = s.size, h = Object.assign(Object.assign({ type: "tick", orient: a, aria: !1 }, f !== void 0 ? { thickness: f } : {}), d !== void 0 ? { size: d } : {}), g = [
    ...c({
      partName: "ticks",
      mark: h,
      positionPrefix: "lower",
      extraEncoding: l
    }),
    ...c({
      partName: "ticks",
      mark: h,
      positionPrefix: "upper",
      extraEncoding: l
    }),
    ...c({
      partName: "rule",
      mark: Object.assign({ type: "rule", ariaRoleDescription: "errorbar" }, f !== void 0 ? { size: f } : {}),
      positionPrefix: "lower",
      endPositionPrefix: "upper",
      extraEncoding: l
    })
  ];
  return Object.assign(Object.assign(Object.assign({}, u), { transform: n }), g.length > 1 ? { layer: g } : Object.assign({}, g[0]));
}
function fse(e, t) {
  const { encoding: n } = e;
  if (dse(n))
    return {
      orient: B8(e, t),
      inputType: "raw"
    };
  const i = hse(n), r = gse(n), o = n.x, a = n.y;
  if (i) {
    if (r)
      throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);
    const s = n.x2, u = n.y2;
    if (ue(s) && ue(u))
      throw new Error(`${t} cannot have both x2 and y2`);
    if (ue(s)) {
      if (cr(o))
        return { orient: "horizontal", inputType: "aggregated-upper-lower" };
      throw new Error(`Both x and x2 have to be quantitative in ${t}`);
    } else if (ue(u)) {
      if (cr(a))
        return { orient: "vertical", inputType: "aggregated-upper-lower" };
      throw new Error(`Both y and y2 have to be quantitative in ${t}`);
    }
    throw new Error("No ranged axis");
  } else {
    const s = n.xError, u = n.xError2, l = n.yError, c = n.yError2;
    if (ue(u) && !ue(s))
      throw new Error(`${t} cannot have xError2 without xError`);
    if (ue(c) && !ue(l))
      throw new Error(`${t} cannot have yError2 without yError`);
    if (ue(s) && ue(l))
      throw new Error(`${t} cannot have both xError and yError with both are quantiative`);
    if (ue(s)) {
      if (cr(o))
        return { orient: "horizontal", inputType: "aggregated-error" };
      throw new Error("All x, xError, and xError2 (if exist) have to be quantitative");
    } else if (ue(l)) {
      if (cr(a))
        return { orient: "vertical", inputType: "aggregated-error" };
      throw new Error("All y, yError, and yError2 (if exist) have to be quantitative");
    }
    throw new Error("No ranged axis");
  }
}
function dse(e) {
  return (ue(e.x) || ue(e.y)) && !ue(e.x2) && !ue(e.y2) && !ue(e.xError) && !ue(e.xError2) && !ue(e.yError) && !ue(e.yError2);
}
function hse(e) {
  return ue(e.x2) || ue(e.y2);
}
function gse(e) {
  return ue(e.xError) || ue(e.xError2) || ue(e.yError) || ue(e.yError2);
}
function G8(e, t, n) {
  var i;
  const { mark: r, encoding: o, selection: a, projection: s } = e, u = NF(e, ["mark", "encoding", "selection", "projection"]), l = mo(r) ? r : { type: r };
  a && U(IR(t));
  const { orient: c, inputType: f } = fse(e, t), { continuousAxisChannelDef: d, continuousAxisChannelDef2: h, continuousAxisChannelDefError: g, continuousAxisChannelDefError2: p, continuousAxis: m } = I8(e, c, t), { errorBarSpecificAggregate: y, postAggregateCalculates: v, tooltipSummary: b, tooltipTitleWithFieldName: x } = pse(l, d, h, g, p, f, t, n), E = o, A = m;
  E[A];
  const w = m === "x" ? "x2" : "y2";
  E[w];
  const _ = m === "x" ? "xError" : "yError";
  E[_];
  const k = m === "x" ? "xError2" : "yError2";
  E[k];
  const C = NF(E, [typeof A == "symbol" ? A : A + "", typeof w == "symbol" ? w : w + "", typeof _ == "symbol" ? _ : _ + "", typeof k == "symbol" ? k : k + ""]), { bins: O, timeUnits: S, aggregate: D, groupby: M, encoding: F } = R8(C, n), $ = [...D, ...y], T = f !== "raw" ? [] : M, L = xb(b, d, F, x);
  return {
    transform: [
      ...(i = u.transform) !== null && i !== void 0 ? i : [],
      ...O,
      ...S,
      ...$.length === 0 ? [] : [{ aggregate: $, groupby: T }],
      ...v
    ],
    groupby: T,
    continuousAxisChannelDef: d,
    continuousAxis: m,
    encodingWithoutContinuousAxis: F,
    ticksOrient: c === "vertical" ? "horizontal" : "vertical",
    markDef: l,
    outerSpec: u,
    tooltipEncoding: L
  };
}
function pse(e, t, n, i, r, o, a, s) {
  let u = [], l = [];
  const c = t.field;
  let f, d = !1;
  if (o === "raw") {
    const h = e.center ? e.center : e.extent ? e.extent === "iqr" ? "median" : "mean" : s.errorbar.center, g = e.extent ? e.extent : h === "mean" ? "stderr" : "iqr";
    if (h === "median" != (g === "iqr") && U(xoe(h, g, a)), g === "stderr" || g === "stdev")
      u = [
        { op: g, field: c, as: "extent_" + c },
        { op: h, field: c, as: "center_" + c }
      ], l = [
        {
          calculate: `datum["center_${c}"] + datum["extent_${c}"]`,
          as: "upper_" + c
        },
        {
          calculate: `datum["center_${c}"] - datum["extent_${c}"]`,
          as: "lower_" + c
        }
      ], f = [
        { fieldPrefix: "center_", titlePrefix: yd(h) },
        { fieldPrefix: "upper_", titlePrefix: RF(h, g, "+") },
        { fieldPrefix: "lower_", titlePrefix: RF(h, g, "-") }
      ], d = !0;
    else {
      let p, m, y;
      g === "ci" ? (p = "mean", m = "ci0", y = "ci1") : (p = "median", m = "q1", y = "q3"), u = [
        { op: m, field: c, as: "lower_" + c },
        { op: y, field: c, as: "upper_" + c },
        { op: p, field: c, as: "center_" + c }
      ], f = [
        {
          fieldPrefix: "upper_",
          titlePrefix: Pu({ field: c, aggregate: y, type: "quantitative" }, s, {
            allowDisabling: !1
          })
        },
        {
          fieldPrefix: "lower_",
          titlePrefix: Pu({ field: c, aggregate: m, type: "quantitative" }, s, {
            allowDisabling: !1
          })
        },
        {
          fieldPrefix: "center_",
          titlePrefix: Pu({ field: c, aggregate: p, type: "quantitative" }, s, {
            allowDisabling: !1
          })
        }
      ];
    }
  } else {
    (e.center || e.extent) && U(boe(e.center, e.extent)), o === "aggregated-upper-lower" ? (f = [], l = [
      { calculate: `datum["${n.field}"]`, as: "upper_" + c },
      { calculate: `datum["${c}"]`, as: "lower_" + c }
    ]) : o === "aggregated-error" && (f = [{ fieldPrefix: "", titlePrefix: c }], l = [
      {
        calculate: `datum["${c}"] + datum["${i.field}"]`,
        as: "upper_" + c
      }
    ], r ? l.push({
      calculate: `datum["${c}"] + datum["${r.field}"]`,
      as: "lower_" + c
    }) : l.push({
      calculate: `datum["${c}"] - datum["${i.field}"]`,
      as: "lower_" + c
    }));
    for (const h of l)
      f.push({
        fieldPrefix: h.as.substring(0, 6),
        titlePrefix: Ms(Ms(h.calculate, 'datum["', ""), '"]', "")
      });
  }
  return { postAggregateCalculates: l, errorBarSpecificAggregate: u, tooltipSummary: f, tooltipTitleWithFieldName: d };
}
function RF(e, t, n) {
  return yd(e) + " " + n + " " + t;
}
const IA = "errorband", mse = ["band", "borders"], yse = new bm(IA, H8);
function H8(e, { config: t }) {
  e = Object.assign(Object.assign({}, e), { encoding: xm(e.encoding, t) });
  const { transform: n, continuousAxisChannelDef: i, continuousAxis: r, encodingWithoutContinuousAxis: o, markDef: a, outerSpec: s, tooltipEncoding: u } = G8(e, IA, t), l = a, c = PA(l, r, i, o, t.errorband), f = e.encoding.x !== void 0 && e.encoding.y !== void 0;
  let d = { type: f ? "area" : "rect" }, h = { type: f ? "line" : "rule" };
  const g = Object.assign(Object.assign({}, l.interpolate ? { interpolate: l.interpolate } : {}), l.tension && l.interpolate ? { tension: l.tension } : {});
  return f ? (d = Object.assign(Object.assign(Object.assign({}, d), g), { ariaRoleDescription: "errorband" }), h = Object.assign(Object.assign(Object.assign({}, h), g), { aria: !1 })) : l.interpolate ? U(OF("interpolate")) : l.tension && U(OF("tension")), Object.assign(Object.assign({}, s), { transform: n, layer: [
    ...c({
      partName: "band",
      mark: d,
      positionPrefix: "lower",
      endPositionPrefix: "upper",
      extraEncoding: u
    }),
    ...c({
      partName: "borders",
      mark: h,
      positionPrefix: "lower",
      extraEncoding: u
    }),
    ...c({
      partName: "borders",
      mark: h,
      positionPrefix: "upper",
      extraEncoding: u
    })
  ] });
}
const Y8 = {};
function BA(e, t, n) {
  const i = new bm(e, t);
  Y8[e] = { normalizer: i, parts: n };
}
function vse() {
  return B(Y8);
}
BA(O0, U8, ase);
BA(LA, W8, lse);
BA(IA, H8, mse);
const bse = [
  "gradientHorizontalMaxLength",
  "gradientHorizontalMinLength",
  "gradientVerticalMaxLength",
  "gradientVerticalMinLength",
  "unselectedOpacity"
], X8 = {
  titleAlign: "align",
  titleAnchor: "anchor",
  titleAngle: "angle",
  titleBaseline: "baseline",
  titleColor: "color",
  titleFont: "font",
  titleFontSize: "fontSize",
  titleFontStyle: "fontStyle",
  titleFontWeight: "fontWeight",
  titleLimit: "limit",
  titleLineHeight: "lineHeight",
  titleOrient: "orient",
  titlePadding: "offset"
}, V8 = {
  labelAlign: "align",
  labelAnchor: "anchor",
  labelAngle: "angle",
  labelBaseline: "baseline",
  labelColor: "color",
  labelFont: "font",
  labelFontSize: "fontSize",
  labelFontStyle: "fontStyle",
  labelFontWeight: "fontWeight",
  labelLimit: "limit",
  labelLineHeight: "lineHeight",
  labelOrient: "orient",
  labelPadding: "offset"
}, xse = B(X8), wse = B(V8), Ese = {
  header: 1,
  headerRow: 1,
  headerColumn: 1,
  headerFacet: 1
}, K8 = B(Ese), J8 = [
  "size",
  "shape",
  "fill",
  "stroke",
  "strokeDash",
  "strokeWidth",
  "opacity"
], Ase = {
  gradientHorizontalMaxLength: 200,
  gradientHorizontalMinLength: 100,
  gradientVerticalMaxLength: 200,
  gradientVerticalMinLength: 64,
  unselectedOpacity: 0.35
}, _se = {
  aria: 1,
  clipHeight: 1,
  columnPadding: 1,
  columns: 1,
  cornerRadius: 1,
  description: 1,
  direction: 1,
  fillColor: 1,
  format: 1,
  formatType: 1,
  gradientLength: 1,
  gradientOpacity: 1,
  gradientStrokeColor: 1,
  gradientStrokeWidth: 1,
  gradientThickness: 1,
  gridAlign: 1,
  labelAlign: 1,
  labelBaseline: 1,
  labelColor: 1,
  labelFont: 1,
  labelFontSize: 1,
  labelFontStyle: 1,
  labelFontWeight: 1,
  labelLimit: 1,
  labelOffset: 1,
  labelOpacity: 1,
  labelOverlap: 1,
  labelPadding: 1,
  labelSeparation: 1,
  legendX: 1,
  legendY: 1,
  offset: 1,
  orient: 1,
  padding: 1,
  rowPadding: 1,
  strokeColor: 1,
  symbolDash: 1,
  symbolDashOffset: 1,
  symbolFillColor: 1,
  symbolLimit: 1,
  symbolOffset: 1,
  symbolOpacity: 1,
  symbolSize: 1,
  symbolStrokeColor: 1,
  symbolStrokeWidth: 1,
  symbolType: 1,
  tickCount: 1,
  tickMinStep: 1,
  title: 1,
  titleAlign: 1,
  titleAnchor: 1,
  titleBaseline: 1,
  titleColor: 1,
  titleFont: 1,
  titleFontSize: 1,
  titleFontStyle: 1,
  titleFontWeight: 1,
  titleLimit: 1,
  titleLineHeight: 1,
  titleOpacity: 1,
  titleOrient: 1,
  titlePadding: 1,
  type: 1,
  values: 1,
  zindex: 1
};
var Ose = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function Q8(e) {
  const t = [];
  for (const n of e || []) {
    const { expr: i, bind: r } = n, o = Ose(n, ["expr", "bind"]);
    if (r && i) {
      const a = Object.assign(Object.assign({}, o), { bind: r, init: i });
      t.push(a);
    } else {
      const a = Object.assign(Object.assign(Object.assign({}, o), i ? { update: i } : {}), r ? { bind: r } : {});
      t.push(a);
    }
  }
  return t;
}
const dl = "_vgsid_", Sse = {
  single: {
    on: "click",
    fields: [dl],
    resolve: "global",
    empty: "all",
    clear: "dblclick"
  },
  multi: {
    on: "click",
    fields: [dl],
    toggle: "event.shiftKey",
    resolve: "global",
    empty: "all",
    clear: "dblclick"
  },
  interval: {
    on: "[mousedown, window:mouseup] > window:mousemove!",
    encodings: ["x", "y"],
    translate: "[mousedown, window:mouseup] > window:mousemove!",
    zoom: "wheel!",
    mark: { fill: "#333", fillOpacity: 0.125, stroke: "white" },
    resolve: "global",
    clear: "dblclick"
  }
};
function zA(e) {
  return !!e && (e === "legend" || !!e.legend);
}
function ty(e) {
  return zA(e) && ut(e);
}
function Cse(e) {
  return wm(e) || qA(e) || UA(e);
}
function UA(e) {
  return "concat" in e;
}
function wm(e) {
  return "vconcat" in e;
}
function qA(e) {
  return "hconcat" in e;
}
function _r(e) {
  return ut(e) && e.step !== void 0;
}
function jF(e) {
  return e.view || e.width || e.height;
}
const PF = 20, Fse = {
  align: 1,
  bounds: 1,
  center: 1,
  columns: 1,
  spacing: 1
}, kse = B(Fse);
function Dse(e, t, n) {
  var i, r;
  const o = n[t], a = {}, { spacing: s, columns: u } = o;
  s !== void 0 && (a.spacing = s), u !== void 0 && (hm(e) && !Sd(e.facet) || UA(e)) && (a.columns = u), wm(e) && (a.columns = 1);
  for (const l of kse)
    if (e[l] !== void 0)
      if (l === "spacing") {
        const c = e[l];
        a[l] = ht(c) ? c : {
          row: (i = c.row) !== null && i !== void 0 ? i : s,
          column: (r = c.column) !== null && r !== void 0 ? r : s
        };
      } else
        a[l] = e[l];
  return a;
}
var $se = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function wb(e, t) {
  var n;
  return (n = e[t]) !== null && n !== void 0 ? n : e[t === "width" ? "continuousWidth" : "continuousHeight"];
}
function S0(e, t) {
  const n = Ff(e, t);
  return _r(n) ? n.step : WA;
}
function Ff(e, t) {
  var n;
  const i = (n = e[t]) !== null && n !== void 0 ? n : e[t === "width" ? "discreteWidth" : "discreteHeight"];
  return ct(i, { step: e.step });
}
const WA = 20, Mse = {
  continuousWidth: 200,
  continuousHeight: 200,
  step: WA
}, Tse = {
  background: "white",
  padding: 5,
  timeFormat: "%b %d, %Y",
  countTitle: "Count of Records",
  view: Mse,
  mark: Sae,
  arc: {},
  area: {},
  bar: kae,
  circle: {},
  geoshape: {},
  image: {},
  line: {},
  point: {},
  rect: Dae,
  rule: { color: "black" },
  square: {},
  text: { color: "black" },
  tick: $ae,
  trail: {},
  boxplot: {
    size: 14,
    extent: 1.5,
    box: {},
    median: { color: "white" },
    outliers: {},
    rule: {},
    ticks: null
  },
  errorbar: {
    center: "mean",
    rule: !0,
    ticks: !1
  },
  errorband: {
    band: {
      opacity: 0.3
    },
    borders: !1
  },
  scale: cae,
  projection: {},
  legend: Ase,
  header: { titlePadding: 10, labelPadding: 10 },
  headerColumn: {},
  headerRow: {},
  headerFacet: {},
  selection: Sse,
  style: {},
  title: {},
  facet: { spacing: PF },
  concat: { spacing: PF }
}, qr = [
  "#4c78a8",
  "#f58518",
  "#e45756",
  "#72b7b2",
  "#54a24b",
  "#eeca3b",
  "#b279a2",
  "#ff9da6",
  "#9d755d",
  "#bab0ac"
], LF = {
  text: 11,
  guideLabel: 10,
  guideTitle: 11,
  groupTitle: 13,
  groupSubtitle: 12
}, IF = {
  blue: qr[0],
  orange: qr[1],
  red: qr[2],
  teal: qr[3],
  green: qr[4],
  yellow: qr[5],
  purple: qr[6],
  pink: qr[7],
  brown: qr[8],
  gray0: "#000",
  gray1: "#111",
  gray2: "#222",
  gray3: "#333",
  gray4: "#444",
  gray5: "#555",
  gray6: "#666",
  gray7: "#777",
  gray8: "#888",
  gray9: "#999",
  gray10: "#aaa",
  gray11: "#bbb",
  gray12: "#ccc",
  gray13: "#ddd",
  gray14: "#eee",
  gray15: "#fff"
};
function Nse(e = {}) {
  return {
    signals: [
      {
        name: "color",
        value: ut(e) ? Object.assign(Object.assign({}, IF), e) : IF
      }
    ],
    mark: { color: { signal: "color.blue" } },
    rule: { color: { signal: "color.gray0" } },
    text: {
      color: { signal: "color.gray0" }
    },
    style: {
      "guide-label": {
        fill: { signal: "color.gray0" }
      },
      "guide-title": {
        fill: { signal: "color.gray0" }
      },
      "group-title": {
        fill: { signal: "color.gray0" }
      },
      "group-subtitle": {
        fill: { signal: "color.gray0" }
      },
      cell: {
        stroke: { signal: "color.gray8" }
      }
    },
    axis: {
      domainColor: { signal: "color.gray13" },
      gridColor: { signal: "color.gray8" },
      tickColor: { signal: "color.gray13" }
    },
    range: {
      category: [
        { signal: "color.blue" },
        { signal: "color.orange" },
        { signal: "color.red" },
        { signal: "color.teal" },
        { signal: "color.green" },
        { signal: "color.yellow" },
        { signal: "color.purple" },
        { signal: "color.pink" },
        { signal: "color.brown" },
        { signal: "color.grey8" }
      ]
    }
  };
}
function Rse(e) {
  return {
    signals: [
      {
        name: "fontSize",
        value: ut(e) ? Object.assign(Object.assign({}, LF), e) : LF
      }
    ],
    text: {
      fontSize: { signal: "fontSize.text" }
    },
    style: {
      "guide-label": {
        fontSize: { signal: "fontSize.guideLabel" }
      },
      "guide-title": {
        fontSize: { signal: "fontSize.guideTitle" }
      },
      "group-title": {
        fontSize: { signal: "fontSize.groupTitle" }
      },
      "group-subtitle": {
        fontSize: { signal: "fontSize.groupSubtitle" }
      }
    }
  };
}
function jse(e) {
  return {
    text: { font: e },
    style: {
      "guide-label": { font: e },
      "guide-title": { font: e },
      "group-title": { font: e },
      "group-subtitle": { font: e }
    }
  };
}
function Z8(e) {
  const t = B(e || {}), n = {};
  for (const i of t) {
    const r = e[i];
    n[i] = vd(r) ? F8(r) : dn(r);
  }
  return n;
}
function Pse(e) {
  const t = B(e), n = {};
  for (const i of t)
    n[i] = Z8(e[i]);
  return n;
}
const Lse = [
  ...a8,
  ...CR,
  ...K8,
  "background",
  "padding",
  "legend",
  "lineBreak",
  "scale",
  "style",
  "title",
  "view"
];
function e4(e = {}) {
  const { color: t, font: n, fontSize: i } = e, r = $se(e, ["color", "font", "fontSize"]), o = mR({}, Tse, n ? jse(n) : {}, t ? Nse(t) : {}, i ? Rse(i) : {}, r || {}), a = Xn(o, Lse);
  for (const s of ["background", "lineBreak", "padding"])
    o[s] && (a[s] = dn(o[s]));
  for (const s of a8)
    o[s] && (a[s] = Ci(o[s]));
  for (const s of CR)
    o[s] && (a[s] = Z8(o[s]));
  for (const s of K8)
    o[s] && (a[s] = Ci(o[s]));
  return o.legend && (a.legend = Ci(o.legend)), o.scale && (a.scale = Ci(o.scale)), o.style && (a.style = Pse(o.style)), o.title && (a.title = Ci(o.title)), o.view && (a.view = Ci(o.view)), a;
}
const Ise = ["view", ...o8], Bse = [
  "color",
  "fontSize",
  "background",
  "padding",
  "facet",
  "concat",
  "numberFormat",
  "timeFormat",
  "countTitle",
  "header",
  "axisQuantitative",
  "axisTemporal",
  "axisDiscrete",
  "axisPoint",
  "axisXBand",
  "axisXPoint",
  "axisXDiscrete",
  "axisXQuantitative",
  "axisXTemporal",
  "axisYBand",
  "axisYPoint",
  "axisYDiscrete",
  "axisYQuantitative",
  "axisYTemporal",
  "scale",
  "selection",
  "overlay"
], zse = Object.assign({ view: ["continuousWidth", "continuousHeight", "discreteWidth", "discreteHeight", "step"] }, Oae);
function Use(e) {
  e = pe(e);
  for (const t of Bse)
    delete e[t];
  if (e.axis)
    for (const t in e.axis)
      vd(e.axis[t]) && delete e.axis[t];
  if (e.legend)
    for (const t of bse)
      delete e.legend[t];
  if (e.mark) {
    for (const t of FF)
      delete e.mark[t];
    e.mark.tooltip && ut(e.mark.tooltip) && delete e.mark.tooltip;
  }
  e.params && (e.signals = (e.signals || []).concat(Q8(e.params)), delete e.params);
  for (const t of Ise) {
    for (const i of FF)
      delete e[t][i];
    const n = zse[t];
    if (n)
      for (const i of n)
        delete e[t][i];
    Wse(e, t);
  }
  for (const t of vse())
    delete e[t];
  qse(e);
  for (const t in e)
    ut(e[t]) && Ie(e[t]) && delete e[t];
  return Ie(e) ? void 0 : e;
}
function qse(e) {
  const { titleMarkConfig: t, subtitleMarkConfig: n, subtitle: i } = C8(e.title);
  Ie(t) || (e.style["group-title"] = Object.assign(
    Object.assign({}, e.style["group-title"]),
    t
  )), Ie(n) || (e.style["group-subtitle"] = Object.assign(Object.assign({}, e.style["group-subtitle"]), n)), Ie(i) ? delete e.title : e.title = i;
}
function Wse(e, t, n, i) {
  const r = i ? e[t][i] : e[t];
  t === "view" && (n = "cell");
  const o = Object.assign(Object.assign({}, r), e.style[n != null ? n : t]);
  Ie(o) || (e.style[n != null ? n : t] = o), i || delete e[t];
}
function Em(e) {
  return "layer" in e;
}
function Gse(e) {
  return "repeat" in e;
}
function Hse(e) {
  return !K(e.repeat) && e.repeat.layer;
}
var Yse = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
class Xse {
  map(t, n) {
    return hm(t) ? this.mapFacet(t, n) : Gse(t) ? this.mapRepeat(t, n) : qA(t) ? this.mapHConcat(t, n) : wm(t) ? this.mapVConcat(t, n) : UA(t) ? this.mapConcat(t, n) : this.mapLayerOrUnit(t, n);
  }
  mapLayerOrUnit(t, n) {
    if (Em(t))
      return this.mapLayer(t, n);
    if (_o(t))
      return this.mapUnit(t, n);
    throw new Error(nA(t));
  }
  mapLayer(t, n) {
    return Object.assign(Object.assign({}, t), { layer: t.layer.map((i) => this.mapLayerOrUnit(i, n)) });
  }
  mapHConcat(t, n) {
    return Object.assign(Object.assign({}, t), { hconcat: t.hconcat.map((i) => this.map(i, n)) });
  }
  mapVConcat(t, n) {
    return Object.assign(Object.assign({}, t), { vconcat: t.vconcat.map((i) => this.map(i, n)) });
  }
  mapConcat(t, n) {
    const { concat: i } = t, r = Yse(t, ["concat"]);
    return Object.assign(Object.assign({}, r), { concat: i.map((o) => this.map(o, n)) });
  }
  mapFacet(t, n) {
    return Object.assign(Object.assign({}, t), {
      spec: this.map(t.spec, n)
    });
  }
  mapRepeat(t, n) {
    return Object.assign(Object.assign({}, t), {
      spec: this.map(t.spec, n)
    });
  }
}
const Vse = {
  zero: 1,
  center: 1,
  normalize: 1
};
function Kse(e) {
  return e in Vse;
}
const Jse = /* @__PURE__ */ new Set([n8, um, sm, x0, cm, bA, xA, lm, i8, vA]), Qse = /* @__PURE__ */ new Set([um, sm, n8]);
function BF(e, t) {
  var n, i;
  const r = t === "x" ? "y" : "radius", o = e[t], a = e[r];
  if (G(o) && G(a))
    if (jo(o) === "quantitative" && jo(a) === "quantitative") {
      if (o.stack)
        return t;
      if (a.stack)
        return r;
      const s = G(o) && !!o.aggregate, u = G(a) && !!a.aggregate;
      if (s !== u)
        return s ? t : r;
      {
        const l = (n = o.scale) === null || n === void 0 ? void 0 : n.type, c = (i = a.scale) === null || i === void 0 ? void 0 : i.type;
        if (l && l !== "linear")
          return r;
        if (c && c !== "linear")
          return t;
      }
    } else {
      if (jo(o) === "quantitative")
        return t;
      if (jo(a) === "quantitative")
        return r;
    }
  else {
    if (jo(o) === "quantitative")
      return t;
    if (jo(a) === "quantitative")
      return r;
  }
}
function Zse(e) {
  switch (e) {
    case "x":
      return "y";
    case "y":
      return "x";
    case "theta":
      return "radius";
    case "radius":
      return "theta";
  }
}
function t4(e, t, n = {}) {
  const i = mo(e) ? e.type : e;
  if (!Jse.has(i))
    return null;
  const r = BF(t, "x") || BF(t, "theta");
  if (!r)
    return null;
  const o = t[r], a = G(o) ? W(o, {}) : void 0;
  let s = Zse(r), u = t[s], l = G(u) ? W(u, {}) : void 0;
  l === a && (l = void 0, u = void 0, s = void 0);
  const c = bre.reduce((d, h) => {
    if (h !== "tooltip" && ys(t, h)) {
      const g = t[h];
      for (const p of lt(g)) {
        const m = Ar(p);
        if (m.aggregate)
          continue;
        const y = W(m, {});
        (!y || y !== l) && d.push({ channel: h, fieldDef: m });
      }
    }
    return d;
  }, []);
  let f;
  if (o.stack !== void 0 ? pd(o.stack) ? f = o.stack ? "zero" : null : f = o.stack : c.length > 0 && Qse.has(i) && (f = "zero"), !f || !Kse(f) || NA(t) && c.length === 0)
    return null;
  if (o.scale && o.scale.type && o.scale.type !== ft.LINEAR) {
    if (n.disallowNonLinearStack)
      return null;
    U(moe(o.scale.type));
  }
  return ue(t[Pr(r)]) ? (o.stack !== void 0 && U(poe(r)), null) : (G(o) && o.aggregate && !ie(are, o.aggregate) && U(yoe(o.aggregate)), {
    groupbyChannel: u ? s : void 0,
    groupbyField: l,
    fieldChannel: r,
    impute: o.impute === null ? !1 : Na(i),
    stackBy: c,
    offset: f
  });
}
var n4 = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function eue(e) {
  const t = n4(e, ["point", "line"]);
  return B(t).length > 1 ? t : t.type;
}
function tue(e) {
  for (const t of ["line", "area", "rule", "trail"])
    e[t] && (e = Object.assign(Object.assign({}, e), {
      [t]: Xn(e[t], ["point", "line"])
    }));
  return e;
}
function ny(e, t = {}, n) {
  return e.point === "transparent" ? { opacity: 0 } : e.point ? ut(e.point) ? e.point : {} : e.point !== void 0 ? null : t.point || n.shape ? ut(t.point) ? t.point : {} : void 0;
}
function zF(e, t = {}) {
  return e.line ? e.line === !0 ? {} : e.line : e.line !== void 0 ? null : t.line ? t.line === !0 ? {} : t.line : void 0;
}
class nue {
  constructor() {
    this.name = "path-overlay";
  }
  hasMatchingType(t, n) {
    if (_o(t)) {
      const { mark: i, encoding: r } = t, o = mo(i) ? i : { type: i };
      switch (o.type) {
        case "line":
        case "rule":
        case "trail":
          return !!ny(o, n[o.type], r);
        case "area":
          return !!ny(o, n[o.type], r) || !!zF(o, n[o.type]);
      }
    }
    return !1;
  }
  run(t, n, i) {
    const { config: r } = n, { selection: o, projection: a, mark: s, encoding: u } = t, l = n4(t, ["selection", "projection", "mark", "encoding"]), c = xm(u, r), f = mo(s) ? s : { type: s }, d = ny(f, r[f.type], c), h = f.type === "area" && zF(f, r[f.type]), g = [
      Object.assign(Object.assign({}, o ? { selection: o } : {}), {
        mark: eue(Object.assign(Object.assign({}, f.type === "area" && f.opacity === void 0 && f.fillOpacity === void 0 ? { opacity: 0.7 } : {}), f)),
        encoding: Xn(c, ["shape"])
      })
    ], p = t4(f, c);
    let m = c;
    if (p) {
      const { fieldChannel: y, offset: v } = p;
      m = Object.assign(Object.assign({}, c), { [y]: Object.assign(Object.assign({}, c[y]), v ? { stack: v } : {}) });
    }
    return h && g.push(Object.assign(Object.assign({}, a ? { projection: a } : {}), { mark: Object.assign(Object.assign({ type: "line" }, al(f, ["clip", "interpolate", "tension", "tooltip"])), h), encoding: m })), d && g.push(Object.assign(Object.assign({}, a ? { projection: a } : {}), { mark: Object.assign(Object.assign({ type: "point", opacity: 1, filled: !0 }, al(f, ["clip", "tooltip"])), d), encoding: m })), i(Object.assign(Object.assign({}, l), { layer: g }), Object.assign(Object.assign({}, n), { config: tue(r) }));
  }
}
var UF = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
class iue {
  constructor() {
    this.name = "RangeStep";
  }
  hasMatchingType(t) {
    var n;
    if (_o(t) && t.encoding)
      for (const i of pi) {
        const r = t.encoding[i];
        if (r && ue(r) && !((n = r == null ? void 0 : r.scale) === null || n === void 0) && n.rangeStep)
          return !0;
      }
    return !1;
  }
  run(t) {
    var n;
    const i = {};
    let r = Object.assign({}, t.encoding);
    for (const o of pi) {
      const a = Lr(o), s = r[o];
      if (s && ue(s) && !((n = s == null ? void 0 : s.scale) === null || n === void 0) && n.rangeStep) {
        const { scale: u } = s, l = UF(s, ["scale"]), c = u, f = UF(c, ["rangeStep"]);
        i[a] = { step: u.rangeStep }, U(eoe), r = Object.assign(Object.assign({}, r), { [o]: Object.assign(Object.assign({}, l), Ie(f) ? {} : { scale: f }) });
      }
    }
    return Object.assign(Object.assign(Object.assign({}, i), t), { encoding: r });
  }
}
var rue = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function oue(e, t) {
  return t ? Sd(e) ? r4(e, t) : i4(e, t) : e;
}
function iy(e, t) {
  return t ? r4(e, t) : e;
}
function Eb(e, t, n) {
  const i = t[e];
  if (Bae(i)) {
    if (i.repeat in n)
      return Object.assign(Object.assign({}, t), { [e]: n[i.repeat] });
    U(jre(i.repeat));
    return;
  }
  return t;
}
function i4(e, t) {
  if (e = Eb("field", e, t), e !== void 0) {
    if (e === null)
      return null;
    if (SA(e) && pr(e.sort)) {
      const n = Eb("field", e.sort, t);
      e = Object.assign(Object.assign({}, e), n ? { sort: n } : {});
    }
    return e;
  }
}
function qF(e, t) {
  if (G(e))
    return i4(e, t);
  {
    const n = Eb("datum", e, t);
    return n !== e && !n.type && (n.type = "nominal"), n;
  }
}
function WF(e, t) {
  if (ue(e)) {
    const n = qF(e, t);
    if (n)
      return n;
    if (FA(e))
      return { condition: e.condition };
  } else {
    if (pm(e)) {
      const n = qF(e.condition, t);
      return n ? Object.assign(Object.assign({}, e), { condition: n }) : rue(e, ["condition"]);
    }
    return e;
  }
}
function r4(e, t) {
  const n = {};
  for (const i in e)
    if (ku(e, i)) {
      const r = e[i];
      if (K(r))
        n[i] = r.map((o) => WF(o, t)).filter((o) => o);
      else {
        const o = WF(r, t);
        o !== void 0 && (n[i] = o);
      }
    }
  return n;
}
class aue {
  constructor() {
    this.name = "RuleForRangedLine";
  }
  hasMatchingType(t) {
    if (_o(t)) {
      const { encoding: n, mark: i } = t;
      if (i === "line")
        for (const r of yre) {
          const o = eu(r), a = n[o];
          if (n[r] && (G(a) && !cn(a.bin) || Ra(a)))
            return !0;
        }
    }
    return !1;
  }
  run(t, n, i) {
    const { encoding: r } = t;
    return U(Qre(!!r.x2, !!r.y2)), i(Object.assign(Object.assign({}, t), { mark: "rule" }), n);
  }
}
var Fo = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
class sue extends Xse {
  constructor() {
    super(...arguments), this.nonFacetUnitNormalizers = [
      sse,
      cse,
      yse,
      new nue(),
      new aue(),
      new iue()
    ];
  }
  map(t, n) {
    if (_o(t)) {
      const i = ys(t.encoding, ao), r = ys(t.encoding, so), o = ys(t.encoding, Qp);
      if (i || r || o)
        return this.mapFacetedUnit(t, n);
    }
    return super.map(t, n);
  }
  mapUnit(t, n) {
    const { parentEncoding: i, parentProjection: r } = n, o = iy(t.encoding, n.repeater), a = Object.assign(Object.assign({}, t), o ? { encoding: o } : {});
    if (i || r)
      return this.mapUnitWithParentEncodingOrProjection(a, n);
    const s = this.mapLayerOrUnit.bind(this);
    for (const u of this.nonFacetUnitNormalizers)
      if (u.hasMatchingType(a, n.config))
        return u.run(a, n, s);
    return a;
  }
  mapRepeat(t, n) {
    return Hse(t) ? this.mapLayerRepeat(t, n) : this.mapNonLayerRepeat(t, n);
  }
  mapLayerRepeat(t, n) {
    const { repeat: i, spec: r } = t, o = Fo(t, ["repeat", "spec"]), { row: a, column: s, layer: u } = i, { repeater: l = {}, repeaterPrefix: c = "" } = n;
    return a || s ? this.mapRepeat(Object.assign(Object.assign({}, t), { repeat: Object.assign(Object.assign({}, a ? { row: a } : {}), s ? { column: s } : {}), spec: {
      repeat: { layer: u },
      spec: r
    } }), n) : Object.assign(Object.assign({}, o), { layer: u.map((f) => {
      const d = Object.assign(Object.assign({}, l), { layer: f }), h = (r.name || "") + c + `child__layer_${Xe(f)}`, g = this.mapLayerOrUnit(r, Object.assign(Object.assign({}, n), { repeater: d, repeaterPrefix: h }));
      return g.name = h, g;
    }) });
  }
  mapNonLayerRepeat(t, n) {
    var i;
    const { repeat: r, spec: o, data: a } = t, s = Fo(t, ["repeat", "spec", "data"]);
    !K(r) && t.columns && (t = Xn(t, ["columns"]), U(wF("repeat")));
    const u = [], { repeater: l = {}, repeaterPrefix: c = "" } = n, f = !K(r) && r.row || [l ? l.row : null], d = !K(r) && r.column || [l ? l.column : null], h = K(r) && r || [l ? l.repeat : null];
    for (const p of h)
      for (const m of f)
        for (const y of d) {
          const v = {
            repeat: p,
            row: m,
            column: y,
            layer: l.layer
          }, b = (o.name || "") + c + "child__" + (K(r) ? `${Xe(p)}` : (r.row ? `row_${Xe(m)}` : "") + (r.column ? `column_${Xe(y)}` : "")), x = this.map(o, Object.assign(Object.assign({}, n), { repeater: v, repeaterPrefix: b }));
          x.name = b, u.push(Xn(x, ["data"]));
        }
    const g = K(r) ? t.columns : r.column ? r.column.length : 1;
    return Object.assign(Object.assign({ data: (i = o.data) !== null && i !== void 0 ? i : a, align: "all" }, s), {
      columns: g,
      concat: u
    });
  }
  mapFacet(t, n) {
    const { facet: i } = t;
    return Sd(i) && t.columns && (t = Xn(t, ["columns"]), U(wF("facet"))), super.mapFacet(t, n);
  }
  mapUnitWithParentEncodingOrProjection(t, n) {
    const { encoding: i, projection: r } = t, { parentEncoding: o, parentProjection: a, config: s } = n, u = HF({ parentProjection: a, projection: r }), l = GF({
      parentEncoding: o,
      encoding: iy(i, n.repeater)
    });
    return this.mapUnit(Object.assign(Object.assign(Object.assign({}, t), u ? { projection: u } : {}), l ? { encoding: l } : {}), { config: s });
  }
  mapFacetedUnit(t, n) {
    const i = t.encoding, { row: r, column: o, facet: a } = i, s = Fo(i, ["row", "column", "facet"]), { mark: u, width: l, projection: c, height: f, view: d, selection: h, encoding: g } = t, p = Fo(t, ["mark", "width", "projection", "height", "view", "selection", "encoding"]), { facetMapping: m, layout: y } = this.getFacetMappingAndLayout({ row: r, column: o, facet: a }, n), v = iy(s, n.repeater);
    return this.mapFacet(Object.assign(Object.assign(Object.assign({}, p), y), {
      facet: m,
      spec: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, l ? { width: l } : {}), f ? { height: f } : {}), d ? { view: d } : {}), c ? { projection: c } : {}), { mark: u, encoding: v }), h ? { selection: h } : {})
    }), n);
  }
  getFacetMappingAndLayout(t, n) {
    var i;
    const { row: r, column: o, facet: a } = t;
    if (r || o) {
      a && U(Kre([...r ? [ao] : [], ...o ? [so] : []]));
      const s = {}, u = {};
      for (const l of [ao, so]) {
        const c = t[l];
        if (c) {
          const f = Fo(c, ["align", "center", "spacing", "columns"]);
          s[l] = f;
          for (const d of ["align", "center", "spacing"])
            c[d] !== void 0 && (u[d] = (i = u[d]) !== null && i !== void 0 ? i : {}, u[d][l] = c[d]);
        }
      }
      return { facetMapping: s, layout: u };
    } else {
      const { align: s, center: u, spacing: l, columns: c } = a, f = Fo(a, ["align", "center", "spacing", "columns"]);
      return {
        facetMapping: oue(f, n.repeater),
        layout: Object.assign(Object.assign(Object.assign(Object.assign({}, s ? { align: s } : {}), u ? { center: u } : {}), l ? { spacing: l } : {}), c ? { columns: c } : {})
      };
    }
  }
  mapLayer(t, n) {
    var { parentEncoding: i, parentProjection: r } = n, o = Fo(n, ["parentEncoding", "parentProjection"]);
    const { encoding: a, projection: s } = t, u = Fo(t, ["encoding", "projection"]), l = Object.assign(Object.assign({}, o), { parentEncoding: GF({ parentEncoding: i, encoding: a, layer: !0 }), parentProjection: HF({ parentProjection: r, projection: s }) });
    return super.mapLayer(u, l);
  }
}
function GF({ parentEncoding: e, encoding: t = {}, layer: n }) {
  let i = {};
  if (e) {
    const r = /* @__PURE__ */ new Set([...B(e), ...B(t)]);
    for (const o of r) {
      const a = t[o], s = e[o];
      if (ue(a)) {
        const u = Object.assign(Object.assign({}, s), a);
        i[o] = u;
      } else
        pm(a) ? i[o] = Object.assign(Object.assign({}, a), { condition: Object.assign(Object.assign({}, s), a.condition) }) : a || a === null ? i[o] = a : (n || Wi(s) || se(s) || ue(s) || K(s)) && (i[o] = s);
    }
  } else
    i = t;
  return !i || Ie(i) ? void 0 : i;
}
function HF(e) {
  const { parentProjection: t, projection: n } = e;
  return t && n && U(Ure({ parentProjection: t, projection: n })), n != null ? n : t;
}
function o4(e, t) {
  t === void 0 && (t = e4(e.config));
  const n = lue(e, t), { width: i, height: r } = e, o = cue(n, { width: i, height: r, autosize: e.autosize }, t);
  return Object.assign(Object.assign({}, n), o ? { autosize: o } : {});
}
const uue = new sue();
function lue(e, t = {}) {
  return uue.map(e, { config: t });
}
function YF(e) {
  return ge(e) ? { type: e } : e != null ? e : {};
}
function cue(e, t, n) {
  let { width: i, height: r } = t;
  const o = _o(e) || Em(e), a = {};
  o ? i == "container" && r == "container" ? (a.type = "fit", a.contains = "padding") : i == "container" ? (a.type = "fit-x", a.contains = "padding") : r == "container" && (a.type = "fit-y", a.contains = "padding") : (i == "container" && (U(yF("width")), i = void 0), r == "container" && (U(yF("height")), r = void 0));
  const s = Object.assign(Object.assign(Object.assign({ type: "pad" }, a), n ? YF(n.autosize) : {}), YF(e.autosize));
  if (s.type === "fit" && !o && (U(Cre), s.type = "pad"), i == "container" && !(s.type == "fit" || s.type == "fit-x") && U(vF("width")), r == "container" && !(s.type == "fit" || s.type == "fit-y") && U(vF("height")), !Tl(s, { type: "pad" }))
    return s;
}
function fue(e) {
  return e === "fit" || e === "fit-x" || e === "fit-y";
}
function due(e) {
  return e ? `fit-${im(e)}` : "fit";
}
const hue = [
  "background",
  "padding"
];
function XF(e, t) {
  const n = {};
  for (const i of hue)
    e && e[i] !== void 0 && (n[i] = dn(e[i]));
  return t && (n.params = e.params), n;
}
class Oo {
  constructor(t = {}, n = {}) {
    this.explicit = t, this.implicit = n;
  }
  clone() {
    return new Oo(pe(this.explicit), pe(this.implicit));
  }
  combine() {
    return Object.assign(Object.assign({}, this.explicit), this.implicit);
  }
  get(t) {
    return ct(this.explicit[t], this.implicit[t]);
  }
  getWithExplicit(t) {
    return this.explicit[t] !== void 0 ? { explicit: !0, value: this.explicit[t] } : this.implicit[t] !== void 0 ? { explicit: !1, value: this.implicit[t] } : { explicit: !1, value: void 0 };
  }
  setWithExplicit(t, n) {
    n.value !== void 0 && this.set(t, n.value, n.explicit);
  }
  set(t, n, i) {
    return delete this[i ? "implicit" : "explicit"][t], this[i ? "explicit" : "implicit"][t] = n, this;
  }
  copyKeyFromSplit(t, n) {
    n.explicit[t] !== void 0 ? this.set(t, n.explicit[t], !0) : n.implicit[t] !== void 0 && this.set(t, n.implicit[t], !1);
  }
  copyKeyFromObject(t, n) {
    n[t] !== void 0 && this.set(t, n[t], !0);
  }
  copyAll(t) {
    for (const n of B(t.combine())) {
      const i = t.getWithExplicit(n);
      this.setWithExplicit(n, i);
    }
  }
}
function Xr(e) {
  return {
    explicit: !0,
    value: e
  };
}
function Un(e) {
  return {
    explicit: !1,
    value: e
  };
}
function a4(e) {
  return (t, n, i, r) => {
    const o = e(t.value, n.value);
    return o > 0 ? t : o < 0 ? n : Am(t, n, i, r);
  };
}
function Am(e, t, n, i) {
  return e.explicit && t.explicit && U(uoe(n, i, e.value, t.value)), e;
}
function ma(e, t, n, i, r = Am) {
  return e === void 0 || e.value === void 0 ? t : e.explicit && !t.explicit ? e : t.explicit && !e.explicit ? t : Tl(e.value, t.value) ? e : r(e, t, n, i);
}
class gue extends Oo {
  constructor(t = {}, n = {}, i = !1) {
    super(t, n), this.explicit = t, this.implicit = n, this.parseNothing = i;
  }
  clone() {
    const t = super.clone();
    return t.parseNothing = this.parseNothing, t;
  }
}
function kf(e) {
  return "url" in e;
}
function C0(e) {
  return "values" in e;
}
function s4(e) {
  return "name" in e && !kf(e) && !C0(e) && !vs(e);
}
function vs(e) {
  return e && (u4(e) || l4(e) || GA(e));
}
function u4(e) {
  return "sequence" in e;
}
function l4(e) {
  return "sphere" in e;
}
function GA(e) {
  return "graticule" in e;
}
var We;
(function(e) {
  e[e.Raw = 0] = "Raw", e[e.Main = 1] = "Main", e[e.Row = 2] = "Row", e[e.Column = 3] = "Column", e[e.Lookup = 4] = "Lookup";
})(We || (We = {}));
function c4(e) {
  return "filter" in e;
}
function pue(e) {
  return (e == null ? void 0 : e.stop) !== void 0;
}
function mue(e) {
  return "lookup" in e;
}
function yue(e) {
  return "data" in e;
}
function vue(e) {
  return "selection" in e;
}
function bue(e) {
  return "pivot" in e;
}
function xue(e) {
  return "density" in e;
}
function wue(e) {
  return "quantile" in e;
}
function Eue(e) {
  return "regression" in e;
}
function Aue(e) {
  return "loess" in e;
}
function _ue(e) {
  return "sample" in e;
}
function Oue(e) {
  return "window" in e;
}
function Sue(e) {
  return "joinaggregate" in e;
}
function Cue(e) {
  return "flatten" in e;
}
function Fue(e) {
  return "calculate" in e;
}
function kue(e) {
  return "bin" in e;
}
function Due(e) {
  return "impute" in e;
}
function $ue(e) {
  return "timeUnit" in e;
}
function Mue(e) {
  return "aggregate" in e;
}
function Tue(e) {
  return "stack" in e;
}
function Nue(e) {
  return "fold" in e;
}
function Rue(e) {
  return e.map((t) => c4(t) ? {
    filter: Vh(t.filter, Voe)
  } : t);
}
const jue = "view", F0 = "[", k0 = "]", f4 = "{", d4 = "}", Pue = ":", h4 = ",", Lue = "@", Iue = ">", Bue = /[[\]{}]/, zue = {
  "*": 1,
  arc: 1,
  area: 1,
  group: 1,
  image: 1,
  line: 1,
  path: 1,
  rect: 1,
  rule: 1,
  shape: 1,
  symbol: 1,
  text: 1,
  trail: 1
};
let g4, p4;
function Rl(e, t, n) {
  return g4 = t || jue, p4 = n || zue, m4(e.trim()).map(Ab);
}
function Uue(e) {
  return p4[e];
}
function Kc(e, t, n, i, r) {
  const o = e.length;
  let a = 0, s;
  for (; t < o; ++t) {
    if (s = e[t], !a && s === n)
      return t;
    r && r.indexOf(s) >= 0 ? --a : i && i.indexOf(s) >= 0 && ++a;
  }
  return t;
}
function m4(e) {
  const t = [], n = e.length;
  let i = 0, r = 0;
  for (; r < n; )
    r = Kc(e, r, h4, F0 + f4, k0 + d4), t.push(e.substring(i, r).trim()), i = ++r;
  if (t.length === 0)
    throw "Empty event selector: " + e;
  return t;
}
function Ab(e) {
  return e[0] === "[" ? que(e) : Wue(e);
}
function que(e) {
  const t = e.length;
  let n = 1, i;
  if (n = Kc(e, n, k0, F0, k0), n === t)
    throw "Empty between selector: " + e;
  if (i = m4(e.substring(1, n)), i.length !== 2)
    throw "Between selector must have two elements: " + e;
  if (e = e.slice(n + 1).trim(), e[0] !== Iue)
    throw "Expected '>' after between selector: " + e;
  i = i.map(Ab);
  const r = Ab(e.slice(1).trim());
  return r.between ? {
    between: i,
    stream: r
  } : (r.between = i, r);
}
function Wue(e) {
  const t = {
    source: g4
  }, n = [];
  let i = [0, 0], r = 0, o = 0, a = e.length, s = 0, u, l;
  if (e[a - 1] === d4) {
    if (s = e.lastIndexOf(f4), s >= 0) {
      try {
        i = Gue(e.substring(s + 1, a - 1));
      } catch {
        throw "Invalid throttle specification: " + e;
      }
      e = e.slice(0, s).trim(), a = e.length;
    } else
      throw "Unmatched right brace: " + e;
    s = 0;
  }
  if (!a)
    throw e;
  if (e[0] === Lue && (r = ++s), u = Kc(e, s, Pue), u < a && (n.push(e.substring(o, u).trim()), o = s = ++u), s = Kc(e, s, F0), s === a)
    n.push(e.substring(o, a).trim());
  else if (n.push(e.substring(o, s).trim()), l = [], o = ++s, o === a)
    throw "Unmatched left bracket: " + e;
  for (; s < a; ) {
    if (s = Kc(e, s, k0), s === a)
      throw "Unmatched left bracket: " + e;
    if (l.push(e.substring(o, s).trim()), s < a - 1 && e[++s] !== F0)
      throw "Expected left bracket: " + e;
    o = ++s;
  }
  if (!(a = n.length) || Bue.test(n[a - 1]))
    throw "Invalid event selector: " + e;
  return a > 1 ? (t.type = n[1], r ? t.markname = n[0].slice(1) : Uue(n[0]) ? t.marktype = n[0] : t.source = n[0]) : t.type = n[0], t.type.slice(-1) === "!" && (t.consume = !0, t.type = t.type.slice(0, -1)), l != null && (t.filter = l), i[0] && (t.throttle = i[0]), i[1] && (t.debounce = i[1]), t;
}
function Gue(e) {
  const t = e.split(h4);
  if (!e.length || t.length > 2)
    throw e;
  return t.map((n) => {
    const i = +n;
    if (i !== i)
      throw e;
    return i;
  });
}
function jl(e, t, n, i) {
  const r = FA(t) && t.condition, o = i(t);
  if (r) {
    const s = lt(r).map((u) => {
      const l = i(u), c = Iae(u) ? U4(e, u.selection) : T0(e, u.test);
      return Object.assign({ test: c }, l);
    });
    return {
      [n]: [...s, ...o !== void 0 ? [o] : []]
    };
  } else
    return o !== void 0 ? { [n]: o } : {};
}
function HA(e, t = "text") {
  const n = e.encoding[t];
  return jl(e, n, t, (i) => _m(i, e.config));
}
function _m(e, t, n = "datum") {
  if (e) {
    if (Wi(e))
      return Ze(e.value);
    if (ue(e)) {
      const { format: i, formatType: r } = E0(e);
      return AA({ fieldOrDatumDef: e, format: i, formatType: r, expr: n, config: t });
    }
  }
}
function y4(e, t = {}) {
  const { encoding: n, markDef: i, config: r, stack: o } = e, a = n.tooltip;
  if (K(a))
    return { tooltip: VF({ tooltip: a }, o, r, t) };
  {
    const s = t.reactiveGeom ? "datum.datum" : "datum";
    return jl(e, a, "tooltip", (u) => {
      const l = _m(u, r, s);
      if (l)
        return l;
      if (u === null)
        return;
      let c = Re("tooltip", i, r);
      if (c === !0 && (c = { content: "encoding" }), ge(c))
        return { value: c };
      if (ut(c))
        return se(c) ? c : c.content === "encoding" ? VF(n, o, r, t) : { signal: s };
    });
  }
}
function v4(e, t, n, { reactiveGeom: i } = {}) {
  const r = {}, o = i ? "datum.datum" : "datum", a = [];
  function s(l, c) {
    const f = eu(c), d = yi(l) ? l : Object.assign(Object.assign({}, l), {
      type: e[f].type
    }), h = d.title || $A(d, n), g = lt(h).join(", ");
    let p;
    if (Er(c)) {
      const m = c === "x" ? "x2" : "y2", y = Ar(e[m]);
      if (cn(d.bin) && y) {
        const v = W(d, { expr: o }), b = W(y, { expr: o }), { format: x, formatType: E } = E0(d);
        p = fm(v, b, x, E, n), r[m] = !0;
      } else if (t && t.fieldChannel === c && t.offset === "normalize") {
        const { format: v, formatType: b } = E0(d);
        p = AA({ fieldOrDatumDef: d, format: v, formatType: b, expr: o, config: n, normalizeStack: !0 }).signal;
      }
    }
    p = p != null ? p : _m(d, n, o).signal, a.push({ channel: c, key: g, value: p });
  }
  RA(e, (l, c) => {
    G(l) ? s(l, c) : gm(l) && s(l.condition, c);
  });
  const u = {};
  for (const { channel: l, key: c, value: f } of a)
    !r[l] && !u[c] && (u[c] = f);
  return u;
}
function VF(e, t, n, { reactiveGeom: i } = {}) {
  const r = v4(e, t, n, { reactiveGeom: i }), o = md(r).map(([a, s]) => `"${a}": ${s}`);
  return o.length > 0 ? { signal: `{${o.join(", ")}}` } : void 0;
}
function Hue(e) {
  const { markDef: t, config: n } = e, i = Re("aria", t, n);
  return i === !1 ? {} : Object.assign(Object.assign(Object.assign({}, i ? { aria: i } : {}), Yue(e)), Xue(e));
}
function Yue(e) {
  const { mark: t, markDef: n, config: i } = e;
  if (i.aria === !1)
    return {};
  const r = Re("ariaRoleDescription", n, i);
  return r != null ? { ariaRoleDescription: { value: r } } : t in Goe ? {} : { ariaRoleDescription: { value: t } };
}
function Xue(e) {
  const { encoding: t, markDef: n, config: i, stack: r } = e, o = t.description;
  if (o)
    return jl(e, o, "description", (u) => _m(u, e.config));
  const a = Re("description", n, i);
  if (a != null)
    return {
      description: Ze(a)
    };
  if (i.aria === !1)
    return {};
  const s = v4(t, r, i);
  if (!Ie(s))
    return {
      description: {
        signal: md(s).map(([u, l], c) => `"${c > 0 ? "; " : ""}${u}: " + (${l})`).join(" + ")
      }
    };
}
function At(e, t, n = {}) {
  const { markDef: i, encoding: r, config: o } = t, { vgChannel: a } = n;
  let { defaultRef: s, defaultValue: u } = n;
  s === void 0 && (u = u != null ? u : Re(e, i, o, { vgChannel: a, ignoreVgConfig: !0 }), u !== void 0 && (s = Ze(u)));
  const l = r[e];
  return jl(t, l, a != null ? a : e, (c) => l8({
    channel: e,
    channelDef: c,
    markDef: i,
    config: o,
    scaleName: t.scaleName(e),
    scale: t.getScaleComponent(e),
    stack: null,
    defaultRef: s
  }));
}
function b4(e, t = { filled: void 0 }) {
  var n, i, r, o;
  const { markDef: a, encoding: s, config: u } = e, { type: l } = a, c = (n = t.filled) !== null && n !== void 0 ? n : Re("filled", a, u), f = ie(["bar", "point", "circle", "square", "geoshape"], l) ? "transparent" : void 0, d = (r = (i = Re(c === !0 ? "color" : void 0, a, u, { vgChannel: "fill" })) !== null && i !== void 0 ? i : u.mark[c === !0 && "color"]) !== null && r !== void 0 ? r : f, h = (o = Re(c === !1 ? "color" : void 0, a, u, { vgChannel: "stroke" })) !== null && o !== void 0 ? o : u.mark[c === !1 && "color"], g = c ? "fill" : "stroke", p = Object.assign(Object.assign({}, d ? { fill: Ze(d) } : {}), h ? { stroke: Ze(h) } : {});
  return a.color && (c ? a.fill : a.stroke) && U(zR("property", { fill: "fill" in a, stroke: "stroke" in a })), Object.assign(Object.assign(Object.assign(Object.assign({}, p), At("color", e, {
    vgChannel: g,
    defaultValue: c ? d : h
  })), At("fill", e, {
    defaultValue: s.fill ? d : void 0
  })), At("stroke", e, {
    defaultValue: s.stroke ? h : void 0
  }));
}
function Vue(e) {
  const { encoding: t, mark: n } = e, i = t.order;
  return !Na(n) && Wi(i) ? jl(e, i, "zindex", (r) => Ze(r.value)) : {};
}
function Df(e, t) {
  const n = vre(e), i = t[n];
  if (i)
    return i;
}
function Gt(e, t, { defaultPos: n, vgChannel: i, isMidPoint: r }) {
  const { encoding: o, markDef: a, config: s, stack: u } = t, l = o[e], c = o[Pr(e)], f = t.scaleName(e), d = t.getScaleComponent(e), h = Df(e, a), g = YA({
    model: t,
    defaultPos: n,
    channel: e,
    scaleName: f,
    scale: d
  }), p = !l && Er(e) && (o.latitude || o.longitude) ? { field: t.getName(e) } : Kue({
    channel: e,
    channelDef: l,
    channel2Def: c,
    markDef: a,
    config: s,
    isMidPoint: r,
    scaleName: f,
    scale: d,
    stack: u,
    offset: h,
    defaultRef: g
  });
  return p ? { [i || e]: p } : void 0;
}
function Kue(e) {
  const { channel: t, channelDef: n, isMidPoint: i, scaleName: r, stack: o, offset: a, markDef: s, config: u } = e;
  if (ue(n) && o && t === o.fieldChannel) {
    if (G(n)) {
      const l = Cd({
        channel: t,
        fieldDef: n,
        isMidPoint: i,
        markDef: s,
        stack: o,
        config: u
      });
      if (l !== void 0)
        return w0({
          scaleName: r,
          fieldOrDatumDef: n,
          startSuffix: "start",
          band: l,
          offset: a
        });
    }
    return ms(n, r, { suffix: "end" }, { offset: a });
  }
  return wA(e);
}
function YA({ model: e, defaultPos: t, channel: n, scaleName: i, scale: r }) {
  const { markDef: o, config: a } = e;
  return () => {
    const s = eu(n), u = pa(n), l = Re(n, o, a, { vgChannel: u });
    if (l !== void 0)
      return Vc(n, l);
    switch (t) {
      case "zeroOrMin":
      case "zeroOrMax":
        if (i) {
          const c = r.get("type");
          if (!ie([ft.LOG, ft.TIME, ft.UTC], c)) {
            if (r.domainDefinitelyIncludesZero())
              return {
                scale: i,
                value: 0
              };
          }
        }
        if (t === "zeroOrMin")
          return s === "y" ? { field: { group: "height" } } : { value: 0 };
        switch (s) {
          case "radius":
            return {
              signal: `min(${e.width.signal},${e.height.signal})/2`
            };
          case "theta":
            return { signal: "2*PI" };
          case "x":
            return { field: { group: "width" } };
          case "y":
            return { value: 0 };
        }
        break;
      case "mid": {
        const c = e[Lr(n)];
        return Object.assign(Object.assign({}, c), { mult: 0.5 });
      }
    }
  };
}
const Jue = {
  left: "x",
  center: "xc",
  right: "x2"
}, Que = {
  top: "y",
  middle: "yc",
  bottom: "y2"
};
function x4(e, t, n, i = "middle") {
  if (e === "radius" || e === "theta")
    return pa(e);
  const r = e === "x" ? "align" : "baseline", o = Re(r, t, n);
  let a;
  return se(o) ? (U(Jre(r)), a = void 0) : a = o, e === "x" ? Jue[a || (i === "top" ? "left" : "center")] : Que[a || i];
}
function D0(e, t, { defaultPos: n, defaultPos2: i, range: r }) {
  return r ? w4(e, t, { defaultPos: n, defaultPos2: i }) : Gt(e, t, { defaultPos: n });
}
function w4(e, t, { defaultPos: n, defaultPos2: i }) {
  const { markDef: r, config: o } = t, a = Pr(e), s = Lr(e), u = Zue(t, i, a), l = u[s] ? x4(e, r, o) : pa(e);
  return Object.assign(Object.assign({}, Gt(e, t, { defaultPos: n, vgChannel: l })), u);
}
function Zue(e, t, n) {
  const { encoding: i, mark: r, markDef: o, stack: a, config: s } = e, u = eu(n), l = Lr(n), c = pa(n), f = i[u], d = e.scaleName(u), h = e.getScaleComponent(u), g = n in i || n in o ? Df(n, e.markDef) : Df(u, e.markDef);
  if (!f && (n === "x2" || n === "y2") && (i.latitude || i.longitude))
    return { [c]: { field: e.getName(n) } };
  const p = ele({
    channel: n,
    channelDef: f,
    channel2Def: i[n],
    markDef: o,
    config: s,
    scaleName: d,
    scale: h,
    stack: a,
    offset: g,
    defaultRef: void 0
  });
  return p !== void 0 ? { [c]: p } : dh(n, o) || dh(n, {
    [n]: _0(n, o, s.style),
    [l]: _0(l, o, s.style)
  }) || dh(n, s[r]) || dh(n, s.mark) || {
    [c]: YA({
      model: e,
      defaultPos: t,
      channel: n,
      scaleName: d,
      scale: h
    })()
  };
}
function ele({ channel: e, channelDef: t, channel2Def: n, markDef: i, config: r, scaleName: o, scale: a, stack: s, offset: u, defaultRef: l }) {
  return ue(t) && s && e.charAt(0) === s.fieldChannel.charAt(0) ? ms(t, o, { suffix: "start" }, { offset: u }) : wA({
    channel: e,
    channelDef: n,
    scaleName: o,
    scale: a,
    stack: s,
    markDef: i,
    config: r,
    offset: u,
    defaultRef: l
  });
}
function dh(e, t) {
  const n = Lr(e), i = pa(e);
  if (t[i] !== void 0)
    return { [i]: Vc(e, t[i]) };
  if (t[e] !== void 0)
    return { [i]: Vc(e, t[e]) };
  if (t[n])
    return { [n]: Vc(e, t[n]) };
}
function ya(e, t, n) {
  var i, r, o, a;
  const { config: s, encoding: u, markDef: l, stack: c } = e, f = Pr(t), d = Lr(t), h = u[t], g = u[f], p = e.getScaleComponent(t), m = p ? p.get("type") : void 0, y = e.scaleName(t), v = l.orient, b = (r = (i = u[d]) !== null && i !== void 0 ? i : u.size) !== null && r !== void 0 ? r : Re("size", l, s, { vgChannel: d }), x = n === "bar" && (t === "x" ? v === "vertical" : v === "horizontal");
  if (G(h) && (Ve(h.bin) || cn(h.bin) || h.timeUnit && !g) && !b && !Ln(m)) {
    const E = Cd({ channel: t, fieldDef: h, stack: c, markDef: l, config: s }), A = (o = e.component.axes[t]) === null || o === void 0 ? void 0 : o[0], w = (a = A == null ? void 0 : A.get("translate")) !== null && a !== void 0 ? a : 0.5;
    return ile({
      fieldDef: h,
      fieldDef2: g,
      channel: t,
      markDef: l,
      scaleName: y,
      band: E,
      axisTranslate: w,
      spacing: Er(t) ? Re("binSpacing", l, s) : void 0,
      reverse: p.get("reverse"),
      config: s
    });
  } else
    return (ue(h) && Ln(m) || x) && !g ? nle(n, h, t, e) : w4(t, e, { defaultPos: "zeroOrMax", defaultPos2: "zeroOrMin" });
}
function tle(e, t, n, i, r, o) {
  if (i) {
    const u = i.get("type");
    if (u === "point" || u === "band") {
      if (r[e].discreteBandSize !== void 0)
        return { value: r[e].discreteBandSize };
      if (u === ft.POINT) {
        const l = i.get("range");
        return Ta(l) && ht(l.step) ? { value: l.step - 2 } : { value: WA - 2 };
      } else
        return { scale: n, band: o };
    } else
      return { value: r[e].continuousBandSize };
  }
  const a = S0(r.view, t), s = ct(
    r[e].discreteBandSize,
    a - 2
  );
  return s !== void 0 ? { value: s } : void 0;
}
function nle(e, t, n, i) {
  var r;
  const { markDef: o, encoding: a, config: s, stack: u } = i, l = o.orient, c = i.scaleName(n), f = i.getScaleComponent(n), d = Lr(n), h = Pr(n), g = l === "horizontal" && n === "y" || l === "vertical" && n === "x", p = Re(g ? "size" : d, o, s, {
    vgChannel: d
  });
  let m;
  (a.size || p !== void 0) && (g ? m = At("size", i, { vgChannel: d, defaultValue: p }) : U(ooe(o.type)));
  const y = (r = ue(t) ? Cd({ channel: n, fieldDef: t, markDef: o, stack: u, config: s }) : void 0) !== null && r !== void 0 ? r : 1;
  m = m || { [d]: tle(e, d, c, f, s, y) };
  const v = (f == null ? void 0 : f.get("type")) !== "band" || !("band" in m[d]), b = x4(n, o, s, v ? "middle" : "top"), x = Df(n, o), E = wA({
    channel: n,
    channelDef: t,
    markDef: o,
    config: s,
    scaleName: c,
    scale: f,
    stack: u,
    offset: x,
    defaultRef: YA({ model: i, defaultPos: "mid", channel: n, scaleName: c, scale: f }),
    band: v ? 0.5 : (1 - y) / 2
  });
  if (d)
    return Object.assign({ [b]: E }, m);
  {
    const A = pa(h), w = m[d], _ = x ? Object.assign(Object.assign({}, w), { offset: x }) : w;
    return {
      [b]: E,
      [A]: K(E) ? [E[0], Object.assign(Object.assign({}, E[1]), { offset: _ })] : Object.assign(Object.assign({}, E), { offset: _ })
    };
  }
}
function cc(e, t, n, i, r) {
  if (DR(e))
    return 0;
  const o = e === "x" || e === "y2" ? -t / 2 : t / 2;
  if (se(n) || se(r) || se(i)) {
    const a = uo(n), s = uo(r), u = uo(i), l = u ? `${u} + ` : "", c = a ? `(${a} ? -1 : 1) * ` : "", f = s ? `(${s} + ${o})` : o;
    return {
      signal: l + c + f
    };
  } else
    return r = r || 0, i + (n ? -r - o : +r + o);
}
function ile({ fieldDef: e, fieldDef2: t, channel: n, band: i, scaleName: r, markDef: o, spacing: a = 0, axisTranslate: s, reverse: u, config: l }) {
  const c = Pr(n), f = pa(n), d = pa(c), h = Df(n, o);
  if (Ve(e.bin) || e.timeUnit)
    return {
      [d]: KF({
        channel: n,
        fieldDef: e,
        scaleName: r,
        markDef: o,
        band: (1 - i) / 2,
        offset: cc(c, a, u, s, h),
        config: l
      }),
      [f]: KF({
        channel: n,
        fieldDef: e,
        scaleName: r,
        markDef: o,
        band: 1 - (1 - i) / 2,
        offset: cc(n, a, u, s, h),
        config: l
      })
    };
  if (cn(e.bin)) {
    const g = ms(e, r, {}, { offset: cc(c, a, u, s, h) });
    if (G(t))
      return {
        [d]: g,
        [f]: ms(t, r, {}, { offset: cc(n, a, u, s, h) })
      };
    if (Ad(e.bin) && e.bin.step)
      return {
        [d]: g,
        [f]: {
          signal: `scale("${r}", ${W(e, { expr: "datum" })} + ${e.bin.step})`,
          offset: cc(n, a, u, s, h)
        }
      };
  }
  U(WR(c));
}
function KF({ channel: e, fieldDef: t, scaleName: n, markDef: i, band: r, offset: o, config: a }) {
  const s = w0({
    scaleName: n,
    fieldOrDatumDef: t,
    band: r,
    offset: o
  });
  return u8({
    fieldDef: t,
    channel: e,
    markDef: i,
    ref: s,
    config: a
  });
}
const rle = /* @__PURE__ */ new Set(["aria"]);
function bi(e, t) {
  const { fill: n = void 0, stroke: i = void 0 } = t.color === "include" ? b4(e) : {};
  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ole(e.markDef, t)), JF(e, "fill", n)), JF(e, "stroke", i)), At("opacity", e)), At("fillOpacity", e)), At("strokeOpacity", e)), At("strokeWidth", e)), At("strokeDash", e)), Vue(e)), y4(e)), HA(e, "href")), Hue(e));
}
function JF(e, t, n) {
  const { config: i, mark: r, markDef: o } = e;
  if (Re("invalid", o, i) === "hide" && n && !Na(r)) {
    const s = ale(e, { invalid: !0, channels: rm });
    if (s)
      return {
        [t]: [
          { test: s, value: null },
          ...lt(n)
        ]
      };
  }
  return n ? { [t]: n } : {};
}
function ole(e, t) {
  return Woe.reduce((n, i) => (!rle.has(i) && e[i] !== void 0 && t[i] !== "ignore" && (n[i] = Ze(e[i])), n), {});
}
function ale(e, { invalid: t = !1, channels: n }) {
  const i = n.reduce((o, a) => {
    const s = e.getScaleComponent(a);
    if (s) {
      const u = s.get("type"), l = e.vgField(a, { expr: "datum" });
      l && mi(u) && (o[l] = !0);
    }
    return o;
  }, {}), r = B(i);
  if (r.length > 0) {
    const o = t ? "||" : "&&";
    return r.map((a) => EA(a, t)).join(` ${o} `);
  }
}
function XA(e) {
  const { config: t, markDef: n } = e;
  if (Re("invalid", n, t)) {
    const r = sle(e, { channels: pi });
    if (r)
      return { defined: { signal: r } };
  }
  return {};
}
function sle(e, { invalid: t = !1, channels: n }) {
  const i = n.reduce((o, a) => {
    const s = e.getScaleComponent(a);
    if (s) {
      const u = s.get("type"), l = e.vgField(a, { expr: "datum" });
      l && mi(u) && (o[l] = !0);
    }
    return o;
  }, {}), r = B(i);
  if (r.length > 0) {
    const o = t ? "||" : "&&";
    return r.map((a) => EA(a, t)).join(` ${o} `);
  }
}
function QF(e, t) {
  if (t !== void 0)
    return { [e]: Ze(t) };
}
const ry = "voronoi", E4 = {
  has: (e) => e.type !== "interval" && e.nearest,
  parse: (e, t) => {
    if (t.events)
      for (const n of t.events)
        n.markname = e.getName(ry);
  },
  marks: (e, t, n) => {
    const { x: i, y: r } = t.project.hasChannel, o = e.mark;
    if (Na(o))
      return U(kre(o)), n;
    const a = {
      name: e.getName(ry),
      type: "path",
      interactive: !0,
      from: { data: e.getName("marks") },
      encode: {
        update: Object.assign({ fill: { value: "transparent" }, strokeWidth: { value: 0.35 }, stroke: { value: "transparent" }, isVoronoi: { value: !0 } }, y4(e, { reactiveGeom: !0 }))
      },
      transform: [
        {
          type: "voronoi",
          x: { expr: i || !r ? "datum.datum.x || 0" : "0" },
          y: { expr: r || !i ? "datum.datum.y || 0" : "0" },
          size: [e.getSizeSignalRef("width"), e.getSizeSignalRef("height")]
        }
      ]
    };
    let s = 0, u = !1;
    return n.forEach((l, c) => {
      var f;
      const d = (f = l.name) !== null && f !== void 0 ? f : "";
      d === e.component.mark[0].name ? s = c : d.indexOf(ry) >= 0 && (u = !0);
    }), u || n.splice(s + 1, 0, a), n;
  }
};
class Ue {
  constructor(t, n) {
    this.debugName = n, this._children = [], this._parent = null, t && (this.parent = t);
  }
  clone() {
    throw new Error("Cannot clone node");
  }
  get parent() {
    return this._parent;
  }
  set parent(t) {
    this._parent = t, t && t.addChild(this);
  }
  get children() {
    return this._children;
  }
  numChildren() {
    return this._children.length;
  }
  addChild(t, n) {
    if (this._children.indexOf(t) > -1) {
      U(Ire);
      return;
    }
    n !== void 0 ? this._children.splice(n, 0, t) : this._children.push(t);
  }
  removeChild(t) {
    const n = this._children.indexOf(t);
    return this._children.splice(n, 1), n;
  }
  remove() {
    let t = this._parent.removeChild(this);
    for (const n of this._children)
      n._parent = this._parent, this._parent.addChild(n, t++);
  }
  insertAsParentOf(t) {
    const n = t.parent;
    n.removeChild(this), this.parent = n, t.parent = this;
  }
  swapWithParent() {
    const t = this._parent, n = t.parent;
    for (const i of this._children)
      i.parent = t;
    this._children = [], t.removeChild(this), t.parent.removeChild(t), this.parent = n, t.parent = this;
  }
}
class pn extends Ue {
  constructor(t, n, i, r) {
    super(t, n), this.type = i, this.refCounts = r, this._source = this._name = n, this.refCounts && !(this._name in this.refCounts) && (this.refCounts[this._name] = 0);
  }
  clone() {
    const t = new this.constructor();
    return t.debugName = "clone_" + this.debugName, t._source = this._source, t._name = "clone_" + this._name, t.type = this.type, t.refCounts = this.refCounts, t.refCounts[t._name] = 0, t;
  }
  dependentFields() {
    return /* @__PURE__ */ new Set();
  }
  producedFields() {
    return /* @__PURE__ */ new Set();
  }
  hash() {
    return this._hash === void 0 && (this._hash = `Output ${ER()}`), this._hash;
  }
  getSource() {
    return this.refCounts[this._name]++, this._source;
  }
  isRequired() {
    return !!this.refCounts[this._name];
  }
  setSource(t) {
    this._source = t;
  }
}
var ZF = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
class mr extends Ue {
  constructor(t, n) {
    super(t), this.formula = n;
  }
  clone() {
    return new mr(null, pe(this.formula));
  }
  static makeFromEncoding(t, n) {
    const i = n.reduceFieldDef((r, o, a) => {
      const { field: s, timeUnit: u } = o, l = it(n) ? n.encoding[Pr(a)] : void 0, c = it(n) && CA(a, o, l, n.stack, n.markDef, n.config);
      if (u) {
        const f = W(o, { forAs: !0 });
        r[we({
          as: f,
          field: s,
          timeUnit: u
        })] = Object.assign({
          as: f,
          field: s,
          timeUnit: u
        }, c ? { band: !0 } : {});
      }
      return r;
    }, {});
    return Ie(i) ? null : new mr(t, i);
  }
  static makeFromTransform(t, n) {
    const i = Object.assign({}, n), { timeUnit: r } = i, o = ZF(i, ["timeUnit"]), a = bn(r), s = Object.assign(Object.assign({}, o), { timeUnit: a });
    return new mr(t, {
      [we(s)]: s
    });
  }
  merge(t) {
    this.formula = Object.assign({}, this.formula);
    for (const n in t.formula)
      (!this.formula[n] || t.formula[n].band) && (this.formula[n] = t.formula[n]);
    for (const n of t.children)
      t.removeChild(n), n.parent = this;
    t.remove();
  }
  removeFormulas(t) {
    const n = {};
    for (const [i, r] of md(this.formula))
      t.has(r.as) || (n[i] = r);
    this.formula = n;
  }
  producedFields() {
    return new Set(oo(this.formula).map((t) => t.as));
  }
  dependentFields() {
    return new Set(oo(this.formula).map((t) => t.field));
  }
  hash() {
    return `TimeUnit ${we(this.formula)}`;
  }
  assemble() {
    const t = [];
    for (const n of oo(this.formula)) {
      const { field: i, as: r, timeUnit: o } = n, a = bn(o), { unit: s, utc: u } = a, l = ZF(a, ["unit", "utc"]);
      t.push(Object.assign(Object.assign(Object.assign(Object.assign({ field: go(i), type: "timeunit" }, s ? { units: sA(s) } : {}), u ? { timezone: "utc" } : {}), l), { as: [r, `${r}_end`] }));
    }
    return t;
  }
}
var ule = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
const kd = "_tuple_fields";
class lle {
  constructor(...t) {
    this.items = t, this.hasChannel = {}, this.hasField = {};
  }
}
const cle = {
  has: () => !0,
  parse: (e, t, n) => {
    var i, r, o;
    const a = t.name, s = (i = t.project) !== null && i !== void 0 ? i : t.project = new lle(), u = {}, l = {}, c = /* @__PURE__ */ new Set(), f = (d, h) => {
      const g = h === "visual" ? d.channel : d.field;
      let p = Xe(`${a}_${g}`);
      for (let m = 1; c.has(p); m++)
        p = Xe(`${a}_${g}_${m}`);
      return c.add(p), { [h]: p };
    };
    if (!n.fields && !n.encodings) {
      const d = e.config.selection[n.type];
      if (n.init)
        for (const h of lt(n.init))
          for (const g of B(h))
            mre(g) ? (n.encodings || (n.encodings = [])).push(g) : n.type === "interval" ? (U(Rre), n.encodings = d.encodings) : (n.fields || (n.fields = [])).push(g);
      else
        n.encodings = d.encodings, n.fields = d.fields;
    }
    for (const d of (r = n.fields) !== null && r !== void 0 ? r : []) {
      const h = { type: "E", field: d };
      h.signals = Object.assign({}, f(h, "data")), s.items.push(h), s.hasField[d] = h;
    }
    for (const d of (o = n.encodings) !== null && o !== void 0 ? o : []) {
      const h = e.fieldDef(d);
      if (h) {
        let g = h.field;
        if (h.aggregate) {
          U(Fre(d, h.aggregate));
          continue;
        } else if (!g) {
          U(xF(d));
          continue;
        }
        if (h.timeUnit) {
          g = e.vgField(d);
          const p = {
            timeUnit: h.timeUnit,
            as: g,
            field: h.field
          };
          l[we(p)] = p;
        }
        if (!u[g]) {
          let p = "E";
          if (t.type === "interval") {
            const y = e.getScaleComponent(d).get("type");
            mi(y) && (p = "R");
          } else
            h.bin && (p = "R-RE");
          const m = { field: g, channel: d, type: p };
          m.signals = Object.assign(Object.assign({}, f(m, "data")), f(m, "visual")), s.items.push(u[g] = m), s.hasField[g] = s.hasChannel[d] = u[g];
        }
      } else
        U(xF(d));
    }
    if (n.init) {
      const d = (h) => s.items.map((g) => h[g.channel] !== void 0 ? h[g.channel] : h[g.field]);
      if (n.type === "interval")
        t.init = d(n.init);
      else {
        const h = lt(n.init);
        t.init = h.map(d);
      }
    }
    Ie(l) || (s.timeUnit = new mr(null, l));
  },
  signals: (e, t, n) => {
    const i = t.name + kd;
    return n.filter((o) => o.name === i).length > 0 ? n : n.concat({
      name: i,
      value: t.project.items.map((o) => {
        const a = ule(o, ["signals", "hasLegend"]);
        return a.field = go(a.field), a;
      })
    });
  }
}, A4 = {
  has: (e) => e.type === "single" && e.resolve === "global" && e.bind && e.bind !== "scales" && !zA(e.bind),
  parse: (e, t, n, i) => {
    i.on || delete t.events, i.clear || delete t.clear;
  },
  topLevelSignals: (e, t, n) => {
    const i = t.name, r = t.project, o = t.bind, a = t.init && t.init[0], s = E4.has(t) ? "(item().isVoronoi ? datum.datum : datum)" : "datum";
    return r.items.forEach((u, l) => {
      var c, f;
      const d = Xe(`${i}_${u.field}`);
      n.filter((g) => g.name === d).length || n.unshift(Object.assign(Object.assign({ name: d }, a ? { init: hl(a[l]) } : { value: null }), { on: t.events ? [
        {
          events: t.events,
          update: `datum && item().mark.marktype !== 'group' ? ${s}[${_e(u.field)}] : null`
        }
      ] : [], bind: (f = (c = o[u.field]) !== null && c !== void 0 ? c : o[u.channel]) !== null && f !== void 0 ? f : o }));
    }), n;
  },
  signals: (e, t, n) => {
    const i = t.name, r = t.project, o = n.filter((l) => l.name === i + Or)[0], a = i + kd, s = r.items.map((l) => Xe(`${i}_${l.field}`)), u = s.map((l) => `${l} !== null`).join(" && ");
    return s.length && (o.update = `${u} ? {fields: ${a}, values: [${s.join(", ")}]} : null`), delete o.value, delete o.on, n;
  }
}, $0 = "_toggle", _4 = {
  has: (e) => e.type === "multi" && !!e.toggle,
  signals: (e, t, n) => n.concat({
    name: t.name + $0,
    value: !1,
    on: [{ events: t.events, update: t.toggle }]
  }),
  modifyExpr: (e, t) => {
    const n = t.name + Or, i = t.name + $0;
    return `${i} ? null : ${n}, ` + (t.resolve === "global" ? `${i} ? null : true, ` : `${i} ? null : {unit: ${lo(e)}}, `) + `${i} ? ${n} : null`;
  }
}, fle = {
  has: (e) => e.clear !== void 0 && e.clear !== !1,
  parse: (e, t, n) => {
    n.clear && (t.clear = ge(n.clear) ? Rl(n.clear, "scope") : n.clear);
  },
  topLevelSignals: (e, t, n) => {
    if (A4.has(t))
      for (const i of t.project.items) {
        const r = n.findIndex((o) => o.name === Xe(`${t.name}_${i.field}`));
        r !== -1 && n[r].on.push({ events: t.clear, update: "null" });
      }
    return n;
  },
  signals: (e, t, n) => {
    function i(r, o) {
      r !== -1 && n[r].on && n[r].on.push({ events: t.clear, update: o });
    }
    if (t.type === "interval")
      for (const r of t.project.items) {
        const o = n.findIndex((a) => a.name === r.signals.visual);
        if (i(o, "[0, 0]"), o === -1) {
          const a = n.findIndex((s) => s.name === r.signals.data);
          i(a, "null");
        }
      }
    else {
      let r = n.findIndex((o) => o.name === t.name + Or);
      i(r, "null"), _4.has(t) && (r = n.findIndex((o) => o.name === t.name + $0), i(r, "false"));
    }
    return n;
  }
}, va = {
  has: (e) => e.type === "interval" && e.resolve === "global" && e.bind && e.bind === "scales",
  parse: (e, t) => {
    const n = t.scales = [];
    for (const i of t.project.items) {
      const r = i.channel;
      if (!Ma(r))
        continue;
      const o = e.getScaleComponent(r), a = o ? o.get("type") : void 0;
      if (!o || !mi(a)) {
        U($re);
        continue;
      }
      const s = { selection: t.name, field: i.field };
      o.set("selectionExtent", s, !0), n.push(i);
    }
  },
  topLevelSignals: (e, t, n) => {
    const i = t.scales.filter((a) => n.filter((s) => s.name === a.signals.data).length === 0);
    if (!e.parent || Ob(e) || i.length === 0)
      return n;
    const r = n.filter((a) => a.name === t.name)[0];
    let o = r.update;
    if (o.indexOf(T4) >= 0)
      r.update = `{${i.map((a) => `${_e(a.field)}: ${a.signals.data}`).join(", ")}}`;
    else {
      for (const a of i) {
        const s = `${_e(a.field)}: ${a.signals.data}`;
        o.indexOf(s) < 0 && (o = `${o.substring(0, o.length - 1)}, ${s}}`);
      }
      r.update = o;
    }
    return n.concat(i.map((a) => ({ name: a.signals.data })));
  },
  signals: (e, t, n) => {
    if (e.parent && !Ob(e))
      for (const i of t.scales) {
        const r = n.filter((o) => o.name === i.signals.data)[0];
        r.push = "outer", delete r.value, delete r.update;
      }
    return n;
  }
};
function _b(e, t) {
  return `domain(${_e(e.scaleName(t))})`;
}
function Ob(e) {
  var t;
  return e.parent && Bl(e.parent) && ((t = !e.parent.parent) !== null && t !== void 0 ? t : Ob(e.parent.parent));
}
const O4 = {
  has: (e) => {
    const t = e.resolve === "global" && e.bind && zA(e.bind), n = e.project.items.length === 1 && e.project.items[0].field !== dl;
    return t && !n && U(Mre), t && n;
  },
  parse: (e, t, n, i) => {
    var r;
    if (i.on || delete t.events, i.clear || delete t.clear, i.on || i.clear) {
      const s = 'event.item && indexof(event.item.mark.role, "legend") < 0';
      for (const u of t.events)
        u.filter = lt((r = u.filter) !== null && r !== void 0 ? r : []), u.filter.indexOf(s) < 0 && u.filter.push(s);
    }
    const o = ty(t.bind) ? t.bind.legend : "click", a = ge(o) ? Rl(o, "view") : lt(o);
    t.bind = { legend: { merge: a } };
  },
  topLevelSignals: (e, t, n) => {
    const i = t.name, r = ty(t.bind) && t.bind.legend, o = (a) => (s) => {
      const u = pe(s);
      return u.markname = a, u;
    };
    for (const a of t.project.items) {
      if (!a.hasLegend)
        continue;
      const s = `${Xe(a.field)}_legend`, u = `${i}_${s}`;
      if (n.filter((c) => c.name === u).length === 0) {
        const c = r.merge.map(o(`${s}_symbols`)).concat(r.merge.map(o(`${s}_labels`))).concat(r.merge.map(o(`${s}_entries`)));
        n.unshift(Object.assign(Object.assign({ name: u }, t.init ? {} : { value: null }), { on: [
          { events: c, update: "datum.value || item().items[0].items[0].datum.value", force: !0 },
          { events: r.merge, update: `!event.item || !datum ? null : ${u}`, force: !0 }
        ] }));
      }
    }
    return n;
  },
  signals: (e, t, n) => {
    const i = t.name, r = t.project, o = n.find((d) => d.name === i + Or), a = i + kd, s = r.items.filter((d) => d.hasLegend).map((d) => Xe(`${i}_${Xe(d.field)}_legend`)), l = `${s.map((d) => `${d} !== null`).join(" && ")} ? {fields: ${a}, values: [${s.join(", ")}]} : null`;
    t.events && s.length > 0 ? o.on.push({
      events: s.map((d) => ({ signal: d })),
      update: l
    }) : s.length > 0 && (o.update = l, delete o.value, delete o.on);
    const c = n.find((d) => d.name === i + $0), f = ty(t.bind) && t.bind.legend;
    return c && (t.events ? c.on.push(Object.assign(Object.assign({}, c.on[0]), { events: f })) : c.on[0].events = f), n;
  }
};
function dle(e, t, n) {
  var i;
  const r = (i = e.fieldDef(t)) === null || i === void 0 ? void 0 : i.field;
  nu(e, (o) => {
    var a, s;
    const u = (a = o.project.hasField[r]) !== null && a !== void 0 ? a : o.project.hasChannel[t];
    if (u && O4.has(o)) {
      const l = (s = n.get("selections")) !== null && s !== void 0 ? s : [];
      l.push(o.name), n.set("selections", l, !1), u.hasLegend = !0;
    }
  });
}
const S4 = "_translate_anchor", C4 = "_translate_delta", hle = {
  has: (e) => e.type === "interval" && e.translate,
  signals: (e, t, n) => {
    const i = t.name, r = va.has(t), o = i + S4, { x: a, y: s } = t.project.hasChannel;
    let u = Rl(t.translate, "scope");
    return r || (u = u.map((l) => (l.between[0].markname = i + Jc, l))), n.push({
      name: o,
      value: {},
      on: [
        {
          events: u.map((l) => l.between[0]),
          update: "{x: x(unit), y: y(unit)" + (a !== void 0 ? ", extent_x: " + (r ? _b(e, et) : `slice(${a.signals.visual})`) : "") + (s !== void 0 ? ", extent_y: " + (r ? _b(e, xt) : `slice(${s.signals.visual})`) : "") + "}"
        }
      ]
    }, {
      name: i + C4,
      value: {},
      on: [
        {
          events: u,
          update: `{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`
        }
      ]
    }), a !== void 0 && ek(e, t, a, "width", n), s !== void 0 && ek(e, t, s, "height", n), n;
  }
};
function ek(e, t, n, i, r) {
  var o;
  const a = t.name, s = a + S4, u = a + C4, l = n.channel, c = va.has(t), f = r.filter((x) => x.name === n.signals[c ? "data" : "visual"])[0], d = e.getSizeSignalRef(i).signal, h = e.getScaleComponent(l), g = h.get("type"), p = c && l === et ? "-" : "", m = `${s}.extent_${l}`, y = `${p}${u}.${l} / ` + (c ? `${d}` : `span(${m})`), b = `${c ? g === "log" ? "panLog" : g === "pow" ? "panPow" : "panLinear" : "panLinear"}(${m}, ${y}` + (c && g === "pow" ? `, ${(o = h.get("exponent")) !== null && o !== void 0 ? o : 1}` : "") + ")";
  f.on.push({
    events: { signal: u },
    update: c ? b : `clampRange(${b}, 0, ${d})`
  });
}
const F4 = "_zoom_anchor", k4 = "_zoom_delta", gle = {
  has: (e) => e.type === "interval" && e.zoom,
  signals: (e, t, n) => {
    const i = t.name, r = va.has(t), o = i + k4, { x: a, y: s } = t.project.hasChannel, u = _e(e.scaleName(et)), l = _e(e.scaleName(xt));
    let c = Rl(t.zoom, "scope");
    return r || (c = c.map((f) => (f.markname = i + Jc, f))), n.push({
      name: i + F4,
      on: [
        {
          events: c,
          update: r ? "{" + [u ? `x: invert(${u}, x(unit))` : "", l ? `y: invert(${l}, y(unit))` : ""].filter((f) => !!f).join(", ") + "}" : "{x: x(unit), y: y(unit)}"
        }
      ]
    }, {
      name: o,
      on: [
        {
          events: c,
          force: !0,
          update: "pow(1.001, event.deltaY * pow(16, event.deltaMode))"
        }
      ]
    }), a !== void 0 && tk(e, t, a, "width", n), s !== void 0 && tk(e, t, s, "height", n), n;
  }
};
function tk(e, t, n, i, r) {
  var o;
  const a = t.name, s = n.channel, u = va.has(t), l = r.filter((v) => v.name === n.signals[u ? "data" : "visual"])[0], c = e.getSizeSignalRef(i).signal, f = e.getScaleComponent(s), d = f.get("type"), h = u ? _b(e, s) : l.name, g = a + k4, p = `${a}${F4}.${s}`, y = `${u ? d === "log" ? "zoomLog" : d === "pow" ? "zoomPow" : "zoomLinear" : "zoomLinear"}(${h}, ${p}, ${g}` + (u && d === "pow" ? `, ${(o = f.get("exponent")) !== null && o !== void 0 ? o : 1}` : "") + ")";
  l.on.push({
    events: { signal: g },
    update: u ? y : `clampRange(${y}, 0, ${c})`
  });
}
const ple = [cle, _4, va, O4, hle, gle, A4, E4, fle];
function Om(e, t) {
  for (const n of ple)
    n.has(e) && t(n);
}
var mle = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function hl(e, t = !0, n = Lie) {
  if (K(e)) {
    const i = e.map((r) => hl(r, t, n));
    return t ? `[${i.join(", ")}]` : i;
  } else if (tu(e))
    return n(t ? Cf(e) : Toe(e));
  return t ? n(JSON.stringify(e)) : e;
}
function yle(e, t) {
  return nu(e, (n, i) => {
    const r = n.name;
    let o = i.modifyExpr(e, n);
    t.push(...i.signals(e, n)), Om(n, (a) => {
      a.signals && (t = a.signals(e, n, t)), a.modifyExpr && (o = a.modifyExpr(e, n, o));
    }), t.push({
      name: r + Fle,
      on: [
        {
          events: { signal: n.name + Or },
          update: `modify(${_e(n.name + Ps)}, ${o})`
        }
      ]
    });
  }), VA(t);
}
function vle(e, t) {
  if (e.component.selection && B(e.component.selection).length) {
    const n = _e(e.getName("cell"));
    t.unshift({
      name: "facet",
      value: {},
      on: [
        {
          events: Rl("mousemove", "scope"),
          update: `isTuple(facet) ? facet : group(${n}).datum`
        }
      ]
    });
  }
  return VA(t);
}
function ble(e, t) {
  let n = !1;
  return nu(e, (i, r) => {
    const o = i.name, a = _e(o + Ps);
    if (t.filter((u) => u.name === o).length === 0) {
      const u = i.resolve === "global" ? "union" : i.resolve, l = i.type === "multi" ? ", true)" : ")";
      t.push({
        name: i.name,
        update: `${T4}(${a}, ${_e(u)}${l}`
      });
    }
    n = !0, r.topLevelSignals && (t = r.topLevelSignals(e, i, t)), Om(i, (u) => {
      u.topLevelSignals && (t = u.topLevelSignals(e, i, t));
    });
  }), n && t.filter((r) => r.name === "unit").length === 0 && t.unshift({
    name: "unit",
    value: {},
    on: [{ events: "mousemove", update: "isTuple(group()) ? group() : unit" }]
  }), VA(t);
}
function xle(e, t) {
  const n = [...t];
  return nu(e, (i) => {
    const r = { name: i.name + Ps };
    if (i.init) {
      const a = i.project.items.map((u) => mle(u, ["signals"])), s = i.init.map((u) => hl(u, !1));
      r.values = i.type === "interval" ? [{ unit: lo(e, { escape: !1 }), fields: a, values: s }] : s.map((u) => ({ unit: lo(e, { escape: !1 }), fields: a, values: u }));
    }
    n.filter((a) => a.name === i.name + Ps).length || n.push(r);
  }), n;
}
function D4(e, t) {
  return nu(e, (n, i) => {
    t = i.marks ? i.marks(e, n, t) : t, Om(n, (r) => {
      r.marks && (t = r.marks(e, n, t));
    });
  }), t;
}
function wle(e, t) {
  for (const n of e.children)
    it(n) && (t = D4(n, t));
  return t;
}
function Ele(e, t) {
  const n = t.selection, i = e.getSelectionComponent(n, Xe(n));
  return { signal: q4(i, t) };
}
function VA(e) {
  return e.map((t) => (t.on && !t.on.length && delete t.on, t));
}
var Ale = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
const Jc = "_brush", Sb = "_scale_trigger", _le = {
  signals: (e, t) => {
    const n = t.name, i = n + kd, r = va.has(t), o = [], a = [], s = [];
    if (t.translate && !r) {
      const c = `!event.item || event.item.mark.name !== ${_e(n + Jc)}`;
      $4(t, (f, d) => {
        var h;
        const g = lt((h = d.between[0].filter) !== null && h !== void 0 ? h : d.between[0].filter = []);
        return g.indexOf(c) < 0 && g.push(c), f;
      });
    }
    t.project.items.forEach((c, f) => {
      const d = c.channel;
      if (d !== et && d !== xt) {
        U("Interval selections only support x and y encoding channels.");
        return;
      }
      const h = t.init ? t.init[f] : null, g = Ole(e, t, c, h), p = c.signals.data, m = c.signals.visual, y = _e(e.scaleName(d)), v = e.getScaleComponent(d).get("type"), b = mi(v) ? "+" : "";
      o.push(...g), a.push(p), s.push({
        scaleName: e.scaleName(d),
        expr: `(!isArray(${p}) || (${b}invert(${y}, ${m})[0] === ${b}${p}[0] && ${b}invert(${y}, ${m})[1] === ${b}${p}[1]))`
      });
    }), r || o.push({
      name: n + Sb,
      value: {},
      on: [
        {
          events: s.map((c) => ({ scale: c.scaleName })),
          update: s.map((c) => c.expr).join(" && ") + ` ? ${n + Sb} : {}`
        }
      ]
    });
    const u = t.init, l = `unit: ${lo(e)}, fields: ${i}, values`;
    return o.concat(Object.assign(Object.assign({ name: n + Or }, u ? { init: `{${l}: ${hl(u)}}` } : {}), { on: [
      {
        events: [{ signal: a.join(" || ") }],
        update: a.join(" && ") + ` ? {${l}: [${a}]} : null`
      }
    ] }));
  },
  modifyExpr: (e, t) => t.name + Or + ", " + (t.resolve === "global" ? "true" : `{unit: ${lo(e)}}`),
  marks: (e, t, n) => {
    const i = t.name, { x: r, y: o } = t.project.hasChannel, a = r && r.signals.visual, s = o && o.signals.visual, u = `data(${_e(t.name + Ps)})`;
    if (va.has(t))
      return n;
    const l = {
      x: r !== void 0 ? { signal: `${a}[0]` } : { value: 0 },
      y: o !== void 0 ? { signal: `${s}[0]` } : { value: 0 },
      x2: r !== void 0 ? { signal: `${a}[1]` } : { field: { group: "width" } },
      y2: o !== void 0 ? { signal: `${s}[1]` } : { field: { group: "height" } }
    };
    if (t.resolve === "global")
      for (const m of B(l))
        l[m] = [
          Object.assign({ test: `${u}.length && ${u}[0].unit === ${lo(e)}` }, l[m]),
          { value: 0 }
        ];
    const c = t.mark, { fill: f, fillOpacity: d, cursor: h } = c, g = Ale(c, ["fill", "fillOpacity", "cursor"]), p = B(g).reduce((m, y) => (m[y] = [
      {
        test: [r !== void 0 && `${a}[0] !== ${a}[1]`, o !== void 0 && `${s}[0] !== ${s}[1]`].filter((v) => v).join(" && "),
        value: g[y]
      },
      { value: null }
    ], m), {});
    return [
      {
        name: i + Jc + "_bg",
        type: "rect",
        clip: !0,
        encode: {
          enter: {
            fill: { value: f },
            fillOpacity: { value: d }
          },
          update: l
        }
      },
      ...n,
      {
        name: i + Jc,
        type: "rect",
        clip: !0,
        encode: {
          enter: Object.assign(Object.assign({}, h ? { cursor: { value: h } } : {}), { fill: { value: "transparent" } }),
          update: Object.assign(Object.assign({}, l), p)
        }
      }
    ];
  }
};
function Ole(e, t, n, i) {
  const r = n.channel, o = n.signals.visual, a = n.signals.data, s = va.has(t), u = _e(e.scaleName(r)), l = e.getScaleComponent(r), c = l ? l.get("type") : void 0, f = (p) => `scale(${u}, ${p})`, d = e.getSizeSignalRef(r === et ? "width" : "height").signal, h = `${r}(unit)`, g = $4(t, (p, m) => [
    ...p,
    { events: m.between[0], update: `[${h}, ${h}]` },
    { events: m, update: `[${o}[0], clamp(${h}, 0, ${d})]` }
  ]);
  return g.push({
    events: { signal: t.name + Sb },
    update: mi(c) ? `[${f(`${a}[0]`)}, ${f(`${a}[1]`)}]` : "[0, 0]"
  }), s ? [{ name: a, on: [] }] : [
    Object.assign(Object.assign({ name: o }, i ? { init: hl(i, !0, f) } : { value: [] }), { on: g }),
    Object.assign(Object.assign({ name: a }, i ? { init: hl(i) } : {}), { on: [
      {
        events: { signal: o },
        update: `${o}[0] === ${o}[1] ? null : invert(${u}, ${o})`
      }
    ] })
  ];
}
function $4(e, t) {
  return e.events.reduce((n, i) => i.between ? t(n, i) : (U(`${i} is not an ordered event stream for interval selections.`), n), []);
}
function M4(e, t) {
  const n = t.name, i = n + kd, r = t.project, o = "(item().isVoronoi ? datum.datum : datum)", a = r.items.map((l) => {
    const c = e.fieldDef(l.channel);
    return c && c.bin ? `[${o}[${_e(e.vgField(l.channel, {}))}], ${o}[${_e(e.vgField(l.channel, { binSuffix: "end" }))}]]` : `${o}[${_e(l.field)}]`;
  }).join(", "), s = `unit: ${lo(e)}, fields: ${i}, values`, u = t.events;
  return [
    {
      name: n + Or,
      on: u ? [
        {
          events: u,
          update: `datum && item().mark.marktype !== 'group' ? {${s}: [${a}]} : null`,
          force: !0
        }
      ] : []
    }
  ];
}
const Sle = {
  signals: M4,
  modifyExpr: (e, t) => t.name + Or + ", " + (t.resolve === "global" ? "null" : `{unit: ${lo(e)}}`)
}, Cle = {
  signals: M4,
  modifyExpr: (e, t) => t.name + Or + ", " + (t.resolve === "global" ? "true" : `{unit: ${lo(e)}}`)
}, Ps = "_store", Or = "_tuple", Fle = "_modify", T4 = "vlSelectionResolve", kle = { single: Cle, multi: Sle, interval: _le };
function nu(e, t) {
  const n = e.component.selection;
  if (n) {
    for (const i of oo(n))
      if (t(i, kle[i.type]) === !0)
        break;
  }
}
function Dle(e) {
  let t = e.parent;
  for (; t && !Bi(t); )
    t = t.parent;
  return t;
}
function lo(e, { escape: t } = { escape: !0 }) {
  let n = t ? _e(e.name) : e.name;
  const i = Dle(e);
  if (i) {
    const { facet: r } = i;
    for (const o of si)
      r[o] && (n += ` + '__facet_${o}_' + (facet[${_e(i.vgField(o))}])`);
  }
  return n;
}
function KA(e) {
  let t = !1;
  return nu(e, (n) => {
    t = t || n.project.items.some((i) => i.field === dl);
  }), t;
}
const $le = "RawCode", Mle = "Literal", Tle = "Property", Nle = "Identifier", Rle = "ArrayExpression", jle = "BinaryExpression", Ple = "CallExpression", Lle = "ConditionalExpression", Ile = "LogicalExpression", Ble = "MemberExpression", zle = "ObjectExpression", Ule = "UnaryExpression";
function Ji(e) {
  this.type = e;
}
Ji.prototype.visit = function(e) {
  let t, n, i;
  if (e(this))
    return 1;
  for (t = qle(this), n = 0, i = t.length; n < i; ++n)
    if (t[n].visit(e))
      return 1;
};
function qle(e) {
  switch (e.type) {
    case Rle:
      return e.elements;
    case jle:
    case Ile:
      return [e.left, e.right];
    case Ple:
      return [e.callee].concat(e.arguments);
    case Lle:
      return [e.test, e.consequent, e.alternate];
    case Ble:
      return [e.object, e.property];
    case zle:
      return e.properties;
    case Tle:
      return [e.key, e.value];
    case Ule:
      return [e.argument];
    case Nle:
    case Mle:
    case $le:
    default:
      return [];
  }
}
var Ir, V, j, Jt, Le, Sm = 1, Dd = 2, Ls = 3, ja = 4, Cm = 5, iu = 6, On = 7, $d = 8, Wle = 9;
Ir = {};
Ir[Sm] = "Boolean";
Ir[Dd] = "<end>";
Ir[Ls] = "Identifier";
Ir[ja] = "Keyword";
Ir[Cm] = "Null";
Ir[iu] = "Numeric";
Ir[On] = "Punctuator";
Ir[$d] = "String";
Ir[Wle] = "RegularExpression";
var Gle = "ArrayExpression", Hle = "BinaryExpression", Yle = "CallExpression", Xle = "ConditionalExpression", N4 = "Identifier", Vle = "Literal", Kle = "LogicalExpression", Jle = "MemberExpression", Qle = "ObjectExpression", Zle = "Property", ece = "UnaryExpression", kt = "Unexpected token %0", tce = "Unexpected number", nce = "Unexpected string", ice = "Unexpected identifier", rce = "Unexpected reserved word", oce = "Unexpected end of input", Cb = "Invalid regular expression", oy = "Invalid regular expression: missing /", R4 = "Octal literals are not allowed in strict mode.", ace = "Duplicate data property in object literal not allowed in strict mode", Nt = "ILLEGAL", $f = "Disabled.", sce = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), uce = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");
function Fm(e, t) {
  if (!e)
    throw new Error("ASSERT: " + t);
}
function Vr(e) {
  return e >= 48 && e <= 57;
}
function JA(e) {
  return "0123456789abcdefABCDEF".indexOf(e) >= 0;
}
function Qc(e) {
  return "01234567".indexOf(e) >= 0;
}
function lce(e) {
  return e === 32 || e === 9 || e === 11 || e === 12 || e === 160 || e >= 5760 && [5760, 6158, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279].indexOf(e) >= 0;
}
function Mf(e) {
  return e === 10 || e === 13 || e === 8232 || e === 8233;
}
function Md(e) {
  return e === 36 || e === 95 || e >= 65 && e <= 90 || e >= 97 && e <= 122 || e === 92 || e >= 128 && sce.test(String.fromCharCode(e));
}
function M0(e) {
  return e === 36 || e === 95 || e >= 65 && e <= 90 || e >= 97 && e <= 122 || e >= 48 && e <= 57 || e === 92 || e >= 128 && uce.test(String.fromCharCode(e));
}
const cce = {
  if: 1,
  in: 1,
  do: 1,
  var: 1,
  for: 1,
  new: 1,
  try: 1,
  let: 1,
  this: 1,
  else: 1,
  case: 1,
  void: 1,
  with: 1,
  enum: 1,
  while: 1,
  break: 1,
  catch: 1,
  throw: 1,
  const: 1,
  yield: 1,
  class: 1,
  super: 1,
  return: 1,
  typeof: 1,
  delete: 1,
  switch: 1,
  export: 1,
  import: 1,
  public: 1,
  static: 1,
  default: 1,
  finally: 1,
  extends: 1,
  package: 1,
  private: 1,
  function: 1,
  continue: 1,
  debugger: 1,
  interface: 1,
  protected: 1,
  instanceof: 1,
  implements: 1
};
function j4() {
  for (; j < Jt; ) {
    const e = V.charCodeAt(j);
    if (lce(e) || Mf(e))
      ++j;
    else
      break;
  }
}
function Fb(e) {
  var t, n, i, r = 0;
  for (n = e === "u" ? 4 : 2, t = 0; t < n; ++t)
    j < Jt && JA(V[j]) ? (i = V[j++], r = r * 16 + "0123456789abcdef".indexOf(i.toLowerCase())) : Fe({}, kt, Nt);
  return String.fromCharCode(r);
}
function fce() {
  var e, t, n, i;
  for (e = V[j], t = 0, e === "}" && Fe({}, kt, Nt); j < Jt && (e = V[j++], !!JA(e)); )
    t = t * 16 + "0123456789abcdef".indexOf(e.toLowerCase());
  return (t > 1114111 || e !== "}") && Fe({}, kt, Nt), t <= 65535 ? String.fromCharCode(t) : (n = (t - 65536 >> 10) + 55296, i = (t - 65536 & 1023) + 56320, String.fromCharCode(n, i));
}
function P4() {
  var e, t;
  for (e = V.charCodeAt(j++), t = String.fromCharCode(e), e === 92 && (V.charCodeAt(j) !== 117 && Fe({}, kt, Nt), ++j, e = Fb("u"), (!e || e === "\\" || !Md(e.charCodeAt(0))) && Fe({}, kt, Nt), t = e); j < Jt && (e = V.charCodeAt(j), !!M0(e)); )
    ++j, t += String.fromCharCode(e), e === 92 && (t = t.substr(0, t.length - 1), V.charCodeAt(j) !== 117 && Fe({}, kt, Nt), ++j, e = Fb("u"), (!e || e === "\\" || !M0(e.charCodeAt(0))) && Fe({}, kt, Nt), t += e);
  return t;
}
function dce() {
  var e, t;
  for (e = j++; j < Jt; ) {
    if (t = V.charCodeAt(j), t === 92)
      return j = e, P4();
    if (M0(t))
      ++j;
    else
      break;
  }
  return V.slice(e, j);
}
function hce() {
  var e, t, n;
  return e = j, t = V.charCodeAt(j) === 92 ? P4() : dce(), t.length === 1 ? n = Ls : cce.hasOwnProperty(t) ? n = ja : t === "null" ? n = Cm : t === "true" || t === "false" ? n = Sm : n = Ls, {
    type: n,
    value: t,
    start: e,
    end: j
  };
}
function ay() {
  var e = j, t = V.charCodeAt(j), n, i = V[j], r, o, a;
  switch (t) {
    case 46:
    case 40:
    case 41:
    case 59:
    case 44:
    case 123:
    case 125:
    case 91:
    case 93:
    case 58:
    case 63:
    case 126:
      return ++j, {
        type: On,
        value: String.fromCharCode(t),
        start: e,
        end: j
      };
    default:
      if (n = V.charCodeAt(j + 1), n === 61)
        switch (t) {
          case 43:
          case 45:
          case 47:
          case 60:
          case 62:
          case 94:
          case 124:
          case 37:
          case 38:
          case 42:
            return j += 2, {
              type: On,
              value: String.fromCharCode(t) + String.fromCharCode(n),
              start: e,
              end: j
            };
          case 33:
          case 61:
            return j += 2, V.charCodeAt(j) === 61 && ++j, {
              type: On,
              value: V.slice(e, j),
              start: e,
              end: j
            };
        }
  }
  if (a = V.substr(j, 4), a === ">>>=")
    return j += 4, {
      type: On,
      value: a,
      start: e,
      end: j
    };
  if (o = a.substr(0, 3), o === ">>>" || o === "<<=" || o === ">>=")
    return j += 3, {
      type: On,
      value: o,
      start: e,
      end: j
    };
  if (r = o.substr(0, 2), i === r[1] && "+-<>&|".indexOf(i) >= 0 || r === "=>")
    return j += 2, {
      type: On,
      value: r,
      start: e,
      end: j
    };
  if (r === "//" && Fe({}, kt, Nt), "<>=!+-*%&|^/".indexOf(i) >= 0)
    return ++j, {
      type: On,
      value: i,
      start: e,
      end: j
    };
  Fe({}, kt, Nt);
}
function gce(e) {
  let t = "";
  for (; j < Jt && JA(V[j]); )
    t += V[j++];
  return t.length === 0 && Fe({}, kt, Nt), Md(V.charCodeAt(j)) && Fe({}, kt, Nt), {
    type: iu,
    value: parseInt("0x" + t, 16),
    start: e,
    end: j
  };
}
function pce(e) {
  let t = "0" + V[j++];
  for (; j < Jt && Qc(V[j]); )
    t += V[j++];
  return (Md(V.charCodeAt(j)) || Vr(V.charCodeAt(j))) && Fe({}, kt, Nt), {
    type: iu,
    value: parseInt(t, 8),
    octal: !0,
    start: e,
    end: j
  };
}
function nk() {
  var e, t, n;
  if (n = V[j], Fm(Vr(n.charCodeAt(0)) || n === ".", "Numeric literal must start with a decimal digit or a decimal point"), t = j, e = "", n !== ".") {
    if (e = V[j++], n = V[j], e === "0") {
      if (n === "x" || n === "X")
        return ++j, gce(t);
      if (Qc(n))
        return pce(t);
      n && Vr(n.charCodeAt(0)) && Fe({}, kt, Nt);
    }
    for (; Vr(V.charCodeAt(j)); )
      e += V[j++];
    n = V[j];
  }
  if (n === ".") {
    for (e += V[j++]; Vr(V.charCodeAt(j)); )
      e += V[j++];
    n = V[j];
  }
  if (n === "e" || n === "E")
    if (e += V[j++], n = V[j], (n === "+" || n === "-") && (e += V[j++]), Vr(V.charCodeAt(j)))
      for (; Vr(V.charCodeAt(j)); )
        e += V[j++];
    else
      Fe({}, kt, Nt);
  return Md(V.charCodeAt(j)) && Fe({}, kt, Nt), {
    type: iu,
    value: parseFloat(e),
    start: t,
    end: j
  };
}
function mce() {
  var e = "", t, n, i, r, o = !1;
  for (t = V[j], Fm(t === "'" || t === '"', "String literal must starts with a quote"), n = j, ++j; j < Jt; )
    if (i = V[j++], i === t) {
      t = "";
      break;
    } else if (i === "\\")
      if (i = V[j++], !i || !Mf(i.charCodeAt(0)))
        switch (i) {
          case "u":
          case "x":
            V[j] === "{" ? (++j, e += fce()) : e += Fb(i);
            break;
          case "n":
            e += `
`;
            break;
          case "r":
            e += "\r";
            break;
          case "t":
            e += "	";
            break;
          case "b":
            e += "\b";
            break;
          case "f":
            e += "\f";
            break;
          case "v":
            e += "\v";
            break;
          default:
            Qc(i) ? (r = "01234567".indexOf(i), r !== 0 && (o = !0), j < Jt && Qc(V[j]) && (o = !0, r = r * 8 + "01234567".indexOf(V[j++]), "0123".indexOf(i) >= 0 && j < Jt && Qc(V[j]) && (r = r * 8 + "01234567".indexOf(V[j++]))), e += String.fromCharCode(r)) : e += i;
            break;
        }
      else
        i === "\r" && V[j] === `
` && ++j;
    else {
      if (Mf(i.charCodeAt(0)))
        break;
      e += i;
    }
  return t !== "" && Fe({}, kt, Nt), {
    type: $d,
    value: e,
    octal: o,
    start: n,
    end: j
  };
}
function yce(e, t) {
  let n = e;
  t.indexOf("u") >= 0 && (n = n.replace(/\\u\{([0-9a-fA-F]+)\}/g, (i, r) => {
    if (parseInt(r, 16) <= 1114111)
      return "x";
    Fe({}, Cb);
  }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x"));
  try {
    new RegExp(n);
  } catch {
    Fe({}, Cb);
  }
  try {
    return new RegExp(e, t);
  } catch {
    return null;
  }
}
function vce() {
  var e, t, n, i, r;
  for (e = V[j], Fm(e === "/", "Regular expression literal must start with a slash"), t = V[j++], n = !1, i = !1; j < Jt; )
    if (e = V[j++], t += e, e === "\\")
      e = V[j++], Mf(e.charCodeAt(0)) && Fe({}, oy), t += e;
    else if (Mf(e.charCodeAt(0)))
      Fe({}, oy);
    else if (n)
      e === "]" && (n = !1);
    else if (e === "/") {
      i = !0;
      break;
    } else
      e === "[" && (n = !0);
  return i || Fe({}, oy), r = t.substr(1, t.length - 2), {
    value: r,
    literal: t
  };
}
function bce() {
  var e, t, n;
  for (t = "", n = ""; j < Jt && (e = V[j], !!M0(e.charCodeAt(0))); )
    ++j, e === "\\" && j < Jt ? Fe({}, kt, Nt) : (n += e, t += e);
  return n.search(/[^gimuy]/g) >= 0 && Fe({}, Cb, n), {
    value: n,
    literal: t
  };
}
function xce() {
  var e, t, n, i;
  return Le = null, j4(), e = j, t = vce(), n = bce(), i = yce(t.value, n.value), {
    literal: t.literal + n.literal,
    value: i,
    regex: {
      pattern: t.value,
      flags: n.value
    },
    start: e,
    end: j
  };
}
function wce(e) {
  return e.type === Ls || e.type === ja || e.type === Sm || e.type === Cm;
}
function L4() {
  if (j4(), j >= Jt)
    return {
      type: Dd,
      start: j,
      end: j
    };
  const e = V.charCodeAt(j);
  return Md(e) ? hce() : e === 40 || e === 41 || e === 59 ? ay() : e === 39 || e === 34 ? mce() : e === 46 ? Vr(V.charCodeAt(j + 1)) ? nk() : ay() : Vr(e) ? nk() : ay();
}
function kn() {
  const e = Le;
  return j = e.end, Le = L4(), j = e.end, e;
}
function I4() {
  const e = j;
  Le = L4(), j = e;
}
function Ece(e) {
  const t = new Ji(Gle);
  return t.elements = e, t;
}
function ik(e, t, n) {
  const i = new Ji(e === "||" || e === "&&" ? Kle : Hle);
  return i.operator = e, i.left = t, i.right = n, i;
}
function Ace(e, t) {
  const n = new Ji(Yle);
  return n.callee = e, n.arguments = t, n;
}
function _ce(e, t, n) {
  const i = new Ji(Xle);
  return i.test = e, i.consequent = t, i.alternate = n, i;
}
function QA(e) {
  const t = new Ji(N4);
  return t.name = e, t;
}
function Nc(e) {
  const t = new Ji(Vle);
  return t.value = e.value, t.raw = V.slice(e.start, e.end), e.regex && (t.raw === "//" && (t.raw = "/(?:)/"), t.regex = e.regex), t;
}
function rk(e, t, n) {
  const i = new Ji(Jle);
  return i.computed = e === "[", i.object = t, i.property = n, i.computed || (n.member = !0), i;
}
function Oce(e) {
  const t = new Ji(Qle);
  return t.properties = e, t;
}
function ok(e, t, n) {
  const i = new Ji(Zle);
  return i.key = t, i.value = n, i.kind = e, i;
}
function Sce(e, t) {
  const n = new Ji(ece);
  return n.operator = e, n.argument = t, n.prefix = !0, n;
}
function Fe(e, t) {
  var n, i = Array.prototype.slice.call(arguments, 2), r = t.replace(/%(\d)/g, (o, a) => (Fm(a < i.length, "Message reference must be in range"), i[a]));
  throw n = new Error(r), n.index = j, n.description = r, n;
}
function km(e) {
  e.type === Dd && Fe(e, oce), e.type === iu && Fe(e, tce), e.type === $d && Fe(e, nce), e.type === Ls && Fe(e, ice), e.type === ja && Fe(e, rce), Fe(e, kt, e.value);
}
function Qt(e) {
  const t = kn();
  (t.type !== On || t.value !== e) && km(t);
}
function Ye(e) {
  return Le.type === On && Le.value === e;
}
function sy(e) {
  return Le.type === ja && Le.value === e;
}
function Cce() {
  const e = [];
  for (j = Le.start, Qt("["); !Ye("]"); )
    Ye(",") ? (kn(), e.push(null)) : (e.push(Is()), Ye("]") || Qt(","));
  return kn(), Ece(e);
}
function ak() {
  j = Le.start;
  const e = kn();
  return e.type === $d || e.type === iu ? (e.octal && Fe(e, R4), Nc(e)) : QA(e.value);
}
function Fce() {
  var e, t, n, i;
  if (j = Le.start, e = Le, e.type === Ls)
    return n = ak(), Qt(":"), i = Is(), ok("init", n, i);
  if (e.type === Dd || e.type === On)
    km(e);
  else
    return t = ak(), Qt(":"), i = Is(), ok("init", t, i);
}
function kce() {
  var e = [], t, n, i, r = {}, o = String;
  for (j = Le.start, Qt("{"); !Ye("}"); )
    t = Fce(), t.key.type === N4 ? n = t.key.name : n = o(t.key.value), i = "$" + n, Object.prototype.hasOwnProperty.call(r, i) ? Fe({}, ace) : r[i] = !0, e.push(t), Ye("}") || Qt(",");
  return Qt("}"), Oce(e);
}
function Dce() {
  Qt("(");
  const e = ZA();
  return Qt(")"), e;
}
const $ce = {
  if: 1
};
function Mce() {
  var e, t, n;
  if (Ye("("))
    return Dce();
  if (Ye("["))
    return Cce();
  if (Ye("{"))
    return kce();
  if (e = Le.type, j = Le.start, e === Ls || $ce[Le.value])
    n = QA(kn().value);
  else if (e === $d || e === iu)
    Le.octal && Fe(Le, R4), n = Nc(kn());
  else {
    if (e === ja)
      throw new Error($f);
    e === Sm ? (t = kn(), t.value = t.value === "true", n = Nc(t)) : e === Cm ? (t = kn(), t.value = null, n = Nc(t)) : Ye("/") || Ye("/=") ? (n = Nc(xce()), I4()) : km(kn());
  }
  return n;
}
function Tce() {
  const e = [];
  if (Qt("("), !Ye(")"))
    for (; j < Jt && (e.push(Is()), !Ye(")")); )
      Qt(",");
  return Qt(")"), e;
}
function Nce() {
  j = Le.start;
  const e = kn();
  return wce(e) || km(e), QA(e.value);
}
function Rce() {
  return Qt("."), Nce();
}
function jce() {
  Qt("[");
  const e = ZA();
  return Qt("]"), e;
}
function Pce() {
  var e, t, n;
  for (e = Mce(); ; )
    if (Ye("."))
      n = Rce(), e = rk(".", e, n);
    else if (Ye("("))
      t = Tce(), e = Ace(e, t);
    else if (Ye("["))
      n = jce(), e = rk("[", e, n);
    else
      break;
  return e;
}
function sk() {
  const e = Pce();
  if (Le.type === On && (Ye("++") || Ye("--")))
    throw new Error($f);
  return e;
}
function Jh() {
  var e, t;
  if (Le.type !== On && Le.type !== ja)
    t = sk();
  else {
    if (Ye("++") || Ye("--"))
      throw new Error($f);
    if (Ye("+") || Ye("-") || Ye("~") || Ye("!"))
      e = kn(), t = Jh(), t = Sce(e.value, t);
    else {
      if (sy("delete") || sy("void") || sy("typeof"))
        throw new Error($f);
      t = sk();
    }
  }
  return t;
}
function uk(e) {
  let t = 0;
  if (e.type !== On && e.type !== ja)
    return 0;
  switch (e.value) {
    case "||":
      t = 1;
      break;
    case "&&":
      t = 2;
      break;
    case "|":
      t = 3;
      break;
    case "^":
      t = 4;
      break;
    case "&":
      t = 5;
      break;
    case "==":
    case "!=":
    case "===":
    case "!==":
      t = 6;
      break;
    case "<":
    case ">":
    case "<=":
    case ">=":
    case "instanceof":
    case "in":
      t = 7;
      break;
    case "<<":
    case ">>":
    case ">>>":
      t = 8;
      break;
    case "+":
    case "-":
      t = 9;
      break;
    case "*":
    case "/":
    case "%":
      t = 11;
      break;
  }
  return t;
}
function Lce() {
  var e, t, n, i, r, o, a, s, u, l;
  if (e = Le, u = Jh(), i = Le, r = uk(i), r === 0)
    return u;
  for (i.prec = r, kn(), t = [e, Le], a = Jh(), o = [u, i, a]; (r = uk(Le)) > 0; ) {
    for (; o.length > 2 && r <= o[o.length - 2].prec; )
      a = o.pop(), s = o.pop().value, u = o.pop(), t.pop(), n = ik(s, u, a), o.push(n);
    i = kn(), i.prec = r, o.push(i), t.push(Le), n = Jh(), o.push(n);
  }
  for (l = o.length - 1, n = o[l], t.pop(); l > 1; )
    t.pop(), n = ik(o[l - 1].value, o[l - 2], n), l -= 2;
  return n;
}
function Is() {
  var e, t, n;
  return e = Lce(), Ye("?") && (kn(), t = Is(), Qt(":"), n = Is(), e = _ce(e, t, n)), e;
}
function ZA() {
  const e = Is();
  if (Ye(","))
    throw new Error($f);
  return e;
}
function Ice(e) {
  V = e, j = 0, Jt = V.length, Le = null, I4();
  const t = ZA();
  if (Le.type !== Dd)
    throw new Error("Unexpect token after expression.");
  return t;
}
function kb(e) {
  const t = [];
  return e.type === "Identifier" ? [e.name] : e.type === "Literal" ? [e.value] : (e.type === "MemberExpression" && (t.push(...kb(e.object)), t.push(...kb(e.property))), t);
}
function B4(e) {
  return e.object.type === "MemberExpression" ? B4(e.object) : e.object.name === "datum";
}
function z4(e) {
  const t = Ice(e), n = /* @__PURE__ */ new Set();
  return t.visit((i) => {
    i.type === "MemberExpression" && B4(i) && n.add(kb(i).slice(1).join("."));
  }), n;
}
class Pl extends Ue {
  constructor(t, n, i) {
    super(t), this.model = n, this.filter = i, this.expr = T0(this.model, this.filter, this), this._dependentFields = z4(this.expr);
  }
  clone() {
    return new Pl(null, this.model, pe(this.filter));
  }
  dependentFields() {
    return this._dependentFields;
  }
  producedFields() {
    return /* @__PURE__ */ new Set();
  }
  assemble() {
    return {
      type: "filter",
      expr: this.expr
    };
  }
  hash() {
    return `Filter ${this.expr}`;
  }
}
var Bce = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function zce(e, t) {
  var n;
  const i = {}, r = e.config.selection;
  for (const o of B(t != null ? t : {})) {
    const a = pe(t[o]), s = r[a.type], u = Bce(s, ["fields", "encodings"]);
    for (const f in u)
      f === "encodings" && a.fields || f === "fields" && a.encodings || (f === "mark" && (a[f] = Object.assign(Object.assign({}, u[f]), a[f])), (a[f] === void 0 || a[f] === !0) && (a[f] = (n = u[f]) !== null && n !== void 0 ? n : a[f]));
    const l = Xe(o), c = i[l] = Object.assign(Object.assign({}, a), { name: l, events: ge(a.on) ? Rl(a.on, "scope") : pe(a.on) });
    Om(c, (f) => {
      f.has(c) && f.parse && f.parse(e, c, a, t[o]);
    });
  }
  return i;
}
function U4(e, t, n, i = "datum") {
  const r = [];
  function o(s) {
    const u = Xe(s), l = e.getSelectionComponent(u, s), c = _e(u + Ps);
    if (l.project.timeUnit) {
      const f = n != null ? n : e.component.data.raw, d = l.project.timeUnit.clone();
      f.parent ? d.insertAsParentOf(f) : f.parent = d;
    }
    return l.empty !== "none" && r.push(c), `vlSelectionTest(${c}, ${i}` + (l.resolve === "global" ? ")" : `, ${_e(l.resolve)})`);
  }
  const a = Ru(t, o);
  return (r.length ? "!(" + r.map((s) => `length(data(${s}))`).join(" || ") + ") || " : "") + `(${a})`;
}
function q4(e, t) {
  const n = t.encoding;
  let i = t.field;
  if (!n && !i)
    i = e.project.items[0].field, e.project.items.length > 1 && U(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${_e(i)}.`);
  else if (n && !i) {
    const r = e.project.items.filter((o) => o.channel === n);
    !r.length || r.length > 1 ? (i = e.project.items[0].field, U((r.length ? "Multiple " : "No ") + `matching ${_e(n)} encoding found for selection ${_e(t.selection)}. Using "field": ${_e(i)}.`)) : i = r[0].field;
  }
  return `${e.name}[${_e(i)}]`;
}
function Uce(e, t) {
  nu(e, (n) => {
    const i = n.name, r = e.getName(`lookup_${i}`);
    e.component.data.outputNodes[r] = n.materialized = new pn(new Pl(t, e, { selection: i }), r, We.Lookup, e.component.data.outputNodeRefCounts);
  });
}
function T0(e, t, n) {
  return Ru(t, (i) => ge(i) ? i : Hoe(i) ? U4(e, i.selection, n) : QR(i));
}
var hh = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function qce(e, t) {
  if (!!e)
    return K(e) && !Po(e) ? e.map((n) => $A(n, t)).join(", ") : e;
}
function uy(e, t, n, i) {
  var r, o, a;
  e.encode = (r = e.encode) !== null && r !== void 0 ? r : {}, e.encode[t] = (o = e.encode[t]) !== null && o !== void 0 ? o : {}, e.encode[t].update = (a = e.encode[t].update) !== null && a !== void 0 ? a : {}, e.encode[t].update[n] = i;
}
function Rc(e, t, n, i = { header: !1 }) {
  var r, o;
  const a = e.combine(), { disable: s, orient: u, scale: l, labelExpr: c, title: f, zindex: d } = a, h = hh(a, ["disable", "orient", "scale", "labelExpr", "title", "zindex"]);
  if (!s) {
    for (const g in h) {
      const p = Zie[g], m = h[g];
      if (p && p !== t && p !== "both")
        delete h[g];
      else if (vd(m)) {
        const { condition: y } = m, v = hh(m, ["condition"]), b = lt(y), x = gF[g];
        if (x) {
          const { vgProp: E, part: A } = x, w = [
            ...b.map((_) => {
              const { test: k } = _, C = hh(_, ["test"]);
              return Object.assign({ test: T0(null, k) }, C);
            }),
            v
          ];
          uy(h, A, E, w), delete h[g];
        } else if (x === null) {
          const E = {
            signal: b.map((A) => {
              const { test: w } = A, _ = hh(A, ["test"]);
              return `${T0(null, w)} ? ${TF(_)} : `;
            }).join("") + TF(v)
          };
          h[g] = E;
        }
      } else if (se(m)) {
        const y = gF[g];
        if (y) {
          const { vgProp: v, part: b } = y;
          uy(h, b, v, m), delete h[g];
        }
      }
    }
    if (t === "grid") {
      if (!h.grid)
        return;
      if (h.encode) {
        const { grid: g } = h.encode;
        h.encode = Object.assign({}, g ? { grid: g } : {}), Ie(h.encode) && delete h.encode;
      }
      return Object.assign(Object.assign({
        scale: l,
        orient: u
      }, h), {
        domain: !1,
        labels: !1,
        aria: !1,
        maxExtent: 0,
        minExtent: 0,
        ticks: !1,
        zindex: ct(d, 0)
      });
    } else {
      if (!i.header && e.mainExtracted)
        return;
      if (c !== void 0) {
        let p = c;
        ((o = (r = h.encode) === null || r === void 0 ? void 0 : r.labels) === null || o === void 0 ? void 0 : o.update) && se(h.encode.labels.update.text) && (p = Ms(c, "datum.label", h.encode.labels.update.text.signal)), uy(h, "labels", "text", { signal: p });
      }
      if (h.labelAlign === null && delete h.labelAlign, h.encode) {
        for (const p of OR)
          e.hasAxisPart(p) || delete h.encode[p];
        Ie(h.encode) && delete h.encode;
      }
      const g = qce(f, n);
      return Object.assign(Object.assign(Object.assign(Object.assign({
        scale: l,
        orient: u,
        grid: !1
      }, g ? { title: g } : {}), h), n.aria === !1 ? { aria: !1 } : {}), {
        zindex: ct(d, 0)
      });
    }
  }
}
function W4(e) {
  const { axes: t } = e.component, n = [];
  for (const i of pi)
    if (t[i]) {
      for (const r of t[i])
        if (!r.get("disable") && !r.get("gridScale")) {
          const o = i === "x" ? "height" : "width", a = e.getSizeSignalRef(o).signal;
          o !== a && n.push({
            name: o,
            update: a
          });
        }
    }
  return n;
}
function Wce(e, t) {
  const { x: n = [], y: i = [] } = e;
  return [
    ...n.map((r) => Rc(r, "grid", t)),
    ...i.map((r) => Rc(r, "grid", t)),
    ...n.map((r) => Rc(r, "main", t)),
    ...i.map((r) => Rc(r, "main", t))
  ].filter((r) => r);
}
function lk(e, t, n, i) {
  return Object.assign.apply(null, [
    {},
    ...e.map((r) => {
      if (r === "axisOrient") {
        const o = n === "x" ? "bottom" : "left", a = t[n === "x" ? "axisBottom" : "axisLeft"] || {}, s = t[n === "x" ? "axisTop" : "axisRight"] || {}, u = /* @__PURE__ */ new Set([...B(a), ...B(s)]), l = {};
        for (const c of u.values())
          l[c] = {
            signal: `${i.signal} === "${o}" ? ${uo(a[c])} : ${uo(s[c])}`
          };
        return l;
      }
      return t[r];
    })
  ]);
}
function Gce(e, t, n, i) {
  const r = t === "band" ? ["axisDiscrete", "axisBand"] : t === "point" ? ["axisDiscrete", "axisPoint"] : iae(t) ? ["axisQuantitative"] : t === "time" || t === "utc" ? ["axisTemporal"] : [], o = e === "x" ? "axisX" : "axisY", a = se(n) ? "axisOrient" : "axis" + yd(n), s = [
    ...r,
    ...r.map((l) => o + l.substr(4))
  ], u = ["axis", a, o];
  return {
    vlOnlyAxisConfig: lk(s, i, e, n),
    vgAxisConfig: lk(u, i, e, n),
    axisConfigStyle: Hce([...u, ...s], i)
  };
}
function Hce(e, t) {
  var n;
  const i = [{}];
  for (const r of e) {
    let o = (n = t[r]) === null || n === void 0 ? void 0 : n.style;
    if (o) {
      o = lt(o);
      for (const a of o)
        i.push(t.style[a]);
    }
  }
  return Object.assign.apply(null, i);
}
function Db(e, t, n, i = {}) {
  var r;
  const o = D8(e, n, t);
  if (o !== void 0)
    return {
      configFrom: "style",
      configValue: o
    };
  for (const a of ["vlOnlyAxisConfig", "vgAxisConfig", "axisConfigStyle"])
    if (((r = i[a]) === null || r === void 0 ? void 0 : r[e]) !== void 0)
      return { configFrom: a, configValue: i[a][e] };
  return {};
}
const ck = {
  scale: ({ model: e, channel: t }) => e.scaleName(t),
  format: ({ fieldOrDatumDef: e, config: t, axis: n }) => {
    const { format: i, formatType: r } = n;
    return d8(e, e.type, i, r, t, !0);
  },
  formatType: ({ axis: e, fieldOrDatumDef: t, scaleType: n }) => {
    const { formatType: i } = e;
    return h8(i, t, n);
  },
  grid: ({ fieldOrDatumDef: e, axis: t, scaleType: n }) => {
    var i;
    return G(e) && cn(e.bin) ? !1 : (i = t.grid) !== null && i !== void 0 ? i : Yce(n, e);
  },
  gridScale: ({ model: e, channel: t }) => Xce(e, t),
  labelAlign: ({ axis: e, labelAngle: t, orient: n, channel: i }) => e.labelAlign || H4(t, n, i),
  labelAngle: ({ labelAngle: e }) => e,
  labelBaseline: ({ axis: e, labelAngle: t, orient: n, channel: i }) => e.labelBaseline || G4(t, n, i),
  labelFlush: ({ axis: e, fieldOrDatumDef: t, channel: n }) => {
    var i;
    return (i = e.labelFlush) !== null && i !== void 0 ? i : Kce(t.type, n);
  },
  labelOverlap: ({ axis: e, fieldOrDatumDef: t, scaleType: n }) => {
    var i;
    return (i = e.labelOverlap) !== null && i !== void 0 ? i : Jce(t.type, n, G(t) && !!t.timeUnit, G(t) ? t.sort : void 0);
  },
  orient: ({ orient: e }) => e,
  tickCount: ({ channel: e, model: t, axis: n, fieldOrDatumDef: i, scaleType: r }) => {
    var o;
    const a = e === "x" ? "width" : e === "y" ? "height" : void 0, s = a ? t.getSizeSignalRef(a) : void 0;
    return (o = n.tickCount) !== null && o !== void 0 ? o : Zce({ fieldOrDatumDef: i, scaleType: r, size: s, values: n.values });
  },
  title: ({ axis: e, model: t, channel: n }) => {
    if (e.title !== void 0)
      return e.title;
    const i = Y4(t, n);
    if (i !== void 0)
      return i;
    const r = t.typedFieldDef(n), o = n === "x" ? "x2" : "y2", a = t.fieldDef(o);
    return M8(r ? [$F(r)] : [], G(a) ? [$F(a)] : []);
  },
  values: ({ axis: e, fieldOrDatumDef: t }) => efe(e, t),
  zindex: ({ axis: e, fieldOrDatumDef: t, mark: n }) => {
    var i;
    return (i = e.zindex) !== null && i !== void 0 ? i : tfe(n, t);
  }
};
function Yce(e, t) {
  return !Ln(e) && G(t) && !Ve(t == null ? void 0 : t.bin);
}
function Xce(e, t) {
  const n = t === "x" ? "y" : "x";
  if (e.getScaleComponent(n))
    return e.scaleName(n);
}
function Vce(e, t, n, i, r) {
  const o = t == null ? void 0 : t.labelAngle;
  if (o !== void 0)
    return se(o) ? o : Sf(o);
  {
    const { configValue: a } = Db("labelAngle", i, t == null ? void 0 : t.style, r);
    return a !== void 0 ? Sf(a) : n === et && ie([yA, mA], e.type) && !(G(e) && e.timeUnit) ? 270 : void 0;
  }
}
function $b(e) {
  return `(((${e.signal} % 360) + 360) % 360)`;
}
function G4(e, t, n, i) {
  if (e !== void 0)
    if (n === "x") {
      if (se(e)) {
        const r = $b(e), o = se(t) ? `(${t.signal} === "top")` : t === "top";
        return {
          signal: `(45 < ${r} && ${r} < 135) || (225 < ${r} && ${r} < 315) ? "middle" :(${r} <= 45 || 315 <= ${r}) === ${o} ? "bottom" : "top"`
        };
      }
      if (45 < e && e < 135 || 225 < e && e < 315)
        return "middle";
      if (se(t)) {
        const r = e <= 45 || 315 <= e ? "===" : "!==";
        return { signal: `${t.signal} ${r} "top" ? "bottom" : "top"` };
      }
      return (e <= 45 || 315 <= e) == (t === "top") ? "bottom" : "top";
    } else {
      if (se(e)) {
        const r = $b(e), o = se(t) ? `(${t.signal} === "left")` : t === "left";
        return {
          signal: `${r} <= 45 || 315 <= ${r} || (135 <= ${r} && ${r} <= 225) ? ${i ? '"middle"' : "null"} : (45 <= ${r} && ${r} <= 135) === ${o} ? "top" : "bottom"`
        };
      }
      if (e <= 45 || 315 <= e || 135 <= e && e <= 225)
        return i ? "middle" : null;
      if (se(t)) {
        const r = 45 <= e && e <= 135 ? "===" : "!==";
        return { signal: `${t.signal} ${r} "left" ? "top" : "bottom"` };
      }
      return (45 <= e && e <= 135) == (t === "left") ? "top" : "bottom";
    }
}
function H4(e, t, n) {
  if (e === void 0)
    return;
  const i = n === "x", r = i ? 0 : 90, o = i ? "bottom" : "left";
  if (se(e)) {
    const a = $b(e), s = se(t) ? `(${t.signal} === "${o}")` : t === o;
    return {
      signal: `(${r ? "(" + a + " + 90)" : a} % 180 === 0) ? ${i ? null : '"center"'} :(${r} < ${a} && ${a} < ${180 + r}) === ${s} ? "left" : "right"`
    };
  }
  if ((e + r) % 180 === 0)
    return i ? null : "center";
  if (se(t)) {
    const a = r < e && e < 180 + r ? "===" : "!==";
    return {
      signal: `${`${t.signal} ${a} "${o}"`} ? "left" : "right"`
    };
  }
  return (r < e && e < 180 + r) == (t === o) ? "left" : "right";
}
function Kce(e, t) {
  if (t === "x" && ie(["quantitative", "temporal"], e))
    return !0;
}
function Jce(e, t, n, i) {
  if (n && !ut(i) || e !== "nominal" && e !== "ordinal")
    return t === "log" || t === "symlog" ? "greedy" : !0;
}
function Qce(e) {
  return e === "x" ? "bottom" : "left";
}
function Zce({ fieldOrDatumDef: e, scaleType: t, size: n, values: i }) {
  var r;
  if (!i && !Ln(t) && t !== "log") {
    if (G(e)) {
      if (Ve(e.bin))
        return { signal: `ceil(${n.signal}/10)` };
      if (e.timeUnit && ie(["month", "hours", "day", "quarter"], (r = bn(e.timeUnit)) === null || r === void 0 ? void 0 : r.unit))
        return;
    }
    return { signal: `ceil(${n.signal}/40)` };
  }
}
function Y4(e, t) {
  const n = t === "x" ? "x2" : "y2", i = e.fieldDef(t), r = e.fieldDef(n), o = i ? i.title : void 0, a = r ? r.title : void 0;
  if (o && a)
    return T8(o, a);
  if (o)
    return o;
  if (a)
    return a;
  if (o !== void 0)
    return o;
  if (a !== void 0)
    return a;
}
function efe(e, t) {
  const n = e.values;
  if (K(n))
    return S8(t, n);
  if (se(n))
    return n;
}
function tfe(e, t) {
  return e === "rect" && x8(t) ? 1 : 0;
}
class gl extends Ue {
  constructor(t, n) {
    super(t), this.transform = n, this._dependentFields = z4(this.transform.calculate);
  }
  clone() {
    return new gl(null, pe(this.transform));
  }
  static parseAllForSortIndex(t, n) {
    return n.forEachFieldDef((i, r) => {
      if (!!mm(i) && y8(i.sort)) {
        const { field: o, timeUnit: a } = i, s = i.sort, u = s.map((l, c) => `${QR({ field: o, timeUnit: a, equal: l })} ? ${c} : `).join("") + s.length;
        t = new gl(t, {
          calculate: u,
          as: pl(i, r, { forAs: !0 })
        });
      }
    }), t;
  }
  producedFields() {
    return /* @__PURE__ */ new Set([this.transform.as]);
  }
  dependentFields() {
    return this._dependentFields;
  }
  assemble() {
    return {
      type: "formula",
      expr: this.transform.calculate,
      as: this.transform.as
    };
  }
  hash() {
    return `Calculate ${we(this.transform)}`;
  }
}
function pl(e, t, n) {
  return W(e, Object.assign({ prefix: t, suffix: "sort_index" }, n != null ? n : {}));
}
function Dm(e, t) {
  return ie(["top", "bottom"], t) ? "column" : ie(["left", "right"], t) || e === "row" ? "row" : "column";
}
function ml(e, t, n, i) {
  const r = i === "row" ? n.headerRow : i === "column" ? n.headerColumn : n.headerFacet;
  return ct((t || {})[e], r[e], n.header[e]);
}
function $m(e, t, n, i) {
  const r = {};
  for (const o of e) {
    const a = ml(o, t || {}, n, i);
    a !== void 0 && (r[o] = a);
  }
  return r;
}
const e_ = ["row", "column"], t_ = ["header", "footer"];
function nfe(e, t) {
  const n = e.component.layoutHeaders[t].title, i = e.config ? e.config : void 0, r = e.component.layoutHeaders[t].facetFieldDef ? e.component.layoutHeaders[t].facetFieldDef : void 0, { titleAnchor: o, titleAngle: a, titleOrient: s } = $m(["titleAnchor", "titleAngle", "titleOrient"], r.header, i, t), u = Dm(t, s), l = Sf(a);
  return {
    name: `${t}-title`,
    type: "group",
    role: `${u}-title`,
    title: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ text: n }, t === "row" ? { orient: "left" } : {}), { style: "guide-title" }), V4(l, u)), X4(u, l, o)), K4(i, r, t, xse, X8))
  };
}
function X4(e, t, n = "middle") {
  switch (n) {
    case "start":
      return { align: "left" };
    case "end":
      return { align: "right" };
  }
  const i = H4(t, e === "row" ? "left" : "top", e === "row" ? "y" : "x");
  return i ? { align: i } : {};
}
function V4(e, t) {
  const n = G4(e, t === "row" ? "left" : "top", t === "row" ? "y" : "x", !0);
  return n ? { baseline: n } : {};
}
function ife(e, t) {
  const n = e.component.layoutHeaders[t], i = [];
  for (const r of t_)
    if (n[r])
      for (const o of n[r]) {
        const a = ofe(e, t, r, n, o);
        a != null && i.push(a);
      }
  return i;
}
function rfe(e, t) {
  var n;
  const { sort: i } = e;
  return pr(i) ? {
    field: W(i, { expr: "datum" }),
    order: (n = i.order) !== null && n !== void 0 ? n : "ascending"
  } : K(i) ? {
    field: pl(e, t, { expr: "datum" }),
    order: "ascending"
  } : {
    field: W(e, { expr: "datum" }),
    order: i != null ? i : "ascending"
  };
}
function Mb(e, t, n) {
  const { format: i, formatType: r, labelAngle: o, labelAnchor: a, labelOrient: s, labelExpr: u } = $m(["format", "formatType", "labelAngle", "labelAnchor", "labelOrient", "labelExpr"], e.header, n, t), l = AA({ fieldOrDatumDef: e, format: i, formatType: r, expr: "parent", config: n }).signal, c = Dm(t, s);
  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ text: {
    signal: u ? Ms(Ms(u, "datum.label", l), "datum.value", W(e, { expr: "parent" })) : l
  } }, t === "row" ? { orient: "left" } : {}), { style: "guide-label", frame: "group" }), V4(o, c)), X4(c, o, a)), K4(n, e, t, wse, V8));
}
function ofe(e, t, n, i, r) {
  if (r) {
    let o = null;
    const { facetFieldDef: a } = i, s = e.config ? e.config : void 0;
    if (a && r.labels) {
      const { labelOrient: f } = $m(["labelOrient"], a.header, s, t);
      (t === "row" && !ie(["top", "bottom"], f) || t === "column" && !ie(["left", "right"], f)) && (o = Mb(a, t, s));
    }
    const u = Bi(e) && !Sd(e.facet), l = r.axes, c = (l == null ? void 0 : l.length) > 0;
    if (o || c) {
      const f = t === "row" ? "height" : "width";
      return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name: e.getName(`${t}_${n}`), type: "group", role: `${t}-${n}` }, i.facetFieldDef ? {
        from: { data: e.getName(t + "_domain") },
        sort: rfe(a, t)
      } : {}), c && u ? {
        from: { data: e.getName(`facet_domain_${t}`) }
      } : {}), o ? { title: o } : {}), r.sizeSignal ? {
        encode: {
          update: {
            [f]: r.sizeSignal
          }
        }
      } : {}), c ? { axes: l } : {});
    }
  }
  return null;
}
const afe = {
  column: {
    start: 0,
    end: 1
  },
  row: {
    start: 1,
    end: 0
  }
};
function sfe(e, t) {
  return afe[t][e];
}
function ufe(e, t) {
  const n = {};
  for (const i of si) {
    const r = e[i];
    if (r != null && r.facetFieldDef) {
      const { titleAnchor: o, titleOrient: a } = $m(["titleAnchor", "titleOrient"], r.facetFieldDef.header, t, i), s = Dm(i, a), u = sfe(o, s);
      u !== void 0 && (n[s] = u);
    }
  }
  return Ie(n) ? void 0 : n;
}
function K4(e, t, n, i, r) {
  const o = {};
  for (const a of i) {
    if (!r[a])
      continue;
    const s = ml(a, t == null ? void 0 : t.header, e, n);
    s !== void 0 && (o[r[a]] = s);
  }
  return o;
}
function n_(e) {
  return [
    ...gh(e, "width"),
    ...gh(e, "height"),
    ...gh(e, "childWidth"),
    ...gh(e, "childHeight")
  ];
}
function gh(e, t) {
  const n = t === "width" ? "x" : "y", i = e.component.layoutSize.get(t);
  if (!i || i === "merged")
    return [];
  const r = e.getSizeSignalRef(t).signal;
  if (i === "step") {
    const o = e.getScaleComponent(n);
    if (o) {
      const a = o.get("type"), s = o.get("range");
      if (Ln(a) && Ta(s)) {
        const u = e.scaleName(n);
        return Bi(e.parent) && e.parent.component.resolve.scale[n] === "independent" ? [fk(u, s)] : [
          fk(u, s),
          {
            name: r,
            update: J4(u, o, `domain('${u}').length`)
          }
        ];
      }
    }
    throw new Error("layout size is step although width/height is not step.");
  } else if (i == "container") {
    const o = r.endsWith("width"), a = o ? "containerSize()[0]" : "containerSize()[1]", s = wb(e.config.view, o ? "width" : "height"), u = `isFinite(${a}) ? ${a} : ${s}`;
    return [{ name: r, init: u, on: [{ update: u, events: "window:resize" }] }];
  } else
    return [
      {
        name: r,
        value: i
      }
    ];
}
function fk(e, t) {
  return {
    name: e + "_step",
    value: t.step
  };
}
function J4(e, t, n) {
  const i = t.get("type"), r = t.get("padding"), o = ct(t.get("paddingOuter"), r);
  let a = t.get("paddingInner");
  return a = i === "band" ? a !== void 0 ? a : r : 1, `bandspace(${n}, ${uo(a)}, ${uo(o)}) * ${e}_step`;
}
function Q4(e) {
  return e === "childWidth" ? "width" : e === "childHeight" ? "height" : e;
}
function Z4(e, t) {
  return B(e).reduce((n, i) => {
    const r = e[i];
    return Object.assign(Object.assign({}, n), jl(t, r, i, (o) => Ze(o.value)));
  }, {});
}
function lfe(e, t) {
  if (Bl(t) || Bi(t))
    return "shared";
  if (l_(t))
    return Er(e) ? "independent" : "shared";
  throw new Error("invalid model type for resolve");
}
function i_(e, t) {
  const n = e.scale[t], i = Er(t) ? "axis" : "legend";
  return n === "independent" ? (e[i][t] === "shared" && U(coe(t)), "independent") : e[i][t] || "shared";
}
const cfe = Object.assign(Object.assign({}, _se), {
  disable: 1,
  labelExpr: 1,
  selections: 1,
  opacity: 1,
  shape: 1,
  stroke: 1,
  fill: 1,
  size: 1,
  strokeWidth: 1,
  strokeDash: 1,
  encode: 1
}), ej = B(cfe);
class ffe extends Oo {
}
const dk = {
  symbols: dfe,
  gradient: hfe,
  labels: gfe,
  entries: pfe
};
function dfe(e, { fieldOrDatumDef: t, model: n, channel: i, legendCmpt: r, legendType: o }) {
  var a, s, u, l, c, f, d, h;
  if (o !== "symbol")
    return;
  const { markDef: g, encoding: p, config: m, mark: y } = n, v = g.filled && y !== "trail";
  let b = Object.assign(Object.assign({}, Zae({}, n, Aae)), b4(n, { filled: v }));
  const x = (a = r.get("symbolOpacity")) !== null && a !== void 0 ? a : m.legend.symbolOpacity, E = (s = r.get("symbolFillColor")) !== null && s !== void 0 ? s : m.legend.symbolFillColor, A = (u = r.get("symbolStrokeColor")) !== null && u !== void 0 ? u : m.legend.symbolStrokeColor, w = x === void 0 ? (l = tj(p.opacity)) !== null && l !== void 0 ? l : g.opacity : void 0;
  if (b.fill) {
    if (i === "fill" || v && i === jn)
      delete b.fill;
    else if (b.fill.field)
      E ? delete b.fill : (b.fill = Ze((c = m.legend.symbolBaseFillColor) !== null && c !== void 0 ? c : "black"), b.fillOpacity = Ze(w != null ? w : 1));
    else if (K(b.fill)) {
      const _ = (h = (d = Tb((f = p.fill) !== null && f !== void 0 ? f : p.color)) !== null && d !== void 0 ? d : g.fill) !== null && h !== void 0 ? h : v && g.color;
      _ && (b.fill = Ze(_));
    }
  }
  if (b.stroke) {
    if (i === "stroke" || !v && i === jn)
      delete b.stroke;
    else if (b.stroke.field || A)
      delete b.stroke;
    else if (K(b.stroke)) {
      const _ = ct(Tb(p.stroke || p.color), g.stroke, v ? g.color : void 0);
      _ && (b.stroke = { value: _ });
    }
  }
  if (i !== Ao) {
    const _ = G(t) && ij(n, r, t);
    _ ? b.opacity = [
      Object.assign({ test: _ }, Ze(w != null ? w : 1)),
      Ze(m.legend.unselectedOpacity)
    ] : w && (b.opacity = Ze(w));
  }
  return b = Object.assign(Object.assign({}, b), e), Ie(b) ? void 0 : b;
}
function hfe(e, { model: t, legendType: n, legendCmpt: i }) {
  var r;
  if (n !== "gradient")
    return;
  const { config: o, markDef: a, encoding: s } = t;
  let u = {};
  const c = ((r = i.get("gradientOpacity")) !== null && r !== void 0 ? r : o.legend.gradientOpacity) === void 0 ? tj(s.opacity) || a.opacity : void 0;
  return c && (u.opacity = Ze(c)), u = Object.assign(Object.assign({}, u), e), Ie(u) ? void 0 : u;
}
function gfe(e, { fieldOrDatumDef: t, model: n, channel: i, legendCmpt: r }) {
  const o = n.legend(i) || {}, a = n.config, s = G(t) ? ij(n, r, t) : void 0, u = s ? [{ test: s, value: 1 }, { value: a.legend.unselectedOpacity }] : void 0, { format: l, formatType: c } = o, f = Rs(c) ? _A({
    fieldOrDatumDef: t,
    field: "datum.value",
    format: l,
    formatType: c,
    config: a
  }) : void 0, d = Object.assign(Object.assign(Object.assign({}, u ? { opacity: u } : {}), f ? { text: f } : {}), e);
  return Ie(d) ? void 0 : d;
}
function pfe(e, { legendCmpt: t }) {
  const n = t.get("selections");
  return n != null && n.length ? Object.assign(Object.assign({}, e), { fill: { value: "transparent" } }) : e;
}
function tj(e) {
  return nj(e, (t, n) => Math.max(t, n.value));
}
function Tb(e) {
  return nj(e, (t, n) => ct(t, n.value));
}
function nj(e, t) {
  if (zae(e))
    return lt(e.condition).reduce(t, e.value);
  if (Wi(e))
    return e.value;
}
function ij(e, t, n) {
  const i = t.get("selections");
  if (!(i != null && i.length))
    return;
  const r = _e(n.field);
  return i.map((o) => `(!length(data(${_e(Xe(o) + Ps)})) || (${o}[${r}] && indexof(${o}[${r}], datum.value) >= 0))`).join(" || ");
}
const hk = {
  direction: ({ direction: e }) => e,
  format: ({ fieldOrDatumDef: e, legend: t, config: n }) => {
    const { format: i, formatType: r } = t;
    return d8(e, e.type, i, r, n, !1);
  },
  formatType: ({ legend: e, fieldOrDatumDef: t, scaleType: n }) => {
    const { formatType: i } = e;
    return h8(i, t, n);
  },
  gradientLength: (e) => {
    var t, n;
    const { legend: i, legendConfig: r } = e;
    return (n = (t = i.gradientLength) !== null && t !== void 0 ? t : r.gradientLength) !== null && n !== void 0 ? n : Efe(e);
  },
  labelOverlap: ({ legend: e, legendConfig: t, scaleType: n }) => {
    var i, r;
    return (r = (i = e.labelOverlap) !== null && i !== void 0 ? i : t.labelOverlap) !== null && r !== void 0 ? r : Afe(n);
  },
  symbolType: ({ legend: e, markDef: t, channel: n, encoding: i }) => {
    var r;
    return (r = e.symbolType) !== null && r !== void 0 ? r : yfe(t.type, n, i.shape, t.shape);
  },
  title: ({ fieldOrDatumDef: e, config: t }) => Pu(e, t, { allowDisabling: !0 }),
  type: ({ legendType: e, scaleType: t, channel: n }) => {
    if (ju(n) && ji(t)) {
      if (e === "gradient")
        return;
    } else if (e === "symbol")
      return;
    return e;
  },
  values: ({ fieldOrDatumDef: e, legend: t }) => mfe(t, e)
};
function mfe(e, t) {
  const n = e.values;
  if (K(n))
    return S8(t, n);
  if (se(n))
    return n;
}
function yfe(e, t, n, i) {
  var r;
  if (t !== "shape") {
    const o = (r = Tb(n)) !== null && r !== void 0 ? r : i;
    if (o)
      return o;
  }
  switch (e) {
    case "bar":
    case "rect":
    case "image":
    case "square":
      return "square";
    case "line":
    case "trail":
    case "rule":
      return "stroke";
    case "arc":
    case "point":
    case "circle":
    case "tick":
    case "geoshape":
    case "area":
    case "text":
      return "circle";
  }
}
function vfe(e) {
  const { legend: t } = e;
  return ct(t.type, bfe(e));
}
function bfe({ channel: e, timeUnit: t, scaleType: n }) {
  if (ju(e)) {
    if (ie(["quarter", "month", "day"], t))
      return "symbol";
    if (ji(n))
      return "gradient";
  }
  return "symbol";
}
function xfe({ legendConfig: e, legendType: t, orient: n, legend: i }) {
  var r, o;
  return (o = (r = i.direction) !== null && r !== void 0 ? r : e[t ? "gradientDirection" : "symbolDirection"]) !== null && o !== void 0 ? o : wfe(n, t);
}
function wfe(e, t) {
  switch (e) {
    case "top":
    case "bottom":
      return "horizontal";
    case "left":
    case "right":
    case "none":
    case void 0:
      return;
    default:
      return t === "gradient" ? "horizontal" : void 0;
  }
}
function Efe({ legendConfig: e, model: t, direction: n, orient: i, scaleType: r }) {
  const { gradientHorizontalMaxLength: o, gradientHorizontalMinLength: a, gradientVerticalMaxLength: s, gradientVerticalMinLength: u } = e;
  if (ji(r))
    return n === "horizontal" ? i === "top" || i === "bottom" ? gk(t, "width", a, o) : a : gk(t, "height", u, s);
}
function gk(e, t, n, i) {
  return { signal: `clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})` };
}
function Afe(e) {
  if (ie(["quantile", "threshold", "log", "symlog"], e))
    return "greedy";
}
function rj(e) {
  const t = it(e) ? _fe(e) : Ffe(e);
  return e.component.legends = t, t;
}
function _fe(e) {
  const { encoding: t } = e, n = {};
  for (const i of [jn, ...J8]) {
    const r = vt(t[i]);
    !r || !e.getScaleComponent(i) || i === Pn && G(r) && r.type === Nl || (n[i] = Cfe(e, i));
  }
  return n;
}
function Ofe(e, t) {
  const n = e.scaleName(t);
  if (e.mark === "trail") {
    if (t === "color")
      return { stroke: n };
    if (t === "size")
      return { strokeWidth: n };
  }
  return t === "color" ? e.markDef.filled ? { fill: n } : { stroke: n } : { [t]: n };
}
function Sfe(e, t, n, i) {
  switch (t) {
    case "disable":
      return n !== void 0;
    case "values":
      return !!(n != null && n.values);
    case "title":
      if (t === "title" && e === (i == null ? void 0 : i.title))
        return !0;
  }
  return e === (n || {})[t];
}
function Cfe(e, t) {
  var n, i, r;
  let o = e.legend(t);
  const { markDef: a, encoding: s, config: u } = e, l = u.legend, c = new ffe({}, Ofe(e, t));
  dle(e, t, c);
  const f = o !== void 0 ? !o : l.disable;
  if (c.set("disable", f, o !== void 0), f)
    return c;
  o = o || {};
  const d = e.getScaleComponent(t).get("type"), h = vt(s[t]), g = G(h) ? (n = bn(h.timeUnit)) === null || n === void 0 ? void 0 : n.unit : void 0, p = o.orient || u.legend.orient || "right", m = vfe({ legend: o, channel: t, timeUnit: g, scaleType: d }), y = xfe({ legend: o, legendType: m, orient: p, legendConfig: l }), v = {
    legend: o,
    channel: t,
    model: e,
    markDef: a,
    encoding: s,
    fieldOrDatumDef: h,
    legendConfig: l,
    config: u,
    scaleType: d,
    orient: p,
    legendType: m,
    direction: y
  };
  for (const w of ej) {
    if (m === "gradient" && w.startsWith("symbol") || m === "symbol" && w.startsWith("gradient"))
      continue;
    const _ = w in hk ? hk[w](v) : o[w];
    if (_ !== void 0) {
      const k = Sfe(_, w, o, e.fieldDef(t));
      (k || u.legend[w] === void 0) && c.set(w, _, k);
    }
  }
  const b = (i = o == null ? void 0 : o.encoding) !== null && i !== void 0 ? i : {}, x = c.get("selections"), E = {}, A = { fieldOrDatumDef: h, model: e, channel: t, legendCmpt: c, legendType: m };
  for (const w of ["labels", "legend", "title", "symbols", "gradient", "entries"]) {
    const _ = Z4((r = b[w]) !== null && r !== void 0 ? r : {}, e), k = w in dk ? dk[w](_, A) : _;
    k !== void 0 && !Ie(k) && (E[w] = Object.assign(Object.assign(Object.assign({}, (x == null ? void 0 : x.length) && G(h) ? { name: `${Xe(h.field)}_legend_${w}` } : {}), x != null && x.length ? { interactive: !!x } : {}), { update: k }));
  }
  return Ie(E) || c.set("encode", E, !!(o != null && o.encoding)), c;
}
function Ffe(e) {
  const { legends: t, resolve: n } = e.component;
  for (const i of e.children) {
    rj(i);
    for (const r of B(i.component.legends))
      n.legend[r] = i_(e.component.resolve, r), n.legend[r] === "shared" && (t[r] = oj(t[r], i.component.legends[r]), t[r] || (n.legend[r] = "independent", delete t[r]));
  }
  for (const i of B(t))
    for (const r of e.children)
      !r.component.legends[i] || n.legend[i] === "shared" && delete r.component.legends[i];
  return t;
}
function oj(e, t) {
  var n, i, r, o;
  if (!e)
    return t.clone();
  const a = e.getWithExplicit("orient"), s = t.getWithExplicit("orient");
  if (a.explicit && s.explicit && a.value !== s.value)
    return;
  let u = !1;
  for (const l of ej) {
    const c = ma(
      e.getWithExplicit(l),
      t.getWithExplicit(l),
      l,
      "legend",
      (f, d) => {
        switch (l) {
          case "symbolType":
            return kfe(f, d);
          case "title":
            return N8(f, d);
          case "type":
            return u = !0, Un("symbol");
        }
        return Am(f, d, l, "legend");
      }
    );
    e.setWithExplicit(l, c);
  }
  return u && (!((i = (n = e.implicit) === null || n === void 0 ? void 0 : n.encode) === null || i === void 0) && i.gradient && y0(e.implicit, ["encode", "gradient"]), !((o = (r = e.explicit) === null || r === void 0 ? void 0 : r.encode) === null || o === void 0) && o.gradient && y0(e.explicit, ["encode", "gradient"])), e;
}
function kfe(e, t) {
  return t.value === "circle" ? t : e;
}
var Dfe = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function $fe(e, t, n, i) {
  var r, o, a;
  e.encode = (r = e.encode) !== null && r !== void 0 ? r : {}, e.encode[t] = (o = e.encode[t]) !== null && o !== void 0 ? o : {}, e.encode[t].update = (a = e.encode[t].update) !== null && a !== void 0 ? a : {}, e.encode[t].update[n] = i;
}
function aj(e) {
  const t = e.component.legends, n = {};
  for (const r of B(t)) {
    const o = e.getScaleComponent(r), a = Ge(o.get("domains"));
    if (n[a])
      for (const s of n[a])
        oj(s, t[r]) || n[a].push(t[r]);
    else
      n[a] = [t[r].clone()];
  }
  return oo(n).flat().map((r) => Mfe(r, e.config)).filter((r) => r !== void 0);
}
function Mfe(e, t) {
  var n, i, r;
  const o = e.combine(), { disable: a, labelExpr: s, selections: u } = o, l = Dfe(o, ["disable", "labelExpr", "selections"]);
  if (!a) {
    if (t.aria === !1 && l.aria == null && (l.aria = !1), !((n = l.encode) === null || n === void 0) && n.symbols) {
      const c = l.encode.symbols.update;
      c.fill && c.fill.value !== "transparent" && !c.stroke && !l.stroke && (c.stroke = { value: "transparent" });
      for (const f of J8)
        l[f] && delete c[f];
    }
    if (l.title || delete l.title, s !== void 0) {
      let c = s;
      ((r = (i = l.encode) === null || i === void 0 ? void 0 : i.labels) === null || r === void 0 ? void 0 : r.update) && se(l.encode.labels.update.text) && (c = Ms(s, "datum.label", l.encode.labels.update.text.signal)), $fe(l, "labels", "text", { signal: c });
    }
    return l;
  }
}
function Tfe(e) {
  return Bl(e) || l_(e) ? Nfe(e) : sj(e);
}
function Nfe(e) {
  return e.children.reduce((t, n) => t.concat(n.assembleProjections()), sj(e));
}
function sj(e) {
  const t = e.component.projection;
  if (!t || t.merged)
    return [];
  const n = t.combine(), { name: i } = n;
  if (t.data) {
    const r = {
      signal: `[${t.size.map((a) => a.signal).join(", ")}]`
    }, o = t.data.reduce((a, s) => {
      const u = se(s) ? s.signal : `data('${e.lookupDataSource(s)}')`;
      return ie(a, u) || a.push(u), a;
    }, []);
    if (o.length <= 0)
      throw new Error("Projection's fit didn't find any data sources");
    return [
      Object.assign({
        name: i,
        size: r,
        fit: {
          signal: o.length > 1 ? `[${o.join(", ")}]` : o[0]
        }
      }, n)
    ];
  } else
    return [
      Object.assign(Object.assign({ name: i }, { translate: { signal: "[width / 2, height / 2]" } }), n)
    ];
}
const Rfe = [
  "type",
  "clipAngle",
  "clipExtent",
  "center",
  "rotate",
  "precision",
  "reflectX",
  "reflectY",
  "coefficient",
  "distance",
  "fraction",
  "lobes",
  "parallel",
  "radius",
  "ratio",
  "spacing",
  "tilt"
];
class uj extends Oo {
  constructor(t, n, i, r) {
    super(
      Object.assign({}, n),
      { name: t }
    ), this.specifiedProjection = n, this.size = i, this.data = r, this.merged = !1;
  }
  get isFit() {
    return !!this.data;
  }
}
function lj(e) {
  e.component.projection = it(e) ? jfe(e) : Ife(e);
}
function jfe(e) {
  var t;
  if (e.hasProjection) {
    const n = e.specifiedProjection, i = !(n && (n.scale != null || n.translate != null)), r = i ? [e.getSizeSignalRef("width"), e.getSizeSignalRef("height")] : void 0, o = i ? Pfe(e) : void 0;
    return new uj(e.projectionName(!0), Object.assign(Object.assign({}, (t = e.config.projection) !== null && t !== void 0 ? t : {}), n != null ? n : {}), r, o);
  }
}
function Pfe(e) {
  const t = [], { encoding: n } = e;
  for (const i of [
    [Nr, Tr],
    [gi, Ki]
  ])
    (vt(n[i[0]]) || vt(n[i[1]])) && t.push({
      signal: e.getName(`geojson_${t.length}`)
    });
  return e.channelHasField(Pn) && e.typedFieldDef(Pn).type === Nl && t.push({
    signal: e.getName(`geojson_${t.length}`)
  }), t.length === 0 && t.push(e.requestDataName(We.Main)), t;
}
function Lfe(e, t) {
  const n = HE(Rfe, (r) => !!(!ku(e.explicit, r) && !ku(t.explicit, r) || ku(e.explicit, r) && ku(t.explicit, r) && Ge(e.get(r)) === Ge(t.get(r))));
  if (Ge(e.size) === Ge(t.size)) {
    if (n)
      return e;
    if (Ge(e.explicit) === Ge({}))
      return t;
    if (Ge(t.explicit) === Ge({}))
      return e;
  }
  return null;
}
function Ife(e) {
  if (e.children.length === 0)
    return;
  let t;
  for (const i of e.children)
    lj(i);
  const n = HE(e.children, (i) => {
    const r = i.component.projection;
    if (r)
      if (t) {
        const o = Lfe(t, r);
        return o && (t = o), !!o;
      } else
        return t = r, !0;
    else
      return !0;
  });
  if (t && n) {
    const i = e.projectionName(!0), r = new uj(i, t.specifiedProjection, t.size, pe(t.data));
    for (const o of e.children) {
      const a = o.component.projection;
      a && (a.isFit && r.data.push(...o.component.projection.data), o.renameProjection(a.get("name"), i), a.merged = !0);
    }
    return r;
  }
}
var Bfe = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function zfe(e, t, n, i) {
  var r, o;
  if (Fd(t, n)) {
    const a = it(e) ? (o = (r = e.axis(n)) !== null && r !== void 0 ? r : e.legend(n)) !== null && o !== void 0 ? o : {} : {}, s = W(t, { expr: "datum" }), u = W(t, { expr: "datum", binSuffix: "end" });
    return {
      formulaAs: W(t, { binSuffix: "range", forAs: !0 }),
      formula: fm(s, u, a.format, a.formatType, i)
    };
  }
  return {};
}
function cj(e, t) {
  return `${LR(e)}_${t}`;
}
function Ufe(e, t) {
  return {
    signal: e.getName(`${t}_bins`),
    extentSignal: e.getName(`${t}_extent`)
  };
}
function r_(e, t, n) {
  var i;
  const r = (i = ym(n, void 0)) !== null && i !== void 0 ? i : {}, o = cj(r, t);
  return e.getName(`${o}_bins`);
}
function qfe(e) {
  return "as" in e;
}
function pk(e, t, n) {
  let i, r;
  qfe(e) ? i = ge(e.as) ? [e.as, `${e.as}_end`] : [e.as[0], e.as[1]] : i = [W(e, { forAs: !0 }), W(e, { binSuffix: "end", forAs: !0 })];
  const o = Object.assign({}, ym(t, void 0)), a = cj(o, e.field), { signal: s, extentSignal: u } = Ufe(n, a);
  if (om(o.extent)) {
    const c = o.extent, f = c.selection;
    r = q4(n.getSelectionComponent(Xe(f), f), c), delete o.extent;
  }
  const l = Object.assign(Object.assign(Object.assign({ bin: o, field: e.field, as: [i] }, s ? { signal: s } : {}), u ? { extentSignal: u } : {}), r ? { span: r } : {});
  return { key: a, binComponent: l };
}
class yr extends Ue {
  constructor(t, n) {
    super(t), this.bins = n;
  }
  clone() {
    return new yr(null, pe(this.bins));
  }
  static makeFromEncoding(t, n) {
    const i = n.reduceFieldDef((r, o, a) => {
      if (yi(o) && Ve(o.bin)) {
        const { key: s, binComponent: u } = pk(o, o.bin, n);
        r[s] = Object.assign(Object.assign(Object.assign({}, u), r[s]), zfe(n, o, a, n.config));
      }
      return r;
    }, {});
    return Ie(i) ? null : new yr(t, i);
  }
  static makeFromTransform(t, n, i) {
    const { key: r, binComponent: o } = pk(n, n.bin, i);
    return new yr(t, {
      [r]: o
    });
  }
  merge(t, n) {
    for (const i of B(t.bins))
      i in this.bins ? (n(t.bins[i].signal, this.bins[i].signal), this.bins[i].as = lr([...this.bins[i].as, ...t.bins[i].as], we)) : this.bins[i] = t.bins[i];
    for (const i of t.children)
      t.removeChild(i), i.parent = this;
    t.remove();
  }
  producedFields() {
    return new Set(oo(this.bins).map((t) => t.as).flat(2));
  }
  dependentFields() {
    return new Set(oo(this.bins).map((t) => t.field));
  }
  hash() {
    return `Bin ${we(this.bins)}`;
  }
  assemble() {
    return oo(this.bins).flatMap((t) => {
      const n = [], [i, ...r] = t.as, o = t.bin, { extent: a } = o, s = Bfe(o, ["extent"]), u = Object.assign(Object.assign(Object.assign({ type: "bin", field: go(t.field), as: i, signal: t.signal }, om(a) ? { extent: null } : { extent: a }), t.span ? { span: { signal: `span(${t.span})` } } : {}), s);
      !a && t.extentSignal && (n.push({
        type: "extent",
        field: go(t.field),
        signal: t.extentSignal
      }), u.extent = { signal: t.extentSignal }), n.push(u);
      for (const l of r)
        for (let c = 0; c < 2; c++)
          n.push({
            type: "formula",
            expr: W({ field: i[c] }, { expr: "datum" }),
            as: l[c]
          });
      return t.formula && n.push({
        type: "formula",
        expr: t.formula,
        as: t.formulaAs
      }), n;
    });
  }
}
function Wfe(e, t, n, i) {
  const r = it(i) ? i.encoding[Pr(t)] : void 0;
  if (yi(n) && it(i) && CA(t, n, r, i.stack, i.markDef, i.config))
    e.add(W(n, {})), e.add(W(n, { suffix: "end" })), n.bin && Fd(n, t) && e.add(W(n, { binSuffix: "range" }));
  else if (fre(t)) {
    const o = cre(t);
    e.add(i.getName(o));
  } else
    e.add(W(n));
  return e;
}
function Gfe(e, t) {
  var n;
  for (const i of B(t)) {
    const r = t[i];
    for (const o of B(r))
      i in e ? e[i][o] = /* @__PURE__ */ new Set([...(n = e[i][o]) !== null && n !== void 0 ? n : [], ...r[o]]) : e[i] = { [o]: r[o] };
  }
}
class Ii extends Ue {
  constructor(t, n, i) {
    super(t), this.dimensions = n, this.measures = i;
  }
  clone() {
    return new Ii(null, new Set(this.dimensions), pe(this.measures));
  }
  get groupBy() {
    return this.dimensions;
  }
  static makeFromEncoding(t, n) {
    let i = !1;
    n.forEachFieldDef((a) => {
      a.aggregate && (i = !0);
    });
    const r = {}, o = /* @__PURE__ */ new Set();
    return !i || (n.forEachFieldDef((a, s) => {
      var u, l, c, f;
      const { aggregate: d, field: h } = a;
      if (d)
        if (d === "count")
          r["*"] = (u = r["*"]) !== null && u !== void 0 ? u : {}, r["*"].count = /* @__PURE__ */ new Set([W(a, { forAs: !0 })]);
        else {
          if (po(d) || Sa(d)) {
            const g = po(d) ? "argmin" : "argmax", p = d[g];
            r[p] = (l = r[p]) !== null && l !== void 0 ? l : {}, r[p][g] = /* @__PURE__ */ new Set([W({ op: g, field: p }, { forAs: !0 })]);
          } else
            r[h] = (c = r[h]) !== null && c !== void 0 ? c : {}, r[h][d] = /* @__PURE__ */ new Set([W(a, { forAs: !0 })]);
          Ma(s) && n.scaleDomain(s) === "unaggregated" && (r[h] = (f = r[h]) !== null && f !== void 0 ? f : {}, r[h].min = /* @__PURE__ */ new Set([W({ field: h, aggregate: "min" }, { forAs: !0 })]), r[h].max = /* @__PURE__ */ new Set([W({ field: h, aggregate: "max" }, { forAs: !0 })]));
        }
      else
        Wfe(o, s, a, n);
    }), o.size + B(r).length === 0) ? null : new Ii(t, o, r);
  }
  static makeFromTransform(t, n) {
    var i, r, o;
    const a = /* @__PURE__ */ new Set(), s = {};
    for (const u of n.aggregate) {
      const { op: l, field: c, as: f } = u;
      l && (l === "count" ? (s["*"] = (i = s["*"]) !== null && i !== void 0 ? i : {}, s["*"].count = /* @__PURE__ */ new Set([f || W(u, { forAs: !0 })])) : (s[c] = (r = s[c]) !== null && r !== void 0 ? r : {}, s[c][l] = /* @__PURE__ */ new Set([f || W(u, { forAs: !0 })])));
    }
    for (const u of (o = n.groupby) !== null && o !== void 0 ? o : [])
      a.add(u);
    return a.size + B(s).length === 0 ? null : new Ii(t, a, s);
  }
  merge(t) {
    return bR(this.dimensions, t.dimensions) ? (Gfe(this.measures, t.measures), !0) : (Soe("different dimensions, cannot merge"), !1);
  }
  addDimensions(t) {
    t.forEach(this.dimensions.add, this.dimensions);
  }
  dependentFields() {
    return /* @__PURE__ */ new Set([...this.dimensions, ...B(this.measures)]);
  }
  producedFields() {
    const t = /* @__PURE__ */ new Set();
    for (const n of B(this.measures))
      for (const i of B(this.measures[n])) {
        const r = this.measures[n][i];
        r.size === 0 ? t.add(`${i}_${n}`) : r.forEach(t.add, t);
      }
    return t;
  }
  hash() {
    return `Aggregate ${we({ dimensions: this.dimensions, measures: this.measures })}`;
  }
  assemble() {
    const t = [], n = [], i = [];
    for (const o of B(this.measures))
      for (const a of B(this.measures[o]))
        for (const s of this.measures[o][a])
          i.push(s), t.push(a), n.push(o === "*" ? null : go(o));
    return {
      type: "aggregate",
      groupby: [...this.dimensions].map(go),
      ops: t,
      fields: n,
      as: i
    };
  }
}
class Ll extends Ue {
  constructor(t, n, i, r) {
    super(t), this.model = n, this.name = i, this.data = r;
    for (const o of si) {
      const a = n.facet[o];
      if (a) {
        const { bin: s, sort: u } = a;
        this[o] = Object.assign({ name: n.getName(`${o}_domain`), fields: [W(a), ...Ve(s) ? [W(a, { binSuffix: "end" })] : []] }, pr(u) ? { sortField: u } : K(u) ? { sortIndexField: pl(a, o) } : {});
      }
    }
    this.childModel = n.child;
  }
  hash() {
    let t = "Facet";
    for (const n of si)
      this[n] && (t += ` ${n.charAt(0)}:${we(this[n])}`);
    return t;
  }
  get fields() {
    var t;
    const n = [];
    for (const i of si)
      !((t = this[i]) === null || t === void 0) && t.fields && n.push(...this[i].fields);
    return n;
  }
  dependentFields() {
    const t = new Set(this.fields);
    for (const n of si)
      this[n] && (this[n].sortField && t.add(this[n].sortField.field), this[n].sortIndexField && t.add(this[n].sortIndexField));
    return t;
  }
  producedFields() {
    return /* @__PURE__ */ new Set();
  }
  getSource() {
    return this.name;
  }
  getChildIndependentFieldsWithStep() {
    const t = {};
    for (const n of pi) {
      const i = this.childModel.component.scales[n];
      if (i && !i.merged) {
        const r = i.get("type"), o = i.get("range");
        if (Ln(r) && Ta(o)) {
          const a = Mm(this.childModel, n), s = u_(a);
          s ? t[n] = s : U(iA(n));
        }
      }
    }
    return t;
  }
  assembleRowColumnHeaderData(t, n, i) {
    const r = { row: "y", column: "x" }[t], o = [], a = [], s = [];
    i && i[r] && (n ? (o.push(`distinct_${i[r]}`), a.push("max")) : (o.push(i[r]), a.push("distinct")), s.push(`distinct_${i[r]}`));
    const { sortField: u, sortIndexField: l } = this[t];
    if (u) {
      const { op: c = dm, field: f } = u;
      o.push(f), a.push(c), s.push(W(u, { forAs: !0 }));
    } else
      l && (o.push(l), a.push("max"), s.push(l));
    return {
      name: this[t].name,
      source: n != null ? n : this.data,
      transform: [
        Object.assign({ type: "aggregate", groupby: this[t].fields }, o.length ? {
          fields: o,
          ops: a,
          as: s
        } : {})
      ]
    };
  }
  assembleFacetHeaderData(t) {
    var n, i;
    const { columns: r } = this.model.layout, { layoutHeaders: o } = this.model.component, a = [], s = {};
    for (const c of e_) {
      for (const f of t_) {
        const d = (n = o[c] && o[c][f]) !== null && n !== void 0 ? n : [];
        for (const h of d)
          if (((i = h.axes) === null || i === void 0 ? void 0 : i.length) > 0) {
            s[c] = !0;
            break;
          }
      }
      if (s[c]) {
        const f = `length(data("${this.facet.name}"))`, d = c === "row" ? r ? { signal: `ceil(${f} / ${r})` } : 1 : r ? { signal: `min(${f}, ${r})` } : { signal: f };
        a.push({
          name: `${this.facet.name}_${c}`,
          transform: [
            {
              type: "sequence",
              start: 0,
              stop: d
            }
          ]
        });
      }
    }
    const { row: u, column: l } = s;
    return (u || l) && a.unshift(this.assembleRowColumnHeaderData("facet", null, t)), a;
  }
  assemble() {
    var t, n;
    const i = [];
    let r = null;
    const o = this.getChildIndependentFieldsWithStep(), { column: a, row: s, facet: u } = this;
    if (a && s && (o.x || o.y)) {
      r = `cross_${this.column.name}_${this.row.name}`;
      const l = [].concat((t = o.x) !== null && t !== void 0 ? t : [], (n = o.y) !== null && n !== void 0 ? n : []), c = l.map(() => "distinct");
      i.push({
        name: r,
        source: this.data,
        transform: [
          {
            type: "aggregate",
            groupby: this.fields,
            fields: l,
            ops: c
          }
        ]
      });
    }
    for (const l of [so, ao])
      this[l] && i.push(this.assembleRowColumnHeaderData(l, r, o));
    if (u) {
      const l = this.assembleFacetHeaderData(o);
      l && i.push(...l);
    }
    return i;
  }
}
function mk(e) {
  return e[0] === "'" && e[e.length - 1] === "'" || e[0] === '"' && e[e.length - 1] === '"' ? e.slice(1, -1) : e;
}
function Hfe(e, t) {
  const n = VE(e);
  if (t === "number")
    return `toNumber(${n})`;
  if (t === "boolean")
    return `toBoolean(${n})`;
  if (t === "string")
    return `toString(${n})`;
  if (t === "date")
    return `toDate(${n})`;
  if (t === "flatten")
    return n;
  if (t.indexOf("date:") === 0) {
    const i = mk(t.slice(5, t.length));
    return `timeParse(${n},'${i}')`;
  } else if (t.indexOf("utc:") === 0) {
    const i = mk(t.slice(4, t.length));
    return `utcParse(${n},'${i}')`;
  } else
    return U(Lre(t)), null;
}
function Yfe(e) {
  const t = {};
  return Xh(e.filter, (n) => {
    var i;
    if (JR(n)) {
      let r = null;
      uA(n) ? r = dn(n.equal) : cA(n) ? r = dn(n.lte) : lA(n) ? r = dn(n.lt) : fA(n) ? r = dn(n.gt) : dA(n) ? r = dn(n.gte) : hA(n) ? r = n.range[0] : gA(n) && (r = ((i = n.oneOf) !== null && i !== void 0 ? i : n.in)[0]), r && (tu(r) ? t[n.field] = "date" : ht(r) ? t[n.field] = "number" : ge(r) && (t[n.field] = "string")), n.timeUnit && (t[n.field] = "date");
    }
  }), t;
}
function Xfe(e) {
  const t = {};
  function n(i) {
    fl(i) ? t[i.field] = "date" : i.type === "quantitative" && ore(i.aggregate) ? t[i.field] = "number" : ul(i.field) > 1 ? i.field in t || (t[i.field] = "flatten") : mm(i) && pr(i.sort) && ul(i.sort.field) > 1 && (i.sort.field in t || (t[i.sort.field] = "flatten"));
  }
  if ((it(e) || Bi(e)) && e.forEachFieldDef((i, r) => {
    if (yi(i))
      n(i);
    else {
      const o = eu(r), a = e.fieldDef(o);
      n(Object.assign(Object.assign({}, i), { type: a.type }));
    }
  }), it(e)) {
    const { mark: i, markDef: r, encoding: o } = e;
    if (Na(i) && !e.encoding.order) {
      const a = r.orient === "horizontal" ? "y" : "x", s = o[a];
      G(s) && s.type === "quantitative" && !(s.field in t) && (t[s.field] = "number");
    }
  }
  return t;
}
function Vfe(e) {
  const t = {};
  if (it(e) && e.component.selection)
    for (const n of B(e.component.selection)) {
      const i = e.component.selection[n];
      for (const r of i.project.items)
        !r.channel && ul(r.field) > 1 && (t[r.field] = "flatten");
    }
  return t;
}
class Ht extends Ue {
  constructor(t, n) {
    super(t), this._parse = n;
  }
  clone() {
    return new Ht(null, pe(this._parse));
  }
  hash() {
    return `Parse ${we(this._parse)}`;
  }
  static makeExplicit(t, n, i) {
    let r = {};
    const o = n.data;
    return !vs(o) && o && o.format && o.format.parse && (r = o.format.parse), this.makeWithAncestors(t, r, {}, i);
  }
  static makeWithAncestors(t, n, i, r) {
    for (const s of B(i)) {
      const u = r.getWithExplicit(s);
      u.value !== void 0 && (u.explicit || u.value === i[s] || u.value === "derived" || i[s] === "flatten" ? delete i[s] : U(EF(s, i[s], u.value)));
    }
    for (const s of B(n)) {
      const u = r.get(s);
      u !== void 0 && (u === n[s] ? delete n[s] : U(EF(s, n[s], u)));
    }
    const o = new Oo(n, i);
    r.copyAll(o);
    const a = {};
    for (const s of B(o.combine())) {
      const u = o.get(s);
      u !== null && (a[s] = u);
    }
    return B(a).length === 0 || r.parseNothing ? null : new Ht(t, a);
  }
  get parse() {
    return this._parse;
  }
  merge(t) {
    this._parse = Object.assign(Object.assign({}, this._parse), t.parse), t.remove();
  }
  assembleFormatParse() {
    const t = {};
    for (const n of B(this._parse)) {
      const i = this._parse[n];
      ul(n) === 1 && (t[n] = i);
    }
    return t;
  }
  producedFields() {
    return new Set(B(this._parse));
  }
  dependentFields() {
    return new Set(B(this._parse));
  }
  assembleTransforms(t = !1) {
    return B(this._parse).filter((n) => t ? ul(n) > 1 : !0).map((n) => {
      const i = Hfe(n, this._parse[n]);
      return i ? {
        type: "formula",
        expr: i,
        as: KE(n)
      } : null;
    }).filter((n) => n !== null);
  }
}
class ba extends Ue {
  clone() {
    return new ba(null);
  }
  constructor(t) {
    super(t);
  }
  dependentFields() {
    return /* @__PURE__ */ new Set();
  }
  producedFields() {
    return /* @__PURE__ */ new Set([dl]);
  }
  hash() {
    return "Identifier";
  }
  assemble() {
    return { type: "identifier", as: dl };
  }
}
class Td extends Ue {
  constructor(t, n) {
    super(t), this.params = n;
  }
  clone() {
    return new Td(null, this.params);
  }
  dependentFields() {
    return /* @__PURE__ */ new Set();
  }
  producedFields() {
  }
  hash() {
    return `Graticule ${we(this.params)}`;
  }
  assemble() {
    return Object.assign({ type: "graticule" }, this.params === !0 ? {} : this.params);
  }
}
class Nd extends Ue {
  constructor(t, n) {
    super(t), this.params = n;
  }
  clone() {
    return new Nd(null, this.params);
  }
  dependentFields() {
    return /* @__PURE__ */ new Set();
  }
  producedFields() {
    var t;
    return /* @__PURE__ */ new Set([(t = this.params.as) !== null && t !== void 0 ? t : "data"]);
  }
  hash() {
    return `Hash ${we(this.params)}`;
  }
  assemble() {
    return Object.assign({ type: "sequence" }, this.params);
  }
}
class Bs extends Ue {
  constructor(t) {
    super(null), t = t != null ? t : { name: "source" };
    let n;
    if (vs(t) || (n = t.format ? Object.assign({}, Xn(t.format, ["parse"])) : {}), C0(t))
      this._data = { values: t.values };
    else if (kf(t)) {
      if (this._data = { url: t.url }, !n.type) {
        let i = /(?:\.([^.]+))?$/.exec(t.url)[1];
        ie(["json", "csv", "tsv", "dsv", "topojson"], i) || (i = "json"), n.type = i;
      }
    } else
      l4(t) ? this._data = { values: [{ type: "Sphere" }] } : (s4(t) || vs(t)) && (this._data = {});
    this._generator = vs(t), t.name && (this._name = t.name), n && !Ie(n) && (this._data.format = n);
  }
  dependentFields() {
    return /* @__PURE__ */ new Set();
  }
  producedFields() {
  }
  get data() {
    return this._data;
  }
  hasName() {
    return !!this._name;
  }
  get isGenerator() {
    return this._generator;
  }
  get dataName() {
    return this._name;
  }
  set dataName(t) {
    this._name = t;
  }
  set parent(t) {
    throw new Error("Source nodes have to be roots.");
  }
  remove() {
    throw new Error("Source nodes are roots and cannot be removed.");
  }
  hash() {
    throw new Error("Cannot hash sources");
  }
  assemble() {
    return Object.assign(Object.assign({ name: this._name }, this._data), { transform: [] });
  }
}
var yk = globalThis && globalThis.__classPrivateFieldSet || function(e, t, n) {
  if (!t.has(e))
    throw new TypeError("attempted to set private field on non-instance");
  return t.set(e, n), n;
}, Kfe = globalThis && globalThis.__classPrivateFieldGet || function(e, t) {
  if (!t.has(e))
    throw new TypeError("attempted to get private field on non-instance");
  return t.get(e);
}, jc;
function o_(e) {
  return e instanceof Bs || e instanceof Td || e instanceof Nd;
}
class a_ {
  constructor() {
    jc.set(this, void 0), yk(this, jc, !1);
  }
  setModified() {
    yk(this, jc, !0);
  }
  get modifiedFlag() {
    return Kfe(this, jc);
  }
}
jc = /* @__PURE__ */ new WeakMap();
class ru extends a_ {
  getNodeDepths(t, n, i) {
    i.set(t, n);
    for (const r of t.children)
      this.getNodeDepths(r, n + 1, i);
    return i;
  }
  optimize(t) {
    const i = [...this.getNodeDepths(t, 0, /* @__PURE__ */ new Map()).entries()].sort((r, o) => o[1] - r[1]);
    for (const r of i)
      this.run(r[0]);
    return this.modifiedFlag;
  }
}
class s_ extends a_ {
  optimize(t) {
    this.run(t);
    for (const n of t.children)
      this.optimize(n);
    return this.modifiedFlag;
  }
}
class Jfe extends s_ {
  mergeNodes(t, n) {
    const i = n.shift();
    for (const r of n)
      t.removeChild(r), r.parent = i, r.remove();
  }
  run(t) {
    const n = t.children.map((r) => r.hash()), i = {};
    for (let r = 0; r < n.length; r++)
      i[n[r]] === void 0 ? i[n[r]] = [t.children[r]] : i[n[r]].push(t.children[r]);
    for (const r of B(i))
      i[r].length > 1 && (this.setModified(), this.mergeNodes(t, i[r]));
  }
}
class Qfe extends s_ {
  constructor(t) {
    super(), this.requiresSelectionId = t && KA(t);
  }
  run(t) {
    t instanceof ba && (this.requiresSelectionId && (o_(t.parent) || t.parent instanceof Ii || t.parent instanceof Ht) || (this.setModified(), t.remove()));
  }
}
class Zfe extends a_ {
  optimize(t) {
    return this.run(t, /* @__PURE__ */ new Set()), this.modifiedFlag;
  }
  run(t, n) {
    let i = /* @__PURE__ */ new Set();
    t instanceof mr && (i = t.producedFields(), YE(i, n) && (this.setModified(), t.removeFormulas(n), t.producedFields.length === 0 && t.remove()));
    for (const r of t.children)
      this.run(r, /* @__PURE__ */ new Set([...n, ...i]));
  }
}
class ede extends s_ {
  constructor() {
    super();
  }
  run(t) {
    t instanceof pn && !t.isRequired() && (this.setModified(), t.remove());
  }
}
class tde extends ru {
  run(t) {
    if (!o_(t) && !(t.numChildren() > 1)) {
      for (const n of t.children)
        if (n instanceof Ht)
          if (t instanceof Ht)
            this.setModified(), t.merge(n);
          else {
            if (XE(t.producedFields(), n.dependentFields()))
              continue;
            this.setModified(), n.swapWithParent();
          }
    }
  }
}
class nde extends ru {
  run(t) {
    const n = [...t.children], i = t.children.filter((r) => r instanceof Ht);
    if (t.numChildren() > 1 && i.length >= 1) {
      const r = {}, o = /* @__PURE__ */ new Set();
      for (const a of i) {
        const s = a.parse;
        for (const u of B(s))
          u in r ? r[u] !== s[u] && o.add(u) : r[u] = s[u];
      }
      for (const a of o)
        delete r[a];
      if (!Ie(r)) {
        this.setModified();
        const a = new Ht(t, r);
        for (const s of n) {
          if (s instanceof Ht)
            for (const u of B(r))
              delete s.parse[u];
          t.removeChild(s), s.parent = a, s instanceof Ht && B(s.parse).length === 0 && s.remove();
        }
      }
    }
  }
}
class ide extends ru {
  run(t) {
    t instanceof pn || t.numChildren() > 0 || t instanceof Ll || t instanceof Bs || (this.setModified(), t.remove());
  }
}
class rde extends ru {
  run(t) {
    const n = t.children.filter((r) => r instanceof mr), i = n.pop();
    for (const r of n)
      this.setModified(), i.merge(r);
  }
}
class ode extends ru {
  run(t) {
    const n = t.children.filter((r) => r instanceof Ii), i = {};
    for (const r of n) {
      const o = we(r.groupBy);
      o in i || (i[o] = []), i[o].push(r);
    }
    for (const r of B(i)) {
      const o = i[r];
      if (o.length > 1) {
        const a = o.pop();
        for (const s of o)
          a.merge(s) && (t.removeChild(s), s.parent = a, s.remove(), this.setModified());
      }
    }
  }
}
class ade extends ru {
  constructor(t) {
    super(), this.model = t;
  }
  run(t) {
    const n = !(o_(t) || t instanceof Pl || t instanceof Ht || t instanceof ba), i = [], r = [];
    for (const o of t.children)
      o instanceof yr && (n && !XE(t.producedFields(), o.dependentFields()) ? i.push(o) : r.push(o));
    if (i.length > 0) {
      const o = i.pop();
      for (const a of i)
        o.merge(a, this.model.renameSignal.bind(this.model));
      this.setModified(), t instanceof yr ? t.merge(o, this.model.renameSignal.bind(this.model)) : o.swapWithParent();
    }
    if (r.length > 1) {
      const o = r.pop();
      for (const a of r)
        o.merge(a, this.model.renameSignal.bind(this.model));
      this.setModified();
    }
  }
}
class sde extends ru {
  run(t) {
    const n = [...t.children];
    if (!sl(n, (a) => a instanceof pn) || t.numChildren() <= 1)
      return;
    const r = [];
    let o;
    for (const a of n)
      if (a instanceof pn) {
        let s = a;
        for (; s.numChildren() === 1; ) {
          const [u] = s.children;
          if (u instanceof pn)
            s = u;
          else
            break;
        }
        r.push(...s.children), o ? (t.removeChild(a), a.parent = o.parent, o.parent.removeChild(o), o.parent = s, this.setModified()) : o = s;
      } else
        r.push(a);
    if (r.length) {
      this.setModified();
      for (const a of r)
        a.parent.removeChild(a), a.parent = o;
    }
  }
}
class ou extends Ue {
  constructor(t, n) {
    super(t), this.transform = n;
  }
  clone() {
    return new ou(null, pe(this.transform));
  }
  addDimensions(t) {
    this.transform.groupby = lr(this.transform.groupby.concat(t), (n) => n);
  }
  dependentFields() {
    const t = /* @__PURE__ */ new Set();
    return this.transform.groupby && this.transform.groupby.forEach(t.add, t), this.transform.joinaggregate.map((n) => n.field).filter((n) => n !== void 0).forEach(t.add, t), t;
  }
  producedFields() {
    return new Set(this.transform.joinaggregate.map(this.getDefaultName));
  }
  getDefaultName(t) {
    var n;
    return (n = t.as) !== null && n !== void 0 ? n : W(t);
  }
  hash() {
    return `JoinAggregateTransform ${we(this.transform)}`;
  }
  assemble() {
    const t = [], n = [], i = [];
    for (const o of this.transform.joinaggregate)
      n.push(o.op), i.push(this.getDefaultName(o)), t.push(o.field === void 0 ? null : o.field);
    const r = this.transform.groupby;
    return Object.assign({
      type: "joinaggregate",
      as: i,
      ops: n,
      fields: t
    }, r !== void 0 ? { groupby: r } : {});
  }
}
function ude(e) {
  return e.stack.stackBy.reduce((t, n) => {
    const i = n.fieldDef, r = W(i);
    return r && t.push(r), t;
  }, []);
}
function lde(e) {
  return K(e) && e.every((t) => ge(t)) && e.length > 1;
}
class co extends Ue {
  constructor(t, n) {
    super(t), this._stack = n;
  }
  clone() {
    return new co(null, pe(this._stack));
  }
  static makeFromTransform(t, n) {
    const { stack: i, groupby: r, as: o, offset: a = "zero" } = n, s = [], u = [];
    if (n.sort !== void 0)
      for (const f of n.sort)
        s.push(f.field), u.push(ct(f.order, "ascending"));
    const l = {
      field: s,
      order: u
    };
    let c;
    return lde(o) ? c = o : ge(o) ? c = [o, o + "_end"] : c = [n.stack + "_start", n.stack + "_end"], new co(t, {
      stackField: i,
      groupby: r,
      offset: a,
      sort: l,
      facetby: [],
      as: c
    });
  }
  static makeFromEncoding(t, n) {
    const i = n.stack, { encoding: r } = n;
    if (!i)
      return null;
    const { groupbyChannel: o, fieldChannel: a, offset: s, impute: u } = i;
    let l;
    if (o) {
      const h = r[o];
      l = Ar(h);
    }
    const c = ude(n), f = n.encoding.order;
    let d;
    return K(f) || G(f) ? d = $8(f) : d = c.reduce((h, g) => (h.field.push(g), h.order.push(a === "y" ? "descending" : "ascending"), h), { field: [], order: [] }), new co(t, {
      dimensionFieldDef: l,
      stackField: n.vgField(a),
      facetby: [],
      stackby: c,
      sort: d,
      offset: s,
      impute: u,
      as: [
        n.vgField(a, { suffix: "start", forAs: !0 }),
        n.vgField(a, { suffix: "end", forAs: !0 })
      ]
    });
  }
  get stack() {
    return this._stack;
  }
  addDimensions(t) {
    this._stack.facetby.push(...t);
  }
  dependentFields() {
    const t = /* @__PURE__ */ new Set();
    return t.add(this._stack.stackField), this.getGroupbyFields().forEach(t.add, t), this._stack.facetby.forEach(t.add, t), this._stack.sort.field.forEach(t.add, t), t;
  }
  producedFields() {
    return new Set(this._stack.as);
  }
  hash() {
    return `Stack ${we(this._stack)}`;
  }
  getGroupbyFields() {
    const { dimensionFieldDef: t, impute: n, groupby: i } = this._stack;
    return t ? t.bin ? n ? [W(t, { binSuffix: "mid" })] : [
      W(t, {}),
      W(t, { binSuffix: "end" })
    ] : [W(t)] : i != null ? i : [];
  }
  assemble() {
    const t = [], { facetby: n, dimensionFieldDef: i, stackField: r, stackby: o, sort: a, offset: s, impute: u, as: l } = this._stack;
    if (u && i) {
      const { band: c = 0.5, bin: f } = i;
      f && t.push({
        type: "formula",
        expr: `${c}*` + W(i, { expr: "datum" }) + `+${1 - c}*` + W(i, { expr: "datum", binSuffix: "end" }),
        as: W(i, { binSuffix: "mid", forAs: !0 })
      }), t.push({
        type: "impute",
        field: r,
        groupby: [...o, ...n],
        key: W(i, { binSuffix: "mid" }),
        method: "value",
        value: 0
      });
    }
    return t.push({
      type: "stack",
      groupby: [...this.getGroupbyFields(), ...n],
      field: r,
      sort: a,
      as: l,
      offset: s
    }), t;
  }
}
class Il extends Ue {
  constructor(t, n) {
    super(t), this.transform = n;
  }
  clone() {
    return new Il(null, pe(this.transform));
  }
  addDimensions(t) {
    this.transform.groupby = lr(this.transform.groupby.concat(t), (n) => n);
  }
  dependentFields() {
    var t, n;
    const i = /* @__PURE__ */ new Set();
    return ((t = this.transform.groupby) !== null && t !== void 0 ? t : []).forEach(i.add, i), ((n = this.transform.sort) !== null && n !== void 0 ? n : []).forEach((r) => i.add(r.field)), this.transform.window.map((r) => r.field).filter((r) => r !== void 0).forEach(i.add, i), i;
  }
  producedFields() {
    return new Set(this.transform.window.map(this.getDefaultName));
  }
  getDefaultName(t) {
    var n;
    return (n = t.as) !== null && n !== void 0 ? n : W(t);
  }
  hash() {
    return `WindowTransform ${we(this.transform)}`;
  }
  assemble() {
    var t;
    const n = [], i = [], r = [], o = [];
    for (const d of this.transform.window)
      i.push(d.op), r.push(this.getDefaultName(d)), o.push(d.param === void 0 ? null : d.param), n.push(d.field === void 0 ? null : d.field);
    const a = this.transform.frame, s = this.transform.groupby;
    if (a && a[0] === null && a[1] === null && i.every((d) => JE(d)))
      return Object.assign({ type: "joinaggregate", as: r, ops: i, fields: n }, s !== void 0 ? { groupby: s } : {});
    const u = [], l = [];
    if (this.transform.sort !== void 0)
      for (const d of this.transform.sort)
        u.push(d.field), l.push((t = d.order) !== null && t !== void 0 ? t : "ascending");
    const c = {
      field: u,
      order: l
    }, f = this.transform.ignorePeers;
    return Object.assign(Object.assign(Object.assign({
      type: "window",
      params: o,
      as: r,
      ops: i,
      fields: n,
      sort: c
    }, f !== void 0 ? { ignorePeers: f } : {}), s !== void 0 ? { groupby: s } : {}), a !== void 0 ? { frame: a } : {});
  }
}
function cde(e) {
  function t(n) {
    if (!(n instanceof Ll)) {
      const i = n.clone();
      if (i instanceof pn) {
        const r = Rb + i.getSource();
        i.setSource(r), e.model.component.data.outputNodes[r] = i;
      } else
        (i instanceof Ii || i instanceof co || i instanceof Il || i instanceof ou) && i.addDimensions(e.fields);
      for (const r of n.children.flatMap(t))
        r.parent = i;
      return [i];
    }
    return n.children.flatMap(t);
  }
  return t;
}
function Nb(e) {
  if (e instanceof Ll)
    if (e.numChildren() === 1 && !(e.children[0] instanceof pn)) {
      const t = e.children[0];
      (t instanceof Ii || t instanceof co || t instanceof Il || t instanceof ou) && t.addDimensions(e.fields), t.swapWithParent(), Nb(e);
    } else {
      const t = e.model.component.data.main;
      fj(t);
      const n = cde(e), i = e.children.map(n).flat();
      for (const r of i)
        r.parent = t;
    }
  else
    e.children.map(Nb);
}
function fj(e) {
  if (e instanceof pn && e.type === We.Main && e.numChildren() === 1) {
    const t = e.children[0];
    t instanceof Ll || (t.swapWithParent(), fj(e));
  }
}
const Rb = "scale_", ph = 5;
function jb(e) {
  for (const t of e) {
    for (const n of t.children)
      if (n.parent !== t)
        return !1;
    if (!jb(t.children))
      return !1;
  }
  return !0;
}
function xi(e, t) {
  let n = !1;
  for (const i of t)
    n = e.optimize(i) || n;
  return n;
}
function vk(e, t, n) {
  let i = e.sources, r = !1;
  return r = xi(new ede(), i) || r, r = xi(new Qfe(t), i) || r, i = i.filter((o) => o.numChildren() > 0), r = xi(new ide(), i) || r, i = i.filter((o) => o.numChildren() > 0), n || (r = xi(new tde(), i) || r, r = xi(new ade(t), i) || r, r = xi(new Zfe(), i) || r, r = xi(new nde(), i) || r, r = xi(new ode(), i) || r, r = xi(new rde(), i) || r, r = xi(new Jfe(), i) || r, r = xi(new sde(), i) || r), e.sources = i, r;
}
function fde(e, t) {
  jb(e.sources);
  let n = 0, i = 0;
  for (let r = 0; r < ph && vk(e, t, !0); r++)
    n++;
  e.sources.map(Nb);
  for (let r = 0; r < ph && vk(e, t, !1); r++)
    i++;
  jb(e.sources), Math.max(n, i) === ph && U(`Maximum optimization runs(${ph}) reached.`);
}
class Vn {
  constructor(t) {
    Object.defineProperty(this, "signal", {
      enumerable: !0,
      get: t
    });
  }
  static fromName(t, n) {
    return new Vn(() => t(n));
  }
}
var dde = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function dj(e) {
  it(e) ? hde(e) : gde(e);
}
function hde(e) {
  const t = e.component.scales;
  for (const n of B(t)) {
    const i = mde(e, n);
    if (t[n].setWithExplicit("domains", i), vde(e, n), e.component.data.isFaceted) {
      let o = e;
      for (; !Bi(o) && o.parent; )
        o = o.parent;
      if (o.component.resolve.scale[n] === "shared")
        for (const s of i.value)
          no(s) && (s.data = Rb + s.data.replace(Rb, ""));
    }
  }
}
function gde(e) {
  for (const n of e.children)
    dj(n);
  const t = e.component.scales;
  for (const n of B(t)) {
    let i, r = null;
    for (const o of e.children) {
      const a = o.component.scales[n];
      if (a) {
        i === void 0 ? i = a.getWithExplicit("domains") : i = ma(i, a.getWithExplicit("domains"), "domains", "scale", Pb);
        const s = a.get("selectionExtent");
        r && s && r.selection !== s.selection && U(Nre), r = s;
      }
    }
    t[n].setWithExplicit("domains", i), r && t[n].set("selectionExtent", r, !0);
  }
}
function pde(e, t, n, i) {
  if (e === "unaggregated") {
    const { valid: r, reason: o } = bk(t, n);
    if (!r) {
      U(o);
      return;
    }
  } else if (e === void 0 && i.useUnaggregatedDomain) {
    const { valid: r } = bk(t, n);
    if (r)
      return "unaggregated";
  }
  return e;
}
function mde(e, t) {
  const n = e.getScaleComponent(t).get("type"), { encoding: i } = e, r = pde(e.scaleDomain(t), e.typedFieldDef(t), n, e.config.scale);
  return r !== e.scaleDomain(t) && (e.specifiedScales[t] = Object.assign(Object.assign({}, e.specifiedScales[t]), { domain: r })), t === "x" && vt(i.x2) ? vt(i.x) ? ma($o(n, r, e, "x"), $o(n, r, e, "x2"), "domain", "scale", Pb) : $o(n, r, e, "x2") : t === "y" && vt(i.y2) ? vt(i.y) ? ma($o(n, r, e, "y"), $o(n, r, e, "y2"), "domain", "scale", Pb) : $o(n, r, e, "y2") : $o(n, r, e, t);
}
function yde(e, t, n) {
  return e.map((i) => ({ signal: `{data: ${vm(i, { timeUnit: n, type: t })}}` }));
}
function ly(e, t, n) {
  var i;
  const r = (i = bn(n)) === null || i === void 0 ? void 0 : i.unit;
  return t === "temporal" || r ? yde(e, t, r) : [e];
}
function $o(e, t, n, i) {
  const { encoding: r } = n, o = vt(r[i]), { type: a } = o, s = o.timeUnit;
  if (dae(t)) {
    const f = $o(e, void 0, n, i), d = ly(t.unionWith, a, s);
    return Xr([...f.value, ...d]);
  } else {
    if (se(t))
      return Xr([t]);
    if (t && t !== "unaggregated" && !e8(t))
      return Xr(ly(t, a, s));
  }
  const u = n.stack;
  if (u && i === u.fieldChannel) {
    if (u.offset === "normalize")
      return Un([[0, 1]]);
    const f = n.requestDataName(We.Main);
    return Un([
      {
        data: f,
        field: n.vgField(i, { suffix: "start" })
      },
      {
        data: f,
        field: n.vgField(i, { suffix: "end" })
      }
    ]);
  }
  const l = Ma(i) && G(o) ? bde(n, i, e) : void 0;
  if (Ra(o)) {
    const f = ly([o.datum], a, s);
    return Un(f);
  }
  const c = o;
  if (t === "unaggregated") {
    const f = n.requestDataName(We.Main), { field: d } = o;
    return Un([
      {
        data: f,
        field: W({ field: d, aggregate: "min" })
      },
      {
        data: f,
        field: W({ field: d, aggregate: "max" })
      }
    ]);
  } else if (Ve(c.bin)) {
    if (Ln(e))
      return Un(e === "bin-ordinal" ? [] : [
        {
          data: Of(l) ? n.requestDataName(We.Main) : n.requestDataName(We.Raw),
          field: n.vgField(i, Fd(c, i) ? { binSuffix: "range" } : {}),
          sort: l === !0 || !ut(l) ? {
            field: n.vgField(i, {}),
            op: "min"
          } : l
        }
      ]);
    {
      const { bin: f } = c;
      if (Ve(f)) {
        const d = r_(n, c.field, f);
        return Un([
          new Vn(() => {
            const h = n.getSignalName(d);
            return `[${h}.start, ${h}.stop]`;
          })
        ]);
      } else
        return Un([
          {
            data: n.requestDataName(We.Main),
            field: n.vgField(i, {})
          }
        ]);
    }
  } else if (c.timeUnit && ie(["time", "utc"], e) && CA(i, c, it(n) ? n.encoding[Pr(i)] : void 0, n.stack, n.markDef, n.config)) {
    const f = n.requestDataName(We.Main);
    return Un([
      {
        data: f,
        field: n.vgField(i)
      },
      {
        data: f,
        field: n.vgField(i, { suffix: "end" })
      }
    ]);
  } else
    return Un(l ? [
      {
        data: Of(l) ? n.requestDataName(We.Main) : n.requestDataName(We.Raw),
        field: n.vgField(i),
        sort: l
      }
    ] : [
      {
        data: n.requestDataName(We.Main),
        field: n.vgField(i)
      }
    ]);
}
function cy(e, t) {
  const { op: n, field: i, order: r } = e;
  return Object.assign(Object.assign({
    op: n != null ? n : t ? "sum" : dm
  }, i ? { field: go(i) } : {}), r ? { order: r } : {});
}
function vde(e, t) {
  var n;
  const i = e.component.scales[t], r = e.specifiedScales[t].domain, o = (n = e.fieldDef(t)) === null || n === void 0 ? void 0 : n.bin, a = e8(r) && r, s = Ad(o) && om(o.extent) && o.extent;
  (a || s) && i.set("selectionExtent", a != null ? a : s, !0);
}
function bde(e, t, n) {
  if (!Ln(n))
    return;
  const i = e.fieldDef(t), r = i.sort;
  if (y8(r))
    return {
      op: "min",
      field: pl(i, t),
      order: "ascending"
    };
  const { stack: o } = e, a = o ? [...o.groupbyField ? [o.groupbyField] : [], ...o.stackBy.map((s) => s.fieldDef.field)] : void 0;
  if (pr(r)) {
    const s = o && !ie(a, r.field);
    return cy(r, s);
  } else if (m8(r)) {
    const { encoding: s, order: u } = r, l = e.fieldDef(s), { aggregate: c, field: f } = l, d = o && !ie(a, f);
    if (po(c) || Sa(c))
      return cy({
        field: W(l),
        order: u
      }, d);
    if (JE(c) || !c)
      return cy({
        op: c,
        field: f,
        order: u
      }, d);
  } else {
    if (r === "descending")
      return {
        op: "min",
        field: e.vgField(t),
        order: "descending"
      };
    if (ie(["ascending", void 0], r))
      return !0;
  }
}
function bk(e, t) {
  const { aggregate: n, type: i } = e;
  return n ? ge(n) && !ure[n] ? {
    valid: !1,
    reason: ioe(n)
  } : i === "quantitative" && t === "log" ? {
    valid: !1,
    reason: roe(e)
  } : { valid: !0 } : {
    valid: !1,
    reason: noe(e)
  };
}
function Pb(e, t, n, i) {
  return e.explicit && t.explicit && U(loe(n, i, e.value, t.value)), { explicit: e.explicit, value: [...e.value, ...t.value] };
}
function xde(e) {
  const t = lr(e.map((a) => no(a) ? dde(a, ["sort"]) : a), we), n = lr(e.map((a) => {
    if (no(a)) {
      const s = a.sort;
      return s !== void 0 && !Of(s) && ("op" in s && s.op === "count" && delete s.field, s.order === "ascending" && delete s.order), s;
    }
  }).filter((a) => a !== void 0), we);
  if (t.length === 0)
    return;
  if (t.length === 1) {
    const a = e[0];
    if (no(a) && n.length > 0) {
      let s = n[0];
      if (n.length > 1)
        U(_F), s = !0;
      else if (ut(s) && "field" in s) {
        const u = s.field;
        a.field === u && (s = s.order ? { order: s.order } : !0);
      }
      return Object.assign(Object.assign({}, a), { sort: s });
    }
    return a;
  }
  const i = lr(n.map((a) => Of(a) || !("op" in a) || ge(a.op) && a.op in ire ? a : (U(foe(a)), !0)), we);
  let r;
  i.length === 1 ? r = i[0] : i.length > 1 && (U(_F), r = !0);
  const o = lr(e.map((a) => no(a) ? a.data : null), (a) => a);
  return o.length === 1 && o[0] !== null ? Object.assign({ data: o[0], fields: t.map((s) => s.field) }, r ? { sort: r } : {}) : Object.assign({ fields: t }, r ? { sort: r } : {});
}
function u_(e) {
  if (no(e) && ge(e.field))
    return e.field;
  if (zoe(e)) {
    let t;
    for (const n of e.fields)
      if (no(n) && ge(n.field)) {
        if (!t)
          t = n.field;
        else if (t !== n.field)
          return U(doe), t;
      }
    return U(hoe), t;
  } else if (Uoe(e)) {
    U(goe);
    const t = e.fields[0];
    return ge(t) ? t : void 0;
  }
}
function Mm(e, t) {
  const i = e.component.scales[t].get("domains").map((r) => (no(r) && (r.data = e.lookupDataSource(r.data)), r));
  return xde(i);
}
var wde = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function hj(e) {
  return Bl(e) || l_(e) ? e.children.reduce((t, n) => t.concat(hj(n)), xk(e)) : xk(e);
}
function xk(e) {
  return B(e.component.scales).reduce((t, n) => {
    const i = e.component.scales[n];
    if (i.merged)
      return t;
    const r = i.combine(), { name: o, type: a, selectionExtent: s, domains: u, range: l, reverse: c } = r, f = wde(r, ["name", "type", "selectionExtent", "domains", "range", "reverse"]), d = Ede(r.range, o, n, e);
    let h;
    s && (h = Ele(e, s));
    const g = Mm(e, n);
    return t.push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
      name: o,
      type: a
    }, g ? { domain: g } : {}), h ? { domainRaw: h } : {}), { range: d }), c !== void 0 ? { reverse: c } : {}), f)), t;
  }, []);
}
function Ede(e, t, n, i) {
  if (Er(n)) {
    if (Ta(e))
      return {
        step: { signal: t + "_step" }
      };
  } else if (ut(e) && no(e))
    return Object.assign(Object.assign({}, e), { data: i.lookupDataSource(e.data) });
  return e;
}
class gj extends Oo {
  constructor(t, n) {
    super(
      {},
      { name: t }
    ), this.merged = !1, this.setWithExplicit("type", n);
  }
  domainDefinitelyIncludesZero() {
    return this.get("zero") !== !1 ? !0 : sl(this.get("domains"), (t) => K(t) && t.length === 2 && t[0] <= 0 && t[1] >= 0);
  }
}
const Ade = ["range", "scheme"];
function pj(e) {
  return e === "x" ? "width" : e === "y" ? "height" : void 0;
}
function _de(e) {
  const t = e.component.scales;
  for (const n of rm) {
    const i = t[n];
    if (!i)
      continue;
    const r = Ode(n, e);
    i.setWithExplicit("range", r);
  }
}
function wk(e, t) {
  const n = e.fieldDef(t);
  if (n && n.bin && Ve(n.bin)) {
    const i = r_(e, n.field, n.bin), r = pj(t), o = e.getName(r);
    return new Vn(() => {
      const a = e.getSignalName(i), s = `(${a}.stop - ${a}.start) / ${a}.step`;
      return `${e.getSignalName(o)} / (${s})`;
    });
  }
}
function Ode(e, t) {
  const n = t.specifiedScales[e], { size: i } = t, o = t.getScaleComponent(e).get("type");
  for (const l of Ade)
    if (n[l] !== void 0) {
      const c = yb(o, l), f = t8(e, l);
      if (!c)
        U(UR(o, l, e));
      else if (f)
        U(f);
      else
        switch (l) {
          case "range": {
            const d = n.range;
            if (K(d)) {
              if (Er(e))
                return Xr(d.map((h) => {
                  if (h === "width" || h === "height") {
                    const g = t.getName(h), p = t.getSignalName.bind(t);
                    return Vn.fromName(p, g);
                  }
                  return h;
                }));
            } else if (ut(d))
              return Xr({
                data: t.requestDataName(We.Main),
                field: d.field,
                sort: { op: "min", field: t.vgField(e) }
              });
            return Xr(d);
          }
          case "scheme":
            return Xr(Sde(n[l]));
        }
    }
  if (e === et || e === xt) {
    const l = e === et ? "width" : "height", c = i[l];
    if (_r(c)) {
      if (Ln(o))
        return Xr({ step: c.step });
      U(qR(l));
    }
  }
  const { rangeMin: a, rangeMax: s } = n, u = Cde(e, t);
  return (a !== void 0 || s !== void 0) && yb(o, "rangeMin") && K(u) && u.length === 2 ? Xr([a != null ? a : u[0], s != null ? s : u[1]]) : Un(u);
}
function Sde(e) {
  return fae(e) ? Object.assign({ scheme: e.name }, Xn(e, ["name"])) : { scheme: e };
}
function Cde(e, t) {
  const { size: n, config: i, mark: r, encoding: o } = t, a = t.getSignalName.bind(t), { type: s } = vt(o[e]), l = t.getScaleComponent(e).get("type"), { domain: c, domainMid: f } = t.specifiedScales[e];
  switch (e) {
    case et:
    case xt: {
      if (ie(["point", "band"], l)) {
        if (e === et && !n.width) {
          const g = Ff(i.view, "width");
          if (_r(g))
            return g;
        } else if (e === xt && !n.height) {
          const g = Ff(i.view, "height");
          if (_r(g))
            return g;
        }
      }
      const d = pj(e), h = t.getName(d);
      return e === xt && mi(l) ? [Vn.fromName(a, h), 0] : [0, Vn.fromName(a, h)];
    }
    case Eo: {
      const d = t.component.scales[e].get("zero"), h = mj(r, d, i), g = Dde(r, n, t, i);
      return b0(l) ? kde(h, g, Fde(l, i, c, e)) : [h, g];
    }
    case Vi:
      return [0, Math.PI * 2];
    case Zs:
      return [0, 360];
    case Mr:
      return [
        0,
        new Vn(() => {
          const d = t.getSignalName("width"), h = t.getSignalName("height");
          return `min(${d},${h})/2`;
        })
      ];
    case ka:
      return [i.scale.minStrokeWidth, i.scale.maxStrokeWidth];
    case Da:
      return [
        [1, 0],
        [4, 2],
        [2, 1],
        [1, 1],
        [1, 2, 4, 2]
      ];
    case Pn:
      return "symbol";
    case jn:
    case Rr:
    case jr:
      return l === "ordinal" ? s === "nominal" ? "category" : "ordinal" : f !== void 0 ? "diverging" : r === "rect" || r === "geoshape" ? "heatmap" : "ramp";
    case Ao:
    case Ca:
    case Fa:
      return [i.scale.minOpacity, i.scale.maxOpacity];
  }
  throw new Error(`Scale range undefined for channel ${e}`);
}
function Fde(e, t, n, i) {
  switch (e) {
    case "quantile":
      return t.scale.quantileCount;
    case "quantize":
      return t.scale.quantizeCount;
    case "threshold":
      return n !== void 0 && K(n) ? n.length + 1 : (U(Aoe(i)), 3);
  }
}
function kde(e, t, n) {
  const i = () => {
    const r = uo(t), o = uo(e), a = `(${r} - ${o}) / (${n} - 1)`;
    return `sequence(${o}, ${r} + ${a}, ${a})`;
  };
  return se(t) ? new Vn(i) : { signal: i() };
}
function mj(e, t, n) {
  if (t)
    return se(t) ? { signal: `${t.signal} ? 0 : ${mj(e, !1, n)}` } : 0;
  switch (e) {
    case "bar":
    case "tick":
      return n.scale.minBandSize;
    case "line":
    case "trail":
    case "rule":
      return n.scale.minStrokeWidth;
    case "text":
      return n.scale.minFontSize;
    case "point":
    case "square":
    case "circle":
      return n.scale.minSize;
  }
  throw new Error(am("size", e));
}
const Ek = 0.95;
function Dde(e, t, n, i) {
  const r = {
    x: wk(n, "x"),
    y: wk(n, "y")
  };
  switch (e) {
    case "bar":
    case "tick": {
      if (i.scale.maxBandSize !== void 0)
        return i.scale.maxBandSize;
      const o = Ak(t, r, i.view);
      return ht(o) ? o - 1 : new Vn(() => `${o.signal} - 1`);
    }
    case "line":
    case "trail":
    case "rule":
      return i.scale.maxStrokeWidth;
    case "text":
      return i.scale.maxFontSize;
    case "point":
    case "square":
    case "circle": {
      if (i.scale.maxSize)
        return i.scale.maxSize;
      const o = Ak(t, r, i.view);
      return ht(o) ? Math.pow(Ek * o, 2) : new Vn(() => `pow(${Ek} * ${o.signal}, 2)`);
    }
  }
  throw new Error(am("size", e));
}
function Ak(e, t, n) {
  const i = _r(e.width) ? e.width.step : S0(n, "width"), r = _r(e.height) ? e.height.step : S0(n, "height");
  return t.x || t.y ? new Vn(() => `min(${[
    t.x ? t.x.signal : i,
    t.y ? t.y.signal : r
  ].join(", ")})`) : Math.min(i, r);
}
function yj(e, t) {
  it(e) ? $de(e, t) : bj(e, t);
}
function $de(e, t) {
  const n = e.component.scales, { config: i, encoding: r, markDef: o, specifiedScales: a } = e;
  for (const s of B(n)) {
    const u = a[s], l = n[s], c = e.getScaleComponent(s), f = vt(r[s]), d = u[t], h = c.get("type"), g = c.get("padding"), p = c.get("paddingInner"), m = yb(h, t), y = t8(s, t);
    if (d !== void 0 && (m ? y && U(y) : U(UR(h, t, s))), m && y === void 0)
      if (d !== void 0) {
        const v = f.timeUnit, b = f.type;
        switch (t) {
          case "domainMax":
          case "domainMin":
            tu(u[t]) || b === "temporal" || v ? l.set(t, { signal: vm(u[t], { type: b, timeUnit: v }) }, !0) : l.set(t, u[t], !0);
            break;
          default:
            l.copyKeyFromObject(t, u);
        }
      } else {
        const v = t in _k ? _k[t]({
          model: e,
          channel: s,
          fieldOrDatumDef: f,
          scaleType: h,
          scalePadding: g,
          scalePaddingInner: p,
          domain: u.domain,
          markDef: o,
          config: i
        }) : i.scale[t];
        v !== void 0 && l.set(t, v, !1);
      }
  }
}
const _k = {
  bins: ({ model: e, fieldOrDatumDef: t }) => G(t) ? Mde(e, t) : void 0,
  interpolate: ({ channel: e, fieldOrDatumDef: t }) => Tde(e, t.type),
  nice: ({ scaleType: e, channel: t, fieldOrDatumDef: n }) => Nde(e, t, n),
  padding: ({ channel: e, scaleType: t, fieldOrDatumDef: n, markDef: i, config: r }) => Rde(e, t, r.scale, n, i, r.bar),
  paddingInner: ({ scalePadding: e, channel: t, markDef: n, config: i }) => jde(e, t, n.type, i.scale),
  paddingOuter: ({ scalePadding: e, channel: t, scaleType: n, markDef: i, scalePaddingInner: r, config: o }) => Pde(e, t, n, i.type, r, o.scale),
  reverse: ({ fieldOrDatumDef: e, scaleType: t, channel: n, config: i }) => {
    const r = G(e) ? e.sort : void 0;
    return Lde(t, r, n, i.scale);
  },
  zero: ({ channel: e, fieldOrDatumDef: t, domain: n, markDef: i, scaleType: r }) => Ide(e, t, n, i, r)
};
function vj(e) {
  it(e) ? _de(e) : bj(e, "range");
}
function bj(e, t) {
  const n = e.component.scales;
  for (const i of e.children)
    t === "range" ? vj(i) : yj(i, t);
  for (const i of B(n)) {
    let r;
    for (const o of e.children) {
      const a = o.component.scales[i];
      if (a) {
        const s = a.getWithExplicit(t);
        r = ma(r, s, t, "scale", a4((u, l) => {
          switch (t) {
            case "range":
              return u.step && l.step ? u.step - l.step : 0;
          }
          return 0;
        }));
      }
    }
    n[i].setWithExplicit(t, r);
  }
}
function Mde(e, t) {
  const n = t.bin;
  if (Ve(n)) {
    const i = r_(e, t.field, n);
    return new Vn(() => e.getSignalName(i));
  } else if (cn(n) && Ad(n) && n.step !== void 0)
    return {
      step: n.step
    };
}
function Tde(e, t) {
  if (ie([jn, Rr, jr], e) && t !== "nominal")
    return "hcl";
}
function Nde(e, t, n) {
  var i;
  if (!(((i = Ar(n)) === null || i === void 0 ? void 0 : i.bin) || ie([ft.TIME, ft.UTC], e)))
    return t in $a ? !0 : void 0;
}
function Rde(e, t, n, i, r, o) {
  if (e in $a) {
    if (ji(t)) {
      if (n.continuousPadding !== void 0)
        return n.continuousPadding;
      const { type: a, orient: s } = r;
      if (a === "bar" && !(G(i) && (i.bin || i.timeUnit)) && (s === "vertical" && e === "x" || s === "horizontal" && e === "y"))
        return o.continuousBandSize;
    }
    if (t === ft.POINT)
      return n.pointPadding;
  }
}
function jde(e, t, n, i) {
  if (e === void 0 && t in $a) {
    const { bandPaddingInner: r, barBandPaddingInner: o, rectBandPaddingInner: a } = i;
    return ct(r, n === "bar" ? o : a);
  }
}
function Pde(e, t, n, i, r, o) {
  if (e === void 0 && t in $a && n === ft.BAND) {
    const { bandPaddingOuter: a } = o;
    return ct(
      a,
      se(r) ? { signal: `${r.signal}/2` } : r / 2
    );
  }
}
function Lde(e, t, n, i) {
  if (n === "x" && i.xReverse !== void 0)
    return mi(e) && t === "descending" ? se(i.xReverse) ? { signal: `!${i.xReverse.signal}` } : !i.xReverse : i.xReverse;
  if (mi(e) && t === "descending")
    return !0;
}
function Ide(e, t, n, i, r) {
  if (!!n && n !== "unaggregated" && mi(r)) {
    if (K(n)) {
      const a = n[0], s = n[n.length - 1];
      if (a <= 0 && s >= 0)
        return !0;
    }
    return !1;
  }
  if (e === "size" && t.type === "quantitative" && !b0(r))
    return !0;
  if (!(G(t) && t.bin) && ie([...pi, ...xre], e)) {
    const { orient: a, type: s } = i;
    return !(ie(["bar", "area", "line", "trail"], s) && (a === "horizontal" && e === "y" || a === "vertical" && e === "x"));
  }
  return !1;
}
function Bde(e, t, n, i) {
  const r = zde(t, n, i), { type: o } = e;
  return Ma(t) ? o !== void 0 ? yae(t, o) ? G(n) && !mae(o, n.type) ? (U(soe(o, r)), r) : o : (U(aoe(t, o, r)), r) : r : null;
}
function zde(e, t, n) {
  var i;
  switch (t.type) {
    case "nominal":
    case "ordinal":
      if (ju(e) || Z1(e) === "discrete")
        return e === "shape" && t.type === "ordinal" && U(ey(e, "ordinal")), "ordinal";
      if (e in $a) {
        if (ie(["rect", "bar", "image", "rule"], n))
          return "band";
      } else if (n === "arc" && e in tA)
        return "band";
      return t.band !== void 0 || kA(t) && ((i = t.axis) === null || i === void 0 ? void 0 : i.tickBand) ? "band" : "point";
    case "temporal":
      return ju(e) ? "time" : Z1(e) === "discrete" ? (U(ey(e, "temporal")), "ordinal") : G(t) && t.timeUnit && bn(t.timeUnit).utc ? "utc" : "time";
    case "quantitative":
      return ju(e) ? G(t) && Ve(t.bin) ? "bin-ordinal" : "linear" : Z1(e) === "discrete" ? (U(ey(e, "quantitative")), "ordinal") : "linear";
    case "geojson":
      return;
  }
  throw new Error(BR(t.type));
}
function Ude(e, { ignoreRange: t } = {}) {
  xj(e), dj(e);
  for (const n of pae)
    yj(e, n);
  t || vj(e);
}
function xj(e) {
  it(e) ? e.component.scales = qde(e) : e.component.scales = Gde(e);
}
function qde(e) {
  const { encoding: t, mark: n } = e;
  return rm.reduce((i, r) => {
    const o = vt(t[r]);
    if (o && n === r8 && r === Pn && o.type === Nl)
      return i;
    let a = o && o.scale;
    if (o && a !== null && a !== !1) {
      a = a != null ? a : {};
      const s = Bde(a, r, o, n);
      i[r] = new gj(e.scaleName(r + "", !0), {
        value: s,
        explicit: a.type === s
      });
    }
    return i;
  }, {});
}
const Wde = a4((e, t) => SF(e) - SF(t));
function Gde(e) {
  var t;
  const n = e.component.scales = {}, i = {}, r = e.component.resolve;
  for (const o of e.children) {
    xj(o);
    for (const a of B(o.component.scales))
      if (r.scale[a] = (t = r.scale[a]) !== null && t !== void 0 ? t : lfe(a, e), r.scale[a] === "shared") {
        const s = i[a], u = o.component.scales[a].getWithExplicit("type");
        s ? Qoe(s.value, u.value) ? i[a] = ma(s, u, "type", "scale", Wde) : (r.scale[a] = "independent", delete i[a]) : i[a] = u;
      }
  }
  for (const o of B(i)) {
    const a = e.scaleName(o, !0), s = i[o];
    n[o] = new gj(a, s);
    for (const u of e.children) {
      const l = u.component.scales[o];
      l && (u.renameScale(l.get("name"), a), l.merged = !0);
    }
  }
  return n;
}
var fy = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
class dy {
  constructor() {
    this.nameMap = {};
  }
  rename(t, n) {
    this.nameMap[t] = n;
  }
  has(t) {
    return this.nameMap[t] !== void 0;
  }
  get(t) {
    for (; this.nameMap[t] && t !== this.nameMap[t]; )
      t = this.nameMap[t];
    return t;
  }
}
function it(e) {
  return (e == null ? void 0 : e.type) === "unit";
}
function Bi(e) {
  return (e == null ? void 0 : e.type) === "facet";
}
function l_(e) {
  return (e == null ? void 0 : e.type) === "concat";
}
function Bl(e) {
  return (e == null ? void 0 : e.type) === "layer";
}
class c_ {
  constructor(t, n, i, r, o, a, s) {
    var u, l;
    this.type = n, this.parent = i, this.config = o, this.children = [], this.correctDataNames = (c) => (c.from && c.from.data && (c.from.data = this.lookupDataSource(c.from.data)), c.from && c.from.facet && c.from.facet.data && (c.from.facet.data = this.lookupDataSource(c.from.facet.data)), c), this.parent = i, this.config = o, this.view = Ci(s), this.name = (u = t.name) !== null && u !== void 0 ? u : r, this.title = Po(t.title) ? { text: t.title } : t.title ? this.initTitle(t.title) : void 0, this.scaleNameMap = i ? i.scaleNameMap : new dy(), this.projectionNameMap = i ? i.projectionNameMap : new dy(), this.signalNameMap = i ? i.signalNameMap : new dy(), this.data = t.data, this.description = t.description, this.transforms = Rue((l = t.transform) !== null && l !== void 0 ? l : []), this.layout = n === "layer" || n === "unit" ? {} : Dse(t, n, o), this.component = {
      data: {
        sources: i ? i.component.data.sources : [],
        outputNodes: i ? i.component.data.outputNodes : {},
        outputNodeRefCounts: i ? i.component.data.outputNodeRefCounts : {},
        isFaceted: hm(t) || i && i.component.data.isFaceted && t.data === void 0
      },
      layoutSize: new Oo(),
      layoutHeaders: { row: {}, column: {}, facet: {} },
      mark: null,
      resolve: Object.assign({ scale: {}, axis: {}, legend: {} }, a ? pe(a) : {}),
      selection: null,
      scales: null,
      projection: null,
      axes: {},
      legends: {}
    };
  }
  initTitle(t) {
    const n = B(t), i = {
      text: dn(t.text)
    };
    for (const r of n)
      i[r] = dn(t[r]);
    return i;
  }
  get width() {
    return this.getSizeSignalRef("width");
  }
  get height() {
    return this.getSizeSignalRef("height");
  }
  parse() {
    this.parseScale(), this.parseLayoutSize(), this.renameTopLevelLayoutSizeSignal(), this.parseSelections(), this.parseProjection(), this.parseData(), this.parseAxesAndHeaders(), this.parseLegends(), this.parseMarkGroup();
  }
  parseScale() {
    Ude(this);
  }
  parseProjection() {
    lj(this);
  }
  renameTopLevelLayoutSizeSignal() {
    this.getName("width") !== "width" && this.renameSignal(this.getName("width"), "width"), this.getName("height") !== "height" && this.renameSignal(this.getName("height"), "height");
  }
  parseLegends() {
    rj(this);
  }
  assembleGroupStyle() {
    var t, n;
    if (this.type === "unit" || this.type === "layer")
      return (n = (t = this.view) === null || t === void 0 ? void 0 : t.style) !== null && n !== void 0 ? n : "cell";
  }
  assembleEncodeFromView(t) {
    const n = fy(t, ["style"]), i = {};
    for (const r of B(n)) {
      const o = n[r];
      o !== void 0 && (i[r] = Ze(o));
    }
    return i;
  }
  assembleGroupEncodeEntry(t) {
    let n = {};
    return this.view && (n = this.assembleEncodeFromView(this.view)), !t && (this.description && (n.description = Ze(this.description)), this.type === "unit" || this.type === "layer") ? Object.assign({ width: this.getSizeSignalRef("width"), height: this.getSizeSignalRef("height") }, n != null ? n : {}) : Ie(n) ? void 0 : n;
  }
  assembleLayout() {
    if (!this.layout)
      return;
    const t = this.layout, { spacing: n } = t, i = fy(t, ["spacing"]), { component: r, config: o } = this, a = ufe(r.layoutHeaders, o);
    return Object.assign(Object.assign(Object.assign({ padding: n }, this.assembleDefaultLayout()), i), a ? { titleBand: a } : {});
  }
  assembleDefaultLayout() {
    return {};
  }
  assembleHeaderMarks() {
    const { layoutHeaders: t } = this.component;
    let n = [];
    for (const i of si)
      t[i].title && n.push(nfe(this, i));
    for (const i of e_)
      n = n.concat(ife(this, i));
    return n;
  }
  assembleAxes() {
    return Wce(this.component.axes, this.config);
  }
  assembleLegends() {
    return aj(this);
  }
  assembleProjections() {
    return Tfe(this);
  }
  assembleTitle() {
    var t, n, i;
    const r = (t = this.title) !== null && t !== void 0 ? t : {}, { encoding: o } = r, a = fy(r, ["encoding"]), s = Object.assign(Object.assign(Object.assign({}, C8(this.config.title).nonMark), a), o ? { encode: { update: o } } : {});
    if (s.text)
      return ie(["unit", "layer"], this.type) ? ie(["middle", void 0], s.anchor) && (s.frame = (n = s.frame) !== null && n !== void 0 ? n : "group") : s.anchor = (i = s.anchor) !== null && i !== void 0 ? i : "start", Ie(s) ? void 0 : s;
  }
  assembleGroup(t = []) {
    const n = {};
    t = t.concat(this.assembleSignals()), t.length > 0 && (n.signals = t);
    const i = this.assembleLayout();
    i && (n.layout = i), n.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks());
    const r = !this.parent || Bi(this.parent) ? hj(this) : [];
    r.length > 0 && (n.scales = r);
    const o = this.assembleAxes();
    o.length > 0 && (n.axes = o);
    const a = this.assembleLegends();
    return a.length > 0 && (n.legends = a), n;
  }
  getName(t) {
    return Xe((this.name ? this.name + "_" : "") + t);
  }
  getDataName(t) {
    return this.getName(We[t].toLowerCase());
  }
  requestDataName(t) {
    const n = this.getDataName(t), i = this.component.data.outputNodeRefCounts;
    return i[n] = (i[n] || 0) + 1, n;
  }
  getSizeSignalRef(t) {
    if (Bi(this.parent)) {
      const n = Q4(t), i = im(n), r = this.component.scales[i];
      if (r && !r.merged) {
        const o = r.get("type"), a = r.get("range");
        if (Ln(o) && Ta(a)) {
          const s = r.get("name"), u = Mm(this, i), l = u_(u);
          if (l) {
            const c = W({ aggregate: "distinct", field: l }, { expr: "datum" });
            return {
              signal: J4(s, r, c)
            };
          } else
            return U(iA(i)), null;
        }
      }
    }
    return {
      signal: this.signalNameMap.get(this.getName(t))
    };
  }
  lookupDataSource(t) {
    const n = this.component.data.outputNodes[t];
    return n ? n.getSource() : t;
  }
  getSignalName(t) {
    return this.signalNameMap.get(t);
  }
  renameSignal(t, n) {
    this.signalNameMap.rename(t, n);
  }
  renameScale(t, n) {
    this.scaleNameMap.rename(t, n);
  }
  renameProjection(t, n) {
    this.projectionNameMap.rename(t, n);
  }
  scaleName(t, n) {
    if (n)
      return this.getName(t);
    if (TR(t) && Ma(t) && this.component.scales[t] || this.scaleNameMap.has(this.getName(t)))
      return this.scaleNameMap.get(this.getName(t));
  }
  projectionName(t) {
    if (t)
      return this.getName("projection");
    if (this.component.projection && !this.component.projection.merged || this.projectionNameMap.has(this.getName("projection")))
      return this.projectionNameMap.get(this.getName("projection"));
  }
  getScaleComponent(t) {
    if (!this.component.scales)
      throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");
    const n = this.component.scales[t];
    return n && !n.merged ? n : this.parent ? this.parent.getScaleComponent(t) : void 0;
  }
  getSelectionComponent(t, n) {
    let i = this.component.selection[t];
    if (!i && this.parent && (i = this.parent.getSelectionComponent(t, n)), !i)
      throw new Error(Dre(n));
    return i;
  }
  hasAxisOrientSignalRef() {
    var t, n;
    return ((t = this.component.axes.x) === null || t === void 0 ? void 0 : t.some((i) => i.hasOrientSignalRef())) || ((n = this.component.axes.y) === null || n === void 0 ? void 0 : n.some((i) => i.hasOrientSignalRef()));
  }
}
class wj extends c_ {
  vgField(t, n = {}) {
    const i = this.fieldDef(t);
    if (!!i)
      return W(i, n);
  }
  reduceFieldDef(t, n) {
    return rse(this.getMapping(), (i, r, o) => {
      const a = Ar(r);
      return a ? t(i, a, o) : i;
    }, n);
  }
  forEachFieldDef(t, n) {
    RA(this.getMapping(), (i, r) => {
      const o = Ar(i);
      o && t(o, r);
    }, n);
  }
}
var Hde = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
class Tm extends Ue {
  constructor(t, n) {
    var i, r, o;
    super(t), this.transform = n, this.transform = pe(n);
    const a = (i = this.transform.as) !== null && i !== void 0 ? i : [void 0, void 0];
    this.transform.as = [(r = a[0]) !== null && r !== void 0 ? r : "value", (o = a[1]) !== null && o !== void 0 ? o : "density"];
  }
  clone() {
    return new Tm(null, pe(this.transform));
  }
  dependentFields() {
    var t;
    return /* @__PURE__ */ new Set([this.transform.density, ...(t = this.transform.groupby) !== null && t !== void 0 ? t : []]);
  }
  producedFields() {
    return new Set(this.transform.as);
  }
  hash() {
    return `DensityTransform ${we(this.transform)}`;
  }
  assemble() {
    const t = this.transform, { density: n } = t, i = Hde(t, ["density"]);
    return Object.assign({ type: "kde", field: n }, i);
  }
}
class Tf extends Ue {
  constructor(t, n) {
    super(t), this.filter = n;
  }
  clone() {
    return new Tf(null, Object.assign({}, this.filter));
  }
  static make(t, n) {
    const { config: i, mark: r, markDef: o } = n;
    if (Re("invalid", o, i) !== "filter")
      return null;
    const s = n.reduceFieldDef((u, l, c) => {
      const f = Ma(c) && n.getScaleComponent(c);
      if (f) {
        const d = f.get("type");
        mi(d) && l.aggregate !== "count" && !Na(r) && (u[l.field] = l);
      }
      return u;
    }, {});
    return B(s).length ? new Tf(t, s) : null;
  }
  dependentFields() {
    return new Set(B(this.filter));
  }
  producedFields() {
    return /* @__PURE__ */ new Set();
  }
  hash() {
    return `FilterInvalid ${we(this.filter)}`;
  }
  assemble() {
    const t = B(this.filter).reduce((n, i) => {
      const r = this.filter[i], o = W(r, { expr: "datum" });
      return r !== null && (r.type === "temporal" ? n.push(`(isDate(${o}) || (isValid(${o}) && isFinite(+${o})))`) : r.type === "quantitative" && (n.push(`isValid(${o})`), n.push(`isFinite(+${o})`))), n;
    }, []);
    return t.length > 0 ? {
      type: "filter",
      expr: t.join(" && ")
    } : null;
  }
}
class Nm extends Ue {
  constructor(t, n) {
    super(t), this.transform = n, this.transform = pe(n);
    const { flatten: i, as: r = [] } = this.transform;
    this.transform.as = i.map((o, a) => {
      var s;
      return (s = r[a]) !== null && s !== void 0 ? s : o;
    });
  }
  clone() {
    return new Nm(this.parent, pe(this.transform));
  }
  dependentFields() {
    return new Set(this.transform.flatten);
  }
  producedFields() {
    return new Set(this.transform.as);
  }
  hash() {
    return `FlattenTransform ${we(this.transform)}`;
  }
  assemble() {
    const { flatten: t, as: n } = this.transform;
    return {
      type: "flatten",
      fields: t,
      as: n
    };
  }
}
class Rm extends Ue {
  constructor(t, n) {
    var i, r, o;
    super(t), this.transform = n, this.transform = pe(n);
    const a = (i = this.transform.as) !== null && i !== void 0 ? i : [void 0, void 0];
    this.transform.as = [(r = a[0]) !== null && r !== void 0 ? r : "key", (o = a[1]) !== null && o !== void 0 ? o : "value"];
  }
  clone() {
    return new Rm(null, pe(this.transform));
  }
  dependentFields() {
    return new Set(this.transform.fold);
  }
  producedFields() {
    return new Set(this.transform.as);
  }
  hash() {
    return `FoldTransform ${we(this.transform)}`;
  }
  assemble() {
    const { fold: t, as: n } = this.transform;
    return {
      type: "fold",
      fields: t,
      as: n
    };
  }
}
class Lu extends Ue {
  constructor(t, n, i, r) {
    super(t), this.fields = n, this.geojson = i, this.signal = r;
  }
  clone() {
    return new Lu(null, pe(this.fields), this.geojson, this.signal);
  }
  static parseAll(t, n) {
    if (n.component.projection && !n.component.projection.isFit)
      return t;
    let i = 0;
    for (const r of [
      [Nr, Tr],
      [gi, Ki]
    ]) {
      const o = r.map((a) => {
        const s = vt(n.encoding[a]);
        return G(s) ? s.field : Ra(s) ? { expr: `${s.datum}` } : Wi(s) ? { expr: `${s.value}` } : void 0;
      });
      (o[0] || o[1]) && (t = new Lu(t, o, null, n.getName(`geojson_${i++}`)));
    }
    if (n.channelHasField(Pn)) {
      const r = n.typedFieldDef(Pn);
      r.type === Nl && (t = new Lu(t, null, r.field, n.getName(`geojson_${i++}`)));
    }
    return t;
  }
  dependentFields() {
    var t;
    const n = ((t = this.fields) !== null && t !== void 0 ? t : []).filter(ge);
    return /* @__PURE__ */ new Set([...this.geojson ? [this.geojson] : [], ...n]);
  }
  producedFields() {
    return /* @__PURE__ */ new Set();
  }
  hash() {
    return `GeoJSON ${this.geojson} ${this.signal} ${we(this.fields)}`;
  }
  assemble() {
    return Object.assign(Object.assign(Object.assign({ type: "geojson" }, this.fields ? { fields: this.fields } : {}), this.geojson ? { geojson: this.geojson } : {}), { signal: this.signal });
  }
}
class Nf extends Ue {
  constructor(t, n, i, r) {
    super(t), this.projection = n, this.fields = i, this.as = r;
  }
  clone() {
    return new Nf(null, this.projection, pe(this.fields), pe(this.as));
  }
  static parseAll(t, n) {
    if (!n.projectionName())
      return t;
    for (const i of [
      [Nr, Tr],
      [gi, Ki]
    ]) {
      const r = i.map((a) => {
        const s = vt(n.encoding[a]);
        return G(s) ? s.field : Ra(s) ? { expr: `${s.datum}` } : Wi(s) ? { expr: `${s.value}` } : void 0;
      }), o = i[0] === gi ? "2" : "";
      (r[0] || r[1]) && (t = new Nf(t, n.projectionName(), r, [
        n.getName("x" + o),
        n.getName("y" + o)
      ]));
    }
    return t;
  }
  dependentFields() {
    return new Set(this.fields.filter(ge));
  }
  producedFields() {
    return new Set(this.as);
  }
  hash() {
    return `Geopoint ${this.projection} ${we(this.fields)} ${we(this.as)}`;
  }
  assemble() {
    return {
      type: "geopoint",
      projection: this.projection,
      fields: this.fields,
      as: this.as
    };
  }
}
class bs extends Ue {
  constructor(t, n) {
    super(t), this.transform = n;
  }
  clone() {
    return new bs(null, pe(this.transform));
  }
  dependentFields() {
    var t;
    return /* @__PURE__ */ new Set([this.transform.impute, this.transform.key, ...(t = this.transform.groupby) !== null && t !== void 0 ? t : []]);
  }
  producedFields() {
    return /* @__PURE__ */ new Set([this.transform.impute]);
  }
  processSequence(t) {
    const { start: n = 0, stop: i, step: r } = t;
    return { signal: `sequence(${[n, i, ...r ? [r] : []].join(",")})` };
  }
  static makeFromTransform(t, n) {
    return new bs(t, n);
  }
  static makeFromEncoding(t, n) {
    const i = n.encoding, r = i.x, o = i.y;
    if (G(r) && G(o)) {
      const a = r.impute ? r : o.impute ? o : void 0;
      if (a === void 0)
        return;
      const s = r.impute ? o : o.impute ? r : void 0, { method: u, value: l, frame: c, keyvals: f } = a.impute, d = j8(n.mark, i);
      return new bs(t, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ impute: a.field, key: s.field }, u ? { method: u } : {}), l !== void 0 ? { value: l } : {}), c ? { frame: c } : {}), f !== void 0 ? { keyvals: f } : {}), d.length ? { groupby: d } : {}));
    }
    return null;
  }
  hash() {
    return `Impute ${we(this.transform)}`;
  }
  assemble() {
    const { impute: t, key: n, keyvals: i, method: r, groupby: o, value: a, frame: s = [null, null] } = this.transform, u = Object.assign(Object.assign(Object.assign(Object.assign({ type: "impute", field: t, key: n }, i ? { keyvals: pue(i) ? this.processSequence(i) : i } : {}), { method: "value" }), o ? { groupby: o } : {}), { value: !r || r === "value" ? a : null });
    if (r && r !== "value") {
      const l = Object.assign({ type: "window", as: [`imputed_${t}_value`], ops: [r], fields: [t], frame: s, ignorePeers: !1 }, o ? { groupby: o } : {}), c = {
        type: "formula",
        expr: `datum.${t} === null ? datum.imputed_${t}_value : datum.${t}`,
        as: t
      };
      return [u, l, c];
    } else
      return [u];
  }
}
var Yde = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
class jm extends Ue {
  constructor(t, n) {
    var i, r, o;
    super(t), this.transform = n, this.transform = pe(n);
    const a = (i = this.transform.as) !== null && i !== void 0 ? i : [void 0, void 0];
    this.transform.as = [(r = a[0]) !== null && r !== void 0 ? r : n.on, (o = a[1]) !== null && o !== void 0 ? o : n.loess];
  }
  clone() {
    return new jm(null, pe(this.transform));
  }
  dependentFields() {
    var t;
    return /* @__PURE__ */ new Set([this.transform.loess, this.transform.on, ...(t = this.transform.groupby) !== null && t !== void 0 ? t : []]);
  }
  producedFields() {
    return new Set(this.transform.as);
  }
  hash() {
    return `LoessTransform ${we(this.transform)}`;
  }
  assemble() {
    const t = this.transform, { loess: n, on: i } = t, r = Yde(t, ["loess", "on"]);
    return Object.assign({ type: "loess", x: i, y: n }, r);
  }
}
class Rf extends Ue {
  constructor(t, n, i) {
    super(t), this.transform = n, this.secondary = i;
  }
  clone() {
    return new Rf(null, pe(this.transform), this.secondary);
  }
  static make(t, n, i, r) {
    const o = n.component.data.sources, { from: a } = i;
    let s = null;
    if (yue(a)) {
      let u = _j(a.data, o);
      u || (u = new Bs(a.data), o.push(u));
      const l = n.getName(`lookup_${r}`);
      s = new pn(u, l, We.Lookup, n.component.data.outputNodeRefCounts), n.component.data.outputNodes[l] = s;
    } else if (vue(a)) {
      const u = a.selection;
      if (i = Object.assign({ as: u }, i), s = n.getSelectionComponent(Xe(u), u).materialized, !s)
        throw new Error(Tre(u));
    }
    return new Rf(t, i, s.getSource());
  }
  dependentFields() {
    return /* @__PURE__ */ new Set([this.transform.lookup]);
  }
  producedFields() {
    return new Set(this.transform.as ? lt(this.transform.as) : this.transform.from.fields);
  }
  hash() {
    return `Lookup ${we({ transform: this.transform, secondary: this.secondary })}`;
  }
  assemble() {
    let t;
    if (this.transform.from.fields)
      t = Object.assign({ values: this.transform.from.fields }, this.transform.as ? { as: lt(this.transform.as) } : {});
    else {
      let n = this.transform.as;
      ge(n) || (U(zre), n = "_lookup"), t = {
        as: [n]
      };
    }
    return Object.assign(Object.assign({ type: "lookup", from: this.secondary, key: this.transform.from.key, fields: [this.transform.lookup] }, t), this.transform.default ? { default: this.transform.default } : {});
  }
}
var Xde = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
class Pm extends Ue {
  constructor(t, n) {
    var i, r, o;
    super(t), this.transform = n, this.transform = pe(n);
    const a = (i = this.transform.as) !== null && i !== void 0 ? i : [void 0, void 0];
    this.transform.as = [(r = a[0]) !== null && r !== void 0 ? r : "prob", (o = a[1]) !== null && o !== void 0 ? o : "value"];
  }
  clone() {
    return new Pm(null, pe(this.transform));
  }
  dependentFields() {
    var t;
    return /* @__PURE__ */ new Set([this.transform.quantile, ...(t = this.transform.groupby) !== null && t !== void 0 ? t : []]);
  }
  producedFields() {
    return new Set(this.transform.as);
  }
  hash() {
    return `QuantileTransform ${we(this.transform)}`;
  }
  assemble() {
    const t = this.transform, { quantile: n } = t, i = Xde(t, ["quantile"]);
    return Object.assign({ type: "quantile", field: n }, i);
  }
}
var Vde = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
class Lm extends Ue {
  constructor(t, n) {
    var i, r, o;
    super(t), this.transform = n, this.transform = pe(n);
    const a = (i = this.transform.as) !== null && i !== void 0 ? i : [void 0, void 0];
    this.transform.as = [(r = a[0]) !== null && r !== void 0 ? r : n.on, (o = a[1]) !== null && o !== void 0 ? o : n.regression];
  }
  clone() {
    return new Lm(null, pe(this.transform));
  }
  dependentFields() {
    var t;
    return /* @__PURE__ */ new Set([this.transform.regression, this.transform.on, ...(t = this.transform.groupby) !== null && t !== void 0 ? t : []]);
  }
  producedFields() {
    return new Set(this.transform.as);
  }
  hash() {
    return `RegressionTransform ${we(this.transform)}`;
  }
  assemble() {
    const t = this.transform, { regression: n, on: i } = t, r = Vde(t, ["regression", "on"]);
    return Object.assign({ type: "regression", x: i, y: n }, r);
  }
}
class Im extends Ue {
  constructor(t, n) {
    super(t), this.transform = n;
  }
  clone() {
    return new Im(null, pe(this.transform));
  }
  addDimensions(t) {
    var n;
    this.transform.groupby = lr(((n = this.transform.groupby) !== null && n !== void 0 ? n : []).concat(t), (i) => i);
  }
  producedFields() {
  }
  dependentFields() {
    var t;
    return /* @__PURE__ */ new Set([this.transform.pivot, this.transform.value, ...(t = this.transform.groupby) !== null && t !== void 0 ? t : []]);
  }
  hash() {
    return `PivotTransform ${we(this.transform)}`;
  }
  assemble() {
    const { pivot: t, value: n, groupby: i, limit: r, op: o } = this.transform;
    return Object.assign(Object.assign(Object.assign({ type: "pivot", field: t, value: n }, r !== void 0 ? { limit: r } : {}), o !== void 0 ? { op: o } : {}), i !== void 0 ? { groupby: i } : {});
  }
}
class Bm extends Ue {
  constructor(t, n) {
    super(t), this.transform = n;
  }
  clone() {
    return new Bm(null, pe(this.transform));
  }
  dependentFields() {
    return /* @__PURE__ */ new Set();
  }
  producedFields() {
    return /* @__PURE__ */ new Set();
  }
  hash() {
    return `SampleTransform ${we(this.transform)}`;
  }
  assemble() {
    return {
      type: "sample",
      size: this.transform.sample
    };
  }
}
function Ej(e) {
  let t = 0;
  function n(i, r) {
    var o;
    if (i instanceof Bs && !i.isGenerator && !kf(i.data) && (e.push(r), r = {
      name: null,
      source: r.name,
      transform: []
    }), i instanceof Ht && (i.parent instanceof Bs && !r.source ? (r.format = Object.assign(Object.assign({}, (o = r.format) !== null && o !== void 0 ? o : {}), { parse: i.assembleFormatParse() }), r.transform.push(...i.assembleTransforms(!0))) : r.transform.push(...i.assembleTransforms())), i instanceof Ll) {
      r.name || (r.name = `data_${t++}`), !r.source || r.transform.length > 0 ? (e.push(r), i.data = r.name) : i.data = r.source;
      for (const a of i.assemble())
        e.push(a);
      return;
    }
    switch ((i instanceof Td || i instanceof Nd || i instanceof Tf || i instanceof Pl || i instanceof gl || i instanceof Nf || i instanceof Lu || i instanceof Ii || i instanceof Rf || i instanceof Il || i instanceof ou || i instanceof Rm || i instanceof Nm || i instanceof Tm || i instanceof jm || i instanceof Pm || i instanceof Lm || i instanceof ba || i instanceof Bm || i instanceof Im) && r.transform.push(i.assemble()), (i instanceof yr || i instanceof mr || i instanceof bs || i instanceof co) && r.transform.push(...i.assemble()), i instanceof pn && (r.source && r.transform.length === 0 ? i.setSource(r.source) : i.parent instanceof pn ? i.setSource(r.name) : (r.name || (r.name = `data_${t++}`), i.setSource(r.name), i.numChildren() === 1 && (e.push(r), r = {
      name: null,
      source: r.name,
      transform: []
    }))), i.numChildren()) {
      case 0:
        i instanceof pn && (!r.source || r.transform.length > 0) && e.push(r);
        break;
      case 1:
        n(i.children[0], r);
        break;
      default: {
        r.name || (r.name = `data_${t++}`);
        let a = r.name;
        !r.source || r.transform.length > 0 ? e.push(r) : a = r.source;
        for (const s of i.children)
          n(s, {
            name: null,
            source: a,
            transform: []
          });
        break;
      }
    }
  }
  return n;
}
function Kde(e) {
  const t = [], n = Ej(t);
  for (const i of e.children)
    n(i, {
      source: e.name,
      name: null,
      transform: []
    });
  return t;
}
function Jde(e, t) {
  var n, i;
  const r = [], o = Ej(r);
  let a = 0;
  for (const u of e.sources) {
    u.hasName() || (u.dataName = `source_${a++}`);
    const l = u.assemble();
    o(u, l);
  }
  for (const u of r)
    u.transform.length === 0 && delete u.transform;
  let s = 0;
  for (const [u, l] of r.entries())
    ((n = l.transform) !== null && n !== void 0 ? n : []).length === 0 && !l.source && r.splice(s++, 0, r.splice(u, 1)[0]);
  for (const u of r)
    for (const l of (i = u.transform) !== null && i !== void 0 ? i : [])
      l.type === "lookup" && (l.from = e.outputNodes[l.from].getSource());
  for (const u of r)
    u.name in t && (u.values = t[u.name]);
  return r;
}
function Qde(e) {
  return e === "top" || e === "left" || se(e) ? "header" : "footer";
}
function Zde(e) {
  for (const t of si)
    ehe(e, t);
  Ok(e, "x"), Ok(e, "y");
}
function ehe(e, t) {
  var n;
  const { facet: i, config: r, child: o, component: a } = e;
  if (e.channelHasField(t)) {
    const s = i[t], u = ml("title", null, r, t);
    let l = Pu(s, r, {
      allowDisabling: !0,
      includeDefault: u === void 0 || !!u
    });
    o.component.layoutHeaders[t].title && (l = K(l) ? l.join(", ") : l, l += " / " + o.component.layoutHeaders[t].title, o.component.layoutHeaders[t].title = null);
    const c = ml("labelOrient", s, r, t), f = (n = s.header) !== null && n !== void 0 ? n : {}, d = ct(f.labels, r.header.labels, !0), h = ie(["bottom", "right"], c) ? "footer" : "header";
    a.layoutHeaders[t] = {
      title: l,
      facetFieldDef: s,
      [h]: t === "facet" ? [] : [Aj(e, t, d)]
    };
  }
}
function Aj(e, t, n) {
  const i = t === "row" ? "height" : "width";
  return {
    labels: n,
    sizeSignal: e.child.component.layoutSize.get(i) ? e.child.getSizeSignalRef(i) : void 0,
    axes: []
  };
}
function Ok(e, t) {
  var n;
  const { child: i } = e;
  if (i.component.axes[t]) {
    const { layoutHeaders: r, resolve: o } = e.component;
    if (o.axis[t] = i_(o, t), o.axis[t] === "shared") {
      const a = t === "x" ? "column" : "row", s = r[a];
      for (const u of i.component.axes[t]) {
        const l = Qde(u.get("orient"));
        s[l] = (n = s[l]) !== null && n !== void 0 ? n : [Aj(e, a, !1)];
        const c = Rc(u, "main", e.config, { header: !0 });
        c && s[l][0].axes.push(c), u.mainExtracted = !0;
      }
    }
  }
}
function the(e) {
  f_(e), N0(e, "width"), N0(e, "height");
}
function nhe(e) {
  f_(e);
  const t = e.layout.columns === 1 ? "width" : "childWidth", n = e.layout.columns === void 0 ? "height" : "childHeight";
  N0(e, t), N0(e, n);
}
function f_(e) {
  for (const t of e.children)
    t.parseLayoutSize();
}
function N0(e, t) {
  const n = Q4(t), i = im(n), r = e.component.resolve, o = e.component.layoutSize;
  let a;
  for (const s of e.children) {
    const u = s.component.layoutSize.getWithExplicit(n), l = r.scale[i];
    if (l === "independent" && u.value === "step") {
      a = void 0;
      break;
    }
    if (a) {
      if (l === "independent" && a.value !== u.value) {
        a = void 0;
        break;
      }
      a = ma(a, u, n, "");
    } else
      a = u;
  }
  if (a) {
    for (const s of e.children)
      e.renameSignal(s.getName(n), e.getName(t)), s.component.layoutSize.set(n, "merged", !1);
    o.setWithExplicit(t, a);
  } else
    o.setWithExplicit(t, {
      explicit: !1,
      value: void 0
    });
}
function ihe(e) {
  const { size: t, component: n } = e;
  for (const i of pi) {
    const r = Lr(i);
    if (t[r]) {
      const o = t[r];
      n.layoutSize.set(r, _r(o) ? "step" : o, !0);
    } else {
      const o = rhe(e, r);
      n.layoutSize.set(r, o, !1);
    }
  }
}
function rhe(e, t) {
  const n = t === "width" ? "x" : "y", i = e.config, r = e.getScaleComponent(n);
  if (r) {
    const o = r.get("type"), a = r.get("range");
    if (Ln(o)) {
      const s = Ff(i.view, t);
      return Ta(a) || _r(s) ? "step" : s;
    } else
      return wb(i.view, t);
  } else {
    if (e.hasProjection || e.mark === "arc")
      return wb(i.view, t);
    {
      const o = Ff(i.view, t);
      return _r(o) ? o.step : o;
    }
  }
}
var ohe = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function Lb(e, t, n) {
  return W(t, Object.assign({ suffix: `by_${W(e)}` }, n != null ? n : {}));
}
class Zc extends wj {
  constructor(t, n, i, r) {
    super(t, "facet", n, i, r, t.resolve), this.child = m_(t.spec, this, this.getName("child"), void 0, r), this.children = [this.child], this.facet = this.initFacet(t.facet);
  }
  initFacet(t) {
    if (!Sd(t))
      return { facet: this.initFacetFieldDef(t, "facet") };
    const n = B(t), i = {};
    for (const r of n) {
      if (!ie([ao, so], r)) {
        U(am(r, "facet"));
        break;
      }
      const o = t[r];
      if (o.field === void 0) {
        U(gb(o, r));
        break;
      }
      i[r] = this.initFacetFieldDef(o, r);
    }
    return i;
  }
  initFacetFieldDef(t, n) {
    const { header: i } = t, r = ohe(t, ["header"]), o = MA(r, n);
    return i && (o.header = Ci(i)), o;
  }
  channelHasField(t) {
    return !!this.facet[t];
  }
  fieldDef(t) {
    return this.facet[t];
  }
  parseData() {
    this.component.data = zm(this), this.child.parseData();
  }
  parseLayoutSize() {
    f_(this);
  }
  parseSelections() {
    this.child.parseSelections(), this.component.selection = this.child.component.selection;
  }
  parseMarkGroup() {
    this.child.parseMarkGroup();
  }
  parseAxesAndHeaders() {
    this.child.parseAxesAndHeaders(), Zde(this);
  }
  assembleSelectionTopLevelSignals(t) {
    return this.child.assembleSelectionTopLevelSignals(t);
  }
  assembleSignals() {
    return this.child.assembleSignals(), [];
  }
  assembleSelectionData(t) {
    return this.child.assembleSelectionData(t);
  }
  getHeaderLayoutMixins() {
    var t, n, i;
    const r = {};
    for (const o of si)
      for (const a of t_) {
        const s = this.component.layoutHeaders[o], u = s[a], { facetFieldDef: l } = s;
        if (l) {
          const c = ml("titleOrient", l.header, this.config, o);
          if (ie(["right", "bottom"], c)) {
            const f = Dm(o, c);
            r.titleAnchor = (t = r.titleAnchor) !== null && t !== void 0 ? t : {}, r.titleAnchor[f] = "end";
          }
        }
        if (u != null && u[0]) {
          const c = o === "row" ? "height" : "width", f = a === "header" ? "headerBand" : "footerBand";
          o !== "facet" && !this.child.component.layoutSize.get(c) && (r[f] = (n = r[f]) !== null && n !== void 0 ? n : {}, r[f][o] = 0.5), s.title && (r.offset = (i = r.offset) !== null && i !== void 0 ? i : {}, r.offset[o === "row" ? "rowTitle" : "columnTitle"] = 10);
        }
      }
    return r;
  }
  assembleDefaultLayout() {
    const { column: t, row: n } = this.facet, i = t ? this.columnDistinctSignal() : n ? 1 : void 0;
    let r = "all";
    return (!n && this.component.resolve.scale.x === "independent" || !t && this.component.resolve.scale.y === "independent") && (r = "none"), Object.assign(Object.assign(Object.assign({}, this.getHeaderLayoutMixins()), i ? { columns: i } : {}), { bounds: "full", align: r });
  }
  assembleLayoutSignals() {
    return this.child.assembleLayoutSignals();
  }
  columnDistinctSignal() {
    if (!(this.parent && this.parent instanceof Zc))
      return { signal: `length(data('${this.getName("column_domain")}'))` };
  }
  assembleGroup(t) {
    return this.parent && this.parent instanceof Zc ? Object.assign(Object.assign({}, this.channelHasField("column") ? {
      encode: {
        update: {
          columns: { field: W(this.facet.column, { prefix: "distinct" }) }
        }
      }
    } : {}), super.assembleGroup(t)) : super.assembleGroup(t);
  }
  getCardinalityAggregateForChild() {
    const t = [], n = [], i = [];
    if (this.child instanceof Zc) {
      if (this.child.channelHasField("column")) {
        const r = W(this.child.facet.column);
        t.push(r), n.push("distinct"), i.push(`distinct_${r}`);
      }
    } else
      for (const r of pi) {
        const o = this.child.component.scales[r];
        if (o && !o.merged) {
          const a = o.get("type"), s = o.get("range");
          if (Ln(a) && Ta(s)) {
            const u = Mm(this.child, r), l = u_(u);
            l ? (t.push(l), n.push("distinct"), i.push(`distinct_${l}`)) : U(iA(r));
          }
        }
      }
    return { fields: t, ops: n, as: i };
  }
  assembleFacet() {
    const { name: t, data: n } = this.component.data.facetRoot, { row: i, column: r } = this.facet, { fields: o, ops: a, as: s } = this.getCardinalityAggregateForChild(), u = [];
    for (const c of si) {
      const f = this.facet[c];
      if (f) {
        u.push(W(f));
        const { bin: d, sort: h } = f;
        if (Ve(d) && u.push(W(f, { binSuffix: "end" })), pr(h)) {
          const { field: g, op: p = dm } = h, m = Lb(f, h);
          i && r ? (o.push(m), a.push("max"), s.push(m)) : (o.push(g), a.push(p), s.push(m));
        } else if (K(h)) {
          const g = pl(f, c);
          o.push(g), a.push("max"), s.push(g);
        }
      }
    }
    const l = !!i && !!r;
    return Object.assign({
      name: t,
      data: n,
      groupby: u
    }, l || o.length > 0 ? {
      aggregate: Object.assign(Object.assign({}, l ? { cross: l } : {}), o.length ? { fields: o, ops: a, as: s } : {})
    } : {});
  }
  facetSortFields(t) {
    const { facet: n } = this, i = n[t];
    return i ? pr(i.sort) ? [Lb(i, i.sort, { expr: "datum" })] : K(i.sort) ? [pl(i, t, { expr: "datum" })] : [W(i, { expr: "datum" })] : [];
  }
  facetSortOrder(t) {
    const { facet: n } = this, i = n[t];
    if (i) {
      const { sort: r } = i;
      return [(pr(r) ? r.order : !K(r) && r) || "ascending"];
    }
    return [];
  }
  assembleLabelTitle() {
    var t;
    const { facet: n, config: i } = this;
    if (n.facet)
      return Mb(n.facet, "facet", i);
    const r = {
      row: ["top", "bottom"],
      column: ["left", "right"]
    };
    for (const o of e_)
      if (n[o]) {
        const a = ml("labelOrient", (t = n[o]) === null || t === void 0 ? void 0 : t.header, i, o);
        if (ie(r[o], a))
          return Mb(n[o], o, i);
      }
  }
  assembleMarks() {
    const { child: t } = this, n = this.component.data.facetRoot, i = Kde(n), r = t.assembleGroupEncodeEntry(!1), o = this.assembleLabelTitle() || t.assembleTitle(), a = t.assembleGroupStyle();
    return [Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name: this.getName("cell"), type: "group" }, o ? { title: o } : {}), a ? { style: a } : {}), {
      from: {
        facet: this.assembleFacet()
      },
      sort: {
        field: si.map((u) => this.facetSortFields(u)).flat(),
        order: si.map((u) => this.facetSortOrder(u)).flat()
      }
    }), i.length > 0 ? { data: i } : {}), r ? { encode: { update: r } } : {}), t.assembleGroup(vle(this, [])))];
  }
  getMapping() {
    return this.facet;
  }
}
function ahe(e, t) {
  const { row: n, column: i } = t;
  if (n && i) {
    let r = null;
    for (const o of [n, i])
      if (pr(o.sort)) {
        const { field: a, op: s = dm } = o.sort;
        e = r = new ou(e, {
          joinaggregate: [
            {
              op: s,
              field: a,
              as: Lb(o, o.sort, { forAs: !0 })
            }
          ],
          groupby: [W(o)]
        });
      }
    return r;
  }
  return null;
}
function _j(e, t) {
  var n, i, r, o;
  for (const a of t) {
    const s = a.data;
    if (e.name && a.hasName() && e.name !== a.dataName)
      continue;
    const u = (n = e.format) === null || n === void 0 ? void 0 : n.mesh, l = (i = s.format) === null || i === void 0 ? void 0 : i.feature;
    if (u && l)
      continue;
    const c = (r = e.format) === null || r === void 0 ? void 0 : r.feature;
    if ((c || l) && c !== l)
      continue;
    const f = (o = s.format) === null || o === void 0 ? void 0 : o.mesh;
    if (!((u || f) && u !== f)) {
      if (C0(e) && C0(s)) {
        if (Tl(e.values, s.values))
          return a;
      } else if (kf(e) && kf(s)) {
        if (e.url === s.url)
          return a;
      } else if (s4(e) && e.name === a.dataName)
        return a;
    }
  }
  return null;
}
function she(e, t) {
  if (e.data || !e.parent) {
    if (e.data === null) {
      const i = new Bs({ values: [] });
      return t.push(i), i;
    }
    const n = _j(e.data, t);
    if (n)
      return vs(e.data) || (n.data.format = vR({}, e.data.format, n.data.format)), !n.hasName() && e.data.name && (n.dataName = e.data.name), n;
    {
      const i = new Bs(e.data);
      return t.push(i), i;
    }
  } else
    return e.parent.component.data.facetRoot ? e.parent.component.data.facetRoot : e.parent.component.data.main;
}
function uhe(e, t, n) {
  var i, r;
  let o = 0;
  for (const a of t.transforms) {
    let s, u;
    if (Fue(a))
      u = e = new gl(e, a), s = "derived";
    else if (c4(a)) {
      const l = Yfe(a);
      u = e = (i = Ht.makeWithAncestors(e, {}, l, n)) !== null && i !== void 0 ? i : e, e = new Pl(e, t, a.filter);
    } else if (kue(a))
      u = e = yr.makeFromTransform(e, a, t), s = "number";
    else if ($ue(a))
      s = "date", n.getWithExplicit(a.field).value === void 0 && (e = new Ht(e, { [a.field]: s }), n.set(a.field, s, !1)), u = e = mr.makeFromTransform(e, a);
    else if (Mue(a))
      u = e = Ii.makeFromTransform(e, a), s = "number", KA(t) && (e = new ba(e));
    else if (mue(a))
      u = e = Rf.make(e, t, a, o++), s = "derived";
    else if (Oue(a))
      u = e = new Il(e, a), s = "number";
    else if (Sue(a))
      u = e = new ou(e, a), s = "number";
    else if (Tue(a))
      u = e = co.makeFromTransform(e, a), s = "derived";
    else if (Nue(a))
      u = e = new Rm(e, a), s = "derived";
    else if (Cue(a))
      u = e = new Nm(e, a), s = "derived";
    else if (bue(a))
      u = e = new Im(e, a), s = "derived";
    else if (_ue(a))
      e = new Bm(e, a);
    else if (Due(a))
      u = e = bs.makeFromTransform(e, a), s = "derived";
    else if (xue(a))
      u = e = new Tm(e, a), s = "derived";
    else if (wue(a))
      u = e = new Pm(e, a), s = "derived";
    else if (Eue(a))
      u = e = new Lm(e, a), s = "derived";
    else if (Aue(a))
      u = e = new jm(e, a), s = "derived";
    else {
      U(Bre(a));
      continue;
    }
    if (u && s !== void 0)
      for (const l of (r = u.producedFields()) !== null && r !== void 0 ? r : [])
        n.set(l, s, !1);
  }
  return e;
}
function zm(e) {
  var t, n, i, r, o, a, s, u, l, c;
  let f = she(e, e.component.data.sources);
  const { outputNodes: d, outputNodeRefCounts: h } = e.component.data, g = e.parent ? e.parent.component.data.ancestorParse.clone() : new gue(), p = e.data;
  vs(p) ? (u4(p) ? f = new Nd(f, p.sequence) : GA(p) && (f = new Td(f, p.graticule)), g.parseNothing = !0) : ((t = p == null ? void 0 : p.format) === null || t === void 0 ? void 0 : t.parse) === null && (g.parseNothing = !0), f = (n = Ht.makeExplicit(f, e, g)) !== null && n !== void 0 ? n : f, f = new ba(f);
  const m = e.parent && Bl(e.parent);
  (it(e) || Bi(e)) && m && (f = (i = yr.makeFromEncoding(f, e)) !== null && i !== void 0 ? i : f), e.transforms.length > 0 && (f = uhe(f, e, g));
  const y = Vfe(e), v = Xfe(e);
  f = (r = Ht.makeWithAncestors(f, {}, Object.assign(Object.assign({}, y), v), g)) !== null && r !== void 0 ? r : f, it(e) && (f = Lu.parseAll(f, e), f = Nf.parseAll(f, e)), (it(e) || Bi(e)) && (m || (f = (o = yr.makeFromEncoding(f, e)) !== null && o !== void 0 ? o : f), f = (a = mr.makeFromEncoding(f, e)) !== null && a !== void 0 ? a : f, f = gl.parseAllForSortIndex(f, e));
  const b = e.getDataName(We.Raw), x = new pn(f, b, We.Raw, h);
  if (d[b] = x, f = x, it(e)) {
    const _ = Ii.makeFromEncoding(f, e);
    _ && (f = _, KA(e) && (f = new ba(f))), f = (s = bs.makeFromEncoding(f, e)) !== null && s !== void 0 ? s : f, f = (u = co.makeFromEncoding(f, e)) !== null && u !== void 0 ? u : f;
  }
  it(e) && (f = (l = Tf.make(f, e)) !== null && l !== void 0 ? l : f);
  const E = e.getDataName(We.Main), A = new pn(f, E, We.Main, h);
  d[E] = A, f = A, it(e) && Uce(e, A);
  let w = null;
  if (Bi(e)) {
    const _ = e.getName("facet");
    f = (c = ahe(f, e.facet)) !== null && c !== void 0 ? c : f, w = new Ll(f, e, _, A.getSource()), d[_] = w;
  }
  return Object.assign(Object.assign({}, e.component.data), {
    outputNodes: d,
    outputNodeRefCounts: h,
    raw: x,
    main: A,
    facetRoot: w,
    ancestorParse: g
  });
}
class lhe extends c_ {
  constructor(t, n, i, r) {
    var o, a, s, u;
    super(t, "concat", n, i, r, t.resolve), (((a = (o = t.resolve) === null || o === void 0 ? void 0 : o.axis) === null || a === void 0 ? void 0 : a.x) === "shared" || ((u = (s = t.resolve) === null || s === void 0 ? void 0 : s.axis) === null || u === void 0 ? void 0 : u.y) === "shared") && U(Pre), this.children = this.getChildren(t).map((l, c) => m_(l, this, this.getName("concat_" + c), void 0, r));
  }
  parseData() {
    this.component.data = zm(this);
    for (const t of this.children)
      t.parseData();
  }
  parseSelections() {
    this.component.selection = {};
    for (const t of this.children) {
      t.parseSelections();
      for (const n of B(t.component.selection))
        this.component.selection[n] = t.component.selection[n];
    }
  }
  parseMarkGroup() {
    for (const t of this.children)
      t.parseMarkGroup();
  }
  parseAxesAndHeaders() {
    for (const t of this.children)
      t.parseAxesAndHeaders();
  }
  getChildren(t) {
    return wm(t) ? t.vconcat : qA(t) ? t.hconcat : t.concat;
  }
  parseLayoutSize() {
    nhe(this);
  }
  parseAxisGroup() {
    return null;
  }
  assembleSelectionTopLevelSignals(t) {
    return this.children.reduce((n, i) => i.assembleSelectionTopLevelSignals(n), t);
  }
  assembleSignals() {
    return this.children.forEach((t) => t.assembleSignals()), [];
  }
  assembleLayoutSignals() {
    const t = n_(this);
    for (const n of this.children)
      t.push(...n.assembleLayoutSignals());
    return t;
  }
  assembleSelectionData(t) {
    return this.children.reduce((n, i) => i.assembleSelectionData(n), t);
  }
  assembleMarks() {
    return this.children.map((t) => {
      const n = t.assembleTitle(), i = t.assembleGroupStyle(), r = t.assembleGroupEncodeEntry(!1);
      return Object.assign(Object.assign(Object.assign(Object.assign({ type: "group", name: t.getName("group") }, n ? { title: n } : {}), i ? { style: i } : {}), r ? { encode: { update: r } } : {}), t.assembleGroup());
    });
  }
  assembleDefaultLayout() {
    const t = this.layout.columns;
    return Object.assign(Object.assign({}, t != null ? { columns: t } : {}), {
      bounds: "full",
      align: "each"
    });
  }
}
function che(e) {
  return e === !1 || e === null;
}
const fhe = Object.assign(Object.assign({ disable: 1, gridScale: 1, scale: 1 }, SR), { labelExpr: 1, encode: 1 }), Oj = B(fhe);
class d_ extends Oo {
  constructor(t = {}, n = {}, i = !1) {
    super(), this.explicit = t, this.implicit = n, this.mainExtracted = i;
  }
  clone() {
    return new d_(pe(this.explicit), pe(this.implicit), this.mainExtracted);
  }
  hasAxisPart(t) {
    return t === "axis" ? !0 : t === "grid" || t === "title" ? !!this.get(t) : !che(this.get(t));
  }
  hasOrientSignalRef() {
    return se(this.explicit.orient);
  }
}
function dhe(e, t, n) {
  var i;
  const { encoding: r, config: o } = e, a = (i = vt(r[t])) !== null && i !== void 0 ? i : vt(r[Pr(t)]), s = e.axis(t) || {}, { format: u, formatType: l } = s;
  return Rs(l) ? Object.assign({ text: _A({
    fieldOrDatumDef: a,
    field: "datum.value",
    format: u,
    formatType: l,
    config: o
  }) }, n) : n;
}
function hhe(e) {
  return pi.reduce((t, n) => (e.component.scales[n] && (t[n] = [xhe(n, e)]), t), {});
}
const ghe = {
  bottom: "top",
  top: "bottom",
  left: "right",
  right: "left"
};
function phe(e) {
  var t;
  const { axes: n, resolve: i } = e.component, r = { top: 0, bottom: 0, right: 0, left: 0 };
  for (const o of e.children) {
    o.parseAxesAndHeaders();
    for (const a of B(o.component.axes))
      i.axis[a] = i_(e.component.resolve, a), i.axis[a] === "shared" && (n[a] = mhe(n[a], o.component.axes[a]), n[a] || (i.axis[a] = "independent", delete n[a]));
  }
  for (const o of pi) {
    for (const a of e.children)
      if (!!a.component.axes[o]) {
        if (i.axis[o] === "independent") {
          n[o] = ((t = n[o]) !== null && t !== void 0 ? t : []).concat(a.component.axes[o]);
          for (const s of a.component.axes[o]) {
            const { value: u, explicit: l } = s.getWithExplicit("orient");
            if (!se(u)) {
              if (r[u] > 0 && !l) {
                const c = ghe[u];
                r[u] > r[c] && s.set("orient", c, !1);
              }
              r[u]++;
            }
          }
        }
        delete a.component.axes[o];
      }
    if (i.axis[o] === "independent" && n[o] && n[o].length > 1)
      for (const a of n[o])
        !!a.get("grid") && !a.explicit.grid && (a.implicit.grid = !1);
  }
}
function mhe(e, t) {
  if (e) {
    if (e.length !== t.length)
      return;
    const n = e.length;
    for (let i = 0; i < n; i++) {
      const r = e[i], o = t[i];
      if (!!r != !!o)
        return;
      if (r && o) {
        const a = r.getWithExplicit("orient"), s = o.getWithExplicit("orient");
        if (a.explicit && s.explicit && a.value !== s.value)
          return;
        e[i] = yhe(r, o);
      }
    }
  } else
    return t.map((n) => n.clone());
  return e;
}
function yhe(e, t) {
  for (const n of Oj) {
    const i = ma(
      e.getWithExplicit(n),
      t.getWithExplicit(n),
      n,
      "axis",
      (r, o) => {
        switch (n) {
          case "title":
            return N8(r, o);
          case "gridScale":
            return {
              explicit: r.explicit,
              value: ct(r.value, o.value)
            };
        }
        return Am(r, o, n, "axis");
      }
    );
    e.setWithExplicit(n, i);
  }
  return e;
}
function vhe(e, t, n, i, r) {
  if (t === "disable")
    return n !== void 0;
  switch (n = n || {}, t) {
    case "titleAngle":
    case "labelAngle":
      return e === (se(n.labelAngle) ? n.labelAngle : Sf(n.labelAngle));
    case "values":
      return !!n.values;
    case "encode":
      return !!n.encoding || !!n.labelAngle;
    case "title":
      if (e === Y4(i, r))
        return !0;
  }
  return e === n[t];
}
const bhe = /* @__PURE__ */ new Set([
  "grid",
  "translate",
  "format",
  "formatType",
  "orient",
  "labelExpr",
  "tickCount",
  "position",
  "tickMinStep"
]);
function xhe(e, t) {
  var n, i, r;
  let o = t.axis(e);
  const a = new d_(), s = vt(t.encoding[e]), { mark: u, config: l } = t, c = (o == null ? void 0 : o.orient) || ((n = l[e === "x" ? "axisX" : "axisY"]) === null || n === void 0 ? void 0 : n.orient) || ((i = l.axis) === null || i === void 0 ? void 0 : i.orient) || Qce(e), f = t.getScaleComponent(e).get("type"), d = Gce(e, f, c, t.config), h = o !== void 0 ? !o : Db("disable", l.style, o == null ? void 0 : o.style, d).configValue;
  if (a.set("disable", h, o !== void 0), h)
    return a;
  o = o || {};
  const g = Vce(s, o, e, l.style, d), p = {
    fieldOrDatumDef: s,
    axis: o,
    channel: e,
    model: t,
    scaleType: f,
    orient: c,
    labelAngle: g,
    mark: u,
    config: l
  };
  for (const v of Oj) {
    const b = v in ck ? ck[v](p) : pF(v) ? o[v] : void 0, x = b !== void 0, E = vhe(b, v, o, t, e);
    if (x && E)
      a.set(v, b, E);
    else {
      const { configValue: A = void 0, configFrom: w = void 0 } = pF(v) && v !== "values" ? Db(v, l.style, o.style, d) : {}, _ = A !== void 0;
      x && !_ ? a.set(v, b, E) : (w !== "vgAxisConfig" || bhe.has(v) && _ || vd(A) || se(A)) && a.set(v, A, !1);
    }
  }
  const m = (r = o.encoding) !== null && r !== void 0 ? r : {}, y = OR.reduce((v, b) => {
    var x;
    if (!a.hasAxisPart(b))
      return v;
    const E = Z4((x = m[b]) !== null && x !== void 0 ? x : {}, t), A = b === "labels" ? dhe(t, e, E) : E;
    return A !== void 0 && !Ie(A) && (v[b] = { update: A }), v;
  }, {});
  return Ie(y) || a.set("encode", y, !!o.encoding || o.labelAngle !== void 0), a;
}
function whe({ encoding: e, size: t }) {
  for (const n of pi) {
    const i = Lr(n);
    _r(t[i]) && cr(e[n]) && (delete t[i], U(qR(i)));
  }
  return t;
}
function Ehe(e, t, n) {
  const i = Ci(e), r = Re("orient", i, n);
  if (i.orient = She(i.type, t, r), r !== void 0 && r !== i.orient && U(Zre(i.orient, r)), i.type === "bar" && i.orient) {
    const s = Re("cornerRadiusEnd", i, n);
    if (s !== void 0) {
      const u = i.orient === "horizontal" && t.x2 || i.orient === "vertical" && t.y2 ? ["cornerRadius"] : Fae[i.orient];
      for (const l of u)
        i[l] = s;
      i.cornerRadiusEnd !== void 0 && delete i.cornerRadiusEnd;
    }
  }
  return Re("opacity", i, n) === void 0 && (i.opacity = _he(i.type, t)), Re("cursor", i, n) === void 0 && (i.cursor = Ahe(i, t, n)), i;
}
function Ahe(e, t, n) {
  return t.href || e.href || Re("href", e, n) ? "pointer" : e.cursor;
}
function _he(e, t) {
  if (ie([cm, vA, bA, xA], e) && !NA(t))
    return 0.7;
}
function Ohe(e, t, { graticule: n }) {
  if (n)
    return !1;
  const i = js("filled", e, t), r = e.type;
  return ct(i, r !== cm && r !== lm && r !== x0);
}
function She(e, t, n) {
  switch (e) {
    case cm:
    case bA:
    case xA:
    case i8:
    case bae:
    case vae:
      return;
  }
  const { x: i, y: r, x2: o, y2: a } = t;
  switch (e) {
    case um:
      if (G(i) && (cn(i.bin) || G(r) && r.aggregate && !i.aggregate))
        return "vertical";
      if (G(r) && (cn(r.bin) || G(i) && i.aggregate && !r.aggregate))
        return "horizontal";
      if (a || o) {
        if (n)
          return n;
        if (!o && (G(i) && i.type === Ns && !Ve(i.bin) || bb(i)))
          return "horizontal";
        if (!a && (G(r) && r.type === Ns && !Ve(r.bin) || bb(r)))
          return "vertical";
      }
    case x0:
      if (o && !(G(i) && cn(i.bin)) && a && !(G(r) && cn(r.bin)))
        return;
    case sm:
      if (a)
        return G(r) && cn(r.bin) ? "horizontal" : "vertical";
      if (o)
        return G(i) && cn(i.bin) ? "vertical" : "horizontal";
      if (e === x0) {
        if (i && !r)
          return "vertical";
        if (r && !i)
          return "horizontal";
      }
    case lm:
    case vA: {
      const s = cr(i), u = cr(r);
      if (s && !u)
        return e !== "tick" ? "horizontal" : "vertical";
      if (!s && u)
        return e !== "tick" ? "vertical" : "horizontal";
      if (s && u) {
        const l = i, c = r, f = l.type === cl, d = c.type === cl;
        return f && !d ? e !== "tick" ? "vertical" : "horizontal" : !f && d ? e !== "tick" ? "horizontal" : "vertical" : !l.aggregate && c.aggregate ? e !== "tick" ? "vertical" : "horizontal" : l.aggregate && !c.aggregate ? e !== "tick" ? "horizontal" : "vertical" : n || "vertical";
      } else
        return n || void 0;
    }
  }
  return "vertical";
}
const Che = {
  vgMark: "arc",
  encodeEntry: (e) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bi(e, {
    align: "ignore",
    baseline: "ignore",
    color: "include",
    size: "ignore",
    orient: "ignore",
    theta: "ignore"
  })), Gt("x", e, { defaultPos: "mid" })), Gt("y", e, { defaultPos: "mid" })), ya(e, "radius", "arc")), ya(e, "theta", "arc"))
}, Fhe = {
  vgMark: "area",
  encodeEntry: (e) => Object.assign(Object.assign(Object.assign(Object.assign({}, bi(e, {
    align: "ignore",
    baseline: "ignore",
    color: "include",
    orient: "include",
    size: "ignore",
    theta: "ignore"
  })), D0("x", e, {
    defaultPos: "zeroOrMin",
    defaultPos2: "zeroOrMin",
    range: e.markDef.orient === "horizontal"
  })), D0("y", e, {
    defaultPos: "zeroOrMin",
    defaultPos2: "zeroOrMin",
    range: e.markDef.orient === "vertical"
  })), XA(e))
}, khe = {
  vgMark: "rect",
  encodeEntry: (e) => Object.assign(Object.assign(Object.assign({}, bi(e, {
    align: "ignore",
    baseline: "ignore",
    color: "include",
    orient: "ignore",
    size: "ignore",
    theta: "ignore"
  })), ya(e, "x", "bar")), ya(e, "y", "bar"))
}, Dhe = {
  vgMark: "shape",
  encodeEntry: (e) => Object.assign({}, bi(e, {
    align: "ignore",
    baseline: "ignore",
    color: "include",
    size: "ignore",
    orient: "ignore",
    theta: "ignore"
  })),
  postEncodingTransform: (e) => {
    const { encoding: t } = e, n = t.shape;
    return [Object.assign({ type: "geoshape", projection: e.projectionName() }, n && G(n) && n.type === Nl ? { field: W(n, { expr: "datum" }) } : {})];
  }
}, $he = {
  vgMark: "image",
  encodeEntry: (e) => Object.assign(Object.assign(Object.assign(Object.assign({}, bi(e, {
    align: "ignore",
    baseline: "ignore",
    color: "ignore",
    orient: "ignore",
    size: "ignore",
    theta: "ignore"
  })), ya(e, "x", "image")), ya(e, "y", "image")), HA(e, "url"))
}, Mhe = {
  vgMark: "line",
  encodeEntry: (e) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bi(e, {
    align: "ignore",
    baseline: "ignore",
    color: "include",
    size: "ignore",
    orient: "ignore",
    theta: "ignore"
  })), Gt("x", e, { defaultPos: "mid" })), Gt("y", e, { defaultPos: "mid" })), At("size", e, {
    vgChannel: "strokeWidth"
  })), XA(e))
}, The = {
  vgMark: "trail",
  encodeEntry: (e) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bi(e, {
    align: "ignore",
    baseline: "ignore",
    color: "include",
    size: "include",
    orient: "ignore",
    theta: "ignore"
  })), Gt("x", e, { defaultPos: "mid" })), Gt("y", e, { defaultPos: "mid" })), At("size", e)), XA(e))
};
function h_(e, t) {
  const { config: n } = e;
  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bi(e, {
    align: "ignore",
    baseline: "ignore",
    color: "include",
    size: "include",
    orient: "ignore",
    theta: "ignore"
  })), Gt("x", e, { defaultPos: "mid" })), Gt("y", e, { defaultPos: "mid" })), At("size", e)), At("angle", e)), Nhe(e, n, t));
}
function Nhe(e, t, n) {
  return n ? { shape: { value: n } } : At("shape", e);
}
const Rhe = {
  vgMark: "symbol",
  encodeEntry: (e) => h_(e)
}, jhe = {
  vgMark: "symbol",
  encodeEntry: (e) => h_(e, "circle")
}, Phe = {
  vgMark: "symbol",
  encodeEntry: (e) => h_(e, "square")
}, Lhe = {
  vgMark: "rect",
  encodeEntry: (e) => Object.assign(Object.assign(Object.assign({}, bi(e, {
    align: "ignore",
    baseline: "ignore",
    color: "include",
    orient: "ignore",
    size: "ignore",
    theta: "ignore"
  })), ya(e, "x", "rect")), ya(e, "y", "rect"))
}, Ihe = {
  vgMark: "rule",
  encodeEntry: (e) => {
    const { markDef: t } = e, n = t.orient;
    return !e.encoding.x && !e.encoding.y && !e.encoding.latitude && !e.encoding.longitude ? {} : Object.assign(Object.assign(Object.assign(Object.assign({}, bi(e, {
      align: "ignore",
      baseline: "ignore",
      color: "include",
      orient: "ignore",
      size: "ignore",
      theta: "ignore"
    })), D0("x", e, {
      defaultPos: n === "horizontal" ? "zeroOrMax" : "mid",
      defaultPos2: "zeroOrMin",
      range: n !== "vertical"
    })), D0("y", e, {
      defaultPos: n === "vertical" ? "zeroOrMax" : "mid",
      defaultPos2: "zeroOrMin",
      range: n !== "horizontal"
    })), At("size", e, {
      vgChannel: "strokeWidth"
    }));
  }
}, Bhe = {
  vgMark: "text",
  encodeEntry: (e) => {
    const { config: t, encoding: n } = e;
    return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bi(e, {
      align: "include",
      baseline: "include",
      color: "include",
      size: "ignore",
      orient: "ignore",
      theta: "include"
    })), Gt("x", e, { defaultPos: "mid" })), Gt("y", e, { defaultPos: "mid" })), HA(e)), At("size", e, {
      vgChannel: "fontSize"
    })), At("angle", e)), QF("align", zhe(e.markDef, n, t))), QF("baseline", Uhe(e.markDef, n, t))), Gt("radius", e, { defaultPos: null, isMidPoint: !0 })), Gt("theta", e, { defaultPos: null, isMidPoint: !0 }));
  }
};
function zhe(e, t, n) {
  if (Re("align", e, n) === void 0)
    return "center";
}
function Uhe(e, t, n) {
  if (Re("baseline", e, n) === void 0)
    return "middle";
}
const qhe = {
  vgMark: "rect",
  encodeEntry: (e) => {
    const { config: t, markDef: n } = e, i = n.orient, r = i === "horizontal" ? "width" : "height", o = i === "horizontal" ? "height" : "width";
    return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bi(e, {
      align: "ignore",
      baseline: "ignore",
      color: "include",
      orient: "ignore",
      size: "ignore",
      theta: "ignore"
    })), Gt("x", e, { defaultPos: "mid", vgChannel: "xc" })), Gt("y", e, { defaultPos: "mid", vgChannel: "yc" })), At("size", e, {
      defaultValue: Whe(e),
      vgChannel: r
    })), { [o]: Ze(Re("thickness", n, t)) });
  }
};
function Whe(e) {
  var t;
  const { config: n, markDef: i } = e, { orient: r } = i, o = r === "horizontal" ? "width" : "height", a = e.getScaleComponent(r === "horizontal" ? "x" : "y"), s = (t = Re("size", i, n, { vgChannel: o })) !== null && t !== void 0 ? t : n.tick.bandSize;
  if (s !== void 0)
    return s;
  {
    const u = a ? a.get("range") : void 0;
    return u && Ta(u) && ht(u.step) ? u.step * 3 / 4 : S0(n.view, o) * 3 / 4;
  }
}
const mh = {
  arc: Che,
  area: Fhe,
  bar: khe,
  circle: jhe,
  geoshape: Dhe,
  image: $he,
  line: Mhe,
  point: Rhe,
  rect: Lhe,
  rule: Ihe,
  square: Phe,
  text: Bhe,
  tick: qhe,
  trail: The
};
function Ghe(e) {
  if (ie([lm, sm, xae], e.mark)) {
    const t = j8(e.mark, e.encoding);
    if (t.length > 0)
      return Hhe(e, t);
  } else if (ie([um], e.mark)) {
    const t = pb.some((n) => Re(n, e.markDef, e.config));
    if (e.stack && !e.fieldDef("size") && t)
      return Yhe(e);
  }
  return g_(e);
}
const Sk = "faceted_path_";
function Hhe(e, t) {
  return [
    {
      name: e.getName("pathgroup"),
      type: "group",
      from: {
        facet: {
          name: Sk + e.requestDataName(We.Main),
          data: e.requestDataName(We.Main),
          groupby: t
        }
      },
      encode: {
        update: {
          width: { field: { group: "width" } },
          height: { field: { group: "height" } }
        }
      },
      marks: g_(e, { fromPrefix: Sk })
    }
  ];
}
const Ck = "stack_group_";
function Yhe(e) {
  const [t] = g_(e, { fromPrefix: Ck }), n = e.scaleName(e.stack.fieldChannel), i = (c = {}) => e.vgField(e.stack.fieldChannel, c), r = (c, f) => {
    const d = [
      i({ prefix: "min", suffix: "start", expr: f }),
      i({ prefix: "max", suffix: "start", expr: f }),
      i({ prefix: "min", suffix: "end", expr: f }),
      i({ prefix: "max", suffix: "end", expr: f })
    ];
    return `${c}(${d.map((h) => `scale('${n}',${h})`).join(",")})`;
  };
  let o, a;
  e.stack.fieldChannel === "x" ? (o = Object.assign(Object.assign({}, al(t.encode.update, ["y", "yc", "y2", "height", ...pb])), { x: { signal: r("min", "datum") }, x2: { signal: r("max", "datum") }, clip: { value: !0 } }), a = {
    x: { field: { group: "x" }, mult: -1 },
    height: { field: { group: "height" } }
  }, t.encode.update = Object.assign(Object.assign({}, Xn(t.encode.update, ["y", "yc", "y2"])), { height: { field: { group: "height" } } })) : (o = Object.assign(Object.assign({}, al(t.encode.update, ["x", "xc", "x2", "width"])), { y: { signal: r("min", "datum") }, y2: { signal: r("max", "datum") }, clip: { value: !0 } }), a = {
    y: { field: { group: "y" }, mult: -1 },
    width: { field: { group: "width" } }
  }, t.encode.update = Object.assign(Object.assign({}, Xn(t.encode.update, ["x", "xc", "x2"])), { width: { field: { group: "width" } } }));
  for (const c of pb) {
    const f = js(c, e.markDef, e.config);
    t.encode.update[c] ? (o[c] = t.encode.update[c], delete t.encode.update[c]) : f && (o[c] = Ze(f)), f && (t.encode.update[c] = { value: 0 });
  }
  const s = e.fieldDef(e.stack.groupbyChannel), u = W(s) ? [W(s)] : [];
  return ((s == null ? void 0 : s.bin) || (s == null ? void 0 : s.timeUnit)) && u.push(W(s, { binSuffix: "end" })), o = [
    "stroke",
    "strokeWidth",
    "strokeJoin",
    "strokeCap",
    "strokeDash",
    "strokeDashOffset",
    "strokeMiterLimit",
    "strokeOpacity"
  ].reduce((c, f) => {
    if (t.encode.update[f])
      return Object.assign(Object.assign({}, c), { [f]: t.encode.update[f] });
    {
      const d = js(f, e.markDef, e.config);
      return d !== void 0 ? Object.assign(Object.assign({}, c), { [f]: Ze(d) }) : c;
    }
  }, o), o.stroke && (o.strokeForeground = { value: !0 }, o.strokeOffset = { value: 0 }), [
    {
      type: "group",
      from: {
        facet: {
          data: e.requestDataName(We.Main),
          name: Ck + e.requestDataName(We.Main),
          groupby: u,
          aggregate: {
            fields: [
              i({ suffix: "start" }),
              i({ suffix: "start" }),
              i({ suffix: "end" }),
              i({ suffix: "end" })
            ],
            ops: ["min", "max", "min", "max"]
          }
        }
      },
      encode: {
        update: o
      },
      marks: [
        {
          type: "group",
          encode: { update: a },
          marks: [t]
        }
      ]
    }
  ];
}
function Xhe(e) {
  const { encoding: t, stack: n, mark: i, markDef: r, config: o } = e, a = t.order;
  if (!(!K(a) && Wi(a) && db(a.value) || !a && db(Re("order", r, o)))) {
    if ((K(a) || G(a)) && !n)
      return $8(a, { expr: "datum" });
    if (Na(i)) {
      const s = r.orient === "horizontal" ? "y" : "x", u = t[s];
      if (G(u)) {
        const l = u.sort;
        if (K(l))
          return {
            field: W(u, { prefix: s, suffix: "sort_index", expr: "datum" })
          };
        if (pr(l))
          return {
            field: W({
              aggregate: NA(e.encoding) ? l.op : void 0,
              field: l.field
            }, { expr: "datum" })
          };
        if (m8(l)) {
          const c = e.fieldDef(l.encoding);
          return {
            field: W(c, { expr: "datum" }),
            order: l.order
          };
        } else
          return l === null ? void 0 : {
            field: W(u, {
              binSuffix: e.stack && e.stack.impute ? "mid" : void 0,
              expr: "datum"
            })
          };
      }
      return;
    }
  }
}
function g_(e, t = { fromPrefix: "" }) {
  const { mark: n, markDef: i, encoding: r, config: o } = e, a = ct(i.clip, Vhe(e), Khe(e)), s = k8(i), u = r.key, l = Xhe(e), c = Jhe(e), f = Re("aria", i, o), d = mh[n].postEncodingTransform ? mh[n].postEncodingTransform(e) : null;
  return [
    Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name: e.getName("marks"), type: mh[n].vgMark }, a ? { clip: !0 } : {}), s ? { style: s } : {}), u ? { key: u.field } : {}), l ? { sort: l } : {}), c || {}), f === !1 ? { aria: f } : {}), { from: { data: t.fromPrefix + e.requestDataName(We.Main) }, encode: {
      update: mh[n].encodeEntry(e)
    } }), d ? {
      transform: d
    } : {})
  ];
}
function Vhe(e) {
  const t = e.getScaleComponent("x"), n = e.getScaleComponent("y");
  return t && t.get("selectionExtent") || n && n.get("selectionExtent") ? !0 : void 0;
}
function Khe(e) {
  const t = e.component.projection;
  return t && !t.isFit ? !0 : void 0;
}
function Jhe(e) {
  if (!e.component.selection)
    return null;
  const t = B(e.component.selection).length;
  let n = t, i = e.parent;
  for (; i && n === 0; )
    n = B(i.component.selection).length, i = i.parent;
  return n ? {
    interactive: t > 0 || !!e.encoding.tooltip
  } : null;
}
class Sj extends wj {
  constructor(t, n, i, r = {}, o) {
    super(t, "unit", n, i, o, void 0, jF(t) ? t.view : void 0), this.specifiedScales = {}, this.specifiedAxes = {}, this.specifiedLegends = {}, this.specifiedProjection = {}, this.selection = {}, this.children = [];
    const a = mo(t.mark) ? Object.assign({}, t.mark) : { type: t.mark }, s = a.type;
    a.filled === void 0 && (a.filled = Ohe(a, o, {
      graticule: t.data && GA(t.data)
    }));
    const u = this.encoding = nse(t.encoding || {}, s, a.filled, o);
    this.markDef = Ehe(a, u, o), this.size = whe({
      encoding: u,
      size: jF(t) ? Object.assign(Object.assign(Object.assign({}, r), t.width ? { width: t.width } : {}), t.height ? { height: t.height } : {}) : r
    }), this.stack = t4(s, u), this.specifiedScales = this.initScales(s, u), this.specifiedAxes = this.initAxes(u), this.specifiedLegends = this.initLegends(u), this.specifiedProjection = t.projection, this.selection = t.selection;
  }
  get hasProjection() {
    const { encoding: t } = this, n = this.mark === r8, i = t && dre.some((r) => ue(t[r]));
    return n || i;
  }
  scaleDomain(t) {
    const n = this.specifiedScales[t];
    return n ? n.domain : void 0;
  }
  axis(t) {
    return this.specifiedAxes[t];
  }
  legend(t) {
    return this.specifiedLegends[t];
  }
  initScales(t, n) {
    return rm.reduce((i, r) => {
      var o;
      const a = vt(n[r]);
      return a && (i[r] = this.initScale((o = a.scale) !== null && o !== void 0 ? o : {})), i;
    }, {});
  }
  initScale(t) {
    const { domain: n, range: i } = t, r = Ci(t);
    return K(n) && (r.domain = n.map(dn)), K(i) && (r.range = i.map(dn)), r;
  }
  initAxes(t) {
    return pi.reduce((n, i) => {
      const r = t[i];
      if (ue(r) || i === et && ue(t.x2) || i === xt && ue(t.y2)) {
        const o = ue(r) ? r.axis : void 0;
        n[i] = o && this.initAxis(Object.assign({}, o));
      }
      return n;
    }, {});
  }
  initAxis(t) {
    const n = B(t), i = {};
    for (const r of n) {
      const o = t[r];
      i[r] = vd(o) ? F8(o) : dn(o);
    }
    return i;
  }
  initLegends(t) {
    return wre.reduce((n, i) => {
      const r = vt(t[i]);
      if (r && Are(i)) {
        const o = r.legend;
        n[i] = o && Ci(o);
      }
      return n;
    }, {});
  }
  parseData() {
    this.component.data = zm(this);
  }
  parseLayoutSize() {
    ihe(this);
  }
  parseSelections() {
    this.component.selection = zce(this, this.selection);
  }
  parseMarkGroup() {
    this.component.mark = Ghe(this);
  }
  parseAxesAndHeaders() {
    this.component.axes = hhe(this);
  }
  assembleSelectionTopLevelSignals(t) {
    return ble(this, t);
  }
  assembleSignals() {
    return [...W4(this), ...yle(this, [])];
  }
  assembleSelectionData(t) {
    return xle(this, t);
  }
  assembleLayout() {
    return null;
  }
  assembleLayoutSignals() {
    return n_(this);
  }
  assembleMarks() {
    var t;
    let n = (t = this.component.mark) !== null && t !== void 0 ? t : [];
    return (!this.parent || !Bl(this.parent)) && (n = D4(this, n)), n.map(this.correctDataNames);
  }
  getMapping() {
    return this.encoding;
  }
  get mark() {
    return this.markDef.type;
  }
  channelHasField(t) {
    return ys(this.encoding, t);
  }
  fieldDef(t) {
    const n = this.encoding[t];
    return Ar(n);
  }
  typedFieldDef(t) {
    const n = this.fieldDef(t);
    return yi(n) ? n : null;
  }
}
class p_ extends c_ {
  constructor(t, n, i, r, o) {
    super(t, "layer", n, i, o, t.resolve, t.view);
    const a = Object.assign(Object.assign(Object.assign({}, r), t.width ? { width: t.width } : {}), t.height ? { height: t.height } : {});
    this.children = t.layer.map((s, u) => {
      if (Em(s))
        return new p_(s, this, this.getName("layer_" + u), a, o);
      if (_o(s))
        return new Sj(s, this, this.getName("layer_" + u), a, o);
      throw new Error(nA(s));
    });
  }
  parseData() {
    this.component.data = zm(this);
    for (const t of this.children)
      t.parseData();
  }
  parseLayoutSize() {
    the(this);
  }
  parseSelections() {
    this.component.selection = {};
    for (const t of this.children) {
      t.parseSelections();
      for (const n of B(t.component.selection))
        this.component.selection[n] = t.component.selection[n];
    }
  }
  parseMarkGroup() {
    for (const t of this.children)
      t.parseMarkGroup();
  }
  parseAxesAndHeaders() {
    phe(this);
  }
  assembleSelectionTopLevelSignals(t) {
    return this.children.reduce((n, i) => i.assembleSelectionTopLevelSignals(n), t);
  }
  assembleSignals() {
    return this.children.reduce((t, n) => t.concat(n.assembleSignals()), W4(this));
  }
  assembleLayoutSignals() {
    return this.children.reduce((t, n) => t.concat(n.assembleLayoutSignals()), n_(this));
  }
  assembleSelectionData(t) {
    return this.children.reduce((n, i) => i.assembleSelectionData(n), t);
  }
  assembleTitle() {
    let t = super.assembleTitle();
    if (t)
      return t;
    for (const n of this.children)
      if (t = n.assembleTitle(), t)
        return t;
  }
  assembleLayout() {
    return null;
  }
  assembleMarks() {
    return wle(this, this.children.flatMap((t) => t.assembleMarks()));
  }
  assembleLegends() {
    return this.children.reduce((t, n) => t.concat(n.assembleLegends()), aj(this));
  }
}
function m_(e, t, n, i, r) {
  if (hm(e))
    return new Zc(e, t, n, r);
  if (Em(e))
    return new p_(e, t, n, i, r);
  if (_o(e))
    return new Sj(e, t, n, i, r);
  if (Cse(e))
    return new lhe(e, t, n, r);
  throw new Error(nA(e));
}
var Qhe = globalThis && globalThis.__rest || function(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
};
function Zhe(e, t = {}) {
  t.logger && _oe(t.logger), t.fieldTitle && _8(t.fieldTitle);
  try {
    const n = e4(mR(t.config, e.config)), i = o4(e, n), r = m_(i, null, "", void 0, n);
    return r.parse(), fde(r.component.data, r), {
      spec: tge(r, ege(e, i.autosize, n, r), e.datasets, e.usermeta),
      normalized: i
    };
  } finally {
    t.logger && Ooe(), t.fieldTitle && Yae();
  }
}
function ege(e, t, n, i) {
  const r = i.component.layoutSize.get("width"), o = i.component.layoutSize.get("height");
  if (t === void 0 ? (t = { type: "pad" }, i.hasAxisOrientSignalRef() && (t.resize = !0)) : ge(t) && (t = { type: t }), r && o && fue(t.type)) {
    if (r === "step" && o === "step")
      U(bF()), t.type = "pad";
    else if (r === "step" || o === "step") {
      const a = r === "step" ? "width" : "height";
      U(bF(im(a)));
      const s = a === "width" ? "height" : "width";
      t.type = due(s);
    }
  }
  return Object.assign(Object.assign(Object.assign({}, B(t).length === 1 && t.type ? t.type === "pad" ? {} : { autosize: t.type } : { autosize: t }), XF(n, !1)), XF(e, !0));
}
function tge(e, t, n = {}, i) {
  const r = e.config ? Use(e.config) : void 0, o = [].concat(
    e.assembleSelectionData([]),
    Jde(e.component.data, n)
  ), a = e.assembleProjections(), s = e.assembleTitle(), u = e.assembleGroupStyle(), l = e.assembleGroupEncodeEntry(!0);
  let c = e.assembleLayoutSignals();
  c = c.filter((h) => (h.name === "width" || h.name === "height") && h.value !== void 0 ? (t[h.name] = +h.value, !1) : !0);
  const { params: f } = t, d = Qhe(t, ["params"]);
  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ $schema: "https://vega.github.io/schema/vega/v5.json" }, e.description ? { description: e.description } : {}), d), s ? { title: s } : {}), u ? { style: u } : {}), l ? { encode: { update: l } } : {}), { data: o }), a.length > 0 ? { projections: a } : {}), e.assembleGroup([
    ...c,
    ...e.assembleSelectionTopLevelSignals([]),
    ...Q8(f)
  ])), r ? { config: r } : {}), i ? { usermeta: i } : {});
}
const nge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  normalize: o4,
  version: Tie,
  compile: Zhe,
  deepEqual: Tl,
  duplicate: pe,
  pick: al,
  omit: Xn,
  stringify: Ge,
  hash: we,
  isNullOrFalse: db,
  contains: ie,
  some: sl,
  every: HE,
  mergeDeep: vR,
  unique: lr,
  isEqual: Kie,
  setEqual: bR,
  hasIntersection: YE,
  prefixGenerator: hb,
  fieldIntersection: XE,
  isEmpty: Ie,
  keys: B,
  vals: oo,
  entries: md,
  isBoolean: Of,
  varName: Xe,
  logicalExpr: Ru,
  deleteNestedProperty: y0,
  titleCase: yd,
  accessPathWithDatum: VE,
  flatAccessWithDatum: xR,
  replacePathInField: go,
  replaceAll: Ms,
  removePathFromField: KE,
  accessPathDepth: ul,
  getFirstDefined: ct,
  uniqueId: ER,
  resetIdCounter: Qie,
  internalField: AR,
  isInternalField: _R,
  normalizeAngle: Sf,
  isNumeric: Jp
}, Symbol.toStringTag, { value: "Module" }));
function Cj(e) {
  const [t, n] = /schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1, 3);
  return { library: t, version: n };
}
var ige = "vega-themes", rge = "2.10.0", oge = "Themes for stylized Vega and Vega-Lite visualizations.", age = [
  "vega",
  "vega-lite",
  "themes",
  "style"
], sge = "BSD-3-Clause", uge = {
  name: "UW Interactive Data Lab",
  url: "https://idl.cs.washington.edu"
}, lge = [
  {
    name: "Emily Gu",
    url: "https://github.com/emilygu"
  },
  {
    name: "Arvind Satyanarayan",
    url: "http://arvindsatya.com"
  },
  {
    name: "Jeffrey Heer",
    url: "https://idl.cs.washington.edu"
  },
  {
    name: "Dominik Moritz",
    url: "https://www.domoritz.de"
  }
], cge = "build/vega-themes.js", fge = "build/vega-themes.module.js", dge = "build/vega-themes.min.js", hge = "build/vega-themes.min.js", gge = "build/vega-themes.module.d.ts", pge = {
  type: "git",
  url: "https://github.com/vega/vega-themes.git"
}, mge = [
  "src",
  "build"
], yge = {
  prebuild: "yarn clean",
  build: "rollup -c",
  clean: "rimraf build && rimraf examples/build",
  "copy:data": "rsync -r node_modules/vega-datasets/data/* examples/data",
  "copy:build": "rsync -r build/* examples/build",
  "deploy:gh": "yarn build && mkdir -p examples/build && rsync -r build/* examples/build && gh-pages -d examples",
  prepublishOnly: "yarn clean && yarn build",
  preversion: "yarn lint",
  serve: "browser-sync start -s -f build examples --serveStatic examples",
  start: "yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'",
  prepare: "beemo create-config",
  eslintbase: "beemo eslint .",
  format: "yarn eslintbase --fix",
  lint: "yarn eslintbase"
}, vge = {
  "@rollup/plugin-json": "^4.1.0",
  "@rollup/plugin-node-resolve": "^11.2.0",
  "@wessberg/rollup-plugin-ts": "^1.3.8",
  "browser-sync": "^2.26.14",
  concurrently: "^6.0.0",
  "gh-pages": "^3.1.0",
  rollup: "^2.39.1",
  "rollup-plugin-bundle-size": "^1.0.3",
  "rollup-plugin-terser": "^7.0.2",
  typescript: "^4.2.2",
  vega: "^5.19.1",
  "vega-lite": "^5.0.0",
  "vega-lite-dev-config": "^0.16.1"
}, bge = {
  vega: "*",
  "vega-lite": "*"
}, xge = {
  name: ige,
  version: rge,
  description: oge,
  keywords: age,
  license: sge,
  author: uge,
  contributors: lge,
  main: cge,
  module: fge,
  unpkg: dge,
  jsdelivr: hge,
  types: gge,
  repository: pge,
  files: mge,
  scripts: yge,
  devDependencies: vge,
  peerDependencies: bge
};
const yu = "#fff", wge = "#888", Ege = {
  background: "#333",
  title: {
    color: yu,
    subtitleColor: yu
  },
  style: {
    "guide-label": {
      fill: yu
    },
    "guide-title": {
      fill: yu
    }
  },
  axis: {
    domainColor: yu,
    gridColor: wge,
    tickColor: yu
  }
}, Ua = "#4572a7", Age = {
  background: "#fff",
  arc: { fill: Ua },
  area: { fill: Ua },
  line: { stroke: Ua, strokeWidth: 2 },
  path: { stroke: Ua },
  rect: { fill: Ua },
  shape: { stroke: Ua },
  symbol: { fill: Ua, strokeWidth: 1.5, size: 50 },
  axis: {
    bandPosition: 0.5,
    grid: !0,
    gridColor: "#000000",
    gridOpacity: 1,
    gridWidth: 0.5,
    labelPadding: 10,
    tickSize: 5,
    tickWidth: 0.5
  },
  axisBand: {
    grid: !1,
    tickExtra: !0
  },
  legend: {
    labelBaseline: "middle",
    labelFontSize: 11,
    symbolSize: 50,
    symbolType: "square"
  },
  range: {
    category: [
      "#4572a7",
      "#aa4643",
      "#8aa453",
      "#71598e",
      "#4598ae",
      "#d98445",
      "#94aace",
      "#d09393",
      "#b9cc98",
      "#a99cbc"
    ]
  }
}, qa = "#30a2da", hy = "#cbcbcb", _ge = "#999", Oge = "#333", Fk = "#f0f0f0", kk = "#333", Sge = {
  arc: { fill: qa },
  area: { fill: qa },
  axis: {
    domainColor: hy,
    grid: !0,
    gridColor: hy,
    gridWidth: 1,
    labelColor: _ge,
    labelFontSize: 10,
    titleColor: Oge,
    tickColor: hy,
    tickSize: 10,
    titleFontSize: 14,
    titlePadding: 10,
    labelPadding: 4
  },
  axisBand: {
    grid: !1
  },
  background: Fk,
  group: {
    fill: Fk
  },
  legend: {
    labelColor: kk,
    labelFontSize: 11,
    padding: 1,
    symbolSize: 30,
    symbolType: "square",
    titleColor: kk,
    titleFontSize: 14,
    titlePadding: 10
  },
  line: {
    stroke: qa,
    strokeWidth: 2
  },
  path: { stroke: qa, strokeWidth: 0.5 },
  rect: { fill: qa },
  range: {
    category: [
      "#30a2da",
      "#fc4f30",
      "#e5ae38",
      "#6d904f",
      "#8b8b8b",
      "#b96db8",
      "#ff9e27",
      "#56cc60",
      "#52d2ca",
      "#52689e",
      "#545454",
      "#9fe4f8"
    ],
    diverging: ["#cc0020", "#e77866", "#f6e7e1", "#d6e8ed", "#91bfd9", "#1d78b5"],
    heatmap: ["#d6e8ed", "#cee0e5", "#91bfd9", "#549cc6", "#1d78b5"]
  },
  point: {
    filled: !0,
    shape: "circle"
  },
  shape: { stroke: qa },
  bar: {
    binSpacing: 2,
    fill: qa,
    stroke: null
  },
  title: {
    anchor: "start",
    fontSize: 24,
    fontWeight: 600,
    offset: 20
  }
}, Wa = "#000", Cge = {
  group: {
    fill: "#e5e5e5"
  },
  arc: { fill: Wa },
  area: { fill: Wa },
  line: { stroke: Wa },
  path: { stroke: Wa },
  rect: { fill: Wa },
  shape: { stroke: Wa },
  symbol: { fill: Wa, size: 40 },
  axis: {
    domain: !1,
    grid: !0,
    gridColor: "#FFFFFF",
    gridOpacity: 1,
    labelColor: "#7F7F7F",
    labelPadding: 4,
    tickColor: "#7F7F7F",
    tickSize: 5.67,
    titleFontSize: 16,
    titleFontWeight: "normal"
  },
  legend: {
    labelBaseline: "middle",
    labelFontSize: 11,
    symbolSize: 40
  },
  range: {
    category: [
      "#000000",
      "#7F7F7F",
      "#1A1A1A",
      "#999999",
      "#333333",
      "#B0B0B0",
      "#4D4D4D",
      "#C9C9C9",
      "#666666",
      "#DCDCDC"
    ]
  }
}, Fge = 22, kge = "normal", Dk = "Benton Gothic, sans-serif", $k = 11.5, Dge = "normal", Ga = "#82c6df", gy = "Benton Gothic Bold, sans-serif", Mk = "normal", Tk = 13, fc = {
  "category-6": ["#ec8431", "#829eb1", "#c89d29", "#3580b1", "#adc839", "#ab7fb4"],
  "fire-7": ["#fbf2c7", "#f9e39c", "#f8d36e", "#f4bb6a", "#e68a4f", "#d15a40", "#ab4232"],
  "fireandice-6": ["#e68a4f", "#f4bb6a", "#f9e39c", "#dadfe2", "#a6b7c6", "#849eae"],
  "ice-7": ["#edefee", "#dadfe2", "#c4ccd2", "#a6b7c6", "#849eae", "#607785", "#47525d"]
}, $ge = {
  background: "#ffffff",
  title: {
    anchor: "start",
    color: "#000000",
    font: gy,
    fontSize: Fge,
    fontWeight: kge
  },
  arc: { fill: Ga },
  area: { fill: Ga },
  line: { stroke: Ga, strokeWidth: 2 },
  path: { stroke: Ga },
  rect: { fill: Ga },
  shape: { stroke: Ga },
  symbol: { fill: Ga, size: 30 },
  axis: {
    labelFont: Dk,
    labelFontSize: $k,
    labelFontWeight: Dge,
    titleFont: gy,
    titleFontSize: Tk,
    titleFontWeight: Mk
  },
  axisX: {
    labelAngle: 0,
    labelPadding: 4,
    tickSize: 3
  },
  axisY: {
    labelBaseline: "middle",
    maxExtent: 45,
    minExtent: 45,
    tickSize: 2,
    titleAlign: "left",
    titleAngle: 0,
    titleX: -45,
    titleY: -11
  },
  legend: {
    labelFont: Dk,
    labelFontSize: $k,
    symbolType: "square",
    titleFont: gy,
    titleFontSize: Tk,
    titleFontWeight: Mk
  },
  range: {
    category: fc["category-6"],
    diverging: fc["fireandice-6"],
    heatmap: fc["fire-7"],
    ordinal: fc["fire-7"],
    ramp: fc["fire-7"]
  }
}, Ha = "#ab5787", yh = "#979797", Mge = {
  background: "#f9f9f9",
  arc: { fill: Ha },
  area: { fill: Ha },
  line: { stroke: Ha },
  path: { stroke: Ha },
  rect: { fill: Ha },
  shape: { stroke: Ha },
  symbol: { fill: Ha, size: 30 },
  axis: {
    domainColor: yh,
    domainWidth: 0.5,
    gridWidth: 0.2,
    labelColor: yh,
    tickColor: yh,
    tickWidth: 0.2,
    titleColor: yh
  },
  axisBand: {
    grid: !1
  },
  axisX: {
    grid: !0,
    tickSize: 10
  },
  axisY: {
    domain: !1,
    grid: !0,
    tickSize: 0
  },
  legend: {
    labelFontSize: 11,
    padding: 1,
    symbolSize: 30,
    symbolType: "square"
  },
  range: {
    category: [
      "#ab5787",
      "#51b2e5",
      "#703c5c",
      "#168dd9",
      "#d190b6",
      "#00609f",
      "#d365ba",
      "#154866",
      "#666666",
      "#c4c4c4"
    ]
  }
}, Ya = "#3e5c69", Tge = {
  background: "#fff",
  arc: { fill: Ya },
  area: { fill: Ya },
  line: { stroke: Ya },
  path: { stroke: Ya },
  rect: { fill: Ya },
  shape: { stroke: Ya },
  symbol: { fill: Ya },
  axis: {
    domainWidth: 0.5,
    grid: !0,
    labelPadding: 2,
    tickSize: 5,
    tickWidth: 0.5,
    titleFontWeight: "normal"
  },
  axisBand: {
    grid: !1
  },
  axisX: {
    gridWidth: 0.2
  },
  axisY: {
    gridDash: [3],
    gridWidth: 0.4
  },
  legend: {
    labelFontSize: 11,
    padding: 1,
    symbolType: "square"
  },
  range: {
    category: ["#3e5c69", "#6793a6", "#182429", "#0570b0", "#3690c0", "#74a9cf", "#a6bddb", "#e2ddf2"]
  }
}, ii = "#1696d2", Nk = "#000000", Nge = "#FFFFFF", vh = "Lato", py = "Lato", Rge = "Lato", jge = "#DEDDDD", Pge = 18, dc = {
  "main-colors": ["#1696d2", "#d2d2d2", "#000000", "#fdbf11", "#ec008b", "#55b748", "#5c5859", "#db2b27"],
  "shades-blue": ["#CFE8F3", "#A2D4EC", "#73BFE2", "#46ABDB", "#1696D2", "#12719E", "#0A4C6A", "#062635"],
  "shades-gray": ["#F5F5F5", "#ECECEC", "#E3E3E3", "#DCDBDB", "#D2D2D2", "#9D9D9D", "#696969", "#353535"],
  "shades-yellow": ["#FFF2CF", "#FCE39E", "#FDD870", "#FCCB41", "#FDBF11", "#E88E2D", "#CA5800", "#843215"],
  "shades-magenta": ["#F5CBDF", "#EB99C2", "#E46AA7", "#E54096", "#EC008B", "#AF1F6B", "#761548", "#351123"],
  "shades-green": ["#DCEDD9", "#BCDEB4", "#98CF90", "#78C26D", "#55B748", "#408941", "#2C5C2D", "#1A2E19"],
  "shades-black": ["#D5D5D4", "#ADABAC", "#848081", "#5C5859", "#332D2F", "#262223", "#1A1717", "#0E0C0D"],
  "shades-red": ["#F8D5D4", "#F1AAA9", "#E9807D", "#E25552", "#DB2B27", "#A4201D", "#6E1614", "#370B0A"],
  "one-group": ["#1696d2", "#000000"],
  "two-groups-cat-1": ["#1696d2", "#000000"],
  "two-groups-cat-2": ["#1696d2", "#fdbf11"],
  "two-groups-cat-3": ["#1696d2", "#db2b27"],
  "two-groups-seq": ["#a2d4ec", "#1696d2"],
  "three-groups-cat": ["#1696d2", "#fdbf11", "#000000"],
  "three-groups-seq": ["#a2d4ec", "#1696d2", "#0a4c6a"],
  "four-groups-cat-1": ["#000000", "#d2d2d2", "#fdbf11", "#1696d2"],
  "four-groups-cat-2": ["#1696d2", "#ec0008b", "#fdbf11", "#5c5859"],
  "four-groups-seq": ["#cfe8f3", "#73bf42", "#1696d2", "#0a4c6a"],
  "five-groups-cat-1": ["#1696d2", "#fdbf11", "#d2d2d2", "#ec008b", "#000000"],
  "five-groups-cat-2": ["#1696d2", "#0a4c6a", "#d2d2d2", "#fdbf11", "#332d2f"],
  "five-groups-seq": ["#cfe8f3", "#73bf42", "#1696d2", "#0a4c6a", "#000000"],
  "six-groups-cat-1": ["#1696d2", "#ec008b", "#fdbf11", "#000000", "#d2d2d2", "#55b748"],
  "six-groups-cat-2": ["#1696d2", "#d2d2d2", "#ec008b", "#fdbf11", "#332d2f", "#0a4c6a"],
  "six-groups-seq": ["#cfe8f3", "#a2d4ec", "#73bfe2", "#46abdb", "#1696d2", "#12719e"],
  "diverging-colors": ["#ca5800", "#fdbf11", "#fdd870", "#fff2cf", "#cfe8f3", "#73bfe2", "#1696d2", "#0a4c6a"]
}, Lge = {
  background: Nge,
  title: {
    anchor: "start",
    fontSize: Pge,
    font: vh
  },
  axisX: {
    domain: !0,
    domainColor: Nk,
    domainWidth: 1,
    grid: !1,
    labelFontSize: 12,
    labelFont: py,
    labelAngle: 0,
    tickColor: Nk,
    tickSize: 5,
    titleFontSize: 12,
    titlePadding: 10,
    titleFont: vh
  },
  axisY: {
    domain: !1,
    domainWidth: 1,
    grid: !0,
    gridColor: jge,
    gridWidth: 1,
    labelFontSize: 12,
    labelFont: py,
    labelPadding: 8,
    ticks: !1,
    titleFontSize: 12,
    titlePadding: 10,
    titleFont: vh,
    titleAngle: 0,
    titleY: -10,
    titleX: 18
  },
  legend: {
    labelFontSize: 12,
    labelFont: py,
    symbolSize: 100,
    titleFontSize: 12,
    titlePadding: 10,
    titleFont: vh,
    orient: "right",
    offset: 10
  },
  view: {
    stroke: "transparent"
  },
  range: {
    category: dc["six-groups-cat-1"],
    diverging: dc["diverging-colors"],
    heatmap: dc["diverging-colors"],
    ordinal: dc["six-groups-seq"],
    ramp: dc["shades-blue"]
  },
  area: {
    fill: ii
  },
  rect: {
    fill: ii
  },
  line: {
    color: ii,
    stroke: ii,
    strokeWidth: 5
  },
  trail: {
    color: ii,
    stroke: ii,
    strokeWidth: 0,
    size: 1
  },
  path: {
    stroke: ii,
    strokeWidth: 0.5
  },
  point: {
    filled: !0
  },
  text: {
    font: Rge,
    color: ii,
    fontSize: 11,
    align: "center",
    fontWeight: 400,
    size: 11
  },
  style: {
    bar: {
      fill: ii,
      stroke: null
    }
  },
  arc: { fill: ii },
  shape: { stroke: ii },
  symbol: { fill: ii, size: 30 }
}, Xa = "#3366CC", Rk = "#ccc", bh = "Arial, sans-serif", Ige = {
  arc: { fill: Xa },
  area: { fill: Xa },
  path: { stroke: Xa },
  rect: { fill: Xa },
  shape: { stroke: Xa },
  symbol: { stroke: Xa },
  circle: { fill: Xa },
  background: "#fff",
  padding: {
    top: 10,
    right: 10,
    bottom: 10,
    left: 10
  },
  style: {
    "guide-label": {
      font: bh,
      fontSize: 12
    },
    "guide-title": {
      font: bh,
      fontSize: 12
    },
    "group-title": {
      font: bh,
      fontSize: 12
    }
  },
  title: {
    font: bh,
    fontSize: 14,
    fontWeight: "bold",
    dy: -3,
    anchor: "start"
  },
  axis: {
    gridColor: Rk,
    tickColor: Rk,
    domain: !1,
    grid: !0
  },
  range: {
    category: [
      "#4285F4",
      "#DB4437",
      "#F4B400",
      "#0F9D58",
      "#AB47BC",
      "#00ACC1",
      "#FF7043",
      "#9E9D24",
      "#5C6BC0",
      "#F06292",
      "#00796B",
      "#C2185B"
    ],
    heatmap: ["#c6dafc", "#5e97f6", "#2a56c6"]
  }
}, Bge = xge.version, zge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  dark: Ege,
  excel: Age,
  fivethirtyeight: Sge,
  ggplot2: Cge,
  googlecharts: Ige,
  latimes: $ge,
  quartz: Mge,
  urbaninstitute: Lge,
  version: Bge,
  vox: Tge
}, Symbol.toStringTag, { value: "Module" }));
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

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

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function Uge(e, t) {
  var n = {};
  for (var i in e)
    Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
      t.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (n[i[r]] = e[i[r]]);
  return n;
}
function qge(e, t, n) {
  if (J(e))
    return `[${e.map((i) => t(je(i) ? i : jk(i, n))).join(", ")}]`;
  if (ce(e)) {
    let i = "";
    const r = e, { title: o, image: a } = r, s = Uge(r, ["title", "image"]);
    o && (i += `<h2>${t(o)}</h2>`), a && (i += `<img src="${t(a)}">`);
    const u = Object.keys(s);
    if (u.length > 0) {
      i += "<table>";
      for (const l of u) {
        let c = s[l];
        c !== void 0 && (ce(c) && (c = jk(c, n)), i += `<tr><td class="key">${t(l)}:</td><td class="value">${t(c)}</td></tr>`);
      }
      i += "</table>";
    }
    return i || "{}";
  }
  return t(e);
}
function Wge(e) {
  const t = [];
  return function(n, i) {
    if (typeof i != "object" || i === null)
      return i;
    const r = t.indexOf(this) + 1;
    return t.length = r, t.length > e ? "[Object]" : t.indexOf(i) >= 0 ? "[Circular]" : (t.push(i), i);
  };
}
function jk(e, t) {
  return JSON.stringify(e, Wge(t));
}
var Gge = `#vg-tooltip-element {
  visibility: hidden;
  padding: 8px;
  position: fixed;
  z-index: 1000;
  font-family: sans-serif;
  font-size: 11px;
  border-radius: 3px;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  /* The default theme is the light theme. */
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid #d9d9d9;
  color: black;
}
#vg-tooltip-element.visible {
  visibility: visible;
}
#vg-tooltip-element h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 13px;
}
#vg-tooltip-element img {
  max-width: 200px;
  max-height: 200px;
}
#vg-tooltip-element table {
  border-spacing: 0;
}
#vg-tooltip-element table tr {
  border: none;
}
#vg-tooltip-element table tr td {
  overflow: hidden;
  text-overflow: ellipsis;
  padding-top: 2px;
  padding-bottom: 2px;
}
#vg-tooltip-element table tr td.key {
  color: #808080;
  max-width: 150px;
  text-align: right;
  padding-right: 4px;
}
#vg-tooltip-element table tr td.value {
  display: block;
  max-width: 300px;
  max-height: 7em;
  text-align: left;
}
#vg-tooltip-element.dark-theme {
  background-color: rgba(32, 32, 32, 0.9);
  border: 1px solid #f5f5f5;
  color: white;
}
#vg-tooltip-element.dark-theme td.key {
  color: #bfbfbf;
}
`;
const Fj = "vg-tooltip-element", Hge = {
  offsetX: 10,
  offsetY: 10,
  id: Fj,
  styleId: "vega-tooltip-style",
  theme: "light",
  disableDefaultStyle: !1,
  sanitize: Yge,
  maxDepth: 2,
  formatTooltip: qge
};
function Yge(e) {
  return String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;");
}
function Xge(e) {
  if (!/^[A-Za-z]+[-:.\w]*$/.test(e))
    throw new Error("Invalid HTML ID");
  return Gge.toString().replace(Fj, e);
}
function Vge(e, t, n, i) {
  let r = e.clientX + n;
  r + t.width > window.innerWidth && (r = +e.clientX - n - t.width);
  let o = e.clientY + i;
  return o + t.height > window.innerHeight && (o = +e.clientY - i - t.height), { x: r, y: o };
}
class Kge {
  constructor(t) {
    this.options = Object.assign(Object.assign({}, Hge), t);
    const n = this.options.id;
    if (this.el = null, this.call = this.tooltipHandler.bind(this), !this.options.disableDefaultStyle && !document.getElementById(this.options.styleId)) {
      const i = document.createElement("style");
      i.setAttribute("id", this.options.styleId), i.innerHTML = Xge(n);
      const r = document.head;
      r.childNodes.length > 0 ? r.insertBefore(i, r.childNodes[0]) : r.appendChild(i);
    }
  }
  tooltipHandler(t, n, i, r) {
    var o;
    if (this.el = document.getElementById(this.options.id), this.el || (this.el = document.createElement("div"), this.el.setAttribute("id", this.options.id), this.el.classList.add("vg-tooltip"), ((o = document.fullscreenElement) !== null && o !== void 0 ? o : document.body).appendChild(this.el)), r == null || r === "") {
      this.el.classList.remove("visible", `${this.options.theme}-theme`);
      return;
    }
    this.el.innerHTML = this.options.formatTooltip(r, this.options.sanitize, this.options.maxDepth), this.el.classList.add("visible", `${this.options.theme}-theme`);
    const { x: a, y: s } = Vge(n, this.el.getBoundingClientRect(), this.options.offsetX, this.options.offsetY);
    this.el.setAttribute("style", `top: ${s}px; left: ${a}px`);
  }
}
function Jge(e, t, n) {
  return t in e ? Object.defineProperty(e, t, {
    value: n,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[t] = n, e;
}
function Pk(e, t, n, i, r, o, a) {
  try {
    var s = e[o](a), u = s.value;
  } catch (l) {
    n(l);
    return;
  }
  s.done ? t(u) : Promise.resolve(u).then(i, r);
}
function R0(e) {
  return function() {
    var t = this, n = arguments;
    return new Promise(function(i, r) {
      var o = e.apply(t, n);
      function a(u) {
        Pk(o, i, r, a, s, "next", u);
      }
      function s(u) {
        Pk(o, i, r, a, s, "throw", u);
      }
      a(void 0);
    });
  };
}
var kj = Object.prototype, us = kj.hasOwnProperty, ur, y_ = typeof Symbol == "function" ? Symbol : {}, Um = y_.iterator || "@@iterator", Qge = y_.asyncIterator || "@@asyncIterator", j0 = y_.toStringTag || "@@toStringTag";
function Dj(e, t, n, i) {
  var r = t && t.prototype instanceof Ib ? t : Ib, o = Object.create(r.prototype), a = new Bb(i || []);
  return o._invoke = i0e(e, n, a), o;
}
function v_(e, t, n) {
  try {
    return {
      type: "normal",
      arg: e.call(t, n)
    };
  } catch (i) {
    return {
      type: "throw",
      arg: i
    };
  }
}
var Lk = "suspendedStart", Zge = "suspendedYield", Ik = "executing", xh = "completed", Mi = {};
function Ib() {
}
function qm() {
}
function yl() {
}
var b_ = {};
b_[Um] = function() {
  return this;
};
var my = Object.getPrototypeOf, wh = my && my(my(x_([])));
wh && wh !== kj && us.call(wh, Um) && (b_ = wh);
var zl = yl.prototype = Ib.prototype = Object.create(b_);
qm.prototype = zl.constructor = yl;
yl.constructor = qm;
yl[j0] = qm.displayName = "GeneratorFunction";
function $j(e) {
  ["next", "throw", "return"].forEach(function(t) {
    e[t] = function(n) {
      return this._invoke(t, n);
    };
  });
}
function Mj(e) {
  var t = typeof e == "function" && e.constructor;
  return t ? t === qm || (t.displayName || t.name) === "GeneratorFunction" : !1;
}
function e0e(e) {
  return Object.setPrototypeOf ? Object.setPrototypeOf(e, yl) : (e.__proto__ = yl, j0 in e || (e[j0] = "GeneratorFunction")), e.prototype = Object.create(zl), e;
}
function t0e(e) {
  return {
    __await: e
  };
}
function Wm(e, t) {
  function n(o, a, s, u) {
    var l = v_(e[o], e, a);
    if (l.type === "throw")
      u(l.arg);
    else {
      var c = l.arg, f = c.value;
      return f && typeof f == "object" && us.call(f, "__await") ? t.resolve(f.__await).then(function(d) {
        n("next", d, s, u);
      }, function(d) {
        n("throw", d, s, u);
      }) : t.resolve(f).then(function(d) {
        c.value = d, s(c);
      }, function(d) {
        return n("throw", d, s, u);
      });
    }
  }
  var i;
  function r(o, a) {
    function s() {
      return new t(function(u, l) {
        n(o, a, u, l);
      });
    }
    return i = i ? i.then(
      s,
      s
    ) : s();
  }
  this._invoke = r;
}
$j(Wm.prototype);
Wm.prototype[Qge] = function() {
  return this;
};
function n0e(e, t, n, i, r) {
  r === void 0 && (r = Promise);
  var o = new Wm(Dj(e, t, n, i), r);
  return Mj(t) ? o : o.next().then(function(a) {
    return a.done ? a.value : o.next();
  });
}
function i0e(e, t, n) {
  var i = Lk;
  return function(o, a) {
    if (i === Ik)
      throw new Error("Generator is already running");
    if (i === xh) {
      if (o === "throw")
        throw a;
      return Nj();
    }
    for (n.method = o, n.arg = a; ; ) {
      var s = n.delegate;
      if (s) {
        var u = Tj(s, n);
        if (u) {
          if (u === Mi)
            continue;
          return u;
        }
      }
      if (n.method === "next")
        n.sent = n._sent = n.arg;
      else if (n.method === "throw") {
        if (i === Lk)
          throw i = xh, n.arg;
        n.dispatchException(n.arg);
      } else
        n.method === "return" && n.abrupt("return", n.arg);
      i = Ik;
      var l = v_(e, t, n);
      if (l.type === "normal") {
        if (i = n.done ? xh : Zge, l.arg === Mi)
          continue;
        return {
          value: l.arg,
          done: n.done
        };
      } else
        l.type === "throw" && (i = xh, n.method = "throw", n.arg = l.arg);
    }
  };
}
function Tj(e, t) {
  var n = e.iterator[t.method];
  if (n === ur) {
    if (t.delegate = null, t.method === "throw") {
      if (e.iterator.return && (t.method = "return", t.arg = ur, Tj(e, t), t.method === "throw"))
        return Mi;
      t.method = "throw", t.arg = new TypeError("The iterator does not provide a 'throw' method");
    }
    return Mi;
  }
  var i = v_(n, e.iterator, t.arg);
  if (i.type === "throw")
    return t.method = "throw", t.arg = i.arg, t.delegate = null, Mi;
  var r = i.arg;
  if (!r)
    return t.method = "throw", t.arg = new TypeError("iterator result is not an object"), t.delegate = null, Mi;
  if (r.done)
    t[e.resultName] = r.value, t.next = e.nextLoc, t.method !== "return" && (t.method = "next", t.arg = ur);
  else
    return r;
  return t.delegate = null, Mi;
}
$j(zl);
zl[j0] = "Generator";
zl[Um] = function() {
  return this;
};
zl.toString = function() {
  return "[object Generator]";
};
function r0e(e) {
  var t = {
    tryLoc: e[0]
  };
  1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t);
}
function yy(e) {
  var t = e.completion || {};
  t.type = "normal", delete t.arg, e.completion = t;
}
function Bb(e) {
  this.tryEntries = [{
    tryLoc: "root"
  }], e.forEach(r0e, this), this.reset(!0);
}
function o0e(e) {
  var t = [];
  for (var n in e)
    t.push(n);
  return t.reverse(), function i() {
    for (; t.length; ) {
      var r = t.pop();
      if (r in e)
        return i.value = r, i.done = !1, i;
    }
    return i.done = !0, i;
  };
}
function x_(e) {
  if (e) {
    var t = e[Um];
    if (t)
      return t.call(e);
    if (typeof e.next == "function")
      return e;
    if (!isNaN(e.length)) {
      var n = -1, i = function r() {
        for (; ++n < e.length; )
          if (us.call(e, n))
            return r.value = e[n], r.done = !1, r;
        return r.value = ur, r.done = !0, r;
      };
      return i.next = i;
    }
  }
  return {
    next: Nj
  };
}
function Nj() {
  return {
    value: ur,
    done: !0
  };
}
Bb.prototype = {
  constructor: Bb,
  reset: function(t) {
    if (this.prev = 0, this.next = 0, this.sent = this._sent = ur, this.done = !1, this.delegate = null, this.method = "next", this.arg = ur, this.tryEntries.forEach(yy), !t)
      for (var n in this)
        n.charAt(0) === "t" && us.call(this, n) && !isNaN(+n.slice(1)) && (this[n] = ur);
  },
  stop: function() {
    this.done = !0;
    var t = this.tryEntries[0], n = t.completion;
    if (n.type === "throw")
      throw n.arg;
    return this.rval;
  },
  dispatchException: function(t) {
    if (this.done)
      throw t;
    var n = this;
    function i(l, c) {
      return a.type = "throw", a.arg = t, n.next = l, c && (n.method = "next", n.arg = ur), !!c;
    }
    for (var r = this.tryEntries.length - 1; r >= 0; --r) {
      var o = this.tryEntries[r], a = o.completion;
      if (o.tryLoc === "root")
        return i("end");
      if (o.tryLoc <= this.prev) {
        var s = us.call(o, "catchLoc"), u = us.call(o, "finallyLoc");
        if (s && u) {
          if (this.prev < o.catchLoc)
            return i(o.catchLoc, !0);
          if (this.prev < o.finallyLoc)
            return i(o.finallyLoc);
        } else if (s) {
          if (this.prev < o.catchLoc)
            return i(o.catchLoc, !0);
        } else if (u) {
          if (this.prev < o.finallyLoc)
            return i(o.finallyLoc);
        } else
          throw new Error("try statement without catch or finally");
      }
    }
  },
  abrupt: function(t, n) {
    for (var i = this.tryEntries.length - 1; i >= 0; --i) {
      var r = this.tryEntries[i];
      if (r.tryLoc <= this.prev && us.call(r, "finallyLoc") && this.prev < r.finallyLoc) {
        var o = r;
        break;
      }
    }
    o && (t === "break" || t === "continue") && o.tryLoc <= n && n <= o.finallyLoc && (o = null);
    var a = o ? o.completion : {};
    return a.type = t, a.arg = n, o ? (this.method = "next", this.next = o.finallyLoc, Mi) : this.complete(a);
  },
  complete: function(t, n) {
    if (t.type === "throw")
      throw t.arg;
    return t.type === "break" || t.type === "continue" ? this.next = t.arg : t.type === "return" ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : t.type === "normal" && n && (this.next = n), Mi;
  },
  finish: function(t) {
    for (var n = this.tryEntries.length - 1; n >= 0; --n) {
      var i = this.tryEntries[n];
      if (i.finallyLoc === t)
        return this.complete(i.completion, i.afterLoc), yy(i), Mi;
    }
  },
  catch: function(t) {
    for (var n = this.tryEntries.length - 1; n >= 0; --n) {
      var i = this.tryEntries[n];
      if (i.tryLoc === t) {
        var r = i.completion;
        if (r.type === "throw") {
          var o = r.arg;
          yy(i);
        }
        return o;
      }
    }
    throw new Error("illegal catch attempt");
  },
  delegateYield: function(t, n, i) {
    return this.delegate = {
      iterator: x_(t),
      resultName: n,
      nextLoc: i
    }, this.method === "next" && (this.arg = ur), Mi;
  }
};
var fr = {
  wrap: Dj,
  isGeneratorFunction: Mj,
  AsyncIterator: Wm,
  mark: e0e,
  awrap: t0e,
  async: n0e,
  keys: o0e,
  values: x_
}, a0e = $e;
$e.Node = zs;
$e.create = $e;
function $e(e) {
  var t = this;
  if (t instanceof $e || (t = new $e()), t.tail = null, t.head = null, t.length = 0, e && typeof e.forEach == "function")
    e.forEach(function(r) {
      t.push(r);
    });
  else if (arguments.length > 0)
    for (var n = 0, i = arguments.length; n < i; n++)
      t.push(arguments[n]);
  return t;
}
$e.prototype.removeNode = function(e) {
  if (e.list !== this)
    throw new Error("removing node which does not belong to this list");
  var t = e.next, n = e.prev;
  return t && (t.prev = n), n && (n.next = t), e === this.head && (this.head = t), e === this.tail && (this.tail = n), e.list.length--, e.next = null, e.prev = null, e.list = null, t;
};
$e.prototype.unshiftNode = function(e) {
  if (e !== this.head) {
    e.list && e.list.removeNode(e);
    var t = this.head;
    e.list = this, e.next = t, t && (t.prev = e), this.head = e, this.tail || (this.tail = e), this.length++;
  }
};
$e.prototype.pushNode = function(e) {
  if (e !== this.tail) {
    e.list && e.list.removeNode(e);
    var t = this.tail;
    e.list = this, e.prev = t, t && (t.next = e), this.tail = e, this.head || (this.head = e), this.length++;
  }
};
$e.prototype.push = function() {
  for (var e = 0, t = arguments.length; e < t; e++)
    u0e(this, arguments[e]);
  return this.length;
};
$e.prototype.unshift = function() {
  for (var e = 0, t = arguments.length; e < t; e++)
    l0e(this, arguments[e]);
  return this.length;
};
$e.prototype.pop = function() {
  if (!!this.tail) {
    var e = this.tail.value;
    return this.tail = this.tail.prev, this.tail ? this.tail.next = null : this.head = null, this.length--, e;
  }
};
$e.prototype.shift = function() {
  if (!!this.head) {
    var e = this.head.value;
    return this.head = this.head.next, this.head ? this.head.prev = null : this.tail = null, this.length--, e;
  }
};
$e.prototype.forEach = function(e, t) {
  t = t || this;
  for (var n = this.head, i = 0; n !== null; i++)
    e.call(t, n.value, i, this), n = n.next;
};
$e.prototype.forEachReverse = function(e, t) {
  t = t || this;
  for (var n = this.tail, i = this.length - 1; n !== null; i--)
    e.call(t, n.value, i, this), n = n.prev;
};
$e.prototype.get = function(e) {
  for (var t = 0, n = this.head; n !== null && t < e; t++)
    n = n.next;
  if (t === e && n !== null)
    return n.value;
};
$e.prototype.getReverse = function(e) {
  for (var t = 0, n = this.tail; n !== null && t < e; t++)
    n = n.prev;
  if (t === e && n !== null)
    return n.value;
};
$e.prototype.map = function(e, t) {
  t = t || this;
  for (var n = new $e(), i = this.head; i !== null; )
    n.push(e.call(t, i.value, this)), i = i.next;
  return n;
};
$e.prototype.mapReverse = function(e, t) {
  t = t || this;
  for (var n = new $e(), i = this.tail; i !== null; )
    n.push(e.call(t, i.value, this)), i = i.prev;
  return n;
};
$e.prototype.reduce = function(e, t) {
  var n, i = this.head;
  if (arguments.length > 1)
    n = t;
  else if (this.head)
    i = this.head.next, n = this.head.value;
  else
    throw new TypeError("Reduce of empty list with no initial value");
  for (var r = 0; i !== null; r++)
    n = e(n, i.value, r), i = i.next;
  return n;
};
$e.prototype.reduceReverse = function(e, t) {
  var n, i = this.tail;
  if (arguments.length > 1)
    n = t;
  else if (this.tail)
    i = this.tail.prev, n = this.tail.value;
  else
    throw new TypeError("Reduce of empty list with no initial value");
  for (var r = this.length - 1; i !== null; r--)
    n = e(n, i.value, r), i = i.prev;
  return n;
};
$e.prototype.toArray = function() {
  for (var e = new Array(this.length), t = 0, n = this.head; n !== null; t++)
    e[t] = n.value, n = n.next;
  return e;
};
$e.prototype.toArrayReverse = function() {
  for (var e = new Array(this.length), t = 0, n = this.tail; n !== null; t++)
    e[t] = n.value, n = n.prev;
  return e;
};
$e.prototype.slice = function(e, t) {
  t = t || this.length, t < 0 && (t += this.length), e = e || 0, e < 0 && (e += this.length);
  var n = new $e();
  if (t < e || t < 0)
    return n;
  e < 0 && (e = 0), t > this.length && (t = this.length);
  for (var i = 0, r = this.head; r !== null && i < e; i++)
    r = r.next;
  for (; r !== null && i < t; i++, r = r.next)
    n.push(r.value);
  return n;
};
$e.prototype.sliceReverse = function(e, t) {
  t = t || this.length, t < 0 && (t += this.length), e = e || 0, e < 0 && (e += this.length);
  var n = new $e();
  if (t < e || t < 0)
    return n;
  e < 0 && (e = 0), t > this.length && (t = this.length);
  for (var i = this.length, r = this.tail; r !== null && i > t; i--)
    r = r.prev;
  for (; r !== null && i > e; i--, r = r.prev)
    n.push(r.value);
  return n;
};
$e.prototype.splice = function(e, t) {
  e > this.length && (e = this.length - 1), e < 0 && (e = this.length + e);
  for (var n = 0, i = this.head; i !== null && n < e; n++)
    i = i.next;
  for (var r = [], n = 0; i && n < t; n++)
    r.push(i.value), i = this.removeNode(i);
  i === null && (i = this.tail), i !== this.head && i !== this.tail && (i = i.prev);
  for (var n = 0; n < (arguments.length <= 2 ? 0 : arguments.length - 2); n++)
    i = s0e(this, i, n + 2 < 2 || arguments.length <= n + 2 ? void 0 : arguments[n + 2]);
  return r;
};
$e.prototype.reverse = function() {
  for (var e = this.head, t = this.tail, n = e; n !== null; n = n.prev) {
    var i = n.prev;
    n.prev = n.next, n.next = i;
  }
  return this.head = t, this.tail = e, this;
};
function s0e(e, t, n) {
  var i = t === e.head ? new zs(n, null, t, e) : new zs(n, t, t.next, e);
  return i.next === null && (e.tail = i), i.prev === null && (e.head = i), e.length++, i;
}
function u0e(e, t) {
  e.tail = new zs(t, e.tail, null, e), e.head || (e.head = e.tail), e.length++;
}
function l0e(e, t) {
  e.head = new zs(t, null, e.head, e), e.tail || (e.tail = e.head), e.length++;
}
function zs(e, t, n, i) {
  if (!(this instanceof zs))
    return new zs(e, t, n, i);
  this.list = i, this.value = e, t ? (t.next = this, this.prev = t) : this.prev = null, n ? (n.prev = this, this.next = n) : this.next = null;
}
try {
  $e.prototype[Symbol.iterator] = /* @__PURE__ */ fr.mark(function e() {
    var t;
    return fr.wrap(function(i) {
      for (; ; )
        switch (i.prev = i.next) {
          case 0:
            t = this.head;
          case 1:
            if (!t) {
              i.next = 7;
              break;
            }
            return i.next = 4, t.value;
          case 4:
            t = t.next, i.next = 1;
            break;
          case 7:
          case "end":
            return i.stop();
        }
    }, e, this);
  });
} catch {
}
var c0e = a0e, is = Symbol("max"), Kr = Symbol("length"), vu = Symbol("lengthCalculator"), ef = Symbol("allowStale"), ls = Symbol("maxAge"), Gr = Symbol("dispose"), Bk = Symbol("noDisposeOnSet"), Et = Symbol("lruList"), Ei = Symbol("cache"), Rj = Symbol("updateAgeOnGet"), vy = () => 1;
class f0e {
  constructor(t) {
    if (typeof t == "number" && (t = {
      max: t
    }), t || (t = {}), t.max && (typeof t.max != "number" || t.max < 0))
      throw new TypeError("max must be a non-negative number");
    this[is] = t.max || 1 / 0;
    var n = t.length || vy;
    if (this[vu] = typeof n != "function" ? vy : n, this[ef] = t.stale || !1, t.maxAge && typeof t.maxAge != "number")
      throw new TypeError("maxAge must be a number");
    this[ls] = t.maxAge || 0, this[Gr] = t.dispose, this[Bk] = t.noDisposeOnSet || !1, this[Rj] = t.updateAgeOnGet || !1, this.reset();
  }
  set max(t) {
    if (typeof t != "number" || t < 0)
      throw new TypeError("max must be a non-negative number");
    this[is] = t || 1 / 0, hc(this);
  }
  get max() {
    return this[is];
  }
  set allowStale(t) {
    this[ef] = !!t;
  }
  get allowStale() {
    return this[ef];
  }
  set maxAge(t) {
    if (typeof t != "number")
      throw new TypeError("maxAge must be a non-negative number");
    this[ls] = t, hc(this);
  }
  get maxAge() {
    return this[ls];
  }
  set lengthCalculator(t) {
    typeof t != "function" && (t = vy), t !== this[vu] && (this[vu] = t, this[Kr] = 0, this[Et].forEach((n) => {
      n.length = this[vu](n.value, n.key), this[Kr] += n.length;
    })), hc(this);
  }
  get lengthCalculator() {
    return this[vu];
  }
  get length() {
    return this[Kr];
  }
  get itemCount() {
    return this[Et].length;
  }
  rforEach(t, n) {
    n = n || this;
    for (var i = this[Et].tail; i !== null; ) {
      var r = i.prev;
      zk(this, t, i, n), i = r;
    }
  }
  forEach(t, n) {
    n = n || this;
    for (var i = this[Et].head; i !== null; ) {
      var r = i.next;
      zk(this, t, i, n), i = r;
    }
  }
  keys() {
    return this[Et].toArray().map((t) => t.key);
  }
  values() {
    return this[Et].toArray().map((t) => t.value);
  }
  reset() {
    this[Gr] && this[Et] && this[Et].length && this[Et].forEach((t) => this[Gr](t.key, t.value)), this[Ei] = /* @__PURE__ */ new Map(), this[Et] = new c0e(), this[Kr] = 0;
  }
  dump() {
    return this[Et].map((t) => P0(this, t) ? !1 : {
      k: t.key,
      v: t.value,
      e: t.now + (t.maxAge || 0)
    }).toArray().filter((t) => t);
  }
  dumpLru() {
    return this[Et];
  }
  set(t, n, i) {
    if (i = i || this[ls], i && typeof i != "number")
      throw new TypeError("maxAge must be a number");
    var r = i ? Date.now() : 0, o = this[vu](n, t);
    if (this[Ei].has(t)) {
      if (o > this[is])
        return Iu(this, this[Ei].get(t)), !1;
      var a = this[Ei].get(t), s = a.value;
      return this[Gr] && (this[Bk] || this[Gr](t, s.value)), s.now = r, s.maxAge = i, s.value = n, this[Kr] += o - s.length, s.length = o, this.get(t), hc(this), !0;
    }
    var u = new d0e(t, n, o, r, i);
    return u.length > this[is] ? (this[Gr] && this[Gr](t, n), !1) : (this[Kr] += u.length, this[Et].unshift(u), this[Ei].set(t, this[Et].head), hc(this), !0);
  }
  has(t) {
    if (!this[Ei].has(t))
      return !1;
    var n = this[Ei].get(t).value;
    return !P0(this, n);
  }
  get(t) {
    return by(this, t, !0);
  }
  peek(t) {
    return by(this, t, !1);
  }
  pop() {
    var t = this[Et].tail;
    return t ? (Iu(this, t), t.value) : null;
  }
  del(t) {
    Iu(this, this[Ei].get(t));
  }
  load(t) {
    this.reset();
    for (var n = Date.now(), i = t.length - 1; i >= 0; i--) {
      var r = t[i], o = r.e || 0;
      if (o === 0)
        this.set(r.k, r.v);
      else {
        var a = o - n;
        a > 0 && this.set(r.k, r.v, a);
      }
    }
  }
  prune() {
    this[Ei].forEach((t, n) => by(this, n, !1));
  }
}
var by = (e, t, n) => {
  var i = e[Ei].get(t);
  if (i) {
    var r = i.value;
    if (P0(e, r)) {
      if (Iu(e, i), !e[ef])
        return;
    } else
      n && (e[Rj] && (i.value.now = Date.now()), e[Et].unshiftNode(i));
    return r.value;
  }
}, P0 = (e, t) => {
  if (!t || !t.maxAge && !e[ls])
    return !1;
  var n = Date.now() - t.now;
  return t.maxAge ? n > t.maxAge : e[ls] && n > e[ls];
}, hc = (e) => {
  if (e[Kr] > e[is])
    for (var t = e[Et].tail; e[Kr] > e[is] && t !== null; ) {
      var n = t.prev;
      Iu(e, t), t = n;
    }
}, Iu = (e, t) => {
  if (t) {
    var n = t.value;
    e[Gr] && e[Gr](n.key, n.value), e[Kr] -= n.length, e[Ei].delete(n.key), e[Et].removeNode(t);
  }
};
class d0e {
  constructor(t, n, i, r, o) {
    this.key = t, this.value = n, this.length = i, this.now = r, this.maxAge = o || 0;
  }
}
var zk = (e, t, n, i) => {
  var r = n.value;
  P0(e, r) && (Iu(e, n), e[ef] || (r = void 0)), r && t.call(i, r.value, r.key, e);
}, h0e = f0e, g0e = ["includePrerelease", "loose", "rtl"], p0e = (e) => e ? typeof e != "object" ? {
  loose: !0
} : g0e.filter((t) => e[t]).reduce((t, n) => (t[n] = !0, t), {}) : {}, w_ = p0e, Ti = { exports: {} }, m0e = "2.0.0", y0e = 256, v0e = Number.MAX_SAFE_INTEGER || 9007199254740991, b0e = 16, E_ = {
  SEMVER_SPEC_VERSION: m0e,
  MAX_LENGTH: y0e,
  MAX_SAFE_INTEGER: v0e,
  MAX_SAFE_COMPONENT_LENGTH: b0e
}, x0e = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? function() {
  for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
    t[n] = arguments[n];
  return console.error("SEMVER", ...t);
} : () => {
}, Gm = x0e;
(function(e, t) {
  var n = E_.MAX_SAFE_COMPONENT_LENGTH, i = Gm;
  t = e.exports = {};
  var r = t.re = [], o = t.src = [], a = t.t = {}, s = 0, u = (l, c, f) => {
    var d = s++;
    i(l, d, c), a[l] = d, o[d] = c, r[d] = new RegExp(c, f ? "g" : void 0);
  };
  u("NUMERICIDENTIFIER", "0|[1-9]\\d*"), u("NUMERICIDENTIFIERLOOSE", "[0-9]+"), u("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*"), u("MAINVERSION", "(".concat(o[a.NUMERICIDENTIFIER], ")\\.") + "(".concat(o[a.NUMERICIDENTIFIER], ")\\.") + "(".concat(o[a.NUMERICIDENTIFIER], ")")), u("MAINVERSIONLOOSE", "(".concat(o[a.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(o[a.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(o[a.NUMERICIDENTIFIERLOOSE], ")")), u("PRERELEASEIDENTIFIER", "(?:".concat(o[a.NUMERICIDENTIFIER], "|").concat(o[a.NONNUMERICIDENTIFIER], ")")), u("PRERELEASEIDENTIFIERLOOSE", "(?:".concat(o[a.NUMERICIDENTIFIERLOOSE], "|").concat(o[a.NONNUMERICIDENTIFIER], ")")), u("PRERELEASE", "(?:-(".concat(o[a.PRERELEASEIDENTIFIER], "(?:\\.").concat(o[a.PRERELEASEIDENTIFIER], ")*))")), u("PRERELEASELOOSE", "(?:-?(".concat(o[a.PRERELEASEIDENTIFIERLOOSE], "(?:\\.").concat(o[a.PRERELEASEIDENTIFIERLOOSE], ")*))")), u("BUILDIDENTIFIER", "[0-9A-Za-z-]+"), u("BUILD", "(?:\\+(".concat(o[a.BUILDIDENTIFIER], "(?:\\.").concat(o[a.BUILDIDENTIFIER], ")*))")), u("FULLPLAIN", "v?".concat(o[a.MAINVERSION]).concat(o[a.PRERELEASE], "?").concat(o[a.BUILD], "?")), u("FULL", "^".concat(o[a.FULLPLAIN], "$")), u("LOOSEPLAIN", "[v=\\s]*".concat(o[a.MAINVERSIONLOOSE]).concat(o[a.PRERELEASELOOSE], "?").concat(o[a.BUILD], "?")), u("LOOSE", "^".concat(o[a.LOOSEPLAIN], "$")), u("GTLT", "((?:<|>)?=?)"), u("XRANGEIDENTIFIERLOOSE", "".concat(o[a.NUMERICIDENTIFIERLOOSE], "|x|X|\\*")), u("XRANGEIDENTIFIER", "".concat(o[a.NUMERICIDENTIFIER], "|x|X|\\*")), u("XRANGEPLAIN", "[v=\\s]*(".concat(o[a.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(o[a.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(o[a.XRANGEIDENTIFIER], ")") + "(?:".concat(o[a.PRERELEASE], ")?").concat(o[a.BUILD], "?") + ")?)?"), u("XRANGEPLAINLOOSE", "[v=\\s]*(".concat(o[a.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(o[a.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(o[a.XRANGEIDENTIFIERLOOSE], ")") + "(?:".concat(o[a.PRERELEASELOOSE], ")?").concat(o[a.BUILD], "?") + ")?)?"), u("XRANGE", "^".concat(o[a.GTLT], "\\s*").concat(o[a.XRANGEPLAIN], "$")), u("XRANGELOOSE", "^".concat(o[a.GTLT], "\\s*").concat(o[a.XRANGEPLAINLOOSE], "$")), u("COERCE", "".concat("(^|[^\\d])(\\d{1,").concat(n, "})") + "(?:\\.(\\d{1,".concat(n, "}))?") + "(?:\\.(\\d{1,".concat(n, "}))?") + "(?:$|[^\\d])"), u("COERCERTL", o[a.COERCE], !0), u("LONETILDE", "(?:~>?)"), u("TILDETRIM", "(\\s*)".concat(o[a.LONETILDE], "\\s+"), !0), t.tildeTrimReplace = "$1~", u("TILDE", "^".concat(o[a.LONETILDE]).concat(o[a.XRANGEPLAIN], "$")), u("TILDELOOSE", "^".concat(o[a.LONETILDE]).concat(o[a.XRANGEPLAINLOOSE], "$")), u("LONECARET", "(?:\\^)"), u("CARETTRIM", "(\\s*)".concat(o[a.LONECARET], "\\s+"), !0), t.caretTrimReplace = "$1^", u("CARET", "^".concat(o[a.LONECARET]).concat(o[a.XRANGEPLAIN], "$")), u("CARETLOOSE", "^".concat(o[a.LONECARET]).concat(o[a.XRANGEPLAINLOOSE], "$")), u("COMPARATORLOOSE", "^".concat(o[a.GTLT], "\\s*(").concat(o[a.LOOSEPLAIN], ")$|^$")), u("COMPARATOR", "^".concat(o[a.GTLT], "\\s*(").concat(o[a.FULLPLAIN], ")$|^$")), u("COMPARATORTRIM", "(\\s*)".concat(o[a.GTLT], "\\s*(").concat(o[a.LOOSEPLAIN], "|").concat(o[a.XRANGEPLAIN], ")"), !0), t.comparatorTrimReplace = "$1$2$3", u("HYPHENRANGE", "^\\s*(".concat(o[a.XRANGEPLAIN], ")") + "\\s+-\\s+" + "(".concat(o[a.XRANGEPLAIN], ")") + "\\s*$"), u("HYPHENRANGELOOSE", "^\\s*(".concat(o[a.XRANGEPLAINLOOSE], ")") + "\\s+-\\s+" + "(".concat(o[a.XRANGEPLAINLOOSE], ")") + "\\s*$"), u("STAR", "(<|>)?=?\\s*\\*"), u("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), u("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
})(Ti, Ti.exports);
var Uk = /^[0-9]+$/, jj = (e, t) => {
  var n = Uk.test(e), i = Uk.test(t);
  return n && i && (e = +e, t = +t), e === t ? 0 : n && !i ? -1 : i && !n ? 1 : e < t ? -1 : 1;
}, w0e = (e, t) => jj(t, e), E0e = {
  compareIdentifiers: jj,
  rcompareIdentifiers: w0e
}, Eh = Gm, qk = E_.MAX_LENGTH, Ah = E_.MAX_SAFE_INTEGER, Wk = Ti.exports.re, Gk = Ti.exports.t, A0e = w_, bu = E0e.compareIdentifiers;
class Ai {
  constructor(t, n) {
    if (n = A0e(n), t instanceof Ai) {
      if (t.loose === !!n.loose && t.includePrerelease === !!n.includePrerelease)
        return t;
      t = t.version;
    } else if (typeof t != "string")
      throw new TypeError("Invalid Version: ".concat(t));
    if (t.length > qk)
      throw new TypeError("version is longer than ".concat(qk, " characters"));
    Eh("SemVer", t, n), this.options = n, this.loose = !!n.loose, this.includePrerelease = !!n.includePrerelease;
    var i = t.trim().match(n.loose ? Wk[Gk.LOOSE] : Wk[Gk.FULL]);
    if (!i)
      throw new TypeError("Invalid Version: ".concat(t));
    if (this.raw = t, this.major = +i[1], this.minor = +i[2], this.patch = +i[3], this.major > Ah || this.major < 0)
      throw new TypeError("Invalid major version");
    if (this.minor > Ah || this.minor < 0)
      throw new TypeError("Invalid minor version");
    if (this.patch > Ah || this.patch < 0)
      throw new TypeError("Invalid patch version");
    i[4] ? this.prerelease = i[4].split(".").map((r) => {
      if (/^[0-9]+$/.test(r)) {
        var o = +r;
        if (o >= 0 && o < Ah)
          return o;
      }
      return r;
    }) : this.prerelease = [], this.build = i[5] ? i[5].split(".") : [], this.format();
  }
  format() {
    return this.version = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch), this.prerelease.length && (this.version += "-".concat(this.prerelease.join("."))), this.version;
  }
  toString() {
    return this.version;
  }
  compare(t) {
    if (Eh("SemVer.compare", this.version, this.options, t), !(t instanceof Ai)) {
      if (typeof t == "string" && t === this.version)
        return 0;
      t = new Ai(t, this.options);
    }
    return t.version === this.version ? 0 : this.compareMain(t) || this.comparePre(t);
  }
  compareMain(t) {
    return t instanceof Ai || (t = new Ai(t, this.options)), bu(this.major, t.major) || bu(this.minor, t.minor) || bu(this.patch, t.patch);
  }
  comparePre(t) {
    if (t instanceof Ai || (t = new Ai(t, this.options)), this.prerelease.length && !t.prerelease.length)
      return -1;
    if (!this.prerelease.length && t.prerelease.length)
      return 1;
    if (!this.prerelease.length && !t.prerelease.length)
      return 0;
    var n = 0;
    do {
      var i = this.prerelease[n], r = t.prerelease[n];
      if (Eh("prerelease compare", n, i, r), i === void 0 && r === void 0)
        return 0;
      if (r === void 0)
        return 1;
      if (i === void 0)
        return -1;
      if (i === r)
        continue;
      return bu(i, r);
    } while (++n);
  }
  compareBuild(t) {
    t instanceof Ai || (t = new Ai(t, this.options));
    var n = 0;
    do {
      var i = this.build[n], r = t.build[n];
      if (Eh("prerelease compare", n, i, r), i === void 0 && r === void 0)
        return 0;
      if (r === void 0)
        return 1;
      if (i === void 0)
        return -1;
      if (i === r)
        continue;
      return bu(i, r);
    } while (++n);
  }
  inc(t, n) {
    switch (t) {
      case "premajor":
        this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", n);
        break;
      case "preminor":
        this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", n);
        break;
      case "prepatch":
        this.prerelease.length = 0, this.inc("patch", n), this.inc("pre", n);
        break;
      case "prerelease":
        this.prerelease.length === 0 && this.inc("patch", n), this.inc("pre", n);
        break;
      case "major":
        (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
        break;
      case "minor":
        (this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
        break;
      case "patch":
        this.prerelease.length === 0 && this.patch++, this.prerelease = [];
        break;
      case "pre":
        if (this.prerelease.length === 0)
          this.prerelease = [0];
        else {
          for (var i = this.prerelease.length; --i >= 0; )
            typeof this.prerelease[i] == "number" && (this.prerelease[i]++, i = -2);
          i === -1 && this.prerelease.push(0);
        }
        n && (bu(this.prerelease[0], n) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = [n, 0]) : this.prerelease = [n, 0]);
        break;
      default:
        throw new Error("invalid increment argument: ".concat(t));
    }
    return this.format(), this.raw = this.version, this;
  }
}
var A_ = Ai, Hk = A_, _0e = (e, t, n) => new Hk(e, n).compare(new Hk(t, n)), Ul = _0e, O0e = Ul, S0e = (e, t, n) => O0e(e, t, n) === 0, C0e = S0e, F0e = Ul, k0e = (e, t, n) => F0e(e, t, n) !== 0, D0e = k0e, $0e = Ul, M0e = (e, t, n) => $0e(e, t, n) > 0, T0e = M0e, N0e = Ul, R0e = (e, t, n) => N0e(e, t, n) >= 0, j0e = R0e, P0e = Ul, L0e = (e, t, n) => P0e(e, t, n) < 0, I0e = L0e, B0e = Ul, z0e = (e, t, n) => B0e(e, t, n) <= 0, U0e = z0e, q0e = C0e, W0e = D0e, G0e = T0e, H0e = j0e, Y0e = I0e, X0e = U0e, V0e = (e, t, n, i) => {
  switch (t) {
    case "===":
      return typeof e == "object" && (e = e.version), typeof n == "object" && (n = n.version), e === n;
    case "!==":
      return typeof e == "object" && (e = e.version), typeof n == "object" && (n = n.version), e !== n;
    case "":
    case "=":
    case "==":
      return q0e(e, n, i);
    case "!=":
      return W0e(e, n, i);
    case ">":
      return G0e(e, n, i);
    case ">=":
      return H0e(e, n, i);
    case "<":
      return Y0e(e, n, i);
    case "<=":
      return X0e(e, n, i);
    default:
      throw new TypeError("Invalid operator: ".concat(t));
  }
}, K0e = V0e, xy, Yk;
function J0e() {
  if (Yk)
    return xy;
  Yk = 1;
  var e = Symbol("SemVer ANY");
  class t {
    static get ANY() {
      return e;
    }
    constructor(c, f) {
      if (f = n(f), c instanceof t) {
        if (c.loose === !!f.loose)
          return c;
        c = c.value;
      }
      a("comparator", c, f), this.options = f, this.loose = !!f.loose, this.parse(c), this.semver === e ? this.value = "" : this.value = this.operator + this.semver.version, a("comp", this);
    }
    parse(c) {
      var f = this.options.loose ? i[r.COMPARATORLOOSE] : i[r.COMPARATOR], d = c.match(f);
      if (!d)
        throw new TypeError("Invalid comparator: ".concat(c));
      this.operator = d[1] !== void 0 ? d[1] : "", this.operator === "=" && (this.operator = ""), d[2] ? this.semver = new s(d[2], this.options.loose) : this.semver = e;
    }
    toString() {
      return this.value;
    }
    test(c) {
      if (a("Comparator.test", c, this.options.loose), this.semver === e || c === e)
        return !0;
      if (typeof c == "string")
        try {
          c = new s(c, this.options);
        } catch {
          return !1;
        }
      return o(c, this.operator, this.semver, this.options);
    }
    intersects(c, f) {
      if (!(c instanceof t))
        throw new TypeError("a Comparator is required");
      if ((!f || typeof f != "object") && (f = {
        loose: !!f,
        includePrerelease: !1
      }), this.operator === "")
        return this.value === "" ? !0 : new u(c.value, f).test(this.value);
      if (c.operator === "")
        return c.value === "" ? !0 : new u(this.value, f).test(c.semver);
      var d = (this.operator === ">=" || this.operator === ">") && (c.operator === ">=" || c.operator === ">"), h = (this.operator === "<=" || this.operator === "<") && (c.operator === "<=" || c.operator === "<"), g = this.semver.version === c.semver.version, p = (this.operator === ">=" || this.operator === "<=") && (c.operator === ">=" || c.operator === "<="), m = o(this.semver, "<", c.semver, f) && (this.operator === ">=" || this.operator === ">") && (c.operator === "<=" || c.operator === "<"), y = o(this.semver, ">", c.semver, f) && (this.operator === "<=" || this.operator === "<") && (c.operator === ">=" || c.operator === ">");
      return d || h || g && p || m || y;
    }
  }
  xy = t;
  var n = w_, i = Ti.exports.re, r = Ti.exports.t, o = K0e, a = Gm, s = A_, u = Pj();
  return xy;
}
function Xk(e, t) {
  var n = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
  if (!n) {
    if (Array.isArray(e) || (n = Q0e(e)) || t && e && typeof e.length == "number") {
      n && (e = n);
      var i = 0, r = function() {
      };
      return { s: r, n: function() {
        return i >= e.length ? { done: !0 } : { done: !1, value: e[i++] };
      }, e: function(l) {
        throw l;
      }, f: r };
    }
    throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
  }
  var o = !0, a = !1, s;
  return { s: function() {
    n = n.call(e);
  }, n: function() {
    var l = n.next();
    return o = l.done, l;
  }, e: function(l) {
    a = !0, s = l;
  }, f: function() {
    try {
      !o && n.return != null && n.return();
    } finally {
      if (a)
        throw s;
    }
  } };
}
function Q0e(e, t) {
  if (!!e) {
    if (typeof e == "string")
      return Vk(e, t);
    var n = Object.prototype.toString.call(e).slice(8, -1);
    if (n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set")
      return Array.from(e);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
      return Vk(e, t);
  }
}
function Vk(e, t) {
  (t == null || t > e.length) && (t = e.length);
  for (var n = 0, i = new Array(t); n < t; n++)
    i[n] = e[n];
  return i;
}
var wy, Kk;
function Pj() {
  if (Kk)
    return wy;
  Kk = 1;
  class e {
    constructor(S, D) {
      if (D = i(D), S instanceof e)
        return S.loose === !!D.loose && S.includePrerelease === !!D.includePrerelease ? S : new e(S.raw, D);
      if (S instanceof r)
        return this.raw = S.value, this.set = [[S]], this.format(), this;
      if (this.options = D, this.loose = !!D.loose, this.includePrerelease = !!D.includePrerelease, this.raw = S, this.set = S.split("||").map((L) => this.parseRange(L.trim())).filter((L) => L.length), !this.set.length)
        throw new TypeError("Invalid SemVer Range: ".concat(S));
      if (this.set.length > 1) {
        var M = this.set[0];
        if (this.set = this.set.filter((L) => !d(L[0])), this.set.length === 0)
          this.set = [M];
        else if (this.set.length > 1) {
          var F = Xk(this.set), $;
          try {
            for (F.s(); !($ = F.n()).done; ) {
              var T = $.value;
              if (T.length === 1 && h(T[0])) {
                this.set = [T];
                break;
              }
            }
          } catch (L) {
            F.e(L);
          } finally {
            F.f();
          }
        }
      }
      this.format();
    }
    format() {
      return this.range = this.set.map((S) => S.join(" ").trim()).join("||").trim(), this.range;
    }
    toString() {
      return this.range;
    }
    parseRange(S) {
      S = S.trim();
      var D = Object.keys(this.options).join(","), M = "parseRange:".concat(D, ":").concat(S), F = n.get(M);
      if (F)
        return F;
      var $ = this.options.loose, T = $ ? s[u.HYPHENRANGELOOSE] : s[u.HYPHENRANGE];
      S = S.replace(T, k(this.options.includePrerelease)), o("hyphen replace", S), S = S.replace(s[u.COMPARATORTRIM], l), o("comparator trim", S), S = S.replace(s[u.TILDETRIM], c), S = S.replace(s[u.CARETTRIM], f), S = S.split(/\s+/).join(" ");
      var L = S.split(" ").map((Se) => p(Se, this.options)).join(" ").split(/\s+/).map((Se) => _(Se, this.options));
      $ && (L = L.filter((Se) => (o("loose invalid filter", Se, this.options), !!Se.match(s[u.COMPARATORLOOSE])))), o("range list", L);
      var I = /* @__PURE__ */ new Map(), Y = L.map((Se) => new r(Se, this.options)), fe = Xk(Y), Me;
      try {
        for (fe.s(); !(Me = fe.n()).done; ) {
          var Oe = Me.value;
          if (d(Oe))
            return [Oe];
          I.set(Oe.value, Oe);
        }
      } catch (Se) {
        fe.e(Se);
      } finally {
        fe.f();
      }
      I.size > 1 && I.has("") && I.delete("");
      var Be = [...I.values()];
      return n.set(M, Be), Be;
    }
    intersects(S, D) {
      if (!(S instanceof e))
        throw new TypeError("a Range is required");
      return this.set.some((M) => g(M, D) && S.set.some((F) => g(F, D) && M.every(($) => F.every((T) => $.intersects(T, D)))));
    }
    test(S) {
      if (!S)
        return !1;
      if (typeof S == "string")
        try {
          S = new a(S, this.options);
        } catch {
          return !1;
        }
      for (var D = 0; D < this.set.length; D++)
        if (C(this.set[D], S, this.options))
          return !0;
      return !1;
    }
  }
  wy = e;
  var t = h0e, n = new t({
    max: 1e3
  }), i = w_, r = J0e(), o = Gm, a = A_, s = Ti.exports.re, u = Ti.exports.t, l = Ti.exports.comparatorTrimReplace, c = Ti.exports.tildeTrimReplace, f = Ti.exports.caretTrimReplace, d = (O) => O.value === "<0.0.0-0", h = (O) => O.value === "", g = (O, S) => {
    for (var D = !0, M = O.slice(), F = M.pop(); D && M.length; )
      D = M.every(($) => F.intersects($, S)), F = M.pop();
    return D;
  }, p = (O, S) => (o("comp", O, S), O = b(O, S), o("caret", O), O = y(O, S), o("tildes", O), O = E(O, S), o("xrange", O), O = w(O, S), o("stars", O), O), m = (O) => !O || O.toLowerCase() === "x" || O === "*", y = (O, S) => O.trim().split(/\s+/).map((D) => v(D, S)).join(" "), v = (O, S) => {
    var D = S.loose ? s[u.TILDELOOSE] : s[u.TILDE];
    return O.replace(D, (M, F, $, T, L) => {
      o("tilde", O, M, F, $, T, L);
      var I;
      return m(F) ? I = "" : m($) ? I = ">=".concat(F, ".0.0 <").concat(+F + 1, ".0.0-0") : m(T) ? I = ">=".concat(F, ".").concat($, ".0 <").concat(F, ".").concat(+$ + 1, ".0-0") : L ? (o("replaceTilde pr", L), I = ">=".concat(F, ".").concat($, ".").concat(T, "-").concat(L, " <").concat(F, ".").concat(+$ + 1, ".0-0")) : I = ">=".concat(F, ".").concat($, ".").concat(T, " <").concat(F, ".").concat(+$ + 1, ".0-0"), o("tilde return", I), I;
    });
  }, b = (O, S) => O.trim().split(/\s+/).map((D) => x(D, S)).join(" "), x = (O, S) => {
    o("caret", O, S);
    var D = S.loose ? s[u.CARETLOOSE] : s[u.CARET], M = S.includePrerelease ? "-0" : "";
    return O.replace(D, (F, $, T, L, I) => {
      o("caret", O, F, $, T, L, I);
      var Y;
      return m($) ? Y = "" : m(T) ? Y = ">=".concat($, ".0.0").concat(M, " <").concat(+$ + 1, ".0.0-0") : m(L) ? $ === "0" ? Y = ">=".concat($, ".").concat(T, ".0").concat(M, " <").concat($, ".").concat(+T + 1, ".0-0") : Y = ">=".concat($, ".").concat(T, ".0").concat(M, " <").concat(+$ + 1, ".0.0-0") : I ? (o("replaceCaret pr", I), $ === "0" ? T === "0" ? Y = ">=".concat($, ".").concat(T, ".").concat(L, "-").concat(I, " <").concat($, ".").concat(T, ".").concat(+L + 1, "-0") : Y = ">=".concat($, ".").concat(T, ".").concat(L, "-").concat(I, " <").concat($, ".").concat(+T + 1, ".0-0") : Y = ">=".concat($, ".").concat(T, ".").concat(L, "-").concat(I, " <").concat(+$ + 1, ".0.0-0")) : (o("no pr"), $ === "0" ? T === "0" ? Y = ">=".concat($, ".").concat(T, ".").concat(L).concat(M, " <").concat($, ".").concat(T, ".").concat(+L + 1, "-0") : Y = ">=".concat($, ".").concat(T, ".").concat(L).concat(M, " <").concat($, ".").concat(+T + 1, ".0-0") : Y = ">=".concat($, ".").concat(T, ".").concat(L, " <").concat(+$ + 1, ".0.0-0")), o("caret return", Y), Y;
    });
  }, E = (O, S) => (o("replaceXRanges", O, S), O.split(/\s+/).map((D) => A(D, S)).join(" ")), A = (O, S) => {
    O = O.trim();
    var D = S.loose ? s[u.XRANGELOOSE] : s[u.XRANGE];
    return O.replace(D, (M, F, $, T, L, I) => {
      o("xRange", O, M, F, $, T, L, I);
      var Y = m($), fe = Y || m(T), Me = fe || m(L), Oe = Me;
      return F === "=" && Oe && (F = ""), I = S.includePrerelease ? "-0" : "", Y ? F === ">" || F === "<" ? M = "<0.0.0-0" : M = "*" : F && Oe ? (fe && (T = 0), L = 0, F === ">" ? (F = ">=", fe ? ($ = +$ + 1, T = 0, L = 0) : (T = +T + 1, L = 0)) : F === "<=" && (F = "<", fe ? $ = +$ + 1 : T = +T + 1), F === "<" && (I = "-0"), M = "".concat(F + $, ".").concat(T, ".").concat(L).concat(I)) : fe ? M = ">=".concat($, ".0.0").concat(I, " <").concat(+$ + 1, ".0.0-0") : Me && (M = ">=".concat($, ".").concat(T, ".0").concat(I, " <").concat($, ".").concat(+T + 1, ".0-0")), o("xRange return", M), M;
    });
  }, w = (O, S) => (o("replaceStars", O, S), O.trim().replace(s[u.STAR], "")), _ = (O, S) => (o("replaceGTE0", O, S), O.trim().replace(s[S.includePrerelease ? u.GTE0PRE : u.GTE0], "")), k = (O) => (S, D, M, F, $, T, L, I, Y, fe, Me, Oe, Be) => (m(M) ? D = "" : m(F) ? D = ">=".concat(M, ".0.0").concat(O ? "-0" : "") : m($) ? D = ">=".concat(M, ".").concat(F, ".0").concat(O ? "-0" : "") : T ? D = ">=".concat(D) : D = ">=".concat(D).concat(O ? "-0" : ""), m(Y) ? I = "" : m(fe) ? I = "<".concat(+Y + 1, ".0.0-0") : m(Me) ? I = "<".concat(Y, ".").concat(+fe + 1, ".0-0") : Oe ? I = "<=".concat(Y, ".").concat(fe, ".").concat(Me, "-").concat(Oe) : O ? I = "<".concat(Y, ".").concat(fe, ".").concat(+Me + 1, "-0") : I = "<=".concat(I), "".concat(D, " ").concat(I).trim()), C = (O, S, D) => {
    for (var M = 0; M < O.length; M++)
      if (!O[M].test(S))
        return !1;
    if (S.prerelease.length && !D.includePrerelease) {
      for (var F = 0; F < O.length; F++)
        if (o(O[F].semver), O[F].semver !== r.ANY && O[F].semver.prerelease.length > 0) {
          var $ = O[F].semver;
          if ($.major === S.major && $.minor === S.minor && $.patch === S.patch)
            return !0;
        }
      return !1;
    }
    return !0;
  };
  return wy;
}
var Z0e = Pj(), epe = (e, t, n) => {
  try {
    t = new Z0e(t, n);
  } catch {
    return !1;
  }
  return t.test(e);
}, Lj = epe;
function tpe(e, t, n) {
  var i = e.open(t), r = 1e4, o = 250, a = new URL(t), s = a.origin, u = ~~(r / o);
  function l(f) {
    f.source === i && (u = 0, e.removeEventListener("message", l, !1));
  }
  e.addEventListener("message", l, !1);
  function c() {
    u <= 0 || (i.postMessage(n, s), setTimeout(c, o), u -= 1);
  }
  setTimeout(c, o);
}
var npe = `.vega-embed {
  position: relative;
  display: inline-block;
  box-sizing: border-box;
}
.vega-embed.has-actions {
  padding-right: 38px;
}
.vega-embed details:not([open]) > :not(summary) {
  display: none !important;
}
.vega-embed summary {
  list-style: none;
  position: absolute;
  top: 0;
  right: 0;
  padding: 6px;
  z-index: 1000;
  background: white;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
  color: #1b1e23;
  border: 1px solid #aaa;
  border-radius: 999px;
  opacity: 0.2;
  transition: opacity 0.4s ease-in;
  cursor: pointer;
  line-height: 0px;
}
.vega-embed summary::-webkit-details-marker {
  display: none;
}
.vega-embed summary:active {
  box-shadow: #aaa 0px 0px 0px 1px inset;
}
.vega-embed summary svg {
  width: 14px;
  height: 14px;
}
.vega-embed details[open] summary {
  opacity: 0.7;
}
.vega-embed:hover summary, .vega-embed:focus-within summary {
  opacity: 1 !important;
  transition: opacity 0.2s ease;
}
.vega-embed .vega-actions {
  position: absolute;
  z-index: 1001;
  top: 35px;
  right: -9px;
  display: flex;
  flex-direction: column;
  padding-bottom: 8px;
  padding-top: 8px;
  border-radius: 4px;
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);
  border: 1px solid #d9d9d9;
  background: white;
  animation-duration: 0.15s;
  animation-name: scale-in;
  animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);
  text-align: left;
}
.vega-embed .vega-actions a {
  padding: 8px 16px;
  font-family: sans-serif;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  color: #434a56;
  text-decoration: none;
}
.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {
  background-color: #f7f7f9;
  color: black;
}
.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {
  content: "";
  display: inline-block;
  position: absolute;
}
.vega-embed .vega-actions::before {
  left: auto;
  right: 14px;
  top: -16px;
  border: 8px solid rgba(0, 0, 0, 0);
  border-bottom-color: #d9d9d9;
}
.vega-embed .vega-actions::after {
  left: auto;
  right: 15px;
  top: -14px;
  border: 7px solid rgba(0, 0, 0, 0);
  border-bottom-color: #fff;
}
.vega-embed .chart-wrapper.fit-x {
  width: 100%;
}
.vega-embed .chart-wrapper.fit-y {
  height: 100%;
}

.vega-embed-wrapper {
  max-width: 100%;
  overflow: auto;
  padding-right: 14px;
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
`;
String.prototype.startsWith || (String.prototype.startsWith = function(e, t) {
  return this.substr(!t || t < 0 ? 0 : +t, e.length) === e;
});
function Ij(e) {
  for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
    n[i - 1] = arguments[i];
  for (var r = 0, o = n; r < o.length; r++) {
    var a = o[r];
    ipe(e, a);
  }
  return e;
}
function ipe(e, t) {
  for (var n = 0, i = Object.keys(t); n < i.length; n++) {
    var r = i[n];
    U0(e, r, t[r], !0);
  }
}
var Ey;
function rpe(e, t) {
  var n = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
  if (!n) {
    if (Array.isArray(e) || (n = ope(e)) || t && e && typeof e.length == "number") {
      n && (e = n);
      var i = 0, r = function() {
      };
      return { s: r, n: function() {
        return i >= e.length ? { done: !0 } : { done: !1, value: e[i++] };
      }, e: function(l) {
        throw l;
      }, f: r };
    }
    throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
  }
  var o = !0, a = !1, s;
  return { s: function() {
    n = n.call(e);
  }, n: function() {
    var l = n.next();
    return o = l.done, l;
  }, e: function(l) {
    a = !0, s = l;
  }, f: function() {
    try {
      !o && n.return != null && n.return();
    } finally {
      if (a)
        throw s;
    }
  } };
}
function ope(e, t) {
  if (!!e) {
    if (typeof e == "string")
      return Jk(e, t);
    var n = Object.prototype.toString.call(e).slice(8, -1);
    if (n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set")
      return Array.from(e);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
      return Jk(e, t);
  }
}
function Jk(e, t) {
  (t == null || t > e.length) && (t = e.length);
  for (var n = 0, i = new Array(t); n < t; n++)
    i[n] = e[n];
  return i;
}
function Qk(e, t) {
  var n = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var i = Object.getOwnPropertySymbols(e);
    t && (i = i.filter(function(r) {
      return Object.getOwnPropertyDescriptor(e, r).enumerable;
    })), n.push.apply(n, i);
  }
  return n;
}
function ta(e) {
  for (var t = 1; t < arguments.length; t++) {
    var n = arguments[t] != null ? arguments[t] : {};
    t % 2 ? Qk(Object(n), !0).forEach(function(i) {
      Jge(e, i, n[i]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Qk(Object(n)).forEach(function(i) {
      Object.defineProperty(e, i, Object.getOwnPropertyDescriptor(n, i));
    });
  }
  return e;
}
var nr = Eie, jf = nge, _h = typeof window < "u" ? window : void 0;
jf === void 0 && _h !== null && _h !== void 0 && (Ey = _h.vl) !== null && Ey !== void 0 && Ey.compile && (jf = _h.vl);
var ape = {
  export: {
    svg: !0,
    png: !0
  },
  source: !0,
  compiled: !0,
  editor: !0
}, spe = {
  CLICK_TO_VIEW_ACTIONS: "Click to view actions",
  COMPILED_ACTION: "View Compiled Vega",
  EDITOR_ACTION: "Open in Vega Editor",
  PNG_ACTION: "Save as PNG",
  SOURCE_ACTION: "View Source",
  SVG_ACTION: "Save as SVG"
}, Pc = {
  vega: "Vega",
  "vega-lite": "Vega-Lite"
}, L0 = {
  vega: nr.version,
  "vega-lite": jf ? jf.version : "not available"
}, upe = {
  vega: (e) => e,
  "vega-lite": (e, t) => jf.compile(e, {
    config: t
  }).spec
}, lpe = `
<svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">
  <circle r="2" cy="8" cx="2"></circle>
  <circle r="2" cy="8" cx="8"></circle>
  <circle r="2" cy="8" cx="14"></circle>
</svg>`, cpe = "chart-wrapper";
function fpe(e) {
  return typeof e == "function";
}
function Zk(e, t, n, i) {
  var r = "<html><head>".concat(t, '</head><body><pre><code class="json">'), o = "</code></pre>".concat(n, "</body></html>"), a = window.open("");
  a.document.write(r + e + o), a.document.title = "".concat(Pc[i], " JSON Source");
}
function dpe(e, t) {
  if (e.$schema) {
    var n = Cj(e.$schema);
    if (t && t !== n.library) {
      var i;
      console.warn("The given visualization spec is written in ".concat(Pc[n.library], ", but mode argument sets ").concat((i = Pc[t]) !== null && i !== void 0 ? i : t, "."));
    }
    var r = n.library;
    return Lj(L0[r], "^".concat(n.version.slice(1))) || console.warn("The input spec uses ".concat(Pc[r], " ").concat(n.version, ", but the current version of ").concat(Pc[r], " is v").concat(L0[r], ".")), r;
  }
  return "mark" in e || "encoding" in e || "layer" in e || "hconcat" in e || "vconcat" in e || "facet" in e || "repeat" in e ? "vega-lite" : "marks" in e || "signals" in e || "scales" in e || "axes" in e ? "vega" : t != null ? t : "vega";
}
function hpe(e) {
  return !!(e && "load" in e);
}
function eD(e) {
  return hpe(e) ? e : nr.loader(e);
}
function gpe(e) {
  var t, n, i = (t = (n = e.usermeta) === null || n === void 0 ? void 0 : n.embedOptions) !== null && t !== void 0 ? t : {};
  return je(i.defaultStyle) && (i.defaultStyle = !1), i;
}
function ppe(e, t) {
  return zb.apply(this, arguments);
}
function zb() {
  return zb = R0(/* @__PURE__ */ fr.mark(function e(t, n) {
    var i, r, o, a, s, u, l, c, f, d, h, g = arguments;
    return fr.wrap(function(m) {
      for (; ; )
        switch (m.prev = m.next) {
          case 0:
            if (o = g.length > 2 && g[2] !== void 0 ? g[2] : {}, !je(n)) {
              m.next = 10;
              break;
            }
            return s = eD(o.loader), m.t0 = JSON, m.next = 6, s.load(n);
          case 6:
            m.t1 = m.sent, a = m.t0.parse.call(m.t0, m.t1), m.next = 11;
            break;
          case 10:
            a = n;
          case 11:
            return u = gpe(a), l = u.loader, (!s || l) && (s = eD((c = o.loader) !== null && c !== void 0 ? c : l)), m.next = 16, tD(u, s);
          case 16:
            return f = m.sent, m.next = 19, tD(o, s);
          case 19:
            return d = m.sent, h = ta(ta({}, Ij(d, f)), {}, {
              config: z0((i = d.config) !== null && i !== void 0 ? i : {}, (r = f.config) !== null && r !== void 0 ? r : {})
            }), m.next = 23, ype(t, a, h, s);
          case 23:
            return m.abrupt("return", m.sent);
          case 24:
          case "end":
            return m.stop();
        }
    }, e);
  })), zb.apply(this, arguments);
}
function tD(e, t) {
  return Ub.apply(this, arguments);
}
function Ub() {
  return Ub = R0(/* @__PURE__ */ fr.mark(function e(t, n) {
    var i, r, o;
    return fr.wrap(function(s) {
      for (; ; )
        switch (s.prev = s.next) {
          case 0:
            if (!je(t.config)) {
              s.next = 8;
              break;
            }
            return s.t1 = JSON, s.next = 4, n.load(t.config);
          case 4:
            s.t2 = s.sent, s.t0 = s.t1.parse.call(s.t1, s.t2), s.next = 9;
            break;
          case 8:
            s.t0 = (i = t.config) !== null && i !== void 0 ? i : {};
          case 9:
            if (r = s.t0, !je(t.patch)) {
              s.next = 18;
              break;
            }
            return s.t4 = JSON, s.next = 14, n.load(t.patch);
          case 14:
            s.t5 = s.sent, s.t3 = s.t4.parse.call(s.t4, s.t5), s.next = 19;
            break;
          case 18:
            s.t3 = t.patch;
          case 19:
            return o = s.t3, s.abrupt("return", ta(ta(ta({}, t), o ? {
              patch: o
            } : {}), r ? {
              config: r
            } : {}));
          case 21:
          case "end":
            return s.stop();
        }
    }, e);
  })), Ub.apply(this, arguments);
}
function mpe(e) {
  var t, n = e.getRootNode ? e.getRootNode() : document;
  return n instanceof ShadowRoot ? {
    root: n,
    rootContainer: n
  } : {
    root: document,
    rootContainer: (t = document.head) !== null && t !== void 0 ? t : document.body
  };
}
function ype(e, t) {
  return qb.apply(this, arguments);
}
function qb() {
  return qb = R0(/* @__PURE__ */ fr.mark(function e(t, n) {
    var i, r, o, a, s, u, l, c, f, d, h, g, p, m, y, v, b, x, E, A, w, _, k, C, O, S, D, M, F, $, T, L, I, Y, fe, Me, Oe, Be, Se, en, ei, tn, H, le, ve, z, Je, be, pt, at, Qi, So = arguments;
    return fr.wrap(function(au) {
      for (; ; )
        switch (au.prev = au.next) {
          case 0:
            if (Qi = function() {
              Be && document.removeEventListener("click", Be), L.finalize();
            }, c = So.length > 2 && So[2] !== void 0 ? So[2] : {}, f = So.length > 3 ? So[3] : void 0, d = c.theme ? z0(zge[c.theme], (i = c.config) !== null && i !== void 0 ? i : {}) : c.config, h = Qb(c.actions) ? c.actions : Ij({}, ape, (r = c.actions) !== null && r !== void 0 ? r : {}), g = ta(ta({}, spe), c.i18n), p = (o = c.renderer) !== null && o !== void 0 ? o : "canvas", m = (a = c.logLevel) !== null && a !== void 0 ? a : nr.Warn, y = (s = c.downloadFileName) !== null && s !== void 0 ? s : "visualization", v = typeof t == "string" ? document.querySelector(t) : t, v) {
              au.next = 12;
              break;
            }
            throw new Error("".concat(t, " does not exist"));
          case 12:
            if (c.defaultStyle !== !1 && (b = "vega-embed-style", x = mpe(v), E = x.root, A = x.rootContainer, E.getElementById(b) || (w = document.createElement("style"), w.id = b, w.innerHTML = c.defaultStyle === void 0 || c.defaultStyle === !0 ? npe.toString() : c.defaultStyle, A.appendChild(w))), _ = dpe(n, c.mode), k = upe[_](n, d), _ === "vega-lite" && k.$schema && (C = Cj(k.$schema), Lj(L0.vega, "^".concat(C.version.slice(1))) || console.warn("The compiled spec uses Vega ".concat(C.version, ", but current version is v").concat(L0.vega, "."))), v.classList.add("vega-embed"), h && v.classList.add("has-actions"), v.innerHTML = "", O = v, h && (S = document.createElement("div"), S.classList.add(cpe), v.appendChild(S), O = S), D = c.patch, D && (k = D instanceof Function ? D(k) : I0(k, D, !0, !1).newDocument), c.formatLocale && nr.formatLocale(c.formatLocale), c.timeFormatLocale && nr.timeFormatLocale(c.timeFormatLocale), c.expressionFunctions)
              for (M in c.expressionFunctions)
                F = c.expressionFunctions[M], "fn" in F ? nr.expressionFunction(M, F.fn, F.visitor) : F instanceof Function && nr.expressionFunction(M, F);
            return $ = c.ast, T = nr.parse(k, _ === "vega-lite" ? {} : d, {
              ast: $
            }), L = new (c.viewClass || nr.View)(T, ta({
              loader: f,
              logLevel: m,
              renderer: p
            }, $ ? {
              expr: (u = (l = nr.expressionInterpreter) !== null && l !== void 0 ? l : c.expr) !== null && u !== void 0 ? u : Mie
            } : {})), L.addSignalListener("autosize", (ti, En) => {
              var zn = En.type;
              zn == "fit-x" ? (O.classList.add("fit-x"), O.classList.remove("fit-y")) : zn == "fit-y" ? (O.classList.remove("fit-x"), O.classList.add("fit-y")) : zn == "fit" ? O.classList.add("fit-x", "fit-y") : O.classList.remove("fit-x", "fit-y");
            }), c.tooltip !== !1 && (I = fpe(c.tooltip) ? c.tooltip : new Kge(c.tooltip === !0 ? {} : c.tooltip).call, L.tooltip(I)), Y = c.hover, Y === void 0 && (Y = _ === "vega"), Y && (fe = typeof Y == "boolean" ? {} : Y, Me = fe.hoverSet, Oe = fe.updateSet, L.hover(Me, Oe)), c && (c.width != null && L.width(c.width), c.height != null && L.height(c.height), c.padding != null && L.padding(c.padding)), au.next = 37, L.initialize(O, c.bind).runAsync();
          case 37:
            if (h !== !1) {
              if (Se = v, c.defaultStyle !== !1 && (en = document.createElement("details"), en.title = g.CLICK_TO_VIEW_ACTIONS, v.append(en), Se = en, ei = document.createElement("summary"), ei.innerHTML = lpe, en.append(ei), Be = (ti) => {
                en.contains(ti.target) || en.removeAttribute("open");
              }, document.addEventListener("click", Be)), tn = document.createElement("div"), Se.append(tn), tn.classList.add("vega-actions"), h === !0 || h.export !== !1) {
                H = rpe(["svg", "png"]);
                try {
                  for (ve = function() {
                    var En = le.value;
                    if (h === !0 || h.export === !0 || h.export[En]) {
                      var zn = g["".concat(En.toUpperCase(), "_ACTION")], su = document.createElement("a");
                      su.text = zn, su.href = "#", su.target = "_blank", su.download = "".concat(y, ".").concat(En), su.addEventListener("mousedown", /* @__PURE__ */ function() {
                        var Bj = R0(/* @__PURE__ */ fr.mark(function __(zj) {
                          var O_;
                          return fr.wrap(function(ql) {
                            for (; ; )
                              switch (ql.prev = ql.next) {
                                case 0:
                                  return zj.preventDefault(), ql.next = 3, L.toImageURL(En, c.scaleFactor);
                                case 3:
                                  O_ = ql.sent, this.href = O_;
                                case 5:
                                case "end":
                                  return ql.stop();
                              }
                          }, __, this);
                        }));
                        return function(__) {
                          return Bj.apply(this, arguments);
                        };
                      }()), tn.append(su);
                    }
                  }, H.s(); !(le = H.n()).done; )
                    ve();
                } catch (ti) {
                  H.e(ti);
                } finally {
                  H.f();
                }
              }
              (h === !0 || h.source !== !1) && (z = document.createElement("a"), z.text = g.SOURCE_ACTION, z.href = "#", z.addEventListener("click", function(ti) {
                var En, zn;
                Zk(Hm(n), (En = c.sourceHeader) !== null && En !== void 0 ? En : "", (zn = c.sourceFooter) !== null && zn !== void 0 ? zn : "", _), ti.preventDefault();
              }), tn.append(z)), _ === "vega-lite" && (h === !0 || h.compiled !== !1) && (Je = document.createElement("a"), Je.text = g.COMPILED_ACTION, Je.href = "#", Je.addEventListener("click", function(ti) {
                var En, zn;
                Zk(Hm(k), (En = c.sourceHeader) !== null && En !== void 0 ? En : "", (zn = c.sourceFooter) !== null && zn !== void 0 ? zn : "", "vega"), ti.preventDefault();
              }), tn.append(Je)), (h === !0 || h.editor !== !1) && (pt = (be = c.editorUrl) !== null && be !== void 0 ? be : "https://vega.github.io/editor/", at = document.createElement("a"), at.text = g.EDITOR_ACTION, at.href = "#", at.addEventListener("click", function(ti) {
                tpe(window, pt, {
                  config: d,
                  mode: _,
                  renderer: p,
                  spec: Hm(n)
                }), ti.preventDefault();
              }), tn.append(at));
            }
            return au.abrupt("return", {
              view: L,
              spec: n,
              vgSpec: k,
              finalize: Qi,
              embedOptions: c
            });
          case 39:
          case "end":
            return au.stop();
        }
    }, e);
  })), qb.apply(this, arguments);
}
const Epe = /* @__PURE__ */ Uj({
  __name: "Vega",
  props: {
    plotJson: null,
    responsive: { type: Boolean }
  },
  setup(e) {
    const t = e, n = `vega_${Kj()}`, i = qj("singleBlockEmbed"), r = Wj(), o = (u) => {
      u.width = "container", i && (u.height = "container");
    }, a = () => {
      const u = document.getElementById(n), l = u && u.querySelector(".vega-bindings"), c = u && u.querySelector("canvas");
      c && l && (c.style.height = `${c.offsetHeight - l.offsetHeight}px`);
    }, s = async () => {
      try {
        t.responsive && o(t.plotJson);
        const u = await ppe(`#${n}`, t.plotJson, {
          mode: "vega-lite",
          actions: !1
        });
        r.value = u, i && a();
      } catch (u) {
        console.error("An error occurred while rendering an Altair chart: ", u);
      }
    };
    return Gj(() => {
      s();
    }), Hj(() => {
      var u;
      return void ((u = r.value) == null ? void 0 : u.finalize());
    }), (u, l) => (Yj(), Xj("div", {
      class: S_([
        "m-auto justify-center bg-white flex",
        { "w-full": t.responsive, "h-iframe": C_(i) }
      ])
    }, [
      Vj("div", {
        id: n,
        class: S_({ "w-full": t.responsive, "h-iframe": C_(i) }),
        "data-cy": "block-vega"
      }, null, 2)
    ], 2));
  }
});
export {
  Epe as default
};
