var X4 = Object.defineProperty;
var J4 = (_e, Qt, Zt) => Qt in _e ? X4(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt;
var p$ = (_e, Qt, Zt) => (J4(_e, typeof Qt != "symbol" ? Qt + "" : Qt, Zt), Zt);
function _mergeNamespaces(_e, Qt) {
  for (var Zt = 0; Zt < Qt.length; Zt++) {
    const $n = Qt[Zt];
    if (typeof $n != "string" && !Array.isArray($n)) {
      for (const Sn in $n)
        if (Sn !== "default" && !(Sn in _e)) {
          const kn = Object.getOwnPropertyDescriptor($n, Sn);
          kn && Object.defineProperty(_e, Sn, kn.get ? kn : {
            enumerable: !0,
            get: () => $n[Sn]
          });
        }
    }
  }
  return Object.freeze(Object.defineProperty(_e, Symbol.toStringTag, { value: "Module" }));
}
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function getDefaultExportFromCjs$1(_e) {
  return _e && _e.__esModule && Object.prototype.hasOwnProperty.call(_e, "default") ? _e.default : _e;
}
function getAugmentedNamespace(_e) {
  if (_e.__esModule)
    return _e;
  var Qt = _e.default;
  if (typeof Qt == "function") {
    var Zt = function $n() {
      return this instanceof $n ? Reflect.construct(Qt, arguments, this.constructor) : Qt.apply(this, arguments);
    };
    Zt.prototype = Qt.prototype;
  } else
    Zt = {};
  return Object.defineProperty(Zt, "__esModule", { value: !0 }), Object.keys(_e).forEach(function($n) {
    var Sn = Object.getOwnPropertyDescriptor(_e, $n);
    Object.defineProperty(Zt, $n, Sn.get ? Sn : {
      enumerable: !0,
      get: function() {
        return _e[$n];
      }
    });
  }), Zt;
}
var react = { exports: {} }, react_production_min = {};
/**
 * @license React
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var l$5 = Symbol.for("react.element"), n$6 = Symbol.for("react.portal"), p$7 = Symbol.for("react.fragment"), q$7 = Symbol.for("react.strict_mode"), r$4 = Symbol.for("react.profiler"), t$6 = Symbol.for("react.provider"), u$5 = Symbol.for("react.context"), v$5 = Symbol.for("react.forward_ref"), w$5 = Symbol.for("react.suspense"), x$7 = Symbol.for("react.memo"), y$7 = Symbol.for("react.lazy"), z$4 = Symbol.iterator;
function A$5(_e) {
  return _e === null || typeof _e != "object" ? null : (_e = z$4 && _e[z$4] || _e["@@iterator"], typeof _e == "function" ? _e : null);
}
var B$5 = { isMounted: function() {
  return !1;
}, enqueueForceUpdate: function() {
}, enqueueReplaceState: function() {
}, enqueueSetState: function() {
} }, C$6 = Object.assign, D$5 = {};
function E$4(_e, Qt, Zt) {
  this.props = _e, this.context = Qt, this.refs = D$5, this.updater = Zt || B$5;
}
E$4.prototype.isReactComponent = {};
E$4.prototype.setState = function(_e, Qt) {
  if (typeof _e != "object" && typeof _e != "function" && _e != null)
    throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
  this.updater.enqueueSetState(this, _e, Qt, "setState");
};
E$4.prototype.forceUpdate = function(_e) {
  this.updater.enqueueForceUpdate(this, _e, "forceUpdate");
};
function F$2() {
}
F$2.prototype = E$4.prototype;
function G$3(_e, Qt, Zt) {
  this.props = _e, this.context = Qt, this.refs = D$5, this.updater = Zt || B$5;
}
var H$4 = G$3.prototype = new F$2();
H$4.constructor = G$3;
C$6(H$4, E$4.prototype);
H$4.isPureReactComponent = !0;
var I$3 = Array.isArray, J$1 = Object.prototype.hasOwnProperty, K$3 = { current: null }, L$3 = { key: !0, ref: !0, __self: !0, __source: !0 };
function M$4(_e, Qt, Zt) {
  var $n, Sn = {}, kn = null, Kn = null;
  if (Qt != null)
    for ($n in Qt.ref !== void 0 && (Kn = Qt.ref), Qt.key !== void 0 && (kn = "" + Qt.key), Qt)
      J$1.call(Qt, $n) && !L$3.hasOwnProperty($n) && (Sn[$n] = Qt[$n]);
  var er = arguments.length - 2;
  if (er === 1)
    Sn.children = Zt;
  else if (1 < er) {
    for (var Cr = Array(er), kr = 0; kr < er; kr++)
      Cr[kr] = arguments[kr + 2];
    Sn.children = Cr;
  }
  if (_e && _e.defaultProps)
    for ($n in er = _e.defaultProps, er)
      Sn[$n] === void 0 && (Sn[$n] = er[$n]);
  return { $$typeof: l$5, type: _e, key: kn, ref: Kn, props: Sn, _owner: K$3.current };
}
function N$3(_e, Qt) {
  return { $$typeof: l$5, type: _e.type, key: Qt, ref: _e.ref, props: _e.props, _owner: _e._owner };
}
function O$2(_e) {
  return typeof _e == "object" && _e !== null && _e.$$typeof === l$5;
}
function escape$4(_e) {
  var Qt = { "=": "=0", ":": "=2" };
  return "$" + _e.replace(/[=:]/g, function(Zt) {
    return Qt[Zt];
  });
}
var P$3 = /\/+/g;
function Q$3(_e, Qt) {
  return typeof _e == "object" && _e !== null && _e.key != null ? escape$4("" + _e.key) : Qt.toString(36);
}
function R$2(_e, Qt, Zt, $n, Sn) {
  var kn = typeof _e;
  (kn === "undefined" || kn === "boolean") && (_e = null);
  var Kn = !1;
  if (_e === null)
    Kn = !0;
  else
    switch (kn) {
      case "string":
      case "number":
        Kn = !0;
        break;
      case "object":
        switch (_e.$$typeof) {
          case l$5:
          case n$6:
            Kn = !0;
        }
    }
  if (Kn)
    return Kn = _e, Sn = Sn(Kn), _e = $n === "" ? "." + Q$3(Kn, 0) : $n, I$3(Sn) ? (Zt = "", _e != null && (Zt = _e.replace(P$3, "$&/") + "/"), R$2(Sn, Qt, Zt, "", function(kr) {
      return kr;
    })) : Sn != null && (O$2(Sn) && (Sn = N$3(Sn, Zt + (!Sn.key || Kn && Kn.key === Sn.key ? "" : ("" + Sn.key).replace(P$3, "$&/") + "/") + _e)), Qt.push(Sn)), 1;
  if (Kn = 0, $n = $n === "" ? "." : $n + ":", I$3(_e))
    for (var er = 0; er < _e.length; er++) {
      kn = _e[er];
      var Cr = $n + Q$3(kn, er);
      Kn += R$2(kn, Qt, Zt, Cr, Sn);
    }
  else if (Cr = A$5(_e), typeof Cr == "function")
    for (_e = Cr.call(_e), er = 0; !(kn = _e.next()).done; )
      kn = kn.value, Cr = $n + Q$3(kn, er++), Kn += R$2(kn, Qt, Zt, Cr, Sn);
  else if (kn === "object")
    throw Qt = String(_e), Error("Objects are not valid as a React child (found: " + (Qt === "[object Object]" ? "object with keys {" + Object.keys(_e).join(", ") + "}" : Qt) + "). If you meant to render a collection of children, use an array instead.");
  return Kn;
}
function S$3(_e, Qt, Zt) {
  if (_e == null)
    return _e;
  var $n = [], Sn = 0;
  return R$2(_e, $n, "", "", function(kn) {
    return Qt.call(Zt, kn, Sn++);
  }), $n;
}
function T$2(_e) {
  if (_e._status === -1) {
    var Qt = _e._result;
    Qt = Qt(), Qt.then(function(Zt) {
      (_e._status === 0 || _e._status === -1) && (_e._status = 1, _e._result = Zt);
    }, function(Zt) {
      (_e._status === 0 || _e._status === -1) && (_e._status = 2, _e._result = Zt);
    }), _e._status === -1 && (_e._status = 0, _e._result = Qt);
  }
  if (_e._status === 1)
    return _e._result.default;
  throw _e._result;
}
var U$3 = { current: null }, V$3 = { transition: null }, W$3 = { ReactCurrentDispatcher: U$3, ReactCurrentBatchConfig: V$3, ReactCurrentOwner: K$3 };
react_production_min.Children = { map: S$3, forEach: function(_e, Qt, Zt) {
  S$3(_e, function() {
    Qt.apply(this, arguments);
  }, Zt);
}, count: function(_e) {
  var Qt = 0;
  return S$3(_e, function() {
    Qt++;
  }), Qt;
}, toArray: function(_e) {
  return S$3(_e, function(Qt) {
    return Qt;
  }) || [];
}, only: function(_e) {
  if (!O$2(_e))
    throw Error("React.Children.only expected to receive a single React element child.");
  return _e;
} };
react_production_min.Component = E$4;
react_production_min.Fragment = p$7;
react_production_min.Profiler = r$4;
react_production_min.PureComponent = G$3;
react_production_min.StrictMode = q$7;
react_production_min.Suspense = w$5;
react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W$3;
react_production_min.cloneElement = function(_e, Qt, Zt) {
  if (_e == null)
    throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + _e + ".");
  var $n = C$6({}, _e.props), Sn = _e.key, kn = _e.ref, Kn = _e._owner;
  if (Qt != null) {
    if (Qt.ref !== void 0 && (kn = Qt.ref, Kn = K$3.current), Qt.key !== void 0 && (Sn = "" + Qt.key), _e.type && _e.type.defaultProps)
      var er = _e.type.defaultProps;
    for (Cr in Qt)
      J$1.call(Qt, Cr) && !L$3.hasOwnProperty(Cr) && ($n[Cr] = Qt[Cr] === void 0 && er !== void 0 ? er[Cr] : Qt[Cr]);
  }
  var Cr = arguments.length - 2;
  if (Cr === 1)
    $n.children = Zt;
  else if (1 < Cr) {
    er = Array(Cr);
    for (var kr = 0; kr < Cr; kr++)
      er[kr] = arguments[kr + 2];
    $n.children = er;
  }
  return { $$typeof: l$5, type: _e.type, key: Sn, ref: kn, props: $n, _owner: Kn };
};
react_production_min.createContext = function(_e) {
  return _e = { $$typeof: u$5, _currentValue: _e, _currentValue2: _e, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null }, _e.Provider = { $$typeof: t$6, _context: _e }, _e.Consumer = _e;
};
react_production_min.createElement = M$4;
react_production_min.createFactory = function(_e) {
  var Qt = M$4.bind(null, _e);
  return Qt.type = _e, Qt;
};
react_production_min.createRef = function() {
  return { current: null };
};
react_production_min.forwardRef = function(_e) {
  return { $$typeof: v$5, render: _e };
};
react_production_min.isValidElement = O$2;
react_production_min.lazy = function(_e) {
  return { $$typeof: y$7, _payload: { _status: -1, _result: _e }, _init: T$2 };
};
react_production_min.memo = function(_e, Qt) {
  return { $$typeof: x$7, type: _e, compare: Qt === void 0 ? null : Qt };
};
react_production_min.startTransition = function(_e) {
  var Qt = V$3.transition;
  V$3.transition = {};
  try {
    _e();
  } finally {
    V$3.transition = Qt;
  }
};
react_production_min.unstable_act = function() {
  throw Error("act(...) is not supported in production builds of React.");
};
react_production_min.useCallback = function(_e, Qt) {
  return U$3.current.useCallback(_e, Qt);
};
react_production_min.useContext = function(_e) {
  return U$3.current.useContext(_e);
};
react_production_min.useDebugValue = function() {
};
react_production_min.useDeferredValue = function(_e) {
  return U$3.current.useDeferredValue(_e);
};
react_production_min.useEffect = function(_e, Qt) {
  return U$3.current.useEffect(_e, Qt);
};
react_production_min.useId = function() {
  return U$3.current.useId();
};
react_production_min.useImperativeHandle = function(_e, Qt, Zt) {
  return U$3.current.useImperativeHandle(_e, Qt, Zt);
};
react_production_min.useInsertionEffect = function(_e, Qt) {
  return U$3.current.useInsertionEffect(_e, Qt);
};
react_production_min.useLayoutEffect = function(_e, Qt) {
  return U$3.current.useLayoutEffect(_e, Qt);
};
react_production_min.useMemo = function(_e, Qt) {
  return U$3.current.useMemo(_e, Qt);
};
react_production_min.useReducer = function(_e, Qt, Zt) {
  return U$3.current.useReducer(_e, Qt, Zt);
};
react_production_min.useRef = function(_e) {
  return U$3.current.useRef(_e);
};
react_production_min.useState = function(_e) {
  return U$3.current.useState(_e);
};
react_production_min.useSyncExternalStore = function(_e, Qt, Zt) {
  return U$3.current.useSyncExternalStore(_e, Qt, Zt);
};
react_production_min.useTransition = function() {
  return U$3.current.useTransition();
};
react_production_min.version = "18.2.0";
react.exports = react_production_min;
var reactExports = react.exports;
const React = /* @__PURE__ */ getDefaultExportFromCjs$1(reactExports), A$4 = /* @__PURE__ */ _mergeNamespaces({
  __proto__: null,
  default: React
}, [reactExports]);
var reactDom = { exports: {} }, reactDom_production_min = {}, scheduler = { exports: {} }, scheduler_production_min = {};
/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
(function(_e) {
  function Qt(hm, ym) {
    var _m = hm.length;
    hm.push(ym);
    e:
      for (; 0 < _m; ) {
        var Sm = _m - 1 >>> 1, wm = hm[Sm];
        if (0 < Sn(wm, ym))
          hm[Sm] = ym, hm[_m] = wm, _m = Sm;
        else
          break e;
      }
  }
  function Zt(hm) {
    return hm.length === 0 ? null : hm[0];
  }
  function $n(hm) {
    if (hm.length === 0)
      return null;
    var ym = hm[0], _m = hm.pop();
    if (_m !== ym) {
      hm[0] = _m;
      e:
        for (var Sm = 0, wm = hm.length, Nm = wm >>> 1; Sm < Nm; ) {
          var Cm = 2 * (Sm + 1) - 1, Im = hm[Cm], Am = Cm + 1, Vm = hm[Am];
          if (0 > Sn(Im, _m))
            Am < wm && 0 > Sn(Vm, Im) ? (hm[Sm] = Vm, hm[Am] = _m, Sm = Am) : (hm[Sm] = Im, hm[Cm] = _m, Sm = Cm);
          else if (Am < wm && 0 > Sn(Vm, _m))
            hm[Sm] = Vm, hm[Am] = _m, Sm = Am;
          else
            break e;
        }
    }
    return ym;
  }
  function Sn(hm, ym) {
    var _m = hm.sortIndex - ym.sortIndex;
    return _m !== 0 ? _m : hm.id - ym.id;
  }
  if (typeof performance == "object" && typeof performance.now == "function") {
    var kn = performance;
    _e.unstable_now = function() {
      return kn.now();
    };
  } else {
    var Kn = Date, er = Kn.now();
    _e.unstable_now = function() {
      return Kn.now() - er;
    };
  }
  var Cr = [], kr = [], Yr = 1, Ms = null, Ds = 3, Ls = !1, js = !1, zs = !1, Fs = typeof setTimeout == "function" ? setTimeout : null, Bs = typeof clearTimeout == "function" ? clearTimeout : null, Hs = typeof setImmediate < "u" ? setImmediate : null;
  typeof navigator < "u" && navigator.scheduling !== void 0 && navigator.scheduling.isInputPending !== void 0 && navigator.scheduling.isInputPending.bind(navigator.scheduling);
  function Ws(hm) {
    for (var ym = Zt(kr); ym !== null; ) {
      if (ym.callback === null)
        $n(kr);
      else if (ym.startTime <= hm)
        $n(kr), ym.sortIndex = ym.expirationTime, Qt(Cr, ym);
      else
        break;
      ym = Zt(kr);
    }
  }
  function Ys(hm) {
    if (zs = !1, Ws(hm), !js)
      if (Zt(Cr) !== null)
        js = !0, sm(El);
      else {
        var ym = Zt(kr);
        ym !== null && mm(Ys, ym.startTime - hm);
      }
  }
  function El(hm, ym) {
    js = !1, zs && (zs = !1, Bs(Iu), Iu = -1), Ls = !0;
    var _m = Ds;
    try {
      for (Ws(ym), Ms = Zt(Cr); Ms !== null && (!(Ms.expirationTime > ym) || hm && !Nu()); ) {
        var Sm = Ms.callback;
        if (typeof Sm == "function") {
          Ms.callback = null, Ds = Ms.priorityLevel;
          var wm = Sm(Ms.expirationTime <= ym);
          ym = _e.unstable_now(), typeof wm == "function" ? Ms.callback = wm : Ms === Zt(Cr) && $n(Cr), Ws(ym);
        } else
          $n(Cr);
        Ms = Zt(Cr);
      }
      if (Ms !== null)
        var Nm = !0;
      else {
        var Cm = Zt(kr);
        Cm !== null && mm(Ys, Cm.startTime - ym), Nm = !1;
      }
      return Nm;
    } finally {
      Ms = null, Ds = _m, Ls = !1;
    }
  }
  var Mu = !1, Pl = null, Iu = -1, Tu = 5, Au = -1;
  function Nu() {
    return !(_e.unstable_now() - Au < Tu);
  }
  function gm() {
    if (Pl !== null) {
      var hm = _e.unstable_now();
      Au = hm;
      var ym = !0;
      try {
        ym = Pl(!0, hm);
      } finally {
        ym ? pm() : (Mu = !1, Pl = null);
      }
    } else
      Mu = !1;
  }
  var pm;
  if (typeof Hs == "function")
    pm = function() {
      Hs(gm);
    };
  else if (typeof MessageChannel < "u") {
    var zu = new MessageChannel(), Yu = zu.port2;
    zu.port1.onmessage = gm, pm = function() {
      Yu.postMessage(null);
    };
  } else
    pm = function() {
      Fs(gm, 0);
    };
  function sm(hm) {
    Pl = hm, Mu || (Mu = !0, pm());
  }
  function mm(hm, ym) {
    Iu = Fs(function() {
      hm(_e.unstable_now());
    }, ym);
  }
  _e.unstable_IdlePriority = 5, _e.unstable_ImmediatePriority = 1, _e.unstable_LowPriority = 4, _e.unstable_NormalPriority = 3, _e.unstable_Profiling = null, _e.unstable_UserBlockingPriority = 2, _e.unstable_cancelCallback = function(hm) {
    hm.callback = null;
  }, _e.unstable_continueExecution = function() {
    js || Ls || (js = !0, sm(El));
  }, _e.unstable_forceFrameRate = function(hm) {
    0 > hm || 125 < hm ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : Tu = 0 < hm ? Math.floor(1e3 / hm) : 5;
  }, _e.unstable_getCurrentPriorityLevel = function() {
    return Ds;
  }, _e.unstable_getFirstCallbackNode = function() {
    return Zt(Cr);
  }, _e.unstable_next = function(hm) {
    switch (Ds) {
      case 1:
      case 2:
      case 3:
        var ym = 3;
        break;
      default:
        ym = Ds;
    }
    var _m = Ds;
    Ds = ym;
    try {
      return hm();
    } finally {
      Ds = _m;
    }
  }, _e.unstable_pauseExecution = function() {
  }, _e.unstable_requestPaint = function() {
  }, _e.unstable_runWithPriority = function(hm, ym) {
    switch (hm) {
      case 1:
      case 2:
      case 3:
      case 4:
      case 5:
        break;
      default:
        hm = 3;
    }
    var _m = Ds;
    Ds = hm;
    try {
      return ym();
    } finally {
      Ds = _m;
    }
  }, _e.unstable_scheduleCallback = function(hm, ym, _m) {
    var Sm = _e.unstable_now();
    switch (typeof _m == "object" && _m !== null ? (_m = _m.delay, _m = typeof _m == "number" && 0 < _m ? Sm + _m : Sm) : _m = Sm, hm) {
      case 1:
        var wm = -1;
        break;
      case 2:
        wm = 250;
        break;
      case 5:
        wm = 1073741823;
        break;
      case 4:
        wm = 1e4;
        break;
      default:
        wm = 5e3;
    }
    return wm = _m + wm, hm = { id: Yr++, callback: ym, priorityLevel: hm, startTime: _m, expirationTime: wm, sortIndex: -1 }, _m > Sm ? (hm.sortIndex = _m, Qt(kr, hm), Zt(Cr) === null && hm === Zt(kr) && (zs ? (Bs(Iu), Iu = -1) : zs = !0, mm(Ys, _m - Sm))) : (hm.sortIndex = wm, Qt(Cr, hm), js || Ls || (js = !0, sm(El))), hm;
  }, _e.unstable_shouldYield = Nu, _e.unstable_wrapCallback = function(hm) {
    var ym = Ds;
    return function() {
      var _m = Ds;
      Ds = ym;
      try {
        return hm.apply(this, arguments);
      } finally {
        Ds = _m;
      }
    };
  };
})(scheduler_production_min);
scheduler.exports = scheduler_production_min;
var schedulerExports = scheduler.exports;
/**
 * @license React
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var aa$1 = reactExports, ca$1 = schedulerExports;
function p$6(_e) {
  for (var Qt = "https://reactjs.org/docs/error-decoder.html?invariant=" + _e, Zt = 1; Zt < arguments.length; Zt++)
    Qt += "&args[]=" + encodeURIComponent(arguments[Zt]);
  return "Minified React error #" + _e + "; visit " + Qt + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
}
var da$1 = /* @__PURE__ */ new Set(), ea$2 = {};
function fa$1(_e, Qt) {
  ha$1(_e, Qt), ha$1(_e + "Capture", Qt);
}
function ha$1(_e, Qt) {
  for (ea$2[_e] = Qt, _e = 0; _e < Qt.length; _e++)
    da$1.add(Qt[_e]);
}
var ia$1 = !(typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u"), ja$1 = Object.prototype.hasOwnProperty, ka$1 = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/, la$1 = {}, ma$2 = {};
function oa$1(_e) {
  return ja$1.call(ma$2, _e) ? !0 : ja$1.call(la$1, _e) ? !1 : ka$1.test(_e) ? ma$2[_e] = !0 : (la$1[_e] = !0, !1);
}
function pa$2(_e, Qt, Zt, $n) {
  if (Zt !== null && Zt.type === 0)
    return !1;
  switch (typeof Qt) {
    case "function":
    case "symbol":
      return !0;
    case "boolean":
      return $n ? !1 : Zt !== null ? !Zt.acceptsBooleans : (_e = _e.toLowerCase().slice(0, 5), _e !== "data-" && _e !== "aria-");
    default:
      return !1;
  }
}
function qa$1(_e, Qt, Zt, $n) {
  if (Qt === null || typeof Qt > "u" || pa$2(_e, Qt, Zt, $n))
    return !0;
  if ($n)
    return !1;
  if (Zt !== null)
    switch (Zt.type) {
      case 3:
        return !Qt;
      case 4:
        return Qt === !1;
      case 5:
        return isNaN(Qt);
      case 6:
        return isNaN(Qt) || 1 > Qt;
    }
  return !1;
}
function v$4(_e, Qt, Zt, $n, Sn, kn, Kn) {
  this.acceptsBooleans = Qt === 2 || Qt === 3 || Qt === 4, this.attributeName = $n, this.attributeNamespace = Sn, this.mustUseProperty = Zt, this.propertyName = _e, this.type = Qt, this.sanitizeURL = kn, this.removeEmptyString = Kn;
}
var z$3 = {};
"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(_e) {
  z$3[_e] = new v$4(_e, 0, !1, _e, null, !1, !1);
});
[["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(_e) {
  var Qt = _e[0];
  z$3[Qt] = new v$4(Qt, 1, !1, _e[1], null, !1, !1);
});
["contentEditable", "draggable", "spellCheck", "value"].forEach(function(_e) {
  z$3[_e] = new v$4(_e, 2, !1, _e.toLowerCase(), null, !1, !1);
});
["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(_e) {
  z$3[_e] = new v$4(_e, 2, !1, _e, null, !1, !1);
});
"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(_e) {
  z$3[_e] = new v$4(_e, 3, !1, _e.toLowerCase(), null, !1, !1);
});
["checked", "multiple", "muted", "selected"].forEach(function(_e) {
  z$3[_e] = new v$4(_e, 3, !0, _e, null, !1, !1);
});
["capture", "download"].forEach(function(_e) {
  z$3[_e] = new v$4(_e, 4, !1, _e, null, !1, !1);
});
["cols", "rows", "size", "span"].forEach(function(_e) {
  z$3[_e] = new v$4(_e, 6, !1, _e, null, !1, !1);
});
["rowSpan", "start"].forEach(function(_e) {
  z$3[_e] = new v$4(_e, 5, !1, _e.toLowerCase(), null, !1, !1);
});
var ra$1 = /[\-:]([a-z])/g;
function sa$2(_e) {
  return _e[1].toUpperCase();
}
"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(_e) {
  var Qt = _e.replace(
    ra$1,
    sa$2
  );
  z$3[Qt] = new v$4(Qt, 1, !1, _e, null, !1, !1);
});
"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(_e) {
  var Qt = _e.replace(ra$1, sa$2);
  z$3[Qt] = new v$4(Qt, 1, !1, _e, "http://www.w3.org/1999/xlink", !1, !1);
});
["xml:base", "xml:lang", "xml:space"].forEach(function(_e) {
  var Qt = _e.replace(ra$1, sa$2);
  z$3[Qt] = new v$4(Qt, 1, !1, _e, "http://www.w3.org/XML/1998/namespace", !1, !1);
});
["tabIndex", "crossOrigin"].forEach(function(_e) {
  z$3[_e] = new v$4(_e, 1, !1, _e.toLowerCase(), null, !1, !1);
});
z$3.xlinkHref = new v$4("xlinkHref", 1, !1, "xlink:href", "http://www.w3.org/1999/xlink", !0, !1);
["src", "href", "action", "formAction"].forEach(function(_e) {
  z$3[_e] = new v$4(_e, 1, !1, _e.toLowerCase(), null, !0, !0);
});
function ta$1(_e, Qt, Zt, $n) {
  var Sn = z$3.hasOwnProperty(Qt) ? z$3[Qt] : null;
  (Sn !== null ? Sn.type !== 0 : $n || !(2 < Qt.length) || Qt[0] !== "o" && Qt[0] !== "O" || Qt[1] !== "n" && Qt[1] !== "N") && (qa$1(Qt, Zt, Sn, $n) && (Zt = null), $n || Sn === null ? oa$1(Qt) && (Zt === null ? _e.removeAttribute(Qt) : _e.setAttribute(Qt, "" + Zt)) : Sn.mustUseProperty ? _e[Sn.propertyName] = Zt === null ? Sn.type === 3 ? !1 : "" : Zt : (Qt = Sn.attributeName, $n = Sn.attributeNamespace, Zt === null ? _e.removeAttribute(Qt) : (Sn = Sn.type, Zt = Sn === 3 || Sn === 4 && Zt === !0 ? "" : "" + Zt, $n ? _e.setAttributeNS($n, Qt, Zt) : _e.setAttribute(Qt, Zt))));
}
var ua$1 = aa$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, va$1 = Symbol.for("react.element"), wa$1 = Symbol.for("react.portal"), ya$1 = Symbol.for("react.fragment"), za$1 = Symbol.for("react.strict_mode"), Aa$1 = Symbol.for("react.profiler"), Ba$1 = Symbol.for("react.provider"), Ca$1 = Symbol.for("react.context"), Da$1 = Symbol.for("react.forward_ref"), Ea$1 = Symbol.for("react.suspense"), Fa$1 = Symbol.for("react.suspense_list"), Ga$1 = Symbol.for("react.memo"), Ha = Symbol.for("react.lazy"), Ia$1 = Symbol.for("react.offscreen"), Ja$1 = Symbol.iterator;
function Ka$1(_e) {
  return _e === null || typeof _e != "object" ? null : (_e = Ja$1 && _e[Ja$1] || _e["@@iterator"], typeof _e == "function" ? _e : null);
}
var A$3 = Object.assign, La$1;
function Ma$1(_e) {
  if (La$1 === void 0)
    try {
      throw Error();
    } catch (Zt) {
      var Qt = Zt.stack.trim().match(/\n( *(at )?)/);
      La$1 = Qt && Qt[1] || "";
    }
  return `
` + La$1 + _e;
}
var Na$1 = !1;
function Oa$1(_e, Qt) {
  if (!_e || Na$1)
    return "";
  Na$1 = !0;
  var Zt = Error.prepareStackTrace;
  Error.prepareStackTrace = void 0;
  try {
    if (Qt)
      if (Qt = function() {
        throw Error();
      }, Object.defineProperty(Qt.prototype, "props", { set: function() {
        throw Error();
      } }), typeof Reflect == "object" && Reflect.construct) {
        try {
          Reflect.construct(Qt, []);
        } catch (kr) {
          var $n = kr;
        }
        Reflect.construct(_e, [], Qt);
      } else {
        try {
          Qt.call();
        } catch (kr) {
          $n = kr;
        }
        _e.call(Qt.prototype);
      }
    else {
      try {
        throw Error();
      } catch (kr) {
        $n = kr;
      }
      _e();
    }
  } catch (kr) {
    if (kr && $n && typeof kr.stack == "string") {
      for (var Sn = kr.stack.split(`
`), kn = $n.stack.split(`
`), Kn = Sn.length - 1, er = kn.length - 1; 1 <= Kn && 0 <= er && Sn[Kn] !== kn[er]; )
        er--;
      for (; 1 <= Kn && 0 <= er; Kn--, er--)
        if (Sn[Kn] !== kn[er]) {
          if (Kn !== 1 || er !== 1)
            do
              if (Kn--, er--, 0 > er || Sn[Kn] !== kn[er]) {
                var Cr = `
` + Sn[Kn].replace(" at new ", " at ");
                return _e.displayName && Cr.includes("<anonymous>") && (Cr = Cr.replace("<anonymous>", _e.displayName)), Cr;
              }
            while (1 <= Kn && 0 <= er);
          break;
        }
    }
  } finally {
    Na$1 = !1, Error.prepareStackTrace = Zt;
  }
  return (_e = _e ? _e.displayName || _e.name : "") ? Ma$1(_e) : "";
}
function Pa$1(_e) {
  switch (_e.tag) {
    case 5:
      return Ma$1(_e.type);
    case 16:
      return Ma$1("Lazy");
    case 13:
      return Ma$1("Suspense");
    case 19:
      return Ma$1("SuspenseList");
    case 0:
    case 2:
    case 15:
      return _e = Oa$1(_e.type, !1), _e;
    case 11:
      return _e = Oa$1(_e.type.render, !1), _e;
    case 1:
      return _e = Oa$1(_e.type, !0), _e;
    default:
      return "";
  }
}
function Qa$1(_e) {
  if (_e == null)
    return null;
  if (typeof _e == "function")
    return _e.displayName || _e.name || null;
  if (typeof _e == "string")
    return _e;
  switch (_e) {
    case ya$1:
      return "Fragment";
    case wa$1:
      return "Portal";
    case Aa$1:
      return "Profiler";
    case za$1:
      return "StrictMode";
    case Ea$1:
      return "Suspense";
    case Fa$1:
      return "SuspenseList";
  }
  if (typeof _e == "object")
    switch (_e.$$typeof) {
      case Ca$1:
        return (_e.displayName || "Context") + ".Consumer";
      case Ba$1:
        return (_e._context.displayName || "Context") + ".Provider";
      case Da$1:
        var Qt = _e.render;
        return _e = _e.displayName, _e || (_e = Qt.displayName || Qt.name || "", _e = _e !== "" ? "ForwardRef(" + _e + ")" : "ForwardRef"), _e;
      case Ga$1:
        return Qt = _e.displayName || null, Qt !== null ? Qt : Qa$1(_e.type) || "Memo";
      case Ha:
        Qt = _e._payload, _e = _e._init;
        try {
          return Qa$1(_e(Qt));
        } catch {
        }
    }
  return null;
}
function Ra$1(_e) {
  var Qt = _e.type;
  switch (_e.tag) {
    case 24:
      return "Cache";
    case 9:
      return (Qt.displayName || "Context") + ".Consumer";
    case 10:
      return (Qt._context.displayName || "Context") + ".Provider";
    case 18:
      return "DehydratedFragment";
    case 11:
      return _e = Qt.render, _e = _e.displayName || _e.name || "", Qt.displayName || (_e !== "" ? "ForwardRef(" + _e + ")" : "ForwardRef");
    case 7:
      return "Fragment";
    case 5:
      return Qt;
    case 4:
      return "Portal";
    case 3:
      return "Root";
    case 6:
      return "Text";
    case 16:
      return Qa$1(Qt);
    case 8:
      return Qt === za$1 ? "StrictMode" : "Mode";
    case 22:
      return "Offscreen";
    case 12:
      return "Profiler";
    case 21:
      return "Scope";
    case 13:
      return "Suspense";
    case 19:
      return "SuspenseList";
    case 25:
      return "TracingMarker";
    case 1:
    case 0:
    case 17:
    case 2:
    case 14:
    case 15:
      if (typeof Qt == "function")
        return Qt.displayName || Qt.name || null;
      if (typeof Qt == "string")
        return Qt;
  }
  return null;
}
function Sa$1(_e) {
  switch (typeof _e) {
    case "boolean":
    case "number":
    case "string":
    case "undefined":
      return _e;
    case "object":
      return _e;
    default:
      return "";
  }
}
function Ta$1(_e) {
  var Qt = _e.type;
  return (_e = _e.nodeName) && _e.toLowerCase() === "input" && (Qt === "checkbox" || Qt === "radio");
}
function Ua(_e) {
  var Qt = Ta$1(_e) ? "checked" : "value", Zt = Object.getOwnPropertyDescriptor(_e.constructor.prototype, Qt), $n = "" + _e[Qt];
  if (!_e.hasOwnProperty(Qt) && typeof Zt < "u" && typeof Zt.get == "function" && typeof Zt.set == "function") {
    var Sn = Zt.get, kn = Zt.set;
    return Object.defineProperty(_e, Qt, { configurable: !0, get: function() {
      return Sn.call(this);
    }, set: function(Kn) {
      $n = "" + Kn, kn.call(this, Kn);
    } }), Object.defineProperty(_e, Qt, { enumerable: Zt.enumerable }), { getValue: function() {
      return $n;
    }, setValue: function(Kn) {
      $n = "" + Kn;
    }, stopTracking: function() {
      _e._valueTracker = null, delete _e[Qt];
    } };
  }
}
function Va$1(_e) {
  _e._valueTracker || (_e._valueTracker = Ua(_e));
}
function Wa$1(_e) {
  if (!_e)
    return !1;
  var Qt = _e._valueTracker;
  if (!Qt)
    return !0;
  var Zt = Qt.getValue(), $n = "";
  return _e && ($n = Ta$1(_e) ? _e.checked ? "true" : "false" : _e.value), _e = $n, _e !== Zt ? (Qt.setValue(_e), !0) : !1;
}
function Xa$1(_e) {
  if (_e = _e || (typeof document < "u" ? document : void 0), typeof _e > "u")
    return null;
  try {
    return _e.activeElement || _e.body;
  } catch {
    return _e.body;
  }
}
function Ya$1(_e, Qt) {
  var Zt = Qt.checked;
  return A$3({}, Qt, { defaultChecked: void 0, defaultValue: void 0, value: void 0, checked: Zt ?? _e._wrapperState.initialChecked });
}
function Za$1(_e, Qt) {
  var Zt = Qt.defaultValue == null ? "" : Qt.defaultValue, $n = Qt.checked != null ? Qt.checked : Qt.defaultChecked;
  Zt = Sa$1(Qt.value != null ? Qt.value : Zt), _e._wrapperState = { initialChecked: $n, initialValue: Zt, controlled: Qt.type === "checkbox" || Qt.type === "radio" ? Qt.checked != null : Qt.value != null };
}
function ab$1(_e, Qt) {
  Qt = Qt.checked, Qt != null && ta$1(_e, "checked", Qt, !1);
}
function bb$1(_e, Qt) {
  ab$1(_e, Qt);
  var Zt = Sa$1(Qt.value), $n = Qt.type;
  if (Zt != null)
    $n === "number" ? (Zt === 0 && _e.value === "" || _e.value != Zt) && (_e.value = "" + Zt) : _e.value !== "" + Zt && (_e.value = "" + Zt);
  else if ($n === "submit" || $n === "reset") {
    _e.removeAttribute("value");
    return;
  }
  Qt.hasOwnProperty("value") ? cb$1(_e, Qt.type, Zt) : Qt.hasOwnProperty("defaultValue") && cb$1(_e, Qt.type, Sa$1(Qt.defaultValue)), Qt.checked == null && Qt.defaultChecked != null && (_e.defaultChecked = !!Qt.defaultChecked);
}
function db$1(_e, Qt, Zt) {
  if (Qt.hasOwnProperty("value") || Qt.hasOwnProperty("defaultValue")) {
    var $n = Qt.type;
    if (!($n !== "submit" && $n !== "reset" || Qt.value !== void 0 && Qt.value !== null))
      return;
    Qt = "" + _e._wrapperState.initialValue, Zt || Qt === _e.value || (_e.value = Qt), _e.defaultValue = Qt;
  }
  Zt = _e.name, Zt !== "" && (_e.name = ""), _e.defaultChecked = !!_e._wrapperState.initialChecked, Zt !== "" && (_e.name = Zt);
}
function cb$1(_e, Qt, Zt) {
  (Qt !== "number" || Xa$1(_e.ownerDocument) !== _e) && (Zt == null ? _e.defaultValue = "" + _e._wrapperState.initialValue : _e.defaultValue !== "" + Zt && (_e.defaultValue = "" + Zt));
}
var eb$1 = Array.isArray;
function fb$1(_e, Qt, Zt, $n) {
  if (_e = _e.options, Qt) {
    Qt = {};
    for (var Sn = 0; Sn < Zt.length; Sn++)
      Qt["$" + Zt[Sn]] = !0;
    for (Zt = 0; Zt < _e.length; Zt++)
      Sn = Qt.hasOwnProperty("$" + _e[Zt].value), _e[Zt].selected !== Sn && (_e[Zt].selected = Sn), Sn && $n && (_e[Zt].defaultSelected = !0);
  } else {
    for (Zt = "" + Sa$1(Zt), Qt = null, Sn = 0; Sn < _e.length; Sn++) {
      if (_e[Sn].value === Zt) {
        _e[Sn].selected = !0, $n && (_e[Sn].defaultSelected = !0);
        return;
      }
      Qt !== null || _e[Sn].disabled || (Qt = _e[Sn]);
    }
    Qt !== null && (Qt.selected = !0);
  }
}
function gb$1(_e, Qt) {
  if (Qt.dangerouslySetInnerHTML != null)
    throw Error(p$6(91));
  return A$3({}, Qt, { value: void 0, defaultValue: void 0, children: "" + _e._wrapperState.initialValue });
}
function hb$1(_e, Qt) {
  var Zt = Qt.value;
  if (Zt == null) {
    if (Zt = Qt.children, Qt = Qt.defaultValue, Zt != null) {
      if (Qt != null)
        throw Error(p$6(92));
      if (eb$1(Zt)) {
        if (1 < Zt.length)
          throw Error(p$6(93));
        Zt = Zt[0];
      }
      Qt = Zt;
    }
    Qt == null && (Qt = ""), Zt = Qt;
  }
  _e._wrapperState = { initialValue: Sa$1(Zt) };
}
function ib$1(_e, Qt) {
  var Zt = Sa$1(Qt.value), $n = Sa$1(Qt.defaultValue);
  Zt != null && (Zt = "" + Zt, Zt !== _e.value && (_e.value = Zt), Qt.defaultValue == null && _e.defaultValue !== Zt && (_e.defaultValue = Zt)), $n != null && (_e.defaultValue = "" + $n);
}
function jb$1(_e) {
  var Qt = _e.textContent;
  Qt === _e._wrapperState.initialValue && Qt !== "" && Qt !== null && (_e.value = Qt);
}
function kb$1(_e) {
  switch (_e) {
    case "svg":
      return "http://www.w3.org/2000/svg";
    case "math":
      return "http://www.w3.org/1998/Math/MathML";
    default:
      return "http://www.w3.org/1999/xhtml";
  }
}
function lb$1(_e, Qt) {
  return _e == null || _e === "http://www.w3.org/1999/xhtml" ? kb$1(Qt) : _e === "http://www.w3.org/2000/svg" && Qt === "foreignObject" ? "http://www.w3.org/1999/xhtml" : _e;
}
var mb$2, nb$1 = function(_e) {
  return typeof MSApp < "u" && MSApp.execUnsafeLocalFunction ? function(Qt, Zt, $n, Sn) {
    MSApp.execUnsafeLocalFunction(function() {
      return _e(Qt, Zt, $n, Sn);
    });
  } : _e;
}(function(_e, Qt) {
  if (_e.namespaceURI !== "http://www.w3.org/2000/svg" || "innerHTML" in _e)
    _e.innerHTML = Qt;
  else {
    for (mb$2 = mb$2 || document.createElement("div"), mb$2.innerHTML = "<svg>" + Qt.valueOf().toString() + "</svg>", Qt = mb$2.firstChild; _e.firstChild; )
      _e.removeChild(_e.firstChild);
    for (; Qt.firstChild; )
      _e.appendChild(Qt.firstChild);
  }
});
function ob$1(_e, Qt) {
  if (Qt) {
    var Zt = _e.firstChild;
    if (Zt && Zt === _e.lastChild && Zt.nodeType === 3) {
      Zt.nodeValue = Qt;
      return;
    }
  }
  _e.textContent = Qt;
}
var pb$1 = {
  animationIterationCount: !0,
  aspectRatio: !0,
  borderImageOutset: !0,
  borderImageSlice: !0,
  borderImageWidth: !0,
  boxFlex: !0,
  boxFlexGroup: !0,
  boxOrdinalGroup: !0,
  columnCount: !0,
  columns: !0,
  flex: !0,
  flexGrow: !0,
  flexPositive: !0,
  flexShrink: !0,
  flexNegative: !0,
  flexOrder: !0,
  gridArea: !0,
  gridRow: !0,
  gridRowEnd: !0,
  gridRowSpan: !0,
  gridRowStart: !0,
  gridColumn: !0,
  gridColumnEnd: !0,
  gridColumnSpan: !0,
  gridColumnStart: !0,
  fontWeight: !0,
  lineClamp: !0,
  lineHeight: !0,
  opacity: !0,
  order: !0,
  orphans: !0,
  tabSize: !0,
  widows: !0,
  zIndex: !0,
  zoom: !0,
  fillOpacity: !0,
  floodOpacity: !0,
  stopOpacity: !0,
  strokeDasharray: !0,
  strokeDashoffset: !0,
  strokeMiterlimit: !0,
  strokeOpacity: !0,
  strokeWidth: !0
}, qb$1 = ["Webkit", "ms", "Moz", "O"];
Object.keys(pb$1).forEach(function(_e) {
  qb$1.forEach(function(Qt) {
    Qt = Qt + _e.charAt(0).toUpperCase() + _e.substring(1), pb$1[Qt] = pb$1[_e];
  });
});
function rb$1(_e, Qt, Zt) {
  return Qt == null || typeof Qt == "boolean" || Qt === "" ? "" : Zt || typeof Qt != "number" || Qt === 0 || pb$1.hasOwnProperty(_e) && pb$1[_e] ? ("" + Qt).trim() : Qt + "px";
}
function sb$1(_e, Qt) {
  _e = _e.style;
  for (var Zt in Qt)
    if (Qt.hasOwnProperty(Zt)) {
      var $n = Zt.indexOf("--") === 0, Sn = rb$1(Zt, Qt[Zt], $n);
      Zt === "float" && (Zt = "cssFloat"), $n ? _e.setProperty(Zt, Sn) : _e[Zt] = Sn;
    }
}
var tb$1 = A$3({ menuitem: !0 }, { area: !0, base: !0, br: !0, col: !0, embed: !0, hr: !0, img: !0, input: !0, keygen: !0, link: !0, meta: !0, param: !0, source: !0, track: !0, wbr: !0 });
function ub$1(_e, Qt) {
  if (Qt) {
    if (tb$1[_e] && (Qt.children != null || Qt.dangerouslySetInnerHTML != null))
      throw Error(p$6(137, _e));
    if (Qt.dangerouslySetInnerHTML != null) {
      if (Qt.children != null)
        throw Error(p$6(60));
      if (typeof Qt.dangerouslySetInnerHTML != "object" || !("__html" in Qt.dangerouslySetInnerHTML))
        throw Error(p$6(61));
    }
    if (Qt.style != null && typeof Qt.style != "object")
      throw Error(p$6(62));
  }
}
function vb$1(_e, Qt) {
  if (_e.indexOf("-") === -1)
    return typeof Qt.is == "string";
  switch (_e) {
    case "annotation-xml":
    case "color-profile":
    case "font-face":
    case "font-face-src":
    case "font-face-uri":
    case "font-face-format":
    case "font-face-name":
    case "missing-glyph":
      return !1;
    default:
      return !0;
  }
}
var wb$1 = null;
function xb$1(_e) {
  return _e = _e.target || _e.srcElement || window, _e.correspondingUseElement && (_e = _e.correspondingUseElement), _e.nodeType === 3 ? _e.parentNode : _e;
}
var yb$1 = null, zb$1 = null, Ab$1 = null;
function Bb$1(_e) {
  if (_e = Cb$1(_e)) {
    if (typeof yb$1 != "function")
      throw Error(p$6(280));
    var Qt = _e.stateNode;
    Qt && (Qt = Db$1(Qt), yb$1(_e.stateNode, _e.type, Qt));
  }
}
function Eb$1(_e) {
  zb$1 ? Ab$1 ? Ab$1.push(_e) : Ab$1 = [_e] : zb$1 = _e;
}
function Fb$1() {
  if (zb$1) {
    var _e = zb$1, Qt = Ab$1;
    if (Ab$1 = zb$1 = null, Bb$1(_e), Qt)
      for (_e = 0; _e < Qt.length; _e++)
        Bb$1(Qt[_e]);
  }
}
function Gb$1(_e, Qt) {
  return _e(Qt);
}
function Hb$1() {
}
var Ib$1 = !1;
function Jb$1(_e, Qt, Zt) {
  if (Ib$1)
    return _e(Qt, Zt);
  Ib$1 = !0;
  try {
    return Gb$1(_e, Qt, Zt);
  } finally {
    Ib$1 = !1, (zb$1 !== null || Ab$1 !== null) && (Hb$1(), Fb$1());
  }
}
function Kb$1(_e, Qt) {
  var Zt = _e.stateNode;
  if (Zt === null)
    return null;
  var $n = Db$1(Zt);
  if ($n === null)
    return null;
  Zt = $n[Qt];
  e:
    switch (Qt) {
      case "onClick":
      case "onClickCapture":
      case "onDoubleClick":
      case "onDoubleClickCapture":
      case "onMouseDown":
      case "onMouseDownCapture":
      case "onMouseMove":
      case "onMouseMoveCapture":
      case "onMouseUp":
      case "onMouseUpCapture":
      case "onMouseEnter":
        ($n = !$n.disabled) || (_e = _e.type, $n = !(_e === "button" || _e === "input" || _e === "select" || _e === "textarea")), _e = !$n;
        break e;
      default:
        _e = !1;
    }
  if (_e)
    return null;
  if (Zt && typeof Zt != "function")
    throw Error(p$6(231, Qt, typeof Zt));
  return Zt;
}
var Lb$1 = !1;
if (ia$1)
  try {
    var Mb$1 = {};
    Object.defineProperty(Mb$1, "passive", { get: function() {
      Lb$1 = !0;
    } }), window.addEventListener("test", Mb$1, Mb$1), window.removeEventListener("test", Mb$1, Mb$1);
  } catch {
    Lb$1 = !1;
  }
function Nb$1(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr) {
  var kr = Array.prototype.slice.call(arguments, 3);
  try {
    Qt.apply(Zt, kr);
  } catch (Yr) {
    this.onError(Yr);
  }
}
var Ob$1 = !1, Pb$1 = null, Qb$1 = !1, Rb$1 = null, Sb$1 = { onError: function(_e) {
  Ob$1 = !0, Pb$1 = _e;
} };
function Tb$1(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr) {
  Ob$1 = !1, Pb$1 = null, Nb$1.apply(Sb$1, arguments);
}
function Ub$1(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr) {
  if (Tb$1.apply(this, arguments), Ob$1) {
    if (Ob$1) {
      var kr = Pb$1;
      Ob$1 = !1, Pb$1 = null;
    } else
      throw Error(p$6(198));
    Qb$1 || (Qb$1 = !0, Rb$1 = kr);
  }
}
function Vb$1(_e) {
  var Qt = _e, Zt = _e;
  if (_e.alternate)
    for (; Qt.return; )
      Qt = Qt.return;
  else {
    _e = Qt;
    do
      Qt = _e, Qt.flags & 4098 && (Zt = Qt.return), _e = Qt.return;
    while (_e);
  }
  return Qt.tag === 3 ? Zt : null;
}
function Wb$1(_e) {
  if (_e.tag === 13) {
    var Qt = _e.memoizedState;
    if (Qt === null && (_e = _e.alternate, _e !== null && (Qt = _e.memoizedState)), Qt !== null)
      return Qt.dehydrated;
  }
  return null;
}
function Xb$1(_e) {
  if (Vb$1(_e) !== _e)
    throw Error(p$6(188));
}
function Yb$1(_e) {
  var Qt = _e.alternate;
  if (!Qt) {
    if (Qt = Vb$1(_e), Qt === null)
      throw Error(p$6(188));
    return Qt !== _e ? null : _e;
  }
  for (var Zt = _e, $n = Qt; ; ) {
    var Sn = Zt.return;
    if (Sn === null)
      break;
    var kn = Sn.alternate;
    if (kn === null) {
      if ($n = Sn.return, $n !== null) {
        Zt = $n;
        continue;
      }
      break;
    }
    if (Sn.child === kn.child) {
      for (kn = Sn.child; kn; ) {
        if (kn === Zt)
          return Xb$1(Sn), _e;
        if (kn === $n)
          return Xb$1(Sn), Qt;
        kn = kn.sibling;
      }
      throw Error(p$6(188));
    }
    if (Zt.return !== $n.return)
      Zt = Sn, $n = kn;
    else {
      for (var Kn = !1, er = Sn.child; er; ) {
        if (er === Zt) {
          Kn = !0, Zt = Sn, $n = kn;
          break;
        }
        if (er === $n) {
          Kn = !0, $n = Sn, Zt = kn;
          break;
        }
        er = er.sibling;
      }
      if (!Kn) {
        for (er = kn.child; er; ) {
          if (er === Zt) {
            Kn = !0, Zt = kn, $n = Sn;
            break;
          }
          if (er === $n) {
            Kn = !0, $n = kn, Zt = Sn;
            break;
          }
          er = er.sibling;
        }
        if (!Kn)
          throw Error(p$6(189));
      }
    }
    if (Zt.alternate !== $n)
      throw Error(p$6(190));
  }
  if (Zt.tag !== 3)
    throw Error(p$6(188));
  return Zt.stateNode.current === Zt ? _e : Qt;
}
function Zb$1(_e) {
  return _e = Yb$1(_e), _e !== null ? $b$1(_e) : null;
}
function $b$1(_e) {
  if (_e.tag === 5 || _e.tag === 6)
    return _e;
  for (_e = _e.child; _e !== null; ) {
    var Qt = $b$1(_e);
    if (Qt !== null)
      return Qt;
    _e = _e.sibling;
  }
  return null;
}
var ac$1 = ca$1.unstable_scheduleCallback, bc$1 = ca$1.unstable_cancelCallback, cc$1 = ca$1.unstable_shouldYield, dc$1 = ca$1.unstable_requestPaint, B$4 = ca$1.unstable_now, ec$1 = ca$1.unstable_getCurrentPriorityLevel, fc$1 = ca$1.unstable_ImmediatePriority, gc$1 = ca$1.unstable_UserBlockingPriority, hc$1 = ca$1.unstable_NormalPriority, ic$1 = ca$1.unstable_LowPriority, jc$1 = ca$1.unstable_IdlePriority, kc$1 = null, lc$1 = null;
function mc$2(_e) {
  if (lc$1 && typeof lc$1.onCommitFiberRoot == "function")
    try {
      lc$1.onCommitFiberRoot(kc$1, _e, void 0, (_e.current.flags & 128) === 128);
    } catch {
    }
}
var oc$1 = Math.clz32 ? Math.clz32 : nc$1, pc$1 = Math.log, qc$1 = Math.LN2;
function nc$1(_e) {
  return _e >>>= 0, _e === 0 ? 32 : 31 - (pc$1(_e) / qc$1 | 0) | 0;
}
var rc$1 = 64, sc$1 = 4194304;
function tc$1(_e) {
  switch (_e & -_e) {
    case 1:
      return 1;
    case 2:
      return 2;
    case 4:
      return 4;
    case 8:
      return 8;
    case 16:
      return 16;
    case 32:
      return 32;
    case 64:
    case 128:
    case 256:
    case 512:
    case 1024:
    case 2048:
    case 4096:
    case 8192:
    case 16384:
    case 32768:
    case 65536:
    case 131072:
    case 262144:
    case 524288:
    case 1048576:
    case 2097152:
      return _e & 4194240;
    case 4194304:
    case 8388608:
    case 16777216:
    case 33554432:
    case 67108864:
      return _e & 130023424;
    case 134217728:
      return 134217728;
    case 268435456:
      return 268435456;
    case 536870912:
      return 536870912;
    case 1073741824:
      return 1073741824;
    default:
      return _e;
  }
}
function uc$1(_e, Qt) {
  var Zt = _e.pendingLanes;
  if (Zt === 0)
    return 0;
  var $n = 0, Sn = _e.suspendedLanes, kn = _e.pingedLanes, Kn = Zt & 268435455;
  if (Kn !== 0) {
    var er = Kn & ~Sn;
    er !== 0 ? $n = tc$1(er) : (kn &= Kn, kn !== 0 && ($n = tc$1(kn)));
  } else
    Kn = Zt & ~Sn, Kn !== 0 ? $n = tc$1(Kn) : kn !== 0 && ($n = tc$1(kn));
  if ($n === 0)
    return 0;
  if (Qt !== 0 && Qt !== $n && !(Qt & Sn) && (Sn = $n & -$n, kn = Qt & -Qt, Sn >= kn || Sn === 16 && (kn & 4194240) !== 0))
    return Qt;
  if ($n & 4 && ($n |= Zt & 16), Qt = _e.entangledLanes, Qt !== 0)
    for (_e = _e.entanglements, Qt &= $n; 0 < Qt; )
      Zt = 31 - oc$1(Qt), Sn = 1 << Zt, $n |= _e[Zt], Qt &= ~Sn;
  return $n;
}
function vc$1(_e, Qt) {
  switch (_e) {
    case 1:
    case 2:
    case 4:
      return Qt + 250;
    case 8:
    case 16:
    case 32:
    case 64:
    case 128:
    case 256:
    case 512:
    case 1024:
    case 2048:
    case 4096:
    case 8192:
    case 16384:
    case 32768:
    case 65536:
    case 131072:
    case 262144:
    case 524288:
    case 1048576:
    case 2097152:
      return Qt + 5e3;
    case 4194304:
    case 8388608:
    case 16777216:
    case 33554432:
    case 67108864:
      return -1;
    case 134217728:
    case 268435456:
    case 536870912:
    case 1073741824:
      return -1;
    default:
      return -1;
  }
}
function wc$1(_e, Qt) {
  for (var Zt = _e.suspendedLanes, $n = _e.pingedLanes, Sn = _e.expirationTimes, kn = _e.pendingLanes; 0 < kn; ) {
    var Kn = 31 - oc$1(kn), er = 1 << Kn, Cr = Sn[Kn];
    Cr === -1 ? (!(er & Zt) || er & $n) && (Sn[Kn] = vc$1(er, Qt)) : Cr <= Qt && (_e.expiredLanes |= er), kn &= ~er;
  }
}
function xc$1(_e) {
  return _e = _e.pendingLanes & -1073741825, _e !== 0 ? _e : _e & 1073741824 ? 1073741824 : 0;
}
function yc$1() {
  var _e = rc$1;
  return rc$1 <<= 1, !(rc$1 & 4194240) && (rc$1 = 64), _e;
}
function zc$1(_e) {
  for (var Qt = [], Zt = 0; 31 > Zt; Zt++)
    Qt.push(_e);
  return Qt;
}
function Ac$1(_e, Qt, Zt) {
  _e.pendingLanes |= Qt, Qt !== 536870912 && (_e.suspendedLanes = 0, _e.pingedLanes = 0), _e = _e.eventTimes, Qt = 31 - oc$1(Qt), _e[Qt] = Zt;
}
function Bc$1(_e, Qt) {
  var Zt = _e.pendingLanes & ~Qt;
  _e.pendingLanes = Qt, _e.suspendedLanes = 0, _e.pingedLanes = 0, _e.expiredLanes &= Qt, _e.mutableReadLanes &= Qt, _e.entangledLanes &= Qt, Qt = _e.entanglements;
  var $n = _e.eventTimes;
  for (_e = _e.expirationTimes; 0 < Zt; ) {
    var Sn = 31 - oc$1(Zt), kn = 1 << Sn;
    Qt[Sn] = 0, $n[Sn] = -1, _e[Sn] = -1, Zt &= ~kn;
  }
}
function Cc$1(_e, Qt) {
  var Zt = _e.entangledLanes |= Qt;
  for (_e = _e.entanglements; Zt; ) {
    var $n = 31 - oc$1(Zt), Sn = 1 << $n;
    Sn & Qt | _e[$n] & Qt && (_e[$n] |= Qt), Zt &= ~Sn;
  }
}
var C$5 = 0;
function Dc$1(_e) {
  return _e &= -_e, 1 < _e ? 4 < _e ? _e & 268435455 ? 16 : 536870912 : 4 : 1;
}
var Ec$1, Fc$1, Gc$1, Hc$1, Ic$1, Jc$1 = !1, Kc$1 = [], Lc$1 = null, Mc$1 = null, Nc$1 = null, Oc$1 = /* @__PURE__ */ new Map(), Pc$1 = /* @__PURE__ */ new Map(), Qc$1 = [], Rc$1 = "mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");
function Sc$1(_e, Qt) {
  switch (_e) {
    case "focusin":
    case "focusout":
      Lc$1 = null;
      break;
    case "dragenter":
    case "dragleave":
      Mc$1 = null;
      break;
    case "mouseover":
    case "mouseout":
      Nc$1 = null;
      break;
    case "pointerover":
    case "pointerout":
      Oc$1.delete(Qt.pointerId);
      break;
    case "gotpointercapture":
    case "lostpointercapture":
      Pc$1.delete(Qt.pointerId);
  }
}
function Tc$1(_e, Qt, Zt, $n, Sn, kn) {
  return _e === null || _e.nativeEvent !== kn ? (_e = { blockedOn: Qt, domEventName: Zt, eventSystemFlags: $n, nativeEvent: kn, targetContainers: [Sn] }, Qt !== null && (Qt = Cb$1(Qt), Qt !== null && Fc$1(Qt)), _e) : (_e.eventSystemFlags |= $n, Qt = _e.targetContainers, Sn !== null && Qt.indexOf(Sn) === -1 && Qt.push(Sn), _e);
}
function Uc$1(_e, Qt, Zt, $n, Sn) {
  switch (Qt) {
    case "focusin":
      return Lc$1 = Tc$1(Lc$1, _e, Qt, Zt, $n, Sn), !0;
    case "dragenter":
      return Mc$1 = Tc$1(Mc$1, _e, Qt, Zt, $n, Sn), !0;
    case "mouseover":
      return Nc$1 = Tc$1(Nc$1, _e, Qt, Zt, $n, Sn), !0;
    case "pointerover":
      var kn = Sn.pointerId;
      return Oc$1.set(kn, Tc$1(Oc$1.get(kn) || null, _e, Qt, Zt, $n, Sn)), !0;
    case "gotpointercapture":
      return kn = Sn.pointerId, Pc$1.set(kn, Tc$1(Pc$1.get(kn) || null, _e, Qt, Zt, $n, Sn)), !0;
  }
  return !1;
}
function Vc$1(_e) {
  var Qt = Wc$1(_e.target);
  if (Qt !== null) {
    var Zt = Vb$1(Qt);
    if (Zt !== null) {
      if (Qt = Zt.tag, Qt === 13) {
        if (Qt = Wb$1(Zt), Qt !== null) {
          _e.blockedOn = Qt, Ic$1(_e.priority, function() {
            Gc$1(Zt);
          });
          return;
        }
      } else if (Qt === 3 && Zt.stateNode.current.memoizedState.isDehydrated) {
        _e.blockedOn = Zt.tag === 3 ? Zt.stateNode.containerInfo : null;
        return;
      }
    }
  }
  _e.blockedOn = null;
}
function Xc$1(_e) {
  if (_e.blockedOn !== null)
    return !1;
  for (var Qt = _e.targetContainers; 0 < Qt.length; ) {
    var Zt = Yc$1(_e.domEventName, _e.eventSystemFlags, Qt[0], _e.nativeEvent);
    if (Zt === null) {
      Zt = _e.nativeEvent;
      var $n = new Zt.constructor(Zt.type, Zt);
      wb$1 = $n, Zt.target.dispatchEvent($n), wb$1 = null;
    } else
      return Qt = Cb$1(Zt), Qt !== null && Fc$1(Qt), _e.blockedOn = Zt, !1;
    Qt.shift();
  }
  return !0;
}
function Zc$1(_e, Qt, Zt) {
  Xc$1(_e) && Zt.delete(Qt);
}
function $c$1() {
  Jc$1 = !1, Lc$1 !== null && Xc$1(Lc$1) && (Lc$1 = null), Mc$1 !== null && Xc$1(Mc$1) && (Mc$1 = null), Nc$1 !== null && Xc$1(Nc$1) && (Nc$1 = null), Oc$1.forEach(Zc$1), Pc$1.forEach(Zc$1);
}
function ad$1(_e, Qt) {
  _e.blockedOn === Qt && (_e.blockedOn = null, Jc$1 || (Jc$1 = !0, ca$1.unstable_scheduleCallback(ca$1.unstable_NormalPriority, $c$1)));
}
function bd$1(_e) {
  function Qt(Sn) {
    return ad$1(Sn, _e);
  }
  if (0 < Kc$1.length) {
    ad$1(Kc$1[0], _e);
    for (var Zt = 1; Zt < Kc$1.length; Zt++) {
      var $n = Kc$1[Zt];
      $n.blockedOn === _e && ($n.blockedOn = null);
    }
  }
  for (Lc$1 !== null && ad$1(Lc$1, _e), Mc$1 !== null && ad$1(Mc$1, _e), Nc$1 !== null && ad$1(Nc$1, _e), Oc$1.forEach(Qt), Pc$1.forEach(Qt), Zt = 0; Zt < Qc$1.length; Zt++)
    $n = Qc$1[Zt], $n.blockedOn === _e && ($n.blockedOn = null);
  for (; 0 < Qc$1.length && (Zt = Qc$1[0], Zt.blockedOn === null); )
    Vc$1(Zt), Zt.blockedOn === null && Qc$1.shift();
}
var cd$1 = ua$1.ReactCurrentBatchConfig, dd$1 = !0;
function ed$1(_e, Qt, Zt, $n) {
  var Sn = C$5, kn = cd$1.transition;
  cd$1.transition = null;
  try {
    C$5 = 1, fd$1(_e, Qt, Zt, $n);
  } finally {
    C$5 = Sn, cd$1.transition = kn;
  }
}
function gd$1(_e, Qt, Zt, $n) {
  var Sn = C$5, kn = cd$1.transition;
  cd$1.transition = null;
  try {
    C$5 = 4, fd$1(_e, Qt, Zt, $n);
  } finally {
    C$5 = Sn, cd$1.transition = kn;
  }
}
function fd$1(_e, Qt, Zt, $n) {
  if (dd$1) {
    var Sn = Yc$1(_e, Qt, Zt, $n);
    if (Sn === null)
      hd$1(_e, Qt, $n, id$3, Zt), Sc$1(_e, $n);
    else if (Uc$1(Sn, _e, Qt, Zt, $n))
      $n.stopPropagation();
    else if (Sc$1(_e, $n), Qt & 4 && -1 < Rc$1.indexOf(_e)) {
      for (; Sn !== null; ) {
        var kn = Cb$1(Sn);
        if (kn !== null && Ec$1(kn), kn = Yc$1(_e, Qt, Zt, $n), kn === null && hd$1(_e, Qt, $n, id$3, Zt), kn === Sn)
          break;
        Sn = kn;
      }
      Sn !== null && $n.stopPropagation();
    } else
      hd$1(_e, Qt, $n, null, Zt);
  }
}
var id$3 = null;
function Yc$1(_e, Qt, Zt, $n) {
  if (id$3 = null, _e = xb$1($n), _e = Wc$1(_e), _e !== null)
    if (Qt = Vb$1(_e), Qt === null)
      _e = null;
    else if (Zt = Qt.tag, Zt === 13) {
      if (_e = Wb$1(Qt), _e !== null)
        return _e;
      _e = null;
    } else if (Zt === 3) {
      if (Qt.stateNode.current.memoizedState.isDehydrated)
        return Qt.tag === 3 ? Qt.stateNode.containerInfo : null;
      _e = null;
    } else
      Qt !== _e && (_e = null);
  return id$3 = _e, null;
}
function jd$1(_e) {
  switch (_e) {
    case "cancel":
    case "click":
    case "close":
    case "contextmenu":
    case "copy":
    case "cut":
    case "auxclick":
    case "dblclick":
    case "dragend":
    case "dragstart":
    case "drop":
    case "focusin":
    case "focusout":
    case "input":
    case "invalid":
    case "keydown":
    case "keypress":
    case "keyup":
    case "mousedown":
    case "mouseup":
    case "paste":
    case "pause":
    case "play":
    case "pointercancel":
    case "pointerdown":
    case "pointerup":
    case "ratechange":
    case "reset":
    case "resize":
    case "seeked":
    case "submit":
    case "touchcancel":
    case "touchend":
    case "touchstart":
    case "volumechange":
    case "change":
    case "selectionchange":
    case "textInput":
    case "compositionstart":
    case "compositionend":
    case "compositionupdate":
    case "beforeblur":
    case "afterblur":
    case "beforeinput":
    case "blur":
    case "fullscreenchange":
    case "focus":
    case "hashchange":
    case "popstate":
    case "select":
    case "selectstart":
      return 1;
    case "drag":
    case "dragenter":
    case "dragexit":
    case "dragleave":
    case "dragover":
    case "mousemove":
    case "mouseout":
    case "mouseover":
    case "pointermove":
    case "pointerout":
    case "pointerover":
    case "scroll":
    case "toggle":
    case "touchmove":
    case "wheel":
    case "mouseenter":
    case "mouseleave":
    case "pointerenter":
    case "pointerleave":
      return 4;
    case "message":
      switch (ec$1()) {
        case fc$1:
          return 1;
        case gc$1:
          return 4;
        case hc$1:
        case ic$1:
          return 16;
        case jc$1:
          return 536870912;
        default:
          return 16;
      }
    default:
      return 16;
  }
}
var kd$1 = null, ld$1 = null, md$2 = null;
function nd$1() {
  if (md$2)
    return md$2;
  var _e, Qt = ld$1, Zt = Qt.length, $n, Sn = "value" in kd$1 ? kd$1.value : kd$1.textContent, kn = Sn.length;
  for (_e = 0; _e < Zt && Qt[_e] === Sn[_e]; _e++)
    ;
  var Kn = Zt - _e;
  for ($n = 1; $n <= Kn && Qt[Zt - $n] === Sn[kn - $n]; $n++)
    ;
  return md$2 = Sn.slice(_e, 1 < $n ? 1 - $n : void 0);
}
function od$1(_e) {
  var Qt = _e.keyCode;
  return "charCode" in _e ? (_e = _e.charCode, _e === 0 && Qt === 13 && (_e = 13)) : _e = Qt, _e === 10 && (_e = 13), 32 <= _e || _e === 13 ? _e : 0;
}
function pd$1() {
  return !0;
}
function qd$1() {
  return !1;
}
function rd$1(_e) {
  function Qt(Zt, $n, Sn, kn, Kn) {
    this._reactName = Zt, this._targetInst = Sn, this.type = $n, this.nativeEvent = kn, this.target = Kn, this.currentTarget = null;
    for (var er in _e)
      _e.hasOwnProperty(er) && (Zt = _e[er], this[er] = Zt ? Zt(kn) : kn[er]);
    return this.isDefaultPrevented = (kn.defaultPrevented != null ? kn.defaultPrevented : kn.returnValue === !1) ? pd$1 : qd$1, this.isPropagationStopped = qd$1, this;
  }
  return A$3(Qt.prototype, { preventDefault: function() {
    this.defaultPrevented = !0;
    var Zt = this.nativeEvent;
    Zt && (Zt.preventDefault ? Zt.preventDefault() : typeof Zt.returnValue != "unknown" && (Zt.returnValue = !1), this.isDefaultPrevented = pd$1);
  }, stopPropagation: function() {
    var Zt = this.nativeEvent;
    Zt && (Zt.stopPropagation ? Zt.stopPropagation() : typeof Zt.cancelBubble != "unknown" && (Zt.cancelBubble = !0), this.isPropagationStopped = pd$1);
  }, persist: function() {
  }, isPersistent: pd$1 }), Qt;
}
var sd$1 = { eventPhase: 0, bubbles: 0, cancelable: 0, timeStamp: function(_e) {
  return _e.timeStamp || Date.now();
}, defaultPrevented: 0, isTrusted: 0 }, td$1 = rd$1(sd$1), ud$1 = A$3({}, sd$1, { view: 0, detail: 0 }), vd$1 = rd$1(ud$1), wd$1, xd$1, yd$1, Ad$1 = A$3({}, ud$1, { screenX: 0, screenY: 0, clientX: 0, clientY: 0, pageX: 0, pageY: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, getModifierState: zd$1, button: 0, buttons: 0, relatedTarget: function(_e) {
  return _e.relatedTarget === void 0 ? _e.fromElement === _e.srcElement ? _e.toElement : _e.fromElement : _e.relatedTarget;
}, movementX: function(_e) {
  return "movementX" in _e ? _e.movementX : (_e !== yd$1 && (yd$1 && _e.type === "mousemove" ? (wd$1 = _e.screenX - yd$1.screenX, xd$1 = _e.screenY - yd$1.screenY) : xd$1 = wd$1 = 0, yd$1 = _e), wd$1);
}, movementY: function(_e) {
  return "movementY" in _e ? _e.movementY : xd$1;
} }), Bd$1 = rd$1(Ad$1), Cd$1 = A$3({}, Ad$1, { dataTransfer: 0 }), Dd$1 = rd$1(Cd$1), Ed$1 = A$3({}, ud$1, { relatedTarget: 0 }), Fd$1 = rd$1(Ed$1), Gd$1 = A$3({}, sd$1, { animationName: 0, elapsedTime: 0, pseudoElement: 0 }), Hd$1 = rd$1(Gd$1), Id$1 = A$3({}, sd$1, { clipboardData: function(_e) {
  return "clipboardData" in _e ? _e.clipboardData : window.clipboardData;
} }), Jd$1 = rd$1(Id$1), Kd$1 = A$3({}, sd$1, { data: 0 }), Ld$1 = rd$1(Kd$1), Md$1 = {
  Esc: "Escape",
  Spacebar: " ",
  Left: "ArrowLeft",
  Up: "ArrowUp",
  Right: "ArrowRight",
  Down: "ArrowDown",
  Del: "Delete",
  Win: "OS",
  Menu: "ContextMenu",
  Apps: "ContextMenu",
  Scroll: "ScrollLock",
  MozPrintableKey: "Unidentified"
}, Nd$1 = {
  8: "Backspace",
  9: "Tab",
  12: "Clear",
  13: "Enter",
  16: "Shift",
  17: "Control",
  18: "Alt",
  19: "Pause",
  20: "CapsLock",
  27: "Escape",
  32: " ",
  33: "PageUp",
  34: "PageDown",
  35: "End",
  36: "Home",
  37: "ArrowLeft",
  38: "ArrowUp",
  39: "ArrowRight",
  40: "ArrowDown",
  45: "Insert",
  46: "Delete",
  112: "F1",
  113: "F2",
  114: "F3",
  115: "F4",
  116: "F5",
  117: "F6",
  118: "F7",
  119: "F8",
  120: "F9",
  121: "F10",
  122: "F11",
  123: "F12",
  144: "NumLock",
  145: "ScrollLock",
  224: "Meta"
}, Od$1 = { Alt: "altKey", Control: "ctrlKey", Meta: "metaKey", Shift: "shiftKey" };
function Pd$1(_e) {
  var Qt = this.nativeEvent;
  return Qt.getModifierState ? Qt.getModifierState(_e) : (_e = Od$1[_e]) ? !!Qt[_e] : !1;
}
function zd$1() {
  return Pd$1;
}
var Qd$1 = A$3({}, ud$1, { key: function(_e) {
  if (_e.key) {
    var Qt = Md$1[_e.key] || _e.key;
    if (Qt !== "Unidentified")
      return Qt;
  }
  return _e.type === "keypress" ? (_e = od$1(_e), _e === 13 ? "Enter" : String.fromCharCode(_e)) : _e.type === "keydown" || _e.type === "keyup" ? Nd$1[_e.keyCode] || "Unidentified" : "";
}, code: 0, location: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, repeat: 0, locale: 0, getModifierState: zd$1, charCode: function(_e) {
  return _e.type === "keypress" ? od$1(_e) : 0;
}, keyCode: function(_e) {
  return _e.type === "keydown" || _e.type === "keyup" ? _e.keyCode : 0;
}, which: function(_e) {
  return _e.type === "keypress" ? od$1(_e) : _e.type === "keydown" || _e.type === "keyup" ? _e.keyCode : 0;
} }), Rd$1 = rd$1(Qd$1), Sd$1 = A$3({}, Ad$1, { pointerId: 0, width: 0, height: 0, pressure: 0, tangentialPressure: 0, tiltX: 0, tiltY: 0, twist: 0, pointerType: 0, isPrimary: 0 }), Td$1 = rd$1(Sd$1), Ud$1 = A$3({}, ud$1, { touches: 0, targetTouches: 0, changedTouches: 0, altKey: 0, metaKey: 0, ctrlKey: 0, shiftKey: 0, getModifierState: zd$1 }), Vd$1 = rd$1(Ud$1), Wd$1 = A$3({}, sd$1, { propertyName: 0, elapsedTime: 0, pseudoElement: 0 }), Xd$1 = rd$1(Wd$1), Yd$1 = A$3({}, Ad$1, {
  deltaX: function(_e) {
    return "deltaX" in _e ? _e.deltaX : "wheelDeltaX" in _e ? -_e.wheelDeltaX : 0;
  },
  deltaY: function(_e) {
    return "deltaY" in _e ? _e.deltaY : "wheelDeltaY" in _e ? -_e.wheelDeltaY : "wheelDelta" in _e ? -_e.wheelDelta : 0;
  },
  deltaZ: 0,
  deltaMode: 0
}), Zd$1 = rd$1(Yd$1), $d$1 = [9, 13, 27, 32], ae$2 = ia$1 && "CompositionEvent" in window, be = null;
ia$1 && "documentMode" in document && (be = document.documentMode);
var ce$1 = ia$1 && "TextEvent" in window && !be, de$1 = ia$1 && (!ae$2 || be && 8 < be && 11 >= be), ee = String.fromCharCode(32), fe$2 = !1;
function ge$2(_e, Qt) {
  switch (_e) {
    case "keyup":
      return $d$1.indexOf(Qt.keyCode) !== -1;
    case "keydown":
      return Qt.keyCode !== 229;
    case "keypress":
    case "mousedown":
    case "focusout":
      return !0;
    default:
      return !1;
  }
}
function he$1(_e) {
  return _e = _e.detail, typeof _e == "object" && "data" in _e ? _e.data : null;
}
var ie$3 = !1;
function je$1(_e, Qt) {
  switch (_e) {
    case "compositionend":
      return he$1(Qt);
    case "keypress":
      return Qt.which !== 32 ? null : (fe$2 = !0, ee);
    case "textInput":
      return _e = Qt.data, _e === ee && fe$2 ? null : _e;
    default:
      return null;
  }
}
function ke$1(_e, Qt) {
  if (ie$3)
    return _e === "compositionend" || !ae$2 && ge$2(_e, Qt) ? (_e = nd$1(), md$2 = ld$1 = kd$1 = null, ie$3 = !1, _e) : null;
  switch (_e) {
    case "paste":
      return null;
    case "keypress":
      if (!(Qt.ctrlKey || Qt.altKey || Qt.metaKey) || Qt.ctrlKey && Qt.altKey) {
        if (Qt.char && 1 < Qt.char.length)
          return Qt.char;
        if (Qt.which)
          return String.fromCharCode(Qt.which);
      }
      return null;
    case "compositionend":
      return de$1 && Qt.locale !== "ko" ? null : Qt.data;
    default:
      return null;
  }
}
var le$1 = { color: !0, date: !0, datetime: !0, "datetime-local": !0, email: !0, month: !0, number: !0, password: !0, range: !0, search: !0, tel: !0, text: !0, time: !0, url: !0, week: !0 };
function me$1(_e) {
  var Qt = _e && _e.nodeName && _e.nodeName.toLowerCase();
  return Qt === "input" ? !!le$1[_e.type] : Qt === "textarea";
}
function ne$2(_e, Qt, Zt, $n) {
  Eb$1($n), Qt = oe$2(Qt, "onChange"), 0 < Qt.length && (Zt = new td$1("onChange", "change", null, Zt, $n), _e.push({ event: Zt, listeners: Qt }));
}
var pe$1 = null, qe$2 = null;
function re$4(_e) {
  se$1(_e, 0);
}
function te$1(_e) {
  var Qt = ue$2(_e);
  if (Wa$1(Qt))
    return _e;
}
function ve$2(_e, Qt) {
  if (_e === "change")
    return Qt;
}
var we$1 = !1;
if (ia$1) {
  var xe$2;
  if (ia$1) {
    var ye$2 = "oninput" in document;
    if (!ye$2) {
      var ze$2 = document.createElement("div");
      ze$2.setAttribute("oninput", "return;"), ye$2 = typeof ze$2.oninput == "function";
    }
    xe$2 = ye$2;
  } else
    xe$2 = !1;
  we$1 = xe$2 && (!document.documentMode || 9 < document.documentMode);
}
function Ae$1() {
  pe$1 && (pe$1.detachEvent("onpropertychange", Be$1), qe$2 = pe$1 = null);
}
function Be$1(_e) {
  if (_e.propertyName === "value" && te$1(qe$2)) {
    var Qt = [];
    ne$2(Qt, qe$2, _e, xb$1(_e)), Jb$1(re$4, Qt);
  }
}
function Ce$2(_e, Qt, Zt) {
  _e === "focusin" ? (Ae$1(), pe$1 = Qt, qe$2 = Zt, pe$1.attachEvent("onpropertychange", Be$1)) : _e === "focusout" && Ae$1();
}
function De$2(_e) {
  if (_e === "selectionchange" || _e === "keyup" || _e === "keydown")
    return te$1(qe$2);
}
function Ee$1(_e, Qt) {
  if (_e === "click")
    return te$1(Qt);
}
function Fe$2(_e, Qt) {
  if (_e === "input" || _e === "change")
    return te$1(Qt);
}
function Ge$2(_e, Qt) {
  return _e === Qt && (_e !== 0 || 1 / _e === 1 / Qt) || _e !== _e && Qt !== Qt;
}
var He$1 = typeof Object.is == "function" ? Object.is : Ge$2;
function Ie$1(_e, Qt) {
  if (He$1(_e, Qt))
    return !0;
  if (typeof _e != "object" || _e === null || typeof Qt != "object" || Qt === null)
    return !1;
  var Zt = Object.keys(_e), $n = Object.keys(Qt);
  if (Zt.length !== $n.length)
    return !1;
  for ($n = 0; $n < Zt.length; $n++) {
    var Sn = Zt[$n];
    if (!ja$1.call(Qt, Sn) || !He$1(_e[Sn], Qt[Sn]))
      return !1;
  }
  return !0;
}
function Je$2(_e) {
  for (; _e && _e.firstChild; )
    _e = _e.firstChild;
  return _e;
}
function Ke$2(_e, Qt) {
  var Zt = Je$2(_e);
  _e = 0;
  for (var $n; Zt; ) {
    if (Zt.nodeType === 3) {
      if ($n = _e + Zt.textContent.length, _e <= Qt && $n >= Qt)
        return { node: Zt, offset: Qt - _e };
      _e = $n;
    }
    e: {
      for (; Zt; ) {
        if (Zt.nextSibling) {
          Zt = Zt.nextSibling;
          break e;
        }
        Zt = Zt.parentNode;
      }
      Zt = void 0;
    }
    Zt = Je$2(Zt);
  }
}
function Le$2(_e, Qt) {
  return _e && Qt ? _e === Qt ? !0 : _e && _e.nodeType === 3 ? !1 : Qt && Qt.nodeType === 3 ? Le$2(_e, Qt.parentNode) : "contains" in _e ? _e.contains(Qt) : _e.compareDocumentPosition ? !!(_e.compareDocumentPosition(Qt) & 16) : !1 : !1;
}
function Me$2() {
  for (var _e = window, Qt = Xa$1(); Qt instanceof _e.HTMLIFrameElement; ) {
    try {
      var Zt = typeof Qt.contentWindow.location.href == "string";
    } catch {
      Zt = !1;
    }
    if (Zt)
      _e = Qt.contentWindow;
    else
      break;
    Qt = Xa$1(_e.document);
  }
  return Qt;
}
function Ne$2(_e) {
  var Qt = _e && _e.nodeName && _e.nodeName.toLowerCase();
  return Qt && (Qt === "input" && (_e.type === "text" || _e.type === "search" || _e.type === "tel" || _e.type === "url" || _e.type === "password") || Qt === "textarea" || _e.contentEditable === "true");
}
function Oe$1(_e) {
  var Qt = Me$2(), Zt = _e.focusedElem, $n = _e.selectionRange;
  if (Qt !== Zt && Zt && Zt.ownerDocument && Le$2(Zt.ownerDocument.documentElement, Zt)) {
    if ($n !== null && Ne$2(Zt)) {
      if (Qt = $n.start, _e = $n.end, _e === void 0 && (_e = Qt), "selectionStart" in Zt)
        Zt.selectionStart = Qt, Zt.selectionEnd = Math.min(_e, Zt.value.length);
      else if (_e = (Qt = Zt.ownerDocument || document) && Qt.defaultView || window, _e.getSelection) {
        _e = _e.getSelection();
        var Sn = Zt.textContent.length, kn = Math.min($n.start, Sn);
        $n = $n.end === void 0 ? kn : Math.min($n.end, Sn), !_e.extend && kn > $n && (Sn = $n, $n = kn, kn = Sn), Sn = Ke$2(Zt, kn);
        var Kn = Ke$2(
          Zt,
          $n
        );
        Sn && Kn && (_e.rangeCount !== 1 || _e.anchorNode !== Sn.node || _e.anchorOffset !== Sn.offset || _e.focusNode !== Kn.node || _e.focusOffset !== Kn.offset) && (Qt = Qt.createRange(), Qt.setStart(Sn.node, Sn.offset), _e.removeAllRanges(), kn > $n ? (_e.addRange(Qt), _e.extend(Kn.node, Kn.offset)) : (Qt.setEnd(Kn.node, Kn.offset), _e.addRange(Qt)));
      }
    }
    for (Qt = [], _e = Zt; _e = _e.parentNode; )
      _e.nodeType === 1 && Qt.push({ element: _e, left: _e.scrollLeft, top: _e.scrollTop });
    for (typeof Zt.focus == "function" && Zt.focus(), Zt = 0; Zt < Qt.length; Zt++)
      _e = Qt[Zt], _e.element.scrollLeft = _e.left, _e.element.scrollTop = _e.top;
  }
}
var Pe$2 = ia$1 && "documentMode" in document && 11 >= document.documentMode, Qe$2 = null, Re$1 = null, Se$2 = null, Te$2 = !1;
function Ue$1(_e, Qt, Zt) {
  var $n = Zt.window === Zt ? Zt.document : Zt.nodeType === 9 ? Zt : Zt.ownerDocument;
  Te$2 || Qe$2 == null || Qe$2 !== Xa$1($n) || ($n = Qe$2, "selectionStart" in $n && Ne$2($n) ? $n = { start: $n.selectionStart, end: $n.selectionEnd } : ($n = ($n.ownerDocument && $n.ownerDocument.defaultView || window).getSelection(), $n = { anchorNode: $n.anchorNode, anchorOffset: $n.anchorOffset, focusNode: $n.focusNode, focusOffset: $n.focusOffset }), Se$2 && Ie$1(Se$2, $n) || (Se$2 = $n, $n = oe$2(Re$1, "onSelect"), 0 < $n.length && (Qt = new td$1("onSelect", "select", null, Qt, Zt), _e.push({ event: Qt, listeners: $n }), Qt.target = Qe$2)));
}
function Ve$2(_e, Qt) {
  var Zt = {};
  return Zt[_e.toLowerCase()] = Qt.toLowerCase(), Zt["Webkit" + _e] = "webkit" + Qt, Zt["Moz" + _e] = "moz" + Qt, Zt;
}
var We$1 = { animationend: Ve$2("Animation", "AnimationEnd"), animationiteration: Ve$2("Animation", "AnimationIteration"), animationstart: Ve$2("Animation", "AnimationStart"), transitionend: Ve$2("Transition", "TransitionEnd") }, Xe$2 = {}, Ye$2 = {};
ia$1 && (Ye$2 = document.createElement("div").style, "AnimationEvent" in window || (delete We$1.animationend.animation, delete We$1.animationiteration.animation, delete We$1.animationstart.animation), "TransitionEvent" in window || delete We$1.transitionend.transition);
function Ze$2(_e) {
  if (Xe$2[_e])
    return Xe$2[_e];
  if (!We$1[_e])
    return _e;
  var Qt = We$1[_e], Zt;
  for (Zt in Qt)
    if (Qt.hasOwnProperty(Zt) && Zt in Ye$2)
      return Xe$2[_e] = Qt[Zt];
  return _e;
}
var $e$1 = Ze$2("animationend"), af$1 = Ze$2("animationiteration"), bf$1 = Ze$2("animationstart"), cf$1 = Ze$2("transitionend"), df$1 = /* @__PURE__ */ new Map(), ef$1 = "abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");
function ff$1(_e, Qt) {
  df$1.set(_e, Qt), fa$1(Qt, [_e]);
}
for (var gf$1 = 0; gf$1 < ef$1.length; gf$1++) {
  var hf$1 = ef$1[gf$1], jf$1 = hf$1.toLowerCase(), kf$1 = hf$1[0].toUpperCase() + hf$1.slice(1);
  ff$1(jf$1, "on" + kf$1);
}
ff$1($e$1, "onAnimationEnd");
ff$1(af$1, "onAnimationIteration");
ff$1(bf$1, "onAnimationStart");
ff$1("dblclick", "onDoubleClick");
ff$1("focusin", "onFocus");
ff$1("focusout", "onBlur");
ff$1(cf$1, "onTransitionEnd");
ha$1("onMouseEnter", ["mouseout", "mouseover"]);
ha$1("onMouseLeave", ["mouseout", "mouseover"]);
ha$1("onPointerEnter", ["pointerout", "pointerover"]);
ha$1("onPointerLeave", ["pointerout", "pointerover"]);
fa$1("onChange", "change click focusin focusout input keydown keyup selectionchange".split(" "));
fa$1("onSelect", "focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));
fa$1("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]);
fa$1("onCompositionEnd", "compositionend focusout keydown keypress keyup mousedown".split(" "));
fa$1("onCompositionStart", "compositionstart focusout keydown keypress keyup mousedown".split(" "));
fa$1("onCompositionUpdate", "compositionupdate focusout keydown keypress keyup mousedown".split(" "));
var lf$1 = "abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "), mf$1 = new Set("cancel close invalid load scroll toggle".split(" ").concat(lf$1));
function nf$1(_e, Qt, Zt) {
  var $n = _e.type || "unknown-event";
  _e.currentTarget = Zt, Ub$1($n, Qt, void 0, _e), _e.currentTarget = null;
}
function se$1(_e, Qt) {
  Qt = (Qt & 4) !== 0;
  for (var Zt = 0; Zt < _e.length; Zt++) {
    var $n = _e[Zt], Sn = $n.event;
    $n = $n.listeners;
    e: {
      var kn = void 0;
      if (Qt)
        for (var Kn = $n.length - 1; 0 <= Kn; Kn--) {
          var er = $n[Kn], Cr = er.instance, kr = er.currentTarget;
          if (er = er.listener, Cr !== kn && Sn.isPropagationStopped())
            break e;
          nf$1(Sn, er, kr), kn = Cr;
        }
      else
        for (Kn = 0; Kn < $n.length; Kn++) {
          if (er = $n[Kn], Cr = er.instance, kr = er.currentTarget, er = er.listener, Cr !== kn && Sn.isPropagationStopped())
            break e;
          nf$1(Sn, er, kr), kn = Cr;
        }
    }
  }
  if (Qb$1)
    throw _e = Rb$1, Qb$1 = !1, Rb$1 = null, _e;
}
function D$4(_e, Qt) {
  var Zt = Qt[of$1];
  Zt === void 0 && (Zt = Qt[of$1] = /* @__PURE__ */ new Set());
  var $n = _e + "__bubble";
  Zt.has($n) || (pf$1(Qt, _e, 2, !1), Zt.add($n));
}
function qf$1(_e, Qt, Zt) {
  var $n = 0;
  Qt && ($n |= 4), pf$1(Zt, _e, $n, Qt);
}
var rf$1 = "_reactListening" + Math.random().toString(36).slice(2);
function sf$1(_e) {
  if (!_e[rf$1]) {
    _e[rf$1] = !0, da$1.forEach(function(Zt) {
      Zt !== "selectionchange" && (mf$1.has(Zt) || qf$1(Zt, !1, _e), qf$1(Zt, !0, _e));
    });
    var Qt = _e.nodeType === 9 ? _e : _e.ownerDocument;
    Qt === null || Qt[rf$1] || (Qt[rf$1] = !0, qf$1("selectionchange", !1, Qt));
  }
}
function pf$1(_e, Qt, Zt, $n) {
  switch (jd$1(Qt)) {
    case 1:
      var Sn = ed$1;
      break;
    case 4:
      Sn = gd$1;
      break;
    default:
      Sn = fd$1;
  }
  Zt = Sn.bind(null, Qt, Zt, _e), Sn = void 0, !Lb$1 || Qt !== "touchstart" && Qt !== "touchmove" && Qt !== "wheel" || (Sn = !0), $n ? Sn !== void 0 ? _e.addEventListener(Qt, Zt, { capture: !0, passive: Sn }) : _e.addEventListener(Qt, Zt, !0) : Sn !== void 0 ? _e.addEventListener(Qt, Zt, { passive: Sn }) : _e.addEventListener(Qt, Zt, !1);
}
function hd$1(_e, Qt, Zt, $n, Sn) {
  var kn = $n;
  if (!(Qt & 1) && !(Qt & 2) && $n !== null)
    e:
      for (; ; ) {
        if ($n === null)
          return;
        var Kn = $n.tag;
        if (Kn === 3 || Kn === 4) {
          var er = $n.stateNode.containerInfo;
          if (er === Sn || er.nodeType === 8 && er.parentNode === Sn)
            break;
          if (Kn === 4)
            for (Kn = $n.return; Kn !== null; ) {
              var Cr = Kn.tag;
              if ((Cr === 3 || Cr === 4) && (Cr = Kn.stateNode.containerInfo, Cr === Sn || Cr.nodeType === 8 && Cr.parentNode === Sn))
                return;
              Kn = Kn.return;
            }
          for (; er !== null; ) {
            if (Kn = Wc$1(er), Kn === null)
              return;
            if (Cr = Kn.tag, Cr === 5 || Cr === 6) {
              $n = kn = Kn;
              continue e;
            }
            er = er.parentNode;
          }
        }
        $n = $n.return;
      }
  Jb$1(function() {
    var kr = kn, Yr = xb$1(Zt), Ms = [];
    e: {
      var Ds = df$1.get(_e);
      if (Ds !== void 0) {
        var Ls = td$1, js = _e;
        switch (_e) {
          case "keypress":
            if (od$1(Zt) === 0)
              break e;
          case "keydown":
          case "keyup":
            Ls = Rd$1;
            break;
          case "focusin":
            js = "focus", Ls = Fd$1;
            break;
          case "focusout":
            js = "blur", Ls = Fd$1;
            break;
          case "beforeblur":
          case "afterblur":
            Ls = Fd$1;
            break;
          case "click":
            if (Zt.button === 2)
              break e;
          case "auxclick":
          case "dblclick":
          case "mousedown":
          case "mousemove":
          case "mouseup":
          case "mouseout":
          case "mouseover":
          case "contextmenu":
            Ls = Bd$1;
            break;
          case "drag":
          case "dragend":
          case "dragenter":
          case "dragexit":
          case "dragleave":
          case "dragover":
          case "dragstart":
          case "drop":
            Ls = Dd$1;
            break;
          case "touchcancel":
          case "touchend":
          case "touchmove":
          case "touchstart":
            Ls = Vd$1;
            break;
          case $e$1:
          case af$1:
          case bf$1:
            Ls = Hd$1;
            break;
          case cf$1:
            Ls = Xd$1;
            break;
          case "scroll":
            Ls = vd$1;
            break;
          case "wheel":
            Ls = Zd$1;
            break;
          case "copy":
          case "cut":
          case "paste":
            Ls = Jd$1;
            break;
          case "gotpointercapture":
          case "lostpointercapture":
          case "pointercancel":
          case "pointerdown":
          case "pointermove":
          case "pointerout":
          case "pointerover":
          case "pointerup":
            Ls = Td$1;
        }
        var zs = (Qt & 4) !== 0, Fs = !zs && _e === "scroll", Bs = zs ? Ds !== null ? Ds + "Capture" : null : Ds;
        zs = [];
        for (var Hs = kr, Ws; Hs !== null; ) {
          Ws = Hs;
          var Ys = Ws.stateNode;
          if (Ws.tag === 5 && Ys !== null && (Ws = Ys, Bs !== null && (Ys = Kb$1(Hs, Bs), Ys != null && zs.push(tf$1(Hs, Ys, Ws)))), Fs)
            break;
          Hs = Hs.return;
        }
        0 < zs.length && (Ds = new Ls(Ds, js, null, Zt, Yr), Ms.push({ event: Ds, listeners: zs }));
      }
    }
    if (!(Qt & 7)) {
      e: {
        if (Ds = _e === "mouseover" || _e === "pointerover", Ls = _e === "mouseout" || _e === "pointerout", Ds && Zt !== wb$1 && (js = Zt.relatedTarget || Zt.fromElement) && (Wc$1(js) || js[uf$1]))
          break e;
        if ((Ls || Ds) && (Ds = Yr.window === Yr ? Yr : (Ds = Yr.ownerDocument) ? Ds.defaultView || Ds.parentWindow : window, Ls ? (js = Zt.relatedTarget || Zt.toElement, Ls = kr, js = js ? Wc$1(js) : null, js !== null && (Fs = Vb$1(js), js !== Fs || js.tag !== 5 && js.tag !== 6) && (js = null)) : (Ls = null, js = kr), Ls !== js)) {
          if (zs = Bd$1, Ys = "onMouseLeave", Bs = "onMouseEnter", Hs = "mouse", (_e === "pointerout" || _e === "pointerover") && (zs = Td$1, Ys = "onPointerLeave", Bs = "onPointerEnter", Hs = "pointer"), Fs = Ls == null ? Ds : ue$2(Ls), Ws = js == null ? Ds : ue$2(js), Ds = new zs(Ys, Hs + "leave", Ls, Zt, Yr), Ds.target = Fs, Ds.relatedTarget = Ws, Ys = null, Wc$1(Yr) === kr && (zs = new zs(Bs, Hs + "enter", js, Zt, Yr), zs.target = Ws, zs.relatedTarget = Fs, Ys = zs), Fs = Ys, Ls && js)
            t: {
              for (zs = Ls, Bs = js, Hs = 0, Ws = zs; Ws; Ws = vf$1(Ws))
                Hs++;
              for (Ws = 0, Ys = Bs; Ys; Ys = vf$1(Ys))
                Ws++;
              for (; 0 < Hs - Ws; )
                zs = vf$1(zs), Hs--;
              for (; 0 < Ws - Hs; )
                Bs = vf$1(Bs), Ws--;
              for (; Hs--; ) {
                if (zs === Bs || Bs !== null && zs === Bs.alternate)
                  break t;
                zs = vf$1(zs), Bs = vf$1(Bs);
              }
              zs = null;
            }
          else
            zs = null;
          Ls !== null && wf$1(Ms, Ds, Ls, zs, !1), js !== null && Fs !== null && wf$1(Ms, Fs, js, zs, !0);
        }
      }
      e: {
        if (Ds = kr ? ue$2(kr) : window, Ls = Ds.nodeName && Ds.nodeName.toLowerCase(), Ls === "select" || Ls === "input" && Ds.type === "file")
          var El = ve$2;
        else if (me$1(Ds))
          if (we$1)
            El = Fe$2;
          else {
            El = De$2;
            var Mu = Ce$2;
          }
        else
          (Ls = Ds.nodeName) && Ls.toLowerCase() === "input" && (Ds.type === "checkbox" || Ds.type === "radio") && (El = Ee$1);
        if (El && (El = El(_e, kr))) {
          ne$2(Ms, El, Zt, Yr);
          break e;
        }
        Mu && Mu(_e, Ds, kr), _e === "focusout" && (Mu = Ds._wrapperState) && Mu.controlled && Ds.type === "number" && cb$1(Ds, "number", Ds.value);
      }
      switch (Mu = kr ? ue$2(kr) : window, _e) {
        case "focusin":
          (me$1(Mu) || Mu.contentEditable === "true") && (Qe$2 = Mu, Re$1 = kr, Se$2 = null);
          break;
        case "focusout":
          Se$2 = Re$1 = Qe$2 = null;
          break;
        case "mousedown":
          Te$2 = !0;
          break;
        case "contextmenu":
        case "mouseup":
        case "dragend":
          Te$2 = !1, Ue$1(Ms, Zt, Yr);
          break;
        case "selectionchange":
          if (Pe$2)
            break;
        case "keydown":
        case "keyup":
          Ue$1(Ms, Zt, Yr);
      }
      var Pl;
      if (ae$2)
        e: {
          switch (_e) {
            case "compositionstart":
              var Iu = "onCompositionStart";
              break e;
            case "compositionend":
              Iu = "onCompositionEnd";
              break e;
            case "compositionupdate":
              Iu = "onCompositionUpdate";
              break e;
          }
          Iu = void 0;
        }
      else
        ie$3 ? ge$2(_e, Zt) && (Iu = "onCompositionEnd") : _e === "keydown" && Zt.keyCode === 229 && (Iu = "onCompositionStart");
      Iu && (de$1 && Zt.locale !== "ko" && (ie$3 || Iu !== "onCompositionStart" ? Iu === "onCompositionEnd" && ie$3 && (Pl = nd$1()) : (kd$1 = Yr, ld$1 = "value" in kd$1 ? kd$1.value : kd$1.textContent, ie$3 = !0)), Mu = oe$2(kr, Iu), 0 < Mu.length && (Iu = new Ld$1(Iu, _e, null, Zt, Yr), Ms.push({ event: Iu, listeners: Mu }), Pl ? Iu.data = Pl : (Pl = he$1(Zt), Pl !== null && (Iu.data = Pl)))), (Pl = ce$1 ? je$1(_e, Zt) : ke$1(_e, Zt)) && (kr = oe$2(kr, "onBeforeInput"), 0 < kr.length && (Yr = new Ld$1("onBeforeInput", "beforeinput", null, Zt, Yr), Ms.push({ event: Yr, listeners: kr }), Yr.data = Pl));
    }
    se$1(Ms, Qt);
  });
}
function tf$1(_e, Qt, Zt) {
  return { instance: _e, listener: Qt, currentTarget: Zt };
}
function oe$2(_e, Qt) {
  for (var Zt = Qt + "Capture", $n = []; _e !== null; ) {
    var Sn = _e, kn = Sn.stateNode;
    Sn.tag === 5 && kn !== null && (Sn = kn, kn = Kb$1(_e, Zt), kn != null && $n.unshift(tf$1(_e, kn, Sn)), kn = Kb$1(_e, Qt), kn != null && $n.push(tf$1(_e, kn, Sn))), _e = _e.return;
  }
  return $n;
}
function vf$1(_e) {
  if (_e === null)
    return null;
  do
    _e = _e.return;
  while (_e && _e.tag !== 5);
  return _e || null;
}
function wf$1(_e, Qt, Zt, $n, Sn) {
  for (var kn = Qt._reactName, Kn = []; Zt !== null && Zt !== $n; ) {
    var er = Zt, Cr = er.alternate, kr = er.stateNode;
    if (Cr !== null && Cr === $n)
      break;
    er.tag === 5 && kr !== null && (er = kr, Sn ? (Cr = Kb$1(Zt, kn), Cr != null && Kn.unshift(tf$1(Zt, Cr, er))) : Sn || (Cr = Kb$1(Zt, kn), Cr != null && Kn.push(tf$1(Zt, Cr, er)))), Zt = Zt.return;
  }
  Kn.length !== 0 && _e.push({ event: Qt, listeners: Kn });
}
var xf$2 = /\r\n?/g, yf$1 = /\u0000|\uFFFD/g;
function zf$1(_e) {
  return (typeof _e == "string" ? _e : "" + _e).replace(xf$2, `
`).replace(yf$1, "");
}
function Af$1(_e, Qt, Zt) {
  if (Qt = zf$1(Qt), zf$1(_e) !== Qt && Zt)
    throw Error(p$6(425));
}
function Bf$1() {
}
var Cf$1 = null, Df$1 = null;
function Ef$1(_e, Qt) {
  return _e === "textarea" || _e === "noscript" || typeof Qt.children == "string" || typeof Qt.children == "number" || typeof Qt.dangerouslySetInnerHTML == "object" && Qt.dangerouslySetInnerHTML !== null && Qt.dangerouslySetInnerHTML.__html != null;
}
var Ff = typeof setTimeout == "function" ? setTimeout : void 0, Gf$1 = typeof clearTimeout == "function" ? clearTimeout : void 0, Hf$1 = typeof Promise == "function" ? Promise : void 0, Jf$1 = typeof queueMicrotask == "function" ? queueMicrotask : typeof Hf$1 < "u" ? function(_e) {
  return Hf$1.resolve(null).then(_e).catch(If$1);
} : Ff;
function If$1(_e) {
  setTimeout(function() {
    throw _e;
  });
}
function Kf$1(_e, Qt) {
  var Zt = Qt, $n = 0;
  do {
    var Sn = Zt.nextSibling;
    if (_e.removeChild(Zt), Sn && Sn.nodeType === 8)
      if (Zt = Sn.data, Zt === "/$") {
        if ($n === 0) {
          _e.removeChild(Sn), bd$1(Qt);
          return;
        }
        $n--;
      } else
        Zt !== "$" && Zt !== "$?" && Zt !== "$!" || $n++;
    Zt = Sn;
  } while (Zt);
  bd$1(Qt);
}
function Lf$1(_e) {
  for (; _e != null; _e = _e.nextSibling) {
    var Qt = _e.nodeType;
    if (Qt === 1 || Qt === 3)
      break;
    if (Qt === 8) {
      if (Qt = _e.data, Qt === "$" || Qt === "$!" || Qt === "$?")
        break;
      if (Qt === "/$")
        return null;
    }
  }
  return _e;
}
function Mf(_e) {
  _e = _e.previousSibling;
  for (var Qt = 0; _e; ) {
    if (_e.nodeType === 8) {
      var Zt = _e.data;
      if (Zt === "$" || Zt === "$!" || Zt === "$?") {
        if (Qt === 0)
          return _e;
        Qt--;
      } else
        Zt === "/$" && Qt++;
    }
    _e = _e.previousSibling;
  }
  return null;
}
var Nf$1 = Math.random().toString(36).slice(2), Of$1 = "__reactFiber$" + Nf$1, Pf$1 = "__reactProps$" + Nf$1, uf$1 = "__reactContainer$" + Nf$1, of$1 = "__reactEvents$" + Nf$1, Qf$1 = "__reactListeners$" + Nf$1, Rf$1 = "__reactHandles$" + Nf$1;
function Wc$1(_e) {
  var Qt = _e[Of$1];
  if (Qt)
    return Qt;
  for (var Zt = _e.parentNode; Zt; ) {
    if (Qt = Zt[uf$1] || Zt[Of$1]) {
      if (Zt = Qt.alternate, Qt.child !== null || Zt !== null && Zt.child !== null)
        for (_e = Mf(_e); _e !== null; ) {
          if (Zt = _e[Of$1])
            return Zt;
          _e = Mf(_e);
        }
      return Qt;
    }
    _e = Zt, Zt = _e.parentNode;
  }
  return null;
}
function Cb$1(_e) {
  return _e = _e[Of$1] || _e[uf$1], !_e || _e.tag !== 5 && _e.tag !== 6 && _e.tag !== 13 && _e.tag !== 3 ? null : _e;
}
function ue$2(_e) {
  if (_e.tag === 5 || _e.tag === 6)
    return _e.stateNode;
  throw Error(p$6(33));
}
function Db$1(_e) {
  return _e[Pf$1] || null;
}
var Sf$1 = [], Tf$1 = -1;
function Uf$1(_e) {
  return { current: _e };
}
function E$3(_e) {
  0 > Tf$1 || (_e.current = Sf$1[Tf$1], Sf$1[Tf$1] = null, Tf$1--);
}
function G$2(_e, Qt) {
  Tf$1++, Sf$1[Tf$1] = _e.current, _e.current = Qt;
}
var Vf$1 = {}, H$3 = Uf$1(Vf$1), Wf$1 = Uf$1(!1), Xf$1 = Vf$1;
function Yf$1(_e, Qt) {
  var Zt = _e.type.contextTypes;
  if (!Zt)
    return Vf$1;
  var $n = _e.stateNode;
  if ($n && $n.__reactInternalMemoizedUnmaskedChildContext === Qt)
    return $n.__reactInternalMemoizedMaskedChildContext;
  var Sn = {}, kn;
  for (kn in Zt)
    Sn[kn] = Qt[kn];
  return $n && (_e = _e.stateNode, _e.__reactInternalMemoizedUnmaskedChildContext = Qt, _e.__reactInternalMemoizedMaskedChildContext = Sn), Sn;
}
function Zf$1(_e) {
  return _e = _e.childContextTypes, _e != null;
}
function $f$1() {
  E$3(Wf$1), E$3(H$3);
}
function ag$1(_e, Qt, Zt) {
  if (H$3.current !== Vf$1)
    throw Error(p$6(168));
  G$2(H$3, Qt), G$2(Wf$1, Zt);
}
function bg(_e, Qt, Zt) {
  var $n = _e.stateNode;
  if (Qt = Qt.childContextTypes, typeof $n.getChildContext != "function")
    return Zt;
  $n = $n.getChildContext();
  for (var Sn in $n)
    if (!(Sn in Qt))
      throw Error(p$6(108, Ra$1(_e) || "Unknown", Sn));
  return A$3({}, Zt, $n);
}
function cg$1(_e) {
  return _e = (_e = _e.stateNode) && _e.__reactInternalMemoizedMergedChildContext || Vf$1, Xf$1 = H$3.current, G$2(H$3, _e), G$2(Wf$1, Wf$1.current), !0;
}
function dg$1(_e, Qt, Zt) {
  var $n = _e.stateNode;
  if (!$n)
    throw Error(p$6(169));
  Zt ? (_e = bg(_e, Qt, Xf$1), $n.__reactInternalMemoizedMergedChildContext = _e, E$3(Wf$1), E$3(H$3), G$2(H$3, _e)) : E$3(Wf$1), G$2(Wf$1, Zt);
}
var eg$1 = null, fg$1 = !1, gg = !1;
function hg(_e) {
  eg$1 === null ? eg$1 = [_e] : eg$1.push(_e);
}
function ig$1(_e) {
  fg$1 = !0, hg(_e);
}
function jg() {
  if (!gg && eg$1 !== null) {
    gg = !0;
    var _e = 0, Qt = C$5;
    try {
      var Zt = eg$1;
      for (C$5 = 1; _e < Zt.length; _e++) {
        var $n = Zt[_e];
        do
          $n = $n(!0);
        while ($n !== null);
      }
      eg$1 = null, fg$1 = !1;
    } catch (Sn) {
      throw eg$1 !== null && (eg$1 = eg$1.slice(_e + 1)), ac$1(fc$1, jg), Sn;
    } finally {
      C$5 = Qt, gg = !1;
    }
  }
  return null;
}
var kg$1 = [], lg$1 = 0, mg$1 = null, ng$1 = 0, og$1 = [], pg$1 = 0, qg$1 = null, rg$1 = 1, sg$1 = "";
function tg$1(_e, Qt) {
  kg$1[lg$1++] = ng$1, kg$1[lg$1++] = mg$1, mg$1 = _e, ng$1 = Qt;
}
function ug$1(_e, Qt, Zt) {
  og$1[pg$1++] = rg$1, og$1[pg$1++] = sg$1, og$1[pg$1++] = qg$1, qg$1 = _e;
  var $n = rg$1;
  _e = sg$1;
  var Sn = 32 - oc$1($n) - 1;
  $n &= ~(1 << Sn), Zt += 1;
  var kn = 32 - oc$1(Qt) + Sn;
  if (30 < kn) {
    var Kn = Sn - Sn % 5;
    kn = ($n & (1 << Kn) - 1).toString(32), $n >>= Kn, Sn -= Kn, rg$1 = 1 << 32 - oc$1(Qt) + Sn | Zt << Sn | $n, sg$1 = kn + _e;
  } else
    rg$1 = 1 << kn | Zt << Sn | $n, sg$1 = _e;
}
function vg(_e) {
  _e.return !== null && (tg$1(_e, 1), ug$1(_e, 1, 0));
}
function wg$1(_e) {
  for (; _e === mg$1; )
    mg$1 = kg$1[--lg$1], kg$1[lg$1] = null, ng$1 = kg$1[--lg$1], kg$1[lg$1] = null;
  for (; _e === qg$1; )
    qg$1 = og$1[--pg$1], og$1[pg$1] = null, sg$1 = og$1[--pg$1], og$1[pg$1] = null, rg$1 = og$1[--pg$1], og$1[pg$1] = null;
}
var xg$1 = null, yg = null, I$2 = !1, zg$1 = null;
function Ag(_e, Qt) {
  var Zt = Bg$1(5, null, null, 0);
  Zt.elementType = "DELETED", Zt.stateNode = Qt, Zt.return = _e, Qt = _e.deletions, Qt === null ? (_e.deletions = [Zt], _e.flags |= 16) : Qt.push(Zt);
}
function Cg$1(_e, Qt) {
  switch (_e.tag) {
    case 5:
      var Zt = _e.type;
      return Qt = Qt.nodeType !== 1 || Zt.toLowerCase() !== Qt.nodeName.toLowerCase() ? null : Qt, Qt !== null ? (_e.stateNode = Qt, xg$1 = _e, yg = Lf$1(Qt.firstChild), !0) : !1;
    case 6:
      return Qt = _e.pendingProps === "" || Qt.nodeType !== 3 ? null : Qt, Qt !== null ? (_e.stateNode = Qt, xg$1 = _e, yg = null, !0) : !1;
    case 13:
      return Qt = Qt.nodeType !== 8 ? null : Qt, Qt !== null ? (Zt = qg$1 !== null ? { id: rg$1, overflow: sg$1 } : null, _e.memoizedState = { dehydrated: Qt, treeContext: Zt, retryLane: 1073741824 }, Zt = Bg$1(18, null, null, 0), Zt.stateNode = Qt, Zt.return = _e, _e.child = Zt, xg$1 = _e, yg = null, !0) : !1;
    default:
      return !1;
  }
}
function Dg$1(_e) {
  return (_e.mode & 1) !== 0 && (_e.flags & 128) === 0;
}
function Eg$1(_e) {
  if (I$2) {
    var Qt = yg;
    if (Qt) {
      var Zt = Qt;
      if (!Cg$1(_e, Qt)) {
        if (Dg$1(_e))
          throw Error(p$6(418));
        Qt = Lf$1(Zt.nextSibling);
        var $n = xg$1;
        Qt && Cg$1(_e, Qt) ? Ag($n, Zt) : (_e.flags = _e.flags & -4097 | 2, I$2 = !1, xg$1 = _e);
      }
    } else {
      if (Dg$1(_e))
        throw Error(p$6(418));
      _e.flags = _e.flags & -4097 | 2, I$2 = !1, xg$1 = _e;
    }
  }
}
function Fg$1(_e) {
  for (_e = _e.return; _e !== null && _e.tag !== 5 && _e.tag !== 3 && _e.tag !== 13; )
    _e = _e.return;
  xg$1 = _e;
}
function Gg$1(_e) {
  if (_e !== xg$1)
    return !1;
  if (!I$2)
    return Fg$1(_e), I$2 = !0, !1;
  var Qt;
  if ((Qt = _e.tag !== 3) && !(Qt = _e.tag !== 5) && (Qt = _e.type, Qt = Qt !== "head" && Qt !== "body" && !Ef$1(_e.type, _e.memoizedProps)), Qt && (Qt = yg)) {
    if (Dg$1(_e))
      throw Hg$1(), Error(p$6(418));
    for (; Qt; )
      Ag(_e, Qt), Qt = Lf$1(Qt.nextSibling);
  }
  if (Fg$1(_e), _e.tag === 13) {
    if (_e = _e.memoizedState, _e = _e !== null ? _e.dehydrated : null, !_e)
      throw Error(p$6(317));
    e: {
      for (_e = _e.nextSibling, Qt = 0; _e; ) {
        if (_e.nodeType === 8) {
          var Zt = _e.data;
          if (Zt === "/$") {
            if (Qt === 0) {
              yg = Lf$1(_e.nextSibling);
              break e;
            }
            Qt--;
          } else
            Zt !== "$" && Zt !== "$!" && Zt !== "$?" || Qt++;
        }
        _e = _e.nextSibling;
      }
      yg = null;
    }
  } else
    yg = xg$1 ? Lf$1(_e.stateNode.nextSibling) : null;
  return !0;
}
function Hg$1() {
  for (var _e = yg; _e; )
    _e = Lf$1(_e.nextSibling);
}
function Ig() {
  yg = xg$1 = null, I$2 = !1;
}
function Jg$1(_e) {
  zg$1 === null ? zg$1 = [_e] : zg$1.push(_e);
}
var Kg$1 = ua$1.ReactCurrentBatchConfig;
function Lg$1(_e, Qt) {
  if (_e && _e.defaultProps) {
    Qt = A$3({}, Qt), _e = _e.defaultProps;
    for (var Zt in _e)
      Qt[Zt] === void 0 && (Qt[Zt] = _e[Zt]);
    return Qt;
  }
  return Qt;
}
var Mg$1 = Uf$1(null), Ng = null, Og$1 = null, Pg$1 = null;
function Qg$1() {
  Pg$1 = Og$1 = Ng = null;
}
function Rg(_e) {
  var Qt = Mg$1.current;
  E$3(Mg$1), _e._currentValue = Qt;
}
function Sg$1(_e, Qt, Zt) {
  for (; _e !== null; ) {
    var $n = _e.alternate;
    if ((_e.childLanes & Qt) !== Qt ? (_e.childLanes |= Qt, $n !== null && ($n.childLanes |= Qt)) : $n !== null && ($n.childLanes & Qt) !== Qt && ($n.childLanes |= Qt), _e === Zt)
      break;
    _e = _e.return;
  }
}
function Tg(_e, Qt) {
  Ng = _e, Pg$1 = Og$1 = null, _e = _e.dependencies, _e !== null && _e.firstContext !== null && (_e.lanes & Qt && (Ug$1 = !0), _e.firstContext = null);
}
function Vg$1(_e) {
  var Qt = _e._currentValue;
  if (Pg$1 !== _e)
    if (_e = { context: _e, memoizedValue: Qt, next: null }, Og$1 === null) {
      if (Ng === null)
        throw Error(p$6(308));
      Og$1 = _e, Ng.dependencies = { lanes: 0, firstContext: _e };
    } else
      Og$1 = Og$1.next = _e;
  return Qt;
}
var Wg$1 = null;
function Xg$1(_e) {
  Wg$1 === null ? Wg$1 = [_e] : Wg$1.push(_e);
}
function Yg$1(_e, Qt, Zt, $n) {
  var Sn = Qt.interleaved;
  return Sn === null ? (Zt.next = Zt, Xg$1(Qt)) : (Zt.next = Sn.next, Sn.next = Zt), Qt.interleaved = Zt, Zg$1(_e, $n);
}
function Zg$1(_e, Qt) {
  _e.lanes |= Qt;
  var Zt = _e.alternate;
  for (Zt !== null && (Zt.lanes |= Qt), Zt = _e, _e = _e.return; _e !== null; )
    _e.childLanes |= Qt, Zt = _e.alternate, Zt !== null && (Zt.childLanes |= Qt), Zt = _e, _e = _e.return;
  return Zt.tag === 3 ? Zt.stateNode : null;
}
var $g$1 = !1;
function ah$1(_e) {
  _e.updateQueue = { baseState: _e.memoizedState, firstBaseUpdate: null, lastBaseUpdate: null, shared: { pending: null, interleaved: null, lanes: 0 }, effects: null };
}
function bh$1(_e, Qt) {
  _e = _e.updateQueue, Qt.updateQueue === _e && (Qt.updateQueue = { baseState: _e.baseState, firstBaseUpdate: _e.firstBaseUpdate, lastBaseUpdate: _e.lastBaseUpdate, shared: _e.shared, effects: _e.effects });
}
function ch$2(_e, Qt) {
  return { eventTime: _e, lane: Qt, tag: 0, payload: null, callback: null, next: null };
}
function dh$1(_e, Qt, Zt) {
  var $n = _e.updateQueue;
  if ($n === null)
    return null;
  if ($n = $n.shared, K$2 & 2) {
    var Sn = $n.pending;
    return Sn === null ? Qt.next = Qt : (Qt.next = Sn.next, Sn.next = Qt), $n.pending = Qt, Zg$1(_e, Zt);
  }
  return Sn = $n.interleaved, Sn === null ? (Qt.next = Qt, Xg$1($n)) : (Qt.next = Sn.next, Sn.next = Qt), $n.interleaved = Qt, Zg$1(_e, Zt);
}
function eh$1(_e, Qt, Zt) {
  if (Qt = Qt.updateQueue, Qt !== null && (Qt = Qt.shared, (Zt & 4194240) !== 0)) {
    var $n = Qt.lanes;
    $n &= _e.pendingLanes, Zt |= $n, Qt.lanes = Zt, Cc$1(_e, Zt);
  }
}
function fh$1(_e, Qt) {
  var Zt = _e.updateQueue, $n = _e.alternate;
  if ($n !== null && ($n = $n.updateQueue, Zt === $n)) {
    var Sn = null, kn = null;
    if (Zt = Zt.firstBaseUpdate, Zt !== null) {
      do {
        var Kn = { eventTime: Zt.eventTime, lane: Zt.lane, tag: Zt.tag, payload: Zt.payload, callback: Zt.callback, next: null };
        kn === null ? Sn = kn = Kn : kn = kn.next = Kn, Zt = Zt.next;
      } while (Zt !== null);
      kn === null ? Sn = kn = Qt : kn = kn.next = Qt;
    } else
      Sn = kn = Qt;
    Zt = { baseState: $n.baseState, firstBaseUpdate: Sn, lastBaseUpdate: kn, shared: $n.shared, effects: $n.effects }, _e.updateQueue = Zt;
    return;
  }
  _e = Zt.lastBaseUpdate, _e === null ? Zt.firstBaseUpdate = Qt : _e.next = Qt, Zt.lastBaseUpdate = Qt;
}
function gh$1(_e, Qt, Zt, $n) {
  var Sn = _e.updateQueue;
  $g$1 = !1;
  var kn = Sn.firstBaseUpdate, Kn = Sn.lastBaseUpdate, er = Sn.shared.pending;
  if (er !== null) {
    Sn.shared.pending = null;
    var Cr = er, kr = Cr.next;
    Cr.next = null, Kn === null ? kn = kr : Kn.next = kr, Kn = Cr;
    var Yr = _e.alternate;
    Yr !== null && (Yr = Yr.updateQueue, er = Yr.lastBaseUpdate, er !== Kn && (er === null ? Yr.firstBaseUpdate = kr : er.next = kr, Yr.lastBaseUpdate = Cr));
  }
  if (kn !== null) {
    var Ms = Sn.baseState;
    Kn = 0, Yr = kr = Cr = null, er = kn;
    do {
      var Ds = er.lane, Ls = er.eventTime;
      if (($n & Ds) === Ds) {
        Yr !== null && (Yr = Yr.next = {
          eventTime: Ls,
          lane: 0,
          tag: er.tag,
          payload: er.payload,
          callback: er.callback,
          next: null
        });
        e: {
          var js = _e, zs = er;
          switch (Ds = Qt, Ls = Zt, zs.tag) {
            case 1:
              if (js = zs.payload, typeof js == "function") {
                Ms = js.call(Ls, Ms, Ds);
                break e;
              }
              Ms = js;
              break e;
            case 3:
              js.flags = js.flags & -65537 | 128;
            case 0:
              if (js = zs.payload, Ds = typeof js == "function" ? js.call(Ls, Ms, Ds) : js, Ds == null)
                break e;
              Ms = A$3({}, Ms, Ds);
              break e;
            case 2:
              $g$1 = !0;
          }
        }
        er.callback !== null && er.lane !== 0 && (_e.flags |= 64, Ds = Sn.effects, Ds === null ? Sn.effects = [er] : Ds.push(er));
      } else
        Ls = { eventTime: Ls, lane: Ds, tag: er.tag, payload: er.payload, callback: er.callback, next: null }, Yr === null ? (kr = Yr = Ls, Cr = Ms) : Yr = Yr.next = Ls, Kn |= Ds;
      if (er = er.next, er === null) {
        if (er = Sn.shared.pending, er === null)
          break;
        Ds = er, er = Ds.next, Ds.next = null, Sn.lastBaseUpdate = Ds, Sn.shared.pending = null;
      }
    } while (1);
    if (Yr === null && (Cr = Ms), Sn.baseState = Cr, Sn.firstBaseUpdate = kr, Sn.lastBaseUpdate = Yr, Qt = Sn.shared.interleaved, Qt !== null) {
      Sn = Qt;
      do
        Kn |= Sn.lane, Sn = Sn.next;
      while (Sn !== Qt);
    } else
      kn === null && (Sn.shared.lanes = 0);
    hh$1 |= Kn, _e.lanes = Kn, _e.memoizedState = Ms;
  }
}
function ih$1(_e, Qt, Zt) {
  if (_e = Qt.effects, Qt.effects = null, _e !== null)
    for (Qt = 0; Qt < _e.length; Qt++) {
      var $n = _e[Qt], Sn = $n.callback;
      if (Sn !== null) {
        if ($n.callback = null, $n = Zt, typeof Sn != "function")
          throw Error(p$6(191, Sn));
        Sn.call($n);
      }
    }
}
var jh$1 = new aa$1.Component().refs;
function kh$1(_e, Qt, Zt, $n) {
  Qt = _e.memoizedState, Zt = Zt($n, Qt), Zt = Zt == null ? Qt : A$3({}, Qt, Zt), _e.memoizedState = Zt, _e.lanes === 0 && (_e.updateQueue.baseState = Zt);
}
var nh$1 = { isMounted: function(_e) {
  return (_e = _e._reactInternals) ? Vb$1(_e) === _e : !1;
}, enqueueSetState: function(_e, Qt, Zt) {
  _e = _e._reactInternals;
  var $n = L$2(), Sn = lh$1(_e), kn = ch$2($n, Sn);
  kn.payload = Qt, Zt != null && (kn.callback = Zt), Qt = dh$1(_e, kn, Sn), Qt !== null && (mh$1(Qt, _e, Sn, $n), eh$1(Qt, _e, Sn));
}, enqueueReplaceState: function(_e, Qt, Zt) {
  _e = _e._reactInternals;
  var $n = L$2(), Sn = lh$1(_e), kn = ch$2($n, Sn);
  kn.tag = 1, kn.payload = Qt, Zt != null && (kn.callback = Zt), Qt = dh$1(_e, kn, Sn), Qt !== null && (mh$1(Qt, _e, Sn, $n), eh$1(Qt, _e, Sn));
}, enqueueForceUpdate: function(_e, Qt) {
  _e = _e._reactInternals;
  var Zt = L$2(), $n = lh$1(_e), Sn = ch$2(Zt, $n);
  Sn.tag = 2, Qt != null && (Sn.callback = Qt), Qt = dh$1(_e, Sn, $n), Qt !== null && (mh$1(Qt, _e, $n, Zt), eh$1(Qt, _e, $n));
} };
function oh$1(_e, Qt, Zt, $n, Sn, kn, Kn) {
  return _e = _e.stateNode, typeof _e.shouldComponentUpdate == "function" ? _e.shouldComponentUpdate($n, kn, Kn) : Qt.prototype && Qt.prototype.isPureReactComponent ? !Ie$1(Zt, $n) || !Ie$1(Sn, kn) : !0;
}
function ph$1(_e, Qt, Zt) {
  var $n = !1, Sn = Vf$1, kn = Qt.contextType;
  return typeof kn == "object" && kn !== null ? kn = Vg$1(kn) : (Sn = Zf$1(Qt) ? Xf$1 : H$3.current, $n = Qt.contextTypes, kn = ($n = $n != null) ? Yf$1(_e, Sn) : Vf$1), Qt = new Qt(Zt, kn), _e.memoizedState = Qt.state !== null && Qt.state !== void 0 ? Qt.state : null, Qt.updater = nh$1, _e.stateNode = Qt, Qt._reactInternals = _e, $n && (_e = _e.stateNode, _e.__reactInternalMemoizedUnmaskedChildContext = Sn, _e.__reactInternalMemoizedMaskedChildContext = kn), Qt;
}
function qh$1(_e, Qt, Zt, $n) {
  _e = Qt.state, typeof Qt.componentWillReceiveProps == "function" && Qt.componentWillReceiveProps(Zt, $n), typeof Qt.UNSAFE_componentWillReceiveProps == "function" && Qt.UNSAFE_componentWillReceiveProps(Zt, $n), Qt.state !== _e && nh$1.enqueueReplaceState(Qt, Qt.state, null);
}
function rh$1(_e, Qt, Zt, $n) {
  var Sn = _e.stateNode;
  Sn.props = Zt, Sn.state = _e.memoizedState, Sn.refs = jh$1, ah$1(_e);
  var kn = Qt.contextType;
  typeof kn == "object" && kn !== null ? Sn.context = Vg$1(kn) : (kn = Zf$1(Qt) ? Xf$1 : H$3.current, Sn.context = Yf$1(_e, kn)), Sn.state = _e.memoizedState, kn = Qt.getDerivedStateFromProps, typeof kn == "function" && (kh$1(_e, Qt, kn, Zt), Sn.state = _e.memoizedState), typeof Qt.getDerivedStateFromProps == "function" || typeof Sn.getSnapshotBeforeUpdate == "function" || typeof Sn.UNSAFE_componentWillMount != "function" && typeof Sn.componentWillMount != "function" || (Qt = Sn.state, typeof Sn.componentWillMount == "function" && Sn.componentWillMount(), typeof Sn.UNSAFE_componentWillMount == "function" && Sn.UNSAFE_componentWillMount(), Qt !== Sn.state && nh$1.enqueueReplaceState(Sn, Sn.state, null), gh$1(_e, Zt, Sn, $n), Sn.state = _e.memoizedState), typeof Sn.componentDidMount == "function" && (_e.flags |= 4194308);
}
function sh$1(_e, Qt, Zt) {
  if (_e = Zt.ref, _e !== null && typeof _e != "function" && typeof _e != "object") {
    if (Zt._owner) {
      if (Zt = Zt._owner, Zt) {
        if (Zt.tag !== 1)
          throw Error(p$6(309));
        var $n = Zt.stateNode;
      }
      if (!$n)
        throw Error(p$6(147, _e));
      var Sn = $n, kn = "" + _e;
      return Qt !== null && Qt.ref !== null && typeof Qt.ref == "function" && Qt.ref._stringRef === kn ? Qt.ref : (Qt = function(Kn) {
        var er = Sn.refs;
        er === jh$1 && (er = Sn.refs = {}), Kn === null ? delete er[kn] : er[kn] = Kn;
      }, Qt._stringRef = kn, Qt);
    }
    if (typeof _e != "string")
      throw Error(p$6(284));
    if (!Zt._owner)
      throw Error(p$6(290, _e));
  }
  return _e;
}
function th$1(_e, Qt) {
  throw _e = Object.prototype.toString.call(Qt), Error(p$6(31, _e === "[object Object]" ? "object with keys {" + Object.keys(Qt).join(", ") + "}" : _e));
}
function uh$1(_e) {
  var Qt = _e._init;
  return Qt(_e._payload);
}
function vh$1(_e) {
  function Qt(Bs, Hs) {
    if (_e) {
      var Ws = Bs.deletions;
      Ws === null ? (Bs.deletions = [Hs], Bs.flags |= 16) : Ws.push(Hs);
    }
  }
  function Zt(Bs, Hs) {
    if (!_e)
      return null;
    for (; Hs !== null; )
      Qt(Bs, Hs), Hs = Hs.sibling;
    return null;
  }
  function $n(Bs, Hs) {
    for (Bs = /* @__PURE__ */ new Map(); Hs !== null; )
      Hs.key !== null ? Bs.set(Hs.key, Hs) : Bs.set(Hs.index, Hs), Hs = Hs.sibling;
    return Bs;
  }
  function Sn(Bs, Hs) {
    return Bs = wh$1(Bs, Hs), Bs.index = 0, Bs.sibling = null, Bs;
  }
  function kn(Bs, Hs, Ws) {
    return Bs.index = Ws, _e ? (Ws = Bs.alternate, Ws !== null ? (Ws = Ws.index, Ws < Hs ? (Bs.flags |= 2, Hs) : Ws) : (Bs.flags |= 2, Hs)) : (Bs.flags |= 1048576, Hs);
  }
  function Kn(Bs) {
    return _e && Bs.alternate === null && (Bs.flags |= 2), Bs;
  }
  function er(Bs, Hs, Ws, Ys) {
    return Hs === null || Hs.tag !== 6 ? (Hs = xh$1(Ws, Bs.mode, Ys), Hs.return = Bs, Hs) : (Hs = Sn(Hs, Ws), Hs.return = Bs, Hs);
  }
  function Cr(Bs, Hs, Ws, Ys) {
    var El = Ws.type;
    return El === ya$1 ? Yr(Bs, Hs, Ws.props.children, Ys, Ws.key) : Hs !== null && (Hs.elementType === El || typeof El == "object" && El !== null && El.$$typeof === Ha && uh$1(El) === Hs.type) ? (Ys = Sn(Hs, Ws.props), Ys.ref = sh$1(Bs, Hs, Ws), Ys.return = Bs, Ys) : (Ys = yh$2(Ws.type, Ws.key, Ws.props, null, Bs.mode, Ys), Ys.ref = sh$1(Bs, Hs, Ws), Ys.return = Bs, Ys);
  }
  function kr(Bs, Hs, Ws, Ys) {
    return Hs === null || Hs.tag !== 4 || Hs.stateNode.containerInfo !== Ws.containerInfo || Hs.stateNode.implementation !== Ws.implementation ? (Hs = zh$1(Ws, Bs.mode, Ys), Hs.return = Bs, Hs) : (Hs = Sn(Hs, Ws.children || []), Hs.return = Bs, Hs);
  }
  function Yr(Bs, Hs, Ws, Ys, El) {
    return Hs === null || Hs.tag !== 7 ? (Hs = Ah$1(Ws, Bs.mode, Ys, El), Hs.return = Bs, Hs) : (Hs = Sn(Hs, Ws), Hs.return = Bs, Hs);
  }
  function Ms(Bs, Hs, Ws) {
    if (typeof Hs == "string" && Hs !== "" || typeof Hs == "number")
      return Hs = xh$1("" + Hs, Bs.mode, Ws), Hs.return = Bs, Hs;
    if (typeof Hs == "object" && Hs !== null) {
      switch (Hs.$$typeof) {
        case va$1:
          return Ws = yh$2(Hs.type, Hs.key, Hs.props, null, Bs.mode, Ws), Ws.ref = sh$1(Bs, null, Hs), Ws.return = Bs, Ws;
        case wa$1:
          return Hs = zh$1(Hs, Bs.mode, Ws), Hs.return = Bs, Hs;
        case Ha:
          var Ys = Hs._init;
          return Ms(Bs, Ys(Hs._payload), Ws);
      }
      if (eb$1(Hs) || Ka$1(Hs))
        return Hs = Ah$1(Hs, Bs.mode, Ws, null), Hs.return = Bs, Hs;
      th$1(Bs, Hs);
    }
    return null;
  }
  function Ds(Bs, Hs, Ws, Ys) {
    var El = Hs !== null ? Hs.key : null;
    if (typeof Ws == "string" && Ws !== "" || typeof Ws == "number")
      return El !== null ? null : er(Bs, Hs, "" + Ws, Ys);
    if (typeof Ws == "object" && Ws !== null) {
      switch (Ws.$$typeof) {
        case va$1:
          return Ws.key === El ? Cr(Bs, Hs, Ws, Ys) : null;
        case wa$1:
          return Ws.key === El ? kr(Bs, Hs, Ws, Ys) : null;
        case Ha:
          return El = Ws._init, Ds(
            Bs,
            Hs,
            El(Ws._payload),
            Ys
          );
      }
      if (eb$1(Ws) || Ka$1(Ws))
        return El !== null ? null : Yr(Bs, Hs, Ws, Ys, null);
      th$1(Bs, Ws);
    }
    return null;
  }
  function Ls(Bs, Hs, Ws, Ys, El) {
    if (typeof Ys == "string" && Ys !== "" || typeof Ys == "number")
      return Bs = Bs.get(Ws) || null, er(Hs, Bs, "" + Ys, El);
    if (typeof Ys == "object" && Ys !== null) {
      switch (Ys.$$typeof) {
        case va$1:
          return Bs = Bs.get(Ys.key === null ? Ws : Ys.key) || null, Cr(Hs, Bs, Ys, El);
        case wa$1:
          return Bs = Bs.get(Ys.key === null ? Ws : Ys.key) || null, kr(Hs, Bs, Ys, El);
        case Ha:
          var Mu = Ys._init;
          return Ls(Bs, Hs, Ws, Mu(Ys._payload), El);
      }
      if (eb$1(Ys) || Ka$1(Ys))
        return Bs = Bs.get(Ws) || null, Yr(Hs, Bs, Ys, El, null);
      th$1(Hs, Ys);
    }
    return null;
  }
  function js(Bs, Hs, Ws, Ys) {
    for (var El = null, Mu = null, Pl = Hs, Iu = Hs = 0, Tu = null; Pl !== null && Iu < Ws.length; Iu++) {
      Pl.index > Iu ? (Tu = Pl, Pl = null) : Tu = Pl.sibling;
      var Au = Ds(Bs, Pl, Ws[Iu], Ys);
      if (Au === null) {
        Pl === null && (Pl = Tu);
        break;
      }
      _e && Pl && Au.alternate === null && Qt(Bs, Pl), Hs = kn(Au, Hs, Iu), Mu === null ? El = Au : Mu.sibling = Au, Mu = Au, Pl = Tu;
    }
    if (Iu === Ws.length)
      return Zt(Bs, Pl), I$2 && tg$1(Bs, Iu), El;
    if (Pl === null) {
      for (; Iu < Ws.length; Iu++)
        Pl = Ms(Bs, Ws[Iu], Ys), Pl !== null && (Hs = kn(Pl, Hs, Iu), Mu === null ? El = Pl : Mu.sibling = Pl, Mu = Pl);
      return I$2 && tg$1(Bs, Iu), El;
    }
    for (Pl = $n(Bs, Pl); Iu < Ws.length; Iu++)
      Tu = Ls(Pl, Bs, Iu, Ws[Iu], Ys), Tu !== null && (_e && Tu.alternate !== null && Pl.delete(Tu.key === null ? Iu : Tu.key), Hs = kn(Tu, Hs, Iu), Mu === null ? El = Tu : Mu.sibling = Tu, Mu = Tu);
    return _e && Pl.forEach(function(Nu) {
      return Qt(Bs, Nu);
    }), I$2 && tg$1(Bs, Iu), El;
  }
  function zs(Bs, Hs, Ws, Ys) {
    var El = Ka$1(Ws);
    if (typeof El != "function")
      throw Error(p$6(150));
    if (Ws = El.call(Ws), Ws == null)
      throw Error(p$6(151));
    for (var Mu = El = null, Pl = Hs, Iu = Hs = 0, Tu = null, Au = Ws.next(); Pl !== null && !Au.done; Iu++, Au = Ws.next()) {
      Pl.index > Iu ? (Tu = Pl, Pl = null) : Tu = Pl.sibling;
      var Nu = Ds(Bs, Pl, Au.value, Ys);
      if (Nu === null) {
        Pl === null && (Pl = Tu);
        break;
      }
      _e && Pl && Nu.alternate === null && Qt(Bs, Pl), Hs = kn(Nu, Hs, Iu), Mu === null ? El = Nu : Mu.sibling = Nu, Mu = Nu, Pl = Tu;
    }
    if (Au.done)
      return Zt(
        Bs,
        Pl
      ), I$2 && tg$1(Bs, Iu), El;
    if (Pl === null) {
      for (; !Au.done; Iu++, Au = Ws.next())
        Au = Ms(Bs, Au.value, Ys), Au !== null && (Hs = kn(Au, Hs, Iu), Mu === null ? El = Au : Mu.sibling = Au, Mu = Au);
      return I$2 && tg$1(Bs, Iu), El;
    }
    for (Pl = $n(Bs, Pl); !Au.done; Iu++, Au = Ws.next())
      Au = Ls(Pl, Bs, Iu, Au.value, Ys), Au !== null && (_e && Au.alternate !== null && Pl.delete(Au.key === null ? Iu : Au.key), Hs = kn(Au, Hs, Iu), Mu === null ? El = Au : Mu.sibling = Au, Mu = Au);
    return _e && Pl.forEach(function(gm) {
      return Qt(Bs, gm);
    }), I$2 && tg$1(Bs, Iu), El;
  }
  function Fs(Bs, Hs, Ws, Ys) {
    if (typeof Ws == "object" && Ws !== null && Ws.type === ya$1 && Ws.key === null && (Ws = Ws.props.children), typeof Ws == "object" && Ws !== null) {
      switch (Ws.$$typeof) {
        case va$1:
          e: {
            for (var El = Ws.key, Mu = Hs; Mu !== null; ) {
              if (Mu.key === El) {
                if (El = Ws.type, El === ya$1) {
                  if (Mu.tag === 7) {
                    Zt(Bs, Mu.sibling), Hs = Sn(Mu, Ws.props.children), Hs.return = Bs, Bs = Hs;
                    break e;
                  }
                } else if (Mu.elementType === El || typeof El == "object" && El !== null && El.$$typeof === Ha && uh$1(El) === Mu.type) {
                  Zt(Bs, Mu.sibling), Hs = Sn(Mu, Ws.props), Hs.ref = sh$1(Bs, Mu, Ws), Hs.return = Bs, Bs = Hs;
                  break e;
                }
                Zt(Bs, Mu);
                break;
              } else
                Qt(Bs, Mu);
              Mu = Mu.sibling;
            }
            Ws.type === ya$1 ? (Hs = Ah$1(Ws.props.children, Bs.mode, Ys, Ws.key), Hs.return = Bs, Bs = Hs) : (Ys = yh$2(Ws.type, Ws.key, Ws.props, null, Bs.mode, Ys), Ys.ref = sh$1(Bs, Hs, Ws), Ys.return = Bs, Bs = Ys);
          }
          return Kn(Bs);
        case wa$1:
          e: {
            for (Mu = Ws.key; Hs !== null; ) {
              if (Hs.key === Mu)
                if (Hs.tag === 4 && Hs.stateNode.containerInfo === Ws.containerInfo && Hs.stateNode.implementation === Ws.implementation) {
                  Zt(Bs, Hs.sibling), Hs = Sn(Hs, Ws.children || []), Hs.return = Bs, Bs = Hs;
                  break e;
                } else {
                  Zt(Bs, Hs);
                  break;
                }
              else
                Qt(Bs, Hs);
              Hs = Hs.sibling;
            }
            Hs = zh$1(Ws, Bs.mode, Ys), Hs.return = Bs, Bs = Hs;
          }
          return Kn(Bs);
        case Ha:
          return Mu = Ws._init, Fs(Bs, Hs, Mu(Ws._payload), Ys);
      }
      if (eb$1(Ws))
        return js(Bs, Hs, Ws, Ys);
      if (Ka$1(Ws))
        return zs(Bs, Hs, Ws, Ys);
      th$1(Bs, Ws);
    }
    return typeof Ws == "string" && Ws !== "" || typeof Ws == "number" ? (Ws = "" + Ws, Hs !== null && Hs.tag === 6 ? (Zt(Bs, Hs.sibling), Hs = Sn(Hs, Ws), Hs.return = Bs, Bs = Hs) : (Zt(Bs, Hs), Hs = xh$1(Ws, Bs.mode, Ys), Hs.return = Bs, Bs = Hs), Kn(Bs)) : Zt(Bs, Hs);
  }
  return Fs;
}
var Bh$1 = vh$1(!0), Ch$1 = vh$1(!1), Dh$1 = {}, Eh$1 = Uf$1(Dh$1), Fh$1 = Uf$1(Dh$1), Gh$1 = Uf$1(Dh$1);
function Hh$1(_e) {
  if (_e === Dh$1)
    throw Error(p$6(174));
  return _e;
}
function Ih$1(_e, Qt) {
  switch (G$2(Gh$1, Qt), G$2(Fh$1, _e), G$2(Eh$1, Dh$1), _e = Qt.nodeType, _e) {
    case 9:
    case 11:
      Qt = (Qt = Qt.documentElement) ? Qt.namespaceURI : lb$1(null, "");
      break;
    default:
      _e = _e === 8 ? Qt.parentNode : Qt, Qt = _e.namespaceURI || null, _e = _e.tagName, Qt = lb$1(Qt, _e);
  }
  E$3(Eh$1), G$2(Eh$1, Qt);
}
function Jh$1() {
  E$3(Eh$1), E$3(Fh$1), E$3(Gh$1);
}
function Kh$1(_e) {
  Hh$1(Gh$1.current);
  var Qt = Hh$1(Eh$1.current), Zt = lb$1(Qt, _e.type);
  Qt !== Zt && (G$2(Fh$1, _e), G$2(Eh$1, Zt));
}
function Lh$1(_e) {
  Fh$1.current === _e && (E$3(Eh$1), E$3(Fh$1));
}
var M$3 = Uf$1(0);
function Mh$1(_e) {
  for (var Qt = _e; Qt !== null; ) {
    if (Qt.tag === 13) {
      var Zt = Qt.memoizedState;
      if (Zt !== null && (Zt = Zt.dehydrated, Zt === null || Zt.data === "$?" || Zt.data === "$!"))
        return Qt;
    } else if (Qt.tag === 19 && Qt.memoizedProps.revealOrder !== void 0) {
      if (Qt.flags & 128)
        return Qt;
    } else if (Qt.child !== null) {
      Qt.child.return = Qt, Qt = Qt.child;
      continue;
    }
    if (Qt === _e)
      break;
    for (; Qt.sibling === null; ) {
      if (Qt.return === null || Qt.return === _e)
        return null;
      Qt = Qt.return;
    }
    Qt.sibling.return = Qt.return, Qt = Qt.sibling;
  }
  return null;
}
var Nh$1 = [];
function Oh$1() {
  for (var _e = 0; _e < Nh$1.length; _e++)
    Nh$1[_e]._workInProgressVersionPrimary = null;
  Nh$1.length = 0;
}
var Ph$1 = ua$1.ReactCurrentDispatcher, Qh$1 = ua$1.ReactCurrentBatchConfig, Rh$1 = 0, N$2 = null, O$1 = null, P$2 = null, Sh$1 = !1, Th$1 = !1, Uh$1 = 0, Vh$1 = 0;
function Q$2() {
  throw Error(p$6(321));
}
function Wh$1(_e, Qt) {
  if (Qt === null)
    return !1;
  for (var Zt = 0; Zt < Qt.length && Zt < _e.length; Zt++)
    if (!He$1(_e[Zt], Qt[Zt]))
      return !1;
  return !0;
}
function Xh$1(_e, Qt, Zt, $n, Sn, kn) {
  if (Rh$1 = kn, N$2 = Qt, Qt.memoizedState = null, Qt.updateQueue = null, Qt.lanes = 0, Ph$1.current = _e === null || _e.memoizedState === null ? Yh$1 : Zh$1, _e = Zt($n, Sn), Th$1) {
    kn = 0;
    do {
      if (Th$1 = !1, Uh$1 = 0, 25 <= kn)
        throw Error(p$6(301));
      kn += 1, P$2 = O$1 = null, Qt.updateQueue = null, Ph$1.current = $h$1, _e = Zt($n, Sn);
    } while (Th$1);
  }
  if (Ph$1.current = ai$1, Qt = O$1 !== null && O$1.next !== null, Rh$1 = 0, P$2 = O$1 = N$2 = null, Sh$1 = !1, Qt)
    throw Error(p$6(300));
  return _e;
}
function bi$1() {
  var _e = Uh$1 !== 0;
  return Uh$1 = 0, _e;
}
function ci$1() {
  var _e = { memoizedState: null, baseState: null, baseQueue: null, queue: null, next: null };
  return P$2 === null ? N$2.memoizedState = P$2 = _e : P$2 = P$2.next = _e, P$2;
}
function di$1() {
  if (O$1 === null) {
    var _e = N$2.alternate;
    _e = _e !== null ? _e.memoizedState : null;
  } else
    _e = O$1.next;
  var Qt = P$2 === null ? N$2.memoizedState : P$2.next;
  if (Qt !== null)
    P$2 = Qt, O$1 = _e;
  else {
    if (_e === null)
      throw Error(p$6(310));
    O$1 = _e, _e = { memoizedState: O$1.memoizedState, baseState: O$1.baseState, baseQueue: O$1.baseQueue, queue: O$1.queue, next: null }, P$2 === null ? N$2.memoizedState = P$2 = _e : P$2 = P$2.next = _e;
  }
  return P$2;
}
function ei$1(_e, Qt) {
  return typeof Qt == "function" ? Qt(_e) : Qt;
}
function fi$1(_e) {
  var Qt = di$1(), Zt = Qt.queue;
  if (Zt === null)
    throw Error(p$6(311));
  Zt.lastRenderedReducer = _e;
  var $n = O$1, Sn = $n.baseQueue, kn = Zt.pending;
  if (kn !== null) {
    if (Sn !== null) {
      var Kn = Sn.next;
      Sn.next = kn.next, kn.next = Kn;
    }
    $n.baseQueue = Sn = kn, Zt.pending = null;
  }
  if (Sn !== null) {
    kn = Sn.next, $n = $n.baseState;
    var er = Kn = null, Cr = null, kr = kn;
    do {
      var Yr = kr.lane;
      if ((Rh$1 & Yr) === Yr)
        Cr !== null && (Cr = Cr.next = { lane: 0, action: kr.action, hasEagerState: kr.hasEagerState, eagerState: kr.eagerState, next: null }), $n = kr.hasEagerState ? kr.eagerState : _e($n, kr.action);
      else {
        var Ms = {
          lane: Yr,
          action: kr.action,
          hasEagerState: kr.hasEagerState,
          eagerState: kr.eagerState,
          next: null
        };
        Cr === null ? (er = Cr = Ms, Kn = $n) : Cr = Cr.next = Ms, N$2.lanes |= Yr, hh$1 |= Yr;
      }
      kr = kr.next;
    } while (kr !== null && kr !== kn);
    Cr === null ? Kn = $n : Cr.next = er, He$1($n, Qt.memoizedState) || (Ug$1 = !0), Qt.memoizedState = $n, Qt.baseState = Kn, Qt.baseQueue = Cr, Zt.lastRenderedState = $n;
  }
  if (_e = Zt.interleaved, _e !== null) {
    Sn = _e;
    do
      kn = Sn.lane, N$2.lanes |= kn, hh$1 |= kn, Sn = Sn.next;
    while (Sn !== _e);
  } else
    Sn === null && (Zt.lanes = 0);
  return [Qt.memoizedState, Zt.dispatch];
}
function gi(_e) {
  var Qt = di$1(), Zt = Qt.queue;
  if (Zt === null)
    throw Error(p$6(311));
  Zt.lastRenderedReducer = _e;
  var $n = Zt.dispatch, Sn = Zt.pending, kn = Qt.memoizedState;
  if (Sn !== null) {
    Zt.pending = null;
    var Kn = Sn = Sn.next;
    do
      kn = _e(kn, Kn.action), Kn = Kn.next;
    while (Kn !== Sn);
    He$1(kn, Qt.memoizedState) || (Ug$1 = !0), Qt.memoizedState = kn, Qt.baseQueue === null && (Qt.baseState = kn), Zt.lastRenderedState = kn;
  }
  return [kn, $n];
}
function hi() {
}
function ii$1(_e, Qt) {
  var Zt = N$2, $n = di$1(), Sn = Qt(), kn = !He$1($n.memoizedState, Sn);
  if (kn && ($n.memoizedState = Sn, Ug$1 = !0), $n = $n.queue, ji$1(ki$1.bind(null, Zt, $n, _e), [_e]), $n.getSnapshot !== Qt || kn || P$2 !== null && P$2.memoizedState.tag & 1) {
    if (Zt.flags |= 2048, li$1(9, mi.bind(null, Zt, $n, Sn, Qt), void 0, null), R$1 === null)
      throw Error(p$6(349));
    Rh$1 & 30 || ni$1(Zt, Qt, Sn);
  }
  return Sn;
}
function ni$1(_e, Qt, Zt) {
  _e.flags |= 16384, _e = { getSnapshot: Qt, value: Zt }, Qt = N$2.updateQueue, Qt === null ? (Qt = { lastEffect: null, stores: null }, N$2.updateQueue = Qt, Qt.stores = [_e]) : (Zt = Qt.stores, Zt === null ? Qt.stores = [_e] : Zt.push(_e));
}
function mi(_e, Qt, Zt, $n) {
  Qt.value = Zt, Qt.getSnapshot = $n, oi$1(Qt) && pi$5(_e);
}
function ki$1(_e, Qt, Zt) {
  return Zt(function() {
    oi$1(Qt) && pi$5(_e);
  });
}
function oi$1(_e) {
  var Qt = _e.getSnapshot;
  _e = _e.value;
  try {
    var Zt = Qt();
    return !He$1(_e, Zt);
  } catch {
    return !0;
  }
}
function pi$5(_e) {
  var Qt = Zg$1(_e, 1);
  Qt !== null && mh$1(Qt, _e, 1, -1);
}
function qi(_e) {
  var Qt = ci$1();
  return typeof _e == "function" && (_e = _e()), Qt.memoizedState = Qt.baseState = _e, _e = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: ei$1, lastRenderedState: _e }, Qt.queue = _e, _e = _e.dispatch = ri$1.bind(null, N$2, _e), [Qt.memoizedState, _e];
}
function li$1(_e, Qt, Zt, $n) {
  return _e = { tag: _e, create: Qt, destroy: Zt, deps: $n, next: null }, Qt = N$2.updateQueue, Qt === null ? (Qt = { lastEffect: null, stores: null }, N$2.updateQueue = Qt, Qt.lastEffect = _e.next = _e) : (Zt = Qt.lastEffect, Zt === null ? Qt.lastEffect = _e.next = _e : ($n = Zt.next, Zt.next = _e, _e.next = $n, Qt.lastEffect = _e)), _e;
}
function si$1() {
  return di$1().memoizedState;
}
function ti$1(_e, Qt, Zt, $n) {
  var Sn = ci$1();
  N$2.flags |= _e, Sn.memoizedState = li$1(1 | Qt, Zt, void 0, $n === void 0 ? null : $n);
}
function ui$1(_e, Qt, Zt, $n) {
  var Sn = di$1();
  $n = $n === void 0 ? null : $n;
  var kn = void 0;
  if (O$1 !== null) {
    var Kn = O$1.memoizedState;
    if (kn = Kn.destroy, $n !== null && Wh$1($n, Kn.deps)) {
      Sn.memoizedState = li$1(Qt, Zt, kn, $n);
      return;
    }
  }
  N$2.flags |= _e, Sn.memoizedState = li$1(1 | Qt, Zt, kn, $n);
}
function vi(_e, Qt) {
  return ti$1(8390656, 8, _e, Qt);
}
function ji$1(_e, Qt) {
  return ui$1(2048, 8, _e, Qt);
}
function wi$1(_e, Qt) {
  return ui$1(4, 2, _e, Qt);
}
function xi$1(_e, Qt) {
  return ui$1(4, 4, _e, Qt);
}
function yi(_e, Qt) {
  if (typeof Qt == "function")
    return _e = _e(), Qt(_e), function() {
      Qt(null);
    };
  if (Qt != null)
    return _e = _e(), Qt.current = _e, function() {
      Qt.current = null;
    };
}
function zi$1(_e, Qt, Zt) {
  return Zt = Zt != null ? Zt.concat([_e]) : null, ui$1(4, 4, yi.bind(null, Qt, _e), Zt);
}
function Ai$1() {
}
function Bi$1(_e, Qt) {
  var Zt = di$1();
  Qt = Qt === void 0 ? null : Qt;
  var $n = Zt.memoizedState;
  return $n !== null && Qt !== null && Wh$1(Qt, $n[1]) ? $n[0] : (Zt.memoizedState = [_e, Qt], _e);
}
function Ci$1(_e, Qt) {
  var Zt = di$1();
  Qt = Qt === void 0 ? null : Qt;
  var $n = Zt.memoizedState;
  return $n !== null && Qt !== null && Wh$1(Qt, $n[1]) ? $n[0] : (_e = _e(), Zt.memoizedState = [_e, Qt], _e);
}
function Di$1(_e, Qt, Zt) {
  return Rh$1 & 21 ? (He$1(Zt, Qt) || (Zt = yc$1(), N$2.lanes |= Zt, hh$1 |= Zt, _e.baseState = !0), Qt) : (_e.baseState && (_e.baseState = !1, Ug$1 = !0), _e.memoizedState = Zt);
}
function Ei$1(_e, Qt) {
  var Zt = C$5;
  C$5 = Zt !== 0 && 4 > Zt ? Zt : 4, _e(!0);
  var $n = Qh$1.transition;
  Qh$1.transition = {};
  try {
    _e(!1), Qt();
  } finally {
    C$5 = Zt, Qh$1.transition = $n;
  }
}
function Fi$1() {
  return di$1().memoizedState;
}
function Gi$1(_e, Qt, Zt) {
  var $n = lh$1(_e);
  if (Zt = { lane: $n, action: Zt, hasEagerState: !1, eagerState: null, next: null }, Hi(_e))
    Ii$1(Qt, Zt);
  else if (Zt = Yg$1(_e, Qt, Zt, $n), Zt !== null) {
    var Sn = L$2();
    mh$1(Zt, _e, $n, Sn), Ji$1(Zt, Qt, $n);
  }
}
function ri$1(_e, Qt, Zt) {
  var $n = lh$1(_e), Sn = { lane: $n, action: Zt, hasEagerState: !1, eagerState: null, next: null };
  if (Hi(_e))
    Ii$1(Qt, Sn);
  else {
    var kn = _e.alternate;
    if (_e.lanes === 0 && (kn === null || kn.lanes === 0) && (kn = Qt.lastRenderedReducer, kn !== null))
      try {
        var Kn = Qt.lastRenderedState, er = kn(Kn, Zt);
        if (Sn.hasEagerState = !0, Sn.eagerState = er, He$1(er, Kn)) {
          var Cr = Qt.interleaved;
          Cr === null ? (Sn.next = Sn, Xg$1(Qt)) : (Sn.next = Cr.next, Cr.next = Sn), Qt.interleaved = Sn;
          return;
        }
      } catch {
      } finally {
      }
    Zt = Yg$1(_e, Qt, Sn, $n), Zt !== null && (Sn = L$2(), mh$1(Zt, _e, $n, Sn), Ji$1(Zt, Qt, $n));
  }
}
function Hi(_e) {
  var Qt = _e.alternate;
  return _e === N$2 || Qt !== null && Qt === N$2;
}
function Ii$1(_e, Qt) {
  Th$1 = Sh$1 = !0;
  var Zt = _e.pending;
  Zt === null ? Qt.next = Qt : (Qt.next = Zt.next, Zt.next = Qt), _e.pending = Qt;
}
function Ji$1(_e, Qt, Zt) {
  if (Zt & 4194240) {
    var $n = Qt.lanes;
    $n &= _e.pendingLanes, Zt |= $n, Qt.lanes = Zt, Cc$1(_e, Zt);
  }
}
var ai$1 = { readContext: Vg$1, useCallback: Q$2, useContext: Q$2, useEffect: Q$2, useImperativeHandle: Q$2, useInsertionEffect: Q$2, useLayoutEffect: Q$2, useMemo: Q$2, useReducer: Q$2, useRef: Q$2, useState: Q$2, useDebugValue: Q$2, useDeferredValue: Q$2, useTransition: Q$2, useMutableSource: Q$2, useSyncExternalStore: Q$2, useId: Q$2, unstable_isNewReconciler: !1 }, Yh$1 = { readContext: Vg$1, useCallback: function(_e, Qt) {
  return ci$1().memoizedState = [_e, Qt === void 0 ? null : Qt], _e;
}, useContext: Vg$1, useEffect: vi, useImperativeHandle: function(_e, Qt, Zt) {
  return Zt = Zt != null ? Zt.concat([_e]) : null, ti$1(
    4194308,
    4,
    yi.bind(null, Qt, _e),
    Zt
  );
}, useLayoutEffect: function(_e, Qt) {
  return ti$1(4194308, 4, _e, Qt);
}, useInsertionEffect: function(_e, Qt) {
  return ti$1(4, 2, _e, Qt);
}, useMemo: function(_e, Qt) {
  var Zt = ci$1();
  return Qt = Qt === void 0 ? null : Qt, _e = _e(), Zt.memoizedState = [_e, Qt], _e;
}, useReducer: function(_e, Qt, Zt) {
  var $n = ci$1();
  return Qt = Zt !== void 0 ? Zt(Qt) : Qt, $n.memoizedState = $n.baseState = Qt, _e = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: _e, lastRenderedState: Qt }, $n.queue = _e, _e = _e.dispatch = Gi$1.bind(null, N$2, _e), [$n.memoizedState, _e];
}, useRef: function(_e) {
  var Qt = ci$1();
  return _e = { current: _e }, Qt.memoizedState = _e;
}, useState: qi, useDebugValue: Ai$1, useDeferredValue: function(_e) {
  return ci$1().memoizedState = _e;
}, useTransition: function() {
  var _e = qi(!1), Qt = _e[0];
  return _e = Ei$1.bind(null, _e[1]), ci$1().memoizedState = _e, [Qt, _e];
}, useMutableSource: function() {
}, useSyncExternalStore: function(_e, Qt, Zt) {
  var $n = N$2, Sn = ci$1();
  if (I$2) {
    if (Zt === void 0)
      throw Error(p$6(407));
    Zt = Zt();
  } else {
    if (Zt = Qt(), R$1 === null)
      throw Error(p$6(349));
    Rh$1 & 30 || ni$1($n, Qt, Zt);
  }
  Sn.memoizedState = Zt;
  var kn = { value: Zt, getSnapshot: Qt };
  return Sn.queue = kn, vi(ki$1.bind(
    null,
    $n,
    kn,
    _e
  ), [_e]), $n.flags |= 2048, li$1(9, mi.bind(null, $n, kn, Zt, Qt), void 0, null), Zt;
}, useId: function() {
  var _e = ci$1(), Qt = R$1.identifierPrefix;
  if (I$2) {
    var Zt = sg$1, $n = rg$1;
    Zt = ($n & ~(1 << 32 - oc$1($n) - 1)).toString(32) + Zt, Qt = ":" + Qt + "R" + Zt, Zt = Uh$1++, 0 < Zt && (Qt += "H" + Zt.toString(32)), Qt += ":";
  } else
    Zt = Vh$1++, Qt = ":" + Qt + "r" + Zt.toString(32) + ":";
  return _e.memoizedState = Qt;
}, unstable_isNewReconciler: !1 }, Zh$1 = {
  readContext: Vg$1,
  useCallback: Bi$1,
  useContext: Vg$1,
  useEffect: ji$1,
  useImperativeHandle: zi$1,
  useInsertionEffect: wi$1,
  useLayoutEffect: xi$1,
  useMemo: Ci$1,
  useReducer: fi$1,
  useRef: si$1,
  useState: function() {
    return fi$1(ei$1);
  },
  useDebugValue: Ai$1,
  useDeferredValue: function(_e) {
    var Qt = di$1();
    return Di$1(Qt, O$1.memoizedState, _e);
  },
  useTransition: function() {
    var _e = fi$1(ei$1)[0], Qt = di$1().memoizedState;
    return [_e, Qt];
  },
  useMutableSource: hi,
  useSyncExternalStore: ii$1,
  useId: Fi$1,
  unstable_isNewReconciler: !1
}, $h$1 = { readContext: Vg$1, useCallback: Bi$1, useContext: Vg$1, useEffect: ji$1, useImperativeHandle: zi$1, useInsertionEffect: wi$1, useLayoutEffect: xi$1, useMemo: Ci$1, useReducer: gi, useRef: si$1, useState: function() {
  return gi(ei$1);
}, useDebugValue: Ai$1, useDeferredValue: function(_e) {
  var Qt = di$1();
  return O$1 === null ? Qt.memoizedState = _e : Di$1(Qt, O$1.memoizedState, _e);
}, useTransition: function() {
  var _e = gi(ei$1)[0], Qt = di$1().memoizedState;
  return [_e, Qt];
}, useMutableSource: hi, useSyncExternalStore: ii$1, useId: Fi$1, unstable_isNewReconciler: !1 };
function Ki$1(_e, Qt) {
  try {
    var Zt = "", $n = Qt;
    do
      Zt += Pa$1($n), $n = $n.return;
    while ($n);
    var Sn = Zt;
  } catch (kn) {
    Sn = `
Error generating stack: ` + kn.message + `
` + kn.stack;
  }
  return { value: _e, source: Qt, stack: Sn, digest: null };
}
function Li$1(_e, Qt, Zt) {
  return { value: _e, source: null, stack: Zt ?? null, digest: Qt ?? null };
}
function Mi$1(_e, Qt) {
  try {
    console.error(Qt.value);
  } catch (Zt) {
    setTimeout(function() {
      throw Zt;
    });
  }
}
var Ni$1 = typeof WeakMap == "function" ? WeakMap : Map;
function Oi$1(_e, Qt, Zt) {
  Zt = ch$2(-1, Zt), Zt.tag = 3, Zt.payload = { element: null };
  var $n = Qt.value;
  return Zt.callback = function() {
    Pi$1 || (Pi$1 = !0, Qi$1 = $n), Mi$1(_e, Qt);
  }, Zt;
}
function Ri$1(_e, Qt, Zt) {
  Zt = ch$2(-1, Zt), Zt.tag = 3;
  var $n = _e.type.getDerivedStateFromError;
  if (typeof $n == "function") {
    var Sn = Qt.value;
    Zt.payload = function() {
      return $n(Sn);
    }, Zt.callback = function() {
      Mi$1(_e, Qt);
    };
  }
  var kn = _e.stateNode;
  return kn !== null && typeof kn.componentDidCatch == "function" && (Zt.callback = function() {
    Mi$1(_e, Qt), typeof $n != "function" && (Si$1 === null ? Si$1 = /* @__PURE__ */ new Set([this]) : Si$1.add(this));
    var Kn = Qt.stack;
    this.componentDidCatch(Qt.value, { componentStack: Kn !== null ? Kn : "" });
  }), Zt;
}
function Ti$1(_e, Qt, Zt) {
  var $n = _e.pingCache;
  if ($n === null) {
    $n = _e.pingCache = new Ni$1();
    var Sn = /* @__PURE__ */ new Set();
    $n.set(Qt, Sn);
  } else
    Sn = $n.get(Qt), Sn === void 0 && (Sn = /* @__PURE__ */ new Set(), $n.set(Qt, Sn));
  Sn.has(Zt) || (Sn.add(Zt), _e = Ui.bind(null, _e, Qt, Zt), Qt.then(_e, _e));
}
function Vi$1(_e) {
  do {
    var Qt;
    if ((Qt = _e.tag === 13) && (Qt = _e.memoizedState, Qt = Qt !== null ? Qt.dehydrated !== null : !0), Qt)
      return _e;
    _e = _e.return;
  } while (_e !== null);
  return null;
}
function Wi$1(_e, Qt, Zt, $n, Sn) {
  return _e.mode & 1 ? (_e.flags |= 65536, _e.lanes = Sn, _e) : (_e === Qt ? _e.flags |= 65536 : (_e.flags |= 128, Zt.flags |= 131072, Zt.flags &= -52805, Zt.tag === 1 && (Zt.alternate === null ? Zt.tag = 17 : (Qt = ch$2(-1, 1), Qt.tag = 2, dh$1(Zt, Qt, 1))), Zt.lanes |= 1), _e);
}
var Xi$1 = ua$1.ReactCurrentOwner, Ug$1 = !1;
function Yi(_e, Qt, Zt, $n) {
  Qt.child = _e === null ? Ch$1(Qt, null, Zt, $n) : Bh$1(Qt, _e.child, Zt, $n);
}
function Zi$1(_e, Qt, Zt, $n, Sn) {
  Zt = Zt.render;
  var kn = Qt.ref;
  return Tg(Qt, Sn), $n = Xh$1(_e, Qt, Zt, $n, kn, Sn), Zt = bi$1(), _e !== null && !Ug$1 ? (Qt.updateQueue = _e.updateQueue, Qt.flags &= -2053, _e.lanes &= ~Sn, $i$1(_e, Qt, Sn)) : (I$2 && Zt && vg(Qt), Qt.flags |= 1, Yi(_e, Qt, $n, Sn), Qt.child);
}
function aj(_e, Qt, Zt, $n, Sn) {
  if (_e === null) {
    var kn = Zt.type;
    return typeof kn == "function" && !bj(kn) && kn.defaultProps === void 0 && Zt.compare === null && Zt.defaultProps === void 0 ? (Qt.tag = 15, Qt.type = kn, cj(_e, Qt, kn, $n, Sn)) : (_e = yh$2(Zt.type, null, $n, Qt, Qt.mode, Sn), _e.ref = Qt.ref, _e.return = Qt, Qt.child = _e);
  }
  if (kn = _e.child, !(_e.lanes & Sn)) {
    var Kn = kn.memoizedProps;
    if (Zt = Zt.compare, Zt = Zt !== null ? Zt : Ie$1, Zt(Kn, $n) && _e.ref === Qt.ref)
      return $i$1(_e, Qt, Sn);
  }
  return Qt.flags |= 1, _e = wh$1(kn, $n), _e.ref = Qt.ref, _e.return = Qt, Qt.child = _e;
}
function cj(_e, Qt, Zt, $n, Sn) {
  if (_e !== null) {
    var kn = _e.memoizedProps;
    if (Ie$1(kn, $n) && _e.ref === Qt.ref)
      if (Ug$1 = !1, Qt.pendingProps = $n = kn, (_e.lanes & Sn) !== 0)
        _e.flags & 131072 && (Ug$1 = !0);
      else
        return Qt.lanes = _e.lanes, $i$1(_e, Qt, Sn);
  }
  return dj(_e, Qt, Zt, $n, Sn);
}
function ej(_e, Qt, Zt) {
  var $n = Qt.pendingProps, Sn = $n.children, kn = _e !== null ? _e.memoizedState : null;
  if ($n.mode === "hidden")
    if (!(Qt.mode & 1))
      Qt.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, G$2(fj, gj), gj |= Zt;
    else {
      if (!(Zt & 1073741824))
        return _e = kn !== null ? kn.baseLanes | Zt : Zt, Qt.lanes = Qt.childLanes = 1073741824, Qt.memoizedState = { baseLanes: _e, cachePool: null, transitions: null }, Qt.updateQueue = null, G$2(fj, gj), gj |= _e, null;
      Qt.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, $n = kn !== null ? kn.baseLanes : Zt, G$2(fj, gj), gj |= $n;
    }
  else
    kn !== null ? ($n = kn.baseLanes | Zt, Qt.memoizedState = null) : $n = Zt, G$2(fj, gj), gj |= $n;
  return Yi(_e, Qt, Sn, Zt), Qt.child;
}
function hj(_e, Qt) {
  var Zt = Qt.ref;
  (_e === null && Zt !== null || _e !== null && _e.ref !== Zt) && (Qt.flags |= 512, Qt.flags |= 2097152);
}
function dj(_e, Qt, Zt, $n, Sn) {
  var kn = Zf$1(Zt) ? Xf$1 : H$3.current;
  return kn = Yf$1(Qt, kn), Tg(Qt, Sn), Zt = Xh$1(_e, Qt, Zt, $n, kn, Sn), $n = bi$1(), _e !== null && !Ug$1 ? (Qt.updateQueue = _e.updateQueue, Qt.flags &= -2053, _e.lanes &= ~Sn, $i$1(_e, Qt, Sn)) : (I$2 && $n && vg(Qt), Qt.flags |= 1, Yi(_e, Qt, Zt, Sn), Qt.child);
}
function ij(_e, Qt, Zt, $n, Sn) {
  if (Zf$1(Zt)) {
    var kn = !0;
    cg$1(Qt);
  } else
    kn = !1;
  if (Tg(Qt, Sn), Qt.stateNode === null)
    jj(_e, Qt), ph$1(Qt, Zt, $n), rh$1(Qt, Zt, $n, Sn), $n = !0;
  else if (_e === null) {
    var Kn = Qt.stateNode, er = Qt.memoizedProps;
    Kn.props = er;
    var Cr = Kn.context, kr = Zt.contextType;
    typeof kr == "object" && kr !== null ? kr = Vg$1(kr) : (kr = Zf$1(Zt) ? Xf$1 : H$3.current, kr = Yf$1(Qt, kr));
    var Yr = Zt.getDerivedStateFromProps, Ms = typeof Yr == "function" || typeof Kn.getSnapshotBeforeUpdate == "function";
    Ms || typeof Kn.UNSAFE_componentWillReceiveProps != "function" && typeof Kn.componentWillReceiveProps != "function" || (er !== $n || Cr !== kr) && qh$1(Qt, Kn, $n, kr), $g$1 = !1;
    var Ds = Qt.memoizedState;
    Kn.state = Ds, gh$1(Qt, $n, Kn, Sn), Cr = Qt.memoizedState, er !== $n || Ds !== Cr || Wf$1.current || $g$1 ? (typeof Yr == "function" && (kh$1(Qt, Zt, Yr, $n), Cr = Qt.memoizedState), (er = $g$1 || oh$1(Qt, Zt, er, $n, Ds, Cr, kr)) ? (Ms || typeof Kn.UNSAFE_componentWillMount != "function" && typeof Kn.componentWillMount != "function" || (typeof Kn.componentWillMount == "function" && Kn.componentWillMount(), typeof Kn.UNSAFE_componentWillMount == "function" && Kn.UNSAFE_componentWillMount()), typeof Kn.componentDidMount == "function" && (Qt.flags |= 4194308)) : (typeof Kn.componentDidMount == "function" && (Qt.flags |= 4194308), Qt.memoizedProps = $n, Qt.memoizedState = Cr), Kn.props = $n, Kn.state = Cr, Kn.context = kr, $n = er) : (typeof Kn.componentDidMount == "function" && (Qt.flags |= 4194308), $n = !1);
  } else {
    Kn = Qt.stateNode, bh$1(_e, Qt), er = Qt.memoizedProps, kr = Qt.type === Qt.elementType ? er : Lg$1(Qt.type, er), Kn.props = kr, Ms = Qt.pendingProps, Ds = Kn.context, Cr = Zt.contextType, typeof Cr == "object" && Cr !== null ? Cr = Vg$1(Cr) : (Cr = Zf$1(Zt) ? Xf$1 : H$3.current, Cr = Yf$1(Qt, Cr));
    var Ls = Zt.getDerivedStateFromProps;
    (Yr = typeof Ls == "function" || typeof Kn.getSnapshotBeforeUpdate == "function") || typeof Kn.UNSAFE_componentWillReceiveProps != "function" && typeof Kn.componentWillReceiveProps != "function" || (er !== Ms || Ds !== Cr) && qh$1(Qt, Kn, $n, Cr), $g$1 = !1, Ds = Qt.memoizedState, Kn.state = Ds, gh$1(Qt, $n, Kn, Sn);
    var js = Qt.memoizedState;
    er !== Ms || Ds !== js || Wf$1.current || $g$1 ? (typeof Ls == "function" && (kh$1(Qt, Zt, Ls, $n), js = Qt.memoizedState), (kr = $g$1 || oh$1(Qt, Zt, kr, $n, Ds, js, Cr) || !1) ? (Yr || typeof Kn.UNSAFE_componentWillUpdate != "function" && typeof Kn.componentWillUpdate != "function" || (typeof Kn.componentWillUpdate == "function" && Kn.componentWillUpdate($n, js, Cr), typeof Kn.UNSAFE_componentWillUpdate == "function" && Kn.UNSAFE_componentWillUpdate($n, js, Cr)), typeof Kn.componentDidUpdate == "function" && (Qt.flags |= 4), typeof Kn.getSnapshotBeforeUpdate == "function" && (Qt.flags |= 1024)) : (typeof Kn.componentDidUpdate != "function" || er === _e.memoizedProps && Ds === _e.memoizedState || (Qt.flags |= 4), typeof Kn.getSnapshotBeforeUpdate != "function" || er === _e.memoizedProps && Ds === _e.memoizedState || (Qt.flags |= 1024), Qt.memoizedProps = $n, Qt.memoizedState = js), Kn.props = $n, Kn.state = js, Kn.context = Cr, $n = kr) : (typeof Kn.componentDidUpdate != "function" || er === _e.memoizedProps && Ds === _e.memoizedState || (Qt.flags |= 4), typeof Kn.getSnapshotBeforeUpdate != "function" || er === _e.memoizedProps && Ds === _e.memoizedState || (Qt.flags |= 1024), $n = !1);
  }
  return kj(_e, Qt, Zt, $n, kn, Sn);
}
function kj(_e, Qt, Zt, $n, Sn, kn) {
  hj(_e, Qt);
  var Kn = (Qt.flags & 128) !== 0;
  if (!$n && !Kn)
    return Sn && dg$1(Qt, Zt, !1), $i$1(_e, Qt, kn);
  $n = Qt.stateNode, Xi$1.current = Qt;
  var er = Kn && typeof Zt.getDerivedStateFromError != "function" ? null : $n.render();
  return Qt.flags |= 1, _e !== null && Kn ? (Qt.child = Bh$1(Qt, _e.child, null, kn), Qt.child = Bh$1(Qt, null, er, kn)) : Yi(_e, Qt, er, kn), Qt.memoizedState = $n.state, Sn && dg$1(Qt, Zt, !0), Qt.child;
}
function lj(_e) {
  var Qt = _e.stateNode;
  Qt.pendingContext ? ag$1(_e, Qt.pendingContext, Qt.pendingContext !== Qt.context) : Qt.context && ag$1(_e, Qt.context, !1), Ih$1(_e, Qt.containerInfo);
}
function mj(_e, Qt, Zt, $n, Sn) {
  return Ig(), Jg$1(Sn), Qt.flags |= 256, Yi(_e, Qt, Zt, $n), Qt.child;
}
var nj = { dehydrated: null, treeContext: null, retryLane: 0 };
function oj(_e) {
  return { baseLanes: _e, cachePool: null, transitions: null };
}
function pj(_e, Qt, Zt) {
  var $n = Qt.pendingProps, Sn = M$3.current, kn = !1, Kn = (Qt.flags & 128) !== 0, er;
  if ((er = Kn) || (er = _e !== null && _e.memoizedState === null ? !1 : (Sn & 2) !== 0), er ? (kn = !0, Qt.flags &= -129) : (_e === null || _e.memoizedState !== null) && (Sn |= 1), G$2(M$3, Sn & 1), _e === null)
    return Eg$1(Qt), _e = Qt.memoizedState, _e !== null && (_e = _e.dehydrated, _e !== null) ? (Qt.mode & 1 ? _e.data === "$!" ? Qt.lanes = 8 : Qt.lanes = 1073741824 : Qt.lanes = 1, null) : (Kn = $n.children, _e = $n.fallback, kn ? ($n = Qt.mode, kn = Qt.child, Kn = { mode: "hidden", children: Kn }, !($n & 1) && kn !== null ? (kn.childLanes = 0, kn.pendingProps = Kn) : kn = qj(Kn, $n, 0, null), _e = Ah$1(_e, $n, Zt, null), kn.return = Qt, _e.return = Qt, kn.sibling = _e, Qt.child = kn, Qt.child.memoizedState = oj(Zt), Qt.memoizedState = nj, _e) : rj(Qt, Kn));
  if (Sn = _e.memoizedState, Sn !== null && (er = Sn.dehydrated, er !== null))
    return sj(_e, Qt, Kn, $n, er, Sn, Zt);
  if (kn) {
    kn = $n.fallback, Kn = Qt.mode, Sn = _e.child, er = Sn.sibling;
    var Cr = { mode: "hidden", children: $n.children };
    return !(Kn & 1) && Qt.child !== Sn ? ($n = Qt.child, $n.childLanes = 0, $n.pendingProps = Cr, Qt.deletions = null) : ($n = wh$1(Sn, Cr), $n.subtreeFlags = Sn.subtreeFlags & 14680064), er !== null ? kn = wh$1(er, kn) : (kn = Ah$1(kn, Kn, Zt, null), kn.flags |= 2), kn.return = Qt, $n.return = Qt, $n.sibling = kn, Qt.child = $n, $n = kn, kn = Qt.child, Kn = _e.child.memoizedState, Kn = Kn === null ? oj(Zt) : { baseLanes: Kn.baseLanes | Zt, cachePool: null, transitions: Kn.transitions }, kn.memoizedState = Kn, kn.childLanes = _e.childLanes & ~Zt, Qt.memoizedState = nj, $n;
  }
  return kn = _e.child, _e = kn.sibling, $n = wh$1(kn, { mode: "visible", children: $n.children }), !(Qt.mode & 1) && ($n.lanes = Zt), $n.return = Qt, $n.sibling = null, _e !== null && (Zt = Qt.deletions, Zt === null ? (Qt.deletions = [_e], Qt.flags |= 16) : Zt.push(_e)), Qt.child = $n, Qt.memoizedState = null, $n;
}
function rj(_e, Qt) {
  return Qt = qj({ mode: "visible", children: Qt }, _e.mode, 0, null), Qt.return = _e, _e.child = Qt;
}
function tj(_e, Qt, Zt, $n) {
  return $n !== null && Jg$1($n), Bh$1(Qt, _e.child, null, Zt), _e = rj(Qt, Qt.pendingProps.children), _e.flags |= 2, Qt.memoizedState = null, _e;
}
function sj(_e, Qt, Zt, $n, Sn, kn, Kn) {
  if (Zt)
    return Qt.flags & 256 ? (Qt.flags &= -257, $n = Li$1(Error(p$6(422))), tj(_e, Qt, Kn, $n)) : Qt.memoizedState !== null ? (Qt.child = _e.child, Qt.flags |= 128, null) : (kn = $n.fallback, Sn = Qt.mode, $n = qj({ mode: "visible", children: $n.children }, Sn, 0, null), kn = Ah$1(kn, Sn, Kn, null), kn.flags |= 2, $n.return = Qt, kn.return = Qt, $n.sibling = kn, Qt.child = $n, Qt.mode & 1 && Bh$1(Qt, _e.child, null, Kn), Qt.child.memoizedState = oj(Kn), Qt.memoizedState = nj, kn);
  if (!(Qt.mode & 1))
    return tj(_e, Qt, Kn, null);
  if (Sn.data === "$!") {
    if ($n = Sn.nextSibling && Sn.nextSibling.dataset, $n)
      var er = $n.dgst;
    return $n = er, kn = Error(p$6(419)), $n = Li$1(kn, $n, void 0), tj(_e, Qt, Kn, $n);
  }
  if (er = (Kn & _e.childLanes) !== 0, Ug$1 || er) {
    if ($n = R$1, $n !== null) {
      switch (Kn & -Kn) {
        case 4:
          Sn = 2;
          break;
        case 16:
          Sn = 8;
          break;
        case 64:
        case 128:
        case 256:
        case 512:
        case 1024:
        case 2048:
        case 4096:
        case 8192:
        case 16384:
        case 32768:
        case 65536:
        case 131072:
        case 262144:
        case 524288:
        case 1048576:
        case 2097152:
        case 4194304:
        case 8388608:
        case 16777216:
        case 33554432:
        case 67108864:
          Sn = 32;
          break;
        case 536870912:
          Sn = 268435456;
          break;
        default:
          Sn = 0;
      }
      Sn = Sn & ($n.suspendedLanes | Kn) ? 0 : Sn, Sn !== 0 && Sn !== kn.retryLane && (kn.retryLane = Sn, Zg$1(_e, Sn), mh$1($n, _e, Sn, -1));
    }
    return uj(), $n = Li$1(Error(p$6(421))), tj(_e, Qt, Kn, $n);
  }
  return Sn.data === "$?" ? (Qt.flags |= 128, Qt.child = _e.child, Qt = vj.bind(null, _e), Sn._reactRetry = Qt, null) : (_e = kn.treeContext, yg = Lf$1(Sn.nextSibling), xg$1 = Qt, I$2 = !0, zg$1 = null, _e !== null && (og$1[pg$1++] = rg$1, og$1[pg$1++] = sg$1, og$1[pg$1++] = qg$1, rg$1 = _e.id, sg$1 = _e.overflow, qg$1 = Qt), Qt = rj(Qt, $n.children), Qt.flags |= 4096, Qt);
}
function wj(_e, Qt, Zt) {
  _e.lanes |= Qt;
  var $n = _e.alternate;
  $n !== null && ($n.lanes |= Qt), Sg$1(_e.return, Qt, Zt);
}
function xj(_e, Qt, Zt, $n, Sn) {
  var kn = _e.memoizedState;
  kn === null ? _e.memoizedState = { isBackwards: Qt, rendering: null, renderingStartTime: 0, last: $n, tail: Zt, tailMode: Sn } : (kn.isBackwards = Qt, kn.rendering = null, kn.renderingStartTime = 0, kn.last = $n, kn.tail = Zt, kn.tailMode = Sn);
}
function yj(_e, Qt, Zt) {
  var $n = Qt.pendingProps, Sn = $n.revealOrder, kn = $n.tail;
  if (Yi(_e, Qt, $n.children, Zt), $n = M$3.current, $n & 2)
    $n = $n & 1 | 2, Qt.flags |= 128;
  else {
    if (_e !== null && _e.flags & 128)
      e:
        for (_e = Qt.child; _e !== null; ) {
          if (_e.tag === 13)
            _e.memoizedState !== null && wj(_e, Zt, Qt);
          else if (_e.tag === 19)
            wj(_e, Zt, Qt);
          else if (_e.child !== null) {
            _e.child.return = _e, _e = _e.child;
            continue;
          }
          if (_e === Qt)
            break e;
          for (; _e.sibling === null; ) {
            if (_e.return === null || _e.return === Qt)
              break e;
            _e = _e.return;
          }
          _e.sibling.return = _e.return, _e = _e.sibling;
        }
    $n &= 1;
  }
  if (G$2(M$3, $n), !(Qt.mode & 1))
    Qt.memoizedState = null;
  else
    switch (Sn) {
      case "forwards":
        for (Zt = Qt.child, Sn = null; Zt !== null; )
          _e = Zt.alternate, _e !== null && Mh$1(_e) === null && (Sn = Zt), Zt = Zt.sibling;
        Zt = Sn, Zt === null ? (Sn = Qt.child, Qt.child = null) : (Sn = Zt.sibling, Zt.sibling = null), xj(Qt, !1, Sn, Zt, kn);
        break;
      case "backwards":
        for (Zt = null, Sn = Qt.child, Qt.child = null; Sn !== null; ) {
          if (_e = Sn.alternate, _e !== null && Mh$1(_e) === null) {
            Qt.child = Sn;
            break;
          }
          _e = Sn.sibling, Sn.sibling = Zt, Zt = Sn, Sn = _e;
        }
        xj(Qt, !0, Zt, null, kn);
        break;
      case "together":
        xj(Qt, !1, null, null, void 0);
        break;
      default:
        Qt.memoizedState = null;
    }
  return Qt.child;
}
function jj(_e, Qt) {
  !(Qt.mode & 1) && _e !== null && (_e.alternate = null, Qt.alternate = null, Qt.flags |= 2);
}
function $i$1(_e, Qt, Zt) {
  if (_e !== null && (Qt.dependencies = _e.dependencies), hh$1 |= Qt.lanes, !(Zt & Qt.childLanes))
    return null;
  if (_e !== null && Qt.child !== _e.child)
    throw Error(p$6(153));
  if (Qt.child !== null) {
    for (_e = Qt.child, Zt = wh$1(_e, _e.pendingProps), Qt.child = Zt, Zt.return = Qt; _e.sibling !== null; )
      _e = _e.sibling, Zt = Zt.sibling = wh$1(_e, _e.pendingProps), Zt.return = Qt;
    Zt.sibling = null;
  }
  return Qt.child;
}
function zj(_e, Qt, Zt) {
  switch (Qt.tag) {
    case 3:
      lj(Qt), Ig();
      break;
    case 5:
      Kh$1(Qt);
      break;
    case 1:
      Zf$1(Qt.type) && cg$1(Qt);
      break;
    case 4:
      Ih$1(Qt, Qt.stateNode.containerInfo);
      break;
    case 10:
      var $n = Qt.type._context, Sn = Qt.memoizedProps.value;
      G$2(Mg$1, $n._currentValue), $n._currentValue = Sn;
      break;
    case 13:
      if ($n = Qt.memoizedState, $n !== null)
        return $n.dehydrated !== null ? (G$2(M$3, M$3.current & 1), Qt.flags |= 128, null) : Zt & Qt.child.childLanes ? pj(_e, Qt, Zt) : (G$2(M$3, M$3.current & 1), _e = $i$1(_e, Qt, Zt), _e !== null ? _e.sibling : null);
      G$2(M$3, M$3.current & 1);
      break;
    case 19:
      if ($n = (Zt & Qt.childLanes) !== 0, _e.flags & 128) {
        if ($n)
          return yj(_e, Qt, Zt);
        Qt.flags |= 128;
      }
      if (Sn = Qt.memoizedState, Sn !== null && (Sn.rendering = null, Sn.tail = null, Sn.lastEffect = null), G$2(M$3, M$3.current), $n)
        break;
      return null;
    case 22:
    case 23:
      return Qt.lanes = 0, ej(_e, Qt, Zt);
  }
  return $i$1(_e, Qt, Zt);
}
var Aj, Bj, Cj, Dj;
Aj = function(_e, Qt) {
  for (var Zt = Qt.child; Zt !== null; ) {
    if (Zt.tag === 5 || Zt.tag === 6)
      _e.appendChild(Zt.stateNode);
    else if (Zt.tag !== 4 && Zt.child !== null) {
      Zt.child.return = Zt, Zt = Zt.child;
      continue;
    }
    if (Zt === Qt)
      break;
    for (; Zt.sibling === null; ) {
      if (Zt.return === null || Zt.return === Qt)
        return;
      Zt = Zt.return;
    }
    Zt.sibling.return = Zt.return, Zt = Zt.sibling;
  }
};
Bj = function() {
};
Cj = function(_e, Qt, Zt, $n) {
  var Sn = _e.memoizedProps;
  if (Sn !== $n) {
    _e = Qt.stateNode, Hh$1(Eh$1.current);
    var kn = null;
    switch (Zt) {
      case "input":
        Sn = Ya$1(_e, Sn), $n = Ya$1(_e, $n), kn = [];
        break;
      case "select":
        Sn = A$3({}, Sn, { value: void 0 }), $n = A$3({}, $n, { value: void 0 }), kn = [];
        break;
      case "textarea":
        Sn = gb$1(_e, Sn), $n = gb$1(_e, $n), kn = [];
        break;
      default:
        typeof Sn.onClick != "function" && typeof $n.onClick == "function" && (_e.onclick = Bf$1);
    }
    ub$1(Zt, $n);
    var Kn;
    Zt = null;
    for (kr in Sn)
      if (!$n.hasOwnProperty(kr) && Sn.hasOwnProperty(kr) && Sn[kr] != null)
        if (kr === "style") {
          var er = Sn[kr];
          for (Kn in er)
            er.hasOwnProperty(Kn) && (Zt || (Zt = {}), Zt[Kn] = "");
        } else
          kr !== "dangerouslySetInnerHTML" && kr !== "children" && kr !== "suppressContentEditableWarning" && kr !== "suppressHydrationWarning" && kr !== "autoFocus" && (ea$2.hasOwnProperty(kr) ? kn || (kn = []) : (kn = kn || []).push(kr, null));
    for (kr in $n) {
      var Cr = $n[kr];
      if (er = Sn != null ? Sn[kr] : void 0, $n.hasOwnProperty(kr) && Cr !== er && (Cr != null || er != null))
        if (kr === "style")
          if (er) {
            for (Kn in er)
              !er.hasOwnProperty(Kn) || Cr && Cr.hasOwnProperty(Kn) || (Zt || (Zt = {}), Zt[Kn] = "");
            for (Kn in Cr)
              Cr.hasOwnProperty(Kn) && er[Kn] !== Cr[Kn] && (Zt || (Zt = {}), Zt[Kn] = Cr[Kn]);
          } else
            Zt || (kn || (kn = []), kn.push(
              kr,
              Zt
            )), Zt = Cr;
        else
          kr === "dangerouslySetInnerHTML" ? (Cr = Cr ? Cr.__html : void 0, er = er ? er.__html : void 0, Cr != null && er !== Cr && (kn = kn || []).push(kr, Cr)) : kr === "children" ? typeof Cr != "string" && typeof Cr != "number" || (kn = kn || []).push(kr, "" + Cr) : kr !== "suppressContentEditableWarning" && kr !== "suppressHydrationWarning" && (ea$2.hasOwnProperty(kr) ? (Cr != null && kr === "onScroll" && D$4("scroll", _e), kn || er === Cr || (kn = [])) : (kn = kn || []).push(kr, Cr));
    }
    Zt && (kn = kn || []).push("style", Zt);
    var kr = kn;
    (Qt.updateQueue = kr) && (Qt.flags |= 4);
  }
};
Dj = function(_e, Qt, Zt, $n) {
  Zt !== $n && (Qt.flags |= 4);
};
function Ej(_e, Qt) {
  if (!I$2)
    switch (_e.tailMode) {
      case "hidden":
        Qt = _e.tail;
        for (var Zt = null; Qt !== null; )
          Qt.alternate !== null && (Zt = Qt), Qt = Qt.sibling;
        Zt === null ? _e.tail = null : Zt.sibling = null;
        break;
      case "collapsed":
        Zt = _e.tail;
        for (var $n = null; Zt !== null; )
          Zt.alternate !== null && ($n = Zt), Zt = Zt.sibling;
        $n === null ? Qt || _e.tail === null ? _e.tail = null : _e.tail.sibling = null : $n.sibling = null;
    }
}
function S$2(_e) {
  var Qt = _e.alternate !== null && _e.alternate.child === _e.child, Zt = 0, $n = 0;
  if (Qt)
    for (var Sn = _e.child; Sn !== null; )
      Zt |= Sn.lanes | Sn.childLanes, $n |= Sn.subtreeFlags & 14680064, $n |= Sn.flags & 14680064, Sn.return = _e, Sn = Sn.sibling;
  else
    for (Sn = _e.child; Sn !== null; )
      Zt |= Sn.lanes | Sn.childLanes, $n |= Sn.subtreeFlags, $n |= Sn.flags, Sn.return = _e, Sn = Sn.sibling;
  return _e.subtreeFlags |= $n, _e.childLanes = Zt, Qt;
}
function Fj(_e, Qt, Zt) {
  var $n = Qt.pendingProps;
  switch (wg$1(Qt), Qt.tag) {
    case 2:
    case 16:
    case 15:
    case 0:
    case 11:
    case 7:
    case 8:
    case 12:
    case 9:
    case 14:
      return S$2(Qt), null;
    case 1:
      return Zf$1(Qt.type) && $f$1(), S$2(Qt), null;
    case 3:
      return $n = Qt.stateNode, Jh$1(), E$3(Wf$1), E$3(H$3), Oh$1(), $n.pendingContext && ($n.context = $n.pendingContext, $n.pendingContext = null), (_e === null || _e.child === null) && (Gg$1(Qt) ? Qt.flags |= 4 : _e === null || _e.memoizedState.isDehydrated && !(Qt.flags & 256) || (Qt.flags |= 1024, zg$1 !== null && (Gj(zg$1), zg$1 = null))), Bj(_e, Qt), S$2(Qt), null;
    case 5:
      Lh$1(Qt);
      var Sn = Hh$1(Gh$1.current);
      if (Zt = Qt.type, _e !== null && Qt.stateNode != null)
        Cj(_e, Qt, Zt, $n, Sn), _e.ref !== Qt.ref && (Qt.flags |= 512, Qt.flags |= 2097152);
      else {
        if (!$n) {
          if (Qt.stateNode === null)
            throw Error(p$6(166));
          return S$2(Qt), null;
        }
        if (_e = Hh$1(Eh$1.current), Gg$1(Qt)) {
          $n = Qt.stateNode, Zt = Qt.type;
          var kn = Qt.memoizedProps;
          switch ($n[Of$1] = Qt, $n[Pf$1] = kn, _e = (Qt.mode & 1) !== 0, Zt) {
            case "dialog":
              D$4("cancel", $n), D$4("close", $n);
              break;
            case "iframe":
            case "object":
            case "embed":
              D$4("load", $n);
              break;
            case "video":
            case "audio":
              for (Sn = 0; Sn < lf$1.length; Sn++)
                D$4(lf$1[Sn], $n);
              break;
            case "source":
              D$4("error", $n);
              break;
            case "img":
            case "image":
            case "link":
              D$4(
                "error",
                $n
              ), D$4("load", $n);
              break;
            case "details":
              D$4("toggle", $n);
              break;
            case "input":
              Za$1($n, kn), D$4("invalid", $n);
              break;
            case "select":
              $n._wrapperState = { wasMultiple: !!kn.multiple }, D$4("invalid", $n);
              break;
            case "textarea":
              hb$1($n, kn), D$4("invalid", $n);
          }
          ub$1(Zt, kn), Sn = null;
          for (var Kn in kn)
            if (kn.hasOwnProperty(Kn)) {
              var er = kn[Kn];
              Kn === "children" ? typeof er == "string" ? $n.textContent !== er && (kn.suppressHydrationWarning !== !0 && Af$1($n.textContent, er, _e), Sn = ["children", er]) : typeof er == "number" && $n.textContent !== "" + er && (kn.suppressHydrationWarning !== !0 && Af$1(
                $n.textContent,
                er,
                _e
              ), Sn = ["children", "" + er]) : ea$2.hasOwnProperty(Kn) && er != null && Kn === "onScroll" && D$4("scroll", $n);
            }
          switch (Zt) {
            case "input":
              Va$1($n), db$1($n, kn, !0);
              break;
            case "textarea":
              Va$1($n), jb$1($n);
              break;
            case "select":
            case "option":
              break;
            default:
              typeof kn.onClick == "function" && ($n.onclick = Bf$1);
          }
          $n = Sn, Qt.updateQueue = $n, $n !== null && (Qt.flags |= 4);
        } else {
          Kn = Sn.nodeType === 9 ? Sn : Sn.ownerDocument, _e === "http://www.w3.org/1999/xhtml" && (_e = kb$1(Zt)), _e === "http://www.w3.org/1999/xhtml" ? Zt === "script" ? (_e = Kn.createElement("div"), _e.innerHTML = "<script><\/script>", _e = _e.removeChild(_e.firstChild)) : typeof $n.is == "string" ? _e = Kn.createElement(Zt, { is: $n.is }) : (_e = Kn.createElement(Zt), Zt === "select" && (Kn = _e, $n.multiple ? Kn.multiple = !0 : $n.size && (Kn.size = $n.size))) : _e = Kn.createElementNS(_e, Zt), _e[Of$1] = Qt, _e[Pf$1] = $n, Aj(_e, Qt, !1, !1), Qt.stateNode = _e;
          e: {
            switch (Kn = vb$1(Zt, $n), Zt) {
              case "dialog":
                D$4("cancel", _e), D$4("close", _e), Sn = $n;
                break;
              case "iframe":
              case "object":
              case "embed":
                D$4("load", _e), Sn = $n;
                break;
              case "video":
              case "audio":
                for (Sn = 0; Sn < lf$1.length; Sn++)
                  D$4(lf$1[Sn], _e);
                Sn = $n;
                break;
              case "source":
                D$4("error", _e), Sn = $n;
                break;
              case "img":
              case "image":
              case "link":
                D$4(
                  "error",
                  _e
                ), D$4("load", _e), Sn = $n;
                break;
              case "details":
                D$4("toggle", _e), Sn = $n;
                break;
              case "input":
                Za$1(_e, $n), Sn = Ya$1(_e, $n), D$4("invalid", _e);
                break;
              case "option":
                Sn = $n;
                break;
              case "select":
                _e._wrapperState = { wasMultiple: !!$n.multiple }, Sn = A$3({}, $n, { value: void 0 }), D$4("invalid", _e);
                break;
              case "textarea":
                hb$1(_e, $n), Sn = gb$1(_e, $n), D$4("invalid", _e);
                break;
              default:
                Sn = $n;
            }
            ub$1(Zt, Sn), er = Sn;
            for (kn in er)
              if (er.hasOwnProperty(kn)) {
                var Cr = er[kn];
                kn === "style" ? sb$1(_e, Cr) : kn === "dangerouslySetInnerHTML" ? (Cr = Cr ? Cr.__html : void 0, Cr != null && nb$1(_e, Cr)) : kn === "children" ? typeof Cr == "string" ? (Zt !== "textarea" || Cr !== "") && ob$1(_e, Cr) : typeof Cr == "number" && ob$1(_e, "" + Cr) : kn !== "suppressContentEditableWarning" && kn !== "suppressHydrationWarning" && kn !== "autoFocus" && (ea$2.hasOwnProperty(kn) ? Cr != null && kn === "onScroll" && D$4("scroll", _e) : Cr != null && ta$1(_e, kn, Cr, Kn));
              }
            switch (Zt) {
              case "input":
                Va$1(_e), db$1(_e, $n, !1);
                break;
              case "textarea":
                Va$1(_e), jb$1(_e);
                break;
              case "option":
                $n.value != null && _e.setAttribute("value", "" + Sa$1($n.value));
                break;
              case "select":
                _e.multiple = !!$n.multiple, kn = $n.value, kn != null ? fb$1(_e, !!$n.multiple, kn, !1) : $n.defaultValue != null && fb$1(
                  _e,
                  !!$n.multiple,
                  $n.defaultValue,
                  !0
                );
                break;
              default:
                typeof Sn.onClick == "function" && (_e.onclick = Bf$1);
            }
            switch (Zt) {
              case "button":
              case "input":
              case "select":
              case "textarea":
                $n = !!$n.autoFocus;
                break e;
              case "img":
                $n = !0;
                break e;
              default:
                $n = !1;
            }
          }
          $n && (Qt.flags |= 4);
        }
        Qt.ref !== null && (Qt.flags |= 512, Qt.flags |= 2097152);
      }
      return S$2(Qt), null;
    case 6:
      if (_e && Qt.stateNode != null)
        Dj(_e, Qt, _e.memoizedProps, $n);
      else {
        if (typeof $n != "string" && Qt.stateNode === null)
          throw Error(p$6(166));
        if (Zt = Hh$1(Gh$1.current), Hh$1(Eh$1.current), Gg$1(Qt)) {
          if ($n = Qt.stateNode, Zt = Qt.memoizedProps, $n[Of$1] = Qt, (kn = $n.nodeValue !== Zt) && (_e = xg$1, _e !== null))
            switch (_e.tag) {
              case 3:
                Af$1($n.nodeValue, Zt, (_e.mode & 1) !== 0);
                break;
              case 5:
                _e.memoizedProps.suppressHydrationWarning !== !0 && Af$1($n.nodeValue, Zt, (_e.mode & 1) !== 0);
            }
          kn && (Qt.flags |= 4);
        } else
          $n = (Zt.nodeType === 9 ? Zt : Zt.ownerDocument).createTextNode($n), $n[Of$1] = Qt, Qt.stateNode = $n;
      }
      return S$2(Qt), null;
    case 13:
      if (E$3(M$3), $n = Qt.memoizedState, _e === null || _e.memoizedState !== null && _e.memoizedState.dehydrated !== null) {
        if (I$2 && yg !== null && Qt.mode & 1 && !(Qt.flags & 128))
          Hg$1(), Ig(), Qt.flags |= 98560, kn = !1;
        else if (kn = Gg$1(Qt), $n !== null && $n.dehydrated !== null) {
          if (_e === null) {
            if (!kn)
              throw Error(p$6(318));
            if (kn = Qt.memoizedState, kn = kn !== null ? kn.dehydrated : null, !kn)
              throw Error(p$6(317));
            kn[Of$1] = Qt;
          } else
            Ig(), !(Qt.flags & 128) && (Qt.memoizedState = null), Qt.flags |= 4;
          S$2(Qt), kn = !1;
        } else
          zg$1 !== null && (Gj(zg$1), zg$1 = null), kn = !0;
        if (!kn)
          return Qt.flags & 65536 ? Qt : null;
      }
      return Qt.flags & 128 ? (Qt.lanes = Zt, Qt) : ($n = $n !== null, $n !== (_e !== null && _e.memoizedState !== null) && $n && (Qt.child.flags |= 8192, Qt.mode & 1 && (_e === null || M$3.current & 1 ? T$1 === 0 && (T$1 = 3) : uj())), Qt.updateQueue !== null && (Qt.flags |= 4), S$2(Qt), null);
    case 4:
      return Jh$1(), Bj(_e, Qt), _e === null && sf$1(Qt.stateNode.containerInfo), S$2(Qt), null;
    case 10:
      return Rg(Qt.type._context), S$2(Qt), null;
    case 17:
      return Zf$1(Qt.type) && $f$1(), S$2(Qt), null;
    case 19:
      if (E$3(M$3), kn = Qt.memoizedState, kn === null)
        return S$2(Qt), null;
      if ($n = (Qt.flags & 128) !== 0, Kn = kn.rendering, Kn === null)
        if ($n)
          Ej(kn, !1);
        else {
          if (T$1 !== 0 || _e !== null && _e.flags & 128)
            for (_e = Qt.child; _e !== null; ) {
              if (Kn = Mh$1(_e), Kn !== null) {
                for (Qt.flags |= 128, Ej(kn, !1), $n = Kn.updateQueue, $n !== null && (Qt.updateQueue = $n, Qt.flags |= 4), Qt.subtreeFlags = 0, $n = Zt, Zt = Qt.child; Zt !== null; )
                  kn = Zt, _e = $n, kn.flags &= 14680066, Kn = kn.alternate, Kn === null ? (kn.childLanes = 0, kn.lanes = _e, kn.child = null, kn.subtreeFlags = 0, kn.memoizedProps = null, kn.memoizedState = null, kn.updateQueue = null, kn.dependencies = null, kn.stateNode = null) : (kn.childLanes = Kn.childLanes, kn.lanes = Kn.lanes, kn.child = Kn.child, kn.subtreeFlags = 0, kn.deletions = null, kn.memoizedProps = Kn.memoizedProps, kn.memoizedState = Kn.memoizedState, kn.updateQueue = Kn.updateQueue, kn.type = Kn.type, _e = Kn.dependencies, kn.dependencies = _e === null ? null : { lanes: _e.lanes, firstContext: _e.firstContext }), Zt = Zt.sibling;
                return G$2(M$3, M$3.current & 1 | 2), Qt.child;
              }
              _e = _e.sibling;
            }
          kn.tail !== null && B$4() > Hj && (Qt.flags |= 128, $n = !0, Ej(kn, !1), Qt.lanes = 4194304);
        }
      else {
        if (!$n)
          if (_e = Mh$1(Kn), _e !== null) {
            if (Qt.flags |= 128, $n = !0, Zt = _e.updateQueue, Zt !== null && (Qt.updateQueue = Zt, Qt.flags |= 4), Ej(kn, !0), kn.tail === null && kn.tailMode === "hidden" && !Kn.alternate && !I$2)
              return S$2(Qt), null;
          } else
            2 * B$4() - kn.renderingStartTime > Hj && Zt !== 1073741824 && (Qt.flags |= 128, $n = !0, Ej(kn, !1), Qt.lanes = 4194304);
        kn.isBackwards ? (Kn.sibling = Qt.child, Qt.child = Kn) : (Zt = kn.last, Zt !== null ? Zt.sibling = Kn : Qt.child = Kn, kn.last = Kn);
      }
      return kn.tail !== null ? (Qt = kn.tail, kn.rendering = Qt, kn.tail = Qt.sibling, kn.renderingStartTime = B$4(), Qt.sibling = null, Zt = M$3.current, G$2(M$3, $n ? Zt & 1 | 2 : Zt & 1), Qt) : (S$2(Qt), null);
    case 22:
    case 23:
      return Ij(), $n = Qt.memoizedState !== null, _e !== null && _e.memoizedState !== null !== $n && (Qt.flags |= 8192), $n && Qt.mode & 1 ? gj & 1073741824 && (S$2(Qt), Qt.subtreeFlags & 6 && (Qt.flags |= 8192)) : S$2(Qt), null;
    case 24:
      return null;
    case 25:
      return null;
  }
  throw Error(p$6(156, Qt.tag));
}
function Jj(_e, Qt) {
  switch (wg$1(Qt), Qt.tag) {
    case 1:
      return Zf$1(Qt.type) && $f$1(), _e = Qt.flags, _e & 65536 ? (Qt.flags = _e & -65537 | 128, Qt) : null;
    case 3:
      return Jh$1(), E$3(Wf$1), E$3(H$3), Oh$1(), _e = Qt.flags, _e & 65536 && !(_e & 128) ? (Qt.flags = _e & -65537 | 128, Qt) : null;
    case 5:
      return Lh$1(Qt), null;
    case 13:
      if (E$3(M$3), _e = Qt.memoizedState, _e !== null && _e.dehydrated !== null) {
        if (Qt.alternate === null)
          throw Error(p$6(340));
        Ig();
      }
      return _e = Qt.flags, _e & 65536 ? (Qt.flags = _e & -65537 | 128, Qt) : null;
    case 19:
      return E$3(M$3), null;
    case 4:
      return Jh$1(), null;
    case 10:
      return Rg(Qt.type._context), null;
    case 22:
    case 23:
      return Ij(), null;
    case 24:
      return null;
    default:
      return null;
  }
}
var Kj = !1, U$2 = !1, Lj = typeof WeakSet == "function" ? WeakSet : Set, V$2 = null;
function Mj(_e, Qt) {
  var Zt = _e.ref;
  if (Zt !== null)
    if (typeof Zt == "function")
      try {
        Zt(null);
      } catch ($n) {
        W$2(_e, Qt, $n);
      }
    else
      Zt.current = null;
}
function Nj(_e, Qt, Zt) {
  try {
    Zt();
  } catch ($n) {
    W$2(_e, Qt, $n);
  }
}
var Oj = !1;
function Pj(_e, Qt) {
  if (Cf$1 = dd$1, _e = Me$2(), Ne$2(_e)) {
    if ("selectionStart" in _e)
      var Zt = { start: _e.selectionStart, end: _e.selectionEnd };
    else
      e: {
        Zt = (Zt = _e.ownerDocument) && Zt.defaultView || window;
        var $n = Zt.getSelection && Zt.getSelection();
        if ($n && $n.rangeCount !== 0) {
          Zt = $n.anchorNode;
          var Sn = $n.anchorOffset, kn = $n.focusNode;
          $n = $n.focusOffset;
          try {
            Zt.nodeType, kn.nodeType;
          } catch {
            Zt = null;
            break e;
          }
          var Kn = 0, er = -1, Cr = -1, kr = 0, Yr = 0, Ms = _e, Ds = null;
          t:
            for (; ; ) {
              for (var Ls; Ms !== Zt || Sn !== 0 && Ms.nodeType !== 3 || (er = Kn + Sn), Ms !== kn || $n !== 0 && Ms.nodeType !== 3 || (Cr = Kn + $n), Ms.nodeType === 3 && (Kn += Ms.nodeValue.length), (Ls = Ms.firstChild) !== null; )
                Ds = Ms, Ms = Ls;
              for (; ; ) {
                if (Ms === _e)
                  break t;
                if (Ds === Zt && ++kr === Sn && (er = Kn), Ds === kn && ++Yr === $n && (Cr = Kn), (Ls = Ms.nextSibling) !== null)
                  break;
                Ms = Ds, Ds = Ms.parentNode;
              }
              Ms = Ls;
            }
          Zt = er === -1 || Cr === -1 ? null : { start: er, end: Cr };
        } else
          Zt = null;
      }
    Zt = Zt || { start: 0, end: 0 };
  } else
    Zt = null;
  for (Df$1 = { focusedElem: _e, selectionRange: Zt }, dd$1 = !1, V$2 = Qt; V$2 !== null; )
    if (Qt = V$2, _e = Qt.child, (Qt.subtreeFlags & 1028) !== 0 && _e !== null)
      _e.return = Qt, V$2 = _e;
    else
      for (; V$2 !== null; ) {
        Qt = V$2;
        try {
          var js = Qt.alternate;
          if (Qt.flags & 1024)
            switch (Qt.tag) {
              case 0:
              case 11:
              case 15:
                break;
              case 1:
                if (js !== null) {
                  var zs = js.memoizedProps, Fs = js.memoizedState, Bs = Qt.stateNode, Hs = Bs.getSnapshotBeforeUpdate(Qt.elementType === Qt.type ? zs : Lg$1(Qt.type, zs), Fs);
                  Bs.__reactInternalSnapshotBeforeUpdate = Hs;
                }
                break;
              case 3:
                var Ws = Qt.stateNode.containerInfo;
                Ws.nodeType === 1 ? Ws.textContent = "" : Ws.nodeType === 9 && Ws.documentElement && Ws.removeChild(Ws.documentElement);
                break;
              case 5:
              case 6:
              case 4:
              case 17:
                break;
              default:
                throw Error(p$6(163));
            }
        } catch (Ys) {
          W$2(Qt, Qt.return, Ys);
        }
        if (_e = Qt.sibling, _e !== null) {
          _e.return = Qt.return, V$2 = _e;
          break;
        }
        V$2 = Qt.return;
      }
  return js = Oj, Oj = !1, js;
}
function Qj(_e, Qt, Zt) {
  var $n = Qt.updateQueue;
  if ($n = $n !== null ? $n.lastEffect : null, $n !== null) {
    var Sn = $n = $n.next;
    do {
      if ((Sn.tag & _e) === _e) {
        var kn = Sn.destroy;
        Sn.destroy = void 0, kn !== void 0 && Nj(Qt, Zt, kn);
      }
      Sn = Sn.next;
    } while (Sn !== $n);
  }
}
function Rj(_e, Qt) {
  if (Qt = Qt.updateQueue, Qt = Qt !== null ? Qt.lastEffect : null, Qt !== null) {
    var Zt = Qt = Qt.next;
    do {
      if ((Zt.tag & _e) === _e) {
        var $n = Zt.create;
        Zt.destroy = $n();
      }
      Zt = Zt.next;
    } while (Zt !== Qt);
  }
}
function Sj(_e) {
  var Qt = _e.ref;
  if (Qt !== null) {
    var Zt = _e.stateNode;
    switch (_e.tag) {
      case 5:
        _e = Zt;
        break;
      default:
        _e = Zt;
    }
    typeof Qt == "function" ? Qt(_e) : Qt.current = _e;
  }
}
function Tj(_e) {
  var Qt = _e.alternate;
  Qt !== null && (_e.alternate = null, Tj(Qt)), _e.child = null, _e.deletions = null, _e.sibling = null, _e.tag === 5 && (Qt = _e.stateNode, Qt !== null && (delete Qt[Of$1], delete Qt[Pf$1], delete Qt[of$1], delete Qt[Qf$1], delete Qt[Rf$1])), _e.stateNode = null, _e.return = null, _e.dependencies = null, _e.memoizedProps = null, _e.memoizedState = null, _e.pendingProps = null, _e.stateNode = null, _e.updateQueue = null;
}
function Uj(_e) {
  return _e.tag === 5 || _e.tag === 3 || _e.tag === 4;
}
function Vj(_e) {
  e:
    for (; ; ) {
      for (; _e.sibling === null; ) {
        if (_e.return === null || Uj(_e.return))
          return null;
        _e = _e.return;
      }
      for (_e.sibling.return = _e.return, _e = _e.sibling; _e.tag !== 5 && _e.tag !== 6 && _e.tag !== 18; ) {
        if (_e.flags & 2 || _e.child === null || _e.tag === 4)
          continue e;
        _e.child.return = _e, _e = _e.child;
      }
      if (!(_e.flags & 2))
        return _e.stateNode;
    }
}
function Wj(_e, Qt, Zt) {
  var $n = _e.tag;
  if ($n === 5 || $n === 6)
    _e = _e.stateNode, Qt ? Zt.nodeType === 8 ? Zt.parentNode.insertBefore(_e, Qt) : Zt.insertBefore(_e, Qt) : (Zt.nodeType === 8 ? (Qt = Zt.parentNode, Qt.insertBefore(_e, Zt)) : (Qt = Zt, Qt.appendChild(_e)), Zt = Zt._reactRootContainer, Zt != null || Qt.onclick !== null || (Qt.onclick = Bf$1));
  else if ($n !== 4 && (_e = _e.child, _e !== null))
    for (Wj(_e, Qt, Zt), _e = _e.sibling; _e !== null; )
      Wj(_e, Qt, Zt), _e = _e.sibling;
}
function Xj(_e, Qt, Zt) {
  var $n = _e.tag;
  if ($n === 5 || $n === 6)
    _e = _e.stateNode, Qt ? Zt.insertBefore(_e, Qt) : Zt.appendChild(_e);
  else if ($n !== 4 && (_e = _e.child, _e !== null))
    for (Xj(_e, Qt, Zt), _e = _e.sibling; _e !== null; )
      Xj(_e, Qt, Zt), _e = _e.sibling;
}
var X$4 = null, Yj = !1;
function Zj(_e, Qt, Zt) {
  for (Zt = Zt.child; Zt !== null; )
    ak(_e, Qt, Zt), Zt = Zt.sibling;
}
function ak(_e, Qt, Zt) {
  if (lc$1 && typeof lc$1.onCommitFiberUnmount == "function")
    try {
      lc$1.onCommitFiberUnmount(kc$1, Zt);
    } catch {
    }
  switch (Zt.tag) {
    case 5:
      U$2 || Mj(Zt, Qt);
    case 6:
      var $n = X$4, Sn = Yj;
      X$4 = null, Zj(_e, Qt, Zt), X$4 = $n, Yj = Sn, X$4 !== null && (Yj ? (_e = X$4, Zt = Zt.stateNode, _e.nodeType === 8 ? _e.parentNode.removeChild(Zt) : _e.removeChild(Zt)) : X$4.removeChild(Zt.stateNode));
      break;
    case 18:
      X$4 !== null && (Yj ? (_e = X$4, Zt = Zt.stateNode, _e.nodeType === 8 ? Kf$1(_e.parentNode, Zt) : _e.nodeType === 1 && Kf$1(_e, Zt), bd$1(_e)) : Kf$1(X$4, Zt.stateNode));
      break;
    case 4:
      $n = X$4, Sn = Yj, X$4 = Zt.stateNode.containerInfo, Yj = !0, Zj(_e, Qt, Zt), X$4 = $n, Yj = Sn;
      break;
    case 0:
    case 11:
    case 14:
    case 15:
      if (!U$2 && ($n = Zt.updateQueue, $n !== null && ($n = $n.lastEffect, $n !== null))) {
        Sn = $n = $n.next;
        do {
          var kn = Sn, Kn = kn.destroy;
          kn = kn.tag, Kn !== void 0 && (kn & 2 || kn & 4) && Nj(Zt, Qt, Kn), Sn = Sn.next;
        } while (Sn !== $n);
      }
      Zj(_e, Qt, Zt);
      break;
    case 1:
      if (!U$2 && (Mj(Zt, Qt), $n = Zt.stateNode, typeof $n.componentWillUnmount == "function"))
        try {
          $n.props = Zt.memoizedProps, $n.state = Zt.memoizedState, $n.componentWillUnmount();
        } catch (er) {
          W$2(Zt, Qt, er);
        }
      Zj(_e, Qt, Zt);
      break;
    case 21:
      Zj(_e, Qt, Zt);
      break;
    case 22:
      Zt.mode & 1 ? (U$2 = ($n = U$2) || Zt.memoizedState !== null, Zj(_e, Qt, Zt), U$2 = $n) : Zj(_e, Qt, Zt);
      break;
    default:
      Zj(_e, Qt, Zt);
  }
}
function bk(_e) {
  var Qt = _e.updateQueue;
  if (Qt !== null) {
    _e.updateQueue = null;
    var Zt = _e.stateNode;
    Zt === null && (Zt = _e.stateNode = new Lj()), Qt.forEach(function($n) {
      var Sn = ck.bind(null, _e, $n);
      Zt.has($n) || (Zt.add($n), $n.then(Sn, Sn));
    });
  }
}
function dk(_e, Qt) {
  var Zt = Qt.deletions;
  if (Zt !== null)
    for (var $n = 0; $n < Zt.length; $n++) {
      var Sn = Zt[$n];
      try {
        var kn = _e, Kn = Qt, er = Kn;
        e:
          for (; er !== null; ) {
            switch (er.tag) {
              case 5:
                X$4 = er.stateNode, Yj = !1;
                break e;
              case 3:
                X$4 = er.stateNode.containerInfo, Yj = !0;
                break e;
              case 4:
                X$4 = er.stateNode.containerInfo, Yj = !0;
                break e;
            }
            er = er.return;
          }
        if (X$4 === null)
          throw Error(p$6(160));
        ak(kn, Kn, Sn), X$4 = null, Yj = !1;
        var Cr = Sn.alternate;
        Cr !== null && (Cr.return = null), Sn.return = null;
      } catch (kr) {
        W$2(Sn, Qt, kr);
      }
    }
  if (Qt.subtreeFlags & 12854)
    for (Qt = Qt.child; Qt !== null; )
      ek(Qt, _e), Qt = Qt.sibling;
}
function ek(_e, Qt) {
  var Zt = _e.alternate, $n = _e.flags;
  switch (_e.tag) {
    case 0:
    case 11:
    case 14:
    case 15:
      if (dk(Qt, _e), fk(_e), $n & 4) {
        try {
          Qj(3, _e, _e.return), Rj(3, _e);
        } catch (zs) {
          W$2(_e, _e.return, zs);
        }
        try {
          Qj(5, _e, _e.return);
        } catch (zs) {
          W$2(_e, _e.return, zs);
        }
      }
      break;
    case 1:
      dk(Qt, _e), fk(_e), $n & 512 && Zt !== null && Mj(Zt, Zt.return);
      break;
    case 5:
      if (dk(Qt, _e), fk(_e), $n & 512 && Zt !== null && Mj(Zt, Zt.return), _e.flags & 32) {
        var Sn = _e.stateNode;
        try {
          ob$1(Sn, "");
        } catch (zs) {
          W$2(_e, _e.return, zs);
        }
      }
      if ($n & 4 && (Sn = _e.stateNode, Sn != null)) {
        var kn = _e.memoizedProps, Kn = Zt !== null ? Zt.memoizedProps : kn, er = _e.type, Cr = _e.updateQueue;
        if (_e.updateQueue = null, Cr !== null)
          try {
            er === "input" && kn.type === "radio" && kn.name != null && ab$1(Sn, kn), vb$1(er, Kn);
            var kr = vb$1(er, kn);
            for (Kn = 0; Kn < Cr.length; Kn += 2) {
              var Yr = Cr[Kn], Ms = Cr[Kn + 1];
              Yr === "style" ? sb$1(Sn, Ms) : Yr === "dangerouslySetInnerHTML" ? nb$1(Sn, Ms) : Yr === "children" ? ob$1(Sn, Ms) : ta$1(Sn, Yr, Ms, kr);
            }
            switch (er) {
              case "input":
                bb$1(Sn, kn);
                break;
              case "textarea":
                ib$1(Sn, kn);
                break;
              case "select":
                var Ds = Sn._wrapperState.wasMultiple;
                Sn._wrapperState.wasMultiple = !!kn.multiple;
                var Ls = kn.value;
                Ls != null ? fb$1(Sn, !!kn.multiple, Ls, !1) : Ds !== !!kn.multiple && (kn.defaultValue != null ? fb$1(
                  Sn,
                  !!kn.multiple,
                  kn.defaultValue,
                  !0
                ) : fb$1(Sn, !!kn.multiple, kn.multiple ? [] : "", !1));
            }
            Sn[Pf$1] = kn;
          } catch (zs) {
            W$2(_e, _e.return, zs);
          }
      }
      break;
    case 6:
      if (dk(Qt, _e), fk(_e), $n & 4) {
        if (_e.stateNode === null)
          throw Error(p$6(162));
        Sn = _e.stateNode, kn = _e.memoizedProps;
        try {
          Sn.nodeValue = kn;
        } catch (zs) {
          W$2(_e, _e.return, zs);
        }
      }
      break;
    case 3:
      if (dk(Qt, _e), fk(_e), $n & 4 && Zt !== null && Zt.memoizedState.isDehydrated)
        try {
          bd$1(Qt.containerInfo);
        } catch (zs) {
          W$2(_e, _e.return, zs);
        }
      break;
    case 4:
      dk(Qt, _e), fk(_e);
      break;
    case 13:
      dk(Qt, _e), fk(_e), Sn = _e.child, Sn.flags & 8192 && (kn = Sn.memoizedState !== null, Sn.stateNode.isHidden = kn, !kn || Sn.alternate !== null && Sn.alternate.memoizedState !== null || (gk = B$4())), $n & 4 && bk(_e);
      break;
    case 22:
      if (Yr = Zt !== null && Zt.memoizedState !== null, _e.mode & 1 ? (U$2 = (kr = U$2) || Yr, dk(Qt, _e), U$2 = kr) : dk(Qt, _e), fk(_e), $n & 8192) {
        if (kr = _e.memoizedState !== null, (_e.stateNode.isHidden = kr) && !Yr && _e.mode & 1)
          for (V$2 = _e, Yr = _e.child; Yr !== null; ) {
            for (Ms = V$2 = Yr; V$2 !== null; ) {
              switch (Ds = V$2, Ls = Ds.child, Ds.tag) {
                case 0:
                case 11:
                case 14:
                case 15:
                  Qj(4, Ds, Ds.return);
                  break;
                case 1:
                  Mj(Ds, Ds.return);
                  var js = Ds.stateNode;
                  if (typeof js.componentWillUnmount == "function") {
                    $n = Ds, Zt = Ds.return;
                    try {
                      Qt = $n, js.props = Qt.memoizedProps, js.state = Qt.memoizedState, js.componentWillUnmount();
                    } catch (zs) {
                      W$2($n, Zt, zs);
                    }
                  }
                  break;
                case 5:
                  Mj(Ds, Ds.return);
                  break;
                case 22:
                  if (Ds.memoizedState !== null) {
                    hk(Ms);
                    continue;
                  }
              }
              Ls !== null ? (Ls.return = Ds, V$2 = Ls) : hk(Ms);
            }
            Yr = Yr.sibling;
          }
        e:
          for (Yr = null, Ms = _e; ; ) {
            if (Ms.tag === 5) {
              if (Yr === null) {
                Yr = Ms;
                try {
                  Sn = Ms.stateNode, kr ? (kn = Sn.style, typeof kn.setProperty == "function" ? kn.setProperty("display", "none", "important") : kn.display = "none") : (er = Ms.stateNode, Cr = Ms.memoizedProps.style, Kn = Cr != null && Cr.hasOwnProperty("display") ? Cr.display : null, er.style.display = rb$1("display", Kn));
                } catch (zs) {
                  W$2(_e, _e.return, zs);
                }
              }
            } else if (Ms.tag === 6) {
              if (Yr === null)
                try {
                  Ms.stateNode.nodeValue = kr ? "" : Ms.memoizedProps;
                } catch (zs) {
                  W$2(_e, _e.return, zs);
                }
            } else if ((Ms.tag !== 22 && Ms.tag !== 23 || Ms.memoizedState === null || Ms === _e) && Ms.child !== null) {
              Ms.child.return = Ms, Ms = Ms.child;
              continue;
            }
            if (Ms === _e)
              break e;
            for (; Ms.sibling === null; ) {
              if (Ms.return === null || Ms.return === _e)
                break e;
              Yr === Ms && (Yr = null), Ms = Ms.return;
            }
            Yr === Ms && (Yr = null), Ms.sibling.return = Ms.return, Ms = Ms.sibling;
          }
      }
      break;
    case 19:
      dk(Qt, _e), fk(_e), $n & 4 && bk(_e);
      break;
    case 21:
      break;
    default:
      dk(
        Qt,
        _e
      ), fk(_e);
  }
}
function fk(_e) {
  var Qt = _e.flags;
  if (Qt & 2) {
    try {
      e: {
        for (var Zt = _e.return; Zt !== null; ) {
          if (Uj(Zt)) {
            var $n = Zt;
            break e;
          }
          Zt = Zt.return;
        }
        throw Error(p$6(160));
      }
      switch ($n.tag) {
        case 5:
          var Sn = $n.stateNode;
          $n.flags & 32 && (ob$1(Sn, ""), $n.flags &= -33);
          var kn = Vj(_e);
          Xj(_e, kn, Sn);
          break;
        case 3:
        case 4:
          var Kn = $n.stateNode.containerInfo, er = Vj(_e);
          Wj(_e, er, Kn);
          break;
        default:
          throw Error(p$6(161));
      }
    } catch (Cr) {
      W$2(_e, _e.return, Cr);
    }
    _e.flags &= -3;
  }
  Qt & 4096 && (_e.flags &= -4097);
}
function ik(_e, Qt, Zt) {
  V$2 = _e, jk(_e);
}
function jk(_e, Qt, Zt) {
  for (var $n = (_e.mode & 1) !== 0; V$2 !== null; ) {
    var Sn = V$2, kn = Sn.child;
    if (Sn.tag === 22 && $n) {
      var Kn = Sn.memoizedState !== null || Kj;
      if (!Kn) {
        var er = Sn.alternate, Cr = er !== null && er.memoizedState !== null || U$2;
        er = Kj;
        var kr = U$2;
        if (Kj = Kn, (U$2 = Cr) && !kr)
          for (V$2 = Sn; V$2 !== null; )
            Kn = V$2, Cr = Kn.child, Kn.tag === 22 && Kn.memoizedState !== null ? kk(Sn) : Cr !== null ? (Cr.return = Kn, V$2 = Cr) : kk(Sn);
        for (; kn !== null; )
          V$2 = kn, jk(kn), kn = kn.sibling;
        V$2 = Sn, Kj = er, U$2 = kr;
      }
      lk(_e);
    } else
      Sn.subtreeFlags & 8772 && kn !== null ? (kn.return = Sn, V$2 = kn) : lk(_e);
  }
}
function lk(_e) {
  for (; V$2 !== null; ) {
    var Qt = V$2;
    if (Qt.flags & 8772) {
      var Zt = Qt.alternate;
      try {
        if (Qt.flags & 8772)
          switch (Qt.tag) {
            case 0:
            case 11:
            case 15:
              U$2 || Rj(5, Qt);
              break;
            case 1:
              var $n = Qt.stateNode;
              if (Qt.flags & 4 && !U$2)
                if (Zt === null)
                  $n.componentDidMount();
                else {
                  var Sn = Qt.elementType === Qt.type ? Zt.memoizedProps : Lg$1(Qt.type, Zt.memoizedProps);
                  $n.componentDidUpdate(Sn, Zt.memoizedState, $n.__reactInternalSnapshotBeforeUpdate);
                }
              var kn = Qt.updateQueue;
              kn !== null && ih$1(Qt, kn, $n);
              break;
            case 3:
              var Kn = Qt.updateQueue;
              if (Kn !== null) {
                if (Zt = null, Qt.child !== null)
                  switch (Qt.child.tag) {
                    case 5:
                      Zt = Qt.child.stateNode;
                      break;
                    case 1:
                      Zt = Qt.child.stateNode;
                  }
                ih$1(Qt, Kn, Zt);
              }
              break;
            case 5:
              var er = Qt.stateNode;
              if (Zt === null && Qt.flags & 4) {
                Zt = er;
                var Cr = Qt.memoizedProps;
                switch (Qt.type) {
                  case "button":
                  case "input":
                  case "select":
                  case "textarea":
                    Cr.autoFocus && Zt.focus();
                    break;
                  case "img":
                    Cr.src && (Zt.src = Cr.src);
                }
              }
              break;
            case 6:
              break;
            case 4:
              break;
            case 12:
              break;
            case 13:
              if (Qt.memoizedState === null) {
                var kr = Qt.alternate;
                if (kr !== null) {
                  var Yr = kr.memoizedState;
                  if (Yr !== null) {
                    var Ms = Yr.dehydrated;
                    Ms !== null && bd$1(Ms);
                  }
                }
              }
              break;
            case 19:
            case 17:
            case 21:
            case 22:
            case 23:
            case 25:
              break;
            default:
              throw Error(p$6(163));
          }
        U$2 || Qt.flags & 512 && Sj(Qt);
      } catch (Ds) {
        W$2(Qt, Qt.return, Ds);
      }
    }
    if (Qt === _e) {
      V$2 = null;
      break;
    }
    if (Zt = Qt.sibling, Zt !== null) {
      Zt.return = Qt.return, V$2 = Zt;
      break;
    }
    V$2 = Qt.return;
  }
}
function hk(_e) {
  for (; V$2 !== null; ) {
    var Qt = V$2;
    if (Qt === _e) {
      V$2 = null;
      break;
    }
    var Zt = Qt.sibling;
    if (Zt !== null) {
      Zt.return = Qt.return, V$2 = Zt;
      break;
    }
    V$2 = Qt.return;
  }
}
function kk(_e) {
  for (; V$2 !== null; ) {
    var Qt = V$2;
    try {
      switch (Qt.tag) {
        case 0:
        case 11:
        case 15:
          var Zt = Qt.return;
          try {
            Rj(4, Qt);
          } catch (Cr) {
            W$2(Qt, Zt, Cr);
          }
          break;
        case 1:
          var $n = Qt.stateNode;
          if (typeof $n.componentDidMount == "function") {
            var Sn = Qt.return;
            try {
              $n.componentDidMount();
            } catch (Cr) {
              W$2(Qt, Sn, Cr);
            }
          }
          var kn = Qt.return;
          try {
            Sj(Qt);
          } catch (Cr) {
            W$2(Qt, kn, Cr);
          }
          break;
        case 5:
          var Kn = Qt.return;
          try {
            Sj(Qt);
          } catch (Cr) {
            W$2(Qt, Kn, Cr);
          }
      }
    } catch (Cr) {
      W$2(Qt, Qt.return, Cr);
    }
    if (Qt === _e) {
      V$2 = null;
      break;
    }
    var er = Qt.sibling;
    if (er !== null) {
      er.return = Qt.return, V$2 = er;
      break;
    }
    V$2 = Qt.return;
  }
}
var mk = Math.ceil, nk = ua$1.ReactCurrentDispatcher, ok = ua$1.ReactCurrentOwner, pk = ua$1.ReactCurrentBatchConfig, K$2 = 0, R$1 = null, Y$3 = null, Z$2 = 0, gj = 0, fj = Uf$1(0), T$1 = 0, qk = null, hh$1 = 0, rk = 0, sk = 0, tk = null, uk = null, gk = 0, Hj = 1 / 0, vk = null, Pi$1 = !1, Qi$1 = null, Si$1 = null, wk = !1, xk = null, yk = 0, zk = 0, Ak = null, Bk = -1, Ck = 0;
function L$2() {
  return K$2 & 6 ? B$4() : Bk !== -1 ? Bk : Bk = B$4();
}
function lh$1(_e) {
  return _e.mode & 1 ? K$2 & 2 && Z$2 !== 0 ? Z$2 & -Z$2 : Kg$1.transition !== null ? (Ck === 0 && (Ck = yc$1()), Ck) : (_e = C$5, _e !== 0 || (_e = window.event, _e = _e === void 0 ? 16 : jd$1(_e.type)), _e) : 1;
}
function mh$1(_e, Qt, Zt, $n) {
  if (50 < zk)
    throw zk = 0, Ak = null, Error(p$6(185));
  Ac$1(_e, Zt, $n), (!(K$2 & 2) || _e !== R$1) && (_e === R$1 && (!(K$2 & 2) && (rk |= Zt), T$1 === 4 && Dk(_e, Z$2)), Ek(_e, $n), Zt === 1 && K$2 === 0 && !(Qt.mode & 1) && (Hj = B$4() + 500, fg$1 && jg()));
}
function Ek(_e, Qt) {
  var Zt = _e.callbackNode;
  wc$1(_e, Qt);
  var $n = uc$1(_e, _e === R$1 ? Z$2 : 0);
  if ($n === 0)
    Zt !== null && bc$1(Zt), _e.callbackNode = null, _e.callbackPriority = 0;
  else if (Qt = $n & -$n, _e.callbackPriority !== Qt) {
    if (Zt != null && bc$1(Zt), Qt === 1)
      _e.tag === 0 ? ig$1(Fk.bind(null, _e)) : hg(Fk.bind(null, _e)), Jf$1(function() {
        !(K$2 & 6) && jg();
      }), Zt = null;
    else {
      switch (Dc$1($n)) {
        case 1:
          Zt = fc$1;
          break;
        case 4:
          Zt = gc$1;
          break;
        case 16:
          Zt = hc$1;
          break;
        case 536870912:
          Zt = jc$1;
          break;
        default:
          Zt = hc$1;
      }
      Zt = Gk(Zt, Hk.bind(null, _e));
    }
    _e.callbackPriority = Qt, _e.callbackNode = Zt;
  }
}
function Hk(_e, Qt) {
  if (Bk = -1, Ck = 0, K$2 & 6)
    throw Error(p$6(327));
  var Zt = _e.callbackNode;
  if (Ik() && _e.callbackNode !== Zt)
    return null;
  var $n = uc$1(_e, _e === R$1 ? Z$2 : 0);
  if ($n === 0)
    return null;
  if ($n & 30 || $n & _e.expiredLanes || Qt)
    Qt = Jk(_e, $n);
  else {
    Qt = $n;
    var Sn = K$2;
    K$2 |= 2;
    var kn = Kk();
    (R$1 !== _e || Z$2 !== Qt) && (vk = null, Hj = B$4() + 500, Lk(_e, Qt));
    do
      try {
        Mk();
        break;
      } catch (er) {
        Nk(_e, er);
      }
    while (1);
    Qg$1(), nk.current = kn, K$2 = Sn, Y$3 !== null ? Qt = 0 : (R$1 = null, Z$2 = 0, Qt = T$1);
  }
  if (Qt !== 0) {
    if (Qt === 2 && (Sn = xc$1(_e), Sn !== 0 && ($n = Sn, Qt = Ok(_e, Sn))), Qt === 1)
      throw Zt = qk, Lk(_e, 0), Dk(_e, $n), Ek(_e, B$4()), Zt;
    if (Qt === 6)
      Dk(_e, $n);
    else {
      if (Sn = _e.current.alternate, !($n & 30) && !Pk(Sn) && (Qt = Jk(_e, $n), Qt === 2 && (kn = xc$1(_e), kn !== 0 && ($n = kn, Qt = Ok(_e, kn))), Qt === 1))
        throw Zt = qk, Lk(_e, 0), Dk(_e, $n), Ek(_e, B$4()), Zt;
      switch (_e.finishedWork = Sn, _e.finishedLanes = $n, Qt) {
        case 0:
        case 1:
          throw Error(p$6(345));
        case 2:
          Qk(_e, uk, vk);
          break;
        case 3:
          if (Dk(_e, $n), ($n & 130023424) === $n && (Qt = gk + 500 - B$4(), 10 < Qt)) {
            if (uc$1(_e, 0) !== 0)
              break;
            if (Sn = _e.suspendedLanes, (Sn & $n) !== $n) {
              L$2(), _e.pingedLanes |= _e.suspendedLanes & Sn;
              break;
            }
            _e.timeoutHandle = Ff(Qk.bind(null, _e, uk, vk), Qt);
            break;
          }
          Qk(_e, uk, vk);
          break;
        case 4:
          if (Dk(_e, $n), ($n & 4194240) === $n)
            break;
          for (Qt = _e.eventTimes, Sn = -1; 0 < $n; ) {
            var Kn = 31 - oc$1($n);
            kn = 1 << Kn, Kn = Qt[Kn], Kn > Sn && (Sn = Kn), $n &= ~kn;
          }
          if ($n = Sn, $n = B$4() - $n, $n = (120 > $n ? 120 : 480 > $n ? 480 : 1080 > $n ? 1080 : 1920 > $n ? 1920 : 3e3 > $n ? 3e3 : 4320 > $n ? 4320 : 1960 * mk($n / 1960)) - $n, 10 < $n) {
            _e.timeoutHandle = Ff(Qk.bind(null, _e, uk, vk), $n);
            break;
          }
          Qk(_e, uk, vk);
          break;
        case 5:
          Qk(_e, uk, vk);
          break;
        default:
          throw Error(p$6(329));
      }
    }
  }
  return Ek(_e, B$4()), _e.callbackNode === Zt ? Hk.bind(null, _e) : null;
}
function Ok(_e, Qt) {
  var Zt = tk;
  return _e.current.memoizedState.isDehydrated && (Lk(_e, Qt).flags |= 256), _e = Jk(_e, Qt), _e !== 2 && (Qt = uk, uk = Zt, Qt !== null && Gj(Qt)), _e;
}
function Gj(_e) {
  uk === null ? uk = _e : uk.push.apply(uk, _e);
}
function Pk(_e) {
  for (var Qt = _e; ; ) {
    if (Qt.flags & 16384) {
      var Zt = Qt.updateQueue;
      if (Zt !== null && (Zt = Zt.stores, Zt !== null))
        for (var $n = 0; $n < Zt.length; $n++) {
          var Sn = Zt[$n], kn = Sn.getSnapshot;
          Sn = Sn.value;
          try {
            if (!He$1(kn(), Sn))
              return !1;
          } catch {
            return !1;
          }
        }
    }
    if (Zt = Qt.child, Qt.subtreeFlags & 16384 && Zt !== null)
      Zt.return = Qt, Qt = Zt;
    else {
      if (Qt === _e)
        break;
      for (; Qt.sibling === null; ) {
        if (Qt.return === null || Qt.return === _e)
          return !0;
        Qt = Qt.return;
      }
      Qt.sibling.return = Qt.return, Qt = Qt.sibling;
    }
  }
  return !0;
}
function Dk(_e, Qt) {
  for (Qt &= ~sk, Qt &= ~rk, _e.suspendedLanes |= Qt, _e.pingedLanes &= ~Qt, _e = _e.expirationTimes; 0 < Qt; ) {
    var Zt = 31 - oc$1(Qt), $n = 1 << Zt;
    _e[Zt] = -1, Qt &= ~$n;
  }
}
function Fk(_e) {
  if (K$2 & 6)
    throw Error(p$6(327));
  Ik();
  var Qt = uc$1(_e, 0);
  if (!(Qt & 1))
    return Ek(_e, B$4()), null;
  var Zt = Jk(_e, Qt);
  if (_e.tag !== 0 && Zt === 2) {
    var $n = xc$1(_e);
    $n !== 0 && (Qt = $n, Zt = Ok(_e, $n));
  }
  if (Zt === 1)
    throw Zt = qk, Lk(_e, 0), Dk(_e, Qt), Ek(_e, B$4()), Zt;
  if (Zt === 6)
    throw Error(p$6(345));
  return _e.finishedWork = _e.current.alternate, _e.finishedLanes = Qt, Qk(_e, uk, vk), Ek(_e, B$4()), null;
}
function Rk(_e, Qt) {
  var Zt = K$2;
  K$2 |= 1;
  try {
    return _e(Qt);
  } finally {
    K$2 = Zt, K$2 === 0 && (Hj = B$4() + 500, fg$1 && jg());
  }
}
function Sk(_e) {
  xk !== null && xk.tag === 0 && !(K$2 & 6) && Ik();
  var Qt = K$2;
  K$2 |= 1;
  var Zt = pk.transition, $n = C$5;
  try {
    if (pk.transition = null, C$5 = 1, _e)
      return _e();
  } finally {
    C$5 = $n, pk.transition = Zt, K$2 = Qt, !(K$2 & 6) && jg();
  }
}
function Ij() {
  gj = fj.current, E$3(fj);
}
function Lk(_e, Qt) {
  _e.finishedWork = null, _e.finishedLanes = 0;
  var Zt = _e.timeoutHandle;
  if (Zt !== -1 && (_e.timeoutHandle = -1, Gf$1(Zt)), Y$3 !== null)
    for (Zt = Y$3.return; Zt !== null; ) {
      var $n = Zt;
      switch (wg$1($n), $n.tag) {
        case 1:
          $n = $n.type.childContextTypes, $n != null && $f$1();
          break;
        case 3:
          Jh$1(), E$3(Wf$1), E$3(H$3), Oh$1();
          break;
        case 5:
          Lh$1($n);
          break;
        case 4:
          Jh$1();
          break;
        case 13:
          E$3(M$3);
          break;
        case 19:
          E$3(M$3);
          break;
        case 10:
          Rg($n.type._context);
          break;
        case 22:
        case 23:
          Ij();
      }
      Zt = Zt.return;
    }
  if (R$1 = _e, Y$3 = _e = wh$1(_e.current, null), Z$2 = gj = Qt, T$1 = 0, qk = null, sk = rk = hh$1 = 0, uk = tk = null, Wg$1 !== null) {
    for (Qt = 0; Qt < Wg$1.length; Qt++)
      if (Zt = Wg$1[Qt], $n = Zt.interleaved, $n !== null) {
        Zt.interleaved = null;
        var Sn = $n.next, kn = Zt.pending;
        if (kn !== null) {
          var Kn = kn.next;
          kn.next = Sn, $n.next = Kn;
        }
        Zt.pending = $n;
      }
    Wg$1 = null;
  }
  return _e;
}
function Nk(_e, Qt) {
  do {
    var Zt = Y$3;
    try {
      if (Qg$1(), Ph$1.current = ai$1, Sh$1) {
        for (var $n = N$2.memoizedState; $n !== null; ) {
          var Sn = $n.queue;
          Sn !== null && (Sn.pending = null), $n = $n.next;
        }
        Sh$1 = !1;
      }
      if (Rh$1 = 0, P$2 = O$1 = N$2 = null, Th$1 = !1, Uh$1 = 0, ok.current = null, Zt === null || Zt.return === null) {
        T$1 = 1, qk = Qt, Y$3 = null;
        break;
      }
      e: {
        var kn = _e, Kn = Zt.return, er = Zt, Cr = Qt;
        if (Qt = Z$2, er.flags |= 32768, Cr !== null && typeof Cr == "object" && typeof Cr.then == "function") {
          var kr = Cr, Yr = er, Ms = Yr.tag;
          if (!(Yr.mode & 1) && (Ms === 0 || Ms === 11 || Ms === 15)) {
            var Ds = Yr.alternate;
            Ds ? (Yr.updateQueue = Ds.updateQueue, Yr.memoizedState = Ds.memoizedState, Yr.lanes = Ds.lanes) : (Yr.updateQueue = null, Yr.memoizedState = null);
          }
          var Ls = Vi$1(Kn);
          if (Ls !== null) {
            Ls.flags &= -257, Wi$1(Ls, Kn, er, kn, Qt), Ls.mode & 1 && Ti$1(kn, kr, Qt), Qt = Ls, Cr = kr;
            var js = Qt.updateQueue;
            if (js === null) {
              var zs = /* @__PURE__ */ new Set();
              zs.add(Cr), Qt.updateQueue = zs;
            } else
              js.add(Cr);
            break e;
          } else {
            if (!(Qt & 1)) {
              Ti$1(kn, kr, Qt), uj();
              break e;
            }
            Cr = Error(p$6(426));
          }
        } else if (I$2 && er.mode & 1) {
          var Fs = Vi$1(Kn);
          if (Fs !== null) {
            !(Fs.flags & 65536) && (Fs.flags |= 256), Wi$1(Fs, Kn, er, kn, Qt), Jg$1(Ki$1(Cr, er));
            break e;
          }
        }
        kn = Cr = Ki$1(Cr, er), T$1 !== 4 && (T$1 = 2), tk === null ? tk = [kn] : tk.push(kn), kn = Kn;
        do {
          switch (kn.tag) {
            case 3:
              kn.flags |= 65536, Qt &= -Qt, kn.lanes |= Qt;
              var Bs = Oi$1(kn, Cr, Qt);
              fh$1(kn, Bs);
              break e;
            case 1:
              er = Cr;
              var Hs = kn.type, Ws = kn.stateNode;
              if (!(kn.flags & 128) && (typeof Hs.getDerivedStateFromError == "function" || Ws !== null && typeof Ws.componentDidCatch == "function" && (Si$1 === null || !Si$1.has(Ws)))) {
                kn.flags |= 65536, Qt &= -Qt, kn.lanes |= Qt;
                var Ys = Ri$1(kn, er, Qt);
                fh$1(kn, Ys);
                break e;
              }
          }
          kn = kn.return;
        } while (kn !== null);
      }
      Tk(Zt);
    } catch (El) {
      Qt = El, Y$3 === Zt && Zt !== null && (Y$3 = Zt = Zt.return);
      continue;
    }
    break;
  } while (1);
}
function Kk() {
  var _e = nk.current;
  return nk.current = ai$1, _e === null ? ai$1 : _e;
}
function uj() {
  (T$1 === 0 || T$1 === 3 || T$1 === 2) && (T$1 = 4), R$1 === null || !(hh$1 & 268435455) && !(rk & 268435455) || Dk(R$1, Z$2);
}
function Jk(_e, Qt) {
  var Zt = K$2;
  K$2 |= 2;
  var $n = Kk();
  (R$1 !== _e || Z$2 !== Qt) && (vk = null, Lk(_e, Qt));
  do
    try {
      Uk();
      break;
    } catch (Sn) {
      Nk(_e, Sn);
    }
  while (1);
  if (Qg$1(), K$2 = Zt, nk.current = $n, Y$3 !== null)
    throw Error(p$6(261));
  return R$1 = null, Z$2 = 0, T$1;
}
function Uk() {
  for (; Y$3 !== null; )
    Vk(Y$3);
}
function Mk() {
  for (; Y$3 !== null && !cc$1(); )
    Vk(Y$3);
}
function Vk(_e) {
  var Qt = Wk(_e.alternate, _e, gj);
  _e.memoizedProps = _e.pendingProps, Qt === null ? Tk(_e) : Y$3 = Qt, ok.current = null;
}
function Tk(_e) {
  var Qt = _e;
  do {
    var Zt = Qt.alternate;
    if (_e = Qt.return, Qt.flags & 32768) {
      if (Zt = Jj(Zt, Qt), Zt !== null) {
        Zt.flags &= 32767, Y$3 = Zt;
        return;
      }
      if (_e !== null)
        _e.flags |= 32768, _e.subtreeFlags = 0, _e.deletions = null;
      else {
        T$1 = 6, Y$3 = null;
        return;
      }
    } else if (Zt = Fj(Zt, Qt, gj), Zt !== null) {
      Y$3 = Zt;
      return;
    }
    if (Qt = Qt.sibling, Qt !== null) {
      Y$3 = Qt;
      return;
    }
    Y$3 = Qt = _e;
  } while (Qt !== null);
  T$1 === 0 && (T$1 = 5);
}
function Qk(_e, Qt, Zt) {
  var $n = C$5, Sn = pk.transition;
  try {
    pk.transition = null, C$5 = 1, Xk(_e, Qt, Zt, $n);
  } finally {
    pk.transition = Sn, C$5 = $n;
  }
  return null;
}
function Xk(_e, Qt, Zt, $n) {
  do
    Ik();
  while (xk !== null);
  if (K$2 & 6)
    throw Error(p$6(327));
  Zt = _e.finishedWork;
  var Sn = _e.finishedLanes;
  if (Zt === null)
    return null;
  if (_e.finishedWork = null, _e.finishedLanes = 0, Zt === _e.current)
    throw Error(p$6(177));
  _e.callbackNode = null, _e.callbackPriority = 0;
  var kn = Zt.lanes | Zt.childLanes;
  if (Bc$1(_e, kn), _e === R$1 && (Y$3 = R$1 = null, Z$2 = 0), !(Zt.subtreeFlags & 2064) && !(Zt.flags & 2064) || wk || (wk = !0, Gk(hc$1, function() {
    return Ik(), null;
  })), kn = (Zt.flags & 15990) !== 0, Zt.subtreeFlags & 15990 || kn) {
    kn = pk.transition, pk.transition = null;
    var Kn = C$5;
    C$5 = 1;
    var er = K$2;
    K$2 |= 4, ok.current = null, Pj(_e, Zt), ek(Zt, _e), Oe$1(Df$1), dd$1 = !!Cf$1, Df$1 = Cf$1 = null, _e.current = Zt, ik(Zt), dc$1(), K$2 = er, C$5 = Kn, pk.transition = kn;
  } else
    _e.current = Zt;
  if (wk && (wk = !1, xk = _e, yk = Sn), kn = _e.pendingLanes, kn === 0 && (Si$1 = null), mc$2(Zt.stateNode), Ek(_e, B$4()), Qt !== null)
    for ($n = _e.onRecoverableError, Zt = 0; Zt < Qt.length; Zt++)
      Sn = Qt[Zt], $n(Sn.value, { componentStack: Sn.stack, digest: Sn.digest });
  if (Pi$1)
    throw Pi$1 = !1, _e = Qi$1, Qi$1 = null, _e;
  return yk & 1 && _e.tag !== 0 && Ik(), kn = _e.pendingLanes, kn & 1 ? _e === Ak ? zk++ : (zk = 0, Ak = _e) : zk = 0, jg(), null;
}
function Ik() {
  if (xk !== null) {
    var _e = Dc$1(yk), Qt = pk.transition, Zt = C$5;
    try {
      if (pk.transition = null, C$5 = 16 > _e ? 16 : _e, xk === null)
        var $n = !1;
      else {
        if (_e = xk, xk = null, yk = 0, K$2 & 6)
          throw Error(p$6(331));
        var Sn = K$2;
        for (K$2 |= 4, V$2 = _e.current; V$2 !== null; ) {
          var kn = V$2, Kn = kn.child;
          if (V$2.flags & 16) {
            var er = kn.deletions;
            if (er !== null) {
              for (var Cr = 0; Cr < er.length; Cr++) {
                var kr = er[Cr];
                for (V$2 = kr; V$2 !== null; ) {
                  var Yr = V$2;
                  switch (Yr.tag) {
                    case 0:
                    case 11:
                    case 15:
                      Qj(8, Yr, kn);
                  }
                  var Ms = Yr.child;
                  if (Ms !== null)
                    Ms.return = Yr, V$2 = Ms;
                  else
                    for (; V$2 !== null; ) {
                      Yr = V$2;
                      var Ds = Yr.sibling, Ls = Yr.return;
                      if (Tj(Yr), Yr === kr) {
                        V$2 = null;
                        break;
                      }
                      if (Ds !== null) {
                        Ds.return = Ls, V$2 = Ds;
                        break;
                      }
                      V$2 = Ls;
                    }
                }
              }
              var js = kn.alternate;
              if (js !== null) {
                var zs = js.child;
                if (zs !== null) {
                  js.child = null;
                  do {
                    var Fs = zs.sibling;
                    zs.sibling = null, zs = Fs;
                  } while (zs !== null);
                }
              }
              V$2 = kn;
            }
          }
          if (kn.subtreeFlags & 2064 && Kn !== null)
            Kn.return = kn, V$2 = Kn;
          else
            e:
              for (; V$2 !== null; ) {
                if (kn = V$2, kn.flags & 2048)
                  switch (kn.tag) {
                    case 0:
                    case 11:
                    case 15:
                      Qj(9, kn, kn.return);
                  }
                var Bs = kn.sibling;
                if (Bs !== null) {
                  Bs.return = kn.return, V$2 = Bs;
                  break e;
                }
                V$2 = kn.return;
              }
        }
        var Hs = _e.current;
        for (V$2 = Hs; V$2 !== null; ) {
          Kn = V$2;
          var Ws = Kn.child;
          if (Kn.subtreeFlags & 2064 && Ws !== null)
            Ws.return = Kn, V$2 = Ws;
          else
            e:
              for (Kn = Hs; V$2 !== null; ) {
                if (er = V$2, er.flags & 2048)
                  try {
                    switch (er.tag) {
                      case 0:
                      case 11:
                      case 15:
                        Rj(9, er);
                    }
                  } catch (El) {
                    W$2(er, er.return, El);
                  }
                if (er === Kn) {
                  V$2 = null;
                  break e;
                }
                var Ys = er.sibling;
                if (Ys !== null) {
                  Ys.return = er.return, V$2 = Ys;
                  break e;
                }
                V$2 = er.return;
              }
        }
        if (K$2 = Sn, jg(), lc$1 && typeof lc$1.onPostCommitFiberRoot == "function")
          try {
            lc$1.onPostCommitFiberRoot(kc$1, _e);
          } catch {
          }
        $n = !0;
      }
      return $n;
    } finally {
      C$5 = Zt, pk.transition = Qt;
    }
  }
  return !1;
}
function Yk(_e, Qt, Zt) {
  Qt = Ki$1(Zt, Qt), Qt = Oi$1(_e, Qt, 1), _e = dh$1(_e, Qt, 1), Qt = L$2(), _e !== null && (Ac$1(_e, 1, Qt), Ek(_e, Qt));
}
function W$2(_e, Qt, Zt) {
  if (_e.tag === 3)
    Yk(_e, _e, Zt);
  else
    for (; Qt !== null; ) {
      if (Qt.tag === 3) {
        Yk(Qt, _e, Zt);
        break;
      } else if (Qt.tag === 1) {
        var $n = Qt.stateNode;
        if (typeof Qt.type.getDerivedStateFromError == "function" || typeof $n.componentDidCatch == "function" && (Si$1 === null || !Si$1.has($n))) {
          _e = Ki$1(Zt, _e), _e = Ri$1(Qt, _e, 1), Qt = dh$1(Qt, _e, 1), _e = L$2(), Qt !== null && (Ac$1(Qt, 1, _e), Ek(Qt, _e));
          break;
        }
      }
      Qt = Qt.return;
    }
}
function Ui(_e, Qt, Zt) {
  var $n = _e.pingCache;
  $n !== null && $n.delete(Qt), Qt = L$2(), _e.pingedLanes |= _e.suspendedLanes & Zt, R$1 === _e && (Z$2 & Zt) === Zt && (T$1 === 4 || T$1 === 3 && (Z$2 & 130023424) === Z$2 && 500 > B$4() - gk ? Lk(_e, 0) : sk |= Zt), Ek(_e, Qt);
}
function Zk(_e, Qt) {
  Qt === 0 && (_e.mode & 1 ? (Qt = sc$1, sc$1 <<= 1, !(sc$1 & 130023424) && (sc$1 = 4194304)) : Qt = 1);
  var Zt = L$2();
  _e = Zg$1(_e, Qt), _e !== null && (Ac$1(_e, Qt, Zt), Ek(_e, Zt));
}
function vj(_e) {
  var Qt = _e.memoizedState, Zt = 0;
  Qt !== null && (Zt = Qt.retryLane), Zk(_e, Zt);
}
function ck(_e, Qt) {
  var Zt = 0;
  switch (_e.tag) {
    case 13:
      var $n = _e.stateNode, Sn = _e.memoizedState;
      Sn !== null && (Zt = Sn.retryLane);
      break;
    case 19:
      $n = _e.stateNode;
      break;
    default:
      throw Error(p$6(314));
  }
  $n !== null && $n.delete(Qt), Zk(_e, Zt);
}
var Wk;
Wk = function(_e, Qt, Zt) {
  if (_e !== null)
    if (_e.memoizedProps !== Qt.pendingProps || Wf$1.current)
      Ug$1 = !0;
    else {
      if (!(_e.lanes & Zt) && !(Qt.flags & 128))
        return Ug$1 = !1, zj(_e, Qt, Zt);
      Ug$1 = !!(_e.flags & 131072);
    }
  else
    Ug$1 = !1, I$2 && Qt.flags & 1048576 && ug$1(Qt, ng$1, Qt.index);
  switch (Qt.lanes = 0, Qt.tag) {
    case 2:
      var $n = Qt.type;
      jj(_e, Qt), _e = Qt.pendingProps;
      var Sn = Yf$1(Qt, H$3.current);
      Tg(Qt, Zt), Sn = Xh$1(null, Qt, $n, _e, Sn, Zt);
      var kn = bi$1();
      return Qt.flags |= 1, typeof Sn == "object" && Sn !== null && typeof Sn.render == "function" && Sn.$$typeof === void 0 ? (Qt.tag = 1, Qt.memoizedState = null, Qt.updateQueue = null, Zf$1($n) ? (kn = !0, cg$1(Qt)) : kn = !1, Qt.memoizedState = Sn.state !== null && Sn.state !== void 0 ? Sn.state : null, ah$1(Qt), Sn.updater = nh$1, Qt.stateNode = Sn, Sn._reactInternals = Qt, rh$1(Qt, $n, _e, Zt), Qt = kj(null, Qt, $n, !0, kn, Zt)) : (Qt.tag = 0, I$2 && kn && vg(Qt), Yi(null, Qt, Sn, Zt), Qt = Qt.child), Qt;
    case 16:
      $n = Qt.elementType;
      e: {
        switch (jj(_e, Qt), _e = Qt.pendingProps, Sn = $n._init, $n = Sn($n._payload), Qt.type = $n, Sn = Qt.tag = $k($n), _e = Lg$1($n, _e), Sn) {
          case 0:
            Qt = dj(null, Qt, $n, _e, Zt);
            break e;
          case 1:
            Qt = ij(null, Qt, $n, _e, Zt);
            break e;
          case 11:
            Qt = Zi$1(null, Qt, $n, _e, Zt);
            break e;
          case 14:
            Qt = aj(null, Qt, $n, Lg$1($n.type, _e), Zt);
            break e;
        }
        throw Error(p$6(
          306,
          $n,
          ""
        ));
      }
      return Qt;
    case 0:
      return $n = Qt.type, Sn = Qt.pendingProps, Sn = Qt.elementType === $n ? Sn : Lg$1($n, Sn), dj(_e, Qt, $n, Sn, Zt);
    case 1:
      return $n = Qt.type, Sn = Qt.pendingProps, Sn = Qt.elementType === $n ? Sn : Lg$1($n, Sn), ij(_e, Qt, $n, Sn, Zt);
    case 3:
      e: {
        if (lj(Qt), _e === null)
          throw Error(p$6(387));
        $n = Qt.pendingProps, kn = Qt.memoizedState, Sn = kn.element, bh$1(_e, Qt), gh$1(Qt, $n, null, Zt);
        var Kn = Qt.memoizedState;
        if ($n = Kn.element, kn.isDehydrated)
          if (kn = { element: $n, isDehydrated: !1, cache: Kn.cache, pendingSuspenseBoundaries: Kn.pendingSuspenseBoundaries, transitions: Kn.transitions }, Qt.updateQueue.baseState = kn, Qt.memoizedState = kn, Qt.flags & 256) {
            Sn = Ki$1(Error(p$6(423)), Qt), Qt = mj(_e, Qt, $n, Zt, Sn);
            break e;
          } else if ($n !== Sn) {
            Sn = Ki$1(Error(p$6(424)), Qt), Qt = mj(_e, Qt, $n, Zt, Sn);
            break e;
          } else
            for (yg = Lf$1(Qt.stateNode.containerInfo.firstChild), xg$1 = Qt, I$2 = !0, zg$1 = null, Zt = Ch$1(Qt, null, $n, Zt), Qt.child = Zt; Zt; )
              Zt.flags = Zt.flags & -3 | 4096, Zt = Zt.sibling;
        else {
          if (Ig(), $n === Sn) {
            Qt = $i$1(_e, Qt, Zt);
            break e;
          }
          Yi(_e, Qt, $n, Zt);
        }
        Qt = Qt.child;
      }
      return Qt;
    case 5:
      return Kh$1(Qt), _e === null && Eg$1(Qt), $n = Qt.type, Sn = Qt.pendingProps, kn = _e !== null ? _e.memoizedProps : null, Kn = Sn.children, Ef$1($n, Sn) ? Kn = null : kn !== null && Ef$1($n, kn) && (Qt.flags |= 32), hj(_e, Qt), Yi(_e, Qt, Kn, Zt), Qt.child;
    case 6:
      return _e === null && Eg$1(Qt), null;
    case 13:
      return pj(_e, Qt, Zt);
    case 4:
      return Ih$1(Qt, Qt.stateNode.containerInfo), $n = Qt.pendingProps, _e === null ? Qt.child = Bh$1(Qt, null, $n, Zt) : Yi(_e, Qt, $n, Zt), Qt.child;
    case 11:
      return $n = Qt.type, Sn = Qt.pendingProps, Sn = Qt.elementType === $n ? Sn : Lg$1($n, Sn), Zi$1(_e, Qt, $n, Sn, Zt);
    case 7:
      return Yi(_e, Qt, Qt.pendingProps, Zt), Qt.child;
    case 8:
      return Yi(_e, Qt, Qt.pendingProps.children, Zt), Qt.child;
    case 12:
      return Yi(_e, Qt, Qt.pendingProps.children, Zt), Qt.child;
    case 10:
      e: {
        if ($n = Qt.type._context, Sn = Qt.pendingProps, kn = Qt.memoizedProps, Kn = Sn.value, G$2(Mg$1, $n._currentValue), $n._currentValue = Kn, kn !== null)
          if (He$1(kn.value, Kn)) {
            if (kn.children === Sn.children && !Wf$1.current) {
              Qt = $i$1(_e, Qt, Zt);
              break e;
            }
          } else
            for (kn = Qt.child, kn !== null && (kn.return = Qt); kn !== null; ) {
              var er = kn.dependencies;
              if (er !== null) {
                Kn = kn.child;
                for (var Cr = er.firstContext; Cr !== null; ) {
                  if (Cr.context === $n) {
                    if (kn.tag === 1) {
                      Cr = ch$2(-1, Zt & -Zt), Cr.tag = 2;
                      var kr = kn.updateQueue;
                      if (kr !== null) {
                        kr = kr.shared;
                        var Yr = kr.pending;
                        Yr === null ? Cr.next = Cr : (Cr.next = Yr.next, Yr.next = Cr), kr.pending = Cr;
                      }
                    }
                    kn.lanes |= Zt, Cr = kn.alternate, Cr !== null && (Cr.lanes |= Zt), Sg$1(
                      kn.return,
                      Zt,
                      Qt
                    ), er.lanes |= Zt;
                    break;
                  }
                  Cr = Cr.next;
                }
              } else if (kn.tag === 10)
                Kn = kn.type === Qt.type ? null : kn.child;
              else if (kn.tag === 18) {
                if (Kn = kn.return, Kn === null)
                  throw Error(p$6(341));
                Kn.lanes |= Zt, er = Kn.alternate, er !== null && (er.lanes |= Zt), Sg$1(Kn, Zt, Qt), Kn = kn.sibling;
              } else
                Kn = kn.child;
              if (Kn !== null)
                Kn.return = kn;
              else
                for (Kn = kn; Kn !== null; ) {
                  if (Kn === Qt) {
                    Kn = null;
                    break;
                  }
                  if (kn = Kn.sibling, kn !== null) {
                    kn.return = Kn.return, Kn = kn;
                    break;
                  }
                  Kn = Kn.return;
                }
              kn = Kn;
            }
        Yi(_e, Qt, Sn.children, Zt), Qt = Qt.child;
      }
      return Qt;
    case 9:
      return Sn = Qt.type, $n = Qt.pendingProps.children, Tg(Qt, Zt), Sn = Vg$1(Sn), $n = $n(Sn), Qt.flags |= 1, Yi(_e, Qt, $n, Zt), Qt.child;
    case 14:
      return $n = Qt.type, Sn = Lg$1($n, Qt.pendingProps), Sn = Lg$1($n.type, Sn), aj(_e, Qt, $n, Sn, Zt);
    case 15:
      return cj(_e, Qt, Qt.type, Qt.pendingProps, Zt);
    case 17:
      return $n = Qt.type, Sn = Qt.pendingProps, Sn = Qt.elementType === $n ? Sn : Lg$1($n, Sn), jj(_e, Qt), Qt.tag = 1, Zf$1($n) ? (_e = !0, cg$1(Qt)) : _e = !1, Tg(Qt, Zt), ph$1(Qt, $n, Sn), rh$1(Qt, $n, Sn, Zt), kj(null, Qt, $n, !0, _e, Zt);
    case 19:
      return yj(_e, Qt, Zt);
    case 22:
      return ej(_e, Qt, Zt);
  }
  throw Error(p$6(156, Qt.tag));
};
function Gk(_e, Qt) {
  return ac$1(_e, Qt);
}
function al$1(_e, Qt, Zt, $n) {
  this.tag = _e, this.key = Zt, this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null, this.index = 0, this.ref = null, this.pendingProps = Qt, this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null, this.mode = $n, this.subtreeFlags = this.flags = 0, this.deletions = null, this.childLanes = this.lanes = 0, this.alternate = null;
}
function Bg$1(_e, Qt, Zt, $n) {
  return new al$1(_e, Qt, Zt, $n);
}
function bj(_e) {
  return _e = _e.prototype, !(!_e || !_e.isReactComponent);
}
function $k(_e) {
  if (typeof _e == "function")
    return bj(_e) ? 1 : 0;
  if (_e != null) {
    if (_e = _e.$$typeof, _e === Da$1)
      return 11;
    if (_e === Ga$1)
      return 14;
  }
  return 2;
}
function wh$1(_e, Qt) {
  var Zt = _e.alternate;
  return Zt === null ? (Zt = Bg$1(_e.tag, Qt, _e.key, _e.mode), Zt.elementType = _e.elementType, Zt.type = _e.type, Zt.stateNode = _e.stateNode, Zt.alternate = _e, _e.alternate = Zt) : (Zt.pendingProps = Qt, Zt.type = _e.type, Zt.flags = 0, Zt.subtreeFlags = 0, Zt.deletions = null), Zt.flags = _e.flags & 14680064, Zt.childLanes = _e.childLanes, Zt.lanes = _e.lanes, Zt.child = _e.child, Zt.memoizedProps = _e.memoizedProps, Zt.memoizedState = _e.memoizedState, Zt.updateQueue = _e.updateQueue, Qt = _e.dependencies, Zt.dependencies = Qt === null ? null : { lanes: Qt.lanes, firstContext: Qt.firstContext }, Zt.sibling = _e.sibling, Zt.index = _e.index, Zt.ref = _e.ref, Zt;
}
function yh$2(_e, Qt, Zt, $n, Sn, kn) {
  var Kn = 2;
  if ($n = _e, typeof _e == "function")
    bj(_e) && (Kn = 1);
  else if (typeof _e == "string")
    Kn = 5;
  else
    e:
      switch (_e) {
        case ya$1:
          return Ah$1(Zt.children, Sn, kn, Qt);
        case za$1:
          Kn = 8, Sn |= 8;
          break;
        case Aa$1:
          return _e = Bg$1(12, Zt, Qt, Sn | 2), _e.elementType = Aa$1, _e.lanes = kn, _e;
        case Ea$1:
          return _e = Bg$1(13, Zt, Qt, Sn), _e.elementType = Ea$1, _e.lanes = kn, _e;
        case Fa$1:
          return _e = Bg$1(19, Zt, Qt, Sn), _e.elementType = Fa$1, _e.lanes = kn, _e;
        case Ia$1:
          return qj(Zt, Sn, kn, Qt);
        default:
          if (typeof _e == "object" && _e !== null)
            switch (_e.$$typeof) {
              case Ba$1:
                Kn = 10;
                break e;
              case Ca$1:
                Kn = 9;
                break e;
              case Da$1:
                Kn = 11;
                break e;
              case Ga$1:
                Kn = 14;
                break e;
              case Ha:
                Kn = 16, $n = null;
                break e;
            }
          throw Error(p$6(130, _e == null ? _e : typeof _e, ""));
      }
  return Qt = Bg$1(Kn, Zt, Qt, Sn), Qt.elementType = _e, Qt.type = $n, Qt.lanes = kn, Qt;
}
function Ah$1(_e, Qt, Zt, $n) {
  return _e = Bg$1(7, _e, $n, Qt), _e.lanes = Zt, _e;
}
function qj(_e, Qt, Zt, $n) {
  return _e = Bg$1(22, _e, $n, Qt), _e.elementType = Ia$1, _e.lanes = Zt, _e.stateNode = { isHidden: !1 }, _e;
}
function xh$1(_e, Qt, Zt) {
  return _e = Bg$1(6, _e, null, Qt), _e.lanes = Zt, _e;
}
function zh$1(_e, Qt, Zt) {
  return Qt = Bg$1(4, _e.children !== null ? _e.children : [], _e.key, Qt), Qt.lanes = Zt, Qt.stateNode = { containerInfo: _e.containerInfo, pendingChildren: null, implementation: _e.implementation }, Qt;
}
function bl$2(_e, Qt, Zt, $n, Sn) {
  this.tag = Qt, this.containerInfo = _e, this.finishedWork = this.pingCache = this.current = this.pendingChildren = null, this.timeoutHandle = -1, this.callbackNode = this.pendingContext = this.context = null, this.callbackPriority = 0, this.eventTimes = zc$1(0), this.expirationTimes = zc$1(-1), this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0, this.entanglements = zc$1(0), this.identifierPrefix = $n, this.onRecoverableError = Sn, this.mutableSourceEagerHydrationData = null;
}
function cl$1(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr) {
  return _e = new bl$2(_e, Qt, Zt, er, Cr), Qt === 1 ? (Qt = 1, kn === !0 && (Qt |= 8)) : Qt = 0, kn = Bg$1(3, null, null, Qt), _e.current = kn, kn.stateNode = _e, kn.memoizedState = { element: $n, isDehydrated: Zt, cache: null, transitions: null, pendingSuspenseBoundaries: null }, ah$1(kn), _e;
}
function dl$1(_e, Qt, Zt) {
  var $n = 3 < arguments.length && arguments[3] !== void 0 ? arguments[3] : null;
  return { $$typeof: wa$1, key: $n == null ? null : "" + $n, children: _e, containerInfo: Qt, implementation: Zt };
}
function el$1(_e) {
  if (!_e)
    return Vf$1;
  _e = _e._reactInternals;
  e: {
    if (Vb$1(_e) !== _e || _e.tag !== 1)
      throw Error(p$6(170));
    var Qt = _e;
    do {
      switch (Qt.tag) {
        case 3:
          Qt = Qt.stateNode.context;
          break e;
        case 1:
          if (Zf$1(Qt.type)) {
            Qt = Qt.stateNode.__reactInternalMemoizedMergedChildContext;
            break e;
          }
      }
      Qt = Qt.return;
    } while (Qt !== null);
    throw Error(p$6(171));
  }
  if (_e.tag === 1) {
    var Zt = _e.type;
    if (Zf$1(Zt))
      return bg(_e, Zt, Qt);
  }
  return Qt;
}
function fl$1(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr) {
  return _e = cl$1(Zt, $n, !0, _e, Sn, kn, Kn, er, Cr), _e.context = el$1(null), Zt = _e.current, $n = L$2(), Sn = lh$1(Zt), kn = ch$2($n, Sn), kn.callback = Qt ?? null, dh$1(Zt, kn, Sn), _e.current.lanes = Sn, Ac$1(_e, Sn, $n), Ek(_e, $n), _e;
}
function gl$1(_e, Qt, Zt, $n) {
  var Sn = Qt.current, kn = L$2(), Kn = lh$1(Sn);
  return Zt = el$1(Zt), Qt.context === null ? Qt.context = Zt : Qt.pendingContext = Zt, Qt = ch$2(kn, Kn), Qt.payload = { element: _e }, $n = $n === void 0 ? null : $n, $n !== null && (Qt.callback = $n), _e = dh$1(Sn, Qt, Kn), _e !== null && (mh$1(_e, Sn, Kn, kn), eh$1(_e, Sn, Kn)), Kn;
}
function hl$1(_e) {
  if (_e = _e.current, !_e.child)
    return null;
  switch (_e.child.tag) {
    case 5:
      return _e.child.stateNode;
    default:
      return _e.child.stateNode;
  }
}
function il$1(_e, Qt) {
  if (_e = _e.memoizedState, _e !== null && _e.dehydrated !== null) {
    var Zt = _e.retryLane;
    _e.retryLane = Zt !== 0 && Zt < Qt ? Zt : Qt;
  }
}
function jl$1(_e, Qt) {
  il$1(_e, Qt), (_e = _e.alternate) && il$1(_e, Qt);
}
function kl$1() {
  return null;
}
var ll$1 = typeof reportError == "function" ? reportError : function(_e) {
  console.error(_e);
};
function ml$1(_e) {
  this._internalRoot = _e;
}
nl$1.prototype.render = ml$1.prototype.render = function(_e) {
  var Qt = this._internalRoot;
  if (Qt === null)
    throw Error(p$6(409));
  gl$1(_e, Qt, null, null);
};
nl$1.prototype.unmount = ml$1.prototype.unmount = function() {
  var _e = this._internalRoot;
  if (_e !== null) {
    this._internalRoot = null;
    var Qt = _e.containerInfo;
    Sk(function() {
      gl$1(null, _e, null, null);
    }), Qt[uf$1] = null;
  }
};
function nl$1(_e) {
  this._internalRoot = _e;
}
nl$1.prototype.unstable_scheduleHydration = function(_e) {
  if (_e) {
    var Qt = Hc$1();
    _e = { blockedOn: null, target: _e, priority: Qt };
    for (var Zt = 0; Zt < Qc$1.length && Qt !== 0 && Qt < Qc$1[Zt].priority; Zt++)
      ;
    Qc$1.splice(Zt, 0, _e), Zt === 0 && Vc$1(_e);
  }
};
function ol$1(_e) {
  return !(!_e || _e.nodeType !== 1 && _e.nodeType !== 9 && _e.nodeType !== 11);
}
function pl$1(_e) {
  return !(!_e || _e.nodeType !== 1 && _e.nodeType !== 9 && _e.nodeType !== 11 && (_e.nodeType !== 8 || _e.nodeValue !== " react-mount-point-unstable "));
}
function ql$1() {
}
function rl$1(_e, Qt, Zt, $n, Sn) {
  if (Sn) {
    if (typeof $n == "function") {
      var kn = $n;
      $n = function() {
        var kr = hl$1(Kn);
        kn.call(kr);
      };
    }
    var Kn = fl$1(Qt, $n, _e, 0, null, !1, !1, "", ql$1);
    return _e._reactRootContainer = Kn, _e[uf$1] = Kn.current, sf$1(_e.nodeType === 8 ? _e.parentNode : _e), Sk(), Kn;
  }
  for (; Sn = _e.lastChild; )
    _e.removeChild(Sn);
  if (typeof $n == "function") {
    var er = $n;
    $n = function() {
      var kr = hl$1(Cr);
      er.call(kr);
    };
  }
  var Cr = cl$1(_e, 0, !1, null, null, !1, !1, "", ql$1);
  return _e._reactRootContainer = Cr, _e[uf$1] = Cr.current, sf$1(_e.nodeType === 8 ? _e.parentNode : _e), Sk(function() {
    gl$1(Qt, Cr, Zt, $n);
  }), Cr;
}
function sl$1(_e, Qt, Zt, $n, Sn) {
  var kn = Zt._reactRootContainer;
  if (kn) {
    var Kn = kn;
    if (typeof Sn == "function") {
      var er = Sn;
      Sn = function() {
        var Cr = hl$1(Kn);
        er.call(Cr);
      };
    }
    gl$1(Qt, Kn, _e, Sn);
  } else
    Kn = rl$1(Zt, Qt, _e, Sn, $n);
  return hl$1(Kn);
}
Ec$1 = function(_e) {
  switch (_e.tag) {
    case 3:
      var Qt = _e.stateNode;
      if (Qt.current.memoizedState.isDehydrated) {
        var Zt = tc$1(Qt.pendingLanes);
        Zt !== 0 && (Cc$1(Qt, Zt | 1), Ek(Qt, B$4()), !(K$2 & 6) && (Hj = B$4() + 500, jg()));
      }
      break;
    case 13:
      Sk(function() {
        var $n = Zg$1(_e, 1);
        if ($n !== null) {
          var Sn = L$2();
          mh$1($n, _e, 1, Sn);
        }
      }), jl$1(_e, 1);
  }
};
Fc$1 = function(_e) {
  if (_e.tag === 13) {
    var Qt = Zg$1(_e, 134217728);
    if (Qt !== null) {
      var Zt = L$2();
      mh$1(Qt, _e, 134217728, Zt);
    }
    jl$1(_e, 134217728);
  }
};
Gc$1 = function(_e) {
  if (_e.tag === 13) {
    var Qt = lh$1(_e), Zt = Zg$1(_e, Qt);
    if (Zt !== null) {
      var $n = L$2();
      mh$1(Zt, _e, Qt, $n);
    }
    jl$1(_e, Qt);
  }
};
Hc$1 = function() {
  return C$5;
};
Ic$1 = function(_e, Qt) {
  var Zt = C$5;
  try {
    return C$5 = _e, Qt();
  } finally {
    C$5 = Zt;
  }
};
yb$1 = function(_e, Qt, Zt) {
  switch (Qt) {
    case "input":
      if (bb$1(_e, Zt), Qt = Zt.name, Zt.type === "radio" && Qt != null) {
        for (Zt = _e; Zt.parentNode; )
          Zt = Zt.parentNode;
        for (Zt = Zt.querySelectorAll("input[name=" + JSON.stringify("" + Qt) + '][type="radio"]'), Qt = 0; Qt < Zt.length; Qt++) {
          var $n = Zt[Qt];
          if ($n !== _e && $n.form === _e.form) {
            var Sn = Db$1($n);
            if (!Sn)
              throw Error(p$6(90));
            Wa$1($n), bb$1($n, Sn);
          }
        }
      }
      break;
    case "textarea":
      ib$1(_e, Zt);
      break;
    case "select":
      Qt = Zt.value, Qt != null && fb$1(_e, !!Zt.multiple, Qt, !1);
  }
};
Gb$1 = Rk;
Hb$1 = Sk;
var tl$2 = { usingClientEntryPoint: !1, Events: [Cb$1, ue$2, Db$1, Eb$1, Fb$1, Rk] }, ul$1 = { findFiberByHostInstance: Wc$1, bundleType: 0, version: "18.2.0", rendererPackageName: "react-dom" }, vl$1 = { bundleType: ul$1.bundleType, version: ul$1.version, rendererPackageName: ul$1.rendererPackageName, rendererConfig: ul$1.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, overrideProps: null, overridePropsDeletePath: null, overridePropsRenamePath: null, setErrorHandler: null, setSuspenseHandler: null, scheduleUpdate: null, currentDispatcherRef: ua$1.ReactCurrentDispatcher, findHostInstanceByFiber: function(_e) {
  return _e = Zb$1(_e), _e === null ? null : _e.stateNode;
}, findFiberByHostInstance: ul$1.findFiberByHostInstance || kl$1, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, reconcilerVersion: "18.2.0-next-9e3b772b8-20220608" };
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u") {
  var wl$1 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
  if (!wl$1.isDisabled && wl$1.supportsFiber)
    try {
      kc$1 = wl$1.inject(vl$1), lc$1 = wl$1;
    } catch {
    }
}
reactDom_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = tl$2;
reactDom_production_min.createPortal = function(_e, Qt) {
  var Zt = 2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : null;
  if (!ol$1(Qt))
    throw Error(p$6(200));
  return dl$1(_e, Qt, null, Zt);
};
reactDom_production_min.createRoot = function(_e, Qt) {
  if (!ol$1(_e))
    throw Error(p$6(299));
  var Zt = !1, $n = "", Sn = ll$1;
  return Qt != null && (Qt.unstable_strictMode === !0 && (Zt = !0), Qt.identifierPrefix !== void 0 && ($n = Qt.identifierPrefix), Qt.onRecoverableError !== void 0 && (Sn = Qt.onRecoverableError)), Qt = cl$1(_e, 1, !1, null, null, Zt, !1, $n, Sn), _e[uf$1] = Qt.current, sf$1(_e.nodeType === 8 ? _e.parentNode : _e), new ml$1(Qt);
};
reactDom_production_min.findDOMNode = function(_e) {
  if (_e == null)
    return null;
  if (_e.nodeType === 1)
    return _e;
  var Qt = _e._reactInternals;
  if (Qt === void 0)
    throw typeof _e.render == "function" ? Error(p$6(188)) : (_e = Object.keys(_e).join(","), Error(p$6(268, _e)));
  return _e = Zb$1(Qt), _e = _e === null ? null : _e.stateNode, _e;
};
reactDom_production_min.flushSync = function(_e) {
  return Sk(_e);
};
reactDom_production_min.hydrate = function(_e, Qt, Zt) {
  if (!pl$1(Qt))
    throw Error(p$6(200));
  return sl$1(null, _e, Qt, !0, Zt);
};
reactDom_production_min.hydrateRoot = function(_e, Qt, Zt) {
  if (!ol$1(_e))
    throw Error(p$6(405));
  var $n = Zt != null && Zt.hydratedSources || null, Sn = !1, kn = "", Kn = ll$1;
  if (Zt != null && (Zt.unstable_strictMode === !0 && (Sn = !0), Zt.identifierPrefix !== void 0 && (kn = Zt.identifierPrefix), Zt.onRecoverableError !== void 0 && (Kn = Zt.onRecoverableError)), Qt = fl$1(Qt, null, _e, 1, Zt ?? null, Sn, !1, kn, Kn), _e[uf$1] = Qt.current, sf$1(_e), $n)
    for (_e = 0; _e < $n.length; _e++)
      Zt = $n[_e], Sn = Zt._getVersion, Sn = Sn(Zt._source), Qt.mutableSourceEagerHydrationData == null ? Qt.mutableSourceEagerHydrationData = [Zt, Sn] : Qt.mutableSourceEagerHydrationData.push(
        Zt,
        Sn
      );
  return new nl$1(Qt);
};
reactDom_production_min.render = function(_e, Qt, Zt) {
  if (!pl$1(Qt))
    throw Error(p$6(200));
  return sl$1(null, _e, Qt, !1, Zt);
};
reactDom_production_min.unmountComponentAtNode = function(_e) {
  if (!pl$1(_e))
    throw Error(p$6(40));
  return _e._reactRootContainer ? (Sk(function() {
    sl$1(null, null, _e, !1, function() {
      _e._reactRootContainer = null, _e[uf$1] = null;
    });
  }), !0) : !1;
};
reactDom_production_min.unstable_batchedUpdates = Rk;
reactDom_production_min.unstable_renderSubtreeIntoContainer = function(_e, Qt, Zt, $n) {
  if (!pl$1(Zt))
    throw Error(p$6(200));
  if (_e == null || _e._reactInternals === void 0)
    throw Error(p$6(38));
  return sl$1(_e, Qt, Zt, !1, $n);
};
reactDom_production_min.version = "18.2.0-next-9e3b772b8-20220608";
function checkDCE() {
  if (!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ > "u" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE != "function"))
    try {
      __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
    } catch (_e) {
      console.error(_e);
    }
}
checkDCE(), reactDom.exports = reactDom_production_min;
var reactDomExports = reactDom.exports;
const Vu = /* @__PURE__ */ getDefaultExportFromCjs$1(reactDomExports);
var createRoot, m$8 = reactDomExports;
createRoot = m$8.createRoot, m$8.hydrateRoot;
let ModelContext = reactExports.createContext(
  /** @type {any} */
  null
);
function useModel() {
  let _e = reactExports.useContext(ModelContext);
  if (!_e)
    throw new Error("Model not found");
  return _e;
}
function useModelState(_e) {
  let Qt = useModel(), [Zt, $n] = reactExports.useState(Qt.get(_e));
  return reactExports.useEffect(() => {
    let Sn = () => $n(Qt.get(_e));
    return Qt.on(`change:${_e}`, Sn), () => Qt.off(`change:${_e}`, Sn);
  }, [Qt, _e]), [
    Zt,
    (Sn) => {
      Qt.set(_e, Sn), Qt.save_changes();
    }
  ];
}
function createRender(_e) {
  return ({ model: Qt, el: Zt }) => {
    let $n = createRoot(Zt);
    return $n.render(
      reactExports.createElement(
        reactExports.StrictMode,
        null,
        reactExports.createElement(
          ModelContext.Provider,
          { value: Qt },
          reactExports.createElement(_e)
        )
      )
    ), () => $n.unmount();
  };
}
var extendStatics = function(_e, Qt) {
  return extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(Zt, $n) {
    Zt.__proto__ = $n;
  } || function(Zt, $n) {
    for (var Sn in $n)
      Object.prototype.hasOwnProperty.call($n, Sn) && (Zt[Sn] = $n[Sn]);
  }, extendStatics(_e, Qt);
};
function __extends$2(_e, Qt) {
  if (typeof Qt != "function" && Qt !== null)
    throw new TypeError("Class extends value " + String(Qt) + " is not a constructor or null");
  extendStatics(_e, Qt);
  function Zt() {
    this.constructor = _e;
  }
  _e.prototype = Qt === null ? Object.create(Qt) : (Zt.prototype = Qt.prototype, new Zt());
}
var __assign$1 = function() {
  return __assign$1 = Object.assign || function(Qt) {
    for (var Zt, $n = 1, Sn = arguments.length; $n < Sn; $n++) {
      Zt = arguments[$n];
      for (var kn in Zt)
        Object.prototype.hasOwnProperty.call(Zt, kn) && (Qt[kn] = Zt[kn]);
    }
    return Qt;
  }, __assign$1.apply(this, arguments);
}, hasOwnProperty$1 = Object.prototype.hasOwnProperty;
function is$2(_e, Qt) {
  return _e === Qt ? _e !== 0 || Qt !== 0 || 1 / _e === 1 / Qt : _e !== _e && Qt !== Qt;
}
function shallowEqual$2(_e, Qt) {
  if (is$2(_e, Qt))
    return !0;
  if (typeof _e != "object" || _e === null || typeof Qt != "object" || Qt === null)
    return !1;
  var Zt = Object.keys(_e), $n = Object.keys(Qt);
  if (Zt.length !== $n.length)
    return !1;
  for (var Sn = 0; Sn < Zt.length; Sn++)
    if (!hasOwnProperty$1.call(Qt, Zt[Sn]) || !is$2(_e[Zt[Sn]], Qt[Zt[Sn]]))
      return !1;
  return !0;
}
var none$2 = Symbol("none"), __state = Symbol("__state");
function hookstate(_e, Qt) {
  var Zt = createStore$2(_e);
  Zt.activate(Qt);
  var $n = Zt.toMethods();
  return $n.self();
}
function extend$4(_e, Qt, Zt, $n, Sn) {
  function kn(Kn) {
    var er = Kn.map(function(js) {
      return js();
    }), Cr = er.map(function(js) {
      return js.onInit;
    }).filter(function(js) {
      return js;
    }), kr = er.map(function(js) {
      return js.onPremerge;
    }).filter(function(js) {
      return js;
    }), Yr = er.map(function(js) {
      return js.onPreset;
    }).filter(function(js) {
      return js;
    }), Ms = er.map(function(js) {
      return js.onSet;
    }).filter(function(js) {
      return js;
    }), Ds = er.map(function(js) {
      return js.onDestroy;
    }).filter(function(js) {
      return js;
    }), Ls = {
      onCreate: function(js, zs) {
        for (var Fs = 0, Bs = er; Fs < Bs.length; Fs++) {
          var Hs = Bs[Fs];
          if (Hs.onCreate) {
            var Ws = Hs.onCreate(js, zs);
            Object.assign(zs, Ws);
          }
        }
        return zs;
      }
    };
    return Cr.length > 0 && (Ls.onInit = function(js, zs) {
      for (var Fs = 0, Bs = Cr; Fs < Bs.length; Fs++) {
        var Hs = Bs[Fs];
        Hs(js, zs);
      }
    }), kr.length > 0 && (Ls.onPremerge = function(js, zs, Fs) {
      for (var Bs = 0, Hs = kr; Bs < Hs.length; Bs++) {
        var Ws = Hs[Bs];
        Ws(js, zs, Fs);
      }
    }), Yr.length > 0 && (Ls.onPreset = function(js, zs, Fs) {
      for (var Bs = 0, Hs = Yr; Bs < Hs.length; Bs++) {
        var Ws = Hs[Bs];
        Ws(js, zs, Fs);
      }
    }), Ms.length > 0 && (Ls.onSet = function(js, zs, Fs) {
      for (var Bs = 0, Hs = Ms; Bs < Hs.length; Bs++) {
        var Ws = Hs[Bs];
        Ws(js, zs, Fs);
      }
    }), Ds.length > 0 && (Ls.onDestroy = function(js) {
      for (var zs = 0, Fs = Ds; zs < Fs.length; zs++) {
        var Bs = Fs[zs];
        Bs(js);
      }
    }), Ls;
  }
  return function() {
    return kn([_e, Qt, Zt, $n, Sn].filter(function(Kn) {
      return Kn;
    }));
  };
}
function useHookstate(_e, Qt) {
  var Zt = Object(_e) === _e ? _e[self$1] : void 0;
  if (Zt)
    if (Zt.isMounted) {
      var $n = function() {
        var zs = Zt.store, Fs = function() {
          return Kn({
            store: zs,
            state: Bs,
            source: kn.source
            // mutable, get the latest from value
          });
        }, Bs = new StateMethodsImpl(zs, Zt.path, zs.get(Zt.path), zs.edition, Fs);
        return {
          store: zs,
          state: Bs,
          source: _e
        };
      }, Sn = React.useState($n), kn = Sn[0], Kn = Sn[1];
      if (kn.store !== Zt.store || !("source" in kn))
        throw new StateInvalidUsageError(Zt.path, ErrorId.InitStateStoreSwitchover);
      Object.defineProperty(kn, "store", { enumerable: !1 }), Object.defineProperty(kn, "state", { enumerable: !1 }), Object.defineProperty(kn, "source", { enumerable: !1 }), kn.state.reconstruct(
        Zt.path,
        kn.store.get(Zt.path),
        kn.store.edition,
        // parent state object has changed its reference object
        // so the scopped state should change too
        kn.source !== _e
      ), kn.source = _e, Zt.subscribe(kn.state), useIsomorphicLayoutEffect$4(function() {
        return kn.state.onMount(), Zt.subscribe(kn.state), function() {
          kn.state.onUnmount(), Zt.unsubscribe(kn.state);
        };
      }, []);
      var er = kn.state.self();
      return kn["[hookstate(scoped)]"] = er, er;
    } else {
      var $n = function() {
        var Bs = Zt.store, Hs = function() {
          return Yr({
            store: Bs,
            state: Ws,
            source: kr.source
            // mutable, get the latest from value
          });
        }, Ws = new StateMethodsImpl(Bs, RootPath, Bs.get(RootPath), Bs.edition, Hs);
        return {
          store: Bs,
          state: Ws,
          source: _e
        };
      }, Cr = React.useState($n), kr = Cr[0], Yr = Cr[1];
      if (kr.store !== Zt.store || !("source" in kr))
        throw new StateInvalidUsageError(Zt.path, ErrorId.InitStateStoreSwitchover);
      Object.defineProperty(kr, "store", { enumerable: !1 }), Object.defineProperty(kr, "state", { enumerable: !1 }), Object.defineProperty(kr, "source", { enumerable: !1 }), kr.state.reconstruct(
        RootPath,
        kr.store.get(RootPath),
        kr.store.edition,
        // parent state object has changed its reference object
        // so the scopped state should change too
        kr.source !== _e
      ), kr.source = _e, kr.store.subscribe(kr.state), useIsomorphicLayoutEffect$4(function() {
        return kr.state.onMount(), kr.store.subscribe(kr.state), function() {
          kr.state.onUnmount(), kr.store.unsubscribe(kr.state);
        };
      }, []);
      for (var er = kr.state.self(), Ms = 0; Ms < Zt.path.length; Ms += 1)
        er = er.nested(Zt.path[Ms]);
      return kr["[hookstate(global)]"] = er, er;
    }
  else {
    var $n = function() {
      var Bs = createStore$2(_e), Hs = function() {
        return js({
          store: Bs,
          state: Ws
        });
      }, Ws = new StateMethodsImpl(Bs, RootPath, Bs.get(RootPath), Bs.edition, Hs);
      return {
        store: Bs,
        state: Ws
      };
    }, Ds = React.useState($n), Ls = Ds[0], js = Ds[1];
    if ("source" in Ls)
      throw new StateInvalidUsageError(RootPath, ErrorId.InitStateStoreSwitchover);
    Object.defineProperty(Ls, "store", { enumerable: !1 }), Object.defineProperty(Ls, "state", { enumerable: !1 }), Ls.state.reconstruct(RootPath, Ls.store.get(RootPath), Ls.store.edition, !1), Ls.store.subscribe(Ls.state), Ls.store.activate(Qt), useIsomorphicLayoutEffect$4(function() {
      return Ls.state.onMount(), Ls.store.subscribe(Ls.state), Ls.store.activate(Qt), function() {
        Ls.state.onUnmount(), Ls.store.unsubscribe(Ls.state), Ls.store.deactivate();
      };
    }, []);
    var er = Ls.state.self();
    return Ls["[hookstate(local)]"] = er, er;
  }
}
var self$1 = Symbol("self"), ErrorId;
(function(_e) {
  _e[_e.StateUsedInDependencyList = 100] = "StateUsedInDependencyList", _e[_e.InitStateToValueFromState = 101] = "InitStateToValueFromState", _e[_e.SetStateToValueFromState = 102] = "SetStateToValueFromState", _e[_e.GetStateWhenPromised = 103] = "GetStateWhenPromised", _e[_e.SetStateWhenPromised = 104] = "SetStateWhenPromised", _e[_e.SetStateNestedToPromised = 105] = "SetStateNestedToPromised", _e[_e.SetStateWhenDestroyed = 106] = "SetStateWhenDestroyed", _e[_e.ToJson_Value = 108] = "ToJson_Value", _e[_e.ToJson_State = 109] = "ToJson_State", _e[_e.GetProperty_Function = 110] = "GetProperty_Function", _e[_e.InitStateStoreSwitchover = 111] = "InitStateStoreSwitchover", _e[_e.GetUnknownPlugin = 120] = "GetUnknownPlugin", _e[_e.SetProperty_State = 201] = "SetProperty_State", _e[_e.SetProperty_Value = 202] = "SetProperty_Value", _e[_e.SetPrototypeOf_State = 203] = "SetPrototypeOf_State", _e[_e.SetPrototypeOf_Value = 204] = "SetPrototypeOf_Value", _e[_e.PreventExtensions_State = 205] = "PreventExtensions_State", _e[_e.PreventExtensions_Value = 206] = "PreventExtensions_Value", _e[_e.DefineProperty_State = 207] = "DefineProperty_State", _e[_e.DefineProperty_Value = 208] = "DefineProperty_Value", _e[_e.DeleteProperty_State = 209] = "DeleteProperty_State", _e[_e.DeleteProperty_Value = 210] = "DeleteProperty_Value", _e[_e.Construct_State = 211] = "Construct_State", _e[_e.Construct_Value = 212] = "Construct_Value", _e[_e.Apply_State = 213] = "Apply_State", _e[_e.Apply_Value = 214] = "Apply_Value";
})(ErrorId || (ErrorId = {}));
var StateInvalidUsageError = (
  /** @class */
  function(_e) {
    __extends$2(Qt, _e);
    function Qt(Zt, $n, Sn) {
      return _e.call(this, "Error: HOOKSTATE-".concat($n, " [path: /").concat(Zt.join("/")).concat(Sn ? ", details: ".concat(Sn) : "", "]. ") + "See https://hookstate.js.org/docs/exceptions#hookstate-".concat($n)) || this;
    }
    return Qt;
  }(Error)
), SelfMethodsID = Symbol("ProxyMarker"), RootPath = [], Store = (
  /** @class */
  function() {
    function _e(Qt) {
      var Zt = this;
      this._value = Qt, this.edition = 1, this._subscribers = /* @__PURE__ */ new Set(), Object(Qt) === Qt && configuration.promiseDetector(Qt) ? this.setPromised(Qt) : Qt === none$2 && this.setPromised(void 0);
      var $n = function() {
        Zt._stateMethods.reconstruct(RootPath, Zt.get(RootPath), Zt.edition, !1);
      };
      $n[IsUnmounted] = !0, this._stateMethods = new StateMethodsImpl(this, RootPath, this.get(RootPath), this.edition, $n), this.subscribe(this._stateMethods);
    }
    return _e.prototype.setPromised = function(Qt) {
      var Zt = this;
      if (this._value = none$2, this._promiseError = void 0, this._promiseResolver = void 0, !Qt) {
        this._promise = new Promise(function($n) {
          Zt._promiseResolver = $n;
        });
        return;
      }
      Qt = Qt.then(function($n) {
        Zt._promise === Qt && (Zt._promise = void 0, Zt._promiseError = void 0, Zt._promiseResolver, Zt.update(Zt._stateMethods.self(), Zt.set(RootPath, $n)));
      }).catch(function($n) {
        if (Zt._promise === Qt) {
          Zt._promise = void 0, Zt._promiseResolver = void 0, Zt._promiseError = $n, Zt.edition += 1;
          var Sn = { path: RootPath };
          Zt.update(Zt._stateMethods.self(), Sn);
        }
      }), this._promise = Qt;
    }, _e.prototype.activate = function(Qt) {
      var Zt, $n, Sn, kn;
      this.edition < 0 && (this.edition = -this.edition), this._extension === void 0 && (this._extension = Qt == null ? void 0 : Qt(), this._extensionMethods = ($n = (Zt = this._extension) === null || Zt === void 0 ? void 0 : Zt.onCreate) === null || $n === void 0 ? void 0 : $n.call(Zt, this._stateMethods.self(), {}), (kn = (Sn = this._extension) === null || Sn === void 0 ? void 0 : Sn.onInit) === null || kn === void 0 || kn.call(Sn, this._stateMethods.self(), this._extensionMethods || {}));
    }, _e.prototype.deactivate = function() {
      var Qt, Zt;
      this._extension && ((Zt = (Qt = this._extension).onDestroy) === null || Zt === void 0 || Zt.call(Qt, this._stateMethods.self()), delete this._extension, delete this._extensionMethods), this.edition > 0 && (this.edition = -this.edition);
    }, Object.defineProperty(_e.prototype, "extension", {
      get: function() {
        return this._extensionMethods;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(_e.prototype, "promise", {
      get: function() {
        return this._promise;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(_e.prototype, "promiseError", {
      get: function() {
        return this._promiseError;
      },
      enumerable: !1,
      configurable: !0
    }), _e.prototype.get = function(Qt) {
      var Zt = this._value;
      return Zt === none$2 || Qt.forEach(function($n) {
        Zt = Zt[$n];
      }), Zt;
    }, _e.prototype.set = function(Qt, Zt) {
      var $n, Sn;
      if (this.edition < 0)
        throw new StateInvalidUsageError(Qt, ErrorId.SetStateWhenDestroyed);
      if (Qt.length === 0) {
        if (Zt === none$2)
          this.setPromised(void 0);
        else if (Object(Zt) === Zt && configuration.promiseDetector(Zt))
          this.setPromised(Zt), Zt = none$2;
        else {
          if (this._promise && !this._promiseResolver)
            throw new StateInvalidUsageError(Qt, ErrorId.SetStateWhenPromised);
          this._promiseError = void 0;
        }
        var kn = this._value;
        if (this._value = Zt, this.afterSet(), kn === none$2 && this._value !== none$2 && this._promiseResolver) {
          this._promise = void 0, this._promiseError = void 0;
          var Kn = this._promiseResolver;
          this._promiseResolver, Kn(this._value);
        }
        return {
          path: Qt
        };
      }
      if (Object(Zt) === Zt && configuration.promiseDetector(Zt))
        throw new StateInvalidUsageError(Qt, ErrorId.SetStateNestedToPromised);
      for (var er = this._value, Cr = 0; Cr < Qt.length - 1; Cr += 1)
        er = er[Qt[Cr]];
      var kr = Qt[Qt.length - 1];
      return kr in er ? Zt !== none$2 ? (er[kr] = Zt, this.afterSet(), {
        path: Qt
      }) : (Array.isArray(er) && typeof kr == "number" ? er.splice(kr, 1) : delete er[kr], this.afterSet(), {
        path: Qt.slice(0, -1),
        actions: ($n = {}, $n[kr] = "D", $n)
      }) : Zt !== none$2 ? (er[kr] = Zt, this.afterSet(), {
        path: Qt.slice(0, -1),
        actions: (Sn = {}, Sn[kr] = "I", Sn)
      }) : {
        path: Qt
      };
    }, _e.prototype.preset = function(Qt, Zt) {
      var $n, Sn;
      (Sn = ($n = this._extension) === null || $n === void 0 ? void 0 : $n.onPreset) === null || Sn === void 0 || Sn.call($n, Qt, Zt, this._stateMethods.self());
    }, _e.prototype.premerge = function(Qt, Zt) {
      var $n, Sn;
      (Sn = ($n = this._extension) === null || $n === void 0 ? void 0 : $n.onPremerge) === null || Sn === void 0 || Sn.call($n, Qt, Zt, this._stateMethods.self());
    }, _e.prototype.update = function(Qt, Zt) {
      var $n = this, Sn, kn;
      (kn = (Sn = this._extension) === null || Sn === void 0 ? void 0 : Sn.onSet) === null || kn === void 0 || kn.call(Sn, Qt, Zt, this._stateMethods.self());
      var Kn = /* @__PURE__ */ new Set();
      Zt.actions && Object.values(Zt.actions).findIndex(function(er) {
        return er !== "U";
      }) === -1 ? Object.keys(Zt.actions).forEach(function(er) {
        $n._subscribers.forEach(function(Cr) {
          return Cr.onSet({ path: Zt.path.concat(er) }, Kn);
        });
      }) : this._subscribers.forEach(function(er) {
        return er.onSet(Zt, Kn);
      }), Kn.forEach(function(er) {
        return er();
      });
    }, _e.prototype.afterSet = function() {
      this.edition > 0 && (this.edition += 1), this.edition < 0 && (this.edition -= 1);
    }, _e.prototype.toMethods = function() {
      return this._stateMethods;
    }, _e.prototype.subscribe = function(Qt) {
      this._subscribers.add(Qt);
    }, _e.prototype.unsubscribe = function(Qt) {
      this._subscribers.delete(Qt);
    }, _e.prototype.toJSON = function() {
      throw new StateInvalidUsageError(RootPath, ErrorId.ToJson_Value);
    }, _e;
  }()
), UnusedValue = Symbol("UnusedValue"), IsUnmounted = Symbol("IsUnmounted"), StateMethodsImpl = (
  /** @class */
  function() {
    function _e(Qt, Zt, $n, Sn, kn) {
      this.store = Qt, this.path = Zt, this.valueSource = $n, this.valueEdition = Sn, this.onSetUsed = kn, this.valueUsed = UnusedValue;
    }
    return Object.defineProperty(_e.prototype, __state, {
      get: function() {
        return [this.get(), this.self()];
      },
      enumerable: !1,
      configurable: !0
    }), _e.prototype.reconstruct = function(Qt, Zt, $n, Sn) {
      this.path = Qt, this.valueSource = Zt, this.valueEdition = $n, this.valueUsed = UnusedValue, Sn ? (delete this.selfUsed, delete this.childrenCreated, delete this.childrenUsedPrevious) : (this.valueUsedNoProxyPrevious = this.valueUsedNoProxy, this.childrenUsedPrevious = this.childrenUsed), delete this.valueUsedNoProxy, delete this.childrenUsed;
    }, _e.prototype.reconnect = function() {
      this.get({ __internalAllowPromised: !0, noproxy: this.valueUsedNoProxyPrevious }), this.childrenUsed = __assign$1(__assign$1({}, this.childrenUsedPrevious), this.childrenUsed);
    }, _e.prototype.getUntracked = function(Qt) {
      if (this.valueEdition !== this.store.edition && (this.valueSource = this.store.get(this.path), this.valueEdition = this.store.edition, this.valueUsed !== UnusedValue && (this.valueUsed = UnusedValue, this.get({ __internalAllowPromised: !0 }))), Qt)
        return this.valueSource;
      if (this.store.promiseError)
        throw this.store.promiseError;
      if (this.store.promise)
        throw new StateInvalidUsageError(this.path, ErrorId.GetStateWhenPromised);
      return this.valueSource;
    }, _e.prototype.get = function(Qt) {
      var Zt, $n = this.getUntracked(Qt == null ? void 0 : Qt.__internalAllowPromised);
      return Qt != null && Qt.stealth ? $n : (this.valueUsed === UnusedValue && (Array.isArray($n) ? this.valueUsed = this.valueArrayImpl($n) : Object($n) === $n ? ((Zt = $n.constructor) === null || Zt === void 0 ? void 0 : Zt.name) === "Object" ? this.valueUsed = this.valueObjectImpl($n) : (this.valueUsedNoProxy = !0, this.valueUsed = $n) : this.valueUsed = $n), Qt != null && Qt.noproxy ? (this.valueUsedNoProxy = !0, $n) : this.valueUsed);
    }, Object.defineProperty(_e.prototype, "value", {
      get: function() {
        return this.get();
      },
      enumerable: !1,
      configurable: !0
    }), _e.prototype.setUntrackedV4 = function(Qt) {
      if (typeof Qt == "function" && (Qt = Qt(this.getUntracked())), this.store.preset(this.self(), Qt), Object(Qt) === Qt && Qt[SelfMethodsID])
        throw new StateInvalidUsageError(this.path, ErrorId.SetStateToValueFromState);
      return Qt !== Object(Qt) && Qt === this.getUntracked(!0) ? null : this.store.set(this.path, Qt);
    }, _e.prototype.set = function(Qt) {
      var Zt = this.setUntrackedV4(Qt);
      Zt && this.store.update(this.self(), Zt);
    }, _e.prototype.mergeUntracked = function(Qt) {
      var Zt = this.mergeUntrackedV4(Qt);
      return Zt ? [Zt.path] : [];
    }, _e.prototype.mergeUntrackedV4 = function(Qt) {
      var Zt = this.getUntracked();
      if (typeof Qt == "function" && (Qt = Qt(Zt)), this.store.premerge(this.self(), Qt), Array.isArray(Zt))
        if (Array.isArray(Qt)) {
          var $n = { path: this.path, actions: {} };
          return Qt.forEach(function(er, Cr) {
            $n.actions[Zt.push(er) - 1] = "I";
          }), Object.keys($n.actions).length > 0 ? (this.setUntrackedV4(Zt), $n) : null;
        } else {
          var Sn = { path: this.path, actions: {} }, kn = [];
          return Object.keys(Qt).map(function(er) {
            return Number(er);
          }).sort(function(er, Cr) {
            return er - Cr;
          }).forEach(function(er) {
            var Cr = Number(er), kr = Qt[Cr];
            kr === none$2 ? (Sn.actions[Cr] = "D", kn.push(Cr)) : (Cr in Zt ? Sn.actions[Cr] = "U" : Sn.actions[Cr] = "I", Zt[Cr] = kr);
          }), kn.reverse().forEach(function(er) {
            Zt.splice(er, 1);
          }), Object.keys(Sn.actions).length > 0 ? (this.setUntrackedV4(Zt), Sn) : null;
        }
      else if (Object(Zt) === Zt) {
        var Kn = { path: this.path, actions: {} };
        return Object.keys(Qt).forEach(function(er) {
          var Cr = Qt[er];
          Cr === none$2 ? (Kn.actions[er] = "D", delete Zt[er]) : (er in Zt ? Kn.actions[er] = "U" : Kn.actions[er] = "I", Zt[er] = Cr);
        }), Object.keys(Kn.actions).length > 0 ? (this.setUntrackedV4(Zt), Kn) : null;
      } else
        return typeof Zt == "string" ? this.setUntrackedV4(Zt + String(Qt)) : this.setUntrackedV4(Qt);
    }, _e.prototype.merge = function(Qt) {
      var Zt = this.mergeUntrackedV4(Qt);
      Zt && this.store.update(this.self(), Zt);
    }, _e.prototype.nested = function(Qt) {
      return this.child(Qt).self();
    }, _e.prototype.rerender = function(Qt) {
      for (var Zt = 0, $n = Qt; Zt < $n.length; Zt++) {
        var Sn = $n[Zt];
        this.store.update(this.self(), { path: Sn });
      }
    }, _e.prototype.activate = function(Qt) {
      this.store.activate(Qt);
    }, _e.prototype.deactivate = function() {
      this.store.deactivate();
    }, _e.prototype.subscribe = function(Qt) {
      this.subscribers === void 0 && (this.subscribers = /* @__PURE__ */ new Set()), this.subscribers.add(Qt);
    }, _e.prototype.unsubscribe = function(Qt) {
      this.subscribers && this.subscribers.delete(Qt);
    }, Object.defineProperty(_e.prototype, "isMounted", {
      get: function() {
        return !this.onSetUsed[IsUnmounted];
      },
      enumerable: !1,
      configurable: !0
    }), _e.prototype.onMount = function() {
      delete this.onSetUsed[IsUnmounted];
    }, _e.prototype.onUnmount = function() {
      this.onSetUsed[IsUnmounted] = !0;
    }, _e.prototype.onSet = function(Qt, Zt) {
      var $n = this, Sn = function() {
        var Kn, er = !1;
        $n.valueUsedNoProxy && $n.valueUsed !== UnusedValue && (Zt.add($n.onSetUsed), delete $n.selfUsed, er = !0);
        var Cr = Qt.path, kr = Cr[$n.path.length];
        if (kr === void 0) {
          if ($n.valueUsed !== UnusedValue) {
            if (Zt.add($n.onSetUsed), delete $n.selfUsed, delete $n.childrenUsed, Qt.actions && $n.childrenCreated)
              if (Array.isArray($n.valueSource) && Object.values(Qt.actions).includes("D")) {
                var Yr = Object.keys(Qt.actions).map(function(Ls) {
                  return Number(Ls);
                }).sort(function(Ls, js) {
                  return Ls - js;
                }).find(function(Ls) {
                  var js;
                  return ((js = Qt.actions) === null || js === void 0 ? void 0 : js[Ls]) === "D";
                });
                for (var Ms in $n.childrenCreated)
                  (Number(Ms) >= Yr || Ms in Qt.actions) && delete $n.childrenCreated[Ms];
              } else
                for (var Ms in Qt.actions)
                  delete $n.childrenCreated[Ms];
            else
              delete $n.childrenCreated;
            return !0;
          }
        } else {
          var Ds = (Kn = $n.childrenUsed) === null || Kn === void 0 ? void 0 : Kn[kr];
          if (Ds && Ds.onSet(Qt, Zt))
            return delete $n.selfUsed, !0;
        }
        return er;
      }, kn = Sn();
      return !kn && this.subscribers !== void 0 && this.subscribers.forEach(function(Kn) {
        Kn.onSet(Qt, Zt) && delete $n.selfUsed;
      }), kn;
    }, Object.defineProperty(_e.prototype, "keys", {
      get: function() {
        var Qt = this.get();
        if (Array.isArray(Qt))
          return Object.keys(Qt).map(function(Zt) {
            return Number(Zt);
          }).filter(function(Zt) {
            return Number.isInteger(Zt);
          });
        if (Object(Qt) === Qt)
          return Object.keys(Qt);
      },
      enumerable: !1,
      configurable: !0
    }), _e.prototype.child = function(Qt) {
      this.childrenUsed = this.childrenUsed || {};
      var Zt = this.childrenUsed.hasOwnProperty(Qt) && this.childrenUsed[Qt];
      if (Zt)
        return Zt;
      var $n = this.valueSource[Qt];
      if (typeof $n == "function")
        throw new StateInvalidUsageError(this.path, ErrorId.GetProperty_Function);
      this.childrenCreated = this.childrenCreated || {};
      var Sn = this.childrenCreated[Qt], kn;
      return Sn ? (Sn.reconstruct(this.path.concat(Qt), $n, this.valueEdition, !1), kn = Sn) : (kn = new _e(this.store, this.path.concat(Qt), $n, this.valueEdition, this.onSetUsed), this.childrenCreated[Qt] = kn), this.valueUsedNoProxy && (kn.valueUsedNoProxy = !0), this.childrenUsed[Qt] = kn, kn;
    }, _e.prototype.valueArrayImpl = function(Qt) {
      var Zt = this;
      return proxyWrap(this.path, Qt, function() {
        return Qt;
      }, function($n, Sn) {
        if (Sn === "length")
          return $n.length;
        if (Sn in Array.prototype)
          return Array.prototype[Sn];
        if (Sn === SelfMethodsID)
          return Zt;
        if (typeof Sn == "symbol")
          return $n[Sn];
        var kn = Number(Sn);
        if (Number.isInteger(kn))
          return Zt.child(kn).get();
      }, function($n, Sn, kn) {
        if (typeof Sn == "symbol")
          return $n[Sn] = kn, !0;
        throw new StateInvalidUsageError(Zt.path, ErrorId.SetProperty_Value);
      }, !0);
    }, _e.prototype.valueObjectImpl = function(Qt) {
      var Zt = this;
      return proxyWrap(this.path, Qt, function() {
        return Qt;
      }, function($n, Sn) {
        return Sn in Object.prototype ? Object.prototype[Sn] : Sn === SelfMethodsID ? Zt : typeof Sn == "symbol" ? $n[Sn] : Zt.child(Sn).get();
      }, function($n, Sn, kn) {
        if (typeof Sn == "symbol")
          return $n[Sn] = kn, !0;
        throw new StateInvalidUsageError(Zt.path, ErrorId.SetProperty_Value);
      }, !0);
    }, _e.prototype.self = function() {
      var Qt = this;
      if (this.selfUsed)
        return this.selfUsed;
      var Zt = function($n, Sn) {
        if (Sn === self$1)
          return Qt;
        if (typeof Sn != "symbol") {
          if (Sn === "toJSON")
            throw new StateInvalidUsageError(Qt.path, ErrorId.ToJson_State);
          var kn = function(er) {
            var Cr = Qt.get({ __internalAllowPromised: er === "$$typeof" || er === "constructor" });
            if (er in Object.prototype)
              return Object.prototype[er];
            if (
              // if currentValue is primitive type
              !(Object(Cr) !== Cr && // if promised, it will be none
              Cr !== none$2)
            ) {
              if (Array.isArray(Cr)) {
                if (er === "length")
                  return Cr.length;
                if (er in Array.prototype)
                  return Array.prototype[er];
                var kr = Number(er);
                return Number.isInteger(kr) ? Qt.nested(kr) : void 0;
              }
              return Qt.nested(er.toString());
            }
          };
          switch (Sn) {
            case "path":
              return Qt.path;
            case "keys":
              return Qt.keys;
            case "value":
              return Qt.value;
            case "ornull":
              return Qt.ornull;
            case "promised":
              return Qt.promised;
            case "promise":
              return Qt.promise;
            case "error":
              return Qt.error;
            case "get":
              return function(er) {
                return Qt.get(er);
              };
            case "set":
              return function(er) {
                return Qt.set(er);
              };
            case "merge":
              return function(er) {
                return Qt.merge(er);
              };
            case "nested":
              return function(er) {
                return kn(er);
              };
            default:
              var Kn = Qt.store.extension;
              return Kn && Sn in Kn ? Kn[Sn](Qt.self()) : kn(Sn);
          }
        }
      };
      return this.selfUsed = proxyWrap(this.path, this.valueSource, function($n) {
        return Qt.get({ __internalAllowPromised: !0, stealth: $n == null ? void 0 : $n.stealth });
      }, Zt, function($n, Sn, kn) {
        throw new StateInvalidUsageError(Qt.path, ErrorId.SetProperty_State);
      }, !1), this.selfUsed;
    }, Object.defineProperty(_e.prototype, "promised", {
      get: function() {
        return this.get({ __internalAllowPromised: !0 }), !!this.store.promise;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(_e.prototype, "promise", {
      get: function() {
        var Qt = this, Zt;
        return this.get({ __internalAllowPromised: !0 }), (Zt = this.store.promise) === null || Zt === void 0 ? void 0 : Zt.then(function($n) {
          return Qt.self();
        });
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(_e.prototype, "error", {
      get: function() {
        return this.get({ __internalAllowPromised: !!this.store.promiseError }), this.store.promiseError;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(_e.prototype, "ornull", {
      get: function() {
        var Qt = this.get();
        return Qt == null ? Qt : this.self();
      },
      enumerable: !1,
      configurable: !0
    }), _e;
  }()
);
function proxyWrap(_e, Qt, Zt, $n, Sn, kn) {
  var Kn = function(er) {
    throw new StateInvalidUsageError(_e, er);
  };
  return Object(Qt) !== Qt && (Qt = {}), new Proxy(Qt, {
    getPrototypeOf: function(er) {
      var Cr = Zt();
      return Cr == null ? null : Object.getPrototypeOf(Cr === none$2 ? new Promise(function() {
      }) : Cr);
    },
    setPrototypeOf: function(er, Cr) {
      return Kn(kn ? ErrorId.SetPrototypeOf_State : ErrorId.SetPrototypeOf_Value);
    },
    isExtensible: function(er) {
      return !0;
    },
    preventExtensions: function(er) {
      return Kn(kn ? ErrorId.PreventExtensions_State : ErrorId.PreventExtensions_Value);
    },
    getOwnPropertyDescriptor: function(er, Cr) {
      var kr = Zt();
      if (Object(kr) === kr) {
        var Yr = Object.getOwnPropertyDescriptor(kr, Cr);
        return Array.isArray(kr) && Cr in Array.prototype ? Yr : Yr && {
          // should be configurable as may not exist on proxy target
          configurable: !0,
          enumerable: Yr.enumerable,
          get: function() {
            return $n(kr, Cr);
          },
          set: void 0
        };
      }
      if (!(kn || kr === none$2)) {
        if (Cr === "value")
          return {
            // should be configurable as does not exist on proxy target
            configurable: !0,
            enumerable: !0,
            get: function() {
              return Zt({ stealth: !0 });
            },
            set: void 0
          };
        if (Cr === "path")
          return {
            // should be configurable as does not exist on proxy target
            configurable: !0,
            enumerable: !0,
            get: function() {
              return _e;
            },
            set: void 0
          };
      }
    },
    has: function(er, Cr) {
      if (typeof Cr == "symbol")
        return !1;
      var kr = Zt();
      return Object(kr) === kr ? Cr in kr : kn || kr === none$2 ? !1 : Cr === "value" || Cr === "path";
    },
    get: $n,
    set: Sn,
    deleteProperty: function(er, Cr) {
      return Kn(kn ? ErrorId.DeleteProperty_State : ErrorId.DeleteProperty_Value);
    },
    defineProperty: function(er, Cr, kr) {
      return Kn(kn ? ErrorId.DefineProperty_State : ErrorId.DefineProperty_Value);
    },
    ownKeys: function(er) {
      var Cr = Zt();
      return Array.isArray(Cr) && er.length === void 0 && Object.defineProperty(Qt, "length", {
        value: 0,
        writable: !0,
        enumerable: !1,
        configurable: !1
      }), Object(Cr) === Cr ? Object.getOwnPropertyNames(Cr) : kn || Cr === none$2 ? [] : ["value", "path"];
    },
    apply: function(er, Cr, kr) {
      return Kn(kn ? ErrorId.Apply_State : ErrorId.Apply_Value);
    },
    construct: function(er, Cr, kr) {
      return Kn(kn ? ErrorId.Construct_State : ErrorId.Construct_Value);
    }
  });
}
function createStore$2(_e) {
  var Qt = _e;
  if (typeof _e == "function" && (Qt = _e()), Object(Qt) === Qt && Qt[SelfMethodsID])
    throw new StateInvalidUsageError(RootPath, ErrorId.InitStateToValueFromState);
  return new Store(Qt);
}
var configuration = {
  interceptDependencyListsMode: "always",
  isDevelopmentMode: typeof process == "object" && typeof process.env == "object" && !1,
  promiseDetector: function(_e) {
    return Promise.resolve(_e) === _e;
  },
  hiddenInterceptDependencyListsModeDebug: !1
};
function reconnectDependencies(_e, Qt) {
  for (var Zt = 0, $n = _e || []; Zt < $n.length; Zt++) {
    var Sn = $n[Zt];
    if (Sn === Object(Sn)) {
      var kn = Sn[self$1];
      if (kn) {
        if (Qt && configuration.hiddenInterceptDependencyListsModeDebug)
          throw new StateInvalidUsageError(kn.path, ErrorId.StateUsedInDependencyList);
        kn.reconnect();
      }
    }
  }
  return _e;
}
var useEffectOrigin;
function useHookstateEffect(_e, Qt) {
  return reconnectDependencies(Qt), useEffectOrigin(_e, Qt);
}
function useEffectIntercept(_e, Qt) {
  return reconnectDependencies(Qt, !0), useEffectOrigin(_e, Qt);
}
var useLayoutEffectOrigin;
function useLayoutEffectIntercept(_e, Qt) {
  return reconnectDependencies(Qt, !0), useLayoutEffectOrigin(_e, Qt);
}
var useInsertionEffectOrigin;
function useInsertionEffectIntercept(_e, Qt) {
  return reconnectDependencies(Qt, !0), useInsertionEffectOrigin(_e, Qt);
}
var useImperativeHandleOrigin;
function useImperativeHandleIntercept(_e, Qt, Zt) {
  return reconnectDependencies(Zt, !0), useImperativeHandleOrigin(_e, Qt, Zt);
}
var useMemoOrigin;
function useMemoIntercept(_e, Qt) {
  return reconnectDependencies(Qt, !0), useMemoOrigin(_e, Qt);
}
var useCallbackOrigin;
function useCallbackIntercept(_e, Qt) {
  return reconnectDependencies(Qt, !0), useCallbackOrigin(_e, Qt);
}
var memoOrigin;
function memoIntercept(_e, Qt) {
  return memoOrigin(_e, function(Zt, $n) {
    return reconnectDependencies(Object.keys($n).map(function(Sn) {
      return $n[Sn];
    }), !0), (Qt || shallowEqual$2)(Zt, $n);
  });
}
function interceptReactHooks() {
  !useEffectOrigin && React.useEffect && (useEffectOrigin = React.useEffect, React.useEffect = useEffectIntercept), !useLayoutEffectOrigin && React.useLayoutEffect && (useLayoutEffectOrigin = React.useLayoutEffect, React.useLayoutEffect = useLayoutEffectIntercept), !useInsertionEffectOrigin && React.useInsertionEffect && (useInsertionEffectOrigin = React.useInsertionEffect, React.useInsertionEffect = useInsertionEffectIntercept), !useImperativeHandleOrigin && React.useImperativeHandle && (useImperativeHandleOrigin = React.useImperativeHandle, React.useImperativeHandle = useImperativeHandleIntercept), !useMemoOrigin && React.useMemo && (useMemoOrigin = React.useMemo, React.useMemo = useMemoIntercept), !useCallbackOrigin && React.useCallback && (useCallbackOrigin = React.useCallback, React.useCallback = useCallbackIntercept), !memoOrigin && React.memo && (memoOrigin = React.memo, React.memo = memoIntercept);
}
interceptReactHooks();
var useIsomorphicLayoutEffect$4 = typeof window < "u" ? useLayoutEffectOrigin : useEffectOrigin;
function localstored(_e) {
  return function() {
    var Qt, Zt, $n, Sn, kn = (_e == null ? void 0 : _e.engine) || localStorage;
    return {
      onInit: function(Kn, er) {
        if (Sn = Kn, (_e == null ? void 0 : _e.key) === void 0) {
          if (er.identifier === void 0)
            throw Error("State is missing Identifiable extension");
          Qt = er.identifier(Kn);
        } else
          Qt = _e.key;
        er.serialize !== void 0 ? Zt = er.serialize : Zt = function(kr) {
          return function() {
            return JSON.stringify(kr.get({ noproxy: !0 }));
          };
        }, er.deserialize !== void 0 ? $n = er.deserialize(Kn) : $n = function(kr) {
          return function(Yr) {
            return kr.set(JSON.parse(Yr));
          };
        };
        var Cr = kn.getItem(Qt);
        Promise.resolve(Cr).then(function(kr) {
          kr ? $n(Kn)(kr) : _e != null && _e.initializer && _e.initializer().then(function(Yr) {
            Kn.set(Yr);
          });
        });
      },
      onSet: function(Kn) {
        if (Kn.promised || Kn.error !== void 0) {
          var er = kn.removeItem(Qt);
          Promise.resolve(er).then(function() {
          });
        } else {
          var er = kn.setItem(Qt, Zt(Sn)());
          Promise.resolve(er).then(function() {
          });
        }
      }
    };
  };
}
function subscribable() {
  var _e = [], Qt;
  return function() {
    return {
      onCreate: function(Zt) {
        Qt = Zt;
        function $n(Sn, kn) {
          if (Sn.length !== kn.length)
            return !1;
          for (var Kn = 0; Kn < Sn.length; Kn += 1)
            if (Sn[Kn] !== kn[Kn])
              return !1;
          return !0;
        }
        return {
          subscribe: function(Sn) {
            return function(kn) {
              return _e.find(function(Kn) {
                return $n(Kn[0], Sn.path) && Kn[1] === kn;
              }) || _e.push([Sn.path, kn]), function() {
                var Kn = _e.findIndex(function(er) {
                  return $n(er[0], Sn.path) && er[1] === kn;
                });
                Kn !== -1 && _e.splice(Kn, 1);
              };
            };
          }
        };
      },
      onSet: function(Zt, $n) {
        function Sn(Yr, Ms) {
          if (Yr.length < Ms.length)
            return !1;
          for (var Ds = 0; Ds < Ms.length; Ds += 1)
            if (Yr[Ds] !== Ms[Ds])
              return !1;
          return !0;
        }
        function kn(Yr) {
          for (var Ms = Qt.value, Ds = 0, Ls = Yr; Ds < Ls.length; Ds++) {
            var js = Ls[Ds];
            if (Ms === void 0 || Ms == null)
              return none$2;
            Ms = Ms[js];
          }
          return Ms;
        }
        if (!(Zt.promise || Zt.error))
          for (var Kn = 0, er = _e; Kn < er.length; Kn++) {
            var Cr = er[Kn];
            if (Sn(Zt.path, Cr[0]) || Sn(Cr[0], Zt.path)) {
              var kr = kn(Cr[0]);
              kr !== none$2 && Cr[1](kr);
            }
          }
      }
    };
  };
}
var ArrayExt;
(function(_e) {
  function Qt(Pl, Iu, Tu = 0, Au = -1) {
    let Nu = Pl.length;
    if (Nu === 0)
      return -1;
    Tu < 0 ? Tu = Math.max(0, Tu + Nu) : Tu = Math.min(Tu, Nu - 1), Au < 0 ? Au = Math.max(0, Au + Nu) : Au = Math.min(Au, Nu - 1);
    let gm;
    Au < Tu ? gm = Au + 1 + (Nu - Tu) : gm = Au - Tu + 1;
    for (let pm = 0; pm < gm; ++pm) {
      let zu = (Tu + pm) % Nu;
      if (Pl[zu] === Iu)
        return zu;
    }
    return -1;
  }
  _e.firstIndexOf = Qt;
  function Zt(Pl, Iu, Tu = -1, Au = 0) {
    let Nu = Pl.length;
    if (Nu === 0)
      return -1;
    Tu < 0 ? Tu = Math.max(0, Tu + Nu) : Tu = Math.min(Tu, Nu - 1), Au < 0 ? Au = Math.max(0, Au + Nu) : Au = Math.min(Au, Nu - 1);
    let gm;
    Tu < Au ? gm = Tu + 1 + (Nu - Au) : gm = Tu - Au + 1;
    for (let pm = 0; pm < gm; ++pm) {
      let zu = (Tu - pm + Nu) % Nu;
      if (Pl[zu] === Iu)
        return zu;
    }
    return -1;
  }
  _e.lastIndexOf = Zt;
  function $n(Pl, Iu, Tu = 0, Au = -1) {
    let Nu = Pl.length;
    if (Nu === 0)
      return -1;
    Tu < 0 ? Tu = Math.max(0, Tu + Nu) : Tu = Math.min(Tu, Nu - 1), Au < 0 ? Au = Math.max(0, Au + Nu) : Au = Math.min(Au, Nu - 1);
    let gm;
    Au < Tu ? gm = Au + 1 + (Nu - Tu) : gm = Au - Tu + 1;
    for (let pm = 0; pm < gm; ++pm) {
      let zu = (Tu + pm) % Nu;
      if (Iu(Pl[zu], zu))
        return zu;
    }
    return -1;
  }
  _e.findFirstIndex = $n;
  function Sn(Pl, Iu, Tu = -1, Au = 0) {
    let Nu = Pl.length;
    if (Nu === 0)
      return -1;
    Tu < 0 ? Tu = Math.max(0, Tu + Nu) : Tu = Math.min(Tu, Nu - 1), Au < 0 ? Au = Math.max(0, Au + Nu) : Au = Math.min(Au, Nu - 1);
    let gm;
    Tu < Au ? gm = Tu + 1 + (Nu - Au) : gm = Tu - Au + 1;
    for (let pm = 0; pm < gm; ++pm) {
      let zu = (Tu - pm + Nu) % Nu;
      if (Iu(Pl[zu], zu))
        return zu;
    }
    return -1;
  }
  _e.findLastIndex = Sn;
  function kn(Pl, Iu, Tu = 0, Au = -1) {
    let Nu = $n(Pl, Iu, Tu, Au);
    return Nu !== -1 ? Pl[Nu] : void 0;
  }
  _e.findFirstValue = kn;
  function Kn(Pl, Iu, Tu = -1, Au = 0) {
    let Nu = Sn(Pl, Iu, Tu, Au);
    return Nu !== -1 ? Pl[Nu] : void 0;
  }
  _e.findLastValue = Kn;
  function er(Pl, Iu, Tu, Au = 0, Nu = -1) {
    let gm = Pl.length;
    if (gm === 0)
      return 0;
    Au < 0 ? Au = Math.max(0, Au + gm) : Au = Math.min(Au, gm - 1), Nu < 0 ? Nu = Math.max(0, Nu + gm) : Nu = Math.min(Nu, gm - 1);
    let pm = Au, zu = Nu - Au + 1;
    for (; zu > 0; ) {
      let Yu = zu >> 1, sm = pm + Yu;
      Tu(Pl[sm], Iu) < 0 ? (pm = sm + 1, zu -= Yu + 1) : zu = Yu;
    }
    return pm;
  }
  _e.lowerBound = er;
  function Cr(Pl, Iu, Tu, Au = 0, Nu = -1) {
    let gm = Pl.length;
    if (gm === 0)
      return 0;
    Au < 0 ? Au = Math.max(0, Au + gm) : Au = Math.min(Au, gm - 1), Nu < 0 ? Nu = Math.max(0, Nu + gm) : Nu = Math.min(Nu, gm - 1);
    let pm = Au, zu = Nu - Au + 1;
    for (; zu > 0; ) {
      let Yu = zu >> 1, sm = pm + Yu;
      Tu(Pl[sm], Iu) > 0 ? zu = Yu : (pm = sm + 1, zu -= Yu + 1);
    }
    return pm;
  }
  _e.upperBound = Cr;
  function kr(Pl, Iu, Tu) {
    if (Pl === Iu)
      return !0;
    if (Pl.length !== Iu.length)
      return !1;
    for (let Au = 0, Nu = Pl.length; Au < Nu; ++Au)
      if (Tu ? !Tu(Pl[Au], Iu[Au]) : Pl[Au] !== Iu[Au])
        return !1;
    return !0;
  }
  _e.shallowEqual = kr;
  function Yr(Pl, Iu = {}) {
    let { start: Tu, stop: Au, step: Nu } = Iu;
    if (Nu === void 0 && (Nu = 1), Nu === 0)
      throw new Error("Slice `step` cannot be zero.");
    let gm = Pl.length;
    Tu === void 0 ? Tu = Nu < 0 ? gm - 1 : 0 : Tu < 0 ? Tu = Math.max(Tu + gm, Nu < 0 ? -1 : 0) : Tu >= gm && (Tu = Nu < 0 ? gm - 1 : gm), Au === void 0 ? Au = Nu < 0 ? -1 : gm : Au < 0 ? Au = Math.max(Au + gm, Nu < 0 ? -1 : 0) : Au >= gm && (Au = Nu < 0 ? gm - 1 : gm);
    let pm;
    Nu < 0 && Au >= Tu || Nu > 0 && Tu >= Au ? pm = 0 : Nu < 0 ? pm = Math.floor((Au - Tu + 1) / Nu + 1) : pm = Math.floor((Au - Tu - 1) / Nu + 1);
    let zu = [];
    for (let Yu = 0; Yu < pm; ++Yu)
      zu[Yu] = Pl[Tu + Yu * Nu];
    return zu;
  }
  _e.slice = Yr;
  function Ms(Pl, Iu, Tu) {
    let Au = Pl.length;
    if (Au <= 1 || (Iu < 0 ? Iu = Math.max(0, Iu + Au) : Iu = Math.min(Iu, Au - 1), Tu < 0 ? Tu = Math.max(0, Tu + Au) : Tu = Math.min(Tu, Au - 1), Iu === Tu))
      return;
    let Nu = Pl[Iu], gm = Iu < Tu ? 1 : -1;
    for (let pm = Iu; pm !== Tu; pm += gm)
      Pl[pm] = Pl[pm + gm];
    Pl[Tu] = Nu;
  }
  _e.move = Ms;
  function Ds(Pl, Iu = 0, Tu = -1) {
    let Au = Pl.length;
    if (!(Au <= 1))
      for (Iu < 0 ? Iu = Math.max(0, Iu + Au) : Iu = Math.min(Iu, Au - 1), Tu < 0 ? Tu = Math.max(0, Tu + Au) : Tu = Math.min(Tu, Au - 1); Iu < Tu; ) {
        let Nu = Pl[Iu], gm = Pl[Tu];
        Pl[Iu++] = gm, Pl[Tu--] = Nu;
      }
  }
  _e.reverse = Ds;
  function Ls(Pl, Iu, Tu = 0, Au = -1) {
    let Nu = Pl.length;
    if (Nu <= 1 || (Tu < 0 ? Tu = Math.max(0, Tu + Nu) : Tu = Math.min(Tu, Nu - 1), Au < 0 ? Au = Math.max(0, Au + Nu) : Au = Math.min(Au, Nu - 1), Tu >= Au))
      return;
    let gm = Au - Tu + 1;
    if (Iu > 0 ? Iu = Iu % gm : Iu < 0 && (Iu = (Iu % gm + gm) % gm), Iu === 0)
      return;
    let pm = Tu + Iu;
    Ds(Pl, Tu, pm - 1), Ds(Pl, pm, Au), Ds(Pl, Tu, Au);
  }
  _e.rotate = Ls;
  function js(Pl, Iu, Tu = 0, Au = -1) {
    let Nu = Pl.length;
    if (Nu === 0)
      return;
    Tu < 0 ? Tu = Math.max(0, Tu + Nu) : Tu = Math.min(Tu, Nu - 1), Au < 0 ? Au = Math.max(0, Au + Nu) : Au = Math.min(Au, Nu - 1);
    let gm;
    Au < Tu ? gm = Au + 1 + (Nu - Tu) : gm = Au - Tu + 1;
    for (let pm = 0; pm < gm; ++pm)
      Pl[(Tu + pm) % Nu] = Iu;
  }
  _e.fill = js;
  function zs(Pl, Iu, Tu) {
    let Au = Pl.length;
    Iu < 0 ? Iu = Math.max(0, Iu + Au) : Iu = Math.min(Iu, Au);
    for (let Nu = Au; Nu > Iu; --Nu)
      Pl[Nu] = Pl[Nu - 1];
    Pl[Iu] = Tu;
  }
  _e.insert = zs;
  function Fs(Pl, Iu) {
    let Tu = Pl.length;
    if (Iu < 0 && (Iu += Tu), Iu < 0 || Iu >= Tu)
      return;
    let Au = Pl[Iu];
    for (let Nu = Iu + 1; Nu < Tu; ++Nu)
      Pl[Nu - 1] = Pl[Nu];
    return Pl.length = Tu - 1, Au;
  }
  _e.removeAt = Fs;
  function Bs(Pl, Iu, Tu = 0, Au = -1) {
    let Nu = Qt(Pl, Iu, Tu, Au);
    return Nu !== -1 && Fs(Pl, Nu), Nu;
  }
  _e.removeFirstOf = Bs;
  function Hs(Pl, Iu, Tu = -1, Au = 0) {
    let Nu = Zt(Pl, Iu, Tu, Au);
    return Nu !== -1 && Fs(Pl, Nu), Nu;
  }
  _e.removeLastOf = Hs;
  function Ws(Pl, Iu, Tu = 0, Au = -1) {
    let Nu = Pl.length;
    if (Nu === 0)
      return 0;
    Tu < 0 ? Tu = Math.max(0, Tu + Nu) : Tu = Math.min(Tu, Nu - 1), Au < 0 ? Au = Math.max(0, Au + Nu) : Au = Math.min(Au, Nu - 1);
    let gm = 0;
    for (let pm = 0; pm < Nu; ++pm)
      Tu <= Au && pm >= Tu && pm <= Au && Pl[pm] === Iu || Au < Tu && (pm <= Au || pm >= Tu) && Pl[pm] === Iu ? gm++ : gm > 0 && (Pl[pm - gm] = Pl[pm]);
    return gm > 0 && (Pl.length = Nu - gm), gm;
  }
  _e.removeAllOf = Ws;
  function Ys(Pl, Iu, Tu = 0, Au = -1) {
    let Nu, gm = $n(Pl, Iu, Tu, Au);
    return gm !== -1 && (Nu = Fs(Pl, gm)), { index: gm, value: Nu };
  }
  _e.removeFirstWhere = Ys;
  function El(Pl, Iu, Tu = -1, Au = 0) {
    let Nu, gm = Sn(Pl, Iu, Tu, Au);
    return gm !== -1 && (Nu = Fs(Pl, gm)), { index: gm, value: Nu };
  }
  _e.removeLastWhere = El;
  function Mu(Pl, Iu, Tu = 0, Au = -1) {
    let Nu = Pl.length;
    if (Nu === 0)
      return 0;
    Tu < 0 ? Tu = Math.max(0, Tu + Nu) : Tu = Math.min(Tu, Nu - 1), Au < 0 ? Au = Math.max(0, Au + Nu) : Au = Math.min(Au, Nu - 1);
    let gm = 0;
    for (let pm = 0; pm < Nu; ++pm)
      Tu <= Au && pm >= Tu && pm <= Au && Iu(Pl[pm], pm) || Au < Tu && (pm <= Au || pm >= Tu) && Iu(Pl[pm], pm) ? gm++ : gm > 0 && (Pl[pm - gm] = Pl[pm]);
    return gm > 0 && (Pl.length = Nu - gm), gm;
  }
  _e.removeAllWhere = Mu;
})(ArrayExt || (ArrayExt = {}));
function* empty$3() {
}
function find$5(_e, Qt) {
  let Zt = 0;
  for (const $n of _e)
    if (Qt($n, Zt++))
      return $n;
}
function max$5(_e, Qt) {
  let Zt;
  for (const $n of _e) {
    if (Zt === void 0) {
      Zt = $n;
      continue;
    }
    Qt($n, Zt) > 0 && (Zt = $n);
  }
  return Zt;
}
function every$1(_e, Qt) {
  let Zt = 0;
  for (const $n of _e)
    if (Qt($n, Zt++) === !1)
      return !1;
  return !0;
}
function some$1(_e, Qt) {
  let Zt = 0;
  for (const $n of _e)
    if (Qt($n, Zt++))
      return !0;
  return !1;
}
var Private$t;
(function(_e) {
  function Qt(Zt, $n, Sn) {
    return Sn === 0 ? 1 / 0 : Zt > $n && Sn > 0 || Zt < $n && Sn < 0 ? 0 : Math.ceil(($n - Zt) / Sn);
  }
  _e.rangeLength = Qt;
})(Private$t || (Private$t = {}));
function* retro(_e) {
  if (typeof _e.retro == "function")
    yield* _e.retro();
  else
    for (let Qt = _e.length - 1; Qt > -1; Qt--)
      yield _e[Qt];
}
var StringExt;
(function(_e) {
  function Qt(Kn, er, Cr = 0) {
    let kr = new Array(er.length);
    for (let Yr = 0, Ms = Cr, Ds = er.length; Yr < Ds; ++Yr, ++Ms) {
      if (Ms = Kn.indexOf(er[Yr], Ms), Ms === -1)
        return null;
      kr[Yr] = Ms;
    }
    return kr;
  }
  _e.findIndices = Qt;
  function Zt(Kn, er, Cr = 0) {
    let kr = Qt(Kn, er, Cr);
    if (!kr)
      return null;
    let Yr = 0;
    for (let Ms = 0, Ds = kr.length; Ms < Ds; ++Ms) {
      let Ls = kr[Ms] - Cr;
      Yr += Ls * Ls;
    }
    return { score: Yr, indices: kr };
  }
  _e.matchSumOfSquares = Zt;
  function $n(Kn, er, Cr = 0) {
    let kr = Qt(Kn, er, Cr);
    if (!kr)
      return null;
    let Yr = 0, Ms = Cr - 1;
    for (let Ds = 0, Ls = kr.length; Ds < Ls; ++Ds) {
      let js = kr[Ds];
      Yr += js - Ms - 1, Ms = js;
    }
    return { score: Yr, indices: kr };
  }
  _e.matchSumOfDeltas = $n;
  function Sn(Kn, er, Cr) {
    let kr = [], Yr = 0, Ms = 0, Ds = er.length;
    for (; Yr < Ds; ) {
      let Ls = er[Yr], js = er[Yr];
      for (; ++Yr < Ds && er[Yr] === js + 1; )
        js++;
      Ms < Ls && kr.push(Kn.slice(Ms, Ls)), Ls < js + 1 && kr.push(Cr(Kn.slice(Ls, js + 1))), Ms = js + 1;
    }
    return Ms < Kn.length && kr.push(Kn.slice(Ms)), kr;
  }
  _e.highlight = Sn;
  function kn(Kn, er) {
    return Kn < er ? -1 : Kn > er ? 1 : 0;
  }
  _e.cmp = kn;
})(StringExt || (StringExt = {}));
class VirtualText {
  /**
   * Construct a new virtual text node.
   *
   * @param content - The text content for the node.
   */
  constructor(Qt) {
    this.type = "text", this.content = Qt;
  }
}
class VirtualElement {
  /**
   * Construct a new virtual element node.
   *
   * @param tag - The element tag name.
   *
   * @param attrs - The element attributes.
   *
   * @param children - The element children.
   *
   * @param renderer - An optional custom renderer for the element.
   */
  constructor(Qt, Zt, $n, Sn) {
    this.type = "element", this.tag = Qt, this.attrs = Zt, this.children = $n, this.renderer = Sn;
  }
}
function h$6(_e) {
  let Qt = {}, Zt, $n = [];
  for (let kn = 1, Kn = arguments.length; kn < Kn; ++kn) {
    let er = arguments[kn];
    typeof er == "string" ? $n.push(new VirtualText(er)) : er instanceof VirtualText || er instanceof VirtualElement ? $n.push(er) : er instanceof Array ? Sn($n, er) : (kn === 1 || kn === 2) && er && typeof er == "object" && ("render" in er ? Zt = er : Qt = er);
  }
  return new VirtualElement(_e, Qt, $n, Zt);
  function Sn(kn, Kn) {
    for (let er of Kn)
      typeof er == "string" ? kn.push(new VirtualText(er)) : (er instanceof VirtualText || er instanceof VirtualElement) && kn.push(er);
  }
}
(function(_e) {
  _e.a = _e.bind(void 0, "a"), _e.abbr = _e.bind(void 0, "abbr"), _e.address = _e.bind(void 0, "address"), _e.area = _e.bind(void 0, "area"), _e.article = _e.bind(void 0, "article"), _e.aside = _e.bind(void 0, "aside"), _e.audio = _e.bind(void 0, "audio"), _e.b = _e.bind(void 0, "b"), _e.bdi = _e.bind(void 0, "bdi"), _e.bdo = _e.bind(void 0, "bdo"), _e.blockquote = _e.bind(void 0, "blockquote"), _e.br = _e.bind(void 0, "br"), _e.button = _e.bind(void 0, "button"), _e.canvas = _e.bind(void 0, "canvas"), _e.caption = _e.bind(void 0, "caption"), _e.cite = _e.bind(void 0, "cite"), _e.code = _e.bind(void 0, "code"), _e.col = _e.bind(void 0, "col"), _e.colgroup = _e.bind(void 0, "colgroup"), _e.data = _e.bind(void 0, "data"), _e.datalist = _e.bind(void 0, "datalist"), _e.dd = _e.bind(void 0, "dd"), _e.del = _e.bind(void 0, "del"), _e.dfn = _e.bind(void 0, "dfn"), _e.div = _e.bind(void 0, "div"), _e.dl = _e.bind(void 0, "dl"), _e.dt = _e.bind(void 0, "dt"), _e.em = _e.bind(void 0, "em"), _e.embed = _e.bind(void 0, "embed"), _e.fieldset = _e.bind(void 0, "fieldset"), _e.figcaption = _e.bind(void 0, "figcaption"), _e.figure = _e.bind(void 0, "figure"), _e.footer = _e.bind(void 0, "footer"), _e.form = _e.bind(void 0, "form"), _e.h1 = _e.bind(void 0, "h1"), _e.h2 = _e.bind(void 0, "h2"), _e.h3 = _e.bind(void 0, "h3"), _e.h4 = _e.bind(void 0, "h4"), _e.h5 = _e.bind(void 0, "h5"), _e.h6 = _e.bind(void 0, "h6"), _e.header = _e.bind(void 0, "header"), _e.hr = _e.bind(void 0, "hr"), _e.i = _e.bind(void 0, "i"), _e.iframe = _e.bind(void 0, "iframe"), _e.img = _e.bind(void 0, "img"), _e.input = _e.bind(void 0, "input"), _e.ins = _e.bind(void 0, "ins"), _e.kbd = _e.bind(void 0, "kbd"), _e.label = _e.bind(void 0, "label"), _e.legend = _e.bind(void 0, "legend"), _e.li = _e.bind(void 0, "li"), _e.main = _e.bind(void 0, "main"), _e.map = _e.bind(void 0, "map"), _e.mark = _e.bind(void 0, "mark"), _e.meter = _e.bind(void 0, "meter"), _e.nav = _e.bind(void 0, "nav"), _e.noscript = _e.bind(void 0, "noscript"), _e.object = _e.bind(void 0, "object"), _e.ol = _e.bind(void 0, "ol"), _e.optgroup = _e.bind(void 0, "optgroup"), _e.option = _e.bind(void 0, "option"), _e.output = _e.bind(void 0, "output"), _e.p = _e.bind(void 0, "p"), _e.param = _e.bind(void 0, "param"), _e.pre = _e.bind(void 0, "pre"), _e.progress = _e.bind(void 0, "progress"), _e.q = _e.bind(void 0, "q"), _e.rp = _e.bind(void 0, "rp"), _e.rt = _e.bind(void 0, "rt"), _e.ruby = _e.bind(void 0, "ruby"), _e.s = _e.bind(void 0, "s"), _e.samp = _e.bind(void 0, "samp"), _e.section = _e.bind(void 0, "section"), _e.select = _e.bind(void 0, "select"), _e.small = _e.bind(void 0, "small"), _e.source = _e.bind(void 0, "source"), _e.span = _e.bind(void 0, "span"), _e.strong = _e.bind(void 0, "strong"), _e.sub = _e.bind(void 0, "sub"), _e.summary = _e.bind(void 0, "summary"), _e.sup = _e.bind(void 0, "sup"), _e.table = _e.bind(void 0, "table"), _e.tbody = _e.bind(void 0, "tbody"), _e.td = _e.bind(void 0, "td"), _e.textarea = _e.bind(void 0, "textarea"), _e.tfoot = _e.bind(void 0, "tfoot"), _e.th = _e.bind(void 0, "th"), _e.thead = _e.bind(void 0, "thead"), _e.time = _e.bind(void 0, "time"), _e.title = _e.bind(void 0, "title"), _e.tr = _e.bind(void 0, "tr"), _e.track = _e.bind(void 0, "track"), _e.u = _e.bind(void 0, "u"), _e.ul = _e.bind(void 0, "ul"), _e.var_ = _e.bind(void 0, "var"), _e.video = _e.bind(void 0, "video"), _e.wbr = _e.bind(void 0, "wbr");
})(h$6 || (h$6 = {}));
var VirtualDOM;
(function(_e) {
  function Qt($n) {
    return Private$s.createDOMNode($n);
  }
  _e.realize = Qt;
  function Zt($n, Sn) {
    let kn = Private$s.hostMap.get(Sn) || [], Kn = Private$s.asContentArray($n);
    Private$s.hostMap.set(Sn, Kn), Private$s.updateContent(Sn, kn, Kn);
  }
  _e.render = Zt;
})(VirtualDOM || (VirtualDOM = {}));
var Private$s;
(function(_e) {
  _e.hostMap = /* @__PURE__ */ new WeakMap();
  function Qt(Ls) {
    return Ls ? Ls instanceof Array ? Ls : [Ls] : [];
  }
  _e.asContentArray = Qt;
  function Zt(Ls) {
    let js = arguments[1] || null;
    const zs = arguments[2] || null;
    if (js)
      js.insertBefore(Zt(Ls), zs);
    else {
      if (Ls.type === "text")
        return document.createTextNode(Ls.content);
      if (js = document.createElement(Ls.tag), Kn(js, Ls.attrs), Ls.renderer)
        return Ls.renderer.render(js, {
          attrs: Ls.attrs,
          children: Ls.children
        }), js;
      for (let Fs = 0, Bs = Ls.children.length; Fs < Bs; ++Fs)
        Zt(Ls.children[Fs], js);
    }
    return js;
  }
  _e.createDOMNode = Zt;
  function $n(Ls, js, zs) {
    if (js === zs)
      return;
    let Fs = Ds(Ls, js), Bs = js.slice(), Hs = Ls.firstChild, Ws = zs.length;
    for (let Ys = 0; Ys < Ws; ++Ys) {
      if (Ys >= Bs.length) {
        Zt(zs[Ys], Ls);
        continue;
      }
      let El = Bs[Ys], Mu = zs[Ys];
      if (El === Mu) {
        Hs = Hs.nextSibling;
        continue;
      }
      if (El.type === "text" && Mu.type === "text") {
        Hs.textContent !== Mu.content && (Hs.textContent = Mu.content), Hs = Hs.nextSibling;
        continue;
      }
      if (El.type === "text" || Mu.type === "text") {
        ArrayExt.insert(Bs, Ys, Mu), Zt(Mu, Ls, Hs);
        continue;
      }
      if (!El.renderer != !Mu.renderer) {
        ArrayExt.insert(Bs, Ys, Mu), Zt(Mu, Ls, Hs);
        continue;
      }
      let Pl = Mu.attrs.key;
      if (Pl && Pl in Fs) {
        let Tu = Fs[Pl];
        Tu.vNode !== El && (ArrayExt.move(Bs, Bs.indexOf(Tu.vNode, Ys + 1), Ys), Ls.insertBefore(Tu.element, Hs), El = Tu.vNode, Hs = Tu.element);
      }
      if (El === Mu) {
        Hs = Hs.nextSibling;
        continue;
      }
      let Iu = El.attrs.key;
      if (Iu && Iu !== Pl) {
        ArrayExt.insert(Bs, Ys, Mu), Zt(Mu, Ls, Hs);
        continue;
      }
      if (El.tag !== Mu.tag) {
        ArrayExt.insert(Bs, Ys, Mu), Zt(Mu, Ls, Hs);
        continue;
      }
      er(Hs, El.attrs, Mu.attrs), Mu.renderer ? Mu.renderer.render(Hs, {
        attrs: Mu.attrs,
        children: Mu.children
      }) : $n(Hs, El.children, Mu.children), Hs = Hs.nextSibling;
    }
    Sn(Ls, Bs, Ws, !0);
  }
  _e.updateContent = $n;
  function Sn(Ls, js, zs, Fs) {
    for (let Bs = js.length - 1; Bs >= zs; --Bs) {
      const Hs = js[Bs], Ws = Fs ? Ls.lastChild : Ls.childNodes[Bs];
      Hs.type === "text" || (Hs.renderer && Hs.renderer.unrender ? Hs.renderer.unrender(Ws, {
        attrs: Hs.attrs,
        children: Hs.children
      }) : Sn(Ws, Hs.children, 0, !1)), Fs && Ls.removeChild(Ws);
    }
  }
  const kn = {
    key: !0,
    className: !0,
    htmlFor: !0,
    dataset: !0,
    style: !0
  };
  function Kn(Ls, js) {
    for (let zs in js)
      zs in kn || (zs.substr(0, 2) === "on" ? Ls[zs] = js[zs] : Ls.setAttribute(zs, js[zs]));
    js.className !== void 0 && Ls.setAttribute("class", js.className), js.htmlFor !== void 0 && Ls.setAttribute("for", js.htmlFor), js.dataset && Cr(Ls, js.dataset), js.style && Yr(Ls, js.style);
  }
  function er(Ls, js, zs) {
    if (js === zs)
      return;
    let Fs;
    for (Fs in js)
      Fs in kn || Fs in zs || (Fs.substr(0, 2) === "on" ? Ls[Fs] = null : Ls.removeAttribute(Fs));
    for (Fs in zs)
      Fs in kn || js[Fs] === zs[Fs] || (Fs.substr(0, 2) === "on" ? Ls[Fs] = zs[Fs] : Ls.setAttribute(Fs, zs[Fs]));
    js.className !== zs.className && (zs.className !== void 0 ? Ls.setAttribute("class", zs.className) : Ls.removeAttribute("class")), js.htmlFor !== zs.htmlFor && (zs.htmlFor !== void 0 ? Ls.setAttribute("for", zs.htmlFor) : Ls.removeAttribute("for")), js.dataset !== zs.dataset && kr(Ls, js.dataset || {}, zs.dataset || {}), js.style !== zs.style && Ms(Ls, js.style || {}, zs.style || {});
  }
  function Cr(Ls, js) {
    for (let zs in js)
      Ls.setAttribute(`data-${zs}`, js[zs]);
  }
  function kr(Ls, js, zs) {
    for (let Fs in js)
      Fs in zs || Ls.removeAttribute(`data-${Fs}`);
    for (let Fs in zs)
      js[Fs] !== zs[Fs] && Ls.setAttribute(`data-${Fs}`, zs[Fs]);
  }
  function Yr(Ls, js) {
    let zs = Ls.style, Fs;
    for (Fs in js)
      zs[Fs] = js[Fs];
  }
  function Ms(Ls, js, zs) {
    let Fs = Ls.style, Bs;
    for (Bs in js)
      Bs in zs || (Fs[Bs] = "");
    for (Bs in zs)
      js[Bs] !== zs[Bs] && (Fs[Bs] = zs[Bs]);
  }
  function Ds(Ls, js) {
    let zs = Ls.firstChild, Fs = /* @__PURE__ */ Object.create(null);
    for (let Bs of js)
      Bs.type === "element" && Bs.attrs.key && (Fs[Bs.attrs.key] = { vNode: Bs, element: zs }), zs = zs.nextSibling;
    return Fs;
  }
})(Private$s || (Private$s = {}));
var lib$3 = {}, activitymonitor = {}, JSONExt;
(function(_e) {
  _e.emptyObject = Object.freeze({}), _e.emptyArray = Object.freeze([]);
  function Qt(Yr) {
    return Yr === null || typeof Yr == "boolean" || typeof Yr == "number" || typeof Yr == "string";
  }
  _e.isPrimitive = Qt;
  function Zt(Yr) {
    return Array.isArray(Yr);
  }
  _e.isArray = Zt;
  function $n(Yr) {
    return !Qt(Yr) && !Zt(Yr);
  }
  _e.isObject = $n;
  function Sn(Yr, Ms) {
    if (Yr === Ms)
      return !0;
    if (Qt(Yr) || Qt(Ms))
      return !1;
    let Ds = Zt(Yr), Ls = Zt(Ms);
    return Ds !== Ls ? !1 : Ds && Ls ? Kn(Yr, Ms) : er(Yr, Ms);
  }
  _e.deepEqual = Sn;
  function kn(Yr) {
    return Qt(Yr) ? Yr : Zt(Yr) ? Cr(Yr) : kr(Yr);
  }
  _e.deepCopy = kn;
  function Kn(Yr, Ms) {
    if (Yr === Ms)
      return !0;
    if (Yr.length !== Ms.length)
      return !1;
    for (let Ds = 0, Ls = Yr.length; Ds < Ls; ++Ds)
      if (!Sn(Yr[Ds], Ms[Ds]))
        return !1;
    return !0;
  }
  function er(Yr, Ms) {
    if (Yr === Ms)
      return !0;
    for (let Ds in Yr)
      if (Yr[Ds] !== void 0 && !(Ds in Ms))
        return !1;
    for (let Ds in Ms)
      if (Ms[Ds] !== void 0 && !(Ds in Yr))
        return !1;
    for (let Ds in Yr) {
      let Ls = Yr[Ds], js = Ms[Ds];
      if (!(Ls === void 0 && js === void 0) && (Ls === void 0 || js === void 0 || !Sn(Ls, js)))
        return !1;
    }
    return !0;
  }
  function Cr(Yr) {
    let Ms = new Array(Yr.length);
    for (let Ds = 0, Ls = Yr.length; Ds < Ls; ++Ds)
      Ms[Ds] = kn(Yr[Ds]);
    return Ms;
  }
  function kr(Yr) {
    let Ms = {};
    for (let Ds in Yr) {
      let Ls = Yr[Ds];
      Ls !== void 0 && (Ms[Ds] = kn(Ls));
    }
    return Ms;
  }
})(JSONExt || (JSONExt = {}));
class MimeData {
  constructor() {
    this._types = [], this._values = [];
  }
  /**
   * Get an array of the MIME types contained within the dataset.
   *
   * @returns A new array of the MIME types, in order of insertion.
   */
  types() {
    return this._types.slice();
  }
  /**
   * Test whether the dataset has an entry for the given type.
   *
   * @param mime - The MIME type of interest.
   *
   * @returns `true` if the dataset contains a value for the given
   *   MIME type, `false` otherwise.
   */
  hasData(Qt) {
    return this._types.indexOf(Qt) !== -1;
  }
  /**
   * Get the data value for the given MIME type.
   *
   * @param mime - The MIME type of interest.
   *
   * @returns The value for the given MIME type, or `undefined` if
   *   the dataset does not contain a value for the type.
   */
  getData(Qt) {
    let Zt = this._types.indexOf(Qt);
    return Zt !== -1 ? this._values[Zt] : void 0;
  }
  /**
   * Set the data value for the given MIME type.
   *
   * @param mime - The MIME type of interest.
   *
   * @param data - The data value for the given MIME type.
   *
   * #### Notes
   * This will overwrite any previous entry for the MIME type.
   */
  setData(Qt, Zt) {
    this.clearData(Qt), this._types.push(Qt), this._values.push(Zt);
  }
  /**
   * Remove the data entry for the given MIME type.
   *
   * @param mime - The MIME type of interest.
   *
   * #### Notes
   * This is a no-op if there is no entry for the given MIME type.
   */
  clearData(Qt) {
    let Zt = this._types.indexOf(Qt);
    Zt !== -1 && (this._types.splice(Zt, 1), this._values.splice(Zt, 1));
  }
  /**
   * Remove all data entries from the dataset.
   */
  clear() {
    this._types.length = 0, this._values.length = 0;
  }
}
class PromiseDelegate {
  /**
   * Construct a new promise delegate.
   */
  constructor() {
    this.promise = new Promise((Qt, Zt) => {
      this._resolve = Qt, this._reject = Zt;
    });
  }
  /**
   * Resolve the wrapped promise with the given value.
   *
   * @param value - The value to use for resolving the promise.
   */
  resolve(Qt) {
    let Zt = this._resolve;
    Zt(Qt);
  }
  /**
   * Reject the wrapped promise with the given value.
   *
   * @reason - The reason for rejecting the promise.
   */
  reject(Qt) {
    let Zt = this._reject;
    Zt(Qt);
  }
}
class Token {
  /**
   * Construct a new token.
   *
   * @param name - A human readable name for the token.
   * @param description - Token purpose description for documentation.
   */
  constructor(Qt, Zt) {
    this.name = Qt, this.description = Zt ?? "", this._tokenStructuralPropertyT = null;
  }
}
function fallbackRandomValues(_e) {
  let Qt = 0;
  for (let Zt = 0, $n = _e.length; Zt < $n; ++Zt)
    Zt % 4 === 0 && (Qt = Math.random() * 4294967295 >>> 0), _e[Zt] = Qt & 255, Qt >>>= 8;
}
var Random;
(function(_e) {
  _e.getRandomValues = (() => {
    const Qt = typeof window < "u" && (window.crypto || window.msCrypto) || null;
    return Qt && typeof Qt.getRandomValues == "function" ? function($n) {
      return Qt.getRandomValues($n);
    } : fallbackRandomValues;
  })();
})(Random || (Random = {}));
function uuid4Factory(_e) {
  const Qt = new Uint8Array(16), Zt = new Array(256);
  for (let $n = 0; $n < 16; ++$n)
    Zt[$n] = "0" + $n.toString(16);
  for (let $n = 16; $n < 256; ++$n)
    Zt[$n] = $n.toString(16);
  return function() {
    return _e(Qt), Qt[6] = 64 | Qt[6] & 15, Qt[8] = 128 | Qt[8] & 63, Zt[Qt[0]] + Zt[Qt[1]] + Zt[Qt[2]] + Zt[Qt[3]] + "-" + Zt[Qt[4]] + Zt[Qt[5]] + "-" + Zt[Qt[6]] + Zt[Qt[7]] + "-" + Zt[Qt[8]] + Zt[Qt[9]] + "-" + Zt[Qt[10]] + Zt[Qt[11]] + Zt[Qt[12]] + Zt[Qt[13]] + Zt[Qt[14]] + Zt[Qt[15]];
  };
}
var UUID$1;
(function(_e) {
  _e.uuid4 = uuid4Factory(Random.getRandomValues);
})(UUID$1 || (UUID$1 = {}));
const index_es6$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  get JSONExt() {
    return JSONExt;
  },
  MimeData,
  PromiseDelegate,
  get Random() {
    return Random;
  },
  Token,
  get UUID() {
    return UUID$1;
  }
}, Symbol.toStringTag, { value: "Module" }));
class Signal {
  /**
   * Construct a new signal.
   *
   * @param sender - The sender which owns the signal.
   */
  constructor(Qt) {
    this.sender = Qt;
  }
  /**
   * Connect a slot to the signal.
   *
   * @param slot - The slot to invoke when the signal is emitted.
   *
   * @param thisArg - The `this` context for the slot. If provided,
   *   this must be a non-primitive object.
   *
   * @returns `true` if the connection succeeds, `false` otherwise.
   */
  connect(Qt, Zt) {
    return Private$r.connect(this, Qt, Zt);
  }
  /**
   * Disconnect a slot from the signal.
   *
   * @param slot - The slot to disconnect from the signal.
   *
   * @param thisArg - The `this` context for the slot. If provided,
   *   this must be a non-primitive object.
   *
   * @returns `true` if the connection is removed, `false` otherwise.
   */
  disconnect(Qt, Zt) {
    return Private$r.disconnect(this, Qt, Zt);
  }
  /**
   * Emit the signal and invoke the connected slots.
   *
   * @param args - The args to pass to the connected slots.
   *
   * #### Notes
   * Slots are invoked synchronously in connection order.
   *
   * Exceptions thrown by connected slots will be caught and logged.
   */
  emit(Qt) {
    Private$r.emit(this, Qt);
  }
}
(function(_e) {
  function Qt(Cr, kr) {
    Private$r.disconnectBetween(Cr, kr);
  }
  _e.disconnectBetween = Qt;
  function Zt(Cr) {
    Private$r.disconnectSender(Cr);
  }
  _e.disconnectSender = Zt;
  function $n(Cr) {
    Private$r.disconnectReceiver(Cr);
  }
  _e.disconnectReceiver = $n;
  function Sn(Cr) {
    Private$r.disconnectAll(Cr);
  }
  _e.disconnectAll = Sn;
  function kn(Cr) {
    Private$r.disconnectAll(Cr);
  }
  _e.clearData = kn;
  function Kn() {
    return Private$r.exceptionHandler;
  }
  _e.getExceptionHandler = Kn;
  function er(Cr) {
    let kr = Private$r.exceptionHandler;
    return Private$r.exceptionHandler = Cr, kr;
  }
  _e.setExceptionHandler = er;
})(Signal || (Signal = {}));
class Stream extends Signal {
  constructor() {
    super(...arguments), this._pending = new PromiseDelegate();
  }
  /**
   * Return an async iterator that yields every emission.
   */
  async *[Symbol.asyncIterator]() {
    let Qt = this._pending;
    for (; ; )
      try {
        const { args: Zt, next: $n } = await Qt.promise;
        Qt = $n, yield Zt;
      } catch {
        return;
      }
  }
  /**
   * Emit the signal, invoke the connected slots, and yield the emission.
   *
   * @param args - The args to pass to the connected slots.
   */
  emit(Qt) {
    const Zt = this._pending, $n = this._pending = new PromiseDelegate();
    Zt.resolve({ args: Qt, next: $n }), super.emit(Qt);
  }
  /**
   * Stop the stream's async iteration.
   */
  stop() {
    this._pending.promise.catch(() => {
    }), this._pending.reject("stop"), this._pending = new PromiseDelegate();
  }
}
var Private$r;
(function(_e) {
  _e.exceptionHandler = (Hs) => {
    console.error(Hs);
  };
  function Qt(Hs, Ws, Ys) {
    Ys = Ys || void 0;
    let El = Cr.get(Hs.sender);
    if (El || (El = [], Cr.set(Hs.sender, El)), Ds(El, Hs, Ws, Ys))
      return !1;
    let Mu = Ys || Ws, Pl = kr.get(Mu);
    Pl || (Pl = [], kr.set(Mu, Pl));
    let Iu = { signal: Hs, slot: Ws, thisArg: Ys };
    return El.push(Iu), Pl.push(Iu), !0;
  }
  _e.connect = Qt;
  function Zt(Hs, Ws, Ys) {
    Ys = Ys || void 0;
    let El = Cr.get(Hs.sender);
    if (!El || El.length === 0)
      return !1;
    let Mu = Ds(El, Hs, Ws, Ys);
    if (!Mu)
      return !1;
    let Pl = Ys || Ws, Iu = kr.get(Pl);
    return Mu.signal = null, js(El), js(Iu), !0;
  }
  _e.disconnect = Zt;
  function $n(Hs, Ws) {
    let Ys = Cr.get(Hs);
    if (!Ys || Ys.length === 0)
      return;
    let El = kr.get(Ws);
    if (!(!El || El.length === 0)) {
      for (const Mu of El)
        Mu.signal && Mu.signal.sender === Hs && (Mu.signal = null);
      js(Ys), js(El);
    }
  }
  _e.disconnectBetween = $n;
  function Sn(Hs) {
    let Ws = Cr.get(Hs);
    if (!(!Ws || Ws.length === 0)) {
      for (const Ys of Ws) {
        if (!Ys.signal)
          continue;
        let El = Ys.thisArg || Ys.slot;
        Ys.signal = null, js(kr.get(El));
      }
      js(Ws);
    }
  }
  _e.disconnectSender = Sn;
  function kn(Hs) {
    let Ws = kr.get(Hs);
    if (!(!Ws || Ws.length === 0)) {
      for (const Ys of Ws) {
        if (!Ys.signal)
          continue;
        let El = Ys.signal.sender;
        Ys.signal = null, js(Cr.get(El));
      }
      js(Ws);
    }
  }
  _e.disconnectReceiver = kn;
  function Kn(Hs) {
    Sn(Hs), kn(Hs);
  }
  _e.disconnectAll = Kn;
  function er(Hs, Ws) {
    let Ys = Cr.get(Hs.sender);
    if (!(!Ys || Ys.length === 0))
      for (let El = 0, Mu = Ys.length; El < Mu; ++El) {
        let Pl = Ys[El];
        Pl.signal === Hs && Ls(Pl, Ws);
      }
  }
  _e.emit = er;
  const Cr = /* @__PURE__ */ new WeakMap(), kr = /* @__PURE__ */ new WeakMap(), Yr = /* @__PURE__ */ new Set(), Ms = (() => typeof requestAnimationFrame == "function" ? requestAnimationFrame : setImmediate)();
  function Ds(Hs, Ws, Ys, El) {
    return find$5(Hs, (Mu) => Mu.signal === Ws && Mu.slot === Ys && Mu.thisArg === El);
  }
  function Ls(Hs, Ws) {
    let { signal: Ys, slot: El, thisArg: Mu } = Hs;
    try {
      El.call(Mu, Ys.sender, Ws);
    } catch (Pl) {
      _e.exceptionHandler(Pl);
    }
  }
  function js(Hs) {
    Yr.size === 0 && Ms(zs), Yr.add(Hs);
  }
  function zs() {
    Yr.forEach(Fs), Yr.clear();
  }
  function Fs(Hs) {
    ArrayExt.removeAllWhere(Hs, Bs);
  }
  function Bs(Hs) {
    return Hs.signal === null;
  }
})(Private$r || (Private$r = {}));
const index_es6$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  get Signal() {
    return Signal;
  },
  Stream
}, Symbol.toStringTag, { value: "Module" })), require$$0$1 = /* @__PURE__ */ getAugmentedNamespace(index_es6$3);
Object.defineProperty(activitymonitor, "__esModule", { value: !0 });
activitymonitor.ActivityMonitor = void 0;
const signaling_1$5 = require$$0$1;
class ActivityMonitor {
  /**
   * Construct a new activity monitor.
   */
  constructor(Qt) {
    this._timer = -1, this._timeout = -1, this._isDisposed = !1, this._activityStopped = new signaling_1$5.Signal(this), Qt.signal.connect(this._onSignalFired, this), this._timeout = Qt.timeout || 1e3;
  }
  /**
   * A signal emitted when activity has ceased.
   */
  get activityStopped() {
    return this._activityStopped;
  }
  /**
   * The timeout associated with the monitor, in milliseconds.
   */
  get timeout() {
    return this._timeout;
  }
  set timeout(Qt) {
    this._timeout = Qt;
  }
  /**
   * Test whether the monitor has been disposed.
   *
   * #### Notes
   * This is a read-only property.
   */
  get isDisposed() {
    return this._isDisposed;
  }
  /**
   * Dispose of the resources used by the activity monitor.
   */
  dispose() {
    this._isDisposed || (this._isDisposed = !0, signaling_1$5.Signal.clearData(this));
  }
  /**
   * A signal handler for the monitored signal.
   */
  _onSignalFired(Qt, Zt) {
    clearTimeout(this._timer), this._sender = Qt, this._args = Zt, this._timer = setTimeout(() => {
      this._activityStopped.emit({
        sender: this._sender,
        args: this._args
      });
    }, this._timeout);
  }
}
activitymonitor.ActivityMonitor = ActivityMonitor;
var interfaces$1 = {};
Object.defineProperty(interfaces$1, "__esModule", { value: !0 });
var markdowncodeblocks = {};
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.MarkdownCodeBlocks = void 0, function(Qt) {
    Qt.CODE_BLOCK_MARKER = "```";
    const Zt = [
      ".markdown",
      ".mdown",
      ".mkdn",
      ".md",
      ".mkd",
      ".mdwn",
      ".mdtxt",
      ".mdtext",
      ".text",
      ".txt",
      ".Rmd"
    ];
    class $n {
      constructor(er) {
        this.startLine = er, this.code = "", this.endLine = -1;
      }
    }
    Qt.MarkdownCodeBlock = $n;
    function Sn(Kn) {
      return Zt.indexOf(Kn) > -1;
    }
    Qt.isMarkdown = Sn;
    function kn(Kn) {
      if (!Kn || Kn === "")
        return [];
      const er = Kn.split(`
`), Cr = [];
      let kr = null;
      for (let Yr = 0; Yr < er.length; Yr++) {
        const Ms = er[Yr], Ds = Ms.indexOf(Qt.CODE_BLOCK_MARKER) === 0, Ls = kr != null;
        if (!(!Ds && !Ls))
          if (Ls)
            kr && (Ds ? (kr.endLine = Yr - 1, Cr.push(kr), kr = null) : kr.code += Ms + `
`);
          else {
            kr = new $n(Yr);
            const js = Ms.indexOf(Qt.CODE_BLOCK_MARKER), zs = Ms.lastIndexOf(Qt.CODE_BLOCK_MARKER);
            js !== zs && (kr.code = Ms.substring(js + Qt.CODE_BLOCK_MARKER.length, zs), kr.endLine = Yr, Cr.push(kr), kr = null);
          }
      }
      return Cr;
    }
    Qt.findMarkdownCodeBlocks = kn;
  }(_e.MarkdownCodeBlocks || (_e.MarkdownCodeBlocks = {}));
})(markdowncodeblocks);
var pageconfig = {};
const require$$1$2 = /* @__PURE__ */ getAugmentedNamespace(index_es6$4);
function hasKey(_e, Qt) {
  var Zt = _e;
  Qt.slice(0, -1).forEach(function(Sn) {
    Zt = Zt[Sn] || {};
  });
  var $n = Qt[Qt.length - 1];
  return $n in Zt;
}
function isNumber$2(_e) {
  return typeof _e == "number" || /^0x[0-9a-f]+$/i.test(_e) ? !0 : /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(_e);
}
function isConstructorOrProto(_e, Qt) {
  return Qt === "constructor" && typeof _e[Qt] == "function" || Qt === "__proto__";
}
var minimist = function(_e, Qt) {
  Qt || (Qt = {});
  var Zt = {
    bools: {},
    strings: {},
    unknownFn: null
  };
  typeof Qt.unknown == "function" && (Zt.unknownFn = Qt.unknown), typeof Qt.boolean == "boolean" && Qt.boolean ? Zt.allBools = !0 : [].concat(Qt.boolean).filter(Boolean).forEach(function(Ys) {
    Zt.bools[Ys] = !0;
  });
  var $n = {};
  function Sn(Ys) {
    return $n[Ys].some(function(El) {
      return Zt.bools[El];
    });
  }
  Object.keys(Qt.alias || {}).forEach(function(Ys) {
    $n[Ys] = [].concat(Qt.alias[Ys]), $n[Ys].forEach(function(El) {
      $n[El] = [Ys].concat($n[Ys].filter(function(Mu) {
        return El !== Mu;
      }));
    });
  }), [].concat(Qt.string).filter(Boolean).forEach(function(Ys) {
    Zt.strings[Ys] = !0, $n[Ys] && [].concat($n[Ys]).forEach(function(El) {
      Zt.strings[El] = !0;
    });
  });
  var kn = Qt.default || {}, Kn = { _: [] };
  function er(Ys, El) {
    return Zt.allBools && /^--[^=]+$/.test(El) || Zt.strings[Ys] || Zt.bools[Ys] || $n[Ys];
  }
  function Cr(Ys, El, Mu) {
    for (var Pl = Ys, Iu = 0; Iu < El.length - 1; Iu++) {
      var Tu = El[Iu];
      if (isConstructorOrProto(Pl, Tu))
        return;
      Pl[Tu] === void 0 && (Pl[Tu] = {}), (Pl[Tu] === Object.prototype || Pl[Tu] === Number.prototype || Pl[Tu] === String.prototype) && (Pl[Tu] = {}), Pl[Tu] === Array.prototype && (Pl[Tu] = []), Pl = Pl[Tu];
    }
    var Au = El[El.length - 1];
    isConstructorOrProto(Pl, Au) || ((Pl === Object.prototype || Pl === Number.prototype || Pl === String.prototype) && (Pl = {}), Pl === Array.prototype && (Pl = []), Pl[Au] === void 0 || Zt.bools[Au] || typeof Pl[Au] == "boolean" ? Pl[Au] = Mu : Array.isArray(Pl[Au]) ? Pl[Au].push(Mu) : Pl[Au] = [Pl[Au], Mu]);
  }
  function kr(Ys, El, Mu) {
    if (!(Mu && Zt.unknownFn && !er(Ys, Mu) && Zt.unknownFn(Mu) === !1)) {
      var Pl = !Zt.strings[Ys] && isNumber$2(El) ? Number(El) : El;
      Cr(Kn, Ys.split("."), Pl), ($n[Ys] || []).forEach(function(Iu) {
        Cr(Kn, Iu.split("."), Pl);
      });
    }
  }
  Object.keys(Zt.bools).forEach(function(Ys) {
    kr(Ys, kn[Ys] === void 0 ? !1 : kn[Ys]);
  });
  var Yr = [];
  _e.indexOf("--") !== -1 && (Yr = _e.slice(_e.indexOf("--") + 1), _e = _e.slice(0, _e.indexOf("--")));
  for (var Ms = 0; Ms < _e.length; Ms++) {
    var Ds = _e[Ms], Ls, js;
    if (/^--.+=/.test(Ds)) {
      var zs = Ds.match(/^--([^=]+)=([\s\S]*)$/);
      Ls = zs[1];
      var Fs = zs[2];
      Zt.bools[Ls] && (Fs = Fs !== "false"), kr(Ls, Fs, Ds);
    } else if (/^--no-.+/.test(Ds))
      Ls = Ds.match(/^--no-(.+)/)[1], kr(Ls, !1, Ds);
    else if (/^--.+/.test(Ds))
      Ls = Ds.match(/^--(.+)/)[1], js = _e[Ms + 1], js !== void 0 && !/^(-|--)[^-]/.test(js) && !Zt.bools[Ls] && !Zt.allBools && (!$n[Ls] || !Sn(Ls)) ? (kr(Ls, js, Ds), Ms += 1) : /^(true|false)$/.test(js) ? (kr(Ls, js === "true", Ds), Ms += 1) : kr(Ls, Zt.strings[Ls] ? "" : !0, Ds);
    else if (/^-[^-]+/.test(Ds)) {
      for (var Bs = Ds.slice(1, -1).split(""), Hs = !1, Ws = 0; Ws < Bs.length; Ws++) {
        if (js = Ds.slice(Ws + 2), js === "-") {
          kr(Bs[Ws], js, Ds);
          continue;
        }
        if (/[A-Za-z]/.test(Bs[Ws]) && js[0] === "=") {
          kr(Bs[Ws], js.slice(1), Ds), Hs = !0;
          break;
        }
        if (/[A-Za-z]/.test(Bs[Ws]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(js)) {
          kr(Bs[Ws], js, Ds), Hs = !0;
          break;
        }
        if (Bs[Ws + 1] && Bs[Ws + 1].match(/\W/)) {
          kr(Bs[Ws], Ds.slice(Ws + 2), Ds), Hs = !0;
          break;
        } else
          kr(Bs[Ws], Zt.strings[Bs[Ws]] ? "" : !0, Ds);
      }
      Ls = Ds.slice(-1)[0], !Hs && Ls !== "-" && (_e[Ms + 1] && !/^(-|--)[^-]/.test(_e[Ms + 1]) && !Zt.bools[Ls] && (!$n[Ls] || !Sn(Ls)) ? (kr(Ls, _e[Ms + 1], Ds), Ms += 1) : _e[Ms + 1] && /^(true|false)$/.test(_e[Ms + 1]) ? (kr(Ls, _e[Ms + 1] === "true", Ds), Ms += 1) : kr(Ls, Zt.strings[Ls] ? "" : !0, Ds));
    } else if ((!Zt.unknownFn || Zt.unknownFn(Ds) !== !1) && Kn._.push(Zt.strings._ || !isNumber$2(Ds) ? Ds : Number(Ds)), Qt.stopEarly) {
      Kn._.push.apply(Kn._, _e.slice(Ms + 1));
      break;
    }
  }
  return Object.keys(kn).forEach(function(Ys) {
    hasKey(Kn, Ys.split(".")) || (Cr(Kn, Ys.split("."), kn[Ys]), ($n[Ys] || []).forEach(function(El) {
      Cr(Kn, El.split("."), kn[Ys]);
    }));
  }), Qt["--"] ? Kn["--"] = Yr.slice() : Yr.forEach(function(Ys) {
    Kn._.push(Ys);
  }), Kn;
}, url = {};
function assertPath(_e) {
  if (typeof _e != "string")
    throw new TypeError("Path must be a string. Received " + JSON.stringify(_e));
}
function normalizeStringPosix(_e, Qt) {
  for (var Zt = "", $n = 0, Sn = -1, kn = 0, Kn, er = 0; er <= _e.length; ++er) {
    if (er < _e.length)
      Kn = _e.charCodeAt(er);
    else {
      if (Kn === 47)
        break;
      Kn = 47;
    }
    if (Kn === 47) {
      if (!(Sn === er - 1 || kn === 1))
        if (Sn !== er - 1 && kn === 2) {
          if (Zt.length < 2 || $n !== 2 || Zt.charCodeAt(Zt.length - 1) !== 46 || Zt.charCodeAt(Zt.length - 2) !== 46) {
            if (Zt.length > 2) {
              var Cr = Zt.lastIndexOf("/");
              if (Cr !== Zt.length - 1) {
                Cr === -1 ? (Zt = "", $n = 0) : (Zt = Zt.slice(0, Cr), $n = Zt.length - 1 - Zt.lastIndexOf("/")), Sn = er, kn = 0;
                continue;
              }
            } else if (Zt.length === 2 || Zt.length === 1) {
              Zt = "", $n = 0, Sn = er, kn = 0;
              continue;
            }
          }
          Qt && (Zt.length > 0 ? Zt += "/.." : Zt = "..", $n = 2);
        } else
          Zt.length > 0 ? Zt += "/" + _e.slice(Sn + 1, er) : Zt = _e.slice(Sn + 1, er), $n = er - Sn - 1;
      Sn = er, kn = 0;
    } else
      Kn === 46 && kn !== -1 ? ++kn : kn = -1;
  }
  return Zt;
}
function _format(_e, Qt) {
  var Zt = Qt.dir || Qt.root, $n = Qt.base || (Qt.name || "") + (Qt.ext || "");
  return Zt ? Zt === Qt.root ? Zt + $n : Zt + _e + $n : $n;
}
var posix = {
  // path.resolve([from ...], to)
  resolve: function() {
    for (var Qt = "", Zt = !1, $n, Sn = arguments.length - 1; Sn >= -1 && !Zt; Sn--) {
      var kn;
      Sn >= 0 ? kn = arguments[Sn] : ($n === void 0 && ($n = process.cwd()), kn = $n), assertPath(kn), kn.length !== 0 && (Qt = kn + "/" + Qt, Zt = kn.charCodeAt(0) === 47);
    }
    return Qt = normalizeStringPosix(Qt, !Zt), Zt ? Qt.length > 0 ? "/" + Qt : "/" : Qt.length > 0 ? Qt : ".";
  },
  normalize: function(Qt) {
    if (assertPath(Qt), Qt.length === 0)
      return ".";
    var Zt = Qt.charCodeAt(0) === 47, $n = Qt.charCodeAt(Qt.length - 1) === 47;
    return Qt = normalizeStringPosix(Qt, !Zt), Qt.length === 0 && !Zt && (Qt = "."), Qt.length > 0 && $n && (Qt += "/"), Zt ? "/" + Qt : Qt;
  },
  isAbsolute: function(Qt) {
    return assertPath(Qt), Qt.length > 0 && Qt.charCodeAt(0) === 47;
  },
  join: function() {
    if (arguments.length === 0)
      return ".";
    for (var Qt, Zt = 0; Zt < arguments.length; ++Zt) {
      var $n = arguments[Zt];
      assertPath($n), $n.length > 0 && (Qt === void 0 ? Qt = $n : Qt += "/" + $n);
    }
    return Qt === void 0 ? "." : posix.normalize(Qt);
  },
  relative: function(Qt, Zt) {
    if (assertPath(Qt), assertPath(Zt), Qt === Zt || (Qt = posix.resolve(Qt), Zt = posix.resolve(Zt), Qt === Zt))
      return "";
    for (var $n = 1; $n < Qt.length && Qt.charCodeAt($n) === 47; ++$n)
      ;
    for (var Sn = Qt.length, kn = Sn - $n, Kn = 1; Kn < Zt.length && Zt.charCodeAt(Kn) === 47; ++Kn)
      ;
    for (var er = Zt.length, Cr = er - Kn, kr = kn < Cr ? kn : Cr, Yr = -1, Ms = 0; Ms <= kr; ++Ms) {
      if (Ms === kr) {
        if (Cr > kr) {
          if (Zt.charCodeAt(Kn + Ms) === 47)
            return Zt.slice(Kn + Ms + 1);
          if (Ms === 0)
            return Zt.slice(Kn + Ms);
        } else
          kn > kr && (Qt.charCodeAt($n + Ms) === 47 ? Yr = Ms : Ms === 0 && (Yr = 0));
        break;
      }
      var Ds = Qt.charCodeAt($n + Ms), Ls = Zt.charCodeAt(Kn + Ms);
      if (Ds !== Ls)
        break;
      Ds === 47 && (Yr = Ms);
    }
    var js = "";
    for (Ms = $n + Yr + 1; Ms <= Sn; ++Ms)
      (Ms === Sn || Qt.charCodeAt(Ms) === 47) && (js.length === 0 ? js += ".." : js += "/..");
    return js.length > 0 ? js + Zt.slice(Kn + Yr) : (Kn += Yr, Zt.charCodeAt(Kn) === 47 && ++Kn, Zt.slice(Kn));
  },
  _makeLong: function(Qt) {
    return Qt;
  },
  dirname: function(Qt) {
    if (assertPath(Qt), Qt.length === 0)
      return ".";
    for (var Zt = Qt.charCodeAt(0), $n = Zt === 47, Sn = -1, kn = !0, Kn = Qt.length - 1; Kn >= 1; --Kn)
      if (Zt = Qt.charCodeAt(Kn), Zt === 47) {
        if (!kn) {
          Sn = Kn;
          break;
        }
      } else
        kn = !1;
    return Sn === -1 ? $n ? "/" : "." : $n && Sn === 1 ? "//" : Qt.slice(0, Sn);
  },
  basename: function(Qt, Zt) {
    if (Zt !== void 0 && typeof Zt != "string")
      throw new TypeError('"ext" argument must be a string');
    assertPath(Qt);
    var $n = 0, Sn = -1, kn = !0, Kn;
    if (Zt !== void 0 && Zt.length > 0 && Zt.length <= Qt.length) {
      if (Zt.length === Qt.length && Zt === Qt)
        return "";
      var er = Zt.length - 1, Cr = -1;
      for (Kn = Qt.length - 1; Kn >= 0; --Kn) {
        var kr = Qt.charCodeAt(Kn);
        if (kr === 47) {
          if (!kn) {
            $n = Kn + 1;
            break;
          }
        } else
          Cr === -1 && (kn = !1, Cr = Kn + 1), er >= 0 && (kr === Zt.charCodeAt(er) ? --er === -1 && (Sn = Kn) : (er = -1, Sn = Cr));
      }
      return $n === Sn ? Sn = Cr : Sn === -1 && (Sn = Qt.length), Qt.slice($n, Sn);
    } else {
      for (Kn = Qt.length - 1; Kn >= 0; --Kn)
        if (Qt.charCodeAt(Kn) === 47) {
          if (!kn) {
            $n = Kn + 1;
            break;
          }
        } else
          Sn === -1 && (kn = !1, Sn = Kn + 1);
      return Sn === -1 ? "" : Qt.slice($n, Sn);
    }
  },
  extname: function(Qt) {
    assertPath(Qt);
    for (var Zt = -1, $n = 0, Sn = -1, kn = !0, Kn = 0, er = Qt.length - 1; er >= 0; --er) {
      var Cr = Qt.charCodeAt(er);
      if (Cr === 47) {
        if (!kn) {
          $n = er + 1;
          break;
        }
        continue;
      }
      Sn === -1 && (kn = !1, Sn = er + 1), Cr === 46 ? Zt === -1 ? Zt = er : Kn !== 1 && (Kn = 1) : Zt !== -1 && (Kn = -1);
    }
    return Zt === -1 || Sn === -1 || // We saw a non-dot character immediately before the dot
    Kn === 0 || // The (right-most) trimmed path component is exactly '..'
    Kn === 1 && Zt === Sn - 1 && Zt === $n + 1 ? "" : Qt.slice(Zt, Sn);
  },
  format: function(Qt) {
    if (Qt === null || typeof Qt != "object")
      throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof Qt);
    return _format("/", Qt);
  },
  parse: function(Qt) {
    assertPath(Qt);
    var Zt = { root: "", dir: "", base: "", ext: "", name: "" };
    if (Qt.length === 0)
      return Zt;
    var $n = Qt.charCodeAt(0), Sn = $n === 47, kn;
    Sn ? (Zt.root = "/", kn = 1) : kn = 0;
    for (var Kn = -1, er = 0, Cr = -1, kr = !0, Yr = Qt.length - 1, Ms = 0; Yr >= kn; --Yr) {
      if ($n = Qt.charCodeAt(Yr), $n === 47) {
        if (!kr) {
          er = Yr + 1;
          break;
        }
        continue;
      }
      Cr === -1 && (kr = !1, Cr = Yr + 1), $n === 46 ? Kn === -1 ? Kn = Yr : Ms !== 1 && (Ms = 1) : Kn !== -1 && (Ms = -1);
    }
    return Kn === -1 || Cr === -1 || // We saw a non-dot character immediately before the dot
    Ms === 0 || // The (right-most) trimmed path component is exactly '..'
    Ms === 1 && Kn === Cr - 1 && Kn === er + 1 ? Cr !== -1 && (er === 0 && Sn ? Zt.base = Zt.name = Qt.slice(1, Cr) : Zt.base = Zt.name = Qt.slice(er, Cr)) : (er === 0 && Sn ? (Zt.name = Qt.slice(1, Kn), Zt.base = Qt.slice(1, Cr)) : (Zt.name = Qt.slice(er, Kn), Zt.base = Qt.slice(er, Cr)), Zt.ext = Qt.slice(Kn, Cr)), er > 0 ? Zt.dir = Qt.slice(0, er - 1) : Sn && (Zt.dir = "/"), Zt;
  },
  sep: "/",
  delimiter: ":",
  win32: null,
  posix: null
};
posix.posix = posix;
var pathBrowserify = posix, requiresPort = function(Qt, Zt) {
  if (Zt = Zt.split(":")[0], Qt = +Qt, !Qt)
    return !1;
  switch (Zt) {
    case "http":
    case "ws":
      return Qt !== 80;
    case "https":
    case "wss":
      return Qt !== 443;
    case "ftp":
      return Qt !== 21;
    case "gopher":
      return Qt !== 70;
    case "file":
      return !1;
  }
  return Qt !== 0;
}, querystringify$1 = {}, has$2 = Object.prototype.hasOwnProperty, undef;
function decode(_e) {
  try {
    return decodeURIComponent(_e.replace(/\+/g, " "));
  } catch {
    return null;
  }
}
function encode$2(_e) {
  try {
    return encodeURIComponent(_e);
  } catch {
    return null;
  }
}
function querystring(_e) {
  for (var Qt = /([^=?#&]+)=?([^&]*)/g, Zt = {}, $n; $n = Qt.exec(_e); ) {
    var Sn = decode($n[1]), kn = decode($n[2]);
    Sn === null || kn === null || Sn in Zt || (Zt[Sn] = kn);
  }
  return Zt;
}
function querystringify(_e, Qt) {
  Qt = Qt || "";
  var Zt = [], $n, Sn;
  typeof Qt != "string" && (Qt = "?");
  for (Sn in _e)
    if (has$2.call(_e, Sn)) {
      if ($n = _e[Sn], !$n && ($n === null || $n === undef || isNaN($n)) && ($n = ""), Sn = encode$2(Sn), $n = encode$2($n), Sn === null || $n === null)
        continue;
      Zt.push(Sn + "=" + $n);
    }
  return Zt.length ? Qt + Zt.join("&") : "";
}
querystringify$1.stringify = querystringify;
querystringify$1.parse = querystring;
var required$1 = requiresPort, qs = querystringify$1, controlOrWhitespace = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, CRHTLF = /[\n\r\t]/g, slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, port = /:\d+$/, protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, windowsDriveLetter = /^[a-zA-Z]:/;
function trimLeft(_e) {
  return (_e || "").toString().replace(controlOrWhitespace, "");
}
var rules = [
  ["#", "hash"],
  // Extract from the back.
  ["?", "query"],
  // Extract from the back.
  function(Qt, Zt) {
    return isSpecial(Zt.protocol) ? Qt.replace(/\\/g, "/") : Qt;
  },
  ["/", "pathname"],
  // Extract from the back.
  ["@", "auth", 1],
  // Extract from the front.
  [NaN, "host", void 0, 1, 1],
  // Set left over value.
  [/:(\d*)$/, "port", void 0, 1],
  // RegExp the back.
  [NaN, "hostname", void 0, 1, 1]
  // Set left over.
], ignore = { hash: 1, query: 1 };
function lolcation(_e) {
  var Qt;
  typeof window < "u" ? Qt = window : typeof commonjsGlobal < "u" ? Qt = commonjsGlobal : typeof self < "u" ? Qt = self : Qt = {};
  var Zt = Qt.location || {};
  _e = _e || Zt;
  var $n = {}, Sn = typeof _e, kn;
  if (_e.protocol === "blob:")
    $n = new Url(unescape(_e.pathname), {});
  else if (Sn === "string") {
    $n = new Url(_e, {});
    for (kn in ignore)
      delete $n[kn];
  } else if (Sn === "object") {
    for (kn in _e)
      kn in ignore || ($n[kn] = _e[kn]);
    $n.slashes === void 0 && ($n.slashes = slashes.test(_e.href));
  }
  return $n;
}
function isSpecial(_e) {
  return _e === "file:" || _e === "ftp:" || _e === "http:" || _e === "https:" || _e === "ws:" || _e === "wss:";
}
function extractProtocol(_e, Qt) {
  _e = trimLeft(_e), _e = _e.replace(CRHTLF, ""), Qt = Qt || {};
  var Zt = protocolre.exec(_e), $n = Zt[1] ? Zt[1].toLowerCase() : "", Sn = !!Zt[2], kn = !!Zt[3], Kn = 0, er;
  return Sn ? kn ? (er = Zt[2] + Zt[3] + Zt[4], Kn = Zt[2].length + Zt[3].length) : (er = Zt[2] + Zt[4], Kn = Zt[2].length) : kn ? (er = Zt[3] + Zt[4], Kn = Zt[3].length) : er = Zt[4], $n === "file:" ? Kn >= 2 && (er = er.slice(2)) : isSpecial($n) ? er = Zt[4] : $n ? Sn && (er = er.slice(2)) : Kn >= 2 && isSpecial(Qt.protocol) && (er = Zt[4]), {
    protocol: $n,
    slashes: Sn || isSpecial($n),
    slashesCount: Kn,
    rest: er
  };
}
function resolve$1(_e, Qt) {
  if (_e === "")
    return Qt;
  for (var Zt = (Qt || "/").split("/").slice(0, -1).concat(_e.split("/")), $n = Zt.length, Sn = Zt[$n - 1], kn = !1, Kn = 0; $n--; )
    Zt[$n] === "." ? Zt.splice($n, 1) : Zt[$n] === ".." ? (Zt.splice($n, 1), Kn++) : Kn && ($n === 0 && (kn = !0), Zt.splice($n, 1), Kn--);
  return kn && Zt.unshift(""), (Sn === "." || Sn === "..") && Zt.push(""), Zt.join("/");
}
function Url(_e, Qt, Zt) {
  if (_e = trimLeft(_e), _e = _e.replace(CRHTLF, ""), !(this instanceof Url))
    return new Url(_e, Qt, Zt);
  var $n, Sn, kn, Kn, er, Cr, kr = rules.slice(), Yr = typeof Qt, Ms = this, Ds = 0;
  for (Yr !== "object" && Yr !== "string" && (Zt = Qt, Qt = null), Zt && typeof Zt != "function" && (Zt = qs.parse), Qt = lolcation(Qt), Sn = extractProtocol(_e || "", Qt), $n = !Sn.protocol && !Sn.slashes, Ms.slashes = Sn.slashes || $n && Qt.slashes, Ms.protocol = Sn.protocol || Qt.protocol || "", _e = Sn.rest, (Sn.protocol === "file:" && (Sn.slashesCount !== 2 || windowsDriveLetter.test(_e)) || !Sn.slashes && (Sn.protocol || Sn.slashesCount < 2 || !isSpecial(Ms.protocol))) && (kr[3] = [/(.*)/, "pathname"]); Ds < kr.length; Ds++) {
    if (Kn = kr[Ds], typeof Kn == "function") {
      _e = Kn(_e, Ms);
      continue;
    }
    kn = Kn[0], Cr = Kn[1], kn !== kn ? Ms[Cr] = _e : typeof kn == "string" ? (er = kn === "@" ? _e.lastIndexOf(kn) : _e.indexOf(kn), ~er && (typeof Kn[2] == "number" ? (Ms[Cr] = _e.slice(0, er), _e = _e.slice(er + Kn[2])) : (Ms[Cr] = _e.slice(er), _e = _e.slice(0, er)))) : (er = kn.exec(_e)) && (Ms[Cr] = er[1], _e = _e.slice(0, er.index)), Ms[Cr] = Ms[Cr] || $n && Kn[3] && Qt[Cr] || "", Kn[4] && (Ms[Cr] = Ms[Cr].toLowerCase());
  }
  Zt && (Ms.query = Zt(Ms.query)), $n && Qt.slashes && Ms.pathname.charAt(0) !== "/" && (Ms.pathname !== "" || Qt.pathname !== "") && (Ms.pathname = resolve$1(Ms.pathname, Qt.pathname)), Ms.pathname.charAt(0) !== "/" && isSpecial(Ms.protocol) && (Ms.pathname = "/" + Ms.pathname), required$1(Ms.port, Ms.protocol) || (Ms.host = Ms.hostname, Ms.port = ""), Ms.username = Ms.password = "", Ms.auth && (er = Ms.auth.indexOf(":"), ~er ? (Ms.username = Ms.auth.slice(0, er), Ms.username = encodeURIComponent(decodeURIComponent(Ms.username)), Ms.password = Ms.auth.slice(er + 1), Ms.password = encodeURIComponent(decodeURIComponent(Ms.password))) : Ms.username = encodeURIComponent(decodeURIComponent(Ms.auth)), Ms.auth = Ms.password ? Ms.username + ":" + Ms.password : Ms.username), Ms.origin = Ms.protocol !== "file:" && isSpecial(Ms.protocol) && Ms.host ? Ms.protocol + "//" + Ms.host : "null", Ms.href = Ms.toString();
}
function set$7(_e, Qt, Zt) {
  var $n = this;
  switch (_e) {
    case "query":
      typeof Qt == "string" && Qt.length && (Qt = (Zt || qs.parse)(Qt)), $n[_e] = Qt;
      break;
    case "port":
      $n[_e] = Qt, required$1(Qt, $n.protocol) ? Qt && ($n.host = $n.hostname + ":" + Qt) : ($n.host = $n.hostname, $n[_e] = "");
      break;
    case "hostname":
      $n[_e] = Qt, $n.port && (Qt += ":" + $n.port), $n.host = Qt;
      break;
    case "host":
      $n[_e] = Qt, port.test(Qt) ? (Qt = Qt.split(":"), $n.port = Qt.pop(), $n.hostname = Qt.join(":")) : ($n.hostname = Qt, $n.port = "");
      break;
    case "protocol":
      $n.protocol = Qt.toLowerCase(), $n.slashes = !Zt;
      break;
    case "pathname":
    case "hash":
      if (Qt) {
        var Sn = _e === "pathname" ? "/" : "#";
        $n[_e] = Qt.charAt(0) !== Sn ? Sn + Qt : Qt;
      } else
        $n[_e] = Qt;
      break;
    case "username":
    case "password":
      $n[_e] = encodeURIComponent(Qt);
      break;
    case "auth":
      var kn = Qt.indexOf(":");
      ~kn ? ($n.username = Qt.slice(0, kn), $n.username = encodeURIComponent(decodeURIComponent($n.username)), $n.password = Qt.slice(kn + 1), $n.password = encodeURIComponent(decodeURIComponent($n.password))) : $n.username = encodeURIComponent(decodeURIComponent(Qt));
  }
  for (var Kn = 0; Kn < rules.length; Kn++) {
    var er = rules[Kn];
    er[4] && ($n[er[1]] = $n[er[1]].toLowerCase());
  }
  return $n.auth = $n.password ? $n.username + ":" + $n.password : $n.username, $n.origin = $n.protocol !== "file:" && isSpecial($n.protocol) && $n.host ? $n.protocol + "//" + $n.host : "null", $n.href = $n.toString(), $n;
}
function toString$3(_e) {
  (!_e || typeof _e != "function") && (_e = qs.stringify);
  var Qt, Zt = this, $n = Zt.host, Sn = Zt.protocol;
  Sn && Sn.charAt(Sn.length - 1) !== ":" && (Sn += ":");
  var kn = Sn + (Zt.protocol && Zt.slashes || isSpecial(Zt.protocol) ? "//" : "");
  return Zt.username ? (kn += Zt.username, Zt.password && (kn += ":" + Zt.password), kn += "@") : Zt.password ? (kn += ":" + Zt.password, kn += "@") : Zt.protocol !== "file:" && isSpecial(Zt.protocol) && !$n && Zt.pathname !== "/" && (kn += "@"), ($n[$n.length - 1] === ":" || port.test(Zt.hostname) && !Zt.port) && ($n += ":"), kn += $n + Zt.pathname, Qt = typeof Zt.query == "object" ? _e(Zt.query) : Zt.query, Qt && (kn += Qt.charAt(0) !== "?" ? "?" + Qt : Qt), Zt.hash && (kn += Zt.hash), kn;
}
Url.prototype = { set: set$7, toString: toString$3 };
Url.extractProtocol = extractProtocol;
Url.location = lolcation;
Url.trimLeft = trimLeft;
Url.qs = qs;
var urlParse = Url;
(function(_e) {
  var Qt = commonjsGlobal && commonjsGlobal.__importDefault || function(Sn) {
    return Sn && Sn.__esModule ? Sn : { default: Sn };
  };
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.URLExt = void 0;
  const Zt = pathBrowserify, $n = Qt(urlParse);
  (function(Sn) {
    function kn(Ls) {
      if (typeof document < "u" && document) {
        const js = document.createElement("a");
        return js.href = Ls, js;
      }
      return (0, $n.default)(Ls);
    }
    Sn.parse = kn;
    function Kn(Ls) {
      return (0, $n.default)(Ls).hostname;
    }
    Sn.getHostName = Kn;
    function er(Ls) {
      return Ls && kn(Ls).toString();
    }
    Sn.normalize = er;
    function Cr(...Ls) {
      let js = (0, $n.default)(Ls[0], {});
      const zs = js.protocol === "" && js.slashes;
      zs && (js = (0, $n.default)(Ls[0], "https:" + Ls[0]));
      const Fs = `${zs ? "" : js.protocol}${js.slashes ? "//" : ""}${js.auth}${js.auth ? "@" : ""}${js.host}`, Bs = Zt.posix.join(`${Fs && js.pathname[0] !== "/" ? "/" : ""}${js.pathname}`, ...Ls.slice(1));
      return `${Fs}${Bs === "." ? "" : Bs}`;
    }
    Sn.join = Cr;
    function kr(Ls) {
      return Cr(...Ls.split("/").map(encodeURIComponent));
    }
    Sn.encodeParts = kr;
    function Yr(Ls) {
      const js = Object.keys(Ls).filter((zs) => zs.length > 0);
      return js.length ? "?" + js.map((zs) => {
        const Fs = encodeURIComponent(String(Ls[zs]));
        return zs + (Fs ? "=" + Fs : "");
      }).join("&") : "";
    }
    Sn.objectToQueryString = Yr;
    function Ms(Ls) {
      return Ls.replace(/^\?/, "").split("&").reduce((js, zs) => {
        const [Fs, Bs] = zs.split("=");
        return Fs.length > 0 && (js[Fs] = decodeURIComponent(Bs || "")), js;
      }, {});
    }
    Sn.queryStringToObject = Ms;
    function Ds(Ls) {
      const { protocol: js } = kn(Ls);
      return (!js || Ls.toLowerCase().indexOf(js) !== 0) && Ls.indexOf("/") !== 0;
    }
    Sn.isLocal = Ds;
  })(_e.URLExt || (_e.URLExt = {}));
})(url);
(function(exports) {
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(_e) {
    return _e && _e.__esModule ? _e : { default: _e };
  };
  Object.defineProperty(exports, "__esModule", { value: !0 }), exports.PageConfig = void 0;
  const coreutils_1 = require$$1$2, minimist_1 = __importDefault(minimist), url_1 = url;
  (function(PageConfig) {
    function getOption(name) {
      if (configData)
        return configData[name] || getBodyData(name);
      configData = /* @__PURE__ */ Object.create(null);
      let found = !1;
      if (typeof document < "u" && document) {
        const _e = document.getElementById("jupyter-config-data");
        _e && (configData = JSON.parse(_e.textContent || ""), found = !0);
      }
      if (!found && typeof process < "u" && process.argv)
        try {
          const cli = (0, minimist_1.default)(process.argv.slice(2)), path = pathBrowserify;
          let fullPath = "";
          "jupyter-config-data" in cli ? fullPath = path.resolve(cli["jupyter-config-data"]) : "JUPYTER_CONFIG_DATA" in process.env && (fullPath = path.resolve(process.env.JUPYTER_CONFIG_DATA)), fullPath && (configData = eval("require")(fullPath));
        } catch (_e) {
          console.error(_e);
        }
      if (!coreutils_1.JSONExt.isObject(configData))
        configData = /* @__PURE__ */ Object.create(null);
      else
        for (const _e in configData)
          typeof configData[_e] != "string" && (configData[_e] = JSON.stringify(configData[_e]));
      return configData[name] || getBodyData(name);
    }
    PageConfig.getOption = getOption;
    function setOption(_e, Qt) {
      const Zt = getOption(_e);
      return configData[_e] = Qt, Zt;
    }
    PageConfig.setOption = setOption;
    function getBaseUrl() {
      return url_1.URLExt.normalize(getOption("baseUrl") || "/");
    }
    PageConfig.getBaseUrl = getBaseUrl;
    function getTreeUrl() {
      return url_1.URLExt.join(getBaseUrl(), getOption("treeUrl"));
    }
    PageConfig.getTreeUrl = getTreeUrl;
    function getShareUrl() {
      return url_1.URLExt.normalize(getOption("shareUrl") || getBaseUrl());
    }
    PageConfig.getShareUrl = getShareUrl;
    function getTreeShareUrl() {
      return url_1.URLExt.normalize(url_1.URLExt.join(getShareUrl(), getOption("treeUrl")));
    }
    PageConfig.getTreeShareUrl = getTreeShareUrl;
    function getUrl(_e) {
      var Qt, Zt, $n, Sn;
      let kn = _e.toShare ? getShareUrl() : getBaseUrl();
      const Kn = (Qt = _e.mode) !== null && Qt !== void 0 ? Qt : getOption("mode"), er = (Zt = _e.workspace) !== null && Zt !== void 0 ? Zt : getOption("workspace"), Cr = Kn === "single-document" ? "doc" : "lab";
      kn = url_1.URLExt.join(kn, Cr), er !== PageConfig.defaultWorkspace && (kn = url_1.URLExt.join(kn, "workspaces", encodeURIComponent(($n = getOption("workspace")) !== null && $n !== void 0 ? $n : PageConfig.defaultWorkspace)));
      const kr = (Sn = _e.treePath) !== null && Sn !== void 0 ? Sn : getOption("treePath");
      return kr && (kn = url_1.URLExt.join(kn, "tree", url_1.URLExt.encodeParts(kr))), kn;
    }
    PageConfig.getUrl = getUrl, PageConfig.defaultWorkspace = "default";
    function getWsUrl(_e) {
      let Qt = getOption("wsUrl");
      if (!Qt) {
        if (_e = _e ? url_1.URLExt.normalize(_e) : getBaseUrl(), _e.indexOf("http") !== 0)
          return "";
        Qt = "ws" + _e.slice(4);
      }
      return url_1.URLExt.normalize(Qt);
    }
    PageConfig.getWsUrl = getWsUrl;
    function getNBConvertURL({ path: _e, format: Qt, download: Zt }) {
      const $n = url_1.URLExt.encodeParts(_e), Sn = url_1.URLExt.join(getBaseUrl(), "nbconvert", Qt, $n);
      return Zt ? Sn + "?download=true" : Sn;
    }
    PageConfig.getNBConvertURL = getNBConvertURL;
    function getToken() {
      return getOption("token") || getBodyData("jupyterApiToken");
    }
    PageConfig.getToken = getToken;
    function getNotebookVersion() {
      const _e = getOption("notebookVersion");
      return _e === "" ? [0, 0, 0] : JSON.parse(_e);
    }
    PageConfig.getNotebookVersion = getNotebookVersion;
    let configData = null;
    function getBodyData(_e) {
      if (typeof document > "u" || !document.body)
        return "";
      const Qt = document.body.dataset[_e];
      return typeof Qt > "u" ? "" : decodeURIComponent(Qt);
    }
    (function(_e) {
      function Qt(Sn) {
        try {
          const kn = getOption(Sn);
          if (kn)
            return JSON.parse(kn);
        } catch (kn) {
          console.warn(`Unable to parse ${Sn}.`, kn);
        }
        return [];
      }
      _e.deferred = Qt("deferredExtensions"), _e.disabled = Qt("disabledExtensions");
      function Zt(Sn) {
        const kn = Sn.indexOf(":");
        let Kn = "";
        return kn !== -1 && (Kn = Sn.slice(0, kn)), _e.deferred.some((er) => er === Sn || Kn && er === Kn);
      }
      _e.isDeferred = Zt;
      function $n(Sn) {
        const kn = Sn.indexOf(":");
        let Kn = "";
        return kn !== -1 && (Kn = Sn.slice(0, kn)), _e.disabled.some((er) => er === Sn || Kn && er === Kn);
      }
      _e.isDisabled = $n;
    })(PageConfig.Extension || (PageConfig.Extension = {}));
  })(exports.PageConfig || (exports.PageConfig = {}));
})(pageconfig);
var path$4 = {};
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.PathExt = void 0;
  const Qt = pathBrowserify;
  (function(Zt) {
    function $n(...Ds) {
      const Ls = Qt.posix.join(...Ds);
      return Ls === "." ? "" : Ms(Ls);
    }
    Zt.join = $n;
    function Sn(Ds, Ls) {
      return Qt.posix.basename(Ds, Ls);
    }
    Zt.basename = Sn;
    function kn(Ds) {
      const Ls = Ms(Qt.posix.dirname(Ds));
      return Ls === "." ? "" : Ls;
    }
    Zt.dirname = kn;
    function Kn(Ds) {
      return Qt.posix.extname(Ds);
    }
    Zt.extname = Kn;
    function er(Ds) {
      return Ds === "" ? "" : Ms(Qt.posix.normalize(Ds));
    }
    Zt.normalize = er;
    function Cr(...Ds) {
      return Ms(Qt.posix.resolve(...Ds));
    }
    Zt.resolve = Cr;
    function kr(Ds, Ls) {
      return Ms(Qt.posix.relative(Ds, Ls));
    }
    Zt.relative = kr;
    function Yr(Ds) {
      return Ds.length > 0 && Ds.indexOf(".") !== 0 && (Ds = `.${Ds}`), Ds;
    }
    Zt.normalizeExtension = Yr;
    function Ms(Ds) {
      return Ds.indexOf("/") === 0 && (Ds = Ds.slice(1)), Ds;
    }
    Zt.removeSlash = Ms;
  })(_e.PathExt || (_e.PathExt = {}));
})(path$4);
var signal = {};
Object.defineProperty(signal, "__esModule", { value: !0 });
signal.signalToPromise = void 0;
const coreutils_1$b = require$$1$2;
function signalToPromise(_e, Qt) {
  const Zt = new coreutils_1$b.PromiseDelegate();
  function $n() {
    _e.disconnect(Sn);
  }
  function Sn(kn, Kn) {
    $n(), Zt.resolve([kn, Kn]);
  }
  return _e.connect(Sn), (Qt ?? 0) > 0 && setTimeout(() => {
    $n(), Zt.reject(`Signal not emitted within ${Qt} ms.`);
  }, Qt), Zt.promise;
}
signal.signalToPromise = signalToPromise;
var text$4 = {};
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.Text = void 0, function(Qt) {
    const Zt = 2 > 1;
    function $n(er, Cr) {
      if (Zt)
        return er;
      let kr = er;
      for (let Yr = 0; Yr + 1 < Cr.length && Yr < er; Yr++) {
        const Ms = Cr.charCodeAt(Yr);
        if (Ms >= 55296 && Ms <= 56319) {
          const Ds = Cr.charCodeAt(Yr + 1);
          Ds >= 56320 && Ds <= 57343 && (kr--, Yr++);
        }
      }
      return kr;
    }
    Qt.jsIndexToCharIndex = $n;
    function Sn(er, Cr) {
      if (Zt)
        return er;
      let kr = er;
      for (let Yr = 0; Yr + 1 < Cr.length && Yr < kr; Yr++) {
        const Ms = Cr.charCodeAt(Yr);
        if (Ms >= 55296 && Ms <= 56319) {
          const Ds = Cr.charCodeAt(Yr + 1);
          Ds >= 56320 && Ds <= 57343 && (kr++, Yr++);
        }
      }
      return kr;
    }
    Qt.charIndexToJsIndex = Sn;
    function kn(er, Cr = !1) {
      return er.replace(/^(\w)|[\s-_:]+(\w)/g, function(kr, Yr, Ms) {
        return Ms ? Ms.toUpperCase() : Cr ? Yr.toUpperCase() : Yr.toLowerCase();
      });
    }
    Qt.camelCase = kn;
    function Kn(er) {
      return (er || "").toLowerCase().split(" ").map((Cr) => Cr.charAt(0).toUpperCase() + Cr.slice(1)).join(" ");
    }
    Qt.titleCase = Kn;
  }(_e.Text || (_e.Text = {}));
})(text$4);
var time$2 = {};
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.Time = void 0;
  const Qt = [
    { name: "years", milliseconds: 365 * 24 * 60 * 60 * 1e3 },
    { name: "months", milliseconds: 30 * 24 * 60 * 60 * 1e3 },
    { name: "days", milliseconds: 24 * 60 * 60 * 1e3 },
    { name: "hours", milliseconds: 60 * 60 * 1e3 },
    { name: "minutes", milliseconds: 60 * 1e3 },
    { name: "seconds", milliseconds: 1e3 }
  ];
  (function(Zt) {
    function $n(kn) {
      const Kn = document.documentElement.lang || "en", er = new Intl.RelativeTimeFormat(Kn, { numeric: "auto" }), Cr = new Date(kn).getTime() - Date.now();
      for (let kr of Qt) {
        const Yr = Math.ceil(Cr / kr.milliseconds);
        if (Yr !== 0)
          return er.format(Yr, kr.name);
      }
      return er.format(0, "seconds");
    }
    Zt.formatHuman = $n;
    function Sn(kn) {
      const Kn = document.documentElement.lang || "en";
      return new Intl.DateTimeFormat(Kn, {
        dateStyle: "short",
        timeStyle: "short"
      }).format(new Date(kn));
    }
    Zt.format = Sn;
  })(_e.Time || (_e.Time = {}));
})(time$2);
(function(_e) {
  var Qt = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function($n, Sn, kn, Kn) {
    Kn === void 0 && (Kn = kn);
    var er = Object.getOwnPropertyDescriptor(Sn, kn);
    (!er || ("get" in er ? !Sn.__esModule : er.writable || er.configurable)) && (er = { enumerable: !0, get: function() {
      return Sn[kn];
    } }), Object.defineProperty($n, Kn, er);
  } : function($n, Sn, kn, Kn) {
    Kn === void 0 && (Kn = kn), $n[Kn] = Sn[kn];
  }), Zt = commonjsGlobal && commonjsGlobal.__exportStar || function($n, Sn) {
    for (var kn in $n)
      kn !== "default" && !Object.prototype.hasOwnProperty.call(Sn, kn) && Qt(Sn, $n, kn);
  };
  Object.defineProperty(_e, "__esModule", { value: !0 }), Zt(activitymonitor, _e), Zt(interfaces$1, _e), Zt(markdowncodeblocks, _e), Zt(pageconfig, _e), Zt(path$4, _e), Zt(signal, _e), Zt(text$4, _e), Zt(time$2, _e), Zt(url, _e);
})(lib$3);
function _classes(_e) {
  return _e.map((Qt) => Qt && typeof Qt == "object" ? Object.keys(Qt).map((Zt) => !!Qt[Zt] && Zt) : typeof Qt == "string" ? Qt.split(/\s+/) : []).reduce((Qt, Zt) => Qt.concat(Zt), []).filter((Qt) => !!Qt);
}
function classes$1(..._e) {
  return _classes(_e).join(" ");
}
function getReactAttrs(_e, { ignore: Qt = [] } = {}) {
  return _e.getAttributeNames().reduce((Zt, $n) => ($n === "style" || Qt.includes($n) || ($n.startsWith("data") ? Zt[$n] = _e.getAttribute($n) : Zt[lib$3.Text.camelCase($n)] = _e.getAttribute($n)), Zt), {});
}
var ClipboardExt;
(function(_e) {
  function Qt(Zt) {
    const $n = document.body, Sn = (kn) => {
      kn.preventDefault(), kn.stopPropagation(), kn.clipboardData.setData("text", Zt), $n.removeEventListener("copy", Sn, !0);
    };
    $n.addEventListener("copy", Sn, !0), document.execCommand("copy");
  }
  _e.copyText = Qt;
})(ClipboardExt || (ClipboardExt = {}));
var ElementExt;
(function(_e) {
  function Qt(kn) {
    let Kn = window.getComputedStyle(kn), er = parseFloat(Kn.borderTopWidth) || 0, Cr = parseFloat(Kn.borderLeftWidth) || 0, kr = parseFloat(Kn.borderRightWidth) || 0, Yr = parseFloat(Kn.borderBottomWidth) || 0, Ms = parseFloat(Kn.paddingTop) || 0, Ds = parseFloat(Kn.paddingLeft) || 0, Ls = parseFloat(Kn.paddingRight) || 0, js = parseFloat(Kn.paddingBottom) || 0, zs = Cr + Ds + Ls + kr, Fs = er + Ms + js + Yr;
    return {
      borderTop: er,
      borderLeft: Cr,
      borderRight: kr,
      borderBottom: Yr,
      paddingTop: Ms,
      paddingLeft: Ds,
      paddingRight: Ls,
      paddingBottom: js,
      horizontalSum: zs,
      verticalSum: Fs
    };
  }
  _e.boxSizing = Qt;
  function Zt(kn) {
    let Kn = window.getComputedStyle(kn), er = parseFloat(Kn.minWidth) || 0, Cr = parseFloat(Kn.minHeight) || 0, kr = parseFloat(Kn.maxWidth) || 1 / 0, Yr = parseFloat(Kn.maxHeight) || 1 / 0;
    return kr = Math.max(er, kr), Yr = Math.max(Cr, Yr), { minWidth: er, minHeight: Cr, maxWidth: kr, maxHeight: Yr };
  }
  _e.sizeLimits = Zt;
  function $n(kn, Kn, er) {
    let Cr = kn.getBoundingClientRect();
    return Kn >= Cr.left && Kn < Cr.right && er >= Cr.top && er < Cr.bottom;
  }
  _e.hitTest = $n;
  function Sn(kn, Kn) {
    let er = kn.getBoundingClientRect(), Cr = Kn.getBoundingClientRect();
    if (!(Cr.top <= er.top && Cr.bottom >= er.bottom)) {
      if (Cr.top < er.top && Cr.height <= er.height) {
        kn.scrollTop -= er.top - Cr.top;
        return;
      }
      if (Cr.bottom > er.bottom && Cr.height >= er.height) {
        kn.scrollTop -= er.top - Cr.top;
        return;
      }
      if (Cr.top < er.top && Cr.height > er.height) {
        kn.scrollTop -= er.bottom - Cr.bottom;
        return;
      }
      if (Cr.bottom > er.bottom && Cr.height < er.height) {
        kn.scrollTop -= er.bottom - Cr.bottom;
        return;
      }
    }
  }
  _e.scrollIntoViewIfNeeded = Sn;
})(ElementExt || (ElementExt = {}));
var Platform;
(function(_e) {
  _e.IS_MAC = !!navigator.platform.match(/Mac/i), _e.IS_WIN = !!navigator.platform.match(/Win/i), _e.IS_IE = /Trident/.test(navigator.userAgent), _e.IS_EDGE = /Edge/.test(navigator.userAgent);
  function Qt(Zt) {
    return _e.IS_MAC ? Zt.metaKey : Zt.ctrlKey;
  }
  _e.accelKey = Qt;
})(Platform || (Platform = {}));
var Selector$1;
(function(_e) {
  function Qt(Sn) {
    if (Sn in Private$q.specificityCache)
      return Private$q.specificityCache[Sn];
    let kn = Private$q.calculateSingle(Sn);
    return Private$q.specificityCache[Sn] = kn;
  }
  _e.calculateSpecificity = Qt;
  function Zt(Sn) {
    if (Sn in Private$q.validityCache)
      return Private$q.validityCache[Sn];
    let kn = !0;
    try {
      Private$q.testElem.querySelector(Sn);
    } catch {
      kn = !1;
    }
    return Private$q.validityCache[Sn] = kn;
  }
  _e.isValid = Zt;
  function $n(Sn, kn) {
    return Private$q.protoMatchFunc.call(Sn, kn);
  }
  _e.matches = $n;
})(Selector$1 || (Selector$1 = {}));
var Private$q;
(function(_e) {
  _e.specificityCache = /* @__PURE__ */ Object.create(null), _e.validityCache = /* @__PURE__ */ Object.create(null), _e.testElem = document.createElement("div"), _e.protoMatchFunc = (() => {
    let Yr = Element.prototype;
    return Yr.matches || Yr.matchesSelector || Yr.mozMatchesSelector || Yr.msMatchesSelector || Yr.oMatchesSelector || Yr.webkitMatchesSelector || function(Ms) {
      let Ds = this, Ls = Ds.ownerDocument ? Ds.ownerDocument.querySelectorAll(Ms) : [];
      return Array.prototype.indexOf.call(Ls, Ds) !== -1;
    };
  })();
  function Qt(Yr) {
    Yr = Yr.split(",", 1)[0];
    let Ms = 0, Ds = 0, Ls = 0;
    function js(zs) {
      let Fs = Yr.match(zs);
      return Fs === null ? !1 : (Yr = Yr.slice(Fs[0].length), !0);
    }
    for (Yr = Yr.replace(kr, " $1 "); Yr.length > 0; ) {
      if (js(Zt)) {
        Ms++;
        continue;
      }
      if (js($n)) {
        Ds++;
        continue;
      }
      if (js(Sn)) {
        Ds++;
        continue;
      }
      if (js(Kn)) {
        Ls++;
        continue;
      }
      if (js(er)) {
        Ds++;
        continue;
      }
      if (js(kn)) {
        Ls++;
        continue;
      }
      if (!js(Cr))
        return 0;
    }
    return Ms = Math.min(Ms, 255), Ds = Math.min(Ds, 255), Ls = Math.min(Ls, 255), Ms << 16 | Ds << 8 | Ls;
  }
  _e.calculateSingle = Qt;
  const Zt = /^#[^\s\+>~#\.\[:]+/, $n = /^\.[^\s\+>~#\.\[:]+/, Sn = /^\[[^\]]+\]/, kn = /^[^\s\+>~#\.\[:]+/, Kn = /^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/, er = /^:[^\s\+>~#\.\[:]+/, Cr = /^[\s\+>~\*]+/, kr = /:not\(([^\)]+)\)/g;
})(Private$q || (Private$q = {}));
class LinkedList {
  constructor() {
    this._first = null, this._last = null, this._size = 0;
  }
  /**
   * Whether the list is empty.
   *
   * #### Complexity
   * Constant.
   */
  get isEmpty() {
    return this._size === 0;
  }
  /**
   * The size of the list.
   *
   * #### Complexity
   * `O(1)`
   *
   * #### Notes
   * This is equivalent to `length`.
   */
  get size() {
    return this._size;
  }
  /**
   * The length of the list.
   *
   * #### Complexity
   * Constant.
   *
   * #### Notes
   * This is equivalent to `size`.
   *
   * This property is deprecated.
   */
  get length() {
    return this._size;
  }
  /**
   * The first value in the list.
   *
   * This is `undefined` if the list is empty.
   *
   * #### Complexity
   * Constant.
   */
  get first() {
    return this._first ? this._first.value : void 0;
  }
  /**
   * The last value in the list.
   *
   * This is `undefined` if the list is empty.
   *
   * #### Complexity
   * Constant.
   */
  get last() {
    return this._last ? this._last.value : void 0;
  }
  /**
   * The first node in the list.
   *
   * This is `null` if the list is empty.
   *
   * #### Complexity
   * Constant.
   */
  get firstNode() {
    return this._first;
  }
  /**
   * The last node in the list.
   *
   * This is `null` if the list is empty.
   *
   * #### Complexity
   * Constant.
   */
  get lastNode() {
    return this._last;
  }
  /**
   * Create an iterator over the values in the list.
   *
   * @returns A new iterator starting with the first value.
   *
   * #### Complexity
   * Constant.
   */
  *[Symbol.iterator]() {
    let Qt = this._first;
    for (; Qt; )
      yield Qt.value, Qt = Qt.next;
  }
  /**
   * Create a reverse iterator over the values in the list.
   *
   * @returns A new iterator starting with the last value.
   *
   * #### Complexity
   * Constant.
   */
  *retro() {
    let Qt = this._last;
    for (; Qt; )
      yield Qt.value, Qt = Qt.prev;
  }
  /**
   * Create an iterator over the nodes in the list.
   *
   * @returns A new iterator starting with the first node.
   *
   * #### Complexity
   * Constant.
   */
  *nodes() {
    let Qt = this._first;
    for (; Qt; )
      yield Qt, Qt = Qt.next;
  }
  /**
   * Create a reverse iterator over the nodes in the list.
   *
   * @returns A new iterator starting with the last node.
   *
   * #### Complexity
   * Constant.
   */
  *retroNodes() {
    let Qt = this._last;
    for (; Qt; )
      yield Qt, Qt = Qt.prev;
  }
  /**
   * Assign new values to the list, replacing all current values.
   *
   * @param values - The values to assign to the list.
   *
   * #### Complexity
   * Linear.
   */
  assign(Qt) {
    this.clear();
    for (const Zt of Qt)
      this.addLast(Zt);
  }
  /**
   * Add a value to the end of the list.
   *
   * @param value - The value to add to the end of the list.
   *
   * #### Complexity
   * Constant.
   *
   * #### Notes
   * This is equivalent to `addLast`.
   */
  push(Qt) {
    this.addLast(Qt);
  }
  /**
   * Remove and return the value at the end of the list.
   *
   * @returns The removed value, or `undefined` if the list is empty.
   *
   * #### Complexity
   * Constant.
   *
   * #### Notes
   * This is equivalent to `removeLast`.
   */
  pop() {
    return this.removeLast();
  }
  /**
   * Add a value to the beginning of the list.
   *
   * @param value - The value to add to the beginning of the list.
   *
   * #### Complexity
   * Constant.
   *
   * #### Notes
   * This is equivalent to `addFirst`.
   */
  shift(Qt) {
    this.addFirst(Qt);
  }
  /**
   * Remove and return the value at the beginning of the list.
   *
   * @returns The removed value, or `undefined` if the list is empty.
   *
   * #### Complexity
   * Constant.
   *
   * #### Notes
   * This is equivalent to `removeFirst`.
   */
  unshift() {
    return this.removeFirst();
  }
  /**
   * Add a value to the beginning of the list.
   *
   * @param value - The value to add to the beginning of the list.
   *
   * @returns The list node which holds the value.
   *
   * #### Complexity
   * Constant.
   */
  addFirst(Qt) {
    let Zt = new Private$p.LinkedListNode(this, Qt);
    return this._first ? (Zt.next = this._first, this._first.prev = Zt, this._first = Zt) : (this._first = Zt, this._last = Zt), this._size++, Zt;
  }
  /**
   * Add a value to the end of the list.
   *
   * @param value - The value to add to the end of the list.
   *
   * @returns The list node which holds the value.
   *
   * #### Complexity
   * Constant.
   */
  addLast(Qt) {
    let Zt = new Private$p.LinkedListNode(this, Qt);
    return this._last ? (Zt.prev = this._last, this._last.next = Zt, this._last = Zt) : (this._first = Zt, this._last = Zt), this._size++, Zt;
  }
  /**
   * Insert a value before a specific node in the list.
   *
   * @param value - The value to insert before the reference node.
   *
   * @param ref - The reference node of interest. If this is `null`,
   *   the value will be added to the beginning of the list.
   *
   * @returns The list node which holds the value.
   *
   * #### Notes
   * The reference node must be owned by the list.
   *
   * #### Complexity
   * Constant.
   */
  insertBefore(Qt, Zt) {
    if (!Zt || Zt === this._first)
      return this.addFirst(Qt);
    if (!(Zt instanceof Private$p.LinkedListNode) || Zt.list !== this)
      throw new Error("Reference node is not owned by the list.");
    let $n = new Private$p.LinkedListNode(this, Qt), Sn = Zt, kn = Sn.prev;
    return $n.next = Sn, $n.prev = kn, Sn.prev = $n, kn.next = $n, this._size++, $n;
  }
  /**
   * Insert a value after a specific node in the list.
   *
   * @param value - The value to insert after the reference node.
   *
   * @param ref - The reference node of interest. If this is `null`,
   *   the value will be added to the end of the list.
   *
   * @returns The list node which holds the value.
   *
   * #### Notes
   * The reference node must be owned by the list.
   *
   * #### Complexity
   * Constant.
   */
  insertAfter(Qt, Zt) {
    if (!Zt || Zt === this._last)
      return this.addLast(Qt);
    if (!(Zt instanceof Private$p.LinkedListNode) || Zt.list !== this)
      throw new Error("Reference node is not owned by the list.");
    let $n = new Private$p.LinkedListNode(this, Qt), Sn = Zt, kn = Sn.next;
    return $n.next = kn, $n.prev = Sn, Sn.next = $n, kn.prev = $n, this._size++, $n;
  }
  /**
   * Remove and return the value at the beginning of the list.
   *
   * @returns The removed value, or `undefined` if the list is empty.
   *
   * #### Complexity
   * Constant.
   */
  removeFirst() {
    let Qt = this._first;
    if (Qt)
      return Qt === this._last ? (this._first = null, this._last = null) : (this._first = Qt.next, this._first.prev = null), Qt.list = null, Qt.next = null, Qt.prev = null, this._size--, Qt.value;
  }
  /**
   * Remove and return the value at the end of the list.
   *
   * @returns The removed value, or `undefined` if the list is empty.
   *
   * #### Complexity
   * Constant.
   */
  removeLast() {
    let Qt = this._last;
    if (Qt)
      return Qt === this._first ? (this._first = null, this._last = null) : (this._last = Qt.prev, this._last.next = null), Qt.list = null, Qt.next = null, Qt.prev = null, this._size--, Qt.value;
  }
  /**
   * Remove a specific node from the list.
   *
   * @param node - The node to remove from the list.
   *
   * #### Complexity
   * Constant.
   *
   * #### Notes
   * The node must be owned by the list.
   */
  removeNode(Qt) {
    if (!(Qt instanceof Private$p.LinkedListNode) || Qt.list !== this)
      throw new Error("Node is not owned by the list.");
    let Zt = Qt;
    Zt === this._first && Zt === this._last ? (this._first = null, this._last = null) : Zt === this._first ? (this._first = Zt.next, this._first.prev = null) : Zt === this._last ? (this._last = Zt.prev, this._last.next = null) : (Zt.next.prev = Zt.prev, Zt.prev.next = Zt.next), Zt.list = null, Zt.next = null, Zt.prev = null, this._size--;
  }
  /**
   * Remove all values from the list.
   *
   * #### Complexity
   * Linear.
   */
  clear() {
    let Qt = this._first;
    for (; Qt; ) {
      let Zt = Qt.next;
      Qt.list = null, Qt.prev = null, Qt.next = null, Qt = Zt;
    }
    this._first = null, this._last = null, this._size = 0;
  }
}
(function(_e) {
  function Qt(Zt) {
    let $n = new _e();
    return $n.assign(Zt), $n;
  }
  _e.from = Qt;
})(LinkedList || (LinkedList = {}));
var Private$p;
(function(_e) {
  class Qt {
    /**
     * Construct a new linked list node.
     *
     * @param list - The list which owns the node.
     *
     * @param value - The value for the link.
     */
    constructor($n, Sn) {
      this.list = null, this.next = null, this.prev = null, this.list = $n, this.value = Sn;
    }
  }
  _e.LinkedListNode = Qt;
})(Private$p || (Private$p = {}));
class Message {
  /**
   * Construct a new message.
   *
   * @param type - The type of the message.
   */
  constructor(Qt) {
    this.type = Qt;
  }
  /**
   * Test whether the message is conflatable.
   *
   * #### Notes
   * Message conflation is an advanced topic. Most message types will
   * not make use of this feature.
   *
   * If a conflatable message is posted to a handler while another
   * conflatable message of the same `type` has already been posted
   * to the handler, the `conflate()` method of the existing message
   * will be invoked. If that method returns `true`, the new message
   * will not be enqueued. This allows messages to be compressed, so
   * that only a single instance of the message type is processed per
   * cycle, no matter how many times messages of that type are posted.
   *
   * Custom message types may reimplement this property.
   *
   * The default implementation is always `false`.
   */
  get isConflatable() {
    return !1;
  }
  /**
   * Conflate this message with another message of the same `type`.
   *
   * @param other - A conflatable message of the same `type`.
   *
   * @returns `true` if the message was successfully conflated, or
   *   `false` otherwise.
   *
   * #### Notes
   * Message conflation is an advanced topic. Most message types will
   * not make use of this feature.
   *
   * This method is called automatically by the message loop when the
   * given message is posted to the handler paired with this message.
   * This message will already be enqueued and conflatable, and the
   * given message will have the same `type` and also be conflatable.
   *
   * This method should merge the state of the other message into this
   * message as needed so that when this message is finally delivered
   * to the handler, it receives the most up-to-date information.
   *
   * If this method returns `true`, it signals that the other message
   * was successfully conflated and that message will not be enqueued.
   *
   * If this method returns `false`, the other message will be enqueued
   * for normal delivery.
   *
   * Custom message types may reimplement this method.
   *
   * The default implementation always returns `false`.
   */
  conflate(Qt) {
    return !1;
  }
}
class ConflatableMessage extends Message {
  /**
   * Test whether the message is conflatable.
   *
   * #### Notes
   * This property is always `true`.
   */
  get isConflatable() {
    return !0;
  }
  /**
   * Conflate this message with another message of the same `type`.
   *
   * #### Notes
   * This method always returns `true`.
   */
  conflate(Qt) {
    return !0;
  }
}
var MessageLoop;
(function(_e) {
  let Qt = null;
  const Zt = ((Iu) => (Tu) => {
    let Au = !1;
    return Iu.then(() => !Au && Tu()), () => {
      Au = !0;
    };
  })(Promise.resolve());
  function $n(Iu, Tu) {
    let Au = Ds.get(Iu);
    if (!Au || Au.length === 0) {
      Bs(Iu, Tu);
      return;
    }
    every$1(retro(Au), (gm) => gm ? Fs(gm, Iu, Tu) : !0) && Bs(Iu, Tu);
  }
  _e.sendMessage = $n;
  function Sn(Iu, Tu) {
    if (!Tu.isConflatable) {
      Hs(Iu, Tu);
      return;
    }
    some$1(Ms, (Nu) => Nu.handler !== Iu || !Nu.msg || Nu.msg.type !== Tu.type || !Nu.msg.isConflatable ? !1 : Nu.msg.conflate(Tu)) || Hs(Iu, Tu);
  }
  _e.postMessage = Sn;
  function kn(Iu, Tu) {
    let Au = Ds.get(Iu);
    Au && Au.indexOf(Tu) !== -1 || (Au ? Au.push(Tu) : Ds.set(Iu, [Tu]));
  }
  _e.installMessageHook = kn;
  function Kn(Iu, Tu) {
    let Au = Ds.get(Iu);
    if (!Au)
      return;
    let Nu = Au.indexOf(Tu);
    Nu !== -1 && (Au[Nu] = null, Ys(Au));
  }
  _e.removeMessageHook = Kn;
  function er(Iu) {
    let Tu = Ds.get(Iu);
    Tu && Tu.length > 0 && (ArrayExt.fill(Tu, null), Ys(Tu));
    for (const Au of Ms)
      Au.handler === Iu && (Au.handler = null, Au.msg = null);
  }
  _e.clearData = er;
  function Cr() {
    zs || Qt === null || (Qt(), Qt = null, zs = !0, Ws(), zs = !1);
  }
  _e.flush = Cr;
  function kr() {
    return js;
  }
  _e.getExceptionHandler = kr;
  function Yr(Iu) {
    let Tu = js;
    return js = Iu, Tu;
  }
  _e.setExceptionHandler = Yr;
  const Ms = new LinkedList(), Ds = /* @__PURE__ */ new WeakMap(), Ls = /* @__PURE__ */ new Set();
  let js = (Iu) => {
    console.error(Iu);
  }, zs = !1;
  function Fs(Iu, Tu, Au) {
    let Nu = !0;
    try {
      typeof Iu == "function" ? Nu = Iu(Tu, Au) : Nu = Iu.messageHook(Tu, Au);
    } catch (gm) {
      js(gm);
    }
    return Nu;
  }
  function Bs(Iu, Tu) {
    try {
      Iu.processMessage(Tu);
    } catch (Au) {
      js(Au);
    }
  }
  function Hs(Iu, Tu) {
    Ms.addLast({ handler: Iu, msg: Tu }), Qt === null && (Qt = Zt(Ws));
  }
  function Ws() {
    if (Qt = null, Ms.isEmpty)
      return;
    let Iu = { handler: null, msg: null };
    for (Ms.addLast(Iu); ; ) {
      let Tu = Ms.removeFirst();
      if (Tu === Iu)
        return;
      Tu.handler && Tu.msg && $n(Tu.handler, Tu.msg);
    }
  }
  function Ys(Iu) {
    Ls.size === 0 && Zt(El), Ls.add(Iu);
  }
  function El() {
    Ls.forEach(Mu), Ls.clear();
  }
  function Mu(Iu) {
    ArrayExt.removeAllWhere(Iu, Pl);
  }
  function Pl(Iu) {
    return Iu === null;
  }
})(MessageLoop || (MessageLoop = {}));
class AttachedProperty {
  /**
   * Construct a new attached property.
   *
   * @param options - The options for initializing the property.
   */
  constructor(Qt) {
    this._pid = Private$o.nextPID(), this.name = Qt.name, this._create = Qt.create, this._coerce = Qt.coerce || null, this._compare = Qt.compare || null, this._changed = Qt.changed || null;
  }
  /**
   * Get the current value of the property for a given owner.
   *
   * @param owner - The property owner of interest.
   *
   * @returns The current value of the property.
   *
   * #### Notes
   * If the value has not yet been set, the default value will be
   * computed and assigned as the current value of the property.
   */
  get(Qt) {
    let Zt, $n = Private$o.ensureMap(Qt);
    return this._pid in $n ? Zt = $n[this._pid] : Zt = $n[this._pid] = this._createValue(Qt), Zt;
  }
  /**
   * Set the current value of the property for a given owner.
   *
   * @param owner - The property owner of interest.
   *
   * @param value - The value for the property.
   *
   * #### Notes
   * If the value has not yet been set, the default value will be
   * computed and used as the previous value for the comparison.
   */
  set(Qt, Zt) {
    let $n, Sn = Private$o.ensureMap(Qt);
    this._pid in Sn ? $n = Sn[this._pid] : $n = Sn[this._pid] = this._createValue(Qt);
    let kn = this._coerceValue(Qt, Zt);
    this._maybeNotify(Qt, $n, Sn[this._pid] = kn);
  }
  /**
   * Explicitly coerce the current property value for a given owner.
   *
   * @param owner - The property owner of interest.
   *
   * #### Notes
   * If the value has not yet been set, the default value will be
   * computed and used as the previous value for the comparison.
   */
  coerce(Qt) {
    let Zt, $n = Private$o.ensureMap(Qt);
    this._pid in $n ? Zt = $n[this._pid] : Zt = $n[this._pid] = this._createValue(Qt);
    let Sn = this._coerceValue(Qt, Zt);
    this._maybeNotify(Qt, Zt, $n[this._pid] = Sn);
  }
  /**
   * Get or create the default value for the given owner.
   */
  _createValue(Qt) {
    let Zt = this._create;
    return Zt(Qt);
  }
  /**
   * Coerce the value for the given owner.
   */
  _coerceValue(Qt, Zt) {
    let $n = this._coerce;
    return $n ? $n(Qt, Zt) : Zt;
  }
  /**
   * Compare the old value and new value for equality.
   */
  _compareValue(Qt, Zt) {
    let $n = this._compare;
    return $n ? $n(Qt, Zt) : Qt === Zt;
  }
  /**
   * Run the change notification if the given values are different.
   */
  _maybeNotify(Qt, Zt, $n) {
    let Sn = this._changed;
    Sn && !this._compareValue(Zt, $n) && Sn(Qt, Zt, $n);
  }
}
(function(_e) {
  function Qt(Zt) {
    Private$o.ownerData.delete(Zt);
  }
  _e.clearData = Qt;
})(AttachedProperty || (AttachedProperty = {}));
var Private$o;
(function(_e) {
  _e.ownerData = /* @__PURE__ */ new WeakMap(), _e.nextPID = (() => {
    let Zt = 0;
    return () => `pid-${`${Math.random()}`.slice(2)}-${Zt++}`;
  })();
  function Qt(Zt) {
    let $n = _e.ownerData.get(Zt);
    return $n || ($n = /* @__PURE__ */ Object.create(null), _e.ownerData.set(Zt, $n), $n);
  }
  _e.ensureMap = Qt;
})(Private$o || (Private$o = {}));
const index_es6$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  get AttachedProperty() {
    return AttachedProperty;
  }
}, Symbol.toStringTag, { value: "Module" }));
class DisposableDelegate {
  /**
   * Construct a new disposable delegate.
   *
   * @param fn - The callback function to invoke on dispose.
   */
  constructor(Qt) {
    this._fn = Qt;
  }
  /**
   * Test whether the delegate has been disposed.
   */
  get isDisposed() {
    return !this._fn;
  }
  /**
   * Dispose of the delegate and invoke the callback function.
   */
  dispose() {
    if (!this._fn)
      return;
    let Qt = this._fn;
    this._fn = null, Qt();
  }
}
class ObservableDisposableDelegate extends DisposableDelegate {
  constructor() {
    super(...arguments), this._disposed = new Signal(this);
  }
  /**
   * A signal emitted when the delegate is disposed.
   */
  get disposed() {
    return this._disposed;
  }
  /**
   * Dispose of the delegate and invoke the callback function.
   */
  dispose() {
    this.isDisposed || (super.dispose(), this._disposed.emit(void 0), Signal.clearData(this));
  }
}
class DisposableSet {
  constructor() {
    this._isDisposed = !1, this._items = /* @__PURE__ */ new Set();
  }
  /**
   * Test whether the set has been disposed.
   */
  get isDisposed() {
    return this._isDisposed;
  }
  /**
   * Dispose of the set and the items it contains.
   *
   * #### Notes
   * Items are disposed in the order they are added to the set.
   */
  dispose() {
    this._isDisposed || (this._isDisposed = !0, this._items.forEach((Qt) => {
      Qt.dispose();
    }), this._items.clear());
  }
  /**
   * Test whether the set contains a specific item.
   *
   * @param item - The item of interest.
   *
   * @returns `true` if the set contains the item, `false` otherwise.
   */
  contains(Qt) {
    return this._items.has(Qt);
  }
  /**
   * Add a disposable item to the set.
   *
   * @param item - The item to add to the set.
   *
   * #### Notes
   * If the item is already contained in the set, this is a no-op.
   */
  add(Qt) {
    this._items.add(Qt);
  }
  /**
   * Remove a disposable item from the set.
   *
   * @param item - The item to remove from the set.
   *
   * #### Notes
   * If the item is not contained in the set, this is a no-op.
   */
  remove(Qt) {
    this._items.delete(Qt);
  }
  /**
   * Remove all items from the set.
   */
  clear() {
    this._items.clear();
  }
}
(function(_e) {
  function Qt(Zt) {
    let $n = new _e();
    for (const Sn of Zt)
      $n.add(Sn);
    return $n;
  }
  _e.from = Qt;
})(DisposableSet || (DisposableSet = {}));
class ObservableDisposableSet extends DisposableSet {
  constructor() {
    super(...arguments), this._disposed = new Signal(this);
  }
  /**
   * A signal emitted when the set is disposed.
   */
  get disposed() {
    return this._disposed;
  }
  /**
   * Dispose of the set and the items it contains.
   *
   * #### Notes
   * Items are disposed in the order they are added to the set.
   */
  dispose() {
    this.isDisposed || (super.dispose(), this._disposed.emit(void 0), Signal.clearData(this));
  }
}
(function(_e) {
  function Qt(Zt) {
    let $n = new _e();
    for (const Sn of Zt)
      $n.add(Sn);
    return $n;
  }
  _e.from = Qt;
})(ObservableDisposableSet || (ObservableDisposableSet = {}));
const index_es6$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  DisposableDelegate,
  get DisposableSet() {
    return DisposableSet;
  },
  ObservableDisposableDelegate,
  get ObservableDisposableSet() {
    return ObservableDisposableSet;
  }
}, Symbol.toStringTag, { value: "Module" }));
class Drag {
  /**
   * Construct a new drag object.
   *
   * @param options - The options for initializing the drag.
   */
  constructor(Qt) {
    this._onScrollFrame = () => {
      if (!this._scrollTarget)
        return;
      let { element: Zt, edge: $n, distance: Sn } = this._scrollTarget, kn = Private$n.SCROLL_EDGE_SIZE - Sn, Kn = Math.pow(kn / Private$n.SCROLL_EDGE_SIZE, 2), er = Math.max(1, Math.round(Kn * Private$n.SCROLL_EDGE_SIZE));
      switch ($n) {
        case "top":
          Zt.scrollTop -= er;
          break;
        case "left":
          Zt.scrollLeft -= er;
          break;
        case "right":
          Zt.scrollLeft += er;
          break;
        case "bottom":
          Zt.scrollTop += er;
          break;
      }
      requestAnimationFrame(this._onScrollFrame);
    }, this._disposed = !1, this._dropAction = "none", this._override = null, this._currentTarget = null, this._currentElement = null, this._promise = null, this._scrollTarget = null, this._resolve = null, this.document = Qt.document || document, this.mimeData = Qt.mimeData, this.dragImage = Qt.dragImage || null, this.proposedAction = Qt.proposedAction || "copy", this.supportedActions = Qt.supportedActions || "all", this.source = Qt.source || null;
  }
  /**
   * Dispose of the resources held by the drag object.
   *
   * #### Notes
   * This will cancel the drag operation if it is active.
   */
  dispose() {
    if (!this._disposed) {
      if (this._disposed = !0, this._currentTarget) {
        let Qt = new PointerEvent("pointerup", {
          bubbles: !0,
          cancelable: !0,
          clientX: -1,
          clientY: -1
        });
        Private$n.dispatchDragLeave(this, this._currentTarget, null, Qt);
      }
      this._finalize("none");
    }
  }
  /**
   * Test whether the drag object is disposed.
   */
  get isDisposed() {
    return this._disposed;
  }
  /**
   * Start the drag operation at the specified client position.
   *
   * @param clientX - The client X position for the drag start.
   *
   * @param clientY - The client Y position for the drag start.
   *
   * @returns A promise which resolves to the result of the drag.
   *
   * #### Notes
   * If the drag has already been started, the promise created by the
   * first call to `start` is returned.
   *
   * If the drag operation has ended, or if the drag object has been
   * disposed, the returned promise will resolve to `'none'`.
   *
   * The drag object will be automatically disposed when drag operation
   * completes. This means `Drag` objects are for single-use only.
   *
   * This method assumes the left mouse button is already held down.
   */
  start(Qt, Zt) {
    if (this._disposed)
      return Promise.resolve("none");
    if (this._promise)
      return this._promise;
    this._addListeners(), this._attachDragImage(Qt, Zt), this._promise = new Promise((Sn) => {
      this._resolve = Sn;
    });
    let $n = new PointerEvent("pointermove", {
      bubbles: !0,
      cancelable: !0,
      clientX: Qt,
      clientY: Zt
    });
    return document.dispatchEvent($n), this._promise;
  }
  /**
   * Handle the DOM events for the drag operation.
   *
   * @param event - The DOM event sent to the drag object.
   *
   * #### Notes
   * This method implements the DOM `EventListener` interface and is
   * called in response to events on the document. It should not be
   * called directly by user code.
   */
  handleEvent(Qt) {
    switch (Qt.type) {
      case "pointermove":
        this._evtPointerMove(Qt);
        break;
      case "pointerup":
        this._evtPointerUp(Qt);
        break;
      case "keydown":
        this._evtKeyDown(Qt);
        break;
      default:
        Qt.preventDefault(), Qt.stopPropagation();
        break;
    }
  }
  /**
   * Move the drag image element to the specified location.
   *
   * This is a no-op if there is no drag image element.
   */
  moveDragImage(Qt, Zt) {
    if (!this.dragImage)
      return;
    let $n = this.dragImage.style;
    $n.transform = `translate(${Qt}px, ${Zt}px)`;
  }
  /**
   * Handle the `'pointermove'` event for the drag object.
   */
  _evtPointerMove(Qt) {
    Qt.preventDefault(), Qt.stopPropagation(), this._updateCurrentTarget(Qt), this._updateDragScroll(Qt), this.moveDragImage(Qt.clientX, Qt.clientY);
  }
  /**
   * Handle the `'pointerup'` event for the drag object.
   */
  _evtPointerUp(Qt) {
    if (Qt.preventDefault(), Qt.stopPropagation(), Qt.button !== 0)
      return;
    if (this._updateCurrentTarget(Qt), !this._currentTarget) {
      this._finalize("none");
      return;
    }
    if (this._dropAction === "none") {
      Private$n.dispatchDragLeave(this, this._currentTarget, null, Qt), this._finalize("none");
      return;
    }
    let Zt = Private$n.dispatchDrop(this, this._currentTarget, Qt);
    this._finalize(Zt);
  }
  /**
   * Handle the `'keydown'` event for the drag object.
   */
  _evtKeyDown(Qt) {
    Qt.preventDefault(), Qt.stopPropagation(), Qt.keyCode === 27 && this.dispose();
  }
  /**
   * Add the document event listeners for the drag object.
   */
  _addListeners() {
    document.addEventListener("pointerdown", this, !0), document.addEventListener("pointermove", this, !0), document.addEventListener("pointerup", this, !0), document.addEventListener("pointerenter", this, !0), document.addEventListener("pointerleave", this, !0), document.addEventListener("pointerover", this, !0), document.addEventListener("pointerout", this, !0), document.addEventListener("keydown", this, !0), document.addEventListener("keyup", this, !0), document.addEventListener("keypress", this, !0), document.addEventListener("contextmenu", this, !0);
  }
  /**
   * Remove the document event listeners for the drag object.
   */
  _removeListeners() {
    document.removeEventListener("pointerdown", this, !0), document.removeEventListener("pointermove", this, !0), document.removeEventListener("pointerup", this, !0), document.removeEventListener("pointerenter", this, !0), document.removeEventListener("pointerleave", this, !0), document.removeEventListener("pointerover", this, !0), document.removeEventListener("pointerout", this, !0), document.removeEventListener("keydown", this, !0), document.removeEventListener("keyup", this, !0), document.removeEventListener("keypress", this, !0), document.removeEventListener("contextmenu", this, !0);
  }
  /**
   * Update the drag scroll element under the mouse.
   */
  _updateDragScroll(Qt) {
    let Zt = Private$n.findScrollTarget(Qt);
    !this._scrollTarget && !Zt || (this._scrollTarget || setTimeout(this._onScrollFrame, 500), this._scrollTarget = Zt);
  }
  /**
   * Update the current target node using the given mouse event.
   */
  _updateCurrentTarget(Qt) {
    let Zt = this._currentTarget, $n = this._currentTarget, Sn = this._currentElement, kn = Private$n.findElementBehidBackdrop(Qt, this.document);
    this._currentElement = kn, kn !== Sn && kn !== $n && Private$n.dispatchDragExit(this, $n, kn, Qt), kn !== Sn && kn !== $n && ($n = Private$n.dispatchDragEnter(this, kn, $n, Qt)), $n !== Zt && (this._currentTarget = $n, Private$n.dispatchDragLeave(this, Zt, $n, Qt));
    let Kn = Private$n.dispatchDragOver(this, $n, Qt);
    this._setDropAction(Kn);
  }
  /**
   * Attach the drag image element at the specified location.
   *
   * This is a no-op if there is no drag image element.
   */
  _attachDragImage(Qt, Zt) {
    if (!this.dragImage)
      return;
    this.dragImage.classList.add("lm-mod-drag-image");
    let $n = this.dragImage.style;
    $n.pointerEvents = "none", $n.position = "fixed", $n.transform = `translate(${Qt}px, ${Zt}px)`, (this.document instanceof Document ? this.document.body : this.document.firstElementChild).appendChild(this.dragImage);
  }
  /**
   * Detach the drag image element from the DOM.
   *
   * This is a no-op if there is no drag image element.
   */
  _detachDragImage() {
    if (!this.dragImage)
      return;
    let Qt = this.dragImage.parentNode;
    Qt && Qt.removeChild(this.dragImage);
  }
  /**
   * Set the internal drop action state and update the drag cursor.
   */
  _setDropAction(Qt) {
    if (Qt = Private$n.validateAction(Qt, this.supportedActions), !(this._override && this._dropAction === Qt))
      switch (Qt) {
        case "none":
          this._dropAction = Qt, this._override = Drag.overrideCursor("no-drop", this.document);
          break;
        case "copy":
          this._dropAction = Qt, this._override = Drag.overrideCursor("copy", this.document);
          break;
        case "link":
          this._dropAction = Qt, this._override = Drag.overrideCursor("alias", this.document);
          break;
        case "move":
          this._dropAction = Qt, this._override = Drag.overrideCursor("move", this.document);
          break;
      }
  }
  /**
   * Finalize the drag operation and resolve the drag promise.
   */
  _finalize(Qt) {
    let Zt = this._resolve;
    this._removeListeners(), this._detachDragImage(), this._override && (this._override.dispose(), this._override = null), this.mimeData.clear(), this._disposed = !0, this._dropAction = "none", this._currentTarget = null, this._currentElement = null, this._scrollTarget = null, this._promise = null, this._resolve = null, Zt && Zt(Qt);
  }
}
(function(_e) {
  class Qt extends DragEvent {
    constructor(Sn, kn) {
      super(kn.type, {
        bubbles: !0,
        cancelable: !0,
        altKey: Sn.altKey,
        button: Sn.button,
        clientX: Sn.clientX,
        clientY: Sn.clientY,
        ctrlKey: Sn.ctrlKey,
        detail: 0,
        metaKey: Sn.metaKey,
        relatedTarget: kn.related,
        screenX: Sn.screenX,
        screenY: Sn.screenY,
        shiftKey: Sn.shiftKey,
        view: window
      });
      const { drag: Kn } = kn;
      this.dropAction = "none", this.mimeData = Kn.mimeData, this.proposedAction = Kn.proposedAction, this.supportedActions = Kn.supportedActions, this.source = Kn.source;
    }
  }
  _e.Event = Qt;
  function Zt($n, Sn = document) {
    return Private$n.overrideCursor($n, Sn);
  }
  _e.overrideCursor = Zt;
})(Drag || (Drag = {}));
var Private$n;
(function(_e) {
  _e.SCROLL_EDGE_SIZE = 20;
  function Qt(Fs, Bs) {
    return Yr[Fs] & Ms[Bs] ? Fs : "none";
  }
  _e.validateAction = Qt;
  function Zt(Fs, Bs = document) {
    if ($n && Fs == $n.event)
      return $n.element;
    _e.cursorBackdrop.style.zIndex = "-1000";
    const Hs = Bs.elementFromPoint(Fs.clientX, Fs.clientY);
    return _e.cursorBackdrop.style.zIndex = "", $n = { event: Fs, element: Hs }, Hs;
  }
  _e.findElementBehidBackdrop = Zt;
  let $n = null;
  function Sn(Fs) {
    let Bs = Fs.clientX, Hs = Fs.clientY, Ws = Zt(Fs);
    for (; Ws; Ws = Ws.parentElement) {
      if (!Ws.hasAttribute("data-lm-dragscroll"))
        continue;
      let Ys = 0, El = 0;
      Ws === document.body && (Ys = window.pageXOffset, El = window.pageYOffset);
      let Mu = Ws.getBoundingClientRect(), Pl = Mu.top + El, Iu = Mu.left + Ys, Tu = Iu + Mu.width, Au = Pl + Mu.height;
      if (Bs < Iu || Bs >= Tu || Hs < Pl || Hs >= Au)
        continue;
      let Nu = Bs - Iu + 1, gm = Hs - Pl + 1, pm = Tu - Bs, zu = Au - Hs, Yu = Math.min(Nu, gm, pm, zu);
      if (Yu > _e.SCROLL_EDGE_SIZE)
        continue;
      let sm;
      switch (Yu) {
        case zu:
          sm = "bottom";
          break;
        case gm:
          sm = "top";
          break;
        case pm:
          sm = "right";
          break;
        case Nu:
          sm = "left";
          break;
        default:
          throw "unreachable";
      }
      let mm = Ws.scrollWidth - Ws.clientWidth, hm = Ws.scrollHeight - Ws.clientHeight, ym;
      switch (sm) {
        case "top":
          ym = hm > 0 && Ws.scrollTop > 0;
          break;
        case "left":
          ym = mm > 0 && Ws.scrollLeft > 0;
          break;
        case "right":
          ym = mm > 0 && Ws.scrollLeft < mm;
          break;
        case "bottom":
          ym = hm > 0 && Ws.scrollTop < hm;
          break;
        default:
          throw "unreachable";
      }
      if (ym)
        return { element: Ws, edge: sm, distance: Yu };
    }
    return null;
  }
  _e.findScrollTarget = Sn;
  function kn(Fs, Bs, Hs, Ws) {
    if (!Bs)
      return null;
    let Ys = new Drag.Event(Ws, {
      drag: Fs,
      related: Hs,
      type: "lm-dragenter"
    });
    if (!Bs.dispatchEvent(Ys))
      return Bs;
    const Mu = Fs.document instanceof Document ? Fs.document.body : Fs.document.firstElementChild;
    return Bs === Mu ? Hs : (Ys = new Drag.Event(Ws, {
      drag: Fs,
      related: Hs,
      type: "lm-dragenter"
    }), Mu.dispatchEvent(Ys), Mu);
  }
  _e.dispatchDragEnter = kn;
  function Kn(Fs, Bs, Hs, Ws) {
    if (!Bs)
      return;
    let Ys = new Drag.Event(Ws, {
      drag: Fs,
      related: Hs,
      type: "lm-dragexit"
    });
    Bs.dispatchEvent(Ys);
  }
  _e.dispatchDragExit = Kn;
  function er(Fs, Bs, Hs, Ws) {
    if (!Bs)
      return;
    let Ys = new Drag.Event(Ws, {
      drag: Fs,
      related: Hs,
      type: "lm-dragleave"
    });
    Bs.dispatchEvent(Ys);
  }
  _e.dispatchDragLeave = er;
  function Cr(Fs, Bs, Hs) {
    if (!Bs)
      return "none";
    let Ws = new Drag.Event(Hs, {
      drag: Fs,
      related: null,
      type: "lm-dragover"
    });
    return Bs.dispatchEvent(Ws) ? "none" : Ws.dropAction;
  }
  _e.dispatchDragOver = Cr;
  function kr(Fs, Bs, Hs) {
    if (!Bs)
      return "none";
    let Ws = new Drag.Event(Hs, {
      drag: Fs,
      related: null,
      type: "lm-drop"
    });
    return Bs.dispatchEvent(Ws) ? "none" : Ws.dropAction;
  }
  _e.dispatchDrop = kr;
  const Yr = {
    none: 0,
    copy: 1,
    link: 2,
    move: 4
  }, Ms = {
    none: Yr.none,
    copy: Yr.copy,
    link: Yr.link,
    move: Yr.move,
    "copy-link": Yr.copy | Yr.link,
    "copy-move": Yr.copy | Yr.move,
    "link-move": Yr.link | Yr.move,
    all: Yr.copy | Yr.link | Yr.move
  };
  function Ds(Fs, Bs = document) {
    let Hs = ++zs;
    const Ws = Bs instanceof Document ? Bs.body : Bs.firstElementChild;
    return _e.cursorBackdrop.isConnected || (_e.cursorBackdrop.style.transform = "scale(0)", Ws.appendChild(_e.cursorBackdrop), document.addEventListener("pointermove", Ls, {
      capture: !0,
      passive: !0
    })), _e.cursorBackdrop.style.cursor = Fs, new DisposableDelegate(() => {
      Hs === zs && _e.cursorBackdrop.isConnected && (document.removeEventListener("pointermove", Ls, !0), Ws.removeChild(_e.cursorBackdrop));
    });
  }
  _e.overrideCursor = Ds;
  function Ls(Fs) {
    _e.cursorBackdrop && (_e.cursorBackdrop.style.transform = `translate(${Fs.clientX}px, ${Fs.clientY}px)`);
  }
  function js() {
    const Fs = document.createElement("div");
    return Fs.classList.add("lm-cursor-backdrop"), Fs;
  }
  let zs = 0;
  _e.cursorBackdrop = js();
})(Private$n || (Private$n = {}));
function getKeyboardLayout() {
  return Private$m.keyboardLayout;
}
class KeycodeLayout {
  /**
   * Construct a new keycode layout.
   *
   * @param name - The human readable name for the layout.
   *
   * @param codes - A mapping of keycode to key value.
   *
   * @param modifierKeys - Array of modifier key names
   */
  constructor(Qt, Zt, $n = []) {
    this.name = Qt, this._codes = Zt, this._keys = KeycodeLayout.extractKeys(Zt), this._modifierKeys = KeycodeLayout.convertToKeySet($n);
  }
  /**
   * Get an array of the key values supported by the layout.
   *
   * @returns A new array of the supported key values.
   */
  keys() {
    return Object.keys(this._keys);
  }
  /**
   * Test whether the given key is a valid value for the layout.
   *
   * @param key - The user provided key to test for validity.
   *
   * @returns `true` if the key is valid, `false` otherwise.
   */
  isValidKey(Qt) {
    return Qt in this._keys;
  }
  /**
   * Test whether the given key is a modifier key.
   *
   * @param key - The user provided key.
   *
   * @returns `true` if the key is a modifier key, `false` otherwise.
   */
  isModifierKey(Qt) {
    return Qt in this._modifierKeys;
  }
  /**
   * Get the key for a `'keydown'` event.
   *
   * @param event - The event object for a `'keydown'` event.
   *
   * @returns The associated key value, or an empty string if
   *   the event does not represent a valid primary key.
   */
  keyForKeydownEvent(Qt) {
    return this._codes[Qt.keyCode] || "";
  }
}
(function(_e) {
  function Qt($n) {
    let Sn = /* @__PURE__ */ Object.create(null);
    for (let kn in $n)
      Sn[$n[kn]] = !0;
    return Sn;
  }
  _e.extractKeys = Qt;
  function Zt($n) {
    let Sn = Object(null);
    for (let kn = 0, Kn = $n.length; kn < Kn; ++kn)
      Sn[$n[kn]] = !0;
    return Sn;
  }
  _e.convertToKeySet = Zt;
})(KeycodeLayout || (KeycodeLayout = {}));
const EN_US = new KeycodeLayout(
  "en-us",
  {
    8: "Backspace",
    9: "Tab",
    13: "Enter",
    16: "Shift",
    17: "Ctrl",
    18: "Alt",
    19: "Pause",
    27: "Escape",
    32: "Space",
    33: "PageUp",
    34: "PageDown",
    35: "End",
    36: "Home",
    37: "ArrowLeft",
    38: "ArrowUp",
    39: "ArrowRight",
    40: "ArrowDown",
    45: "Insert",
    46: "Delete",
    48: "0",
    49: "1",
    50: "2",
    51: "3",
    52: "4",
    53: "5",
    54: "6",
    55: "7",
    56: "8",
    57: "9",
    59: ";",
    61: "=",
    65: "A",
    66: "B",
    67: "C",
    68: "D",
    69: "E",
    70: "F",
    71: "G",
    72: "H",
    73: "I",
    74: "J",
    75: "K",
    76: "L",
    77: "M",
    78: "N",
    79: "O",
    80: "P",
    81: "Q",
    82: "R",
    83: "S",
    84: "T",
    85: "U",
    86: "V",
    87: "W",
    88: "X",
    89: "Y",
    90: "Z",
    91: "Meta",
    93: "ContextMenu",
    96: "0",
    97: "1",
    98: "2",
    99: "3",
    100: "4",
    101: "5",
    102: "6",
    103: "7",
    104: "8",
    105: "9",
    106: "*",
    107: "+",
    109: "-",
    110: ".",
    111: "/",
    112: "F1",
    113: "F2",
    114: "F3",
    115: "F4",
    116: "F5",
    117: "F6",
    118: "F7",
    119: "F8",
    120: "F9",
    121: "F10",
    122: "F11",
    123: "F12",
    173: "-",
    186: ";",
    187: "=",
    188: ",",
    189: "-",
    190: ".",
    191: "/",
    192: "`",
    219: "[",
    220: "\\",
    221: "]",
    222: "'",
    224: "Meta"
    // firefox
  },
  ["Shift", "Ctrl", "Alt", "Meta"]
  // modifier keys
);
var Private$m;
(function(_e) {
  _e.keyboardLayout = EN_US;
})(Private$m || (Private$m = {}));
class CommandRegistry {
  constructor() {
    this._timerID = 0, this._replaying = !1, this._keystrokes = [], this._keydownEvents = [], this._keyBindings = [], this._exactKeyMatch = null, this._commands = /* @__PURE__ */ new Map(), this._commandChanged = new Signal(this), this._commandExecuted = new Signal(this), this._keyBindingChanged = new Signal(this);
  }
  /**
   * A signal emitted when a command has changed.
   *
   * #### Notes
   * This signal is useful for visual representations of commands which
   * need to refresh when the state of a relevant command has changed.
   */
  get commandChanged() {
    return this._commandChanged;
  }
  /**
   * A signal emitted when a command has executed.
   *
   * #### Notes
   * Care should be taken when consuming this signal. The command system is used
   * by many components for many user actions. Handlers registered with this
   * signal must return quickly to ensure the overall application remains responsive.
   */
  get commandExecuted() {
    return this._commandExecuted;
  }
  /**
   * A signal emitted when a key binding is changed.
   */
  get keyBindingChanged() {
    return this._keyBindingChanged;
  }
  /**
   * A read-only array of the key bindings in the registry.
   */
  get keyBindings() {
    return this._keyBindings;
  }
  /**
   * List the ids of the registered commands.
   *
   * @returns A new array of the registered command ids.
   */
  listCommands() {
    return Array.from(this._commands.keys());
  }
  /**
   * Test whether a specific command is registered.
   *
   * @param id - The id of the command of interest.
   *
   * @returns `true` if the command is registered, `false` otherwise.
   */
  hasCommand(Qt) {
    return this._commands.has(Qt);
  }
  /**
   * Add a command to the registry.
   *
   * @param id - The unique id of the command.
   *
   * @param options - The options for the command.
   *
   * @returns A disposable which will remove the command.
   *
   * @throws An error if the given `id` is already registered.
   */
  addCommand(Qt, Zt) {
    if (this._commands.has(Qt))
      throw new Error(`Command '${Qt}' already registered.`);
    return this._commands.set(Qt, Private$l.createCommand(Zt)), this._commandChanged.emit({ id: Qt, type: "added" }), new DisposableDelegate(() => {
      this._commands.delete(Qt), this._commandChanged.emit({ id: Qt, type: "removed" });
    });
  }
  /**
   * Notify listeners that the state of a command has changed.
   *
   * @param id - The id of the command which has changed. If more than
   *   one command has changed, this argument should be omitted.
   *
   * @throws An error if the given `id` is not registered.
   *
   * #### Notes
   * This method should be called by the command author whenever the
   * application state changes such that the results of the command
   * metadata functions may have changed.
   *
   * This will cause the `commandChanged` signal to be emitted.
   */
  notifyCommandChanged(Qt) {
    if (Qt !== void 0 && !this._commands.has(Qt))
      throw new Error(`Command '${Qt}' is not registered.`);
    this._commandChanged.emit({ id: Qt, type: Qt ? "changed" : "many-changed" });
  }
  /**
   * Get the description for a specific command.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns The description for the command.
   */
  describedBy(Qt, Zt = JSONExt.emptyObject) {
    var $n;
    let Sn = this._commands.get(Qt);
    return Promise.resolve(($n = Sn == null ? void 0 : Sn.describedBy.call(void 0, Zt)) !== null && $n !== void 0 ? $n : { args: null });
  }
  /**
   * Get the display label for a specific command.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns The display label for the command, or an empty string
   *   if the command is not registered.
   */
  label(Qt, Zt = JSONExt.emptyObject) {
    var $n;
    let Sn = this._commands.get(Qt);
    return ($n = Sn == null ? void 0 : Sn.label.call(void 0, Zt)) !== null && $n !== void 0 ? $n : "";
  }
  /**
   * Get the mnemonic index for a specific command.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns The mnemonic index for the command, or `-1` if the
   *   command is not registered.
   */
  mnemonic(Qt, Zt = JSONExt.emptyObject) {
    let $n = this._commands.get(Qt);
    return $n ? $n.mnemonic.call(void 0, Zt) : -1;
  }
  /**
   * Get the icon renderer for a specific command.
   *
   * DEPRECATED: if set to a string value, the .icon field will
   * function as an alias for the .iconClass field, for backwards
   * compatibility. In the future when this is removed, the default
   * return type will become undefined.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns The icon renderer for the command or `undefined`.
   */
  icon(Qt, Zt = JSONExt.emptyObject) {
    var $n;
    return ($n = this._commands.get(Qt)) === null || $n === void 0 ? void 0 : $n.icon.call(void 0, Zt);
  }
  /**
   * Get the icon class for a specific command.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns The icon class for the command, or an empty string if
   *   the command is not registered.
   */
  iconClass(Qt, Zt = JSONExt.emptyObject) {
    let $n = this._commands.get(Qt);
    return $n ? $n.iconClass.call(void 0, Zt) : "";
  }
  /**
   * Get the icon label for a specific command.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns The icon label for the command, or an empty string if
   *   the command is not registered.
   */
  iconLabel(Qt, Zt = JSONExt.emptyObject) {
    let $n = this._commands.get(Qt);
    return $n ? $n.iconLabel.call(void 0, Zt) : "";
  }
  /**
   * Get the short form caption for a specific command.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns The caption for the command, or an empty string if the
   *   command is not registered.
   */
  caption(Qt, Zt = JSONExt.emptyObject) {
    let $n = this._commands.get(Qt);
    return $n ? $n.caption.call(void 0, Zt) : "";
  }
  /**
   * Get the usage help text for a specific command.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns The usage text for the command, or an empty string if
   *   the command is not registered.
   */
  usage(Qt, Zt = JSONExt.emptyObject) {
    let $n = this._commands.get(Qt);
    return $n ? $n.usage.call(void 0, Zt) : "";
  }
  /**
   * Get the extra class name for a specific command.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns The class name for the command, or an empty string if
   *   the command is not registered.
   */
  className(Qt, Zt = JSONExt.emptyObject) {
    let $n = this._commands.get(Qt);
    return $n ? $n.className.call(void 0, Zt) : "";
  }
  /**
   * Get the dataset for a specific command.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns The dataset for the command, or an empty dataset if
   *   the command is not registered.
   */
  dataset(Qt, Zt = JSONExt.emptyObject) {
    let $n = this._commands.get(Qt);
    return $n ? $n.dataset.call(void 0, Zt) : {};
  }
  /**
   * Test whether a specific command is enabled.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns A boolean indicating whether the command is enabled,
   *   or `false` if the command is not registered.
   */
  isEnabled(Qt, Zt = JSONExt.emptyObject) {
    let $n = this._commands.get(Qt);
    return $n ? $n.isEnabled.call(void 0, Zt) : !1;
  }
  /**
   * Test whether a specific command is toggled.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns A boolean indicating whether the command is toggled,
   *   or `false` if the command is not registered.
   */
  isToggled(Qt, Zt = JSONExt.emptyObject) {
    let $n = this._commands.get(Qt);
    return $n ? $n.isToggled.call(void 0, Zt) : !1;
  }
  /**
   * Test whether a specific command is toggleable.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns A boolean indicating whether the command is toggleable,
   *   or `false` if the command is not registered.
   */
  isToggleable(Qt, Zt = JSONExt.emptyObject) {
    let $n = this._commands.get(Qt);
    return $n ? $n.isToggleable : !1;
  }
  /**
   * Test whether a specific command is visible.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns A boolean indicating whether the command is visible,
   *   or `false` if the command is not registered.
   */
  isVisible(Qt, Zt = JSONExt.emptyObject) {
    let $n = this._commands.get(Qt);
    return $n ? $n.isVisible.call(void 0, Zt) : !1;
  }
  /**
   * Execute a specific command.
   *
   * @param id - The id of the command of interest.
   *
   * @param args - The arguments for the command.
   *
   * @returns A promise which resolves with the result of the command.
   *
   * #### Notes
   * The promise will reject if the command throws an exception,
   * or if the command is not registered.
   */
  execute(Qt, Zt = JSONExt.emptyObject) {
    let $n = this._commands.get(Qt);
    if (!$n)
      return Promise.reject(new Error(`Command '${Qt}' not registered.`));
    let Sn;
    try {
      Sn = $n.execute.call(void 0, Zt);
    } catch (Kn) {
      Sn = Promise.reject(Kn);
    }
    let kn = Promise.resolve(Sn);
    return this._commandExecuted.emit({ id: Qt, args: Zt, result: kn }), kn;
  }
  /**
   * Add a key binding to the registry.
   *
   * @param options - The options for creating the key binding.
   *
   * @returns A disposable which removes the added key binding.
   *
   * #### Notes
   * If multiple key bindings are registered for the same sequence, the
   * binding with the highest selector specificity is executed first. A
   * tie is broken by using the most recently added key binding.
   *
   * Ambiguous key bindings are resolved with a timeout. As an example,
   * suppose two key bindings are registered: one with the key sequence
   * `['Ctrl D']`, and another with `['Ctrl D', 'Ctrl W']`. If the user
   * presses `Ctrl D`, the first binding cannot be immediately executed
   * since the user may intend to complete the chord with `Ctrl W`. For
   * such cases, a timer is used to allow the chord to be completed. If
   * the chord is not completed before the timeout, the first binding
   * is executed.
   */
  addKeyBinding(Qt) {
    let Zt = Private$l.createKeyBinding(Qt);
    return this._keyBindings.push(Zt), this._keyBindingChanged.emit({ binding: Zt, type: "added" }), new DisposableDelegate(() => {
      ArrayExt.removeFirstOf(this._keyBindings, Zt), this._keyBindingChanged.emit({ binding: Zt, type: "removed" });
    });
  }
  /**
   * Process a `'keydown'` event and invoke a matching key binding.
   *
   * @param event - The event object for a `'keydown'` event.
   *
   * #### Notes
   * This should be called in response to a `'keydown'` event in order
   * to invoke the command for the best matching key binding.
   *
   * The registry **does not** install its own listener for `'keydown'`
   * events. This allows the application full control over the nodes
   * and phase for which the registry processes `'keydown'` events.
   *
   * When the keydown event is processed, if the event target or any of its
   * ancestor nodes has a `data-lm-suppress-shortcuts` attribute, its keydown
   * events will not invoke commands.
   */
  processKeydownEvent(Qt) {
    if (this._replaying || CommandRegistry.isModifierKeyPressed(Qt))
      return;
    let Zt = CommandRegistry.keystrokeForKeydownEvent(Qt);
    if (!Zt) {
      this._replayKeydownEvents(), this._clearPendingState();
      return;
    }
    this._keystrokes.push(Zt);
    let { exact: $n, partial: Sn } = Private$l.matchKeyBinding(this._keyBindings, this._keystrokes, Qt);
    if (!$n && !Sn) {
      this._replayKeydownEvents(), this._clearPendingState();
      return;
    }
    if (Qt.preventDefault(), Qt.stopPropagation(), $n && !Sn) {
      this._executeKeyBinding($n), this._clearPendingState();
      return;
    }
    $n && (this._exactKeyMatch = $n), this._keydownEvents.push(Qt), this._startTimer();
  }
  /**
   * Start or restart the pending timeout.
   */
  _startTimer() {
    this._clearTimer(), this._timerID = window.setTimeout(() => {
      this._onPendingTimeout();
    }, Private$l.CHORD_TIMEOUT);
  }
  /**
   * Clear the pending timeout.
   */
  _clearTimer() {
    this._timerID !== 0 && (clearTimeout(this._timerID), this._timerID = 0);
  }
  /**
   * Replay the keydown events which were suppressed.
   */
  _replayKeydownEvents() {
    this._keydownEvents.length !== 0 && (this._replaying = !0, this._keydownEvents.forEach(Private$l.replayKeyEvent), this._replaying = !1);
  }
  /**
   * Execute the command for the given key binding.
   *
   * If the command is missing or disabled, a warning will be logged.
   */
  _executeKeyBinding(Qt) {
    let { command: Zt, args: $n } = Qt;
    if (!this.hasCommand(Zt) || !this.isEnabled(Zt, $n)) {
      let Sn = this.hasCommand(Zt) ? "enabled" : "registered", Kn = `Cannot execute key binding '${Qt.keys.join(", ")}':`, er = `command '${Zt}' is not ${Sn}.`;
      console.warn(`${Kn} ${er}`);
      return;
    }
    this.execute(Zt, $n);
  }
  /**
   * Clear the internal pending state.
   */
  _clearPendingState() {
    this._clearTimer(), this._exactKeyMatch = null, this._keystrokes.length = 0, this._keydownEvents.length = 0;
  }
  /**
   * Handle the partial match timeout.
   */
  _onPendingTimeout() {
    this._timerID = 0, this._exactKeyMatch ? this._executeKeyBinding(this._exactKeyMatch) : this._replayKeydownEvents(), this._clearPendingState();
  }
}
(function(_e) {
  function Qt(er) {
    let Cr = "", kr = !1, Yr = !1, Ms = !1, Ds = !1;
    for (let Ls of er.split(/\s+/))
      Ls === "Accel" ? Platform.IS_MAC ? Yr = !0 : Ms = !0 : Ls === "Alt" ? kr = !0 : Ls === "Cmd" ? Yr = !0 : Ls === "Ctrl" ? Ms = !0 : Ls === "Shift" ? Ds = !0 : Ls.length > 0 && (Cr = Ls);
    return { cmd: Yr, ctrl: Ms, alt: kr, shift: Ds, key: Cr };
  }
  _e.parseKeystroke = Qt;
  function Zt(er) {
    let Cr = "", kr = Qt(er);
    return kr.ctrl && (Cr += "Ctrl "), kr.alt && (Cr += "Alt "), kr.shift && (Cr += "Shift "), kr.cmd && Platform.IS_MAC && (Cr += "Cmd "), Cr + kr.key;
  }
  _e.normalizeKeystroke = Zt;
  function $n(er) {
    let Cr;
    return Platform.IS_WIN ? Cr = er.winKeys || er.keys : Platform.IS_MAC ? Cr = er.macKeys || er.keys : Cr = er.linuxKeys || er.keys, Cr.map(Zt);
  }
  _e.normalizeKeys = $n;
  function Sn(er) {
    return typeof er == "string" ? Cr(er) : er.map(Cr).join(", ");
    function Cr(kr) {
      let Yr = [], Ms = Platform.IS_MAC ? " " : "+", Ds = Qt(kr);
      return Ds.ctrl && Yr.push("Ctrl"), Ds.alt && Yr.push("Alt"), Ds.shift && Yr.push("Shift"), Platform.IS_MAC && Ds.cmd && Yr.push("Cmd"), Yr.push(Ds.key), Yr.map(Private$l.formatKey).join(Ms);
    }
  }
  _e.formatKeystroke = Sn;
  function kn(er) {
    let Cr = getKeyboardLayout(), kr = Cr.keyForKeydownEvent(er);
    return Cr.isModifierKey(kr);
  }
  _e.isModifierKeyPressed = kn;
  function Kn(er) {
    let Cr = getKeyboardLayout(), kr = Cr.keyForKeydownEvent(er);
    if (!kr || Cr.isModifierKey(kr))
      return "";
    let Yr = [];
    return er.ctrlKey && Yr.push("Ctrl"), er.altKey && Yr.push("Alt"), er.shiftKey && Yr.push("Shift"), er.metaKey && Platform.IS_MAC && Yr.push("Cmd"), Yr.push(kr), Yr.join(" ");
  }
  _e.keystrokeForKeydownEvent = Kn;
})(CommandRegistry || (CommandRegistry = {}));
var Private$l;
(function(_e) {
  _e.CHORD_TIMEOUT = 1e3;
  function Qt(Ws) {
    return {
      execute: Ws.execute,
      describedBy: js(typeof Ws.describedBy == "function" ? Ws.describedBy : { args: null, ...Ws.describedBy }, () => ({ args: null })),
      label: js(Ws.label, Cr),
      mnemonic: js(Ws.mnemonic, kr),
      icon: js(Ws.icon, Ls),
      iconClass: js(Ws.iconClass, Cr),
      iconLabel: js(Ws.iconLabel, Cr),
      caption: js(Ws.caption, Cr),
      usage: js(Ws.usage, Cr),
      className: js(Ws.className, Cr),
      dataset: js(Ws.dataset, Ds),
      isEnabled: Ws.isEnabled || Yr,
      isToggled: Ws.isToggled || Ms,
      isToggleable: Ws.isToggleable || !!Ws.isToggled,
      isVisible: Ws.isVisible || Yr
    };
  }
  _e.createCommand = Qt;
  function Zt(Ws) {
    return {
      keys: CommandRegistry.normalizeKeys(Ws),
      selector: zs(Ws),
      command: Ws.command,
      args: Ws.args || JSONExt.emptyObject
    };
  }
  _e.createKeyBinding = Zt;
  function $n(Ws, Ys, El) {
    let Mu = null, Pl = !1, Iu = 1 / 0, Tu = 0;
    for (let Au = 0, Nu = Ws.length; Au < Nu; ++Au) {
      let gm = Ws[Au], pm = Fs(gm.keys, Ys);
      if (pm === 0)
        continue;
      if (pm === 2) {
        !Pl && Bs(gm.selector, El) !== -1 && (Pl = !0);
        continue;
      }
      let zu = Bs(gm.selector, El);
      if (zu === -1 || zu > Iu)
        continue;
      let Yu = Selector$1.calculateSpecificity(gm.selector);
      (!Mu || zu < Iu || Yu >= Tu) && (Mu = gm, Iu = zu, Tu = Yu);
    }
    return { exact: Mu, partial: Pl };
  }
  _e.matchKeyBinding = $n;
  function Sn(Ws) {
    Ws.target.dispatchEvent(Hs(Ws));
  }
  _e.replayKeyEvent = Sn;
  function kn(Ws) {
    return Platform.IS_MAC ? Kn.hasOwnProperty(Ws) ? Kn[Ws] : Ws : er.hasOwnProperty(Ws) ? er[Ws] : Ws;
  }
  _e.formatKey = kn;
  const Kn = {
    Backspace: "⌫",
    Tab: "⇥",
    Enter: "⏎",
    Shift: "⇧",
    Ctrl: "⌃",
    Alt: "⌥",
    Escape: "⎋",
    PageUp: "⇞",
    PageDown: "⇟",
    End: "↘",
    Home: "↖",
    ArrowLeft: "←",
    ArrowUp: "↑",
    ArrowRight: "→",
    ArrowDown: "↓",
    Delete: "⌦",
    Cmd: "⌘"
  }, er = {
    Escape: "Esc",
    PageUp: "Page Up",
    PageDown: "Page Down",
    ArrowLeft: "Left",
    ArrowUp: "Up",
    ArrowRight: "Right",
    ArrowDown: "Down",
    Delete: "Del"
  }, Cr = () => "", kr = () => -1, Yr = () => !0, Ms = () => !1, Ds = () => ({}), Ls = () => {
  };
  function js(Ws, Ys) {
    return Ws === void 0 ? Ys : typeof Ws == "function" ? Ws : () => Ws;
  }
  function zs(Ws) {
    if (Ws.selector.indexOf(",") !== -1)
      throw new Error(`Selector cannot contain commas: ${Ws.selector}`);
    if (!Selector$1.isValid(Ws.selector))
      throw new Error(`Invalid selector: ${Ws.selector}`);
    return Ws.selector;
  }
  function Fs(Ws, Ys) {
    if (Ws.length < Ys.length)
      return 0;
    for (let El = 0, Mu = Ys.length; El < Mu; ++El)
      if (Ws[El] !== Ys[El])
        return 0;
    return Ws.length > Ys.length ? 2 : 1;
  }
  function Bs(Ws, Ys) {
    let El = Ys.target, Mu = Ys.currentTarget;
    for (let Pl = 0; El !== null; El = El.parentElement, ++Pl) {
      if (El.hasAttribute("data-lm-suppress-shortcuts"))
        return -1;
      if (Selector$1.matches(El, Ws))
        return Pl;
      if (El === Mu)
        return -1;
    }
    return -1;
  }
  function Hs(Ws) {
    let Ys = document.createEvent("Event"), El = Ws.bubbles || !0, Mu = Ws.cancelable || !0;
    return Ys.initEvent(Ws.type || "keydown", El, Mu), Ys.key = Ws.key || "", Ys.keyCode = Ws.keyCode || 0, Ys.which = Ws.keyCode || 0, Ys.ctrlKey = Ws.ctrlKey || !1, Ys.altKey = Ws.altKey || !1, Ys.shiftKey = Ws.shiftKey || !1, Ys.metaKey = Ws.metaKey || !1, Ys.view = Ws.view || window, Ys;
  }
})(Private$l || (Private$l = {}));
class BoxSizer {
  constructor() {
    this.sizeHint = 0, this.minSize = 0, this.maxSize = 1 / 0, this.stretch = 1, this.size = 0, this.done = !1;
  }
}
var BoxEngine;
(function(_e) {
  function Qt(kn, Kn) {
    let er = kn.length;
    if (er === 0)
      return Kn;
    let Cr = 0, kr = 0, Yr = 0, Ms = 0, Ds = 0;
    for (let zs = 0; zs < er; ++zs) {
      let Fs = kn[zs], Bs = Fs.minSize, Hs = Fs.maxSize, Ws = Fs.sizeHint;
      Fs.done = !1, Fs.size = Math.max(Bs, Math.min(Ws, Hs)), Yr += Fs.size, Cr += Bs, kr += Hs, Fs.stretch > 0 && (Ms += Fs.stretch, Ds++);
    }
    if (Kn === Yr)
      return 0;
    if (Kn <= Cr) {
      for (let zs = 0; zs < er; ++zs) {
        let Fs = kn[zs];
        Fs.size = Fs.minSize;
      }
      return Kn - Cr;
    }
    if (Kn >= kr) {
      for (let zs = 0; zs < er; ++zs) {
        let Fs = kn[zs];
        Fs.size = Fs.maxSize;
      }
      return Kn - kr;
    }
    let Ls = 0.01, js = er;
    if (Kn < Yr) {
      let zs = Yr - Kn;
      for (; Ds > 0 && zs > Ls; ) {
        let Fs = zs, Bs = Ms;
        for (let Hs = 0; Hs < er; ++Hs) {
          let Ws = kn[Hs];
          if (Ws.done || Ws.stretch === 0)
            continue;
          let Ys = Ws.stretch * Fs / Bs;
          Ws.size - Ys <= Ws.minSize ? (zs -= Ws.size - Ws.minSize, Ms -= Ws.stretch, Ws.size = Ws.minSize, Ws.done = !0, js--, Ds--) : (zs -= Ys, Ws.size -= Ys);
        }
      }
      for (; js > 0 && zs > Ls; ) {
        let Fs = zs / js;
        for (let Bs = 0; Bs < er; ++Bs) {
          let Hs = kn[Bs];
          Hs.done || (Hs.size - Fs <= Hs.minSize ? (zs -= Hs.size - Hs.minSize, Hs.size = Hs.minSize, Hs.done = !0, js--) : (zs -= Fs, Hs.size -= Fs));
        }
      }
    } else {
      let zs = Kn - Yr;
      for (; Ds > 0 && zs > Ls; ) {
        let Fs = zs, Bs = Ms;
        for (let Hs = 0; Hs < er; ++Hs) {
          let Ws = kn[Hs];
          if (Ws.done || Ws.stretch === 0)
            continue;
          let Ys = Ws.stretch * Fs / Bs;
          Ws.size + Ys >= Ws.maxSize ? (zs -= Ws.maxSize - Ws.size, Ms -= Ws.stretch, Ws.size = Ws.maxSize, Ws.done = !0, js--, Ds--) : (zs -= Ys, Ws.size += Ys);
        }
      }
      for (; js > 0 && zs > Ls; ) {
        let Fs = zs / js;
        for (let Bs = 0; Bs < er; ++Bs) {
          let Hs = kn[Bs];
          Hs.done || (Hs.size + Fs >= Hs.maxSize ? (zs -= Hs.maxSize - Hs.size, Hs.size = Hs.maxSize, Hs.done = !0, js--) : (zs -= Fs, Hs.size += Fs));
        }
      }
    }
    return 0;
  }
  _e.calc = Qt;
  function Zt(kn, Kn, er) {
    kn.length === 0 || er === 0 || (er > 0 ? $n(kn, Kn, er) : Sn(kn, Kn, -er));
  }
  _e.adjust = Zt;
  function $n(kn, Kn, er) {
    let Cr = 0;
    for (let Ds = 0; Ds <= Kn; ++Ds) {
      let Ls = kn[Ds];
      Cr += Ls.maxSize - Ls.size;
    }
    let kr = 0;
    for (let Ds = Kn + 1, Ls = kn.length; Ds < Ls; ++Ds) {
      let js = kn[Ds];
      kr += js.size - js.minSize;
    }
    er = Math.min(er, Cr, kr);
    let Yr = er;
    for (let Ds = Kn; Ds >= 0 && Yr > 0; --Ds) {
      let Ls = kn[Ds], js = Ls.maxSize - Ls.size;
      js >= Yr ? (Ls.sizeHint = Ls.size + Yr, Yr = 0) : (Ls.sizeHint = Ls.size + js, Yr -= js);
    }
    let Ms = er;
    for (let Ds = Kn + 1, Ls = kn.length; Ds < Ls && Ms > 0; ++Ds) {
      let js = kn[Ds], zs = js.size - js.minSize;
      zs >= Ms ? (js.sizeHint = js.size - Ms, Ms = 0) : (js.sizeHint = js.size - zs, Ms -= zs);
    }
  }
  function Sn(kn, Kn, er) {
    let Cr = 0;
    for (let Ds = Kn + 1, Ls = kn.length; Ds < Ls; ++Ds) {
      let js = kn[Ds];
      Cr += js.maxSize - js.size;
    }
    let kr = 0;
    for (let Ds = 0; Ds <= Kn; ++Ds) {
      let Ls = kn[Ds];
      kr += Ls.size - Ls.minSize;
    }
    er = Math.min(er, Cr, kr);
    let Yr = er;
    for (let Ds = Kn + 1, Ls = kn.length; Ds < Ls && Yr > 0; ++Ds) {
      let js = kn[Ds], zs = js.maxSize - js.size;
      zs >= Yr ? (js.sizeHint = js.size + Yr, Yr = 0) : (js.sizeHint = js.size + zs, Yr -= zs);
    }
    let Ms = er;
    for (let Ds = Kn; Ds >= 0 && Ms > 0; --Ds) {
      let Ls = kn[Ds], js = Ls.size - Ls.minSize;
      js >= Ms ? (Ls.sizeHint = Ls.size - Ms, Ms = 0) : (Ls.sizeHint = Ls.size - js, Ms -= js);
    }
  }
})(BoxEngine || (BoxEngine = {}));
let Title$1 = class {
  /**
   * Construct a new title.
   *
   * @param options - The options for initializing the title.
   */
  constructor(Qt) {
    this._label = "", this._caption = "", this._mnemonic = -1, this._icon = void 0, this._iconClass = "", this._iconLabel = "", this._className = "", this._closable = !1, this._changed = new Signal(this), this._isDisposed = !1, this.owner = Qt.owner, Qt.label !== void 0 && (this._label = Qt.label), Qt.mnemonic !== void 0 && (this._mnemonic = Qt.mnemonic), Qt.icon !== void 0 && (this._icon = Qt.icon), Qt.iconClass !== void 0 && (this._iconClass = Qt.iconClass), Qt.iconLabel !== void 0 && (this._iconLabel = Qt.iconLabel), Qt.caption !== void 0 && (this._caption = Qt.caption), Qt.className !== void 0 && (this._className = Qt.className), Qt.closable !== void 0 && (this._closable = Qt.closable), this._dataset = Qt.dataset || {};
  }
  /**
   * A signal emitted when the state of the title changes.
   */
  get changed() {
    return this._changed;
  }
  /**
   * Get the label for the title.
   *
   * #### Notes
   * The default value is an empty string.
   */
  get label() {
    return this._label;
  }
  /**
   * Set the label for the title.
   */
  set label(Qt) {
    this._label !== Qt && (this._label = Qt, this._changed.emit(void 0));
  }
  /**
   * Get the mnemonic index for the title.
   *
   * #### Notes
   * The default value is `-1`.
   */
  get mnemonic() {
    return this._mnemonic;
  }
  /**
   * Set the mnemonic index for the title.
   */
  set mnemonic(Qt) {
    this._mnemonic !== Qt && (this._mnemonic = Qt, this._changed.emit(void 0));
  }
  /**
   * Get the icon renderer for the title.
   *
   * #### Notes
   * The default value is undefined.
   */
  get icon() {
    return this._icon;
  }
  /**
   * Set the icon renderer for the title.
   *
   * #### Notes
   * A renderer is an object that supplies a render and unrender function.
   */
  set icon(Qt) {
    this._icon !== Qt && (this._icon = Qt, this._changed.emit(void 0));
  }
  /**
   * Get the icon class name for the title.
   *
   * #### Notes
   * The default value is an empty string.
   */
  get iconClass() {
    return this._iconClass;
  }
  /**
   * Set the icon class name for the title.
   *
   * #### Notes
   * Multiple class names can be separated with whitespace.
   */
  set iconClass(Qt) {
    this._iconClass !== Qt && (this._iconClass = Qt, this._changed.emit(void 0));
  }
  /**
   * Get the icon label for the title.
   *
   * #### Notes
   * The default value is an empty string.
   */
  get iconLabel() {
    return this._iconLabel;
  }
  /**
   * Set the icon label for the title.
   *
   * #### Notes
   * Multiple class names can be separated with whitespace.
   */
  set iconLabel(Qt) {
    this._iconLabel !== Qt && (this._iconLabel = Qt, this._changed.emit(void 0));
  }
  /**
   * Get the caption for the title.
   *
   * #### Notes
   * The default value is an empty string.
   */
  get caption() {
    return this._caption;
  }
  /**
   * Set the caption for the title.
   */
  set caption(Qt) {
    this._caption !== Qt && (this._caption = Qt, this._changed.emit(void 0));
  }
  /**
   * Get the extra class name for the title.
   *
   * #### Notes
   * The default value is an empty string.
   */
  get className() {
    return this._className;
  }
  /**
   * Set the extra class name for the title.
   *
   * #### Notes
   * Multiple class names can be separated with whitespace.
   */
  set className(Qt) {
    this._className !== Qt && (this._className = Qt, this._changed.emit(void 0));
  }
  /**
   * Get the closable state for the title.
   *
   * #### Notes
   * The default value is `false`.
   */
  get closable() {
    return this._closable;
  }
  /**
   * Set the closable state for the title.
   *
   * #### Notes
   * This controls the presence of a close icon when applicable.
   */
  set closable(Qt) {
    this._closable !== Qt && (this._closable = Qt, this._changed.emit(void 0));
  }
  /**
   * Get the dataset for the title.
   *
   * #### Notes
   * The default value is an empty dataset.
   */
  get dataset() {
    return this._dataset;
  }
  /**
   * Set the dataset for the title.
   *
   * #### Notes
   * This controls the data attributes when applicable.
   */
  set dataset(Qt) {
    this._dataset !== Qt && (this._dataset = Qt, this._changed.emit(void 0));
  }
  /**
   * Test whether the title has been disposed.
   */
  get isDisposed() {
    return this._isDisposed;
  }
  /**
   * Dispose of the resources held by the title.
   *
   * #### Notes
   * It is the responsibility of the owner to call the title disposal.
   */
  dispose() {
    this.isDisposed || (this._isDisposed = !0, Signal.clearData(this));
  }
};
class Widget {
  /**
   * Construct a new widget.
   *
   * @param options - The options for initializing the widget.
   */
  constructor(Qt = {}) {
    this._flags = 0, this._layout = null, this._parent = null, this._disposed = new Signal(this), this._hiddenMode = Widget.HiddenMode.Display, this.node = Private$j.createNode(Qt), this.addClass("lm-Widget");
  }
  /**
   * Dispose of the widget and its descendant widgets.
   *
   * #### Notes
   * It is unsafe to use the widget after it has been disposed.
   *
   * All calls made to this method after the first are a no-op.
   */
  dispose() {
    this.isDisposed || (this.setFlag(Widget.Flag.IsDisposed), this._disposed.emit(void 0), this.parent ? this.parent = null : this.isAttached && Widget.detach(this), this._layout && (this._layout.dispose(), this._layout = null), this.title.dispose(), Signal.clearData(this), MessageLoop.clearData(this), AttachedProperty.clearData(this));
  }
  /**
   * A signal emitted when the widget is disposed.
   */
  get disposed() {
    return this._disposed;
  }
  /**
   * Test whether the widget has been disposed.
   */
  get isDisposed() {
    return this.testFlag(Widget.Flag.IsDisposed);
  }
  /**
   * Test whether the widget's node is attached to the DOM.
   */
  get isAttached() {
    return this.testFlag(Widget.Flag.IsAttached);
  }
  /**
   * Test whether the widget is explicitly hidden.
   */
  get isHidden() {
    return this.testFlag(Widget.Flag.IsHidden);
  }
  /**
   * Test whether the widget is visible.
   *
   * #### Notes
   * A widget is visible when it is attached to the DOM, is not
   * explicitly hidden, and has no explicitly hidden ancestors.
   */
  get isVisible() {
    return this.testFlag(Widget.Flag.IsVisible);
  }
  /**
   * The title object for the widget.
   *
   * #### Notes
   * The title object is used by some container widgets when displaying
   * the widget alongside some title, such as a tab panel or side bar.
   *
   * Since not all widgets will use the title, it is created on demand.
   *
   * The `owner` property of the title is set to this widget.
   */
  get title() {
    return Private$j.titleProperty.get(this);
  }
  /**
   * Get the id of the widget's DOM node.
   */
  get id() {
    return this.node.id;
  }
  /**
   * Set the id of the widget's DOM node.
   */
  set id(Qt) {
    this.node.id = Qt;
  }
  /**
   * The dataset for the widget's DOM node.
   */
  get dataset() {
    return this.node.dataset;
  }
  /**
   * Get the method for hiding the widget.
   */
  get hiddenMode() {
    return this._hiddenMode;
  }
  /**
   * Set the method for hiding the widget.
   */
  set hiddenMode(Qt) {
    this._hiddenMode !== Qt && (this.isHidden && this._toggleHidden(!1), Qt == Widget.HiddenMode.Scale ? this.node.style.willChange = "transform" : this.node.style.willChange = "auto", this._hiddenMode = Qt, this.isHidden && this._toggleHidden(!0));
  }
  /**
   * Get the parent of the widget.
   */
  get parent() {
    return this._parent;
  }
  /**
   * Set the parent of the widget.
   *
   * #### Notes
   * Children are typically added to a widget by using a layout, which
   * means user code will not normally set the parent widget directly.
   *
   * The widget will be automatically removed from its old parent.
   *
   * This is a no-op if there is no effective parent change.
   */
  set parent(Qt) {
    if (this._parent !== Qt) {
      if (Qt && this.contains(Qt))
        throw new Error("Invalid parent widget.");
      if (this._parent && !this._parent.isDisposed) {
        let Zt = new Widget.ChildMessage("child-removed", this);
        MessageLoop.sendMessage(this._parent, Zt);
      }
      if (this._parent = Qt, this._parent && !this._parent.isDisposed) {
        let Zt = new Widget.ChildMessage("child-added", this);
        MessageLoop.sendMessage(this._parent, Zt);
      }
      this.isDisposed || MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);
    }
  }
  /**
   * Get the layout for the widget.
   */
  get layout() {
    return this._layout;
  }
  /**
   * Set the layout for the widget.
   *
   * #### Notes
   * The layout is single-use only. It cannot be changed after the
   * first assignment.
   *
   * The layout is disposed automatically when the widget is disposed.
   */
  set layout(Qt) {
    if (this._layout !== Qt) {
      if (this.testFlag(Widget.Flag.DisallowLayout))
        throw new Error("Cannot set widget layout.");
      if (this._layout)
        throw new Error("Cannot change widget layout.");
      if (Qt.parent)
        throw new Error("Cannot change layout parent.");
      this._layout = Qt, Qt.parent = this;
    }
  }
  /**
   * Create an iterator over the widget's children.
   *
   * @returns A new iterator over the children of the widget.
   *
   * #### Notes
   * The widget must have a populated layout in order to have children.
   *
   * If a layout is not installed, the returned iterator will be empty.
   */
  *children() {
    this._layout && (yield* this._layout);
  }
  /**
   * Test whether a widget is a descendant of this widget.
   *
   * @param widget - The descendant widget of interest.
   *
   * @returns `true` if the widget is a descendant, `false` otherwise.
   */
  contains(Qt) {
    for (let Zt = Qt; Zt; Zt = Zt._parent)
      if (Zt === this)
        return !0;
    return !1;
  }
  /**
   * Test whether the widget's DOM node has the given class name.
   *
   * @param name - The class name of interest.
   *
   * @returns `true` if the node has the class, `false` otherwise.
   */
  hasClass(Qt) {
    return this.node.classList.contains(Qt);
  }
  /**
   * Add a class name to the widget's DOM node.
   *
   * @param name - The class name to add to the node.
   *
   * #### Notes
   * If the class name is already added to the node, this is a no-op.
   *
   * The class name must not contain whitespace.
   */
  addClass(Qt) {
    this.node.classList.add(Qt);
  }
  /**
   * Remove a class name from the widget's DOM node.
   *
   * @param name - The class name to remove from the node.
   *
   * #### Notes
   * If the class name is not yet added to the node, this is a no-op.
   *
   * The class name must not contain whitespace.
   */
  removeClass(Qt) {
    this.node.classList.remove(Qt);
  }
  /**
   * Toggle a class name on the widget's DOM node.
   *
   * @param name - The class name to toggle on the node.
   *
   * @param force - Whether to force add the class (`true`) or force
   *   remove the class (`false`). If not provided, the presence of
   *   the class will be toggled from its current state.
   *
   * @returns `true` if the class is now present, `false` otherwise.
   *
   * #### Notes
   * The class name must not contain whitespace.
   */
  toggleClass(Qt, Zt) {
    return Zt === !0 ? (this.node.classList.add(Qt), !0) : Zt === !1 ? (this.node.classList.remove(Qt), !1) : this.node.classList.toggle(Qt);
  }
  /**
   * Post an `'update-request'` message to the widget.
   *
   * #### Notes
   * This is a simple convenience method for posting the message.
   */
  update() {
    MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);
  }
  /**
   * Post a `'fit-request'` message to the widget.
   *
   * #### Notes
   * This is a simple convenience method for posting the message.
   */
  fit() {
    MessageLoop.postMessage(this, Widget.Msg.FitRequest);
  }
  /**
   * Post an `'activate-request'` message to the widget.
   *
   * #### Notes
   * This is a simple convenience method for posting the message.
   */
  activate() {
    MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);
  }
  /**
   * Send a `'close-request'` message to the widget.
   *
   * #### Notes
   * This is a simple convenience method for sending the message.
   */
  close() {
    MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);
  }
  /**
   * Show the widget and make it visible to its parent widget.
   *
   * #### Notes
   * This causes the {@link isHidden} property to be `false`.
   *
   * If the widget is not explicitly hidden, this is a no-op.
   */
  show() {
    if (this.testFlag(Widget.Flag.IsHidden) && (this.isAttached && (!this.parent || this.parent.isVisible) && MessageLoop.sendMessage(this, Widget.Msg.BeforeShow), this.clearFlag(Widget.Flag.IsHidden), this._toggleHidden(!1), this.isAttached && (!this.parent || this.parent.isVisible) && MessageLoop.sendMessage(this, Widget.Msg.AfterShow), this.parent)) {
      let Qt = new Widget.ChildMessage("child-shown", this);
      MessageLoop.sendMessage(this.parent, Qt);
    }
  }
  /**
   * Hide the widget and make it hidden to its parent widget.
   *
   * #### Notes
   * This causes the {@link isHidden} property to be `true`.
   *
   * If the widget is explicitly hidden, this is a no-op.
   */
  hide() {
    if (!this.testFlag(Widget.Flag.IsHidden) && (this.isAttached && (!this.parent || this.parent.isVisible) && MessageLoop.sendMessage(this, Widget.Msg.BeforeHide), this.setFlag(Widget.Flag.IsHidden), this._toggleHidden(!0), this.isAttached && (!this.parent || this.parent.isVisible) && MessageLoop.sendMessage(this, Widget.Msg.AfterHide), this.parent)) {
      let Qt = new Widget.ChildMessage("child-hidden", this);
      MessageLoop.sendMessage(this.parent, Qt);
    }
  }
  /**
   * Show or hide the widget according to a boolean value.
   *
   * @param hidden - `true` to hide the widget, or `false` to show it.
   *
   * #### Notes
   * This is a convenience method for `hide()` and `show()`.
   */
  setHidden(Qt) {
    Qt ? this.hide() : this.show();
  }
  /**
   * Test whether the given widget flag is set.
   *
   * #### Notes
   * This will not typically be called directly by user code.
   */
  testFlag(Qt) {
    return (this._flags & Qt) !== 0;
  }
  /**
   * Set the given widget flag.
   *
   * #### Notes
   * This will not typically be called directly by user code.
   */
  setFlag(Qt) {
    this._flags |= Qt;
  }
  /**
   * Clear the given widget flag.
   *
   * #### Notes
   * This will not typically be called directly by user code.
   */
  clearFlag(Qt) {
    this._flags &= ~Qt;
  }
  /**
   * Process a message sent to the widget.
   *
   * @param msg - The message sent to the widget.
   *
   * #### Notes
   * Subclasses may reimplement this method as needed.
   */
  processMessage(Qt) {
    switch (Qt.type) {
      case "resize":
        this.notifyLayout(Qt), this.onResize(Qt);
        break;
      case "update-request":
        this.notifyLayout(Qt), this.onUpdateRequest(Qt);
        break;
      case "fit-request":
        this.notifyLayout(Qt), this.onFitRequest(Qt);
        break;
      case "before-show":
        this.notifyLayout(Qt), this.onBeforeShow(Qt);
        break;
      case "after-show":
        this.setFlag(Widget.Flag.IsVisible), this.notifyLayout(Qt), this.onAfterShow(Qt);
        break;
      case "before-hide":
        this.notifyLayout(Qt), this.onBeforeHide(Qt);
        break;
      case "after-hide":
        this.clearFlag(Widget.Flag.IsVisible), this.notifyLayout(Qt), this.onAfterHide(Qt);
        break;
      case "before-attach":
        this.notifyLayout(Qt), this.onBeforeAttach(Qt);
        break;
      case "after-attach":
        !this.isHidden && (!this.parent || this.parent.isVisible) && this.setFlag(Widget.Flag.IsVisible), this.setFlag(Widget.Flag.IsAttached), this.notifyLayout(Qt), this.onAfterAttach(Qt);
        break;
      case "before-detach":
        this.notifyLayout(Qt), this.onBeforeDetach(Qt);
        break;
      case "after-detach":
        this.clearFlag(Widget.Flag.IsVisible), this.clearFlag(Widget.Flag.IsAttached), this.notifyLayout(Qt), this.onAfterDetach(Qt);
        break;
      case "activate-request":
        this.notifyLayout(Qt), this.onActivateRequest(Qt);
        break;
      case "close-request":
        this.notifyLayout(Qt), this.onCloseRequest(Qt);
        break;
      case "child-added":
        this.notifyLayout(Qt), this.onChildAdded(Qt);
        break;
      case "child-removed":
        this.notifyLayout(Qt), this.onChildRemoved(Qt);
        break;
      default:
        this.notifyLayout(Qt);
        break;
    }
  }
  /**
   * Invoke the message processing routine of the widget's layout.
   *
   * @param msg - The message to dispatch to the layout.
   *
   * #### Notes
   * This is a no-op if the widget does not have a layout.
   *
   * This will not typically be called directly by user code.
   */
  notifyLayout(Qt) {
    this._layout && this._layout.processParentMessage(Qt);
  }
  /**
   * A message handler invoked on a `'close-request'` message.
   *
   * #### Notes
   * The default implementation unparents or detaches the widget.
   */
  onCloseRequest(Qt) {
    this.parent ? this.parent = null : this.isAttached && Widget.detach(this);
  }
  /**
   * A message handler invoked on a `'resize'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onResize(Qt) {
  }
  /**
   * A message handler invoked on an `'update-request'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onUpdateRequest(Qt) {
  }
  /**
   * A message handler invoked on a `'fit-request'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onFitRequest(Qt) {
  }
  /**
   * A message handler invoked on an `'activate-request'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onActivateRequest(Qt) {
  }
  /**
   * A message handler invoked on a `'before-show'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onBeforeShow(Qt) {
  }
  /**
   * A message handler invoked on an `'after-show'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onAfterShow(Qt) {
  }
  /**
   * A message handler invoked on a `'before-hide'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onBeforeHide(Qt) {
  }
  /**
   * A message handler invoked on an `'after-hide'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onAfterHide(Qt) {
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onBeforeAttach(Qt) {
  }
  /**
   * A message handler invoked on an `'after-attach'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onAfterAttach(Qt) {
  }
  /**
   * A message handler invoked on a `'before-detach'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onBeforeDetach(Qt) {
  }
  /**
   * A message handler invoked on an `'after-detach'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onAfterDetach(Qt) {
  }
  /**
   * A message handler invoked on a `'child-added'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onChildAdded(Qt) {
  }
  /**
   * A message handler invoked on a `'child-removed'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onChildRemoved(Qt) {
  }
  _toggleHidden(Qt) {
    if (Qt)
      switch (this._hiddenMode) {
        case Widget.HiddenMode.Display:
          this.addClass("lm-mod-hidden");
          break;
        case Widget.HiddenMode.Scale:
          this.node.style.transform = "scale(0)", this.node.setAttribute("aria-hidden", "true");
          break;
        case Widget.HiddenMode.ContentVisibility:
          this.node.style.contentVisibility = "hidden", this.node.style.zIndex = "-1";
          break;
      }
    else
      switch (this._hiddenMode) {
        case Widget.HiddenMode.Display:
          this.removeClass("lm-mod-hidden");
          break;
        case Widget.HiddenMode.Scale:
          this.node.style.transform = "", this.node.removeAttribute("aria-hidden");
          break;
        case Widget.HiddenMode.ContentVisibility:
          this.node.style.contentVisibility = "", this.node.style.zIndex = "";
          break;
      }
  }
}
(function(_e) {
  (function(kn) {
    kn[kn.Display = 0] = "Display", kn[kn.Scale = 1] = "Scale", kn[kn.ContentVisibility = 2] = "ContentVisibility";
  })(_e.HiddenMode || (_e.HiddenMode = {})), function(kn) {
    kn[kn.IsDisposed = 1] = "IsDisposed", kn[kn.IsAttached = 2] = "IsAttached", kn[kn.IsHidden = 4] = "IsHidden", kn[kn.IsVisible = 8] = "IsVisible", kn[kn.DisallowLayout = 16] = "DisallowLayout";
  }(_e.Flag || (_e.Flag = {})), function(kn) {
    kn.BeforeShow = new Message("before-show"), kn.AfterShow = new Message("after-show"), kn.BeforeHide = new Message("before-hide"), kn.AfterHide = new Message("after-hide"), kn.BeforeAttach = new Message("before-attach"), kn.AfterAttach = new Message("after-attach"), kn.BeforeDetach = new Message("before-detach"), kn.AfterDetach = new Message("after-detach"), kn.ParentChanged = new Message("parent-changed"), kn.UpdateRequest = new ConflatableMessage("update-request"), kn.FitRequest = new ConflatableMessage("fit-request"), kn.ActivateRequest = new ConflatableMessage("activate-request"), kn.CloseRequest = new ConflatableMessage("close-request");
  }(_e.Msg || (_e.Msg = {}));
  class Qt extends Message {
    /**
     * Construct a new child message.
     *
     * @param type - The message type.
     *
     * @param child - The child widget for the message.
     */
    constructor(Kn, er) {
      super(Kn), this.child = er;
    }
  }
  _e.ChildMessage = Qt;
  class Zt extends Message {
    /**
     * Construct a new resize message.
     *
     * @param width - The **offset width** of the widget, or `-1` if
     *   the width is not known.
     *
     * @param height - The **offset height** of the widget, or `-1` if
     *   the height is not known.
     */
    constructor(Kn, er) {
      super("resize"), this.width = Kn, this.height = er;
    }
  }
  _e.ResizeMessage = Zt, function(kn) {
    kn.UnknownSize = new kn(-1, -1);
  }(Zt = _e.ResizeMessage || (_e.ResizeMessage = {}));
  function $n(kn, Kn, er = null) {
    if (kn.parent)
      throw new Error("Cannot attach a child widget.");
    if (kn.isAttached || kn.node.isConnected)
      throw new Error("Widget is already attached.");
    if (!Kn.isConnected)
      throw new Error("Host is not attached.");
    MessageLoop.sendMessage(kn, _e.Msg.BeforeAttach), Kn.insertBefore(kn.node, er), MessageLoop.sendMessage(kn, _e.Msg.AfterAttach);
  }
  _e.attach = $n;
  function Sn(kn) {
    if (kn.parent)
      throw new Error("Cannot detach a child widget.");
    if (!kn.isAttached || !kn.node.isConnected)
      throw new Error("Widget is not attached.");
    MessageLoop.sendMessage(kn, _e.Msg.BeforeDetach), kn.node.parentNode.removeChild(kn.node), MessageLoop.sendMessage(kn, _e.Msg.AfterDetach);
  }
  _e.detach = Sn;
})(Widget || (Widget = {}));
var Private$j;
(function(_e) {
  _e.titleProperty = new AttachedProperty({
    name: "title",
    create: (Zt) => new Title$1({ owner: Zt })
  });
  function Qt(Zt) {
    return Zt.node || document.createElement(Zt.tag || "div");
  }
  _e.createNode = Qt;
})(Private$j || (Private$j = {}));
class Layout {
  /**
   * Construct a new layout.
   *
   * @param options - The options for initializing the layout.
   */
  constructor(Qt = {}) {
    this._disposed = !1, this._parent = null, this._fitPolicy = Qt.fitPolicy || "set-min-size";
  }
  /**
   * Dispose of the resources held by the layout.
   *
   * #### Notes
   * This should be reimplemented to clear and dispose of the widgets.
   *
   * All reimplementations should call the superclass method.
   *
   * This method is called automatically when the parent is disposed.
   */
  dispose() {
    this._parent = null, this._disposed = !0, Signal.clearData(this), AttachedProperty.clearData(this);
  }
  /**
   * Test whether the layout is disposed.
   */
  get isDisposed() {
    return this._disposed;
  }
  /**
   * Get the parent widget of the layout.
   */
  get parent() {
    return this._parent;
  }
  /**
   * Set the parent widget of the layout.
   *
   * #### Notes
   * This is set automatically when installing the layout on the parent
   * widget. The parent widget should not be set directly by user code.
   */
  set parent(Qt) {
    if (this._parent !== Qt) {
      if (this._parent)
        throw new Error("Cannot change parent widget.");
      if (Qt.layout !== this)
        throw new Error("Invalid parent widget.");
      this._parent = Qt, this.init();
    }
  }
  /**
   * Get the fit policy for the layout.
   *
   * #### Notes
   * The fit policy controls the computed size constraints which are
   * applied to the parent widget by the layout.
   *
   * Some layout implementations may ignore the fit policy.
   */
  get fitPolicy() {
    return this._fitPolicy;
  }
  /**
   * Set the fit policy for the layout.
   *
   * #### Notes
   * The fit policy controls the computed size constraints which are
   * applied to the parent widget by the layout.
   *
   * Some layout implementations may ignore the fit policy.
   *
   * Changing the fit policy will clear the current size constraint
   * for the parent widget and then re-fit the parent.
   */
  set fitPolicy(Qt) {
    if (this._fitPolicy !== Qt && (this._fitPolicy = Qt, this._parent)) {
      let Zt = this._parent.node.style;
      Zt.minWidth = "", Zt.minHeight = "", Zt.maxWidth = "", Zt.maxHeight = "", this._parent.fit();
    }
  }
  /**
   * Process a message sent to the parent widget.
   *
   * @param msg - The message sent to the parent widget.
   *
   * #### Notes
   * This method is called by the parent widget to process a message.
   *
   * Subclasses may reimplement this method as needed.
   */
  processParentMessage(Qt) {
    switch (Qt.type) {
      case "resize":
        this.onResize(Qt);
        break;
      case "update-request":
        this.onUpdateRequest(Qt);
        break;
      case "fit-request":
        this.onFitRequest(Qt);
        break;
      case "before-show":
        this.onBeforeShow(Qt);
        break;
      case "after-show":
        this.onAfterShow(Qt);
        break;
      case "before-hide":
        this.onBeforeHide(Qt);
        break;
      case "after-hide":
        this.onAfterHide(Qt);
        break;
      case "before-attach":
        this.onBeforeAttach(Qt);
        break;
      case "after-attach":
        this.onAfterAttach(Qt);
        break;
      case "before-detach":
        this.onBeforeDetach(Qt);
        break;
      case "after-detach":
        this.onAfterDetach(Qt);
        break;
      case "child-removed":
        this.onChildRemoved(Qt);
        break;
      case "child-shown":
        this.onChildShown(Qt);
        break;
      case "child-hidden":
        this.onChildHidden(Qt);
        break;
    }
  }
  /**
   * Perform layout initialization which requires the parent widget.
   *
   * #### Notes
   * This method is invoked immediately after the layout is installed
   * on the parent widget.
   *
   * The default implementation reparents all of the widgets to the
   * layout parent widget.
   *
   * Subclasses should reimplement this method and attach the child
   * widget nodes to the parent widget's node.
   */
  init() {
    for (const Qt of this)
      Qt.parent = this.parent;
  }
  /**
   * A message handler invoked on a `'resize'` message.
   *
   * #### Notes
   * The layout should ensure that its widgets are resized according
   * to the specified layout space, and that they are sent a `'resize'`
   * message if appropriate.
   *
   * The default implementation of this method sends an `UnknownSize`
   * resize message to all widgets.
   *
   * This may be reimplemented by subclasses as needed.
   */
  onResize(Qt) {
    for (const Zt of this)
      MessageLoop.sendMessage(Zt, Widget.ResizeMessage.UnknownSize);
  }
  /**
   * A message handler invoked on an `'update-request'` message.
   *
   * #### Notes
   * The layout should ensure that its widgets are resized according
   * to the available layout space, and that they are sent a `'resize'`
   * message if appropriate.
   *
   * The default implementation of this method sends an `UnknownSize`
   * resize message to all widgets.
   *
   * This may be reimplemented by subclasses as needed.
   */
  onUpdateRequest(Qt) {
    for (const Zt of this)
      MessageLoop.sendMessage(Zt, Widget.ResizeMessage.UnknownSize);
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   *
   * #### Notes
   * The default implementation of this method forwards the message
   * to all widgets. It assumes all widget nodes are attached to the
   * parent widget node.
   *
   * This may be reimplemented by subclasses as needed.
   */
  onBeforeAttach(Qt) {
    for (const Zt of this)
      MessageLoop.sendMessage(Zt, Qt);
  }
  /**
   * A message handler invoked on an `'after-attach'` message.
   *
   * #### Notes
   * The default implementation of this method forwards the message
   * to all widgets. It assumes all widget nodes are attached to the
   * parent widget node.
   *
   * This may be reimplemented by subclasses as needed.
   */
  onAfterAttach(Qt) {
    for (const Zt of this)
      MessageLoop.sendMessage(Zt, Qt);
  }
  /**
   * A message handler invoked on a `'before-detach'` message.
   *
   * #### Notes
   * The default implementation of this method forwards the message
   * to all widgets. It assumes all widget nodes are attached to the
   * parent widget node.
   *
   * This may be reimplemented by subclasses as needed.
   */
  onBeforeDetach(Qt) {
    for (const Zt of this)
      MessageLoop.sendMessage(Zt, Qt);
  }
  /**
   * A message handler invoked on an `'after-detach'` message.
   *
   * #### Notes
   * The default implementation of this method forwards the message
   * to all widgets. It assumes all widget nodes are attached to the
   * parent widget node.
   *
   * This may be reimplemented by subclasses as needed.
   */
  onAfterDetach(Qt) {
    for (const Zt of this)
      MessageLoop.sendMessage(Zt, Qt);
  }
  /**
   * A message handler invoked on a `'before-show'` message.
   *
   * #### Notes
   * The default implementation of this method forwards the message to
   * all non-hidden widgets. It assumes all widget nodes are attached
   * to the parent widget node.
   *
   * This may be reimplemented by subclasses as needed.
   */
  onBeforeShow(Qt) {
    for (const Zt of this)
      Zt.isHidden || MessageLoop.sendMessage(Zt, Qt);
  }
  /**
   * A message handler invoked on an `'after-show'` message.
   *
   * #### Notes
   * The default implementation of this method forwards the message to
   * all non-hidden widgets. It assumes all widget nodes are attached
   * to the parent widget node.
   *
   * This may be reimplemented by subclasses as needed.
   */
  onAfterShow(Qt) {
    for (const Zt of this)
      Zt.isHidden || MessageLoop.sendMessage(Zt, Qt);
  }
  /**
   * A message handler invoked on a `'before-hide'` message.
   *
   * #### Notes
   * The default implementation of this method forwards the message to
   * all non-hidden widgets. It assumes all widget nodes are attached
   * to the parent widget node.
   *
   * This may be reimplemented by subclasses as needed.
   */
  onBeforeHide(Qt) {
    for (const Zt of this)
      Zt.isHidden || MessageLoop.sendMessage(Zt, Qt);
  }
  /**
   * A message handler invoked on an `'after-hide'` message.
   *
   * #### Notes
   * The default implementation of this method forwards the message to
   * all non-hidden widgets. It assumes all widget nodes are attached
   * to the parent widget node.
   *
   * This may be reimplemented by subclasses as needed.
   */
  onAfterHide(Qt) {
    for (const Zt of this)
      Zt.isHidden || MessageLoop.sendMessage(Zt, Qt);
  }
  /**
   * A message handler invoked on a `'child-removed'` message.
   *
   * #### Notes
   * This will remove the child widget from the layout.
   *
   * Subclasses should **not** typically reimplement this method.
   */
  onChildRemoved(Qt) {
    this.removeWidget(Qt.child);
  }
  /**
   * A message handler invoked on a `'fit-request'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onFitRequest(Qt) {
  }
  /**
   * A message handler invoked on a `'child-shown'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onChildShown(Qt) {
  }
  /**
   * A message handler invoked on a `'child-hidden'` message.
   *
   * #### Notes
   * The default implementation of this handler is a no-op.
   */
  onChildHidden(Qt) {
  }
}
(function(_e) {
  function Qt(kn) {
    return Private$i.horizontalAlignmentProperty.get(kn);
  }
  _e.getHorizontalAlignment = Qt;
  function Zt(kn, Kn) {
    Private$i.horizontalAlignmentProperty.set(kn, Kn);
  }
  _e.setHorizontalAlignment = Zt;
  function $n(kn) {
    return Private$i.verticalAlignmentProperty.get(kn);
  }
  _e.getVerticalAlignment = $n;
  function Sn(kn, Kn) {
    Private$i.verticalAlignmentProperty.set(kn, Kn);
  }
  _e.setVerticalAlignment = Sn;
})(Layout || (Layout = {}));
class LayoutItem {
  /**
   * Construct a new layout item.
   *
   * @param widget - The widget to be managed by the item.
   *
   * #### Notes
   * The widget will be set to absolute positioning.
   * The widget will use strict CSS containment.
   */
  constructor(Qt) {
    this._top = NaN, this._left = NaN, this._width = NaN, this._height = NaN, this._minWidth = 0, this._minHeight = 0, this._maxWidth = 1 / 0, this._maxHeight = 1 / 0, this._disposed = !1, this.widget = Qt, this.widget.node.style.position = "absolute", this.widget.node.style.contain = "strict";
  }
  /**
   * Dispose of the the layout item.
   *
   * #### Notes
   * This will reset the positioning of the widget.
   */
  dispose() {
    if (this._disposed)
      return;
    this._disposed = !0;
    let Qt = this.widget.node.style;
    Qt.position = "", Qt.top = "", Qt.left = "", Qt.width = "", Qt.height = "", Qt.contain = "";
  }
  /**
   * The computed minimum width of the widget.
   *
   * #### Notes
   * This value can be updated by calling the `fit` method.
   */
  get minWidth() {
    return this._minWidth;
  }
  /**
   * The computed minimum height of the widget.
   *
   * #### Notes
   * This value can be updated by calling the `fit` method.
   */
  get minHeight() {
    return this._minHeight;
  }
  /**
   * The computed maximum width of the widget.
   *
   * #### Notes
   * This value can be updated by calling the `fit` method.
   */
  get maxWidth() {
    return this._maxWidth;
  }
  /**
   * The computed maximum height of the widget.
   *
   * #### Notes
   * This value can be updated by calling the `fit` method.
   */
  get maxHeight() {
    return this._maxHeight;
  }
  /**
   * Whether the layout item is disposed.
   */
  get isDisposed() {
    return this._disposed;
  }
  /**
   * Whether the managed widget is hidden.
   */
  get isHidden() {
    return this.widget.isHidden;
  }
  /**
   * Whether the managed widget is visible.
   */
  get isVisible() {
    return this.widget.isVisible;
  }
  /**
   * Whether the managed widget is attached.
   */
  get isAttached() {
    return this.widget.isAttached;
  }
  /**
   * Update the computed size limits of the managed widget.
   */
  fit() {
    let Qt = ElementExt.sizeLimits(this.widget.node);
    this._minWidth = Qt.minWidth, this._minHeight = Qt.minHeight, this._maxWidth = Qt.maxWidth, this._maxHeight = Qt.maxHeight;
  }
  /**
   * Update the position and size of the managed widget.
   *
   * @param left - The left edge position of the layout box.
   *
   * @param top - The top edge position of the layout box.
   *
   * @param width - The width of the layout box.
   *
   * @param height - The height of the layout box.
   */
  update(Qt, Zt, $n, Sn) {
    let kn = Math.max(this._minWidth, Math.min($n, this._maxWidth)), Kn = Math.max(this._minHeight, Math.min(Sn, this._maxHeight));
    if (kn < $n)
      switch (Layout.getHorizontalAlignment(this.widget)) {
        case "left":
          break;
        case "center":
          Qt += ($n - kn) / 2;
          break;
        case "right":
          Qt += $n - kn;
          break;
        default:
          throw "unreachable";
      }
    if (Kn < Sn)
      switch (Layout.getVerticalAlignment(this.widget)) {
        case "top":
          break;
        case "center":
          Zt += (Sn - Kn) / 2;
          break;
        case "bottom":
          Zt += Sn - Kn;
          break;
        default:
          throw "unreachable";
      }
    let er = !1, Cr = this.widget.node.style;
    if (this._top !== Zt && (this._top = Zt, Cr.top = `${Zt}px`), this._left !== Qt && (this._left = Qt, Cr.left = `${Qt}px`), this._width !== kn && (er = !0, this._width = kn, Cr.width = `${kn}px`), this._height !== Kn && (er = !0, this._height = Kn, Cr.height = `${Kn}px`), er) {
      let kr = new Widget.ResizeMessage(kn, Kn);
      MessageLoop.sendMessage(this.widget, kr);
    }
  }
}
var Private$i;
(function(_e) {
  _e.horizontalAlignmentProperty = new AttachedProperty({
    name: "horizontalAlignment",
    create: () => "center",
    changed: Qt
  }), _e.verticalAlignmentProperty = new AttachedProperty({
    name: "verticalAlignment",
    create: () => "top",
    changed: Qt
  });
  function Qt(Zt) {
    Zt.parent && Zt.parent.layout && Zt.parent.update();
  }
})(Private$i || (Private$i = {}));
class PanelLayout extends Layout {
  constructor() {
    super(...arguments), this._widgets = [];
  }
  /**
   * Dispose of the resources held by the layout.
   *
   * #### Notes
   * This will clear and dispose all widgets in the layout.
   *
   * All reimplementations should call the superclass method.
   *
   * This method is called automatically when the parent is disposed.
   */
  dispose() {
    for (; this._widgets.length > 0; )
      this._widgets.pop().dispose();
    super.dispose();
  }
  /**
   * A read-only array of the widgets in the layout.
   */
  get widgets() {
    return this._widgets;
  }
  /**
   * Create an iterator over the widgets in the layout.
   *
   * @returns A new iterator over the widgets in the layout.
   */
  *[Symbol.iterator]() {
    yield* this._widgets;
  }
  /**
   * Add a widget to the end of the layout.
   *
   * @param widget - The widget to add to the layout.
   *
   * #### Notes
   * If the widget is already contained in the layout, it will be moved.
   */
  addWidget(Qt) {
    this.insertWidget(this._widgets.length, Qt);
  }
  /**
   * Insert a widget into the layout at the specified index.
   *
   * @param index - The index at which to insert the widget.
   *
   * @param widget - The widget to insert into the layout.
   *
   * #### Notes
   * The index will be clamped to the bounds of the widgets.
   *
   * If the widget is already added to the layout, it will be moved.
   *
   * #### Undefined Behavior
   * An `index` which is non-integral.
   */
  insertWidget(Qt, Zt) {
    Zt.parent = this.parent;
    let $n = this._widgets.indexOf(Zt), Sn = Math.max(0, Math.min(Qt, this._widgets.length));
    if ($n === -1) {
      ArrayExt.insert(this._widgets, Sn, Zt), this.parent && this.attachWidget(Sn, Zt);
      return;
    }
    Sn === this._widgets.length && Sn--, $n !== Sn && (ArrayExt.move(this._widgets, $n, Sn), this.parent && this.moveWidget($n, Sn, Zt));
  }
  /**
   * Remove a widget from the layout.
   *
   * @param widget - The widget to remove from the layout.
   *
   * #### Notes
   * A widget is automatically removed from the layout when its `parent`
   * is set to `null`. This method should only be invoked directly when
   * removing a widget from a layout which has yet to be installed on a
   * parent widget.
   *
   * This method does *not* modify the widget's `parent`.
   */
  removeWidget(Qt) {
    this.removeWidgetAt(this._widgets.indexOf(Qt));
  }
  /**
   * Remove the widget at a given index from the layout.
   *
   * @param index - The index of the widget to remove.
   *
   * #### Notes
   * A widget is automatically removed from the layout when its `parent`
   * is set to `null`. This method should only be invoked directly when
   * removing a widget from a layout which has yet to be installed on a
   * parent widget.
   *
   * This method does *not* modify the widget's `parent`.
   *
   * #### Undefined Behavior
   * An `index` which is non-integral.
   */
  removeWidgetAt(Qt) {
    let Zt = ArrayExt.removeAt(this._widgets, Qt);
    Zt && this.parent && this.detachWidget(Qt, Zt);
  }
  /**
   * Perform layout initialization which requires the parent widget.
   */
  init() {
    super.init();
    let Qt = 0;
    for (const Zt of this)
      this.attachWidget(Qt++, Zt);
  }
  /**
   * Attach a widget to the parent's DOM node.
   *
   * @param index - The current index of the widget in the layout.
   *
   * @param widget - The widget to attach to the parent.
   *
   * #### Notes
   * This method is called automatically by the panel layout at the
   * appropriate time. It should not be called directly by user code.
   *
   * The default implementation adds the widgets's node to the parent's
   * node at the proper location, and sends the appropriate attach
   * messages to the widget if the parent is attached to the DOM.
   *
   * Subclasses may reimplement this method to control how the widget's
   * node is added to the parent's node.
   */
  attachWidget(Qt, Zt) {
    let $n = this.parent.node.children[Qt];
    this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.BeforeAttach), this.parent.node.insertBefore(Zt.node, $n), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.AfterAttach);
  }
  /**
   * Move a widget in the parent's DOM node.
   *
   * @param fromIndex - The previous index of the widget in the layout.
   *
   * @param toIndex - The current index of the widget in the layout.
   *
   * @param widget - The widget to move in the parent.
   *
   * #### Notes
   * This method is called automatically by the panel layout at the
   * appropriate time. It should not be called directly by user code.
   *
   * The default implementation moves the widget's node to the proper
   * location in the parent's node and sends the appropriate attach and
   * detach messages to the widget if the parent is attached to the DOM.
   *
   * Subclasses may reimplement this method to control how the widget's
   * node is moved in the parent's node.
   */
  moveWidget(Qt, Zt, $n) {
    this.parent.isAttached && MessageLoop.sendMessage($n, Widget.Msg.BeforeDetach), this.parent.node.removeChild($n.node), this.parent.isAttached && MessageLoop.sendMessage($n, Widget.Msg.AfterDetach);
    let Sn = this.parent.node.children[Zt];
    this.parent.isAttached && MessageLoop.sendMessage($n, Widget.Msg.BeforeAttach), this.parent.node.insertBefore($n.node, Sn), this.parent.isAttached && MessageLoop.sendMessage($n, Widget.Msg.AfterAttach);
  }
  /**
   * Detach a widget from the parent's DOM node.
   *
   * @param index - The previous index of the widget in the layout.
   *
   * @param widget - The widget to detach from the parent.
   *
   * #### Notes
   * This method is called automatically by the panel layout at the
   * appropriate time. It should not be called directly by user code.
   *
   * The default implementation removes the widget's node from the
   * parent's node, and sends the appropriate detach messages to the
   * widget if the parent is attached to the DOM.
   *
   * Subclasses may reimplement this method to control how the widget's
   * node is removed from the parent's node.
   */
  detachWidget(Qt, Zt) {
    this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.BeforeDetach), this.parent.node.removeChild(Zt.node), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.AfterDetach);
  }
}
var Utils;
(function(_e) {
  function Qt(Zt) {
    return Math.max(0, Math.floor(Zt));
  }
  _e.clampDimension = Qt;
})(Utils || (Utils = {}));
var Utils$1 = Utils;
class SplitLayout extends PanelLayout {
  /**
   * Construct a new split layout.
   *
   * @param options - The options for initializing the layout.
   */
  constructor(Qt) {
    super(), this.widgetOffset = 0, this._fixed = 0, this._spacing = 4, this._dirty = !1, this._hasNormedSizes = !1, this._sizers = [], this._items = [], this._handles = [], this._box = null, this._alignment = "start", this._orientation = "horizontal", this.renderer = Qt.renderer, Qt.orientation !== void 0 && (this._orientation = Qt.orientation), Qt.alignment !== void 0 && (this._alignment = Qt.alignment), Qt.spacing !== void 0 && (this._spacing = Utils.clampDimension(Qt.spacing));
  }
  /**
   * Dispose of the resources held by the layout.
   */
  dispose() {
    for (const Qt of this._items)
      Qt.dispose();
    this._box = null, this._items.length = 0, this._sizers.length = 0, this._handles.length = 0, super.dispose();
  }
  /**
   * Get the layout orientation for the split layout.
   */
  get orientation() {
    return this._orientation;
  }
  /**
   * Set the layout orientation for the split layout.
   */
  set orientation(Qt) {
    this._orientation !== Qt && (this._orientation = Qt, this.parent && (this.parent.dataset.orientation = Qt, this.parent.fit()));
  }
  /**
   * Get the content alignment for the split layout.
   *
   * #### Notes
   * This is the alignment of the widgets in the layout direction.
   *
   * The alignment has no effect if the widgets can expand  to fill the
   * entire split layout.
   */
  get alignment() {
    return this._alignment;
  }
  /**
   * Set the content alignment for the split layout.
   *
   * #### Notes
   * This is the alignment of the widgets in the layout direction.
   *
   * The alignment has no effect if the widgets can expand  to fill the
   * entire split layout.
   */
  set alignment(Qt) {
    this._alignment !== Qt && (this._alignment = Qt, this.parent && (this.parent.dataset.alignment = Qt, this.parent.update()));
  }
  /**
   * Get the inter-element spacing for the split layout.
   */
  get spacing() {
    return this._spacing;
  }
  /**
   * Set the inter-element spacing for the split layout.
   */
  set spacing(Qt) {
    Qt = Utils.clampDimension(Qt), this._spacing !== Qt && (this._spacing = Qt, this.parent && this.parent.fit());
  }
  /**
   * A read-only array of the split handles in the layout.
   */
  get handles() {
    return this._handles;
  }
  /**
   * Get the absolute sizes of the widgets in the layout.
   *
   * @returns A new array of the absolute sizes of the widgets.
   *
   * This method **does not** measure the DOM nodes.
   */
  absoluteSizes() {
    return this._sizers.map((Qt) => Qt.size);
  }
  /**
   * Get the relative sizes of the widgets in the layout.
   *
   * @returns A new array of the relative sizes of the widgets.
   *
   * #### Notes
   * The returned sizes reflect the sizes of the widgets normalized
   * relative to their siblings.
   *
   * This method **does not** measure the DOM nodes.
   */
  relativeSizes() {
    return Private$h.normalize(this._sizers.map((Qt) => Qt.size));
  }
  /**
   * Set the relative sizes for the widgets in the layout.
   *
   * @param sizes - The relative sizes for the widgets in the panel.
   * @param update - Update the layout after setting relative sizes.
   * Default is True.
   *
   * #### Notes
   * Extra values are ignored, too few will yield an undefined layout.
   *
   * The actual geometry of the DOM nodes is updated asynchronously.
   */
  setRelativeSizes(Qt, Zt = !0) {
    let $n = this._sizers.length, Sn = Qt.slice(0, $n);
    for (; Sn.length < $n; )
      Sn.push(0);
    let kn = Private$h.normalize(Sn);
    for (let Kn = 0; Kn < $n; ++Kn) {
      let er = this._sizers[Kn];
      er.sizeHint = kn[Kn], er.size = kn[Kn];
    }
    this._hasNormedSizes = !0, Zt && this.parent && this.parent.update();
  }
  /**
   * Move the offset position of a split handle.
   *
   * @param index - The index of the handle of the interest.
   *
   * @param position - The desired offset position of the handle.
   *
   * #### Notes
   * The position is relative to the offset parent.
   *
   * This will move the handle as close as possible to the desired
   * position. The sibling widgets will be adjusted as necessary.
   */
  moveHandle(Qt, Zt) {
    let $n = this._handles[Qt];
    if (!$n || $n.classList.contains("lm-mod-hidden"))
      return;
    let Sn;
    if (this._orientation === "horizontal" ? Sn = Zt - $n.offsetLeft : Sn = Zt - $n.offsetTop, Sn !== 0) {
      for (let kn of this._sizers)
        kn.size > 0 && (kn.sizeHint = kn.size);
      BoxEngine.adjust(this._sizers, Qt, Sn), this.parent && this.parent.update();
    }
  }
  /**
   * Perform layout initialization which requires the parent widget.
   */
  init() {
    this.parent.dataset.orientation = this.orientation, this.parent.dataset.alignment = this.alignment, super.init();
  }
  /**
   * Attach a widget to the parent's DOM node.
   *
   * @param index - The current index of the widget in the layout.
   *
   * @param widget - The widget to attach to the parent.
   *
   * #### Notes
   * This is a reimplementation of the superclass method.
   */
  attachWidget(Qt, Zt) {
    let $n = new LayoutItem(Zt), Sn = Private$h.createHandle(this.renderer), kn = Private$h.averageSize(this._sizers), Kn = Private$h.createSizer(kn);
    ArrayExt.insert(this._items, Qt, $n), ArrayExt.insert(this._sizers, Qt, Kn), ArrayExt.insert(this._handles, Qt, Sn), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.BeforeAttach), this.parent.node.appendChild(Zt.node), this.parent.node.appendChild(Sn), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.AfterAttach), this.parent.fit();
  }
  /**
   * Move a widget in the parent's DOM node.
   *
   * @param fromIndex - The previous index of the widget in the layout.
   *
   * @param toIndex - The current index of the widget in the layout.
   *
   * @param widget - The widget to move in the parent.
   *
   * #### Notes
   * This is a reimplementation of the superclass method.
   */
  moveWidget(Qt, Zt, $n) {
    ArrayExt.move(this._items, Qt, Zt), ArrayExt.move(this._sizers, Qt, Zt), ArrayExt.move(this._handles, Qt, Zt), this.parent.fit();
  }
  /**
   * Detach a widget from the parent's DOM node.
   *
   * @param index - The previous index of the widget in the layout.
   *
   * @param widget - The widget to detach from the parent.
   *
   * #### Notes
   * This is a reimplementation of the superclass method.
   */
  detachWidget(Qt, Zt) {
    let $n = ArrayExt.removeAt(this._items, Qt), Sn = ArrayExt.removeAt(this._handles, Qt);
    ArrayExt.removeAt(this._sizers, Qt), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.BeforeDetach), this.parent.node.removeChild(Zt.node), this.parent.node.removeChild(Sn), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.AfterDetach), $n.dispose(), this.parent.fit();
  }
  /**
   * A message handler invoked on a `'before-show'` message.
   */
  onBeforeShow(Qt) {
    super.onBeforeShow(Qt), this.parent.update();
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   */
  onBeforeAttach(Qt) {
    super.onBeforeAttach(Qt), this.parent.fit();
  }
  /**
   * A message handler invoked on a `'child-shown'` message.
   */
  onChildShown(Qt) {
    this.parent.fit();
  }
  /**
   * A message handler invoked on a `'child-hidden'` message.
   */
  onChildHidden(Qt) {
    this.parent.fit();
  }
  /**
   * A message handler invoked on a `'resize'` message.
   */
  onResize(Qt) {
    this.parent.isVisible && this._update(Qt.width, Qt.height);
  }
  /**
   * A message handler invoked on an `'update-request'` message.
   */
  onUpdateRequest(Qt) {
    this.parent.isVisible && this._update(-1, -1);
  }
  /**
   * A message handler invoked on a `'fit-request'` message.
   */
  onFitRequest(Qt) {
    this.parent.isAttached && this._fit();
  }
  /**
   * Update the item position.
   *
   * @param i Item index
   * @param isHorizontal Whether the layout is horizontal or not
   * @param left Left position in pixels
   * @param top Top position in pixels
   * @param height Item height
   * @param width Item width
   * @param size Item size
   */
  updateItemPosition(Qt, Zt, $n, Sn, kn, Kn, er) {
    const Cr = this._items[Qt];
    if (Cr.isHidden)
      return;
    let kr = this._handles[Qt].style;
    Zt ? ($n += this.widgetOffset, Cr.update($n, Sn, er, kn), $n += er, kr.top = `${Sn}px`, kr.left = `${$n}px`, kr.width = `${this._spacing}px`, kr.height = `${kn}px`) : (Sn += this.widgetOffset, Cr.update($n, Sn, Kn, er), Sn += er, kr.top = `${Sn}px`, kr.left = `${$n}px`, kr.width = `${Kn}px`, kr.height = `${this._spacing}px`);
  }
  /**
   * Fit the layout to the total size required by the widgets.
   */
  _fit() {
    let Qt = 0, Zt = -1;
    for (let Cr = 0, kr = this._items.length; Cr < kr; ++Cr)
      this._items[Cr].isHidden ? this._handles[Cr].classList.add("lm-mod-hidden") : (this._handles[Cr].classList.remove("lm-mod-hidden"), Zt = Cr, Qt++);
    Zt !== -1 && this._handles[Zt].classList.add("lm-mod-hidden"), this._fixed = this._spacing * Math.max(0, Qt - 1) + this.widgetOffset * this._items.length;
    let $n = this._orientation === "horizontal", Sn = $n ? this._fixed : 0, kn = $n ? 0 : this._fixed;
    for (let Cr = 0, kr = this._items.length; Cr < kr; ++Cr) {
      let Yr = this._items[Cr], Ms = this._sizers[Cr];
      if (Ms.size > 0 && (Ms.sizeHint = Ms.size), Yr.isHidden) {
        Ms.minSize = 0, Ms.maxSize = 0;
        continue;
      }
      Yr.fit(), Ms.stretch = SplitLayout.getStretch(Yr.widget), $n ? (Ms.minSize = Yr.minWidth, Ms.maxSize = Yr.maxWidth, Sn += Yr.minWidth, kn = Math.max(kn, Yr.minHeight)) : (Ms.minSize = Yr.minHeight, Ms.maxSize = Yr.maxHeight, kn += Yr.minHeight, Sn = Math.max(Sn, Yr.minWidth));
    }
    let Kn = this._box = ElementExt.boxSizing(this.parent.node);
    Sn += Kn.horizontalSum, kn += Kn.verticalSum;
    let er = this.parent.node.style;
    er.minWidth = `${Sn}px`, er.minHeight = `${kn}px`, this._dirty = !0, this.parent.parent && MessageLoop.sendMessage(this.parent.parent, Widget.Msg.FitRequest), this._dirty && MessageLoop.sendMessage(this.parent, Widget.Msg.UpdateRequest);
  }
  /**
   * Update the layout position and size of the widgets.
   *
   * The parent offset dimensions should be `-1` if unknown.
   */
  _update(Qt, Zt) {
    this._dirty = !1;
    let $n = 0;
    for (let Ms = 0, Ds = this._items.length; Ms < Ds; ++Ms)
      $n += +!this._items[Ms].isHidden;
    if ($n === 0 && this.widgetOffset === 0)
      return;
    Qt < 0 && (Qt = this.parent.node.offsetWidth), Zt < 0 && (Zt = this.parent.node.offsetHeight), this._box || (this._box = ElementExt.boxSizing(this.parent.node));
    let Sn = this._box.paddingTop, kn = this._box.paddingLeft, Kn = Qt - this._box.horizontalSum, er = Zt - this._box.verticalSum, Cr = 0, kr = 0, Yr = this._orientation === "horizontal";
    if ($n > 0) {
      let Ms;
      if (Yr ? Ms = Math.max(0, Kn - this._fixed) : Ms = Math.max(0, er - this._fixed), this._hasNormedSizes) {
        for (let Ls of this._sizers)
          Ls.sizeHint *= Ms;
        this._hasNormedSizes = !1;
      }
      let Ds = BoxEngine.calc(this._sizers, Ms);
      if (Ds > 0)
        switch (this._alignment) {
          case "start":
            break;
          case "center":
            Cr = 0, kr = Ds / 2;
            break;
          case "end":
            Cr = 0, kr = Ds;
            break;
          case "justify":
            Cr = Ds / $n, kr = 0;
            break;
          default:
            throw "unreachable";
        }
    }
    for (let Ms = 0, Ds = this._items.length; Ms < Ds; ++Ms) {
      const js = this._items[Ms].isHidden ? 0 : this._sizers[Ms].size + Cr;
      this.updateItemPosition(Ms, Yr, Yr ? kn + kr : kn, Yr ? Sn : Sn + kr, er, Kn, js);
      const zs = this.widgetOffset + (this._handles[Ms].classList.contains("lm-mod-hidden") ? 0 : this._spacing);
      Yr ? kn += js + zs : Sn += js + zs;
    }
  }
}
(function(_e) {
  function Qt($n) {
    return Private$h.stretchProperty.get($n);
  }
  _e.getStretch = Qt;
  function Zt($n, Sn) {
    Private$h.stretchProperty.set($n, Sn);
  }
  _e.setStretch = Zt;
})(SplitLayout || (SplitLayout = {}));
var Private$h;
(function(_e) {
  _e.stretchProperty = new AttachedProperty({
    name: "stretch",
    create: () => 0,
    coerce: (Kn, er) => Math.max(0, Math.floor(er)),
    changed: kn
  });
  function Qt(Kn) {
    let er = new BoxSizer();
    return er.sizeHint = Math.floor(Kn), er;
  }
  _e.createSizer = Qt;
  function Zt(Kn) {
    let er = Kn.createHandle();
    return er.style.position = "absolute", er.style.contain = "style", er;
  }
  _e.createHandle = Zt;
  function $n(Kn) {
    return Kn.reduce((er, Cr) => er + Cr.size, 0) / Kn.length || 0;
  }
  _e.averageSize = $n;
  function Sn(Kn) {
    let er = Kn.length;
    if (er === 0)
      return [];
    let Cr = Kn.reduce((kr, Yr) => kr + Math.abs(Yr), 0);
    return Cr === 0 ? Kn.map((kr) => 1 / er) : Kn.map((kr) => kr / Cr);
  }
  _e.normalize = Sn;
  function kn(Kn) {
    Kn.parent && Kn.parent.layout instanceof SplitLayout && Kn.parent.fit();
  }
})(Private$h || (Private$h = {}));
class AccordionLayout extends SplitLayout {
  /**
   * Construct a new accordion layout.
   *
   * @param options - The options for initializing the layout.
   *
   * #### Notes
   * The default orientation will be vertical.
   *
   * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css
   */
  constructor(Qt) {
    super({ ...Qt, orientation: Qt.orientation || "vertical" }), this._titles = [], this.titleSpace = Qt.titleSpace || 22;
  }
  /**
   * The section title height or width depending on the orientation.
   */
  get titleSpace() {
    return this.widgetOffset;
  }
  set titleSpace(Qt) {
    Qt = Utils$1.clampDimension(Qt), this.widgetOffset !== Qt && (this.widgetOffset = Qt, this.parent && this.parent.fit());
  }
  /**
   * A read-only array of the section titles in the panel.
   */
  get titles() {
    return this._titles;
  }
  /**
   * Dispose of the resources held by the layout.
   */
  dispose() {
    this.isDisposed || (this._titles.length = 0, super.dispose());
  }
  updateTitle(Qt, Zt) {
    const $n = this._titles[Qt], Sn = $n.classList.contains("lm-mod-expanded"), kn = Private$g.createTitle(this.renderer, Zt.title, Sn);
    this._titles[Qt] = kn, this.parent.node.replaceChild(kn, $n);
  }
  /**
   * Insert a widget into the layout at the specified index.
   *
   * @param index - The index at which to insert the widget.
   *
   * @param widget - The widget to insert into the layout.
   *
   * #### Notes
   * The index will be clamped to the bounds of the widgets.
   *
   * If the widget is already added to the layout, it will be moved.
   *
   * #### Undefined Behavior
   * An `index` which is non-integral.
   */
  insertWidget(Qt, Zt) {
    Zt.id || (Zt.id = `id-${UUID$1.uuid4()}`), super.insertWidget(Qt, Zt);
  }
  /**
   * Attach a widget to the parent's DOM node.
   *
   * @param index - The current index of the widget in the layout.
   *
   * @param widget - The widget to attach to the parent.
   */
  attachWidget(Qt, Zt) {
    const $n = Private$g.createTitle(this.renderer, Zt.title);
    ArrayExt.insert(this._titles, Qt, $n), this.parent.node.appendChild($n), Zt.node.setAttribute("role", "region"), Zt.node.setAttribute("aria-labelledby", $n.id), super.attachWidget(Qt, Zt);
  }
  /**
   * Move a widget in the parent's DOM node.
   *
   * @param fromIndex - The previous index of the widget in the layout.
   *
   * @param toIndex - The current index of the widget in the layout.
   *
   * @param widget - The widget to move in the parent.
   */
  moveWidget(Qt, Zt, $n) {
    ArrayExt.move(this._titles, Qt, Zt), super.moveWidget(Qt, Zt, $n);
  }
  /**
   * Detach a widget from the parent's DOM node.
   *
   * @param index - The previous index of the widget in the layout.
   *
   * @param widget - The widget to detach from the parent.
   *
   * #### Notes
   * This is a reimplementation of the superclass method.
   */
  detachWidget(Qt, Zt) {
    const $n = ArrayExt.removeAt(this._titles, Qt);
    this.parent.node.removeChild($n), super.detachWidget(Qt, Zt);
  }
  /**
   * Update the item position.
   *
   * @param i Item index
   * @param isHorizontal Whether the layout is horizontal or not
   * @param left Left position in pixels
   * @param top Top position in pixels
   * @param height Item height
   * @param width Item width
   * @param size Item size
   */
  updateItemPosition(Qt, Zt, $n, Sn, kn, Kn, er) {
    const Cr = this._titles[Qt].style;
    Cr.top = `${Sn}px`, Cr.left = `${$n}px`, Cr.height = `${this.widgetOffset}px`, Zt ? Cr.width = `${kn}px` : Cr.width = `${Kn}px`, super.updateItemPosition(Qt, Zt, $n, Sn, kn, Kn, er);
  }
}
var Private$g;
(function(_e) {
  function Qt(Zt, $n, Sn = !0) {
    const kn = Zt.createSectionTitle($n);
    return kn.style.position = "absolute", kn.style.contain = "strict", kn.setAttribute("aria-label", `${$n.label} Section`), kn.setAttribute("aria-expanded", Sn ? "true" : "false"), kn.setAttribute("aria-controls", $n.owner.id), Sn && kn.classList.add("lm-mod-expanded"), kn;
  }
  _e.createTitle = Qt;
})(Private$g || (Private$g = {}));
class Panel extends Widget {
  /**
   * Construct a new panel.
   *
   * @param options - The options for initializing the panel.
   */
  constructor(Qt = {}) {
    super(), this.addClass("lm-Panel"), this.layout = Private$f.createLayout(Qt);
  }
  /**
   * A read-only array of the widgets in the panel.
   */
  get widgets() {
    return this.layout.widgets;
  }
  /**
   * Add a widget to the end of the panel.
   *
   * @param widget - The widget to add to the panel.
   *
   * #### Notes
   * If the widget is already contained in the panel, it will be moved.
   */
  addWidget(Qt) {
    this.layout.addWidget(Qt);
  }
  /**
   * Insert a widget at the specified index.
   *
   * @param index - The index at which to insert the widget.
   *
   * @param widget - The widget to insert into to the panel.
   *
   * #### Notes
   * If the widget is already contained in the panel, it will be moved.
   */
  insertWidget(Qt, Zt) {
    this.layout.insertWidget(Qt, Zt);
  }
}
var Private$f;
(function(_e) {
  function Qt(Zt) {
    return Zt.layout || new PanelLayout();
  }
  _e.createLayout = Qt;
})(Private$f || (Private$f = {}));
class SplitPanel extends Panel {
  /**
   * Construct a new split panel.
   *
   * @param options - The options for initializing the split panel.
   */
  constructor(Qt = {}) {
    super({ layout: Private$e.createLayout(Qt) }), this._handleMoved = new Signal(this), this._pressData = null, this.addClass("lm-SplitPanel");
  }
  /**
   * Dispose of the resources held by the panel.
   */
  dispose() {
    this._releaseMouse(), super.dispose();
  }
  /**
   * Get the layout orientation for the split panel.
   */
  get orientation() {
    return this.layout.orientation;
  }
  /**
   * Set the layout orientation for the split panel.
   */
  set orientation(Qt) {
    this.layout.orientation = Qt;
  }
  /**
   * Get the content alignment for the split panel.
   *
   * #### Notes
   * This is the alignment of the widgets in the layout direction.
   *
   * The alignment has no effect if the widgets can expand to fill the
   * entire split panel.
   */
  get alignment() {
    return this.layout.alignment;
  }
  /**
   * Set the content alignment for the split panel.
   *
   * #### Notes
   * This is the alignment of the widgets in the layout direction.
   *
   * The alignment has no effect if the widgets can expand to fill the
   * entire split panel.
   */
  set alignment(Qt) {
    this.layout.alignment = Qt;
  }
  /**
   * Get the inter-element spacing for the split panel.
   */
  get spacing() {
    return this.layout.spacing;
  }
  /**
   * Set the inter-element spacing for the split panel.
   */
  set spacing(Qt) {
    this.layout.spacing = Qt;
  }
  /**
   * The renderer used by the split panel.
   */
  get renderer() {
    return this.layout.renderer;
  }
  /**
   * A signal emitted when a split handle has moved.
   */
  get handleMoved() {
    return this._handleMoved;
  }
  /**
   * A read-only array of the split handles in the panel.
   */
  get handles() {
    return this.layout.handles;
  }
  /**
   * Get the relative sizes of the widgets in the panel.
   *
   * @returns A new array of the relative sizes of the widgets.
   *
   * #### Notes
   * The returned sizes reflect the sizes of the widgets normalized
   * relative to their siblings.
   *
   * This method **does not** measure the DOM nodes.
   */
  relativeSizes() {
    return this.layout.relativeSizes();
  }
  /**
   * Set the relative sizes for the widgets in the panel.
   *
   * @param sizes - The relative sizes for the widgets in the panel.
   * @param update - Update the layout after setting relative sizes.
   * Default is True.
   *
   * #### Notes
   * Extra values are ignored, too few will yield an undefined layout.
   *
   * The actual geometry of the DOM nodes is updated asynchronously.
   */
  setRelativeSizes(Qt, Zt = !0) {
    this.layout.setRelativeSizes(Qt, Zt);
  }
  /**
   * Handle the DOM events for the split panel.
   *
   * @param event - The DOM event sent to the panel.
   *
   * #### Notes
   * This method implements the DOM `EventListener` interface and is
   * called in response to events on the panel's DOM node. It should
   * not be called directly by user code.
   */
  handleEvent(Qt) {
    switch (Qt.type) {
      case "pointerdown":
        this._evtPointerDown(Qt);
        break;
      case "pointermove":
        this._evtPointerMove(Qt);
        break;
      case "pointerup":
        this._evtPointerUp(Qt);
        break;
      case "keydown":
        this._evtKeyDown(Qt);
        break;
      case "contextmenu":
        Qt.preventDefault(), Qt.stopPropagation();
        break;
    }
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   */
  onBeforeAttach(Qt) {
    this.node.addEventListener("pointerdown", this);
  }
  /**
   * A message handler invoked on an `'after-detach'` message.
   */
  onAfterDetach(Qt) {
    this.node.removeEventListener("pointerdown", this), this._releaseMouse();
  }
  /**
   * A message handler invoked on a `'child-added'` message.
   */
  onChildAdded(Qt) {
    Qt.child.addClass("lm-SplitPanel-child"), this._releaseMouse();
  }
  /**
   * A message handler invoked on a `'child-removed'` message.
   */
  onChildRemoved(Qt) {
    Qt.child.removeClass("lm-SplitPanel-child"), this._releaseMouse();
  }
  /**
   * Handle the `'keydown'` event for the split panel.
   */
  _evtKeyDown(Qt) {
    this._pressData && (Qt.preventDefault(), Qt.stopPropagation()), Qt.keyCode === 27 && this._releaseMouse();
  }
  /**
   * Handle the `'pointerdown'` event for the split panel.
   */
  _evtPointerDown(Qt) {
    if (Qt.button !== 0)
      return;
    let Zt = this.layout, $n = ArrayExt.findFirstIndex(Zt.handles, (kr) => kr.contains(Qt.target));
    if ($n === -1)
      return;
    Qt.preventDefault(), Qt.stopPropagation(), document.addEventListener("pointerup", this, !0), document.addEventListener("pointermove", this, !0), document.addEventListener("keydown", this, !0), document.addEventListener("contextmenu", this, !0);
    let Sn, kn = Zt.handles[$n], Kn = kn.getBoundingClientRect();
    Zt.orientation === "horizontal" ? Sn = Qt.clientX - Kn.left : Sn = Qt.clientY - Kn.top;
    let er = window.getComputedStyle(kn), Cr = Drag.overrideCursor(er.cursor);
    this._pressData = { index: $n, delta: Sn, override: Cr };
  }
  /**
   * Handle the `'pointermove'` event for the split panel.
   */
  _evtPointerMove(Qt) {
    Qt.preventDefault(), Qt.stopPropagation();
    let Zt, $n = this.layout, Sn = this.node.getBoundingClientRect();
    $n.orientation === "horizontal" ? Zt = Qt.clientX - Sn.left - this._pressData.delta : Zt = Qt.clientY - Sn.top - this._pressData.delta, $n.moveHandle(this._pressData.index, Zt);
  }
  /**
   * Handle the `'pointerup'` event for the split panel.
   */
  _evtPointerUp(Qt) {
    Qt.button === 0 && (Qt.preventDefault(), Qt.stopPropagation(), this._releaseMouse());
  }
  /**
   * Release the mouse grab for the split panel.
   */
  _releaseMouse() {
    this._pressData && (this._pressData.override.dispose(), this._pressData = null, this._handleMoved.emit(), document.removeEventListener("keydown", this, !0), document.removeEventListener("pointerup", this, !0), document.removeEventListener("pointermove", this, !0), document.removeEventListener("contextmenu", this, !0));
  }
}
(function(_e) {
  class Qt {
    /**
     * Create a new handle for use with a split panel.
     *
     * @returns A new handle element for a split panel.
     */
    createHandle() {
      let kn = document.createElement("div");
      return kn.className = "lm-SplitPanel-handle", kn;
    }
  }
  _e.Renderer = Qt, _e.defaultRenderer = new Qt();
  function Zt(Sn) {
    return SplitLayout.getStretch(Sn);
  }
  _e.getStretch = Zt;
  function $n(Sn, kn) {
    SplitLayout.setStretch(Sn, kn);
  }
  _e.setStretch = $n;
})(SplitPanel || (SplitPanel = {}));
var Private$e;
(function(_e) {
  function Qt(Zt) {
    return Zt.layout || new SplitLayout({
      renderer: Zt.renderer || SplitPanel.defaultRenderer,
      orientation: Zt.orientation,
      alignment: Zt.alignment,
      spacing: Zt.spacing
    });
  }
  _e.createLayout = Qt;
})(Private$e || (Private$e = {}));
class AccordionPanel extends SplitPanel {
  /**
   * Construct a new accordion panel.
   *
   * @param options - The options for initializing the accordion panel.
   */
  constructor(Qt = {}) {
    super({ ...Qt, layout: Private$d$1.createLayout(Qt) }), this._widgetSizesCache = /* @__PURE__ */ new WeakMap(), this._expansionToggled = new Signal(this), this.addClass("lm-AccordionPanel");
  }
  /**
   * The renderer used by the accordion panel.
   */
  get renderer() {
    return this.layout.renderer;
  }
  /**
   * The section title space.
   *
   * This is the height if the panel is vertical and the width if it is
   * horizontal.
   */
  get titleSpace() {
    return this.layout.titleSpace;
  }
  set titleSpace(Qt) {
    this.layout.titleSpace = Qt;
  }
  /**
   * A read-only array of the section titles in the panel.
   */
  get titles() {
    return this.layout.titles;
  }
  /**
   * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.
   */
  get expansionToggled() {
    return this._expansionToggled;
  }
  /**
   * Add a widget to the end of the panel.
   *
   * @param widget - The widget to add to the panel.
   *
   * #### Notes
   * If the widget is already contained in the panel, it will be moved.
   */
  addWidget(Qt) {
    super.addWidget(Qt), Qt.title.changed.connect(this._onTitleChanged, this);
  }
  /**
   * Collapse the widget at position `index`.
   *
   * #### Notes
   * If no widget is found for `index`, this will bail.
   *
   * @param index Widget index
   */
  collapse(Qt) {
    const Zt = this.layout.widgets[Qt];
    Zt && !Zt.isHidden && this._toggleExpansion(Qt);
  }
  /**
   * Expand the widget at position `index`.
   *
   * #### Notes
   * If no widget is found for `index`, this will bail.
   *
   * @param index Widget index
   */
  expand(Qt) {
    const Zt = this.layout.widgets[Qt];
    Zt && Zt.isHidden && this._toggleExpansion(Qt);
  }
  /**
   * Insert a widget at the specified index.
   *
   * @param index - The index at which to insert the widget.
   *
   * @param widget - The widget to insert into to the panel.
   *
   * #### Notes
   * If the widget is already contained in the panel, it will be moved.
   */
  insertWidget(Qt, Zt) {
    super.insertWidget(Qt, Zt), Zt.title.changed.connect(this._onTitleChanged, this);
  }
  /**
   * Handle the DOM events for the accordion panel.
   *
   * @param event - The DOM event sent to the panel.
   *
   * #### Notes
   * This method implements the DOM `EventListener` interface and is
   * called in response to events on the panel's DOM node. It should
   * not be called directly by user code.
   */
  handleEvent(Qt) {
    switch (super.handleEvent(Qt), Qt.type) {
      case "click":
        this._evtClick(Qt);
        break;
      case "keydown":
        this._eventKeyDown(Qt);
        break;
    }
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   */
  onBeforeAttach(Qt) {
    this.node.addEventListener("click", this), this.node.addEventListener("keydown", this), super.onBeforeAttach(Qt);
  }
  /**
   * A message handler invoked on an `'after-detach'` message.
   */
  onAfterDetach(Qt) {
    super.onAfterDetach(Qt), this.node.removeEventListener("click", this), this.node.removeEventListener("keydown", this);
  }
  /**
   * Handle the `changed` signal of a title object.
   */
  _onTitleChanged(Qt) {
    const Zt = ArrayExt.findFirstIndex(this.widgets, ($n) => $n.contains(Qt.owner));
    Zt >= 0 && (this.layout.updateTitle(Zt, Qt.owner), this.update());
  }
  /**
   * Compute the size of widgets in this panel on the title click event.
   * On closing, the size of the widget is cached and we will try to expand
   * the last opened widget.
   * On opening, we will use the cached size if it is available to restore the
   * widget.
   * In both cases, if we can not compute the size of widgets, we will let
   * `SplitLayout` decide.
   *
   * @param index - The index of widget to be opened of closed
   *
   * @returns Relative size of widgets in this panel, if this size can
   * not be computed, return `undefined`
   */
  _computeWidgetSize(Qt) {
    const Zt = this.layout, $n = Zt.widgets[Qt];
    if (!$n)
      return;
    const Sn = $n.isHidden, kn = Zt.absoluteSizes(), Kn = (Sn ? -1 : 1) * this.spacing, er = kn.reduce((kr, Yr) => kr + Yr);
    let Cr = [...kn];
    if (Sn) {
      const kr = this._widgetSizesCache.get($n);
      if (!kr)
        return;
      Cr[Qt] += kr;
      const Yr = Cr.map((Ms) => Ms - kr > 0).lastIndexOf(!0);
      Yr === -1 ? Cr.forEach((Ms, Ds) => {
        Ds !== Qt && (Cr[Ds] -= kn[Ds] / er * (kr - Kn));
      }) : Cr[Yr] -= kr - Kn;
    } else {
      const kr = kn[Qt];
      this._widgetSizesCache.set($n, kr), Cr[Qt] = 0;
      const Yr = Cr.map((Ms) => Ms > 0).lastIndexOf(!0);
      if (Yr === -1)
        return;
      Cr[Yr] = kn[Yr] + kr + Kn;
    }
    return Cr.map((kr) => kr / (er + Kn));
  }
  /**
   * Handle the `'click'` event for the accordion panel
   */
  _evtClick(Qt) {
    const Zt = Qt.target;
    if (Zt) {
      const $n = ArrayExt.findFirstIndex(this.titles, (Sn) => Sn.contains(Zt));
      $n >= 0 && (Qt.preventDefault(), Qt.stopPropagation(), this._toggleExpansion($n));
    }
  }
  /**
   * Handle the `'keydown'` event for the accordion panel.
   */
  _eventKeyDown(Qt) {
    if (Qt.defaultPrevented)
      return;
    const Zt = Qt.target;
    let $n = !1;
    if (Zt) {
      const Sn = ArrayExt.findFirstIndex(this.titles, (kn) => kn.contains(Zt));
      if (Sn >= 0) {
        const kn = Qt.keyCode.toString();
        if (Qt.key.match(/Space|Enter/) || kn.match(/13|32/))
          Zt.click(), $n = !0;
        else if (this.orientation === "horizontal" ? Qt.key.match(/ArrowLeft|ArrowRight/) || kn.match(/37|39/) : Qt.key.match(/ArrowUp|ArrowDown/) || kn.match(/38|40/)) {
          const Kn = Qt.key.match(/ArrowLeft|ArrowUp/) || kn.match(/37|38/) ? -1 : 1, er = this.titles.length, Cr = (Sn + er + Kn) % er;
          this.titles[Cr].focus(), $n = !0;
        } else
          Qt.key === "End" || kn === "35" ? (this.titles[this.titles.length - 1].focus(), $n = !0) : (Qt.key === "Home" || kn === "36") && (this.titles[0].focus(), $n = !0);
      }
      $n && Qt.preventDefault();
    }
  }
  _toggleExpansion(Qt) {
    const Zt = this.titles[Qt], $n = this.layout.widgets[Qt], Sn = this._computeWidgetSize(Qt);
    Sn && this.setRelativeSizes(Sn, !1), $n.isHidden ? (Zt.classList.add("lm-mod-expanded"), Zt.setAttribute("aria-expanded", "true"), $n.show()) : (Zt.classList.remove("lm-mod-expanded"), Zt.setAttribute("aria-expanded", "false"), $n.hide()), this._expansionToggled.emit(Qt);
  }
}
(function(_e) {
  class Qt extends SplitPanel.Renderer {
    constructor() {
      super(), this.titleClassName = "lm-AccordionPanel-title", this._titleID = 0, this._titleKeys = /* @__PURE__ */ new WeakMap(), this._uuid = ++Qt._nInstance;
    }
    /**
     * Render the collapse indicator for a section title.
     *
     * @param data - The data to use for rendering the section title.
     *
     * @returns A element representing the collapse indicator.
     */
    createCollapseIcon($n) {
      return document.createElement("span");
    }
    /**
     * Render the element for a section title.
     *
     * @param data - The data to use for rendering the section title.
     *
     * @returns A element representing the section title.
     */
    createSectionTitle($n) {
      const Sn = document.createElement("h3");
      Sn.setAttribute("tabindex", "0"), Sn.id = this.createTitleKey($n), Sn.className = this.titleClassName;
      for (const er in $n.dataset)
        Sn.dataset[er] = $n.dataset[er];
      const kn = Sn.appendChild(this.createCollapseIcon($n));
      kn.className = "lm-AccordionPanel-titleCollapser";
      const Kn = Sn.appendChild(document.createElement("span"));
      return Kn.className = "lm-AccordionPanel-titleLabel", Kn.textContent = $n.label, Kn.title = $n.caption || $n.label, Sn;
    }
    /**
     * Create a unique render key for the title.
     *
     * @param data - The data to use for the title.
     *
     * @returns The unique render key for the title.
     *
     * #### Notes
     * This method caches the key against the section title the first time
     * the key is generated.
     */
    createTitleKey($n) {
      let Sn = this._titleKeys.get($n);
      return Sn === void 0 && (Sn = `title-key-${this._uuid}-${this._titleID++}`, this._titleKeys.set($n, Sn)), Sn;
    }
  }
  Qt._nInstance = 0, _e.Renderer = Qt, _e.defaultRenderer = new Qt();
})(AccordionPanel || (AccordionPanel = {}));
var Private$d$1;
(function(_e) {
  function Qt(Zt) {
    return Zt.layout || new AccordionLayout({
      renderer: Zt.renderer || AccordionPanel.defaultRenderer,
      orientation: Zt.orientation,
      alignment: Zt.alignment,
      spacing: Zt.spacing,
      titleSpace: Zt.titleSpace
    });
  }
  _e.createLayout = Qt;
})(Private$d$1 || (Private$d$1 = {}));
class BoxLayout extends PanelLayout {
  /**
   * Construct a new box layout.
   *
   * @param options - The options for initializing the layout.
   */
  constructor(Qt = {}) {
    super(), this._fixed = 0, this._spacing = 4, this._dirty = !1, this._sizers = [], this._items = [], this._box = null, this._alignment = "start", this._direction = "top-to-bottom", Qt.direction !== void 0 && (this._direction = Qt.direction), Qt.alignment !== void 0 && (this._alignment = Qt.alignment), Qt.spacing !== void 0 && (this._spacing = Utils$1.clampDimension(Qt.spacing));
  }
  /**
   * Dispose of the resources held by the layout.
   */
  dispose() {
    for (const Qt of this._items)
      Qt.dispose();
    this._box = null, this._items.length = 0, this._sizers.length = 0, super.dispose();
  }
  /**
   * Get the layout direction for the box layout.
   */
  get direction() {
    return this._direction;
  }
  /**
   * Set the layout direction for the box layout.
   */
  set direction(Qt) {
    this._direction !== Qt && (this._direction = Qt, this.parent && (this.parent.dataset.direction = Qt, this.parent.fit()));
  }
  /**
   * Get the content alignment for the box layout.
   *
   * #### Notes
   * This is the alignment of the widgets in the layout direction.
   *
   * The alignment has no effect if the widgets can expand to fill the
   * entire box layout.
   */
  get alignment() {
    return this._alignment;
  }
  /**
   * Set the content alignment for the box layout.
   *
   * #### Notes
   * This is the alignment of the widgets in the layout direction.
   *
   * The alignment has no effect if the widgets can expand to fill the
   * entire box layout.
   */
  set alignment(Qt) {
    this._alignment !== Qt && (this._alignment = Qt, this.parent && (this.parent.dataset.alignment = Qt, this.parent.update()));
  }
  /**
   * Get the inter-element spacing for the box layout.
   */
  get spacing() {
    return this._spacing;
  }
  /**
   * Set the inter-element spacing for the box layout.
   */
  set spacing(Qt) {
    Qt = Utils$1.clampDimension(Qt), this._spacing !== Qt && (this._spacing = Qt, this.parent && this.parent.fit());
  }
  /**
   * Perform layout initialization which requires the parent widget.
   */
  init() {
    this.parent.dataset.direction = this.direction, this.parent.dataset.alignment = this.alignment, super.init();
  }
  /**
   * Attach a widget to the parent's DOM node.
   *
   * @param index - The current index of the widget in the layout.
   *
   * @param widget - The widget to attach to the parent.
   *
   * #### Notes
   * This is a reimplementation of the superclass method.
   */
  attachWidget(Qt, Zt) {
    ArrayExt.insert(this._items, Qt, new LayoutItem(Zt)), ArrayExt.insert(this._sizers, Qt, new BoxSizer()), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.BeforeAttach), this.parent.node.appendChild(Zt.node), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.AfterAttach), this.parent.fit();
  }
  /**
   * Move a widget in the parent's DOM node.
   *
   * @param fromIndex - The previous index of the widget in the layout.
   *
   * @param toIndex - The current index of the widget in the layout.
   *
   * @param widget - The widget to move in the parent.
   *
   * #### Notes
   * This is a reimplementation of the superclass method.
   */
  moveWidget(Qt, Zt, $n) {
    ArrayExt.move(this._items, Qt, Zt), ArrayExt.move(this._sizers, Qt, Zt), this.parent.update();
  }
  /**
   * Detach a widget from the parent's DOM node.
   *
   * @param index - The previous index of the widget in the layout.
   *
   * @param widget - The widget to detach from the parent.
   *
   * #### Notes
   * This is a reimplementation of the superclass method.
   */
  detachWidget(Qt, Zt) {
    let $n = ArrayExt.removeAt(this._items, Qt);
    ArrayExt.removeAt(this._sizers, Qt), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.BeforeDetach), this.parent.node.removeChild(Zt.node), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.AfterDetach), $n.dispose(), this.parent.fit();
  }
  /**
   * A message handler invoked on a `'before-show'` message.
   */
  onBeforeShow(Qt) {
    super.onBeforeShow(Qt), this.parent.update();
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   */
  onBeforeAttach(Qt) {
    super.onBeforeAttach(Qt), this.parent.fit();
  }
  /**
   * A message handler invoked on a `'child-shown'` message.
   */
  onChildShown(Qt) {
    this.parent.fit();
  }
  /**
   * A message handler invoked on a `'child-hidden'` message.
   */
  onChildHidden(Qt) {
    this.parent.fit();
  }
  /**
   * A message handler invoked on a `'resize'` message.
   */
  onResize(Qt) {
    this.parent.isVisible && this._update(Qt.width, Qt.height);
  }
  /**
   * A message handler invoked on an `'update-request'` message.
   */
  onUpdateRequest(Qt) {
    this.parent.isVisible && this._update(-1, -1);
  }
  /**
   * A message handler invoked on a `'fit-request'` message.
   */
  onFitRequest(Qt) {
    this.parent.isAttached && this._fit();
  }
  /**
   * Fit the layout to the total size required by the widgets.
   */
  _fit() {
    let Qt = 0;
    for (let er = 0, Cr = this._items.length; er < Cr; ++er)
      Qt += +!this._items[er].isHidden;
    this._fixed = this._spacing * Math.max(0, Qt - 1);
    let Zt = Private$c$1.isHorizontal(this._direction), $n = Zt ? this._fixed : 0, Sn = Zt ? 0 : this._fixed;
    for (let er = 0, Cr = this._items.length; er < Cr; ++er) {
      let kr = this._items[er], Yr = this._sizers[er];
      if (kr.isHidden) {
        Yr.minSize = 0, Yr.maxSize = 0;
        continue;
      }
      kr.fit(), Yr.sizeHint = BoxLayout.getSizeBasis(kr.widget), Yr.stretch = BoxLayout.getStretch(kr.widget), Zt ? (Yr.minSize = kr.minWidth, Yr.maxSize = kr.maxWidth, $n += kr.minWidth, Sn = Math.max(Sn, kr.minHeight)) : (Yr.minSize = kr.minHeight, Yr.maxSize = kr.maxHeight, Sn += kr.minHeight, $n = Math.max($n, kr.minWidth));
    }
    let kn = this._box = ElementExt.boxSizing(this.parent.node);
    $n += kn.horizontalSum, Sn += kn.verticalSum;
    let Kn = this.parent.node.style;
    Kn.minWidth = `${$n}px`, Kn.minHeight = `${Sn}px`, this._dirty = !0, this.parent.parent && MessageLoop.sendMessage(this.parent.parent, Widget.Msg.FitRequest), this._dirty && MessageLoop.sendMessage(this.parent, Widget.Msg.UpdateRequest);
  }
  /**
   * Update the layout position and size of the widgets.
   *
   * The parent offset dimensions should be `-1` if unknown.
   */
  _update(Qt, Zt) {
    this._dirty = !1;
    let $n = 0;
    for (let Ms = 0, Ds = this._items.length; Ms < Ds; ++Ms)
      $n += +!this._items[Ms].isHidden;
    if ($n === 0)
      return;
    Qt < 0 && (Qt = this.parent.node.offsetWidth), Zt < 0 && (Zt = this.parent.node.offsetHeight), this._box || (this._box = ElementExt.boxSizing(this.parent.node));
    let Sn = this._box.paddingTop, kn = this._box.paddingLeft, Kn = Qt - this._box.horizontalSum, er = Zt - this._box.verticalSum, Cr;
    switch (this._direction) {
      case "left-to-right":
        Cr = BoxEngine.calc(this._sizers, Math.max(0, Kn - this._fixed));
        break;
      case "top-to-bottom":
        Cr = BoxEngine.calc(this._sizers, Math.max(0, er - this._fixed));
        break;
      case "right-to-left":
        Cr = BoxEngine.calc(this._sizers, Math.max(0, Kn - this._fixed)), kn += Kn;
        break;
      case "bottom-to-top":
        Cr = BoxEngine.calc(this._sizers, Math.max(0, er - this._fixed)), Sn += er;
        break;
      default:
        throw "unreachable";
    }
    let kr = 0, Yr = 0;
    if (Cr > 0)
      switch (this._alignment) {
        case "start":
          break;
        case "center":
          kr = 0, Yr = Cr / 2;
          break;
        case "end":
          kr = 0, Yr = Cr;
          break;
        case "justify":
          kr = Cr / $n, Yr = 0;
          break;
        default:
          throw "unreachable";
      }
    for (let Ms = 0, Ds = this._items.length; Ms < Ds; ++Ms) {
      let Ls = this._items[Ms];
      if (Ls.isHidden)
        continue;
      let js = this._sizers[Ms].size;
      switch (this._direction) {
        case "left-to-right":
          Ls.update(kn + Yr, Sn, js + kr, er), kn += js + kr + this._spacing;
          break;
        case "top-to-bottom":
          Ls.update(kn, Sn + Yr, Kn, js + kr), Sn += js + kr + this._spacing;
          break;
        case "right-to-left":
          Ls.update(kn - Yr - js - kr, Sn, js + kr, er), kn -= js + kr + this._spacing;
          break;
        case "bottom-to-top":
          Ls.update(kn, Sn - Yr - js - kr, Kn, js + kr), Sn -= js + kr + this._spacing;
          break;
        default:
          throw "unreachable";
      }
    }
  }
}
(function(_e) {
  function Qt(kn) {
    return Private$c$1.stretchProperty.get(kn);
  }
  _e.getStretch = Qt;
  function Zt(kn, Kn) {
    Private$c$1.stretchProperty.set(kn, Kn);
  }
  _e.setStretch = Zt;
  function $n(kn) {
    return Private$c$1.sizeBasisProperty.get(kn);
  }
  _e.getSizeBasis = $n;
  function Sn(kn, Kn) {
    Private$c$1.sizeBasisProperty.set(kn, Kn);
  }
  _e.setSizeBasis = Sn;
})(BoxLayout || (BoxLayout = {}));
var Private$c$1;
(function(_e) {
  _e.stretchProperty = new AttachedProperty({
    name: "stretch",
    create: () => 0,
    coerce: (Sn, kn) => Math.max(0, Math.floor(kn)),
    changed: $n
  }), _e.sizeBasisProperty = new AttachedProperty({
    name: "sizeBasis",
    create: () => 0,
    coerce: (Sn, kn) => Math.max(0, Math.floor(kn)),
    changed: $n
  });
  function Qt(Sn) {
    return Sn === "left-to-right" || Sn === "right-to-left";
  }
  _e.isHorizontal = Qt;
  function Zt(Sn) {
    return Math.max(0, Math.floor(Sn));
  }
  _e.clampSpacing = Zt;
  function $n(Sn) {
    Sn.parent && Sn.parent.layout instanceof BoxLayout && Sn.parent.fit();
  }
})(Private$c$1 || (Private$c$1 = {}));
class BoxPanel extends Panel {
  /**
   * Construct a new box panel.
   *
   * @param options - The options for initializing the box panel.
   */
  constructor(Qt = {}) {
    super({ layout: Private$b$1.createLayout(Qt) }), this.addClass("lm-BoxPanel");
  }
  /**
   * Get the layout direction for the box panel.
   */
  get direction() {
    return this.layout.direction;
  }
  /**
   * Set the layout direction for the box panel.
   */
  set direction(Qt) {
    this.layout.direction = Qt;
  }
  /**
   * Get the content alignment for the box panel.
   *
   * #### Notes
   * This is the alignment of the widgets in the layout direction.
   *
   * The alignment has no effect if the widgets can expand to fill the
   * entire box layout.
   */
  get alignment() {
    return this.layout.alignment;
  }
  /**
   * Set the content alignment for the box panel.
   *
   * #### Notes
   * This is the alignment of the widgets in the layout direction.
   *
   * The alignment has no effect if the widgets can expand to fill the
   * entire box layout.
   */
  set alignment(Qt) {
    this.layout.alignment = Qt;
  }
  /**
   * Get the inter-element spacing for the box panel.
   */
  get spacing() {
    return this.layout.spacing;
  }
  /**
   * Set the inter-element spacing for the box panel.
   */
  set spacing(Qt) {
    this.layout.spacing = Qt;
  }
  /**
   * A message handler invoked on a `'child-added'` message.
   */
  onChildAdded(Qt) {
    Qt.child.addClass("lm-BoxPanel-child");
  }
  /**
   * A message handler invoked on a `'child-removed'` message.
   */
  onChildRemoved(Qt) {
    Qt.child.removeClass("lm-BoxPanel-child");
  }
}
(function(_e) {
  function Qt(kn) {
    return BoxLayout.getStretch(kn);
  }
  _e.getStretch = Qt;
  function Zt(kn, Kn) {
    BoxLayout.setStretch(kn, Kn);
  }
  _e.setStretch = Zt;
  function $n(kn) {
    return BoxLayout.getSizeBasis(kn);
  }
  _e.getSizeBasis = $n;
  function Sn(kn, Kn) {
    BoxLayout.setSizeBasis(kn, Kn);
  }
  _e.setSizeBasis = Sn;
})(BoxPanel || (BoxPanel = {}));
var Private$b$1;
(function(_e) {
  function Qt(Zt) {
    return Zt.layout || new BoxLayout(Zt);
  }
  _e.createLayout = Qt;
})(Private$b$1 || (Private$b$1 = {}));
class CommandPalette extends Widget {
  /**
   * Construct a new command palette.
   *
   * @param options - The options for initializing the palette.
   */
  constructor(Qt) {
    super({ node: Private$a$1.createNode() }), this._activeIndex = -1, this._items = [], this._results = null, this.addClass("lm-CommandPalette"), this.setFlag(Widget.Flag.DisallowLayout), this.commands = Qt.commands, this.renderer = Qt.renderer || CommandPalette.defaultRenderer, this.commands.commandChanged.connect(this._onGenericChange, this), this.commands.keyBindingChanged.connect(this._onGenericChange, this);
  }
  /**
   * Dispose of the resources held by the widget.
   */
  dispose() {
    this._items.length = 0, this._results = null, super.dispose();
  }
  /**
   * The command palette search node.
   *
   * #### Notes
   * This is the node which contains the search-related elements.
   */
  get searchNode() {
    return this.node.getElementsByClassName("lm-CommandPalette-search")[0];
  }
  /**
   * The command palette input node.
   *
   * #### Notes
   * This is the actual input node for the search area.
   */
  get inputNode() {
    return this.node.getElementsByClassName("lm-CommandPalette-input")[0];
  }
  /**
   * The command palette content node.
   *
   * #### Notes
   * This is the node which holds the command item nodes.
   *
   * Modifying this node directly can lead to undefined behavior.
   */
  get contentNode() {
    return this.node.getElementsByClassName("lm-CommandPalette-content")[0];
  }
  /**
   * A read-only array of the command items in the palette.
   */
  get items() {
    return this._items;
  }
  /**
   * Add a command item to the command palette.
   *
   * @param options - The options for creating the command item.
   *
   * @returns The command item added to the palette.
   */
  addItem(Qt) {
    let Zt = Private$a$1.createItem(this.commands, Qt);
    return this._items.push(Zt), this.refresh(), Zt;
  }
  /**
   * Adds command items to the command palette.
   *
   * @param items - An array of options for creating each command item.
   *
   * @returns The command items added to the palette.
   */
  addItems(Qt) {
    const Zt = Qt.map(($n) => Private$a$1.createItem(this.commands, $n));
    return Zt.forEach(($n) => this._items.push($n)), this.refresh(), Zt;
  }
  /**
   * Remove an item from the command palette.
   *
   * @param item - The item to remove from the palette.
   *
   * #### Notes
   * This is a no-op if the item is not in the palette.
   */
  removeItem(Qt) {
    this.removeItemAt(this._items.indexOf(Qt));
  }
  /**
   * Remove the item at a given index from the command palette.
   *
   * @param index - The index of the item to remove.
   *
   * #### Notes
   * This is a no-op if the index is out of range.
   */
  removeItemAt(Qt) {
    ArrayExt.removeAt(this._items, Qt) && this.refresh();
  }
  /**
   * Remove all items from the command palette.
   */
  clearItems() {
    this._items.length !== 0 && (this._items.length = 0, this.refresh());
  }
  /**
   * Clear the search results and schedule an update.
   *
   * #### Notes
   * This should be called whenever the search results of the palette
   * should be updated.
   *
   * This is typically called automatically by the palette as needed,
   * but can be called manually if the input text is programatically
   * changed.
   *
   * The rendered results are updated asynchronously.
   */
  refresh() {
    if (this._results = null, this.inputNode.value !== "") {
      let Qt = this.node.getElementsByClassName("lm-close-icon")[0];
      Qt.style.display = "inherit";
    } else {
      let Qt = this.node.getElementsByClassName("lm-close-icon")[0];
      Qt.style.display = "none";
    }
    this.update();
  }
  /**
   * Handle the DOM events for the command palette.
   *
   * @param event - The DOM event sent to the command palette.
   *
   * #### Notes
   * This method implements the DOM `EventListener` interface and is
   * called in response to events on the command palette's DOM node.
   * It should not be called directly by user code.
   */
  handleEvent(Qt) {
    switch (Qt.type) {
      case "click":
        this._evtClick(Qt);
        break;
      case "keydown":
        this._evtKeyDown(Qt);
        break;
      case "input":
        this.refresh();
        break;
      case "focus":
      case "blur":
        this._toggleFocused();
        break;
    }
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   */
  onBeforeAttach(Qt) {
    this.node.addEventListener("click", this), this.node.addEventListener("keydown", this), this.node.addEventListener("input", this), this.node.addEventListener("focus", this, !0), this.node.addEventListener("blur", this, !0);
  }
  /**
   * A message handler invoked on an `'after-detach'` message.
   */
  onAfterDetach(Qt) {
    this.node.removeEventListener("click", this), this.node.removeEventListener("keydown", this), this.node.removeEventListener("input", this), this.node.removeEventListener("focus", this, !0), this.node.removeEventListener("blur", this, !0);
  }
  /**
   * A message handler invoked on an `'after-show'` message.
   */
  onAfterShow(Qt) {
    this.update(), super.onAfterShow(Qt);
  }
  /**
   * A message handler invoked on an `'activate-request'` message.
   */
  onActivateRequest(Qt) {
    if (this.isAttached) {
      let Zt = this.inputNode;
      Zt.focus(), Zt.select();
    }
  }
  /**
   * A message handler invoked on an `'update-request'` message.
   */
  onUpdateRequest(Qt) {
    if (this.isHidden)
      return;
    let Zt = this.inputNode.value, $n = this.contentNode, Sn = this._results;
    if (Sn || (Sn = this._results = Private$a$1.search(this._items, Zt), this._activeIndex = Zt ? ArrayExt.findFirstIndex(Sn, Private$a$1.canActivate) : -1), !Zt && Sn.length === 0) {
      VirtualDOM.render(null, $n);
      return;
    }
    if (Zt && Sn.length === 0) {
      let Cr = this.renderer.renderEmptyMessage({ query: Zt });
      VirtualDOM.render(Cr, $n);
      return;
    }
    let kn = this.renderer, Kn = this._activeIndex, er = new Array(Sn.length);
    for (let Cr = 0, kr = Sn.length; Cr < kr; ++Cr) {
      let Yr = Sn[Cr];
      if (Yr.type === "header") {
        let Ms = Yr.indices, Ds = Yr.category;
        er[Cr] = kn.renderHeader({ category: Ds, indices: Ms });
      } else {
        let Ms = Yr.item, Ds = Yr.indices, Ls = Cr === Kn;
        er[Cr] = kn.renderItem({ item: Ms, indices: Ds, active: Ls });
      }
    }
    if (VirtualDOM.render(er, $n), Kn < 0 || Kn >= Sn.length)
      $n.scrollTop = 0;
    else {
      let Cr = $n.children[Kn];
      ElementExt.scrollIntoViewIfNeeded($n, Cr);
    }
  }
  /**
   * Handle the `'click'` event for the command palette.
   */
  _evtClick(Qt) {
    if (Qt.button !== 0)
      return;
    if (Qt.target.classList.contains("lm-close-icon")) {
      this.inputNode.value = "", this.refresh();
      return;
    }
    let Zt = ArrayExt.findFirstIndex(this.contentNode.children, ($n) => $n.contains(Qt.target));
    Zt !== -1 && (Qt.preventDefault(), Qt.stopPropagation(), this._execute(Zt));
  }
  /**
   * Handle the `'keydown'` event for the command palette.
   */
  _evtKeyDown(Qt) {
    if (!(Qt.altKey || Qt.ctrlKey || Qt.metaKey || Qt.shiftKey))
      switch (Qt.keyCode) {
        case 13:
          Qt.preventDefault(), Qt.stopPropagation(), this._execute(this._activeIndex);
          break;
        case 38:
          Qt.preventDefault(), Qt.stopPropagation(), this._activatePreviousItem();
          break;
        case 40:
          Qt.preventDefault(), Qt.stopPropagation(), this._activateNextItem();
          break;
      }
  }
  /**
   * Activate the next enabled command item.
   */
  _activateNextItem() {
    if (!this._results || this._results.length === 0)
      return;
    let Qt = this._activeIndex, Zt = this._results.length, $n = Qt < Zt - 1 ? Qt + 1 : 0, Sn = $n === 0 ? Zt - 1 : $n - 1;
    this._activeIndex = ArrayExt.findFirstIndex(this._results, Private$a$1.canActivate, $n, Sn), this.update();
  }
  /**
   * Activate the previous enabled command item.
   */
  _activatePreviousItem() {
    if (!this._results || this._results.length === 0)
      return;
    let Qt = this._activeIndex, Zt = this._results.length, $n = Qt <= 0 ? Zt - 1 : Qt - 1, Sn = $n === Zt - 1 ? 0 : $n + 1;
    this._activeIndex = ArrayExt.findLastIndex(this._results, Private$a$1.canActivate, $n, Sn), this.update();
  }
  /**
   * Execute the command item at the given index, if possible.
   */
  _execute(Qt) {
    if (!this._results)
      return;
    let Zt = this._results[Qt];
    if (Zt) {
      if (Zt.type === "header") {
        let $n = this.inputNode;
        $n.value = `${Zt.category.toLowerCase()} `, $n.focus(), this.refresh();
        return;
      }
      Zt.item.isEnabled && (this.commands.execute(Zt.item.command, Zt.item.args), this.inputNode.value = "", this.refresh());
    }
  }
  /**
   * Toggle the focused modifier based on the input node focus state.
   */
  _toggleFocused() {
    let Qt = document.activeElement === this.inputNode;
    this.toggleClass("lm-mod-focused", Qt);
  }
  /**
   * A signal handler for generic command changes.
   */
  _onGenericChange() {
    this.refresh();
  }
}
(function(_e) {
  class Qt {
    /**
     * Render the virtual element for a command palette header.
     *
     * @param data - The data to use for rendering the header.
     *
     * @returns A virtual element representing the header.
     */
    renderHeader($n) {
      let Sn = this.formatHeader($n);
      return h$6.li({ className: "lm-CommandPalette-header" }, Sn);
    }
    /**
     * Render the virtual element for a command palette item.
     *
     * @param data - The data to use for rendering the item.
     *
     * @returns A virtual element representing the item.
     */
    renderItem($n) {
      let Sn = this.createItemClass($n), kn = this.createItemDataset($n);
      return $n.item.isToggleable ? h$6.li({
        className: Sn,
        dataset: kn,
        role: "menuitemcheckbox",
        "aria-checked": `${$n.item.isToggled}`
      }, this.renderItemIcon($n), this.renderItemContent($n), this.renderItemShortcut($n)) : h$6.li({
        className: Sn,
        dataset: kn,
        role: "menuitem"
      }, this.renderItemIcon($n), this.renderItemContent($n), this.renderItemShortcut($n));
    }
    /**
     * Render the empty results message for a command palette.
     *
     * @param data - The data to use for rendering the message.
     *
     * @returns A virtual element representing the message.
     */
    renderEmptyMessage($n) {
      let Sn = this.formatEmptyMessage($n);
      return h$6.li({ className: "lm-CommandPalette-emptyMessage" }, Sn);
    }
    /**
     * Render the icon for a command palette item.
     *
     * @param data - The data to use for rendering the icon.
     *
     * @returns A virtual element representing the icon.
     */
    renderItemIcon($n) {
      let Sn = this.createIconClass($n);
      return h$6.div({ className: Sn }, $n.item.icon, $n.item.iconLabel);
    }
    /**
     * Render the content for a command palette item.
     *
     * @param data - The data to use for rendering the content.
     *
     * @returns A virtual element representing the content.
     */
    renderItemContent($n) {
      return h$6.div({ className: "lm-CommandPalette-itemContent" }, this.renderItemLabel($n), this.renderItemCaption($n));
    }
    /**
     * Render the label for a command palette item.
     *
     * @param data - The data to use for rendering the label.
     *
     * @returns A virtual element representing the label.
     */
    renderItemLabel($n) {
      let Sn = this.formatItemLabel($n);
      return h$6.div({ className: "lm-CommandPalette-itemLabel" }, Sn);
    }
    /**
     * Render the caption for a command palette item.
     *
     * @param data - The data to use for rendering the caption.
     *
     * @returns A virtual element representing the caption.
     */
    renderItemCaption($n) {
      let Sn = this.formatItemCaption($n);
      return h$6.div({ className: "lm-CommandPalette-itemCaption" }, Sn);
    }
    /**
     * Render the shortcut for a command palette item.
     *
     * @param data - The data to use for rendering the shortcut.
     *
     * @returns A virtual element representing the shortcut.
     */
    renderItemShortcut($n) {
      let Sn = this.formatItemShortcut($n);
      return h$6.div({ className: "lm-CommandPalette-itemShortcut" }, Sn);
    }
    /**
     * Create the class name for the command palette item.
     *
     * @param data - The data to use for the class name.
     *
     * @returns The full class name for the command palette item.
     */
    createItemClass($n) {
      let Sn = "lm-CommandPalette-item";
      $n.item.isEnabled || (Sn += " lm-mod-disabled"), $n.item.isToggled && (Sn += " lm-mod-toggled"), $n.active && (Sn += " lm-mod-active");
      let kn = $n.item.className;
      return kn && (Sn += ` ${kn}`), Sn;
    }
    /**
     * Create the dataset for the command palette item.
     *
     * @param data - The data to use for creating the dataset.
     *
     * @returns The dataset for the command palette item.
     */
    createItemDataset($n) {
      return { ...$n.item.dataset, command: $n.item.command };
    }
    /**
     * Create the class name for the command item icon.
     *
     * @param data - The data to use for the class name.
     *
     * @returns The full class name for the item icon.
     */
    createIconClass($n) {
      let Sn = "lm-CommandPalette-itemIcon", kn = $n.item.iconClass;
      return kn ? `${Sn} ${kn}` : Sn;
    }
    /**
     * Create the render content for the header node.
     *
     * @param data - The data to use for the header content.
     *
     * @returns The content to add to the header node.
     */
    formatHeader($n) {
      return !$n.indices || $n.indices.length === 0 ? $n.category : StringExt.highlight($n.category, $n.indices, h$6.mark);
    }
    /**
     * Create the render content for the empty message node.
     *
     * @param data - The data to use for the empty message content.
     *
     * @returns The content to add to the empty message node.
     */
    formatEmptyMessage($n) {
      return `No commands found that match '${$n.query}'`;
    }
    /**
     * Create the render content for the item shortcut node.
     *
     * @param data - The data to use for the shortcut content.
     *
     * @returns The content to add to the shortcut node.
     */
    formatItemShortcut($n) {
      let Sn = $n.item.keyBinding;
      return Sn ? CommandRegistry.formatKeystroke(Sn.keys) : null;
    }
    /**
     * Create the render content for the item label node.
     *
     * @param data - The data to use for the label content.
     *
     * @returns The content to add to the label node.
     */
    formatItemLabel($n) {
      return !$n.indices || $n.indices.length === 0 ? $n.item.label : StringExt.highlight($n.item.label, $n.indices, h$6.mark);
    }
    /**
     * Create the render content for the item caption node.
     *
     * @param data - The data to use for the caption content.
     *
     * @returns The content to add to the caption node.
     */
    formatItemCaption($n) {
      return $n.item.caption;
    }
  }
  _e.Renderer = Qt, _e.defaultRenderer = new Qt();
})(CommandPalette || (CommandPalette = {}));
var Private$a$1;
(function(_e) {
  function Qt() {
    let Ds = document.createElement("div"), Ls = document.createElement("div"), js = document.createElement("div"), zs = document.createElement("input"), Fs = document.createElement("ul"), Bs = document.createElement("button");
    return Ls.className = "lm-CommandPalette-search", js.className = "lm-CommandPalette-wrapper", zs.className = "lm-CommandPalette-input", Bs.className = "lm-close-icon", Fs.className = "lm-CommandPalette-content", Fs.setAttribute("role", "menu"), zs.spellcheck = !1, js.appendChild(zs), js.appendChild(Bs), Ls.appendChild(js), Ds.appendChild(Ls), Ds.appendChild(Fs), Ds;
  }
  _e.createNode = Qt;
  function Zt(Ds, Ls) {
    return new Ms(Ds, Ls);
  }
  _e.createItem = Zt;
  function $n(Ds, Ls) {
    let js = er(Ds, Ls);
    return js.sort(kr), Yr(js);
  }
  _e.search = $n;
  function Sn(Ds) {
    return Ds.type === "item" && Ds.item.isEnabled;
  }
  _e.canActivate = Sn;
  function kn(Ds) {
    return Ds.trim().replace(/\s+/g, " ");
  }
  function Kn(Ds) {
    return Ds.replace(/\s+/g, "").toLowerCase();
  }
  function er(Ds, Ls) {
    Ls = Kn(Ls);
    let js = [];
    for (let zs = 0, Fs = Ds.length; zs < Fs; ++zs) {
      let Bs = Ds[zs];
      if (!Bs.isVisible)
        continue;
      if (!Ls) {
        js.push({
          matchType: 3,
          categoryIndices: null,
          labelIndices: null,
          score: 0,
          item: Bs
        });
        continue;
      }
      let Hs = Cr(Bs, Ls);
      Hs && (Bs.isEnabled || (Hs.score += 1e3), js.push(Hs));
    }
    return js;
  }
  function Cr(Ds, Ls) {
    let js = Ds.category.toLowerCase(), zs = Ds.label.toLowerCase(), Fs = `${js} ${zs}`, Bs = 1 / 0, Hs = null, Ws = /\b\w/g;
    for (; ; ) {
      let Iu = Ws.exec(Fs);
      if (!Iu)
        break;
      let Tu = StringExt.matchSumOfDeltas(Fs, Ls, Iu.index);
      if (!Tu)
        break;
      Tu.score <= Bs && (Bs = Tu.score, Hs = Tu.indices);
    }
    if (!Hs || Bs === 1 / 0)
      return null;
    let Ys = js.length + 1, El = ArrayExt.lowerBound(Hs, Ys, (Iu, Tu) => Iu - Tu), Mu = Hs.slice(0, El), Pl = Hs.slice(El);
    for (let Iu = 0, Tu = Pl.length; Iu < Tu; ++Iu)
      Pl[Iu] -= Ys;
    return Mu.length === 0 ? {
      matchType: 0,
      categoryIndices: null,
      labelIndices: Pl,
      score: Bs,
      item: Ds
    } : Pl.length === 0 ? {
      matchType: 1,
      categoryIndices: Mu,
      labelIndices: null,
      score: Bs,
      item: Ds
    } : {
      matchType: 2,
      categoryIndices: Mu,
      labelIndices: Pl,
      score: Bs,
      item: Ds
    };
  }
  function kr(Ds, Ls) {
    let js = Ds.matchType - Ls.matchType;
    if (js !== 0)
      return js;
    let zs = Ds.score - Ls.score;
    if (zs !== 0)
      return zs;
    let Fs = 0, Bs = 0;
    switch (Ds.matchType) {
      case 0:
        Fs = Ds.labelIndices[0], Bs = Ls.labelIndices[0];
        break;
      case 1:
      case 2:
        Fs = Ds.categoryIndices[0], Bs = Ls.categoryIndices[0];
        break;
    }
    if (Fs !== Bs)
      return Fs - Bs;
    let Hs = Ds.item.category.localeCompare(Ls.item.category);
    if (Hs !== 0)
      return Hs;
    let Ws = Ds.item.rank, Ys = Ls.item.rank;
    return Ws !== Ys ? Ws < Ys ? -1 : 1 : Ds.item.label.localeCompare(Ls.item.label);
  }
  function Yr(Ds) {
    let Ls = new Array(Ds.length);
    ArrayExt.fill(Ls, !1);
    let js = [];
    for (let zs = 0, Fs = Ds.length; zs < Fs; ++zs) {
      if (Ls[zs])
        continue;
      let { item: Bs, categoryIndices: Hs } = Ds[zs], Ws = Bs.category;
      js.push({ type: "header", category: Ws, indices: Hs });
      for (let Ys = zs; Ys < Fs; ++Ys) {
        if (Ls[Ys])
          continue;
        let { item: El, labelIndices: Mu } = Ds[Ys];
        El.category === Ws && (js.push({ type: "item", item: El, indices: Mu }), Ls[Ys] = !0);
      }
    }
    return js;
  }
  class Ms {
    /**
     * Construct a new command item.
     */
    constructor(Ls, js) {
      this._commands = Ls, this.category = kn(js.category), this.command = js.command, this.args = js.args || JSONExt.emptyObject, this.rank = js.rank !== void 0 ? js.rank : 1 / 0;
    }
    /**
     * The display label for the command item.
     */
    get label() {
      return this._commands.label(this.command, this.args);
    }
    /**
     * The icon renderer for the command item.
     */
    get icon() {
      return this._commands.icon(this.command, this.args);
    }
    /**
     * The icon class for the command item.
     */
    get iconClass() {
      return this._commands.iconClass(this.command, this.args);
    }
    /**
     * The icon label for the command item.
     */
    get iconLabel() {
      return this._commands.iconLabel(this.command, this.args);
    }
    /**
     * The display caption for the command item.
     */
    get caption() {
      return this._commands.caption(this.command, this.args);
    }
    /**
     * The extra class name for the command item.
     */
    get className() {
      return this._commands.className(this.command, this.args);
    }
    /**
     * The dataset for the command item.
     */
    get dataset() {
      return this._commands.dataset(this.command, this.args);
    }
    /**
     * Whether the command item is enabled.
     */
    get isEnabled() {
      return this._commands.isEnabled(this.command, this.args);
    }
    /**
     * Whether the command item is toggled.
     */
    get isToggled() {
      return this._commands.isToggled(this.command, this.args);
    }
    /**
     * Whether the command item is toggleable.
     */
    get isToggleable() {
      return this._commands.isToggleable(this.command, this.args);
    }
    /**
     * Whether the command item is visible.
     */
    get isVisible() {
      return this._commands.isVisible(this.command, this.args);
    }
    /**
     * The key binding for the command item.
     */
    get keyBinding() {
      let { command: Ls, args: js } = this;
      return ArrayExt.findLastValue(this._commands.keyBindings, (zs) => zs.command === Ls && JSONExt.deepEqual(zs.args, js)) || null;
    }
  }
})(Private$a$1 || (Private$a$1 = {}));
let Menu$1 = class II extends Widget {
  /**
   * Construct a new menu.
   *
   * @param options - The options for initializing the menu.
   */
  constructor(Qt) {
    super({ node: Private$9$1.createNode() }), this._childIndex = -1, this._activeIndex = -1, this._openTimerID = 0, this._closeTimerID = 0, this._items = [], this._childMenu = null, this._parentMenu = null, this._aboutToClose = new Signal(this), this._menuRequested = new Signal(this), this.addClass("lm-Menu"), this.setFlag(Widget.Flag.DisallowLayout), this.commands = Qt.commands, this.renderer = Qt.renderer || II.defaultRenderer;
  }
  /**
   * Dispose of the resources held by the menu.
   */
  dispose() {
    this.close(), this._items.length = 0, super.dispose();
  }
  /**
   * A signal emitted just before the menu is closed.
   *
   * #### Notes
   * This signal is emitted when the menu receives a `'close-request'`
   * message, just before it removes itself from the DOM.
   *
   * This signal is not emitted if the menu is already detached from
   * the DOM when it receives the `'close-request'` message.
   */
  get aboutToClose() {
    return this._aboutToClose;
  }
  /**
   * A signal emitted when a new menu is requested by the user.
   *
   * #### Notes
   * This signal is emitted whenever the user presses the right or left
   * arrow keys, and a submenu cannot be opened or closed in response.
   *
   * This signal is useful when implementing menu bars in order to open
   * the next or previous menu in response to a user key press.
   *
   * This signal is only emitted for the root menu in a hierarchy.
   */
  get menuRequested() {
    return this._menuRequested;
  }
  /**
   * The parent menu of the menu.
   *
   * #### Notes
   * This is `null` unless the menu is an open submenu.
   */
  get parentMenu() {
    return this._parentMenu;
  }
  /**
   * The child menu of the menu.
   *
   * #### Notes
   * This is `null` unless the menu has an open submenu.
   */
  get childMenu() {
    return this._childMenu;
  }
  /**
   * The root menu of the menu hierarchy.
   */
  get rootMenu() {
    let Qt = this;
    for (; Qt._parentMenu; )
      Qt = Qt._parentMenu;
    return Qt;
  }
  /**
   * The leaf menu of the menu hierarchy.
   */
  get leafMenu() {
    let Qt = this;
    for (; Qt._childMenu; )
      Qt = Qt._childMenu;
    return Qt;
  }
  /**
   * The menu content node.
   *
   * #### Notes
   * This is the node which holds the menu item nodes.
   *
   * Modifying this node directly can lead to undefined behavior.
   */
  get contentNode() {
    return this.node.getElementsByClassName("lm-Menu-content")[0];
  }
  /**
   * Get the currently active menu item.
   */
  get activeItem() {
    return this._items[this._activeIndex] || null;
  }
  /**
   * Set the currently active menu item.
   *
   * #### Notes
   * If the item cannot be activated, the item will be set to `null`.
   */
  set activeItem(Qt) {
    this.activeIndex = Qt ? this._items.indexOf(Qt) : -1;
  }
  /**
   * Get the index of the currently active menu item.
   *
   * #### Notes
   * This will be `-1` if no menu item is active.
   */
  get activeIndex() {
    return this._activeIndex;
  }
  /**
   * Set the index of the currently active menu item.
   *
   * #### Notes
   * If the item cannot be activated, the index will be set to `-1`.
   */
  set activeIndex(Qt) {
    (Qt < 0 || Qt >= this._items.length) && (Qt = -1), Qt !== -1 && !Private$9$1.canActivate(this._items[Qt]) && (Qt = -1), this._activeIndex !== Qt && (this._activeIndex = Qt, this._activeIndex >= 0 && this.contentNode.childNodes[this._activeIndex] && this.contentNode.childNodes[this._activeIndex].focus(), this.update());
  }
  /**
   * A read-only array of the menu items in the menu.
   */
  get items() {
    return this._items;
  }
  /**
   * Activate the next selectable item in the menu.
   *
   * #### Notes
   * If no item is selectable, the index will be set to `-1`.
   */
  activateNextItem() {
    let Qt = this._items.length, Zt = this._activeIndex, $n = Zt < Qt - 1 ? Zt + 1 : 0, Sn = $n === 0 ? Qt - 1 : $n - 1;
    this.activeIndex = ArrayExt.findFirstIndex(this._items, Private$9$1.canActivate, $n, Sn);
  }
  /**
   * Activate the previous selectable item in the menu.
   *
   * #### Notes
   * If no item is selectable, the index will be set to `-1`.
   */
  activatePreviousItem() {
    let Qt = this._items.length, Zt = this._activeIndex, $n = Zt <= 0 ? Qt - 1 : Zt - 1, Sn = $n === Qt - 1 ? 0 : $n + 1;
    this.activeIndex = ArrayExt.findLastIndex(this._items, Private$9$1.canActivate, $n, Sn);
  }
  /**
   * Trigger the active menu item.
   *
   * #### Notes
   * If the active item is a submenu, it will be opened and the first
   * item will be activated.
   *
   * If the active item is a command, the command will be executed.
   *
   * If the menu is not attached, this is a no-op.
   *
   * If there is no active item, this is a no-op.
   */
  triggerActiveItem() {
    if (!this.isAttached)
      return;
    let Qt = this.activeItem;
    if (!Qt)
      return;
    if (this._cancelOpenTimer(), this._cancelCloseTimer(), Qt.type === "submenu") {
      this._openChildMenu(!0);
      return;
    }
    this.rootMenu.close();
    let { command: Zt, args: $n } = Qt;
    this.commands.isEnabled(Zt, $n) ? this.commands.execute(Zt, $n) : console.log(`Command '${Zt}' is disabled.`);
  }
  /**
   * Add a menu item to the end of the menu.
   *
   * @param options - The options for creating the menu item.
   *
   * @returns The menu item added to the menu.
   */
  addItem(Qt) {
    return this.insertItem(this._items.length, Qt);
  }
  /**
   * Insert a menu item into the menu at the specified index.
   *
   * @param index - The index at which to insert the item.
   *
   * @param options - The options for creating the menu item.
   *
   * @returns The menu item added to the menu.
   *
   * #### Notes
   * The index will be clamped to the bounds of the items.
   */
  insertItem(Qt, Zt) {
    this.isAttached && this.close(), this.activeIndex = -1;
    let $n = Math.max(0, Math.min(Qt, this._items.length)), Sn = Private$9$1.createItem(this, Zt);
    return ArrayExt.insert(this._items, $n, Sn), this.update(), Sn;
  }
  /**
   * Remove an item from the menu.
   *
   * @param item - The item to remove from the menu.
   *
   * #### Notes
   * This is a no-op if the item is not in the menu.
   */
  removeItem(Qt) {
    this.removeItemAt(this._items.indexOf(Qt));
  }
  /**
   * Remove the item at a given index from the menu.
   *
   * @param index - The index of the item to remove.
   *
   * #### Notes
   * This is a no-op if the index is out of range.
   */
  removeItemAt(Qt) {
    this.isAttached && this.close(), this.activeIndex = -1, ArrayExt.removeAt(this._items, Qt) && this.update();
  }
  /**
   * Remove all menu items from the menu.
   */
  clearItems() {
    this.isAttached && this.close(), this.activeIndex = -1, this._items.length !== 0 && (this._items.length = 0, this.update());
  }
  /**
   * Open the menu at the specified location.
   *
   * @param x - The client X coordinate of the menu location.
   *
   * @param y - The client Y coordinate of the menu location.
   *
   * @param options - The additional options for opening the menu.
   *
   * #### Notes
   * The menu will be opened at the given location unless it will not
   * fully fit on the screen. If it will not fit, it will be adjusted
   * to fit naturally on the screen.
   *
   * This is a no-op if the menu is already attached to the DOM.
   */
  open(Qt, Zt, $n = {}) {
    if (this.isAttached)
      return;
    let Sn = $n.forceX || !1, kn = $n.forceY || !1;
    Private$9$1.openRootMenu(this, Qt, Zt, Sn, kn), this.activate();
  }
  /**
   * Handle the DOM events for the menu.
   *
   * @param event - The DOM event sent to the menu.
   *
   * #### Notes
   * This method implements the DOM `EventListener` interface and is
   * called in response to events on the menu's DOM nodes. It should
   * not be called directly by user code.
   */
  handleEvent(Qt) {
    switch (Qt.type) {
      case "keydown":
        this._evtKeyDown(Qt);
        break;
      case "mouseup":
        this._evtMouseUp(Qt);
        break;
      case "mousemove":
        this._evtMouseMove(Qt);
        break;
      case "mouseenter":
        this._evtMouseEnter(Qt);
        break;
      case "mouseleave":
        this._evtMouseLeave(Qt);
        break;
      case "mousedown":
        this._evtMouseDown(Qt);
        break;
      case "contextmenu":
        Qt.preventDefault(), Qt.stopPropagation();
        break;
    }
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   */
  onBeforeAttach(Qt) {
    this.node.addEventListener("keydown", this), this.node.addEventListener("mouseup", this), this.node.addEventListener("mousemove", this), this.node.addEventListener("mouseenter", this), this.node.addEventListener("mouseleave", this), this.node.addEventListener("contextmenu", this), document.addEventListener("mousedown", this, !0);
  }
  /**
   * A message handler invoked on an `'after-detach'` message.
   */
  onAfterDetach(Qt) {
    this.node.removeEventListener("keydown", this), this.node.removeEventListener("mouseup", this), this.node.removeEventListener("mousemove", this), this.node.removeEventListener("mouseenter", this), this.node.removeEventListener("mouseleave", this), this.node.removeEventListener("contextmenu", this), document.removeEventListener("mousedown", this, !0);
  }
  /**
   * A message handler invoked on an `'activate-request'` message.
   */
  onActivateRequest(Qt) {
    this.isAttached && this.node.focus();
  }
  /**
   * A message handler invoked on an `'update-request'` message.
   */
  onUpdateRequest(Qt) {
    let Zt = this._items, $n = this.renderer, Sn = this._activeIndex, kn = Private$9$1.computeCollapsed(Zt), Kn = new Array(Zt.length);
    for (let er = 0, Cr = Zt.length; er < Cr; ++er) {
      let kr = Zt[er], Yr = er === Sn, Ms = kn[er];
      Kn[er] = $n.renderItem({
        item: kr,
        active: Yr,
        collapsed: Ms,
        onfocus: () => {
          this.activeIndex = er;
        }
      });
    }
    VirtualDOM.render(Kn, this.contentNode);
  }
  /**
   * A message handler invoked on a `'close-request'` message.
   */
  onCloseRequest(Qt) {
    this._cancelOpenTimer(), this._cancelCloseTimer(), this.activeIndex = -1;
    let Zt = this._childMenu;
    Zt && (this._childIndex = -1, this._childMenu = null, Zt._parentMenu = null, Zt.close());
    let $n = this._parentMenu;
    $n && (this._parentMenu = null, $n._childIndex = -1, $n._childMenu = null, $n.activate()), this.isAttached && this._aboutToClose.emit(void 0), super.onCloseRequest(Qt);
  }
  /**
   * Handle the `'keydown'` event for the menu.
   *
   * #### Notes
   * This listener is attached to the menu node.
   */
  _evtKeyDown(Qt) {
    Qt.preventDefault(), Qt.stopPropagation();
    let Zt = Qt.keyCode;
    if (Zt === 13) {
      this.triggerActiveItem();
      return;
    }
    if (Zt === 27) {
      this.close();
      return;
    }
    if (Zt === 37) {
      this._parentMenu ? this.close() : this._menuRequested.emit("previous");
      return;
    }
    if (Zt === 38) {
      this.activatePreviousItem();
      return;
    }
    if (Zt === 39) {
      let Kn = this.activeItem;
      Kn && Kn.type === "submenu" ? this.triggerActiveItem() : this.rootMenu._menuRequested.emit("next");
      return;
    }
    if (Zt === 40) {
      this.activateNextItem();
      return;
    }
    let $n = getKeyboardLayout().keyForKeydownEvent(Qt);
    if (!$n)
      return;
    let Sn = this._activeIndex + 1, kn = Private$9$1.findMnemonic(this._items, $n, Sn);
    kn.index !== -1 && !kn.multiple ? (this.activeIndex = kn.index, this.triggerActiveItem()) : kn.index !== -1 ? this.activeIndex = kn.index : kn.auto !== -1 && (this.activeIndex = kn.auto);
  }
  /**
   * Handle the `'mouseup'` event for the menu.
   *
   * #### Notes
   * This listener is attached to the menu node.
   */
  _evtMouseUp(Qt) {
    Qt.button === 0 && (Qt.preventDefault(), Qt.stopPropagation(), this.triggerActiveItem());
  }
  /**
   * Handle the `'mousemove'` event for the menu.
   *
   * #### Notes
   * This listener is attached to the menu node.
   */
  _evtMouseMove(Qt) {
    let Zt = ArrayExt.findFirstIndex(this.contentNode.children, (Sn) => ElementExt.hitTest(Sn, Qt.clientX, Qt.clientY));
    if (Zt === this._activeIndex)
      return;
    if (this.activeIndex = Zt, Zt = this.activeIndex, Zt === this._childIndex) {
      this._cancelOpenTimer(), this._cancelCloseTimer();
      return;
    }
    this._childIndex !== -1 && this._startCloseTimer(), this._cancelOpenTimer();
    let $n = this.activeItem;
    !$n || $n.type !== "submenu" || !$n.submenu || this._startOpenTimer();
  }
  /**
   * Handle the `'mouseenter'` event for the menu.
   *
   * #### Notes
   * This listener is attached to the menu node.
   */
  _evtMouseEnter(Qt) {
    for (let Zt = this._parentMenu; Zt; Zt = Zt._parentMenu)
      Zt._cancelOpenTimer(), Zt._cancelCloseTimer(), Zt.activeIndex = Zt._childIndex;
  }
  /**
   * Handle the `'mouseleave'` event for the menu.
   *
   * #### Notes
   * This listener is attached to the menu node.
   */
  _evtMouseLeave(Qt) {
    if (this._cancelOpenTimer(), !this._childMenu) {
      this.activeIndex = -1;
      return;
    }
    let { clientX: Zt, clientY: $n } = Qt;
    if (ElementExt.hitTest(this._childMenu.node, Zt, $n)) {
      this._cancelCloseTimer();
      return;
    }
    this.activeIndex = -1, this._startCloseTimer();
  }
  /**
   * Handle the `'mousedown'` event for the menu.
   *
   * #### Notes
   * This listener is attached to the document node.
   */
  _evtMouseDown(Qt) {
    this._parentMenu || (Private$9$1.hitTestMenus(this, Qt.clientX, Qt.clientY) ? (Qt.preventDefault(), Qt.stopPropagation()) : this.close());
  }
  /**
   * Open the child menu at the active index immediately.
   *
   * If a different child menu is already open, it will be closed,
   * even if the active item is not a valid submenu.
   */
  _openChildMenu(Qt = !1) {
    let Zt = this.activeItem;
    if (!Zt || Zt.type !== "submenu" || !Zt.submenu) {
      this._closeChildMenu();
      return;
    }
    let $n = Zt.submenu;
    if ($n === this._childMenu)
      return;
    II.saveWindowData(), this._closeChildMenu(), this._childMenu = $n, this._childIndex = this._activeIndex, $n._parentMenu = this, MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);
    let Sn = this.contentNode.children[this._activeIndex];
    Private$9$1.openSubmenu($n, Sn), Qt && ($n.activeIndex = -1, $n.activateNextItem()), $n.activate();
  }
  /**
   * Close the child menu immediately.
   *
   * This is a no-op if a child menu is not open.
   */
  _closeChildMenu() {
    this._childMenu && this._childMenu.close();
  }
  /**
   * Start the open timer, unless it is already pending.
   */
  _startOpenTimer() {
    this._openTimerID === 0 && (this._openTimerID = window.setTimeout(() => {
      this._openTimerID = 0, this._openChildMenu();
    }, Private$9$1.TIMER_DELAY));
  }
  /**
   * Start the close timer, unless it is already pending.
   */
  _startCloseTimer() {
    this._closeTimerID === 0 && (this._closeTimerID = window.setTimeout(() => {
      this._closeTimerID = 0, this._closeChildMenu();
    }, Private$9$1.TIMER_DELAY));
  }
  /**
   * Cancel the open timer, if the timer is pending.
   */
  _cancelOpenTimer() {
    this._openTimerID !== 0 && (clearTimeout(this._openTimerID), this._openTimerID = 0);
  }
  /**
   * Cancel the close timer, if the timer is pending.
   */
  _cancelCloseTimer() {
    this._closeTimerID !== 0 && (clearTimeout(this._closeTimerID), this._closeTimerID = 0);
  }
  /**
   * Save window data used for menu positioning in transient cache.
   *
   * In order to avoid layout trashing it is recommended to invoke this
   * method immediately prior to opening the menu and any DOM modifications
   * (like closing previously visible menu, or adding a class to menu widget).
   *
   * The transient cache will be released upon `open()` call.
   */
  static saveWindowData() {
    Private$9$1.saveWindowData();
  }
};
(function(_e) {
  class Qt {
    /**
     * Render the virtual element for a menu item.
     *
     * @param data - The data to use for rendering the item.
     *
     * @returns A virtual element representing the item.
     */
    renderItem($n) {
      let Sn = this.createItemClass($n), kn = this.createItemDataset($n), Kn = this.createItemARIA($n);
      return h$6.li({
        className: Sn,
        dataset: kn,
        tabindex: "0",
        onfocus: $n.onfocus,
        ...Kn
      }, this.renderIcon($n), this.renderLabel($n), this.renderShortcut($n), this.renderSubmenu($n));
    }
    /**
     * Render the icon element for a menu item.
     *
     * @param data - The data to use for rendering the icon.
     *
     * @returns A virtual element representing the item icon.
     */
    renderIcon($n) {
      let Sn = this.createIconClass($n);
      return h$6.div({ className: Sn }, $n.item.icon, $n.item.iconLabel);
    }
    /**
     * Render the label element for a menu item.
     *
     * @param data - The data to use for rendering the label.
     *
     * @returns A virtual element representing the item label.
     */
    renderLabel($n) {
      let Sn = this.formatLabel($n);
      return h$6.div({ className: "lm-Menu-itemLabel" }, Sn);
    }
    /**
     * Render the shortcut element for a menu item.
     *
     * @param data - The data to use for rendering the shortcut.
     *
     * @returns A virtual element representing the item shortcut.
     */
    renderShortcut($n) {
      let Sn = this.formatShortcut($n);
      return h$6.div({ className: "lm-Menu-itemShortcut" }, Sn);
    }
    /**
     * Render the submenu icon element for a menu item.
     *
     * @param data - The data to use for rendering the submenu icon.
     *
     * @returns A virtual element representing the submenu icon.
     */
    renderSubmenu($n) {
      return h$6.div({ className: "lm-Menu-itemSubmenuIcon" });
    }
    /**
     * Create the class name for the menu item.
     *
     * @param data - The data to use for the class name.
     *
     * @returns The full class name for the menu item.
     */
    createItemClass($n) {
      let Sn = "lm-Menu-item";
      $n.item.isEnabled || (Sn += " lm-mod-disabled"), $n.item.isToggled && (Sn += " lm-mod-toggled"), $n.item.isVisible || (Sn += " lm-mod-hidden"), $n.active && (Sn += " lm-mod-active"), $n.collapsed && (Sn += " lm-mod-collapsed");
      let kn = $n.item.className;
      return kn && (Sn += ` ${kn}`), Sn;
    }
    /**
     * Create the dataset for the menu item.
     *
     * @param data - The data to use for creating the dataset.
     *
     * @returns The dataset for the menu item.
     */
    createItemDataset($n) {
      let Sn, { type: kn, command: Kn, dataset: er } = $n.item;
      return kn === "command" ? Sn = { ...er, type: kn, command: Kn } : Sn = { ...er, type: kn }, Sn;
    }
    /**
     * Create the class name for the menu item icon.
     *
     * @param data - The data to use for the class name.
     *
     * @returns The full class name for the item icon.
     */
    createIconClass($n) {
      let Sn = "lm-Menu-itemIcon", kn = $n.item.iconClass;
      return kn ? `${Sn} ${kn}` : Sn;
    }
    /**
     * Create the aria attributes for menu item.
     *
     * @param data - The data to use for the aria attributes.
     *
     * @returns The aria attributes object for the item.
     */
    createItemARIA($n) {
      let Sn = {};
      switch ($n.item.type) {
        case "separator":
          Sn.role = "presentation";
          break;
        case "submenu":
          Sn["aria-haspopup"] = "true", $n.item.isEnabled || (Sn["aria-disabled"] = "true");
          break;
        default:
          $n.item.isEnabled || (Sn["aria-disabled"] = "true"), Sn.role = "menuitem";
      }
      return Sn;
    }
    /**
     * Create the render content for the label node.
     *
     * @param data - The data to use for the label content.
     *
     * @returns The content to add to the label node.
     */
    formatLabel($n) {
      let { label: Sn, mnemonic: kn } = $n.item;
      if (kn < 0 || kn >= Sn.length)
        return Sn;
      let Kn = Sn.slice(0, kn), er = Sn.slice(kn + 1), Cr = Sn[kn], kr = h$6.span({ className: "lm-Menu-itemMnemonic" }, Cr);
      return [Kn, kr, er];
    }
    /**
     * Create the render content for the shortcut node.
     *
     * @param data - The data to use for the shortcut content.
     *
     * @returns The content to add to the shortcut node.
     */
    formatShortcut($n) {
      let Sn = $n.item.keyBinding;
      return Sn ? CommandRegistry.formatKeystroke(Sn.keys) : null;
    }
  }
  _e.Renderer = Qt, _e.defaultRenderer = new Qt();
})(Menu$1 || (Menu$1 = {}));
var Private$9$1;
(function(_e) {
  _e.TIMER_DELAY = 300, _e.SUBMENU_OVERLAP = 3;
  let Qt = null, Zt = 0;
  function $n() {
    return Zt > 0 ? (Zt--, Qt) : Yr();
  }
  function Sn() {
    Qt = Yr(), Zt++;
  }
  _e.saveWindowData = Sn;
  function kn() {
    let zs = document.createElement("div"), Fs = document.createElement("ul");
    return Fs.className = "lm-Menu-content", zs.appendChild(Fs), Fs.setAttribute("role", "menu"), zs.tabIndex = 0, zs;
  }
  _e.createNode = kn;
  function Kn(zs) {
    return zs.type !== "separator" && zs.isEnabled && zs.isVisible;
  }
  _e.canActivate = Kn;
  function er(zs, Fs) {
    return new js(zs.commands, Fs);
  }
  _e.createItem = er;
  function Cr(zs, Fs, Bs) {
    for (let Hs = zs; Hs; Hs = Hs.childMenu)
      if (ElementExt.hitTest(Hs.node, Fs, Bs))
        return !0;
    return !1;
  }
  _e.hitTestMenus = Cr;
  function kr(zs) {
    let Fs = new Array(zs.length);
    ArrayExt.fill(Fs, !1);
    let Bs = 0, Hs = zs.length;
    for (; Bs < Hs; ++Bs) {
      let El = zs[Bs];
      if (El.isVisible) {
        if (El.type !== "separator")
          break;
        Fs[Bs] = !0;
      }
    }
    let Ws = Hs - 1;
    for (; Ws >= 0; --Ws) {
      let El = zs[Ws];
      if (El.isVisible) {
        if (El.type !== "separator")
          break;
        Fs[Ws] = !0;
      }
    }
    let Ys = !1;
    for (; ++Bs < Ws; ) {
      let El = zs[Bs];
      El.isVisible && (El.type !== "separator" ? Ys = !1 : Ys ? Fs[Bs] = !0 : Ys = !0);
    }
    return Fs;
  }
  _e.computeCollapsed = kr;
  function Yr() {
    return {
      pageXOffset: window.pageXOffset,
      pageYOffset: window.pageYOffset,
      clientWidth: document.documentElement.clientWidth,
      clientHeight: document.documentElement.clientHeight
    };
  }
  function Ms(zs, Fs, Bs, Hs, Ws) {
    const Ys = $n();
    let El = Ys.pageXOffset, Mu = Ys.pageYOffset, Pl = Ys.clientWidth, Iu = Ys.clientHeight;
    MessageLoop.sendMessage(zs, Widget.Msg.UpdateRequest);
    let Tu = Iu - (Ws ? Bs : 0), Au = zs.node, Nu = Au.style;
    Nu.opacity = "0", Nu.maxHeight = `${Tu}px`, Widget.attach(zs, document.body);
    let { width: gm, height: pm } = Au.getBoundingClientRect();
    !Hs && Fs + gm > El + Pl && (Fs = El + Pl - gm), !Ws && Bs + pm > Mu + Iu && (Bs > Mu + Iu ? Bs = Mu + Iu - pm : Bs = Bs - pm), Nu.transform = `translate(${Math.max(0, Fs)}px, ${Math.max(0, Bs)}px`, Nu.opacity = "1";
  }
  _e.openRootMenu = Ms;
  function Ds(zs, Fs) {
    const Bs = $n();
    let Hs = Bs.pageXOffset, Ws = Bs.pageYOffset, Ys = Bs.clientWidth, El = Bs.clientHeight;
    MessageLoop.sendMessage(zs, Widget.Msg.UpdateRequest);
    let Mu = El, Pl = zs.node, Iu = Pl.style;
    Iu.opacity = "0", Iu.maxHeight = `${Mu}px`, Widget.attach(zs, document.body);
    let { width: Tu, height: Au } = Pl.getBoundingClientRect(), Nu = ElementExt.boxSizing(zs.node), gm = Fs.getBoundingClientRect(), pm = gm.right - _e.SUBMENU_OVERLAP;
    pm + Tu > Hs + Ys && (pm = gm.left + _e.SUBMENU_OVERLAP - Tu);
    let zu = gm.top - Nu.borderTop - Nu.paddingTop;
    zu + Au > Ws + El && (zu = gm.bottom + Nu.borderBottom + Nu.paddingBottom - Au), Iu.transform = `translate(${Math.max(0, pm)}px, ${Math.max(0, zu)}px`, Iu.opacity = "1";
  }
  _e.openSubmenu = Ds;
  function Ls(zs, Fs, Bs) {
    let Hs = -1, Ws = -1, Ys = !1, El = Fs.toUpperCase();
    for (let Mu = 0, Pl = zs.length; Mu < Pl; ++Mu) {
      let Iu = (Mu + Bs) % Pl, Tu = zs[Iu];
      if (!Kn(Tu))
        continue;
      let Au = Tu.label;
      if (Au.length === 0)
        continue;
      let Nu = Tu.mnemonic;
      if (Nu >= 0 && Nu < Au.length) {
        Au[Nu].toUpperCase() === El && (Hs === -1 ? Hs = Iu : Ys = !0);
        continue;
      }
      Ws === -1 && Au[0].toUpperCase() === El && (Ws = Iu);
    }
    return { index: Hs, multiple: Ys, auto: Ws };
  }
  _e.findMnemonic = Ls;
  class js {
    /**
     * Construct a new menu item.
     */
    constructor(Fs, Bs) {
      this._commands = Fs, this.type = Bs.type || "command", this.command = Bs.command || "", this.args = Bs.args || JSONExt.emptyObject, this.submenu = Bs.submenu || null;
    }
    /**
     * The display label for the menu item.
     */
    get label() {
      return this.type === "command" ? this._commands.label(this.command, this.args) : this.type === "submenu" && this.submenu ? this.submenu.title.label : "";
    }
    /**
     * The mnemonic index for the menu item.
     */
    get mnemonic() {
      return this.type === "command" ? this._commands.mnemonic(this.command, this.args) : this.type === "submenu" && this.submenu ? this.submenu.title.mnemonic : -1;
    }
    /**
     * The icon renderer for the menu item.
     */
    get icon() {
      if (this.type === "command")
        return this._commands.icon(this.command, this.args);
      if (this.type === "submenu" && this.submenu)
        return this.submenu.title.icon;
    }
    /**
     * The icon class for the menu item.
     */
    get iconClass() {
      return this.type === "command" ? this._commands.iconClass(this.command, this.args) : this.type === "submenu" && this.submenu ? this.submenu.title.iconClass : "";
    }
    /**
     * The icon label for the menu item.
     */
    get iconLabel() {
      return this.type === "command" ? this._commands.iconLabel(this.command, this.args) : this.type === "submenu" && this.submenu ? this.submenu.title.iconLabel : "";
    }
    /**
     * The display caption for the menu item.
     */
    get caption() {
      return this.type === "command" ? this._commands.caption(this.command, this.args) : this.type === "submenu" && this.submenu ? this.submenu.title.caption : "";
    }
    /**
     * The extra class name for the menu item.
     */
    get className() {
      return this.type === "command" ? this._commands.className(this.command, this.args) : this.type === "submenu" && this.submenu ? this.submenu.title.className : "";
    }
    /**
     * The dataset for the menu item.
     */
    get dataset() {
      return this.type === "command" ? this._commands.dataset(this.command, this.args) : this.type === "submenu" && this.submenu ? this.submenu.title.dataset : {};
    }
    /**
     * Whether the menu item is enabled.
     */
    get isEnabled() {
      return this.type === "command" ? this._commands.isEnabled(this.command, this.args) : this.type === "submenu" ? this.submenu !== null : !0;
    }
    /**
     * Whether the menu item is toggled.
     */
    get isToggled() {
      return this.type === "command" ? this._commands.isToggled(this.command, this.args) : !1;
    }
    /**
     * Whether the menu item is visible.
     */
    get isVisible() {
      return this.type === "command" ? this._commands.isVisible(this.command, this.args) : this.type === "submenu" ? this.submenu !== null : !0;
    }
    /**
     * The key binding for the menu item.
     */
    get keyBinding() {
      if (this.type === "command") {
        let { command: Fs, args: Bs } = this;
        return ArrayExt.findLastValue(this._commands.keyBindings, (Hs) => Hs.command === Fs && JSONExt.deepEqual(Hs.args, Bs)) || null;
      }
      return null;
    }
  }
})(Private$9$1 || (Private$9$1 = {}));
var Private$8$1;
(function(_e) {
  function Qt(Kn, er) {
    let Cr = $n(Kn.selector), kr = Kn.rank !== void 0 ? Kn.rank : 1 / 0;
    return { ...Kn, selector: Cr, rank: kr, id: er };
  }
  _e.createItem = Qt;
  function Zt(Kn, er, Cr, kr) {
    let Yr = er.target;
    if (!Yr)
      return null;
    let Ms = er.currentTarget;
    if (!Ms || !Ms.contains(Yr) && (Yr = document.elementFromPoint(er.clientX, er.clientY), !Yr || !Ms.contains(Yr)))
      return null;
    let Ds = [], Ls = Kn.slice();
    for (; Yr !== null; ) {
      let js = [];
      for (let zs = 0, Fs = Ls.length; zs < Fs; ++zs) {
        let Bs = Ls[zs];
        Bs && Selector$1.matches(Yr, Bs.selector) && (js.push(Bs), Ls[zs] = null);
      }
      if (js.length !== 0 && (Cr && js.sort(kr ? kn : Sn), Ds.push(...js)), Yr === Ms)
        break;
      Yr = Yr.parentElement;
    }
    return Cr || Ds.sort(kr ? kn : Sn), Ds;
  }
  _e.matchItems = Zt;
  function $n(Kn) {
    if (Kn.indexOf(",") !== -1)
      throw new Error(`Selector cannot contain commas: ${Kn}`);
    if (!Selector$1.isValid(Kn))
      throw new Error(`Invalid selector: ${Kn}`);
    return Kn;
  }
  function Sn(Kn, er) {
    let Cr = Kn.rank, kr = er.rank;
    return Cr !== kr ? Cr < kr ? -1 : 1 : Kn.id - er.id;
  }
  function kn(Kn, er) {
    let Cr = Selector$1.calculateSpecificity(Kn.selector), kr = Selector$1.calculateSpecificity(er.selector);
    return Cr !== kr ? kr - Cr : Sn(Kn, er);
  }
})(Private$8$1 || (Private$8$1 = {}));
const ARROW_KEYS = [
  "ArrowLeft",
  "ArrowUp",
  "ArrowRight",
  "ArrowDown",
  "Home",
  "End"
];
class TabBar extends Widget {
  /**
   * Construct a new tab bar.
   *
   * @param options - The options for initializing the tab bar.
   */
  constructor(Qt = {}) {
    super({ node: Private$7$1.createNode() }), this._currentIndex = -1, this._titles = [], this._titlesEditable = !1, this._previousTitle = null, this._dragData = null, this._addButtonEnabled = !1, this._tabMoved = new Signal(this), this._currentChanged = new Signal(this), this._addRequested = new Signal(this), this._tabCloseRequested = new Signal(this), this._tabDetachRequested = new Signal(this), this._tabActivateRequested = new Signal(this), this.addClass("lm-TabBar"), this.contentNode.setAttribute("role", "tablist"), this.setFlag(Widget.Flag.DisallowLayout), this._document = Qt.document || document, this.tabsMovable = Qt.tabsMovable || !1, this.titlesEditable = Qt.titlesEditable || !1, this.allowDeselect = Qt.allowDeselect || !1, this.addButtonEnabled = Qt.addButtonEnabled || !1, this.insertBehavior = Qt.insertBehavior || "select-tab-if-needed", this.name = Qt.name || "", this.orientation = Qt.orientation || "horizontal", this.removeBehavior = Qt.removeBehavior || "select-tab-after", this.renderer = Qt.renderer || TabBar.defaultRenderer;
  }
  /**
   * Dispose of the resources held by the widget.
   */
  dispose() {
    this._releaseMouse(), this._titles.length = 0, this._previousTitle = null, super.dispose();
  }
  /**
   * A signal emitted when the current tab is changed.
   *
   * #### Notes
   * This signal is emitted when the currently selected tab is changed
   * either through user or programmatic interaction.
   *
   * Notably, this signal is not emitted when the index of the current
   * tab changes due to tabs being inserted, removed, or moved. It is
   * only emitted when the actual current tab node is changed.
   */
  get currentChanged() {
    return this._currentChanged;
  }
  /**
   * A signal emitted when a tab is moved by the user.
   *
   * #### Notes
   * This signal is emitted when a tab is moved by user interaction.
   *
   * This signal is not emitted when a tab is moved programmatically.
   */
  get tabMoved() {
    return this._tabMoved;
  }
  /**
   * A signal emitted when a tab is clicked by the user.
   *
   * #### Notes
   * If the clicked tab is not the current tab, the clicked tab will be
   * made current and the `currentChanged` signal will be emitted first.
   *
   * This signal is emitted even if the clicked tab is the current tab.
   */
  get tabActivateRequested() {
    return this._tabActivateRequested;
  }
  /**
   * A signal emitted when the tab bar add button is clicked.
   */
  get addRequested() {
    return this._addRequested;
  }
  /**
   * A signal emitted when a tab close icon is clicked.
   *
   * #### Notes
   * This signal is not emitted unless the tab title is `closable`.
   */
  get tabCloseRequested() {
    return this._tabCloseRequested;
  }
  /**
   * A signal emitted when a tab is dragged beyond the detach threshold.
   *
   * #### Notes
   * This signal is emitted when the user drags a tab with the mouse,
   * and mouse is dragged beyond the detach threshold.
   *
   * The consumer of the signal should call `releaseMouse` and remove
   * the tab in order to complete the detach.
   *
   * This signal is only emitted once per drag cycle.
   */
  get tabDetachRequested() {
    return this._tabDetachRequested;
  }
  /**
   * The document to use with the tab bar.
   *
   * The default is the global `document` instance.
   */
  get document() {
    return this._document;
  }
  /**
   * Whether the titles can be user-edited.
   *
   */
  get titlesEditable() {
    return this._titlesEditable;
  }
  /**
   * Set whether titles can be user edited.
   *
   */
  set titlesEditable(Qt) {
    this._titlesEditable = Qt;
  }
  /**
   * Get the currently selected title.
   *
   * #### Notes
   * This will be `null` if no tab is selected.
   */
  get currentTitle() {
    return this._titles[this._currentIndex] || null;
  }
  /**
   * Set the currently selected title.
   *
   * #### Notes
   * If the title does not exist, the title will be set to `null`.
   */
  set currentTitle(Qt) {
    this.currentIndex = Qt ? this._titles.indexOf(Qt) : -1;
  }
  /**
   * Get the index of the currently selected tab.
   *
   * #### Notes
   * This will be `-1` if no tab is selected.
   */
  get currentIndex() {
    return this._currentIndex;
  }
  /**
   * Set the index of the currently selected tab.
   *
   * #### Notes
   * If the value is out of range, the index will be set to `-1`.
   */
  set currentIndex(Qt) {
    if ((Qt < 0 || Qt >= this._titles.length) && (Qt = -1), this._currentIndex === Qt)
      return;
    let Zt = this._currentIndex, $n = this._titles[Zt] || null, Sn = Qt, kn = this._titles[Sn] || null;
    this._currentIndex = Sn, this._previousTitle = $n, this.update(), this._currentChanged.emit({
      previousIndex: Zt,
      previousTitle: $n,
      currentIndex: Sn,
      currentTitle: kn
    });
  }
  /**
   * Get the name of the tab bar.
   */
  get name() {
    return this._name;
  }
  /**
   * Set the name of the tab bar.
   */
  set name(Qt) {
    this._name = Qt, Qt ? this.contentNode.setAttribute("aria-label", Qt) : this.contentNode.removeAttribute("aria-label");
  }
  /**
   * Get the orientation of the tab bar.
   *
   * #### Notes
   * This controls whether the tabs are arranged in a row or column.
   */
  get orientation() {
    return this._orientation;
  }
  /**
   * Set the orientation of the tab bar.
   *
   * #### Notes
   * This controls whether the tabs are arranged in a row or column.
   */
  set orientation(Qt) {
    this._orientation !== Qt && (this._releaseMouse(), this._orientation = Qt, this.dataset.orientation = Qt, this.contentNode.setAttribute("aria-orientation", Qt));
  }
  /**
   * Whether the add button is enabled.
   */
  get addButtonEnabled() {
    return this._addButtonEnabled;
  }
  /**
   * Set whether the add button is enabled.
   */
  set addButtonEnabled(Qt) {
    this._addButtonEnabled !== Qt && (this._addButtonEnabled = Qt, Qt ? this.addButtonNode.classList.remove("lm-mod-hidden") : this.addButtonNode.classList.add("lm-mod-hidden"));
  }
  /**
   * A read-only array of the titles in the tab bar.
   */
  get titles() {
    return this._titles;
  }
  /**
   * The tab bar content node.
   *
   * #### Notes
   * This is the node which holds the tab nodes.
   *
   * Modifying this node directly can lead to undefined behavior.
   */
  get contentNode() {
    return this.node.getElementsByClassName("lm-TabBar-content")[0];
  }
  /**
   * The tab bar add button node.
   *
   * #### Notes
   * This is the node which holds the add button.
   *
   * Modifying this node directly can lead to undefined behavior.
   */
  get addButtonNode() {
    return this.node.getElementsByClassName("lm-TabBar-addButton")[0];
  }
  /**
   * Add a tab to the end of the tab bar.
   *
   * @param value - The title which holds the data for the tab,
   *   or an options object to convert to a title.
   *
   * @returns The title object added to the tab bar.
   *
   * #### Notes
   * If the title is already added to the tab bar, it will be moved.
   */
  addTab(Qt) {
    return this.insertTab(this._titles.length, Qt);
  }
  /**
   * Insert a tab into the tab bar at the specified index.
   *
   * @param index - The index at which to insert the tab.
   *
   * @param value - The title which holds the data for the tab,
   *   or an options object to convert to a title.
   *
   * @returns The title object added to the tab bar.
   *
   * #### Notes
   * The index will be clamped to the bounds of the tabs.
   *
   * If the title is already added to the tab bar, it will be moved.
   */
  insertTab(Qt, Zt) {
    this._releaseMouse();
    let $n = Private$7$1.asTitle(Zt), Sn = this._titles.indexOf($n), kn = Math.max(0, Math.min(Qt, this._titles.length));
    return Sn === -1 ? (ArrayExt.insert(this._titles, kn, $n), $n.changed.connect(this._onTitleChanged, this), this.update(), this._adjustCurrentForInsert(kn, $n), $n) : (kn === this._titles.length && kn--, Sn === kn || (ArrayExt.move(this._titles, Sn, kn), this.update(), this._adjustCurrentForMove(Sn, kn)), $n);
  }
  /**
   * Remove a tab from the tab bar.
   *
   * @param title - The title for the tab to remove.
   *
   * #### Notes
   * This is a no-op if the title is not in the tab bar.
   */
  removeTab(Qt) {
    this.removeTabAt(this._titles.indexOf(Qt));
  }
  /**
   * Remove the tab at a given index from the tab bar.
   *
   * @param index - The index of the tab to remove.
   *
   * #### Notes
   * This is a no-op if the index is out of range.
   */
  removeTabAt(Qt) {
    this._releaseMouse();
    let Zt = ArrayExt.removeAt(this._titles, Qt);
    Zt && (Zt.changed.disconnect(this._onTitleChanged, this), Zt === this._previousTitle && (this._previousTitle = null), this.update(), this._adjustCurrentForRemove(Qt, Zt));
  }
  /**
   * Remove all tabs from the tab bar.
   */
  clearTabs() {
    if (this._titles.length === 0)
      return;
    this._releaseMouse();
    for (let $n of this._titles)
      $n.changed.disconnect(this._onTitleChanged, this);
    let Qt = this.currentIndex, Zt = this.currentTitle;
    this._currentIndex = -1, this._previousTitle = null, this._titles.length = 0, this.update(), Qt !== -1 && this._currentChanged.emit({
      previousIndex: Qt,
      previousTitle: Zt,
      currentIndex: -1,
      currentTitle: null
    });
  }
  /**
   * Release the mouse and restore the non-dragged tab positions.
   *
   * #### Notes
   * This will cause the tab bar to stop handling mouse events and to
   * restore the tabs to their non-dragged positions.
   */
  releaseMouse() {
    this._releaseMouse();
  }
  /**
   * Handle the DOM events for the tab bar.
   *
   * @param event - The DOM event sent to the tab bar.
   *
   * #### Notes
   * This method implements the DOM `EventListener` interface and is
   * called in response to events on the tab bar's DOM node.
   *
   * This should not be called directly by user code.
   */
  handleEvent(Qt) {
    switch (Qt.type) {
      case "pointerdown":
        this._evtPointerDown(Qt);
        break;
      case "pointermove":
        this._evtPointerMove(Qt);
        break;
      case "pointerup":
        this._evtPointerUp(Qt);
        break;
      case "dblclick":
        this._evtDblClick(Qt);
        break;
      case "keydown":
        Qt.eventPhase === Event.CAPTURING_PHASE ? this._evtKeyDownCapturing(Qt) : this._evtKeyDown(Qt);
        break;
      case "contextmenu":
        Qt.preventDefault(), Qt.stopPropagation();
        break;
    }
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   */
  onBeforeAttach(Qt) {
    this.node.addEventListener("pointerdown", this), this.node.addEventListener("dblclick", this), this.node.addEventListener("keydown", this);
  }
  /**
   * A message handler invoked on an `'after-detach'` message.
   */
  onAfterDetach(Qt) {
    this.node.removeEventListener("pointerdown", this), this.node.removeEventListener("dblclick", this), this.node.removeEventListener("keydown", this), this._releaseMouse();
  }
  /**
   * A message handler invoked on an `'update-request'` message.
   */
  onUpdateRequest(Qt) {
    var Zt;
    let $n = this._titles, Sn = this.renderer, kn = this.currentTitle, Kn = new Array($n.length);
    const er = (Zt = this._getCurrentTabindex()) !== null && Zt !== void 0 ? Zt : this._currentIndex > -1 ? this._currentIndex : 0;
    for (let Cr = 0, kr = $n.length; Cr < kr; ++Cr) {
      let Yr = $n[Cr], Ms = Yr === kn, Ds = Ms ? kr : kr - Cr - 1, Ls = er === Cr ? 0 : -1;
      Kn[Cr] = Sn.renderTab({ title: Yr, current: Ms, zIndex: Ds, tabIndex: Ls });
    }
    VirtualDOM.render(Kn, this.contentNode);
  }
  /**
   * Get the index of the tab which handles tabindex="0".
   * If the add button handles tabindex="0", -1 is returned.
   * If none of the previous handles tabindex="0", null is returned.
   */
  _getCurrentTabindex() {
    let Qt = null;
    const Zt = this.contentNode.querySelector('li[tabindex="0"]');
    return Zt ? Qt = [...this.contentNode.children].indexOf(Zt) : this._addButtonEnabled && this.addButtonNode.getAttribute("tabindex") === "0" && (Qt = -1), Qt;
  }
  /**
   * Handle the `'dblclick'` event for the tab bar.
   */
  _evtDblClick(Qt) {
    if (!this.titlesEditable)
      return;
    let Zt = this.contentNode.children, $n = ArrayExt.findFirstIndex(Zt, (Kn) => ElementExt.hitTest(Kn, Qt.clientX, Qt.clientY));
    if ($n === -1)
      return;
    let Sn = this.titles[$n], kn = Zt[$n].querySelector(".lm-TabBar-tabLabel");
    if (kn && kn.contains(Qt.target)) {
      let Kn = Sn.label || "", er = kn.innerHTML;
      kn.innerHTML = "";
      let Cr = document.createElement("input");
      Cr.classList.add("lm-TabBar-tabInput"), Cr.value = Kn, kn.appendChild(Cr);
      let kr = () => {
        Cr.removeEventListener("blur", kr), kn.innerHTML = er, this.node.addEventListener("keydown", this);
      };
      Cr.addEventListener("dblclick", (Yr) => Yr.stopPropagation()), Cr.addEventListener("blur", kr), Cr.addEventListener("keydown", (Yr) => {
        Yr.key === "Enter" ? (Cr.value !== "" && (Sn.label = Sn.caption = Cr.value), kr()) : Yr.key === "Escape" && kr();
      }), this.node.removeEventListener("keydown", this), Cr.select(), Cr.focus(), kn.children.length > 0 && kn.children[0].focus();
    }
  }
  /**
   * Handle the `'keydown'` event for the tab bar at capturing phase.
   */
  _evtKeyDownCapturing(Qt) {
    Qt.eventPhase === Event.CAPTURING_PHASE && (Qt.preventDefault(), Qt.stopPropagation(), Qt.key === "Escape" && this._releaseMouse());
  }
  /**
   * Handle the `'keydown'` event for the tab bar at target phase.
   */
  _evtKeyDown(Qt) {
    var Zt, $n, Sn;
    if (!(Qt.key === "Tab" || Qt.eventPhase === Event.CAPTURING_PHASE)) {
      if (Qt.key === "Enter" || Qt.key === "Spacebar" || Qt.key === " ") {
        const kn = document.activeElement;
        if (this.addButtonEnabled && this.addButtonNode.contains(kn))
          Qt.preventDefault(), Qt.stopPropagation(), this._addRequested.emit();
        else {
          const Kn = ArrayExt.findFirstIndex(this.contentNode.children, (er) => er.contains(kn));
          Kn >= 0 && (Qt.preventDefault(), Qt.stopPropagation(), this.currentIndex = Kn);
        }
      } else if (ARROW_KEYS.includes(Qt.key)) {
        const kn = [...this.contentNode.children];
        if (this.addButtonEnabled && kn.push(this.addButtonNode), kn.length <= 1)
          return;
        Qt.preventDefault(), Qt.stopPropagation();
        let Kn = kn.indexOf(document.activeElement);
        Kn === -1 && (Kn = this._currentIndex);
        let er;
        Qt.key === "ArrowRight" && this._orientation === "horizontal" || Qt.key === "ArrowDown" && this._orientation === "vertical" ? er = (Zt = kn[Kn + 1]) !== null && Zt !== void 0 ? Zt : kn[0] : Qt.key === "ArrowLeft" && this._orientation === "horizontal" || Qt.key === "ArrowUp" && this._orientation === "vertical" ? er = ($n = kn[Kn - 1]) !== null && $n !== void 0 ? $n : kn[kn.length - 1] : Qt.key === "Home" ? er = kn[0] : Qt.key === "End" && (er = kn[kn.length - 1]), er && ((Sn = kn[Kn]) === null || Sn === void 0 || Sn.setAttribute("tabindex", "-1"), er == null || er.setAttribute("tabindex", "0"), er.focus());
      }
    }
  }
  /**
   * Handle the `'pointerdown'` event for the tab bar.
   */
  _evtPointerDown(Qt) {
    if (Qt.button !== 0 && Qt.button !== 1 || this._dragData || Qt.target.classList.contains("lm-TabBar-tabInput"))
      return;
    let Zt = this.addButtonEnabled && this.addButtonNode.contains(Qt.target), $n = this.contentNode.children, Sn = ArrayExt.findFirstIndex($n, (Kn) => ElementExt.hitTest(Kn, Qt.clientX, Qt.clientY));
    if (Sn === -1 && !Zt || (Qt.preventDefault(), Qt.stopPropagation(), this._dragData = {
      tab: $n[Sn],
      index: Sn,
      pressX: Qt.clientX,
      pressY: Qt.clientY,
      tabPos: -1,
      tabSize: -1,
      tabPressPos: -1,
      targetIndex: -1,
      tabLayout: null,
      contentRect: null,
      override: null,
      dragActive: !1,
      dragAborted: !1,
      detachRequested: !1
    }, this.document.addEventListener("pointerup", this, !0), Qt.button === 1 || Zt))
      return;
    let kn = $n[Sn].querySelector(this.renderer.closeIconSelector);
    kn && kn.contains(Qt.target) || (this.tabsMovable && (this.document.addEventListener("pointermove", this, !0), this.document.addEventListener("keydown", this, !0), this.document.addEventListener("contextmenu", this, !0)), this.allowDeselect && this.currentIndex === Sn ? this.currentIndex = -1 : this.currentIndex = Sn, this.currentIndex !== -1 && this._tabActivateRequested.emit({
      index: this.currentIndex,
      title: this.currentTitle
    }));
  }
  /**
   * Handle the `'pointermove'` event for the tab bar.
   */
  _evtPointerMove(Qt) {
    let Zt = this._dragData;
    if (!Zt)
      return;
    Qt.preventDefault(), Qt.stopPropagation();
    let $n = this.contentNode.children;
    if (!(!Zt.dragActive && !Private$7$1.dragExceeded(Zt, Qt))) {
      if (!Zt.dragActive) {
        let Sn = Zt.tab.getBoundingClientRect();
        this._orientation === "horizontal" ? (Zt.tabPos = Zt.tab.offsetLeft, Zt.tabSize = Sn.width, Zt.tabPressPos = Zt.pressX - Sn.left) : (Zt.tabPos = Zt.tab.offsetTop, Zt.tabSize = Sn.height, Zt.tabPressPos = Zt.pressY - Sn.top), Zt.tabPressOffset = {
          x: Zt.pressX - Sn.left,
          y: Zt.pressY - Sn.top
        }, Zt.tabLayout = Private$7$1.snapTabLayout($n, this._orientation), Zt.contentRect = this.contentNode.getBoundingClientRect(), Zt.override = Drag.overrideCursor("default"), Zt.tab.classList.add("lm-mod-dragging"), this.addClass("lm-mod-dragging"), Zt.dragActive = !0;
      }
      if (!Zt.detachRequested && Private$7$1.detachExceeded(Zt, Qt)) {
        Zt.detachRequested = !0;
        let Sn = Zt.index, kn = Qt.clientX, Kn = Qt.clientY, er = $n[Sn], Cr = this._titles[Sn];
        if (this._tabDetachRequested.emit({
          index: Sn,
          title: Cr,
          tab: er,
          clientX: kn,
          clientY: Kn,
          offset: Zt.tabPressOffset
        }), Zt.dragAborted)
          return;
      }
      Private$7$1.layoutTabs($n, Zt, Qt, this._orientation);
    }
  }
  /**
   * Handle the `'pointerup'` event for the document.
   */
  _evtPointerUp(Qt) {
    if (Qt.button !== 0 && Qt.button !== 1)
      return;
    const Zt = this._dragData;
    if (!Zt)
      return;
    if (Qt.preventDefault(), Qt.stopPropagation(), this.document.removeEventListener("pointermove", this, !0), this.document.removeEventListener("pointerup", this, !0), this.document.removeEventListener("keydown", this, !0), this.document.removeEventListener("contextmenu", this, !0), !Zt.dragActive) {
      if (this._dragData = null, this.addButtonEnabled && this.addButtonNode.contains(Qt.target)) {
        this._addRequested.emit(void 0);
        return;
      }
      let kn = this.contentNode.children, Kn = ArrayExt.findFirstIndex(kn, (kr) => ElementExt.hitTest(kr, Qt.clientX, Qt.clientY));
      if (Kn !== Zt.index)
        return;
      let er = this._titles[Kn];
      if (!er.closable)
        return;
      if (Qt.button === 1) {
        this._tabCloseRequested.emit({ index: Kn, title: er });
        return;
      }
      let Cr = kn[Kn].querySelector(this.renderer.closeIconSelector);
      if (Cr && Cr.contains(Qt.target)) {
        this._tabCloseRequested.emit({ index: Kn, title: er });
        return;
      }
      return;
    }
    if (Qt.button !== 0)
      return;
    Private$7$1.finalizeTabPosition(Zt, this._orientation), Zt.tab.classList.remove("lm-mod-dragging");
    let $n = Private$7$1.parseTransitionDuration(Zt.tab);
    setTimeout(() => {
      if (Zt.dragAborted)
        return;
      this._dragData = null, Private$7$1.resetTabPositions(this.contentNode.children, this._orientation), Zt.override.dispose(), this.removeClass("lm-mod-dragging");
      let Sn = Zt.index, kn = Zt.targetIndex;
      kn === -1 || Sn === kn || (ArrayExt.move(this._titles, Sn, kn), this._adjustCurrentForMove(Sn, kn), this._tabMoved.emit({
        fromIndex: Sn,
        toIndex: kn,
        title: this._titles[kn]
      }), MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest));
    }, $n);
  }
  /**
   * Release the mouse and restore the non-dragged tab positions.
   */
  _releaseMouse() {
    let Qt = this._dragData;
    Qt && (this._dragData = null, this.document.removeEventListener("pointermove", this, !0), this.document.removeEventListener("pointerup", this, !0), this.document.removeEventListener("keydown", this, !0), this.document.removeEventListener("contextmenu", this, !0), Qt.dragAborted = !0, Qt.dragActive && (Private$7$1.resetTabPositions(this.contentNode.children, this._orientation), Qt.override.dispose(), Qt.tab.classList.remove("lm-mod-dragging"), this.removeClass("lm-mod-dragging")));
  }
  /**
   * Adjust the current index for a tab insert operation.
   *
   * This method accounts for the tab bar's insertion behavior when
   * adjusting the current index and emitting the changed signal.
   */
  _adjustCurrentForInsert(Qt, Zt) {
    let $n = this.currentTitle, Sn = this._currentIndex, kn = this.insertBehavior;
    if (kn === "select-tab" || kn === "select-tab-if-needed" && Sn === -1) {
      this._currentIndex = Qt, this._previousTitle = $n, this._currentChanged.emit({
        previousIndex: Sn,
        previousTitle: $n,
        currentIndex: Qt,
        currentTitle: Zt
      });
      return;
    }
    Sn >= Qt && this._currentIndex++;
  }
  /**
   * Adjust the current index for a tab move operation.
   *
   * This method will not cause the actual current tab to change.
   * It silently adjusts the index to account for the given move.
   */
  _adjustCurrentForMove(Qt, Zt) {
    this._currentIndex === Qt ? this._currentIndex = Zt : this._currentIndex < Qt && this._currentIndex >= Zt ? this._currentIndex++ : this._currentIndex > Qt && this._currentIndex <= Zt && this._currentIndex--;
  }
  /**
   * Adjust the current index for a tab remove operation.
   *
   * This method accounts for the tab bar's remove behavior when
   * adjusting the current index and emitting the changed signal.
   */
  _adjustCurrentForRemove(Qt, Zt) {
    let $n = this._currentIndex, Sn = this.removeBehavior;
    if ($n !== Qt) {
      $n > Qt && this._currentIndex--;
      return;
    }
    if (this._titles.length === 0) {
      this._currentIndex = -1, this._currentChanged.emit({
        previousIndex: Qt,
        previousTitle: Zt,
        currentIndex: -1,
        currentTitle: null
      });
      return;
    }
    if (Sn === "select-tab-after") {
      this._currentIndex = Math.min(Qt, this._titles.length - 1), this._currentChanged.emit({
        previousIndex: Qt,
        previousTitle: Zt,
        currentIndex: this._currentIndex,
        currentTitle: this.currentTitle
      });
      return;
    }
    if (Sn === "select-tab-before") {
      this._currentIndex = Math.max(0, Qt - 1), this._currentChanged.emit({
        previousIndex: Qt,
        previousTitle: Zt,
        currentIndex: this._currentIndex,
        currentTitle: this.currentTitle
      });
      return;
    }
    if (Sn === "select-previous-tab") {
      this._previousTitle ? (this._currentIndex = this._titles.indexOf(this._previousTitle), this._previousTitle = null) : this._currentIndex = Math.min(Qt, this._titles.length - 1), this._currentChanged.emit({
        previousIndex: Qt,
        previousTitle: Zt,
        currentIndex: this._currentIndex,
        currentTitle: this.currentTitle
      });
      return;
    }
    this._currentIndex = -1, this._currentChanged.emit({
      previousIndex: Qt,
      previousTitle: Zt,
      currentIndex: -1,
      currentTitle: null
    });
  }
  /**
   * Handle the `changed` signal of a title object.
   */
  _onTitleChanged(Qt) {
    this.update();
  }
}
(function(_e) {
  class Qt {
    constructor() {
      this.closeIconSelector = ".lm-TabBar-tabCloseIcon", this._tabID = 0, this._tabKeys = /* @__PURE__ */ new WeakMap(), this._uuid = ++Qt._nInstance;
    }
    /**
     * Render the virtual element for a tab.
     *
     * @param data - The data to use for rendering the tab.
     *
     * @returns A virtual element representing the tab.
     */
    renderTab($n) {
      let Sn = $n.title.caption, kn = this.createTabKey($n), Kn = kn, er = this.createTabStyle($n), Cr = this.createTabClass($n), kr = this.createTabDataset($n), Yr = this.createTabARIA($n);
      return $n.title.closable ? h$6.li({ id: Kn, key: kn, className: Cr, title: Sn, style: er, dataset: kr, ...Yr }, this.renderIcon($n), this.renderLabel($n), this.renderCloseIcon($n)) : h$6.li({ id: Kn, key: kn, className: Cr, title: Sn, style: er, dataset: kr, ...Yr }, this.renderIcon($n), this.renderLabel($n));
    }
    /**
     * Render the icon element for a tab.
     *
     * @param data - The data to use for rendering the tab.
     *
     * @returns A virtual element representing the tab icon.
     */
    renderIcon($n) {
      const { title: Sn } = $n;
      let kn = this.createIconClass($n);
      return h$6.div({ className: kn }, Sn.icon, Sn.iconLabel);
    }
    /**
     * Render the label element for a tab.
     *
     * @param data - The data to use for rendering the tab.
     *
     * @returns A virtual element representing the tab label.
     */
    renderLabel($n) {
      return h$6.div({ className: "lm-TabBar-tabLabel" }, $n.title.label);
    }
    /**
     * Render the close icon element for a tab.
     *
     * @param data - The data to use for rendering the tab.
     *
     * @returns A virtual element representing the tab close icon.
     */
    renderCloseIcon($n) {
      return h$6.div({ className: "lm-TabBar-tabCloseIcon" });
    }
    /**
     * Create a unique render key for the tab.
     *
     * @param data - The data to use for the tab.
     *
     * @returns The unique render key for the tab.
     *
     * #### Notes
     * This method caches the key against the tab title the first time
     * the key is generated. This enables efficient rendering of moved
     * tabs and avoids subtle hover style artifacts.
     */
    createTabKey($n) {
      let Sn = this._tabKeys.get($n.title);
      return Sn === void 0 && (Sn = `tab-key-${this._uuid}-${this._tabID++}`, this._tabKeys.set($n.title, Sn)), Sn;
    }
    /**
     * Create the inline style object for a tab.
     *
     * @param data - The data to use for the tab.
     *
     * @returns The inline style data for the tab.
     */
    createTabStyle($n) {
      return { zIndex: `${$n.zIndex}` };
    }
    /**
     * Create the class name for the tab.
     *
     * @param data - The data to use for the tab.
     *
     * @returns The full class name for the tab.
     */
    createTabClass($n) {
      let Sn = "lm-TabBar-tab";
      return $n.title.className && (Sn += ` ${$n.title.className}`), $n.title.closable && (Sn += " lm-mod-closable"), $n.current && (Sn += " lm-mod-current"), Sn;
    }
    /**
     * Create the dataset for a tab.
     *
     * @param data - The data to use for the tab.
     *
     * @returns The dataset for the tab.
     */
    createTabDataset($n) {
      return $n.title.dataset;
    }
    /**
     * Create the ARIA attributes for a tab.
     *
     * @param data - The data to use for the tab.
     *
     * @returns The ARIA attributes for the tab.
     */
    createTabARIA($n) {
      var Sn;
      return {
        role: "tab",
        "aria-selected": $n.current.toString(),
        tabindex: `${(Sn = $n.tabIndex) !== null && Sn !== void 0 ? Sn : "-1"}`
      };
    }
    /**
     * Create the class name for the tab icon.
     *
     * @param data - The data to use for the tab.
     *
     * @returns The full class name for the tab icon.
     */
    createIconClass($n) {
      let Sn = "lm-TabBar-tabIcon", kn = $n.title.iconClass;
      return kn ? `${Sn} ${kn}` : Sn;
    }
  }
  Qt._nInstance = 0, _e.Renderer = Qt, _e.defaultRenderer = new Qt(), _e.addButtonSelector = ".lm-TabBar-addButton";
})(TabBar || (TabBar = {}));
var Private$7$1;
(function(_e) {
  _e.DRAG_THRESHOLD = 5, _e.DETACH_THRESHOLD = 20;
  function Qt() {
    let Yr = document.createElement("div"), Ms = document.createElement("ul");
    Ms.setAttribute("role", "tablist"), Ms.className = "lm-TabBar-content", Yr.appendChild(Ms);
    let Ds = document.createElement("div");
    return Ds.className = "lm-TabBar-addButton lm-mod-hidden", Ds.setAttribute("tabindex", "-1"), Yr.appendChild(Ds), Yr;
  }
  _e.createNode = Qt;
  function Zt(Yr) {
    return Yr instanceof Title$1 ? Yr : new Title$1(Yr);
  }
  _e.asTitle = Zt;
  function $n(Yr) {
    let Ms = window.getComputedStyle(Yr);
    return 1e3 * (parseFloat(Ms.transitionDuration) || 0);
  }
  _e.parseTransitionDuration = $n;
  function Sn(Yr, Ms) {
    let Ds = new Array(Yr.length);
    for (let Ls = 0, js = Yr.length; Ls < js; ++Ls) {
      let zs = Yr[Ls], Fs = window.getComputedStyle(zs);
      Ms === "horizontal" ? Ds[Ls] = {
        pos: zs.offsetLeft,
        size: zs.offsetWidth,
        margin: parseFloat(Fs.marginLeft) || 0
      } : Ds[Ls] = {
        pos: zs.offsetTop,
        size: zs.offsetHeight,
        margin: parseFloat(Fs.marginTop) || 0
      };
    }
    return Ds;
  }
  _e.snapTabLayout = Sn;
  function kn(Yr, Ms) {
    let Ds = Math.abs(Ms.clientX - Yr.pressX), Ls = Math.abs(Ms.clientY - Yr.pressY);
    return Ds >= _e.DRAG_THRESHOLD || Ls >= _e.DRAG_THRESHOLD;
  }
  _e.dragExceeded = kn;
  function Kn(Yr, Ms) {
    let Ds = Yr.contentRect;
    return Ms.clientX < Ds.left - _e.DETACH_THRESHOLD || Ms.clientX >= Ds.right + _e.DETACH_THRESHOLD || Ms.clientY < Ds.top - _e.DETACH_THRESHOLD || Ms.clientY >= Ds.bottom + _e.DETACH_THRESHOLD;
  }
  _e.detachExceeded = Kn;
  function er(Yr, Ms, Ds, Ls) {
    let js, zs, Fs, Bs;
    Ls === "horizontal" ? (js = Ms.pressX, zs = Ds.clientX - Ms.contentRect.left, Fs = Ds.clientX, Bs = Ms.contentRect.width) : (js = Ms.pressY, zs = Ds.clientY - Ms.contentRect.top, Fs = Ds.clientY, Bs = Ms.contentRect.height);
    let Hs = Ms.index, Ws = zs - Ms.tabPressPos, Ys = Ws + Ms.tabSize;
    for (let El = 0, Mu = Yr.length; El < Mu; ++El) {
      let Pl, Iu = Ms.tabLayout[El], Tu = Iu.pos + (Iu.size >> 1);
      if (El < Ms.index && Ws < Tu)
        Pl = `${Ms.tabSize + Ms.tabLayout[El + 1].margin}px`, Hs = Math.min(Hs, El);
      else if (El > Ms.index && Ys > Tu)
        Pl = `${-Ms.tabSize - Iu.margin}px`, Hs = Math.max(Hs, El);
      else if (El === Ms.index) {
        let Au = Fs - js, Nu = Bs - (Ms.tabPos + Ms.tabSize);
        Pl = `${Math.max(-Ms.tabPos, Math.min(Au, Nu))}px`;
      } else
        Pl = "";
      Ls === "horizontal" ? Yr[El].style.left = Pl : Yr[El].style.top = Pl;
    }
    Ms.targetIndex = Hs;
  }
  _e.layoutTabs = er;
  function Cr(Yr, Ms) {
    let Ds;
    Ms === "horizontal" ? Ds = Yr.contentRect.width : Ds = Yr.contentRect.height;
    let Ls;
    if (Yr.targetIndex === Yr.index)
      Ls = 0;
    else if (Yr.targetIndex > Yr.index) {
      let Fs = Yr.tabLayout[Yr.targetIndex];
      Ls = Fs.pos + Fs.size - Yr.tabSize - Yr.tabPos;
    } else
      Ls = Yr.tabLayout[Yr.targetIndex].pos - Yr.tabPos;
    let js = Ds - (Yr.tabPos + Yr.tabSize), zs = Math.max(-Yr.tabPos, Math.min(Ls, js));
    Ms === "horizontal" ? Yr.tab.style.left = `${zs}px` : Yr.tab.style.top = `${zs}px`;
  }
  _e.finalizeTabPosition = Cr;
  function kr(Yr, Ms) {
    for (const Ds of Yr)
      Ms === "horizontal" ? Ds.style.left = "" : Ds.style.top = "";
  }
  _e.resetTabPositions = kr;
})(Private$7$1 || (Private$7$1 = {}));
class DockLayout extends Layout {
  /**
   * Construct a new dock layout.
   *
   * @param options - The options for initializing the layout.
   */
  constructor(Qt) {
    super(), this._spacing = 4, this._dirty = !1, this._root = null, this._box = null, this._items = /* @__PURE__ */ new Map(), this.renderer = Qt.renderer, Qt.spacing !== void 0 && (this._spacing = Utils$1.clampDimension(Qt.spacing)), this._document = Qt.document || document, this._hiddenMode = Qt.hiddenMode !== void 0 ? Qt.hiddenMode : Widget.HiddenMode.Display;
  }
  /**
   * Dispose of the resources held by the layout.
   *
   * #### Notes
   * This will clear and dispose all widgets in the layout.
   */
  dispose() {
    let Qt = this[Symbol.iterator]();
    this._items.forEach((Zt) => {
      Zt.dispose();
    }), this._box = null, this._root = null, this._items.clear();
    for (const Zt of Qt)
      Zt.dispose();
    super.dispose();
  }
  /**
   * The method for hiding child widgets.
   *
   * #### Notes
   * If there is only one child widget, `Display` hiding mode will be used
   * regardless of this setting.
   */
  get hiddenMode() {
    return this._hiddenMode;
  }
  set hiddenMode(Qt) {
    if (this._hiddenMode !== Qt) {
      this._hiddenMode = Qt;
      for (const Zt of this.tabBars())
        if (Zt.titles.length > 1)
          for (const $n of Zt.titles)
            $n.owner.hiddenMode = this._hiddenMode;
    }
  }
  /**
   * Get the inter-element spacing for the dock layout.
   */
  get spacing() {
    return this._spacing;
  }
  /**
   * Set the inter-element spacing for the dock layout.
   */
  set spacing(Qt) {
    Qt = Utils$1.clampDimension(Qt), this._spacing !== Qt && (this._spacing = Qt, this.parent && this.parent.fit());
  }
  /**
   * Whether the dock layout is empty.
   */
  get isEmpty() {
    return this._root === null;
  }
  /**
   * Create an iterator over all widgets in the layout.
   *
   * @returns A new iterator over the widgets in the layout.
   *
   * #### Notes
   * This iterator includes the generated tab bars.
   */
  [Symbol.iterator]() {
    return this._root ? this._root.iterAllWidgets() : empty$3();
  }
  /**
   * Create an iterator over the user widgets in the layout.
   *
   * @returns A new iterator over the user widgets in the layout.
   *
   * #### Notes
   * This iterator does not include the generated tab bars.
   */
  widgets() {
    return this._root ? this._root.iterUserWidgets() : empty$3();
  }
  /**
   * Create an iterator over the selected widgets in the layout.
   *
   * @returns A new iterator over the selected user widgets.
   *
   * #### Notes
   * This iterator yields the widgets corresponding to the current tab
   * of each tab bar in the layout.
   */
  selectedWidgets() {
    return this._root ? this._root.iterSelectedWidgets() : empty$3();
  }
  /**
   * Create an iterator over the tab bars in the layout.
   *
   * @returns A new iterator over the tab bars in the layout.
   *
   * #### Notes
   * This iterator does not include the user widgets.
   */
  tabBars() {
    return this._root ? this._root.iterTabBars() : empty$3();
  }
  /**
   * Create an iterator over the handles in the layout.
   *
   * @returns A new iterator over the handles in the layout.
   */
  handles() {
    return this._root ? this._root.iterHandles() : empty$3();
  }
  /**
   * Move a handle to the given offset position.
   *
   * @param handle - The handle to move.
   *
   * @param offsetX - The desired offset X position of the handle.
   *
   * @param offsetY - The desired offset Y position of the handle.
   *
   * #### Notes
   * If the given handle is not contained in the layout, this is no-op.
   *
   * The handle will be moved as close as possible to the desired
   * position without violating any of the layout constraints.
   *
   * Only one of the coordinates is used depending on the orientation
   * of the handle. This method accepts both coordinates to make it
   * easy to invoke from a mouse move event without needing to know
   * the handle orientation.
   */
  moveHandle(Qt, Zt, $n) {
    let Sn = Qt.classList.contains("lm-mod-hidden");
    if (!this._root || Sn)
      return;
    let kn = this._root.findSplitNode(Qt);
    if (!kn)
      return;
    let Kn;
    kn.node.orientation === "horizontal" ? Kn = Zt - Qt.offsetLeft : Kn = $n - Qt.offsetTop, Kn !== 0 && (kn.node.holdSizes(), BoxEngine.adjust(kn.node.sizers, kn.index, Kn), this.parent && this.parent.update());
  }
  /**
   * Save the current configuration of the dock layout.
   *
   * @returns A new config object for the current layout state.
   *
   * #### Notes
   * The return value can be provided to the `restoreLayout` method
   * in order to restore the layout to its current configuration.
   */
  saveLayout() {
    return this._root ? (this._root.holdAllSizes(), { main: this._root.createConfig() }) : { main: null };
  }
  /**
   * Restore the layout to a previously saved configuration.
   *
   * @param config - The layout configuration to restore.
   *
   * #### Notes
   * Widgets which currently belong to the layout but which are not
   * contained in the config will be unparented.
   */
  restoreLayout(Qt) {
    let Zt = /* @__PURE__ */ new Set(), $n;
    Qt.main ? $n = Private$6$1.normalizeAreaConfig(Qt.main, Zt) : $n = null;
    let Sn = this.widgets(), kn = this.tabBars(), Kn = this.handles();
    this._root = null;
    for (const er of Sn)
      Zt.has(er) || (er.parent = null);
    for (const er of kn)
      er.dispose();
    for (const er of Kn)
      er.parentNode && er.parentNode.removeChild(er);
    for (const er of Zt)
      er.parent = this.parent;
    $n ? this._root = Private$6$1.realizeAreaConfig($n, {
      // Ignoring optional `document` argument as we must reuse `this._document`
      createTabBar: (er) => this._createTabBar(),
      createHandle: () => this._createHandle()
    }, this._document) : this._root = null, this.parent && (Zt.forEach((er) => {
      this.attachWidget(er);
    }), this.parent.fit());
  }
  /**
   * Add a widget to the dock layout.
   *
   * @param widget - The widget to add to the dock layout.
   *
   * @param options - The additional options for adding the widget.
   *
   * #### Notes
   * The widget will be moved if it is already contained in the layout.
   *
   * An error will be thrown if the reference widget is invalid.
   */
  addWidget(Qt, Zt = {}) {
    let $n = Zt.ref || null, Sn = Zt.mode || "tab-after", kn = null;
    if (this._root && $n && (kn = this._root.findTabNode($n)), $n && !kn)
      throw new Error("Reference widget is not in the layout.");
    switch (Qt.parent = this.parent, Sn) {
      case "tab-after":
        this._insertTab(Qt, $n, kn, !0);
        break;
      case "tab-before":
        this._insertTab(Qt, $n, kn, !1);
        break;
      case "split-top":
        this._insertSplit(Qt, $n, kn, "vertical", !1);
        break;
      case "split-left":
        this._insertSplit(Qt, $n, kn, "horizontal", !1);
        break;
      case "split-right":
        this._insertSplit(Qt, $n, kn, "horizontal", !0);
        break;
      case "split-bottom":
        this._insertSplit(Qt, $n, kn, "vertical", !0);
        break;
      case "merge-top":
        this._insertSplit(Qt, $n, kn, "vertical", !1, !0);
        break;
      case "merge-left":
        this._insertSplit(Qt, $n, kn, "horizontal", !1, !0);
        break;
      case "merge-right":
        this._insertSplit(Qt, $n, kn, "horizontal", !0, !0);
        break;
      case "merge-bottom":
        this._insertSplit(Qt, $n, kn, "vertical", !0, !0);
        break;
    }
    this.parent && (this.attachWidget(Qt), this.parent.fit());
  }
  /**
   * Remove a widget from the layout.
   *
   * @param widget - The widget to remove from the layout.
   *
   * #### Notes
   * A widget is automatically removed from the layout when its `parent`
   * is set to `null`. This method should only be invoked directly when
   * removing a widget from a layout which has yet to be installed on a
   * parent widget.
   *
   * This method does *not* modify the widget's `parent`.
   */
  removeWidget(Qt) {
    this._removeWidget(Qt), this.parent && (this.detachWidget(Qt), this.parent.fit());
  }
  /**
   * Find the tab area which contains the given client position.
   *
   * @param clientX - The client X position of interest.
   *
   * @param clientY - The client Y position of interest.
   *
   * @returns The geometry of the tab area at the given position, or
   *   `null` if there is no tab area at the given position.
   */
  hitTestTabAreas(Qt, Zt) {
    if (!this._root || !this.parent || !this.parent.isVisible)
      return null;
    this._box || (this._box = ElementExt.boxSizing(this.parent.node));
    let $n = this.parent.node.getBoundingClientRect(), Sn = Qt - $n.left - this._box.borderLeft, kn = Zt - $n.top - this._box.borderTop, Kn = this._root.hitTestTabNodes(Sn, kn);
    if (!Kn)
      return null;
    let { tabBar: er, top: Cr, left: kr, width: Yr, height: Ms } = Kn, Ds = this._box.borderLeft + this._box.borderRight, Ls = this._box.borderTop + this._box.borderBottom, js = $n.width - Ds - (kr + Yr), zs = $n.height - Ls - (Cr + Ms);
    return { tabBar: er, x: Sn, y: kn, top: Cr, left: kr, right: js, bottom: zs, width: Yr, height: Ms };
  }
  /**
   * Perform layout initialization which requires the parent widget.
   */
  init() {
    super.init();
    for (const Qt of this)
      this.attachWidget(Qt);
    for (const Qt of this.handles())
      this.parent.node.appendChild(Qt);
    this.parent.fit();
  }
  /**
   * Attach the widget to the layout parent widget.
   *
   * @param widget - The widget to attach to the parent.
   *
   * #### Notes
   * This is a no-op if the widget is already attached.
   */
  attachWidget(Qt) {
    this.parent.node !== Qt.node.parentNode && (this._items.set(Qt, new LayoutItem(Qt)), this.parent.isAttached && MessageLoop.sendMessage(Qt, Widget.Msg.BeforeAttach), this.parent.node.appendChild(Qt.node), this.parent.isAttached && MessageLoop.sendMessage(Qt, Widget.Msg.AfterAttach));
  }
  /**
   * Detach the widget from the layout parent widget.
   *
   * @param widget - The widget to detach from the parent.
   *
   * #### Notes
   * This is a no-op if the widget is not attached.
   */
  detachWidget(Qt) {
    if (this.parent.node !== Qt.node.parentNode)
      return;
    this.parent.isAttached && MessageLoop.sendMessage(Qt, Widget.Msg.BeforeDetach), this.parent.node.removeChild(Qt.node), this.parent.isAttached && MessageLoop.sendMessage(Qt, Widget.Msg.AfterDetach);
    let Zt = this._items.get(Qt);
    Zt && (this._items.delete(Qt), Zt.dispose());
  }
  /**
   * A message handler invoked on a `'before-show'` message.
   */
  onBeforeShow(Qt) {
    super.onBeforeShow(Qt), this.parent.update();
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   */
  onBeforeAttach(Qt) {
    super.onBeforeAttach(Qt), this.parent.fit();
  }
  /**
   * A message handler invoked on a `'child-shown'` message.
   */
  onChildShown(Qt) {
    this.parent.fit();
  }
  /**
   * A message handler invoked on a `'child-hidden'` message.
   */
  onChildHidden(Qt) {
    this.parent.fit();
  }
  /**
   * A message handler invoked on a `'resize'` message.
   */
  onResize(Qt) {
    this.parent.isVisible && this._update(Qt.width, Qt.height);
  }
  /**
   * A message handler invoked on an `'update-request'` message.
   */
  onUpdateRequest(Qt) {
    this.parent.isVisible && this._update(-1, -1);
  }
  /**
   * A message handler invoked on a `'fit-request'` message.
   */
  onFitRequest(Qt) {
    this.parent.isAttached && this._fit();
  }
  /**
   * Remove the specified widget from the layout structure.
   *
   * #### Notes
   * This is a no-op if the widget is not in the layout tree.
   *
   * This does not detach the widget from the parent node.
   */
  _removeWidget(Qt) {
    if (!this._root)
      return;
    let Zt = this._root.findTabNode(Qt);
    if (!Zt)
      return;
    if (Private$6$1.removeAria(Qt), Zt.tabBar.titles.length > 1) {
      if (Zt.tabBar.removeTab(Qt.title), this._hiddenMode === Widget.HiddenMode.Scale && Zt.tabBar.titles.length == 1) {
        const Ds = Zt.tabBar.titles[0].owner;
        Ds.hiddenMode = Widget.HiddenMode.Display;
      }
      return;
    }
    if (Zt.tabBar.dispose(), this._root === Zt) {
      this._root = null;
      return;
    }
    this._root.holdAllSizes();
    let $n = Zt.parent;
    Zt.parent = null;
    let Sn = ArrayExt.removeFirstOf($n.children, Zt), kn = ArrayExt.removeAt($n.handles, Sn);
    if (ArrayExt.removeAt($n.sizers, Sn), kn.parentNode && kn.parentNode.removeChild(kn), $n.children.length > 1) {
      $n.syncHandles();
      return;
    }
    let Kn = $n.parent;
    $n.parent = null;
    let er = $n.children[0], Cr = $n.handles[0];
    if ($n.children.length = 0, $n.handles.length = 0, $n.sizers.length = 0, Cr.parentNode && Cr.parentNode.removeChild(Cr), this._root === $n) {
      er.parent = null, this._root = er;
      return;
    }
    let kr = Kn, Yr = kr.children.indexOf($n);
    if (er instanceof Private$6$1.TabLayoutNode) {
      er.parent = kr, kr.children[Yr] = er;
      return;
    }
    let Ms = ArrayExt.removeAt(kr.handles, Yr);
    ArrayExt.removeAt(kr.children, Yr), ArrayExt.removeAt(kr.sizers, Yr), Ms.parentNode && Ms.parentNode.removeChild(Ms);
    for (let Ds = 0, Ls = er.children.length; Ds < Ls; ++Ds) {
      let js = er.children[Ds], zs = er.handles[Ds], Fs = er.sizers[Ds];
      ArrayExt.insert(kr.children, Yr + Ds, js), ArrayExt.insert(kr.handles, Yr + Ds, zs), ArrayExt.insert(kr.sizers, Yr + Ds, Fs), js.parent = kr;
    }
    er.children.length = 0, er.handles.length = 0, er.sizers.length = 0, er.parent = null, kr.syncHandles();
  }
  /**
   * Create the tab layout node to hold the widget.
   */
  _createTabNode(Qt) {
    let Zt = new Private$6$1.TabLayoutNode(this._createTabBar());
    return Zt.tabBar.addTab(Qt.title), Private$6$1.addAria(Qt, Zt.tabBar), Zt;
  }
  /**
   * Insert a widget next to an existing tab.
   *
   * #### Notes
   * This does not attach the widget to the parent widget.
   */
  _insertTab(Qt, Zt, $n, Sn) {
    if (Qt === Zt)
      return;
    if (!this._root) {
      let Kn = new Private$6$1.TabLayoutNode(this._createTabBar());
      Kn.tabBar.addTab(Qt.title), this._root = Kn, Private$6$1.addAria(Qt, Kn.tabBar);
      return;
    }
    $n || ($n = this._root.findFirstTabNode()), $n.tabBar.titles.indexOf(Qt.title) === -1 && (this._removeWidget(Qt), Qt.hide());
    let kn;
    if (Zt ? kn = $n.tabBar.titles.indexOf(Zt.title) : kn = $n.tabBar.currentIndex, this._hiddenMode === Widget.HiddenMode.Scale)
      if ($n.tabBar.titles.length === 0)
        Qt.hiddenMode = Widget.HiddenMode.Display;
      else if ($n.tabBar.titles.length == 1) {
        const Kn = $n.tabBar.titles[0].owner;
        Kn.hiddenMode = Widget.HiddenMode.Scale;
      } else
        Qt.hiddenMode = Widget.HiddenMode.Scale;
    else
      Qt.hiddenMode = this._hiddenMode;
    $n.tabBar.insertTab(kn + (Sn ? 1 : 0), Qt.title), Private$6$1.addAria(Qt, $n.tabBar);
  }
  /**
   * Insert a widget as a new split area.
   *
   * #### Notes
   * This does not attach the widget to the parent widget.
   */
  _insertSplit(Qt, Zt, $n, Sn, kn, Kn = !1) {
    if (Qt === Zt && $n && $n.tabBar.titles.length === 1)
      return;
    if (this._removeWidget(Qt), !this._root) {
      this._root = this._createTabNode(Qt);
      return;
    }
    if (!$n || !$n.parent) {
      let Ds = this._splitRoot(Sn), Ls = kn ? Ds.children.length : 0;
      Ds.normalizeSizes();
      let js = Private$6$1.createSizer($n ? 1 : Private$6$1.GOLDEN_RATIO), zs = this._createTabNode(Qt);
      ArrayExt.insert(Ds.children, Ls, zs), ArrayExt.insert(Ds.sizers, Ls, js), ArrayExt.insert(Ds.handles, Ls, this._createHandle()), zs.parent = Ds, Ds.normalizeSizes(), Ds.syncHandles();
      return;
    }
    let er = $n.parent;
    if (er.orientation === Sn) {
      let Ds = er.children.indexOf($n);
      if (Kn) {
        let Fs = Ds + (kn ? 1 : -1), Bs = er.children[Fs];
        if (Bs instanceof Private$6$1.TabLayoutNode) {
          this._insertTab(Qt, null, Bs, !0), ++Bs.tabBar.currentIndex;
          return;
        }
      }
      er.normalizeSizes();
      let Ls = er.sizers[Ds].sizeHint /= 2, js = Ds + (kn ? 1 : 0), zs = this._createTabNode(Qt);
      ArrayExt.insert(er.children, js, zs), ArrayExt.insert(er.sizers, js, Private$6$1.createSizer(Ls)), ArrayExt.insert(er.handles, js, this._createHandle()), zs.parent = er, er.syncHandles();
      return;
    }
    let Cr = ArrayExt.removeFirstOf(er.children, $n), kr = new Private$6$1.SplitLayoutNode(Sn);
    kr.normalized = !0, kr.children.push($n), kr.sizers.push(Private$6$1.createSizer(0.5)), kr.handles.push(this._createHandle()), $n.parent = kr;
    let Yr = kn ? 1 : 0, Ms = this._createTabNode(Qt);
    ArrayExt.insert(kr.children, Yr, Ms), ArrayExt.insert(kr.sizers, Yr, Private$6$1.createSizer(0.5)), ArrayExt.insert(kr.handles, Yr, this._createHandle()), Ms.parent = kr, kr.syncHandles(), ArrayExt.insert(er.children, Cr, kr), kr.parent = er;
  }
  /**
   * Ensure the root is a split node with the given orientation.
   */
  _splitRoot(Qt) {
    let Zt = this._root;
    if (Zt instanceof Private$6$1.SplitLayoutNode && Zt.orientation === Qt)
      return Zt;
    let $n = this._root = new Private$6$1.SplitLayoutNode(Qt);
    return Zt && ($n.children.push(Zt), $n.sizers.push(Private$6$1.createSizer(0)), $n.handles.push(this._createHandle()), Zt.parent = $n), $n;
  }
  /**
   * Fit the layout to the total size required by the widgets.
   */
  _fit() {
    let Qt = 0, Zt = 0;
    if (this._root) {
      let kn = this._root.fit(this._spacing, this._items);
      Qt = kn.minWidth, Zt = kn.minHeight;
    }
    let $n = this._box = ElementExt.boxSizing(this.parent.node);
    Qt += $n.horizontalSum, Zt += $n.verticalSum;
    let Sn = this.parent.node.style;
    Sn.minWidth = `${Qt}px`, Sn.minHeight = `${Zt}px`, this._dirty = !0, this.parent.parent && MessageLoop.sendMessage(this.parent.parent, Widget.Msg.FitRequest), this._dirty && MessageLoop.sendMessage(this.parent, Widget.Msg.UpdateRequest);
  }
  /**
   * Update the layout position and size of the widgets.
   *
   * The parent offset dimensions should be `-1` if unknown.
   */
  _update(Qt, Zt) {
    if (this._dirty = !1, !this._root)
      return;
    Qt < 0 && (Qt = this.parent.node.offsetWidth), Zt < 0 && (Zt = this.parent.node.offsetHeight), this._box || (this._box = ElementExt.boxSizing(this.parent.node));
    let $n = this._box.paddingTop, Sn = this._box.paddingLeft, kn = Qt - this._box.horizontalSum, Kn = Zt - this._box.verticalSum;
    this._root.update($n, Sn, kn, Kn, this._spacing, this._items);
  }
  /**
   * Create a new tab bar for use by the dock layout.
   *
   * #### Notes
   * The tab bar will be attached to the parent if it exists.
   */
  _createTabBar() {
    let Qt = this.renderer.createTabBar(this._document);
    return Qt.orientation = "horizontal", this.parent && this.attachWidget(Qt), Qt;
  }
  /**
   * Create a new handle for the dock layout.
   *
   * #### Notes
   * The handle will be attached to the parent if it exists.
   */
  _createHandle() {
    let Qt = this.renderer.createHandle(), Zt = Qt.style;
    return Zt.position = "absolute", Zt.contain = "strict", Zt.top = "0", Zt.left = "0", Zt.width = "0", Zt.height = "0", this.parent && this.parent.node.appendChild(Qt), Qt;
  }
}
var Private$6$1;
(function(_e) {
  _e.GOLDEN_RATIO = 0.618;
  function Qt(Ds) {
    let Ls = new BoxSizer();
    return Ls.sizeHint = Ds, Ls.size = Ds, Ls;
  }
  _e.createSizer = Qt;
  function Zt(Ds, Ls) {
    let js;
    return Ds.type === "tab-area" ? js = Cr(Ds, Ls) : js = kr(Ds, Ls), js;
  }
  _e.normalizeAreaConfig = Zt;
  function $n(Ds, Ls, js) {
    let zs;
    return Ds.type === "tab-area" ? zs = Yr(Ds, Ls, js) : zs = Ms(Ds, Ls, js), zs;
  }
  _e.realizeAreaConfig = $n;
  class Sn {
    /**
     * Construct a new tab layout node.
     *
     * @param tabBar - The tab bar to use for the layout node.
     */
    constructor(Ls) {
      this.parent = null, this._top = 0, this._left = 0, this._width = 0, this._height = 0;
      let js = new BoxSizer(), zs = new BoxSizer();
      js.stretch = 0, zs.stretch = 1, this.tabBar = Ls, this.sizers = [js, zs];
    }
    /**
     * The most recent value for the `top` edge of the layout box.
     */
    get top() {
      return this._top;
    }
    /**
     * The most recent value for the `left` edge of the layout box.
     */
    get left() {
      return this._left;
    }
    /**
     * The most recent value for the `width` of the layout box.
     */
    get width() {
      return this._width;
    }
    /**
     * The most recent value for the `height` of the layout box.
     */
    get height() {
      return this._height;
    }
    /**
     * Create an iterator for all widgets in the layout tree.
     */
    *iterAllWidgets() {
      yield this.tabBar, yield* this.iterUserWidgets();
    }
    /**
     * Create an iterator for the user widgets in the layout tree.
     */
    *iterUserWidgets() {
      for (const Ls of this.tabBar.titles)
        yield Ls.owner;
    }
    /**
     * Create an iterator for the selected widgets in the layout tree.
     */
    *iterSelectedWidgets() {
      let Ls = this.tabBar.currentTitle;
      Ls && (yield Ls.owner);
    }
    /**
     * Create an iterator for the tab bars in the layout tree.
     */
    *iterTabBars() {
      yield this.tabBar;
    }
    /**
     * Create an iterator for the handles in the layout tree.
     */
    // eslint-disable-next-line require-yield
    *iterHandles() {
    }
    /**
     * Find the tab layout node which contains the given widget.
     */
    findTabNode(Ls) {
      return this.tabBar.titles.indexOf(Ls.title) !== -1 ? this : null;
    }
    /**
     * Find the split layout node which contains the given handle.
     */
    findSplitNode(Ls) {
      return null;
    }
    /**
     * Find the first tab layout node in a layout tree.
     */
    findFirstTabNode() {
      return this;
    }
    /**
     * Find the tab layout node which contains the local point.
     */
    hitTestTabNodes(Ls, js) {
      return Ls < this._left || Ls >= this._left + this._width || js < this._top || js >= this._top + this._height ? null : this;
    }
    /**
     * Create a configuration object for the layout tree.
     */
    createConfig() {
      let Ls = this.tabBar.titles.map((zs) => zs.owner), js = this.tabBar.currentIndex;
      return { type: "tab-area", widgets: Ls, currentIndex: js };
    }
    /**
     * Recursively hold all of the sizes in the layout tree.
     *
     * This ignores the sizers of tab layout nodes.
     */
    holdAllSizes() {
    }
    /**
     * Fit the layout tree.
     */
    fit(Ls, js) {
      let zs = 0, Fs = 0, Bs = 1 / 0, Hs = 1 / 0, Ws = js.get(this.tabBar), Ys = this.tabBar.currentTitle, El = Ys ? js.get(Ys.owner) : void 0, [Mu, Pl] = this.sizers;
      return Ws && Ws.fit(), El && El.fit(), Ws && !Ws.isHidden ? (zs = Math.max(zs, Ws.minWidth), Fs += Ws.minHeight, Mu.minSize = Ws.minHeight, Mu.maxSize = Ws.maxHeight) : (Mu.minSize = 0, Mu.maxSize = 0), El && !El.isHidden ? (zs = Math.max(zs, El.minWidth), Fs += El.minHeight, Pl.minSize = El.minHeight, Pl.maxSize = 1 / 0) : (Pl.minSize = 0, Pl.maxSize = 1 / 0), { minWidth: zs, minHeight: Fs, maxWidth: Bs, maxHeight: Hs };
    }
    /**
     * Update the layout tree.
     */
    update(Ls, js, zs, Fs, Bs, Hs) {
      this._top = js, this._left = Ls, this._width = zs, this._height = Fs;
      let Ws = Hs.get(this.tabBar), Ys = this.tabBar.currentTitle, El = Ys ? Hs.get(Ys.owner) : void 0;
      if (BoxEngine.calc(this.sizers, Fs), Ws && !Ws.isHidden) {
        let Mu = this.sizers[0].size;
        Ws.update(Ls, js, zs, Mu), js += Mu;
      }
      if (El && !El.isHidden) {
        let Mu = this.sizers[1].size;
        El.update(Ls, js, zs, Mu);
      }
    }
  }
  _e.TabLayoutNode = Sn;
  class kn {
    /**
     * Construct a new split layout node.
     *
     * @param orientation - The orientation of the node.
     */
    constructor(Ls) {
      this.parent = null, this.normalized = !1, this.children = [], this.sizers = [], this.handles = [], this.orientation = Ls;
    }
    /**
     * Create an iterator for all widgets in the layout tree.
     */
    *iterAllWidgets() {
      for (const Ls of this.children)
        yield* Ls.iterAllWidgets();
    }
    /**
     * Create an iterator for the user widgets in the layout tree.
     */
    *iterUserWidgets() {
      for (const Ls of this.children)
        yield* Ls.iterUserWidgets();
    }
    /**
     * Create an iterator for the selected widgets in the layout tree.
     */
    *iterSelectedWidgets() {
      for (const Ls of this.children)
        yield* Ls.iterSelectedWidgets();
    }
    /**
     * Create an iterator for the tab bars in the layout tree.
     */
    *iterTabBars() {
      for (const Ls of this.children)
        yield* Ls.iterTabBars();
    }
    /**
     * Create an iterator for the handles in the layout tree.
     */
    *iterHandles() {
      yield* this.handles;
      for (const Ls of this.children)
        yield* Ls.iterHandles();
    }
    /**
     * Find the tab layout node which contains the given widget.
     */
    findTabNode(Ls) {
      for (let js = 0, zs = this.children.length; js < zs; ++js) {
        let Fs = this.children[js].findTabNode(Ls);
        if (Fs)
          return Fs;
      }
      return null;
    }
    /**
     * Find the split layout node which contains the given handle.
     */
    findSplitNode(Ls) {
      let js = this.handles.indexOf(Ls);
      if (js !== -1)
        return { index: js, node: this };
      for (let zs = 0, Fs = this.children.length; zs < Fs; ++zs) {
        let Bs = this.children[zs].findSplitNode(Ls);
        if (Bs)
          return Bs;
      }
      return null;
    }
    /**
     * Find the first tab layout node in a layout tree.
     */
    findFirstTabNode() {
      return this.children.length === 0 ? null : this.children[0].findFirstTabNode();
    }
    /**
     * Find the tab layout node which contains the local point.
     */
    hitTestTabNodes(Ls, js) {
      for (let zs = 0, Fs = this.children.length; zs < Fs; ++zs) {
        let Bs = this.children[zs].hitTestTabNodes(Ls, js);
        if (Bs)
          return Bs;
      }
      return null;
    }
    /**
     * Create a configuration object for the layout tree.
     */
    createConfig() {
      let Ls = this.orientation, js = this.createNormalizedSizes(), zs = this.children.map((Fs) => Fs.createConfig());
      return { type: "split-area", orientation: Ls, children: zs, sizes: js };
    }
    /**
     * Sync the visibility and orientation of the handles.
     */
    syncHandles() {
      this.handles.forEach((Ls, js) => {
        Ls.setAttribute("data-orientation", this.orientation), js === this.handles.length - 1 ? Ls.classList.add("lm-mod-hidden") : Ls.classList.remove("lm-mod-hidden");
      });
    }
    /**
     * Hold the current sizes of the box sizers.
     *
     * This sets the size hint of each sizer to its current size.
     */
    holdSizes() {
      for (const Ls of this.sizers)
        Ls.sizeHint = Ls.size;
    }
    /**
     * Recursively hold all of the sizes in the layout tree.
     *
     * This ignores the sizers of tab layout nodes.
     */
    holdAllSizes() {
      for (const Ls of this.children)
        Ls.holdAllSizes();
      this.holdSizes();
    }
    /**
     * Normalize the sizes of the split layout node.
     */
    normalizeSizes() {
      let Ls = this.sizers.length;
      if (Ls === 0)
        return;
      this.holdSizes();
      let js = this.sizers.reduce((zs, Fs) => zs + Fs.sizeHint, 0);
      if (js === 0)
        for (const zs of this.sizers)
          zs.size = zs.sizeHint = 1 / Ls;
      else
        for (const zs of this.sizers)
          zs.size = zs.sizeHint /= js;
      this.normalized = !0;
    }
    /**
     * Snap the normalized sizes of the split layout node.
     */
    createNormalizedSizes() {
      let Ls = this.sizers.length;
      if (Ls === 0)
        return [];
      let js = this.sizers.map((Fs) => Fs.size), zs = js.reduce((Fs, Bs) => Fs + Bs, 0);
      if (zs === 0)
        for (let Fs = js.length - 1; Fs > -1; Fs--)
          js[Fs] = 1 / Ls;
      else
        for (let Fs = js.length - 1; Fs > -1; Fs--)
          js[Fs] /= zs;
      return js;
    }
    /**
     * Fit the layout tree.
     */
    fit(Ls, js) {
      let zs = this.orientation === "horizontal", Fs = Math.max(0, this.children.length - 1) * Ls, Bs = zs ? Fs : 0, Hs = zs ? 0 : Fs, Ws = 1 / 0, Ys = 1 / 0;
      for (let El = 0, Mu = this.children.length; El < Mu; ++El) {
        let Pl = this.children[El].fit(Ls, js);
        zs ? (Hs = Math.max(Hs, Pl.minHeight), Bs += Pl.minWidth, this.sizers[El].minSize = Pl.minWidth) : (Bs = Math.max(Bs, Pl.minWidth), Hs += Pl.minHeight, this.sizers[El].minSize = Pl.minHeight);
      }
      return { minWidth: Bs, minHeight: Hs, maxWidth: Ws, maxHeight: Ys };
    }
    /**
     * Update the layout tree.
     */
    update(Ls, js, zs, Fs, Bs, Hs) {
      let Ws = this.orientation === "horizontal", Ys = Math.max(0, this.children.length - 1) * Bs, El = Math.max(0, (Ws ? zs : Fs) - Ys);
      if (this.normalized) {
        for (const Mu of this.sizers)
          Mu.sizeHint *= El;
        this.normalized = !1;
      }
      BoxEngine.calc(this.sizers, El);
      for (let Mu = 0, Pl = this.children.length; Mu < Pl; ++Mu) {
        let Iu = this.children[Mu], Tu = this.sizers[Mu].size, Au = this.handles[Mu].style;
        Ws ? (Iu.update(Ls, js, Tu, Fs, Bs, Hs), Ls += Tu, Au.top = `${js}px`, Au.left = `${Ls}px`, Au.width = `${Bs}px`, Au.height = `${Fs}px`, Ls += Bs) : (Iu.update(Ls, js, zs, Tu, Bs, Hs), js += Tu, Au.top = `${js}px`, Au.left = `${Ls}px`, Au.width = `${zs}px`, Au.height = `${Bs}px`, js += Bs);
      }
    }
  }
  _e.SplitLayoutNode = kn;
  function Kn(Ds, Ls) {
    Ds.node.setAttribute("role", "tabpanel");
    let js = Ls.renderer;
    if (js instanceof TabBar.Renderer) {
      let zs = js.createTabKey({
        title: Ds.title,
        current: !1,
        zIndex: 0
      });
      Ds.node.setAttribute("aria-labelledby", zs);
    }
  }
  _e.addAria = Kn;
  function er(Ds) {
    Ds.node.removeAttribute("role"), Ds.node.removeAttribute("aria-labelledby");
  }
  _e.removeAria = er;
  function Cr(Ds, Ls) {
    if (Ds.widgets.length === 0)
      return null;
    let js = [];
    for (const Fs of Ds.widgets)
      Ls.has(Fs) || (Ls.add(Fs), js.push(Fs));
    if (js.length === 0)
      return null;
    let zs = Ds.currentIndex;
    return zs !== -1 && (zs < 0 || zs >= js.length) && (zs = 0), { type: "tab-area", widgets: js, currentIndex: zs };
  }
  function kr(Ds, Ls) {
    let js = Ds.orientation, zs = [], Fs = [];
    for (let Bs = 0, Hs = Ds.children.length; Bs < Hs; ++Bs) {
      let Ws = Zt(Ds.children[Bs], Ls);
      Ws && (Ws.type === "tab-area" || Ws.orientation !== js ? (zs.push(Ws), Fs.push(Math.abs(Ds.sizes[Bs] || 0))) : (zs.push(...Ws.children), Fs.push(...Ws.sizes)));
    }
    return zs.length === 0 ? null : zs.length === 1 ? zs[0] : { type: "split-area", orientation: js, children: zs, sizes: Fs };
  }
  function Yr(Ds, Ls, js) {
    let zs = Ls.createTabBar(js);
    for (const Fs of Ds.widgets)
      Fs.hide(), zs.addTab(Fs.title), _e.addAria(Fs, zs);
    return zs.currentIndex = Ds.currentIndex, new Sn(zs);
  }
  function Ms(Ds, Ls, js) {
    let zs = new kn(Ds.orientation);
    return Ds.children.forEach((Fs, Bs) => {
      let Hs = $n(Fs, Ls, js), Ws = Qt(Ds.sizes[Bs]), Ys = Ls.createHandle();
      zs.children.push(Hs), zs.handles.push(Ys), zs.sizers.push(Ws), Hs.parent = zs;
    }), zs.syncHandles(), zs.normalizeSizes(), zs;
  }
})(Private$6$1 || (Private$6$1 = {}));
class DockPanel extends Widget {
  /**
   * Construct a new dock panel.
   *
   * @param options - The options for initializing the panel.
   */
  constructor(Qt = {}) {
    super(), this._drag = null, this._tabsMovable = !0, this._tabsConstrained = !1, this._addButtonEnabled = !1, this._pressData = null, this._layoutModified = new Signal(this), this._addRequested = new Signal(this), this.addClass("lm-DockPanel"), this._document = Qt.document || document, this._mode = Qt.mode || "multiple-document", this._renderer = Qt.renderer || DockPanel.defaultRenderer, this._edges = Qt.edges || Private$5$1.DEFAULT_EDGES, Qt.tabsMovable !== void 0 && (this._tabsMovable = Qt.tabsMovable), Qt.tabsConstrained !== void 0 && (this._tabsConstrained = Qt.tabsConstrained), Qt.addButtonEnabled !== void 0 && (this._addButtonEnabled = Qt.addButtonEnabled), this.dataset.mode = this._mode;
    let Zt = {
      createTabBar: () => this._createTabBar(),
      createHandle: () => this._createHandle()
    };
    this.layout = new DockLayout({
      document: this._document,
      renderer: Zt,
      spacing: Qt.spacing,
      hiddenMode: Qt.hiddenMode
    }), this.overlay = Qt.overlay || new DockPanel.Overlay(), this.node.appendChild(this.overlay.node);
  }
  /**
   * Dispose of the resources held by the panel.
   */
  dispose() {
    this._releaseMouse(), this.overlay.hide(0), this._drag && this._drag.dispose(), super.dispose();
  }
  /**
   * The method for hiding widgets.
   */
  get hiddenMode() {
    return this.layout.hiddenMode;
  }
  /**
   * Set the method for hiding widgets.
   */
  set hiddenMode(Qt) {
    this.layout.hiddenMode = Qt;
  }
  /**
   * A signal emitted when the layout configuration is modified.
   *
   * #### Notes
   * This signal is emitted whenever the current layout configuration
   * may have changed.
   *
   * This signal is emitted asynchronously in a collapsed fashion, so
   * that multiple synchronous modifications results in only a single
   * emit of the signal.
   */
  get layoutModified() {
    return this._layoutModified;
  }
  /**
   * A signal emitted when the add button on a tab bar is clicked.
   *
   */
  get addRequested() {
    return this._addRequested;
  }
  /**
   * The renderer used by the dock panel.
   */
  get renderer() {
    return this.layout.renderer;
  }
  /**
   * Get the spacing between the widgets.
   */
  get spacing() {
    return this.layout.spacing;
  }
  /**
   * Set the spacing between the widgets.
   */
  set spacing(Qt) {
    this.layout.spacing = Qt;
  }
  /**
   * Get the mode for the dock panel.
   */
  get mode() {
    return this._mode;
  }
  /**
   * Set the mode for the dock panel.
   *
   * #### Notes
   * Changing the mode is a destructive operation with respect to the
   * panel's layout configuration. If layout state must be preserved,
   * save the current layout config before changing the mode.
   */
  set mode(Qt) {
    if (this._mode === Qt)
      return;
    this._mode = Qt, this.dataset.mode = Qt;
    let Zt = this.layout;
    switch (Qt) {
      case "multiple-document":
        for (const $n of Zt.tabBars())
          $n.show();
        break;
      case "single-document":
        Zt.restoreLayout(Private$5$1.createSingleDocumentConfig(this));
        break;
      default:
        throw "unreachable";
    }
    MessageLoop.postMessage(this, Private$5$1.LayoutModified);
  }
  /**
   * Whether the tabs can be dragged / moved at runtime.
   */
  get tabsMovable() {
    return this._tabsMovable;
  }
  /**
   * Enable / Disable draggable / movable tabs.
   */
  set tabsMovable(Qt) {
    this._tabsMovable = Qt;
    for (const Zt of this.tabBars())
      Zt.tabsMovable = Qt;
  }
  /**
   * Whether the tabs are constrained to their source dock panel
   */
  get tabsConstrained() {
    return this._tabsConstrained;
  }
  /**
   * Constrain/Allow tabs to be dragged outside of this dock panel
   */
  set tabsConstrained(Qt) {
    this._tabsConstrained = Qt;
  }
  /**
   * Whether the add buttons for each tab bar are enabled.
   */
  get addButtonEnabled() {
    return this._addButtonEnabled;
  }
  /**
   * Set whether the add buttons for each tab bar are enabled.
   */
  set addButtonEnabled(Qt) {
    this._addButtonEnabled = Qt;
    for (const Zt of this.tabBars())
      Zt.addButtonEnabled = Qt;
  }
  /**
   * Whether the dock panel is empty.
   */
  get isEmpty() {
    return this.layout.isEmpty;
  }
  /**
   * Create an iterator over the user widgets in the panel.
   *
   * @returns A new iterator over the user widgets in the panel.
   *
   * #### Notes
   * This iterator does not include the generated tab bars.
   */
  *widgets() {
    yield* this.layout.widgets();
  }
  /**
   * Create an iterator over the selected widgets in the panel.
   *
   * @returns A new iterator over the selected user widgets.
   *
   * #### Notes
   * This iterator yields the widgets corresponding to the current tab
   * of each tab bar in the panel.
   */
  *selectedWidgets() {
    yield* this.layout.selectedWidgets();
  }
  /**
   * Create an iterator over the tab bars in the panel.
   *
   * @returns A new iterator over the tab bars in the panel.
   *
   * #### Notes
   * This iterator does not include the user widgets.
   */
  *tabBars() {
    yield* this.layout.tabBars();
  }
  /**
   * Create an iterator over the handles in the panel.
   *
   * @returns A new iterator over the handles in the panel.
   */
  *handles() {
    yield* this.layout.handles();
  }
  /**
   * Select a specific widget in the dock panel.
   *
   * @param widget - The widget of interest.
   *
   * #### Notes
   * This will make the widget the current widget in its tab area.
   */
  selectWidget(Qt) {
    let Zt = find$5(this.tabBars(), ($n) => $n.titles.indexOf(Qt.title) !== -1);
    if (!Zt)
      throw new Error("Widget is not contained in the dock panel.");
    Zt.currentTitle = Qt.title;
  }
  /**
   * Activate a specified widget in the dock panel.
   *
   * @param widget - The widget of interest.
   *
   * #### Notes
   * This will select and activate the given widget.
   */
  activateWidget(Qt) {
    this.selectWidget(Qt), Qt.activate();
  }
  /**
   * Save the current layout configuration of the dock panel.
   *
   * @returns A new config object for the current layout state.
   *
   * #### Notes
   * The return value can be provided to the `restoreLayout` method
   * in order to restore the layout to its current configuration.
   */
  saveLayout() {
    return this.layout.saveLayout();
  }
  /**
   * Restore the layout to a previously saved configuration.
   *
   * @param config - The layout configuration to restore.
   *
   * #### Notes
   * Widgets which currently belong to the layout but which are not
   * contained in the config will be unparented.
   *
   * The dock panel automatically reverts to `'multiple-document'`
   * mode when a layout config is restored.
   */
  restoreLayout(Qt) {
    this._mode = "multiple-document", this.layout.restoreLayout(Qt), (Platform.IS_EDGE || Platform.IS_IE) && MessageLoop.flush(), MessageLoop.postMessage(this, Private$5$1.LayoutModified);
  }
  /**
   * Add a widget to the dock panel.
   *
   * @param widget - The widget to add to the dock panel.
   *
   * @param options - The additional options for adding the widget.
   *
   * #### Notes
   * If the panel is in single document mode, the options are ignored
   * and the widget is always added as tab in the hidden tab bar.
   */
  addWidget(Qt, Zt = {}) {
    this._mode === "single-document" ? this.layout.addWidget(Qt) : this.layout.addWidget(Qt, Zt), MessageLoop.postMessage(this, Private$5$1.LayoutModified);
  }
  /**
   * Process a message sent to the widget.
   *
   * @param msg - The message sent to the widget.
   */
  processMessage(Qt) {
    Qt.type === "layout-modified" ? this._layoutModified.emit(void 0) : super.processMessage(Qt);
  }
  /**
   * Handle the DOM events for the dock panel.
   *
   * @param event - The DOM event sent to the panel.
   *
   * #### Notes
   * This method implements the DOM `EventListener` interface and is
   * called in response to events on the panel's DOM node. It should
   * not be called directly by user code.
   */
  handleEvent(Qt) {
    switch (Qt.type) {
      case "lm-dragenter":
        this._evtDragEnter(Qt);
        break;
      case "lm-dragleave":
        this._evtDragLeave(Qt);
        break;
      case "lm-dragover":
        this._evtDragOver(Qt);
        break;
      case "lm-drop":
        this._evtDrop(Qt);
        break;
      case "pointerdown":
        this._evtPointerDown(Qt);
        break;
      case "pointermove":
        this._evtPointerMove(Qt);
        break;
      case "pointerup":
        this._evtPointerUp(Qt);
        break;
      case "keydown":
        this._evtKeyDown(Qt);
        break;
      case "contextmenu":
        Qt.preventDefault(), Qt.stopPropagation();
        break;
    }
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   */
  onBeforeAttach(Qt) {
    this.node.addEventListener("lm-dragenter", this), this.node.addEventListener("lm-dragleave", this), this.node.addEventListener("lm-dragover", this), this.node.addEventListener("lm-drop", this), this.node.addEventListener("pointerdown", this);
  }
  /**
   * A message handler invoked on an `'after-detach'` message.
   */
  onAfterDetach(Qt) {
    this.node.removeEventListener("lm-dragenter", this), this.node.removeEventListener("lm-dragleave", this), this.node.removeEventListener("lm-dragover", this), this.node.removeEventListener("lm-drop", this), this.node.removeEventListener("pointerdown", this), this._releaseMouse();
  }
  /**
   * A message handler invoked on a `'child-added'` message.
   */
  onChildAdded(Qt) {
    Private$5$1.isGeneratedTabBarProperty.get(Qt.child) || Qt.child.addClass("lm-DockPanel-widget");
  }
  /**
   * A message handler invoked on a `'child-removed'` message.
   */
  onChildRemoved(Qt) {
    Private$5$1.isGeneratedTabBarProperty.get(Qt.child) || (Qt.child.removeClass("lm-DockPanel-widget"), MessageLoop.postMessage(this, Private$5$1.LayoutModified));
  }
  /**
   * Handle the `'lm-dragenter'` event for the dock panel.
   */
  _evtDragEnter(Qt) {
    Qt.mimeData.hasData("application/vnd.lumino.widget-factory") && (Qt.preventDefault(), Qt.stopPropagation());
  }
  /**
   * Handle the `'lm-dragleave'` event for the dock panel.
   */
  _evtDragLeave(Qt) {
    Qt.preventDefault(), !(this._tabsConstrained && Qt.source !== this) && (Qt.stopPropagation(), this.overlay.hide(1));
  }
  /**
   * Handle the `'lm-dragover'` event for the dock panel.
   */
  _evtDragOver(Qt) {
    Qt.preventDefault(), this._tabsConstrained && Qt.source !== this || this._showOverlay(Qt.clientX, Qt.clientY) === "invalid" ? Qt.dropAction = "none" : (Qt.stopPropagation(), Qt.dropAction = Qt.proposedAction);
  }
  /**
   * Handle the `'lm-drop'` event for the dock panel.
   */
  _evtDrop(Qt) {
    if (Qt.preventDefault(), this.overlay.hide(0), Qt.proposedAction === "none") {
      Qt.dropAction = "none";
      return;
    }
    let { clientX: Zt, clientY: $n } = Qt, { zone: Sn, target: kn } = Private$5$1.findDropTarget(this, Zt, $n, this._edges);
    if (this._tabsConstrained && Qt.source !== this || Sn === "invalid") {
      Qt.dropAction = "none";
      return;
    }
    let er = Qt.mimeData.getData("application/vnd.lumino.widget-factory");
    if (typeof er != "function") {
      Qt.dropAction = "none";
      return;
    }
    let Cr = er();
    if (!(Cr instanceof Widget)) {
      Qt.dropAction = "none";
      return;
    }
    if (Cr.contains(this)) {
      Qt.dropAction = "none";
      return;
    }
    let kr = kn ? Private$5$1.getDropRef(kn.tabBar) : null;
    switch (Sn) {
      case "root-all":
        this.addWidget(Cr);
        break;
      case "root-top":
        this.addWidget(Cr, { mode: "split-top" });
        break;
      case "root-left":
        this.addWidget(Cr, { mode: "split-left" });
        break;
      case "root-right":
        this.addWidget(Cr, { mode: "split-right" });
        break;
      case "root-bottom":
        this.addWidget(Cr, { mode: "split-bottom" });
        break;
      case "widget-all":
        this.addWidget(Cr, { mode: "tab-after", ref: kr });
        break;
      case "widget-top":
        this.addWidget(Cr, { mode: "split-top", ref: kr });
        break;
      case "widget-left":
        this.addWidget(Cr, { mode: "split-left", ref: kr });
        break;
      case "widget-right":
        this.addWidget(Cr, { mode: "split-right", ref: kr });
        break;
      case "widget-bottom":
        this.addWidget(Cr, { mode: "split-bottom", ref: kr });
        break;
      case "widget-tab":
        this.addWidget(Cr, { mode: "tab-after", ref: kr });
        break;
      default:
        throw "unreachable";
    }
    Qt.dropAction = Qt.proposedAction, Qt.stopPropagation(), this.activateWidget(Cr);
  }
  /**
   * Handle the `'keydown'` event for the dock panel.
   */
  _evtKeyDown(Qt) {
    Qt.preventDefault(), Qt.stopPropagation(), Qt.keyCode === 27 && (this._releaseMouse(), MessageLoop.postMessage(this, Private$5$1.LayoutModified));
  }
  /**
   * Handle the `'pointerdown'` event for the dock panel.
   */
  _evtPointerDown(Qt) {
    if (Qt.button !== 0)
      return;
    let Zt = this.layout, $n = Qt.target, Sn = find$5(Zt.handles(), (Yr) => Yr.contains($n));
    if (!Sn)
      return;
    Qt.preventDefault(), Qt.stopPropagation(), this._document.addEventListener("keydown", this, !0), this._document.addEventListener("pointerup", this, !0), this._document.addEventListener("pointermove", this, !0), this._document.addEventListener("contextmenu", this, !0);
    let kn = Sn.getBoundingClientRect(), Kn = Qt.clientX - kn.left, er = Qt.clientY - kn.top, Cr = window.getComputedStyle(Sn), kr = Drag.overrideCursor(Cr.cursor, this._document);
    this._pressData = { handle: Sn, deltaX: Kn, deltaY: er, override: kr };
  }
  /**
   * Handle the `'pointermove'` event for the dock panel.
   */
  _evtPointerMove(Qt) {
    if (!this._pressData)
      return;
    Qt.preventDefault(), Qt.stopPropagation();
    let Zt = this.node.getBoundingClientRect(), $n = Qt.clientX - Zt.left - this._pressData.deltaX, Sn = Qt.clientY - Zt.top - this._pressData.deltaY;
    this.layout.moveHandle(this._pressData.handle, $n, Sn);
  }
  /**
   * Handle the `'pointerup'` event for the dock panel.
   */
  _evtPointerUp(Qt) {
    Qt.button === 0 && (Qt.preventDefault(), Qt.stopPropagation(), this._releaseMouse(), MessageLoop.postMessage(this, Private$5$1.LayoutModified));
  }
  /**
   * Release the mouse grab for the dock panel.
   */
  _releaseMouse() {
    this._pressData && (this._pressData.override.dispose(), this._pressData = null, this._document.removeEventListener("keydown", this, !0), this._document.removeEventListener("pointerup", this, !0), this._document.removeEventListener("pointermove", this, !0), this._document.removeEventListener("contextmenu", this, !0));
  }
  /**
   * Show the overlay indicator at the given client position.
   *
   * Returns the drop zone at the specified client position.
   *
   * #### Notes
   * If the position is not over a valid zone, the overlay is hidden.
   */
  _showOverlay(Qt, Zt) {
    let { zone: $n, target: Sn } = Private$5$1.findDropTarget(this, Qt, Zt, this._edges);
    if ($n === "invalid")
      return this.overlay.hide(100), $n;
    let kn, Kn, er, Cr, kr = ElementExt.boxSizing(this.node), Yr = this.node.getBoundingClientRect();
    switch ($n) {
      case "root-all":
        kn = kr.paddingTop, Kn = kr.paddingLeft, er = kr.paddingRight, Cr = kr.paddingBottom;
        break;
      case "root-top":
        kn = kr.paddingTop, Kn = kr.paddingLeft, er = kr.paddingRight, Cr = Yr.height * Private$5$1.GOLDEN_RATIO;
        break;
      case "root-left":
        kn = kr.paddingTop, Kn = kr.paddingLeft, er = Yr.width * Private$5$1.GOLDEN_RATIO, Cr = kr.paddingBottom;
        break;
      case "root-right":
        kn = kr.paddingTop, Kn = Yr.width * Private$5$1.GOLDEN_RATIO, er = kr.paddingRight, Cr = kr.paddingBottom;
        break;
      case "root-bottom":
        kn = Yr.height * Private$5$1.GOLDEN_RATIO, Kn = kr.paddingLeft, er = kr.paddingRight, Cr = kr.paddingBottom;
        break;
      case "widget-all":
        kn = Sn.top, Kn = Sn.left, er = Sn.right, Cr = Sn.bottom;
        break;
      case "widget-top":
        kn = Sn.top, Kn = Sn.left, er = Sn.right, Cr = Sn.bottom + Sn.height / 2;
        break;
      case "widget-left":
        kn = Sn.top, Kn = Sn.left, er = Sn.right + Sn.width / 2, Cr = Sn.bottom;
        break;
      case "widget-right":
        kn = Sn.top, Kn = Sn.left + Sn.width / 2, er = Sn.right, Cr = Sn.bottom;
        break;
      case "widget-bottom":
        kn = Sn.top + Sn.height / 2, Kn = Sn.left, er = Sn.right, Cr = Sn.bottom;
        break;
      case "widget-tab": {
        const Ms = Sn.tabBar.node.getBoundingClientRect().height;
        kn = Sn.top, Kn = Sn.left, er = Sn.right, Cr = Sn.bottom + Sn.height - Ms;
        break;
      }
      default:
        throw "unreachable";
    }
    return this.overlay.show({ top: kn, left: Kn, right: er, bottom: Cr }), $n;
  }
  /**
   * Create a new tab bar for use by the panel.
   */
  _createTabBar() {
    let Qt = this._renderer.createTabBar(this._document);
    return Private$5$1.isGeneratedTabBarProperty.set(Qt, !0), this._mode === "single-document" && Qt.hide(), Qt.tabsMovable = this._tabsMovable, Qt.allowDeselect = !1, Qt.addButtonEnabled = this._addButtonEnabled, Qt.removeBehavior = "select-previous-tab", Qt.insertBehavior = "select-tab-if-needed", Qt.tabMoved.connect(this._onTabMoved, this), Qt.currentChanged.connect(this._onCurrentChanged, this), Qt.tabCloseRequested.connect(this._onTabCloseRequested, this), Qt.tabDetachRequested.connect(this._onTabDetachRequested, this), Qt.tabActivateRequested.connect(this._onTabActivateRequested, this), Qt.addRequested.connect(this._onTabAddRequested, this), Qt;
  }
  /**
   * Create a new handle for use by the panel.
   */
  _createHandle() {
    return this._renderer.createHandle();
  }
  /**
   * Handle the `tabMoved` signal from a tab bar.
   */
  _onTabMoved() {
    MessageLoop.postMessage(this, Private$5$1.LayoutModified);
  }
  /**
   * Handle the `currentChanged` signal from a tab bar.
   */
  _onCurrentChanged(Qt, Zt) {
    let { previousTitle: $n, currentTitle: Sn } = Zt;
    $n && $n.owner.hide(), Sn && Sn.owner.show(), (Platform.IS_EDGE || Platform.IS_IE) && MessageLoop.flush(), MessageLoop.postMessage(this, Private$5$1.LayoutModified);
  }
  /**
   * Handle the `addRequested` signal from a tab bar.
   */
  _onTabAddRequested(Qt) {
    this._addRequested.emit(Qt);
  }
  /**
   * Handle the `tabActivateRequested` signal from a tab bar.
   */
  _onTabActivateRequested(Qt, Zt) {
    Zt.title.owner.activate();
  }
  /**
   * Handle the `tabCloseRequested` signal from a tab bar.
   */
  _onTabCloseRequested(Qt, Zt) {
    Zt.title.owner.close();
  }
  /**
   * Handle the `tabDetachRequested` signal from a tab bar.
   */
  _onTabDetachRequested(Qt, Zt) {
    if (this._drag)
      return;
    Qt.releaseMouse();
    let { title: $n, tab: Sn, clientX: kn, clientY: Kn, offset: er } = Zt, Cr = new MimeData(), kr = () => $n.owner;
    Cr.setData("application/vnd.lumino.widget-factory", kr);
    let Yr = Sn.cloneNode(!0);
    er && (Yr.style.top = `-${er.y}px`, Yr.style.left = `-${er.x}px`), this._drag = new Drag({
      document: this._document,
      mimeData: Cr,
      dragImage: Yr,
      proposedAction: "move",
      supportedActions: "move",
      source: this
    }), Sn.classList.add("lm-mod-hidden");
    let Ms = () => {
      this._drag = null, Sn.classList.remove("lm-mod-hidden");
    };
    this._drag.start(kn, Kn).then(Ms);
  }
}
(function(_e) {
  class Qt {
    /**
     * Construct a new overlay.
     */
    constructor() {
      this._timer = -1, this._hidden = !0, this.node = document.createElement("div"), this.node.classList.add("lm-DockPanel-overlay"), this.node.classList.add("lm-mod-hidden"), this.node.style.position = "absolute", this.node.style.contain = "strict";
    }
    /**
     * Show the overlay using the given overlay geometry.
     *
     * @param geo - The desired geometry for the overlay.
     */
    show(Sn) {
      let kn = this.node.style;
      kn.top = `${Sn.top}px`, kn.left = `${Sn.left}px`, kn.right = `${Sn.right}px`, kn.bottom = `${Sn.bottom}px`, clearTimeout(this._timer), this._timer = -1, this._hidden && (this._hidden = !1, this.node.classList.remove("lm-mod-hidden"));
    }
    /**
     * Hide the overlay node.
     *
     * @param delay - The delay (in ms) before hiding the overlay.
     *   A delay value <= 0 will hide the overlay immediately.
     */
    hide(Sn) {
      if (!this._hidden) {
        if (Sn <= 0) {
          clearTimeout(this._timer), this._timer = -1, this._hidden = !0, this.node.classList.add("lm-mod-hidden");
          return;
        }
        this._timer === -1 && (this._timer = window.setTimeout(() => {
          this._timer = -1, this._hidden = !0, this.node.classList.add("lm-mod-hidden");
        }, Sn));
      }
    }
  }
  _e.Overlay = Qt;
  class Zt {
    /**
     * Create a new tab bar for use with a dock panel.
     *
     * @returns A new tab bar for a dock panel.
     */
    createTabBar(Sn) {
      let kn = new TabBar({ document: Sn });
      return kn.addClass("lm-DockPanel-tabBar"), kn;
    }
    /**
     * Create a new handle node for use with a dock panel.
     *
     * @returns A new handle node for a dock panel.
     */
    createHandle() {
      let Sn = document.createElement("div");
      return Sn.className = "lm-DockPanel-handle", Sn;
    }
  }
  _e.Renderer = Zt, _e.defaultRenderer = new Zt();
})(DockPanel || (DockPanel = {}));
var Private$5$1;
(function(_e) {
  _e.GOLDEN_RATIO = 0.618, _e.DEFAULT_EDGES = {
    /**
     * The size of the top edge dock zone for the root panel, in pixels.
     * This is different from the others to distinguish between the top
     * tab bar and the top root zone.
     */
    top: 12,
    /**
     * The size of the edge dock zone for the root panel, in pixels.
     */
    right: 40,
    /**
     * The size of the edge dock zone for the root panel, in pixels.
     */
    bottom: 40,
    /**
     * The size of the edge dock zone for the root panel, in pixels.
     */
    left: 40
  }, _e.LayoutModified = new ConflatableMessage("layout-modified"), _e.isGeneratedTabBarProperty = new AttachedProperty({
    name: "isGeneratedTabBar",
    create: () => !1
  });
  function Qt(Sn) {
    if (Sn.isEmpty)
      return { main: null };
    let kn = Array.from(Sn.widgets()), Kn = Sn.selectedWidgets().next().value, er = Kn ? kn.indexOf(Kn) : -1;
    return { main: { type: "tab-area", widgets: kn, currentIndex: er } };
  }
  _e.createSingleDocumentConfig = Qt;
  function Zt(Sn, kn, Kn, er) {
    if (!ElementExt.hitTest(Sn.node, kn, Kn))
      return { zone: "invalid", target: null };
    let Cr = Sn.layout;
    if (Cr.isEmpty)
      return { zone: "root-all", target: null };
    if (Sn.mode === "multiple-document") {
      let Ws = Sn.node.getBoundingClientRect(), Ys = kn - Ws.left + 1, El = Kn - Ws.top + 1, Mu = Ws.right - kn, Pl = Ws.bottom - Kn;
      switch (Math.min(El, Mu, Pl, Ys)) {
        case El:
          if (El < er.top)
            return { zone: "root-top", target: null };
          break;
        case Mu:
          if (Mu < er.right)
            return { zone: "root-right", target: null };
          break;
        case Pl:
          if (Pl < er.bottom)
            return { zone: "root-bottom", target: null };
          break;
        case Ys:
          if (Ys < er.left)
            return { zone: "root-left", target: null };
          break;
        default:
          throw "unreachable";
      }
    }
    let kr = Cr.hitTestTabAreas(kn, Kn);
    if (!kr)
      return { zone: "invalid", target: null };
    if (Sn.mode === "single-document")
      return { zone: "widget-all", target: kr };
    let Yr = kr.x - kr.left + 1, Ms = kr.y - kr.top + 1, Ds = kr.left + kr.width - kr.x, Ls = kr.top + kr.height - kr.y;
    const js = kr.tabBar.node.getBoundingClientRect().height;
    if (Ms < js)
      return { zone: "widget-tab", target: kr };
    let zs = Math.round(kr.width / 3), Fs = Math.round(kr.height / 3);
    if (Yr > zs && Ds > zs && Ms > Fs && Ls > Fs)
      return { zone: "widget-all", target: kr };
    Yr /= zs, Ms /= Fs, Ds /= zs, Ls /= Fs;
    let Bs = Math.min(Yr, Ms, Ds, Ls), Hs;
    switch (Bs) {
      case Yr:
        Hs = "widget-left";
        break;
      case Ms:
        Hs = "widget-top";
        break;
      case Ds:
        Hs = "widget-right";
        break;
      case Ls:
        Hs = "widget-bottom";
        break;
      default:
        throw "unreachable";
    }
    return { zone: Hs, target: kr };
  }
  _e.findDropTarget = Zt;
  function $n(Sn) {
    return Sn.titles.length === 0 ? null : Sn.currentTitle ? Sn.currentTitle.owner : Sn.titles[Sn.titles.length - 1].owner;
  }
  _e.getDropRef = $n;
})(Private$5$1 || (Private$5$1 = {}));
class FocusTracker {
  constructor() {
    this._counter = 0, this._widgets = [], this._activeWidget = null, this._currentWidget = null, this._numbers = /* @__PURE__ */ new Map(), this._nodes = /* @__PURE__ */ new Map(), this._activeChanged = new Signal(this), this._currentChanged = new Signal(this);
  }
  /**
   * Dispose of the resources held by the tracker.
   */
  dispose() {
    if (!(this._counter < 0)) {
      this._counter = -1, Signal.clearData(this);
      for (const Qt of this._widgets)
        Qt.node.removeEventListener("focus", this, !0), Qt.node.removeEventListener("blur", this, !0);
      this._activeWidget = null, this._currentWidget = null, this._nodes.clear(), this._numbers.clear(), this._widgets.length = 0;
    }
  }
  /**
   * A signal emitted when the current widget has changed.
   */
  get currentChanged() {
    return this._currentChanged;
  }
  /**
   * A signal emitted when the active widget has changed.
   */
  get activeChanged() {
    return this._activeChanged;
  }
  /**
   * A flag indicating whether the tracker is disposed.
   */
  get isDisposed() {
    return this._counter < 0;
  }
  /**
   * The current widget in the tracker.
   *
   * #### Notes
   * The current widget is the widget among the tracked widgets which
   * has the *descendant node* which has most recently been focused.
   *
   * The current widget will not be updated if the node loses focus. It
   * will only be updated when a different tracked widget gains focus.
   *
   * If the current widget is removed from the tracker, the previous
   * current widget will be restored.
   *
   * This behavior is intended to follow a user's conceptual model of
   * a semantically "current" widget, where the "last thing of type X"
   * to be interacted with is the "current instance of X", regardless
   * of whether that instance still has focus.
   */
  get currentWidget() {
    return this._currentWidget;
  }
  /**
   * The active widget in the tracker.
   *
   * #### Notes
   * The active widget is the widget among the tracked widgets which
   * has the *descendant node* which is currently focused.
   */
  get activeWidget() {
    return this._activeWidget;
  }
  /**
   * A read only array of the widgets being tracked.
   */
  get widgets() {
    return this._widgets;
  }
  /**
   * Get the focus number for a particular widget in the tracker.
   *
   * @param widget - The widget of interest.
   *
   * @returns The focus number for the given widget, or `-1` if the
   *   widget has not had focus since being added to the tracker, or
   *   is not contained by the tracker.
   *
   * #### Notes
   * The focus number indicates the relative order in which the widgets
   * have gained focus. A widget with a larger number has gained focus
   * more recently than a widget with a smaller number.
   *
   * The `currentWidget` will always have the largest focus number.
   *
   * All widgets start with a focus number of `-1`, which indicates that
   * the widget has not been focused since being added to the tracker.
   */
  focusNumber(Qt) {
    let Zt = this._numbers.get(Qt);
    return Zt === void 0 ? -1 : Zt;
  }
  /**
   * Test whether the focus tracker contains a given widget.
   *
   * @param widget - The widget of interest.
   *
   * @returns `true` if the widget is tracked, `false` otherwise.
   */
  has(Qt) {
    return this._numbers.has(Qt);
  }
  /**
   * Add a widget to the focus tracker.
   *
   * @param widget - The widget of interest.
   *
   * #### Notes
   * A widget will be automatically removed from the tracker if it
   * is disposed after being added.
   *
   * If the widget is already tracked, this is a no-op.
   */
  add(Qt) {
    if (this._numbers.has(Qt))
      return;
    let Zt = Qt.node.contains(document.activeElement), $n = Zt ? this._counter++ : -1;
    this._widgets.push(Qt), this._numbers.set(Qt, $n), this._nodes.set(Qt.node, Qt), Qt.node.addEventListener("focus", this, !0), Qt.node.addEventListener("blur", this, !0), Qt.disposed.connect(this._onWidgetDisposed, this), Zt && this._setWidgets(Qt, Qt);
  }
  /**
   * Remove a widget from the focus tracker.
   *
   * #### Notes
   * If the widget is the `currentWidget`, the previous current widget
   * will become the new `currentWidget`.
   *
   * A widget will be automatically removed from the tracker if it
   * is disposed after being added.
   *
   * If the widget is not tracked, this is a no-op.
   */
  remove(Qt) {
    if (!this._numbers.has(Qt) || (Qt.disposed.disconnect(this._onWidgetDisposed, this), Qt.node.removeEventListener("focus", this, !0), Qt.node.removeEventListener("blur", this, !0), ArrayExt.removeFirstOf(this._widgets, Qt), this._nodes.delete(Qt.node), this._numbers.delete(Qt), this._currentWidget !== Qt))
      return;
    let Zt = this._widgets.filter((Sn) => this._numbers.get(Sn) !== -1), $n = max$5(Zt, (Sn, kn) => {
      let Kn = this._numbers.get(Sn), er = this._numbers.get(kn);
      return Kn - er;
    }) || null;
    this._setWidgets($n, null);
  }
  /**
   * Handle the DOM events for the focus tracker.
   *
   * @param event - The DOM event sent to the panel.
   *
   * #### Notes
   * This method implements the DOM `EventListener` interface and is
   * called in response to events on the tracked nodes. It should
   * not be called directly by user code.
   */
  handleEvent(Qt) {
    switch (Qt.type) {
      case "focus":
        this._evtFocus(Qt);
        break;
      case "blur":
        this._evtBlur(Qt);
        break;
    }
  }
  /**
   * Set the current and active widgets for the tracker.
   */
  _setWidgets(Qt, Zt) {
    let $n = this._currentWidget;
    this._currentWidget = Qt;
    let Sn = this._activeWidget;
    this._activeWidget = Zt, $n !== Qt && this._currentChanged.emit({ oldValue: $n, newValue: Qt }), Sn !== Zt && this._activeChanged.emit({ oldValue: Sn, newValue: Zt });
  }
  /**
   * Handle the `'focus'` event for a tracked widget.
   */
  _evtFocus(Qt) {
    let Zt = this._nodes.get(Qt.currentTarget);
    Zt !== this._currentWidget && this._numbers.set(Zt, this._counter++), this._setWidgets(Zt, Zt);
  }
  /**
   * Handle the `'blur'` event for a tracked widget.
   */
  _evtBlur(Qt) {
    let Zt = this._nodes.get(Qt.currentTarget), $n = Qt.relatedTarget;
    if (!$n) {
      this._setWidgets(this._currentWidget, null);
      return;
    }
    if (!Zt.node.contains($n) && !find$5(this._widgets, (Sn) => Sn.node.contains($n))) {
      this._setWidgets(this._currentWidget, null);
      return;
    }
  }
  /**
   * Handle the `disposed` signal for a tracked widget.
   */
  _onWidgetDisposed(Qt) {
    this.remove(Qt);
  }
}
class GridLayout extends Layout {
  /**
   * Construct a new grid layout.
   *
   * @param options - The options for initializing the layout.
   */
  constructor(Qt = {}) {
    super(Qt), this._dirty = !1, this._rowSpacing = 4, this._columnSpacing = 4, this._items = [], this._rowStarts = [], this._columnStarts = [], this._rowSizers = [new BoxSizer()], this._columnSizers = [new BoxSizer()], this._box = null, Qt.rowCount !== void 0 && Private$4$1.reallocSizers(this._rowSizers, Qt.rowCount), Qt.columnCount !== void 0 && Private$4$1.reallocSizers(this._columnSizers, Qt.columnCount), Qt.rowSpacing !== void 0 && (this._rowSpacing = Private$4$1.clampValue(Qt.rowSpacing)), Qt.columnSpacing !== void 0 && (this._columnSpacing = Private$4$1.clampValue(Qt.columnSpacing));
  }
  /**
   * Dispose of the resources held by the layout.
   */
  dispose() {
    for (const Qt of this._items) {
      let Zt = Qt.widget;
      Qt.dispose(), Zt.dispose();
    }
    this._box = null, this._items.length = 0, this._rowStarts.length = 0, this._rowSizers.length = 0, this._columnStarts.length = 0, this._columnSizers.length = 0, super.dispose();
  }
  /**
   * Get the number of rows in the layout.
   */
  get rowCount() {
    return this._rowSizers.length;
  }
  /**
   * Set the number of rows in the layout.
   *
   * #### Notes
   * The minimum row count is `1`.
   */
  set rowCount(Qt) {
    Qt !== this.rowCount && (Private$4$1.reallocSizers(this._rowSizers, Qt), this.parent && this.parent.fit());
  }
  /**
   * Get the number of columns in the layout.
   */
  get columnCount() {
    return this._columnSizers.length;
  }
  /**
   * Set the number of columns in the layout.
   *
   * #### Notes
   * The minimum column count is `1`.
   */
  set columnCount(Qt) {
    Qt !== this.columnCount && (Private$4$1.reallocSizers(this._columnSizers, Qt), this.parent && this.parent.fit());
  }
  /**
   * Get the row spacing for the layout.
   */
  get rowSpacing() {
    return this._rowSpacing;
  }
  /**
   * Set the row spacing for the layout.
   */
  set rowSpacing(Qt) {
    Qt = Private$4$1.clampValue(Qt), this._rowSpacing !== Qt && (this._rowSpacing = Qt, this.parent && this.parent.fit());
  }
  /**
   * Get the column spacing for the layout.
   */
  get columnSpacing() {
    return this._columnSpacing;
  }
  /**
   * Set the col spacing for the layout.
   */
  set columnSpacing(Qt) {
    Qt = Private$4$1.clampValue(Qt), this._columnSpacing !== Qt && (this._columnSpacing = Qt, this.parent && this.parent.fit());
  }
  /**
   * Get the stretch factor for a specific row.
   *
   * @param index - The row index of interest.
   *
   * @returns The stretch factor for the row.
   *
   * #### Notes
   * This returns `-1` if the index is out of range.
   */
  rowStretch(Qt) {
    let Zt = this._rowSizers[Qt];
    return Zt ? Zt.stretch : -1;
  }
  /**
   * Set the stretch factor for a specific row.
   *
   * @param index - The row index of interest.
   *
   * @param value - The stretch factor for the row.
   *
   * #### Notes
   * This is a no-op if the index is out of range.
   */
  setRowStretch(Qt, Zt) {
    let $n = this._rowSizers[Qt];
    $n && (Zt = Private$4$1.clampValue(Zt), $n.stretch !== Zt && ($n.stretch = Zt, this.parent && this.parent.update()));
  }
  /**
   * Get the stretch factor for a specific column.
   *
   * @param index - The column index of interest.
   *
   * @returns The stretch factor for the column.
   *
   * #### Notes
   * This returns `-1` if the index is out of range.
   */
  columnStretch(Qt) {
    let Zt = this._columnSizers[Qt];
    return Zt ? Zt.stretch : -1;
  }
  /**
   * Set the stretch factor for a specific column.
   *
   * @param index - The column index of interest.
   *
   * @param value - The stretch factor for the column.
   *
   * #### Notes
   * This is a no-op if the index is out of range.
   */
  setColumnStretch(Qt, Zt) {
    let $n = this._columnSizers[Qt];
    $n && (Zt = Private$4$1.clampValue(Zt), $n.stretch !== Zt && ($n.stretch = Zt, this.parent && this.parent.update()));
  }
  /**
   * Create an iterator over the widgets in the layout.
   *
   * @returns A new iterator over the widgets in the layout.
   */
  *[Symbol.iterator]() {
    for (const Qt of this._items)
      yield Qt.widget;
  }
  /**
   * Add a widget to the grid layout.
   *
   * @param widget - The widget to add to the layout.
   *
   * #### Notes
   * If the widget is already contained in the layout, this is no-op.
   */
  addWidget(Qt) {
    ArrayExt.findFirstIndex(this._items, ($n) => $n.widget === Qt) === -1 && (this._items.push(new LayoutItem(Qt)), this.parent && this.attachWidget(Qt));
  }
  /**
   * Remove a widget from the grid layout.
   *
   * @param widget - The widget to remove from the layout.
   *
   * #### Notes
   * A widget is automatically removed from the layout when its `parent`
   * is set to `null`. This method should only be invoked directly when
   * removing a widget from a layout which has yet to be installed on a
   * parent widget.
   *
   * This method does *not* modify the widget's `parent`.
   */
  removeWidget(Qt) {
    let Zt = ArrayExt.findFirstIndex(this._items, (Sn) => Sn.widget === Qt);
    if (Zt === -1)
      return;
    let $n = ArrayExt.removeAt(this._items, Zt);
    this.parent && this.detachWidget(Qt), $n.dispose();
  }
  /**
   * Perform layout initialization which requires the parent widget.
   */
  init() {
    super.init();
    for (const Qt of this)
      this.attachWidget(Qt);
  }
  /**
   * Attach a widget to the parent's DOM node.
   *
   * @param widget - The widget to attach to the parent.
   */
  attachWidget(Qt) {
    this.parent.isAttached && MessageLoop.sendMessage(Qt, Widget.Msg.BeforeAttach), this.parent.node.appendChild(Qt.node), this.parent.isAttached && MessageLoop.sendMessage(Qt, Widget.Msg.AfterAttach), this.parent.fit();
  }
  /**
   * Detach a widget from the parent's DOM node.
   *
   * @param widget - The widget to detach from the parent.
   */
  detachWidget(Qt) {
    this.parent.isAttached && MessageLoop.sendMessage(Qt, Widget.Msg.BeforeDetach), this.parent.node.removeChild(Qt.node), this.parent.isAttached && MessageLoop.sendMessage(Qt, Widget.Msg.AfterDetach), this.parent.fit();
  }
  /**
   * A message handler invoked on a `'before-show'` message.
   */
  onBeforeShow(Qt) {
    super.onBeforeShow(Qt), this.parent.update();
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   */
  onBeforeAttach(Qt) {
    super.onBeforeAttach(Qt), this.parent.fit();
  }
  /**
   * A message handler invoked on a `'child-shown'` message.
   */
  onChildShown(Qt) {
    this.parent.fit();
  }
  /**
   * A message handler invoked on a `'child-hidden'` message.
   */
  onChildHidden(Qt) {
    this.parent.fit();
  }
  /**
   * A message handler invoked on a `'resize'` message.
   */
  onResize(Qt) {
    this.parent.isVisible && this._update(Qt.width, Qt.height);
  }
  /**
   * A message handler invoked on an `'update-request'` message.
   */
  onUpdateRequest(Qt) {
    this.parent.isVisible && this._update(-1, -1);
  }
  /**
   * A message handler invoked on a `'fit-request'` message.
   */
  onFitRequest(Qt) {
    this.parent.isAttached && this._fit();
  }
  /**
   * Fit the layout to the total size required by the widgets.
   */
  _fit() {
    for (let Cr = 0, kr = this.rowCount; Cr < kr; ++Cr)
      this._rowSizers[Cr].minSize = 0;
    for (let Cr = 0, kr = this.columnCount; Cr < kr; ++Cr)
      this._columnSizers[Cr].minSize = 0;
    let Qt = this._items.filter((Cr) => !Cr.isHidden);
    for (let Cr = 0, kr = Qt.length; Cr < kr; ++Cr)
      Qt[Cr].fit();
    let Zt = this.rowCount - 1, $n = this.columnCount - 1;
    Qt.sort(Private$4$1.rowSpanCmp);
    for (let Cr = 0, kr = Qt.length; Cr < kr; ++Cr) {
      let Yr = Qt[Cr], Ms = GridLayout.getCellConfig(Yr.widget), Ds = Math.min(Ms.row, Zt), Ls = Math.min(Ms.row + Ms.rowSpan - 1, Zt);
      Private$4$1.distributeMin(this._rowSizers, Ds, Ls, Yr.minHeight);
    }
    Qt.sort(Private$4$1.columnSpanCmp);
    for (let Cr = 0, kr = Qt.length; Cr < kr; ++Cr) {
      let Yr = Qt[Cr], Ms = GridLayout.getCellConfig(Yr.widget), Ds = Math.min(Ms.column, $n), Ls = Math.min(Ms.column + Ms.columnSpan - 1, $n);
      Private$4$1.distributeMin(this._columnSizers, Ds, Ls, Yr.minWidth);
    }
    if (this.fitPolicy === "set-no-constraint") {
      MessageLoop.sendMessage(this.parent, Widget.Msg.UpdateRequest);
      return;
    }
    let Sn = Zt * this._rowSpacing, kn = $n * this._columnSpacing;
    for (let Cr = 0, kr = this.rowCount; Cr < kr; ++Cr)
      Sn += this._rowSizers[Cr].minSize;
    for (let Cr = 0, kr = this.columnCount; Cr < kr; ++Cr)
      kn += this._columnSizers[Cr].minSize;
    let Kn = this._box = ElementExt.boxSizing(this.parent.node);
    kn += Kn.horizontalSum, Sn += Kn.verticalSum;
    let er = this.parent.node.style;
    er.minWidth = `${kn}px`, er.minHeight = `${Sn}px`, this._dirty = !0, this.parent.parent && MessageLoop.sendMessage(this.parent.parent, Widget.Msg.FitRequest), this._dirty && MessageLoop.sendMessage(this.parent, Widget.Msg.UpdateRequest);
  }
  /**
   * Update the layout position and size of the widgets.
   *
   * The parent offset dimensions should be `-1` if unknown.
   */
  _update(Qt, Zt) {
    this._dirty = !1, Qt < 0 && (Qt = this.parent.node.offsetWidth), Zt < 0 && (Zt = this.parent.node.offsetHeight), this._box || (this._box = ElementExt.boxSizing(this.parent.node));
    let $n = this._box.paddingTop, Sn = this._box.paddingLeft, kn = Qt - this._box.horizontalSum, Kn = Zt - this._box.verticalSum, er = this.rowCount - 1, Cr = this.columnCount - 1, kr = er * this._rowSpacing, Yr = Cr * this._columnSpacing;
    BoxEngine.calc(this._rowSizers, Math.max(0, Kn - kr)), BoxEngine.calc(this._columnSizers, Math.max(0, kn - Yr));
    for (let Ms = 0, Ds = $n, Ls = this.rowCount; Ms < Ls; ++Ms)
      this._rowStarts[Ms] = Ds, Ds += this._rowSizers[Ms].size + this._rowSpacing;
    for (let Ms = 0, Ds = Sn, Ls = this.columnCount; Ms < Ls; ++Ms)
      this._columnStarts[Ms] = Ds, Ds += this._columnSizers[Ms].size + this._columnSpacing;
    for (let Ms = 0, Ds = this._items.length; Ms < Ds; ++Ms) {
      let Ls = this._items[Ms];
      if (Ls.isHidden)
        continue;
      let js = GridLayout.getCellConfig(Ls.widget), zs = Math.min(js.row, er), Fs = Math.min(js.column, Cr), Bs = Math.min(js.row + js.rowSpan - 1, er), Hs = Math.min(js.column + js.columnSpan - 1, Cr), Ws = this._columnStarts[Fs], Ys = this._rowStarts[zs], El = this._columnStarts[Hs] + this._columnSizers[Hs].size - Ws, Mu = this._rowStarts[Bs] + this._rowSizers[Bs].size - Ys;
      Ls.update(Ws, Ys, El, Mu);
    }
  }
}
(function(_e) {
  function Qt($n) {
    return Private$4$1.cellConfigProperty.get($n);
  }
  _e.getCellConfig = Qt;
  function Zt($n, Sn) {
    Private$4$1.cellConfigProperty.set($n, Private$4$1.normalizeConfig(Sn));
  }
  _e.setCellConfig = Zt;
})(GridLayout || (GridLayout = {}));
var Private$4$1;
(function(_e) {
  _e.cellConfigProperty = new AttachedProperty({
    name: "cellConfig",
    create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),
    changed: er
  });
  function Qt(Cr) {
    let kr = Math.max(0, Math.floor(Cr.row || 0)), Yr = Math.max(0, Math.floor(Cr.column || 0)), Ms = Math.max(1, Math.floor(Cr.rowSpan || 0)), Ds = Math.max(1, Math.floor(Cr.columnSpan || 0));
    return { row: kr, column: Yr, rowSpan: Ms, columnSpan: Ds };
  }
  _e.normalizeConfig = Qt;
  function Zt(Cr) {
    return Math.max(0, Math.floor(Cr));
  }
  _e.clampValue = Zt;
  function $n(Cr, kr) {
    let Yr = _e.cellConfigProperty.get(Cr.widget), Ms = _e.cellConfigProperty.get(kr.widget);
    return Yr.rowSpan - Ms.rowSpan;
  }
  _e.rowSpanCmp = $n;
  function Sn(Cr, kr) {
    let Yr = _e.cellConfigProperty.get(Cr.widget), Ms = _e.cellConfigProperty.get(kr.widget);
    return Yr.columnSpan - Ms.columnSpan;
  }
  _e.columnSpanCmp = Sn;
  function kn(Cr, kr) {
    for (kr = Math.max(1, Math.floor(kr)); Cr.length < kr; )
      Cr.push(new BoxSizer());
    Cr.length > kr && (Cr.length = kr);
  }
  _e.reallocSizers = kn;
  function Kn(Cr, kr, Yr, Ms) {
    if (Yr < kr)
      return;
    if (kr === Yr) {
      let js = Cr[kr];
      js.minSize = Math.max(js.minSize, Ms);
      return;
    }
    let Ds = 0;
    for (let js = kr; js <= Yr; ++js)
      Ds += Cr[js].minSize;
    if (Ds >= Ms)
      return;
    let Ls = (Ms - Ds) / (Yr - kr + 1);
    for (let js = kr; js <= Yr; ++js)
      Cr[js].minSize += Ls;
  }
  _e.distributeMin = Kn;
  function er(Cr) {
    Cr.parent && Cr.parent.layout instanceof GridLayout && Cr.parent.fit();
  }
})(Private$4$1 || (Private$4$1 = {}));
class MenuBar extends Widget {
  /**
   * Construct a new menu bar.
   *
   * @param options - The options for initializing the menu bar.
   */
  constructor(Qt = {}) {
    super({ node: Private$3$1.createNode() }), this._activeIndex = -1, this._tabFocusIndex = 0, this._menus = [], this._childMenu = null, this._overflowMenu = null, this._menuItemSizes = [], this._overflowIndex = -1, this.addClass("lm-MenuBar"), this.setFlag(Widget.Flag.DisallowLayout), this.renderer = Qt.renderer || MenuBar.defaultRenderer, this._forceItemsPosition = Qt.forceItemsPosition || {
      forceX: !0,
      forceY: !0
    }, this._overflowMenuOptions = Qt.overflowMenuOptions || {
      isVisible: !0
    };
  }
  /**
   * Dispose of the resources held by the widget.
   */
  dispose() {
    this._closeChildMenu(), this._menus.length = 0, super.dispose();
  }
  /**
   * The child menu of the menu bar.
   *
   * #### Notes
   * This will be `null` if the menu bar does not have an open menu.
   */
  get childMenu() {
    return this._childMenu;
  }
  /**
   * The overflow index of the menu bar.
   */
  get overflowIndex() {
    return this._overflowIndex;
  }
  /**
   * The overflow menu of the menu bar.
   */
  get overflowMenu() {
    return this._overflowMenu;
  }
  /**
   * Get the menu bar content node.
   *
   * #### Notes
   * This is the node which holds the menu title nodes.
   *
   * Modifying this node directly can lead to undefined behavior.
   */
  get contentNode() {
    return this.node.getElementsByClassName("lm-MenuBar-content")[0];
  }
  /**
   * Get the currently active menu.
   */
  get activeMenu() {
    return this._menus[this._activeIndex] || null;
  }
  /**
   * Set the currently active menu.
   *
   * #### Notes
   * If the menu does not exist, the menu will be set to `null`.
   */
  set activeMenu(Qt) {
    this.activeIndex = Qt ? this._menus.indexOf(Qt) : -1;
  }
  /**
   * Get the index of the currently active menu.
   *
   * #### Notes
   * This will be `-1` if no menu is active.
   */
  get activeIndex() {
    return this._activeIndex;
  }
  /**
   * Set the index of the currently active menu.
   *
   * #### Notes
   * If the menu cannot be activated, the index will be set to `-1`.
   */
  set activeIndex(Qt) {
    (Qt < 0 || Qt >= this._menus.length) && (Qt = -1), this._activeIndex !== Qt && (this._activeIndex = Qt, Qt !== -1 && (this._tabFocusIndex = Qt), this._activeIndex >= 0 && this.contentNode.childNodes[this._activeIndex] && this.contentNode.childNodes[this._activeIndex].focus(), this.update());
  }
  /**
   * A read-only array of the menus in the menu bar.
   */
  get menus() {
    return this._menus;
  }
  /**
   * Open the active menu and activate its first menu item.
   *
   * #### Notes
   * If there is no active menu, this is a no-op.
   */
  openActiveMenu() {
    this._activeIndex !== -1 && (this._openChildMenu(), this._childMenu && (this._childMenu.activeIndex = -1, this._childMenu.activateNextItem()));
  }
  /**
   * Add a menu to the end of the menu bar.
   *
   * @param menu - The menu to add to the menu bar.
   *
   * #### Notes
   * If the menu is already added to the menu bar, it will be moved.
   */
  addMenu(Qt, Zt = !0) {
    this.insertMenu(this._menus.length, Qt, Zt);
  }
  /**
   * Insert a menu into the menu bar at the specified index.
   *
   * @param index - The index at which to insert the menu.
   *
   * @param menu - The menu to insert into the menu bar.
   *
   * #### Notes
   * The index will be clamped to the bounds of the menus.
   *
   * If the menu is already added to the menu bar, it will be moved.
   */
  insertMenu(Qt, Zt, $n = !0) {
    this._closeChildMenu();
    let Sn = this._menus.indexOf(Zt), kn = Math.max(0, Math.min(Qt, this._menus.length));
    if (Sn === -1) {
      ArrayExt.insert(this._menus, kn, Zt), Zt.addClass("lm-MenuBar-menu"), Zt.aboutToClose.connect(this._onMenuAboutToClose, this), Zt.menuRequested.connect(this._onMenuMenuRequested, this), Zt.title.changed.connect(this._onTitleChanged, this), $n && this.update();
      return;
    }
    kn === this._menus.length && kn--, Sn !== kn && (ArrayExt.move(this._menus, Sn, kn), $n && this.update());
  }
  /**
   * Remove a menu from the menu bar.
   *
   * @param menu - The menu to remove from the menu bar.
   *
   * #### Notes
   * This is a no-op if the menu is not in the menu bar.
   */
  removeMenu(Qt, Zt = !0) {
    this.removeMenuAt(this._menus.indexOf(Qt), Zt);
  }
  /**
   * Remove the menu at a given index from the menu bar.
   *
   * @param index - The index of the menu to remove.
   *
   * #### Notes
   * This is a no-op if the index is out of range.
   */
  removeMenuAt(Qt, Zt = !0) {
    this._closeChildMenu();
    let $n = ArrayExt.removeAt(this._menus, Qt);
    $n && ($n.aboutToClose.disconnect(this._onMenuAboutToClose, this), $n.menuRequested.disconnect(this._onMenuMenuRequested, this), $n.title.changed.disconnect(this._onTitleChanged, this), $n.removeClass("lm-MenuBar-menu"), Zt && this.update());
  }
  /**
   * Remove all menus from the menu bar.
   */
  clearMenus() {
    if (this._menus.length !== 0) {
      this._closeChildMenu();
      for (let Qt of this._menus)
        Qt.aboutToClose.disconnect(this._onMenuAboutToClose, this), Qt.menuRequested.disconnect(this._onMenuMenuRequested, this), Qt.title.changed.disconnect(this._onTitleChanged, this), Qt.removeClass("lm-MenuBar-menu");
      this._menus.length = 0, this.update();
    }
  }
  /**
   * Handle the DOM events for the menu bar.
   *
   * @param event - The DOM event sent to the menu bar.
   *
   * #### Notes
   * This method implements the DOM `EventListener` interface and is
   * called in response to events on the menu bar's DOM nodes. It
   * should not be called directly by user code.
   */
  handleEvent(Qt) {
    switch (Qt.type) {
      case "keydown":
        this._evtKeyDown(Qt);
        break;
      case "mousedown":
        this._evtMouseDown(Qt);
        break;
      case "mousemove":
        this._evtMouseMove(Qt);
        break;
      case "mouseleave":
        this._evtMouseLeave(Qt);
        break;
      case "contextmenu":
        Qt.preventDefault(), Qt.stopPropagation();
        break;
    }
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   */
  onBeforeAttach(Qt) {
    this.node.addEventListener("keydown", this), this.node.addEventListener("mousedown", this), this.node.addEventListener("mousemove", this), this.node.addEventListener("mouseleave", this), this.node.addEventListener("contextmenu", this);
  }
  /**
   * A message handler invoked on an `'after-detach'` message.
   */
  onAfterDetach(Qt) {
    this.node.removeEventListener("keydown", this), this.node.removeEventListener("mousedown", this), this.node.removeEventListener("mousemove", this), this.node.removeEventListener("mouseleave", this), this.node.removeEventListener("contextmenu", this), this._closeChildMenu();
  }
  /**
   * A message handler invoked on an `'activate-request'` message.
   */
  onActivateRequest(Qt) {
    this.isAttached && (this.activeIndex = 0);
  }
  /**
   * A message handler invoked on a `'resize'` message.
   */
  onResize(Qt) {
    this.update(), super.onResize(Qt);
  }
  /**
   * A message handler invoked on an `'update-request'` message.
   */
  onUpdateRequest(Qt) {
    var Zt;
    let $n = this._menus, Sn = this.renderer, kn = this._activeIndex, Kn = this._tabFocusIndex >= 0 && this._tabFocusIndex < $n.length ? this._tabFocusIndex : 0, er = this._overflowIndex > -1 ? this._overflowIndex : $n.length, Cr = 0, kr = !1;
    er = this._overflowMenu !== null ? er - 1 : er;
    let Yr = new Array(er);
    for (let Ms = 0; Ms < er; ++Ms)
      Yr[Ms] = Sn.renderItem({
        title: $n[Ms].title,
        active: Ms === kn && $n[Ms].items.length !== 0,
        tabbable: Ms === Kn,
        onfocus: () => {
          this.activeIndex = Ms;
        }
      }), Cr += this._menuItemSizes[Ms], $n[Ms].title.label === this._overflowMenuOptions.title && (kr = !0, er--);
    if (this._overflowMenuOptions.isVisible) {
      if (this._overflowIndex > -1 && !kr) {
        if (this._overflowMenu === null) {
          const Ms = (Zt = this._overflowMenuOptions.title) !== null && Zt !== void 0 ? Zt : "...";
          this._overflowMenu = new Menu$1({ commands: new CommandRegistry() }), this._overflowMenu.title.label = Ms, this._overflowMenu.title.mnemonic = 0, this.addMenu(this._overflowMenu, !1);
        }
        for (let Ms = $n.length - 2; Ms >= er; Ms--) {
          const Ds = this.menus[Ms];
          Ds.title.mnemonic = 0, this._overflowMenu.insertItem(0, {
            type: "submenu",
            submenu: Ds
          }), this.removeMenu(Ds, !1);
        }
        Yr[er] = Sn.renderItem({
          title: this._overflowMenu.title,
          active: er === kn && $n[er].items.length !== 0,
          tabbable: er === Kn,
          onfocus: () => {
            this.activeIndex = er;
          }
        }), er++;
      } else if (this._overflowMenu !== null) {
        let Ms = this._overflowMenu.items, Ds = this.node.offsetWidth, Ls = this._overflowMenu.items.length;
        for (let js = 0; js < Ls; ++js) {
          let zs = $n.length - 1 - js;
          if (Ds - Cr > this._menuItemSizes[zs]) {
            let Fs = Ms[0].submenu;
            this._overflowMenu.removeItemAt(0), this.insertMenu(er, Fs, !1), Yr[er] = Sn.renderItem({
              title: Fs.title,
              active: !1,
              tabbable: er === Kn,
              onfocus: () => {
                this.activeIndex = er;
              }
            }), er++;
          }
        }
        this._overflowMenu.items.length === 0 && (this.removeMenu(this._overflowMenu, !1), Yr.pop(), this._overflowMenu = null, this._overflowIndex = -1);
      }
    }
    VirtualDOM.render(Yr, this.contentNode), this._updateOverflowIndex();
  }
  /**
   * Calculate and update the current overflow index.
   */
  _updateOverflowIndex() {
    if (!this._overflowMenuOptions.isVisible)
      return;
    const Qt = this.contentNode.childNodes;
    let Zt = this.node.offsetWidth, $n = 0, Sn = -1, kn = Qt.length;
    if (this._menuItemSizes.length == 0)
      for (let Kn = 0; Kn < kn; Kn++) {
        let er = Qt[Kn];
        $n += er.offsetWidth, this._menuItemSizes.push(er.offsetWidth), $n > Zt && Sn === -1 && (Sn = Kn);
      }
    else
      for (let Kn = 0; Kn < this._menuItemSizes.length; Kn++)
        if ($n += this._menuItemSizes[Kn], $n > Zt) {
          Sn = Kn;
          break;
        }
    this._overflowIndex = Sn;
  }
  /**
   * Handle the `'keydown'` event for the menu bar.
   *
   * #### Notes
   * All keys are trapped except the tab key that is ignored.
   */
  _evtKeyDown(Qt) {
    let Zt = Qt.keyCode;
    if (Zt === 9) {
      this.activeIndex = -1;
      return;
    }
    if (Qt.preventDefault(), Qt.stopPropagation(), Zt === 13 || Zt === 32 || Zt === 38 || Zt === 40) {
      this.openActiveMenu();
      return;
    }
    if (Zt === 27) {
      this._closeChildMenu(), this.activeIndex = -1, this.node.blur();
      return;
    }
    if (Zt === 37) {
      let Kn = this._activeIndex, er = this._menus.length;
      this.activeIndex = Kn === 0 ? er - 1 : Kn - 1;
      return;
    }
    if (Zt === 39) {
      let Kn = this._activeIndex, er = this._menus.length;
      this.activeIndex = Kn === er - 1 ? 0 : Kn + 1;
      return;
    }
    let $n = getKeyboardLayout().keyForKeydownEvent(Qt);
    if (!$n)
      return;
    let Sn = this._activeIndex + 1, kn = Private$3$1.findMnemonic(this._menus, $n, Sn);
    kn.index !== -1 && !kn.multiple ? (this.activeIndex = kn.index, this.openActiveMenu()) : kn.index !== -1 ? this.activeIndex = kn.index : kn.auto !== -1 && (this.activeIndex = kn.auto);
  }
  /**
   * Handle the `'mousedown'` event for the menu bar.
   */
  _evtMouseDown(Qt) {
    if (!ElementExt.hitTest(this.node, Qt.clientX, Qt.clientY))
      return;
    Qt.preventDefault(), Qt.stopPropagation(), Qt.stopImmediatePropagation();
    let Zt = ArrayExt.findFirstIndex(this.contentNode.children, ($n) => ElementExt.hitTest($n, Qt.clientX, Qt.clientY));
    if (Zt === -1) {
      this._closeChildMenu();
      return;
    }
    if (Qt.button === 0)
      if (this._childMenu)
        this._closeChildMenu(), this.activeIndex = Zt;
      else {
        const $n = this._positionForMenu(Zt);
        Menu$1.saveWindowData(), this.activeIndex = Zt, this._openChildMenu($n);
      }
  }
  /**
   * Handle the `'mousemove'` event for the menu bar.
   */
  _evtMouseMove(Qt) {
    let Zt = ArrayExt.findFirstIndex(this.contentNode.children, (Sn) => ElementExt.hitTest(Sn, Qt.clientX, Qt.clientY));
    if (Zt === this._activeIndex || Zt === -1 && this._childMenu)
      return;
    const $n = Zt >= 0 && this._childMenu ? this._positionForMenu(Zt) : null;
    Menu$1.saveWindowData(), this.activeIndex = Zt, $n && this._openChildMenu($n);
  }
  /**
   * Find initial position for the menu based on menubar item position.
   *
   * NOTE: this should be called before updating active index to avoid
   * an additional layout and style invalidation as changing active
   * index modifies DOM.
   */
  _positionForMenu(Qt) {
    let Zt = this.contentNode.children[Qt], { left: $n, bottom: Sn } = Zt.getBoundingClientRect();
    return {
      top: Sn,
      left: $n
    };
  }
  /**
   * Handle the `'mouseleave'` event for the menu bar.
   */
  _evtMouseLeave(Qt) {
    this._childMenu || (this.activeIndex = -1);
  }
  /**
   * Open the child menu at the active index immediately.
   *
   * If a different child menu is already open, it will be closed,
   * even if there is no active menu.
   */
  _openChildMenu(Qt = {}) {
    let Zt = this.activeMenu;
    if (!Zt) {
      this._closeChildMenu();
      return;
    }
    let $n = this._childMenu;
    if ($n === Zt)
      return;
    this._childMenu = Zt, $n ? $n.close() : document.addEventListener("mousedown", this, !0), MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);
    let { left: Sn, top: kn } = Qt;
    (typeof Sn > "u" || typeof kn > "u") && ({ left: Sn, top: kn } = this._positionForMenu(this._activeIndex)), $n || this.addClass("lm-mod-active"), Zt.items.length > 0 && Zt.open(Sn, kn, this._forceItemsPosition);
  }
  /**
   * Close the child menu immediately.
   *
   * This is a no-op if a child menu is not open.
   */
  _closeChildMenu() {
    if (!this._childMenu)
      return;
    this.removeClass("lm-mod-active"), document.removeEventListener("mousedown", this, !0);
    let Qt = this._childMenu;
    this._childMenu = null, Qt.close(), this.activeIndex = -1;
  }
  /**
   * Handle the `aboutToClose` signal of a menu.
   */
  _onMenuAboutToClose(Qt) {
    Qt === this._childMenu && (this.removeClass("lm-mod-active"), document.removeEventListener("mousedown", this, !0), this._childMenu = null, this.activeIndex = -1);
  }
  /**
   * Handle the `menuRequested` signal of a child menu.
   */
  _onMenuMenuRequested(Qt, Zt) {
    if (Qt !== this._childMenu)
      return;
    let $n = this._activeIndex, Sn = this._menus.length;
    switch (Zt) {
      case "next":
        this.activeIndex = $n === Sn - 1 ? 0 : $n + 1;
        break;
      case "previous":
        this.activeIndex = $n === 0 ? Sn - 1 : $n - 1;
        break;
    }
    this.openActiveMenu();
  }
  /**
   * Handle the `changed` signal of a title object.
   */
  _onTitleChanged() {
    this.update();
  }
}
(function(_e) {
  class Qt {
    /**
     * Render the virtual element for a menu bar item.
     *
     * @param data - The data to use for rendering the item.
     *
     * @returns A virtual element representing the item.
     */
    renderItem($n) {
      let Sn = this.createItemClass($n), kn = this.createItemDataset($n), Kn = this.createItemARIA($n);
      return h$6.li({
        className: Sn,
        dataset: kn,
        tabindex: $n.tabbable ? "0" : "-1",
        onfocus: $n.onfocus,
        ...Kn
      }, this.renderIcon($n), this.renderLabel($n));
    }
    /**
     * Render the icon element for a menu bar item.
     *
     * @param data - The data to use for rendering the icon.
     *
     * @returns A virtual element representing the item icon.
     */
    renderIcon($n) {
      let Sn = this.createIconClass($n);
      return h$6.div({ className: Sn }, $n.title.icon, $n.title.iconLabel);
    }
    /**
     * Render the label element for a menu item.
     *
     * @param data - The data to use for rendering the label.
     *
     * @returns A virtual element representing the item label.
     */
    renderLabel($n) {
      let Sn = this.formatLabel($n);
      return h$6.div({ className: "lm-MenuBar-itemLabel" }, Sn);
    }
    /**
     * Create the class name for the menu bar item.
     *
     * @param data - The data to use for the class name.
     *
     * @returns The full class name for the menu item.
     */
    createItemClass($n) {
      let Sn = "lm-MenuBar-item";
      return $n.title.className && (Sn += ` ${$n.title.className}`), $n.active && (Sn += " lm-mod-active"), Sn;
    }
    /**
     * Create the dataset for a menu bar item.
     *
     * @param data - The data to use for the item.
     *
     * @returns The dataset for the menu bar item.
     */
    createItemDataset($n) {
      return $n.title.dataset;
    }
    /**
     * Create the aria attributes for menu bar item.
     *
     * @param data - The data to use for the aria attributes.
     *
     * @returns The aria attributes object for the item.
     */
    createItemARIA($n) {
      return { role: "menuitem", "aria-haspopup": "true" };
    }
    /**
     * Create the class name for the menu bar item icon.
     *
     * @param data - The data to use for the class name.
     *
     * @returns The full class name for the item icon.
     */
    createIconClass($n) {
      let Sn = "lm-MenuBar-itemIcon", kn = $n.title.iconClass;
      return kn ? `${Sn} ${kn}` : Sn;
    }
    /**
     * Create the render content for the label node.
     *
     * @param data - The data to use for the label content.
     *
     * @returns The content to add to the label node.
     */
    formatLabel($n) {
      let { label: Sn, mnemonic: kn } = $n.title;
      if (kn < 0 || kn >= Sn.length)
        return Sn;
      let Kn = Sn.slice(0, kn), er = Sn.slice(kn + 1), Cr = Sn[kn], kr = h$6.span({ className: "lm-MenuBar-itemMnemonic" }, Cr);
      return [Kn, kr, er];
    }
  }
  _e.Renderer = Qt, _e.defaultRenderer = new Qt();
})(MenuBar || (MenuBar = {}));
var Private$3$1;
(function(_e) {
  function Qt() {
    let $n = document.createElement("div"), Sn = document.createElement("ul");
    return Sn.className = "lm-MenuBar-content", $n.appendChild(Sn), Sn.setAttribute("role", "menubar"), $n;
  }
  _e.createNode = Qt;
  function Zt($n, Sn, kn) {
    let Kn = -1, er = -1, Cr = !1, kr = Sn.toUpperCase();
    for (let Yr = 0, Ms = $n.length; Yr < Ms; ++Yr) {
      let Ds = (Yr + kn) % Ms, Ls = $n[Ds].title;
      if (Ls.label.length === 0)
        continue;
      let js = Ls.mnemonic;
      if (js >= 0 && js < Ls.label.length) {
        Ls.label[js].toUpperCase() === kr && (Kn === -1 ? Kn = Ds : Cr = !0);
        continue;
      }
      er === -1 && Ls.label[0].toUpperCase() === kr && (er = Ds);
    }
    return { index: Kn, multiple: Cr, auto: er };
  }
  _e.findMnemonic = Zt;
})(Private$3$1 || (Private$3$1 = {}));
var Private$2$1;
(function(_e) {
  function Qt() {
    let $n = document.createElement("div"), Sn = document.createElement("div"), kn = document.createElement("div"), Kn = document.createElement("div"), er = document.createElement("div");
    return Sn.className = "lm-ScrollBar-button", kn.className = "lm-ScrollBar-button", Sn.dataset.action = "decrement", kn.dataset.action = "increment", Kn.className = "lm-ScrollBar-track", er.className = "lm-ScrollBar-thumb", Kn.appendChild(er), $n.appendChild(Sn), $n.appendChild(Kn), $n.appendChild(kn), $n;
  }
  _e.createNode = Qt;
  function Zt($n, Sn) {
    return $n.thumbNode.contains(Sn) ? "thumb" : $n.trackNode.contains(Sn) ? "track" : $n.decrementNode.contains(Sn) ? "decrement" : $n.incrementNode.contains(Sn) ? "increment" : null;
  }
  _e.findPart = Zt;
})(Private$2$1 || (Private$2$1 = {}));
class StackedLayout extends PanelLayout {
  constructor(Qt = {}) {
    super(Qt), this._dirty = !1, this._items = [], this._box = null, this._hiddenMode = Qt.hiddenMode !== void 0 ? Qt.hiddenMode : Widget.HiddenMode.Display;
  }
  /**
   * The method for hiding widgets.
   *
   * #### Notes
   * If there is only one child widget, `Display` hiding mode will be used
   * regardless of this setting.
   */
  get hiddenMode() {
    return this._hiddenMode;
  }
  /**
   * Set the method for hiding widgets.
   *
   * #### Notes
   * If there is only one child widget, `Display` hiding mode will be used
   * regardless of this setting.
   */
  set hiddenMode(Qt) {
    this._hiddenMode !== Qt && (this._hiddenMode = Qt, this.widgets.length > 1 && this.widgets.forEach((Zt) => {
      Zt.hiddenMode = this._hiddenMode;
    }));
  }
  /**
   * Dispose of the resources held by the layout.
   */
  dispose() {
    for (const Qt of this._items)
      Qt.dispose();
    this._box = null, this._items.length = 0, super.dispose();
  }
  /**
   * Attach a widget to the parent's DOM node.
   *
   * @param index - The current index of the widget in the layout.
   *
   * @param widget - The widget to attach to the parent.
   *
   * #### Notes
   * This is a reimplementation of the superclass method.
   */
  attachWidget(Qt, Zt) {
    this._hiddenMode === Widget.HiddenMode.Scale && this._items.length > 0 ? (this._items.length === 1 && (this.widgets[0].hiddenMode = Widget.HiddenMode.Scale), Zt.hiddenMode = Widget.HiddenMode.Scale) : Zt.hiddenMode = Widget.HiddenMode.Display, ArrayExt.insert(this._items, Qt, new LayoutItem(Zt)), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.BeforeAttach), this.parent.node.appendChild(Zt.node), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.AfterAttach), this.parent.fit();
  }
  /**
   * Move a widget in the parent's DOM node.
   *
   * @param fromIndex - The previous index of the widget in the layout.
   *
   * @param toIndex - The current index of the widget in the layout.
   *
   * @param widget - The widget to move in the parent.
   *
   * #### Notes
   * This is a reimplementation of the superclass method.
   */
  moveWidget(Qt, Zt, $n) {
    ArrayExt.move(this._items, Qt, Zt), this.parent.update();
  }
  /**
   * Detach a widget from the parent's DOM node.
   *
   * @param index - The previous index of the widget in the layout.
   *
   * @param widget - The widget to detach from the parent.
   *
   * #### Notes
   * This is a reimplementation of the superclass method.
   */
  detachWidget(Qt, Zt) {
    let $n = ArrayExt.removeAt(this._items, Qt);
    this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.BeforeDetach), this.parent.node.removeChild(Zt.node), this.parent.isAttached && MessageLoop.sendMessage(Zt, Widget.Msg.AfterDetach), $n.widget.node.style.zIndex = "", this._hiddenMode === Widget.HiddenMode.Scale && (Zt.hiddenMode = Widget.HiddenMode.Display, this._items.length === 1 && (this._items[0].widget.hiddenMode = Widget.HiddenMode.Display)), $n.dispose(), this.parent.fit();
  }
  /**
   * A message handler invoked on a `'before-show'` message.
   */
  onBeforeShow(Qt) {
    super.onBeforeShow(Qt), this.parent.update();
  }
  /**
   * A message handler invoked on a `'before-attach'` message.
   */
  onBeforeAttach(Qt) {
    super.onBeforeAttach(Qt), this.parent.fit();
  }
  /**
   * A message handler invoked on a `'child-shown'` message.
   */
  onChildShown(Qt) {
    this.parent.fit();
  }
  /**
   * A message handler invoked on a `'child-hidden'` message.
   */
  onChildHidden(Qt) {
    this.parent.fit();
  }
  /**
   * A message handler invoked on a `'resize'` message.
   */
  onResize(Qt) {
    this.parent.isVisible && this._update(Qt.width, Qt.height);
  }
  /**
   * A message handler invoked on an `'update-request'` message.
   */
  onUpdateRequest(Qt) {
    this.parent.isVisible && this._update(-1, -1);
  }
  /**
   * A message handler invoked on a `'fit-request'` message.
   */
  onFitRequest(Qt) {
    this.parent.isAttached && this._fit();
  }
  /**
   * Fit the layout to the total size required by the widgets.
   */
  _fit() {
    let Qt = 0, Zt = 0;
    for (let kn = 0, Kn = this._items.length; kn < Kn; ++kn) {
      let er = this._items[kn];
      er.isHidden || (er.fit(), Qt = Math.max(Qt, er.minWidth), Zt = Math.max(Zt, er.minHeight));
    }
    let $n = this._box = ElementExt.boxSizing(this.parent.node);
    Qt += $n.horizontalSum, Zt += $n.verticalSum;
    let Sn = this.parent.node.style;
    Sn.minWidth = `${Qt}px`, Sn.minHeight = `${Zt}px`, this._dirty = !0, this.parent.parent && MessageLoop.sendMessage(this.parent.parent, Widget.Msg.FitRequest), this._dirty && MessageLoop.sendMessage(this.parent, Widget.Msg.UpdateRequest);
  }
  /**
   * Update the layout position and size of the widgets.
   *
   * The parent offset dimensions should be `-1` if unknown.
   */
  _update(Qt, Zt) {
    this._dirty = !1;
    let $n = 0;
    for (let Cr = 0, kr = this._items.length; Cr < kr; ++Cr)
      $n += +!this._items[Cr].isHidden;
    if ($n === 0)
      return;
    Qt < 0 && (Qt = this.parent.node.offsetWidth), Zt < 0 && (Zt = this.parent.node.offsetHeight), this._box || (this._box = ElementExt.boxSizing(this.parent.node));
    let Sn = this._box.paddingTop, kn = this._box.paddingLeft, Kn = Qt - this._box.horizontalSum, er = Zt - this._box.verticalSum;
    for (let Cr = 0, kr = this._items.length; Cr < kr; ++Cr) {
      let Yr = this._items[Cr];
      Yr.isHidden || (Yr.widget.node.style.zIndex = `${Cr}`, Yr.update(kn, Sn, Kn, er));
    }
  }
}
var Private$1$1;
(function(_e) {
  function Qt(Zt) {
    return Zt.layout || new StackedLayout();
  }
  _e.createLayout = Qt;
})(Private$1$1 || (Private$1$1 = {}));
var Private$k;
(function(_e) {
  function Qt(kn) {
    return $n[kn];
  }
  _e.orientationFromPlacement = Qt;
  function Zt(kn) {
    return Sn[kn];
  }
  _e.directionFromPlacement = Zt;
  const $n = {
    top: "horizontal",
    left: "vertical",
    right: "vertical",
    bottom: "horizontal"
  }, Sn = {
    top: "top-to-bottom",
    left: "left-to-right",
    right: "right-to-left",
    bottom: "bottom-to-top"
  };
})(Private$k || (Private$k = {}));
const badSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoCiAgICAgICAgY2xhc3M9ImpwLWljb24wIgogICAgICAgIGZpbGw9IiMwMDAiCiAgICAgICAgZD0iTTI0IDIwLjE4OGwtOC4zMTUtOC4yMDkgOC4yLTguMjgyLTMuNjk3LTMuNjk3LTguMjEyIDguMzE4LTguMzEtOC4yMDMtMy42NjYgMy42NjYgOC4zMjEgOC4yNC04LjIwNiA4LjMxMyAzLjY2NiAzLjY2NiA4LjIzNy04LjMxOCA4LjI4NSA4LjIwM3oiCiAgICAvPgo8L3N2Zz4K", blankSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoCiAgICAgICAgZmlsbD0iIzAwMCIKICAgICAgICBmaWxsLW9wYWNpdHk9IjAuMCIKICAgICAgICBkPSJNMjQgMjAuMTg4bC04LjMxNS04LjIwOSA4LjItOC4yODItMy42OTctMy42OTctOC4yMTIgOC4zMTgtOC4zMS04LjIwMy0zLjY2NiAzLjY2NiA4LjMyMSA4LjI0LTguMjA2IDguMzEzIDMuNjY2IDMuNjY2IDguMjM3LTguMzE4IDguMjg1IDguMjAzeiIKICAgIC8+Cjwvc3ZnPgo=", refreshSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDE4IDE4Ij4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICAgICAgPHBhdGggZD0iTTkgMTMuNWMtMi40OSAwLTQuNS0yLjAxLTQuNS00LjVTNi41MSA0LjUgOSA0LjVjMS4yNCAwIDIuMzYuNTIgMy4xNyAxLjMzTDEwIDhoNVYzbC0xLjc2IDEuNzZDMTIuMTUgMy42OCAxMC42NiAzIDkgMyA1LjY5IDMgMy4wMSA1LjY5IDMuMDEgOVM1LjY5IDE1IDkgMTVjMi45NyAwIDUuNDMtMi4xNiA1LjktNWgtMS41MmMtLjQ2IDItMi4yNCAzLjUtNC4zOCAzLjV6Ii8+CiAgICA8L2c+Cjwvc3ZnPgo=";
var lib$2 = {}, typestyle = {};
let uniqueId$1 = 0;
const CSS_NUMBER = /* @__PURE__ */ Object.create(null), CSS_NUMBER_KEYS = [
  "animation-iteration-count",
  "border-image-outset",
  "border-image-slice",
  "border-image-width",
  "box-flex",
  "box-flex-group",
  "box-ordinal-group",
  "column-count",
  "columns",
  "counter-increment",
  "counter-reset",
  "flex",
  "flex-grow",
  "flex-positive",
  "flex-shrink",
  "flex-negative",
  "flex-order",
  "font-weight",
  "grid-area",
  "grid-column",
  "grid-column-end",
  "grid-column-span",
  "grid-column-start",
  "grid-row",
  "grid-row-end",
  "grid-row-span",
  "grid-row-start",
  "line-clamp",
  "line-height",
  "opacity",
  "order",
  "orphans",
  "tab-size",
  "widows",
  "z-index",
  "zoom",
  // SVG properties.
  "fill-opacity",
  "flood-opacity",
  "stop-opacity",
  "stroke-dasharray",
  "stroke-dashoffset",
  "stroke-miterlimit",
  "stroke-opacity",
  "stroke-width"
];
for (const _e of CSS_NUMBER_KEYS)
  for (const Qt of ["-webkit-", "-ms-", "-moz-", "-o-", ""])
    CSS_NUMBER[Qt + _e] = !0;
function hyphenate(_e) {
  return _e.replace(/[A-Z]/g, (Qt) => `-${Qt.toLowerCase()}`).replace(/^ms-/, "-ms-");
}
function stringHash(_e) {
  let Qt = 5381, Zt = _e.length;
  for (; Zt--; )
    Qt = Qt * 33 ^ _e.charCodeAt(Zt);
  return (Qt >>> 0).toString(36);
}
function styleToString(_e, Qt) {
  return Qt && typeof Qt == "number" && !CSS_NUMBER[_e] ? `${_e}:${Qt}px` : `${_e}:${Qt}`;
}
function sortTuples(_e) {
  return _e.sort((Qt, Zt) => Qt[0] > Zt[0] ? 1 : -1);
}
function parseStyles(_e, Qt) {
  const Zt = [], $n = [];
  for (const Sn of Object.keys(_e)) {
    const kn = Sn.trim(), Kn = _e[Sn];
    kn.charCodeAt(0) !== 36 && Kn != null && (typeof Kn == "object" && !Array.isArray(Kn) ? $n.push([kn, Kn]) : Zt.push([hyphenate(kn), Kn]));
  }
  return {
    style: stringifyProperties(sortTuples(Zt)),
    nested: Qt ? $n : sortTuples($n),
    isUnique: !!_e.$unique
  };
}
function stringifyProperties(_e) {
  return _e.map(([Qt, Zt]) => Array.isArray(Zt) ? Zt.map(($n) => styleToString(Qt, $n)).join(";") : styleToString(Qt, Zt)).join(";");
}
function interpolate$4(_e, Qt) {
  return _e.indexOf("&") === -1 ? `${Qt} ${_e}` : _e.replace(/&/g, Qt);
}
function stylize(_e, Qt, Zt, $n, Sn) {
  const { style: kn, nested: Kn, isUnique: er } = parseStyles(Qt, _e !== "");
  let Cr = kn;
  if (_e.charCodeAt(0) === 64) {
    const kr = {
      selector: _e,
      styles: [],
      rules: [],
      style: Sn ? "" : kn
    };
    Zt.push(kr), kn && Sn && kr.styles.push({ selector: Sn, style: kn, isUnique: er });
    for (const [Yr, Ms] of Kn)
      Cr += Yr + stylize(Yr, Ms, kr.rules, kr.styles, Sn);
  } else {
    const kr = Sn ? interpolate$4(_e, Sn) : _e;
    kn && $n.push({ selector: kr, style: kn, isUnique: er });
    for (const [Yr, Ms] of Kn)
      Cr += Yr + stylize(Yr, Ms, Zt, $n, kr);
  }
  return Cr;
}
function composeStylize(_e, Qt, Zt, $n, Sn, kn) {
  for (const { selector: Kn, style: er, isUnique: Cr } of $n) {
    const kr = kn ? interpolate$4(Kn, Sn) : Kn, Yr = Cr ? `u\0${(++uniqueId$1).toString(36)}` : `s\0${Qt}\0${er}`, Ms = new Style$1(er, Yr);
    Ms.add(new Selector(kr, `k\0${Qt}\0${kr}`)), _e.add(Ms);
  }
  for (const { selector: Kn, style: er, rules: Cr, styles: kr } of Zt) {
    const Yr = new Rule(Kn, er, `r\0${Qt}\0${Kn}\0${er}`);
    composeStylize(Yr, Qt, Cr, kr, Sn, kn), _e.add(Yr);
  }
}
function join$2(_e) {
  let Qt = "";
  for (let Zt = 0; Zt < _e.length; Zt++)
    Qt += _e[Zt];
  return Qt;
}
const noopChanges = {
  add: () => {
  },
  change: () => {
  },
  remove: () => {
  }
};
class Cache {
  constructor(Qt = noopChanges) {
    this.changes = Qt, this.sheet = [], this.changeId = 0, this._keys = [], this._children = /* @__PURE__ */ Object.create(null), this._counters = /* @__PURE__ */ Object.create(null);
  }
  add(Qt) {
    const Zt = this._counters[Qt.id] || 0, $n = this._children[Qt.id] || Qt.clone();
    if (this._counters[Qt.id] = Zt + 1, Zt === 0)
      this._children[$n.id] = $n, this._keys.push($n.id), this.sheet.push($n.getStyles()), this.changeId++, this.changes.add($n, this._keys.length - 1);
    else if ($n instanceof Cache && Qt instanceof Cache) {
      const Sn = this._keys.indexOf(Qt.id), kn = $n.changeId;
      $n.merge(Qt), $n.changeId !== kn && (this.sheet.splice(Sn, 1, $n.getStyles()), this.changeId++, this.changes.change($n, Sn, Sn));
    }
  }
  remove(Qt) {
    const Zt = this._counters[Qt.id];
    if (Zt) {
      this._counters[Qt.id] = Zt - 1;
      const $n = this._children[Qt.id], Sn = this._keys.indexOf($n.id);
      if (Zt === 1)
        delete this._counters[Qt.id], delete this._children[Qt.id], this._keys.splice(Sn, 1), this.sheet.splice(Sn, 1), this.changeId++, this.changes.remove($n, Sn);
      else if ($n instanceof Cache && Qt instanceof Cache) {
        const kn = $n.changeId;
        $n.unmerge(Qt), $n.changeId !== kn && (this.sheet.splice(Sn, 1, $n.getStyles()), this.changeId++, this.changes.change($n, Sn, Sn));
      }
    }
  }
  values() {
    return this._keys.map((Qt) => this._children[Qt]);
  }
  merge(Qt) {
    for (const Zt of Qt.values())
      this.add(Zt);
    return this;
  }
  unmerge(Qt) {
    for (const Zt of Qt.values())
      this.remove(Zt);
    return this;
  }
  clone() {
    return new Cache().merge(this);
  }
}
class Selector {
  constructor(Qt, Zt) {
    this.selector = Qt, this.id = Zt;
  }
  getStyles() {
    return this.selector;
  }
  clone() {
    return this;
  }
}
let Style$1 = class kD extends Cache {
  constructor(Qt, Zt) {
    super(), this.style = Qt, this.id = Zt;
  }
  getStyles() {
    return `${this.sheet.join(",")}{${this.style}}`;
  }
  clone() {
    return new kD(this.style, this.id).merge(this);
  }
};
class Rule extends Cache {
  constructor(Qt, Zt, $n) {
    super(), this.rule = Qt, this.style = Zt, this.id = $n;
  }
  getStyles() {
    return `${this.rule}{${this.style}${join$2(this.sheet)}}`;
  }
  clone() {
    return new Rule(this.rule, this.style, this.id).merge(this);
  }
}
function key$1(_e, Qt) {
  return `f${stringHash(_e)}`;
}
let FreeStyle$1 = class jD extends Cache {
  constructor(Qt, Zt) {
    super(Zt), this.id = Qt;
  }
  registerStyle(Qt) {
    const Zt = [], $n = [], Sn = stylize("&", Qt, Zt, $n), kn = key$1(Sn), Kn = `.${kn}`;
    return composeStylize(this, Sn, Zt, $n, Kn, !0), kn;
  }
  registerKeyframes(Qt) {
    return this.registerHashRule("@keyframes", Qt);
  }
  registerHashRule(Qt, Zt) {
    const $n = [], Sn = [], kn = stylize("", Zt, $n, Sn), Kn = key$1(kn), er = `${Qt} ${Kn}`, Cr = new Rule(er, "", `h\0${kn}\0${Qt}`);
    return composeStylize(Cr, kn, $n, Sn, "", !1), this.add(Cr), Kn;
  }
  registerRule(Qt, Zt) {
    const $n = [], Sn = [], kn = stylize(Qt, Zt, $n, Sn);
    composeStylize(this, kn, $n, Sn, "", !1);
  }
  registerCss(Qt) {
    return this.registerRule("", Qt);
  }
  getStyles() {
    return join$2(this.sheet);
  }
  clone() {
    return new jD(this.id, this.changes).merge(this);
  }
};
function create$5(_e) {
  return new FreeStyle$1(`f${(++uniqueId$1).toString(36)}`, _e);
}
const dist_es2015 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  Cache,
  FreeStyle: FreeStyle$1,
  Rule,
  Selector,
  Style: Style$1,
  create: create$5
}, Symbol.toStringTag, { value: "Module" })), require$$0 = /* @__PURE__ */ getAugmentedNamespace(dist_es2015);
var formatting = {};
Object.defineProperty(formatting, "__esModule", { value: !0 });
function convertToStyles(_e) {
  var Qt = {};
  for (var Zt in _e) {
    var $n = _e[Zt];
    if (Zt === "$nest") {
      var Sn = $n;
      for (var kn in Sn) {
        var Kn = Sn[kn];
        Qt[kn] = convertToStyles(Kn);
      }
    } else
      Zt === "$debugName" ? Qt.$displayName = $n : Qt[Zt] = $n;
  }
  return Qt;
}
formatting.convertToStyles = convertToStyles;
function convertToKeyframes(_e) {
  var Qt = {};
  for (var Zt in _e)
    Zt !== "$debugName" && (Qt[Zt] = _e[Zt]);
  return _e.$debugName && (Qt.$displayName = _e.$debugName), Qt;
}
formatting.convertToKeyframes = convertToKeyframes;
var utilities = {};
Object.defineProperty(utilities, "__esModule", { value: !0 });
utilities.raf = typeof requestAnimationFrame > "u" ? function(_e) {
  return setTimeout(_e);
} : typeof window > "u" ? requestAnimationFrame : requestAnimationFrame.bind(window);
function classes() {
  for (var _e = [], Qt = 0; Qt < arguments.length; Qt++)
    _e[Qt] = arguments[Qt];
  return _e.map(function(Zt) {
    return Zt && typeof Zt == "object" ? Object.keys(Zt).map(function($n) {
      return !!Zt[$n] && $n;
    }) : [Zt];
  }).reduce(function(Zt, $n) {
    return Zt.concat($n);
  }, []).filter(function(Zt) {
    return !!Zt;
  }).join(" ");
}
utilities.classes = classes;
function extend$3() {
  for (var _e = [], Qt = 0; Qt < arguments.length; Qt++)
    _e[Qt] = arguments[Qt];
  for (var Zt = {}, $n = 0, Sn = _e; $n < Sn.length; $n++) {
    var kn = Sn[$n];
    if (!(kn == null || kn === !1))
      for (var Kn in kn) {
        var er = kn[Kn];
        !er && er !== 0 || (Kn === "$nest" && er ? Zt[Kn] = Zt.$nest ? extend$3(Zt.$nest, er) : er : Kn.indexOf("&") !== -1 || Kn.indexOf("@media") === 0 ? Zt[Kn] = Zt[Kn] ? extend$3(Zt[Kn], er) : er : Zt[Kn] = er);
      }
  }
  return Zt;
}
utilities.extend = extend$3;
utilities.media = function(_e) {
  for (var Qt, Zt = [], $n = 1; $n < arguments.length; $n++)
    Zt[$n - 1] = arguments[$n];
  var Sn = [];
  _e.type && Sn.push(_e.type), _e.orientation && Sn.push("(orientation: " + _e.orientation + ")"), _e.minWidth && Sn.push("(min-width: " + mediaLength(_e.minWidth) + ")"), _e.maxWidth && Sn.push("(max-width: " + mediaLength(_e.maxWidth) + ")"), _e.minHeight && Sn.push("(min-height: " + mediaLength(_e.minHeight) + ")"), _e.maxHeight && Sn.push("(max-height: " + mediaLength(_e.maxHeight) + ")"), _e.prefersColorScheme && Sn.push("(prefers-color-scheme: " + _e.prefersColorScheme + ")");
  var kn = "@media " + Sn.join(" and "), Kn = {
    $nest: (Qt = {}, Qt[kn] = extend$3.apply(void 0, Zt), Qt)
  };
  return Kn;
};
var mediaLength = function(_e) {
  return typeof _e == "string" ? _e : _e + "px";
};
Object.defineProperty(typestyle, "__esModule", { value: !0 });
var FreeStyle = require$$0, formatting_1 = formatting, utilities_1$1 = utilities, createFreeStyle = function() {
  return FreeStyle.create();
}, TypeStyle = (
  /** @class */
  function() {
    function _e(Qt) {
      var Zt = this, $n = Qt.autoGenerateTag;
      this.cssRaw = function(kn) {
        kn && (Zt._raw += kn || "", Zt._pendingRawChange = !0, Zt._styleUpdated());
      }, this.cssRule = function(kn) {
        for (var Kn = [], er = 1; er < arguments.length; er++)
          Kn[er - 1] = arguments[er];
        var Cr = formatting_1.convertToStyles(utilities_1$1.extend.apply(void 0, Kn));
        Zt._freeStyle.registerRule(kn, Cr), Zt._styleUpdated();
      }, this.forceRenderStyles = function() {
        var kn = Zt._getTag();
        kn && (kn.textContent = Zt.getStyles());
      }, this.fontFace = function() {
        for (var kn = [], Kn = 0; Kn < arguments.length; Kn++)
          kn[Kn] = arguments[Kn];
        for (var er = Zt._freeStyle, Cr = 0, kr = kn; Cr < kr.length; Cr++) {
          var Yr = kr[Cr];
          er.registerRule("@font-face", Yr);
        }
        Zt._styleUpdated();
      }, this.getStyles = function() {
        return (Zt._raw || "") + Zt._freeStyle.getStyles();
      }, this.keyframes = function(kn) {
        var Kn = formatting_1.convertToKeyframes(kn), er = Zt._freeStyle.registerKeyframes(Kn);
        return Zt._styleUpdated(), er;
      }, this.reinit = function() {
        var kn = createFreeStyle();
        Zt._freeStyle = kn, Zt._lastFreeStyleChangeId = kn.changeId, Zt._raw = "", Zt._pendingRawChange = !1;
        var Kn = Zt._getTag();
        Kn && (Kn.textContent = "");
      }, this.setStylesTarget = function(kn) {
        Zt._tag && (Zt._tag.textContent = ""), Zt._tag = kn, Zt.forceRenderStyles();
      }, this.stylesheet = function(kn) {
        for (var Kn = Object.getOwnPropertyNames(kn), er = {}, Cr = 0, kr = Kn; Cr < kr.length; Cr++) {
          var Yr = kr[Cr], Ms = kn[Yr];
          Ms && (Ms.$debugName = Yr, er[Yr] = Zt.style(Ms));
        }
        return er;
      };
      var Sn = createFreeStyle();
      this._autoGenerateTag = $n, this._freeStyle = Sn, this._lastFreeStyleChangeId = Sn.changeId, this._pending = 0, this._pendingRawChange = !1, this._raw = "", this._tag = void 0, this.style = this.style.bind(this);
    }
    return _e.prototype._afterAllSync = function(Qt) {
      var Zt = this;
      this._pending++;
      var $n = this._pending;
      utilities_1$1.raf(function() {
        $n === Zt._pending && Qt();
      });
    }, _e.prototype._getTag = function() {
      if (this._tag)
        return this._tag;
      if (this._autoGenerateTag) {
        var Qt = typeof window > "u" ? { textContent: "" } : document.createElement("style");
        return typeof document < "u" && document.head.appendChild(Qt), this._tag = Qt, Qt;
      }
    }, _e.prototype._styleUpdated = function() {
      var Qt = this, Zt = this._freeStyle.changeId, $n = this._lastFreeStyleChangeId;
      !this._pendingRawChange && Zt === $n || (this._lastFreeStyleChangeId = Zt, this._pendingRawChange = !1, this._afterAllSync(function() {
        return Qt.forceRenderStyles();
      }));
    }, _e.prototype.style = function() {
      var Qt = this._freeStyle.registerStyle(formatting_1.convertToStyles(utilities_1$1.extend.apply(void 0, arguments)));
      return this._styleUpdated(), Qt;
    }, _e;
  }()
);
typestyle.TypeStyle = TypeStyle;
var types$4 = {};
Object.defineProperty(types$4, "__esModule", { value: !0 });
Object.defineProperty(lib$2, "__esModule", { value: !0 });
var typestyle_1 = typestyle;
lib$2.TypeStyle = typestyle_1.TypeStyle;
var types$3 = types$4;
lib$2.types = types$3;
var utilities_1 = utilities;
lib$2.extend = utilities_1.extend;
lib$2.classes = utilities_1.classes;
lib$2.media = utilities_1.media;
var ts$2 = new typestyle_1.TypeStyle({ autoGenerateTag: !0 });
lib$2.setStylesTarget = ts$2.setStylesTarget;
lib$2.cssRaw = ts$2.cssRaw;
lib$2.cssRule = ts$2.cssRule;
lib$2.forceRenderStyles = ts$2.forceRenderStyles;
lib$2.fontFace = ts$2.fontFace;
lib$2.getStyles = ts$2.getStyles;
lib$2.keyframes = ts$2.keyframes;
lib$2.reinit = ts$2.reinit;
var style$2 = lib$2.style = ts$2.style;
lib$2.stylesheet = ts$2.stylesheet;
function createTypeStyle(_e) {
  var Qt = new typestyle_1.TypeStyle({ autoGenerateTag: !1 });
  return _e && Qt.setStylesTarget(_e), Qt;
}
lib$2.createTypeStyle = createTypeStyle;
var LabIconStyle;
(function(_e) {
  const Qt = {
    breadCrumb: {
      container: {
        $nest: {
          // `&` will be substituted for the generated classname (interpolation)
          "&:first-child svg": {
            bottom: "1px",
            marginLeft: "0px",
            position: "relative"
          },
          "&:hover": {
            backgroundColor: "var(--jp-layout-color2)"
          },
          ".jp-mod-dropTarget&": {
            backgroundColor: "var(--jp-brand-color2)",
            opacity: 0.7
          }
        }
      },
      element: {
        borderRadius: "var(--jp-border-radius)",
        cursor: "pointer",
        margin: "0px 2px",
        padding: "0px 2px",
        height: "16px",
        width: "16px",
        verticalAlign: "middle"
      }
    },
    commandPaletteHeader: {
      container: {
        height: "14px",
        margin: "0 14px 0 auto"
      },
      element: {
        height: "14px",
        width: "14px"
      },
      options: {
        elementPosition: "center"
      }
    },
    commandPaletteItem: {
      element: {
        height: "16px",
        width: "16px"
      },
      options: {
        elementPosition: "center"
      }
    },
    launcherCard: {
      container: {
        height: "52px",
        width: "52px"
      },
      element: {
        height: "52px",
        width: "52px"
      },
      options: {
        elementPosition: "center"
      }
    },
    launcherSection: {
      container: {
        boxSizing: "border-box",
        marginRight: "12px",
        height: "32px",
        width: "32px"
      },
      element: {
        height: "32px",
        width: "32px"
      },
      options: {
        elementPosition: "center"
      }
    },
    listing: {
      container: {
        flex: "0 0 20px",
        marginRight: "4px",
        position: "relative"
      },
      element: {
        height: "16px",
        width: "16px"
      },
      options: {
        elementPosition: "center"
      }
    },
    listingHeaderItem: {
      container: {
        display: "inline",
        height: "16px",
        width: "16px"
      },
      element: {
        height: "auto",
        margin: "-2px 0 0 0",
        width: "20px"
      },
      options: {
        elementPosition: "center"
      }
    },
    mainAreaTab: {
      container: {
        $nest: {
          ".lm-DockPanel-tabBar &": {
            marginRight: "4px"
          }
        }
      },
      element: {
        $nest: {
          ".lm-DockPanel-tabBar &": {
            height: "14px",
            width: "14px"
          }
        }
      },
      options: {
        elementPosition: "center"
      }
    },
    menuItem: {
      container: {
        display: "inline-block",
        verticalAlign: "middle"
      },
      element: {
        height: "16px",
        width: "16px"
      },
      options: {
        elementPosition: "center"
      }
    },
    runningItem: {
      container: {
        margin: "0px 4px 0px 4px"
      },
      element: {
        height: "16px",
        width: "16px"
      },
      options: {
        elementPosition: "center"
      }
    },
    select: {
      container: {
        pointerEvents: "none"
      },
      element: {
        position: "absolute",
        height: "auto",
        width: "16px"
      }
    },
    settingsEditor: {
      container: {
        display: "flex",
        flex: "0 0 20px",
        margin: "0 3px 0 0",
        position: "relative",
        height: "20px",
        width: "20px"
      },
      element: {
        height: "16px",
        width: "16px"
      },
      options: {
        elementPosition: "center"
      }
    },
    sideBar: {
      element: {
        height: "auto",
        width: "20px"
      },
      options: {
        elementPosition: "center"
      }
    },
    splash: {
      container: {
        animation: "0.3s fade-in linear forwards",
        height: "100%",
        width: "100%",
        zIndex: 1
      },
      element: {
        // width no height
        width: "100px"
      },
      options: {
        elementPosition: "center"
      }
    },
    statusBar: {
      element: {
        left: "0px",
        top: "0px",
        height: "18px",
        width: "20px",
        position: "relative"
      }
    },
    toolbarButton: {
      container: {
        display: "inline-block",
        verticalAlign: "middle"
      },
      element: {
        height: "16px",
        width: "16px"
      },
      options: {
        elementPosition: "center"
      }
    }
  };
  function Zt(Ds) {
    return {
      container: {
        alignItems: "center",
        display: "flex"
      },
      element: {
        display: "block",
        ...Ds
      }
    };
  }
  const $n = {
    center: Zt({ margin: "0 auto", width: "100%" }),
    top: Zt({ margin: "0 0 auto 0" }),
    right: Zt({ margin: "0 0 0 auto" }),
    bottom: Zt({ margin: "auto 0 0 0" }),
    left: Zt({ margin: "0 auto 0 0" }),
    "top right": Zt({ margin: "0 0 auto auto" }),
    "bottom right": Zt({ margin: "auto 0 0 auto" }),
    "bottom left": Zt({ margin: "auto auto 0 0" }),
    "top left": Zt({ margin: "0 auto 0 auto" })
  };
  function Sn(Ds) {
    return {
      element: {
        height: Ds,
        width: Ds
      }
    };
  }
  const kn = {
    small: Sn("14px"),
    normal: Sn("16px"),
    large: Sn("20px"),
    xlarge: Sn("24px")
  };
  function Kn(Ds) {
    return {
      container: Object.assign({}, ...Ds.map((Ls) => Ls.container)),
      element: Object.assign({}, ...Ds.map((Ls) => Ls.element))
    };
  }
  function er(Ds) {
    return Ds ? (Array.isArray(Ds) || (Ds = [Ds]), Ds.map((Ls) => typeof Ls == "string" ? Qt[Ls] : Ls)) : [];
  }
  function Cr(Ds) {
    const Ls = Object.assign({}, ...Ds.map((js) => js.options));
    return Ls.elementPosition && Ds.unshift($n[Ls.elementPosition]), Ls.elementSize && Ds.unshift(kn[Ls.elementSize]), Kn(Ds);
  }
  function kr(Ds) {
    var Ls;
    return style$2({
      ...Ds.container,
      $nest: {
        ...(Ls = Ds.container) === null || Ls === void 0 ? void 0 : Ls.$nest,
        svg: Ds.element
      }
    });
  }
  const Yr = /* @__PURE__ */ new Map();
  function Ms(Ds) {
    if (!Ds || Object.keys(Ds).length === 0)
      return "";
    let { elementPosition: Ls, elementSize: js, stylesheet: zs, ...Fs } = Ds;
    const Bs = {
      ...Ls && { elementPosition: Ls },
      ...js && { elementSize: js }
    }, Hs = typeof zs == "string" && Object.keys(Fs).length === 0, Ws = Hs ? [zs, Ls, js].join(",") : "";
    if (Hs && Yr.has(Ws))
      return Yr.get(Ws);
    const Ys = er(zs);
    Ys.push({ element: Fs, options: Bs });
    const El = kr(Cr(Ys));
    return Hs && Yr.set(Ws, El), El;
  }
  _e.styleClass = Ms;
})(LabIconStyle || (LabIconStyle = {}));
class LabIcon {
  /** *********
   * statics *
   ***********/
  /**
   * Remove any rendered icon from the element that contains it
   *
   * @param container - a DOM node into which an icon was
   * previously rendered
   *
   * @returns the cleaned container
   */
  static remove(Qt) {
    for (; Qt.firstChild; )
      Qt.firstChild.remove();
    return Qt.className = "", Qt;
  }
  /**
   * Resolve an icon name or a \{name, svgstr\} pair into an
   * actual LabIcon.
   *
   * @param icon - either a string with the name of an existing icon
   * or an object with \{name: string, svgstr: string\} fields.
   *
   * @returns a LabIcon instance
   */
  static resolve({ icon: Qt }) {
    if (Qt instanceof LabIcon)
      return Qt;
    if (typeof Qt == "string") {
      const Zt = LabIcon._instances.get(Qt);
      return Zt || (LabIcon._debug && console.warn(`Lookup failed for icon, creating loading icon. icon: ${Qt}`), new LabIcon({ name: Qt, svgstr: refreshSvgstr, _loading: !0 }));
    }
    return new LabIcon(Qt);
  }
  /**
   * Resolve an icon name or a \{name, svgstr\} pair into a DOM element.
   * If icon arg is undefined, the function will fall back to trying to render
   * the icon as a CSS background image, via the iconClass arg.
   * If both icon and iconClass are undefined, this function will return
   * an empty div.
   *
   * @param icon - optional, either a string with the name of an existing icon
   * or an object with \{name: string, svgstr: string\} fields
   *
   * @param iconClass - optional, if the icon arg is not set, the iconClass arg
   * should be a CSS class associated with an existing CSS background-image
   *
   * @param fallback - DEPRECATED, optional, a LabIcon instance that will
   * be used if neither icon nor iconClass are defined
   *
   * @param props - any additional args are passed though to the element method
   * of the resolved icon on render
   *
   * @returns a DOM node with the resolved icon rendered into it
   */
  static resolveElement({ icon: Qt, iconClass: Zt, fallback: $n, ...Sn }) {
    return Private$d.isResolvable(Qt) ? LabIcon.resolve({ icon: Qt }).element(Sn) : !Zt && $n ? $n.element(Sn) : (Sn.className = classes$1(Zt, Sn.className), Private$d.blankElement(Sn));
  }
  /**
   * Resolve an icon name or a \{name, svgstr\} pair into a React component.
   * If icon arg is undefined, the function will fall back to trying to render
   * the icon as a CSS background image, via the iconClass arg.
   * If both icon and iconClass are undefined, the returned component
   * will simply render an empty div.
   *
   * @param icon - optional, either a string with the name of an existing icon
   * or an object with \{name: string, svgstr: string\} fields
   *
   * @param iconClass - optional, if the icon arg is not set, the iconClass arg
   * should be a CSS class associated with an existing CSS background-image
   *
   * @param fallback - DEPRECATED, optional, a LabIcon instance that will
   * be used if neither icon nor iconClass are defined
   *
   * @param props - any additional args are passed though to the React component
   * of the resolved icon on render
   *
   * @returns a React component that will render the resolved icon
   */
  static resolveReact({ icon: Qt, iconClass: Zt, fallback: $n, ...Sn }) {
    if (!Private$d.isResolvable(Qt))
      return !Zt && $n ? React.createElement($n.react, { ...Sn }) : (Sn.className = classes$1(Zt, Sn.className), React.createElement(Private$d.blankReact, { ...Sn }));
    const kn = LabIcon.resolve({ icon: Qt });
    return React.createElement(kn.react, { ...Sn });
  }
  /**
   * Resolve a \{name, svgstr\} pair into an actual svg node.
   */
  static resolveSvg({ name: Qt, svgstr: Zt }) {
    const $n = new DOMParser().parseFromString(Private$d.svgstrShim(Zt), "image/svg+xml"), Sn = $n.querySelector("parsererror");
    if (Sn) {
      const kn = `SVG HTML was malformed for LabIcon instance.
name: ${Qt}, svgstr: ${Zt}`;
      return LabIcon._debug ? (console.error(kn), Sn) : (console.warn(kn), null);
    } else
      return $n.documentElement;
  }
  /**
   * Toggle icon debug from off-to-on, or vice-versa.
   *
   * @param debug - optional boolean to force debug on or off
   */
  static toggleDebug(Qt) {
    LabIcon._debug = Qt ?? !LabIcon._debug;
  }
  /** *********
   * members *
   ***********/
  constructor({ name: Qt, svgstr: Zt, render: $n, unrender: Sn, _loading: kn = !1 }) {
    if (this._props = {}, this._svgReplaced = new Signal(this), this._svgElement = void 0, this._svgInnerHTML = void 0, this._svgReactAttrs = void 0, !(Qt && Zt))
      return console.error(`When defining a new LabIcon, name and svgstr must both be non-empty strings. name: ${Qt}, svgstr: ${Zt}`), badIcon;
    if (this._loading = kn, LabIcon._instances.has(Qt)) {
      const Kn = LabIcon._instances.get(Qt);
      return this._loading ? (Kn.svgstr = Zt, this._loading = !1, Kn) : (LabIcon._debug && console.warn(`Redefining previously loaded icon svgstr. name: ${Qt}, svgstrOld: ${Kn.svgstr}, svgstr: ${Zt}`), Kn.svgstr = Zt, Kn);
    }
    this.name = Qt, this.react = this._initReact(Qt), this.svgstr = Zt, this._initRender({ render: $n, unrender: Sn }), LabIcon._instances.set(this.name, this);
  }
  /**
   * Get a view of this icon that is bound to the specified icon/style props
   *
   * @param optional icon/style props (same as args for .element
   * and .react methods). These will be bound to the resulting view
   *
   * @returns a view of this LabIcon instance
   */
  bindprops(Qt) {
    const Zt = Object.create(this);
    return Zt._props = Qt, Zt.react = Zt._initReact(Zt.name + "_bind"), Zt;
  }
  /**
   * Create an icon as a DOM element
   *
   * @param className - a string that will be used as the class
   * of the container element. Overrides any existing class
   *
   * @param container - a preexisting DOM element that
   * will be used as the container for the svg element
   *
   * @param label - text that will be displayed adjacent
   * to the icon
   *
   * @param title - a tooltip for the icon
   *
   * @param tag - if container is not explicitly
   * provided, this tag will be used when creating the container
   *
   * @param stylesheet - optional string naming a builtin icon
   * stylesheet, for example 'menuItem' or `statusBar`. Can also be an
   * object defining a custom icon stylesheet, or a list of builtin
   * stylesheet names and/or custom stylesheet objects. If array,
   * the given stylesheets will be merged.
   *
   *   See @jupyterlab/ui-components/src/style/icon.ts for details
   *
   * @param elementPosition - optional position for the inner svg element
   *
   * @param elementSize - optional size for the inner svg element.
   * Set to 'normal' to get a standard 16px x 16px icon
   *
   * @param ...elementCSS - all additional args are treated as
   * overrides for the CSS props applied to the inner svg element
   *
   * @returns A DOM element that contains an (inline) svg element
   * that displays an icon
   */
  element(Qt = {}) {
    var Zt;
    let { className: $n, container: Sn, label: kn, title: Kn, tag: er = "div", ...Cr } = { ...this._props, ...Qt };
    const kr = Sn == null ? void 0 : Sn.firstChild;
    if (((Zt = kr == null ? void 0 : kr.dataset) === null || Zt === void 0 ? void 0 : Zt.iconId) === this._uuid)
      return kr;
    if (!this.svgElement)
      return document.createElement("div");
    let Yr = !0;
    if (Sn)
      for (; Sn.firstChild; )
        Sn.firstChild.remove();
    else
      Sn = document.createElement(er), Yr = !1;
    kn != null && (Sn.textContent = kn), Private$d.initContainer({ container: Sn, className: $n, styleProps: Cr, title: Kn });
    const Ms = this.svgElement.cloneNode(!0);
    return Sn.appendChild(Ms), Yr ? Ms : Sn;
  }
  render(Qt, Zt) {
    var $n;
    let Sn = ($n = Zt == null ? void 0 : Zt.children) === null || $n === void 0 ? void 0 : $n[0];
    typeof Sn != "string" && (Sn = void 0), this.element({
      container: Qt,
      label: Sn,
      ...Zt == null ? void 0 : Zt.props
    });
  }
  get svgElement() {
    return this._svgElement === void 0 && (this._svgElement = this._initSvg({ uuid: this._uuid })), this._svgElement;
  }
  get svgInnerHTML() {
    return this._svgInnerHTML === void 0 && (this.svgElement === null ? this._svgInnerHTML = null : this._svgInnerHTML = this.svgElement.innerHTML), this._svgInnerHTML;
  }
  get svgReactAttrs() {
    return this._svgReactAttrs === void 0 && (this.svgElement === null ? this._svgReactAttrs = null : this._svgReactAttrs = getReactAttrs(this.svgElement, {
      ignore: ["data-icon-id"]
    })), this._svgReactAttrs;
  }
  get svgstr() {
    return this._svgstr;
  }
  set svgstr(Qt) {
    this._svgstr = Qt;
    const Zt = UUID$1.uuid4(), $n = this._uuid;
    this._uuid = Zt, this._svgElement = void 0, this._svgInnerHTML = void 0, this._svgReactAttrs = void 0, document.querySelectorAll(`[data-icon-id="${$n}"]`).forEach((Sn) => {
      this.svgElement && Sn.replaceWith(this.svgElement.cloneNode(!0));
    }), this._svgReplaced.emit();
  }
  _initReact(Qt) {
    const Zt = React.forwardRef(($n = {}, Sn) => {
      const { className: kn, container: Kn, label: er, title: Cr, tag: kr = "div", ...Yr } = { ...this._props, ...$n }, [, Ms] = React.useState(this._uuid);
      React.useEffect(() => {
        const js = () => {
          Ms(this._uuid);
        };
        return this._svgReplaced.connect(js), () => {
          this._svgReplaced.disconnect(js);
        };
      });
      const Ds = kr;
      if (!(this.svgInnerHTML && this.svgReactAttrs))
        return React.createElement(React.Fragment, null);
      const Ls = React.createElement("svg", { ...this.svgReactAttrs, dangerouslySetInnerHTML: { __html: this.svgInnerHTML }, ref: Sn });
      return Kn ? (Private$d.initContainer({ container: Kn, className: kn, styleProps: Yr, title: Cr }), React.createElement(
        React.Fragment,
        null,
        Ls,
        er
      )) : React.createElement(
        Ds,
        { className: kn || Yr ? classes$1(kn, LabIconStyle.styleClass(Yr)) : void 0, title: Cr },
        Ls,
        er
      );
    });
    return Zt.displayName = `LabIcon_${Qt}`, Zt;
  }
  _initRender({ render: Qt, unrender: Zt }) {
    Qt ? (this.render = Qt, Zt && (this.unrender = Zt)) : Zt && console.warn("In _initRender, ignoring unrender arg since render is undefined");
  }
  _initSvg({ title: Qt, uuid: Zt } = {}) {
    const $n = LabIcon.resolveSvg(this);
    return $n && ($n.tagName !== "parsererror" && ($n.dataset.icon = this.name, Zt && ($n.dataset.iconId = Zt), Qt && Private$d.setTitleSvg($n, Qt)), $n);
  }
}
LabIcon._debug = !1;
LabIcon._instances = /* @__PURE__ */ new Map();
var Private$d;
(function(_e) {
  function Qt({ className: kr = "", container: Yr, label: Ms, title: Ds, tag: Ls = "div", ...js }) {
    if ((Yr == null ? void 0 : Yr.className) === kr)
      return Yr;
    if (Yr)
      for (; Yr.firstChild; )
        Yr.firstChild.remove();
    else
      Yr = document.createElement(Ls);
    return Ms != null && (Yr.textContent = Ms), _e.initContainer({ container: Yr, className: kr, styleProps: js, title: Ds }), Yr;
  }
  _e.blankElement = Qt, _e.blankReact = React.forwardRef(({ className: kr = "", container: Yr, label: Ms, title: Ds, tag: Ls = "div", ...js }, zs) => {
    const Fs = Ls;
    return Yr ? (Zt({ container: Yr, className: kr, styleProps: js, title: Ds }), React.createElement(React.Fragment, null)) : React.createElement(
      Fs,
      { className: classes$1(kr, LabIconStyle.styleClass(js)) },
      zs && blankIcon.react({ ref: zs }),
      Ms
    );
  }), _e.blankReact.displayName = "BlankReact";
  function Zt({ container: kr, className: Yr, styleProps: Ms, title: Ds }) {
    Ds != null && (kr.title = Ds);
    const Ls = LabIconStyle.styleClass(Ms);
    if (Yr != null) {
      const js = classes$1(Yr, Ls);
      return kr.className = js, js;
    } else
      return Ls ? (kr.classList.add(Ls), Ls) : "";
  }
  _e.initContainer = Zt;
  function $n(kr) {
    return !!(kr && (typeof kr == "string" || kr.name && kr.svgstr));
  }
  _e.isResolvable = $n;
  function Sn(kr, Yr) {
    const Ms = kr.getElementsByTagName("title");
    if (Ms.length)
      Ms[0].textContent = Yr;
    else {
      const Ds = document.createElement("title");
      Ds.textContent = Yr, kr.appendChild(Ds);
    }
  }
  _e.setTitleSvg = Sn;
  function kn(kr, Yr = !0) {
    const [, Ms, Ds] = decodeURIComponent(kr).replace(/>\s*\n\s*</g, "><").replace(/\s*\n\s*/g, " ").match(Yr ? (
      // match based on data url schema
      /^(?:data:.*?(;base64)?,)?(.*)/
    ) : (
      // match based on open of svg tag
      /(?:(base64).*)?(<svg.*)/
    ));
    return Ms ? atob(Ds) : Ds;
  }
  _e.svgstrShim = kn;
  class Kn {
    constructor(Yr, Ms) {
      this._icon = Yr, this._rendererOptions = Ms;
    }
    // eslint-disable-next-line
    render(Yr, Ms) {
    }
  }
  _e.Renderer = Kn;
  class er extends Kn {
    render(Yr, Ms) {
      var Ds, Ls;
      let js = (Ds = Ms == null ? void 0 : Ms.children) === null || Ds === void 0 ? void 0 : Ds[0];
      typeof js != "string" && (js = void 0), this._icon.element({
        container: Yr,
        label: js,
        ...(Ls = this._rendererOptions) === null || Ls === void 0 ? void 0 : Ls.props,
        ...Ms == null ? void 0 : Ms.props
      });
    }
  }
  _e.ElementRenderer = er;
  class Cr extends Kn {
    constructor() {
      super(...arguments), this._rootDOM = null;
    }
    render(Yr, Ms) {
      var Ds, Ls;
      let js = (Ds = Ms == null ? void 0 : Ms.children) === null || Ds === void 0 ? void 0 : Ds[0];
      typeof js != "string" && (js = void 0);
      const zs = this._icon;
      this._rootDOM !== null && this._rootDOM.unmount(), this._rootDOM = createRoot(Yr), this._rootDOM.render(React.createElement(zs.react, { container: Yr, label: js, ...(Ls = this._rendererOptions) === null || Ls === void 0 ? void 0 : Ls.props, ...Ms == null ? void 0 : Ms.props }));
    }
    unrender(Yr) {
      this._rootDOM !== null && (this._rootDOM.unmount(), this._rootDOM = null);
    }
  }
  _e.ReactRenderer = Cr;
})(Private$d || (Private$d = {}));
const badIcon = new LabIcon({
  name: "ui-components:bad",
  svgstr: badSvgstr
}), blankIcon = new LabIcon({
  name: "ui-components:blank",
  svgstr: blankSvgstr
}), addAboveSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxNCAxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzEzN18xOTQ5MikiPgo8cGF0aCBjbGFzcz0ianAtaWNvbjMiIGQ9Ik00Ljc1IDQuOTMwNjZINi42MjVWNi44MDU2NkM2LjYyNSA3LjAxMTkxIDYuNzkzNzUgNy4xODA2NiA3IDcuMTgwNjZDNy4yMDYyNSA3LjE4MDY2IDcuMzc1IDcuMDExOTEgNy4zNzUgNi44MDU2NlY0LjkzMDY2SDkuMjVDOS40NTYyNSA0LjkzMDY2IDkuNjI1IDQuNzYxOTEgOS42MjUgNC41NTU2NkM5LjYyNSA0LjM0OTQxIDkuNDU2MjUgNC4xODA2NiA5LjI1IDQuMTgwNjZINy4zNzVWMi4zMDU2NkM3LjM3NSAyLjA5OTQxIDcuMjA2MjUgMS45MzA2NiA3IDEuOTMwNjZDNi43OTM3NSAxLjkzMDY2IDYuNjI1IDIuMDk5NDEgNi42MjUgMi4zMDU2NlY0LjE4MDY2SDQuNzVDNC41NDM3NSA0LjE4MDY2IDQuMzc1IDQuMzQ5NDEgNC4zNzUgNC41NTU2NkM0LjM3NSA0Ljc2MTkxIDQuNTQzNzUgNC45MzA2NiA0Ljc1IDQuOTMwNjZaIiBmaWxsPSIjNjE2MTYxIiBzdHJva2U9IiM2MTYxNjEiIHN0cm9rZS13aWR0aD0iMC43Ii8+CjwvZz4KPHBhdGggY2xhc3M9ImpwLWljb24zIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTExLjUgOS41VjExLjVMMi41IDExLjVWOS41TDExLjUgOS41Wk0xMiA4QzEyLjU1MjMgOCAxMyA4LjQ0NzcyIDEzIDlWMTJDMTMgMTIuNTUyMyAxMi41NTIzIDEzIDEyIDEzTDIgMTNDMS40NDc3MiAxMyAxIDEyLjU1MjMgMSAxMlY5QzEgOC40NDc3MiAxLjQ0NzcxIDggMiA4TDEyIDhaIiBmaWxsPSIjNjE2MTYxIi8+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzEzN18xOTQ5MiI+CjxyZWN0IGNsYXNzPSJqcC1pY29uMyIgd2lkdGg9IjYiIGhlaWdodD0iNiIgZmlsbD0id2hpdGUiIHRyYW5zZm9ybT0ibWF0cml4KC0xIDAgMCAxIDEwIDEuNTU1NjYpIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==", addBelowSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxNCAxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzEzN18xOTQ5OCkiPgo8cGF0aCBjbGFzcz0ianAtaWNvbjMiIGQ9Ik05LjI1IDEwLjA2OTNMNy4zNzUgMTAuMDY5M0w3LjM3NSA4LjE5NDM0QzcuMzc1IDcuOTg4MDkgNy4yMDYyNSA3LjgxOTM0IDcgNy44MTkzNEM2Ljc5Mzc1IDcuODE5MzQgNi42MjUgNy45ODgwOSA2LjYyNSA4LjE5NDM0TDYuNjI1IDEwLjA2OTNMNC43NSAxMC4wNjkzQzQuNTQzNzUgMTAuMDY5MyA0LjM3NSAxMC4yMzgxIDQuMzc1IDEwLjQ0NDNDNC4zNzUgMTAuNjUwNiA0LjU0Mzc1IDEwLjgxOTMgNC43NSAxMC44MTkzTDYuNjI1IDEwLjgxOTNMNi42MjUgMTIuNjk0M0M2LjYyNSAxMi45MDA2IDYuNzkzNzUgMTMuMDY5MyA3IDEzLjA2OTNDNy4yMDYyNSAxMy4wNjkzIDcuMzc1IDEyLjkwMDYgNy4zNzUgMTIuNjk0M0w3LjM3NSAxMC44MTkzTDkuMjUgMTAuODE5M0M5LjQ1NjI1IDEwLjgxOTMgOS42MjUgMTAuNjUwNiA5LjYyNSAxMC40NDQzQzkuNjI1IDEwLjIzODEgOS40NTYyNSAxMC4wNjkzIDkuMjUgMTAuMDY5M1oiIGZpbGw9IiM2MTYxNjEiIHN0cm9rZT0iIzYxNjE2MSIgc3Ryb2tlLXdpZHRoPSIwLjciLz4KPC9nPgo8cGF0aCBjbGFzcz0ianAtaWNvbjMiIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMi41IDUuNUwyLjUgMy41TDExLjUgMy41TDExLjUgNS41TDIuNSA1LjVaTTIgN0MxLjQ0NzcyIDcgMSA2LjU1MjI4IDEgNkwxIDNDMSAyLjQ0NzcyIDEuNDQ3NzIgMiAyIDJMMTIgMkMxMi41NTIzIDIgMTMgMi40NDc3MiAxMyAzTDEzIDZDMTMgNi41NTIyOSAxMi41NTIzIDcgMTIgN0wyIDdaIiBmaWxsPSIjNjE2MTYxIi8+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzEzN18xOTQ5OCI+CjxyZWN0IGNsYXNzPSJqcC1pY29uMyIgd2lkdGg9IjYiIGhlaWdodD0iNiIgZmlsbD0id2hpdGUiIHRyYW5zZm9ybT0ibWF0cml4KDEgMS43NDg0NmUtMDcgMS43NDg0NmUtMDcgLTEgNCAxMy40NDQzKSIvPgo8L2NsaXBQYXRoPgo8L2RlZnM+Cjwvc3ZnPgo=", addSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTE5IDEzaC02djZoLTJ2LTZINXYtMmg2VjVoMnY2aDZ2MnoiLz4KICA8L2c+Cjwvc3ZnPgo=", bellSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiB2ZXJzaW9uPSIxLjEiPgogICA8cGF0aCBjbGFzcz0ianAtaWNvbjIganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjMzMzMzMzIgogICAgICBkPSJtOCAwLjI5Yy0xLjQgMC0yLjcgMC43My0zLjYgMS44LTEuMiAxLjUtMS40IDMuNC0xLjUgNS4yLTAuMTggMi4yLTAuNDQgNC0yLjMgNS4zbDAuMjggMS4zaDVjMC4wMjYgMC42NiAwLjMyIDEuMSAwLjcxIDEuNSAwLjg0IDAuNjEgMiAwLjYxIDIuOCAwIDAuNTItMC40IDAuNi0xIDAuNzEtMS41aDVsMC4yOC0xLjNjLTEuOS0wLjk3LTIuMi0zLjMtMi4zLTUuMy0wLjEzLTEuOC0wLjI2LTMuNy0xLjUtNS4yLTAuODUtMS0yLjItMS44LTMuNi0xLjh6bTAgMS40YzAuODggMCAxLjkgMC41NSAyLjUgMS4zIDAuODggMS4xIDEuMSAyLjcgMS4yIDQuNCAwLjEzIDEuNyAwLjIzIDMuNiAxLjMgNS4yaC0xMGMxLjEtMS42IDEuMi0zLjQgMS4zLTUuMiAwLjEzLTEuNyAwLjMtMy4zIDEuMi00LjQgMC41OS0wLjcyIDEuNi0xLjMgMi41LTEuM3ptLTAuNzQgMTJoMS41Yy0wLjAwMTUgMC4yOCAwLjAxNSAwLjc5LTAuNzQgMC43OS0wLjczIDAuMDAxNi0wLjcyLTAuNTMtMC43NC0wLjc5eiIgLz4KPC9zdmc+Cg==", bugDotSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyBqcC1pY29uLXNlbGVjdGFibGUiIGZpbGw9IiM2MTYxNjEiPgogICAgICAgIDxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMTcuMTkgOEgyMFYxMEgxNy45MUMxNy45NiAxMC4zMyAxOCAxMC42NiAxOCAxMVYxMkgyMFYxNEgxOC41SDE4VjE0LjAyNzVDMTUuNzUgMTQuMjc2MiAxNCAxNi4xODM3IDE0IDE4LjVDMTQgMTkuMjA4IDE0LjE2MzUgMTkuODc3OSAxNC40NTQ5IDIwLjQ3MzlDMTMuNzA2MyAyMC44MTE3IDEyLjg3NTcgMjEgMTIgMjFDOS43OCAyMSA3Ljg1IDE5Ljc5IDYuODEgMThINFYxNkg2LjA5QzYuMDQgMTUuNjcgNiAxNS4zNCA2IDE1VjE0SDRWMTJINlYxMUM2IDEwLjY2IDYuMDQgMTAuMzMgNi4wOSAxMEg0VjhINi44MUM3LjI2IDcuMjIgNy44OCA2LjU1IDguNjIgNi4wNEw3IDQuNDFMOC40MSAzTDEwLjU5IDUuMTdDMTEuMDQgNS4wNiAxMS41MSA1IDEyIDVDMTIuNDkgNSAxMi45NiA1LjA2IDEzLjQyIDUuMTdMMTUuNTkgM0wxNyA0LjQxTDE1LjM3IDYuMDRDMTYuMTIgNi41NSAxNi43NCA3LjIyIDE3LjE5IDhaTTEwIDE2SDE0VjE0SDEwVjE2Wk0xMCAxMkgxNFYxMEgxMFYxMloiIGZpbGw9IiM2MTYxNjEiLz4KICAgICAgICA8cGF0aCBkPSJNMjIgMTguNUMyMiAyMC40MzMgMjAuNDMzIDIyIDE4LjUgMjJDMTYuNTY3IDIyIDE1IDIwLjQzMyAxNSAxOC41QzE1IDE2LjU2NyAxNi41NjcgMTUgMTguNSAxNUMyMC40MzMgMTUgMjIgMTYuNTY3IDIyIDE4LjVaIiBmaWxsPSIjNjE2MTYxIi8+CiAgICA8L2c+Cjwvc3ZnPgo=", bugSvgstr = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjNjE2MTYxIj4KICAgIDxwYXRoIGQ9Ik0yMCA4aC0yLjgxYy0uNDUtLjc4LTEuMDctMS40NS0xLjgyLTEuOTZMMTcgNC40MSAxNS41OSAzbC0yLjE3IDIuMTdDMTIuOTYgNS4wNiAxMi40OSA1IDEyIDVjLS40OSAwLS45Ni4wNi0xLjQxLjE3TDguNDEgMyA3IDQuNDFsMS42MiAxLjYzQzcuODggNi41NSA3LjI2IDcuMjIgNi44MSA4SDR2MmgyLjA5Yy0uMDUuMzMtLjA5LjY2LS4wOSAxdjFINHYyaDJ2MWMwIC4zNC4wNC42Ny4wOSAxSDR2MmgyLjgxYzEuMDQgMS43OSAyLjk3IDMgNS4xOSAzczQuMTUtMS4yMSA1LjE5LTNIMjB2LTJoLTIuMDljLjA1LS4zMy4wOS0uNjYuMDktMXYtMWgydi0yaC0ydi0xYzAtLjM0LS4wNC0uNjctLjA5LTFIMjBWOHptLTYgOGgtNHYtMmg0djJ6bTAtNGgtNHYtMmg0djJ6Ii8+CiAgPC9nPgo8L3N2Zz4K", buildSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTE0LjkgMTcuNDVDMTYuMjUgMTcuNDUgMTcuMzUgMTYuMzUgMTcuMzUgMTVDMTcuMzUgMTMuNjUgMTYuMjUgMTIuNTUgMTQuOSAxMi41NUMxMy41NCAxMi41NSAxMi40NSAxMy42NSAxMi40NSAxNUMxMi40NSAxNi4zNSAxMy41NCAxNy40NSAxNC45IDE3LjQ1Wk0yMC4xIDE1LjY4TDIxLjU4IDE2Ljg0QzIxLjcxIDE2Ljk1IDIxLjc1IDE3LjEzIDIxLjY2IDE3LjI5TDIwLjI2IDE5LjcxQzIwLjE3IDE5Ljg2IDIwIDE5LjkyIDE5LjgzIDE5Ljg2TDE4LjA5IDE5LjE2QzE3LjczIDE5LjQ0IDE3LjMzIDE5LjY3IDE2LjkxIDE5Ljg1TDE2LjY0IDIxLjdDMTYuNjIgMjEuODcgMTYuNDcgMjIgMTYuMyAyMkgxMy41QzEzLjMyIDIyIDEzLjE4IDIxLjg3IDEzLjE1IDIxLjdMMTIuODkgMTkuODVDMTIuNDYgMTkuNjcgMTIuMDcgMTkuNDQgMTEuNzEgMTkuMTZMOS45NjAwMiAxOS44NkM5LjgxMDAyIDE5LjkyIDkuNjIwMDIgMTkuODYgOS41NDAwMiAxOS43MUw4LjE0MDAyIDE3LjI5QzguMDUwMDIgMTcuMTMgOC4wOTAwMiAxNi45NSA4LjIyMDAyIDE2Ljg0TDkuNzAwMDIgMTUuNjhMOS42NTAwMSAxNUw5LjcwMDAyIDE0LjMxTDguMjIwMDIgMTMuMTZDOC4wOTAwMiAxMy4wNSA4LjA1MDAyIDEyLjg2IDguMTQwMDIgMTIuNzFMOS41NDAwMiAxMC4yOUM5LjYyMDAyIDEwLjEzIDkuODEwMDIgMTAuMDcgOS45NjAwMiAxMC4xM0wxMS43MSAxMC44NEMxMi4wNyAxMC41NiAxMi40NiAxMC4zMiAxMi44OSAxMC4xNUwxMy4xNSA4LjI4OTk4QzEzLjE4IDguMTI5OTggMTMuMzIgNy45OTk5OCAxMy41IDcuOTk5OThIMTYuM0MxNi40NyA3Ljk5OTk4IDE2LjYyIDguMTI5OTggMTYuNjQgOC4yODk5OEwxNi45MSAxMC4xNUMxNy4zMyAxMC4zMiAxNy43MyAxMC41NiAxOC4wOSAxMC44NEwxOS44MyAxMC4xM0MyMCAxMC4wNyAyMC4xNyAxMC4xMyAyMC4yNiAxMC4yOUwyMS42NiAxMi43MUMyMS43NSAxMi44NiAyMS43MSAxMy4wNSAyMS41OCAxMy4xNkwyMC4xIDE0LjMxTDIwLjE1IDE1TDIwLjEgMTUuNjhaIi8+CiAgICA8cGF0aCBkPSJNNy4zMjk2NiA3LjQ0NDU0QzguMDgzMSA3LjAwOTU0IDguMzM5MzIgNi4wNTMzMiA3LjkwNDMyIDUuMjk5ODhDNy40NjkzMiA0LjU0NjQzIDYuNTA4MSA0LjI4MTU2IDUuNzU0NjYgNC43MTY1NkM1LjM5MTc2IDQuOTI2MDggNS4xMjY5NSA1LjI3MTE4IDUuMDE4NDkgNS42NzU5NEM0LjkxMDA0IDYuMDgwNzEgNC45NjY4MiA2LjUxMTk4IDUuMTc2MzQgNi44NzQ4OEM1LjYxMTM0IDcuNjI4MzIgNi41NzYyMiA3Ljg3OTU0IDcuMzI5NjYgNy40NDQ1NFpNOS42NTcxOCA0Ljc5NTkzTDEwLjg2NzIgNC45NTE3OUMxMC45NjI4IDQuOTc3NDEgMTEuMDQwMiA1LjA3MTMzIDExLjAzODIgNS4xODc5M0wxMS4wMzg4IDYuOTg4OTNDMTEuMDQ1NSA3LjEwMDU0IDEwLjk2MTYgNy4xOTUxOCAxMC44NTUgNy4yMTA1NEw5LjY2MDAxIDcuMzgwODNMOS4yMzkxNSA4LjEzMTg4TDkuNjY5NjEgOS4yNTc0NUM5LjcwNzI5IDkuMzYyNzEgOS42NjkzNCA5LjQ3Njk5IDkuNTc0MDggOS41MzE5OUw4LjAxNTIzIDEwLjQzMkM3LjkxMTMxIDEwLjQ5MiA3Ljc5MzM3IDEwLjQ2NzcgNy43MjEwNSAxMC4zODI0TDYuOTg3NDggOS40MzE4OEw2LjEwOTMxIDkuNDMwODNMNS4zNDcwNCAxMC4zOTA1QzUuMjg5MDkgMTAuNDcwMiA1LjE3MzgzIDEwLjQ5MDUgNS4wNzE4NyAxMC40MzM5TDMuNTEyNDUgOS41MzI5M0MzLjQxMDQ5IDkuNDc2MzMgMy4zNzY0NyA5LjM1NzQxIDMuNDEwNzUgOS4yNTY3OUwzLjg2MzQ3IDguMTQwOTNMMy42MTc0OSA3Ljc3NDg4TDMuNDIzNDcgNy4zNzg4M0wyLjIzMDc1IDcuMjEyOTdDMi4xMjY0NyA3LjE5MjM1IDIuMDQwNDkgNy4xMDM0MiAyLjA0MjQ1IDYuOTg2ODJMMi4wNDE4NyA1LjE4NTgyQzIuMDQzODMgNS4wNjkyMiAyLjExOTA5IDQuOTc5NTggMi4yMTcwNCA0Ljk2OTIyTDMuNDIwNjUgNC43OTM5M0wzLjg2NzQ5IDQuMDI3ODhMMy40MTEwNSAyLjkxNzMxQzMuMzczMzcgMi44MTIwNCAzLjQxMTMxIDIuNjk3NzYgMy41MTUyMyAyLjYzNzc2TDUuMDc0MDggMS43Mzc3NkM1LjE2OTM0IDEuNjgyNzYgNS4yODcyOSAxLjcwNzA0IDUuMzU5NjEgMS43OTIzMUw2LjExOTE1IDIuNzI3ODhMNi45ODAwMSAyLjczODkzTDcuNzI0OTYgMS43ODkyMkM3Ljc5MTU2IDEuNzA0NTggNy45MTU0OCAxLjY3OTIyIDguMDA4NzkgMS43NDA4Mkw5LjU2ODIxIDIuNjQxODJDOS42NzAxNyAyLjY5ODQyIDkuNzEyODUgMi44MTIzNCA5LjY4NzIzIDIuOTA3OTdMOS4yMTcxOCA0LjAzMzgzTDkuNDYzMTYgNC4zOTk4OEw5LjY1NzE4IDQuNzk1OTNaIi8+CiAgPC9nPgo8L3N2Zz4K", caretDownEmptySvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDE4IDE4Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KICAgIDxwYXRoIGQ9Ik01LjIsNS45TDksOS43bDMuOC0zLjhsMS4yLDEuMmwtNC45LDVsLTQuOS01TDUuMiw1Ljl6Ii8+CiAgPC9nPgo8L3N2Zz4K", caretDownEmptyThinSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIwIDIwIj4KCTxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgoJCTxwb2x5Z29uIGNsYXNzPSJzdDEiIHBvaW50cz0iOS45LDEzLjYgMy42LDcuNCA0LjQsNi42IDkuOSwxMi4yIDE1LjQsNi43IDE2LjEsNy40ICIvPgoJPC9nPgo8L3N2Zz4K", caretDownSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDE4IDE4Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KICAgIDxwYXRoIGQ9Ik01LjIsNy41TDksMTEuMmwzLjgtMy44SDUuMnoiLz4KICA8L2c+Cjwvc3ZnPgo=", caretLeftSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDE4IDE4Ij4KCTxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgoJCTxwYXRoIGQ9Ik0xMC44LDEyLjhMNy4xLDlsMy44LTMuOGwwLDcuNkgxMC44eiIvPgogIDwvZz4KPC9zdmc+Cg==", caretRightSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDE4IDE4Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KICAgIDxwYXRoIGQ9Ik03LjIsNS4yTDEwLjksOWwtMy44LDMuOFY1LjJINy4yeiIvPgogIDwvZz4KPC9zdmc+Cg==", caretUpEmptyThinSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIwIDIwIj4KCTxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgoJCTxwb2x5Z29uIGNsYXNzPSJzdDEiIHBvaW50cz0iMTUuNCwxMy4zIDkuOSw3LjcgNC40LDEzLjIgMy42LDEyLjUgOS45LDYuMyAxNi4xLDEyLjYgIi8+Cgk8L2c+Cjwvc3ZnPgo=", caretUpSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDE4IDE4Ij4KCTxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgoJCTxwYXRoIGQ9Ik01LjIsMTAuNUw5LDYuOGwzLjgsMy44SDUuMnoiLz4KICA8L2c+Cjwvc3ZnPgo=", caseSensitiveSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIwIDIwIj4KICA8ZyBjbGFzcz0ianAtaWNvbjIiIGZpbGw9IiM0MTQxNDEiPgogICAgPHJlY3QgeD0iMiIgeT0iMiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+CiAgPC9nPgogIDxnIGNsYXNzPSJqcC1pY29uLWFjY2VudDIiIGZpbGw9IiNGRkYiPgogICAgPHBhdGggZD0iTTcuNiw4aDAuOWwzLjUsOGgtMS4xTDEwLDE0SDZsLTAuOSwySDRMNy42LDh6IE04LDkuMUw2LjQsMTNoMy4yTDgsOS4xeiIvPgogICAgPHBhdGggZD0iTTE2LjYsOS44Yy0wLjIsMC4xLTAuNCwwLjEtMC43LDAuMWMtMC4yLDAtMC40LTAuMS0wLjYtMC4yYy0wLjEtMC4xLTAuMi0wLjQtMC4yLTAuNyBjLTAuMywwLjMtMC42LDAuNS0wLjksMC43Yy0wLjMsMC4xLTAuNywwLjItMS4xLDAuMmMtMC4zLDAtMC41LDAtMC43LTAuMWMtMC4yLTAuMS0wLjQtMC4yLTAuNi0wLjNjLTAuMi0wLjEtMC4zLTAuMy0wLjQtMC41IGMtMC4xLTAuMi0wLjEtMC40LTAuMS0wLjdjMC0wLjMsMC4xLTAuNiwwLjItMC44YzAuMS0wLjIsMC4zLTAuNCwwLjQtMC41QzEyLDcsMTIuMiw2LjksMTIuNSw2LjhjMC4yLTAuMSwwLjUtMC4xLDAuNy0wLjIgYzAuMy0wLjEsMC41LTAuMSwwLjctMC4xYzAuMiwwLDAuNC0wLjEsMC42LTAuMWMwLjIsMCwwLjMtMC4xLDAuNC0wLjJjMC4xLTAuMSwwLjItMC4yLDAuMi0wLjRjMC0xLTEuMS0xLTEuMy0xIGMtMC40LDAtMS40LDAtMS40LDEuMmgtMC45YzAtMC40LDAuMS0wLjcsMC4yLTFjMC4xLTAuMiwwLjMtMC40LDAuNS0wLjZjMC4yLTAuMiwwLjUtMC4zLDAuOC0wLjNDMTMuMyw0LDEzLjYsNCwxMy45LDQgYzAuMywwLDAuNSwwLDAuOCwwLjFjMC4zLDAsMC41LDAuMSwwLjcsMC4yYzAuMiwwLjEsMC40LDAuMywwLjUsMC41QzE2LDUsMTYsNS4yLDE2LDUuNnYyLjljMCwwLjIsMCwwLjQsMCwwLjUgYzAsMC4xLDAuMSwwLjIsMC4zLDAuMmMwLjEsMCwwLjIsMCwwLjMsMFY5Ljh6IE0xNS4yLDYuOWMtMS4yLDAuNi0zLjEsMC4yLTMuMSwxLjRjMCwxLjQsMy4xLDEsMy4xLTAuNVY2Ljl6Ii8+CiAgPC9nPgo8L3N2Zz4K", checkSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjNjE2MTYxIj4KICAgIDxwYXRoIGQ9Ik05IDE2LjE3TDQuODMgMTJsLTEuNDIgMS40MUw5IDE5IDIxIDdsLTEuNDEtMS40MXoiLz4KICA8L2c+Cjwvc3ZnPgo=", circleEmptySvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTEyIDJDNi40NyAyIDIgNi40NyAyIDEyczQuNDcgMTAgMTAgMTAgMTAtNC40NyAxMC0xMFMxNy41MyAyIDEyIDJ6bTAgMThjLTQuNDEgMC04LTMuNTktOC04czMuNTktOCA4LTggOCAzLjU5IDggOC0zLjU5IDgtOCA4eiIvPgogIDwvZz4KPC9zdmc+Cg==", circleSvgstr = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTggMTgiIHdpZHRoPSIxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPGNpcmNsZSBjeD0iOSIgY3k9IjkiIHI9IjgiLz4KICA8L2c+Cjwvc3ZnPgo=", clearSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8bWFzayBpZD0iZG9udXRIb2xlIj4KICAgIDxyZWN0IHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0id2hpdGUiIC8+CiAgICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSI4IiBmaWxsPSJibGFjayIvPgogIDwvbWFzaz4KCiAgPGcgY2xhc3M9ImpwLWljb24zIiBmaWxsPSIjNjE2MTYxIj4KICAgIDxyZWN0IGhlaWdodD0iMTgiIHdpZHRoPSIyIiB4PSIxMSIgeT0iMyIgdHJhbnNmb3JtPSJyb3RhdGUoMzE1LCAxMiwgMTIpIi8+CiAgICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgbWFzaz0idXJsKCNkb251dEhvbGUpIi8+CiAgPC9nPgo8L3N2Zz4K", closeSvgstr = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbi1ub25lIGpwLWljb24tc2VsZWN0YWJsZS1pbnZlcnNlIGpwLWljb24zLWhvdmVyIiBmaWxsPSJub25lIj4KICAgIDxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjExIi8+CiAgPC9nPgoKICA8ZyBjbGFzcz0ianAtaWNvbjMganAtaWNvbi1zZWxlY3RhYmxlIGpwLWljb24tYWNjZW50Mi1ob3ZlciIgZmlsbD0iIzYxNjE2MSI+CiAgICA8cGF0aCBkPSJNMTkgNi40MUwxNy41OSA1IDEyIDEwLjU5IDYuNDEgNSA1IDYuNDEgMTAuNTkgMTIgNSAxNy41OSA2LjQxIDE5IDEyIDEzLjQxIDE3LjU5IDE5IDE5IDE3LjU5IDEzLjQxIDEyeiIvPgogIDwvZz4KCiAgPGcgY2xhc3M9ImpwLWljb24tbm9uZSBqcC1pY29uLWJ1c3kiIGZpbGw9Im5vbmUiPgogICAgPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iNyIvPgogIDwvZz4KPC9zdmc+Cg==", codeCheckSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjNjE2MTYxIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CiAgICA8cGF0aCBkPSJNNi41OSwzLjQxTDIsOEw2LjU5LDEyLjZMOCwxMS4xOEw0LjgyLDhMOCw0LjgyTDYuNTksMy40MU0xMi40MSwzLjQxTDExLDQuODJMMTQuMTgsOEwxMSwxMS4xOEwxMi40MSwxMi42TDE3LDhMMTIuNDEsMy40MU0yMS41OSwxMS41OUwxMy41LDE5LjY4TDkuODMsMTZMOC40MiwxNy40MUwxMy41LDIyLjVMMjMsMTNMMjEuNTksMTEuNTlaIiAvPgogIDwvZz4KPC9zdmc+Cg==", codeSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjIiIGhlaWdodD0iMjIiIHZpZXdCb3g9IjAgMCAyOCAyOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KCTxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CgkJPHBhdGggZD0iTTExLjQgMTguNkw2LjggMTRMMTEuNCA5LjRMMTAgOEw0IDE0TDEwIDIwTDExLjQgMTguNlpNMTYuNiAxOC42TDIxLjIgMTRMMTYuNiA5LjRMMTggOEwyNCAxNEwxOCAyMEwxNi42IDE4LjZWMTguNloiLz4KCTwvZz4KPC9zdmc+Cg==", collapseAllSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICAgICAgPHBhdGgKICAgICAgICAgICAgZD0iTTggMmMxIDAgMTEgMCAxMiAwczIgMSAyIDJjMCAxIDAgMTEgMCAxMnMwIDItMiAyQzIwIDE0IDIwIDQgMjAgNFMxMCA0IDYgNGMwLTIgMS0yIDItMnoiIC8+CiAgICAgICAgPHBhdGgKICAgICAgICAgICAgZD0iTTE4IDhjMC0xLTEtMi0yLTJTNSA2IDQgNnMtMiAxLTIgMmMwIDEgMCAxMSAwIDEyczEgMiAyIDJjMSAwIDExIDAgMTIgMHMyLTEgMi0yYzAtMSAwLTExIDAtMTJ6bS0yIDB2MTJINFY4eiIgLz4KICAgICAgICA8cGF0aCBkPSJNNiAxM3YyaDh2LTJ6IiAvPgogICAgPC9nPgo8L3N2Zz4K", consoleSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIwMCAyMDAiPgogIDxnIGNsYXNzPSJqcC1jb25zb2xlLWljb24tYmFja2dyb3VuZC1jb2xvciBqcC1pY29uLXNlbGVjdGFibGUiIGZpbGw9IiMwMjg4RDEiPgogICAgPHBhdGggZD0iTTIwIDE5LjhoMTYwdjE1OS45SDIweiIvPgogIDwvZz4KICA8ZyBjbGFzcz0ianAtY29uc29sZS1pY29uLWNvbG9yIGpwLWljb24tc2VsZWN0YWJsZS1pbnZlcnNlIiBmaWxsPSIjZmZmIj4KICAgIDxwYXRoIGQ9Ik0xMDUgMTI3LjNoNDB2MTIuOGgtNDB6TTUxLjEgNzdMNzQgOTkuOWwtMjMuMyAyMy4zIDEwLjUgMTAuNSAyMy4zLTIzLjNMOTUgOTkuOSA4NC41IDg5LjQgNjEuNiA2Ni41eiIvPgogIDwvZz4KPC9zdmc+Cg==", copySvgstr = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTggMTgiIHdpZHRoPSIxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTExLjksMUgzLjJDMi40LDEsMS43LDEuNywxLjcsMi41djEwLjJoMS41VjIuNWg4LjdWMXogTTE0LjEsMy45aC04Yy0wLjgsMC0xLjUsMC43LTEuNSwxLjV2MTAuMmMwLDAuOCwwLjcsMS41LDEuNSwxLjVoOCBjMC44LDAsMS41LTAuNywxLjUtMS41VjUuNEMxNS41LDQuNiwxNC45LDMuOSwxNC4xLDMuOXogTTE0LjEsMTUuNWgtOFY1LjRoOFYxNS41eiIvPgogIDwvZz4KPC9zdmc+Cg==", copyrightSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI0IDI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCI+CiAgPGcgY2xhc3M9ImpwLWljb24zIiBmaWxsPSIjNjE2MTYxIj4KICAgIDxwYXRoIGQ9Ik0xMS44OCw5LjE0YzEuMjgsMC4wNiwxLjYxLDEuMTUsMS42MywxLjY2aDEuNzljLTAuMDgtMS45OC0xLjQ5LTMuMTktMy40NS0zLjE5QzkuNjQsNy42MSw4LDksOCwxMi4xNCBjMCwxLjk0LDAuOTMsNC4yNCwzLjg0LDQuMjRjMi4yMiwwLDMuNDEtMS42NSwzLjQ0LTIuOTVoLTEuNzljLTAuMDMsMC41OS0wLjQ1LDEuMzgtMS42MywxLjQ0QzEwLjU1LDE0LjgzLDEwLDEzLjgxLDEwLDEyLjE0IEMxMCw5LjI1LDExLjI4LDkuMTYsMTEuODgsOS4xNHogTTEyLDJDNi40OCwyLDIsNi40OCwyLDEyczQuNDgsMTAsMTAsMTBzMTAtNC40OCwxMC0xMFMxNy41MiwyLDEyLDJ6IE0xMiwyMGMtNC40MSwwLTgtMy41OS04LTggczMuNTktOCw4LThzOCwzLjU5LDgsOFMxNi40MSwyMCwxMiwyMHoiLz4KICA8L2c+Cjwvc3ZnPgo=", cutSvgstr = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTkuNjQgNy42NGMuMjMtLjUuMzYtMS4wNS4zNi0xLjY0IDAtMi4yMS0xLjc5LTQtNC00UzIgMy43OSAyIDZzMS43OSA0IDQgNGMuNTkgMCAxLjE0LS4xMyAxLjY0LS4zNkwxMCAxMmwtMi4zNiAyLjM2QzcuMTQgMTQuMTMgNi41OSAxNCA2IDE0Yy0yLjIxIDAtNCAxLjc5LTQgNHMxLjc5IDQgNCA0IDQtMS43OSA0LTRjMC0uNTktLjEzLTEuMTQtLjM2LTEuNjRMMTIgMTRsNyA3aDN2LTFMOS42NCA3LjY0ek02IDhjLTEuMSAwLTItLjg5LTItMnMuOS0yIDItMiAyIC44OSAyIDItLjkgMi0yIDJ6bTAgMTJjLTEuMSAwLTItLjg5LTItMnMuOS0yIDItMiAyIC44OSAyIDItLjkgMi0yIDJ6bTYtNy41Yy0uMjggMC0uNS0uMjItLjUtLjVzLjIyLS41LjUtLjUuNS4yMi41LjUtLjIyLjUtLjUuNXpNMTkgM2wtNiA2IDIgMiA3LTdWM3oiLz4KICA8L2c+Cjwvc3ZnPgo=", deleteSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCI+CiAgICA8cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIiAvPgogICAgPHBhdGggY2xhc3M9ImpwLWljb24zIiBmaWxsPSIjNjI2MjYyIiBkPSJNNiAxOWMwIDEuMS45IDIgMiAyaDhjMS4xIDAgMi0uOSAyLTJWN0g2djEyek0xOSA0aC0zLjVsLTEtMWgtNWwtMSAxSDV2MmgxNFY0eiIgLz4KPC9zdmc+Cg==", downloadSvgstr = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTE5IDloLTRWM0g5djZINWw3IDcgNy03ek01IDE4djJoMTR2LTJINXoiLz4KICA8L2c+Cjwvc3ZnPgo=", duplicateSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxNCAxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggY2xhc3M9ImpwLWljb24zIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTIuNzk5OTggMC44NzVIOC44OTU4MkM5LjIwMDYxIDAuODc1IDkuNDQ5OTggMS4xMzkxNCA5LjQ0OTk4IDEuNDYxOThDOS40NDk5OCAxLjc4NDgyIDkuMjAwNjEgMi4wNDg5NiA4Ljg5NTgyIDIuMDQ4OTZIMy4zNTQxNUMzLjA0OTM2IDIuMDQ4OTYgMi43OTk5OCAyLjMxMzEgMi43OTk5OCAyLjYzNTk0VjkuNjc5NjlDMi43OTk5OCAxMC4wMDI1IDIuNTUwNjEgMTAuMjY2NyAyLjI0NTgyIDEwLjI2NjdDMS45NDEwMyAxMC4yNjY3IDEuNjkxNjUgMTAuMDAyNSAxLjY5MTY1IDkuNjc5NjlWMi4wNDg5NkMxLjY5MTY1IDEuNDAzMjggMi4xOTA0IDAuODc1IDIuNzk5OTggMC44NzVaTTUuMzY2NjUgMTEuOVY0LjU1SDExLjA4MzNWMTEuOUg1LjM2NjY1Wk00LjE0MTY1IDQuMTQxNjdDNC4xNDE2NSAzLjY5MDYzIDQuNTA3MjggMy4zMjUgNC45NTgzMiAzLjMyNUgxMS40OTE3QzExLjk0MjcgMy4zMjUgMTIuMzA4MyAzLjY5MDYzIDEyLjMwODMgNC4xNDE2N1YxMi4zMDgzQzEyLjMwODMgMTIuNzU5NCAxMS45NDI3IDEzLjEyNSAxMS40OTE3IDEzLjEyNUg0Ljk1ODMyQzQuNTA3MjggMTMuMTI1IDQuMTQxNjUgMTIuNzU5NCA0LjE0MTY1IDEyLjMwODNWNC4xNDE2N1oiIGZpbGw9IiM2MTYxNjEiLz4KPHBhdGggY2xhc3M9ImpwLWljb24zIiBkPSJNOS40MzU3NCA4LjI2NTA3SDguMzY0MzFWOS4zMzY1QzguMzY0MzEgOS40NTQzNSA4LjI2Nzg4IDkuNTUwNzggOC4xNTAwMiA5LjU1MDc4QzguMDMyMTcgOS41NTA3OCA3LjkzNTc0IDkuNDU0MzUgNy45MzU3NCA5LjMzNjVWOC4yNjUwN0g2Ljg2NDMxQzYuNzQ2NDUgOC4yNjUwNyA2LjY1MDAyIDguMTY4NjQgNi42NTAwMiA4LjA1MDc4QzYuNjUwMDIgNy45MzI5MiA2Ljc0NjQ1IDcuODM2NSA2Ljg2NDMxIDcuODM2NUg3LjkzNTc0VjYuNzY1MDdDNy45MzU3NCA2LjY0NzIxIDguMDMyMTcgNi41NTA3OCA4LjE1MDAyIDYuNTUwNzhDOC4yNjc4OCA2LjU1MDc4IDguMzY0MzEgNi42NDcyMSA4LjM2NDMxIDYuNzY1MDdWNy44MzY1SDkuNDM1NzRDOS41NTM2IDcuODM2NSA5LjY1MDAyIDcuOTMyOTIgOS42NTAwMiA4LjA1MDc4QzkuNjUwMDIgOC4xNjg2NCA5LjU1MzYgOC4yNjUwNyA5LjQzNTc0IDguMjY1MDdaIiBmaWxsPSIjNjE2MTYxIiBzdHJva2U9IiM2MTYxNjEiIHN0cm9rZS13aWR0aD0iMC41Ii8+Cjwvc3ZnPgo=", editSvgstr = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTMgMTcuMjVWMjFoMy43NUwxNy44MSA5Ljk0bC0zLjc1LTMuNzVMMyAxNy4yNXpNMjAuNzEgNy4wNGMuMzktLjM5LjM5LTEuMDIgMC0xLjQxbC0yLjM0LTIuMzRjLS4zOS0uMzktMS4wMi0uMzktMS40MSAwbC0xLjgzIDEuODMgMy43NSAzLjc1IDEuODMtMS44M3oiLz4KICA8L2c+Cjwvc3ZnPgo=", ellipsesSvgstr = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPGNpcmNsZSBjeD0iNSIgY3k9IjEyIiByPSIyIi8+CiAgICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIyIi8+CiAgICA8Y2lyY2xlIGN4PSIxOSIgY3k9IjEyIiByPSIyIi8+CiAgPC9nPgo8L3N2Zz4K", errorSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KPGcgY2xhc3M9ImpwLWljb24zIiBmaWxsPSIjNjE2MTYxIj48Y2lyY2xlIGN4PSIxMiIgY3k9IjE5IiByPSIyIi8+PHBhdGggZD0iTTEwIDNoNHYxMmgtNHoiLz48L2c+CjxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0wIDBoMjR2MjRIMHoiLz4KPC9zdmc+Cg==", expandAllSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICAgICAgPHBhdGgKICAgICAgICAgICAgZD0iTTggMmMxIDAgMTEgMCAxMiAwczIgMSAyIDJjMCAxIDAgMTEgMCAxMnMwIDItMiAyQzIwIDE0IDIwIDQgMjAgNFMxMCA0IDYgNGMwLTIgMS0yIDItMnoiIC8+CiAgICAgICAgPHBhdGgKICAgICAgICAgICAgZD0iTTE4IDhjMC0xLTEtMi0yLTJTNSA2IDQgNnMtMiAxLTIgMmMwIDEgMCAxMSAwIDEyczEgMiAyIDJjMSAwIDExIDAgMTIgMHMyLTEgMi0yYzAtMSAwLTExIDAtMTJ6bS0yIDB2MTJINFY4eiIgLz4KICAgICAgICA8cGF0aCBkPSJNMTEgMTBIOXYzSDZ2MmgzdjNoMnYtM2gzdi0yaC0zeiIgLz4KICAgIDwvZz4KPC9zdmc+Cg==", extensionSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTIwLjUgMTFIMTlWN2MwLTEuMS0uOS0yLTItMmgtNFYzLjVDMTMgMi4xMiAxMS44OCAxIDEwLjUgMVM4IDIuMTIgOCAzLjVWNUg0Yy0xLjEgMC0xLjk5LjktMS45OSAydjMuOEgzLjVjMS40OSAwIDIuNyAxLjIxIDIuNyAyLjdzLTEuMjEgMi43LTIuNyAyLjdIMlYyMGMwIDEuMS45IDIgMiAyaDMuOHYtMS41YzAtMS40OSAxLjIxLTIuNyAyLjctMi43IDEuNDkgMCAyLjcgMS4yMSAyLjcgMi43VjIySDE3YzEuMSAwIDItLjkgMi0ydi00aDEuNWMxLjM4IDAgMi41LTEuMTIgMi41LTIuNVMyMS44OCAxMSAyMC41IDExeiIvPgogIDwvZz4KPC9zdmc+Cg==", fastForwardSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICAgICAgPHBhdGggZD0iTTQgMThsOC41LTZMNCA2djEyem05LTEydjEybDguNS02TDEzIDZ6Ii8+CiAgICA8L2c+Cjwvc3ZnPgo=", fileSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIyIDIyIj4KICA8cGF0aCBjbGFzcz0ianAtaWNvbjMganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjNjE2MTYxIiBkPSJNMTkuMyA4LjJsLTUuNS01LjVjLS4zLS4zLS43LS41LTEuMi0uNUgzLjljLS44LjEtMS42LjktMS42IDEuOHYxNC4xYzAgLjkuNyAxLjYgMS42IDEuNmgxNC4yYy45IDAgMS42LS43IDEuNi0xLjZWOS40Yy4xLS41LS4xLS45LS40LTEuMnptLTUuOC0zLjNsMy40IDMuNmgtMy40VjQuOXptMy45IDEyLjdINC43Yy0uMSAwLS4yIDAtLjItLjJWNC43YzAtLjIuMS0uMy4yLS4zaDcuMnY0LjRzMCAuOC4zIDEuMWMuMy4zIDEuMS4zIDEuMS4zaDQuM3Y3LjJzLS4xLjItLjIuMnoiLz4KPC9zdmc+Cg==", fileUploadSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTkgMTZoNnYtNmg0bC03LTctNyA3aDR6bS00IDJoMTR2Mkg1eiIvPgogIDwvZz4KPC9zdmc+Cg==", filterDotSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiNGRkYiPgogICAgPHBhdGggZD0iTTE0LDEyVjE5Ljg4QzE0LjA0LDIwLjE4IDEzLjk0LDIwLjUgMTMuNzEsMjAuNzFDMTMuMzIsMjEuMSAxMi42OSwyMS4xIDEyLjMsMjAuNzFMMTAuMjksMTguN0MxMC4wNiwxOC40NyA5Ljk2LDE4LjE2IDEwLDE3Ljg3VjEySDkuOTdMNC4yMSw0LjYyQzMuODcsNC4xOSAzLjk1LDMuNTYgNC4zOCwzLjIyQzQuNTcsMy4wOCA0Ljc4LDMgNSwzVjNIMTlWM0MxOS4yMiwzIDE5LjQzLDMuMDggMTkuNjIsMy4yMkMyMC4wNSwzLjU2IDIwLjEzLDQuMTkgMTkuNzksNC42MkwxNC4wMywxMkgxNFoiIC8+CiAgPC9nPgogIDxnIGNsYXNzPSJqcC1pY29uLWRvdCIgZmlsbD0iI0ZGRiI+CiAgICA8Y2lyY2xlIGN4PSIxOCIgY3k9IjE3IiByPSIzIj48L2NpcmNsZT4KICA8L2c+Cjwvc3ZnPgo=", filterListSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTEwIDE4aDR2LTJoLTR2MnpNMyA2djJoMThWNkgzem0zIDdoMTJ2LTJINnYyeiIvPgogIDwvZz4KPC9zdmc+Cg==", filterSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiNGRkYiPgogICAgPHBhdGggZD0iTTE0LDEyVjE5Ljg4QzE0LjA0LDIwLjE4IDEzLjk0LDIwLjUgMTMuNzEsMjAuNzFDMTMuMzIsMjEuMSAxMi42OSwyMS4xIDEyLjMsMjAuNzFMMTAuMjksMTguN0MxMC4wNiwxOC40NyA5Ljk2LDE4LjE2IDEwLDE3Ljg3VjEySDkuOTdMNC4yMSw0LjYyQzMuODcsNC4xOSAzLjk1LDMuNTYgNC4zOCwzLjIyQzQuNTcsMy4wOCA0Ljc4LDMgNSwzVjNIMTlWM0MxOS4yMiwzIDE5LjQzLDMuMDggMTkuNjIsMy4yMkMyMC4wNSwzLjU2IDIwLjEzLDQuMTkgMTkuNzksNC42MkwxNC4wMywxMkgxNFoiIC8+CiAgPC9nPgo8L3N2Zz4K", folderFavoriteSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiB3aWR0aD0iMjRweCIgZmlsbD0iIzAwMDAwMCI+CiAgPHBhdGggZD0iTTAgMGgyNHYyNEgwVjB6IiBmaWxsPSJub25lIi8+PHBhdGggY2xhc3M9ImpwLWljb24zIGpwLWljb24tc2VsZWN0YWJsZSIgZmlsbD0iIzYxNjE2MSIgZD0iTTIwIDZoLThsLTItMkg0Yy0xLjEgMC0yIC45LTIgMnYxMmMwIDEuMS45IDIgMiAyaDE2YzEuMSAwIDItLjkgMi0yVjhjMC0xLjEtLjktMi0yLTJ6bS0yLjA2IDExTDE1IDE1LjI4IDEyLjA2IDE3bC43OC0zLjMzLTIuNTktMi4yNCAzLjQxLS4yOUwxNSA4bDEuMzQgMy4xNCAzLjQxLjI5LTIuNTkgMi4yNC43OCAzLjMzeiIvPgo8L3N2Zz4K", folderSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8cGF0aCBjbGFzcz0ianAtaWNvbjMganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjNjE2MTYxIiBkPSJNMTAgNEg0Yy0xLjEgMC0xLjk5LjktMS45OSAyTDIgMThjMCAxLjEuOSAyIDIgMmgxNmMxLjEgMCAyLS45IDItMlY4YzAtMS4xLS45LTItMi0yaC04bC0yLTJ6Ii8+Cjwvc3ZnPgo=", homeSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiB3aWR0aD0iMjRweCIgZmlsbD0iIzAwMDAwMCI+CiAgPHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPjxwYXRoIGNsYXNzPSJqcC1pY29uMyBqcC1pY29uLXNlbGVjdGFibGUiIGZpbGw9IiM2MTYxNjEiIGQ9Ik0xMCAyMHYtNmg0djZoNXYtOGgzTDEyIDMgMiAxMmgzdjh6Ii8+Cjwvc3ZnPgo=", html5Svgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDUxMiA1MTIiPgogIDxwYXRoIGNsYXNzPSJqcC1pY29uMCBqcC1pY29uLXNlbGVjdGFibGUiIGZpbGw9IiMwMDAiIGQ9Ik0xMDguNCAwaDIzdjIyLjhoMjEuMlYwaDIzdjY5aC0yM1Y0NmgtMjF2MjNoLTIzLjJNMjA2IDIzaC0yMC4zVjBoNjMuN3YyM0gyMjl2NDZoLTIzbTUzLjUtNjloMjQuMWwxNC44IDI0LjNMMzEzLjIgMGgyNC4xdjY5aC0yM1YzNC44bC0xNi4xIDI0LjgtMTYuMS0yNC44VjY5aC0yMi42bTg5LjItNjloMjN2NDYuMmgzMi42VjY5aC01NS42Ii8+CiAgPHBhdGggY2xhc3M9ImpwLWljb24tc2VsZWN0YWJsZSIgZmlsbD0iI2U0NGQyNiIgZD0iTTEwNy42IDQ3MWwtMzMtMzcwLjRoMzYyLjhsLTMzIDM3MC4yTDI1NS43IDUxMiIvPgogIDxwYXRoIGNsYXNzPSJqcC1pY29uLXNlbGVjdGFibGUiIGZpbGw9IiNmMTY1MjkiIGQ9Ik0yNTYgNDgwLjVWMTMxaDE0OC4zTDM3NiA0NDciLz4KICA8cGF0aCBjbGFzcz0ianAtaWNvbi1zZWxlY3RhYmxlLWludmVyc2UiIGZpbGw9IiNlYmViZWIiIGQ9Ik0xNDIgMTc2LjNoMTE0djQ1LjRoLTY0LjJsNC4yIDQ2LjVoNjB2NDUuM0gxNTQuNG0yIDIyLjhIMjAybDMuMiAzNi4zIDUwLjggMTMuNnY0Ny40bC05My4yLTI2Ii8+CiAgPHBhdGggY2xhc3M9ImpwLWljb24tc2VsZWN0YWJsZS1pbnZlcnNlIiBmaWxsPSIjZmZmIiBkPSJNMzY5LjYgMTc2LjNIMjU1Ljh2NDUuNGgxMDkuNm0tNC4xIDQ2LjVIMjU1Ljh2NDUuNGg1NmwtNS4zIDU5LTUwLjcgMTMuNnY0Ny4ybDkzLTI1LjgiLz4KPC9zdmc+Cg==", imageSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIyIDIyIj4KICA8cGF0aCBjbGFzcz0ianAtaWNvbi1icmFuZDQganAtaWNvbi1zZWxlY3RhYmxlLWludmVyc2UiIGZpbGw9IiNGRkYiIGQ9Ik0yLjIgMi4yaDE3LjV2MTcuNUgyLjJ6Ii8+CiAgPHBhdGggY2xhc3M9ImpwLWljb24tYnJhbmQwIGpwLWljb24tc2VsZWN0YWJsZSIgZmlsbD0iIzNGNTFCNSIgZD0iTTIuMiAyLjJ2MTcuNWgxNy41bC4xLTE3LjVIMi4yem0xMi4xIDIuMmMxLjIgMCAyLjIgMSAyLjIgMi4ycy0xIDIuMi0yLjIgMi4yLTIuMi0xLTIuMi0yLjIgMS0yLjIgMi4yLTIuMnpNNC40IDE3LjZsMy4zLTguOCAzLjMgNi42IDIuMi0zLjIgNC40IDUuNEg0LjR6Ii8+Cjwvc3ZnPgo=", infoSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDUwLjk3OCA1MC45NzgiPgoJPGcgY2xhc3M9ImpwLWljb24zIiBmaWxsPSIjNjE2MTYxIj4KCQk8cGF0aCBkPSJNNDMuNTIsNy40NThDMzguNzExLDIuNjQ4LDMyLjMwNywwLDI1LjQ4OSwwQzE4LjY3LDAsMTIuMjY2LDIuNjQ4LDcuNDU4LDcuNDU4CgkJCWMtOS45NDMsOS45NDEtOS45NDMsMjYuMTE5LDAsMzYuMDYyYzQuODA5LDQuODA5LDExLjIxMiw3LjQ1NiwxOC4wMzEsNy40NThjMCwwLDAuMDAxLDAsMC4wMDIsMAoJCQljNi44MTYsMCwxMy4yMjEtMi42NDgsMTguMDI5LTcuNDU4YzQuODA5LTQuODA5LDcuNDU3LTExLjIxMiw3LjQ1Ny0xOC4wM0M1MC45NzcsMTguNjcsNDguMzI4LDEyLjI2Niw0My41Miw3LjQ1OHoKCQkJIE00Mi4xMDYsNDIuMTA1Yy00LjQzMiw0LjQzMS0xMC4zMzIsNi44NzItMTYuNjE1LDYuODcyaC0wLjAwMmMtNi4yODUtMC4wMDEtMTIuMTg3LTIuNDQxLTE2LjYxNy02Ljg3MgoJCQljLTkuMTYyLTkuMTYzLTkuMTYyLTI0LjA3MSwwLTMzLjIzM0MxMy4zMDMsNC40NCwxOS4yMDQsMiwyNS40ODksMmM2LjI4NCwwLDEyLjE4NiwyLjQ0LDE2LjYxNyw2Ljg3MgoJCQljNC40MzEsNC40MzEsNi44NzEsMTAuMzMyLDYuODcxLDE2LjYxN0M0OC45NzcsMzEuNzcyLDQ2LjUzNiwzNy42NzUsNDIuMTA2LDQyLjEwNXoiLz4KCQk8cGF0aCBkPSJNMjMuNTc4LDMyLjIxOGMtMC4wMjMtMS43MzQsMC4xNDMtMy4wNTksMC40OTYtMy45NzJjMC4zNTMtMC45MTMsMS4xMS0xLjk5NywyLjI3Mi0zLjI1MwoJCQljMC40NjgtMC41MzYsMC45MjMtMS4wNjIsMS4zNjctMS41NzVjMC42MjYtMC43NTMsMS4xMDQtMS40NzgsMS40MzYtMi4xNzVjMC4zMzEtMC43MDcsMC40OTUtMS41NDEsMC40OTUtMi41CgkJCWMwLTEuMDk2LTAuMjYtMi4wODgtMC43NzktMi45NzljLTAuNTY1LTAuODc5LTEuNTAxLTEuMzM2LTIuODA2LTEuMzY5Yy0xLjgwMiwwLjA1Ny0yLjk4NSwwLjY2Ny0zLjU1LDEuODMyCgkJCWMtMC4zMDEsMC41MzUtMC41MDMsMS4xNDEtMC42MDcsMS44MTRjLTAuMTM5LDAuNzA3LTAuMjA3LDEuNDMyLTAuMjA3LDIuMTc0aC0yLjkzN2MtMC4wOTEtMi4yMDgsMC40MDctNC4xMTQsMS40OTMtNS43MTkKCQkJYzEuMDYyLTEuNjQsMi44NTUtMi40ODEsNS4zNzgtMi41MjdjMi4xNiwwLjAyMywzLjg3NCwwLjYwOCw1LjE0MSwxLjc1OGMxLjI3OCwxLjE2LDEuOTI5LDIuNzY0LDEuOTUsNC44MTEKCQkJYzAsMS4xNDItMC4xMzcsMi4xMTEtMC40MSwyLjkxMWMtMC4zMDksMC44NDUtMC43MzEsMS41OTMtMS4yNjgsMi4yNDNjLTAuNDkyLDAuNjUtMS4wNjgsMS4zMTgtMS43MywyLjAwMgoJCQljLTAuNjUsMC42OTctMS4zMTMsMS40NzktMS45ODcsMi4zNDZjLTAuMjM5LDAuMzc3LTAuNDI5LDAuNzc3LTAuNTY1LDEuMTk5Yy0wLjE2LDAuOTU5LTAuMjE3LDEuOTUxLTAuMTcxLDIuOTc5CgkJCUMyNi41ODksMzIuMjE4LDIzLjU3OCwzMi4yMTgsMjMuNTc4LDMyLjIxOHogTTIzLjU3OCwzOC4yMnYtMy40ODRoMy4wNzZ2My40ODRIMjMuNTc4eiIvPgoJPC9nPgo8L3N2Zz4K", inspectorSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8cGF0aCBjbGFzcz0ianAtaW5zcGVjdG9yLWljb24tY29sb3IganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjNjE2MTYxIiBkPSJNMjAgNEg0Yy0xLjEgMC0xLjk5LjktMS45OSAyTDIgMThjMCAxLjEuOSAyIDIgMmgxNmMxLjEgMCAyLS45IDItMlY2YzAtMS4xLS45LTItMi0yem0tNSAxNEg0di00aDExdjR6bTAtNUg0VjloMTF2NHptNSA1aC00VjloNHY5eiIvPgo8L3N2Zz4K", jsonSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIyIDIyIj4KICA8ZyBjbGFzcz0ianAtanNvbi1pY29uLWNvbG9yIGpwLWljb24tc2VsZWN0YWJsZSIgZmlsbD0iI0Y5QTgyNSI+CiAgICA8cGF0aCBkPSJNMjAuMiAxMS44Yy0xLjYgMC0xLjcuNS0xLjcgMSAwIC40LjEuOS4xIDEuMy4xLjUuMS45LjEgMS4zIDAgMS43LTEuNCAyLjMtMy41IDIuM2gtLjl2LTEuOWguNWMxLjEgMCAxLjQgMCAxLjQtLjggMC0uMyAwLS42LS4xLTEgMC0uNC0uMS0uOC0uMS0xLjIgMC0xLjMgMC0xLjggMS4zLTItMS4zLS4yLTEuMy0uNy0xLjMtMiAwLS40LjEtLjguMS0xLjIuMS0uNC4xLS43LjEtMSAwLS44LS40LS43LTEuNC0uOGgtLjVWNC4xaC45YzIuMiAwIDMuNS43IDMuNSAyLjMgMCAuNC0uMS45LS4xIDEuMy0uMS41LS4xLjktLjEgMS4zIDAgLjUuMiAxIDEuNyAxdjEuOHpNMS44IDEwLjFjMS42IDAgMS43LS41IDEuNy0xIDAtLjQtLjEtLjktLjEtMS4zLS4xLS41LS4xLS45LS4xLTEuMyAwLTEuNiAxLjQtMi4zIDMuNS0yLjNoLjl2MS45aC0uNWMtMSAwLTEuNCAwLTEuNC44IDAgLjMgMCAuNi4xIDEgMCAuMi4xLjYuMSAxIDAgMS4zIDAgMS44LTEuMyAyQzYgMTEuMiA2IDExLjcgNiAxM2MwIC40LS4xLjgtLjEgMS4yLS4xLjMtLjEuNy0uMSAxIDAgLjguMy44IDEuNC44aC41djEuOWgtLjljLTIuMSAwLTMuNS0uNi0zLjUtMi4zIDAtLjQuMS0uOS4xLTEuMy4xLS41LjEtLjkuMS0xLjMgMC0uNS0uMi0xLTEuNy0xdi0xLjl6Ii8+CiAgICA8Y2lyY2xlIGN4PSIxMSIgY3k9IjEzLjgiIHI9IjIuMSIvPgogICAgPGNpcmNsZSBjeD0iMTEiIGN5PSI4LjIiIHI9IjIuMSIvPgogIDwvZz4KPC9zdmc+Cg==", juliaSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDMyNSAzMDAiPgogIDxnIGNsYXNzPSJqcC1icmFuZDAganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjY2IzYzMzIj4KICAgIDxwYXRoIGQ9Ik0gMTUwLjg5ODQzOCAyMjUgQyAxNTAuODk4NDM4IDI2Ni40MjE4NzUgMTE3LjMyMDMxMiAzMDAgNzUuODk4NDM4IDMwMCBDIDM0LjQ3NjU2MiAzMDAgMC44OTg0MzggMjY2LjQyMTg3NSAwLjg5ODQzOCAyMjUgQyAwLjg5ODQzOCAxODMuNTc4MTI1IDM0LjQ3NjU2MiAxNTAgNzUuODk4NDM4IDE1MCBDIDExNy4zMjAzMTIgMTUwIDE1MC44OTg0MzggMTgzLjU3ODEyNSAxNTAuODk4NDM4IDIyNSIvPgogIDwvZz4KICA8ZyBjbGFzcz0ianAtYnJhbmQwIGpwLWljb24tc2VsZWN0YWJsZSIgZmlsbD0iIzM4OTgyNiI+CiAgICA8cGF0aCBkPSJNIDIzNy41IDc1IEMgMjM3LjUgMTE2LjQyMTg3NSAyMDMuOTIxODc1IDE1MCAxNjIuNSAxNTAgQyAxMjEuMDc4MTI1IDE1MCA4Ny41IDExNi40MjE4NzUgODcuNSA3NSBDIDg3LjUgMzMuNTc4MTI1IDEyMS4wNzgxMjUgMCAxNjIuNSAwIEMgMjAzLjkyMTg3NSAwIDIzNy41IDMzLjU3ODEyNSAyMzcuNSA3NSIvPgogIDwvZz4KICA8ZyBjbGFzcz0ianAtYnJhbmQwIGpwLWljb24tc2VsZWN0YWJsZSIgZmlsbD0iIzk1NThiMiI+CiAgICA8cGF0aCBkPSJNIDMyNC4xMDE1NjIgMjI1IEMgMzI0LjEwMTU2MiAyNjYuNDIxODc1IDI5MC41MjM0MzggMzAwIDI0OS4xMDE1NjIgMzAwIEMgMjA3LjY3OTY4OCAzMDAgMTc0LjEwMTU2MiAyNjYuNDIxODc1IDE3NC4xMDE1NjIgMjI1IEMgMTc0LjEwMTU2MiAxODMuNTc4MTI1IDIwNy42Nzk2ODggMTUwIDI0OS4xMDE1NjIgMTUwIEMgMjkwLjUyMzQzOCAxNTAgMzI0LjEwMTU2MiAxODMuNTc4MTI1IDMyNC4xMDE1NjIgMjI1Ii8+CiAgPC9nPgo8L3N2Zz4K", jupyterFaviconSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUyIiBoZWlnaHQ9IjE2NSIgdmlld0JveD0iMCAwIDE1MiAxNjUiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgPGcgY2xhc3M9ImpwLWp1cHl0ZXItaWNvbi1jb2xvciIgZmlsbD0iI0YzNzcyNiI+CiAgICA8cGF0aCB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjA3ODk0NywgMTEwLjU4MjkyNykiIGQ9Ik03NS45NDIyODQyLDI5LjU4MDQ1NjEgQzQzLjMwMjM5NDcsMjkuNTgwNDU2MSAxNC43OTY3ODMyLDE3LjY1MzQ2MzQgMCwwIEM1LjUxMDgzMjExLDE1Ljg0MDY4MjkgMTUuNzgxNTM4OSwyOS41NjY3NzMyIDI5LjM5MDQ5NDcsMzkuMjc4NDE3MSBDNDIuOTk5Nyw0OC45ODk4NTM3IDU5LjI3MzcsNTQuMjA2NzgwNSA3NS45NjA1Nzg5LDU0LjIwNjc4MDUgQzkyLjY0NzQ1NzksNTQuMjA2NzgwNSAxMDguOTIxNDU4LDQ4Ljk4OTg1MzcgMTIyLjUzMDY2MywzOS4yNzg0MTcxIEMxMzYuMTM5NDUzLDI5LjU2Njc3MzIgMTQ2LjQxMDI4NCwxNS44NDA2ODI5IDE1MS45MjExNTgsMCBDMTM3LjA4Nzg2OCwxNy42NTM0NjM0IDEwOC41ODI1ODksMjkuNTgwNDU2MSA3NS45NDIyODQyLDI5LjU4MDQ1NjEgTDc1Ljk0MjI4NDIsMjkuNTgwNDU2MSBaIiAvPgogICAgPHBhdGggdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4wMzczNjgsIDAuNzA0ODc4KSIgZD0iTTc1Ljk3ODQ1NzksMjQuNjI2NDA3MyBDMTA4LjYxODc2MywyNC42MjY0MDczIDEzNy4xMjQ0NTgsMzYuNTUzNDQxNSAxNTEuOTIxMTU4LDU0LjIwNjc4MDUgQzE0Ni40MTAyODQsMzguMzY2MjIyIDEzNi4xMzk0NTMsMjQuNjQwMTMxNyAxMjIuNTMwNjYzLDE0LjkyODQ4NzggQzEwOC45MjE0NTgsNS4yMTY4NDM5IDkyLjY0NzQ1NzksMCA3NS45NjA1Nzg5LDAgQzU5LjI3MzcsMCA0Mi45OTk3LDUuMjE2ODQzOSAyOS4zOTA0OTQ3LDE0LjkyODQ4NzggQzE1Ljc4MTUzODksMjQuNjQwMTMxNyA1LjUxMDgzMjExLDM4LjM2NjIyMiAwLDU0LjIwNjc4MDUgQzE0LjgzMzA4MTYsMzYuNTg5OTI5MyA0My4zMzg1Njg0LDI0LjYyNjQwNzMgNzUuOTc4NDU3OSwyNC42MjY0MDczIEw3NS45Nzg0NTc5LDI0LjYyNjQwNzMgWiIgLz4KICA8L2c+Cjwvc3ZnPgo=", jupyterSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzkiIGhlaWdodD0iNTEiIHZpZXdCb3g9IjAgMCAzOSA1MSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTYzOCAtMjI4MSkiPgogICAgIDxnIGNsYXNzPSJqcC1qdXB5dGVyLWljb24tY29sb3IiIGZpbGw9IiNGMzc3MjYiPgogICAgICA8cGF0aCB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNjM5Ljc0IDIzMTEuOTgpIiBkPSJNIDE4LjI2NDYgNy4xMzQxMUMgMTAuNDE0NSA3LjEzNDExIDMuNTU4NzIgNC4yNTc2IDAgMEMgMS4zMjUzOSAzLjgyMDQgMy43OTU1NiA3LjEzMDgxIDcuMDY4NiA5LjQ3MzAzQyAxMC4zNDE3IDExLjgxNTIgMTQuMjU1NyAxMy4wNzM0IDE4LjI2OSAxMy4wNzM0QyAyMi4yODIzIDEzLjA3MzQgMjYuMTk2MyAxMS44MTUyIDI5LjQ2OTQgOS40NzMwM0MgMzIuNzQyNCA3LjEzMDgxIDM1LjIxMjYgMy44MjA0IDM2LjUzOCAwQyAzMi45NzA1IDQuMjU3NiAyNi4xMTQ4IDcuMTM0MTEgMTguMjY0NiA3LjEzNDExWiIvPgogICAgICA8cGF0aCB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNjM5LjczIDIyODUuNDgpIiBkPSJNIDE4LjI3MzMgNS45MzkzMUMgMjYuMTIzNSA1LjkzOTMxIDMyLjk3OTMgOC44MTU4MyAzNi41MzggMTMuMDczNEMgMzUuMjEyNiA5LjI1MzAzIDMyLjc0MjQgNS45NDI2MiAyOS40Njk0IDMuNjAwNEMgMjYuMTk2MyAxLjI1ODE4IDIyLjI4MjMgMCAxOC4yNjkgMEMgMTQuMjU1NyAwIDEwLjM0MTcgMS4yNTgxOCA3LjA2ODYgMy42MDA0QyAzLjc5NTU2IDUuOTQyNjIgMS4zMjUzOSA5LjI1MzAzIDAgMTMuMDczNEMgMy41Njc0NSA4LjgyNDYzIDEwLjQyMzIgNS45MzkzMSAxOC4yNzMzIDUuOTM5MzFaIi8+CiAgICA8L2c+CiAgICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgICA8cGF0aCB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNjY5LjMgMjI4MS4zMSkiIGQ9Ik0gNS44OTM1MyAyLjg0NEMgNS45MTg4OSAzLjQzMTY1IDUuNzcwODUgNC4wMTM2NyA1LjQ2ODE1IDQuNTE2NDVDIDUuMTY1NDUgNS4wMTkyMiA0LjcyMTY4IDUuNDIwMTUgNC4xOTI5OSA1LjY2ODUxQyAzLjY2NDMgNS45MTY4OCAzLjA3NDQ0IDYuMDAxNTEgMi40OTgwNSA1LjkxMTcxQyAxLjkyMTY2IDUuODIxOSAxLjM4NDYzIDUuNTYxNyAwLjk1NDg5OCA1LjE2NDAxQyAwLjUyNTE3IDQuNzY2MzMgMC4yMjIwNTYgNC4yNDkwMyAwLjA4MzkwMzcgMy42Nzc1N0MgLTAuMDU0MjQ4MyAzLjEwNjExIC0wLjAyMTIzIDIuNTA2MTcgMC4xNzg3ODEgMS45NTM2NEMgMC4zNzg3OTMgMS40MDExIDAuNzM2ODA5IDAuOTIwODE3IDEuMjA3NTQgMC41NzM1MzhDIDEuNjc4MjYgMC4yMjYyNTkgMi4yNDA1NSAwLjAyNzU5MTkgMi44MjMyNiAwLjAwMjY3MjI5QyAzLjYwMzg5IC0wLjAzMDcxMTUgNC4zNjU3MyAwLjI0OTc4OSA0Ljk0MTQyIDAuNzgyNTUxQyA1LjUxNzExIDEuMzE1MzEgNS44NTk1NiAyLjA1Njc2IDUuODkzNTMgMi44NDRaIi8+CiAgICAgIDxwYXRoIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE2MzkuOCAyMzIzLjgxKSIgZD0iTSA3LjQyNzg5IDMuNTgzMzhDIDcuNDYwMDggNC4zMjQzIDcuMjczNTUgNS4wNTgxOSA2Ljg5MTkzIDUuNjkyMTNDIDYuNTEwMzEgNi4zMjYwNyA1Ljk1MDc1IDYuODMxNTYgNS4yODQxMSA3LjE0NDZDIDQuNjE3NDcgNy40NTc2MyAzLjg3MzcxIDcuNTY0MTQgMy4xNDcwMiA3LjQ1MDYzQyAyLjQyMDMyIDcuMzM3MTIgMS43NDMzNiA3LjAwODcgMS4yMDE4NCA2LjUwNjk1QyAwLjY2MDMyOCA2LjAwNTIgMC4yNzg2MSA1LjM1MjY4IDAuMTA1MDE3IDQuNjMyMDJDIC0wLjA2ODU3NTcgMy45MTEzNSAtMC4wMjYyMzYxIDMuMTU0OTQgMC4yMjY2NzUgMi40NTg1NkMgMC40Nzk1ODcgMS43NjIxNyAwLjkzMTY5NyAxLjE1NzEzIDEuNTI1NzYgMC43MjAwMzNDIDIuMTE5ODMgMC4yODI5MzUgMi44MjkxNCAwLjAzMzQzOTUgMy41NjM4OSAwLjAwMzEzMzQ0QyA0LjU0NjY3IC0wLjAzNzQwMzMgNS41MDUyOSAwLjMxNjcwNiA2LjIyOTYxIDAuOTg3ODM1QyA2Ljk1MzkzIDEuNjU4OTYgNy4zODQ4NCAyLjU5MjM1IDcuNDI3ODkgMy41ODMzOEwgNy40Mjc4OSAzLjU4MzM4WiIvPgogICAgICA8cGF0aCB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNjM4LjM2IDIyODYuMDYpIiBkPSJNIDIuMjc0NzEgNC4zOTYyOUMgMS44NDM2MyA0LjQxNTA4IDEuNDE2NzEgNC4zMDQ0NSAxLjA0Nzk5IDQuMDc4NDNDIDAuNjc5MjY4IDMuODUyNCAwLjM4NTMyOCAzLjUyMTE0IDAuMjAzMzcxIDMuMTI2NTZDIDAuMDIxNDEzNiAyLjczMTk4IC0wLjA0MDM3OTggMi4yOTE4MyAwLjAyNTgxMTYgMS44NjE4MUMgMC4wOTIwMDMxIDEuNDMxOCAwLjI4MzIwNCAxLjAzMTI2IDAuNTc1MjEzIDAuNzEwODgzQyAwLjg2NzIyMiAwLjM5MDUxIDEuMjQ2OTEgMC4xNjQ3MDggMS42NjYyMiAwLjA2MjA1OTJDIDIuMDg1NTMgLTAuMDQwNTg5NyAyLjUyNTYxIC0wLjAxNTQ3MTQgMi45MzA3NiAwLjEzNDIzNUMgMy4zMzU5MSAwLjI4Mzk0MSAzLjY4NzkyIDAuNTUxNTA1IDMuOTQyMjIgMC45MDMwNkMgNC4xOTY1MiAxLjI1NDYyIDQuMzQxNjkgMS42NzQzNiA0LjM1OTM1IDIuMTA5MTZDIDQuMzgyOTkgMi42OTEwNyA0LjE3Njc4IDMuMjU4NjkgMy43ODU5NyAzLjY4NzQ2QyAzLjM5NTE2IDQuMTE2MjQgMi44NTE2NiA0LjM3MTE2IDIuMjc0NzEgNC4zOTYyOUwgMi4yNzQ3MSA0LjM5NjI5WiIvPgogICAgPC9nPgogIDwvZz4+Cjwvc3ZnPgo=", jupyterlabWordmarkSvgstr = "data:image/svg+xml;base64, ", kernelSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoIGNsYXNzPSJqcC1pY29uMiIgZmlsbD0iIzYxNjE2MSIgZD0iTTE1IDlIOXY2aDZWOXptLTIgNGgtMnYtMmgydjJ6bTgtMlY5aC0yVjdjMC0xLjEtLjktMi0yLTJoLTJWM2gtMnYyaC0yVjNIOXYySDdjLTEuMSAwLTIgLjktMiAydjJIM3YyaDJ2MkgzdjJoMnYyYzAgMS4xLjkgMiAyIDJoMnYyaDJ2LTJoMnYyaDJ2LTJoMmMxLjEgMCAyLS45IDItMnYtMmgydi0yaC0ydi0yaDJ6bS00IDZIN1Y3aDEwdjEweiIvPgo8L3N2Zz4K", keyboardSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8cGF0aCBjbGFzcz0ianAtaWNvbjMganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjNjE2MTYxIiBkPSJNMjAgNUg0Yy0xLjEgMC0xLjk5LjktMS45OSAyTDIgMTdjMCAxLjEuOSAyIDIgMmgxNmMxLjEgMCAyLS45IDItMlY3YzAtMS4xLS45LTItMi0yem0tOSAzaDJ2MmgtMlY4em0wIDNoMnYyaC0ydi0yek04IDhoMnYySDhWOHptMCAzaDJ2Mkg4di0yem0tMSAySDV2LTJoMnYyem0wLTNINVY4aDJ2MnptOSA3SDh2LTJoOHYyem0wLTRoLTJ2LTJoMnYyem0wLTNoLTJWOGgydjJ6bTMgM2gtMnYtMmgydjJ6bTAtM2gtMlY4aDJ2MnoiLz4KPC9zdmc+Cg==", launchSvgstr = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMzIgMzIiIHdpZHRoPSIzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjNjE2MTYxIj4KICAgIDxwYXRoIGQ9Ik0yNiwyOEg2YTIuMDAyNywyLjAwMjcsMCwwLDEtMi0yVjZBMi4wMDI3LDIuMDAyNywwLDAsMSw2LDRIMTZWNkg2VjI2SDI2VjE2aDJWMjZBMi4wMDI3LDIuMDAyNywwLDAsMSwyNiwyOFoiLz4KICAgIDxwb2x5Z29uIHBvaW50cz0iMjAgMiAyMCA0IDI2LjU4NiA0IDE4IDEyLjU4NiAxOS40MTQgMTQgMjggNS40MTQgMjggMTIgMzAgMTIgMzAgMiAyMCAyIi8+CiAgPC9nPgo8L3N2Zz4K", launcherSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8cGF0aCBjbGFzcz0ianAtaWNvbjMganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjNjE2MTYxIiBkPSJNMTkgMTlINVY1aDdWM0g1YTIgMiAwIDAwLTIgMnYxNGEyIDIgMCAwMDIgMmgxNGMxLjEgMCAyLS45IDItMnYtN2gtMnY3ek0xNCAzdjJoMy41OWwtOS44MyA5LjgzIDEuNDEgMS40MUwxOSA2LjQxVjEwaDJWM2gtN3oiLz4KPC9zdmc+Cg==", lineFormSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoIGZpbGw9IndoaXRlIiBkPSJNNS44OCA0LjEyTDEzLjc2IDEybC03Ljg4IDcuODhMOCAyMmwxMC0xMEw4IDJ6Ii8+Cjwvc3ZnPgo=", linkSvgstr = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTMuOSAxMmMwLTEuNzEgMS4zOS0zLjEgMy4xLTMuMWg0VjdIN2MtMi43NiAwLTUgMi4yNC01IDVzMi4yNCA1IDUgNWg0di0xLjlIN2MtMS43MSAwLTMuMS0xLjM5LTMuMS0zLjF6TTggMTNoOHYtMkg4djJ6bTktNmgtNHYxLjloNGMxLjcxIDAgMy4xIDEuMzkgMy4xIDMuMXMtMS4zOSAzLjEtMy4xIDMuMWgtNFYxN2g0YzIuNzYgMCA1LTIuMjQgNS01cy0yLjI0LTUtNS01eiIvPgogIDwvZz4KPC9zdmc+Cg==", listSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoIGNsYXNzPSJqcC1pY29uMiBqcC1pY29uLXNlbGVjdGFibGUiIGZpbGw9IiM2MTYxNjEiIGQ9Ik0xOSA1djE0SDVWNWgxNG0xLjEtMkgzLjljLS41IDAtLjkuNC0uOS45djE2LjJjMCAuNC40LjkuOS45aDE2LjJjLjQgMCAuOS0uNS45LS45VjMuOWMwLS41LS41LS45LS45LS45ek0xMSA3aDZ2MmgtNlY3em0wIDRoNnYyaC02di0yem0wIDRoNnYyaC02ek03IDdoMnYySDd6bTAgNGgydjJIN3ptMCA0aDJ2Mkg3eiIvPgo8L3N2Zz4K", markdownSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIyIDIyIj4KICA8cGF0aCBjbGFzcz0ianAtaWNvbi1jb250cmFzdDAganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjN0IxRkEyIiBkPSJNNSAxNC45aDEybC02LjEgNnptOS40LTYuOGMwLTEuMy0uMS0yLjktLjEtNC41LS40IDEuNC0uOSAyLjktMS4zIDQuM2wtMS4zIDQuM2gtMkw4LjUgNy45Yy0uNC0xLjMtLjctMi45LTEtNC4zLS4xIDEuNi0uMSAzLjItLjIgNC42TDcgMTIuNEg0LjhsLjctMTFoMy4zTDEwIDVjLjQgMS4yLjcgMi43IDEgMy45LjMtMS4yLjctMi42IDEtMy45bDEuMi0zLjdoMy4zbC42IDExaC0yLjRsLS4zLTQuMnoiLz4KPC9zdmc+Cg==", moveDownSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxNCAxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggY2xhc3M9ImpwLWljb24zIiBkPSJNMTIuNDcxIDcuNTI4OTlDMTIuNzYzMiA3LjIzNjg0IDEyLjc2MzIgNi43NjMxNiAxMi40NzEgNi40NzEwMVY2LjQ3MTAxQzEyLjE3OSA2LjE3OTA1IDExLjcwNTcgNi4xNzg4NCAxMS40MTM1IDYuNDcwNTRMNy43NSAxMC4xMjc1VjEuNzVDNy43NSAxLjMzNTc5IDcuNDE0MjEgMSA3IDFWMUM2LjU4NTc5IDEgNi4yNSAxLjMzNTc5IDYuMjUgMS43NVYxMC4xMjc1TDIuNTk3MjYgNi40NjgyMkMyLjMwMzM4IDYuMTczODEgMS44MjY0MSA2LjE3MzU5IDEuNTMyMjYgNi40Njc3NFY2LjQ2Nzc0QzEuMjM4MyA2Ljc2MTcgMS4yMzgzIDcuMjM4MyAxLjUzMjI2IDcuNTMyMjZMNi4yOTI4OSAxMi4yOTI5QzYuNjgzNDIgMTIuNjgzNCA3LjMxNjU4IDEyLjY4MzQgNy43MDcxMSAxMi4yOTI5TDEyLjQ3MSA3LjUyODk5WiIgZmlsbD0iIzYxNjE2MSIvPgo8L3N2Zz4K", moveUpSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxNCAxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggY2xhc3M9ImpwLWljb24zIiBkPSJNMS41Mjg5OSA2LjQ3MTAxQzEuMjM2ODQgNi43NjMxNiAxLjIzNjg0IDcuMjM2ODQgMS41Mjg5OSA3LjUyODk5VjcuNTI4OTlDMS44MjA5NSA3LjgyMDk1IDIuMjk0MjYgNy44MjExNiAyLjU4NjQ5IDcuNTI5NDZMNi4yNSAzLjg3MjVWMTIuMjVDNi4yNSAxMi42NjQyIDYuNTg1NzkgMTMgNyAxM1YxM0M3LjQxNDIxIDEzIDcuNzUgMTIuNjY0MiA3Ljc1IDEyLjI1VjMuODcyNUwxMS40MDI3IDcuNTMxNzhDMTEuNjk2NiA3LjgyNjE5IDEyLjE3MzYgNy44MjY0MSAxMi40Njc3IDcuNTMyMjZWNy41MzIyNkMxMi43NjE3IDcuMjM4MyAxMi43NjE3IDYuNzYxNyAxMi40Njc3IDYuNDY3NzRMNy43MDcxMSAxLjcwNzExQzcuMzE2NTggMS4zMTY1OCA2LjY4MzQyIDEuMzE2NTggNi4yOTI4OSAxLjcwNzExTDEuNTI4OTkgNi40NzEwMVoiIGZpbGw9IiM2MTYxNjEiLz4KPC9zdmc+Cg==", newFolderSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTIwIDZoLThsLTItMkg0Yy0xLjExIDAtMS45OS44OS0xLjk5IDJMMiAxOGMwIDEuMTEuODkgMiAyIDJoMTZjMS4xMSAwIDItLjg5IDItMlY4YzAtMS4xMS0uODktMi0yLTJ6bS0xIDhoLTN2M2gtMnYtM2gtM3YtMmgzVjloMnYzaDN2MnoiLz4KICA8L2c+Cjwvc3ZnPgo=", notTrustedSvgstr = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI1IDI1Ij4KICAgIDxwYXRoIGNsYXNzPSJqcC1pY29uMiIgc3Ryb2tlPSIjMzMzMzMzIiBzdHJva2Utd2lkdGg9IjIiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDMgMykiIGQ9Ik0xLjg2MDk0IDExLjQ0MDlDMC44MjY0NDggOC43NzAyNyAwLjg2Mzc3OSA2LjA1NzY0IDEuMjQ5MDcgNC4xOTkzMkMyLjQ4MjA2IDMuOTMzNDcgNC4wODA2OCAzLjQwMzQ3IDUuNjAxMDIgMi44NDQ5QzcuMjM1NDkgMi4yNDQ0IDguODU2NjYgMS41ODE1IDkuOTg3NiAxLjA5NTM5QzExLjA1OTcgMS41ODM0MSAxMi42MDk0IDIuMjQ0NCAxNC4yMTggMi44NDMzOUMxNS43NTAzIDMuNDEzOTQgMTcuMzk5NSAzLjk1MjU4IDE4Ljc1MzkgNC4yMTM4NUMxOS4xMzY0IDYuMDcxNzcgMTkuMTcwOSA4Ljc3NzIyIDE4LjEzOSAxMS40NDA5QzE3LjAzMDMgMTQuMzAzMiAxNC42NjY4IDE3LjE4NDQgOS45OTk5OSAxOC45MzU0QzUuMzMzMTkgMTcuMTg0NCAyLjk2OTY4IDE0LjMwMzIgMS44NjA5NCAxMS40NDA5WiIvPgogICAgPHBhdGggY2xhc3M9ImpwLWljb24yIiBzdHJva2U9IiMzMzMzMzMiIHN0cm9rZS13aWR0aD0iMiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoOS4zMTU5MiA5LjMyMDMxKSIgZD0iTTcuMzY4NDIgMEwwIDcuMzY0NzkiLz4KICAgIDxwYXRoIGNsYXNzPSJqcC1pY29uMiIgc3Ryb2tlPSIjMzMzMzMzIiBzdHJva2Utd2lkdGg9IjIiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDkuMzE1OTIgMTYuNjgzNikgc2NhbGUoMSAtMSkiIGQ9Ik03LjM2ODQyIDBMMCA3LjM2NDc5Ii8+Cjwvc3ZnPgo=", notebookSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIyIDIyIj4KICA8ZyBjbGFzcz0ianAtbm90ZWJvb2staWNvbi1jb2xvciBqcC1pY29uLXNlbGVjdGFibGUiIGZpbGw9IiNFRjZDMDAiPgogICAgPHBhdGggZD0iTTE4LjcgMy4zdjE1LjRIMy4zVjMuM2gxNS40bTEuNS0xLjVIMS44djE4LjNoMTguM2wuMS0xOC4zeiIvPgogICAgPHBhdGggZD0iTTE2LjUgMTYuNWwtNS40LTQuMy01LjYgNC4zdi0xMWgxMXoiLz4KICA8L2c+Cjwvc3ZnPgo=", numberingSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjIiIGhlaWdodD0iMjIiIHZpZXdCb3g9IjAgMCAyOCAyOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KCTxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CgkJPHBhdGggZD0iTTQgMTlINlYxOS41SDVWMjAuNUg2VjIxSDRWMjJIN1YxOEg0VjE5Wk01IDEwSDZWNkg0VjdINVYxMFpNNCAxM0g1LjhMNCAxNS4xVjE2SDdWMTVINS4yTDcgMTIuOVYxMkg0VjEzWk05IDdWOUgyM1Y3SDlaTTkgMjFIMjNWMTlIOVYyMVpNOSAxNUgyM1YxM0g5VjE1WiIvPgoJPC9nPgo8L3N2Zz4K", offlineBoltSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjE2Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTEyIDIuMDJjLTUuNTEgMC05Ljk4IDQuNDctOS45OCA5Ljk4czQuNDcgOS45OCA5Ljk4IDkuOTggOS45OC00LjQ3IDkuOTgtOS45OFMxNy41MSAyLjAyIDEyIDIuMDJ6TTExLjQ4IDIwdi02LjI2SDhMMTMgNHY2LjI2aDMuMzVMMTEuNDggMjB6Ii8+CiAgPC9nPgo8L3N2Zz4K", paletteSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTE4IDEzVjIwSDRWNkg5LjAyQzkuMDcgNS4yOSA5LjI0IDQuNjIgOS41IDRINEMyLjkgNCAyIDQuOSAyIDZWMjBDMiAyMS4xIDIuOSAyMiA0IDIySDE4QzE5LjEgMjIgMjAgMjEuMSAyMCAyMFYxNUwxOCAxM1pNMTkuMyA4Ljg5QzE5Ljc0IDguMTkgMjAgNy4zOCAyMCA2LjVDMjAgNC4wMSAxNy45OSAyIDE1LjUgMkMxMy4wMSAyIDExIDQuMDEgMTEgNi41QzExIDguOTkgMTMuMDEgMTEgMTUuNDkgMTFDMTYuMzcgMTEgMTcuMTkgMTAuNzQgMTcuODggMTAuM0wyMSAxMy40MkwyMi40MiAxMkwxOS4zIDguODlaTTE1LjUgOUMxNC4xMiA5IDEzIDcuODggMTMgNi41QzEzIDUuMTIgMTQuMTIgNCAxNS41IDRDMTYuODggNCAxOCA1LjEyIDE4IDYuNUMxOCA3Ljg4IDE2Ljg4IDkgMTUuNSA5WiIvPgogICAgPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00IDZIOS4wMTg5NEM5LjAwNjM5IDYuMTY1MDIgOSA2LjMzMTc2IDkgNi41QzkgOC44MTU3NyAxMC4yMTEgMTAuODQ4NyAxMi4wMzQzIDEySDlWMTRIMTZWMTIuOTgxMUMxNi41NzAzIDEyLjkzNzcgMTcuMTIgMTIuODIwNyAxNy42Mzk2IDEyLjYzOTZMMTggMTNWMjBINFY2Wk04IDhINlYxMEg4VjhaTTYgMTJIOFYxNEg2VjEyWk04IDE2SDZWMThIOFYxNlpNOSAxNkgxNlYxOEg5VjE2WiIvPgogIDwvZz4KPC9zdmc+Cg==", pasteSvgstr = "data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICAgICAgPHBhdGggZD0iTTE5IDJoLTQuMThDMTQuNC44NCAxMy4zIDAgMTIgMGMtMS4zIDAtMi40Ljg0LTIuODIgMkg1Yy0xLjEgMC0yIC45LTIgMnYxNmMwIDEuMS45IDIgMiAyaDE0YzEuMSAwIDItLjkgMi0yVjRjMC0xLjEtLjktMi0yLTJ6bS03IDBjLjU1IDAgMSAuNDUgMSAxcy0uNDUgMS0xIDEtMS0uNDUtMS0xIC40NS0xIDEtMXptNyAxOEg1VjRoMnYzaDEwVjRoMnYxNnoiLz4KICAgIDwvZz4KPC9zdmc+Cg==", pdfSvgstr = "data:image/svg+xml;base64,PHN2ZwogICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMiAyMiIgd2lkdGg9IjE2Ij4KICAgIDxwYXRoIHRyYW5zZm9ybT0icm90YXRlKDQ1KSIgY2xhc3M9ImpwLWljb24tc2VsZWN0YWJsZSIgZmlsbD0iI0ZGMkEyQSIKICAgICAgIGQ9Im0gMjIuMzQ0MzY5LC0zLjAxNjM2NDIgaCA1LjYzODYwNCB2IDEuNTc5MjQzMyBoIC0zLjU0OTIyNyB2IDEuNTA4NjkyOTkgaCAzLjMzNzU3NiBWIDEuNjUwODE1NCBoIC0zLjMzNzU3NiB2IDMuNDM1MjYxMyBoIC0yLjA4OTM3NyB6IG0gLTcuMTM2NDQ0LDEuNTc5MjQzMyB2IDQuOTQzOTU0MyBoIDAuNzQ4OTIgcSAxLjI4MDc2MSwwIDEuOTUzNzAzLC0wLjYzNDk1MzUgMC42NzgzNjksLTAuNjM0OTUzNSAwLjY3ODM2OSwtMS44NDUxNjQxIDAsLTEuMjA0NzgzNTUgLTAuNjcyOTQyLC0xLjgzNDMxMDExIC0wLjY3Mjk0MiwtMC42Mjk1MjY1OSAtMS45NTkxMywtMC42Mjk1MjY1OSB6IG0gLTIuMDg5Mzc3LC0xLjU3OTI0MzMgaCAyLjIwMzM0MyBxIDEuODQ1MTY0LDAgMi43NDYwMzksMC4yNjU5MjA3IDAuOTA2MzAxLDAuMjYwNDkzNyAxLjU1MjEwOCwwLjg5MDAyMDMgMC41Njk4MywwLjU0ODEyMjMgMC44NDY2MDUsMS4yNjQ0ODAwNiAwLjI3Njc3NCwwLjcxNjM1NzgxIDAuMjc2Nzc0LDEuNjIyNjU4OTQgMCwwLjkxNzE1NTEgLTAuMjc2Nzc0LDEuNjM4OTM5OSAtMC4yNzY3NzUsMC43MTYzNTc4IC0wLjg0NjYwNSwxLjI2NDQ4IC0wLjY1MTIzNCwwLjYyOTUyNjYgLTEuNTYyOTYyLDAuODk1NDQ3MyAtMC45MTE3MjgsMC4yNjA0OTM3IC0yLjczNTE4NSwwLjI2MDQ5MzcgaCAtMi4yMDMzNDMgeiBtIC04LjE0NTg1NjUsMCBoIDMuNDY3ODIzIHEgMS41NDY2ODE2LDAgMi4zNzE1Nzg1LDAuNjg5MjIzIDAuODMwMzI0LDAuNjgzNzk2MSAwLjgzMDMyNCwxLjk1MzcwMzE0IDAsMS4yNzUzMzM5NyAtMC44MzAzMjQsMS45NjQ1NTcwNiBRIDkuOTg3MTk2MSwyLjI3NDkxNSA4LjQ0MDUxNDUsMi4yNzQ5MTUgSCA3LjA2MjA2ODQgViA1LjA4NjA3NjcgSCA0Ljk3MjY5MTUgWiBtIDIuMDg5Mzc2OSwxLjUxNDExOTkgdiAyLjI2MzAzOTQzIGggMS4xNTU5NDEgcSAwLjYwNzgxODgsMCAwLjkzODg2MjksLTAuMjkzMDU1NDcgMC4zMzEwNDQxLC0wLjI5ODQ4MjQxIDAuMzMxMDQ0MSwtMC44NDExNzc3MiAwLC0wLjU0MjY5NTMxIC0wLjMzMTA0NDEsLTAuODM1NzUwNzQgLTAuMzMxMDQ0MSwtMC4yOTMwNTU1IC0wLjkzODg2MjksLTAuMjkzMDU1NSB6IgovPgo8L3N2Zz4K", pythonSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iLTEwIC0xMCAxMzEuMTYxMzYxNjk0MzM1OTQgMTMyLjM4ODk5OTkzODk2NDg0Ij4KICA8cGF0aCBjbGFzcz0ianAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjMzA2OTk4IiBkPSJNIDU0LjkxODc4NSw5LjE5Mjc0MjFlLTQgQyA1MC4zMzUxMzIsMC4wMjIyMTcyNyA0NS45NTc4NDYsMC40MTMxMzY5NyA0Mi4xMDYyODUsMS4wOTQ2NjkzIDMwLjc2MDA2OSwzLjA5OTE3MzEgMjguNzAwMDM2LDcuMjk0NzcxNCAyOC43MDAwMzUsMTUuMDMyMTY5IHYgMTAuMjE4NzUgaCAyNi44MTI1IHYgMy40MDYyNSBoIC0yNi44MTI1IC0xMC4wNjI1IGMgLTcuNzkyNDU5LDAgLTE0LjYxNTc1ODgsNC42ODM3MTcgLTE2Ljc0OTk5OTgsMTMuNTkzNzUgLTIuNDYxODE5OTgsMTAuMjEyOTY2IC0yLjU3MTAxNTA4LDE2LjU4NjAyMyAwLDI3LjI1IDEuOTA1OTI4Myw3LjkzNzg1MiA2LjQ1NzU0MzIsMTMuNTkzNzQ4IDE0LjI0OTk5OTgsMTMuNTkzNzUgaCA5LjIxODc1IHYgLTEyLjI1IGMgMCwtOC44NDk5MDIgNy42NTcxNDQsLTE2LjY1NjI0OCAxNi43NSwtMTYuNjU2MjUgaCAyNi43ODEyNSBjIDcuNDU0OTUxLDAgMTMuNDA2MjUzLC02LjEzODE2NCAxMy40MDYyNSwtMTMuNjI1IHYgLTI1LjUzMTI1IGMgMCwtNy4yNjYzMzg2IC02LjEyOTk4LC0xMi43MjQ3NzcxIC0xMy40MDYyNSwtMTMuOTM3NDk5NyBDIDY0LjI4MTU0OCwwLjMyNzk0Mzk3IDU5LjUwMjQzOCwtMC4wMjAzNzkwMyA1NC45MTg3ODUsOS4xOTI3NDIxZS00IFogbSAtMTQuNSw4LjIxODc1MDEyNTc5IGMgMi43Njk1NDcsMCA1LjAzMTI1LDIuMjk4NjQ1NiA1LjAzMTI1LDUuMTI0OTk5NiAtMmUtNiwyLjgxNjMzNiAtMi4yNjE3MDMsNS4wOTM3NSAtNS4wMzEyNSw1LjA5Mzc1IC0yLjc3OTQ3NiwtMWUtNiAtNS4wMzEyNSwtMi4yNzc0MTUgLTUuMDMxMjUsLTUuMDkzNzUgLTEwZS03LC0yLjgyNjM1MyAyLjI1MTc3NCwtNS4xMjQ5OTk2IDUuMDMxMjUsLTUuMTI0OTk5NiB6Ii8+CiAgPHBhdGggY2xhc3M9ImpwLWljb24tc2VsZWN0YWJsZSIgZmlsbD0iI2ZmZDQzYiIgZD0ibSA4NS42Mzc1MzUsMjguNjU3MTY5IHYgMTEuOTA2MjUgYyAwLDkuMjMwNzU1IC03LjgyNTg5NSwxNi45OTk5OTkgLTE2Ljc1LDE3IGggLTI2Ljc4MTI1IGMgLTcuMzM1ODMzLDAgLTEzLjQwNjI0OSw2LjI3ODQ4MyAtMTMuNDA2MjUsMTMuNjI1IHYgMjUuNTMxMjQ3IGMgMCw3LjI2NjM0NCA2LjMxODU4OCwxMS41NDAzMjQgMTMuNDA2MjUsMTMuNjI1MDA0IDguNDg3MzMxLDIuNDk1NjEgMTYuNjI2MjM3LDIuOTQ2NjMgMjYuNzgxMjUsMCA2Ljc1MDE1NSwtMS45NTQzOSAxMy40MDYyNTMsLTUuODg3NjEgMTMuNDA2MjUsLTEzLjYyNTAwNCBWIDg2LjUwMDkxOSBoIC0yNi43ODEyNSB2IC0zLjQwNjI1IGggMjYuNzgxMjUgMTMuNDA2MjU0IGMgNy43OTI0NjEsMCAxMC42OTYyNTEsLTUuNDM1NDA4IDEzLjQwNjI0MSwtMTMuNTkzNzUgMi43OTkzMywtOC4zOTg4ODYgMi42ODAyMiwtMTYuNDc1Nzc2IDAsLTI3LjI1IC0xLjkyNTc4LC03Ljc1NzQ0MSAtNS42MDM4NywtMTMuNTkzNzUgLTEzLjQwNjI0MSwtMTMuNTkzNzUgeiBtIC0xNS4wNjI1LDY0LjY1NjI1IGMgMi43Nzk0NzgsM2UtNiA1LjAzMTI1LDIuMjc3NDE3IDUuMDMxMjUsNS4wOTM3NDcgLTJlLTYsMi44MjYzNTQgLTIuMjUxNzc1LDUuMTI1MDA0IC01LjAzMTI1LDUuMTI1MDA0IC0yLjc2OTU1LDAgLTUuMDMxMjUsLTIuMjk4NjUgLTUuMDMxMjUsLTUuMTI1MDA0IDJlLTYsLTIuODE2MzMgMi4yNjE2OTcsLTUuMDkzNzQ3IDUuMDMxMjUsLTUuMDkzNzQ3IHoiLz4KPC9zdmc+Cg==", rKernelSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIyIDIyIj4KICA8cGF0aCBjbGFzcz0ianAtaWNvbi1jb250cmFzdDMganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjMjE5NkYzIiBkPSJNNC40IDIuNWMxLjItLjEgMi45LS4zIDQuOS0uMyAyLjUgMCA0LjEuNCA1LjIgMS4zIDEgLjcgMS41IDEuOSAxLjUgMy41IDAgMi0xLjQgMy41LTIuOSA0LjEgMS4yLjQgMS43IDEuNiAyLjIgMyAuNiAxLjkgMSAzLjkgMS4zIDQuNmgtMy44Yy0uMy0uNC0uOC0xLjctMS4yLTMuN3MtMS4yLTIuNi0yLjYtMi42aC0uOXY2LjRINC40VjIuNXptMy43IDYuOWgxLjRjMS45IDAgMi45LS45IDIuOS0yLjNzLTEtMi4zLTIuOC0yLjNjLS43IDAtMS4zIDAtMS42LjJ2NC41aC4xdi0uMXoiLz4KPC9zdmc+Cg==", reactSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMTUwIDE1MCA1NDEuOSAyOTUuMyI+CiAgPGcgY2xhc3M9ImpwLWljb24tYnJhbmQyIGpwLWljb24tc2VsZWN0YWJsZSIgZmlsbD0iIzYxREFGQiI+CiAgICA8cGF0aCBkPSJNNjY2LjMgMjk2LjVjMC0zMi41LTQwLjctNjMuMy0xMDMuMS04Mi40IDE0LjQtNjMuNiA4LTExNC4yLTIwLjItMTMwLjQtNi41LTMuOC0xNC4xLTUuNi0yMi40LTUuNnYyMi4zYzQuNiAwIDguMy45IDExLjQgMi42IDEzLjYgNy44IDE5LjUgMzcuNSAxNC45IDc1LjctMS4xIDkuNC0yLjkgMTkuMy01LjEgMjkuNC0xOS42LTQuOC00MS04LjUtNjMuNS0xMC45LTEzLjUtMTguNS0yNy41LTM1LjMtNDEuNi01MCAzMi42LTMwLjMgNjMuMi00Ni45IDg0LTQ2LjlWNzhjLTI3LjUgMC02My41IDE5LjYtOTkuOSA1My42LTM2LjQtMzMuOC03Mi40LTUzLjItOTkuOS01My4ydjIyLjNjMjAuNyAwIDUxLjQgMTYuNSA4NCA0Ni42LTE0IDE0LjctMjggMzEuNC00MS4zIDQ5LjktMjIuNiAyLjQtNDQgNi4xLTYzLjYgMTEtMi4zLTEwLTQtMTkuNy01LjItMjktNC43LTM4LjIgMS4xLTY3LjkgMTQuNi03NS44IDMtMS44IDYuOS0yLjYgMTEuNS0yLjZWNzguNWMtOC40IDAtMTYgMS44LTIyLjYgNS42LTI4LjEgMTYuMi0zNC40IDY2LjctMTkuOSAxMzAuMS02Mi4yIDE5LjItMTAyLjcgNDkuOS0xMDIuNyA4Mi4zIDAgMzIuNSA0MC43IDYzLjMgMTAzLjEgODIuNC0xNC40IDYzLjYtOCAxMTQuMiAyMC4yIDEzMC40IDYuNSAzLjggMTQuMSA1LjYgMjIuNSA1LjYgMjcuNSAwIDYzLjUtMTkuNiA5OS45LTUzLjYgMzYuNCAzMy44IDcyLjQgNTMuMiA5OS45IDUzLjIgOC40IDAgMTYtMS44IDIyLjYtNS42IDI4LjEtMTYuMiAzNC40LTY2LjcgMTkuOS0xMzAuMSA2Mi0xOS4xIDEwMi41LTQ5LjkgMTAyLjUtODIuM3ptLTEzMC4yLTY2LjdjLTMuNyAxMi45LTguMyAyNi4yLTEzLjUgMzkuNS00LjEtOC04LjQtMTYtMTMuMS0yNC00LjYtOC05LjUtMTUuOC0xNC40LTIzLjQgMTQuMiAyLjEgMjcuOSA0LjcgNDEgNy45em0tNDUuOCAxMDYuNWMtNy44IDEzLjUtMTUuOCAyNi4zLTI0LjEgMzguMi0xNC45IDEuMy0zMCAyLTQ1LjIgMi0xNS4xIDAtMzAuMi0uNy00NS0xLjktOC4zLTExLjktMTYuNC0yNC42LTI0LjItMzgtNy42LTEzLjEtMTQuNS0yNi40LTIwLjgtMzkuOCA2LjItMTMuNCAxMy4yLTI2LjggMjAuNy0zOS45IDcuOC0xMy41IDE1LjgtMjYuMyAyNC4xLTM4LjIgMTQuOS0xLjMgMzAtMiA0NS4yLTIgMTUuMSAwIDMwLjIuNyA0NSAxLjkgOC4zIDExLjkgMTYuNCAyNC42IDI0LjIgMzggNy42IDEzLjEgMTQuNSAyNi40IDIwLjggMzkuOC02LjMgMTMuNC0xMy4yIDI2LjgtMjAuNyAzOS45em0zMi4zLTEzYzUuNCAxMy40IDEwIDI2LjggMTMuOCAzOS44LTEzLjEgMy4yLTI2LjkgNS45LTQxLjIgOCA0LjktNy43IDkuOC0xNS42IDE0LjQtMjMuNyA0LjYtOCA4LjktMTYuMSAxMy0yNC4xek00MjEuMiA0MzBjLTkuMy05LjYtMTguNi0yMC4zLTI3LjgtMzIgOSAuNCAxOC4yLjcgMjcuNS43IDkuNCAwIDE4LjctLjIgMjcuOC0uNy05IDExLjctMTguMyAyMi40LTI3LjUgMzJ6bS03NC40LTU4LjljLTE0LjItMi4xLTI3LjktNC43LTQxLTcuOSAzLjctMTIuOSA4LjMtMjYuMiAxMy41LTM5LjUgNC4xIDggOC40IDE2IDEzLjEgMjQgNC43IDggOS41IDE1LjggMTQuNCAyMy40ek00MjAuNyAxNjNjOS4zIDkuNiAxOC42IDIwLjMgMjcuOCAzMi05LS40LTE4LjItLjctMjcuNS0uNy05LjQgMC0xOC43LjItMjcuOC43IDktMTEuNyAxOC4zLTIyLjQgMjcuNS0zMnptLTc0IDU4LjljLTQuOSA3LjctOS44IDE1LjYtMTQuNCAyMy43LTQuNiA4LTguOSAxNi0xMyAyNC01LjQtMTMuNC0xMC0yNi44LTEzLjgtMzkuOCAxMy4xLTMuMSAyNi45LTUuOCA0MS4yLTcuOXptLTkwLjUgMTI1LjJjLTM1LjQtMTUuMS01OC4zLTM0LjktNTguMy01MC42IDAtMTUuNyAyMi45LTM1LjYgNTguMy01MC42IDguNi0zLjcgMTgtNyAyNy43LTEwLjEgNS43IDE5LjYgMTMuMiA0MCAyMi41IDYwLjktOS4yIDIwLjgtMTYuNiA0MS4xLTIyLjIgNjAuNi05LjktMy4xLTE5LjMtNi41LTI4LTEwLjJ6TTMxMCA0OTBjLTEzLjYtNy44LTE5LjUtMzcuNS0xNC45LTc1LjcgMS4xLTkuNCAyLjktMTkuMyA1LjEtMjkuNCAxOS42IDQuOCA0MSA4LjUgNjMuNSAxMC45IDEzLjUgMTguNSAyNy41IDM1LjMgNDEuNiA1MC0zMi42IDMwLjMtNjMuMiA0Ni45LTg0IDQ2LjktNC41LS4xLTguMy0xLTExLjMtMi43em0yMzcuMi03Ni4yYzQuNyAzOC4yLTEuMSA2Ny45LTE0LjYgNzUuOC0zIDEuOC02LjkgMi42LTExLjUgMi42LTIwLjcgMC01MS40LTE2LjUtODQtNDYuNiAxNC0xNC43IDI4LTMxLjQgNDEuMy00OS45IDIyLjYtMi40IDQ0LTYuMSA2My42LTExIDIuMyAxMC4xIDQuMSAxOS44IDUuMiAyOS4xem0zOC41LTY2LjdjLTguNiAzLjctMTggNy0yNy43IDEwLjEtNS43LTE5LjYtMTMuMi00MC0yMi41LTYwLjkgOS4yLTIwLjggMTYuNi00MS4xIDIyLjItNjAuNiA5LjkgMy4xIDE5LjMgNi41IDI4LjEgMTAuMiAzNS40IDE1LjEgNTguMyAzNC45IDU4LjMgNTAuNi0uMSAxNS43LTIzIDM1LjYtNTguNCA1MC42ek0zMjAuOCA3OC40eiIvPgogICAgPGNpcmNsZSBjeD0iNDIwLjkiIGN5PSIyOTYuNSIgcj0iNDUuNyIvPgogIDwvZz4KPC9zdmc+Cg==", redoSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjE2Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgICA8cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTE4LjQgMTAuNkMxNi41NSA4Ljk5IDE0LjE1IDggMTEuNSA4Yy00LjY1IDAtOC41OCAzLjAzLTkuOTYgNy4yMkwzLjkgMTZjMS4wNS0zLjE5IDQuMDUtNS41IDcuNi01LjUgMS45NSAwIDMuNzMuNzIgNS4xMiAxLjg4TDEzIDE2aDlWN2wtMy42IDMuNnoiLz4KICA8L2c+Cjwvc3ZnPgo=", regexSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIwIDIwIj4KICA8ZyBjbGFzcz0ianAtaWNvbjIiIGZpbGw9IiM0MTQxNDEiPgogICAgPHJlY3QgeD0iMiIgeT0iMiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+CiAgPC9nPgoKICA8ZyBjbGFzcz0ianAtaWNvbi1hY2NlbnQyIiBmaWxsPSIjRkZGIj4KICAgIDxjaXJjbGUgY2xhc3M9InN0MiIgY3g9IjUuNSIgY3k9IjE0LjUiIHI9IjEuNSIvPgogICAgPHJlY3QgeD0iMTIiIHk9IjQiIGNsYXNzPSJzdDIiIHdpZHRoPSIxIiBoZWlnaHQ9IjgiLz4KICAgIDxyZWN0IHg9IjguNSIgeT0iNy41IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjg2NiAtMC41IDAuNSAwLjg2NiAtMi4zMjU1IDcuMzIxOSkiIGNsYXNzPSJzdDIiIHdpZHRoPSI4IiBoZWlnaHQ9IjEiLz4KICAgIDxyZWN0IHg9IjEyIiB5PSI0IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjUgLTAuODY2IDAuODY2IDAuNSAtMC42Nzc5IDE0LjgyNTIpIiBjbGFzcz0ic3QyIiB3aWR0aD0iMSIgaGVpZ2h0PSI4Ii8+CiAgPC9nPgo8L3N2Zz4K", runSvgstr = "data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICAgICAgPHBhdGggZD0iTTggNXYxNGwxMS03eiIvPgogICAgPC9nPgo8L3N2Zz4K", runningSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDUxMiA1MTIiPgogIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICA8cGF0aCBkPSJNMjU2IDhDMTE5IDggOCAxMTkgOCAyNTZzMTExIDI0OCAyNDggMjQ4IDI0OC0xMTEgMjQ4LTI0OFMzOTMgOCAyNTYgOHptOTYgMzI4YzAgOC44LTcuMiAxNi0xNiAxNkgxNzZjLTguOCAwLTE2LTcuMi0xNi0xNlYxNzZjMC04LjggNy4yLTE2IDE2LTE2aDE2MGM4LjggMCAxNiA3LjIgMTYgMTZ2MTYweiIvPgogIDwvZz4KPC9zdmc+Cg==", saveSvgstr = "data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICAgICAgPHBhdGggZD0iTTE3IDNINWMtMS4xMSAwLTIgLjktMiAydjE0YzAgMS4xLjg5IDIgMiAyaDE0YzEuMSAwIDItLjkgMi0yVjdsLTQtNHptLTUgMTZjLTEuNjYgMC0zLTEuMzQtMy0zczEuMzQtMyAzLTMgMyAxLjM0IDMgMy0xLjM0IDMtMyAzem0zLTEwSDVWNWgxMHY0eiIvPgogICAgPC9nPgo8L3N2Zz4K", searchSvgstr = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTggMTgiIHdpZHRoPSIxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTEyLjEsMTAuOWgtMC43bC0wLjItMC4yYzAuOC0wLjksMS4zLTIuMiwxLjMtMy41YzAtMy0yLjQtNS40LTUuNC01LjRTMS44LDQuMiwxLjgsNy4xczIuNCw1LjQsNS40LDUuNCBjMS4zLDAsMi41LTAuNSwzLjUtMS4zbDAuMiwwLjJ2MC43bDQuMSw0LjFsMS4yLTEuMkwxMi4xLDEwLjl6IE03LjEsMTAuOWMtMi4xLDAtMy43LTEuNy0zLjctMy43czEuNy0zLjcsMy43LTMuN3MzLjcsMS43LDMuNywzLjcgUzkuMiwxMC45LDcuMSwxMC45eiIvPgogIDwvZz4KPC9zdmc+Cg==", settingsSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8cGF0aCBjbGFzcz0ianAtaWNvbjMganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjNjE2MTYxIiBkPSJNMTkuNDMgMTIuOThjLjA0LS4zMi4wNy0uNjQuMDctLjk4cy0uMDMtLjY2LS4wNy0uOThsMi4xMS0xLjY1Yy4xOS0uMTUuMjQtLjQyLjEyLS42NGwtMi0zLjQ2Yy0uMTItLjIyLS4zOS0uMy0uNjEtLjIybC0yLjQ5IDFjLS41Mi0uNC0xLjA4LS43My0xLjY5LS45OGwtLjM4LTIuNjVBLjQ4OC40ODggMCAwMDE0IDJoLTRjLS4yNSAwLS40Ni4xOC0uNDkuNDJsLS4zOCAyLjY1Yy0uNjEuMjUtMS4xNy41OS0xLjY5Ljk4bC0yLjQ5LTFjLS4yMy0uMDktLjQ5IDAtLjYxLjIybC0yIDMuNDZjLS4xMy4yMi0uMDcuNDkuMTIuNjRsMi4xMSAxLjY1Yy0uMDQuMzItLjA3LjY1LS4wNy45OHMuMDMuNjYuMDcuOThsLTIuMTEgMS42NWMtLjE5LjE1LS4yNC40Mi0uMTIuNjRsMiAzLjQ2Yy4xMi4yMi4zOS4zLjYxLjIybDIuNDktMWMuNTIuNCAxLjA4LjczIDEuNjkuOThsLjM4IDIuNjVjLjAzLjI0LjI0LjQyLjQ5LjQyaDRjLjI1IDAgLjQ2LS4xOC40OS0uNDJsLjM4LTIuNjVjLjYxLS4yNSAxLjE3LS41OSAxLjY5LS45OGwyLjQ5IDFjLjIzLjA5LjQ5IDAgLjYxLS4yMmwyLTMuNDZjLjEyLS4yMi4wNy0uNDktLjEyLS42NGwtMi4xMS0xLjY1ek0xMiAxNS41Yy0xLjkzIDAtMy41LTEuNTctMy41LTMuNXMxLjU3LTMuNSAzLjUtMy41IDMuNSAxLjU3IDMuNSAzLjUtMS41NyAzLjUtMy41IDMuNXoiLz4KPC9zdmc+Cg==", shareSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTSAxOCAyIEMgMTYuMzU0OTkgMiAxNSAzLjM1NDk5MDQgMTUgNSBDIDE1IDUuMTkwOTUyOSAxNS4wMjE3OTEgNS4zNzcxMjI0IDE1LjA1NjY0MSA1LjU1ODU5MzggTCA3LjkyMTg3NSA5LjcyMDcwMzEgQyA3LjM5ODUzOTkgOS4yNzc4NTM5IDYuNzMyMDc3MSA5IDYgOSBDIDQuMzU0OTkwNCA5IDMgMTAuMzU0OTkgMyAxMiBDIDMgMTMuNjQ1MDEgNC4zNTQ5OTA0IDE1IDYgMTUgQyA2LjczMjA3NzEgMTUgNy4zOTg1Mzk5IDE0LjcyMjE0NiA3LjkyMTg3NSAxNC4yNzkyOTcgTCAxNS4wNTY2NDEgMTguNDM5NDUzIEMgMTUuMDIxNTU1IDE4LjYyMTUxNCAxNSAxOC44MDgzODYgMTUgMTkgQyAxNSAyMC42NDUwMSAxNi4zNTQ5OSAyMiAxOCAyMiBDIDE5LjY0NTAxIDIyIDIxIDIwLjY0NTAxIDIxIDE5IEMgMjEgMTcuMzU0OTkgMTkuNjQ1MDEgMTYgMTggMTYgQyAxNy4yNjc0OCAxNiAxNi42MDE1OTMgMTYuMjc5MzI4IDE2LjA3ODEyNSAxNi43MjI2NTYgTCA4Ljk0MzM1OTQgMTIuNTU4NTk0IEMgOC45NzgyMDk1IDEyLjM3NzEyMiA5IDEyLjE5MDk1MyA5IDEyIEMgOSAxMS44MDkwNDcgOC45NzgyMDk1IDExLjYyMjg3OCA4Ljk0MzM1OTQgMTEuNDQxNDA2IEwgMTYuMDc4MTI1IDcuMjc5Mjk2OSBDIDE2LjYwMTQ2IDcuNzIyMTQ2MSAxNy4yNjc5MjMgOCAxOCA4IEMgMTkuNjQ1MDEgOCAyMSA2LjY0NTAwOTYgMjEgNSBDIDIxIDMuMzU0OTkwNCAxOS42NDUwMSAyIDE4IDIgeiBNIDE4IDQgQyAxOC41NjQxMjkgNCAxOSA0LjQzNTg3MDYgMTkgNSBDIDE5IDUuNTY0MTI5NCAxOC41NjQxMjkgNiAxOCA2IEMgMTcuNDM1ODcxIDYgMTcgNS41NjQxMjk0IDE3IDUgQyAxNyA0LjQzNTg3MDYgMTcuNDM1ODcxIDQgMTggNCB6IE0gNiAxMSBDIDYuNTY0MTI5NCAxMSA3IDExLjQzNTg3MSA3IDEyIEMgNyAxMi41NjQxMjkgNi41NjQxMjk0IDEzIDYgMTMgQyA1LjQzNTg3MDYgMTMgNSAxMi41NjQxMjkgNSAxMiBDIDUgMTEuNDM1ODcxIDUuNDM1ODcwNiAxMSA2IDExIHogTSAxOCAxOCBDIDE4LjU2NDEyOSAxOCAxOSAxOC40MzU4NzEgMTkgMTkgQyAxOSAxOS41NjQxMjkgMTguNTY0MTI5IDIwIDE4IDIwIEMgMTcuNDM1ODcxIDIwIDE3IDE5LjU2NDEyOSAxNyAxOSBDIDE3IDE4LjQzNTg3MSAxNy40MzU4NzEgMTggMTggMTggeiIvPgogIDwvZz4KPC9zdmc+Cg==", spreadsheetSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIyIDIyIj4KICA8cGF0aCBjbGFzcz0ianAtaWNvbi1jb250cmFzdDEganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjNENBRjUwIiBkPSJNMi4yIDIuMnYxNy42aDE3LjZWMi4ySDIuMnptMTUuNCA3LjdoLTUuNVY0LjRoNS41djUuNXpNOS45IDQuNHY1LjVINC40VjQuNGg1LjV6bS01LjUgNy43aDUuNXY1LjVINC40di01LjV6bTcuNyA1LjV2LTUuNWg1LjV2NS41aC01LjV6Ii8+Cjwvc3ZnPgo=", stopSvgstr = "data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICAgICAgPHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPgogICAgICAgIDxwYXRoIGQ9Ik02IDZoMTJ2MTJINnoiLz4KICAgIDwvZz4KPC9zdmc+Cg==", tabSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTIxIDNIM2MtMS4xIDAtMiAuOS0yIDJ2MTRjMCAxLjEuOSAyIDIgMmgxOGMxLjEgMCAyLS45IDItMlY1YzAtMS4xLS45LTItMi0yem0wIDE2SDNWNWgxMHY0aDh2MTB6Ii8+CiAgPC9nPgo8L3N2Zz4K", tableRowsSvgstr = "data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICAgICAgPHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPgogICAgICAgIDxwYXRoIGQ9Ik0yMSw4SDNWNGgxOFY4eiBNMjEsMTBIM3Y0aDE4VjEweiBNMjEsMTZIM3Y0aDE4VjE2eiIvPgogICAgPC9nPgo8L3N2Zz4K", tagSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjgiIGhlaWdodD0iMjgiIHZpZXdCb3g9IjAgMCA0MyAyOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KCTxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CgkJPHBhdGggZD0iTTI4LjgzMzIgMTIuMzM0TDMyLjk5OTggMTYuNTAwN0wzNy4xNjY1IDEyLjMzNEgyOC44MzMyWiIvPgoJCTxwYXRoIGQ9Ik0xNi4yMDk1IDIxLjYxMDRDMTUuNjg3MyAyMi4xMjk5IDE0Ljg0NDMgMjIuMTI5OSAxNC4zMjQ4IDIxLjYxMDRMNi45ODI5IDE0LjcyNDVDNi41NzI0IDE0LjMzOTQgNi4wODMxMyAxMy42MDk4IDYuMDQ3ODYgMTMuMDQ4MkM1Ljk1MzQ3IDExLjUyODggNi4wMjAwMiA4LjYxOTQ0IDYuMDY2MjEgNy4wNzY5NUM2LjA4MjgxIDYuNTE0NzcgNi41NTU0OCA2LjA0MzQ3IDcuMTE4MDQgNi4wMzA1NUM5LjA4ODYzIDUuOTg0NzMgMTMuMjYzOCA1LjkzNTc5IDEzLjY1MTggNi4zMjQyNUwyMS43MzY5IDEzLjYzOUMyMi4yNTYgMTQuMTU4NSAyMS43ODUxIDE1LjQ3MjQgMjEuMjYyIDE1Ljk5NDZMMTYuMjA5NSAyMS42MTA0Wk05Ljc3NTg1IDguMjY1QzkuMzM1NTEgNy44MjU2NiA4LjYyMzUxIDcuODI1NjYgOC4xODI4IDguMjY1QzcuNzQzNDYgOC43MDU3MSA3Ljc0MzQ2IDkuNDE3MzMgOC4xODI4IDkuODU2NjdDOC42MjM4MiAxMC4yOTY0IDkuMzM1ODIgMTAuMjk2NCA5Ljc3NTg1IDkuODU2NjdDMTAuMjE1NiA5LjQxNzMzIDEwLjIxNTYgOC43MDUzMyA5Ljc3NTg1IDguMjY1WiIvPgoJPC9nPgo8L3N2Zz4K", terminalSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiA+CiAgICA8cmVjdCBjbGFzcz0ianAtdGVybWluYWwtaWNvbi1iYWNrZ3JvdW5kLWNvbG9yIGpwLWljb24tc2VsZWN0YWJsZSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjIwIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyIDIpIiBmaWxsPSIjMzMzMzMzIi8+CiAgICA8cGF0aCBjbGFzcz0ianAtdGVybWluYWwtaWNvbi1jb2xvciBqcC1pY29uLXNlbGVjdGFibGUtaW52ZXJzZSIgZD0iTTUuMDU2NjQgOC43NjE3MkM1LjA1NjY0IDguNTk3NjYgNS4wMzEyNSA4LjQ1MzEyIDQuOTgwNDcgOC4zMjgxMkM0LjkzMzU5IDguMTk5MjIgNC44NTU0NyA4LjA4MjAzIDQuNzQ2MDkgNy45NzY1NkM0LjY0MDYyIDcuODcxMDkgNC41IDcuNzc1MzkgNC4zMjQyMiA3LjY4OTQ1QzQuMTUyMzQgNy41OTk2MSAzLjk0MzM2IDcuNTExNzIgMy42OTcyNyA3LjQyNTc4QzMuMzAyNzMgNy4yODUxNiAyLjk0MzM2IDcuMTM2NzIgMi42MTkxNCA2Ljk4MDQ3QzIuMjk0OTIgNi44MjQyMiAyLjAxNzU4IDYuNjQyNTggMS43ODcxMSA2LjQzNTU1QzEuNTYwNTUgNi4yMjg1MiAxLjM4NDc3IDUuOTg4MjggMS4yNTk3NyA1LjcxNDg0QzEuMTM0NzcgNS40Mzc1IDEuMDcyMjcgNS4xMDkzOCAxLjA3MjI3IDQuNzMwNDdDMS4wNzIyNyA0LjM5ODQ0IDEuMTI4OTEgNC4wOTU3IDEuMjQyMTkgMy44MjIyN0MxLjM1NTQ3IDMuNTQ0OTIgMS41MTU2MiAzLjMwNDY5IDEuNzIyNjYgMy4xMDE1NkMxLjkyOTY5IDIuODk4NDQgMi4xNzk2OSAyLjczNDM3IDIuNDcyNjYgMi42MDkzOEMyLjc2NTYyIDIuNDg0MzggMy4wOTE4IDIuNDA0MyAzLjQ1MTE3IDIuMzY5MTRWMS4xMDkzOEg0LjM4ODY3VjIuMzgwODZDNC43NDAyMyAyLjQyNzczIDUuMDU2NjQgMi41MjM0NCA1LjMzNzg5IDIuNjY3OTdDNS42MTkxNCAyLjgxMjUgNS44NTc0MiAzLjAwMTk1IDYuMDUyNzMgMy4yMzYzM0M2LjI1MTk1IDMuNDY2OCA2LjQwNDMgMy43NDAyMyA2LjUwOTc3IDQuMDU2NjRDNi42MTkxNCA0LjM2OTE0IDYuNjczODMgNC43MjA3IDYuNjczODMgNS4xMTEzM0g1LjA0NDkyQzUuMDQ0OTIgNC42Mzg2NyA0LjkzNzUgNC4yODEyNSA0LjcyMjY2IDQuMDM5MDZDNC41MDc4MSAzLjc5Mjk3IDQuMjE2OCAzLjY2OTkyIDMuODQ5NjEgMy42Njk5MkMzLjY1MDM5IDMuNjY5OTIgMy40NzY1NiAzLjY5NzI3IDMuMzI4MTIgMy43NTE5NUMzLjE4MzU5IDMuODAyNzMgMy4wNjQ0NSAzLjg3Njk1IDIuOTcwNyAzLjk3NDYxQzIuODc2OTUgNC4wNjgzNiAyLjgwNjY0IDQuMTc5NjkgMi43NTk3NyA0LjMwODU5QzIuNzE2OCA0LjQzNzUgMi42OTUzMSA0LjU3ODEyIDIuNjk1MzEgNC43MzA0N0MyLjY5NTMxIDQuODgyODEgMi43MTY4IDUuMDE5NTMgMi43NTk3NyA1LjE0MDYyQzIuODA2NjQgNS4yNTc4MSAyLjg4MjgxIDUuMzY3MTkgMi45ODgyOCA1LjQ2ODc1QzMuMDk3NjYgNS41NzAzMSAzLjI0MDIzIDUuNjY3OTcgMy40MTYwMiA1Ljc2MTcyQzMuNTkxOCA1Ljg1MTU2IDMuODEwNTUgNS45NDMzNiA0LjA3MjI3IDYuMDM3MTFDNC40NjY4IDYuMTg1NTUgNC44MjQyMiA2LjMzOTg0IDUuMTQ0NTMgNi41QzUuNDY0ODQgNi42NTYyNSA1LjczODI4IDYuODM5ODQgNS45NjQ4NCA3LjA1MDc4QzYuMTk1MzEgNy4yNTc4MSA2LjM3MTA5IDcuNSA2LjQ5MjE5IDcuNzc3MzRDNi42MTcxOSA4LjA1MDc4IDYuNjc5NjkgOC4zNzUgNi42Nzk2OSA4Ljc1QzYuNjc5NjkgOS4wOTM3NSA2LjYyMzA1IDkuNDA0MyA2LjUwOTc3IDkuNjgxNjRDNi4zOTY0OCA5Ljk1NTA4IDYuMjM0MzggMTAuMTkxNCA2LjAyMzQ0IDEwLjM5MDZDNS44MTI1IDEwLjU4OTggNS41NTg1OSAxMC43NSA1LjI2MTcyIDEwLjg3MTFDNC45NjQ4NCAxMC45ODgzIDQuNjMyODEgMTEuMDY0NSA0LjI2NTYyIDExLjA5OTZWMTIuMjQ4SDMuMzMzOThWMTEuMDk5NkMzLjAwMTk1IDExLjA2ODQgMi42Nzk2OSAxMC45OTYxIDIuMzY3MTkgMTAuODgyOEMyLjA1NDY5IDEwLjc2NTYgMS43NzczNCAxMC41OTc3IDEuNTM1MTYgMTAuMzc4OUMxLjI5Njg4IDEwLjE2MDIgMS4xMDU0NyA5Ljg4NDc3IDAuOTYwOTM4IDkuNTUyNzNDMC44MTY0MDYgOS4yMTY4IDAuNzQ0MTQxIDguODE0NDUgMC43NDQxNDEgOC4zNDU3SDIuMzc4OTFDMi4zNzg5MSA4LjYyNjk1IDIuNDE5OTIgOC44NjMyOCAyLjUwMTk1IDkuMDU0NjlDMi41ODM5OCA5LjI0MjE5IDIuNjg5NDUgOS4zOTI1OCAyLjgxODM2IDkuNTA1ODZDMi45NTExNyA5LjYxNTIzIDMuMTAxNTYgOS42OTMzNiAzLjI2OTUzIDkuNzQwMjNDMy40Mzc1IDkuNzg3MTEgMy42MDkzOCA5LjgxMDU1IDMuNzg1MTYgOS44MTA1NUM0LjIwMzEyIDkuODEwNTUgNC41MTk1MyA5LjcxMjg5IDQuNzM0MzggOS41MTc1OEM0Ljk0OTIyIDkuMzIyMjcgNS4wNTY2NCA5LjA3MDMxIDUuMDU2NjQgOC43NjE3MlpNMTMuNDE4IDEyLjI3MTVIOC4wNzQyMlYxMUgxMy40MThWMTIuMjcxNVoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDMuOTUyNjQgNikiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=", textEditorSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8cGF0aCBjbGFzcz0ianAtdGV4dC1lZGl0b3ItaWNvbi1jb2xvciBqcC1pY29uLXNlbGVjdGFibGUiIGZpbGw9IiM2MTYxNjEiIGQ9Ik0xNSAxNUgzdjJoMTJ2LTJ6bTAtOEgzdjJoMTJWN3pNMyAxM2gxOHYtMkgzdjJ6bTAgOGgxOHYtMkgzdjJ6TTMgM3YyaDE4VjNIM3oiLz4KPC9zdmc+Cg==", tocSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBjbGFzcz0ianAtaWNvbjMganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjNjE2MTYxIj4KICAgIDxwYXRoIGQ9Ik03LDVIMjFWN0g3VjVNNywxM1YxMUgyMVYxM0g3TTQsNC41QTEuNSwxLjUgMCAwLDEgNS41LDZBMS41LDEuNSAwIDAsMSA0LDcuNUExLjUsMS41IDAgMCwxIDIuNSw2QTEuNSwxLjUgMCAwLDEgNCw0LjVNNCwxMC41QTEuNSwxLjUgMCAwLDEgNS41LDEyQTEuNSwxLjUgMCAwLDEgNCwxMy41QTEuNSwxLjUgMCAwLDEgMi41LDEyQTEuNSwxLjUgMCAwLDEgNCwxMC41TTcsMTlWMTdIMjFWMTlIN000LDE2LjVBMS41LDEuNSAwIDAsMSA1LjUsMThBMS41LDEuNSAwIDAsMSA0LDE5LjVBMS41LDEuNSAwIDAsMSAyLjUsMThBMS41LDEuNSAwIDAsMSA0LDE2LjVaIiAvPgogIDwvZz4KPC9zdmc+Cg==", treeViewSvgstr = "data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICAgICAgPHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPgogICAgICAgIDxwYXRoIGQ9Ik0yMiAxMVYzaC03djNIOVYzSDJ2OGg3VjhoMnYxMGg0djNoN3YtOGgtN3YzaC0yVjhoMnYzeiIvPgogICAgPC9nPgo8L3N2Zz4K", trustedSvgstr = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDI0IDI1Ij4KICAgIDxwYXRoIGNsYXNzPSJqcC1pY29uMiIgc3Ryb2tlPSIjMzMzMzMzIiBzdHJva2Utd2lkdGg9IjIiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIgMykiIGQ9Ik0xLjg2MDk0IDExLjQ0MDlDMC44MjY0NDggOC43NzAyNyAwLjg2Mzc3OSA2LjA1NzY0IDEuMjQ5MDcgNC4xOTkzMkMyLjQ4MjA2IDMuOTMzNDcgNC4wODA2OCAzLjQwMzQ3IDUuNjAxMDIgMi44NDQ5QzcuMjM1NDkgMi4yNDQ0IDguODU2NjYgMS41ODE1IDkuOTg3NiAxLjA5NTM5QzExLjA1OTcgMS41ODM0MSAxMi42MDk0IDIuMjQ0NCAxNC4yMTggMi44NDMzOUMxNS43NTAzIDMuNDEzOTQgMTcuMzk5NSAzLjk1MjU4IDE4Ljc1MzkgNC4yMTM4NUMxOS4xMzY0IDYuMDcxNzcgMTkuMTcwOSA4Ljc3NzIyIDE4LjEzOSAxMS40NDA5QzE3LjAzMDMgMTQuMzAzMiAxNC42NjY4IDE3LjE4NDQgOS45OTk5OSAxOC45MzU0QzUuMzMzMiAxNy4xODQ0IDIuOTY5NjggMTQuMzAzMiAxLjg2MDk0IDExLjQ0MDlaIi8+CiAgICA8cGF0aCBjbGFzcz0ianAtaWNvbjIiIGZpbGw9IiMzMzMzMzMiIHN0cm9rZT0iIzMzMzMzMyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoOCA5Ljg2NzE5KSIgZD0iTTIuODYwMTUgNC44NjUzNUwwLjcyNjU0OSAyLjk5OTU5TDAgMy42MzA0NUwyLjg2MDE1IDYuMTMxNTdMOCAwLjYzMDg3Mkw3LjI3ODU3IDBMMi44NjAxNSA0Ljg2NTM1WiIvPgo8L3N2Zz4K", undoSvgstr = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTEyLjUgOGMtMi42NSAwLTUuMDUuOTktNi45IDIuNkwyIDd2OWg5bC0zLjYyLTMuNjJjMS4zOS0xLjE2IDMuMTYtMS44OCA1LjEyLTEuODggMy41NCAwIDYuNTUgMi4zMSA3LjYgNS41bDIuMzctLjc4QzIxLjA4IDExLjAzIDE3LjE1IDggMTIuNSA4eiIvPgogIDwvZz4KPC9zdmc+Cg==", userSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBjbGFzcz0ianAtaWNvbjMiIGZpbGw9IiM2MTYxNjEiPgogICAgPHBhdGggZD0iTTE2IDdhNCA0IDAgMTEtOCAwIDQgNCAwIDAxOCAwek0xMiAxNGE3IDcgMCAwMC03IDdoMTRhNyA3IDAgMDAtNy03eiIvPgogIDwvZz4KPC9zdmc+Cg==", usersSvgstr = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDM2IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogPGcgY2xhc3M9ImpwLWljb24zIiB0cmFuc2Zvcm09Im1hdHJpeCgxLjczMjcgMCAwIDEuNzMyNyAtMy42MjgyIC4wOTk1NzcpIiBmaWxsPSIjNjE2MTYxIj4KICA8cGF0aCB0cmFuc2Zvcm09Im1hdHJpeCgxLjUsMCwwLDEuNSwwLC02KSIgZD0ibTEyLjE4NiA3LjUwOThjLTEuMDUzNSAwLTEuOTc1NyAwLjU2NjUtMi40Nzg1IDEuNDEwMiAwLjc1MDYxIDAuMzEyNzcgMS4zOTc0IDAuODI2NDggMS44NzMgMS40NzI3aDMuNDg2M2MwLTEuNTkyLTEuMjg4OS0yLjg4MjgtMi44ODA5LTIuODgyOHoiLz4KICA8cGF0aCBkPSJtMjAuNDY1IDIuMzg5NWEyLjE4ODUgMi4xODg1IDAgMCAxLTIuMTg4NCAyLjE4ODUgMi4xODg1IDIuMTg4NSAwIDAgMS0yLjE4ODUtMi4xODg1IDIuMTg4NSAyLjE4ODUgMCAwIDEgMi4xODg1LTIuMTg4NSAyLjE4ODUgMi4xODg1IDAgMCAxIDIuMTg4NCAyLjE4ODV6Ii8+CiAgPHBhdGggdHJhbnNmb3JtPSJtYXRyaXgoMS41LDAsMCwxLjUsMCwtNikiIGQ9Im0zLjU4OTggOC40MjE5Yy0xLjExMjYgMC0yLjAxMzcgMC45MDExMS0yLjAxMzcgMi4wMTM3aDIuODE0NWMwLjI2Nzk3LTAuMzczMDkgMC41OTA3LTAuNzA0MzUgMC45NTg5OC0wLjk3ODUyLTAuMzQ0MzMtMC42MTY4OC0xLjAwMzEtMS4wMzUyLTEuNzU5OC0xLjAzNTJ6Ii8+CiAgPHBhdGggZD0ibTYuOTE1NCA0LjYyM2ExLjUyOTQgMS41Mjk0IDAgMCAxLTEuNTI5NCAxLjUyOTQgMS41Mjk0IDEuNTI5NCAwIDAgMS0xLjUyOTQtMS41Mjk0IDEuNTI5NCAxLjUyOTQgMCAwIDEgMS41Mjk0LTEuNTI5NCAxLjUyOTQgMS41Mjk0IDAgMCAxIDEuNTI5NCAxLjUyOTR6Ii8+CiAgPHBhdGggZD0ibTYuMTM1IDEzLjUzNWMwLTMuMjM5MiAyLjYyNTktNS44NjUgNS44NjUtNS44NjUgMy4yMzkyIDAgNS44NjUgMi42MjU5IDUuODY1IDUuODY1eiIvPgogIDxjaXJjbGUgY3g9IjEyIiBjeT0iMy43Njg1IiByPSIyLjk2ODUiLz4KIDwvZz4KPC9zdmc+Cg==", vegaSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIyIDIyIj4KICA8ZyBjbGFzcz0ianAtaWNvbjEganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjMjEyMTIxIj4KICAgIDxwYXRoIGQ9Ik0xMC42IDUuNGwyLjItMy4ySDIuMnY3LjNsNC02LjZ6Ii8+CiAgICA8cGF0aCBkPSJNMTUuOCAyLjJsLTQuNCA2LjZMNyA2LjNsLTQuOCA4djUuNWgxNy42VjIuMmgtNHptLTcgMTUuNEg1LjV2LTQuNGgzLjN2NC40em00LjQgMEg5LjhWOS44aDMuNHY3Ljh6bTQuNCAwaC0zLjRWNi41aDMuNHYxMS4xeiIvPgogIDwvZz4KPC9zdmc+Cg==", wordSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIwIDIwIj4KIDxnIGNsYXNzPSJqcC1pY29uMiIgZmlsbD0iIzQxNDE0MSI+CiAgPHJlY3QgeD0iMiIgeT0iMiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+CiA8L2c+CiA8ZyBjbGFzcz0ianAtaWNvbi1hY2NlbnQyIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSguNDMgLjA0MDEpIiBmaWxsPSIjZmZmIj4KICA8cGF0aCBkPSJtNC4xNCA4Ljc2cTAuMDY4Mi0xLjg5IDIuNDItMS44OSAxLjE2IDAgMS42OCAwLjQyIDAuNTY3IDAuNDEgMC41NjcgMS4xNnYzLjQ3cTAgMC40NjIgMC41MTQgMC40NjIgMC4xMDMgMCAwLjItMC4wMjMxdjAuNzE0cS0wLjM5OSAwLjEwMy0wLjY1MSAwLjEwMy0wLjQ1MiAwLTAuNjkzLTAuMjItMC4yMzEtMC4yLTAuMjg0LTAuNjYyLTAuOTU2IDAuODcyLTIgMC44NzItMC45MDMgMC0xLjQ3LTAuNDcyLTAuNTI1LTAuNDcyLTAuNTI1LTEuMjYgMC0wLjI2MiAwLjA0NTItMC40NzIgMC4wNTY3LTAuMjIgMC4xMTYtMC4zNzggMC4wNjgyLTAuMTY4IDAuMjMxLTAuMzA0IDAuMTU4LTAuMTQ3IDAuMjYyLTAuMjQyIDAuMTE2LTAuMDkxNCAwLjM2OC0wLjE2OCAwLjI2Mi0wLjA5MTQgMC4zOTktMC4xMjYgMC4xMzYtMC4wNDUyIDAuNDcyLTAuMTAzIDAuMzM2LTAuMDU3OCAwLjUwNC0wLjA3OTggMC4xNTgtMC4wMjMxIDAuNTY3LTAuMDc5OCAwLjU1Ni0wLjA2ODIgMC43NzctMC4yMjEgMC4yMi0wLjE1MiAwLjIyLTAuNDQxdi0wLjI1MnEwLTAuNDMtMC4zNTctMC42NjItMC4zMzYtMC4yMzEtMC45NzYtMC4yMzEtMC42NjIgMC0wLjk5OCAwLjI2Mi0wLjMzNiAwLjI1Mi0wLjM5OSAwLjc5OHptMS44OSAzLjY4cTAuNzg4IDAgMS4yNi0wLjQxIDAuNTA0LTAuNDIgMC41MDQtMC45MDN2LTEuMDVxLTAuMjg0IDAuMTM2LTAuODYxIDAuMjMxLTAuNTY3IDAuMDkxNC0wLjk4NyAwLjE1OC0wLjQyIDAuMDY4Mi0wLjc2NiAwLjMyNi0wLjMzNiAwLjI1Mi0wLjMzNiAwLjcwNHQwLjMwNCAwLjcwNCAwLjg2MSAwLjI1MnoiIHN0cm9rZS13aWR0aD0iMS4wNSIvPgogIDxwYXRoIGQ9Im0xMCA0LjU2aDAuOTQ1djMuMTVxMC42NTEtMC45NzYgMS44OS0wLjk3NiAxLjE2IDAgMS44OSAwLjg0IDAuNjgyIDAuODQgMC42ODIgMi4zMSAwIDEuNDctMC43MDQgMi40Mi0wLjcwNCAwLjg4Mi0xLjg5IDAuODgyLTEuMjYgMC0xLjg5LTEuMDJ2MC43NjZoLTAuODV6bTIuNjIgMy4wNHEtMC43NDYgMC0xLjE2IDAuNjQtMC40NTIgMC42My0wLjQ1MiAxLjY4IDAgMS4wNSAwLjQ1MiAxLjY4dDEuMTYgMC42M3EwLjc3NyAwIDEuMjYtMC42MyAwLjQ5NC0wLjY0IDAuNDk0LTEuNjggMC0xLjA1LTAuNDcyLTEuNjgtMC40NjItMC42NC0xLjI2LTAuNjR6IiBzdHJva2Utd2lkdGg9IjEuMDUiLz4KICA8cGF0aCBkPSJtMi43MyAxNS44IDEzLjYgMC4wMDgxYzAuMDA2OSAwIDAtMi42IDAtMi42IDAtMC4wMDc4LTEuMTUgMC0xLjE1IDAtMC4wMDY5IDAtMC4wMDgzIDEuNS0wLjAwODMgMS41LTJlLTMgLTAuMDAxNC0xMS4zLTAuMDAxNC0xMS4zLTAuMDAxNGwtMC4wMDU5Mi0xLjVjMC0wLjAwNzgtMS4xNyAwLjAwMTMtMS4xNyAwLjAwMTN6IiBzdHJva2Utd2lkdGg9Ii45NzUiLz4KIDwvZz4KPC9zdmc+Cg==", yamlSvgstr = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDIyIDIyIj4KICA8ZyBjbGFzcz0ianAtaWNvbi1jb250cmFzdDIganAtaWNvbi1zZWxlY3RhYmxlIiBmaWxsPSIjRDgxQjYwIj4KICAgIDxwYXRoIGQ9Ik03LjIgMTguNnYtNS40TDMgNS42aDMuM2wxLjQgMy4xYy4zLjkuNiAxLjYgMSAyLjUuMy0uOC42LTEuNiAxLTIuNWwxLjQtMy4xaDMuNGwtNC40IDcuNnY1LjVsLTIuOS0uMXoiLz4KICAgIDxjaXJjbGUgY2xhc3M9InN0MCIgY3g9IjE3LjYiIGN5PSIxNi41IiByPSIyLjEiLz4KICAgIDxjaXJjbGUgY2xhc3M9InN0MCIgY3g9IjE3LjYiIGN5PSIxMSIgcj0iMi4xIi8+CiAgPC9nPgo8L3N2Zz4K";
new LabIcon({ name: "ui-components:add-above", svgstr: addAboveSvgstr });
new LabIcon({ name: "ui-components:add-below", svgstr: addBelowSvgstr });
const addIcon = new LabIcon({ name: "ui-components:add", svgstr: addSvgstr });
new LabIcon({ name: "ui-components:bell", svgstr: bellSvgstr });
new LabIcon({ name: "ui-components:bug-dot", svgstr: bugDotSvgstr });
new LabIcon({ name: "ui-components:bug", svgstr: bugSvgstr });
new LabIcon({ name: "ui-components:build", svgstr: buildSvgstr });
new LabIcon({ name: "ui-components:caret-down-empty", svgstr: caretDownEmptySvgstr });
new LabIcon({ name: "ui-components:caret-down-empty-thin", svgstr: caretDownEmptyThinSvgstr });
new LabIcon({ name: "ui-components:caret-down", svgstr: caretDownSvgstr });
new LabIcon({ name: "ui-components:caret-left", svgstr: caretLeftSvgstr });
new LabIcon({ name: "ui-components:caret-right", svgstr: caretRightSvgstr });
new LabIcon({ name: "ui-components:caret-up-empty-thin", svgstr: caretUpEmptyThinSvgstr });
new LabIcon({ name: "ui-components:caret-up", svgstr: caretUpSvgstr });
new LabIcon({ name: "ui-components:case-sensitive", svgstr: caseSensitiveSvgstr });
new LabIcon({ name: "ui-components:check", svgstr: checkSvgstr });
new LabIcon({ name: "ui-components:circle-empty", svgstr: circleEmptySvgstr });
new LabIcon({ name: "ui-components:circle", svgstr: circleSvgstr });
new LabIcon({ name: "ui-components:clear", svgstr: clearSvgstr });
new LabIcon({ name: "ui-components:close", svgstr: closeSvgstr });
new LabIcon({ name: "ui-components:code-check", svgstr: codeCheckSvgstr });
new LabIcon({ name: "ui-components:code", svgstr: codeSvgstr });
new LabIcon({ name: "ui-components:collapse-all", svgstr: collapseAllSvgstr });
new LabIcon({ name: "ui-components:console", svgstr: consoleSvgstr });
new LabIcon({ name: "ui-components:copy", svgstr: copySvgstr });
new LabIcon({ name: "ui-components:copyright", svgstr: copyrightSvgstr });
new LabIcon({ name: "ui-components:cut", svgstr: cutSvgstr });
new LabIcon({ name: "ui-components:delete", svgstr: deleteSvgstr });
new LabIcon({ name: "ui-components:download", svgstr: downloadSvgstr });
new LabIcon({ name: "ui-components:duplicate", svgstr: duplicateSvgstr });
new LabIcon({ name: "ui-components:edit", svgstr: editSvgstr });
const ellipsesIcon = new LabIcon({ name: "ui-components:ellipses", svgstr: ellipsesSvgstr });
new LabIcon({ name: "ui-components:error", svgstr: errorSvgstr });
new LabIcon({ name: "ui-components:expand-all", svgstr: expandAllSvgstr });
new LabIcon({ name: "ui-components:extension", svgstr: extensionSvgstr });
new LabIcon({ name: "ui-components:fast-forward", svgstr: fastForwardSvgstr });
new LabIcon({ name: "ui-components:file", svgstr: fileSvgstr });
new LabIcon({ name: "ui-components:file-upload", svgstr: fileUploadSvgstr });
new LabIcon({ name: "ui-components:filter-dot", svgstr: filterDotSvgstr });
new LabIcon({ name: "ui-components:filter", svgstr: filterSvgstr });
new LabIcon({ name: "ui-components:filter-list", svgstr: filterListSvgstr });
new LabIcon({ name: "ui-components:folder-favorite", svgstr: folderFavoriteSvgstr });
new LabIcon({ name: "ui-components:folder", svgstr: folderSvgstr });
new LabIcon({ name: "ui-components:home", svgstr: homeSvgstr });
new LabIcon({ name: "ui-components:html5", svgstr: html5Svgstr });
new LabIcon({ name: "ui-components:image", svgstr: imageSvgstr });
new LabIcon({ name: "ui-components:info", svgstr: infoSvgstr });
new LabIcon({ name: "ui-components:inspector", svgstr: inspectorSvgstr });
new LabIcon({ name: "ui-components:json", svgstr: jsonSvgstr });
new LabIcon({ name: "ui-components:julia", svgstr: juliaSvgstr });
new LabIcon({ name: "ui-components:jupyter-favicon", svgstr: jupyterFaviconSvgstr });
new LabIcon({ name: "ui-components:jupyter", svgstr: jupyterSvgstr });
new LabIcon({ name: "ui-components:jupyterlab-wordmark", svgstr: jupyterlabWordmarkSvgstr });
new LabIcon({ name: "ui-components:kernel", svgstr: kernelSvgstr });
new LabIcon({ name: "ui-components:keyboard", svgstr: keyboardSvgstr });
new LabIcon({ name: "ui-components:launch", svgstr: launchSvgstr });
new LabIcon({ name: "ui-components:launcher", svgstr: launcherSvgstr });
new LabIcon({ name: "ui-components:line-form", svgstr: lineFormSvgstr });
new LabIcon({ name: "ui-components:link", svgstr: linkSvgstr });
new LabIcon({ name: "ui-components:list", svgstr: listSvgstr });
new LabIcon({ name: "ui-components:markdown", svgstr: markdownSvgstr });
new LabIcon({ name: "ui-components:move-down", svgstr: moveDownSvgstr });
new LabIcon({ name: "ui-components:move-up", svgstr: moveUpSvgstr });
new LabIcon({ name: "ui-components:new-folder", svgstr: newFolderSvgstr });
new LabIcon({ name: "ui-components:not-trusted", svgstr: notTrustedSvgstr });
new LabIcon({ name: "ui-components:notebook", svgstr: notebookSvgstr });
new LabIcon({ name: "ui-components:numbering", svgstr: numberingSvgstr });
new LabIcon({ name: "ui-components:offline-bolt", svgstr: offlineBoltSvgstr });
new LabIcon({ name: "ui-components:palette", svgstr: paletteSvgstr });
new LabIcon({ name: "ui-components:paste", svgstr: pasteSvgstr });
new LabIcon({ name: "ui-components:pdf", svgstr: pdfSvgstr });
new LabIcon({ name: "ui-components:python", svgstr: pythonSvgstr });
new LabIcon({ name: "ui-components:r-kernel", svgstr: rKernelSvgstr });
new LabIcon({ name: "ui-components:react", svgstr: reactSvgstr });
new LabIcon({ name: "ui-components:redo", svgstr: redoSvgstr });
new LabIcon({ name: "ui-components:refresh", svgstr: refreshSvgstr });
new LabIcon({ name: "ui-components:regex", svgstr: regexSvgstr });
new LabIcon({ name: "ui-components:run", svgstr: runSvgstr });
new LabIcon({ name: "ui-components:running", svgstr: runningSvgstr });
new LabIcon({ name: "ui-components:save", svgstr: saveSvgstr });
new LabIcon({ name: "ui-components:search", svgstr: searchSvgstr });
new LabIcon({ name: "ui-components:settings", svgstr: settingsSvgstr });
new LabIcon({ name: "ui-components:share", svgstr: shareSvgstr });
new LabIcon({ name: "ui-components:spreadsheet", svgstr: spreadsheetSvgstr });
new LabIcon({ name: "ui-components:stop", svgstr: stopSvgstr });
new LabIcon({ name: "ui-components:tab", svgstr: tabSvgstr });
new LabIcon({ name: "ui-components:table-rows", svgstr: tableRowsSvgstr });
new LabIcon({ name: "ui-components:tag", svgstr: tagSvgstr });
new LabIcon({ name: "ui-components:terminal", svgstr: terminalSvgstr });
new LabIcon({ name: "ui-components:text-editor", svgstr: textEditorSvgstr });
new LabIcon({ name: "ui-components:toc", svgstr: tocSvgstr });
new LabIcon({ name: "ui-components:tree-view", svgstr: treeViewSvgstr });
new LabIcon({ name: "ui-components:trusted", svgstr: trustedSvgstr });
new LabIcon({ name: "ui-components:undo", svgstr: undoSvgstr });
new LabIcon({ name: "ui-components:user", svgstr: userSvgstr });
new LabIcon({ name: "ui-components:users", svgstr: usersSvgstr });
new LabIcon({ name: "ui-components:vega", svgstr: vegaSvgstr });
new LabIcon({ name: "ui-components:word", svgstr: wordSvgstr });
new LabIcon({ name: "ui-components:yaml", svgstr: yamlSvgstr });
function normalizeDomain(_e) {
  return _e.replace("-", "_");
}
class Gettext {
  constructor(Qt) {
    Qt = Qt || {}, this._defaults = {
      domain: "messages",
      locale: document.documentElement.getAttribute("lang") || "en",
      pluralFunc: function(Zt) {
        return { nplurals: 2, plural: Zt != 1 ? 1 : 0 };
      },
      contextDelimiter: String.fromCharCode(4),
      stringsPrefix: ""
    }, this._locale = (Qt.locale || this._defaults.locale).replace("_", "-"), this._domain = normalizeDomain(Qt.domain || this._defaults.domain), this._contextDelimiter = Qt.contextDelimiter || this._defaults.contextDelimiter, this._stringsPrefix = Qt.stringsPrefix || this._defaults.stringsPrefix, this._pluralFuncs = {}, this._dictionary = {}, this._pluralForms = {}, Qt.messages && (this._dictionary[this._domain] = {}, this._dictionary[this._domain][this._locale] = Qt.messages), Qt.pluralForms && (this._pluralForms[this._locale] = Qt.pluralForms);
  }
  /**
   * Set current context delimiter.
   *
   * @param delimiter - The delimiter to set.
   */
  setContextDelimiter(Qt) {
    this._contextDelimiter = Qt;
  }
  /**
   * Get current context delimiter.
   *
   * @returns The current delimiter.
   */
  getContextDelimiter() {
    return this._contextDelimiter;
  }
  /**
   * Set current locale.
   *
   * @param locale - The locale to set.
   */
  setLocale(Qt) {
    this._locale = Qt.replace("_", "-");
  }
  /**
   * Get current locale.
   *
   * @returns The current locale.
   */
  getLocale() {
    return this._locale;
  }
  /**
   * Set current domain.
   *
   * @param domain - The domain to set.
   */
  setDomain(Qt) {
    this._domain = normalizeDomain(Qt);
  }
  /**
   * Get current domain.
   *
   * @returns The current domain string.
   */
  getDomain() {
    return this._domain;
  }
  /**
   * Set current strings prefix.
   *
   * @param prefix - The string prefix to set.
   */
  setStringsPrefix(Qt) {
    this._stringsPrefix = Qt;
  }
  /**
   * Get current strings prefix.
   *
   * @returns The strings prefix.
   */
  getStringsPrefix() {
    return this._stringsPrefix;
  }
  /**
   * `sprintf` equivalent, takes a string and some arguments to make a
   * computed string.
   *
   * @param fmt - The string to interpolate.
   * @param args - The variables to use in interpolation.
   *
   * ### Examples
   * strfmt("%1 dogs are in %2", 7, "the kitchen"); => "7 dogs are in the kitchen"
   * strfmt("I like %1, bananas and %1", "apples"); => "I like apples, bananas and apples"
   */
  static strfmt(Qt, ...Zt) {
    return Qt.replace(/%%/g, "%% ").replace(/%(\d+)/g, function($n, Sn) {
      return Zt[Sn - 1];
    }).replace(/%% /g, "%");
  }
  /**
   * Load json translations strings (In Jed 2.x format).
   *
   * @param jsonData - The translation strings plus metadata.
   * @param domain - The translation domain, e.g. "jupyterlab".
   */
  loadJSON(Qt, Zt) {
    if (!Qt[""] || !Qt[""].language || !Qt[""].pluralForms)
      throw new Error(`Wrong jsonData, it must have an empty key ("") with "language" and "pluralForms" information: ${Qt}`);
    Zt = normalizeDomain(Zt);
    let $n = Qt[""], Sn = JSON.parse(JSON.stringify(Qt));
    delete Sn[""], this.setMessages(Zt || this._defaults.domain, $n.language, Sn, $n.pluralForms);
  }
  /**
   * Shorthand for gettext.
   *
   * @param msgid - The singular string to translate.
   * @param args - Any additional values to use with interpolation.
   *
   * @returns A translated string if found, or the original string.
   *
   * ### Notes
   * This is not a private method (starts with an underscore) it is just
   * a shorter and standard way to call these methods.
   */
  __(Qt, ...Zt) {
    return this.gettext(Qt, ...Zt);
  }
  /**
   * Shorthand for ngettext.
   *
   * @param msgid - The singular string to translate.
   * @param msgid_plural - The plural string to translate.
   * @param n - The number for pluralization.
   * @param args - Any additional values to use with interpolation.
   *
   * @returns A translated string if found, or the original string.
   *
   * ### Notes
   * This is not a private method (starts with an underscore) it is just
   * a shorter and standard way to call these methods.
   */
  _n(Qt, Zt, $n, ...Sn) {
    return this.ngettext(Qt, Zt, $n, ...Sn);
  }
  /**
   * Shorthand for pgettext.
   *
   * @param msgctxt - The message context.
   * @param msgid - The singular string to translate.
   * @param args - Any additional values to use with interpolation.
   *
   * @returns A translated string if found, or the original string.
   *
   * ### Notes
   * This is not a private method (starts with an underscore) it is just
   * a shorter and standard way to call these methods.
   */
  _p(Qt, Zt, ...$n) {
    return this.pgettext(Qt, Zt, ...$n);
  }
  /**
   * Shorthand for npgettext.
   *
   * @param msgctxt - The message context.
   * @param msgid - The singular string to translate.
   * @param msgid_plural - The plural string to translate.
   * @param n - The number for pluralization.
   * @param args - Any additional values to use with interpolation.
   *
   * @returns A translated string if found, or the original string.
   *
   * ### Notes
   * This is not a private method (starts with an underscore) it is just
   * a shorter and standard way to call these methods.
   */
  _np(Qt, Zt, $n, Sn, ...kn) {
    return this.npgettext(Qt, Zt, $n, Sn, ...kn);
  }
  /**
   * Translate a singular string with extra interpolation values.
   *
   * @param msgid - The singular string to translate.
   * @param args - Any additional values to use with interpolation.
   *
   * @returns A translated string if found, or the original string.
   */
  gettext(Qt, ...Zt) {
    return this.dcnpgettext("", "", Qt, "", 0, ...Zt);
  }
  /**
   * Translate a plural string with extra interpolation values.
   *
   * @param msgid - The singular string to translate.
   * @param args - Any additional values to use with interpolation.
   *
   * @returns A translated string if found, or the original string.
   */
  ngettext(Qt, Zt, $n, ...Sn) {
    return this.dcnpgettext("", "", Qt, Zt, $n, ...Sn);
  }
  /**
   * Translate a contextualized singular string with extra interpolation values.
   *
   * @param msgctxt - The message context.
   * @param msgid - The singular string to translate.
   * @param args - Any additional values to use with interpolation.
   *
   * @returns A translated string if found, or the original string.
   *
   * ### Notes
   * This is not a private method (starts with an underscore) it is just
   * a shorter and standard way to call these methods.
   */
  pgettext(Qt, Zt, ...$n) {
    return this.dcnpgettext("", Qt, Zt, "", 0, ...$n);
  }
  /**
   * Translate a contextualized plural string with extra interpolation values.
   *
   * @param msgctxt - The message context.
   * @param msgid - The singular string to translate.
   * @param msgid_plural - The plural string to translate.
   * @param n - The number for pluralization.
   * @param args - Any additional values to use with interpolation
   *
   * @returns A translated string if found, or the original string.
   */
  npgettext(Qt, Zt, $n, Sn, ...kn) {
    return this.dcnpgettext("", Qt, Zt, $n, Sn, ...kn);
  }
  /**
   * Translate a singular string with extra interpolation values.
   *
   * @param domain - The translations domain.
   * @param msgctxt - The message context.
   * @param msgid - The singular string to translate.
   * @param msgid_plural - The plural string to translate.
   * @param n - The number for pluralization.
   * @param args - Any additional values to use with interpolation
   *
   * @returns A translated string if found, or the original string.
   */
  dcnpgettext(Qt, Zt, $n, Sn, kn, ...Kn) {
    Qt = normalizeDomain(Qt) || this._domain;
    let er, Cr = Zt ? Zt + this._contextDelimiter + $n : $n, kr = { pluralForm: !1 }, Yr = !1, Ms = this._locale, Ds = this.expandLocale(this._locale);
    for (let js in Ds)
      if (Ms = Ds[js], Yr = this._dictionary[Qt] && this._dictionary[Qt][Ms] && this._dictionary[Qt][Ms][Cr], Sn ? Yr = Yr && this._dictionary[Qt][Ms][Cr].length > 1 : Yr = Yr && this._dictionary[Qt][Ms][Cr].length == 1, Yr) {
        kr.locale = Ms;
        break;
      }
    if (Yr ? er = this._dictionary[Qt][Ms][Cr] : (er = [$n], kr.pluralFunc = this._defaults.pluralFunc), !Sn)
      return this.t(er, kn, kr, ...Kn);
    kr.pluralForm = !0;
    let Ls = Yr ? er : [$n, Sn];
    return this.t(Ls, kn, kr, ...Kn);
  }
  /**
   * Split a locale into parent locales. "es-CO" -> ["es-CO", "es"]
   *
   * @param locale - The locale string.
   *
   * @returns An array of locales.
   */
  expandLocale(Qt) {
    let Zt = [Qt], $n = Qt.lastIndexOf("-");
    for (; $n > 0; )
      Qt = Qt.slice(0, $n), Zt.push(Qt), $n = Qt.lastIndexOf("-");
    return Zt;
  }
  /**
   * Split a locale into parent locales. "es-CO" -> ["es-CO", "es"]
   *
   * @param pluralForm - Plural form string..
   * @returns An function to compute plural forms.
   */
  // eslint-disable-next-line @typescript-eslint/ban-types
  getPluralFunc(Qt) {
    if (!new RegExp("^\\s*nplurals\\s*=\\s*[0-9]+\\s*;\\s*plural\\s*=\\s*(?:\\s|[-\\?\\|&=!<>+*/%:;n0-9_()])+").test(Qt))
      throw new Error(Gettext.strfmt('The plural form "%1" is not valid', Qt));
    return new Function("n", "let plural, nplurals; " + Qt + " return { nplurals: nplurals, plural: (plural === true ? 1 : (plural ? plural : 0)) };");
  }
  /**
   * Remove the context delimiter from string.
   *
   * @param str - Translation string.
   * @returns A translation string without context.
   */
  removeContext(Qt) {
    return Qt.indexOf(this._contextDelimiter) !== -1 ? Qt.split(this._contextDelimiter)[1] : Qt;
  }
  /**
   * Proper translation function that handle plurals and directives.
   *
   * @param messages - List of translation strings.
   * @param n - The number for pluralization.
   * @param options - Translation options.
   * @param args - Any variables to interpolate.
   *
   * @returns A translation string without context.
   *
   * ### Notes
   * Contains juicy parts of https://github.com/Orange-OpenSource/gettext.js/blob/master/lib.gettext.js
   */
  t(Qt, Zt, $n, ...Sn) {
    if (!$n.pluralForm)
      return this._stringsPrefix + Gettext.strfmt(this.removeContext(Qt[0]), ...Sn);
    let kn;
    return $n.pluralFunc ? kn = $n.pluralFunc(Zt) : this._pluralFuncs[$n.locale || ""] ? kn = this._pluralFuncs[$n.locale || ""](Zt) : (this._pluralFuncs[$n.locale || ""] = this.getPluralFunc(this._pluralForms[$n.locale || ""]), kn = this._pluralFuncs[$n.locale || ""](Zt)), (typeof !kn.plural > "u" || kn.plural > kn.nplurals || Qt.length <= kn.plural) && (kn.plural = 0), this._stringsPrefix + Gettext.strfmt(this.removeContext(Qt[kn.plural]), ...[Zt].concat(Sn));
  }
  /**
   * Set messages after loading them.
   *
   * @param domain - The translation domain.
   * @param locale - The translation locale.
   * @param messages - List of translation strings.
   * @param pluralForms - Plural form string.
   *
   * ### Notes
   * Contains juicy parts of https://github.com/Orange-OpenSource/gettext.js/blob/master/lib.gettext.js
   */
  setMessages(Qt, Zt, $n, Sn) {
    Qt = normalizeDomain(Qt), Sn && (this._pluralForms[Zt] = Sn), this._dictionary[Qt] || (this._dictionary[Qt] = {}), this._dictionary[Qt][Zt] = $n;
  }
}
class NullTranslator {
  constructor(Qt) {
    this.languageCode = "en", this._languageBundle = Qt;
  }
  load(Qt) {
    return this._languageBundle;
  }
}
class NullLanguageBundle {
  __(Qt, ...Zt) {
    return this.gettext(Qt, ...Zt);
  }
  _n(Qt, Zt, $n, ...Sn) {
    return this.ngettext(Qt, Zt, $n, ...Sn);
  }
  _p(Qt, Zt, ...$n) {
    return this.pgettext(Qt, Zt, ...$n);
  }
  _np(Qt, Zt, $n, Sn, ...kn) {
    return this.npgettext(Qt, Zt, $n, Sn, ...kn);
  }
  gettext(Qt, ...Zt) {
    return Gettext.strfmt(Qt, ...Zt);
  }
  ngettext(Qt, Zt, $n, ...Sn) {
    return Gettext.strfmt($n == 1 ? Qt : Zt, ...[$n].concat(Sn));
  }
  pgettext(Qt, Zt, ...$n) {
    return Gettext.strfmt(Zt, ...$n);
  }
  npgettext(Qt, Zt, $n, Sn, ...kn) {
    return this.ngettext(Zt, $n, Sn, ...kn);
  }
  dcnpgettext(Qt, Zt, $n, Sn, kn, ...Kn) {
    return this.ngettext($n, Sn, kn, ...Kn);
  }
}
const nullTranslator = new NullTranslator(new NullLanguageBundle());
var lib$1 = {}, dataconnector = {};
Object.defineProperty(dataconnector, "__esModule", { value: !0 });
dataconnector.DataConnector = void 0;
class DataConnector {
  /**
   * Retrieve the list of items available from the data connector.
   *
   * @param query - The optional query filter to apply to the connector request.
   *
   * @returns A promise that always rejects with an error.
   *
   * #### Notes
   * Subclasses should reimplement if they support a back-end that can list.
   */
  async list(Qt) {
    throw new Error("DataConnector#list method has not been implemented.");
  }
  /**
   * Remove a value using the data connector.
   *
   * @param id - The identifier for the data being removed.
   *
   * @returns A promise that always rejects with an error.
   *
   * #### Notes
   * Subclasses should reimplement if they support a back-end that can remove.
   */
  async remove(Qt) {
    throw new Error("DataConnector#remove method has not been implemented.");
  }
  /**
   * Save a value using the data connector.
   *
   * @param id - The identifier for the data being saved.
   *
   * @param value - The data being saved.
   *
   * @returns A promise that always rejects with an error.
   *
   * #### Notes
   * Subclasses should reimplement if they support a back-end that can save.
   */
  async save(Qt, Zt) {
    throw new Error("DataConnector#save method has not been implemented.");
  }
}
dataconnector.DataConnector = DataConnector;
var interfaces = {};
Object.defineProperty(interfaces, "__esModule", { value: !0 });
var restorablepool = {};
const require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(index_es6$2);
Object.defineProperty(restorablepool, "__esModule", { value: !0 });
restorablepool.RestorablePool = void 0;
const coreutils_1$a = require$$1$2, properties_1 = require$$1$1, signaling_1$4 = require$$0$1;
class RestorablePool {
  /**
   * Create a new restorable pool.
   *
   * @param options - The instantiation options for a restorable pool.
   */
  constructor(Qt) {
    this._added = new signaling_1$4.Signal(this), this._current = null, this._currentChanged = new signaling_1$4.Signal(this), this._hasRestored = !1, this._isDisposed = !1, this._objects = /* @__PURE__ */ new Set(), this._restore = null, this._restored = new coreutils_1$a.PromiseDelegate(), this._updated = new signaling_1$4.Signal(this), this.namespace = Qt.namespace;
  }
  /**
   * A signal emitted when an object object is added.
   *
   * #### Notes
   * This signal will only fire when an object is added to the pool.
   * It will not fire if an object injected into the pool.
   */
  get added() {
    return this._added;
  }
  /**
   * The current object.
   *
   * #### Notes
   * The restorable pool does not set `current`. It is intended for client use.
   *
   * If `current` is set to an object that does not exist in the pool, it is a
   * no-op.
   */
  get current() {
    return this._current;
  }
  set current(Qt) {
    this._current !== Qt && Qt !== null && this._objects.has(Qt) && (this._current = Qt, this._currentChanged.emit(this._current));
  }
  /**
   * A signal emitted when the current widget changes.
   */
  get currentChanged() {
    return this._currentChanged;
  }
  /**
   * Test whether the pool is disposed.
   */
  get isDisposed() {
    return this._isDisposed;
  }
  /**
   * A promise resolved when the restorable pool has been restored.
   */
  get restored() {
    return this._restored.promise;
  }
  /**
   * The number of objects held by the pool.
   */
  get size() {
    return this._objects.size;
  }
  /**
   * A signal emitted when an object is updated.
   */
  get updated() {
    return this._updated;
  }
  /**
   * Add a new object to the pool.
   *
   * @param obj - The object object being added.
   *
   * #### Notes
   * The object passed into the pool is added synchronously; its existence in
   * the pool can be checked with the `has()` method. The promise this method
   * returns resolves after the object has been added and saved to an underlying
   * restoration connector, if one is available.
   */
  async add(Qt) {
    var Zt, $n;
    if (Qt.isDisposed) {
      const Sn = "A disposed object cannot be added.";
      throw console.warn(Sn, Qt), new Error(Sn);
    }
    if (this._objects.has(Qt)) {
      const Sn = "This object already exists in the pool.";
      throw console.warn(Sn, Qt), new Error(Sn);
    }
    if (this._objects.add(Qt), Qt.disposed.connect(this._onInstanceDisposed, this), !Private$c.injectedProperty.get(Qt)) {
      if (this._restore) {
        const { connector: Sn } = this._restore, kn = this._restore.name(Qt);
        if (kn) {
          const Kn = `${this.namespace}:${kn}`, er = ($n = (Zt = this._restore).args) === null || $n === void 0 ? void 0 : $n.call(Zt, Qt);
          Private$c.nameProperty.set(Qt, Kn), await Sn.save(Kn, { data: er });
        }
      }
      this._added.emit(Qt);
    }
  }
  /**
   * Dispose of the resources held by the pool.
   *
   * #### Notes
   * Disposing a pool does not affect the underlying data in the data connector,
   * it simply disposes the client-side pool without making any connector calls.
   */
  dispose() {
    this.isDisposed || (this._current = null, this._isDisposed = !0, this._objects.clear(), signaling_1$4.Signal.clearData(this));
  }
  /**
   * Find the first object in the pool that satisfies a filter function.
   *
   * @param - fn The filter function to call on each object.
   */
  find(Qt) {
    const Zt = this._objects.values();
    for (const $n of Zt)
      if (Qt($n))
        return $n;
  }
  /**
   * Iterate through each object in the pool.
   *
   * @param fn - The function to call on each object.
   */
  forEach(Qt) {
    this._objects.forEach(Qt);
  }
  /**
   * Filter the objects in the pool based on a predicate.
   *
   * @param fn - The function by which to filter.
   */
  filter(Qt) {
    const Zt = [];
    return this.forEach(($n) => {
      Qt($n) && Zt.push($n);
    }), Zt;
  }
  /**
   * Inject an object into the restorable pool without the pool handling its
   * restoration lifecycle.
   *
   * @param obj - The object to inject into the pool.
   */
  inject(Qt) {
    return Private$c.injectedProperty.set(Qt, !0), this.add(Qt);
  }
  /**
   * Check if this pool has the specified object.
   *
   * @param obj - The object whose existence is being checked.
   */
  has(Qt) {
    return this._objects.has(Qt);
  }
  /**
   * Restore the objects in this pool's namespace.
   *
   * @param options - The configuration options that describe restoration.
   *
   * @returns A promise that resolves when restoration has completed.
   *
   * #### Notes
   * This function should almost never be invoked by client code. Its primary
   * use case is to be invoked by a layout restorer plugin that handles
   * multiple restorable pools and, when ready, asks them each to restore their
   * respective objects.
   */
  async restore(Qt) {
    if (this._hasRestored)
      throw new Error("This pool has already been restored.");
    this._hasRestored = !0;
    const { command: Zt, connector: $n, registry: Sn, when: kn } = Qt, Kn = this.namespace, er = kn ? [$n.list(Kn)].concat(kn) : [$n.list(Kn)];
    this._restore = Qt;
    const [Cr] = await Promise.all(er), kr = await Promise.all(Cr.ids.map(async (Yr, Ms) => {
      const Ds = Cr.values[Ms], Ls = Ds && Ds.data;
      return Ls === void 0 ? $n.remove(Yr) : Sn.execute(Zt, Ls).catch(() => $n.remove(Yr));
    }));
    return this._restored.resolve(), kr;
  }
  /**
   * Save the restore data for a given object.
   *
   * @param obj - The object being saved.
   */
  async save(Qt) {
    var Zt, $n;
    const Sn = Private$c.injectedProperty.get(Qt);
    if (!this._restore || !this.has(Qt) || Sn)
      return;
    const { connector: kn } = this._restore, Kn = this._restore.name(Qt), er = Private$c.nameProperty.get(Qt), Cr = Kn ? `${this.namespace}:${Kn}` : "";
    if (er && er !== Cr && await kn.remove(er), Private$c.nameProperty.set(Qt, Cr), Cr) {
      const kr = ($n = (Zt = this._restore).args) === null || $n === void 0 ? void 0 : $n.call(Zt, Qt);
      await kn.save(Cr, { data: kr });
    }
    er !== Cr && this._updated.emit(Qt);
  }
  /**
   * Clean up after disposed objects.
   */
  _onInstanceDisposed(Qt) {
    if (this._objects.delete(Qt), Qt === this._current && (this._current = null, this._currentChanged.emit(this._current)), Private$c.injectedProperty.get(Qt) || !this._restore)
      return;
    const { connector: Zt } = this._restore, $n = Private$c.nameProperty.get(Qt);
    $n && Zt.remove($n);
  }
}
restorablepool.RestorablePool = RestorablePool;
var Private$c;
(function(_e) {
  _e.injectedProperty = new properties_1.AttachedProperty({
    name: "injected",
    create: () => !1
  }), _e.nameProperty = new properties_1.AttachedProperty({
    name: "name",
    create: () => ""
  });
})(Private$c || (Private$c = {}));
var statedb = {};
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.StateDB = void 0;
  const Qt = require$$0$1;
  class Zt {
    /**
     * Create a new state database.
     *
     * @param options - The instantiation options for a state database.
     */
    constructor(Sn = {}) {
      this._changed = new Qt.Signal(this);
      const { connector: kn, transform: Kn } = Sn;
      this._connector = kn || new Zt.Connector(), Kn ? this._ready = Kn.then((er) => {
        const { contents: Cr, type: kr } = er;
        switch (kr) {
          case "cancel":
            return;
          case "clear":
            return this._clear();
          case "merge":
            return this._merge(Cr || {});
          case "overwrite":
            return this._overwrite(Cr || {});
          default:
            return;
        }
      }) : this._ready = Promise.resolve(void 0);
    }
    /**
     * A signal that emits the change type any time a value changes.
     */
    get changed() {
      return this._changed;
    }
    /**
     * Clear the entire database.
     */
    async clear() {
      await this._ready, await this._clear();
    }
    /**
     * Retrieve a saved bundle from the database.
     *
     * @param id - The identifier used to retrieve a data bundle.
     *
     * @returns A promise that bears a data payload if available.
     *
     * #### Notes
     * The `id` values of stored items in the state database are formatted:
     * `'namespace:identifier'`, which is the same convention that command
     * identifiers in JupyterLab use as well. While this is not a technical
     * requirement for `fetch()`, `remove()`, and `save()`, it *is* necessary for
     * using the `list(namespace: string)` method.
     *
     * The promise returned by this method may be rejected if an error occurs in
     * retrieving the data. Non-existence of an `id` will succeed with the `value`
     * `undefined`.
     */
    async fetch(Sn) {
      return await this._ready, this._fetch(Sn);
    }
    /**
     * Retrieve all the saved bundles for a namespace.
     *
     * @param filter - The namespace prefix to retrieve.
     *
     * @returns A promise that bears a collection of payloads for a namespace.
     *
     * #### Notes
     * Namespaces are entirely conventional entities. The `id` values of stored
     * items in the state database are formatted: `'namespace:identifier'`, which
     * is the same convention that command identifiers in JupyterLab use as well.
     *
     * If there are any errors in retrieving the data, they will be logged to the
     * console in order to optimistically return any extant data without failing.
     * This promise will always succeed.
     */
    async list(Sn) {
      return await this._ready, this._list(Sn);
    }
    /**
     * Remove a value from the database.
     *
     * @param id - The identifier for the data being removed.
     *
     * @returns A promise that is rejected if remove fails and succeeds otherwise.
     */
    async remove(Sn) {
      await this._ready, await this._remove(Sn), this._changed.emit({ id: Sn, type: "remove" });
    }
    /**
     * Save a value in the database.
     *
     * @param id - The identifier for the data being saved.
     *
     * @param value - The data being saved.
     *
     * @returns A promise that is rejected if saving fails and succeeds otherwise.
     *
     * #### Notes
     * The `id` values of stored items in the state database are formatted:
     * `'namespace:identifier'`, which is the same convention that command
     * identifiers in JupyterLab use as well. While this is not a technical
     * requirement for `fetch()`, `remove()`, and `save()`, it *is* necessary for
     * using the `list(namespace: string)` method.
     */
    async save(Sn, kn) {
      await this._ready, await this._save(Sn, kn), this._changed.emit({ id: Sn, type: "save" });
    }
    /**
     * Return a serialized copy of the state database's entire contents.
     *
     * @returns A promise that resolves with the database contents as JSON.
     */
    async toJSON() {
      await this._ready;
      const { ids: Sn, values: kn } = await this._list();
      return kn.reduce((Kn, er, Cr) => (Kn[Sn[Cr]] = er, Kn), {});
    }
    /**
     * Clear the entire database.
     */
    async _clear() {
      await Promise.all((await this._list()).ids.map((Sn) => this._remove(Sn)));
    }
    /**
     * Fetch a value from the database.
     */
    async _fetch(Sn) {
      const kn = await this._connector.fetch(Sn);
      if (kn)
        return JSON.parse(kn).v;
    }
    /**
     * Fetch a list from the database.
     */
    async _list(Sn = "") {
      const { ids: kn, values: Kn } = await this._connector.list(Sn);
      return {
        ids: kn,
        values: Kn.map((er) => JSON.parse(er).v)
      };
    }
    /**
     * Merge data into the state database.
     */
    async _merge(Sn) {
      await Promise.all(Object.keys(Sn).map((kn) => Sn[kn] && this._save(kn, Sn[kn])));
    }
    /**
     * Overwrite the entire database with new contents.
     */
    async _overwrite(Sn) {
      await this._clear(), await this._merge(Sn);
    }
    /**
     * Remove a key in the database.
     */
    async _remove(Sn) {
      return this._connector.remove(Sn);
    }
    /**
     * Save a key and its value in the database.
     */
    async _save(Sn, kn) {
      return this._connector.save(Sn, JSON.stringify({ v: kn }));
    }
  }
  _e.StateDB = Zt, function($n) {
    class Sn {
      constructor() {
        this._storage = {};
      }
      /**
       * Retrieve an item from the data connector.
       */
      async fetch(Kn) {
        return this._storage[Kn];
      }
      /**
       * Retrieve the list of items available from the data connector.
       *
       * @param namespace - If not empty, only keys whose first token before `:`
       * exactly match `namespace` will be returned, e.g. `foo` in `foo:bar`.
       */
      async list(Kn = "") {
        return Object.keys(this._storage).reduce((er, Cr) => ((Kn === "" || Kn === Cr.split(":")[0]) && (er.ids.push(Cr), er.values.push(this._storage[Cr])), er), { ids: [], values: [] });
      }
      /**
       * Remove a value using the data connector.
       */
      async remove(Kn) {
        delete this._storage[Kn];
      }
      /**
       * Save a value using the data connector.
       */
      async save(Kn, er) {
        this._storage[Kn] = er;
      }
    }
    $n.Connector = Sn;
  }(Zt = _e.StateDB || (_e.StateDB = {}));
})(statedb);
var tokens = {};
Object.defineProperty(tokens, "__esModule", { value: !0 });
tokens.IStateDB = void 0;
const coreutils_1$9 = require$$1$2;
tokens.IStateDB = new coreutils_1$9.Token("@jupyterlab/coreutils:IStateDB", `A service for the JupyterLab state database.
  Use this if you want to store data that will persist across page loads.
  See "state database" for more information.`);
(function(_e) {
  var Qt = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function($n, Sn, kn, Kn) {
    Kn === void 0 && (Kn = kn);
    var er = Object.getOwnPropertyDescriptor(Sn, kn);
    (!er || ("get" in er ? !Sn.__esModule : er.writable || er.configurable)) && (er = { enumerable: !0, get: function() {
      return Sn[kn];
    } }), Object.defineProperty($n, Kn, er);
  } : function($n, Sn, kn, Kn) {
    Kn === void 0 && (Kn = kn), $n[Kn] = Sn[kn];
  }), Zt = commonjsGlobal && commonjsGlobal.__exportStar || function($n, Sn) {
    for (var kn in $n)
      kn !== "default" && !Object.prototype.hasOwnProperty.call(Sn, kn) && Qt(Sn, $n, kn);
  };
  Object.defineProperty(_e, "__esModule", { value: !0 }), Zt(dataconnector, _e), Zt(interfaces, _e), Zt(restorablepool, _e), Zt(statedb, _e), Zt(tokens, _e);
})(lib$1);
var lib = {}, basemanager = {}, serverconnection = {}, ws$1 = {}, hasRequiredWs;
function requireWs() {
  return hasRequiredWs || (hasRequiredWs = 1, Object.defineProperty(ws$1, "__esModule", { value: !0 }), ws$1.default = WebSocket), ws$1;
}
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.ServerConnection = void 0;
  const Qt = lib$3;
  let Zt;
  typeof window > "u" ? Zt = requireWs() : Zt = WebSocket;
  var $n;
  (function(kn) {
    function Kn(Yr) {
      return Sn.makeSettings(Yr);
    }
    kn.makeSettings = Kn;
    function er(Yr, Ms, Ds) {
      return Sn.handleRequest(Yr, Ms, Ds);
    }
    kn.makeRequest = er;
    class Cr extends Error {
      /**
       * Create a ResponseError from a response, handling the traceback and message
       * as appropriate.
       *
       * @param response The response object.
       *
       * @returns A promise that resolves with a `ResponseError` object.
       */
      static async create(Ms) {
        try {
          const Ds = await Ms.json(), { message: Ls, traceback: js } = Ds;
          return js && console.error(js), new Cr(Ms, Ls ?? Cr._defaultMessage(Ms), js ?? "");
        } catch (Ds) {
          return console.debug(Ds), new Cr(Ms);
        }
      }
      /**
       * Create a new response error.
       */
      constructor(Ms, Ds = Cr._defaultMessage(Ms), Ls = "") {
        super(Ds), this.response = Ms, this.traceback = Ls;
      }
      static _defaultMessage(Ms) {
        return `Invalid response: ${Ms.status} ${Ms.statusText}`;
      }
    }
    kn.ResponseError = Cr;
    class kr extends TypeError {
      /**
       * Create a new network error.
       */
      constructor(Ms) {
        super(Ms.message), this.stack = Ms.stack;
      }
    }
    kn.NetworkError = kr;
  })($n = _e.ServerConnection || (_e.ServerConnection = {}));
  var Sn;
  (function(kn) {
    function Kn(kr = {}) {
      var Yr;
      const Ms = Qt.PageConfig.getBaseUrl(), Ds = Qt.PageConfig.getWsUrl(), Ls = Qt.URLExt.normalize(kr.baseUrl) || Ms;
      let js = kr.wsUrl;
      return !js && Ls === Ms && (js = Ds), !js && Ls.indexOf("http") === 0 && (js = "ws" + Ls.slice(4)), js = js ?? Ds, {
        init: { cache: "no-store", credentials: "same-origin" },
        fetch,
        Headers,
        Request,
        WebSocket: Zt,
        token: Qt.PageConfig.getToken(),
        appUrl: Qt.PageConfig.getOption("appUrl"),
        appendToken: typeof window > "u" || typeof process < "u" && ((Yr = process == null ? void 0 : process.env) === null || Yr === void 0 ? void 0 : Yr.JEST_WORKER_ID) !== void 0 || Qt.URLExt.getHostName(Ms) !== Qt.URLExt.getHostName(js),
        ...kr,
        baseUrl: Ls,
        wsUrl: js
      };
    }
    kn.makeSettings = Kn;
    function er(kr, Yr, Ms) {
      var Ds;
      if (kr.indexOf(Ms.baseUrl) !== 0)
        throw new Error("Can only be used for notebook server requests");
      ((Ds = Yr.cache) !== null && Ds !== void 0 ? Ds : Ms.init.cache) === "no-store" && (kr += (/\?/.test(kr) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
      const js = new Ms.Request(kr, { ...Ms.init, ...Yr });
      let zs = !1;
      if (Ms.token && (zs = !0, js.headers.append("Authorization", `token ${Ms.token}`)), typeof document < "u" && (document != null && document.cookie)) {
        const Fs = Cr("_xsrf");
        Fs !== void 0 && (zs = !0, js.headers.append("X-XSRFToken", Fs));
      }
      return !js.headers.has("Content-Type") && zs && js.headers.set("Content-Type", "application/json"), Ms.fetch.call(null, js).catch((Fs) => {
        throw new $n.NetworkError(Fs);
      });
    }
    kn.handleRequest = er;
    function Cr(kr) {
      const Yr = document.cookie.match("\\b" + kr + "=([^;]*)\\b");
      return Yr == null ? void 0 : Yr[1];
    }
  })(Sn || (Sn = {}));
})(serverconnection);
Object.defineProperty(basemanager, "__esModule", { value: !0 });
basemanager.BaseManager = void 0;
const signaling_1$3 = require$$0$1, serverconnection_1$7 = serverconnection;
class BaseManager {
  constructor(Qt) {
    var Zt;
    this._isDisposed = !1, this._disposed = new signaling_1$3.Signal(this), this.serverSettings = (Zt = Qt.serverSettings) !== null && Zt !== void 0 ? Zt : serverconnection_1$7.ServerConnection.makeSettings();
  }
  /**
   * A signal emitted when the delegate is disposed.
   */
  get disposed() {
    return this._disposed;
  }
  /**
   * Test whether the delegate has been disposed.
   */
  get isDisposed() {
    return this._isDisposed;
  }
  /**
   * Whether the manager is active.
   */
  get isActive() {
    return !0;
  }
  /**
   * Dispose of the delegate and invoke the callback function.
   */
  dispose() {
    this.isDisposed || (this._disposed.emit(void 0), signaling_1$3.Signal.clearData(this));
  }
}
basemanager.BaseManager = BaseManager;
var config = {}, hasRequiredConfig;
function requireConfig() {
  return hasRequiredConfig || (hasRequiredConfig = 1, function(_e) {
    Object.defineProperty(_e, "__esModule", { value: !0 }), _e.ConfigWithDefaults = _e.ConfigSection = void 0;
    const Qt = lib$3, Zt = requireLib(), $n = "api/config";
    (function(Kn) {
      function er(Cr) {
        const kr = new Sn(Cr);
        return kr.load().then(() => kr);
      }
      Kn.create = er;
    })(_e.ConfigSection || (_e.ConfigSection = {}));
    class Sn {
      /**
       * Construct a new config section.
       */
      constructor(er) {
        var Cr;
        this._url = "unknown";
        const kr = this.serverSettings = (Cr = er.serverSettings) !== null && Cr !== void 0 ? Cr : Zt.ServerConnection.makeSettings();
        this._url = Qt.URLExt.join(kr.baseUrl, $n, encodeURIComponent(er.name));
      }
      /**
       * Get the data for this section.
       */
      get data() {
        return this._data;
      }
      /**
       * Load the initial data for this section.
       *
       * #### Notes
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/config).
       *
       * The promise is fulfilled on a valid response and rejected otherwise.
       */
      async load() {
        const er = await Zt.ServerConnection.makeRequest(this._url, {}, this.serverSettings);
        if (er.status !== 200)
          throw await Zt.ServerConnection.ResponseError.create(er);
        this._data = await er.json();
      }
      /**
       * Modify the stored config values.
       *
       * #### Notes
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/config).
       *
       * The promise is fulfilled on a valid response and rejected otherwise.
       *
       * Updates the local data immediately, sends the change to the server,
       * and updates the local data with the response, and fulfils the promise
       * with that data.
       */
      async update(er) {
        this._data = { ...this._data, ...er };
        const Cr = {
          method: "PATCH",
          body: JSON.stringify(er)
        }, kr = await Zt.ServerConnection.makeRequest(this._url, Cr, this.serverSettings);
        if (kr.status !== 200)
          throw await Zt.ServerConnection.ResponseError.create(kr);
        return this._data = await kr.json(), this._data;
      }
    }
    class kn {
      /**
       * Create a new config with defaults.
       */
      constructor(er) {
        var Cr, kr;
        this._className = "", this._section = er.section, this._defaults = (Cr = er.defaults) !== null && Cr !== void 0 ? Cr : {}, this._className = (kr = er.className) !== null && kr !== void 0 ? kr : "";
      }
      /**
       * Get data from the config section or fall back to defaults.
       */
      get(er) {
        const Cr = this._classData();
        return er in Cr ? Cr[er] : this._defaults[er];
      }
      /**
       * Set a config value.
       *
       * #### Notes
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/config).
       *
       * The promise is fulfilled on a valid response and rejected otherwise.
       *
       * Sends the update to the server, and changes our local copy of the data
       * immediately.
       */
      set(er, Cr) {
        const kr = {};
        if (kr[er] = Cr, this._className) {
          const Yr = {};
          return Yr[this._className] = kr, this._section.update(Yr);
        } else
          return this._section.update(kr);
      }
      /**
       * Get data from the Section with our classname, if available.
       *
       * #### Notes
       * If we have no classname, get all of the data in the Section
       */
      _classData() {
        const er = this._section.data;
        return this._className && this._className in er ? er[this._className] : er;
      }
    }
    _e.ConfigWithDefaults = kn;
  }(config)), config;
}
var contents = {}, validate$5 = {}, validate$4 = {};
Object.defineProperty(validate$4, "__esModule", { value: !0 });
validate$4.validateProperty = void 0;
function validateProperty(_e, Qt, Zt, $n = []) {
  if (!_e.hasOwnProperty(Qt))
    throw Error(`Missing property '${Qt}'`);
  const Sn = _e[Qt];
  if (Zt !== void 0) {
    let kn = !0;
    switch (Zt) {
      case "array":
        kn = Array.isArray(Sn);
        break;
      case "object":
        kn = typeof Sn < "u";
        break;
      default:
        kn = typeof Sn === Zt;
    }
    if (!kn)
      throw new Error(`Property '${Qt}' is not of type '${Zt}'`);
    if ($n.length > 0) {
      let Kn = !0;
      switch (Zt) {
        case "string":
        case "number":
        case "boolean":
          Kn = $n.includes(Sn);
          break;
        default:
          Kn = $n.findIndex((er) => er === Sn) >= 0;
          break;
      }
      if (!Kn)
        throw new Error(`Property '${Qt}' is not one of the valid values ${JSON.stringify($n)}`);
    }
  }
}
validate$4.validateProperty = validateProperty;
Object.defineProperty(validate$5, "__esModule", { value: !0 });
validate$5.validateCheckpointModel = validate$5.validateContentsModel = void 0;
const validate_1$4 = validate$4;
function validateContentsModel(_e) {
  (0, validate_1$4.validateProperty)(_e, "name", "string"), (0, validate_1$4.validateProperty)(_e, "path", "string"), (0, validate_1$4.validateProperty)(_e, "type", "string"), (0, validate_1$4.validateProperty)(_e, "created", "string"), (0, validate_1$4.validateProperty)(_e, "last_modified", "string"), (0, validate_1$4.validateProperty)(_e, "mimetype", "object"), (0, validate_1$4.validateProperty)(_e, "content", "object"), (0, validate_1$4.validateProperty)(_e, "format", "object");
}
validate$5.validateContentsModel = validateContentsModel;
function validateCheckpointModel(_e) {
  (0, validate_1$4.validateProperty)(_e, "id", "string"), (0, validate_1$4.validateProperty)(_e, "last_modified", "string");
}
validate$5.validateCheckpointModel = validateCheckpointModel;
var hasRequiredContents;
function requireContents() {
  return hasRequiredContents || (hasRequiredContents = 1, function(_e) {
    var Qt = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(Ls, js, zs, Fs) {
      Fs === void 0 && (Fs = zs);
      var Bs = Object.getOwnPropertyDescriptor(js, zs);
      (!Bs || ("get" in Bs ? !js.__esModule : Bs.writable || Bs.configurable)) && (Bs = { enumerable: !0, get: function() {
        return js[zs];
      } }), Object.defineProperty(Ls, Fs, Bs);
    } : function(Ls, js, zs, Fs) {
      Fs === void 0 && (Fs = zs), Ls[Fs] = js[zs];
    }), Zt = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(Ls, js) {
      Object.defineProperty(Ls, "default", { enumerable: !0, value: js });
    } : function(Ls, js) {
      Ls.default = js;
    }), $n = commonjsGlobal && commonjsGlobal.__importStar || function(Ls) {
      if (Ls && Ls.__esModule)
        return Ls;
      var js = {};
      if (Ls != null)
        for (var zs in Ls)
          zs !== "default" && Object.prototype.hasOwnProperty.call(Ls, zs) && Qt(js, Ls, zs);
      return Zt(js, Ls), js;
    };
    Object.defineProperty(_e, "__esModule", { value: !0 }), _e.Drive = _e.ContentsManager = _e.Contents = void 0;
    const Sn = lib$3, kn = require$$0$1, Kn = requireLib(), er = $n(validate$5), Cr = "api/contents", kr = "files";
    (function(Ls) {
      function js(Fs) {
        er.validateContentsModel(Fs);
      }
      Ls.validateContentsModel = js;
      function zs(Fs) {
        er.validateCheckpointModel(Fs);
      }
      Ls.validateCheckpointModel = zs;
    })(_e.Contents || (_e.Contents = {}));
    class Yr {
      /**
       * Construct a new contents manager object.
       *
       * @param options - The options used to initialize the object.
       */
      constructor(js = {}) {
        var zs, Fs;
        this._isDisposed = !1, this._additionalDrives = /* @__PURE__ */ new Map(), this._fileChanged = new kn.Signal(this);
        const Bs = this.serverSettings = (zs = js.serverSettings) !== null && zs !== void 0 ? zs : Kn.ServerConnection.makeSettings();
        this._defaultDrive = (Fs = js.defaultDrive) !== null && Fs !== void 0 ? Fs : new Ms({ serverSettings: Bs }), this._defaultDrive.fileChanged.connect(this._onFileChanged, this);
      }
      /**
       * A signal emitted when a file operation takes place.
       */
      get fileChanged() {
        return this._fileChanged;
      }
      /**
       * Test whether the manager has been disposed.
       */
      get isDisposed() {
        return this._isDisposed;
      }
      /**
       * Dispose of the resources held by the manager.
       */
      dispose() {
        this.isDisposed || (this._isDisposed = !0, kn.Signal.clearData(this));
      }
      /**
       * Add an `IDrive` to the manager.
       */
      addDrive(js) {
        this._additionalDrives.set(js.name, js), js.fileChanged.connect(this._onFileChanged, this);
      }
      /**
       * Given a path, get a shared model factory from the
       * relevant backend. Returns `null` if the backend
       * does not provide one.
       */
      getSharedModelFactory(js) {
        var zs;
        const [Fs] = this._driveForPath(js);
        return (zs = Fs == null ? void 0 : Fs.sharedModelFactory) !== null && zs !== void 0 ? zs : null;
      }
      /**
       * Given a path of the form `drive:local/portion/of/it.txt`
       * get the local part of it.
       *
       * @param path: the path.
       *
       * @returns The local part of the path.
       */
      localPath(js) {
        const zs = js.split("/"), Fs = zs[0].split(":");
        return Fs.length === 1 || !this._additionalDrives.has(Fs[0]) ? Sn.PathExt.removeSlash(js) : Sn.PathExt.join(Fs.slice(1).join(":"), ...zs.slice(1));
      }
      /**
       * Normalize a global path. Reduces '..' and '.' parts, and removes
       * leading slashes from the local part of the path, while retaining
       * the drive name if it exists.
       *
       * @param path: the path.
       *
       * @returns The normalized path.
       */
      normalize(js) {
        const zs = js.split(":");
        return zs.length === 1 ? Sn.PathExt.normalize(js) : `${zs[0]}:${Sn.PathExt.normalize(zs.slice(1).join(":"))}`;
      }
      /**
       * Resolve a global path, starting from the root path. Behaves like
       * posix-path.resolve, with 3 differences:
       *  - will never prepend cwd
       *  - if root has a drive name, the result is prefixed with "<drive>:"
       *  - before adding drive name, leading slashes are removed
       *
       * @param path: the path.
       *
       * @returns The normalized path.
       */
      resolvePath(js, zs) {
        const Fs = this.driveName(js), Bs = this.localPath(js), Hs = Sn.PathExt.resolve("/", Bs, zs);
        return Fs ? `${Fs}:${Hs}` : Hs;
      }
      /**
       * Given a path of the form `drive:local/portion/of/it.txt`
       * get the name of the drive. If the path is missing
       * a drive portion, returns an empty string.
       *
       * @param path: the path.
       *
       * @returns The drive name for the path, or the empty string.
       */
      driveName(js) {
        const Fs = js.split("/")[0].split(":");
        return Fs.length === 1 ? "" : this._additionalDrives.has(Fs[0]) ? Fs[0] : "";
      }
      /**
       * Get a file or directory.
       *
       * @param path: The path to the file.
       *
       * @param options: The options used to fetch the file.
       *
       * @returns A promise which resolves with the file content.
       */
      get(js, zs) {
        const [Fs, Bs] = this._driveForPath(js);
        return Fs.get(Bs, zs).then((Hs) => {
          const Ws = [];
          if (Hs.type === "directory" && Hs.content) {
            for (const Ys of Hs.content)
              Ws.push({ ...Ys, path: this._toGlobalPath(Fs, Ys.path) });
            return {
              ...Hs,
              path: this._toGlobalPath(Fs, Bs),
              content: Ws,
              serverPath: Hs.path
            };
          } else
            return {
              ...Hs,
              path: this._toGlobalPath(Fs, Bs),
              serverPath: Hs.path
            };
        });
      }
      /**
       * Get an encoded download url given a file path.
       *
       * @param path - An absolute POSIX file path on the server.
       *
       * #### Notes
       * It is expected that the path contains no relative paths.
       *
       * The returned URL may include a query parameter.
       */
      getDownloadUrl(js) {
        const [zs, Fs] = this._driveForPath(js);
        return zs.getDownloadUrl(Fs);
      }
      /**
       * Create a new untitled file or directory in the specified directory path.
       *
       * @param options: The options used to create the file.
       *
       * @returns A promise which resolves with the created file content when the
       *    file is created.
       */
      newUntitled(js = {}) {
        if (js.path) {
          const zs = this.normalize(js.path), [Fs, Bs] = this._driveForPath(zs);
          return Fs.newUntitled({ ...js, path: Bs }).then((Hs) => ({
            ...Hs,
            path: Sn.PathExt.join(zs, Hs.name),
            serverPath: Hs.path
          }));
        } else
          return this._defaultDrive.newUntitled(js);
      }
      /**
       * Delete a file.
       *
       * @param path - The path to the file.
       *
       * @returns A promise which resolves when the file is deleted.
       */
      delete(js) {
        const [zs, Fs] = this._driveForPath(js);
        return zs.delete(Fs);
      }
      /**
       * Rename a file or directory.
       *
       * @param path - The original file path.
       *
       * @param newPath - The new file path.
       *
       * @returns A promise which resolves with the new file contents model when
       *   the file is renamed.
       */
      rename(js, zs) {
        const [Fs, Bs] = this._driveForPath(js), [Hs, Ws] = this._driveForPath(zs);
        if (Fs !== Hs)
          throw Error("ContentsManager: renaming files must occur within a Drive");
        return Fs.rename(Bs, Ws).then((Ys) => ({
          ...Ys,
          path: this._toGlobalPath(Fs, Ws),
          serverPath: Ys.path
        }));
      }
      /**
       * Save a file.
       *
       * @param path - The desired file path.
       *
       * @param options - Optional overrides to the model.
       *
       * @returns A promise which resolves with the file content model when the
       *   file is saved.
       *
       * #### Notes
       * Ensure that `model.content` is populated for the file.
       */
      save(js, zs = {}) {
        const Fs = this.normalize(js), [Bs, Hs] = this._driveForPath(js);
        return Bs.save(Hs, { ...zs, path: Hs }).then((Ws) => ({
          ...Ws,
          path: Fs,
          serverPath: Ws.path
        }));
      }
      /**
       * Copy a file into a given directory.
       *
       * @param path - The original file path.
       *
       * @param toDir - The destination directory path.
       *
       * @returns A promise which resolves with the new contents model when the
       *  file is copied.
       *
       * #### Notes
       * The server will select the name of the copied file.
       */
      copy(js, zs) {
        const [Fs, Bs] = this._driveForPath(js), [Hs, Ws] = this._driveForPath(zs);
        if (Fs === Hs)
          return Fs.copy(Bs, Ws).then((Ys) => ({
            ...Ys,
            path: this._toGlobalPath(Fs, Ys.path),
            serverPath: Ys.path
          }));
        throw Error("Copying files between drives is not currently implemented");
      }
      /**
       * Create a checkpoint for a file.
       *
       * @param path - The path of the file.
       *
       * @returns A promise which resolves with the new checkpoint model when the
       *   checkpoint is created.
       */
      createCheckpoint(js) {
        const [zs, Fs] = this._driveForPath(js);
        return zs.createCheckpoint(Fs);
      }
      /**
       * List available checkpoints for a file.
       *
       * @param path - The path of the file.
       *
       * @returns A promise which resolves with a list of checkpoint models for
       *    the file.
       */
      listCheckpoints(js) {
        const [zs, Fs] = this._driveForPath(js);
        return zs.listCheckpoints(Fs);
      }
      /**
       * Restore a file to a known checkpoint state.
       *
       * @param path - The path of the file.
       *
       * @param checkpointID - The id of the checkpoint to restore.
       *
       * @returns A promise which resolves when the checkpoint is restored.
       */
      restoreCheckpoint(js, zs) {
        const [Fs, Bs] = this._driveForPath(js);
        return Fs.restoreCheckpoint(Bs, zs);
      }
      /**
       * Delete a checkpoint for a file.
       *
       * @param path - The path of the file.
       *
       * @param checkpointID - The id of the checkpoint to delete.
       *
       * @returns A promise which resolves when the checkpoint is deleted.
       */
      deleteCheckpoint(js, zs) {
        const [Fs, Bs] = this._driveForPath(js);
        return Fs.deleteCheckpoint(Bs, zs);
      }
      /**
       * Given a drive and a local path, construct a fully qualified
       * path. The inverse of `_driveForPath`.
       *
       * @param drive: an `IDrive`.
       *
       * @param localPath: the local path on the drive.
       *
       * @returns the fully qualified path.
       */
      _toGlobalPath(js, zs) {
        return js === this._defaultDrive ? Sn.PathExt.removeSlash(zs) : `${js.name}:${Sn.PathExt.removeSlash(zs)}`;
      }
      /**
       * Given a path, get the `IDrive to which it refers,
       * where the path satisfies the pattern
       * `'driveName:path/to/file'`. If there is no `driveName`
       * prepended to the path, it returns the default drive.
       *
       * @param path: a path to a file.
       *
       * @returns A tuple containing an `IDrive` object for the path,
       * and a local path for that drive.
       */
      _driveForPath(js) {
        const zs = this.driveName(js), Fs = this.localPath(js);
        return zs ? [this._additionalDrives.get(zs), Fs] : [this._defaultDrive, Fs];
      }
      /**
       * Respond to fileChanged signals from the drives attached to
       * the manager. This prepends the drive name to the path if necessary,
       * and then forwards the signal.
       */
      _onFileChanged(js, zs) {
        var Fs, Bs;
        if (js === this._defaultDrive)
          this._fileChanged.emit(zs);
        else {
          let Hs = null, Ws = null;
          !((Fs = zs.newValue) === null || Fs === void 0) && Fs.path && (Hs = {
            ...zs.newValue,
            path: this._toGlobalPath(js, zs.newValue.path)
          }), !((Bs = zs.oldValue) === null || Bs === void 0) && Bs.path && (Ws = {
            ...zs.oldValue,
            path: this._toGlobalPath(js, zs.oldValue.path)
          }), this._fileChanged.emit({
            type: zs.type,
            newValue: Hs,
            oldValue: Ws
          });
        }
      }
    }
    _e.ContentsManager = Yr;
    class Ms {
      /**
       * Construct a new contents manager object.
       *
       * @param options - The options used to initialize the object.
       */
      constructor(js = {}) {
        var zs, Fs, Bs;
        this._isDisposed = !1, this._fileChanged = new kn.Signal(this), this.name = (zs = js.name) !== null && zs !== void 0 ? zs : "Default", this._apiEndpoint = (Fs = js.apiEndpoint) !== null && Fs !== void 0 ? Fs : Cr, this.serverSettings = (Bs = js.serverSettings) !== null && Bs !== void 0 ? Bs : Kn.ServerConnection.makeSettings();
      }
      /**
       * A signal emitted when a file operation takes place.
       */
      get fileChanged() {
        return this._fileChanged;
      }
      /**
       * Test whether the manager has been disposed.
       */
      get isDisposed() {
        return this._isDisposed;
      }
      /**
       * Dispose of the resources held by the manager.
       */
      dispose() {
        this.isDisposed || (this._isDisposed = !0, kn.Signal.clearData(this));
      }
      /**
       * Get a file or directory.
       *
       * @param localPath: The path to the file.
       *
       * @param options: The options used to fetch the file.
       *
       * @returns A promise which resolves with the file content.
       *
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model.
       */
      async get(js, zs) {
        let Fs = this._getUrl(js);
        if (zs) {
          zs.type === "notebook" && delete zs.format;
          const Ys = zs.content ? "1" : "0", El = { ...zs, content: Ys };
          Fs += Sn.URLExt.objectToQueryString(El);
        }
        const Bs = this.serverSettings, Hs = await Kn.ServerConnection.makeRequest(Fs, {}, Bs);
        if (Hs.status !== 200)
          throw await Kn.ServerConnection.ResponseError.create(Hs);
        const Ws = await Hs.json();
        return er.validateContentsModel(Ws), Ws;
      }
      /**
       * Get an encoded download url given a file path.
       *
       * @param localPath - An absolute POSIX file path on the server.
       *
       * #### Notes
       * It is expected that the path contains no relative paths.
       *
       * The returned URL may include a query parameter.
       */
      getDownloadUrl(js) {
        const zs = this.serverSettings.baseUrl;
        let Fs = Sn.URLExt.join(zs, kr, Sn.URLExt.encodeParts(js));
        const Bs = document.cookie.match("\\b_xsrf=([^;]*)\\b");
        if (Bs) {
          const Hs = new URL(Fs);
          Hs.searchParams.append("_xsrf", Bs[1]), Fs = Hs.toString();
        }
        return Promise.resolve(Fs);
      }
      /**
       * Create a new untitled file or directory in the specified directory path.
       *
       * @param options: The options used to create the file.
       *
       * @returns A promise which resolves with the created file content when the
       *    file is created.
       *
       * #### Notes
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model.
       */
      async newUntitled(js = {}) {
        var zs;
        let Fs = "{}";
        js && (js.ext && (js.ext = Ds.normalizeExtension(js.ext)), Fs = JSON.stringify(js));
        const Bs = this.serverSettings, Hs = this._getUrl((zs = js.path) !== null && zs !== void 0 ? zs : ""), Ws = {
          method: "POST",
          body: Fs
        }, Ys = await Kn.ServerConnection.makeRequest(Hs, Ws, Bs);
        if (Ys.status !== 201)
          throw await Kn.ServerConnection.ResponseError.create(Ys);
        const El = await Ys.json();
        return er.validateContentsModel(El), this._fileChanged.emit({
          type: "new",
          oldValue: null,
          newValue: El
        }), El;
      }
      /**
       * Delete a file.
       *
       * @param localPath - The path to the file.
       *
       * @returns A promise which resolves when the file is deleted.
       *
       * #### Notes
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents).
       */
      async delete(js) {
        const zs = this._getUrl(js), Fs = this.serverSettings, Bs = { method: "DELETE" }, Hs = await Kn.ServerConnection.makeRequest(zs, Bs, Fs);
        if (Hs.status !== 204)
          throw await Kn.ServerConnection.ResponseError.create(Hs);
        this._fileChanged.emit({
          type: "delete",
          oldValue: { path: js },
          newValue: null
        });
      }
      /**
       * Rename a file or directory.
       *
       * @param oldLocalPath - The original file path.
       *
       * @param newLocalPath - The new file path.
       *
       * @returns A promise which resolves with the new file contents model when
       *   the file is renamed.
       *
       * #### Notes
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model.
       */
      async rename(js, zs) {
        const Fs = this.serverSettings, Bs = this._getUrl(js), Hs = {
          method: "PATCH",
          body: JSON.stringify({ path: zs })
        }, Ws = await Kn.ServerConnection.makeRequest(Bs, Hs, Fs);
        if (Ws.status !== 200)
          throw await Kn.ServerConnection.ResponseError.create(Ws);
        const Ys = await Ws.json();
        return er.validateContentsModel(Ys), this._fileChanged.emit({
          type: "rename",
          oldValue: { path: js },
          newValue: Ys
        }), Ys;
      }
      /**
       * Save a file.
       *
       * @param localPath - The desired file path.
       *
       * @param options - Optional overrides to the model.
       *
       * @returns A promise which resolves with the file content model when the
       *   file is saved.
       *
       * #### Notes
       * Ensure that `model.content` is populated for the file.
       *
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model.
       */
      async save(js, zs = {}) {
        const Fs = this.serverSettings, Bs = this._getUrl(js), Hs = {
          method: "PUT",
          body: JSON.stringify(zs)
        }, Ws = await Kn.ServerConnection.makeRequest(Bs, Hs, Fs);
        if (Ws.status !== 200 && Ws.status !== 201)
          throw await Kn.ServerConnection.ResponseError.create(Ws);
        const Ys = await Ws.json();
        return er.validateContentsModel(Ys), this._fileChanged.emit({
          type: "save",
          oldValue: null,
          newValue: Ys
        }), Ys;
      }
      /**
       * Copy a file into a given directory.
       *
       * @param localPath - The original file path.
       *
       * @param toDir - The destination directory path.
       *
       * @returns A promise which resolves with the new contents model when the
       *  file is copied.
       *
       * #### Notes
       * The server will select the name of the copied file.
       *
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model.
       */
      async copy(js, zs) {
        const Fs = this.serverSettings, Bs = this._getUrl(zs), Hs = {
          method: "POST",
          body: JSON.stringify({ copy_from: js })
        }, Ws = await Kn.ServerConnection.makeRequest(Bs, Hs, Fs);
        if (Ws.status !== 201)
          throw await Kn.ServerConnection.ResponseError.create(Ws);
        const Ys = await Ws.json();
        return er.validateContentsModel(Ys), this._fileChanged.emit({
          type: "new",
          oldValue: null,
          newValue: Ys
        }), Ys;
      }
      /**
       * Create a checkpoint for a file.
       *
       * @param localPath - The path of the file.
       *
       * @returns A promise which resolves with the new checkpoint model when the
       *   checkpoint is created.
       *
       * #### Notes
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model.
       */
      async createCheckpoint(js) {
        const zs = this._getUrl(js, "checkpoints"), Fs = { method: "POST" }, Bs = await Kn.ServerConnection.makeRequest(zs, Fs, this.serverSettings);
        if (Bs.status !== 201)
          throw await Kn.ServerConnection.ResponseError.create(Bs);
        const Hs = await Bs.json();
        return er.validateCheckpointModel(Hs), Hs;
      }
      /**
       * List available checkpoints for a file.
       *
       * @param localPath - The path of the file.
       *
       * @returns A promise which resolves with a list of checkpoint models for
       *    the file.
       *
       * #### Notes
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model.
       */
      async listCheckpoints(js) {
        const zs = this._getUrl(js, "checkpoints"), Fs = await Kn.ServerConnection.makeRequest(zs, {}, this.serverSettings);
        if (Fs.status !== 200)
          throw await Kn.ServerConnection.ResponseError.create(Fs);
        const Bs = await Fs.json();
        if (!Array.isArray(Bs))
          throw new Error("Invalid Checkpoint list");
        for (let Hs = 0; Hs < Bs.length; Hs++)
          er.validateCheckpointModel(Bs[Hs]);
        return Bs;
      }
      /**
       * Restore a file to a known checkpoint state.
       *
       * @param localPath - The path of the file.
       *
       * @param checkpointID - The id of the checkpoint to restore.
       *
       * @returns A promise which resolves when the checkpoint is restored.
       *
       * #### Notes
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents).
       */
      async restoreCheckpoint(js, zs) {
        const Fs = this._getUrl(js, "checkpoints", zs), Bs = { method: "POST" }, Hs = await Kn.ServerConnection.makeRequest(Fs, Bs, this.serverSettings);
        if (Hs.status !== 204)
          throw await Kn.ServerConnection.ResponseError.create(Hs);
      }
      /**
       * Delete a checkpoint for a file.
       *
       * @param localPath - The path of the file.
       *
       * @param checkpointID - The id of the checkpoint to delete.
       *
       * @returns A promise which resolves when the checkpoint is deleted.
       *
       * #### Notes
       * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents).
       */
      async deleteCheckpoint(js, zs) {
        const Fs = this._getUrl(js, "checkpoints", zs), Bs = { method: "DELETE" }, Hs = await Kn.ServerConnection.makeRequest(Fs, Bs, this.serverSettings);
        if (Hs.status !== 204)
          throw await Kn.ServerConnection.ResponseError.create(Hs);
      }
      /**
       * Get a REST url for a file given a path.
       */
      _getUrl(...js) {
        const zs = js.map((Bs) => Sn.URLExt.encodeParts(Bs)), Fs = this.serverSettings.baseUrl;
        return Sn.URLExt.join(Fs, this._apiEndpoint, ...zs);
      }
    }
    _e.Drive = Ms;
    var Ds;
    (function(Ls) {
      function js(zs) {
        return zs.length > 0 && zs.indexOf(".") !== 0 && (zs = `.${zs}`), zs;
      }
      Ls.normalizeExtension = js;
    })(Ds || (Ds = {}));
  }(contents)), contents;
}
var event$1 = {};
class Poll {
  /**
   * Instantiate a new poll with exponential backoff in case of failure.
   *
   * @param options - The poll instantiation options.
   */
  constructor(Qt) {
    var Zt;
    this._disposed = new Signal(this), this._lingered = 0, this._tick = new PromiseDelegate(), this._ticked = new Signal(this), this._factory = Qt.factory, this._linger = (Zt = Qt.linger) !== null && Zt !== void 0 ? Zt : Private$b.DEFAULT_LINGER, this._standby = Qt.standby || Private$b.DEFAULT_STANDBY, this._state = { ...Private$b.DEFAULT_STATE, timestamp: (/* @__PURE__ */ new Date()).getTime() };
    const $n = Qt.frequency || {}, Sn = Math.max($n.interval || 0, $n.max || 0, Private$b.DEFAULT_FREQUENCY.max);
    this.frequency = { ...Private$b.DEFAULT_FREQUENCY, ...$n, max: Sn }, this.name = Qt.name || Private$b.DEFAULT_NAME, (!("auto" in Qt) || Qt.auto) && setTimeout(() => this.start());
  }
  /**
   * A signal emitted when the poll is disposed.
   */
  get disposed() {
    return this._disposed;
  }
  /**
   * The polling frequency parameters.
   */
  get frequency() {
    return this._frequency;
  }
  set frequency(Qt) {
    if (this.isDisposed || JSONExt.deepEqual(Qt, this.frequency || {}))
      return;
    let { backoff: Zt, interval: $n, max: Sn } = Qt;
    if ($n = Math.round($n), Sn = Math.round(Sn), typeof Zt == "number" && Zt < 1)
      throw new Error("Poll backoff growth factor must be at least 1");
    if (($n < 0 || $n > Sn) && $n !== Poll.NEVER)
      throw new Error("Poll interval must be between 0 and max");
    if (Sn > Poll.MAX_INTERVAL && Sn !== Poll.NEVER)
      throw new Error(`Max interval must be less than ${Poll.MAX_INTERVAL}`);
    this._frequency = { backoff: Zt, interval: $n, max: Sn };
  }
  /**
   * Whether the poll is disposed.
   */
  get isDisposed() {
    return this.state.phase === "disposed";
  }
  /**
   * Indicates when the poll switches to standby.
   */
  get standby() {
    return this._standby;
  }
  set standby(Qt) {
    this.isDisposed || this.standby === Qt || (this._standby = Qt);
  }
  /**
   * The poll state, which is the content of the current poll tick.
   */
  get state() {
    return this._state;
  }
  /**
   * A promise that resolves when the poll next ticks.
   */
  get tick() {
    return this._tick.promise;
  }
  /**
   * A signal emitted when the poll ticks and fires off a new request.
   */
  get ticked() {
    return this._ticked;
  }
  /**
   * Return an async iterator that yields every tick.
   */
  async *[Symbol.asyncIterator]() {
    for (; !this.isDisposed; )
      yield this.state, await this.tick.catch(() => {
      });
  }
  /**
   * Dispose the poll.
   */
  dispose() {
    this.isDisposed || (this._state = {
      ...Private$b.DISPOSED_STATE,
      timestamp: (/* @__PURE__ */ new Date()).getTime()
    }, this._tick.promise.catch((Qt) => {
    }), this._tick.reject(new Error(`Poll (${this.name}) is disposed.`)), this._disposed.emit(void 0), Signal.clearData(this));
  }
  /**
   * Refreshes the poll. Schedules `refreshed` tick if necessary.
   *
   * @returns A promise that resolves after tick is scheduled and never rejects.
   *
   * #### Notes
   * The returned promise resolves after the tick is scheduled, but before
   * the polling action is run. To wait until after the poll action executes,
   * await the `poll.tick` promise: `await poll.refresh(); await poll.tick;`
   */
  refresh() {
    return this.schedule({
      cancel: ({ phase: Qt }) => Qt === "refreshed",
      interval: Poll.IMMEDIATE,
      phase: "refreshed"
    });
  }
  /**
   * Schedule the next poll tick.
   *
   * @param next - The next poll state data to schedule. Defaults to standby.
   *
   * @param next.cancel - Cancels state transition if function returns `true`.
   *
   * @returns A promise that resolves when the next poll state is active.
   *
   * #### Notes
   * This method is not meant to be invoked by user code typically. It is public
   * to allow poll instances to be composed into classes that schedule ticks.
   */
  async schedule(Qt = {}) {
    if (this.isDisposed || Qt.cancel && Qt.cancel(this.state))
      return;
    const Zt = this._tick, $n = new PromiseDelegate(), Sn = {
      interval: this.frequency.interval,
      payload: null,
      phase: "standby",
      timestamp: (/* @__PURE__ */ new Date()).getTime(),
      ...Qt
    };
    if (this._state = Sn, this._tick = $n, clearTimeout(this._timeout), this._ticked.emit(this.state), Zt.resolve(this), await Zt.promise, Sn.interval === Poll.NEVER) {
      this._timeout = void 0;
      return;
    }
    const kn = () => {
      this.isDisposed || this.tick !== $n.promise || this._execute();
    };
    this._timeout = setTimeout(kn, Sn.interval);
  }
  /**
   * Starts the poll. Schedules `started` tick if necessary.
   *
   * @returns A promise that resolves after tick is scheduled and never rejects.
   */
  start() {
    return this.schedule({
      cancel: ({ phase: Qt }) => Qt !== "constructed" && Qt !== "standby" && Qt !== "stopped",
      interval: Poll.IMMEDIATE,
      phase: "started"
    });
  }
  /**
   * Stops the poll. Schedules `stopped` tick if necessary.
   *
   * @returns A promise that resolves after tick is scheduled and never rejects.
   */
  stop() {
    return this.schedule({
      cancel: ({ phase: Qt }) => Qt === "stopped",
      interval: Poll.NEVER,
      phase: "stopped"
    });
  }
  /**
   * Whether the poll is hidden.
   *
   * #### Notes
   * This property is only relevant in a browser context.
   */
  get hidden() {
    return Private$b.hidden;
  }
  /**
   * Execute a new poll factory promise or stand by if necessary.
   */
  _execute() {
    let Qt = typeof this.standby == "function" ? this.standby() : this.standby;
    if (Qt === "never" ? Qt = !1 : Qt === "when-hidden" && (this.hidden ? Qt = ++this._lingered > this._linger : (this._lingered = 0, Qt = !1)), Qt) {
      this.schedule();
      return;
    }
    const Zt = this.tick;
    this._factory(this.state).then(($n) => {
      this.isDisposed || this.tick !== Zt || this.schedule({
        payload: $n,
        phase: this.state.phase === "rejected" ? "reconnected" : "resolved"
      });
    }).catch(($n) => {
      this.isDisposed || this.tick !== Zt || this.schedule({
        interval: Private$b.sleep(this.frequency, this.state),
        payload: $n,
        phase: "rejected"
      });
    });
  }
}
(function(_e) {
  _e.IMMEDIATE = 0, _e.MAX_INTERVAL = 2147483647, _e.NEVER = 1 / 0;
})(Poll || (Poll = {}));
var Private$b;
(function(_e) {
  _e.DEFAULT_BACKOFF = 3, _e.DEFAULT_FREQUENCY = {
    backoff: !0,
    interval: 1e3,
    max: 30 * 1e3
  }, _e.DEFAULT_LINGER = 1, _e.DEFAULT_NAME = "unknown", _e.DEFAULT_STANDBY = "when-hidden", _e.DEFAULT_STATE = {
    interval: Poll.NEVER,
    payload: null,
    phase: "constructed",
    timestamp: (/* @__PURE__ */ new Date(0)).getTime()
  }, _e.DISPOSED_STATE = {
    interval: Poll.NEVER,
    payload: null,
    phase: "disposed",
    timestamp: (/* @__PURE__ */ new Date(0)).getTime()
  };
  function Qt($n, Sn) {
    const { backoff: kn, interval: Kn, max: er } = $n;
    if (Kn === Poll.NEVER)
      return Kn;
    const Cr = kn === !0 ? _e.DEFAULT_BACKOFF : kn === !1 ? 1 : kn, kr = Zt(Kn, Sn.interval * Cr);
    return Math.min(er, kr);
  }
  _e.sleep = Qt, _e.hidden = (() => typeof document > "u" ? !1 : (document.addEventListener("visibilitychange", () => {
    _e.hidden = document.visibilityState === "hidden";
  }), document.addEventListener("pagehide", () => {
    _e.hidden = document.visibilityState === "hidden";
  }), document.visibilityState === "hidden"))();
  function Zt($n, Sn) {
    return $n = Math.ceil($n), Sn = Math.floor(Sn), Math.floor(Math.random() * (Sn - $n + 1)) + $n;
  }
})(Private$b || (Private$b = {}));
class RateLimiter {
  /**
   * Instantiate a rate limiter.
   *
   * @param fn - The function to rate limit.
   *
   * @param limit - The rate limit; defaults to 500ms.
   */
  constructor(Qt, Zt = 500) {
    this.args = void 0, this.payload = null, this.limit = Zt, this.poll = new Poll({
      auto: !1,
      factory: async () => {
        const { args: $n } = this;
        return this.args = void 0, Qt(...$n);
      },
      frequency: { backoff: !1, interval: Poll.NEVER, max: Poll.NEVER },
      standby: "never"
    }), this.payload = new PromiseDelegate(), this.poll.ticked.connect(($n, Sn) => {
      const { payload: kn } = this;
      if (Sn.phase === "resolved") {
        this.payload = new PromiseDelegate(), kn.resolve(Sn.payload);
        return;
      }
      if (Sn.phase === "rejected" || Sn.phase === "stopped") {
        this.payload = new PromiseDelegate(), kn.promise.catch((Kn) => {
        }), kn.reject(Sn.payload);
        return;
      }
    }, this);
  }
  /**
   * Whether the rate limiter is disposed.
   */
  get isDisposed() {
    return this.payload === null;
  }
  /**
   * Disposes the rate limiter.
   */
  dispose() {
    this.isDisposed || (this.args = void 0, this.payload = null, this.poll.dispose());
  }
  /**
   * Stop the function if it is mid-flight.
   */
  async stop() {
    return this.poll.stop();
  }
}
class Debouncer extends RateLimiter {
  /**
   * Invokes the function and only executes after rate limit has elapsed.
   * Each invocation resets the timer.
   */
  invoke(...Qt) {
    return this.args = Qt, this.poll.schedule({ interval: this.limit, phase: "invoked" }), this.payload.promise;
  }
}
class Throttler extends RateLimiter {
  /**
   * Instantiate a throttler.
   *
   * @param fn - The function being throttled.
   *
   * @param options - Throttling configuration or throttling limit in ms.
   *
   * #### Notes
   * The `edge` defaults to `leading`; the `limit` defaults to `500`.
   */
  constructor(Qt, Zt) {
    super(Qt, typeof Zt == "number" ? Zt : Zt && Zt.limit), this._trailing = !1, typeof Zt != "number" && Zt && Zt.edge === "trailing" && (this._trailing = !0), this._interval = this._trailing ? this.limit : Poll.IMMEDIATE;
  }
  /**
   * Throttles function invocations if one is currently in flight.
   */
  invoke(...Qt) {
    const Zt = this.poll.state.phase !== "invoked";
    return (Zt || this._trailing) && (this.args = Qt), Zt && this.poll.schedule({ interval: this._interval, phase: "invoked" }), this.payload.promise;
  }
}
const index_es6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  Debouncer,
  get Poll() {
    return Poll;
  },
  RateLimiter,
  Throttler
}, Symbol.toStringTag, { value: "Module" })), require$$2 = /* @__PURE__ */ getAugmentedNamespace(index_es6);
Object.defineProperty(event$1, "__esModule", { value: !0 });
event$1.EventManager = void 0;
const coreutils_1$8 = lib$3, polling_1$2 = require$$2, signaling_1$2 = require$$0$1, serverconnection_1$6 = serverconnection, SERVICE_EVENTS_URL = "api/events";
class EventManager {
  /**
   * Create a new event manager.
   */
  constructor(Qt = {}) {
    var Zt;
    this._socket = null, this.serverSettings = (Zt = Qt.serverSettings) !== null && Zt !== void 0 ? Zt : serverconnection_1$6.ServerConnection.makeSettings(), this._poll = new polling_1$2.Poll({ factory: () => this._subscribe() }), this._stream = new signaling_1$2.Stream(this), this._poll.start();
  }
  /**
   * Whether the event manager is disposed.
   */
  get isDisposed() {
    return this._poll.isDisposed;
  }
  /**
   * An event stream that emits and yields each new event.
   */
  get stream() {
    return this._stream;
  }
  /**
   * Dispose the event manager.
   */
  dispose() {
    if (this.isDisposed)
      return;
    this._poll.dispose();
    const Qt = this._socket;
    Qt && (this._socket = null, Qt.onopen = () => {
    }, Qt.onerror = () => {
    }, Qt.onmessage = () => {
    }, Qt.onclose = () => {
    }, Qt.close()), signaling_1$2.Signal.clearData(this), this._stream.stop();
  }
  /**
   * Post an event request to be emitted by the event bus.
   */
  async emit(Qt) {
    const { serverSettings: Zt } = this, { baseUrl: $n, token: Sn } = Zt, { makeRequest: kn, ResponseError: Kn } = serverconnection_1$6.ServerConnection, er = coreutils_1$8.URLExt.join($n, SERVICE_EVENTS_URL) + (Sn ? `?token=${Sn}` : ""), Cr = { body: JSON.stringify(Qt), method: "POST" }, kr = await kn(er, Cr, Zt);
    if (kr.status !== 204)
      throw new Kn(kr);
  }
  /**
   * Subscribe to event bus emissions.
   */
  _subscribe() {
    return new Promise((Qt, Zt) => {
      if (this.isDisposed)
        return;
      const { token: $n, WebSocket: Sn, wsUrl: kn } = this.serverSettings, Kn = coreutils_1$8.URLExt.join(kn, SERVICE_EVENTS_URL, "subscribe") + ($n ? `?token=${encodeURIComponent($n)}` : ""), er = this._socket = new Sn(Kn), Cr = this._stream;
      er.onclose = () => Zt(new Error("EventManager socket closed")), er.onmessage = (kr) => kr.data && Cr.emit(JSON.parse(kr.data));
    });
  }
}
event$1.EventManager = EventManager;
var kernel$1 = {}, kernel = {};
Object.defineProperty(kernel, "__esModule", { value: !0 });
var messages = {};
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.supportedKernelWebSocketProtocols = _e.isInputReplyMsg = _e.isInputRequestMsg = _e.isDebugReplyMsg = _e.isDebugRequestMsg = _e.isExecuteReplyMsg = _e.isInfoRequestMsg = _e.isCommMsgMsg = _e.isCommCloseMsg = _e.isCommOpenMsg = _e.isDebugEventMsg = _e.isClearOutputMsg = _e.isStatusMsg = _e.isErrorMsg = _e.isExecuteResultMsg = _e.isExecuteInputMsg = _e.isUpdateDisplayDataMsg = _e.isDisplayDataMsg = _e.isStreamMsg = _e.createMessage = void 0;
  const Qt = require$$1$2;
  function Zt(El) {
    var Mu, Pl, Iu, Tu, Au;
    return {
      buffers: (Mu = El.buffers) !== null && Mu !== void 0 ? Mu : [],
      channel: El.channel,
      content: El.content,
      header: {
        date: (/* @__PURE__ */ new Date()).toISOString(),
        msg_id: (Pl = El.msgId) !== null && Pl !== void 0 ? Pl : Qt.UUID.uuid4(),
        msg_type: El.msgType,
        session: El.session,
        username: (Iu = El.username) !== null && Iu !== void 0 ? Iu : "",
        version: "5.2"
      },
      metadata: (Tu = El.metadata) !== null && Tu !== void 0 ? Tu : {},
      parent_header: (Au = El.parentHeader) !== null && Au !== void 0 ? Au : {}
    };
  }
  _e.createMessage = Zt;
  function $n(El) {
    return El.header.msg_type === "stream";
  }
  _e.isStreamMsg = $n;
  function Sn(El) {
    return El.header.msg_type === "display_data";
  }
  _e.isDisplayDataMsg = Sn;
  function kn(El) {
    return El.header.msg_type === "update_display_data";
  }
  _e.isUpdateDisplayDataMsg = kn;
  function Kn(El) {
    return El.header.msg_type === "execute_input";
  }
  _e.isExecuteInputMsg = Kn;
  function er(El) {
    return El.header.msg_type === "execute_result";
  }
  _e.isExecuteResultMsg = er;
  function Cr(El) {
    return El.header.msg_type === "error";
  }
  _e.isErrorMsg = Cr;
  function kr(El) {
    return El.header.msg_type === "status";
  }
  _e.isStatusMsg = kr;
  function Yr(El) {
    return El.header.msg_type === "clear_output";
  }
  _e.isClearOutputMsg = Yr;
  function Ms(El) {
    return El.header.msg_type === "debug_event";
  }
  _e.isDebugEventMsg = Ms;
  function Ds(El) {
    return El.header.msg_type === "comm_open";
  }
  _e.isCommOpenMsg = Ds;
  function Ls(El) {
    return El.header.msg_type === "comm_close";
  }
  _e.isCommCloseMsg = Ls;
  function js(El) {
    return El.header.msg_type === "comm_msg";
  }
  _e.isCommMsgMsg = js;
  function zs(El) {
    return El.header.msg_type === "kernel_info_request";
  }
  _e.isInfoRequestMsg = zs;
  function Fs(El) {
    return El.header.msg_type === "execute_reply";
  }
  _e.isExecuteReplyMsg = Fs;
  function Bs(El) {
    return El.header.msg_type === "debug_request";
  }
  _e.isDebugRequestMsg = Bs;
  function Hs(El) {
    return El.header.msg_type === "debug_reply";
  }
  _e.isDebugReplyMsg = Hs;
  function Ws(El) {
    return El.header.msg_type === "input_request";
  }
  _e.isInputRequestMsg = Ws;
  function Ys(El) {
    return El.header.msg_type === "input_reply";
  }
  _e.isInputReplyMsg = Ys, function(El) {
    El.v1KernelWebsocketJupyterOrg = "v1.kernel.websocket.jupyter.org";
  }(_e.supportedKernelWebSocketProtocols || (_e.supportedKernelWebSocketProtocols = {}));
})(messages);
var restapi$4 = {}, validate$3 = {};
Object.defineProperty(validate$3, "__esModule", { value: !0 });
validate$3.validateModels = validate$3.validateModel = validate$3.validateMessage = void 0;
const validate_1$3 = validate$4, HEADER_FIELDS = ["username", "version", "session", "msg_id", "msg_type"], IOPUB_CONTENT_FIELDS = {
  stream: { name: "string", text: "string" },
  display_data: { data: "object", metadata: "object" },
  execute_input: { code: "string", execution_count: "number" },
  execute_result: {
    execution_count: "number",
    data: "object",
    metadata: "object"
  },
  error: { ename: "string", evalue: "string", traceback: "object" },
  status: {
    execution_state: [
      "string",
      ["starting", "idle", "busy", "restarting", "dead"]
    ]
  },
  clear_output: { wait: "boolean" },
  comm_open: { comm_id: "string", target_name: "string", data: "object" },
  comm_msg: { comm_id: "string", data: "object" },
  comm_close: { comm_id: "string" },
  shutdown_reply: { restart: "boolean" }
  // Emitted by the IPython kernel.
};
function validateHeader(_e) {
  for (let Qt = 0; Qt < HEADER_FIELDS.length; Qt++)
    (0, validate_1$3.validateProperty)(_e, HEADER_FIELDS[Qt], "string");
}
function validateMessage(_e) {
  (0, validate_1$3.validateProperty)(_e, "metadata", "object"), (0, validate_1$3.validateProperty)(_e, "content", "object"), (0, validate_1$3.validateProperty)(_e, "channel", "string"), validateHeader(_e.header), _e.channel === "iopub" && validateIOPubContent(_e);
}
validate$3.validateMessage = validateMessage;
function validateIOPubContent(_e) {
  if (_e.channel === "iopub") {
    const Qt = IOPUB_CONTENT_FIELDS[_e.header.msg_type];
    if (Qt === void 0)
      return;
    const Zt = Object.keys(Qt), $n = _e.content;
    for (let Sn = 0; Sn < Zt.length; Sn++) {
      let kn = Qt[Zt[Sn]];
      Array.isArray(kn) || (kn = [kn]), (0, validate_1$3.validateProperty)($n, Zt[Sn], ...kn);
    }
  }
}
function validateModel$1(_e) {
  (0, validate_1$3.validateProperty)(_e, "name", "string"), (0, validate_1$3.validateProperty)(_e, "id", "string");
}
validate$3.validateModel = validateModel$1;
function validateModels$1(_e) {
  if (!Array.isArray(_e))
    throw new Error("Invalid kernel list");
  _e.forEach((Qt) => validateModel$1(Qt));
}
validate$3.validateModels = validateModels$1;
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.getKernelModel = _e.shutdownKernel = _e.interruptKernel = _e.restartKernel = _e.startNew = _e.listRunning = _e.KERNEL_SERVICE_URL = void 0;
  const Qt = serverconnection, Zt = lib$3, $n = validate$3;
  _e.KERNEL_SERVICE_URL = "api/kernels";
  async function Sn(Yr = Qt.ServerConnection.makeSettings()) {
    const Ms = Zt.URLExt.join(Yr.baseUrl, _e.KERNEL_SERVICE_URL), Ds = await Qt.ServerConnection.makeRequest(Ms, {}, Yr);
    if (Ds.status !== 200)
      throw await Qt.ServerConnection.ResponseError.create(Ds);
    const Ls = await Ds.json();
    return (0, $n.validateModels)(Ls), Ls;
  }
  _e.listRunning = Sn;
  async function kn(Yr = {}, Ms = Qt.ServerConnection.makeSettings()) {
    const Ds = Zt.URLExt.join(Ms.baseUrl, _e.KERNEL_SERVICE_URL), Ls = {
      method: "POST",
      body: JSON.stringify(Yr)
    }, js = await Qt.ServerConnection.makeRequest(Ds, Ls, Ms);
    if (js.status !== 201)
      throw await Qt.ServerConnection.ResponseError.create(js);
    const zs = await js.json();
    return (0, $n.validateModel)(zs), zs;
  }
  _e.startNew = kn;
  async function Kn(Yr, Ms = Qt.ServerConnection.makeSettings()) {
    const Ds = Zt.URLExt.join(Ms.baseUrl, _e.KERNEL_SERVICE_URL, encodeURIComponent(Yr), "restart"), Ls = { method: "POST" }, js = await Qt.ServerConnection.makeRequest(Ds, Ls, Ms);
    if (js.status !== 200)
      throw await Qt.ServerConnection.ResponseError.create(js);
    const zs = await js.json();
    (0, $n.validateModel)(zs);
  }
  _e.restartKernel = Kn;
  async function er(Yr, Ms = Qt.ServerConnection.makeSettings()) {
    const Ds = Zt.URLExt.join(Ms.baseUrl, _e.KERNEL_SERVICE_URL, encodeURIComponent(Yr), "interrupt"), Ls = { method: "POST" }, js = await Qt.ServerConnection.makeRequest(Ds, Ls, Ms);
    if (js.status !== 204)
      throw await Qt.ServerConnection.ResponseError.create(js);
  }
  _e.interruptKernel = er;
  async function Cr(Yr, Ms = Qt.ServerConnection.makeSettings()) {
    const Ds = Zt.URLExt.join(Ms.baseUrl, _e.KERNEL_SERVICE_URL, encodeURIComponent(Yr)), Ls = { method: "DELETE" }, js = await Qt.ServerConnection.makeRequest(Ds, Ls, Ms);
    if (js.status === 404) {
      const zs = `The kernel "${Yr}" does not exist on the server`;
      console.warn(zs);
    } else if (js.status !== 204)
      throw await Qt.ServerConnection.ResponseError.create(js);
  }
  _e.shutdownKernel = Cr;
  async function kr(Yr, Ms = Qt.ServerConnection.makeSettings()) {
    const Ds = Zt.URLExt.join(Ms.baseUrl, _e.KERNEL_SERVICE_URL, encodeURIComponent(Yr)), Ls = await Qt.ServerConnection.makeRequest(Ds, {}, Ms);
    if (Ls.status === 404)
      return;
    if (Ls.status !== 200)
      throw await Qt.ServerConnection.ResponseError.create(Ls);
    const js = await Ls.json();
    return (0, $n.validateModel)(js), js;
  }
  _e.getKernelModel = kr;
})(restapi$4);
var _default$2 = {}, comm = {};
const require$$1 = /* @__PURE__ */ getAugmentedNamespace(index_es6$1);
var __createBinding$3 = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(_e, Qt, Zt, $n) {
  $n === void 0 && ($n = Zt);
  var Sn = Object.getOwnPropertyDescriptor(Qt, Zt);
  (!Sn || ("get" in Sn ? !Qt.__esModule : Sn.writable || Sn.configurable)) && (Sn = { enumerable: !0, get: function() {
    return Qt[Zt];
  } }), Object.defineProperty(_e, $n, Sn);
} : function(_e, Qt, Zt, $n) {
  $n === void 0 && ($n = Zt), _e[$n] = Qt[Zt];
}), __setModuleDefault$3 = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(_e, Qt) {
  Object.defineProperty(_e, "default", { enumerable: !0, value: Qt });
} : function(_e, Qt) {
  _e.default = Qt;
}), __importStar$3 = commonjsGlobal && commonjsGlobal.__importStar || function(_e) {
  if (_e && _e.__esModule)
    return _e;
  var Qt = {};
  if (_e != null)
    for (var Zt in _e)
      Zt !== "default" && Object.prototype.hasOwnProperty.call(_e, Zt) && __createBinding$3(Qt, _e, Zt);
  return __setModuleDefault$3(Qt, _e), Qt;
};
Object.defineProperty(comm, "__esModule", { value: !0 });
comm.CommHandler = void 0;
const disposable_1$1 = require$$1, KernelMessage$2 = __importStar$3(messages);
class CommHandler extends disposable_1$1.DisposableDelegate {
  /**
   * Construct a new comm channel.
   */
  constructor(Qt, Zt, $n, Sn) {
    super(Sn), this._target = "", this._id = "", this._id = Zt, this._target = Qt, this._kernel = $n;
  }
  /**
   * The unique id for the comm channel.
   */
  get commId() {
    return this._id;
  }
  /**
   * The target name for the comm channel.
   */
  get targetName() {
    return this._target;
  }
  /**
   * Get the callback for a comm close event.
   *
   * #### Notes
   * This is called when the comm is closed from either the server or client.
   *
   * **See also:** [[ICommClose]], [[close]]
   */
  get onClose() {
    return this._onClose;
  }
  /**
   * Set the callback for a comm close event.
   *
   * #### Notes
   * This is called when the comm is closed from either the server or client. If
   * the function returns a promise, and the kernel was closed from the server,
   * kernel message processing will pause until the returned promise is
   * fulfilled.
   *
   * **See also:** [[close]]
   */
  set onClose(Qt) {
    this._onClose = Qt;
  }
  /**
   * Get the callback for a comm message received event.
   */
  get onMsg() {
    return this._onMsg;
  }
  /**
   * Set the callback for a comm message received event.
   *
   * #### Notes
   * This is called when a comm message is received. If the function returns a
   * promise, kernel message processing will pause until it is fulfilled.
   */
  set onMsg(Qt) {
    this._onMsg = Qt;
  }
  /**
   * Open a comm with optional data and metadata.
   *
   * #### Notes
   * This sends a `comm_open` message to the server.
   *
   * **See also:** [[ICommOpen]]
   */
  open(Qt, Zt, $n = []) {
    if (this.isDisposed || this._kernel.isDisposed)
      throw new Error("Cannot open");
    const Sn = KernelMessage$2.createMessage({
      msgType: "comm_open",
      channel: "shell",
      username: this._kernel.username,
      session: this._kernel.clientId,
      content: {
        comm_id: this._id,
        target_name: this._target,
        data: Qt ?? {}
      },
      metadata: Zt,
      buffers: $n
    });
    return this._kernel.sendShellMessage(Sn, !1, !0);
  }
  /**
   * Send a `comm_msg` message to the kernel.
   *
   * #### Notes
   * This is a no-op if the comm has been closed.
   *
   * **See also:** [[ICommMsg]]
   */
  send(Qt, Zt, $n = [], Sn = !0) {
    if (this.isDisposed || this._kernel.isDisposed)
      throw new Error("Cannot send");
    const kn = KernelMessage$2.createMessage({
      msgType: "comm_msg",
      channel: "shell",
      username: this._kernel.username,
      session: this._kernel.clientId,
      content: {
        comm_id: this._id,
        data: Qt
      },
      metadata: Zt,
      buffers: $n
    });
    return this._kernel.sendShellMessage(kn, !1, Sn);
  }
  /**
   * Close the comm.
   *
   * #### Notes
   * This will send a `comm_close` message to the kernel, and call the
   * `onClose` callback if set.
   *
   * This is a no-op if the comm is already closed.
   *
   * **See also:** [[ICommClose]], [[onClose]]
   */
  close(Qt, Zt, $n = []) {
    if (this.isDisposed || this._kernel.isDisposed)
      throw new Error("Cannot close");
    const Sn = KernelMessage$2.createMessage({
      msgType: "comm_close",
      channel: "shell",
      username: this._kernel.username,
      session: this._kernel.clientId,
      content: {
        comm_id: this._id,
        data: Qt ?? {}
      },
      metadata: Zt,
      buffers: $n
    }), kn = this._kernel.sendShellMessage(Sn, !1, !0), Kn = this._onClose;
    if (Kn) {
      const er = KernelMessage$2.createMessage({
        msgType: "comm_close",
        channel: "iopub",
        username: this._kernel.username,
        session: this._kernel.clientId,
        content: {
          comm_id: this._id,
          data: Qt ?? {}
        },
        metadata: Zt,
        buffers: $n
      });
      Kn(er);
    }
    return this.dispose(), kn;
  }
}
comm.CommHandler = CommHandler;
var future = {}, __createBinding$2 = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(_e, Qt, Zt, $n) {
  $n === void 0 && ($n = Zt);
  var Sn = Object.getOwnPropertyDescriptor(Qt, Zt);
  (!Sn || ("get" in Sn ? !Qt.__esModule : Sn.writable || Sn.configurable)) && (Sn = { enumerable: !0, get: function() {
    return Qt[Zt];
  } }), Object.defineProperty(_e, $n, Sn);
} : function(_e, Qt, Zt, $n) {
  $n === void 0 && ($n = Zt), _e[$n] = Qt[Zt];
}), __setModuleDefault$2 = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(_e, Qt) {
  Object.defineProperty(_e, "default", { enumerable: !0, value: Qt });
} : function(_e, Qt) {
  _e.default = Qt;
}), __importStar$2 = commonjsGlobal && commonjsGlobal.__importStar || function(_e) {
  if (_e && _e.__esModule)
    return _e;
  var Qt = {};
  if (_e != null)
    for (var Zt in _e)
      Zt !== "default" && Object.prototype.hasOwnProperty.call(_e, Zt) && __createBinding$2(Qt, _e, Zt);
  return __setModuleDefault$2(Qt, _e), Qt;
};
Object.defineProperty(future, "__esModule", { value: !0 });
future.KernelShellFutureHandler = future.KernelControlFutureHandler = future.KernelFutureHandler = void 0;
const coreutils_1$7 = require$$1$2, disposable_1 = require$$1, KernelMessage$1 = __importStar$2(messages);
class KernelFutureHandler extends disposable_1.DisposableDelegate {
  /**
   * Construct a new KernelFutureHandler.
   */
  constructor(Qt, Zt, $n, Sn, kn) {
    super(Qt), this._status = 0, this._stdin = Private$a.noOp, this._iopub = Private$a.noOp, this._reply = Private$a.noOp, this._done = new coreutils_1$7.PromiseDelegate(), this._hooks = new Private$a.HookList(), this._disposeOnDone = !0, this._msg = Zt, $n || this._setFlag(Private$a.KernelFutureFlag.GotReply), this._disposeOnDone = Sn, this._kernel = kn;
  }
  /**
   * Get the original outgoing message.
   */
  get msg() {
    return this._msg;
  }
  /**
   * A promise that resolves when the future is done.
   */
  get done() {
    return this._done.promise;
  }
  /**
   * Get the reply handler.
   */
  get onReply() {
    return this._reply;
  }
  /**
   * Set the reply handler.
   */
  set onReply(Qt) {
    this._reply = Qt;
  }
  /**
   * Get the iopub handler.
   */
  get onIOPub() {
    return this._iopub;
  }
  /**
   * Set the iopub handler.
   */
  set onIOPub(Qt) {
    this._iopub = Qt;
  }
  /**
   * Get the stdin handler.
   */
  get onStdin() {
    return this._stdin;
  }
  /**
   * Set the stdin handler.
   */
  set onStdin(Qt) {
    this._stdin = Qt;
  }
  /**
   * Register hook for IOPub messages.
   *
   * @param hook - The callback invoked for an IOPub message.
   *
   * #### Notes
   * The IOPub hook system allows you to preempt the handlers for IOPub
   * messages handled by the future.
   *
   * The most recently registered hook is run first. A hook can return a
   * boolean or a promise to a boolean, in which case all kernel message
   * processing pauses until the promise is fulfilled. If a hook return value
   * resolves to false, any later hooks will not run and the function will
   * return a promise resolving to false. If a hook throws an error, the error
   * is logged to the console and the next hook is run. If a hook is
   * registered during the hook processing, it will not run until the next
   * message. If a hook is removed during the hook processing, it will be
   * deactivated immediately.
   */
  registerMessageHook(Qt) {
    if (this.isDisposed)
      throw new Error("Kernel future is disposed");
    this._hooks.add(Qt);
  }
  /**
   * Remove a hook for IOPub messages.
   *
   * @param hook - The hook to remove.
   *
   * #### Notes
   * If a hook is removed during the hook processing, it will be deactivated immediately.
   */
  removeMessageHook(Qt) {
    this.isDisposed || this._hooks.remove(Qt);
  }
  /**
   * Send an `input_reply` message.
   */
  sendInputReply(Qt, Zt) {
    this._kernel.sendInputReply(Qt, Zt);
  }
  /**
   * Dispose and unregister the future.
   */
  dispose() {
    this._stdin = Private$a.noOp, this._iopub = Private$a.noOp, this._reply = Private$a.noOp, this._hooks = null, this._testFlag(Private$a.KernelFutureFlag.IsDone) || (this._done.promise.catch(() => {
    }), this._done.reject(new Error(`Canceled future for ${this.msg.header.msg_type} message before replies were done`))), super.dispose();
  }
  /**
   * Handle an incoming kernel message.
   */
  async handleMsg(Qt) {
    switch (Qt.channel) {
      case "control":
      case "shell":
        Qt.channel === this.msg.channel && Qt.parent_header.msg_id === this.msg.header.msg_id && await this._handleReply(Qt);
        break;
      case "stdin":
        await this._handleStdin(Qt);
        break;
      case "iopub":
        await this._handleIOPub(Qt);
        break;
    }
  }
  async _handleReply(Qt) {
    const Zt = this._reply;
    Zt && await Zt(Qt), this._replyMsg = Qt, this._setFlag(Private$a.KernelFutureFlag.GotReply), this._testFlag(Private$a.KernelFutureFlag.GotIdle) && this._handleDone();
  }
  async _handleStdin(Qt) {
    this._kernel.hasPendingInput = !0;
    const Zt = this._stdin;
    Zt && await Zt(Qt);
  }
  async _handleIOPub(Qt) {
    const Zt = await this._hooks.process(Qt), $n = this._iopub;
    Zt && $n && await $n(Qt), KernelMessage$1.isStatusMsg(Qt) && Qt.content.execution_state === "idle" && (this._setFlag(Private$a.KernelFutureFlag.GotIdle), this._testFlag(Private$a.KernelFutureFlag.GotReply) && this._handleDone());
  }
  _handleDone() {
    this._testFlag(Private$a.KernelFutureFlag.IsDone) || (this._setFlag(Private$a.KernelFutureFlag.IsDone), this._done.resolve(this._replyMsg), this._disposeOnDone && this.dispose());
  }
  /**
   * Test whether the given future flag is set.
   */
  _testFlag(Qt) {
    return (this._status & Qt) !== 0;
  }
  /**
   * Set the given future flag.
   */
  _setFlag(Qt) {
    this._status |= Qt;
  }
}
future.KernelFutureHandler = KernelFutureHandler;
class KernelControlFutureHandler extends KernelFutureHandler {
}
future.KernelControlFutureHandler = KernelControlFutureHandler;
class KernelShellFutureHandler extends KernelFutureHandler {
}
future.KernelShellFutureHandler = KernelShellFutureHandler;
var Private$a;
(function(_e) {
  _e.noOp = () => {
  };
  const Qt = (() => typeof requestAnimationFrame == "function" ? requestAnimationFrame : setImmediate)();
  class Zt {
    constructor() {
      this._hooks = [];
    }
    /**
     * Register a hook.
     *
     * @param hook - The callback to register.
     */
    add(Sn) {
      this.remove(Sn), this._hooks.push(Sn);
    }
    /**
     * Remove a hook, if it exists in the hook list.
     *
     * @param hook - The callback to remove.
     */
    remove(Sn) {
      const kn = this._hooks.indexOf(Sn);
      kn >= 0 && (this._hooks[kn] = null, this._scheduleCompact());
    }
    /**
     * Process a message through the hooks.
     *
     * @returns a promise resolving to false if any hook resolved as false,
     * otherwise true
     *
     * #### Notes
     * The most recently registered hook is run first. A hook can return a
     * boolean or a promise to a boolean, in which case processing pauses until
     * the promise is fulfilled. If a hook return value resolves to false, any
     * later hooks will not run and the function will return a promise resolving
     * to false. If a hook throws an error, the error is logged to the console
     * and the next hook is run. If a hook is registered during the hook
     * processing, it will not run until the next message. If a hook is removed
     * during the hook processing, it will be deactivated immediately.
     */
    async process(Sn) {
      await this._processing;
      const kn = new coreutils_1$7.PromiseDelegate();
      this._processing = kn.promise;
      let Kn;
      for (let er = this._hooks.length - 1; er >= 0; er--) {
        const Cr = this._hooks[er];
        if (Cr !== null) {
          try {
            Kn = await Cr(Sn);
          } catch (kr) {
            Kn = !0, console.error(kr);
          }
          if (Kn === !1)
            return kn.resolve(void 0), !1;
        }
      }
      return kn.resolve(void 0), !0;
    }
    /**
     * Schedule a cleanup of the list, removing any hooks that have been nulled out.
     */
    _scheduleCompact() {
      this._compactScheduled || (this._compactScheduled = !0, Qt(() => {
        this._processing = this._processing.then(() => {
          this._compactScheduled = !1, this._compact();
        });
      }));
    }
    /**
     * Compact the list, removing any nulls.
     */
    _compact() {
      let Sn = 0;
      for (let kn = 0, Kn = this._hooks.length; kn < Kn; kn++) {
        const er = this._hooks[kn];
        this._hooks[kn] === null ? Sn++ : this._hooks[kn - Sn] = er;
      }
      this._hooks.length -= Sn;
    }
  }
  _e.HookList = Zt, function($n) {
    $n[$n.GotReply = 1] = "GotReply", $n[$n.GotIdle = 2] = "GotIdle", $n[$n.IsDone = 4] = "IsDone", $n[$n.DisposeOnDone = 8] = "DisposeOnDone";
  }(_e.KernelFutureFlag || (_e.KernelFutureFlag = {}));
})(Private$a || (Private$a = {}));
var serialize$2 = {}, __createBinding$1 = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(_e, Qt, Zt, $n) {
  $n === void 0 && ($n = Zt);
  var Sn = Object.getOwnPropertyDescriptor(Qt, Zt);
  (!Sn || ("get" in Sn ? !Qt.__esModule : Sn.writable || Sn.configurable)) && (Sn = { enumerable: !0, get: function() {
    return Qt[Zt];
  } }), Object.defineProperty(_e, $n, Sn);
} : function(_e, Qt, Zt, $n) {
  $n === void 0 && ($n = Zt), _e[$n] = Qt[Zt];
}), __setModuleDefault$1 = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(_e, Qt) {
  Object.defineProperty(_e, "default", { enumerable: !0, value: Qt });
} : function(_e, Qt) {
  _e.default = Qt;
}), __importStar$1 = commonjsGlobal && commonjsGlobal.__importStar || function(_e) {
  if (_e && _e.__esModule)
    return _e;
  var Qt = {};
  if (_e != null)
    for (var Zt in _e)
      Zt !== "default" && Object.prototype.hasOwnProperty.call(_e, Zt) && __createBinding$1(Qt, _e, Zt);
  return __setModuleDefault$1(Qt, _e), Qt;
};
Object.defineProperty(serialize$2, "__esModule", { value: !0 });
serialize$2.deserialize = serialize$2.serialize = void 0;
const KernelMessage = __importStar$1(messages);
function serialize$1(_e, Qt = "") {
  switch (Qt) {
    case KernelMessage.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:
      return Private$9.serializeV1KernelWebsocketJupyterOrg(_e);
    default:
      return Private$9.serializeDefault(_e);
  }
}
serialize$2.serialize = serialize$1;
function deserialize(_e, Qt = "") {
  switch (Qt) {
    case KernelMessage.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:
      return Private$9.deserializeV1KernelWebsocketJupyterOrg(_e);
    default:
      return Private$9.deserializeDefault(_e);
  }
}
serialize$2.deserialize = deserialize;
var Private$9;
(function(_e) {
  function Qt(er) {
    let Cr;
    const kr = new DataView(er), Yr = Number(kr.getBigUint64(
      0,
      !0
      /* littleEndian */
    ));
    let Ms = [];
    for (let Ws = 0; Ws < Yr; Ws++)
      Ms.push(Number(kr.getBigUint64(
        8 * (Ws + 1),
        !0
        /* littleEndian */
      )));
    const Ds = new TextDecoder("utf8"), Ls = Ds.decode(er.slice(Ms[0], Ms[1])), js = JSON.parse(Ds.decode(er.slice(Ms[1], Ms[2]))), zs = JSON.parse(Ds.decode(er.slice(Ms[2], Ms[3]))), Fs = JSON.parse(Ds.decode(er.slice(Ms[3], Ms[4]))), Bs = JSON.parse(Ds.decode(er.slice(Ms[4], Ms[5])));
    let Hs = [];
    for (let Ws = 5; Ws < Ms.length - 1; Ws++)
      Hs.push(new DataView(er.slice(Ms[Ws], Ms[Ws + 1])));
    return Cr = {
      channel: Ls,
      header: js,
      parent_header: zs,
      metadata: Fs,
      content: Bs,
      buffers: Hs
    }, Cr;
  }
  _e.deserializeV1KernelWebsocketJupyterOrg = Qt;
  function Zt(er) {
    const Cr = JSON.stringify(er.header), kr = er.parent_header == null ? "{}" : JSON.stringify(er.parent_header), Yr = JSON.stringify(er.metadata), Ms = JSON.stringify(er.content), Ds = er.buffers !== void 0 ? er.buffers : [], Ls = 1 + 4 + Ds.length + 1;
    let js = [];
    js.push(8 * (1 + Ls)), js.push(er.channel.length + js[js.length - 1]);
    const zs = new TextEncoder(), Fs = zs.encode(er.channel), Bs = zs.encode(Cr), Hs = zs.encode(kr), Ws = zs.encode(Yr), Ys = zs.encode(Ms), El = new Uint8Array(Fs.length + Bs.length + Hs.length + Ws.length + Ys.length);
    El.set(Fs), El.set(Bs, Fs.length), El.set(Hs, Fs.length + Bs.length), El.set(Ws, Fs.length + Bs.length + Hs.length), El.set(Ys, Fs.length + Bs.length + Hs.length + Ws.length);
    for (let Au of [
      Bs.length,
      Hs.length,
      Ws.length,
      Ys.length
    ])
      js.push(Au + js[js.length - 1]);
    let Mu = 0;
    for (let Au of Ds) {
      let Nu = Au.byteLength;
      js.push(Nu + js[js.length - 1]), Mu += Nu;
    }
    const Pl = new Uint8Array(8 * (1 + Ls) + El.byteLength + Mu), Iu = new ArrayBuffer(8), Tu = new DataView(Iu);
    Tu.setBigUint64(
      0,
      BigInt(Ls),
      !0
      /* littleEndian */
    ), Pl.set(new Uint8Array(Iu), 0);
    for (let Au = 0; Au < js.length; Au++)
      Tu.setBigUint64(
        0,
        BigInt(js[Au]),
        !0
        /* littleEndian */
      ), Pl.set(new Uint8Array(Iu), 8 * (Au + 1));
    Pl.set(El, js[0]);
    for (let Au = 0; Au < Ds.length; Au++) {
      const Nu = Ds[Au];
      Pl.set(new Uint8Array(ArrayBuffer.isView(Nu) ? Nu.buffer : Nu), js[5 + Au]);
    }
    return Pl.buffer;
  }
  _e.serializeV1KernelWebsocketJupyterOrg = Zt;
  function $n(er) {
    let Cr;
    return typeof er == "string" ? Cr = JSON.parse(er) : Cr = kn(er), Cr;
  }
  _e.deserializeDefault = $n;
  function Sn(er) {
    var Cr;
    let kr;
    return !((Cr = er.buffers) === null || Cr === void 0) && Cr.length ? kr = Kn(er) : kr = JSON.stringify(er), kr;
  }
  _e.serializeDefault = Sn;
  function kn(er) {
    const Cr = new DataView(er), kr = Cr.getUint32(0), Yr = [];
    if (kr < 2)
      throw new Error("Invalid incoming Kernel Message");
    for (let Ls = 1; Ls <= kr; Ls++)
      Yr.push(Cr.getUint32(Ls * 4));
    const Ms = new Uint8Array(er.slice(Yr[0], Yr[1])), Ds = JSON.parse(new TextDecoder("utf8").decode(Ms));
    Ds.buffers = [];
    for (let Ls = 1; Ls < kr; Ls++) {
      const js = Yr[Ls], zs = Yr[Ls + 1] || er.byteLength;
      Ds.buffers.push(new DataView(er.slice(js, zs)));
    }
    return Ds;
  }
  function Kn(er) {
    const Cr = [], kr = [], Yr = new TextEncoder();
    let Ms = [];
    er.buffers !== void 0 && (Ms = er.buffers, delete er.buffers);
    const Ds = Yr.encode(JSON.stringify(er));
    kr.push(Ds.buffer);
    for (let Fs = 0; Fs < Ms.length; Fs++) {
      const Bs = Ms[Fs];
      kr.push(ArrayBuffer.isView(Bs) ? Bs.buffer : Bs);
    }
    const Ls = kr.length;
    Cr.push(4 * (Ls + 1));
    for (let Fs = 0; Fs + 1 < kr.length; Fs++)
      Cr.push(Cr[Cr.length - 1] + kr[Fs].byteLength);
    const js = new Uint8Array(Cr[Cr.length - 1] + kr[kr.length - 1].byteLength), zs = new DataView(js.buffer);
    zs.setUint32(0, Ls);
    for (let Fs = 0; Fs < Cr.length; Fs++)
      zs.setUint32(4 * (Fs + 1), Cr[Fs]);
    for (let Fs = 0; Fs < kr.length; Fs++)
      js.set(new Uint8Array(kr[Fs]), Cr[Fs]);
    return js.buffer;
  }
})(Private$9 || (Private$9 = {}));
var kernelspec$1 = {}, kernelspec = {};
Object.defineProperty(kernelspec, "__esModule", { value: !0 });
var restapi$3 = {}, validate$2 = {};
Object.defineProperty(validate$2, "__esModule", { value: !0 });
validate$2.validateSpecModels = validate$2.validateSpecModel = void 0;
const validate_1$2 = validate$4;
function validateSpecModel(_e) {
  const Qt = _e.spec;
  if (!Qt)
    throw new Error("Invalid kernel spec");
  (0, validate_1$2.validateProperty)(_e, "name", "string"), (0, validate_1$2.validateProperty)(_e, "resources", "object"), (0, validate_1$2.validateProperty)(Qt, "language", "string"), (0, validate_1$2.validateProperty)(Qt, "display_name", "string"), (0, validate_1$2.validateProperty)(Qt, "argv", "array");
  let Zt = null;
  Qt.hasOwnProperty("metadata") && ((0, validate_1$2.validateProperty)(Qt, "metadata", "object"), Zt = Qt.metadata);
  let $n = null;
  return Qt.hasOwnProperty("env") && ((0, validate_1$2.validateProperty)(Qt, "env", "object"), $n = Qt.env), {
    name: _e.name,
    resources: _e.resources,
    language: Qt.language,
    display_name: Qt.display_name,
    argv: Qt.argv,
    metadata: Zt,
    env: $n
  };
}
validate$2.validateSpecModel = validateSpecModel;
function validateSpecModels(_e) {
  if (!_e.hasOwnProperty("kernelspecs"))
    throw new Error("No kernelspecs found");
  let Qt = Object.keys(_e.kernelspecs);
  const Zt = /* @__PURE__ */ Object.create(null);
  let $n = _e.default;
  for (let Sn = 0; Sn < Qt.length; Sn++) {
    const kn = _e.kernelspecs[Qt[Sn]];
    try {
      Zt[Qt[Sn]] = validateSpecModel(kn);
    } catch {
      console.warn(`Removing errant kernel spec: ${Qt[Sn]}`);
    }
  }
  if (Qt = Object.keys(Zt), !Qt.length)
    throw new Error("No valid kernelspecs found");
  return (!$n || typeof $n != "string" || !($n in Zt)) && ($n = Qt[0], console.warn(`Default kernel not found, using '${Qt[0]}'`)), {
    default: $n,
    kernelspecs: Zt
  };
}
validate$2.validateSpecModels = validateSpecModels;
Object.defineProperty(restapi$3, "__esModule", { value: !0 });
restapi$3.getSpecs = void 0;
const serverconnection_1$5 = serverconnection, validate_1$1 = validate$2, coreutils_1$6 = lib$3, KERNELSPEC_SERVICE_URL = "api/kernelspecs";
async function getSpecs(_e = serverconnection_1$5.ServerConnection.makeSettings()) {
  const Qt = coreutils_1$6.URLExt.join(_e.baseUrl, KERNELSPEC_SERVICE_URL), Zt = await serverconnection_1$5.ServerConnection.makeRequest(Qt, {}, _e);
  if (Zt.status !== 200)
    throw await serverconnection_1$5.ServerConnection.ResponseError.create(Zt);
  const $n = await Zt.json();
  return (0, validate_1$1.validateSpecModels)($n);
}
restapi$3.getSpecs = getSpecs;
var manager$4 = {}, __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(_e, Qt, Zt, $n) {
  $n === void 0 && ($n = Zt);
  var Sn = Object.getOwnPropertyDescriptor(Qt, Zt);
  (!Sn || ("get" in Sn ? !Qt.__esModule : Sn.writable || Sn.configurable)) && (Sn = { enumerable: !0, get: function() {
    return Qt[Zt];
  } }), Object.defineProperty(_e, $n, Sn);
} : function(_e, Qt, Zt, $n) {
  $n === void 0 && ($n = Zt), _e[$n] = Qt[Zt];
}), __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(_e, Qt) {
  Object.defineProperty(_e, "default", { enumerable: !0, value: Qt });
} : function(_e, Qt) {
  _e.default = Qt;
}), __importStar = commonjsGlobal && commonjsGlobal.__importStar || function(_e) {
  if (_e && _e.__esModule)
    return _e;
  var Qt = {};
  if (_e != null)
    for (var Zt in _e)
      Zt !== "default" && Object.prototype.hasOwnProperty.call(_e, Zt) && __createBinding(Qt, _e, Zt);
  return __setModuleDefault(Qt, _e), Qt;
};
Object.defineProperty(manager$4, "__esModule", { value: !0 });
manager$4.KernelSpecManager = void 0;
const coreutils_1$5 = require$$1$2, polling_1$1 = require$$2, signaling_1$1 = require$$0$1, restapi$2 = __importStar(restapi$3), basemanager_1$1 = basemanager;
class KernelSpecManager extends basemanager_1$1.BaseManager {
  /**
   * Construct a new kernel spec manager.
   *
   * @param options - The default options for kernel.
   */
  constructor(Qt = {}) {
    var Zt;
    super(Qt), this._isReady = !1, this._connectionFailure = new signaling_1$1.Signal(this), this._specs = null, this._specsChanged = new signaling_1$1.Signal(this), this._ready = Promise.all([this.requestSpecs()]).then(($n) => {
    }).catch(($n) => {
    }).then(() => {
      this.isDisposed || (this._isReady = !0);
    }), this._pollSpecs = new polling_1$1.Poll({
      auto: !1,
      factory: () => this.requestSpecs(),
      frequency: {
        interval: 61 * 1e3,
        backoff: !0,
        max: 300 * 1e3
      },
      name: "@jupyterlab/services:KernelSpecManager#specs",
      standby: (Zt = Qt.standby) !== null && Zt !== void 0 ? Zt : "when-hidden"
    }), this.ready.then(() => {
      this._pollSpecs.start();
    });
  }
  /**
   * Test whether the manager is ready.
   */
  get isReady() {
    return this._isReady;
  }
  /**
   * A promise that fulfills when the manager is ready.
   */
  get ready() {
    return this._ready;
  }
  /**
   * Get the most recently fetched kernel specs.
   */
  get specs() {
    return this._specs;
  }
  /**
   * A signal emitted when the specs change.
   */
  get specsChanged() {
    return this._specsChanged;
  }
  /**
   * A signal emitted when there is a connection failure.
   */
  get connectionFailure() {
    return this._connectionFailure;
  }
  /**
   * Dispose of the resources used by the manager.
   */
  dispose() {
    this._pollSpecs.dispose(), super.dispose();
  }
  /**
   * Force a refresh of the specs from the server.
   *
   * @returns A promise that resolves when the specs are fetched.
   *
   * #### Notes
   * This is intended to be called only in response to a user action,
   * since the manager maintains its internal state.
   */
  async refreshSpecs() {
    await this._pollSpecs.refresh(), await this._pollSpecs.tick;
  }
  /**
   * Execute a request to the server to poll specs and update state.
   */
  async requestSpecs() {
    const Qt = await restapi$2.getSpecs(this.serverSettings);
    this.isDisposed || coreutils_1$5.JSONExt.deepEqual(Qt, this._specs) || (this._specs = Qt, this._specsChanged.emit(Qt));
  }
}
manager$4.KernelSpecManager = KernelSpecManager;
(function(_e) {
  var Qt = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(er, Cr, kr, Yr) {
    Yr === void 0 && (Yr = kr);
    var Ms = Object.getOwnPropertyDescriptor(Cr, kr);
    (!Ms || ("get" in Ms ? !Cr.__esModule : Ms.writable || Ms.configurable)) && (Ms = { enumerable: !0, get: function() {
      return Cr[kr];
    } }), Object.defineProperty(er, Yr, Ms);
  } : function(er, Cr, kr, Yr) {
    Yr === void 0 && (Yr = kr), er[Yr] = Cr[kr];
  }), Zt = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(er, Cr) {
    Object.defineProperty(er, "default", { enumerable: !0, value: Cr });
  } : function(er, Cr) {
    er.default = Cr;
  }), $n = commonjsGlobal && commonjsGlobal.__importStar || function(er) {
    if (er && er.__esModule)
      return er;
    var Cr = {};
    if (er != null)
      for (var kr in er)
        kr !== "default" && Object.prototype.hasOwnProperty.call(er, kr) && Qt(Cr, er, kr);
    return Zt(Cr, er), Cr;
  }, Sn = commonjsGlobal && commonjsGlobal.__exportStar || function(er, Cr) {
    for (var kr in er)
      kr !== "default" && !Object.prototype.hasOwnProperty.call(Cr, kr) && Qt(Cr, er, kr);
  };
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.KernelSpecAPI = _e.KernelSpec = void 0;
  const kn = $n(kernelspec);
  _e.KernelSpec = kn;
  const Kn = $n(restapi$3);
  _e.KernelSpecAPI = Kn, Sn(manager$4, _e);
})(kernelspec$1);
var hasRequired_default$2;
function require_default$2() {
  if (hasRequired_default$2)
    return _default$2;
  hasRequired_default$2 = 1;
  var _e = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(Ws, Ys, El, Mu) {
    Mu === void 0 && (Mu = El);
    var Pl = Object.getOwnPropertyDescriptor(Ys, El);
    (!Pl || ("get" in Pl ? !Ys.__esModule : Pl.writable || Pl.configurable)) && (Pl = { enumerable: !0, get: function() {
      return Ys[El];
    } }), Object.defineProperty(Ws, Mu, Pl);
  } : function(Ws, Ys, El, Mu) {
    Mu === void 0 && (Mu = El), Ws[Mu] = Ys[El];
  }), Qt = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(Ws, Ys) {
    Object.defineProperty(Ws, "default", { enumerable: !0, value: Ys });
  } : function(Ws, Ys) {
    Ws.default = Ys;
  }), Zt = commonjsGlobal && commonjsGlobal.__importStar || function(Ws) {
    if (Ws && Ws.__esModule)
      return Ws;
    var Ys = {};
    if (Ws != null)
      for (var El in Ws)
        El !== "default" && Object.prototype.hasOwnProperty.call(Ws, El) && _e(Ys, Ws, El);
    return Qt(Ys, Ws), Ys;
  };
  Object.defineProperty(_default$2, "__esModule", { value: !0 }), _default$2.KernelConnection = void 0;
  const $n = lib$3, Sn = require$$1$2, kn = require$$0$1, Kn = requireLib(), er = comm, Cr = Zt(messages), kr = future, Yr = serialize$2, Ms = Zt(validate$3), Ds = kernelspec$1, Ls = Zt(restapi$4), js = 3e3, zs = "_RESTARTING_", Fs = "";
  class Bs {
    /**
     * Construct a kernel object.
     */
    constructor(Ys) {
      var El, Mu, Pl, Iu;
      this._createSocket = (Tu = !0) => {
        this._errorIfDisposed(), this._clearSocket(), this._updateConnectionStatus("connecting");
        const Au = this.serverSettings, Nu = $n.URLExt.join(Au.wsUrl, Ls.KERNEL_SERVICE_URL, encodeURIComponent(this._id)), gm = Nu.replace(/^((?:\w+:)?\/\/)(?:[^@\/]+@)/, "$1");
        console.debug(`Starting WebSocket: ${gm}`);
        let pm = $n.URLExt.join(Nu, "channels?session_id=" + encodeURIComponent(this._clientId));
        const zu = Au.token;
        Au.appendToken && zu !== "" && (pm = pm + `&token=${encodeURIComponent(zu)}`);
        const Yu = Tu ? this._supportedProtocols : [];
        this._ws = new Au.WebSocket(pm, Yu), this._ws.binaryType = "arraybuffer";
        let sm = !1;
        const mm = async (ym) => {
          var _m, Sm;
          if (!this._isDisposed) {
            this._reason = "", this._model = void 0;
            try {
              const wm = await Ls.getKernelModel(this._id, Au);
              this._model = wm, (wm == null ? void 0 : wm.execution_state) === "dead" ? this._updateStatus("dead") : this._onWSClose(ym);
            } catch (wm) {
              if (wm instanceof Kn.ServerConnection.NetworkError || ((_m = wm.response) === null || _m === void 0 ? void 0 : _m.status) === 503 || ((Sm = wm.response) === null || Sm === void 0 ? void 0 : Sm.status) === 424) {
                const Nm = Hs.getRandomIntInclusive(10, 30) * 1e3;
                setTimeout(mm, Nm, ym);
              } else
                this._reason = "Kernel died unexpectedly", this._updateStatus("dead");
            }
          }
        }, hm = async (ym) => {
          sm || (sm = !0, await mm(ym));
        };
        this._ws.onmessage = this._onWSMessage, this._ws.onopen = this._onWSOpen, this._ws.onclose = hm, this._ws.onerror = hm;
      }, this._onWSOpen = (Tu) => {
        if (this._ws.protocol !== "" && !this._supportedProtocols.includes(this._ws.protocol))
          throw console.log("Server selected unknown kernel wire protocol:", this._ws.protocol), this._updateStatus("dead"), new Error(`Unknown kernel wire protocol:  ${this._ws.protocol}`);
        this._selectedProtocol = this._ws.protocol, this._ws.onclose = this._onWSClose, this._ws.onerror = this._onWSClose, this._updateConnectionStatus("connected");
      }, this._onWSMessage = (Tu) => {
        let Au;
        try {
          Au = (0, Yr.deserialize)(Tu.data, this._ws.protocol), Ms.validateMessage(Au);
        } catch (Nu) {
          throw Nu.message = `Kernel message validation error: ${Nu.message}`, Nu;
        }
        this._kernelSession = Au.header.session, this._msgChain = this._msgChain.then(() => this._handleMessage(Au)).catch((Nu) => {
          Nu.message.startsWith("Canceled future for ") && console.error(Nu);
        }), this._anyMessage.emit({ msg: Au, direction: "recv" });
      }, this._onWSClose = (Tu) => {
        this.isDisposed || this._reconnect();
      }, this._id = "", this._name = "", this._status = "unknown", this._connectionStatus = "connecting", this._kernelSession = "", this._isDisposed = !1, this._ws = null, this._username = "", this._reconnectLimit = 7, this._reconnectAttempt = 0, this._reconnectTimeout = null, this._supportedProtocols = Object.values(Cr.supportedKernelWebSocketProtocols), this._selectedProtocol = "", this._futures = /* @__PURE__ */ new Map(), this._comms = /* @__PURE__ */ new Map(), this._targetRegistry = /* @__PURE__ */ Object.create(null), this._info = new Sn.PromiseDelegate(), this._pendingMessages = [], this._statusChanged = new kn.Signal(this), this._connectionStatusChanged = new kn.Signal(this), this._disposed = new kn.Signal(this), this._iopubMessage = new kn.Signal(this), this._anyMessage = new kn.Signal(this), this._pendingInput = new kn.Signal(this), this._unhandledMessage = new kn.Signal(this), this._displayIdToParentIds = /* @__PURE__ */ new Map(), this._msgIdToDisplayIds = /* @__PURE__ */ new Map(), this._msgChain = Promise.resolve(), this._hasPendingInput = !1, this._reason = "", this._noOp = () => {
      }, this._name = Ys.model.name, this._id = Ys.model.id, this.serverSettings = (El = Ys.serverSettings) !== null && El !== void 0 ? El : Kn.ServerConnection.makeSettings(), this._clientId = (Mu = Ys.clientId) !== null && Mu !== void 0 ? Mu : Sn.UUID.uuid4(), this._username = (Pl = Ys.username) !== null && Pl !== void 0 ? Pl : "", this.handleComms = (Iu = Ys.handleComms) !== null && Iu !== void 0 ? Iu : !0, this._createSocket();
    }
    get disposed() {
      return this._disposed;
    }
    /**
     * A signal emitted when the kernel status changes.
     */
    get statusChanged() {
      return this._statusChanged;
    }
    /**
     * A signal emitted when the kernel status changes.
     */
    get connectionStatusChanged() {
      return this._connectionStatusChanged;
    }
    /**
     * A signal emitted for iopub kernel messages.
     *
     * #### Notes
     * This signal is emitted after the iopub message is handled asynchronously.
     */
    get iopubMessage() {
      return this._iopubMessage;
    }
    /**
     * A signal emitted for unhandled kernel message.
     *
     * #### Notes
     * This signal is emitted for a message that was not handled. It is emitted
     * during the asynchronous message handling code.
     */
    get unhandledMessage() {
      return this._unhandledMessage;
    }
    /**
     * The kernel model
     */
    get model() {
      return this._model || {
        id: this.id,
        name: this.name,
        reason: this._reason
      };
    }
    /**
     * A signal emitted for any kernel message.
     *
     * #### Notes
     * This signal is emitted when a message is received, before it is handled
     * asynchronously.
     *
     * This message is emitted when a message is queued for sending (either in
     * the websocket buffer, or our own pending message buffer). The message may
     * actually be sent across the wire at a later time.
     *
     * The message emitted in this signal should not be modified in any way.
     */
    get anyMessage() {
      return this._anyMessage;
    }
    /**
     * A signal emitted when a kernel has pending inputs from the user.
     */
    get pendingInput() {
      return this._pendingInput;
    }
    /**
     * The id of the server-side kernel.
     */
    get id() {
      return this._id;
    }
    /**
     * The name of the server-side kernel.
     */
    get name() {
      return this._name;
    }
    /**
     * The client username.
     */
    get username() {
      return this._username;
    }
    /**
     * The client unique id.
     */
    get clientId() {
      return this._clientId;
    }
    /**
     * The current status of the kernel.
     */
    get status() {
      return this._status;
    }
    /**
     * The current connection status of the kernel connection.
     */
    get connectionStatus() {
      return this._connectionStatus;
    }
    /**
     * Test whether the kernel has been disposed.
     */
    get isDisposed() {
      return this._isDisposed;
    }
    /**
     * The cached kernel info.
     *
     * @returns A promise that resolves to the kernel info.
     */
    get info() {
      return this._info.promise;
    }
    /**
     * The kernel spec.
     *
     * @returns A promise that resolves to the kernel spec.
     */
    get spec() {
      return this._specPromise ? this._specPromise : (this._specPromise = Ds.KernelSpecAPI.getSpecs(this.serverSettings).then((Ys) => Ys.kernelspecs[this._name]), this._specPromise);
    }
    /**
     * Clone the current kernel with a new clientId.
     */
    clone(Ys = {}) {
      return new Bs({
        model: this.model,
        username: this.username,
        serverSettings: this.serverSettings,
        // handleComms defaults to false since that is safer
        handleComms: !1,
        ...Ys
      });
    }
    /**
     * Dispose of the resources held by the kernel.
     */
    dispose() {
      this.isDisposed || (this._isDisposed = !0, this._disposed.emit(), this._updateConnectionStatus("disconnected"), this._clearKernelState(), this._pendingMessages = [], this._clearSocket(), kn.Signal.clearData(this));
    }
    /**
     * Send a shell message to the kernel.
     *
     * #### Notes
     * Send a message to the kernel's shell channel, yielding a future object
     * for accepting replies.
     *
     * If `expectReply` is given and `true`, the future is disposed when both a
     * shell reply and an idle status message are received. If `expectReply`
     * is not given or is `false`, the future is resolved when an idle status
     * message is received.
     * If `disposeOnDone` is not given or is `true`, the Future is disposed at this point.
     * If `disposeOnDone` is given and `false`, it is up to the caller to dispose of the Future.
     *
     * All replies are validated as valid kernel messages.
     *
     * If the kernel status is `dead`, this will throw an error.
     */
    sendShellMessage(Ys, El = !1, Mu = !0) {
      return this._sendKernelShellControl(kr.KernelShellFutureHandler, Ys, El, Mu);
    }
    /**
     * Send a control message to the kernel.
     *
     * #### Notes
     * Send a message to the kernel's control channel, yielding a future object
     * for accepting replies.
     *
     * If `expectReply` is given and `true`, the future is disposed when both a
     * control reply and an idle status message are received. If `expectReply`
     * is not given or is `false`, the future is resolved when an idle status
     * message is received.
     * If `disposeOnDone` is not given or is `true`, the Future is disposed at this point.
     * If `disposeOnDone` is given and `false`, it is up to the caller to dispose of the Future.
     *
     * All replies are validated as valid kernel messages.
     *
     * If the kernel status is `dead`, this will throw an error.
     */
    sendControlMessage(Ys, El = !1, Mu = !0) {
      return this._sendKernelShellControl(kr.KernelControlFutureHandler, Ys, El, Mu);
    }
    _sendKernelShellControl(Ys, El, Mu = !1, Pl = !0) {
      this._sendMessage(El), this._anyMessage.emit({ msg: El, direction: "send" });
      const Iu = new Ys(() => {
        const Tu = El.header.msg_id;
        this._futures.delete(Tu);
        const Au = this._msgIdToDisplayIds.get(Tu);
        Au && (Au.forEach((Nu) => {
          const gm = this._displayIdToParentIds.get(Nu);
          if (gm) {
            const pm = gm.indexOf(Tu);
            if (pm === -1)
              return;
            gm.length === 1 ? this._displayIdToParentIds.delete(Nu) : (gm.splice(pm, 1), this._displayIdToParentIds.set(Nu, gm));
          }
        }), this._msgIdToDisplayIds.delete(Tu));
      }, El, Mu, Pl, this);
      return this._futures.set(El.header.msg_id, Iu), Iu;
    }
    /**
     * Send a message on the websocket.
     *
     * If queue is true, queue the message for later sending if we cannot send
     * now. Otherwise throw an error.
     *
     * #### Notes
     * As an exception to the queueing, if we are sending a kernel_info_request
     * message while we think the kernel is restarting, we send the message
     * immediately without queueing. This is so that we can trigger a message
     * back, which will then clear the kernel restarting state.
     */
    _sendMessage(Ys, El = !0) {
      if (this.status === "dead")
        throw new Error("Kernel is dead");
      if ((this._kernelSession === Fs || this._kernelSession === zs) && Cr.isInfoRequestMsg(Ys))
        if (this.connectionStatus === "connected") {
          this._ws.send((0, Yr.serialize)(Ys, this._ws.protocol));
          return;
        } else
          throw new Error("Could not send message: status is not connected");
      if (El && this._pendingMessages.length > 0) {
        this._pendingMessages.push(Ys);
        return;
      }
      if (this.connectionStatus === "connected" && this._kernelSession !== zs)
        this._ws.send((0, Yr.serialize)(Ys, this._ws.protocol));
      else if (El)
        this._pendingMessages.push(Ys);
      else
        throw new Error("Could not send message");
    }
    /**
     * Interrupt a kernel.
     *
     * #### Notes
     * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels).
     *
     * The promise is fulfilled on a valid response and rejected otherwise.
     *
     * It is assumed that the API call does not mutate the kernel id or name.
     *
     * The promise will be rejected if the kernel status is `Dead` or if the
     * request fails or the response is invalid.
     */
    async interrupt() {
      if (this.hasPendingInput = !1, this.status === "dead")
        throw new Error("Kernel is dead");
      return Ls.interruptKernel(this.id, this.serverSettings);
    }
    /**
     * Request a kernel restart.
     *
     * #### Notes
     * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels)
     * and validates the response model.
     *
     * Any existing Future or Comm objects are cleared once the kernel has
     * actually be restarted.
     *
     * The promise is fulfilled on a valid server response (after the kernel restarts)
     * and rejected otherwise.
     *
     * It is assumed that the API call does not mutate the kernel id or name.
     *
     * The promise will be rejected if the request fails or the response is
     * invalid.
     */
    async restart() {
      if (this.status === "dead")
        throw new Error("Kernel is dead");
      this._updateStatus("restarting"), this._clearKernelState(), this._kernelSession = zs, await Ls.restartKernel(this.id, this.serverSettings), await this.reconnect(), this.hasPendingInput = !1;
    }
    /**
     * Reconnect to a kernel.
     *
     * #### Notes
     * This may try multiple times to reconnect to a kernel, and will sever any
     * existing connection.
     */
    reconnect() {
      this._errorIfDisposed();
      const Ys = new Sn.PromiseDelegate(), El = (Mu, Pl) => {
        Pl === "connected" ? (Ys.resolve(), this.connectionStatusChanged.disconnect(El, this)) : Pl === "disconnected" && (Ys.reject(new Error("Kernel connection disconnected")), this.connectionStatusChanged.disconnect(El, this));
      };
      return this.connectionStatusChanged.connect(El, this), this._reconnectAttempt = 0, this._reconnect(), Ys.promise;
    }
    /**
     * Shutdown a kernel.
     *
     * #### Notes
     * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels).
     *
     * The promise is fulfilled on a valid response and rejected otherwise.
     *
     * On a valid response, disposes this kernel connection.
     *
     * If the kernel is already `dead`, disposes this kernel connection without
     * a server request.
     */
    async shutdown() {
      this.status !== "dead" && await Ls.shutdownKernel(this.id, this.serverSettings), this.handleShutdown();
    }
    /**
     * Handles a kernel shutdown.
     *
     * #### Notes
     * This method should be called if we know from outside information that a
     * kernel is dead (for example, we cannot find the kernel model on the
     * server).
     */
    handleShutdown() {
      this._updateStatus("dead"), this.dispose();
    }
    /**
     * Send a `kernel_info_request` message.
     *
     * #### Notes
     * See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#kernel-info).
     *
     * Fulfills with the `kernel_info_response` content when the shell reply is
     * received and validated.
     */
    async requestKernelInfo() {
      const Ys = Cr.createMessage({
        msgType: "kernel_info_request",
        channel: "shell",
        username: this._username,
        session: this._clientId,
        content: {}
      });
      let El;
      try {
        El = await Hs.handleShellMessage(this, Ys);
      } catch (Mu) {
        if (this.isDisposed)
          return;
        throw Mu;
      }
      if (this._errorIfDisposed(), !!El)
        return El.content.status === void 0 && (El.content.status = "ok"), El.content.status !== "ok" ? (this._info.reject("Kernel info reply errored"), El) : (this._info.resolve(El.content), this._kernelSession = El.header.session, El);
    }
    /**
     * Send a `complete_request` message.
     *
     * #### Notes
     * See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#completion).
     *
     * Fulfills with the `complete_reply` content when the shell reply is
     * received and validated.
     */
    requestComplete(Ys) {
      const El = Cr.createMessage({
        msgType: "complete_request",
        channel: "shell",
        username: this._username,
        session: this._clientId,
        content: Ys
      });
      return Hs.handleShellMessage(this, El);
    }
    /**
     * Send an `inspect_request` message.
     *
     * #### Notes
     * See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#introspection).
     *
     * Fulfills with the `inspect_reply` content when the shell reply is
     * received and validated.
     */
    requestInspect(Ys) {
      const El = Cr.createMessage({
        msgType: "inspect_request",
        channel: "shell",
        username: this._username,
        session: this._clientId,
        content: Ys
      });
      return Hs.handleShellMessage(this, El);
    }
    /**
     * Send a `history_request` message.
     *
     * #### Notes
     * See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#history).
     *
     * Fulfills with the `history_reply` content when the shell reply is
     * received and validated.
     */
    requestHistory(Ys) {
      const El = Cr.createMessage({
        msgType: "history_request",
        channel: "shell",
        username: this._username,
        session: this._clientId,
        content: Ys
      });
      return Hs.handleShellMessage(this, El);
    }
    /**
     * Send an `execute_request` message.
     *
     * #### Notes
     * See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#execute).
     *
     * Future `onReply` is called with the `execute_reply` content when the
     * shell reply is received and validated. The future will resolve when
     * this message is received and the `idle` iopub status is received.
     * The future will also be disposed at this point unless `disposeOnDone`
     * is specified and `false`, in which case it is up to the caller to dispose
     * of the future.
     *
     * **See also:** [[IExecuteReply]]
     */
    requestExecute(Ys, El = !0, Mu) {
      const Pl = {
        silent: !1,
        store_history: !0,
        user_expressions: {},
        allow_stdin: !0,
        stop_on_error: !1
      }, Iu = Cr.createMessage({
        msgType: "execute_request",
        channel: "shell",
        username: this._username,
        session: this._clientId,
        content: { ...Pl, ...Ys },
        metadata: Mu
      });
      return this.sendShellMessage(Iu, !0, El);
    }
    /**
     * Send an experimental `debug_request` message.
     *
     * @hidden
     *
     * #### Notes
     * Debug messages are experimental messages that are not in the official
     * kernel message specification. As such, this function is *NOT* considered
     * part of the public API, and may change without notice.
     */
    requestDebug(Ys, El = !0) {
      const Mu = Cr.createMessage({
        msgType: "debug_request",
        channel: "control",
        username: this._username,
        session: this._clientId,
        content: Ys
      });
      return this.sendControlMessage(Mu, !0, El);
    }
    /**
     * Send an `is_complete_request` message.
     *
     * #### Notes
     * See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#code-completeness).
     *
     * Fulfills with the `is_complete_response` content when the shell reply is
     * received and validated.
     */
    requestIsComplete(Ys) {
      const El = Cr.createMessage({
        msgType: "is_complete_request",
        channel: "shell",
        username: this._username,
        session: this._clientId,
        content: Ys
      });
      return Hs.handleShellMessage(this, El);
    }
    /**
     * Send a `comm_info_request` message.
     *
     * #### Notes
     * Fulfills with the `comm_info_reply` content when the shell reply is
     * received and validated.
     */
    requestCommInfo(Ys) {
      const El = Cr.createMessage({
        msgType: "comm_info_request",
        channel: "shell",
        username: this._username,
        session: this._clientId,
        content: Ys
      });
      return Hs.handleShellMessage(this, El);
    }
    /**
     * Send an `input_reply` message.
     *
     * #### Notes
     * See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#messages-on-the-stdin-router-dealer-sockets).
     */
    sendInputReply(Ys, El) {
      const Mu = Cr.createMessage({
        msgType: "input_reply",
        channel: "stdin",
        username: this._username,
        session: this._clientId,
        content: Ys
      });
      Mu.parent_header = El, this._sendMessage(Mu), this._anyMessage.emit({ msg: Mu, direction: "send" }), this.hasPendingInput = !1;
    }
    /**
     * Create a new comm.
     *
     * #### Notes
     * If a client-side comm already exists with the given commId, an error is thrown.
     * If the kernel does not handle comms, an error is thrown.
     */
    createComm(Ys, El = Sn.UUID.uuid4()) {
      if (!this.handleComms)
        throw new Error("Comms are disabled on this kernel connection");
      if (this._comms.has(El))
        throw new Error("Comm is already created");
      const Mu = new er.CommHandler(Ys, El, this, () => {
        this._unregisterComm(El);
      });
      return this._comms.set(El, Mu), Mu;
    }
    /**
     * Check if a comm exists.
     */
    hasComm(Ys) {
      return this._comms.has(Ys);
    }
    /**
     * Register a comm target handler.
     *
     * @param targetName - The name of the comm target.
     *
     * @param callback - The callback invoked for a comm open message.
     *
     * @returns A disposable used to unregister the comm target.
     *
     * #### Notes
     * Only one comm target can be registered to a target name at a time, an
     * existing callback for the same target name will be overridden.  A registered
     * comm target handler will take precedence over a comm which specifies a
     * `target_module`.
     *
     * If the callback returns a promise, kernel message processing will pause
     * until the returned promise is fulfilled.
     */
    registerCommTarget(Ys, El) {
      this.handleComms && (this._targetRegistry[Ys] = El);
    }
    /**
     * Remove a comm target handler.
     *
     * @param targetName - The name of the comm target to remove.
     *
     * @param callback - The callback to remove.
     *
     * #### Notes
     * The comm target is only removed if the callback argument matches.
     */
    removeCommTarget(Ys, El) {
      this.handleComms && !this.isDisposed && this._targetRegistry[Ys] === El && delete this._targetRegistry[Ys];
    }
    /**
     * Register an IOPub message hook.
     *
     * @param msg_id - The parent_header message id the hook will intercept.
     *
     * @param hook - The callback invoked for the message.
     *
     * #### Notes
     * The IOPub hook system allows you to preempt the handlers for IOPub
     * messages that are responses to a given message id.
     *
     * The most recently registered hook is run first. A hook can return a
     * boolean or a promise to a boolean, in which case all kernel message
     * processing pauses until the promise is fulfilled. If a hook return value
     * resolves to false, any later hooks will not run and the function will
     * return a promise resolving to false. If a hook throws an error, the error
     * is logged to the console and the next hook is run. If a hook is
     * registered during the hook processing, it will not run until the next
     * message. If a hook is removed during the hook processing, it will be
     * deactivated immediately.
     *
     * See also [[IFuture.registerMessageHook]].
     */
    registerMessageHook(Ys, El) {
      var Mu;
      const Pl = (Mu = this._futures) === null || Mu === void 0 ? void 0 : Mu.get(Ys);
      Pl && Pl.registerMessageHook(El);
    }
    /**
     * Remove an IOPub message hook.
     *
     * @param msg_id - The parent_header message id the hook intercepted.
     *
     * @param hook - The callback invoked for the message.
     *
     */
    removeMessageHook(Ys, El) {
      var Mu;
      const Pl = (Mu = this._futures) === null || Mu === void 0 ? void 0 : Mu.get(Ys);
      Pl && Pl.removeMessageHook(El);
    }
    /**
     * Remove the input guard, if any.
     */
    removeInputGuard() {
      this.hasPendingInput = !1;
    }
    /**
     * Handle a message with a display id.
     *
     * @returns Whether the message was handled.
     */
    async _handleDisplayId(Ys, El) {
      var Mu, Pl;
      const Iu = El.parent_header.msg_id;
      let Tu = this._displayIdToParentIds.get(Ys);
      if (Tu) {
        const Nu = {
          header: Sn.JSONExt.deepCopy(El.header),
          parent_header: Sn.JSONExt.deepCopy(El.parent_header),
          metadata: Sn.JSONExt.deepCopy(El.metadata),
          content: Sn.JSONExt.deepCopy(El.content),
          channel: El.channel,
          buffers: El.buffers ? El.buffers.slice() : []
        };
        Nu.header.msg_type = "update_display_data", await Promise.all(Tu.map(async (gm) => {
          const pm = this._futures && this._futures.get(gm);
          pm && await pm.handleMsg(Nu);
        }));
      }
      if (El.header.msg_type === "update_display_data")
        return !0;
      Tu = (Mu = this._displayIdToParentIds.get(Ys)) !== null && Mu !== void 0 ? Mu : [], Tu.indexOf(Iu) === -1 && Tu.push(Iu), this._displayIdToParentIds.set(Ys, Tu);
      const Au = (Pl = this._msgIdToDisplayIds.get(Iu)) !== null && Pl !== void 0 ? Pl : [];
      return Au.indexOf(Iu) === -1 && Au.push(Iu), this._msgIdToDisplayIds.set(Iu, Au), !1;
    }
    /**
     * Forcefully clear the socket state.
     *
     * #### Notes
     * This will clear all socket state without calling any handlers and will
     * not update the connection status. If you call this method, you are
     * responsible for updating the connection status as needed and recreating
     * the socket if you plan to reconnect.
     */
    _clearSocket() {
      this._ws !== null && (this._ws.onopen = this._noOp, this._ws.onclose = this._noOp, this._ws.onerror = this._noOp, this._ws.onmessage = this._noOp, this._ws.close(), this._ws = null);
    }
    /**
     * Handle status iopub messages from the kernel.
     */
    _updateStatus(Ys) {
      this._status === Ys || this._status === "dead" || (this._status = Ys, Hs.logKernelStatus(this), this._statusChanged.emit(Ys), Ys === "dead" && this.dispose());
    }
    /**
     * Send pending messages to the kernel.
     */
    _sendPending() {
      for (; this.connectionStatus === "connected" && this._kernelSession !== zs && this._pendingMessages.length > 0; )
        this._sendMessage(this._pendingMessages[0], !1), this._pendingMessages.shift();
    }
    /**
     * Clear the internal state.
     */
    _clearKernelState() {
      this._kernelSession = "", this._pendingMessages = [], this._futures.forEach((Ys) => {
        Ys.dispose();
      }), this._comms.forEach((Ys) => {
        Ys.dispose();
      }), this._msgChain = Promise.resolve(), this._futures = /* @__PURE__ */ new Map(), this._comms = /* @__PURE__ */ new Map(), this._displayIdToParentIds.clear(), this._msgIdToDisplayIds.clear();
    }
    /**
     * Check to make sure it is okay to proceed to handle a message.
     *
     * #### Notes
     * Because we handle messages asynchronously, before a message is handled the
     * kernel might be disposed or restarted (and have a different session id).
     * This function throws an error in each of these cases. This is meant to be
     * called at the start of an asynchronous message handler to cancel message
     * processing if the message no longer is valid.
     */
    _assertCurrentMessage(Ys) {
      if (this._errorIfDisposed(), Ys.header.session !== this._kernelSession)
        throw new Error(`Canceling handling of old message: ${Ys.header.msg_type}`);
    }
    /**
     * Handle a `comm_open` kernel message.
     */
    async _handleCommOpen(Ys) {
      this._assertCurrentMessage(Ys);
      const El = Ys.content, Mu = new er.CommHandler(El.target_name, El.comm_id, this, () => {
        this._unregisterComm(El.comm_id);
      });
      this._comms.set(El.comm_id, Mu);
      try {
        await (await Hs.loadObject(El.target_name, El.target_module, this._targetRegistry))(Mu, Ys);
      } catch (Pl) {
        throw Mu.close(), console.error("Exception opening new comm"), Pl;
      }
    }
    /**
     * Handle 'comm_close' kernel message.
     */
    async _handleCommClose(Ys) {
      this._assertCurrentMessage(Ys);
      const El = Ys.content, Mu = this._comms.get(El.comm_id);
      if (!Mu) {
        console.error("Comm not found for comm id " + El.comm_id);
        return;
      }
      this._unregisterComm(Mu.commId);
      const Pl = Mu.onClose;
      Pl && await Pl(Ys), Mu.dispose();
    }
    /**
     * Handle a 'comm_msg' kernel message.
     */
    async _handleCommMsg(Ys) {
      this._assertCurrentMessage(Ys);
      const El = Ys.content, Mu = this._comms.get(El.comm_id);
      if (!Mu)
        return;
      const Pl = Mu.onMsg;
      Pl && await Pl(Ys);
    }
    /**
     * Unregister a comm instance.
     */
    _unregisterComm(Ys) {
      this._comms.delete(Ys);
    }
    /**
     * Handle connection status changes.
     */
    _updateConnectionStatus(Ys) {
      if (this._connectionStatus !== Ys) {
        if (this._connectionStatus = Ys, Ys !== "connecting" && (this._reconnectAttempt = 0, clearTimeout(this._reconnectTimeout)), this.status !== "dead")
          if (Ys === "connected") {
            let El = this._kernelSession === zs, Mu = this.requestKernelInfo(), Pl = !1, Iu = () => {
              Pl || (Pl = !0, El && this._kernelSession === zs && (this._kernelSession = ""), clearTimeout(Tu), this._pendingMessages.length > 0 && this._sendPending());
            };
            Mu.then(Iu);
            let Tu = setTimeout(Iu, js);
          } else
            this._updateStatus("unknown");
        this._connectionStatusChanged.emit(Ys);
      }
    }
    async _handleMessage(Ys) {
      var El, Mu;
      let Pl = !1;
      if (Ys.parent_header && Ys.channel === "iopub" && (Cr.isDisplayDataMsg(Ys) || Cr.isUpdateDisplayDataMsg(Ys) || Cr.isExecuteResultMsg(Ys))) {
        const Tu = ((El = Ys.content.transient) !== null && El !== void 0 ? El : {}).display_id;
        Tu && (Pl = await this._handleDisplayId(Tu, Ys), this._assertCurrentMessage(Ys));
      }
      if (!Pl && Ys.parent_header) {
        const Iu = Ys.parent_header, Tu = (Mu = this._futures) === null || Mu === void 0 ? void 0 : Mu.get(Iu.msg_id);
        if (Tu)
          await Tu.handleMsg(Ys), this._assertCurrentMessage(Ys);
        else {
          const Au = Iu.session === this.clientId;
          Ys.channel !== "iopub" && Au && this._unhandledMessage.emit(Ys);
        }
      }
      if (Ys.channel === "iopub") {
        switch (Ys.header.msg_type) {
          case "status": {
            const Iu = Ys.content.execution_state;
            Iu === "restarting" && Promise.resolve().then(async () => {
              this._updateStatus("autorestarting"), this._clearKernelState(), await this.reconnect();
            }), this._updateStatus(Iu);
            break;
          }
          case "comm_open":
            this.handleComms && await this._handleCommOpen(Ys);
            break;
          case "comm_msg":
            this.handleComms && await this._handleCommMsg(Ys);
            break;
          case "comm_close":
            this.handleComms && await this._handleCommClose(Ys);
            break;
        }
        this.isDisposed || (this._assertCurrentMessage(Ys), this._iopubMessage.emit(Ys));
      }
    }
    /**
     * Attempt a connection if we have not exhausted connection attempts.
     */
    _reconnect() {
      if (this._errorIfDisposed(), clearTimeout(this._reconnectTimeout), this._reconnectAttempt < this._reconnectLimit) {
        this._updateConnectionStatus("connecting");
        const Ys = Hs.getRandomIntInclusive(0, 1e3 * (Math.pow(2, this._reconnectAttempt) - 1));
        console.warn(`Connection lost, reconnecting in ${Math.floor(Ys / 1e3)} seconds.`);
        const El = this._selectedProtocol !== "";
        this._reconnectTimeout = setTimeout(this._createSocket, Ys, El), this._reconnectAttempt += 1;
      } else
        this._updateConnectionStatus("disconnected");
      this._clearSocket();
    }
    /**
     * Utility function to throw an error if this instance is disposed.
     */
    _errorIfDisposed() {
      if (this.isDisposed)
        throw new Error("Kernel connection is disposed");
    }
    get hasPendingInput() {
      return this._hasPendingInput;
    }
    set hasPendingInput(Ys) {
      this._hasPendingInput = Ys, this._pendingInput.emit(Ys);
    }
  }
  _default$2.KernelConnection = Bs;
  var Hs;
  return function(Ws) {
    function Ys(Iu) {
      switch (Iu.status) {
        case "idle":
        case "busy":
        case "unknown":
          return;
        default:
          console.debug(`Kernel: ${Iu.status} (${Iu.id})`);
          break;
      }
    }
    Ws.logKernelStatus = Ys;
    async function El(Iu, Tu) {
      return Iu.sendShellMessage(Tu, !0).done;
    }
    Ws.handleShellMessage = El;
    function Mu(Iu, Tu, Au) {
      return new Promise((Nu, gm) => {
        if (Tu) {
          if (typeof requirejs > "u")
            throw new Error("requirejs not found");
          requirejs([Tu], (pm) => {
            if (pm[Iu] === void 0) {
              const zu = `Object '${Iu}' not found in module '${Tu}'`;
              gm(new Error(zu));
            } else
              Nu(pm[Iu]);
          }, gm);
        } else
          Au != null && Au[Iu] ? Nu(Au[Iu]) : gm(new Error(`Object '${Iu}' not found in registry`));
      });
    }
    Ws.loadObject = Mu;
    function Pl(Iu, Tu) {
      return Iu = Math.ceil(Iu), Tu = Math.floor(Tu), Math.floor(Math.random() * (Tu - Iu + 1)) + Iu;
    }
    Ws.getRandomIntInclusive = Pl;
  }(Hs || (Hs = {})), _default$2;
}
var manager$3 = {}, hasRequiredManager$3;
function requireManager$3() {
  return hasRequiredManager$3 || (hasRequiredManager$3 = 1, function(_e) {
    Object.defineProperty(_e, "__esModule", { value: !0 }), _e.KernelManager = void 0;
    const Qt = require$$2, Zt = require$$0$1, $n = requireLib(), Sn = basemanager, kn = restapi$4, Kn = require_default$2();
    class er extends Sn.BaseManager {
      /**
       * Construct a new kernel manager.
       *
       * @param options - The default options for kernel.
       */
      constructor(kr = {}) {
        var Yr;
        super(kr), this._isReady = !1, this._kernelConnections = /* @__PURE__ */ new Set(), this._models = /* @__PURE__ */ new Map(), this._runningChanged = new Zt.Signal(this), this._connectionFailure = new Zt.Signal(this), this._pollModels = new Qt.Poll({
          auto: !1,
          factory: () => this.requestRunning(),
          frequency: {
            interval: 10 * 1e3,
            backoff: !0,
            max: 300 * 1e3
          },
          name: "@jupyterlab/services:KernelManager#models",
          standby: (Yr = kr.standby) !== null && Yr !== void 0 ? Yr : "when-hidden"
        }), this._ready = (async () => {
          await this._pollModels.start(), await this._pollModels.tick, this._isReady = !0;
        })();
      }
      /**
       * Test whether the manager is ready.
       */
      get isReady() {
        return this._isReady;
      }
      /**
       * A promise that fulfills when the manager is ready.
       */
      get ready() {
        return this._ready;
      }
      /**
       * A signal emitted when the running kernels change.
       */
      get runningChanged() {
        return this._runningChanged;
      }
      /**
       * A signal emitted when there is a connection failure.
       */
      get connectionFailure() {
        return this._connectionFailure;
      }
      /**
       * Dispose of the resources used by the manager.
       */
      dispose() {
        this.isDisposed || (this._models.clear(), this._kernelConnections.forEach((kr) => kr.dispose()), this._pollModels.dispose(), super.dispose());
      }
      /**
       * Connect to an existing kernel.
       *
       * @returns The new kernel connection.
       *
       * #### Notes
       * This will use the manager's server settings and ignore any server
       * settings passed in the options.
       */
      connectTo(kr) {
        var Yr;
        const { id: Ms } = kr.model;
        let Ds = (Yr = kr.handleComms) !== null && Yr !== void 0 ? Yr : !0;
        if (kr.handleComms === void 0) {
          for (const js of this._kernelConnections)
            if (js.id === Ms && js.handleComms) {
              Ds = !1;
              break;
            }
        }
        const Ls = new Kn.KernelConnection({
          handleComms: Ds,
          ...kr,
          serverSettings: this.serverSettings
        });
        return this._onStarted(Ls), this._models.has(Ms) || this.refreshRunning().catch(() => {
        }), Ls;
      }
      /**
       * Create an iterator over the most recent running kernels.
       *
       * @returns A new iterator over the running kernels.
       */
      running() {
        return this._models.values();
      }
      /**
       * Force a refresh of the running kernels.
       *
       * @returns A promise that resolves when the running list has been refreshed.
       *
       * #### Notes
       * This is not typically meant to be called by the user, since the
       * manager maintains its own internal state.
       */
      async refreshRunning() {
        await this._pollModels.refresh(), await this._pollModels.tick;
      }
      /**
       * Start a new kernel.
       *
       * @param createOptions - The kernel creation options
       *
       * @param connectOptions - The kernel connection options
       *
       * @returns A promise that resolves with the kernel connection.
       *
       * #### Notes
       * The manager `serverSettings` will be always be used.
       */
      async startNew(kr = {}, Yr = {}) {
        const Ms = await (0, kn.startNew)(kr, this.serverSettings);
        return this.connectTo({
          ...Yr,
          model: Ms
        });
      }
      /**
       * Shut down a kernel by id.
       *
       * @param id - The id of the target kernel.
       *
       * @returns A promise that resolves when the operation is complete.
       */
      async shutdown(kr) {
        await (0, kn.shutdownKernel)(kr, this.serverSettings), await this.refreshRunning();
      }
      /**
       * Shut down all kernels.
       *
       * @returns A promise that resolves when all of the kernels are shut down.
       */
      async shutdownAll() {
        await this.refreshRunning(), await Promise.all([...this._models.keys()].map((kr) => (0, kn.shutdownKernel)(kr, this.serverSettings))), await this.refreshRunning();
      }
      /**
       * Find a kernel by id.
       *
       * @param id - The id of the target kernel.
       *
       * @returns A promise that resolves with the kernel's model.
       */
      async findById(kr) {
        return this._models.has(kr) ? this._models.get(kr) : (await this.refreshRunning(), this._models.get(kr));
      }
      /**
       * Execute a request to the server to poll running kernels and update state.
       */
      async requestRunning() {
        var kr, Yr;
        let Ms;
        try {
          Ms = await (0, kn.listRunning)(this.serverSettings);
        } catch (Ds) {
          throw (Ds instanceof $n.ServerConnection.NetworkError || ((kr = Ds.response) === null || kr === void 0 ? void 0 : kr.status) === 503 || ((Yr = Ds.response) === null || Yr === void 0 ? void 0 : Yr.status) === 424) && this._connectionFailure.emit(Ds), Ds;
        }
        this.isDisposed || this._models.size === Ms.length && Ms.every((Ds) => {
          const Ls = this._models.get(Ds.id);
          return Ls ? Ls.connections === Ds.connections && Ls.execution_state === Ds.execution_state && Ls.last_activity === Ds.last_activity && Ls.name === Ds.name && Ls.reason === Ds.reason && Ls.traceback === Ds.traceback : !1;
        }) || (this._models = new Map(Ms.map((Ds) => [Ds.id, Ds])), this._kernelConnections.forEach((Ds) => {
          this._models.has(Ds.id) || Ds.handleShutdown();
        }), this._runningChanged.emit(Ms));
      }
      /**
       * Handle a kernel starting.
       */
      _onStarted(kr) {
        this._kernelConnections.add(kr), kr.statusChanged.connect(this._onStatusChanged, this), kr.disposed.connect(this._onDisposed, this);
      }
      _onDisposed(kr) {
        this._kernelConnections.delete(kr), this.refreshRunning().catch(() => {
        });
      }
      _onStatusChanged(kr, Yr) {
        Yr === "dead" && this.refreshRunning().catch(() => {
        });
      }
    }
    _e.KernelManager = er, function(Cr) {
      class kr extends Cr {
        constructor() {
          super(...arguments), this._readyPromise = new Promise(() => {
          });
        }
        /**
         * Whether the manager is active.
         */
        get isActive() {
          return !1;
        }
        /**
         * Used for testing.
         */
        get parentReady() {
          return super.ready;
        }
        /**
         * Start a new kernel - throws an error since it is not supported.
         */
        async startNew(Ms = {}, Ds = {}) {
          return Promise.reject(new Error("Not implemented in no-op Kernel Manager"));
        }
        /**
         * Connect to an existing kernel - throws an error since it is not supported.
         */
        connectTo(Ms) {
          throw new Error("Not implemented in no-op Kernel Manager");
        }
        /**
         * Shut down a kernel by id - throws an error since it is not supported.
         */
        async shutdown(Ms) {
          return Promise.reject(new Error("Not implemented in no-op Kernel Manager"));
        }
        /**
         * A promise that fulfills when the manager is ready (never).
         */
        get ready() {
          return this.parentReady.then(() => this._readyPromise);
        }
        /**
         * Execute a request to the server to poll running kernels and update state.
         */
        async requestRunning() {
          return Promise.resolve();
        }
      }
      Cr.NoopManager = kr;
    }(er = _e.KernelManager || (_e.KernelManager = {}));
  }(manager$3)), manager$3;
}
var hasRequiredKernel;
function requireKernel() {
  return hasRequiredKernel || (hasRequiredKernel = 1, function(_e) {
    var Qt = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(kr, Yr, Ms, Ds) {
      Ds === void 0 && (Ds = Ms);
      var Ls = Object.getOwnPropertyDescriptor(Yr, Ms);
      (!Ls || ("get" in Ls ? !Yr.__esModule : Ls.writable || Ls.configurable)) && (Ls = { enumerable: !0, get: function() {
        return Yr[Ms];
      } }), Object.defineProperty(kr, Ds, Ls);
    } : function(kr, Yr, Ms, Ds) {
      Ds === void 0 && (Ds = Ms), kr[Ds] = Yr[Ms];
    }), Zt = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(kr, Yr) {
      Object.defineProperty(kr, "default", { enumerable: !0, value: Yr });
    } : function(kr, Yr) {
      kr.default = Yr;
    }), $n = commonjsGlobal && commonjsGlobal.__importStar || function(kr) {
      if (kr && kr.__esModule)
        return kr;
      var Yr = {};
      if (kr != null)
        for (var Ms in kr)
          Ms !== "default" && Object.prototype.hasOwnProperty.call(kr, Ms) && Qt(Yr, kr, Ms);
      return Zt(Yr, kr), Yr;
    }, Sn = commonjsGlobal && commonjsGlobal.__exportStar || function(kr, Yr) {
      for (var Ms in kr)
        Ms !== "default" && !Object.prototype.hasOwnProperty.call(Yr, Ms) && Qt(Yr, kr, Ms);
    };
    Object.defineProperty(_e, "__esModule", { value: !0 }), _e.KernelConnection = _e.KernelAPI = _e.KernelMessage = _e.Kernel = void 0;
    const kn = $n(kernel);
    _e.Kernel = kn;
    const Kn = $n(messages);
    _e.KernelMessage = Kn;
    const er = $n(restapi$4);
    _e.KernelAPI = er;
    const Cr = require_default$2();
    Object.defineProperty(_e, "KernelConnection", { enumerable: !0, get: function() {
      return Cr.KernelConnection;
    } }), Sn(requireManager$3(), _e);
  }(kernel$1)), kernel$1;
}
var manager$2 = {}, builder = {};
Object.defineProperty(builder, "__esModule", { value: !0 });
builder.BuildManager = void 0;
const coreutils_1$4 = lib$3, serverconnection_1$4 = serverconnection, BUILD_SETTINGS_URL = "api/build";
class BuildManager {
  /**
   * Create a new setting manager.
   */
  constructor(Qt = {}) {
    var Zt;
    this._url = "", this.serverSettings = (Zt = Qt.serverSettings) !== null && Zt !== void 0 ? Zt : serverconnection_1$4.ServerConnection.makeSettings();
    const { baseUrl: $n, appUrl: Sn } = this.serverSettings;
    this._url = coreutils_1$4.URLExt.join($n, Sn, BUILD_SETTINGS_URL);
  }
  /**
   * Test whether the build service is available.
   */
  get isAvailable() {
    return coreutils_1$4.PageConfig.getOption("buildAvailable").toLowerCase() === "true";
  }
  /**
   * Test whether to check build status automatically.
   */
  get shouldCheck() {
    return coreutils_1$4.PageConfig.getOption("buildCheck").toLowerCase() === "true";
  }
  /**
   * Get whether the application should be built.
   */
  getStatus() {
    const { _url: Qt, serverSettings: Zt } = this;
    return serverconnection_1$4.ServerConnection.makeRequest(Qt, {}, Zt).then((Sn) => {
      if (Sn.status !== 200)
        throw new serverconnection_1$4.ServerConnection.ResponseError(Sn);
      return Sn.json();
    }).then((Sn) => {
      if (typeof Sn.status != "string")
        throw new Error("Invalid data");
      if (typeof Sn.message != "string")
        throw new Error("Invalid data");
      return Sn;
    });
  }
  /**
   * Build the application.
   */
  build() {
    const { _url: Qt, serverSettings: Zt } = this, $n = { method: "POST" };
    return serverconnection_1$4.ServerConnection.makeRequest(Qt, $n, Zt).then((kn) => {
      if (kn.status === 400)
        throw new serverconnection_1$4.ServerConnection.ResponseError(kn, "Build aborted");
      if (kn.status !== 200) {
        const Kn = `Build failed with ${kn.status}.

        If you are experiencing the build failure after installing an extension (or trying to include previously installed extension after updating JupyterLab) please check the extension repository for new installation instructions as many extensions migrated to the prebuilt extensions system which no longer requires rebuilding JupyterLab (but uses a different installation procedure, typically involving a package manager such as 'pip' or 'conda').

        If you specifically intended to install a source extension, please run 'jupyter lab build' on the server for full output.`;
        throw new serverconnection_1$4.ServerConnection.ResponseError(kn, Kn);
      }
    });
  }
  /**
   * Cancel an active build.
   */
  cancel() {
    const { _url: Qt, serverSettings: Zt } = this, $n = { method: "DELETE" };
    return serverconnection_1$4.ServerConnection.makeRequest(Qt, $n, Zt).then((kn) => {
      if (kn.status !== 204)
        throw new serverconnection_1$4.ServerConnection.ResponseError(kn);
    });
  }
}
builder.BuildManager = BuildManager;
var nbconvert = {};
Object.defineProperty(nbconvert, "__esModule", { value: !0 });
nbconvert.NbConvertManager = void 0;
const coreutils_1$3 = lib$3, serverconnection_1$3 = serverconnection, coreutils_2$1 = require$$1$2, NBCONVERT_SETTINGS_URL = "api/nbconvert";
class NbConvertManager {
  /**
   * Create a new nbconvert manager.
   */
  constructor(Qt = {}) {
    var Zt;
    this._exportFormats = null, this.serverSettings = (Zt = Qt.serverSettings) !== null && Zt !== void 0 ? Zt : serverconnection_1$3.ServerConnection.makeSettings();
  }
  /**
   * Fetch and cache the export formats from the expensive nbconvert handler.
   */
  async fetchExportFormats() {
    this._requestingFormats = new coreutils_2$1.PromiseDelegate(), this._exportFormats = null;
    const Qt = this.serverSettings.baseUrl, Zt = coreutils_1$3.URLExt.join(Qt, NBCONVERT_SETTINGS_URL), { serverSettings: $n } = this, Sn = await serverconnection_1$3.ServerConnection.makeRequest(Zt, {}, $n);
    if (Sn.status !== 200)
      throw await serverconnection_1$3.ServerConnection.ResponseError.create(Sn);
    const kn = await Sn.json(), Kn = {};
    return Object.keys(kn).forEach(function(Cr) {
      const kr = kn[Cr].output_mimetype;
      Kn[Cr] = { output_mimetype: kr };
    }), this._exportFormats = Kn, this._requestingFormats.resolve(Kn), Kn;
  }
  /**
   * Get the list of export formats, preferring pre-cached ones.
   */
  async getExportFormats(Qt = !0) {
    return this._requestingFormats ? this._requestingFormats.promise : Qt || !this._exportFormats ? await this.fetchExportFormats() : this._exportFormats;
  }
}
nbconvert.NbConvertManager = NbConvertManager;
var session$1 = {}, session = {};
Object.defineProperty(session, "__esModule", { value: !0 });
var restapi$1 = {}, validate$1 = {};
Object.defineProperty(validate$1, "__esModule", { value: !0 });
validate$1.validateModels = validate$1.updateLegacySessionModel = validate$1.validateModel = void 0;
const validate_1 = validate$3, validate_2 = validate$4;
function validateModel(_e) {
  (0, validate_2.validateProperty)(_e, "id", "string"), (0, validate_2.validateProperty)(_e, "type", "string"), (0, validate_2.validateProperty)(_e, "name", "string"), (0, validate_2.validateProperty)(_e, "path", "string"), (0, validate_2.validateProperty)(_e, "kernel", "object"), (0, validate_1.validateModel)(_e.kernel);
}
validate$1.validateModel = validateModel;
function updateLegacySessionModel(_e) {
  _e.path === void 0 && _e.notebook !== void 0 && (_e.path = _e.notebook.path, _e.type = "notebook", _e.name = "");
}
validate$1.updateLegacySessionModel = updateLegacySessionModel;
function validateModels(_e) {
  if (!Array.isArray(_e))
    throw new Error("Invalid session list");
  _e.forEach((Qt) => validateModel(Qt));
}
validate$1.validateModels = validateModels;
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.updateSession = _e.startSession = _e.getSessionModel = _e.shutdownSession = _e.getSessionUrl = _e.listRunning = _e.SESSION_SERVICE_URL = void 0;
  const Qt = serverconnection, Zt = lib$3, $n = validate$1;
  _e.SESSION_SERVICE_URL = "api/sessions";
  async function Sn(Yr = Qt.ServerConnection.makeSettings()) {
    const Ms = Zt.URLExt.join(Yr.baseUrl, _e.SESSION_SERVICE_URL), Ds = await Qt.ServerConnection.makeRequest(Ms, {}, Yr);
    if (Ds.status !== 200)
      throw await Qt.ServerConnection.ResponseError.create(Ds);
    const Ls = await Ds.json();
    if (!Array.isArray(Ls))
      throw new Error("Invalid Session list");
    return Ls.forEach((js) => {
      (0, $n.updateLegacySessionModel)(js), (0, $n.validateModel)(js);
    }), Ls;
  }
  _e.listRunning = Sn;
  function kn(Yr, Ms) {
    return Zt.URLExt.join(Yr, _e.SESSION_SERVICE_URL, Ms);
  }
  _e.getSessionUrl = kn;
  async function Kn(Yr, Ms = Qt.ServerConnection.makeSettings()) {
    var Ds;
    const Ls = kn(Ms.baseUrl, Yr), js = { method: "DELETE" }, zs = await Qt.ServerConnection.makeRequest(Ls, js, Ms);
    if (zs.status === 404) {
      const Bs = (Ds = (await zs.json()).message) !== null && Ds !== void 0 ? Ds : `The session "${Yr}"" does not exist on the server`;
      console.warn(Bs);
    } else {
      if (zs.status === 410)
        throw new Qt.ServerConnection.ResponseError(zs, "The kernel was deleted but the session was not");
      if (zs.status !== 204)
        throw await Qt.ServerConnection.ResponseError.create(zs);
    }
  }
  _e.shutdownSession = Kn;
  async function er(Yr, Ms = Qt.ServerConnection.makeSettings()) {
    const Ds = kn(Ms.baseUrl, Yr), Ls = await Qt.ServerConnection.makeRequest(Ds, {}, Ms);
    if (Ls.status !== 200)
      throw await Qt.ServerConnection.ResponseError.create(Ls);
    const js = await Ls.json();
    return (0, $n.updateLegacySessionModel)(js), (0, $n.validateModel)(js), js;
  }
  _e.getSessionModel = er;
  async function Cr(Yr, Ms = Qt.ServerConnection.makeSettings()) {
    const Ds = Zt.URLExt.join(Ms.baseUrl, _e.SESSION_SERVICE_URL), Ls = {
      method: "POST",
      body: JSON.stringify(Yr)
    }, js = await Qt.ServerConnection.makeRequest(Ds, Ls, Ms);
    if (js.status !== 201)
      throw await Qt.ServerConnection.ResponseError.create(js);
    const zs = await js.json();
    return (0, $n.updateLegacySessionModel)(zs), (0, $n.validateModel)(zs), zs;
  }
  _e.startSession = Cr;
  async function kr(Yr, Ms = Qt.ServerConnection.makeSettings()) {
    const Ds = kn(Ms.baseUrl, Yr.id), Ls = {
      method: "PATCH",
      body: JSON.stringify(Yr)
    }, js = await Qt.ServerConnection.makeRequest(Ds, Ls, Ms);
    if (js.status !== 200)
      throw await Qt.ServerConnection.ResponseError.create(js);
    const zs = await js.json();
    return (0, $n.updateLegacySessionModel)(zs), (0, $n.validateModel)(zs), zs;
  }
  _e.updateSession = kr;
})(restapi$1);
var manager$1 = {}, _default$1 = {}, hasRequired_default$1;
function require_default$1() {
  if (hasRequired_default$1)
    return _default$1;
  hasRequired_default$1 = 1, Object.defineProperty(_default$1, "__esModule", { value: !0 }), _default$1.SessionConnection = void 0;
  const _e = require$$0$1, Qt = requireLib(), Zt = restapi$1, $n = require$$1$2;
  class Sn {
    /**
     * Construct a new session.
     */
    constructor(Kn) {
      var er, Cr, kr, Yr;
      this._id = "", this._path = "", this._name = "", this._type = "", this._kernel = null, this._isDisposed = !1, this._disposed = new _e.Signal(this), this._kernelChanged = new _e.Signal(this), this._statusChanged = new _e.Signal(this), this._connectionStatusChanged = new _e.Signal(this), this._pendingInput = new _e.Signal(this), this._iopubMessage = new _e.Signal(this), this._unhandledMessage = new _e.Signal(this), this._anyMessage = new _e.Signal(this), this._propertyChanged = new _e.Signal(this), this._id = Kn.model.id, this._name = Kn.model.name, this._path = Kn.model.path, this._type = Kn.model.type, this._username = (er = Kn.username) !== null && er !== void 0 ? er : "", this._clientId = (Cr = Kn.clientId) !== null && Cr !== void 0 ? Cr : $n.UUID.uuid4(), this._connectToKernel = Kn.connectToKernel, this._kernelConnectionOptions = (kr = Kn.kernelConnectionOptions) !== null && kr !== void 0 ? kr : {}, this.serverSettings = (Yr = Kn.serverSettings) !== null && Yr !== void 0 ? Yr : Qt.ServerConnection.makeSettings(), this.setupKernel(Kn.model.kernel);
    }
    /**
     * A signal emitted when the session is disposed.
     */
    get disposed() {
      return this._disposed;
    }
    /**
     * A signal emitted when the kernel changes.
     */
    get kernelChanged() {
      return this._kernelChanged;
    }
    /**
     * A signal proxied from the connection about the kernel status.
     */
    get statusChanged() {
      return this._statusChanged;
    }
    /**
     * A signal proxied from the kernel about the connection status.
     */
    get connectionStatusChanged() {
      return this._connectionStatusChanged;
    }
    /**
     * A signal proxied from the kernel pending input.
     */
    get pendingInput() {
      return this._pendingInput;
    }
    /**
     * A signal proxied from the kernel about iopub kernel messages.
     */
    get iopubMessage() {
      return this._iopubMessage;
    }
    /**
     * A signal proxied from the kernel for an unhandled kernel message.
     */
    get unhandledMessage() {
      return this._unhandledMessage;
    }
    /**
     * A signal proxied from the kernel emitted for any kernel message.
     *
     * #### Notes
     * The behavior is undefined if the message is modified during message
     * handling. As such, it should be treated as read-only.
     */
    get anyMessage() {
      return this._anyMessage;
    }
    /**
     * A signal emitted when a session property changes.
     */
    get propertyChanged() {
      return this._propertyChanged;
    }
    /**
     * Get the session id.
     */
    get id() {
      return this._id;
    }
    /**
     * Get the session kernel connection object.
     *
     * #### Notes
     * This is a read-only property, and can be altered by [changeKernel].
     */
    get kernel() {
      return this._kernel;
    }
    /**
     * Get the session path.
     */
    get path() {
      return this._path;
    }
    /**
     * Get the session type.
     */
    get type() {
      return this._type;
    }
    /**
     * Get the session name.
     */
    get name() {
      return this._name;
    }
    /**
     * Get the model associated with the session.
     */
    get model() {
      return {
        id: this.id,
        kernel: this.kernel && { id: this.kernel.id, name: this.kernel.name },
        path: this._path,
        type: this._type,
        name: this._name
      };
    }
    /**
     * Test whether the session has been disposed.
     */
    get isDisposed() {
      return this._isDisposed;
    }
    /**
     * Update the session based on a session model from the server.
     *
     * #### Notes
     * This only updates this session connection instance. Use `setPath`,
     * `setName`, `setType`, and `changeKernel` to change the session values on
     * the server.
     */
    update(Kn) {
      const er = this.model;
      if (this._path = Kn.path, this._name = Kn.name, this._type = Kn.type, this._kernel === null && Kn.kernel !== null || this._kernel !== null && Kn.kernel === null || this._kernel !== null && Kn.kernel !== null && this._kernel.id !== Kn.kernel.id) {
        this._kernel !== null && this._kernel.dispose();
        const Cr = this._kernel || null;
        this.setupKernel(Kn.kernel);
        const kr = this._kernel || null;
        this._kernelChanged.emit({ name: "kernel", oldValue: Cr, newValue: kr });
      }
      this._handleModelChange(er);
    }
    /**
     * Dispose of the resources held by the session.
     */
    dispose() {
      if (!this.isDisposed) {
        if (this._isDisposed = !0, this._disposed.emit(), this._kernel) {
          this._kernel.dispose();
          const Kn = this._kernel;
          this._kernel = null;
          const er = this._kernel;
          this._kernelChanged.emit({ name: "kernel", oldValue: Kn, newValue: er });
        }
        _e.Signal.clearData(this);
      }
    }
    /**
     * Change the session path.
     *
     * @param path - The new session path.
     *
     * @returns A promise that resolves when the session has renamed.
     *
     * #### Notes
     * This uses the Jupyter REST API, and the response is validated.
     * The promise is fulfilled on a valid response and rejected otherwise.
     */
    async setPath(Kn) {
      if (this.isDisposed)
        throw new Error("Session is disposed");
      await this._patch({ path: Kn });
    }
    /**
     * Change the session name.
     */
    async setName(Kn) {
      if (this.isDisposed)
        throw new Error("Session is disposed");
      await this._patch({ name: Kn });
    }
    /**
     * Change the session type.
     */
    async setType(Kn) {
      if (this.isDisposed)
        throw new Error("Session is disposed");
      await this._patch({ type: Kn });
    }
    /**
     * Change the kernel.
     *
     * @param options - The name or id of the new kernel.
     *
     * #### Notes
     * This shuts down the existing kernel and creates a new kernel,
     * keeping the existing session ID and session path.
     */
    async changeKernel(Kn) {
      if (this.isDisposed)
        throw new Error("Session is disposed");
      return await this._patch({ kernel: Kn }), this.kernel;
    }
    /**
     * Kill the kernel and shutdown the session.
     *
     * @returns - The promise fulfilled on a valid response from the server.
     *
     * #### Notes
     * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/sessions), and validates the response.
     * Disposes of the session and emits a [sessionDied] signal on success.
     */
    async shutdown() {
      if (this.isDisposed)
        throw new Error("Session is disposed");
      await (0, Zt.shutdownSession)(this.id, this.serverSettings), this.dispose();
    }
    /**
     * Create a new kernel connection and connect to its signals.
     *
     * #### Notes
     * This method is not meant to be subclassed.
     */
    setupKernel(Kn) {
      if (Kn === null) {
        this._kernel = null;
        return;
      }
      const er = this._connectToKernel({
        ...this._kernelConnectionOptions,
        model: Kn,
        username: this._username,
        clientId: this._clientId,
        serverSettings: this.serverSettings
      });
      this._kernel = er, er.statusChanged.connect(this.onKernelStatus, this), er.connectionStatusChanged.connect(this.onKernelConnectionStatus, this), er.pendingInput.connect(this.onPendingInput, this), er.unhandledMessage.connect(this.onUnhandledMessage, this), er.iopubMessage.connect(this.onIOPubMessage, this), er.anyMessage.connect(this.onAnyMessage, this);
    }
    /**
     * Handle to changes in the Kernel status.
     */
    onKernelStatus(Kn, er) {
      this._statusChanged.emit(er);
    }
    /**
     * Handle to changes in the Kernel status.
     */
    onKernelConnectionStatus(Kn, er) {
      this._connectionStatusChanged.emit(er);
    }
    /**
     * Handle a change in the pendingInput.
     */
    onPendingInput(Kn, er) {
      this._pendingInput.emit(er);
    }
    /**
     * Handle iopub kernel messages.
     */
    onIOPubMessage(Kn, er) {
      this._iopubMessage.emit(er);
    }
    /**
     * Handle unhandled kernel messages.
     */
    onUnhandledMessage(Kn, er) {
      this._unhandledMessage.emit(er);
    }
    /**
     * Handle any kernel messages.
     */
    onAnyMessage(Kn, er) {
      this._anyMessage.emit(er);
    }
    /**
     * Send a PATCH to the server, updating the session path or the kernel.
     */
    async _patch(Kn) {
      const er = await (0, Zt.updateSession)({ ...Kn, id: this._id }, this.serverSettings);
      return this.update(er), er;
    }
    /**
     * Handle a change to the model.
     */
    _handleModelChange(Kn) {
      Kn.name !== this._name && this._propertyChanged.emit("name"), Kn.type !== this._type && this._propertyChanged.emit("type"), Kn.path !== this._path && this._propertyChanged.emit("path");
    }
  }
  return _default$1.SessionConnection = Sn, _default$1;
}
var hasRequiredManager$2;
function requireManager$2() {
  return hasRequiredManager$2 || (hasRequiredManager$2 = 1, function(_e) {
    Object.defineProperty(_e, "__esModule", { value: !0 }), _e.SessionManager = void 0;
    const Qt = require$$2, Zt = require$$0$1, $n = serverconnection, Sn = basemanager, kn = require_default$1(), Kn = restapi$1;
    class er extends Sn.BaseManager {
      /**
       * Construct a new session manager.
       *
       * @param options - The default options for each session.
       */
      constructor(kr) {
        var Yr;
        super(kr), this._isReady = !1, this._sessionConnections = /* @__PURE__ */ new Set(), this._models = /* @__PURE__ */ new Map(), this._runningChanged = new Zt.Signal(this), this._connectionFailure = new Zt.Signal(this), this._connectToKernel = (Ms) => this._kernelManager.connectTo(Ms), this._kernelManager = kr.kernelManager, this._pollModels = new Qt.Poll({
          auto: !1,
          factory: () => this.requestRunning(),
          frequency: {
            interval: 10 * 1e3,
            backoff: !0,
            max: 300 * 1e3
          },
          name: "@jupyterlab/services:SessionManager#models",
          standby: (Yr = kr.standby) !== null && Yr !== void 0 ? Yr : "when-hidden"
        }), this._ready = (async () => {
          await this._pollModels.start(), await this._pollModels.tick, this._kernelManager.isActive && await this._kernelManager.ready, this._isReady = !0;
        })();
      }
      /**
       * Test whether the manager is ready.
       */
      get isReady() {
        return this._isReady;
      }
      /**
       * A promise that fulfills when the manager is ready.
       */
      get ready() {
        return this._ready;
      }
      /**
       * A signal emitted when the running sessions change.
       */
      get runningChanged() {
        return this._runningChanged;
      }
      /**
       * A signal emitted when there is a connection failure.
       */
      get connectionFailure() {
        return this._connectionFailure;
      }
      /**
       * Dispose of the resources used by the manager.
       */
      dispose() {
        this.isDisposed || (this._models.clear(), this._sessionConnections.forEach((kr) => kr.dispose()), this._pollModels.dispose(), super.dispose());
      }
      /*
       * Connect to a running session.  See also [[connectToSession]].
       */
      connectTo(kr) {
        const Yr = new kn.SessionConnection({
          ...kr,
          connectToKernel: this._connectToKernel,
          serverSettings: this.serverSettings
        });
        return this._onStarted(Yr), this._models.has(kr.model.id) || this.refreshRunning().catch(() => {
        }), Yr;
      }
      /**
       * Create an iterator over the most recent running sessions.
       *
       * @returns A new iterator over the running sessions.
       */
      running() {
        return this._models.values();
      }
      /**
       * Force a refresh of the running sessions.
       *
       * @returns A promise that with the list of running sessions.
       *
       * #### Notes
       * This is not typically meant to be called by the user, since the
       * manager maintains its own internal state.
       */
      async refreshRunning() {
        await this._pollModels.refresh(), await this._pollModels.tick;
      }
      /**
       * Start a new session.  See also [[startNewSession]].
       *
       * @param createOptions - Options for creating the session
       *
       * @param connectOptions - Options for connecting to the session
       */
      async startNew(kr, Yr = {}) {
        const Ms = await (0, Kn.startSession)(kr, this.serverSettings);
        return await this.refreshRunning(), this.connectTo({ ...Yr, model: Ms });
      }
      /**
       * Shut down a session by id.
       */
      async shutdown(kr) {
        await (0, Kn.shutdownSession)(kr, this.serverSettings), await this.refreshRunning();
      }
      /**
       * Shut down all sessions.
       *
       * @returns A promise that resolves when all of the kernels are shut down.
       */
      async shutdownAll() {
        await this.refreshRunning(), await Promise.all([...this._models.keys()].map((kr) => (0, Kn.shutdownSession)(kr, this.serverSettings))), await this.refreshRunning();
      }
      /**
       * Find a session associated with a path and stop it if it is the only session
       * using that kernel.
       *
       * @param path - The path in question.
       *
       * @returns A promise that resolves when the relevant sessions are stopped.
       */
      async stopIfNeeded(kr) {
        try {
          const Ms = (await (0, Kn.listRunning)(this.serverSettings)).filter((Ds) => Ds.path === kr);
          if (Ms.length === 1) {
            const Ds = Ms[0].id;
            await this.shutdown(Ds);
          }
        } catch {
        }
      }
      /**
       * Find a session by id.
       */
      async findById(kr) {
        return this._models.has(kr) ? this._models.get(kr) : (await this.refreshRunning(), this._models.get(kr));
      }
      /**
       * Find a session by path.
       */
      async findByPath(kr) {
        for (const Yr of this._models.values())
          if (Yr.path === kr)
            return Yr;
        await this.refreshRunning();
        for (const Yr of this._models.values())
          if (Yr.path === kr)
            return Yr;
      }
      /**
       * Execute a request to the server to poll running kernels and update state.
       */
      async requestRunning() {
        var kr, Yr;
        let Ms;
        try {
          Ms = await (0, Kn.listRunning)(this.serverSettings);
        } catch (Ds) {
          throw (Ds instanceof $n.ServerConnection.NetworkError || ((kr = Ds.response) === null || kr === void 0 ? void 0 : kr.status) === 503 || ((Yr = Ds.response) === null || Yr === void 0 ? void 0 : Yr.status) === 424) && this._connectionFailure.emit(Ds), Ds;
        }
        this.isDisposed || this._models.size === Ms.length && Ms.every((Ds) => {
          var Ls, js, zs, Fs;
          const Bs = this._models.get(Ds.id);
          return Bs ? ((Ls = Bs.kernel) === null || Ls === void 0 ? void 0 : Ls.id) === ((js = Ds.kernel) === null || js === void 0 ? void 0 : js.id) && ((zs = Bs.kernel) === null || zs === void 0 ? void 0 : zs.name) === ((Fs = Ds.kernel) === null || Fs === void 0 ? void 0 : Fs.name) && Bs.name === Ds.name && Bs.path === Ds.path && Bs.type === Ds.type : !1;
        }) || (this._models = new Map(Ms.map((Ds) => [Ds.id, Ds])), this._sessionConnections.forEach((Ds) => {
          this._models.has(Ds.id) ? Ds.update(this._models.get(Ds.id)) : Ds.dispose();
        }), this._runningChanged.emit(Ms));
      }
      /**
       * Handle a session starting.
       */
      _onStarted(kr) {
        this._sessionConnections.add(kr), kr.disposed.connect(this._onDisposed, this), kr.propertyChanged.connect(this._onChanged, this), kr.kernelChanged.connect(this._onChanged, this);
      }
      _onDisposed(kr) {
        this._sessionConnections.delete(kr), this.refreshRunning().catch(() => {
        });
      }
      _onChanged() {
        this.refreshRunning().catch(() => {
        });
      }
    }
    _e.SessionManager = er, function(Cr) {
      class kr extends Cr {
        constructor() {
          super(...arguments), this._readyPromise = new Promise(() => {
          });
        }
        /**
         * Whether the manager is active.
         */
        get isActive() {
          return !1;
        }
        /**
         * Used for testing.
         */
        get parentReady() {
          return super.ready;
        }
        /**
         * Start a new session - throw an error since it is not supported.
         */
        async startNew(Ms, Ds = {}) {
          return Promise.reject(new Error("Not implemented in no-op Session Manager"));
        }
        /*
         * Connect to a running session - throw an error since it is not supported.
         */
        connectTo(Ms) {
          throw Error("Not implemented in no-op Session Manager");
        }
        /**
         * A promise that fulfills when the manager is ready (never).
         */
        get ready() {
          return this.parentReady.then(() => this._readyPromise);
        }
        /**
         * Shut down a session by id - throw an error since it is not supported.
         */
        async shutdown(Ms) {
          return Promise.reject(new Error("Not implemented in no-op Session Manager"));
        }
        /**
         * Execute a request to the server to poll running sessions and update state.
         */
        async requestRunning() {
          return Promise.resolve();
        }
      }
      Cr.NoopManager = kr;
    }(er = _e.SessionManager || (_e.SessionManager = {}));
  }(manager$1)), manager$1;
}
var hasRequiredSession;
function requireSession() {
  return hasRequiredSession || (hasRequiredSession = 1, function(_e) {
    var Qt = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(er, Cr, kr, Yr) {
      Yr === void 0 && (Yr = kr);
      var Ms = Object.getOwnPropertyDescriptor(Cr, kr);
      (!Ms || ("get" in Ms ? !Cr.__esModule : Ms.writable || Ms.configurable)) && (Ms = { enumerable: !0, get: function() {
        return Cr[kr];
      } }), Object.defineProperty(er, Yr, Ms);
    } : function(er, Cr, kr, Yr) {
      Yr === void 0 && (Yr = kr), er[Yr] = Cr[kr];
    }), Zt = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(er, Cr) {
      Object.defineProperty(er, "default", { enumerable: !0, value: Cr });
    } : function(er, Cr) {
      er.default = Cr;
    }), $n = commonjsGlobal && commonjsGlobal.__importStar || function(er) {
      if (er && er.__esModule)
        return er;
      var Cr = {};
      if (er != null)
        for (var kr in er)
          kr !== "default" && Object.prototype.hasOwnProperty.call(er, kr) && Qt(Cr, er, kr);
      return Zt(Cr, er), Cr;
    }, Sn = commonjsGlobal && commonjsGlobal.__exportStar || function(er, Cr) {
      for (var kr in er)
        kr !== "default" && !Object.prototype.hasOwnProperty.call(Cr, kr) && Qt(Cr, er, kr);
    };
    Object.defineProperty(_e, "__esModule", { value: !0 }), _e.SessionAPI = _e.Session = void 0;
    const kn = $n(session);
    _e.Session = kn;
    const Kn = $n(restapi$1);
    _e.SessionAPI = Kn, Sn(requireManager$2(), _e);
  }(session$1)), session$1;
}
var setting = {};
Object.defineProperty(setting, "__esModule", { value: !0 });
setting.SettingManager = void 0;
const coreutils_1$2 = lib$3, statedb_1$1 = lib$1, serverconnection_1$2 = serverconnection, SERVICE_SETTINGS_URL = "api/settings";
class SettingManager extends statedb_1$1.DataConnector {
  /**
   * Create a new setting manager.
   */
  constructor(Qt = {}) {
    var Zt;
    super(), this.serverSettings = (Zt = Qt.serverSettings) !== null && Zt !== void 0 ? Zt : serverconnection_1$2.ServerConnection.makeSettings();
  }
  /**
   * Fetch a plugin's settings.
   *
   * @param id - The plugin's ID.
   *
   * @returns A promise that resolves if successful.
   */
  async fetch(Qt) {
    if (!Qt)
      throw new Error("Plugin `id` parameter is required for settings fetch.");
    const { serverSettings: Zt } = this, { baseUrl: $n, appUrl: Sn } = Zt, { makeRequest: kn, ResponseError: Kn } = serverconnection_1$2.ServerConnection, er = $n + Sn, Cr = Private$8.url(er, Qt), kr = await kn(Cr, {}, Zt);
    if (kr.status !== 200)
      throw await Kn.create(kr);
    return kr.json();
  }
  /**
   * Fetch the list of all plugin setting bundles.
   *
   * @returns A promise that resolves if successful.
   */
  async list(Qt) {
    var Zt, $n, Sn, kn;
    const { serverSettings: Kn } = this, { baseUrl: er, appUrl: Cr } = Kn, { makeRequest: kr, ResponseError: Yr } = serverconnection_1$2.ServerConnection, Ms = er + Cr, Ds = Private$8.url(Ms, "", Qt === "ids"), Ls = await kr(Ds, {}, Kn);
    if (Ls.status !== 200)
      throw new Yr(Ls);
    const js = await Ls.json(), zs = ($n = (Zt = js == null ? void 0 : js.settings) === null || Zt === void 0 ? void 0 : Zt.map((Bs) => Bs.id)) !== null && $n !== void 0 ? $n : [];
    let Fs = [];
    return Qt || (Fs = (kn = (Sn = js == null ? void 0 : js.settings) === null || Sn === void 0 ? void 0 : Sn.map((Bs) => (Bs.data = { composite: {}, user: {} }, Bs))) !== null && kn !== void 0 ? kn : []), { ids: zs, values: Fs };
  }
  /**
   * Save a plugin's settings.
   *
   * @param id - The plugin's ID.
   *
   * @param raw - The user setting values as a raw string of JSON with comments.
   *
   * @returns A promise that resolves if successful.
   */
  async save(Qt, Zt) {
    const { serverSettings: $n } = this, { baseUrl: Sn, appUrl: kn } = $n, { makeRequest: Kn, ResponseError: er } = serverconnection_1$2.ServerConnection, Cr = Sn + kn, kr = Private$8.url(Cr, Qt), Yr = { body: JSON.stringify({ raw: Zt }), method: "PUT" }, Ms = await Kn(kr, Yr, $n);
    if (Ms.status !== 204)
      throw new er(Ms);
  }
}
setting.SettingManager = SettingManager;
var Private$8;
(function(_e) {
  function Qt(Zt, $n, Sn) {
    const kn = Sn ? coreutils_1$2.URLExt.objectToQueryString({ ids_only: !0 }) : "";
    return `${coreutils_1$2.URLExt.join(Zt, SERVICE_SETTINGS_URL, $n)}${kn}`;
  }
  _e.url = Qt;
})(Private$8 || (Private$8 = {}));
var terminal$1 = {}, terminal = {}, restapi = {};
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.shutdownTerminal = _e.listRunning = _e.startNew = _e.isAvailable = _e.TERMINAL_SERVICE_URL = void 0;
  const Qt = lib$3, Zt = serverconnection;
  _e.TERMINAL_SERVICE_URL = "api/terminals";
  function $n() {
    return String(Qt.PageConfig.getOption("terminalsAvailable")).toLowerCase() === "true";
  }
  _e.isAvailable = $n;
  async function Sn(Cr = Zt.ServerConnection.makeSettings(), kr, Yr) {
    er.errorIfNotAvailable();
    const Ms = Qt.URLExt.join(Cr.baseUrl, _e.TERMINAL_SERVICE_URL), Ds = {
      method: "POST",
      body: JSON.stringify({ name: kr, cwd: Yr })
    }, Ls = await Zt.ServerConnection.makeRequest(Ms, Ds, Cr);
    if (Ls.status !== 200)
      throw await Zt.ServerConnection.ResponseError.create(Ls);
    return await Ls.json();
  }
  _e.startNew = Sn;
  async function kn(Cr = Zt.ServerConnection.makeSettings()) {
    er.errorIfNotAvailable();
    const kr = Qt.URLExt.join(Cr.baseUrl, _e.TERMINAL_SERVICE_URL), Yr = await Zt.ServerConnection.makeRequest(kr, {}, Cr);
    if (Yr.status !== 200)
      throw await Zt.ServerConnection.ResponseError.create(Yr);
    const Ms = await Yr.json();
    if (!Array.isArray(Ms))
      throw new Error("Invalid terminal list");
    return Ms;
  }
  _e.listRunning = kn;
  async function Kn(Cr, kr = Zt.ServerConnection.makeSettings()) {
    var Yr;
    er.errorIfNotAvailable();
    const Ms = Qt.URLExt.join(kr.baseUrl, _e.TERMINAL_SERVICE_URL, Cr), Ds = { method: "DELETE" }, Ls = await Zt.ServerConnection.makeRequest(Ms, Ds, kr);
    if (Ls.status === 404) {
      const zs = (Yr = (await Ls.json()).message) !== null && Yr !== void 0 ? Yr : `The terminal session "${Cr}"" does not exist on the server`;
      console.warn(zs);
    } else if (Ls.status !== 204)
      throw await Zt.ServerConnection.ResponseError.create(Ls);
  }
  _e.shutdownTerminal = Kn;
  var er;
  (function(Cr) {
    function kr() {
      if (!$n())
        throw new Error("Terminals Unavailable");
    }
    Cr.errorIfNotAvailable = kr;
  })(er || (er = {}));
})(restapi);
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 }), _e.isAvailable = void 0;
  const Qt = restapi;
  Object.defineProperty(_e, "isAvailable", { enumerable: !0, get: function() {
    return Qt.isAvailable;
  } });
})(terminal);
var manager = {}, _default = {}, hasRequired_default;
function require_default() {
  if (hasRequired_default)
    return _default;
  hasRequired_default = 1, Object.defineProperty(_default, "__esModule", { value: !0 }), _default.TerminalConnection = void 0;
  const _e = lib$3, Qt = require$$1$2, Zt = require$$0$1, $n = requireLib(), Sn = restapi;
  class kn {
    /**
     * Construct a new terminal session.
     */
    constructor(Cr) {
      var kr;
      this._createSocket = () => {
        this._errorIfDisposed(), this._clearSocket(), this._updateConnectionStatus("connecting");
        const Yr = this._name, Ms = this.serverSettings;
        let Ds = _e.URLExt.join(Ms.wsUrl, "terminals", "websocket", encodeURIComponent(Yr));
        const Ls = Ms.token;
        Ms.appendToken && Ls !== "" && (Ds = Ds + `?token=${encodeURIComponent(Ls)}`), this._ws = new Ms.WebSocket(Ds), this._ws.onmessage = this._onWSMessage, this._ws.onclose = this._onWSClose, this._ws.onerror = this._onWSClose;
      }, this._onWSMessage = (Yr) => {
        if (this._isDisposed)
          return;
        const Ms = JSON.parse(Yr.data);
        if (Ms[0] === "disconnect" && this.dispose(), this._connectionStatus === "connecting") {
          Ms[0] === "setup" && this._updateConnectionStatus("connected");
          return;
        }
        this._messageReceived.emit({
          type: Ms[0],
          content: Ms.slice(1)
        });
      }, this._onWSClose = (Yr) => {
        console.warn(`Terminal websocket closed: ${Yr.code}`), this.isDisposed || this._reconnect();
      }, this._connectionStatus = "connecting", this._connectionStatusChanged = new Zt.Signal(this), this._isDisposed = !1, this._disposed = new Zt.Signal(this), this._messageReceived = new Zt.Signal(this), this._reconnectTimeout = null, this._ws = null, this._noOp = () => {
      }, this._reconnectLimit = 7, this._reconnectAttempt = 0, this._pendingMessages = [], this._name = Cr.model.name, this.serverSettings = (kr = Cr.serverSettings) !== null && kr !== void 0 ? kr : $n.ServerConnection.makeSettings(), this._createSocket();
    }
    /**
     * A signal emitted when the session is disposed.
     */
    get disposed() {
      return this._disposed;
    }
    /**
     * A signal emitted when a message is received from the server.
     */
    get messageReceived() {
      return this._messageReceived;
    }
    /**
     * Get the name of the terminal session.
     */
    get name() {
      return this._name;
    }
    /**
     * Get the model for the terminal session.
     */
    get model() {
      return { name: this._name };
    }
    /**
     * Test whether the session is disposed.
     */
    get isDisposed() {
      return this._isDisposed;
    }
    /**
     * Dispose of the resources held by the session.
     */
    dispose() {
      this._isDisposed || (this._isDisposed = !0, this._disposed.emit(), this._updateConnectionStatus("disconnected"), this._clearSocket(), Zt.Signal.clearData(this));
    }
    /**
     * Send a message to the terminal session.
     *
     * #### Notes
     * If the connection is down, the message will be queued for sending when
     * the connection comes back up.
     */
    send(Cr) {
      this._sendMessage(Cr);
    }
    /**
     * Send a message on the websocket, or possibly queue for later sending.
     *
     * @param queue - whether to queue the message if it cannot be sent
     */
    _sendMessage(Cr, kr = !0) {
      if (!(this._isDisposed || !Cr.content))
        if (this.connectionStatus === "connected" && this._ws) {
          const Yr = [Cr.type, ...Cr.content];
          this._ws.send(JSON.stringify(Yr));
        } else if (kr)
          this._pendingMessages.push(Cr);
        else
          throw new Error(`Could not send message: ${JSON.stringify(Cr)}`);
    }
    /**
     * Send pending messages to the kernel.
     */
    _sendPending() {
      for (; this.connectionStatus === "connected" && this._pendingMessages.length > 0; )
        this._sendMessage(this._pendingMessages[0], !1), this._pendingMessages.shift();
    }
    /**
     * Reconnect to a terminal.
     *
     * #### Notes
     * This may try multiple times to reconnect to a terminal, and will sever
     * any existing connection.
     */
    reconnect() {
      this._errorIfDisposed();
      const Cr = new Qt.PromiseDelegate(), kr = (Yr, Ms) => {
        Ms === "connected" ? (Cr.resolve(), this.connectionStatusChanged.disconnect(kr, this)) : Ms === "disconnected" && (Cr.reject(new Error("Terminal connection disconnected")), this.connectionStatusChanged.disconnect(kr, this));
      };
      return this.connectionStatusChanged.connect(kr, this), this._reconnectAttempt = 0, this._reconnect(), Cr.promise;
    }
    /**
     * Attempt a connection if we have not exhausted connection attempts.
     */
    _reconnect() {
      if (this._errorIfDisposed(), clearTimeout(this._reconnectTimeout), this._reconnectAttempt < this._reconnectLimit) {
        this._updateConnectionStatus("connecting");
        const Cr = Kn.getRandomIntInclusive(0, 1e3 * (Math.pow(2, this._reconnectAttempt) - 1));
        console.error(`Connection lost, reconnecting in ${Math.floor(Cr / 1e3)} seconds.`), this._reconnectTimeout = setTimeout(this._createSocket, Cr), this._reconnectAttempt += 1;
      } else
        this._updateConnectionStatus("disconnected");
      this._clearSocket();
    }
    /**
     * Forcefully clear the socket state.
     *
     * #### Notes
     * This will clear all socket state without calling any handlers and will
     * not update the connection status. If you call this method, you are
     * responsible for updating the connection status as needed and recreating
     * the socket if you plan to reconnect.
     */
    _clearSocket() {
      this._ws !== null && (this._ws.onopen = this._noOp, this._ws.onclose = this._noOp, this._ws.onerror = this._noOp, this._ws.onmessage = this._noOp, this._ws.close(), this._ws = null);
    }
    /**
     * Shut down the terminal session.
     */
    async shutdown() {
      await (0, Sn.shutdownTerminal)(this.name, this.serverSettings), this.dispose();
    }
    /**
     * Clone the current terminal connection.
     */
    clone() {
      return new kn(this);
    }
    /**
     * Handle connection status changes.
     */
    _updateConnectionStatus(Cr) {
      this._connectionStatus !== Cr && (this._connectionStatus = Cr, Cr !== "connecting" && (this._reconnectAttempt = 0, clearTimeout(this._reconnectTimeout)), Cr === "connected" && this._sendPending(), this._connectionStatusChanged.emit(Cr));
    }
    /**
     * Utility function to throw an error if this instance is disposed.
     */
    _errorIfDisposed() {
      if (this.isDisposed)
        throw new Error("Terminal connection is disposed");
    }
    /**
     * A signal emitted when the terminal connection status changes.
     */
    get connectionStatusChanged() {
      return this._connectionStatusChanged;
    }
    /**
     * The current connection status of the terminal connection.
     */
    get connectionStatus() {
      return this._connectionStatus;
    }
  }
  _default.TerminalConnection = kn;
  var Kn;
  return function(er) {
    function Cr(Yr, Ms) {
      return _e.URLExt.join(Yr, Sn.TERMINAL_SERVICE_URL, encodeURIComponent(Ms));
    }
    er.getTermUrl = Cr;
    function kr(Yr, Ms) {
      return Yr = Math.ceil(Yr), Ms = Math.floor(Ms), Math.floor(Math.random() * (Ms - Yr + 1)) + Yr;
    }
    er.getRandomIntInclusive = kr;
  }(Kn || (Kn = {})), _default;
}
var hasRequiredManager$1;
function requireManager$1() {
  return hasRequiredManager$1 || (hasRequiredManager$1 = 1, function(_e) {
    Object.defineProperty(_e, "__esModule", { value: !0 }), _e.TerminalManager = void 0;
    const Qt = require$$2, Zt = require$$0$1, $n = requireLib(), Sn = basemanager, kn = restapi, Kn = require_default();
    class er extends Sn.BaseManager {
      /**
       * Construct a new terminal manager.
       */
      constructor(kr = {}) {
        var Yr;
        if (super(kr), this._isReady = !1, this._names = [], this._terminalConnections = /* @__PURE__ */ new Set(), this._runningChanged = new Zt.Signal(this), this._connectionFailure = new Zt.Signal(this), !this.isAvailable()) {
          this._ready = Promise.reject("Terminals unavailable"), this._ready.catch((Ms) => {
          });
          return;
        }
        this._pollModels = new Qt.Poll({
          auto: !1,
          factory: () => this.requestRunning(),
          frequency: {
            interval: 10 * 1e3,
            backoff: !0,
            max: 300 * 1e3
          },
          name: "@jupyterlab/services:TerminalManager#models",
          standby: (Yr = kr.standby) !== null && Yr !== void 0 ? Yr : "when-hidden"
        }), this._ready = (async () => {
          await this._pollModels.start(), await this._pollModels.tick, this._isReady = !0;
        })();
      }
      /**
       * Test whether the manager is ready.
       */
      get isReady() {
        return this._isReady;
      }
      /**
       * A promise that fulfills when the manager is ready.
       */
      get ready() {
        return this._ready;
      }
      /**
       * A signal emitted when the running terminals change.
       */
      get runningChanged() {
        return this._runningChanged;
      }
      /**
       * A signal emitted when there is a connection failure.
       */
      get connectionFailure() {
        return this._connectionFailure;
      }
      /**
       * Dispose of the resources used by the manager.
       */
      dispose() {
        this.isDisposed || (this._names.length = 0, this._terminalConnections.forEach((kr) => kr.dispose()), this._pollModels.dispose(), super.dispose());
      }
      /**
       * Whether the terminal service is available.
       */
      isAvailable() {
        return (0, kn.isAvailable)();
      }
      /*
       * Connect to a running terminal.
       *
       * @param options - The options used to connect to the terminal.
       *
       * @returns The new terminal connection instance.
       *
       * #### Notes
       * The manager `serverSettings` will be used.
       */
      connectTo(kr) {
        const Yr = new Kn.TerminalConnection({
          ...kr,
          serverSettings: this.serverSettings
        });
        return this._onStarted(Yr), this._names.includes(kr.model.name) || this.refreshRunning().catch(() => {
        }), Yr;
      }
      /**
       * Create an iterator over the most recent running terminals.
       *
       * @returns A new iterator over the running terminals.
       */
      running() {
        return this._models[Symbol.iterator]();
      }
      /**
       * Force a refresh of the running terminals.
       *
       * @returns A promise that with the list of running terminals.
       *
       * #### Notes
       * This is intended to be called only in response to a user action,
       * since the manager maintains its internal state.
       */
      async refreshRunning() {
        await this._pollModels.refresh(), await this._pollModels.tick;
      }
      /**
       * Create a new terminal session.
       *
       * @param options - The options used to create the terminal.
       *
       * @returns A promise that resolves with the terminal connection instance.
       *
       * #### Notes
       * The manager `serverSettings` will be used unless overridden in the
       * options.
       */
      async startNew(kr) {
        const Yr = await (0, kn.startNew)(this.serverSettings, kr == null ? void 0 : kr.name, kr == null ? void 0 : kr.cwd);
        return await this.refreshRunning(), this.connectTo({ model: Yr });
      }
      /**
       * Shut down a terminal session by name.
       */
      async shutdown(kr) {
        await (0, kn.shutdownTerminal)(kr, this.serverSettings), await this.refreshRunning();
      }
      /**
       * Shut down all terminal sessions.
       *
       * @returns A promise that resolves when all of the sessions are shut down.
       */
      async shutdownAll() {
        await this.refreshRunning(), await Promise.all(this._names.map((kr) => (0, kn.shutdownTerminal)(kr, this.serverSettings))), await this.refreshRunning();
      }
      /**
       * Execute a request to the server to poll running terminals and update state.
       */
      async requestRunning() {
        var kr, Yr;
        let Ms;
        try {
          Ms = await (0, kn.listRunning)(this.serverSettings);
        } catch (Ls) {
          throw (Ls instanceof $n.ServerConnection.NetworkError || ((kr = Ls.response) === null || kr === void 0 ? void 0 : kr.status) === 503 || ((Yr = Ls.response) === null || Yr === void 0 ? void 0 : Yr.status) === 424) && this._connectionFailure.emit(Ls), Ls;
        }
        if (this.isDisposed)
          return;
        const Ds = Ms.map(({ name: Ls }) => Ls).sort();
        Ds !== this._names && (this._names = Ds, this._terminalConnections.forEach((Ls) => {
          Ds.includes(Ls.name) || Ls.dispose();
        }), this._runningChanged.emit(this._models));
      }
      /**
       * Handle a session starting.
       */
      _onStarted(kr) {
        this._terminalConnections.add(kr), kr.disposed.connect(this._onDisposed, this);
      }
      /**
       * Handle a session terminating.
       */
      _onDisposed(kr) {
        this._terminalConnections.delete(kr), this.refreshRunning().catch(() => {
        });
      }
      get _models() {
        return this._names.map((kr) => ({ name: kr }));
      }
    }
    _e.TerminalManager = er, function(Cr) {
      class kr extends Cr {
        constructor() {
          super(...arguments), this._readyPromise = new Promise(() => {
          });
        }
        /**
         * Whether the manager is active.
         */
        get isActive() {
          return !1;
        }
        /**
         * Used for testing.
         */
        get parentReady() {
          return super.ready;
        }
        /**
         * A promise that fulfills when the manager is ready (never).
         */
        get ready() {
          return this.parentReady.then(() => this._readyPromise);
        }
        /**
         * Create a new terminal session - throw an error since it is not supported.
         *
         */
        async startNew(Ms) {
          return Promise.reject(new Error("Not implemented in no-op Terminal Manager"));
        }
        /*
         * Connect to a running terminal - throw an error since it is not supported.
         */
        connectTo(Ms) {
          throw Error("Not implemented in no-op Terminal Manager");
        }
        /**
         * Shut down a session by id - throw an error since it is not supported.
         */
        async shutdown(Ms) {
          return Promise.reject(new Error("Not implemented in no-op Terminal Manager"));
        }
        /**
         * Execute a request to the server to poll running sessions and update state.
         */
        async requestRunning() {
          return Promise.resolve();
        }
      }
      Cr.NoopManager = kr;
    }(er = _e.TerminalManager || (_e.TerminalManager = {}));
  }(manager)), manager;
}
var hasRequiredTerminal;
function requireTerminal() {
  return hasRequiredTerminal || (hasRequiredTerminal = 1, function(_e) {
    var Qt = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(er, Cr, kr, Yr) {
      Yr === void 0 && (Yr = kr);
      var Ms = Object.getOwnPropertyDescriptor(Cr, kr);
      (!Ms || ("get" in Ms ? !Cr.__esModule : Ms.writable || Ms.configurable)) && (Ms = { enumerable: !0, get: function() {
        return Cr[kr];
      } }), Object.defineProperty(er, Yr, Ms);
    } : function(er, Cr, kr, Yr) {
      Yr === void 0 && (Yr = kr), er[Yr] = Cr[kr];
    }), Zt = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(er, Cr) {
      Object.defineProperty(er, "default", { enumerable: !0, value: Cr });
    } : function(er, Cr) {
      er.default = Cr;
    }), $n = commonjsGlobal && commonjsGlobal.__importStar || function(er) {
      if (er && er.__esModule)
        return er;
      var Cr = {};
      if (er != null)
        for (var kr in er)
          kr !== "default" && Object.prototype.hasOwnProperty.call(er, kr) && Qt(Cr, er, kr);
      return Zt(Cr, er), Cr;
    }, Sn = commonjsGlobal && commonjsGlobal.__exportStar || function(er, Cr) {
      for (var kr in er)
        kr !== "default" && !Object.prototype.hasOwnProperty.call(Cr, kr) && Qt(Cr, er, kr);
    };
    Object.defineProperty(_e, "__esModule", { value: !0 }), _e.TerminalAPI = _e.Terminal = void 0;
    const kn = $n(terminal);
    _e.Terminal = kn;
    const Kn = $n(restapi);
    _e.TerminalAPI = Kn, Sn(requireManager$1(), _e);
  }(terminal$1)), terminal$1;
}
var user = {};
Object.defineProperty(user, "__esModule", { value: !0 });
user.UserManager = void 0;
const coreutils_1$1 = lib$3, coreutils_2 = require$$1$2, polling_1 = require$$2, signaling_1 = require$$0$1, serverconnection_1$1 = serverconnection, basemanager_1 = basemanager, SERVICE_USER_URL = "api/me", SERVICE_ID = "@jupyterlab/services:UserManager#user";
class UserManager extends basemanager_1.BaseManager {
  /**
   * Create a new user manager.
   */
  constructor(Qt = {}) {
    var Zt;
    super(Qt), this._isReady = !1, this._userChanged = new signaling_1.Signal(this), this._connectionFailure = new signaling_1.Signal(this), this._ready = this.requestUser().then(() => {
      this.isDisposed || (this._isReady = !0);
    }).catch(($n) => (
      // Return a promise that will never resolve, so user service is never ready
      // This typically occurs when the backend has no user service
      new Promise(() => {
      })
    )), this._pollSpecs = new polling_1.Poll({
      auto: !1,
      factory: () => this.requestUser(),
      frequency: {
        interval: 61 * 1e3,
        backoff: !0,
        max: 300 * 1e3
      },
      name: SERVICE_ID,
      standby: (Zt = Qt.standby) !== null && Zt !== void 0 ? Zt : "when-hidden"
    }), this.ready.then(() => {
      this._pollSpecs.start();
    });
  }
  /**
   * Test whether the manager is ready.
   */
  get isReady() {
    return this._isReady;
  }
  /**
   * A promise that fulfills when the manager is ready.
   */
  get ready() {
    return this._ready;
  }
  /**
   * Get the most recently fetched identity.
   */
  get identity() {
    return this._identity;
  }
  /**
   * Get the most recently fetched permissions.
   */
  get permissions() {
    return this._permissions;
  }
  /**
   * A signal emitted when the user changes.
   */
  get userChanged() {
    return this._userChanged;
  }
  /**
   * A signal emitted when there is a connection failure.
   */
  get connectionFailure() {
    return this._connectionFailure;
  }
  /**
   * Dispose of the resources used by the manager.
   */
  dispose() {
    this._pollSpecs.dispose(), super.dispose();
  }
  /**
   * Force a refresh of the specs from the server.
   *
   * @returns A promise that resolves when the specs are fetched.
   *
   * #### Notes
   * This is intended to be called only in response to a user action,
   * since the manager maintains its internal state.
   */
  async refreshUser() {
    await this._pollSpecs.refresh(), await this._pollSpecs.tick;
  }
  /**
   * Execute a request to the server to poll the user and update state.
   */
  async requestUser() {
    if (this.isDisposed)
      return;
    const { baseUrl: Qt } = this.serverSettings, { makeRequest: Zt, ResponseError: $n } = serverconnection_1$1.ServerConnection, Sn = coreutils_1$1.URLExt.join(Qt, SERVICE_USER_URL), kn = await Zt(Sn, {}, this.serverSettings);
    if (kn.status !== 200)
      throw await $n.create(kn);
    const Kn = {
      identity: this._identity,
      permissions: this._permissions
    }, er = await kn.json(), Cr = er.identity, { localStorage: kr } = window, Yr = kr.getItem(SERVICE_ID);
    if (Yr && (!Cr.initials || !Cr.color)) {
      const Ms = JSON.parse(Yr);
      Cr.initials = Cr.initials || Ms.initials || Cr.name.substring(0, 1), Cr.color = Cr.color || Ms.color || Private$7.getRandomColor();
    }
    coreutils_2.JSONExt.deepEqual(er, Kn) || (this._identity = Cr, this._permissions = er.permissions, kr.setItem(SERVICE_ID, JSON.stringify(Cr)), this._userChanged.emit(er));
  }
}
user.UserManager = UserManager;
var Private$7;
(function(_e) {
  const Qt = [
    "var(--jp-collaborator-color1)",
    "var(--jp-collaborator-color2)",
    "var(--jp-collaborator-color3)",
    "var(--jp-collaborator-color4)",
    "var(--jp-collaborator-color5)",
    "var(--jp-collaborator-color6)",
    "var(--jp-collaborator-color7)"
  ];
  _e.getRandomColor = () => Qt[Math.floor(Math.random() * Qt.length)];
})(Private$7 || (Private$7 = {}));
var workspace = {};
Object.defineProperty(workspace, "__esModule", { value: !0 });
workspace.WorkspaceManager = void 0;
const coreutils_1 = lib$3, statedb_1 = lib$1, serverconnection_1 = serverconnection, SERVICE_WORKSPACES_URL = "api/workspaces";
class WorkspaceManager extends statedb_1.DataConnector {
  /**
   * Create a new workspace manager.
   */
  constructor(Qt = {}) {
    var Zt;
    super(), this.serverSettings = (Zt = Qt.serverSettings) !== null && Zt !== void 0 ? Zt : serverconnection_1.ServerConnection.makeSettings();
  }
  /**
   * Fetch a workspace.
   *
   * @param id - The workspace's ID.
   *
   * @returns A promise that resolves if successful.
   */
  async fetch(Qt) {
    const { serverSettings: Zt } = this, { baseUrl: $n, appUrl: Sn } = Zt, { makeRequest: kn, ResponseError: Kn } = serverconnection_1.ServerConnection, er = $n + Sn, Cr = Private$6.url(er, Qt), kr = await kn(Cr, {}, Zt);
    if (kr.status !== 200)
      throw await Kn.create(kr);
    return kr.json();
  }
  /**
   * Fetch the list of workspace IDs that exist on the server.
   *
   * @returns A promise that resolves if successful.
   */
  async list() {
    const { serverSettings: Qt } = this, { baseUrl: Zt, appUrl: $n } = Qt, { makeRequest: Sn, ResponseError: kn } = serverconnection_1.ServerConnection, Kn = Zt + $n, er = Private$6.url(Kn, ""), Cr = await Sn(er, {}, Qt);
    if (Cr.status !== 200)
      throw await kn.create(Cr);
    return (await Cr.json()).workspaces;
  }
  /**
   * Remove a workspace from the server.
   *
   * @param id - The workspaces's ID.
   *
   * @returns A promise that resolves if successful.
   */
  async remove(Qt) {
    const { serverSettings: Zt } = this, { baseUrl: $n, appUrl: Sn } = Zt, { makeRequest: kn, ResponseError: Kn } = serverconnection_1.ServerConnection, er = $n + Sn, Cr = Private$6.url(er, Qt), Yr = await kn(Cr, { method: "DELETE" }, Zt);
    if (Yr.status !== 204)
      throw await Kn.create(Yr);
  }
  /**
   * Save a workspace.
   *
   * @param id - The workspace's ID.
   *
   * @param workspace - The workspace being saved.
   *
   * @returns A promise that resolves if successful.
   */
  async save(Qt, Zt) {
    const { serverSettings: $n } = this, { baseUrl: Sn, appUrl: kn } = $n, { makeRequest: Kn, ResponseError: er } = serverconnection_1.ServerConnection, Cr = Sn + kn, kr = Private$6.url(Cr, Qt), Yr = { body: JSON.stringify(Zt), method: "PUT" }, Ms = await Kn(kr, Yr, $n);
    if (Ms.status !== 204)
      throw await er.create(Ms);
  }
}
workspace.WorkspaceManager = WorkspaceManager;
var Private$6;
(function(_e) {
  function Qt(Zt, $n) {
    return coreutils_1.URLExt.join(Zt, SERVICE_WORKSPACES_URL, $n);
  }
  _e.url = Qt;
})(Private$6 || (Private$6 = {}));
var hasRequiredManager;
function requireManager() {
  if (hasRequiredManager)
    return manager$2;
  hasRequiredManager = 1, Object.defineProperty(manager$2, "__esModule", { value: !0 }), manager$2.ServiceManager = void 0;
  const _e = require$$0$1, Qt = builder, Zt = requireContents(), $n = event$1, Sn = requireKernel(), kn = kernelspec$1, Kn = nbconvert, er = serverconnection, Cr = requireSession(), kr = setting, Yr = requireTerminal(), Ms = user, Ds = workspace;
  class Ls {
    /**
     * Construct a new services provider.
     */
    constructor(zs = {}) {
      var Fs, Bs;
      this._isDisposed = !1, this._connectionFailure = new _e.Signal(this), this._isReady = !1;
      const Hs = zs.defaultDrive, Ws = (Fs = zs.serverSettings) !== null && Fs !== void 0 ? Fs : er.ServerConnection.makeSettings(), Ys = (Bs = zs.standby) !== null && Bs !== void 0 ? Bs : "when-hidden", El = { defaultDrive: Hs, serverSettings: Ws, standby: Ys };
      this.serverSettings = Ws, this.contents = zs.contents || new Zt.ContentsManager(El), this.events = zs.events || new $n.EventManager(El), this.kernels = zs.kernels || new Sn.KernelManager(El), this.sessions = zs.sessions || new Cr.SessionManager({
        ...El,
        kernelManager: this.kernels
      }), this.settings = zs.settings || new kr.SettingManager(El), this.terminals = zs.terminals || new Yr.TerminalManager(El), this.builder = zs.builder || new Qt.BuildManager(El), this.workspaces = zs.workspaces || new Ds.WorkspaceManager(El), this.nbconvert = zs.nbconvert || new Kn.NbConvertManager(El), this.kernelspecs = zs.kernelspecs || new kn.KernelSpecManager(El), this.user = zs.user || new Ms.UserManager(El), this.kernelspecs.connectionFailure.connect(this._onConnectionFailure, this), this.sessions.connectionFailure.connect(this._onConnectionFailure, this), this.terminals.connectionFailure.connect(this._onConnectionFailure, this);
      const Mu = [this.sessions.ready, this.kernelspecs.ready];
      this.terminals.isAvailable() && Mu.push(this.terminals.ready), this._readyPromise = Promise.all(Mu).then(() => {
        this._isReady = !0;
      });
    }
    /**
     * A signal emitted when there is a connection failure with the kernel.
     */
    get connectionFailure() {
      return this._connectionFailure;
    }
    /**
     * Test whether the service manager is disposed.
     */
    get isDisposed() {
      return this._isDisposed;
    }
    /**
     * Dispose of the resources used by the manager.
     */
    dispose() {
      this.isDisposed || (this._isDisposed = !0, _e.Signal.clearData(this), this.contents.dispose(), this.events.dispose(), this.sessions.dispose(), this.terminals.dispose());
    }
    /**
     * Test whether the manager is ready.
     */
    get isReady() {
      return this._isReady;
    }
    /**
     * A promise that fulfills when the manager is ready.
     */
    get ready() {
      return this._readyPromise;
    }
    _onConnectionFailure(zs, Fs) {
      this._connectionFailure.emit(Fs);
    }
  }
  return manager$2.ServiceManager = Ls, manager$2;
}
var hasRequiredLib;
function requireLib() {
  return hasRequiredLib || (hasRequiredLib = 1, function(_e) {
    var Qt = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function($n, Sn, kn, Kn) {
      Kn === void 0 && (Kn = kn);
      var er = Object.getOwnPropertyDescriptor(Sn, kn);
      (!er || ("get" in er ? !Sn.__esModule : er.writable || er.configurable)) && (er = { enumerable: !0, get: function() {
        return Sn[kn];
      } }), Object.defineProperty($n, Kn, er);
    } : function($n, Sn, kn, Kn) {
      Kn === void 0 && (Kn = kn), $n[Kn] = Sn[kn];
    }), Zt = commonjsGlobal && commonjsGlobal.__exportStar || function($n, Sn) {
      for (var kn in $n)
        kn !== "default" && !Object.prototype.hasOwnProperty.call(Sn, kn) && Qt(Sn, $n, kn);
    };
    Object.defineProperty(_e, "__esModule", { value: !0 }), Zt(basemanager, _e), Zt(requireConfig(), _e), Zt(requireContents(), _e), Zt(event$1, _e), Zt(requireKernel(), _e), Zt(kernelspec$1, _e), Zt(requireManager(), _e), Zt(serverconnection, _e), Zt(requireSession(), _e), Zt(setting, _e), Zt(requireTerminal(), _e), Zt(user, _e), Zt(workspace, _e), Zt(nbconvert, _e);
  }(lib)), lib;
}
var libExports = requireLib(), jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var f$3 = reactExports, k$5 = Symbol.for("react.element"), l$4 = Symbol.for("react.fragment"), m$7 = Object.prototype.hasOwnProperty, n$5 = f$3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p$5 = { key: !0, ref: !0, __self: !0, __source: !0 };
function q$6(_e, Qt, Zt) {
  var $n, Sn = {}, kn = null, Kn = null;
  Zt !== void 0 && (kn = "" + Zt), Qt.key !== void 0 && (kn = "" + Qt.key), Qt.ref !== void 0 && (Kn = Qt.ref);
  for ($n in Qt)
    m$7.call(Qt, $n) && !p$5.hasOwnProperty($n) && (Sn[$n] = Qt[$n]);
  if (_e && _e.defaultProps)
    for ($n in Qt = _e.defaultProps, Qt)
      Sn[$n] === void 0 && (Sn[$n] = Qt[$n]);
  return { $$typeof: k$5, type: _e, key: kn, ref: Kn, props: Sn, _owner: n$5.current };
}
reactJsxRuntime_production_min.Fragment = l$4;
reactJsxRuntime_production_min.jsx = q$6;
reactJsxRuntime_production_min.jsxs = q$6;
jsxRuntime.exports = reactJsxRuntime_production_min;
var jsxRuntimeExports = jsxRuntime.exports, __assign = function() {
  return __assign = Object.assign || function(Qt) {
    for (var Zt, $n = 1, Sn = arguments.length; $n < Sn; $n++) {
      Zt = arguments[$n];
      for (var kn in Zt)
        Object.prototype.hasOwnProperty.call(Zt, kn) && (Qt[kn] = Zt[kn]);
    }
    return Qt;
  }, __assign.apply(this, arguments);
};
function __rest$1(_e, Qt) {
  var Zt = {};
  for (var $n in _e)
    Object.prototype.hasOwnProperty.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var Sn = 0, $n = Object.getOwnPropertySymbols(_e); Sn < $n.length; Sn++)
      Qt.indexOf($n[Sn]) < 0 && Object.prototype.propertyIsEnumerable.call(_e, $n[Sn]) && (Zt[$n[Sn]] = _e[$n[Sn]]);
  return Zt;
}
function __spreadArray$1(_e, Qt, Zt) {
  if (Zt || arguments.length === 2)
    for (var $n = 0, Sn = Qt.length, kn; $n < Sn; $n++)
      (kn || !($n in Qt)) && (kn || (kn = Array.prototype.slice.call(Qt, 0, $n)), kn[$n] = Qt[$n]);
  return _e.concat(kn || Array.prototype.slice.call(Qt));
}
typeof SuppressedError == "function" && SuppressedError;
var lodash = { exports: {} };
/**
 * @license
 * Lodash <https://lodash.com/>
 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
 * Released under MIT license <https://lodash.com/license>
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 */
lodash.exports;
(function(_e, Qt) {
  (function() {
    var Zt, $n = "4.17.21", Sn = 200, kn = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", Kn = "Expected a function", er = "Invalid `variable` option passed into `_.template`", Cr = "__lodash_hash_undefined__", kr = 500, Yr = "__lodash_placeholder__", Ms = 1, Ds = 2, Ls = 4, js = 1, zs = 2, Fs = 1, Bs = 2, Hs = 4, Ws = 8, Ys = 16, El = 32, Mu = 64, Pl = 128, Iu = 256, Tu = 512, Au = 30, Nu = "...", gm = 800, pm = 16, zu = 1, Yu = 2, sm = 3, mm = 1 / 0, hm = 9007199254740991, ym = 17976931348623157e292, _m = 0 / 0, Sm = 4294967295, wm = Sm - 1, Nm = Sm >>> 1, Cm = [
      ["ary", Pl],
      ["bind", Fs],
      ["bindKey", Bs],
      ["curry", Ws],
      ["curryRight", Ys],
      ["flip", Tu],
      ["partial", El],
      ["partialRight", Mu],
      ["rearg", Iu]
    ], Im = "[object Arguments]", Am = "[object Array]", Vm = "[object AsyncFunction]", Rm = "[object Boolean]", Dm = "[object Date]", km = "[object DOMException]", zm = "[object Error]", Pm = "[object Function]", i$ = "[object GeneratorFunction]", o$ = "[object Map]", u$ = "[object Number]", h$ = "[object Null]", d$ = "[object Object]", v$ = "[object Promise]", $$ = "[object Proxy]", s$ = "[object RegExp]", l$ = "[object Set]", _$ = "[object String]", a$ = "[object Symbol]", n$ = "[object Undefined]", m$ = "[object WeakMap]", j$ = "[object WeakSet]", Q$ = "[object ArrayBuffer]", z$ = "[object DataView]", wS = "[object Float32Array]", aS = "[object Float64Array]", cS = "[object Int8Array]", $S = "[object Int16Array]", B$ = "[object Int32Array]", IS = "[object Uint8Array]", RS = "[object Uint8ClampedArray]", eE = "[object Uint16Array]", rS = "[object Uint32Array]", sS = /\b__p \+= '';/g, PS = /\b(__p \+=) '' \+/g, G$ = /(__e\(.*?\)|\b__t\)) \+\n'';/g, tS = /&(?:amp|lt|gt|quot|#39);/g, hS = /[&<>"']/g, aE = RegExp(tS.source), gS = RegExp(hS.source), lS = /<%-([\s\S]+?)%>/g, M$ = /<%([\s\S]+?)%>/g, Z$ = /<%=([\s\S]+?)%>/g, O$ = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, U$ = /^\w*$/, R$ = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, k$ = /[\\^$.*+?()[\]{}|]/g, yS = RegExp(k$.source), HS = /^\s+/, WE = /\s/, wE = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, GE = /\{\n\/\* \[wrapped with (.+)\] \*/, lM = /,? & /, YE = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, g$ = /[()=,{}\[\]\/\s]/, V$ = /\\(\\)?/g, uS = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, D$ = /\w*$/, xE = /^[-+]0x[0-9a-f]+$/i, LS = /^0b[01]+$/i, xM = /^\[object .+?Constructor\]$/, hC = /^0o[0-7]+$/i, gC = /^(?:0|[1-9]\d*)$/, dS = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, VS = /($^)/, EM = /['\n\r\u2028\u2029\\]/g, pE = "\\ud800-\\udfff", mC = "\\u0300-\\u036f", yC = "\\ufe20-\\ufe2f", vC = "\\u20d0-\\u20ff", MM = mC + yC + vC, CM = "\\u2700-\\u27bf", RE = "a-z\\xdf-\\xf6\\xf8-\\xff", b$ = "\\xac\\xb1\\xd7\\xf7", Y$ = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", OS = "\\u2000-\\u206f", sE = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", lE = "A-Z\\xc0-\\xd6\\xd8-\\xde", WS = "\\ufe0e\\ufe0f", EE = b$ + Y$ + OS + sE, tE = "['’]", HD = "[" + pE + "]", OI = "[" + EE + "]", IM = "[" + MM + "]", DI = "\\d+", VD = "[" + CM + "]", AI = "[" + RE + "]", TI = "[^" + pE + EE + DI + CM + RE + lE + "]", _C = "\\ud83c[\\udffb-\\udfff]", WD = "(?:" + IM + "|" + _C + ")", NI = "[^" + pE + "]", $C = "(?:\\ud83c[\\udde6-\\uddff]){2}", bC = "[\\ud800-\\udbff][\\udc00-\\udfff]", qE = "[" + lE + "]", RI = "\\u200d", LI = "(?:" + AI + "|" + TI + ")", GD = "(?:" + qE + "|" + TI + ")", kI = "(?:" + tE + "(?:d|ll|m|re|s|t|ve))?", jI = "(?:" + tE + "(?:D|LL|M|RE|S|T|VE))?", zI = WD + "?", FI = "[" + WS + "]?", YD = "(?:" + RI + "(?:" + [NI, $C, bC].join("|") + ")" + FI + zI + ")*", qD = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", KD = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", BI = FI + zI + YD, QD = "(?:" + [VD, $C, bC].join("|") + ")" + BI, ZD = "(?:" + [NI + IM + "?", IM, $C, bC, HD].join("|") + ")", XD = RegExp(tE, "g"), JD = RegExp(IM, "g"), SC = RegExp(_C + "(?=" + _C + ")|" + ZD + BI, "g"), n2 = RegExp([
      qE + "?" + AI + "+" + kI + "(?=" + [OI, qE, "$"].join("|") + ")",
      GD + "+" + jI + "(?=" + [OI, qE + LI, "$"].join("|") + ")",
      qE + "?" + LI + "+" + kI,
      qE + "+" + jI,
      KD,
      qD,
      DI,
      QD
    ].join("|"), "g"), r2 = RegExp("[" + RI + pE + MM + WS + "]"), i2 = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, o2 = [
      "Array",
      "Buffer",
      "DataView",
      "Date",
      "Error",
      "Float32Array",
      "Float64Array",
      "Function",
      "Int8Array",
      "Int16Array",
      "Int32Array",
      "Map",
      "Math",
      "Object",
      "Promise",
      "RegExp",
      "Set",
      "String",
      "Symbol",
      "TypeError",
      "Uint8Array",
      "Uint8ClampedArray",
      "Uint16Array",
      "Uint32Array",
      "WeakMap",
      "_",
      "clearTimeout",
      "isFinite",
      "parseInt",
      "setTimeout"
    ], a2 = -1, X$ = {};
    X$[wS] = X$[aS] = X$[cS] = X$[$S] = X$[B$] = X$[IS] = X$[RS] = X$[eE] = X$[rS] = !0, X$[Im] = X$[Am] = X$[Q$] = X$[Rm] = X$[z$] = X$[Dm] = X$[zm] = X$[Pm] = X$[o$] = X$[u$] = X$[d$] = X$[s$] = X$[l$] = X$[_$] = X$[m$] = !1;
    var K$ = {};
    K$[Im] = K$[Am] = K$[Q$] = K$[z$] = K$[Rm] = K$[Dm] = K$[wS] = K$[aS] = K$[cS] = K$[$S] = K$[B$] = K$[o$] = K$[u$] = K$[d$] = K$[s$] = K$[l$] = K$[_$] = K$[a$] = K$[IS] = K$[RS] = K$[eE] = K$[rS] = !0, K$[zm] = K$[Pm] = K$[m$] = !1;
    var s2 = {
      // Latin-1 Supplement block.
      À: "A",
      Á: "A",
      Â: "A",
      Ã: "A",
      Ä: "A",
      Å: "A",
      à: "a",
      á: "a",
      â: "a",
      ã: "a",
      ä: "a",
      å: "a",
      Ç: "C",
      ç: "c",
      Ð: "D",
      ð: "d",
      È: "E",
      É: "E",
      Ê: "E",
      Ë: "E",
      è: "e",
      é: "e",
      ê: "e",
      ë: "e",
      Ì: "I",
      Í: "I",
      Î: "I",
      Ï: "I",
      ì: "i",
      í: "i",
      î: "i",
      ï: "i",
      Ñ: "N",
      ñ: "n",
      Ò: "O",
      Ó: "O",
      Ô: "O",
      Õ: "O",
      Ö: "O",
      Ø: "O",
      ò: "o",
      ó: "o",
      ô: "o",
      õ: "o",
      ö: "o",
      ø: "o",
      Ù: "U",
      Ú: "U",
      Û: "U",
      Ü: "U",
      ù: "u",
      ú: "u",
      û: "u",
      ü: "u",
      Ý: "Y",
      ý: "y",
      ÿ: "y",
      Æ: "Ae",
      æ: "ae",
      Þ: "Th",
      þ: "th",
      ß: "ss",
      // Latin Extended-A block.
      Ā: "A",
      Ă: "A",
      Ą: "A",
      ā: "a",
      ă: "a",
      ą: "a",
      Ć: "C",
      Ĉ: "C",
      Ċ: "C",
      Č: "C",
      ć: "c",
      ĉ: "c",
      ċ: "c",
      č: "c",
      Ď: "D",
      Đ: "D",
      ď: "d",
      đ: "d",
      Ē: "E",
      Ĕ: "E",
      Ė: "E",
      Ę: "E",
      Ě: "E",
      ē: "e",
      ĕ: "e",
      ė: "e",
      ę: "e",
      ě: "e",
      Ĝ: "G",
      Ğ: "G",
      Ġ: "G",
      Ģ: "G",
      ĝ: "g",
      ğ: "g",
      ġ: "g",
      ģ: "g",
      Ĥ: "H",
      Ħ: "H",
      ĥ: "h",
      ħ: "h",
      Ĩ: "I",
      Ī: "I",
      Ĭ: "I",
      Į: "I",
      İ: "I",
      ĩ: "i",
      ī: "i",
      ĭ: "i",
      į: "i",
      ı: "i",
      Ĵ: "J",
      ĵ: "j",
      Ķ: "K",
      ķ: "k",
      ĸ: "k",
      Ĺ: "L",
      Ļ: "L",
      Ľ: "L",
      Ŀ: "L",
      Ł: "L",
      ĺ: "l",
      ļ: "l",
      ľ: "l",
      ŀ: "l",
      ł: "l",
      Ń: "N",
      Ņ: "N",
      Ň: "N",
      Ŋ: "N",
      ń: "n",
      ņ: "n",
      ň: "n",
      ŋ: "n",
      Ō: "O",
      Ŏ: "O",
      Ő: "O",
      ō: "o",
      ŏ: "o",
      ő: "o",
      Ŕ: "R",
      Ŗ: "R",
      Ř: "R",
      ŕ: "r",
      ŗ: "r",
      ř: "r",
      Ś: "S",
      Ŝ: "S",
      Ş: "S",
      Š: "S",
      ś: "s",
      ŝ: "s",
      ş: "s",
      š: "s",
      Ţ: "T",
      Ť: "T",
      Ŧ: "T",
      ţ: "t",
      ť: "t",
      ŧ: "t",
      Ũ: "U",
      Ū: "U",
      Ŭ: "U",
      Ů: "U",
      Ű: "U",
      Ų: "U",
      ũ: "u",
      ū: "u",
      ŭ: "u",
      ů: "u",
      ű: "u",
      ų: "u",
      Ŵ: "W",
      ŵ: "w",
      Ŷ: "Y",
      ŷ: "y",
      Ÿ: "Y",
      Ź: "Z",
      Ż: "Z",
      Ž: "Z",
      ź: "z",
      ż: "z",
      ž: "z",
      Ĳ: "IJ",
      ĳ: "ij",
      Œ: "Oe",
      œ: "oe",
      ŉ: "'n",
      ſ: "s"
    }, l2 = {
      "&": "&amp;",
      "<": "&lt;",
      ">": "&gt;",
      '"': "&quot;",
      "'": "&#39;"
    }, c2 = {
      "&amp;": "&",
      "&lt;": "<",
      "&gt;": ">",
      "&quot;": '"',
      "&#39;": "'"
    }, u2 = {
      "\\": "\\",
      "'": "'",
      "\n": "n",
      "\r": "r",
      "\u2028": "u2028",
      "\u2029": "u2029"
    }, d2 = parseFloat, f2 = parseInt, UI = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal, p2 = typeof self == "object" && self && self.Object === Object && self, vS = UI || p2 || Function("return this")(), wC = Qt && !Qt.nodeType && Qt, LE = wC && !0 && _e && !_e.nodeType && _e, HI = LE && LE.exports === wC, xC = HI && UI.process, GS = function() {
      try {
        var Om = LE && LE.require && LE.require("util").types;
        return Om || xC && xC.binding && xC.binding("util");
      } catch {
      }
    }(), VI = GS && GS.isArrayBuffer, WI = GS && GS.isDate, GI = GS && GS.isMap, YI = GS && GS.isRegExp, qI = GS && GS.isSet, KI = GS && GS.isTypedArray;
    function kS(Om, jm, Lm) {
      switch (Lm.length) {
        case 0:
          return Om.call(jm);
        case 1:
          return Om.call(jm, Lm[0]);
        case 2:
          return Om.call(jm, Lm[0], Lm[1]);
        case 3:
          return Om.call(jm, Lm[0], Lm[1], Lm[2]);
      }
      return Om.apply(jm, Lm);
    }
    function h2(Om, jm, Lm, f$) {
      for (var E$ = -1, F$ = Om == null ? 0 : Om.length; ++E$ < F$; ) {
        var fS = Om[E$];
        jm(f$, fS, Lm(fS), Om);
      }
      return f$;
    }
    function YS(Om, jm) {
      for (var Lm = -1, f$ = Om == null ? 0 : Om.length; ++Lm < f$ && jm(Om[Lm], Lm, Om) !== !1; )
        ;
      return Om;
    }
    function g2(Om, jm) {
      for (var Lm = Om == null ? 0 : Om.length; Lm-- && jm(Om[Lm], Lm, Om) !== !1; )
        ;
      return Om;
    }
    function QI(Om, jm) {
      for (var Lm = -1, f$ = Om == null ? 0 : Om.length; ++Lm < f$; )
        if (!jm(Om[Lm], Lm, Om))
          return !1;
      return !0;
    }
    function ME(Om, jm) {
      for (var Lm = -1, f$ = Om == null ? 0 : Om.length, E$ = 0, F$ = []; ++Lm < f$; ) {
        var fS = Om[Lm];
        jm(fS, Lm, Om) && (F$[E$++] = fS);
      }
      return F$;
    }
    function PM(Om, jm) {
      var Lm = Om == null ? 0 : Om.length;
      return !!Lm && KE(Om, jm, 0) > -1;
    }
    function EC(Om, jm, Lm) {
      for (var f$ = -1, E$ = Om == null ? 0 : Om.length; ++f$ < E$; )
        if (Lm(jm, Om[f$]))
          return !0;
      return !1;
    }
    function J$(Om, jm) {
      for (var Lm = -1, f$ = Om == null ? 0 : Om.length, E$ = Array(f$); ++Lm < f$; )
        E$[Lm] = jm(Om[Lm], Lm, Om);
      return E$;
    }
    function CE(Om, jm) {
      for (var Lm = -1, f$ = jm.length, E$ = Om.length; ++Lm < f$; )
        Om[E$ + Lm] = jm[Lm];
      return Om;
    }
    function MC(Om, jm, Lm, f$) {
      var E$ = -1, F$ = Om == null ? 0 : Om.length;
      for (f$ && F$ && (Lm = Om[++E$]); ++E$ < F$; )
        Lm = jm(Lm, Om[E$], E$, Om);
      return Lm;
    }
    function m2(Om, jm, Lm, f$) {
      var E$ = Om == null ? 0 : Om.length;
      for (f$ && E$ && (Lm = Om[--E$]); E$--; )
        Lm = jm(Lm, Om[E$], E$, Om);
      return Lm;
    }
    function CC(Om, jm) {
      for (var Lm = -1, f$ = Om == null ? 0 : Om.length; ++Lm < f$; )
        if (jm(Om[Lm], Lm, Om))
          return !0;
      return !1;
    }
    var y2 = IC("length");
    function v2(Om) {
      return Om.split("");
    }
    function _2(Om) {
      return Om.match(YE) || [];
    }
    function ZI(Om, jm, Lm) {
      var f$;
      return Lm(Om, function(E$, F$, fS) {
        if (jm(E$, F$, fS))
          return f$ = F$, !1;
      }), f$;
    }
    function OM(Om, jm, Lm, f$) {
      for (var E$ = Om.length, F$ = Lm + (f$ ? 1 : -1); f$ ? F$-- : ++F$ < E$; )
        if (jm(Om[F$], F$, Om))
          return F$;
      return -1;
    }
    function KE(Om, jm, Lm) {
      return jm === jm ? T2(Om, jm, Lm) : OM(Om, XI, Lm);
    }
    function $2(Om, jm, Lm, f$) {
      for (var E$ = Lm - 1, F$ = Om.length; ++E$ < F$; )
        if (f$(Om[E$], jm))
          return E$;
      return -1;
    }
    function XI(Om) {
      return Om !== Om;
    }
    function JI(Om, jm) {
      var Lm = Om == null ? 0 : Om.length;
      return Lm ? OC(Om, jm) / Lm : _m;
    }
    function IC(Om) {
      return function(jm) {
        return jm == null ? Zt : jm[Om];
      };
    }
    function PC(Om) {
      return function(jm) {
        return Om == null ? Zt : Om[jm];
      };
    }
    function eP(Om, jm, Lm, f$, E$) {
      return E$(Om, function(F$, fS, q$) {
        Lm = f$ ? (f$ = !1, F$) : jm(Lm, F$, fS, q$);
      }), Lm;
    }
    function b2(Om, jm) {
      var Lm = Om.length;
      for (Om.sort(jm); Lm--; )
        Om[Lm] = Om[Lm].value;
      return Om;
    }
    function OC(Om, jm) {
      for (var Lm, f$ = -1, E$ = Om.length; ++f$ < E$; ) {
        var F$ = jm(Om[f$]);
        F$ !== Zt && (Lm = Lm === Zt ? F$ : Lm + F$);
      }
      return Lm;
    }
    function DC(Om, jm) {
      for (var Lm = -1, f$ = Array(Om); ++Lm < Om; )
        f$[Lm] = jm(Lm);
      return f$;
    }
    function S2(Om, jm) {
      return J$(jm, function(Lm) {
        return [Lm, Om[Lm]];
      });
    }
    function tP(Om) {
      return Om && Om.slice(0, oP(Om) + 1).replace(HS, "");
    }
    function jS(Om) {
      return function(jm) {
        return Om(jm);
      };
    }
    function AC(Om, jm) {
      return J$(jm, function(Lm) {
        return Om[Lm];
      });
    }
    function cM(Om, jm) {
      return Om.has(jm);
    }
    function nP(Om, jm) {
      for (var Lm = -1, f$ = Om.length; ++Lm < f$ && KE(jm, Om[Lm], 0) > -1; )
        ;
      return Lm;
    }
    function rP(Om, jm) {
      for (var Lm = Om.length; Lm-- && KE(jm, Om[Lm], 0) > -1; )
        ;
      return Lm;
    }
    function w2(Om, jm) {
      for (var Lm = Om.length, f$ = 0; Lm--; )
        Om[Lm] === jm && ++f$;
      return f$;
    }
    var x2 = PC(s2), E2 = PC(l2);
    function M2(Om) {
      return "\\" + u2[Om];
    }
    function I2(Om, jm) {
      return Om == null ? Zt : Om[jm];
    }
    function QE(Om) {
      return r2.test(Om);
    }
    function P2(Om) {
      return i2.test(Om);
    }
    function O2(Om) {
      for (var jm, Lm = []; !(jm = Om.next()).done; )
        Lm.push(jm.value);
      return Lm;
    }
    function TC(Om) {
      var jm = -1, Lm = Array(Om.size);
      return Om.forEach(function(f$, E$) {
        Lm[++jm] = [E$, f$];
      }), Lm;
    }
    function iP(Om, jm) {
      return function(Lm) {
        return Om(jm(Lm));
      };
    }
    function IE(Om, jm) {
      for (var Lm = -1, f$ = Om.length, E$ = 0, F$ = []; ++Lm < f$; ) {
        var fS = Om[Lm];
        (fS === jm || fS === Yr) && (Om[Lm] = Yr, F$[E$++] = Lm);
      }
      return F$;
    }
    function DM(Om) {
      var jm = -1, Lm = Array(Om.size);
      return Om.forEach(function(f$) {
        Lm[++jm] = f$;
      }), Lm;
    }
    function D2(Om) {
      var jm = -1, Lm = Array(Om.size);
      return Om.forEach(function(f$) {
        Lm[++jm] = [f$, f$];
      }), Lm;
    }
    function T2(Om, jm, Lm) {
      for (var f$ = Lm - 1, E$ = Om.length; ++f$ < E$; )
        if (Om[f$] === jm)
          return f$;
      return -1;
    }
    function N2(Om, jm, Lm) {
      for (var f$ = Lm + 1; f$--; )
        if (Om[f$] === jm)
          return f$;
      return f$;
    }
    function ZE(Om) {
      return QE(Om) ? L2(Om) : y2(Om);
    }
    function nE(Om) {
      return QE(Om) ? k2(Om) : v2(Om);
    }
    function oP(Om) {
      for (var jm = Om.length; jm-- && WE.test(Om.charAt(jm)); )
        ;
      return jm;
    }
    var R2 = PC(c2);
    function L2(Om) {
      for (var jm = SC.lastIndex = 0; SC.test(Om); )
        ++jm;
      return jm;
    }
    function k2(Om) {
      return Om.match(SC) || [];
    }
    function j2(Om) {
      return Om.match(n2) || [];
    }
    var z2 = function Om(jm) {
      jm = jm == null ? vS : XE.defaults(vS.Object(), jm, XE.pick(vS, o2));
      var Lm = jm.Array, f$ = jm.Date, E$ = jm.Error, F$ = jm.Function, fS = jm.Math, q$ = jm.Object, NC = jm.RegExp, F2 = jm.String, qS = jm.TypeError, AM = Lm.prototype, B2 = F$.prototype, JE = q$.prototype, TM = jm["__core-js_shared__"], NM = B2.toString, W$ = JE.hasOwnProperty, U2 = 0, aP = function() {
        var Vs = /[^.]+$/.exec(TM && TM.keys && TM.keys.IE_PROTO || "");
        return Vs ? "Symbol(src)_1." + Vs : "";
      }(), RM = JE.toString, H2 = NM.call(q$), V2 = vS._, W2 = NC(
        "^" + NM.call(W$).replace(k$, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
      ), LM = HI ? jm.Buffer : Zt, PE = jm.Symbol, kM = jm.Uint8Array, sP = LM ? LM.allocUnsafe : Zt, jM = iP(q$.getPrototypeOf, q$), lP = q$.create, cP = JE.propertyIsEnumerable, zM = AM.splice, uP = PE ? PE.isConcatSpreadable : Zt, uM = PE ? PE.iterator : Zt, kE = PE ? PE.toStringTag : Zt, FM = function() {
        try {
          var Vs = UE(q$, "defineProperty");
          return Vs({}, "", {}), Vs;
        } catch {
        }
      }(), G2 = jm.clearTimeout !== vS.clearTimeout && jm.clearTimeout, q2 = f$ && f$.now !== vS.Date.now && f$.now, K2 = jm.setTimeout !== vS.setTimeout && jm.setTimeout, BM = fS.ceil, UM = fS.floor, RC = q$.getOwnPropertySymbols, Q2 = LM ? LM.isBuffer : Zt, dP = jm.isFinite, J2 = AM.join, eA = iP(q$.keys, q$), pS = fS.max, bS = fS.min, tA = f$.now, nA = jm.parseInt, fP = fS.random, rA = AM.reverse, LC = UE(jm, "DataView"), dM = UE(jm, "Map"), kC = UE(jm, "Promise"), eM = UE(jm, "Set"), fM = UE(jm, "WeakMap"), pM = UE(q$, "create"), HM = fM && new fM(), tM = {}, iA = HE(LC), oA = HE(dM), aA = HE(kC), sA = HE(eM), lA = HE(fM), VM = PE ? PE.prototype : Zt, hM = VM ? VM.valueOf : Zt, pP = VM ? VM.toString : Zt;
      function $m(Vs) {
        if (nS(Vs) && !C$(Vs) && !(Vs instanceof N$)) {
          if (Vs instanceof KS)
            return Vs;
          if (W$.call(Vs, "__wrapped__"))
            return JO(Vs);
        }
        return new KS(Vs);
      }
      var nM = function() {
        function Vs() {
        }
        return function($l) {
          if (!eS($l))
            return {};
          if (lP)
            return lP($l);
          Vs.prototype = $l;
          var Du = new Vs();
          return Vs.prototype = Zt, Du;
        };
      }();
      function WM() {
      }
      function KS(Vs, $l) {
        this.__wrapped__ = Vs, this.__actions__ = [], this.__chain__ = !!$l, this.__index__ = 0, this.__values__ = Zt;
      }
      $m.templateSettings = {
        /**
         * Used to detect `data` property values to be HTML-escaped.
         *
         * @memberOf _.templateSettings
         * @type {RegExp}
         */
        escape: lS,
        /**
         * Used to detect code to be evaluated.
         *
         * @memberOf _.templateSettings
         * @type {RegExp}
         */
        evaluate: M$,
        /**
         * Used to detect `data` property values to inject.
         *
         * @memberOf _.templateSettings
         * @type {RegExp}
         */
        interpolate: Z$,
        /**
         * Used to reference the data object in the template text.
         *
         * @memberOf _.templateSettings
         * @type {string}
         */
        variable: "",
        /**
         * Used to import variables into the compiled template.
         *
         * @memberOf _.templateSettings
         * @type {Object}
         */
        imports: {
          /**
           * A reference to the `lodash` function.
           *
           * @memberOf _.templateSettings.imports
           * @type {Function}
           */
          _: $m
        }
      }, $m.prototype = WM.prototype, $m.prototype.constructor = $m, KS.prototype = nM(WM.prototype), KS.prototype.constructor = KS;
      function N$(Vs) {
        this.__wrapped__ = Vs, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = Sm, this.__views__ = [];
      }
      function cA() {
        var Vs = new N$(this.__wrapped__);
        return Vs.__actions__ = DS(this.__actions__), Vs.__dir__ = this.__dir__, Vs.__filtered__ = this.__filtered__, Vs.__iteratees__ = DS(this.__iteratees__), Vs.__takeCount__ = this.__takeCount__, Vs.__views__ = DS(this.__views__), Vs;
      }
      function uA() {
        if (this.__filtered__) {
          var Vs = new N$(this);
          Vs.__dir__ = -1, Vs.__filtered__ = !0;
        } else
          Vs = this.clone(), Vs.__dir__ *= -1;
        return Vs;
      }
      function dA() {
        var Vs = this.__wrapped__.value(), $l = this.__dir__, Du = C$(Vs), om = $l < 0, vm = Du ? Vs.length : 0, bm = xT(0, vm, this.__views__), xm = bm.start, Em = bm.end, Tm = Em - xm, e$ = om ? Em : xm - 1, t$ = this.__iteratees__, r$ = t$.length, c$ = 0, y$ = bS(Tm, this.__takeCount__);
        if (!Du || !om && vm == Tm && y$ == Tm)
          return kP(Vs, this.__actions__);
        var w$ = [];
        e:
          for (; Tm-- && c$ < y$; ) {
            e$ += $l;
            for (var P$ = -1, x$ = Vs[e$]; ++P$ < r$; ) {
              var T$ = t$[P$], L$ = T$.iteratee, BS = T$.type, CS = L$(x$);
              if (BS == Yu)
                x$ = CS;
              else if (!CS) {
                if (BS == zu)
                  continue e;
                break e;
              }
            }
            w$[c$++] = x$;
          }
        return w$;
      }
      N$.prototype = nM(WM.prototype), N$.prototype.constructor = N$;
      function jE(Vs) {
        var $l = -1, Du = Vs == null ? 0 : Vs.length;
        for (this.clear(); ++$l < Du; ) {
          var om = Vs[$l];
          this.set(om[0], om[1]);
        }
      }
      function fA() {
        this.__data__ = pM ? pM(null) : {}, this.size = 0;
      }
      function pA(Vs) {
        var $l = this.has(Vs) && delete this.__data__[Vs];
        return this.size -= $l ? 1 : 0, $l;
      }
      function hA(Vs) {
        var $l = this.__data__;
        if (pM) {
          var Du = $l[Vs];
          return Du === Cr ? Zt : Du;
        }
        return W$.call($l, Vs) ? $l[Vs] : Zt;
      }
      function gA(Vs) {
        var $l = this.__data__;
        return pM ? $l[Vs] !== Zt : W$.call($l, Vs);
      }
      function mA(Vs, $l) {
        var Du = this.__data__;
        return this.size += this.has(Vs) ? 0 : 1, Du[Vs] = pM && $l === Zt ? Cr : $l, this;
      }
      jE.prototype.clear = fA, jE.prototype.delete = pA, jE.prototype.get = hA, jE.prototype.has = gA, jE.prototype.set = mA;
      function hE(Vs) {
        var $l = -1, Du = Vs == null ? 0 : Vs.length;
        for (this.clear(); ++$l < Du; ) {
          var om = Vs[$l];
          this.set(om[0], om[1]);
        }
      }
      function yA() {
        this.__data__ = [], this.size = 0;
      }
      function vA(Vs) {
        var $l = this.__data__, Du = GM($l, Vs);
        if (Du < 0)
          return !1;
        var om = $l.length - 1;
        return Du == om ? $l.pop() : zM.call($l, Du, 1), --this.size, !0;
      }
      function _A(Vs) {
        var $l = this.__data__, Du = GM($l, Vs);
        return Du < 0 ? Zt : $l[Du][1];
      }
      function $A(Vs) {
        return GM(this.__data__, Vs) > -1;
      }
      function bA(Vs, $l) {
        var Du = this.__data__, om = GM(Du, Vs);
        return om < 0 ? (++this.size, Du.push([Vs, $l])) : Du[om][1] = $l, this;
      }
      hE.prototype.clear = yA, hE.prototype.delete = vA, hE.prototype.get = _A, hE.prototype.has = $A, hE.prototype.set = bA;
      function gE(Vs) {
        var $l = -1, Du = Vs == null ? 0 : Vs.length;
        for (this.clear(); ++$l < Du; ) {
          var om = Vs[$l];
          this.set(om[0], om[1]);
        }
      }
      function SA() {
        this.size = 0, this.__data__ = {
          hash: new jE(),
          map: new (dM || hE)(),
          string: new jE()
        };
      }
      function wA(Vs) {
        var $l = iC(this, Vs).delete(Vs);
        return this.size -= $l ? 1 : 0, $l;
      }
      function xA(Vs) {
        return iC(this, Vs).get(Vs);
      }
      function EA(Vs) {
        return iC(this, Vs).has(Vs);
      }
      function MA(Vs, $l) {
        var Du = iC(this, Vs), om = Du.size;
        return Du.set(Vs, $l), this.size += Du.size == om ? 0 : 1, this;
      }
      gE.prototype.clear = SA, gE.prototype.delete = wA, gE.prototype.get = xA, gE.prototype.has = EA, gE.prototype.set = MA;
      function zE(Vs) {
        var $l = -1, Du = Vs == null ? 0 : Vs.length;
        for (this.__data__ = new gE(); ++$l < Du; )
          this.add(Vs[$l]);
      }
      function CA(Vs) {
        return this.__data__.set(Vs, Cr), this;
      }
      function IA(Vs) {
        return this.__data__.has(Vs);
      }
      zE.prototype.add = zE.prototype.push = CA, zE.prototype.has = IA;
      function rE(Vs) {
        var $l = this.__data__ = new hE(Vs);
        this.size = $l.size;
      }
      function PA() {
        this.__data__ = new hE(), this.size = 0;
      }
      function OA(Vs) {
        var $l = this.__data__, Du = $l.delete(Vs);
        return this.size = $l.size, Du;
      }
      function DA(Vs) {
        return this.__data__.get(Vs);
      }
      function AA(Vs) {
        return this.__data__.has(Vs);
      }
      function TA(Vs, $l) {
        var Du = this.__data__;
        if (Du instanceof hE) {
          var om = Du.__data__;
          if (!dM || om.length < Sn - 1)
            return om.push([Vs, $l]), this.size = ++Du.size, this;
          Du = this.__data__ = new gE(om);
        }
        return Du.set(Vs, $l), this.size = Du.size, this;
      }
      rE.prototype.clear = PA, rE.prototype.delete = OA, rE.prototype.get = DA, rE.prototype.has = AA, rE.prototype.set = TA;
      function hP(Vs, $l) {
        var Du = C$(Vs), om = !Du && VE(Vs), vm = !Du && !om && NE(Vs), bm = !Du && !om && !vm && aM(Vs), xm = Du || om || vm || bm, Em = xm ? DC(Vs.length, F2) : [], Tm = Em.length;
        for (var e$ in Vs)
          ($l || W$.call(Vs, e$)) && !(xm && // Safari 9 has enumerable `arguments.length` in strict mode.
          (e$ == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
          vm && (e$ == "offset" || e$ == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
          bm && (e$ == "buffer" || e$ == "byteLength" || e$ == "byteOffset") || // Skip index properties.
          _E(e$, Tm))) && Em.push(e$);
        return Em;
      }
      function gP(Vs) {
        var $l = Vs.length;
        return $l ? Vs[qC(0, $l - 1)] : Zt;
      }
      function NA(Vs, $l) {
        return oC(DS(Vs), FE($l, 0, Vs.length));
      }
      function RA(Vs) {
        return oC(DS(Vs));
      }
      function jC(Vs, $l, Du) {
        (Du !== Zt && !iE(Vs[$l], Du) || Du === Zt && !($l in Vs)) && mE(Vs, $l, Du);
      }
      function gM(Vs, $l, Du) {
        var om = Vs[$l];
        (!(W$.call(Vs, $l) && iE(om, Du)) || Du === Zt && !($l in Vs)) && mE(Vs, $l, Du);
      }
      function GM(Vs, $l) {
        for (var Du = Vs.length; Du--; )
          if (iE(Vs[Du][0], $l))
            return Du;
        return -1;
      }
      function LA(Vs, $l, Du, om) {
        return OE(Vs, function(vm, bm, xm) {
          $l(om, vm, Du(vm), xm);
        }), om;
      }
      function mP(Vs, $l) {
        return Vs && uE($l, mS($l), Vs);
      }
      function kA(Vs, $l) {
        return Vs && uE($l, TS($l), Vs);
      }
      function mE(Vs, $l, Du) {
        $l == "__proto__" && FM ? FM(Vs, $l, {
          configurable: !0,
          enumerable: !0,
          value: Du,
          writable: !0
        }) : Vs[$l] = Du;
      }
      function zC(Vs, $l) {
        for (var Du = -1, om = $l.length, vm = Lm(om), bm = Vs == null; ++Du < om; )
          vm[Du] = bm ? Zt : _I(Vs, $l[Du]);
        return vm;
      }
      function FE(Vs, $l, Du) {
        return Vs === Vs && (Du !== Zt && (Vs = Vs <= Du ? Vs : Du), $l !== Zt && (Vs = Vs >= $l ? Vs : $l)), Vs;
      }
      function QS(Vs, $l, Du, om, vm, bm) {
        var xm, Em = $l & Ms, Tm = $l & Ds, e$ = $l & Ls;
        if (Du && (xm = vm ? Du(Vs, om, vm, bm) : Du(Vs)), xm !== Zt)
          return xm;
        if (!eS(Vs))
          return Vs;
        var t$ = C$(Vs);
        if (t$) {
          if (xm = MT(Vs), !Em)
            return DS(Vs, xm);
        } else {
          var r$ = SS(Vs), c$ = r$ == Pm || r$ == i$;
          if (NE(Vs))
            return FP(Vs, Em);
          if (r$ == d$ || r$ == Im || c$ && !vm) {
            if (xm = Tm || c$ ? {} : _O(Vs), !Em)
              return Tm ? hT(Vs, kA(xm, Vs)) : pT(Vs, mP(xm, Vs));
          } else {
            if (!K$[r$])
              return vm ? Vs : {};
            xm = CT(Vs, r$, Em);
          }
        }
        bm || (bm = new rE());
        var y$ = bm.get(Vs);
        if (y$)
          return y$;
        bm.set(Vs, xm), _D(Vs) ? Vs.forEach(function(x$) {
          xm.add(QS(x$, $l, Du, x$, Vs, bm));
        }) : yD(Vs) && Vs.forEach(function(x$, T$) {
          xm.set(T$, QS(x$, $l, Du, T$, Vs, bm));
        });
        var w$ = e$ ? Tm ? oI : iI : Tm ? TS : mS, P$ = t$ ? Zt : w$(Vs);
        return YS(P$ || Vs, function(x$, T$) {
          P$ && (T$ = x$, x$ = Vs[T$]), gM(xm, T$, QS(x$, $l, Du, T$, Vs, bm));
        }), xm;
      }
      function jA(Vs) {
        var $l = mS(Vs);
        return function(Du) {
          return yP(Du, Vs, $l);
        };
      }
      function yP(Vs, $l, Du) {
        var om = Du.length;
        if (Vs == null)
          return !om;
        for (Vs = q$(Vs); om--; ) {
          var vm = Du[om], bm = $l[vm], xm = Vs[vm];
          if (xm === Zt && !(vm in Vs) || !bm(xm))
            return !1;
        }
        return !0;
      }
      function vP(Vs, $l, Du) {
        if (typeof Vs != "function")
          throw new qS(Kn);
        return SM(function() {
          Vs.apply(Zt, Du);
        }, $l);
      }
      function mM(Vs, $l, Du, om) {
        var vm = -1, bm = PM, xm = !0, Em = Vs.length, Tm = [], e$ = $l.length;
        if (!Em)
          return Tm;
        Du && ($l = J$($l, jS(Du))), om ? (bm = EC, xm = !1) : $l.length >= Sn && (bm = cM, xm = !1, $l = new zE($l));
        e:
          for (; ++vm < Em; ) {
            var t$ = Vs[vm], r$ = Du == null ? t$ : Du(t$);
            if (t$ = om || t$ !== 0 ? t$ : 0, xm && r$ === r$) {
              for (var c$ = e$; c$--; )
                if ($l[c$] === r$)
                  continue e;
              Tm.push(t$);
            } else
              bm($l, r$, om) || Tm.push(t$);
          }
        return Tm;
      }
      var OE = WP(cE), _P = WP(BC, !0);
      function zA(Vs, $l) {
        var Du = !0;
        return OE(Vs, function(om, vm, bm) {
          return Du = !!$l(om, vm, bm), Du;
        }), Du;
      }
      function YM(Vs, $l, Du) {
        for (var om = -1, vm = Vs.length; ++om < vm; ) {
          var bm = Vs[om], xm = $l(bm);
          if (xm != null && (Em === Zt ? xm === xm && !FS(xm) : Du(xm, Em)))
            var Em = xm, Tm = bm;
        }
        return Tm;
      }
      function FA(Vs, $l, Du, om) {
        var vm = Vs.length;
        for (Du = I$(Du), Du < 0 && (Du = -Du > vm ? 0 : vm + Du), om = om === Zt || om > vm ? vm : I$(om), om < 0 && (om += vm), om = Du > om ? 0 : bD(om); Du < om; )
          Vs[Du++] = $l;
        return Vs;
      }
      function $P(Vs, $l) {
        var Du = [];
        return OE(Vs, function(om, vm, bm) {
          $l(om, vm, bm) && Du.push(om);
        }), Du;
      }
      function _S(Vs, $l, Du, om, vm) {
        var bm = -1, xm = Vs.length;
        for (Du || (Du = PT), vm || (vm = []); ++bm < xm; ) {
          var Em = Vs[bm];
          $l > 0 && Du(Em) ? $l > 1 ? _S(Em, $l - 1, Du, om, vm) : CE(vm, Em) : om || (vm[vm.length] = Em);
        }
        return vm;
      }
      var FC = GP(), bP = GP(!0);
      function cE(Vs, $l) {
        return Vs && FC(Vs, $l, mS);
      }
      function BC(Vs, $l) {
        return Vs && bP(Vs, $l, mS);
      }
      function qM(Vs, $l) {
        return ME($l, function(Du) {
          return $E(Vs[Du]);
        });
      }
      function BE(Vs, $l) {
        $l = AE($l, Vs);
        for (var Du = 0, om = $l.length; Vs != null && Du < om; )
          Vs = Vs[dE($l[Du++])];
        return Du && Du == om ? Vs : Zt;
      }
      function SP(Vs, $l, Du) {
        var om = $l(Vs);
        return C$(Vs) ? om : CE(om, Du(Vs));
      }
      function xS(Vs) {
        return Vs == null ? Vs === Zt ? n$ : h$ : kE && kE in q$(Vs) ? wT(Vs) : LT(Vs);
      }
      function UC(Vs, $l) {
        return Vs > $l;
      }
      function BA(Vs, $l) {
        return Vs != null && W$.call(Vs, $l);
      }
      function UA(Vs, $l) {
        return Vs != null && $l in q$(Vs);
      }
      function HA(Vs, $l, Du) {
        return Vs >= bS($l, Du) && Vs < pS($l, Du);
      }
      function HC(Vs, $l, Du) {
        for (var om = Du ? EC : PM, vm = Vs[0].length, bm = Vs.length, xm = bm, Em = Lm(bm), Tm = 1 / 0, e$ = []; xm--; ) {
          var t$ = Vs[xm];
          xm && $l && (t$ = J$(t$, jS($l))), Tm = bS(t$.length, Tm), Em[xm] = !Du && ($l || vm >= 120 && t$.length >= 120) ? new zE(xm && t$) : Zt;
        }
        t$ = Vs[0];
        var r$ = -1, c$ = Em[0];
        e:
          for (; ++r$ < vm && e$.length < Tm; ) {
            var y$ = t$[r$], w$ = $l ? $l(y$) : y$;
            if (y$ = Du || y$ !== 0 ? y$ : 0, !(c$ ? cM(c$, w$) : om(e$, w$, Du))) {
              for (xm = bm; --xm; ) {
                var P$ = Em[xm];
                if (!(P$ ? cM(P$, w$) : om(Vs[xm], w$, Du)))
                  continue e;
              }
              c$ && c$.push(w$), e$.push(y$);
            }
          }
        return e$;
      }
      function VA(Vs, $l, Du, om) {
        return cE(Vs, function(vm, bm, xm) {
          $l(om, Du(vm), bm, xm);
        }), om;
      }
      function yM(Vs, $l, Du) {
        $l = AE($l, Vs), Vs = qO(Vs, $l);
        var om = Vs == null ? Vs : Vs[dE(XS($l))];
        return om == null ? Zt : kS(om, Vs, Du);
      }
      function wP(Vs) {
        return nS(Vs) && xS(Vs) == Im;
      }
      function WA(Vs) {
        return nS(Vs) && xS(Vs) == Q$;
      }
      function GA(Vs) {
        return nS(Vs) && xS(Vs) == Dm;
      }
      function vM(Vs, $l, Du, om, vm) {
        return Vs === $l ? !0 : Vs == null || $l == null || !nS(Vs) && !nS($l) ? Vs !== Vs && $l !== $l : YA(Vs, $l, Du, om, vM, vm);
      }
      function YA(Vs, $l, Du, om, vm, bm) {
        var xm = C$(Vs), Em = C$($l), Tm = xm ? Am : SS(Vs), e$ = Em ? Am : SS($l);
        Tm = Tm == Im ? d$ : Tm, e$ = e$ == Im ? d$ : e$;
        var t$ = Tm == d$, r$ = e$ == d$, c$ = Tm == e$;
        if (c$ && NE(Vs)) {
          if (!NE($l))
            return !1;
          xm = !0, t$ = !1;
        }
        if (c$ && !t$)
          return bm || (bm = new rE()), xm || aM(Vs) ? mO(Vs, $l, Du, om, vm, bm) : bT(Vs, $l, Tm, Du, om, vm, bm);
        if (!(Du & js)) {
          var y$ = t$ && W$.call(Vs, "__wrapped__"), w$ = r$ && W$.call($l, "__wrapped__");
          if (y$ || w$) {
            var P$ = y$ ? Vs.value() : Vs, x$ = w$ ? $l.value() : $l;
            return bm || (bm = new rE()), vm(P$, x$, Du, om, bm);
          }
        }
        return c$ ? (bm || (bm = new rE()), ST(Vs, $l, Du, om, vm, bm)) : !1;
      }
      function qA(Vs) {
        return nS(Vs) && SS(Vs) == o$;
      }
      function VC(Vs, $l, Du, om) {
        var vm = Du.length, bm = vm, xm = !om;
        if (Vs == null)
          return !bm;
        for (Vs = q$(Vs); vm--; ) {
          var Em = Du[vm];
          if (xm && Em[2] ? Em[1] !== Vs[Em[0]] : !(Em[0] in Vs))
            return !1;
        }
        for (; ++vm < bm; ) {
          Em = Du[vm];
          var Tm = Em[0], e$ = Vs[Tm], t$ = Em[1];
          if (xm && Em[2]) {
            if (e$ === Zt && !(Tm in Vs))
              return !1;
          } else {
            var r$ = new rE();
            if (om)
              var c$ = om(e$, t$, Tm, Vs, $l, r$);
            if (!(c$ === Zt ? vM(t$, e$, js | zs, om, r$) : c$))
              return !1;
          }
        }
        return !0;
      }
      function xP(Vs) {
        if (!eS(Vs) || DT(Vs))
          return !1;
        var $l = $E(Vs) ? W2 : xM;
        return $l.test(HE(Vs));
      }
      function KA(Vs) {
        return nS(Vs) && xS(Vs) == s$;
      }
      function QA(Vs) {
        return nS(Vs) && SS(Vs) == l$;
      }
      function ZA(Vs) {
        return nS(Vs) && dC(Vs.length) && !!X$[xS(Vs)];
      }
      function EP(Vs) {
        return typeof Vs == "function" ? Vs : Vs == null ? NS : typeof Vs == "object" ? C$(Vs) ? IP(Vs[0], Vs[1]) : CP(Vs) : TD(Vs);
      }
      function WC(Vs) {
        if (!bM(Vs))
          return eA(Vs);
        var $l = [];
        for (var Du in q$(Vs))
          W$.call(Vs, Du) && Du != "constructor" && $l.push(Du);
        return $l;
      }
      function XA(Vs) {
        if (!eS(Vs))
          return RT(Vs);
        var $l = bM(Vs), Du = [];
        for (var om in Vs)
          om == "constructor" && ($l || !W$.call(Vs, om)) || Du.push(om);
        return Du;
      }
      function GC(Vs, $l) {
        return Vs < $l;
      }
      function MP(Vs, $l) {
        var Du = -1, om = AS(Vs) ? Lm(Vs.length) : [];
        return OE(Vs, function(vm, bm, xm) {
          om[++Du] = $l(vm, bm, xm);
        }), om;
      }
      function CP(Vs) {
        var $l = sI(Vs);
        return $l.length == 1 && $l[0][2] ? UO($l[0][0], $l[0][1]) : function(Du) {
          return Du === Vs || VC(Du, Vs, $l);
        };
      }
      function IP(Vs, $l) {
        return cI(Vs) && wO($l) ? UO(dE(Vs), $l) : function(Du) {
          var om = _I(Du, Vs);
          return om === Zt && om === $l ? $I(Du, Vs) : vM($l, om, js | zs);
        };
      }
      function KM(Vs, $l, Du, om, vm) {
        Vs !== $l && FC($l, function(bm, xm) {
          if (vm || (vm = new rE()), eS(bm))
            JA(Vs, $l, xm, Du, KM, om, vm);
          else {
            var Em = om ? om(dI(Vs, xm), bm, xm + "", Vs, $l, vm) : Zt;
            Em === Zt && (Em = bm), jC(Vs, xm, Em);
          }
        }, TS);
      }
      function JA(Vs, $l, Du, om, vm, bm, xm) {
        var Em = dI(Vs, Du), Tm = dI($l, Du), e$ = xm.get(Tm);
        if (e$) {
          jC(Vs, Du, e$);
          return;
        }
        var t$ = bm ? bm(Em, Tm, Du + "", Vs, $l, xm) : Zt, r$ = t$ === Zt;
        if (r$) {
          var c$ = C$(Tm), y$ = !c$ && NE(Tm), w$ = !c$ && !y$ && aM(Tm);
          t$ = Tm, c$ || y$ || w$ ? C$(Em) ? t$ = Em : iS(Em) ? t$ = DS(Em) : y$ ? (r$ = !1, t$ = FP(Tm, !0)) : w$ ? (r$ = !1, t$ = BP(Tm, !0)) : t$ = [] : wM(Tm) || VE(Tm) ? (t$ = Em, VE(Em) ? t$ = SD(Em) : (!eS(Em) || $E(Em)) && (t$ = _O(Tm))) : r$ = !1;
        }
        r$ && (xm.set(Tm, t$), vm(t$, Tm, om, bm, xm), xm.delete(Tm)), jC(Vs, Du, t$);
      }
      function PP(Vs, $l) {
        var Du = Vs.length;
        if (Du)
          return $l += $l < 0 ? Du : 0, _E($l, Du) ? Vs[$l] : Zt;
      }
      function OP(Vs, $l, Du) {
        $l.length ? $l = J$($l, function(bm) {
          return C$(bm) ? function(xm) {
            return BE(xm, bm.length === 1 ? bm[0] : bm);
          } : bm;
        }) : $l = [NS];
        var om = -1;
        $l = J$($l, jS(S$()));
        var vm = MP(Vs, function(bm, xm, Em) {
          var Tm = J$($l, function(e$) {
            return e$(bm);
          });
          return { criteria: Tm, index: ++om, value: bm };
        });
        return b2(vm, function(bm, xm) {
          return fT(bm, xm, Du);
        });
      }
      function eT(Vs, $l) {
        return DP(Vs, $l, function(Du, om) {
          return $I(Vs, om);
        });
      }
      function DP(Vs, $l, Du) {
        for (var om = -1, vm = $l.length, bm = {}; ++om < vm; ) {
          var xm = $l[om], Em = BE(Vs, xm);
          Du(Em, xm) && _M(bm, AE(xm, Vs), Em);
        }
        return bm;
      }
      function tT(Vs) {
        return function($l) {
          return BE($l, Vs);
        };
      }
      function YC(Vs, $l, Du, om) {
        var vm = om ? $2 : KE, bm = -1, xm = $l.length, Em = Vs;
        for (Vs === $l && ($l = DS($l)), Du && (Em = J$(Vs, jS(Du))); ++bm < xm; )
          for (var Tm = 0, e$ = $l[bm], t$ = Du ? Du(e$) : e$; (Tm = vm(Em, t$, Tm, om)) > -1; )
            Em !== Vs && zM.call(Em, Tm, 1), zM.call(Vs, Tm, 1);
        return Vs;
      }
      function AP(Vs, $l) {
        for (var Du = Vs ? $l.length : 0, om = Du - 1; Du--; ) {
          var vm = $l[Du];
          if (Du == om || vm !== bm) {
            var bm = vm;
            _E(vm) ? zM.call(Vs, vm, 1) : ZC(Vs, vm);
          }
        }
        return Vs;
      }
      function qC(Vs, $l) {
        return Vs + UM(fP() * ($l - Vs + 1));
      }
      function nT(Vs, $l, Du, om) {
        for (var vm = -1, bm = pS(BM(($l - Vs) / (Du || 1)), 0), xm = Lm(bm); bm--; )
          xm[om ? bm : ++vm] = Vs, Vs += Du;
        return xm;
      }
      function KC(Vs, $l) {
        var Du = "";
        if (!Vs || $l < 1 || $l > hm)
          return Du;
        do
          $l % 2 && (Du += Vs), $l = UM($l / 2), $l && (Vs += Vs);
        while ($l);
        return Du;
      }
      function A$(Vs, $l) {
        return fI(GO(Vs, $l, NS), Vs + "");
      }
      function rT(Vs) {
        return gP(sM(Vs));
      }
      function iT(Vs, $l) {
        var Du = sM(Vs);
        return oC(Du, FE($l, 0, Du.length));
      }
      function _M(Vs, $l, Du, om) {
        if (!eS(Vs))
          return Vs;
        $l = AE($l, Vs);
        for (var vm = -1, bm = $l.length, xm = bm - 1, Em = Vs; Em != null && ++vm < bm; ) {
          var Tm = dE($l[vm]), e$ = Du;
          if (Tm === "__proto__" || Tm === "constructor" || Tm === "prototype")
            return Vs;
          if (vm != xm) {
            var t$ = Em[Tm];
            e$ = om ? om(t$, Tm, Em) : Zt, e$ === Zt && (e$ = eS(t$) ? t$ : _E($l[vm + 1]) ? [] : {});
          }
          gM(Em, Tm, e$), Em = Em[Tm];
        }
        return Vs;
      }
      var TP = HM ? function(Vs, $l) {
        return HM.set(Vs, $l), Vs;
      } : NS, oT = FM ? function(Vs, $l) {
        return FM(Vs, "toString", {
          configurable: !0,
          enumerable: !1,
          value: SI($l),
          writable: !0
        });
      } : NS;
      function aT(Vs) {
        return oC(sM(Vs));
      }
      function ZS(Vs, $l, Du) {
        var om = -1, vm = Vs.length;
        $l < 0 && ($l = -$l > vm ? 0 : vm + $l), Du = Du > vm ? vm : Du, Du < 0 && (Du += vm), vm = $l > Du ? 0 : Du - $l >>> 0, $l >>>= 0;
        for (var bm = Lm(vm); ++om < vm; )
          bm[om] = Vs[om + $l];
        return bm;
      }
      function sT(Vs, $l) {
        var Du;
        return OE(Vs, function(om, vm, bm) {
          return Du = $l(om, vm, bm), !Du;
        }), !!Du;
      }
      function QM(Vs, $l, Du) {
        var om = 0, vm = Vs == null ? om : Vs.length;
        if (typeof $l == "number" && $l === $l && vm <= Nm) {
          for (; om < vm; ) {
            var bm = om + vm >>> 1, xm = Vs[bm];
            xm !== null && !FS(xm) && (Du ? xm <= $l : xm < $l) ? om = bm + 1 : vm = bm;
          }
          return vm;
        }
        return QC(Vs, $l, NS, Du);
      }
      function QC(Vs, $l, Du, om) {
        var vm = 0, bm = Vs == null ? 0 : Vs.length;
        if (bm === 0)
          return 0;
        $l = Du($l);
        for (var xm = $l !== $l, Em = $l === null, Tm = FS($l), e$ = $l === Zt; vm < bm; ) {
          var t$ = UM((vm + bm) / 2), r$ = Du(Vs[t$]), c$ = r$ !== Zt, y$ = r$ === null, w$ = r$ === r$, P$ = FS(r$);
          if (xm)
            var x$ = om || w$;
          else
            e$ ? x$ = w$ && (om || c$) : Em ? x$ = w$ && c$ && (om || !y$) : Tm ? x$ = w$ && c$ && !y$ && (om || !P$) : y$ || P$ ? x$ = !1 : x$ = om ? r$ <= $l : r$ < $l;
          x$ ? vm = t$ + 1 : bm = t$;
        }
        return bS(bm, wm);
      }
      function NP(Vs, $l) {
        for (var Du = -1, om = Vs.length, vm = 0, bm = []; ++Du < om; ) {
          var xm = Vs[Du], Em = $l ? $l(xm) : xm;
          if (!Du || !iE(Em, Tm)) {
            var Tm = Em;
            bm[vm++] = xm === 0 ? 0 : xm;
          }
        }
        return bm;
      }
      function RP(Vs) {
        return typeof Vs == "number" ? Vs : FS(Vs) ? _m : +Vs;
      }
      function zS(Vs) {
        if (typeof Vs == "string")
          return Vs;
        if (C$(Vs))
          return J$(Vs, zS) + "";
        if (FS(Vs))
          return pP ? pP.call(Vs) : "";
        var $l = Vs + "";
        return $l == "0" && 1 / Vs == -mm ? "-0" : $l;
      }
      function DE(Vs, $l, Du) {
        var om = -1, vm = PM, bm = Vs.length, xm = !0, Em = [], Tm = Em;
        if (Du)
          xm = !1, vm = EC;
        else if (bm >= Sn) {
          var e$ = $l ? null : _T(Vs);
          if (e$)
            return DM(e$);
          xm = !1, vm = cM, Tm = new zE();
        } else
          Tm = $l ? [] : Em;
        e:
          for (; ++om < bm; ) {
            var t$ = Vs[om], r$ = $l ? $l(t$) : t$;
            if (t$ = Du || t$ !== 0 ? t$ : 0, xm && r$ === r$) {
              for (var c$ = Tm.length; c$--; )
                if (Tm[c$] === r$)
                  continue e;
              $l && Tm.push(r$), Em.push(t$);
            } else
              vm(Tm, r$, Du) || (Tm !== Em && Tm.push(r$), Em.push(t$));
          }
        return Em;
      }
      function ZC(Vs, $l) {
        return $l = AE($l, Vs), Vs = qO(Vs, $l), Vs == null || delete Vs[dE(XS($l))];
      }
      function LP(Vs, $l, Du, om) {
        return _M(Vs, $l, Du(BE(Vs, $l)), om);
      }
      function ZM(Vs, $l, Du, om) {
        for (var vm = Vs.length, bm = om ? vm : -1; (om ? bm-- : ++bm < vm) && $l(Vs[bm], bm, Vs); )
          ;
        return Du ? ZS(Vs, om ? 0 : bm, om ? bm + 1 : vm) : ZS(Vs, om ? bm + 1 : 0, om ? vm : bm);
      }
      function kP(Vs, $l) {
        var Du = Vs;
        return Du instanceof N$ && (Du = Du.value()), MC($l, function(om, vm) {
          return vm.func.apply(vm.thisArg, CE([om], vm.args));
        }, Du);
      }
      function XC(Vs, $l, Du) {
        var om = Vs.length;
        if (om < 2)
          return om ? DE(Vs[0]) : [];
        for (var vm = -1, bm = Lm(om); ++vm < om; )
          for (var xm = Vs[vm], Em = -1; ++Em < om; )
            Em != vm && (bm[vm] = mM(bm[vm] || xm, Vs[Em], $l, Du));
        return DE(_S(bm, 1), $l, Du);
      }
      function jP(Vs, $l, Du) {
        for (var om = -1, vm = Vs.length, bm = $l.length, xm = {}; ++om < vm; ) {
          var Em = om < bm ? $l[om] : Zt;
          Du(xm, Vs[om], Em);
        }
        return xm;
      }
      function JC(Vs) {
        return iS(Vs) ? Vs : [];
      }
      function eI(Vs) {
        return typeof Vs == "function" ? Vs : NS;
      }
      function AE(Vs, $l) {
        return C$(Vs) ? Vs : cI(Vs, $l) ? [Vs] : XO(H$(Vs));
      }
      var lT = A$;
      function TE(Vs, $l, Du) {
        var om = Vs.length;
        return Du = Du === Zt ? om : Du, !$l && Du >= om ? Vs : ZS(Vs, $l, Du);
      }
      var zP = G2 || function(Vs) {
        return vS.clearTimeout(Vs);
      };
      function FP(Vs, $l) {
        if ($l)
          return Vs.slice();
        var Du = Vs.length, om = sP ? sP(Du) : new Vs.constructor(Du);
        return Vs.copy(om), om;
      }
      function tI(Vs) {
        var $l = new Vs.constructor(Vs.byteLength);
        return new kM($l).set(new kM(Vs)), $l;
      }
      function cT(Vs, $l) {
        var Du = $l ? tI(Vs.buffer) : Vs.buffer;
        return new Vs.constructor(Du, Vs.byteOffset, Vs.byteLength);
      }
      function uT(Vs) {
        var $l = new Vs.constructor(Vs.source, D$.exec(Vs));
        return $l.lastIndex = Vs.lastIndex, $l;
      }
      function dT(Vs) {
        return hM ? q$(hM.call(Vs)) : {};
      }
      function BP(Vs, $l) {
        var Du = $l ? tI(Vs.buffer) : Vs.buffer;
        return new Vs.constructor(Du, Vs.byteOffset, Vs.length);
      }
      function UP(Vs, $l) {
        if (Vs !== $l) {
          var Du = Vs !== Zt, om = Vs === null, vm = Vs === Vs, bm = FS(Vs), xm = $l !== Zt, Em = $l === null, Tm = $l === $l, e$ = FS($l);
          if (!Em && !e$ && !bm && Vs > $l || bm && xm && Tm && !Em && !e$ || om && xm && Tm || !Du && Tm || !vm)
            return 1;
          if (!om && !bm && !e$ && Vs < $l || e$ && Du && vm && !om && !bm || Em && Du && vm || !xm && vm || !Tm)
            return -1;
        }
        return 0;
      }
      function fT(Vs, $l, Du) {
        for (var om = -1, vm = Vs.criteria, bm = $l.criteria, xm = vm.length, Em = Du.length; ++om < xm; ) {
          var Tm = UP(vm[om], bm[om]);
          if (Tm) {
            if (om >= Em)
              return Tm;
            var e$ = Du[om];
            return Tm * (e$ == "desc" ? -1 : 1);
          }
        }
        return Vs.index - $l.index;
      }
      function HP(Vs, $l, Du, om) {
        for (var vm = -1, bm = Vs.length, xm = Du.length, Em = -1, Tm = $l.length, e$ = pS(bm - xm, 0), t$ = Lm(Tm + e$), r$ = !om; ++Em < Tm; )
          t$[Em] = $l[Em];
        for (; ++vm < xm; )
          (r$ || vm < bm) && (t$[Du[vm]] = Vs[vm]);
        for (; e$--; )
          t$[Em++] = Vs[vm++];
        return t$;
      }
      function VP(Vs, $l, Du, om) {
        for (var vm = -1, bm = Vs.length, xm = -1, Em = Du.length, Tm = -1, e$ = $l.length, t$ = pS(bm - Em, 0), r$ = Lm(t$ + e$), c$ = !om; ++vm < t$; )
          r$[vm] = Vs[vm];
        for (var y$ = vm; ++Tm < e$; )
          r$[y$ + Tm] = $l[Tm];
        for (; ++xm < Em; )
          (c$ || vm < bm) && (r$[y$ + Du[xm]] = Vs[vm++]);
        return r$;
      }
      function DS(Vs, $l) {
        var Du = -1, om = Vs.length;
        for ($l || ($l = Lm(om)); ++Du < om; )
          $l[Du] = Vs[Du];
        return $l;
      }
      function uE(Vs, $l, Du, om) {
        var vm = !Du;
        Du || (Du = {});
        for (var bm = -1, xm = $l.length; ++bm < xm; ) {
          var Em = $l[bm], Tm = om ? om(Du[Em], Vs[Em], Em, Du, Vs) : Zt;
          Tm === Zt && (Tm = Vs[Em]), vm ? mE(Du, Em, Tm) : gM(Du, Em, Tm);
        }
        return Du;
      }
      function pT(Vs, $l) {
        return uE(Vs, lI(Vs), $l);
      }
      function hT(Vs, $l) {
        return uE(Vs, yO(Vs), $l);
      }
      function XM(Vs, $l) {
        return function(Du, om) {
          var vm = C$(Du) ? h2 : LA, bm = $l ? $l() : {};
          return vm(Du, Vs, S$(om, 2), bm);
        };
      }
      function rM(Vs) {
        return A$(function($l, Du) {
          var om = -1, vm = Du.length, bm = vm > 1 ? Du[vm - 1] : Zt, xm = vm > 2 ? Du[2] : Zt;
          for (bm = Vs.length > 3 && typeof bm == "function" ? (vm--, bm) : Zt, xm && ES(Du[0], Du[1], xm) && (bm = vm < 3 ? Zt : bm, vm = 1), $l = q$($l); ++om < vm; ) {
            var Em = Du[om];
            Em && Vs($l, Em, om, bm);
          }
          return $l;
        });
      }
      function WP(Vs, $l) {
        return function(Du, om) {
          if (Du == null)
            return Du;
          if (!AS(Du))
            return Vs(Du, om);
          for (var vm = Du.length, bm = $l ? vm : -1, xm = q$(Du); ($l ? bm-- : ++bm < vm) && om(xm[bm], bm, xm) !== !1; )
            ;
          return Du;
        };
      }
      function GP(Vs) {
        return function($l, Du, om) {
          for (var vm = -1, bm = q$($l), xm = om($l), Em = xm.length; Em--; ) {
            var Tm = xm[Vs ? Em : ++vm];
            if (Du(bm[Tm], Tm, bm) === !1)
              break;
          }
          return $l;
        };
      }
      function mT(Vs, $l, Du) {
        var om = $l & Fs, vm = $M(Vs);
        function bm() {
          var xm = this && this !== vS && this instanceof bm ? vm : Vs;
          return xm.apply(om ? Du : this, arguments);
        }
        return bm;
      }
      function YP(Vs) {
        return function($l) {
          $l = H$($l);
          var Du = QE($l) ? nE($l) : Zt, om = Du ? Du[0] : $l.charAt(0), vm = Du ? TE(Du, 1).join("") : $l.slice(1);
          return om[Vs]() + vm;
        };
      }
      function iM(Vs) {
        return function($l) {
          return MC(DD(OD($l).replace(XD, "")), Vs, "");
        };
      }
      function $M(Vs) {
        return function() {
          var $l = arguments;
          switch ($l.length) {
            case 0:
              return new Vs();
            case 1:
              return new Vs($l[0]);
            case 2:
              return new Vs($l[0], $l[1]);
            case 3:
              return new Vs($l[0], $l[1], $l[2]);
            case 4:
              return new Vs($l[0], $l[1], $l[2], $l[3]);
            case 5:
              return new Vs($l[0], $l[1], $l[2], $l[3], $l[4]);
            case 6:
              return new Vs($l[0], $l[1], $l[2], $l[3], $l[4], $l[5]);
            case 7:
              return new Vs($l[0], $l[1], $l[2], $l[3], $l[4], $l[5], $l[6]);
          }
          var Du = nM(Vs.prototype), om = Vs.apply(Du, $l);
          return eS(om) ? om : Du;
        };
      }
      function yT(Vs, $l, Du) {
        var om = $M(Vs);
        function vm() {
          for (var bm = arguments.length, xm = Lm(bm), Em = bm, Tm = oM(vm); Em--; )
            xm[Em] = arguments[Em];
          var e$ = bm < 3 && xm[0] !== Tm && xm[bm - 1] !== Tm ? [] : IE(xm, Tm);
          if (bm -= e$.length, bm < Du)
            return XP(
              Vs,
              $l,
              JM,
              vm.placeholder,
              Zt,
              xm,
              e$,
              Zt,
              Zt,
              Du - bm
            );
          var t$ = this && this !== vS && this instanceof vm ? om : Vs;
          return kS(t$, this, xm);
        }
        return vm;
      }
      function qP(Vs) {
        return function($l, Du, om) {
          var vm = q$($l);
          if (!AS($l)) {
            var bm = S$(Du, 3);
            $l = mS($l), Du = function(Em) {
              return bm(vm[Em], Em, vm);
            };
          }
          var xm = Vs($l, Du, om);
          return xm > -1 ? vm[bm ? $l[xm] : xm] : Zt;
        };
      }
      function KP(Vs) {
        return vE(function($l) {
          var Du = $l.length, om = Du, vm = KS.prototype.thru;
          for (Vs && $l.reverse(); om--; ) {
            var bm = $l[om];
            if (typeof bm != "function")
              throw new qS(Kn);
            if (vm && !xm && rC(bm) == "wrapper")
              var xm = new KS([], !0);
          }
          for (om = xm ? om : Du; ++om < Du; ) {
            bm = $l[om];
            var Em = rC(bm), Tm = Em == "wrapper" ? aI(bm) : Zt;
            Tm && uI(Tm[0]) && Tm[1] == (Pl | Ws | El | Iu) && !Tm[4].length && Tm[9] == 1 ? xm = xm[rC(Tm[0])].apply(xm, Tm[3]) : xm = bm.length == 1 && uI(bm) ? xm[Em]() : xm.thru(bm);
          }
          return function() {
            var e$ = arguments, t$ = e$[0];
            if (xm && e$.length == 1 && C$(t$))
              return xm.plant(t$).value();
            for (var r$ = 0, c$ = Du ? $l[r$].apply(this, e$) : t$; ++r$ < Du; )
              c$ = $l[r$].call(this, c$);
            return c$;
          };
        });
      }
      function JM(Vs, $l, Du, om, vm, bm, xm, Em, Tm, e$) {
        var t$ = $l & Pl, r$ = $l & Fs, c$ = $l & Bs, y$ = $l & (Ws | Ys), w$ = $l & Tu, P$ = c$ ? Zt : $M(Vs);
        function x$() {
          for (var T$ = arguments.length, L$ = Lm(T$), BS = T$; BS--; )
            L$[BS] = arguments[BS];
          if (y$)
            var CS = oM(x$), US = w2(L$, CS);
          if (om && (L$ = HP(L$, om, vm, y$)), bm && (L$ = VP(L$, bm, xm, y$)), T$ -= US, y$ && T$ < e$) {
            var oS = IE(L$, CS);
            return XP(
              Vs,
              $l,
              JM,
              x$.placeholder,
              Du,
              L$,
              oS,
              Em,
              Tm,
              e$ - T$
            );
          }
          var oE = r$ ? Du : this, SE = c$ ? oE[Vs] : Vs;
          return T$ = L$.length, Em ? L$ = kT(L$, Em) : w$ && T$ > 1 && L$.reverse(), t$ && Tm < T$ && (L$.length = Tm), this && this !== vS && this instanceof x$ && (SE = P$ || $M(SE)), SE.apply(oE, L$);
        }
        return x$;
      }
      function QP(Vs, $l) {
        return function(Du, om) {
          return VA(Du, Vs, $l(om), {});
        };
      }
      function eC(Vs, $l) {
        return function(Du, om) {
          var vm;
          if (Du === Zt && om === Zt)
            return $l;
          if (Du !== Zt && (vm = Du), om !== Zt) {
            if (vm === Zt)
              return om;
            typeof Du == "string" || typeof om == "string" ? (Du = zS(Du), om = zS(om)) : (Du = RP(Du), om = RP(om)), vm = Vs(Du, om);
          }
          return vm;
        };
      }
      function nI(Vs) {
        return vE(function($l) {
          return $l = J$($l, jS(S$())), A$(function(Du) {
            var om = this;
            return Vs($l, function(vm) {
              return kS(vm, om, Du);
            });
          });
        });
      }
      function tC(Vs, $l) {
        $l = $l === Zt ? " " : zS($l);
        var Du = $l.length;
        if (Du < 2)
          return Du ? KC($l, Vs) : $l;
        var om = KC($l, BM(Vs / ZE($l)));
        return QE($l) ? TE(nE(om), 0, Vs).join("") : om.slice(0, Vs);
      }
      function vT(Vs, $l, Du, om) {
        var vm = $l & Fs, bm = $M(Vs);
        function xm() {
          for (var Em = -1, Tm = arguments.length, e$ = -1, t$ = om.length, r$ = Lm(t$ + Tm), c$ = this && this !== vS && this instanceof xm ? bm : Vs; ++e$ < t$; )
            r$[e$] = om[e$];
          for (; Tm--; )
            r$[e$++] = arguments[++Em];
          return kS(c$, vm ? Du : this, r$);
        }
        return xm;
      }
      function ZP(Vs) {
        return function($l, Du, om) {
          return om && typeof om != "number" && ES($l, Du, om) && (Du = om = Zt), $l = bE($l), Du === Zt ? (Du = $l, $l = 0) : Du = bE(Du), om = om === Zt ? $l < Du ? 1 : -1 : bE(om), nT($l, Du, om, Vs);
        };
      }
      function nC(Vs) {
        return function($l, Du) {
          return typeof $l == "string" && typeof Du == "string" || ($l = JS($l), Du = JS(Du)), Vs($l, Du);
        };
      }
      function XP(Vs, $l, Du, om, vm, bm, xm, Em, Tm, e$) {
        var t$ = $l & Ws, r$ = t$ ? xm : Zt, c$ = t$ ? Zt : xm, y$ = t$ ? bm : Zt, w$ = t$ ? Zt : bm;
        $l |= t$ ? El : Mu, $l &= ~(t$ ? Mu : El), $l & Hs || ($l &= ~(Fs | Bs));
        var P$ = [
          Vs,
          $l,
          vm,
          y$,
          r$,
          w$,
          c$,
          Em,
          Tm,
          e$
        ], x$ = Du.apply(Zt, P$);
        return uI(Vs) && KO(x$, P$), x$.placeholder = om, QO(x$, Vs, $l);
      }
      function rI(Vs) {
        var $l = fS[Vs];
        return function(Du, om) {
          if (Du = JS(Du), om = om == null ? 0 : bS(I$(om), 292), om && dP(Du)) {
            var vm = (H$(Du) + "e").split("e"), bm = $l(vm[0] + "e" + (+vm[1] + om));
            return vm = (H$(bm) + "e").split("e"), +(vm[0] + "e" + (+vm[1] - om));
          }
          return $l(Du);
        };
      }
      var _T = eM && 1 / DM(new eM([, -0]))[1] == mm ? function(Vs) {
        return new eM(Vs);
      } : EI;
      function JP(Vs) {
        return function($l) {
          var Du = SS($l);
          return Du == o$ ? TC($l) : Du == l$ ? D2($l) : S2($l, Vs($l));
        };
      }
      function yE(Vs, $l, Du, om, vm, bm, xm, Em) {
        var Tm = $l & Bs;
        if (!Tm && typeof Vs != "function")
          throw new qS(Kn);
        var e$ = om ? om.length : 0;
        if (e$ || ($l &= ~(El | Mu), om = vm = Zt), xm = xm === Zt ? xm : pS(I$(xm), 0), Em = Em === Zt ? Em : I$(Em), e$ -= vm ? vm.length : 0, $l & Mu) {
          var t$ = om, r$ = vm;
          om = vm = Zt;
        }
        var c$ = Tm ? Zt : aI(Vs), y$ = [
          Vs,
          $l,
          Du,
          om,
          vm,
          t$,
          r$,
          bm,
          xm,
          Em
        ];
        if (c$ && NT(y$, c$), Vs = y$[0], $l = y$[1], Du = y$[2], om = y$[3], vm = y$[4], Em = y$[9] = y$[9] === Zt ? Tm ? 0 : Vs.length : pS(y$[9] - e$, 0), !Em && $l & (Ws | Ys) && ($l &= ~(Ws | Ys)), !$l || $l == Fs)
          var w$ = mT(Vs, $l, Du);
        else
          $l == Ws || $l == Ys ? w$ = yT(Vs, $l, Em) : ($l == El || $l == (Fs | El)) && !vm.length ? w$ = vT(Vs, $l, Du, om) : w$ = JM.apply(Zt, y$);
        var P$ = c$ ? TP : KO;
        return QO(P$(w$, y$), Vs, $l);
      }
      function hO(Vs, $l, Du, om) {
        return Vs === Zt || iE(Vs, JE[Du]) && !W$.call(om, Du) ? $l : Vs;
      }
      function gO(Vs, $l, Du, om, vm, bm) {
        return eS(Vs) && eS($l) && (bm.set($l, Vs), KM(Vs, $l, Zt, gO, bm), bm.delete($l)), Vs;
      }
      function $T(Vs) {
        return wM(Vs) ? Zt : Vs;
      }
      function mO(Vs, $l, Du, om, vm, bm) {
        var xm = Du & js, Em = Vs.length, Tm = $l.length;
        if (Em != Tm && !(xm && Tm > Em))
          return !1;
        var e$ = bm.get(Vs), t$ = bm.get($l);
        if (e$ && t$)
          return e$ == $l && t$ == Vs;
        var r$ = -1, c$ = !0, y$ = Du & zs ? new zE() : Zt;
        for (bm.set(Vs, $l), bm.set($l, Vs); ++r$ < Em; ) {
          var w$ = Vs[r$], P$ = $l[r$];
          if (om)
            var x$ = xm ? om(P$, w$, r$, $l, Vs, bm) : om(w$, P$, r$, Vs, $l, bm);
          if (x$ !== Zt) {
            if (x$)
              continue;
            c$ = !1;
            break;
          }
          if (y$) {
            if (!CC($l, function(T$, L$) {
              if (!cM(y$, L$) && (w$ === T$ || vm(w$, T$, Du, om, bm)))
                return y$.push(L$);
            })) {
              c$ = !1;
              break;
            }
          } else if (!(w$ === P$ || vm(w$, P$, Du, om, bm))) {
            c$ = !1;
            break;
          }
        }
        return bm.delete(Vs), bm.delete($l), c$;
      }
      function bT(Vs, $l, Du, om, vm, bm, xm) {
        switch (Du) {
          case z$:
            if (Vs.byteLength != $l.byteLength || Vs.byteOffset != $l.byteOffset)
              return !1;
            Vs = Vs.buffer, $l = $l.buffer;
          case Q$:
            return !(Vs.byteLength != $l.byteLength || !bm(new kM(Vs), new kM($l)));
          case Rm:
          case Dm:
          case u$:
            return iE(+Vs, +$l);
          case zm:
            return Vs.name == $l.name && Vs.message == $l.message;
          case s$:
          case _$:
            return Vs == $l + "";
          case o$:
            var Em = TC;
          case l$:
            var Tm = om & js;
            if (Em || (Em = DM), Vs.size != $l.size && !Tm)
              return !1;
            var e$ = xm.get(Vs);
            if (e$)
              return e$ == $l;
            om |= zs, xm.set(Vs, $l);
            var t$ = mO(Em(Vs), Em($l), om, vm, bm, xm);
            return xm.delete(Vs), t$;
          case a$:
            if (hM)
              return hM.call(Vs) == hM.call($l);
        }
        return !1;
      }
      function ST(Vs, $l, Du, om, vm, bm) {
        var xm = Du & js, Em = iI(Vs), Tm = Em.length, e$ = iI($l), t$ = e$.length;
        if (Tm != t$ && !xm)
          return !1;
        for (var r$ = Tm; r$--; ) {
          var c$ = Em[r$];
          if (!(xm ? c$ in $l : W$.call($l, c$)))
            return !1;
        }
        var y$ = bm.get(Vs), w$ = bm.get($l);
        if (y$ && w$)
          return y$ == $l && w$ == Vs;
        var P$ = !0;
        bm.set(Vs, $l), bm.set($l, Vs);
        for (var x$ = xm; ++r$ < Tm; ) {
          c$ = Em[r$];
          var T$ = Vs[c$], L$ = $l[c$];
          if (om)
            var BS = xm ? om(L$, T$, c$, $l, Vs, bm) : om(T$, L$, c$, Vs, $l, bm);
          if (!(BS === Zt ? T$ === L$ || vm(T$, L$, Du, om, bm) : BS)) {
            P$ = !1;
            break;
          }
          x$ || (x$ = c$ == "constructor");
        }
        if (P$ && !x$) {
          var CS = Vs.constructor, US = $l.constructor;
          CS != US && "constructor" in Vs && "constructor" in $l && !(typeof CS == "function" && CS instanceof CS && typeof US == "function" && US instanceof US) && (P$ = !1);
        }
        return bm.delete(Vs), bm.delete($l), P$;
      }
      function vE(Vs) {
        return fI(GO(Vs, Zt, nD), Vs + "");
      }
      function iI(Vs) {
        return SP(Vs, mS, lI);
      }
      function oI(Vs) {
        return SP(Vs, TS, yO);
      }
      var aI = HM ? function(Vs) {
        return HM.get(Vs);
      } : EI;
      function rC(Vs) {
        for (var $l = Vs.name + "", Du = tM[$l], om = W$.call(tM, $l) ? Du.length : 0; om--; ) {
          var vm = Du[om], bm = vm.func;
          if (bm == null || bm == Vs)
            return vm.name;
        }
        return $l;
      }
      function oM(Vs) {
        var $l = W$.call($m, "placeholder") ? $m : Vs;
        return $l.placeholder;
      }
      function S$() {
        var Vs = $m.iteratee || wI;
        return Vs = Vs === wI ? EP : Vs, arguments.length ? Vs(arguments[0], arguments[1]) : Vs;
      }
      function iC(Vs, $l) {
        var Du = Vs.__data__;
        return OT($l) ? Du[typeof $l == "string" ? "string" : "hash"] : Du.map;
      }
      function sI(Vs) {
        for (var $l = mS(Vs), Du = $l.length; Du--; ) {
          var om = $l[Du], vm = Vs[om];
          $l[Du] = [om, vm, wO(vm)];
        }
        return $l;
      }
      function UE(Vs, $l) {
        var Du = I2(Vs, $l);
        return xP(Du) ? Du : Zt;
      }
      function wT(Vs) {
        var $l = W$.call(Vs, kE), Du = Vs[kE];
        try {
          Vs[kE] = Zt;
          var om = !0;
        } catch {
        }
        var vm = RM.call(Vs);
        return om && ($l ? Vs[kE] = Du : delete Vs[kE]), vm;
      }
      var lI = RC ? function(Vs) {
        return Vs == null ? [] : (Vs = q$(Vs), ME(RC(Vs), function($l) {
          return cP.call(Vs, $l);
        }));
      } : MI, yO = RC ? function(Vs) {
        for (var $l = []; Vs; )
          CE($l, lI(Vs)), Vs = jM(Vs);
        return $l;
      } : MI, SS = xS;
      (LC && SS(new LC(new ArrayBuffer(1))) != z$ || dM && SS(new dM()) != o$ || kC && SS(kC.resolve()) != v$ || eM && SS(new eM()) != l$ || fM && SS(new fM()) != m$) && (SS = function(Vs) {
        var $l = xS(Vs), Du = $l == d$ ? Vs.constructor : Zt, om = Du ? HE(Du) : "";
        if (om)
          switch (om) {
            case iA:
              return z$;
            case oA:
              return o$;
            case aA:
              return v$;
            case sA:
              return l$;
            case lA:
              return m$;
          }
        return $l;
      });
      function xT(Vs, $l, Du) {
        for (var om = -1, vm = Du.length; ++om < vm; ) {
          var bm = Du[om], xm = bm.size;
          switch (bm.type) {
            case "drop":
              Vs += xm;
              break;
            case "dropRight":
              $l -= xm;
              break;
            case "take":
              $l = bS($l, Vs + xm);
              break;
            case "takeRight":
              Vs = pS(Vs, $l - xm);
              break;
          }
        }
        return { start: Vs, end: $l };
      }
      function ET(Vs) {
        var $l = Vs.match(GE);
        return $l ? $l[1].split(lM) : [];
      }
      function vO(Vs, $l, Du) {
        $l = AE($l, Vs);
        for (var om = -1, vm = $l.length, bm = !1; ++om < vm; ) {
          var xm = dE($l[om]);
          if (!(bm = Vs != null && Du(Vs, xm)))
            break;
          Vs = Vs[xm];
        }
        return bm || ++om != vm ? bm : (vm = Vs == null ? 0 : Vs.length, !!vm && dC(vm) && _E(xm, vm) && (C$(Vs) || VE(Vs)));
      }
      function MT(Vs) {
        var $l = Vs.length, Du = new Vs.constructor($l);
        return $l && typeof Vs[0] == "string" && W$.call(Vs, "index") && (Du.index = Vs.index, Du.input = Vs.input), Du;
      }
      function _O(Vs) {
        return typeof Vs.constructor == "function" && !bM(Vs) ? nM(jM(Vs)) : {};
      }
      function CT(Vs, $l, Du) {
        var om = Vs.constructor;
        switch ($l) {
          case Q$:
            return tI(Vs);
          case Rm:
          case Dm:
            return new om(+Vs);
          case z$:
            return cT(Vs, Du);
          case wS:
          case aS:
          case cS:
          case $S:
          case B$:
          case IS:
          case RS:
          case eE:
          case rS:
            return BP(Vs, Du);
          case o$:
            return new om();
          case u$:
          case _$:
            return new om(Vs);
          case s$:
            return uT(Vs);
          case l$:
            return new om();
          case a$:
            return dT(Vs);
        }
      }
      function IT(Vs, $l) {
        var Du = $l.length;
        if (!Du)
          return Vs;
        var om = Du - 1;
        return $l[om] = (Du > 1 ? "& " : "") + $l[om], $l = $l.join(Du > 2 ? ", " : " "), Vs.replace(wE, `{
/* [wrapped with ` + $l + `] */
`);
      }
      function PT(Vs) {
        return C$(Vs) || VE(Vs) || !!(uP && Vs && Vs[uP]);
      }
      function _E(Vs, $l) {
        var Du = typeof Vs;
        return $l = $l ?? hm, !!$l && (Du == "number" || Du != "symbol" && gC.test(Vs)) && Vs > -1 && Vs % 1 == 0 && Vs < $l;
      }
      function ES(Vs, $l, Du) {
        if (!eS(Du))
          return !1;
        var om = typeof $l;
        return (om == "number" ? AS(Du) && _E($l, Du.length) : om == "string" && $l in Du) ? iE(Du[$l], Vs) : !1;
      }
      function cI(Vs, $l) {
        if (C$(Vs))
          return !1;
        var Du = typeof Vs;
        return Du == "number" || Du == "symbol" || Du == "boolean" || Vs == null || FS(Vs) ? !0 : U$.test(Vs) || !O$.test(Vs) || $l != null && Vs in q$($l);
      }
      function OT(Vs) {
        var $l = typeof Vs;
        return $l == "string" || $l == "number" || $l == "symbol" || $l == "boolean" ? Vs !== "__proto__" : Vs === null;
      }
      function uI(Vs) {
        var $l = rC(Vs), Du = $m[$l];
        if (typeof Du != "function" || !($l in N$.prototype))
          return !1;
        if (Vs === Du)
          return !0;
        var om = aI(Du);
        return !!om && Vs === om[0];
      }
      function DT(Vs) {
        return !!aP && aP in Vs;
      }
      var AT = TM ? $E : CI;
      function bM(Vs) {
        var $l = Vs && Vs.constructor, Du = typeof $l == "function" && $l.prototype || JE;
        return Vs === Du;
      }
      function wO(Vs) {
        return Vs === Vs && !eS(Vs);
      }
      function UO(Vs, $l) {
        return function(Du) {
          return Du == null ? !1 : Du[Vs] === $l && ($l !== Zt || Vs in q$(Du));
        };
      }
      function TT(Vs) {
        var $l = cC(Vs, function(om) {
          return Du.size === kr && Du.clear(), om;
        }), Du = $l.cache;
        return $l;
      }
      function NT(Vs, $l) {
        var Du = Vs[1], om = $l[1], vm = Du | om, bm = vm < (Fs | Bs | Pl), xm = om == Pl && Du == Ws || om == Pl && Du == Iu && Vs[7].length <= $l[8] || om == (Pl | Iu) && $l[7].length <= $l[8] && Du == Ws;
        if (!(bm || xm))
          return Vs;
        om & Fs && (Vs[2] = $l[2], vm |= Du & Fs ? 0 : Hs);
        var Em = $l[3];
        if (Em) {
          var Tm = Vs[3];
          Vs[3] = Tm ? HP(Tm, Em, $l[4]) : Em, Vs[4] = Tm ? IE(Vs[3], Yr) : $l[4];
        }
        return Em = $l[5], Em && (Tm = Vs[5], Vs[5] = Tm ? VP(Tm, Em, $l[6]) : Em, Vs[6] = Tm ? IE(Vs[5], Yr) : $l[6]), Em = $l[7], Em && (Vs[7] = Em), om & Pl && (Vs[8] = Vs[8] == null ? $l[8] : bS(Vs[8], $l[8])), Vs[9] == null && (Vs[9] = $l[9]), Vs[0] = $l[0], Vs[1] = vm, Vs;
      }
      function RT(Vs) {
        var $l = [];
        if (Vs != null)
          for (var Du in q$(Vs))
            $l.push(Du);
        return $l;
      }
      function LT(Vs) {
        return RM.call(Vs);
      }
      function GO(Vs, $l, Du) {
        return $l = pS($l === Zt ? Vs.length - 1 : $l, 0), function() {
          for (var om = arguments, vm = -1, bm = pS(om.length - $l, 0), xm = Lm(bm); ++vm < bm; )
            xm[vm] = om[$l + vm];
          vm = -1;
          for (var Em = Lm($l + 1); ++vm < $l; )
            Em[vm] = om[vm];
          return Em[$l] = Du(xm), kS(Vs, this, Em);
        };
      }
      function qO(Vs, $l) {
        return $l.length < 2 ? Vs : BE(Vs, ZS($l, 0, -1));
      }
      function kT(Vs, $l) {
        for (var Du = Vs.length, om = bS($l.length, Du), vm = DS(Vs); om--; ) {
          var bm = $l[om];
          Vs[om] = _E(bm, Du) ? vm[bm] : Zt;
        }
        return Vs;
      }
      function dI(Vs, $l) {
        if (!($l === "constructor" && typeof Vs[$l] == "function") && $l != "__proto__")
          return Vs[$l];
      }
      var KO = ZO(TP), SM = K2 || function(Vs, $l) {
        return vS.setTimeout(Vs, $l);
      }, fI = ZO(oT);
      function QO(Vs, $l, Du) {
        var om = $l + "";
        return fI(Vs, IT(om, jT(ET(om), Du)));
      }
      function ZO(Vs) {
        var $l = 0, Du = 0;
        return function() {
          var om = tA(), vm = pm - (om - Du);
          if (Du = om, vm > 0) {
            if (++$l >= gm)
              return arguments[0];
          } else
            $l = 0;
          return Vs.apply(Zt, arguments);
        };
      }
      function oC(Vs, $l) {
        var Du = -1, om = Vs.length, vm = om - 1;
        for ($l = $l === Zt ? om : $l; ++Du < $l; ) {
          var bm = qC(Du, vm), xm = Vs[bm];
          Vs[bm] = Vs[Du], Vs[Du] = xm;
        }
        return Vs.length = $l, Vs;
      }
      var XO = TT(function(Vs) {
        var $l = [];
        return Vs.charCodeAt(0) === 46 && $l.push(""), Vs.replace(R$, function(Du, om, vm, bm) {
          $l.push(vm ? bm.replace(V$, "$1") : om || Du);
        }), $l;
      });
      function dE(Vs) {
        if (typeof Vs == "string" || FS(Vs))
          return Vs;
        var $l = Vs + "";
        return $l == "0" && 1 / Vs == -mm ? "-0" : $l;
      }
      function HE(Vs) {
        if (Vs != null) {
          try {
            return NM.call(Vs);
          } catch {
          }
          try {
            return Vs + "";
          } catch {
          }
        }
        return "";
      }
      function jT(Vs, $l) {
        return YS(Cm, function(Du) {
          var om = "_." + Du[0];
          $l & Du[1] && !PM(Vs, om) && Vs.push(om);
        }), Vs.sort();
      }
      function JO(Vs) {
        if (Vs instanceof N$)
          return Vs.clone();
        var $l = new KS(Vs.__wrapped__, Vs.__chain__);
        return $l.__actions__ = DS(Vs.__actions__), $l.__index__ = Vs.__index__, $l.__values__ = Vs.__values__, $l;
      }
      function zT(Vs, $l, Du) {
        (Du ? ES(Vs, $l, Du) : $l === Zt) ? $l = 1 : $l = pS(I$($l), 0);
        var om = Vs == null ? 0 : Vs.length;
        if (!om || $l < 1)
          return [];
        for (var vm = 0, bm = 0, xm = Lm(BM(om / $l)); vm < om; )
          xm[bm++] = ZS(Vs, vm, vm += $l);
        return xm;
      }
      function FT(Vs) {
        for (var $l = -1, Du = Vs == null ? 0 : Vs.length, om = 0, vm = []; ++$l < Du; ) {
          var bm = Vs[$l];
          bm && (vm[om++] = bm);
        }
        return vm;
      }
      function BT() {
        var Vs = arguments.length;
        if (!Vs)
          return [];
        for (var $l = Lm(Vs - 1), Du = arguments[0], om = Vs; om--; )
          $l[om - 1] = arguments[om];
        return CE(C$(Du) ? DS(Du) : [Du], _S($l, 1));
      }
      var UT = A$(function(Vs, $l) {
        return iS(Vs) ? mM(Vs, _S($l, 1, iS, !0)) : [];
      }), HT = A$(function(Vs, $l) {
        var Du = XS($l);
        return iS(Du) && (Du = Zt), iS(Vs) ? mM(Vs, _S($l, 1, iS, !0), S$(Du, 2)) : [];
      }), VT = A$(function(Vs, $l) {
        var Du = XS($l);
        return iS(Du) && (Du = Zt), iS(Vs) ? mM(Vs, _S($l, 1, iS, !0), Zt, Du) : [];
      });
      function WT(Vs, $l, Du) {
        var om = Vs == null ? 0 : Vs.length;
        return om ? ($l = Du || $l === Zt ? 1 : I$($l), ZS(Vs, $l < 0 ? 0 : $l, om)) : [];
      }
      function YT(Vs, $l, Du) {
        var om = Vs == null ? 0 : Vs.length;
        return om ? ($l = Du || $l === Zt ? 1 : I$($l), $l = om - $l, ZS(Vs, 0, $l < 0 ? 0 : $l)) : [];
      }
      function qT(Vs, $l) {
        return Vs && Vs.length ? ZM(Vs, S$($l, 3), !0, !0) : [];
      }
      function KT(Vs, $l) {
        return Vs && Vs.length ? ZM(Vs, S$($l, 3), !0) : [];
      }
      function QT(Vs, $l, Du, om) {
        var vm = Vs == null ? 0 : Vs.length;
        return vm ? (Du && typeof Du != "number" && ES(Vs, $l, Du) && (Du = 0, om = vm), FA(Vs, $l, Du, om)) : [];
      }
      function eD(Vs, $l, Du) {
        var om = Vs == null ? 0 : Vs.length;
        if (!om)
          return -1;
        var vm = Du == null ? 0 : I$(Du);
        return vm < 0 && (vm = pS(om + vm, 0)), OM(Vs, S$($l, 3), vm);
      }
      function tD(Vs, $l, Du) {
        var om = Vs == null ? 0 : Vs.length;
        if (!om)
          return -1;
        var vm = om - 1;
        return Du !== Zt && (vm = I$(Du), vm = Du < 0 ? pS(om + vm, 0) : bS(vm, om - 1)), OM(Vs, S$($l, 3), vm, !0);
      }
      function nD(Vs) {
        var $l = Vs == null ? 0 : Vs.length;
        return $l ? _S(Vs, 1) : [];
      }
      function ZT(Vs) {
        var $l = Vs == null ? 0 : Vs.length;
        return $l ? _S(Vs, mm) : [];
      }
      function XT(Vs, $l) {
        var Du = Vs == null ? 0 : Vs.length;
        return Du ? ($l = $l === Zt ? 1 : I$($l), _S(Vs, $l)) : [];
      }
      function JT(Vs) {
        for (var $l = -1, Du = Vs == null ? 0 : Vs.length, om = {}; ++$l < Du; ) {
          var vm = Vs[$l];
          om[vm[0]] = vm[1];
        }
        return om;
      }
      function rD(Vs) {
        return Vs && Vs.length ? Vs[0] : Zt;
      }
      function eN(Vs, $l, Du) {
        var om = Vs == null ? 0 : Vs.length;
        if (!om)
          return -1;
        var vm = Du == null ? 0 : I$(Du);
        return vm < 0 && (vm = pS(om + vm, 0)), KE(Vs, $l, vm);
      }
      function tN(Vs) {
        var $l = Vs == null ? 0 : Vs.length;
        return $l ? ZS(Vs, 0, -1) : [];
      }
      var nN = A$(function(Vs) {
        var $l = J$(Vs, JC);
        return $l.length && $l[0] === Vs[0] ? HC($l) : [];
      }), rN = A$(function(Vs) {
        var $l = XS(Vs), Du = J$(Vs, JC);
        return $l === XS(Du) ? $l = Zt : Du.pop(), Du.length && Du[0] === Vs[0] ? HC(Du, S$($l, 2)) : [];
      }), iN = A$(function(Vs) {
        var $l = XS(Vs), Du = J$(Vs, JC);
        return $l = typeof $l == "function" ? $l : Zt, $l && Du.pop(), Du.length && Du[0] === Vs[0] ? HC(Du, Zt, $l) : [];
      });
      function oN(Vs, $l) {
        return Vs == null ? "" : J2.call(Vs, $l);
      }
      function XS(Vs) {
        var $l = Vs == null ? 0 : Vs.length;
        return $l ? Vs[$l - 1] : Zt;
      }
      function aN(Vs, $l, Du) {
        var om = Vs == null ? 0 : Vs.length;
        if (!om)
          return -1;
        var vm = om;
        return Du !== Zt && (vm = I$(Du), vm = vm < 0 ? pS(om + vm, 0) : bS(vm, om - 1)), $l === $l ? N2(Vs, $l, vm) : OM(Vs, XI, vm, !0);
      }
      function sN(Vs, $l) {
        return Vs && Vs.length ? PP(Vs, I$($l)) : Zt;
      }
      var lN = A$(iD);
      function iD(Vs, $l) {
        return Vs && Vs.length && $l && $l.length ? YC(Vs, $l) : Vs;
      }
      function cN(Vs, $l, Du) {
        return Vs && Vs.length && $l && $l.length ? YC(Vs, $l, S$(Du, 2)) : Vs;
      }
      function uN(Vs, $l, Du) {
        return Vs && Vs.length && $l && $l.length ? YC(Vs, $l, Zt, Du) : Vs;
      }
      var dN = vE(function(Vs, $l) {
        var Du = Vs == null ? 0 : Vs.length, om = zC(Vs, $l);
        return AP(Vs, J$($l, function(vm) {
          return _E(vm, Du) ? +vm : vm;
        }).sort(UP)), om;
      });
      function fN(Vs, $l) {
        var Du = [];
        if (!(Vs && Vs.length))
          return Du;
        var om = -1, vm = [], bm = Vs.length;
        for ($l = S$($l, 3); ++om < bm; ) {
          var xm = Vs[om];
          $l(xm, om, Vs) && (Du.push(xm), vm.push(om));
        }
        return AP(Vs, vm), Du;
      }
      function pI(Vs) {
        return Vs == null ? Vs : rA.call(Vs);
      }
      function pN(Vs, $l, Du) {
        var om = Vs == null ? 0 : Vs.length;
        return om ? (Du && typeof Du != "number" && ES(Vs, $l, Du) ? ($l = 0, Du = om) : ($l = $l == null ? 0 : I$($l), Du = Du === Zt ? om : I$(Du)), ZS(Vs, $l, Du)) : [];
      }
      function hN(Vs, $l) {
        return QM(Vs, $l);
      }
      function gN(Vs, $l, Du) {
        return QC(Vs, $l, S$(Du, 2));
      }
      function mN(Vs, $l) {
        var Du = Vs == null ? 0 : Vs.length;
        if (Du) {
          var om = QM(Vs, $l);
          if (om < Du && iE(Vs[om], $l))
            return om;
        }
        return -1;
      }
      function yN(Vs, $l) {
        return QM(Vs, $l, !0);
      }
      function vN(Vs, $l, Du) {
        return QC(Vs, $l, S$(Du, 2), !0);
      }
      function _N(Vs, $l) {
        var Du = Vs == null ? 0 : Vs.length;
        if (Du) {
          var om = QM(Vs, $l, !0) - 1;
          if (iE(Vs[om], $l))
            return om;
        }
        return -1;
      }
      function $N(Vs) {
        return Vs && Vs.length ? NP(Vs) : [];
      }
      function bN(Vs, $l) {
        return Vs && Vs.length ? NP(Vs, S$($l, 2)) : [];
      }
      function SN(Vs) {
        var $l = Vs == null ? 0 : Vs.length;
        return $l ? ZS(Vs, 1, $l) : [];
      }
      function wN(Vs, $l, Du) {
        return Vs && Vs.length ? ($l = Du || $l === Zt ? 1 : I$($l), ZS(Vs, 0, $l < 0 ? 0 : $l)) : [];
      }
      function xN(Vs, $l, Du) {
        var om = Vs == null ? 0 : Vs.length;
        return om ? ($l = Du || $l === Zt ? 1 : I$($l), $l = om - $l, ZS(Vs, $l < 0 ? 0 : $l, om)) : [];
      }
      function EN(Vs, $l) {
        return Vs && Vs.length ? ZM(Vs, S$($l, 3), !1, !0) : [];
      }
      function MN(Vs, $l) {
        return Vs && Vs.length ? ZM(Vs, S$($l, 3)) : [];
      }
      var CN = A$(function(Vs) {
        return DE(_S(Vs, 1, iS, !0));
      }), IN = A$(function(Vs) {
        var $l = XS(Vs);
        return iS($l) && ($l = Zt), DE(_S(Vs, 1, iS, !0), S$($l, 2));
      }), PN = A$(function(Vs) {
        var $l = XS(Vs);
        return $l = typeof $l == "function" ? $l : Zt, DE(_S(Vs, 1, iS, !0), Zt, $l);
      });
      function ON(Vs) {
        return Vs && Vs.length ? DE(Vs) : [];
      }
      function DN(Vs, $l) {
        return Vs && Vs.length ? DE(Vs, S$($l, 2)) : [];
      }
      function AN(Vs, $l) {
        return $l = typeof $l == "function" ? $l : Zt, Vs && Vs.length ? DE(Vs, Zt, $l) : [];
      }
      function hI(Vs) {
        if (!(Vs && Vs.length))
          return [];
        var $l = 0;
        return Vs = ME(Vs, function(Du) {
          if (iS(Du))
            return $l = pS(Du.length, $l), !0;
        }), DC($l, function(Du) {
          return J$(Vs, IC(Du));
        });
      }
      function oD(Vs, $l) {
        if (!(Vs && Vs.length))
          return [];
        var Du = hI(Vs);
        return $l == null ? Du : J$(Du, function(om) {
          return kS($l, Zt, om);
        });
      }
      var TN = A$(function(Vs, $l) {
        return iS(Vs) ? mM(Vs, $l) : [];
      }), NN = A$(function(Vs) {
        return XC(ME(Vs, iS));
      }), RN = A$(function(Vs) {
        var $l = XS(Vs);
        return iS($l) && ($l = Zt), XC(ME(Vs, iS), S$($l, 2));
      }), LN = A$(function(Vs) {
        var $l = XS(Vs);
        return $l = typeof $l == "function" ? $l : Zt, XC(ME(Vs, iS), Zt, $l);
      }), kN = A$(hI);
      function jN(Vs, $l) {
        return jP(Vs || [], $l || [], gM);
      }
      function zN(Vs, $l) {
        return jP(Vs || [], $l || [], _M);
      }
      var FN = A$(function(Vs) {
        var $l = Vs.length, Du = $l > 1 ? Vs[$l - 1] : Zt;
        return Du = typeof Du == "function" ? (Vs.pop(), Du) : Zt, oD(Vs, Du);
      });
      function aD(Vs) {
        var $l = $m(Vs);
        return $l.__chain__ = !0, $l;
      }
      function BN(Vs, $l) {
        return $l(Vs), Vs;
      }
      function aC(Vs, $l) {
        return $l(Vs);
      }
      var UN = vE(function(Vs) {
        var $l = Vs.length, Du = $l ? Vs[0] : 0, om = this.__wrapped__, vm = function(bm) {
          return zC(bm, Vs);
        };
        return $l > 1 || this.__actions__.length || !(om instanceof N$) || !_E(Du) ? this.thru(vm) : (om = om.slice(Du, +Du + ($l ? 1 : 0)), om.__actions__.push({
          func: aC,
          args: [vm],
          thisArg: Zt
        }), new KS(om, this.__chain__).thru(function(bm) {
          return $l && !bm.length && bm.push(Zt), bm;
        }));
      });
      function HN() {
        return aD(this);
      }
      function VN() {
        return new KS(this.value(), this.__chain__);
      }
      function WN() {
        this.__values__ === Zt && (this.__values__ = $D(this.value()));
        var Vs = this.__index__ >= this.__values__.length, $l = Vs ? Zt : this.__values__[this.__index__++];
        return { done: Vs, value: $l };
      }
      function GN() {
        return this;
      }
      function YN(Vs) {
        for (var $l, Du = this; Du instanceof WM; ) {
          var om = JO(Du);
          om.__index__ = 0, om.__values__ = Zt, $l ? vm.__wrapped__ = om : $l = om;
          var vm = om;
          Du = Du.__wrapped__;
        }
        return vm.__wrapped__ = Vs, $l;
      }
      function qN() {
        var Vs = this.__wrapped__;
        if (Vs instanceof N$) {
          var $l = Vs;
          return this.__actions__.length && ($l = new N$(this)), $l = $l.reverse(), $l.__actions__.push({
            func: aC,
            args: [pI],
            thisArg: Zt
          }), new KS($l, this.__chain__);
        }
        return this.thru(pI);
      }
      function KN() {
        return kP(this.__wrapped__, this.__actions__);
      }
      var QN = XM(function(Vs, $l, Du) {
        W$.call(Vs, Du) ? ++Vs[Du] : mE(Vs, Du, 1);
      });
      function ZN(Vs, $l, Du) {
        var om = C$(Vs) ? QI : zA;
        return Du && ES(Vs, $l, Du) && ($l = Zt), om(Vs, S$($l, 3));
      }
      function XN(Vs, $l) {
        var Du = C$(Vs) ? ME : $P;
        return Du(Vs, S$($l, 3));
      }
      var JN = qP(eD), eR = qP(tD);
      function tR(Vs, $l) {
        return _S(sC(Vs, $l), 1);
      }
      function nR(Vs, $l) {
        return _S(sC(Vs, $l), mm);
      }
      function rR(Vs, $l, Du) {
        return Du = Du === Zt ? 1 : I$(Du), _S(sC(Vs, $l), Du);
      }
      function sD(Vs, $l) {
        var Du = C$(Vs) ? YS : OE;
        return Du(Vs, S$($l, 3));
      }
      function lD(Vs, $l) {
        var Du = C$(Vs) ? g2 : _P;
        return Du(Vs, S$($l, 3));
      }
      var iR = XM(function(Vs, $l, Du) {
        W$.call(Vs, Du) ? Vs[Du].push($l) : mE(Vs, Du, [$l]);
      });
      function oR(Vs, $l, Du, om) {
        Vs = AS(Vs) ? Vs : sM(Vs), Du = Du && !om ? I$(Du) : 0;
        var vm = Vs.length;
        return Du < 0 && (Du = pS(vm + Du, 0)), fC(Vs) ? Du <= vm && Vs.indexOf($l, Du) > -1 : !!vm && KE(Vs, $l, Du) > -1;
      }
      var aR = A$(function(Vs, $l, Du) {
        var om = -1, vm = typeof $l == "function", bm = AS(Vs) ? Lm(Vs.length) : [];
        return OE(Vs, function(xm) {
          bm[++om] = vm ? kS($l, xm, Du) : yM(xm, $l, Du);
        }), bm;
      }), sR = XM(function(Vs, $l, Du) {
        mE(Vs, Du, $l);
      });
      function sC(Vs, $l) {
        var Du = C$(Vs) ? J$ : MP;
        return Du(Vs, S$($l, 3));
      }
      function lR(Vs, $l, Du, om) {
        return Vs == null ? [] : (C$($l) || ($l = $l == null ? [] : [$l]), Du = om ? Zt : Du, C$(Du) || (Du = Du == null ? [] : [Du]), OP(Vs, $l, Du));
      }
      var cR = XM(function(Vs, $l, Du) {
        Vs[Du ? 0 : 1].push($l);
      }, function() {
        return [[], []];
      });
      function uR(Vs, $l, Du) {
        var om = C$(Vs) ? MC : eP, vm = arguments.length < 3;
        return om(Vs, S$($l, 4), Du, vm, OE);
      }
      function dR(Vs, $l, Du) {
        var om = C$(Vs) ? m2 : eP, vm = arguments.length < 3;
        return om(Vs, S$($l, 4), Du, vm, _P);
      }
      function fR(Vs, $l) {
        var Du = C$(Vs) ? ME : $P;
        return Du(Vs, uC(S$($l, 3)));
      }
      function pR(Vs) {
        var $l = C$(Vs) ? gP : rT;
        return $l(Vs);
      }
      function hR(Vs, $l, Du) {
        (Du ? ES(Vs, $l, Du) : $l === Zt) ? $l = 1 : $l = I$($l);
        var om = C$(Vs) ? NA : iT;
        return om(Vs, $l);
      }
      function gR(Vs) {
        var $l = C$(Vs) ? RA : aT;
        return $l(Vs);
      }
      function mR(Vs) {
        if (Vs == null)
          return 0;
        if (AS(Vs))
          return fC(Vs) ? ZE(Vs) : Vs.length;
        var $l = SS(Vs);
        return $l == o$ || $l == l$ ? Vs.size : WC(Vs).length;
      }
      function yR(Vs, $l, Du) {
        var om = C$(Vs) ? CC : sT;
        return Du && ES(Vs, $l, Du) && ($l = Zt), om(Vs, S$($l, 3));
      }
      var vR = A$(function(Vs, $l) {
        if (Vs == null)
          return [];
        var Du = $l.length;
        return Du > 1 && ES(Vs, $l[0], $l[1]) ? $l = [] : Du > 2 && ES($l[0], $l[1], $l[2]) && ($l = [$l[0]]), OP(Vs, _S($l, 1), []);
      }), lC = q2 || function() {
        return vS.Date.now();
      };
      function _R(Vs, $l) {
        if (typeof $l != "function")
          throw new qS(Kn);
        return Vs = I$(Vs), function() {
          if (--Vs < 1)
            return $l.apply(this, arguments);
        };
      }
      function cD(Vs, $l, Du) {
        return $l = Du ? Zt : $l, $l = Vs && $l == null ? Vs.length : $l, yE(Vs, Pl, Zt, Zt, Zt, Zt, $l);
      }
      function uD(Vs, $l) {
        var Du;
        if (typeof $l != "function")
          throw new qS(Kn);
        return Vs = I$(Vs), function() {
          return --Vs > 0 && (Du = $l.apply(this, arguments)), Vs <= 1 && ($l = Zt), Du;
        };
      }
      var gI = A$(function(Vs, $l, Du) {
        var om = Fs;
        if (Du.length) {
          var vm = IE(Du, oM(gI));
          om |= El;
        }
        return yE(Vs, om, $l, Du, vm);
      }), dD = A$(function(Vs, $l, Du) {
        var om = Fs | Bs;
        if (Du.length) {
          var vm = IE(Du, oM(dD));
          om |= El;
        }
        return yE($l, om, Vs, Du, vm);
      });
      function fD(Vs, $l, Du) {
        $l = Du ? Zt : $l;
        var om = yE(Vs, Ws, Zt, Zt, Zt, Zt, Zt, $l);
        return om.placeholder = fD.placeholder, om;
      }
      function pD(Vs, $l, Du) {
        $l = Du ? Zt : $l;
        var om = yE(Vs, Ys, Zt, Zt, Zt, Zt, Zt, $l);
        return om.placeholder = pD.placeholder, om;
      }
      function hD(Vs, $l, Du) {
        var om, vm, bm, xm, Em, Tm, e$ = 0, t$ = !1, r$ = !1, c$ = !0;
        if (typeof Vs != "function")
          throw new qS(Kn);
        $l = JS($l) || 0, eS(Du) && (t$ = !!Du.leading, r$ = "maxWait" in Du, bm = r$ ? pS(JS(Du.maxWait) || 0, $l) : bm, c$ = "trailing" in Du ? !!Du.trailing : c$);
        function y$(oS) {
          var oE = om, SE = vm;
          return om = vm = Zt, e$ = oS, xm = Vs.apply(SE, oE), xm;
        }
        function w$(oS) {
          return e$ = oS, Em = SM(T$, $l), t$ ? y$(oS) : xm;
        }
        function P$(oS) {
          var oE = oS - Tm, SE = oS - e$, ND = $l - oE;
          return r$ ? bS(ND, bm - SE) : ND;
        }
        function x$(oS) {
          var oE = oS - Tm, SE = oS - e$;
          return Tm === Zt || oE >= $l || oE < 0 || r$ && SE >= bm;
        }
        function T$() {
          var oS = lC();
          if (x$(oS))
            return L$(oS);
          Em = SM(T$, P$(oS));
        }
        function L$(oS) {
          return Em = Zt, c$ && om ? y$(oS) : (om = vm = Zt, xm);
        }
        function BS() {
          Em !== Zt && zP(Em), e$ = 0, om = Tm = vm = Em = Zt;
        }
        function CS() {
          return Em === Zt ? xm : L$(lC());
        }
        function US() {
          var oS = lC(), oE = x$(oS);
          if (om = arguments, vm = this, Tm = oS, oE) {
            if (Em === Zt)
              return w$(Tm);
            if (r$)
              return zP(Em), Em = SM(T$, $l), y$(Tm);
          }
          return Em === Zt && (Em = SM(T$, $l)), xm;
        }
        return US.cancel = BS, US.flush = CS, US;
      }
      var $R = A$(function(Vs, $l) {
        return vP(Vs, 1, $l);
      }), bR = A$(function(Vs, $l, Du) {
        return vP(Vs, JS($l) || 0, Du);
      });
      function SR(Vs) {
        return yE(Vs, Tu);
      }
      function cC(Vs, $l) {
        if (typeof Vs != "function" || $l != null && typeof $l != "function")
          throw new qS(Kn);
        var Du = function() {
          var om = arguments, vm = $l ? $l.apply(this, om) : om[0], bm = Du.cache;
          if (bm.has(vm))
            return bm.get(vm);
          var xm = Vs.apply(this, om);
          return Du.cache = bm.set(vm, xm) || bm, xm;
        };
        return Du.cache = new (cC.Cache || gE)(), Du;
      }
      cC.Cache = gE;
      function uC(Vs) {
        if (typeof Vs != "function")
          throw new qS(Kn);
        return function() {
          var $l = arguments;
          switch ($l.length) {
            case 0:
              return !Vs.call(this);
            case 1:
              return !Vs.call(this, $l[0]);
            case 2:
              return !Vs.call(this, $l[0], $l[1]);
            case 3:
              return !Vs.call(this, $l[0], $l[1], $l[2]);
          }
          return !Vs.apply(this, $l);
        };
      }
      function wR(Vs) {
        return uD(2, Vs);
      }
      var xR = lT(function(Vs, $l) {
        $l = $l.length == 1 && C$($l[0]) ? J$($l[0], jS(S$())) : J$(_S($l, 1), jS(S$()));
        var Du = $l.length;
        return A$(function(om) {
          for (var vm = -1, bm = bS(om.length, Du); ++vm < bm; )
            om[vm] = $l[vm].call(this, om[vm]);
          return kS(Vs, this, om);
        });
      }), mI = A$(function(Vs, $l) {
        var Du = IE($l, oM(mI));
        return yE(Vs, El, Zt, $l, Du);
      }), gD = A$(function(Vs, $l) {
        var Du = IE($l, oM(gD));
        return yE(Vs, Mu, Zt, $l, Du);
      }), ER = vE(function(Vs, $l) {
        return yE(Vs, Iu, Zt, Zt, Zt, $l);
      });
      function MR(Vs, $l) {
        if (typeof Vs != "function")
          throw new qS(Kn);
        return $l = $l === Zt ? $l : I$($l), A$(Vs, $l);
      }
      function CR(Vs, $l) {
        if (typeof Vs != "function")
          throw new qS(Kn);
        return $l = $l == null ? 0 : pS(I$($l), 0), A$(function(Du) {
          var om = Du[$l], vm = TE(Du, 0, $l);
          return om && CE(vm, om), kS(Vs, this, vm);
        });
      }
      function IR(Vs, $l, Du) {
        var om = !0, vm = !0;
        if (typeof Vs != "function")
          throw new qS(Kn);
        return eS(Du) && (om = "leading" in Du ? !!Du.leading : om, vm = "trailing" in Du ? !!Du.trailing : vm), hD(Vs, $l, {
          leading: om,
          maxWait: $l,
          trailing: vm
        });
      }
      function PR(Vs) {
        return cD(Vs, 1);
      }
      function OR(Vs, $l) {
        return mI(eI($l), Vs);
      }
      function DR() {
        if (!arguments.length)
          return [];
        var Vs = arguments[0];
        return C$(Vs) ? Vs : [Vs];
      }
      function AR(Vs) {
        return QS(Vs, Ls);
      }
      function TR(Vs, $l) {
        return $l = typeof $l == "function" ? $l : Zt, QS(Vs, Ls, $l);
      }
      function NR(Vs) {
        return QS(Vs, Ms | Ls);
      }
      function RR(Vs, $l) {
        return $l = typeof $l == "function" ? $l : Zt, QS(Vs, Ms | Ls, $l);
      }
      function LR(Vs, $l) {
        return $l == null || yP(Vs, $l, mS($l));
      }
      function iE(Vs, $l) {
        return Vs === $l || Vs !== Vs && $l !== $l;
      }
      var kR = nC(UC), jR = nC(function(Vs, $l) {
        return Vs >= $l;
      }), VE = wP(function() {
        return arguments;
      }()) ? wP : function(Vs) {
        return nS(Vs) && W$.call(Vs, "callee") && !cP.call(Vs, "callee");
      }, C$ = Lm.isArray, zR = VI ? jS(VI) : WA;
      function AS(Vs) {
        return Vs != null && dC(Vs.length) && !$E(Vs);
      }
      function iS(Vs) {
        return nS(Vs) && AS(Vs);
      }
      function FR(Vs) {
        return Vs === !0 || Vs === !1 || nS(Vs) && xS(Vs) == Rm;
      }
      var NE = Q2 || CI, BR = WI ? jS(WI) : GA;
      function UR(Vs) {
        return nS(Vs) && Vs.nodeType === 1 && !wM(Vs);
      }
      function HR(Vs) {
        if (Vs == null)
          return !0;
        if (AS(Vs) && (C$(Vs) || typeof Vs == "string" || typeof Vs.splice == "function" || NE(Vs) || aM(Vs) || VE(Vs)))
          return !Vs.length;
        var $l = SS(Vs);
        if ($l == o$ || $l == l$)
          return !Vs.size;
        if (bM(Vs))
          return !WC(Vs).length;
        for (var Du in Vs)
          if (W$.call(Vs, Du))
            return !1;
        return !0;
      }
      function VR(Vs, $l) {
        return vM(Vs, $l);
      }
      function WR(Vs, $l, Du) {
        Du = typeof Du == "function" ? Du : Zt;
        var om = Du ? Du(Vs, $l) : Zt;
        return om === Zt ? vM(Vs, $l, Zt, Du) : !!om;
      }
      function yI(Vs) {
        if (!nS(Vs))
          return !1;
        var $l = xS(Vs);
        return $l == zm || $l == km || typeof Vs.message == "string" && typeof Vs.name == "string" && !wM(Vs);
      }
      function GR(Vs) {
        return typeof Vs == "number" && dP(Vs);
      }
      function $E(Vs) {
        if (!eS(Vs))
          return !1;
        var $l = xS(Vs);
        return $l == Pm || $l == i$ || $l == Vm || $l == $$;
      }
      function mD(Vs) {
        return typeof Vs == "number" && Vs == I$(Vs);
      }
      function dC(Vs) {
        return typeof Vs == "number" && Vs > -1 && Vs % 1 == 0 && Vs <= hm;
      }
      function eS(Vs) {
        var $l = typeof Vs;
        return Vs != null && ($l == "object" || $l == "function");
      }
      function nS(Vs) {
        return Vs != null && typeof Vs == "object";
      }
      var yD = GI ? jS(GI) : qA;
      function YR(Vs, $l) {
        return Vs === $l || VC(Vs, $l, sI($l));
      }
      function qR(Vs, $l, Du) {
        return Du = typeof Du == "function" ? Du : Zt, VC(Vs, $l, sI($l), Du);
      }
      function KR(Vs) {
        return vD(Vs) && Vs != +Vs;
      }
      function QR(Vs) {
        if (AT(Vs))
          throw new E$(kn);
        return xP(Vs);
      }
      function ZR(Vs) {
        return Vs === null;
      }
      function XR(Vs) {
        return Vs == null;
      }
      function vD(Vs) {
        return typeof Vs == "number" || nS(Vs) && xS(Vs) == u$;
      }
      function wM(Vs) {
        if (!nS(Vs) || xS(Vs) != d$)
          return !1;
        var $l = jM(Vs);
        if ($l === null)
          return !0;
        var Du = W$.call($l, "constructor") && $l.constructor;
        return typeof Du == "function" && Du instanceof Du && NM.call(Du) == H2;
      }
      var vI = YI ? jS(YI) : KA;
      function JR(Vs) {
        return mD(Vs) && Vs >= -hm && Vs <= hm;
      }
      var _D = qI ? jS(qI) : QA;
      function fC(Vs) {
        return typeof Vs == "string" || !C$(Vs) && nS(Vs) && xS(Vs) == _$;
      }
      function FS(Vs) {
        return typeof Vs == "symbol" || nS(Vs) && xS(Vs) == a$;
      }
      var aM = KI ? jS(KI) : ZA;
      function eL(Vs) {
        return Vs === Zt;
      }
      function tL(Vs) {
        return nS(Vs) && SS(Vs) == m$;
      }
      function nL(Vs) {
        return nS(Vs) && xS(Vs) == j$;
      }
      var rL = nC(GC), iL = nC(function(Vs, $l) {
        return Vs <= $l;
      });
      function $D(Vs) {
        if (!Vs)
          return [];
        if (AS(Vs))
          return fC(Vs) ? nE(Vs) : DS(Vs);
        if (uM && Vs[uM])
          return O2(Vs[uM]());
        var $l = SS(Vs), Du = $l == o$ ? TC : $l == l$ ? DM : sM;
        return Du(Vs);
      }
      function bE(Vs) {
        if (!Vs)
          return Vs === 0 ? Vs : 0;
        if (Vs = JS(Vs), Vs === mm || Vs === -mm) {
          var $l = Vs < 0 ? -1 : 1;
          return $l * ym;
        }
        return Vs === Vs ? Vs : 0;
      }
      function I$(Vs) {
        var $l = bE(Vs), Du = $l % 1;
        return $l === $l ? Du ? $l - Du : $l : 0;
      }
      function bD(Vs) {
        return Vs ? FE(I$(Vs), 0, Sm) : 0;
      }
      function JS(Vs) {
        if (typeof Vs == "number")
          return Vs;
        if (FS(Vs))
          return _m;
        if (eS(Vs)) {
          var $l = typeof Vs.valueOf == "function" ? Vs.valueOf() : Vs;
          Vs = eS($l) ? $l + "" : $l;
        }
        if (typeof Vs != "string")
          return Vs === 0 ? Vs : +Vs;
        Vs = tP(Vs);
        var Du = LS.test(Vs);
        return Du || hC.test(Vs) ? f2(Vs.slice(2), Du ? 2 : 8) : xE.test(Vs) ? _m : +Vs;
      }
      function SD(Vs) {
        return uE(Vs, TS(Vs));
      }
      function oL(Vs) {
        return Vs ? FE(I$(Vs), -hm, hm) : Vs === 0 ? Vs : 0;
      }
      function H$(Vs) {
        return Vs == null ? "" : zS(Vs);
      }
      var aL = rM(function(Vs, $l) {
        if (bM($l) || AS($l)) {
          uE($l, mS($l), Vs);
          return;
        }
        for (var Du in $l)
          W$.call($l, Du) && gM(Vs, Du, $l[Du]);
      }), wD = rM(function(Vs, $l) {
        uE($l, TS($l), Vs);
      }), pC = rM(function(Vs, $l, Du, om) {
        uE($l, TS($l), Vs, om);
      }), sL = rM(function(Vs, $l, Du, om) {
        uE($l, mS($l), Vs, om);
      }), lL = vE(zC);
      function cL(Vs, $l) {
        var Du = nM(Vs);
        return $l == null ? Du : mP(Du, $l);
      }
      var uL = A$(function(Vs, $l) {
        Vs = q$(Vs);
        var Du = -1, om = $l.length, vm = om > 2 ? $l[2] : Zt;
        for (vm && ES($l[0], $l[1], vm) && (om = 1); ++Du < om; )
          for (var bm = $l[Du], xm = TS(bm), Em = -1, Tm = xm.length; ++Em < Tm; ) {
            var e$ = xm[Em], t$ = Vs[e$];
            (t$ === Zt || iE(t$, JE[e$]) && !W$.call(Vs, e$)) && (Vs[e$] = bm[e$]);
          }
        return Vs;
      }), dL = A$(function(Vs) {
        return Vs.push(Zt, gO), kS(xD, Zt, Vs);
      });
      function fL(Vs, $l) {
        return ZI(Vs, S$($l, 3), cE);
      }
      function pL(Vs, $l) {
        return ZI(Vs, S$($l, 3), BC);
      }
      function hL(Vs, $l) {
        return Vs == null ? Vs : FC(Vs, S$($l, 3), TS);
      }
      function gL(Vs, $l) {
        return Vs == null ? Vs : bP(Vs, S$($l, 3), TS);
      }
      function mL(Vs, $l) {
        return Vs && cE(Vs, S$($l, 3));
      }
      function yL(Vs, $l) {
        return Vs && BC(Vs, S$($l, 3));
      }
      function vL(Vs) {
        return Vs == null ? [] : qM(Vs, mS(Vs));
      }
      function _L(Vs) {
        return Vs == null ? [] : qM(Vs, TS(Vs));
      }
      function _I(Vs, $l, Du) {
        var om = Vs == null ? Zt : BE(Vs, $l);
        return om === Zt ? Du : om;
      }
      function $L(Vs, $l) {
        return Vs != null && vO(Vs, $l, BA);
      }
      function $I(Vs, $l) {
        return Vs != null && vO(Vs, $l, UA);
      }
      var bL = QP(function(Vs, $l, Du) {
        $l != null && typeof $l.toString != "function" && ($l = RM.call($l)), Vs[$l] = Du;
      }, SI(NS)), SL = QP(function(Vs, $l, Du) {
        $l != null && typeof $l.toString != "function" && ($l = RM.call($l)), W$.call(Vs, $l) ? Vs[$l].push(Du) : Vs[$l] = [Du];
      }, S$), wL = A$(yM);
      function mS(Vs) {
        return AS(Vs) ? hP(Vs) : WC(Vs);
      }
      function TS(Vs) {
        return AS(Vs) ? hP(Vs, !0) : XA(Vs);
      }
      function xL(Vs, $l) {
        var Du = {};
        return $l = S$($l, 3), cE(Vs, function(om, vm, bm) {
          mE(Du, $l(om, vm, bm), om);
        }), Du;
      }
      function EL(Vs, $l) {
        var Du = {};
        return $l = S$($l, 3), cE(Vs, function(om, vm, bm) {
          mE(Du, vm, $l(om, vm, bm));
        }), Du;
      }
      var ML = rM(function(Vs, $l, Du) {
        KM(Vs, $l, Du);
      }), xD = rM(function(Vs, $l, Du, om) {
        KM(Vs, $l, Du, om);
      }), CL = vE(function(Vs, $l) {
        var Du = {};
        if (Vs == null)
          return Du;
        var om = !1;
        $l = J$($l, function(bm) {
          return bm = AE(bm, Vs), om || (om = bm.length > 1), bm;
        }), uE(Vs, oI(Vs), Du), om && (Du = QS(Du, Ms | Ds | Ls, $T));
        for (var vm = $l.length; vm--; )
          ZC(Du, $l[vm]);
        return Du;
      });
      function IL(Vs, $l) {
        return MD(Vs, uC(S$($l)));
      }
      var PL = vE(function(Vs, $l) {
        return Vs == null ? {} : eT(Vs, $l);
      });
      function MD(Vs, $l) {
        if (Vs == null)
          return {};
        var Du = J$(oI(Vs), function(om) {
          return [om];
        });
        return $l = S$($l), DP(Vs, Du, function(om, vm) {
          return $l(om, vm[0]);
        });
      }
      function OL(Vs, $l, Du) {
        $l = AE($l, Vs);
        var om = -1, vm = $l.length;
        for (vm || (vm = 1, Vs = Zt); ++om < vm; ) {
          var bm = Vs == null ? Zt : Vs[dE($l[om])];
          bm === Zt && (om = vm, bm = Du), Vs = $E(bm) ? bm.call(Vs) : bm;
        }
        return Vs;
      }
      function DL(Vs, $l, Du) {
        return Vs == null ? Vs : _M(Vs, $l, Du);
      }
      function AL(Vs, $l, Du, om) {
        return om = typeof om == "function" ? om : Zt, Vs == null ? Vs : _M(Vs, $l, Du, om);
      }
      var CD = JP(mS), ID = JP(TS);
      function TL(Vs, $l, Du) {
        var om = C$(Vs), vm = om || NE(Vs) || aM(Vs);
        if ($l = S$($l, 4), Du == null) {
          var bm = Vs && Vs.constructor;
          vm ? Du = om ? new bm() : [] : eS(Vs) ? Du = $E(bm) ? nM(jM(Vs)) : {} : Du = {};
        }
        return (vm ? YS : cE)(Vs, function(xm, Em, Tm) {
          return $l(Du, xm, Em, Tm);
        }), Du;
      }
      function NL(Vs, $l) {
        return Vs == null ? !0 : ZC(Vs, $l);
      }
      function RL(Vs, $l, Du) {
        return Vs == null ? Vs : LP(Vs, $l, eI(Du));
      }
      function LL(Vs, $l, Du, om) {
        return om = typeof om == "function" ? om : Zt, Vs == null ? Vs : LP(Vs, $l, eI(Du), om);
      }
      function sM(Vs) {
        return Vs == null ? [] : AC(Vs, mS(Vs));
      }
      function kL(Vs) {
        return Vs == null ? [] : AC(Vs, TS(Vs));
      }
      function jL(Vs, $l, Du) {
        return Du === Zt && (Du = $l, $l = Zt), Du !== Zt && (Du = JS(Du), Du = Du === Du ? Du : 0), $l !== Zt && ($l = JS($l), $l = $l === $l ? $l : 0), FE(JS(Vs), $l, Du);
      }
      function zL(Vs, $l, Du) {
        return $l = bE($l), Du === Zt ? (Du = $l, $l = 0) : Du = bE(Du), Vs = JS(Vs), HA(Vs, $l, Du);
      }
      function FL(Vs, $l, Du) {
        if (Du && typeof Du != "boolean" && ES(Vs, $l, Du) && ($l = Du = Zt), Du === Zt && (typeof $l == "boolean" ? (Du = $l, $l = Zt) : typeof Vs == "boolean" && (Du = Vs, Vs = Zt)), Vs === Zt && $l === Zt ? (Vs = 0, $l = 1) : (Vs = bE(Vs), $l === Zt ? ($l = Vs, Vs = 0) : $l = bE($l)), Vs > $l) {
          var om = Vs;
          Vs = $l, $l = om;
        }
        if (Du || Vs % 1 || $l % 1) {
          var vm = fP();
          return bS(Vs + vm * ($l - Vs + d2("1e-" + ((vm + "").length - 1))), $l);
        }
        return qC(Vs, $l);
      }
      var BL = iM(function(Vs, $l, Du) {
        return $l = $l.toLowerCase(), Vs + (Du ? PD($l) : $l);
      });
      function PD(Vs) {
        return bI(H$(Vs).toLowerCase());
      }
      function OD(Vs) {
        return Vs = H$(Vs), Vs && Vs.replace(dS, x2).replace(JD, "");
      }
      function UL(Vs, $l, Du) {
        Vs = H$(Vs), $l = zS($l);
        var om = Vs.length;
        Du = Du === Zt ? om : FE(I$(Du), 0, om);
        var vm = Du;
        return Du -= $l.length, Du >= 0 && Vs.slice(Du, vm) == $l;
      }
      function HL(Vs) {
        return Vs = H$(Vs), Vs && gS.test(Vs) ? Vs.replace(hS, E2) : Vs;
      }
      function VL(Vs) {
        return Vs = H$(Vs), Vs && yS.test(Vs) ? Vs.replace(k$, "\\$&") : Vs;
      }
      var WL = iM(function(Vs, $l, Du) {
        return Vs + (Du ? "-" : "") + $l.toLowerCase();
      }), GL = iM(function(Vs, $l, Du) {
        return Vs + (Du ? " " : "") + $l.toLowerCase();
      }), YL = YP("toLowerCase");
      function qL(Vs, $l, Du) {
        Vs = H$(Vs), $l = I$($l);
        var om = $l ? ZE(Vs) : 0;
        if (!$l || om >= $l)
          return Vs;
        var vm = ($l - om) / 2;
        return tC(UM(vm), Du) + Vs + tC(BM(vm), Du);
      }
      function KL(Vs, $l, Du) {
        Vs = H$(Vs), $l = I$($l);
        var om = $l ? ZE(Vs) : 0;
        return $l && om < $l ? Vs + tC($l - om, Du) : Vs;
      }
      function QL(Vs, $l, Du) {
        Vs = H$(Vs), $l = I$($l);
        var om = $l ? ZE(Vs) : 0;
        return $l && om < $l ? tC($l - om, Du) + Vs : Vs;
      }
      function ZL(Vs, $l, Du) {
        return Du || $l == null ? $l = 0 : $l && ($l = +$l), nA(H$(Vs).replace(HS, ""), $l || 0);
      }
      function XL(Vs, $l, Du) {
        return (Du ? ES(Vs, $l, Du) : $l === Zt) ? $l = 1 : $l = I$($l), KC(H$(Vs), $l);
      }
      function JL() {
        var Vs = arguments, $l = H$(Vs[0]);
        return Vs.length < 3 ? $l : $l.replace(Vs[1], Vs[2]);
      }
      var _j = iM(function(Vs, $l, Du) {
        return Vs + (Du ? "_" : "") + $l.toLowerCase();
      });
      function $j(Vs, $l, Du) {
        return Du && typeof Du != "number" && ES(Vs, $l, Du) && ($l = Du = Zt), Du = Du === Zt ? Sm : Du >>> 0, Du ? (Vs = H$(Vs), Vs && (typeof $l == "string" || $l != null && !vI($l)) && ($l = zS($l), !$l && QE(Vs)) ? TE(nE(Vs), 0, Du) : Vs.split($l, Du)) : [];
      }
      var e4 = iM(function(Vs, $l, Du) {
        return Vs + (Du ? " " : "") + bI($l);
      });
      function t4(Vs, $l, Du) {
        return Vs = H$(Vs), Du = Du == null ? 0 : FE(I$(Du), 0, Vs.length), $l = zS($l), Vs.slice(Du, Du + $l.length) == $l;
      }
      function n4(Vs, $l, Du) {
        var om = $m.templateSettings;
        Du && ES(Vs, $l, Du) && ($l = Zt), Vs = H$(Vs), $l = pC({}, $l, om, hO);
        var vm = pC({}, $l.imports, om.imports, hO), bm = mS(vm), xm = AC(vm, bm), Em, Tm, e$ = 0, t$ = $l.interpolate || VS, r$ = "__p += '", c$ = NC(
          ($l.escape || VS).source + "|" + t$.source + "|" + (t$ === Z$ ? uS : VS).source + "|" + ($l.evaluate || VS).source + "|$",
          "g"
        ), y$ = "//# sourceURL=" + (W$.call($l, "sourceURL") ? ($l.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++a2 + "]") + `
`;
        Vs.replace(c$, function(x$, T$, L$, BS, CS, US) {
          return L$ || (L$ = BS), r$ += Vs.slice(e$, US).replace(EM, M2), T$ && (Em = !0, r$ += `' +
__e(` + T$ + `) +
'`), CS && (Tm = !0, r$ += `';
` + CS + `;
__p += '`), L$ && (r$ += `' +
((__t = (` + L$ + `)) == null ? '' : __t) +
'`), e$ = US + x$.length, x$;
        }), r$ += `';
`;
        var w$ = W$.call($l, "variable") && $l.variable;
        if (!w$)
          r$ = `with (obj) {
` + r$ + `
}
`;
        else if (g$.test(w$))
          throw new E$(er);
        r$ = (Tm ? r$.replace(sS, "") : r$).replace(PS, "$1").replace(G$, "$1;"), r$ = "function(" + (w$ || "obj") + `) {
` + (w$ ? "" : `obj || (obj = {});
`) + "var __t, __p = ''" + (Em ? ", __e = _.escape" : "") + (Tm ? `, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
` : `;
`) + r$ + `return __p
}`;
        var P$ = AD(function() {
          return F$(bm, y$ + "return " + r$).apply(Zt, xm);
        });
        if (P$.source = r$, yI(P$))
          throw P$;
        return P$;
      }
      function r4(Vs) {
        return H$(Vs).toLowerCase();
      }
      function i4(Vs) {
        return H$(Vs).toUpperCase();
      }
      function o4(Vs, $l, Du) {
        if (Vs = H$(Vs), Vs && (Du || $l === Zt))
          return tP(Vs);
        if (!Vs || !($l = zS($l)))
          return Vs;
        var om = nE(Vs), vm = nE($l), bm = nP(om, vm), xm = rP(om, vm) + 1;
        return TE(om, bm, xm).join("");
      }
      function a4(Vs, $l, Du) {
        if (Vs = H$(Vs), Vs && (Du || $l === Zt))
          return Vs.slice(0, oP(Vs) + 1);
        if (!Vs || !($l = zS($l)))
          return Vs;
        var om = nE(Vs), vm = rP(om, nE($l)) + 1;
        return TE(om, 0, vm).join("");
      }
      function s4(Vs, $l, Du) {
        if (Vs = H$(Vs), Vs && (Du || $l === Zt))
          return Vs.replace(HS, "");
        if (!Vs || !($l = zS($l)))
          return Vs;
        var om = nE(Vs), vm = nP(om, nE($l));
        return TE(om, vm).join("");
      }
      function l4(Vs, $l) {
        var Du = Au, om = Nu;
        if (eS($l)) {
          var vm = "separator" in $l ? $l.separator : vm;
          Du = "length" in $l ? I$($l.length) : Du, om = "omission" in $l ? zS($l.omission) : om;
        }
        Vs = H$(Vs);
        var bm = Vs.length;
        if (QE(Vs)) {
          var xm = nE(Vs);
          bm = xm.length;
        }
        if (Du >= bm)
          return Vs;
        var Em = Du - ZE(om);
        if (Em < 1)
          return om;
        var Tm = xm ? TE(xm, 0, Em).join("") : Vs.slice(0, Em);
        if (vm === Zt)
          return Tm + om;
        if (xm && (Em += Tm.length - Em), vI(vm)) {
          if (Vs.slice(Em).search(vm)) {
            var e$, t$ = Tm;
            for (vm.global || (vm = NC(vm.source, H$(D$.exec(vm)) + "g")), vm.lastIndex = 0; e$ = vm.exec(t$); )
              var r$ = e$.index;
            Tm = Tm.slice(0, r$ === Zt ? Em : r$);
          }
        } else if (Vs.indexOf(zS(vm), Em) != Em) {
          var c$ = Tm.lastIndexOf(vm);
          c$ > -1 && (Tm = Tm.slice(0, c$));
        }
        return Tm + om;
      }
      function c4(Vs) {
        return Vs = H$(Vs), Vs && aE.test(Vs) ? Vs.replace(tS, R2) : Vs;
      }
      var u4 = iM(function(Vs, $l, Du) {
        return Vs + (Du ? " " : "") + $l.toUpperCase();
      }), bI = YP("toUpperCase");
      function DD(Vs, $l, Du) {
        return Vs = H$(Vs), $l = Du ? Zt : $l, $l === Zt ? P2(Vs) ? j2(Vs) : _2(Vs) : Vs.match($l) || [];
      }
      var AD = A$(function(Vs, $l) {
        try {
          return kS(Vs, Zt, $l);
        } catch (Du) {
          return yI(Du) ? Du : new E$(Du);
        }
      }), d4 = vE(function(Vs, $l) {
        return YS($l, function(Du) {
          Du = dE(Du), mE(Vs, Du, gI(Vs[Du], Vs));
        }), Vs;
      });
      function f4(Vs) {
        var $l = Vs == null ? 0 : Vs.length, Du = S$();
        return Vs = $l ? J$(Vs, function(om) {
          if (typeof om[1] != "function")
            throw new qS(Kn);
          return [Du(om[0]), om[1]];
        }) : [], A$(function(om) {
          for (var vm = -1; ++vm < $l; ) {
            var bm = Vs[vm];
            if (kS(bm[0], this, om))
              return kS(bm[1], this, om);
          }
        });
      }
      function p4(Vs) {
        return jA(QS(Vs, Ms));
      }
      function SI(Vs) {
        return function() {
          return Vs;
        };
      }
      function h4(Vs, $l) {
        return Vs == null || Vs !== Vs ? $l : Vs;
      }
      var g4 = KP(), m4 = KP(!0);
      function NS(Vs) {
        return Vs;
      }
      function wI(Vs) {
        return EP(typeof Vs == "function" ? Vs : QS(Vs, Ms));
      }
      function y4(Vs) {
        return CP(QS(Vs, Ms));
      }
      function _4(Vs, $l) {
        return IP(Vs, QS($l, Ms));
      }
      var $4 = A$(function(Vs, $l) {
        return function(Du) {
          return yM(Du, Vs, $l);
        };
      }), b4 = A$(function(Vs, $l) {
        return function(Du) {
          return yM(Vs, Du, $l);
        };
      });
      function xI(Vs, $l, Du) {
        var om = mS($l), vm = qM($l, om);
        Du == null && !(eS($l) && (vm.length || !om.length)) && (Du = $l, $l = Vs, Vs = this, vm = qM($l, mS($l)));
        var bm = !(eS(Du) && "chain" in Du) || !!Du.chain, xm = $E(Vs);
        return YS(vm, function(Em) {
          var Tm = $l[Em];
          Vs[Em] = Tm, xm && (Vs.prototype[Em] = function() {
            var e$ = this.__chain__;
            if (bm || e$) {
              var t$ = Vs(this.__wrapped__), r$ = t$.__actions__ = DS(this.__actions__);
              return r$.push({ func: Tm, args: arguments, thisArg: Vs }), t$.__chain__ = e$, t$;
            }
            return Tm.apply(Vs, CE([this.value()], arguments));
          });
        }), Vs;
      }
      function S4() {
        return vS._ === this && (vS._ = V2), this;
      }
      function EI() {
      }
      function w4(Vs) {
        return Vs = I$(Vs), A$(function($l) {
          return PP($l, Vs);
        });
      }
      var x4 = nI(J$), E4 = nI(QI), M4 = nI(CC);
      function TD(Vs) {
        return cI(Vs) ? IC(dE(Vs)) : tT(Vs);
      }
      function C4(Vs) {
        return function($l) {
          return Vs == null ? Zt : BE(Vs, $l);
        };
      }
      var I4 = ZP(), P4 = ZP(!0);
      function MI() {
        return [];
      }
      function CI() {
        return !1;
      }
      function O4() {
        return {};
      }
      function D4() {
        return "";
      }
      function T4() {
        return !0;
      }
      function N4(Vs, $l) {
        if (Vs = I$(Vs), Vs < 1 || Vs > hm)
          return [];
        var Du = Sm, om = bS(Vs, Sm);
        $l = S$($l), Vs -= Sm;
        for (var vm = DC(om, $l); ++Du < Vs; )
          $l(Du);
        return vm;
      }
      function R4(Vs) {
        return C$(Vs) ? J$(Vs, dE) : FS(Vs) ? [Vs] : DS(XO(H$(Vs)));
      }
      function L4(Vs) {
        var $l = ++U2;
        return H$(Vs) + $l;
      }
      var k4 = eC(function(Vs, $l) {
        return Vs + $l;
      }, 0), j4 = rI("ceil"), z4 = eC(function(Vs, $l) {
        return Vs / $l;
      }, 1), F4 = rI("floor");
      function B4(Vs) {
        return Vs && Vs.length ? YM(Vs, NS, UC) : Zt;
      }
      function U4(Vs, $l) {
        return Vs && Vs.length ? YM(Vs, S$($l, 2), UC) : Zt;
      }
      function H4(Vs) {
        return JI(Vs, NS);
      }
      function V4(Vs, $l) {
        return JI(Vs, S$($l, 2));
      }
      function W4(Vs) {
        return Vs && Vs.length ? YM(Vs, NS, GC) : Zt;
      }
      function G4(Vs, $l) {
        return Vs && Vs.length ? YM(Vs, S$($l, 2), GC) : Zt;
      }
      var Y4 = eC(function(Vs, $l) {
        return Vs * $l;
      }, 1), q4 = rI("round"), K4 = eC(function(Vs, $l) {
        return Vs - $l;
      }, 0);
      function Q4(Vs) {
        return Vs && Vs.length ? OC(Vs, NS) : 0;
      }
      function Z4(Vs, $l) {
        return Vs && Vs.length ? OC(Vs, S$($l, 2)) : 0;
      }
      return $m.after = _R, $m.ary = cD, $m.assign = aL, $m.assignIn = wD, $m.assignInWith = pC, $m.assignWith = sL, $m.at = lL, $m.before = uD, $m.bind = gI, $m.bindAll = d4, $m.bindKey = dD, $m.castArray = DR, $m.chain = aD, $m.chunk = zT, $m.compact = FT, $m.concat = BT, $m.cond = f4, $m.conforms = p4, $m.constant = SI, $m.countBy = QN, $m.create = cL, $m.curry = fD, $m.curryRight = pD, $m.debounce = hD, $m.defaults = uL, $m.defaultsDeep = dL, $m.defer = $R, $m.delay = bR, $m.difference = UT, $m.differenceBy = HT, $m.differenceWith = VT, $m.drop = WT, $m.dropRight = YT, $m.dropRightWhile = qT, $m.dropWhile = KT, $m.fill = QT, $m.filter = XN, $m.flatMap = tR, $m.flatMapDeep = nR, $m.flatMapDepth = rR, $m.flatten = nD, $m.flattenDeep = ZT, $m.flattenDepth = XT, $m.flip = SR, $m.flow = g4, $m.flowRight = m4, $m.fromPairs = JT, $m.functions = vL, $m.functionsIn = _L, $m.groupBy = iR, $m.initial = tN, $m.intersection = nN, $m.intersectionBy = rN, $m.intersectionWith = iN, $m.invert = bL, $m.invertBy = SL, $m.invokeMap = aR, $m.iteratee = wI, $m.keyBy = sR, $m.keys = mS, $m.keysIn = TS, $m.map = sC, $m.mapKeys = xL, $m.mapValues = EL, $m.matches = y4, $m.matchesProperty = _4, $m.memoize = cC, $m.merge = ML, $m.mergeWith = xD, $m.method = $4, $m.methodOf = b4, $m.mixin = xI, $m.negate = uC, $m.nthArg = w4, $m.omit = CL, $m.omitBy = IL, $m.once = wR, $m.orderBy = lR, $m.over = x4, $m.overArgs = xR, $m.overEvery = E4, $m.overSome = M4, $m.partial = mI, $m.partialRight = gD, $m.partition = cR, $m.pick = PL, $m.pickBy = MD, $m.property = TD, $m.propertyOf = C4, $m.pull = lN, $m.pullAll = iD, $m.pullAllBy = cN, $m.pullAllWith = uN, $m.pullAt = dN, $m.range = I4, $m.rangeRight = P4, $m.rearg = ER, $m.reject = fR, $m.remove = fN, $m.rest = MR, $m.reverse = pI, $m.sampleSize = hR, $m.set = DL, $m.setWith = AL, $m.shuffle = gR, $m.slice = pN, $m.sortBy = vR, $m.sortedUniq = $N, $m.sortedUniqBy = bN, $m.split = $j, $m.spread = CR, $m.tail = SN, $m.take = wN, $m.takeRight = xN, $m.takeRightWhile = EN, $m.takeWhile = MN, $m.tap = BN, $m.throttle = IR, $m.thru = aC, $m.toArray = $D, $m.toPairs = CD, $m.toPairsIn = ID, $m.toPath = R4, $m.toPlainObject = SD, $m.transform = TL, $m.unary = PR, $m.union = CN, $m.unionBy = IN, $m.unionWith = PN, $m.uniq = ON, $m.uniqBy = DN, $m.uniqWith = AN, $m.unset = NL, $m.unzip = hI, $m.unzipWith = oD, $m.update = RL, $m.updateWith = LL, $m.values = sM, $m.valuesIn = kL, $m.without = TN, $m.words = DD, $m.wrap = OR, $m.xor = NN, $m.xorBy = RN, $m.xorWith = LN, $m.zip = kN, $m.zipObject = jN, $m.zipObjectDeep = zN, $m.zipWith = FN, $m.entries = CD, $m.entriesIn = ID, $m.extend = wD, $m.extendWith = pC, xI($m, $m), $m.add = k4, $m.attempt = AD, $m.camelCase = BL, $m.capitalize = PD, $m.ceil = j4, $m.clamp = jL, $m.clone = AR, $m.cloneDeep = NR, $m.cloneDeepWith = RR, $m.cloneWith = TR, $m.conformsTo = LR, $m.deburr = OD, $m.defaultTo = h4, $m.divide = z4, $m.endsWith = UL, $m.eq = iE, $m.escape = HL, $m.escapeRegExp = VL, $m.every = ZN, $m.find = JN, $m.findIndex = eD, $m.findKey = fL, $m.findLast = eR, $m.findLastIndex = tD, $m.findLastKey = pL, $m.floor = F4, $m.forEach = sD, $m.forEachRight = lD, $m.forIn = hL, $m.forInRight = gL, $m.forOwn = mL, $m.forOwnRight = yL, $m.get = _I, $m.gt = kR, $m.gte = jR, $m.has = $L, $m.hasIn = $I, $m.head = rD, $m.identity = NS, $m.includes = oR, $m.indexOf = eN, $m.inRange = zL, $m.invoke = wL, $m.isArguments = VE, $m.isArray = C$, $m.isArrayBuffer = zR, $m.isArrayLike = AS, $m.isArrayLikeObject = iS, $m.isBoolean = FR, $m.isBuffer = NE, $m.isDate = BR, $m.isElement = UR, $m.isEmpty = HR, $m.isEqual = VR, $m.isEqualWith = WR, $m.isError = yI, $m.isFinite = GR, $m.isFunction = $E, $m.isInteger = mD, $m.isLength = dC, $m.isMap = yD, $m.isMatch = YR, $m.isMatchWith = qR, $m.isNaN = KR, $m.isNative = QR, $m.isNil = XR, $m.isNull = ZR, $m.isNumber = vD, $m.isObject = eS, $m.isObjectLike = nS, $m.isPlainObject = wM, $m.isRegExp = vI, $m.isSafeInteger = JR, $m.isSet = _D, $m.isString = fC, $m.isSymbol = FS, $m.isTypedArray = aM, $m.isUndefined = eL, $m.isWeakMap = tL, $m.isWeakSet = nL, $m.join = oN, $m.kebabCase = WL, $m.last = XS, $m.lastIndexOf = aN, $m.lowerCase = GL, $m.lowerFirst = YL, $m.lt = rL, $m.lte = iL, $m.max = B4, $m.maxBy = U4, $m.mean = H4, $m.meanBy = V4, $m.min = W4, $m.minBy = G4, $m.stubArray = MI, $m.stubFalse = CI, $m.stubObject = O4, $m.stubString = D4, $m.stubTrue = T4, $m.multiply = Y4, $m.nth = sN, $m.noConflict = S4, $m.noop = EI, $m.now = lC, $m.pad = qL, $m.padEnd = KL, $m.padStart = QL, $m.parseInt = ZL, $m.random = FL, $m.reduce = uR, $m.reduceRight = dR, $m.repeat = XL, $m.replace = JL, $m.result = OL, $m.round = q4, $m.runInContext = Om, $m.sample = pR, $m.size = mR, $m.snakeCase = _j, $m.some = yR, $m.sortedIndex = hN, $m.sortedIndexBy = gN, $m.sortedIndexOf = mN, $m.sortedLastIndex = yN, $m.sortedLastIndexBy = vN, $m.sortedLastIndexOf = _N, $m.startCase = e4, $m.startsWith = t4, $m.subtract = K4, $m.sum = Q4, $m.sumBy = Z4, $m.template = n4, $m.times = N4, $m.toFinite = bE, $m.toInteger = I$, $m.toLength = bD, $m.toLower = r4, $m.toNumber = JS, $m.toSafeInteger = oL, $m.toString = H$, $m.toUpper = i4, $m.trim = o4, $m.trimEnd = a4, $m.trimStart = s4, $m.truncate = l4, $m.unescape = c4, $m.uniqueId = L4, $m.upperCase = u4, $m.upperFirst = bI, $m.each = sD, $m.eachRight = lD, $m.first = rD, xI($m, function() {
        var Vs = {};
        return cE($m, function($l, Du) {
          W$.call($m.prototype, Du) || (Vs[Du] = $l);
        }), Vs;
      }(), { chain: !1 }), $m.VERSION = $n, YS(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(Vs) {
        $m[Vs].placeholder = $m;
      }), YS(["drop", "take"], function(Vs, $l) {
        N$.prototype[Vs] = function(Du) {
          Du = Du === Zt ? 1 : pS(I$(Du), 0);
          var om = this.__filtered__ && !$l ? new N$(this) : this.clone();
          return om.__filtered__ ? om.__takeCount__ = bS(Du, om.__takeCount__) : om.__views__.push({
            size: bS(Du, Sm),
            type: Vs + (om.__dir__ < 0 ? "Right" : "")
          }), om;
        }, N$.prototype[Vs + "Right"] = function(Du) {
          return this.reverse()[Vs](Du).reverse();
        };
      }), YS(["filter", "map", "takeWhile"], function(Vs, $l) {
        var Du = $l + 1, om = Du == zu || Du == sm;
        N$.prototype[Vs] = function(vm) {
          var bm = this.clone();
          return bm.__iteratees__.push({
            iteratee: S$(vm, 3),
            type: Du
          }), bm.__filtered__ = bm.__filtered__ || om, bm;
        };
      }), YS(["head", "last"], function(Vs, $l) {
        var Du = "take" + ($l ? "Right" : "");
        N$.prototype[Vs] = function() {
          return this[Du](1).value()[0];
        };
      }), YS(["initial", "tail"], function(Vs, $l) {
        var Du = "drop" + ($l ? "" : "Right");
        N$.prototype[Vs] = function() {
          return this.__filtered__ ? new N$(this) : this[Du](1);
        };
      }), N$.prototype.compact = function() {
        return this.filter(NS);
      }, N$.prototype.find = function(Vs) {
        return this.filter(Vs).head();
      }, N$.prototype.findLast = function(Vs) {
        return this.reverse().find(Vs);
      }, N$.prototype.invokeMap = A$(function(Vs, $l) {
        return typeof Vs == "function" ? new N$(this) : this.map(function(Du) {
          return yM(Du, Vs, $l);
        });
      }), N$.prototype.reject = function(Vs) {
        return this.filter(uC(S$(Vs)));
      }, N$.prototype.slice = function(Vs, $l) {
        Vs = I$(Vs);
        var Du = this;
        return Du.__filtered__ && (Vs > 0 || $l < 0) ? new N$(Du) : (Vs < 0 ? Du = Du.takeRight(-Vs) : Vs && (Du = Du.drop(Vs)), $l !== Zt && ($l = I$($l), Du = $l < 0 ? Du.dropRight(-$l) : Du.take($l - Vs)), Du);
      }, N$.prototype.takeRightWhile = function(Vs) {
        return this.reverse().takeWhile(Vs).reverse();
      }, N$.prototype.toArray = function() {
        return this.take(Sm);
      }, cE(N$.prototype, function(Vs, $l) {
        var Du = /^(?:filter|find|map|reject)|While$/.test($l), om = /^(?:head|last)$/.test($l), vm = $m[om ? "take" + ($l == "last" ? "Right" : "") : $l], bm = om || /^find/.test($l);
        vm && ($m.prototype[$l] = function() {
          var xm = this.__wrapped__, Em = om ? [1] : arguments, Tm = xm instanceof N$, e$ = Em[0], t$ = Tm || C$(xm), r$ = function(T$) {
            var L$ = vm.apply($m, CE([T$], Em));
            return om && c$ ? L$[0] : L$;
          };
          t$ && Du && typeof e$ == "function" && e$.length != 1 && (Tm = t$ = !1);
          var c$ = this.__chain__, y$ = !!this.__actions__.length, w$ = bm && !c$, P$ = Tm && !y$;
          if (!bm && t$) {
            xm = P$ ? xm : new N$(this);
            var x$ = Vs.apply(xm, Em);
            return x$.__actions__.push({ func: aC, args: [r$], thisArg: Zt }), new KS(x$, c$);
          }
          return w$ && P$ ? Vs.apply(this, Em) : (x$ = this.thru(r$), w$ ? om ? x$.value()[0] : x$.value() : x$);
        });
      }), YS(["pop", "push", "shift", "sort", "splice", "unshift"], function(Vs) {
        var $l = AM[Vs], Du = /^(?:push|sort|unshift)$/.test(Vs) ? "tap" : "thru", om = /^(?:pop|shift)$/.test(Vs);
        $m.prototype[Vs] = function() {
          var vm = arguments;
          if (om && !this.__chain__) {
            var bm = this.value();
            return $l.apply(C$(bm) ? bm : [], vm);
          }
          return this[Du](function(xm) {
            return $l.apply(C$(xm) ? xm : [], vm);
          });
        };
      }), cE(N$.prototype, function(Vs, $l) {
        var Du = $m[$l];
        if (Du) {
          var om = Du.name + "";
          W$.call(tM, om) || (tM[om] = []), tM[om].push({ name: $l, func: Du });
        }
      }), tM[JM(Zt, Bs).name] = [{
        name: "wrapper",
        func: Zt
      }], N$.prototype.clone = cA, N$.prototype.reverse = uA, N$.prototype.value = dA, $m.prototype.at = UN, $m.prototype.chain = HN, $m.prototype.commit = VN, $m.prototype.next = WN, $m.prototype.plant = YN, $m.prototype.reverse = qN, $m.prototype.toJSON = $m.prototype.valueOf = $m.prototype.value = KN, $m.prototype.first = $m.prototype.head, uM && ($m.prototype[uM] = GN), $m;
    }, XE = z2();
    LE ? ((LE.exports = XE)._ = XE, wC._ = XE) : vS._ = XE;
  }).call(commonjsGlobal);
})(lodash, lodash.exports);
var lodashExports = lodash.exports, reactIs$2 = { exports: {} }, reactIs_production_min$1 = {};
/**
 * @license React
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var b$4 = Symbol.for("react.element"), c$4 = Symbol.for("react.portal"), d$2 = Symbol.for("react.fragment"), e$3 = Symbol.for("react.strict_mode"), f$2 = Symbol.for("react.profiler"), g$3 = Symbol.for("react.provider"), h$5 = Symbol.for("react.context"), k$4 = Symbol.for("react.server_context"), l$3 = Symbol.for("react.forward_ref"), m$6 = Symbol.for("react.suspense"), n$4 = Symbol.for("react.suspense_list"), p$4 = Symbol.for("react.memo"), q$5 = Symbol.for("react.lazy"), t$5 = Symbol.for("react.offscreen"), u$4;
u$4 = Symbol.for("react.module.reference");
function v$3(_e) {
  if (typeof _e == "object" && _e !== null) {
    var Qt = _e.$$typeof;
    switch (Qt) {
      case b$4:
        switch (_e = _e.type, _e) {
          case d$2:
          case f$2:
          case e$3:
          case m$6:
          case n$4:
            return _e;
          default:
            switch (_e = _e && _e.$$typeof, _e) {
              case k$4:
              case h$5:
              case l$3:
              case q$5:
              case p$4:
              case g$3:
                return _e;
              default:
                return Qt;
            }
        }
      case c$4:
        return Qt;
    }
  }
}
reactIs_production_min$1.ContextConsumer = h$5;
reactIs_production_min$1.ContextProvider = g$3;
reactIs_production_min$1.Element = b$4;
reactIs_production_min$1.ForwardRef = l$3;
reactIs_production_min$1.Fragment = d$2;
reactIs_production_min$1.Lazy = q$5;
reactIs_production_min$1.Memo = p$4;
reactIs_production_min$1.Portal = c$4;
reactIs_production_min$1.Profiler = f$2;
reactIs_production_min$1.StrictMode = e$3;
reactIs_production_min$1.Suspense = m$6;
reactIs_production_min$1.SuspenseList = n$4;
reactIs_production_min$1.isAsyncMode = function() {
  return !1;
};
reactIs_production_min$1.isConcurrentMode = function() {
  return !1;
};
reactIs_production_min$1.isContextConsumer = function(_e) {
  return v$3(_e) === h$5;
};
reactIs_production_min$1.isContextProvider = function(_e) {
  return v$3(_e) === g$3;
};
reactIs_production_min$1.isElement = function(_e) {
  return typeof _e == "object" && _e !== null && _e.$$typeof === b$4;
};
reactIs_production_min$1.isForwardRef = function(_e) {
  return v$3(_e) === l$3;
};
reactIs_production_min$1.isFragment = function(_e) {
  return v$3(_e) === d$2;
};
reactIs_production_min$1.isLazy = function(_e) {
  return v$3(_e) === q$5;
};
reactIs_production_min$1.isMemo = function(_e) {
  return v$3(_e) === p$4;
};
reactIs_production_min$1.isPortal = function(_e) {
  return v$3(_e) === c$4;
};
reactIs_production_min$1.isProfiler = function(_e) {
  return v$3(_e) === f$2;
};
reactIs_production_min$1.isStrictMode = function(_e) {
  return v$3(_e) === e$3;
};
reactIs_production_min$1.isSuspense = function(_e) {
  return v$3(_e) === m$6;
};
reactIs_production_min$1.isSuspenseList = function(_e) {
  return v$3(_e) === n$4;
};
reactIs_production_min$1.isValidElementType = function(_e) {
  return typeof _e == "string" || typeof _e == "function" || _e === d$2 || _e === f$2 || _e === e$3 || _e === m$6 || _e === n$4 || _e === t$5 || typeof _e == "object" && _e !== null && (_e.$$typeof === q$5 || _e.$$typeof === p$4 || _e.$$typeof === g$3 || _e.$$typeof === h$5 || _e.$$typeof === l$3 || _e.$$typeof === u$4 || _e.getModuleId !== void 0);
};
reactIs_production_min$1.typeOf = v$3;
reactIs$2.exports = reactIs_production_min$1;
var reactIsExports$1 = reactIs$2.exports;
class ReactWidget extends Widget {
  constructor() {
    super(), this._rootDOM = null;
  }
  /**
   * Creates a new `ReactWidget` that renders a constant element.
   * @param element React element to render.
   */
  static create(Qt) {
    return new class extends ReactWidget {
      render() {
        return Qt;
      }
    }();
  }
  /**
   * Called to update the state of the widget.
   *
   * The default implementation of this method triggers
   * VDOM based rendering by calling the `renderDOM` method.
   */
  onUpdateRequest(Qt) {
    this.renderPromise = this.renderDOM();
  }
  /**
   * Called after the widget is attached to the DOM
   */
  onAfterAttach(Qt) {
    MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);
  }
  /**
   * Called before the widget is detached from the DOM.
   */
  onBeforeDetach(Qt) {
    this._rootDOM !== null && (this._rootDOM.unmount(), this._rootDOM = null);
  }
  /**
   * Render the React nodes to the DOM.
   *
   * @returns a promise that resolves when the rendering is done.
   */
  renderDOM() {
    return new Promise((Qt) => {
      const Zt = this.render();
      this._rootDOM === null && (this._rootDOM = createRoot(this.node)), Array.isArray(Zt) ? (this._rootDOM.render(Zt), requestIdleCallback(() => Qt())) : Zt ? (this._rootDOM.render(Zt), requestIdleCallback(() => Qt())) : (this._rootDOM.unmount(), this._rootDOM = null, requestIdleCallback(() => Qt()));
    });
  }
}
class UseSignal extends reactExports.Component {
  constructor(Qt) {
    super(Qt), this.slot = (Zt, $n) => {
      this.props.shouldUpdate && !this.props.shouldUpdate(Zt, $n) || this.setState({ value: [Zt, $n] });
    }, this.state = { value: [this.props.initialSender, this.props.initialArgs] };
  }
  componentDidMount() {
    this.props.signal.connect(this.slot);
  }
  componentWillUnmount() {
    this.props.signal.disconnect(this.slot);
  }
  render() {
    return this.props.children(...this.state.value);
  }
}
const COLLAPSER_CLASS = "jp-Collapser", COLLAPSER_CHILD_CLASS = "jp-Collapser-child", INPUT_COLLAPSER = "jp-InputCollapser", OUTPUT_COLLAPSER = "jp-OutputCollapser";
class Collapser extends ReactWidget {
  /**
   * Construct a new collapser.
   */
  constructor() {
    super(), this.addClass(COLLAPSER_CLASS);
  }
  /**
   * Is the input/output of the parent collapsed.
   */
  get collapsed() {
    return !1;
  }
  /**
   * Render the collapser with the virtual DOM.
   */
  render() {
    const Qt = COLLAPSER_CHILD_CLASS;
    return reactExports.createElement("div", { className: Qt, onClick: (Zt) => this.handleClick(Zt) });
  }
}
class InputCollapser extends Collapser {
  /**
   * Construct a new input collapser.
   */
  constructor() {
    super(), this.addClass(INPUT_COLLAPSER);
  }
  /**
   * Is the cell's input collapsed?
   */
  get collapsed() {
    var Qt;
    const Zt = (Qt = this.parent) === null || Qt === void 0 ? void 0 : Qt.parent;
    return Zt ? Zt.inputHidden : !1;
  }
  /**
   * Handle a click event for the user to collapse the cell's input.
   */
  handleClick(Qt) {
    var Zt;
    const $n = (Zt = this.parent) === null || Zt === void 0 ? void 0 : Zt.parent;
    $n && ($n.inputHidden = !$n.inputHidden), this.update();
  }
}
class OutputCollapser extends Collapser {
  /**
   * Construct a new output collapser.
   */
  constructor() {
    super(), this.addClass(OUTPUT_COLLAPSER);
  }
  /**
   * Is the cell's output collapsed?
   */
  get collapsed() {
    var Qt;
    const Zt = (Qt = this.parent) === null || Qt === void 0 ? void 0 : Qt.parent;
    return Zt ? Zt.outputHidden : !1;
  }
  /**
   * Handle a click event for the user to collapse the cell's output.
   */
  handleClick(Qt) {
    var Zt, $n;
    const Sn = (Zt = this.parent) === null || Zt === void 0 ? void 0 : Zt.parent;
    if (Sn && (Sn.outputHidden = !Sn.outputHidden, Sn.outputHidden)) {
      let kn = ($n = Sn.parent) === null || $n === void 0 ? void 0 : $n.node;
      kn && ElementExt.scrollIntoViewIfNeeded(kn, Sn.node);
    }
    this.update();
  }
}
const CELL_HEADER_CLASS$1 = "jp-CellHeader", CELL_FOOTER_CLASS$1 = "jp-CellFooter";
class CellHeader extends Widget {
  /**
   * Construct a new cell header.
   */
  constructor() {
    super(), this.addClass(CELL_HEADER_CLASS$1);
  }
}
class CellFooter extends Widget {
  /**
   * Construct a new cell footer.
   */
  constructor() {
    super(), this.addClass(CELL_FOOTER_CLASS$1);
  }
}
class ObservableMap {
  /**
   * Construct a new observable map.
   */
  constructor(Qt = {}) {
    if (this._map = /* @__PURE__ */ new Map(), this._changed = new Signal(this), this._isDisposed = !1, this._itemCmp = Qt.itemCmp || Private$5.itemCmp, Qt.values)
      for (const Zt in Qt.values)
        this._map.set(Zt, Qt.values[Zt]);
  }
  /**
   * The type of the Observable.
   */
  get type() {
    return "Map";
  }
  /**
   * A signal emitted when the map has changed.
   */
  get changed() {
    return this._changed;
  }
  /**
   * Whether this map has been disposed.
   */
  get isDisposed() {
    return this._isDisposed;
  }
  /**
   * The number of key-value pairs in the map.
   */
  get size() {
    return this._map.size;
  }
  /**
   * Set a key-value pair in the map
   *
   * @param key - The key to set.
   *
   * @param value - The value for the key.
   *
   * @returns the old value for the key, or undefined
   *   if that did not exist.
   *
   * @throws if the new value is undefined.
   *
   * #### Notes
   * This is a no-op if the value does not change.
   */
  set(Qt, Zt) {
    const $n = this._map.get(Qt);
    if (Zt === void 0)
      throw Error("Cannot set an undefined value, use remove");
    const Sn = this._itemCmp;
    return $n !== void 0 && Sn($n, Zt) || (this._map.set(Qt, Zt), this._changed.emit({
      type: $n ? "change" : "add",
      key: Qt,
      oldValue: $n,
      newValue: Zt
    })), $n;
  }
  /**
   * Get a value for a given key.
   *
   * @param key - the key.
   *
   * @returns the value for that key.
   */
  get(Qt) {
    return this._map.get(Qt);
  }
  /**
   * Check whether the map has a key.
   *
   * @param key - the key to check.
   *
   * @returns `true` if the map has the key, `false` otherwise.
   */
  has(Qt) {
    return this._map.has(Qt);
  }
  /**
   * Get a list of the keys in the map.
   *
   * @returns - a list of keys.
   */
  keys() {
    const Qt = [];
    return this._map.forEach((Zt, $n) => {
      Qt.push($n);
    }), Qt;
  }
  /**
   * Get a list of the values in the map.
   *
   * @returns - a list of values.
   */
  values() {
    const Qt = [];
    return this._map.forEach((Zt, $n) => {
      Qt.push(Zt);
    }), Qt;
  }
  /**
   * Remove a key from the map
   *
   * @param key - the key to remove.
   *
   * @returns the value of the given key,
   *   or undefined if that does not exist.
   *
   * #### Notes
   * This is a no-op if the value does not change.
   */
  delete(Qt) {
    const Zt = this._map.get(Qt);
    return this._map.delete(Qt) && this._changed.emit({
      type: "remove",
      key: Qt,
      oldValue: Zt,
      newValue: void 0
    }), Zt;
  }
  /**
   * Set the ObservableMap to an empty map.
   */
  clear() {
    const Qt = this.keys();
    for (let Zt = 0; Zt < Qt.length; Zt++)
      this.delete(Qt[Zt]);
  }
  /**
   * Dispose of the resources held by the map.
   */
  dispose() {
    this.isDisposed || (this._isDisposed = !0, Signal.clearData(this), this._map.clear());
  }
}
var Private$5;
(function(_e) {
  function Qt(Zt, $n) {
    return Zt === $n;
  }
  _e.itemCmp = Qt;
})(Private$5 || (Private$5 = {}));
class ObservableJSON extends ObservableMap {
  /**
   * Construct a new observable JSON object.
   */
  constructor(Qt = {}) {
    super({
      itemCmp: JSONExt.deepEqual,
      values: Qt.values
    });
  }
  /**
   * Serialize the model to JSON.
   */
  toJSON() {
    const Qt = /* @__PURE__ */ Object.create(null), Zt = this.keys();
    for (const $n of Zt) {
      const Sn = this.get($n);
      Sn !== void 0 && (Qt[$n] = JSONExt.deepCopy(Sn));
    }
    return Qt;
  }
}
(function(_e) {
  class Qt extends Message {
    /**
     * Create a new metadata changed message.
     */
    constructor($n, Sn) {
      super($n), this.args = Sn;
    }
  }
  _e.ChangeMessage = Qt;
})(ObservableJSON || (ObservableJSON = {}));
const HAS_SELECTION_CLASS = "jp-mod-has-primary-selection", HAS_IN_LEADING_WHITESPACE_CLASS = "jp-mod-in-leading-whitespace", DROP_TARGET_CLASS = "jp-mod-dropTarget", leadingWhitespaceRe = /^\s+$/;
class CodeEditorWrapper extends Widget {
  /**
   * Construct a new code editor widget.
   */
  constructor(Qt) {
    super();
    const { factory: Zt, model: $n, editorOptions: Sn } = Qt;
    (this.editor = Zt({
      host: this.node,
      model: $n,
      ...Sn
    })).model.selections.changed.connect(this._onSelectionsChanged, this);
  }
  /**
   * Get the model used by the widget.
   */
  get model() {
    return this.editor.model;
  }
  /**
   * Dispose of the resources held by the widget.
   */
  dispose() {
    this.isDisposed || (this.editor.dispose(), super.dispose());
  }
  /**
   * Handle the DOM events for the widget.
   *
   * @param event - The DOM event sent to the widget.
   *
   * #### Notes
   * This method implements the DOM `EventListener` interface and is
   * called in response to events on the notebook panel's node. It should
   * not be called directly by user code.
   */
  handleEvent(Qt) {
    switch (Qt.type) {
      case "lm-dragenter":
        this._evtDragEnter(Qt);
        break;
      case "lm-dragleave":
        this._evtDragLeave(Qt);
        break;
      case "lm-dragover":
        this._evtDragOver(Qt);
        break;
      case "lm-drop":
        this._evtDrop(Qt);
        break;
    }
  }
  /**
   * Handle `'activate-request'` messages.
   */
  onActivateRequest(Qt) {
    this.editor.focus();
  }
  /**
   * A message handler invoked on an `'after-attach'` message.
   */
  onAfterAttach(Qt) {
    super.onAfterAttach(Qt);
    const Zt = this.node;
    Zt.addEventListener("lm-dragenter", this), Zt.addEventListener("lm-dragleave", this), Zt.addEventListener("lm-dragover", this), Zt.addEventListener("lm-drop", this);
  }
  /**
   * Handle `before-detach` messages for the widget.
   */
  onBeforeDetach(Qt) {
    const Zt = this.node;
    Zt.removeEventListener("lm-dragenter", this), Zt.removeEventListener("lm-dragleave", this), Zt.removeEventListener("lm-dragover", this), Zt.removeEventListener("lm-drop", this);
  }
  /**
   * Handle a change in model selections.
   */
  _onSelectionsChanged() {
    const { start: Qt, end: Zt } = this.editor.getSelection();
    Qt.column !== Zt.column || Qt.line !== Zt.line ? (this.addClass(HAS_SELECTION_CLASS), this.removeClass(HAS_IN_LEADING_WHITESPACE_CLASS)) : (this.removeClass(HAS_SELECTION_CLASS), this.editor.getLine(Zt.line).slice(0, Zt.column).match(leadingWhitespaceRe) ? this.addClass(HAS_IN_LEADING_WHITESPACE_CLASS) : this.removeClass(HAS_IN_LEADING_WHITESPACE_CLASS));
  }
  /**
   * Handle the `'lm-dragenter'` event for the widget.
   */
  _evtDragEnter(Qt) {
    this.editor.getOption("readOnly") === !0 || Private$4.findTextData(Qt.mimeData) === void 0 || (Qt.preventDefault(), Qt.stopPropagation(), this.addClass("jp-mod-dropTarget"));
  }
  /**
   * Handle the `'lm-dragleave'` event for the widget.
   */
  _evtDragLeave(Qt) {
    this.removeClass(DROP_TARGET_CLASS), !(this.editor.getOption("readOnly") === !0 || Private$4.findTextData(Qt.mimeData) === void 0) && (Qt.preventDefault(), Qt.stopPropagation());
  }
  /**
   * Handle the `'lm-dragover'` event for the widget.
   */
  _evtDragOver(Qt) {
    this.removeClass(DROP_TARGET_CLASS), !(this.editor.getOption("readOnly") === !0 || Private$4.findTextData(Qt.mimeData) === void 0) && (Qt.preventDefault(), Qt.stopPropagation(), Qt.dropAction = "copy", this.addClass(DROP_TARGET_CLASS));
  }
  /**
   * Handle the `'lm-drop'` event for the widget.
   */
  _evtDrop(Qt) {
    if (this.editor.getOption("readOnly") === !0)
      return;
    const Zt = Private$4.findTextData(Qt.mimeData);
    if (Zt === void 0)
      return;
    const $n = {
      top: Qt.y,
      bottom: Qt.y,
      left: Qt.x,
      right: Qt.x,
      x: Qt.x,
      y: Qt.y,
      width: 0,
      height: 0
    }, Sn = this.editor.getPositionForCoordinate($n);
    if (Sn === null)
      return;
    if (this.removeClass(DROP_TARGET_CLASS), Qt.preventDefault(), Qt.stopPropagation(), Qt.proposedAction === "none") {
      Qt.dropAction = "none";
      return;
    }
    const kn = this.editor.getOffsetAt(Sn);
    this.model.sharedModel.updateSource(kn, kn, Zt);
  }
}
var Private$4;
(function(_e) {
  function Qt(Zt) {
    const Sn = Zt.types().find((kn) => kn.indexOf("text") === 0);
    if (Sn !== void 0)
      return Zt.getData(Sn);
  }
  _e.findTextData = Qt;
})(Private$4 || (Private$4 = {}));
const INPUT_AREA_CLASS = "jp-InputArea", INPUT_AREA_PROMPT_CLASS = "jp-InputArea-prompt", INPUT_PROMPT_CLASS$1 = "jp-InputPrompt", INPUT_AREA_EDITOR_CLASS = "jp-InputArea-editor";
class InputArea extends Widget {
  /**
   * Construct an input area widget.
   */
  constructor(Qt) {
    super(), this.addClass(INPUT_AREA_CLASS);
    const { contentFactory: Zt, editorOptions: $n, model: Sn } = Qt;
    this.model = Sn, this.contentFactory = Zt;
    const kn = this._prompt = Zt.createInputPrompt();
    kn.addClass(INPUT_AREA_PROMPT_CLASS);
    const Kn = this._editor = new CodeEditorWrapper({
      factory: Zt.editorFactory,
      model: Sn,
      editorOptions: $n
    });
    Kn.addClass(INPUT_AREA_EDITOR_CLASS);
    const er = this.layout = new PanelLayout();
    er.addWidget(kn), er.addWidget(Kn);
  }
  /**
   * Get the CodeEditorWrapper used by the cell.
   */
  get editorWidget() {
    return this._editor;
  }
  /**
   * Get the CodeEditor used by the cell.
   */
  get editor() {
    return this._editor.editor;
  }
  /**
   * Get the prompt node used by the cell.
   */
  get promptNode() {
    return this._prompt.node;
  }
  /**
   * Get the rendered input area widget, if any.
   */
  get renderedInput() {
    return this._rendered;
  }
  /**
   * Render an input instead of the text editor.
   */
  renderInput(Qt) {
    const Zt = this.layout;
    this._rendered && (this._rendered.parent = null), this._editor.hide(), this._rendered = Qt, Zt.addWidget(Qt);
  }
  /**
   * Show the text editor.
   */
  showEditor() {
    this._rendered && (this._rendered.parent = null), this._editor.show();
  }
  /**
   * Set the prompt of the input area.
   */
  setPrompt(Qt) {
    this._prompt.executionCount = Qt;
  }
  /**
   * Dispose of the resources held by the widget.
   */
  dispose() {
    this.isDisposed || (this._prompt = null, this._editor = null, this._rendered = null, super.dispose());
  }
}
(function(_e) {
  class Qt {
    /**
     * Construct a `ContentFactory`.
     */
    constructor($n) {
      this._editor = $n.editorFactory;
    }
    /**
     * Return the `CodeEditor.Factory` being used.
     */
    get editorFactory() {
      return this._editor;
    }
    /**
     * Create an input prompt.
     */
    createInputPrompt() {
      return new InputPrompt();
    }
  }
  _e.ContentFactory = Qt;
})(InputArea || (InputArea = {}));
class InputPrompt extends Widget {
  /*
   * Create an output prompt widget.
   */
  constructor() {
    super(), this._executionCount = null, this.addClass(INPUT_PROMPT_CLASS$1);
  }
  /**
   * The execution count for the prompt.
   */
  get executionCount() {
    return this._executionCount;
  }
  set executionCount(Qt) {
    this._executionCount = Qt, Qt === null ? this.node.textContent = " " : this.node.textContent = `[${Qt || " "}]:`;
  }
}
class AttachmentModel {
  /**
   * Construct a new attachment model.
   */
  constructor(Qt) {
    this.trusted = !1, this._changed = new Signal(this), this._raw = {};
    const Zt = Private$3.getData(Qt.value);
    this._data = new ObservableJSON({ values: Zt }), this._rawData = Zt;
    const $n = Qt.value;
    for (const Sn in $n)
      switch (Sn) {
        case "data":
          break;
        default:
          this._raw[Sn] = Private$3.extract($n, Sn);
      }
  }
  /**
   * A signal emitted when the attachment model changes.
   */
  get changed() {
    return this._changed;
  }
  /**
   * Dispose of the resources used by the attachment model.
   */
  dispose() {
    this._data.dispose(), Signal.clearData(this);
  }
  /**
   * The data associated with the model.
   */
  get data() {
    return this._rawData;
  }
  /**
   * The metadata associated with the model.
   */
  get metadata() {
    return {};
  }
  /**
   * Set the data associated with the model.
   *
   * #### Notes
   * Depending on the implementation of the mime model,
   * this call may or may not have deferred effects,
   */
  setData(Qt) {
    Qt.data && (this._updateObservable(this._data, Qt.data), this._rawData = Qt.data), this._changed.emit(void 0);
  }
  /**
   * Serialize the model to JSON.
   */
  toJSON() {
    const Qt = {};
    for (const Zt in this._raw)
      Qt[Zt] = Private$3.extract(this._raw, Zt);
    return Qt;
  }
  /**
   * Update an observable JSON object using a readonly JSON object.
   */
  _updateObservable(Qt, Zt) {
    const $n = Qt.keys(), Sn = Object.keys(Zt);
    for (const kn of $n)
      Sn.indexOf(kn) === -1 && Qt.delete(kn);
    for (const kn of Sn) {
      const Kn = Qt.get(kn), er = Zt[kn];
      Kn !== er && Qt.set(kn, er);
    }
  }
}
(function(_e) {
  function Qt(Zt) {
    return Private$3.getData(Zt);
  }
  _e.getData = Qt;
})(AttachmentModel || (AttachmentModel = {}));
var Private$3;
(function(_e) {
  function Qt(kn) {
    return Sn(kn);
  }
  _e.getData = Qt;
  function Zt(kn) {
    return { data: Qt(kn.value) };
  }
  _e.getBundleOptions = Zt;
  function $n(kn, Kn) {
    const er = kn[Kn];
    return er === void 0 || JSONExt.isPrimitive(er) ? er : JSONExt.deepCopy(er);
  }
  _e.extract = $n;
  function Sn(kn) {
    const Kn = /* @__PURE__ */ Object.create(null);
    for (const er in kn)
      Kn[er] = $n(kn, er);
    return Kn;
  }
})(Private$3 || (Private$3 = {}));
var INFINITY = 1 / 0, symbolTag = "[object Symbol]", reUnescapedHtml = /[&<>"'`]/g, reHasUnescapedHtml = RegExp(reUnescapedHtml.source), htmlEscapes = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;",
  "`": "&#96;"
}, freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal, freeSelf = typeof self == "object" && self && self.Object === Object && self, root$1 = freeGlobal || freeSelf || Function("return this")();
function basePropertyOf(_e) {
  return function(Qt) {
    return _e == null ? void 0 : _e[Qt];
  };
}
var escapeHtmlChar = basePropertyOf(htmlEscapes), objectProto = Object.prototype, objectToString = objectProto.toString, Symbol$2 = root$1.Symbol, symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
function baseToString(_e) {
  if (typeof _e == "string")
    return _e;
  if (isSymbol(_e))
    return symbolToString ? symbolToString.call(_e) : "";
  var Qt = _e + "";
  return Qt == "0" && 1 / _e == -INFINITY ? "-0" : Qt;
}
function isObjectLike(_e) {
  return !!_e && typeof _e == "object";
}
function isSymbol(_e) {
  return typeof _e == "symbol" || isObjectLike(_e) && objectToString.call(_e) == symbolTag;
}
function toString$2(_e) {
  return _e == null ? "" : baseToString(_e);
}
function escape$2(_e) {
  return _e = toString$2(_e), _e && reHasUnescapedHtml.test(_e) ? _e.replace(reUnescapedHtml, escapeHtmlChar) : _e;
}
var lodash_escape = escape$2;
const escape$3 = /* @__PURE__ */ getDefaultExportFromCjs$1(lodash_escape), inline$1 = "$", MATHSPLIT = /(\$\$?|\\(?:begin|end)\{[a-z]*\*?\}|\\[{}$]|[{}]|(?:\n\s*)+|@@\d+@@|\\\\(?:\(|\)|\[|\]))/i;
function removeMath(_e) {
  const Qt = [];
  let Zt = null, $n = null, Sn = null, kn = 0, Kn;
  _e.includes("`") || _e.includes("~~~") ? (_e = _e.replace(/~/g, "~T").replace(/^(?<fence>`{3,}|(~T){3,})[^`\n]*\n([\s\S]*?)^\k<fence>`*$/gm, (kr) => kr.replace(/\$/g, "~D")).replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm, (kr) => kr.replace(/\$/g, "~D")), Kn = (kr) => kr.replace(/~([TD])/g, (Yr, Ms) => Ms === "T" ? "~" : inline$1)) : Kn = (kr) => kr;
  let Cr = _e.replace(/\r\n?/g, `
`).split(MATHSPLIT);
  for (let kr = 1, Yr = Cr.length; kr < Yr; kr += 2) {
    const Ms = Cr[kr];
    Ms.charAt(0) === "@" ? (Cr[kr] = "@@" + Qt.length + "@@", Qt.push(Ms)) : Zt !== null ? Ms === $n ? kn ? Sn = kr : (Cr = processMath(Zt, kr, Kn, Qt, Cr), Zt = null, $n = null, Sn = null) : Ms.match(/\n.*\n/) ? (Sn !== null && (kr = Sn, Cr = processMath(Zt, kr, Kn, Qt, Cr)), Zt = null, $n = null, Sn = null, kn = 0) : Ms === "{" ? kn++ : Ms === "}" && kn && kn-- : Ms === inline$1 || Ms === "$$" ? (Zt = kr, $n = Ms, kn = 0) : Ms === "\\\\(" || Ms === "\\\\[" ? (Zt = kr, $n = Ms.slice(-1) === "(" ? "\\\\)" : "\\\\]", kn = 0) : Ms.substr(1, 5) === "begin" && (Zt = kr, $n = "\\end" + Ms.substr(6), kn = 0);
  }
  return Zt !== null && Sn !== null && (Cr = processMath(Zt, Sn, Kn, Qt, Cr), Zt = null, $n = null, Sn = null), { text: Kn(Cr.join("")), math: Qt };
}
function replaceMath(_e, Qt) {
  const Zt = ($n, Sn) => {
    let kn = Qt[Sn];
    return kn.substr(0, 3) === "\\\\(" && kn.substr(kn.length - 3) === "\\\\)" ? kn = "\\(" + kn.substring(3, kn.length - 3) + "\\)" : kn.substr(0, 3) === "\\\\[" && kn.substr(kn.length - 3) === "\\\\]" && (kn = "\\[" + kn.substring(3, kn.length - 3) + "\\]"), kn;
  };
  return _e.replace(/@@(\d+)@@/g, Zt);
}
function processMath(_e, Qt, Zt, $n, Sn) {
  let kn = Sn.slice(_e, Qt + 1).join("").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
  for (navigator && navigator.appName === "Microsoft Internet Explorer" && (kn = kn.replace(/(%[^\n]*)\n/g, `$1<br/>
`)); Qt > _e; )
    Sn[Qt] = "", Qt--;
  return Sn[_e] = "@@" + $n.length + "@@", Zt && (kn = Zt(kn)), $n.push(kn), Sn;
}
function renderHTML(_e) {
  let { host: Qt, source: Zt, trusted: $n, sanitizer: Sn, resolver: kn, linkHandler: Kn, shouldTypeset: er, latexTypesetter: Cr, translator: kr } = _e;
  kr = kr || nullTranslator;
  const Yr = kr == null ? void 0 : kr.load("jupyterlab");
  let Ms = Zt;
  if (!Zt)
    return Qt.textContent = "", Promise.resolve(void 0);
  if ($n || (Ms = `${Zt}`, Zt = Sn.sanitize(Zt)), Qt.innerHTML = Zt, Qt.getElementsByTagName("script").length > 0)
    if ($n)
      Private$2.evalInnerHTMLScriptTags(Qt);
    else {
      const Ls = document.createElement("div"), js = document.createElement("pre");
      js.textContent = Yr.__("This HTML output contains inline scripts. Are you sure that you want to run arbitrary Javascript within your JupyterLab session?");
      const zs = document.createElement("button");
      zs.textContent = Yr.__("Run"), zs.onclick = (Fs) => {
        Qt.innerHTML = Ms, Private$2.evalInnerHTMLScriptTags(Qt), Qt.firstChild && Qt.removeChild(Qt.firstChild);
      }, Ls.appendChild(js), Ls.appendChild(zs), Qt.insertBefore(Ls, Qt.firstChild);
    }
  Private$2.handleDefaults(Qt, kn);
  let Ds;
  return kn ? Ds = Private$2.handleUrls(Qt, kn, Kn) : Ds = Promise.resolve(void 0), Ds.then(() => {
    er && Cr && Cr.typeset(Qt);
  });
}
function renderImage(_e) {
  const { host: Qt, mimeType: Zt, source: $n, width: Sn, height: kn, needsBackground: Kn, unconfined: er } = _e;
  Qt.textContent = "";
  const Cr = document.createElement("img");
  return Cr.src = `data:${Zt};base64,${$n}`, typeof kn == "number" && (Cr.height = kn), typeof Sn == "number" && (Cr.width = Sn), Kn === "light" ? Cr.classList.add("jp-needs-light-background") : Kn === "dark" && Cr.classList.add("jp-needs-dark-background"), er === !0 && Cr.classList.add("jp-mod-unconfined"), Qt.appendChild(Cr), Promise.resolve(void 0);
}
async function renderMarkdown(_e) {
  const { host: Qt, source: Zt, markdownParser: $n, ...Sn } = _e;
  if (!Zt) {
    Qt.textContent = "";
    return;
  }
  let kn = "";
  if ($n) {
    const Kn = removeMath(Zt);
    kn = await $n.render(Kn.text), kn = replaceMath(kn, Kn.math);
  } else
    kn = `<pre>${Zt}</pre>`;
  await renderHTML({
    host: Qt,
    source: kn,
    ...Sn
  }), Private$2.headerAnchors(Qt);
}
(function(_e) {
  function Qt(Zt) {
    var $n;
    return (($n = Zt.textContent) !== null && $n !== void 0 ? $n : "").replace(/ /g, "-");
  }
  _e.createHeaderId = Qt;
})(renderMarkdown || (renderMarkdown = {}));
var Private$2;
(function(_e) {
  function Qt(Ms) {
    const Ds = Array.from(Ms.getElementsByTagName("script"));
    for (const Ls of Ds) {
      if (!Ls.parentNode)
        continue;
      const js = document.createElement("script"), zs = Ls.attributes;
      for (let Fs = 0, Bs = zs.length; Fs < Bs; ++Fs) {
        const { name: Hs, value: Ws } = zs[Fs];
        js.setAttribute(Hs, Ws);
      }
      js.textContent = Ls.textContent, Ls.parentNode.replaceChild(js, Ls);
    }
  }
  _e.evalInnerHTMLScriptTags = Qt;
  function Zt(Ms, Ds) {
    const Ls = Ms.getElementsByTagName("a");
    for (let zs = 0; zs < Ls.length; zs++) {
      const Fs = Ls[zs];
      if (!(Fs instanceof HTMLAnchorElement))
        continue;
      const Bs = Fs.href, Hs = Ds && Ds.isLocal ? Ds.isLocal(Bs) : lib$3.URLExt.isLocal(Bs);
      Fs.target || (Fs.target = Hs ? "_self" : "_blank"), Hs || (Fs.rel = "noopener");
    }
    const js = Ms.getElementsByTagName("img");
    for (let zs = 0; zs < js.length; zs++)
      js[zs].alt || (js[zs].alt = "Image");
  }
  _e.handleDefaults = Zt;
  function $n(Ms, Ds, Ls) {
    const js = [], zs = Ms.querySelectorAll("*[src]");
    for (let Hs = 0; Hs < zs.length; Hs++)
      js.push(kn(zs[Hs], "src", Ds));
    const Fs = Ms.getElementsByTagName("a");
    for (let Hs = 0; Hs < Fs.length; Hs++)
      js.push(Kn(Fs[Hs], Ds, Ls));
    const Bs = Ms.getElementsByTagName("link");
    for (let Hs = 0; Hs < Bs.length; Hs++)
      js.push(kn(Bs[Hs], "href", Ds));
    return Promise.all(js).then(() => {
    });
  }
  _e.handleUrls = $n;
  function Sn(Ms) {
    const Ds = ["h1", "h2", "h3", "h4", "h5", "h6"];
    for (const Ls of Ds) {
      const js = Ms.getElementsByTagName(Ls);
      for (let zs = 0; zs < js.length; zs++) {
        const Fs = js[zs];
        Fs.id = renderMarkdown.createHeaderId(Fs);
        const Bs = document.createElement("a");
        Bs.target = "_self", Bs.textContent = "¶", Bs.href = "#" + Fs.id, Bs.classList.add("jp-InternalAnchorLink"), Fs.appendChild(Bs);
      }
    }
  }
  _e.headerAnchors = Sn;
  async function kn(Ms, Ds, Ls) {
    const js = Ms.getAttribute(Ds) || "", zs = Ls.isLocal ? Ls.isLocal(js) : lib$3.URLExt.isLocal(js);
    if (!(!js || !zs))
      try {
        const Fs = await Ls.resolveUrl(js);
        let Bs = await Ls.getDownloadUrl(Fs);
        lib$3.URLExt.parse(Bs).protocol !== "data:" && (Bs += (/\?/.test(Bs) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime()), Ms.setAttribute(Ds, Bs);
      } catch (Fs) {
        throw Ms.setAttribute(Ds, ""), Fs;
      }
  }
  function Kn(Ms, Ds, Ls) {
    let js = Ms.getAttribute("href") || "";
    const zs = Ds.isLocal ? Ds.isLocal(js) : lib$3.URLExt.isLocal(js);
    if (!js || !zs)
      return Promise.resolve(void 0);
    const Fs = Ms.hash;
    if (Fs) {
      if (Fs === js)
        return Ms.target = "_self", Promise.resolve(void 0);
      js = js.replace(Fs, "");
    }
    return Ds.resolveUrl(js).then((Bs) => {
      const Hs = decodeURIComponent(Bs);
      return Ls && Ls.handleLink(Ms, Hs, Fs), Ds.getDownloadUrl(Bs);
    }).then((Bs) => {
      Ms.href = Bs + Fs;
    }).catch((Bs) => {
      Ms.href = "";
    });
  }
  const er = [
    "ansi-black",
    "ansi-red",
    "ansi-green",
    "ansi-yellow",
    "ansi-blue",
    "ansi-magenta",
    "ansi-cyan",
    "ansi-white",
    "ansi-black-intense",
    "ansi-red-intense",
    "ansi-green-intense",
    "ansi-yellow-intense",
    "ansi-blue-intense",
    "ansi-magenta-intense",
    "ansi-cyan-intense",
    "ansi-white-intense"
  ];
  function Cr(Ms, Ds, Ls, js, zs, Fs, Bs) {
    if (Ms) {
      const Hs = [], Ws = [];
      js && typeof Ds == "number" && 0 <= Ds && Ds < 8 && (Ds += 8), Fs && ([Ds, Ls] = [Ls, Ds]), typeof Ds == "number" ? Hs.push(er[Ds] + "-fg") : Ds.length ? Ws.push(`color: rgb(${Ds})`) : Fs && Hs.push("ansi-default-inverse-fg"), typeof Ls == "number" ? Hs.push(er[Ls] + "-bg") : Ls.length ? Ws.push(`background-color: rgb(${Ls})`) : Fs && Hs.push("ansi-default-inverse-bg"), js && Hs.push("ansi-bold"), zs && Hs.push("ansi-underline"), Hs.length || Ws.length ? (Bs.push("<span"), Hs.length && Bs.push(` class="${Hs.join(" ")}"`), Ws.length && Bs.push(` style="${Ws.join("; ")}"`), Bs.push(">"), Bs.push(Ms), Bs.push("</span>")) : Bs.push(Ms);
    }
  }
  function kr(Ms) {
    let Ds, Ls, js;
    const zs = Ms.shift();
    if (zs === 2 && Ms.length >= 3) {
      if (Ds = Ms.shift(), Ls = Ms.shift(), js = Ms.shift(), [Ds, Ls, js].some((Fs) => Fs < 0 || 255 < Fs))
        throw new RangeError("Invalid range for RGB colors");
    } else if (zs === 5 && Ms.length >= 1) {
      const Fs = Ms.shift();
      if (Fs < 0)
        throw new RangeError("Color index must be >= 0");
      if (Fs < 16)
        return Fs;
      if (Fs < 232)
        Ds = Math.floor((Fs - 16) / 36), Ds = Ds > 0 ? 55 + Ds * 40 : 0, Ls = Math.floor((Fs - 16) % 36 / 6), Ls = Ls > 0 ? 55 + Ls * 40 : 0, js = (Fs - 16) % 6, js = js > 0 ? 55 + js * 40 : 0;
      else if (Fs < 256)
        Ds = Ls = js = (Fs - 232) * 10 + 8;
      else
        throw new RangeError("Color index must be < 256");
    } else
      throw new RangeError("Invalid extended color specification");
    return [Ds, Ls, js];
  }
  function Yr(Ms) {
    const Ds = /\x1b\[(.*?)([@-~])/g;
    let Ls = [], js = [], zs = !1, Fs = !1, Bs = !1, Hs;
    const Ws = [], Ys = [];
    let El = 0;
    for (Ms = escape$3(Ms), Ms += "\x1B[m"; Hs = Ds.exec(Ms); ) {
      if (Hs[2] === "m") {
        const Pl = Hs[1].split(";");
        for (let Iu = 0; Iu < Pl.length; Iu++) {
          const Tu = Pl[Iu];
          if (Tu === "")
            Ys.push(0);
          else if (Tu.search(/^\d+$/) !== -1)
            Ys.push(parseInt(Tu, 10));
          else {
            Ys.length = 0;
            break;
          }
        }
      }
      const Mu = Ms.substring(El, Hs.index);
      for (Cr(Mu, Ls, js, zs, Fs, Bs, Ws), El = Ds.lastIndex; Ys.length; ) {
        const Pl = Ys.shift();
        switch (Pl) {
          case 0:
            Ls = js = [], zs = !1, Fs = !1, Bs = !1;
            break;
          case 1:
          case 5:
            zs = !0;
            break;
          case 4:
            Fs = !0;
            break;
          case 7:
            Bs = !0;
            break;
          case 21:
          case 22:
            zs = !1;
            break;
          case 24:
            Fs = !1;
            break;
          case 27:
            Bs = !1;
            break;
          case 30:
          case 31:
          case 32:
          case 33:
          case 34:
          case 35:
          case 36:
          case 37:
            Ls = Pl - 30;
            break;
          case 38:
            try {
              Ls = kr(Ys);
            } catch {
              Ys.length = 0;
            }
            break;
          case 39:
            Ls = [];
            break;
          case 40:
          case 41:
          case 42:
          case 43:
          case 44:
          case 45:
          case 46:
          case 47:
            js = Pl - 40;
            break;
          case 48:
            try {
              js = kr(Ys);
            } catch {
              Ys.length = 0;
            }
            break;
          case 49:
            js = [];
            break;
          case 90:
          case 91:
          case 92:
          case 93:
          case 94:
          case 95:
          case 96:
          case 97:
            Ls = Pl - 90 + 8;
            break;
          case 100:
          case 101:
          case 102:
          case 103:
          case 104:
          case 105:
          case 106:
          case 107:
            js = Pl - 100 + 8;
            break;
        }
      }
    }
    return Ws.join("");
  }
  _e.ansiSpan = Yr;
})(Private$2 || (Private$2 = {}));
class RenderedCommon extends Widget {
  /**
   * Construct a new rendered common widget.
   *
   * @param options - The options for initializing the widget.
   */
  constructor(Qt) {
    var Zt, $n;
    super(), this.mimeType = Qt.mimeType, this.sanitizer = Qt.sanitizer, this.resolver = Qt.resolver, this.linkHandler = Qt.linkHandler, this.translator = (Zt = Qt.translator) !== null && Zt !== void 0 ? Zt : nullTranslator, this.latexTypesetter = Qt.latexTypesetter, this.markdownParser = ($n = Qt.markdownParser) !== null && $n !== void 0 ? $n : null, this.node.dataset.mimeType = this.mimeType;
  }
  /**
   * Render a mime model.
   *
   * @param model - The mime model to render.
   *
   * @param keepExisting - Whether to keep the existing rendering.
   *
   * @returns A promise which resolves when rendering is complete.
   *
   * #### Notes
   * By default, if the DOM node for this widget already has content, it
   * is emptied before rendering. Subclasses that do not want this behavior
   * (if, for instance, they are using DOM diffing), should override this
   * method or call `super.renderModel(model, true)`.
   */
  async renderModel(Qt, Zt) {
    if (!Zt)
      for (; this.node.firstChild; )
        this.node.removeChild(this.node.firstChild);
    this.toggleClass("jp-mod-trusted", Qt.trusted), await this.render(Qt);
    const { fragment: $n } = Qt.metadata;
    $n && this.setFragment($n);
  }
  /**
   * Set the URI fragment identifier.
   *
   * @param fragment - The URI fragment identifier.
   */
  setFragment(Qt) {
  }
}
class RenderedImage extends RenderedCommon {
  /**
   * Construct a new rendered image widget.
   *
   * @param options - The options for initializing the widget.
   */
  constructor(Qt) {
    super(Qt), this.addClass("jp-RenderedImage");
  }
  /**
   * Render a mime model.
   *
   * @param model - The mime model to render.
   *
   * @returns A promise which resolves when rendering is complete.
   */
  render(Qt) {
    const Zt = Qt.metadata[this.mimeType];
    return renderImage({
      host: this.node,
      mimeType: this.mimeType,
      source: String(Qt.data[this.mimeType]),
      width: Zt && Zt.width,
      height: Zt && Zt.height,
      needsBackground: Qt.metadata.needs_background,
      unconfined: Zt && Zt.unconfined
    });
  }
}
const imageRendererFactory = {
  safe: !0,
  mimeTypes: [
    "image/bmp",
    "image/png",
    "image/jpeg",
    "image/gif",
    "image/webp"
  ],
  defaultRank: 90,
  createRenderer: (_e) => new RenderedImage(_e)
};
class MimeModel {
  /**
   * Construct a new mime model.
   */
  constructor(Qt = {}) {
    this.trusted = !!Qt.trusted, this._data = Qt.data || {}, this._metadata = Qt.metadata || {}, this._callback = Qt.callback || Private$1.noOp;
  }
  /**
   * The data associated with the model.
   */
  get data() {
    return this._data;
  }
  /**
   * The metadata associated with the model.
   */
  get metadata() {
    return this._metadata;
  }
  /**
   * Set the data associated with the model.
   *
   * #### Notes
   * Depending on the implementation of the mime model,
   * this call may or may not have deferred effects,
   */
  setData(Qt) {
    this._data = Qt.data || this._data, this._metadata = Qt.metadata || this._metadata, this._callback(Qt);
  }
}
var Private$1;
(function(_e) {
  function Qt() {
  }
  _e.noOp = Qt;
})(Private$1 || (Private$1 = {}));
var fastDeepEqual = function _e(Qt, Zt) {
  if (Qt === Zt)
    return !0;
  if (Qt && Zt && typeof Qt == "object" && typeof Zt == "object") {
    if (Qt.constructor !== Zt.constructor)
      return !1;
    var $n, Sn, kn;
    if (Array.isArray(Qt)) {
      if ($n = Qt.length, $n != Zt.length)
        return !1;
      for (Sn = $n; Sn-- !== 0; )
        if (!_e(Qt[Sn], Zt[Sn]))
          return !1;
      return !0;
    }
    if (Qt.constructor === RegExp)
      return Qt.source === Zt.source && Qt.flags === Zt.flags;
    if (Qt.valueOf !== Object.prototype.valueOf)
      return Qt.valueOf() === Zt.valueOf();
    if (Qt.toString !== Object.prototype.toString)
      return Qt.toString() === Zt.toString();
    if (kn = Object.keys(Qt), $n = kn.length, $n !== Object.keys(Zt).length)
      return !1;
    for (Sn = $n; Sn-- !== 0; )
      if (!Object.prototype.hasOwnProperty.call(Zt, kn[Sn]))
        return !1;
    for (Sn = $n; Sn-- !== 0; ) {
      var Kn = kn[Sn];
      if (!_e(Qt[Kn], Zt[Kn]))
        return !1;
    }
    return !0;
  }
  return Qt !== Qt && Zt !== Zt;
};
const equal$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(fastDeepEqual);
class WidgetTracker {
  /**
   * Create a new widget tracker.
   *
   * @param options - The instantiation options for a widget tracker.
   */
  constructor(Qt) {
    this._currentChanged = new Signal(this), this._deferred = null, this._isDisposed = !1, this._widgetAdded = new Signal(this), this._widgetUpdated = new Signal(this);
    const Zt = this._focusTracker = new FocusTracker(), $n = this._pool = new lib$1.RestorablePool(Qt);
    this.namespace = Qt.namespace, Zt.currentChanged.connect((Sn, kn) => {
      kn.newValue !== this.currentWidget && ($n.current = kn.newValue);
    }, this), $n.added.connect((Sn, kn) => {
      this._widgetAdded.emit(kn);
    }, this), $n.currentChanged.connect((Sn, kn) => {
      if (kn === null && Zt.currentWidget) {
        $n.current = Zt.currentWidget;
        return;
      }
      this.onCurrentChanged(kn), this._currentChanged.emit(kn);
    }, this), $n.updated.connect((Sn, kn) => {
      this._widgetUpdated.emit(kn);
    }, this);
  }
  /**
   * A signal emitted when the current widget changes.
   */
  get currentChanged() {
    return this._currentChanged;
  }
  /**
   * The current widget is the most recently focused or added widget.
   *
   * #### Notes
   * It is the most recently focused widget, or the most recently added
   * widget if no widget has taken focus.
   */
  get currentWidget() {
    return this._pool.current || null;
  }
  /**
   * A promise resolved when the tracker has been restored.
   */
  get restored() {
    return this._deferred ? Promise.resolve() : this._pool.restored;
  }
  /**
   * The number of widgets held by the tracker.
   */
  get size() {
    return this._pool.size;
  }
  /**
   * A signal emitted when a widget is added.
   *
   * #### Notes
   * This signal will only fire when a widget is added to the tracker. It will
   * not fire if a widget is injected into the tracker.
   */
  get widgetAdded() {
    return this._widgetAdded;
  }
  /**
   * A signal emitted when a widget is updated.
   */
  get widgetUpdated() {
    return this._widgetUpdated;
  }
  /**
   * Add a new widget to the tracker.
   *
   * @param widget - The widget being added.
   *
   * #### Notes
   * The widget passed into the tracker is added synchronously; its existence in
   * the tracker can be checked with the `has()` method. The promise this method
   * returns resolves after the widget has been added and saved to an underlying
   * restoration connector, if one is available.
   *
   * The newly added widget becomes the current widget unless the focus tracker
   * already had a focused widget.
   */
  async add(Qt) {
    this._focusTracker.add(Qt), await this._pool.add(Qt), this._focusTracker.activeWidget || (this._pool.current = Qt);
  }
  /**
   * Test whether the tracker is disposed.
   */
  get isDisposed() {
    return this._isDisposed;
  }
  /**
   * Dispose of the resources held by the tracker.
   */
  dispose() {
    this.isDisposed || (this._isDisposed = !0, this._pool.dispose(), this._focusTracker.dispose(), Signal.clearData(this));
  }
  /**
   * Find the first widget in the tracker that satisfies a filter function.
   *
   * @param - fn The filter function to call on each widget.
   *
   * #### Notes
   * If no widget is found, the value returned is `undefined`.
   */
  find(Qt) {
    return this._pool.find(Qt);
  }
  /**
   * Iterate through each widget in the tracker.
   *
   * @param fn - The function to call on each widget.
   */
  forEach(Qt) {
    return this._pool.forEach(Qt);
  }
  /**
   * Filter the widgets in the tracker based on a predicate.
   *
   * @param fn - The function by which to filter.
   */
  filter(Qt) {
    return this._pool.filter(Qt);
  }
  /**
   * Inject a foreign widget into the widget tracker.
   *
   * @param widget - The widget to inject into the tracker.
   *
   * #### Notes
   * Injected widgets will not have their state saved by the tracker.
   *
   * The primary use case for widget injection is for a plugin that offers a
   * sub-class of an extant plugin to have its instances share the same commands
   * as the parent plugin (since most relevant commands will use the
   * `currentWidget` of the parent plugin's widget tracker). In this situation,
   * the sub-class plugin may well have its own widget tracker for layout and
   * state restoration in addition to injecting its widgets into the parent
   * plugin's widget tracker.
   */
  inject(Qt) {
    return this._pool.inject(Qt);
  }
  /**
   * Check if this tracker has the specified widget.
   *
   * @param widget - The widget whose existence is being checked.
   */
  has(Qt) {
    return this._pool.has(Qt);
  }
  /**
   * Restore the widgets in this tracker's namespace.
   *
   * @param options - The configuration options that describe restoration.
   *
   * @returns A promise that resolves when restoration has completed.
   *
   * #### Notes
   * This function should not typically be invoked by client code.
   * Its primary use case is to be invoked by a restorer.
   */
  async restore(Qt) {
    const Zt = this._deferred;
    if (Zt)
      return this._deferred = null, this._pool.restore(Zt);
    if (Qt)
      return this._pool.restore(Qt);
    console.warn("No options provided to restore the tracker.");
  }
  /**
   * Save the restore options for this tracker, but do not restore yet.
   *
   * @param options - The configuration options that describe restoration.
   *
   * ### Notes
   * This function is useful when starting the shell in 'single-document' mode,
   * to avoid restoring all useless widgets. It should not ordinarily be called
   * by client code.
   */
  defer(Qt) {
    this._deferred = Qt;
  }
  /**
   * Save the restore data for a given widget.
   *
   * @param widget - The widget being saved.
   */
  async save(Qt) {
    return this._pool.save(Qt);
  }
  /**
   * Handle the current change event.
   *
   * #### Notes
   * The default implementation is a no-op.
   */
  onCurrentChanged(Qt) {
  }
}
class AttachmentsModel {
  /**
   * Construct a new observable outputs instance.
   */
  constructor(Qt) {
    var Zt;
    if (this._map = new ObservableMap(), this._isDisposed = !1, this._stateChanged = new Signal(this), this._changed = new Signal(this), this._serialized = null, this._changeGuard = !1, this.contentFactory = (Zt = Qt.contentFactory) !== null && Zt !== void 0 ? Zt : AttachmentsModel.defaultContentFactory, Qt.values)
      for (const $n of Object.keys(Qt.values))
        Qt.values[$n] !== void 0 && this.set($n, Qt.values[$n]);
    this._map.changed.connect(this._onMapChanged, this);
  }
  /**
   * A signal emitted when the model state changes.
   */
  get stateChanged() {
    return this._stateChanged;
  }
  /**
   * A signal emitted when the model changes.
   */
  get changed() {
    return this._changed;
  }
  /**
   * The keys of the attachments in the model.
   */
  get keys() {
    return this._map.keys();
  }
  /**
   * Get the length of the items in the model.
   */
  get length() {
    return this._map.keys().length;
  }
  /**
   * Test whether the model is disposed.
   */
  get isDisposed() {
    return this._isDisposed;
  }
  /**
   * Dispose of the resources used by the model.
   */
  dispose() {
    this.isDisposed || (this._isDisposed = !0, this._map.dispose(), Signal.clearData(this));
  }
  /**
   * Whether the specified key is set.
   */
  has(Qt) {
    return this._map.has(Qt);
  }
  /**
   * Get an item at the specified key.
   */
  get(Qt) {
    return this._map.get(Qt);
  }
  /**
   * Set the value at the specified key.
   */
  set(Qt, Zt) {
    const $n = this._createItem({ value: Zt });
    this._map.set(Qt, $n);
  }
  /**
   * Remove the attachment whose name is the specified key
   */
  remove(Qt) {
    this._map.delete(Qt);
  }
  /**
   * Clear all of the attachments.
   */
  clear() {
    this._map.values().forEach((Qt) => {
      Qt.dispose();
    }), this._map.clear();
  }
  /**
   * Deserialize the model from JSON.
   *
   * #### Notes
   * This will clear any existing data.
   */
  fromJSON(Qt) {
    this.clear(), Object.keys(Qt).forEach((Zt) => {
      Qt[Zt] !== void 0 && this.set(Zt, Qt[Zt]);
    });
  }
  /**
   * Serialize the model to JSON.
   */
  toJSON() {
    const Qt = {};
    for (const Zt of this._map.keys())
      Qt[Zt] = this._map.get(Zt).toJSON();
    return Qt;
  }
  /**
   * Create an attachment item and hook up its signals.
   */
  _createItem(Qt) {
    const $n = this.contentFactory.createAttachmentModel(Qt);
    return $n.changed.connect(this._onGenericChange, this), $n;
  }
  /**
   * Handle a change to the list.
   */
  _onMapChanged(Qt, Zt) {
    this._serialized && !this._changeGuard && (this._changeGuard = !0, this._serialized.set(this.toJSON()), this._changeGuard = !1), this._changed.emit(Zt), this._stateChanged.emit(void 0);
  }
  /**
   * Handle a change to an item.
   */
  _onGenericChange() {
    this._stateChanged.emit(void 0);
  }
}
(function(_e) {
  class Qt {
    /**
     * Create an attachment model.
     */
    createAttachmentModel($n) {
      return new AttachmentModel($n);
    }
  }
  _e.ContentFactory = Qt, _e.defaultContentFactory = new Qt();
})(AttachmentsModel || (AttachmentsModel = {}));
class AttachmentsResolver {
  /**
   * Create an attachments resolver object.
   */
  constructor(Qt) {
    this._parent = Qt.parent || null, this._model = Qt.model;
  }
  /**
   * Resolve a relative url to a correct server path.
   */
  async resolveUrl(Qt) {
    return this._parent && !Qt.startsWith("attachment:") ? this._parent.resolveUrl(Qt) : Qt;
  }
  /**
   * Get the download url of a given absolute server path.
   *
   * #### Notes
   * The returned URL may include a query parameter.
   */
  async getDownloadUrl(Qt) {
    if (this._parent && !Qt.startsWith("attachment:"))
      return this._parent.getDownloadUrl(Qt);
    const Zt = Qt.slice(11), $n = this._model.get(Zt);
    if ($n === void 0)
      return Qt;
    const { data: Sn } = $n, kn = Object.keys(Sn)[0];
    if (kn === void 0 || imageRendererFactory.mimeTypes.indexOf(kn) === -1)
      throw new Error(`Cannot render unknown image mime type "${kn}".`);
    return `data:${kn};base64,${Sn[kn]}`;
  }
  /**
   * Whether the URL should be handled by the resolver
   * or not.
   */
  isLocal(Qt) {
    var Zt, $n, Sn;
    return this._parent && !Qt.startsWith("attachment:") && (Sn = ($n = (Zt = this._parent).isLocal) === null || $n === void 0 ? void 0 : $n.call(Zt, Qt)) !== null && Sn !== void 0 ? Sn : !0;
  }
}
const OUTPUT_AREA_CLASS = "jp-OutputArea", OUTPUT_AREA_ITEM_CLASS = "jp-OutputArea-child", OUTPUT_AREA_OUTPUT_CLASS = "jp-OutputArea-output", OUTPUT_AREA_PROMPT_CLASS = "jp-OutputArea-prompt", OUTPUT_PROMPT_CLASS$1 = "jp-OutputPrompt", EXECUTE_CLASS = "jp-OutputArea-executeResult", OUTPUT_AREA_STDIN_ITEM_CLASS = "jp-OutputArea-stdin-item", STDIN_CLASS = "jp-Stdin", STDIN_PROMPT_CLASS = "jp-Stdin-prompt", STDIN_INPUT_CLASS = "jp-Stdin-input", OUTPUT_PROMPT_OVERLAY = "jp-OutputArea-promptOverlay";
class OutputArea extends Widget {
  /**
   * Construct an output area widget.
   */
  constructor(Qt) {
    var Zt, $n, Sn, kn;
    super(), this.outputLengthChanged = new Signal(this), this._onIOPub = (er) => {
      const Cr = this.model, kr = er.header.msg_type;
      let Yr;
      const Ds = (er.content.transient || {}).display_id;
      let Ls;
      switch (kr) {
        case "execute_result":
        case "display_data":
        case "stream":
        case "error":
          Yr = { ...er.content, output_type: kr }, Cr.add(Yr);
          break;
        case "clear_output": {
          const js = er.content.wait;
          Cr.clear(js);
          break;
        }
        case "update_display_data":
          if (Yr = { ...er.content, output_type: "display_data" }, Ls = this._displayIdMap.get(Ds), Ls)
            for (const js of Ls)
              Cr.set(js, Yr);
          break;
      }
      Ds && kr === "display_data" && (Ls = this._displayIdMap.get(Ds) || [], Ls.push(Cr.length - 1), this._displayIdMap.set(Ds, Ls));
    }, this._onExecuteReply = (er) => {
      const Cr = this.model, kr = er.content;
      if (kr.status !== "ok")
        return;
      const Yr = kr && kr.payload;
      if (!Yr || !Yr.length)
        return;
      const Ms = Yr.filter((js) => js.source === "page");
      if (!Ms.length)
        return;
      const Ls = {
        output_type: "display_data",
        data: JSON.parse(JSON.stringify(Ms[0])).data,
        metadata: {}
      };
      Cr.add(Ls);
    }, this._displayIdMap = /* @__PURE__ */ new Map(), this._minHeightTimeout = null, this._inputRequested = new Signal(this), this._toggleScrolling = new Signal(this), this._outputTracker = new WidgetTracker({
      namespace: UUID$1.uuid4()
    }), this._inputHistoryScope = "global", super.layout = new PanelLayout(), this.addClass(OUTPUT_AREA_CLASS), this.contentFactory = (Zt = Qt.contentFactory) !== null && Zt !== void 0 ? Zt : OutputArea.defaultContentFactory, this.rendermime = Qt.rendermime, this._maxNumberOutputs = ($n = Qt.maxNumberOutputs) !== null && $n !== void 0 ? $n : 1 / 0, this._translator = (Sn = Qt.translator) !== null && Sn !== void 0 ? Sn : nullTranslator, this._inputHistoryScope = (kn = Qt.inputHistoryScope) !== null && kn !== void 0 ? kn : "global";
    const Kn = this.model = Qt.model;
    for (let er = 0; er < Math.min(Kn.length, this._maxNumberOutputs + 1); er++) {
      const Cr = Kn.get(er);
      this._insertOutput(er, Cr);
    }
    Kn.changed.connect(this.onModelChanged, this), Kn.stateChanged.connect(this.onStateChanged, this), Qt.promptOverlay && this._addPromptOverlay();
  }
  /**
   * Narrow the type of OutputArea's layout prop
   */
  get layout() {
    return super.layout;
  }
  /**
   * A read-only sequence of the children widgets in the output area.
   */
  get widgets() {
    return this.layout.widgets;
  }
  /**
   * The kernel future associated with the output area.
   */
  get future() {
    return this._future;
  }
  set future(Qt) {
    if (this.model.isDisposed)
      throw Error("Model is disposed");
    this._future !== Qt && (this._future && this._future.dispose(), this._future = Qt, this.model.clear(), this.widgets.length && (this._clear(), this.outputLengthChanged.emit(Math.min(this.model.length, this._maxNumberOutputs))), Qt.onIOPub = this._onIOPub, Qt.onReply = this._onExecuteReply, Qt.onStdin = (Zt) => {
      libExports.KernelMessage.isInputRequestMsg(Zt) && this.onInputRequest(Zt, Qt);
    });
  }
  /**
   * Signal emitted when an output area is requesting an input.
   */
  get inputRequested() {
    return this._inputRequested;
  }
  /**
   * The maximum number of output items to display on top and bottom of cell output.
   *
   * ### Notes
   * It is set to Infinity if no trim is applied.
   */
  get maxNumberOutputs() {
    return this._maxNumberOutputs;
  }
  set maxNumberOutputs(Qt) {
    if (Qt <= 0) {
      console.warn("OutputArea.maxNumberOutputs must be strictly positive.");
      return;
    }
    const Zt = this._maxNumberOutputs;
    this._maxNumberOutputs = Qt, Zt < Qt && this._showTrimmedOutputs(Zt);
  }
  /**
   * Dispose of the resources used by the output area.
   */
  dispose() {
    this._future && (this._future.dispose(), this._future = null), this._displayIdMap.clear(), this._outputTracker.dispose(), super.dispose();
  }
  /**
   * Follow changes on the model state.
   */
  onModelChanged(Qt, Zt) {
    switch (Zt.type) {
      case "add":
        this._insertOutput(Zt.newIndex, Zt.newValues[0]);
        break;
      case "remove":
        if (this.widgets.length)
          if (this.model.length === 0)
            this._clear();
          else {
            const $n = Zt.oldIndex;
            for (let Sn = 0; Sn < Zt.oldValues.length && $n < this.widgets.length; ++Sn) {
              const kn = this.widgets[$n];
              kn.parent = null, kn.dispose();
            }
            this._moveDisplayIdIndices($n, Zt.oldValues.length), this._preventHeightChangeJitter();
          }
        break;
      case "set":
        this._setOutput(Zt.newIndex, Zt.newValues[0]);
        break;
    }
    this.outputLengthChanged.emit(Math.min(this.model.length, this._maxNumberOutputs));
  }
  /**
   * Emitted when user requests toggling of the output scrolling mode.
   */
  get toggleScrolling() {
    return this._toggleScrolling;
  }
  /**
   * Add overlay allowing to toggle scrolling.
   */
  _addPromptOverlay() {
    const Qt = document.createElement("div");
    Qt.className = OUTPUT_PROMPT_OVERLAY;
    const Zt = this._translator.load("jupyterlab");
    Qt.title = Zt.__("Toggle output scrolling"), Qt.addEventListener("click", () => {
      this._toggleScrolling.emit();
    }), this.node.appendChild(Qt);
  }
  /**
   * Update indices in _displayIdMap in response to element remove from model items
   *
   * @param startIndex - The index of first element removed
   *
   * @param count - The number of elements removed from model items
   *
   */
  _moveDisplayIdIndices(Qt, Zt) {
    this._displayIdMap.forEach(($n) => {
      const Sn = Qt + Zt, kn = $n.length;
      for (let Kn = kn - 1; Kn >= 0; --Kn) {
        const er = $n[Kn];
        er >= Qt && er < Sn ? $n.splice(Kn, 1) : er >= Sn && ($n[Kn] -= Zt);
      }
    });
  }
  /**
   * Follow changes on the output model state.
   */
  onStateChanged(Qt, Zt) {
    const $n = Math.min(this.model.length, this._maxNumberOutputs);
    if (Zt) {
      if (Zt >= this._maxNumberOutputs)
        return;
      this._setOutput(Zt, this.model.get(Zt));
    } else
      for (let Sn = 0; Sn < $n; Sn++)
        this._setOutput(Sn, this.model.get(Sn));
    this.outputLengthChanged.emit($n);
  }
  /**
   * Clear the widget outputs.
   */
  _clear() {
    if (!this.widgets.length)
      return;
    const Qt = this.widgets.length;
    for (let Zt = 0; Zt < Qt; Zt++) {
      const $n = this.widgets[0];
      $n.parent = null, $n.dispose();
    }
    this._displayIdMap.clear(), this._preventHeightChangeJitter();
  }
  _preventHeightChangeJitter() {
    const Qt = this.node.getBoundingClientRect();
    this.node.style.minHeight = `${Qt.height}px`, this._minHeightTimeout && window.clearTimeout(this._minHeightTimeout), this._minHeightTimeout = window.setTimeout(() => {
      this.isDisposed || (this.node.style.minHeight = "");
    }, 50);
  }
  /**
   * Handle an input request from a kernel.
   */
  onInputRequest(Qt, Zt) {
    const $n = this.contentFactory, Sn = Qt.content.prompt, kn = Qt.content.password, Kn = new Panel();
    Kn.addClass(OUTPUT_AREA_ITEM_CLASS), Kn.addClass(OUTPUT_AREA_STDIN_ITEM_CLASS);
    const er = $n.createOutputPrompt();
    er.addClass(OUTPUT_AREA_PROMPT_CLASS), Kn.addWidget(er);
    const Cr = $n.createStdin({
      parent_header: Qt.header,
      prompt: Sn,
      password: kn,
      future: Zt,
      translator: this._translator,
      inputHistoryScope: this._inputHistoryScope
    });
    Cr.addClass(OUTPUT_AREA_OUTPUT_CLASS), Kn.addWidget(Cr), this.model.length >= this.maxNumberOutputs && (this.maxNumberOutputs = this.model.length), this.layout.addWidget(Kn), this._inputRequested.emit(), Cr.value.then((kr) => {
      this.model.length >= this.maxNumberOutputs && (this.maxNumberOutputs = this.model.length + 1), this.model.add({
        output_type: "stream",
        name: "stdin",
        text: kr + `
`
      }), Kn.dispose();
    });
  }
  /**
   * Update an output in the layout in place.
   */
  _setOutput(Qt, Zt) {
    if (Qt >= this._maxNumberOutputs)
      return;
    const $n = this.layout.widgets[Qt], Sn = $n.widgets ? $n.widgets[1] : $n, kn = this.rendermime.preferredMimeType(Zt.data, Zt.trusted ? "any" : "ensure");
    Private.currentPreferredMimetype.get(Sn) === kn && OutputArea.isIsolated(kn, Zt.metadata) === Sn instanceof Private.IsolatedRenderer ? Sn.renderModel(Zt) : (this.layout.widgets[Qt].dispose(), this._insertOutput(Qt, Zt));
  }
  /**
   * Render and insert a single output into the layout.
   *
   * @param index - The index of the output to be inserted.
   * @param model - The model of the output to be inserted.
   */
  _insertOutput(Qt, Zt) {
    if (Qt > this._maxNumberOutputs)
      return;
    const $n = this.layout;
    if (Qt === this._maxNumberOutputs) {
      const Sn = new Private.TrimmedOutputs(this._maxNumberOutputs, () => {
        const kn = this._maxNumberOutputs;
        this._maxNumberOutputs = 1 / 0, this._showTrimmedOutputs(kn);
      });
      $n.insertWidget(Qt, this._wrappedOutput(Sn));
    } else {
      let Sn = this.createOutputItem(Zt);
      Sn ? Sn.toggleClass(EXECUTE_CLASS, Zt.executionCount !== null) : Sn = new Widget(), this._outputTracker.has(Sn) || this._outputTracker.add(Sn), $n.insertWidget(Qt, Sn);
    }
  }
  /**
   * A widget tracker for individual output widgets in the output area.
   */
  get outputTracker() {
    return this._outputTracker;
  }
  /**
   * Dispose information message and show output models from the given
   * index to maxNumberOutputs
   *
   * @param lastShown Starting model index to insert.
   */
  _showTrimmedOutputs(Qt) {
    this.widgets[Qt].dispose();
    for (let Zt = Qt; Zt < this.model.length; Zt++)
      this._insertOutput(Zt, this.model.get(Zt));
    this.outputLengthChanged.emit(Math.min(this.model.length, this._maxNumberOutputs));
  }
  /**
   * Create an output item with a prompt and actual output
   *
   * @returns a rendered widget, or null if we cannot render
   * #### Notes
   */
  createOutputItem(Qt) {
    const Zt = this.createRenderedMimetype(Qt);
    return Zt ? this._wrappedOutput(Zt, Qt.executionCount) : null;
  }
  /**
   * Render a mimetype
   */
  createRenderedMimetype(Qt) {
    const Zt = this.rendermime.preferredMimeType(Qt.data, Qt.trusted ? "any" : "ensure");
    if (!Zt)
      return null;
    let $n = this.rendermime.createRenderer(Zt);
    return OutputArea.isIsolated(Zt, Qt.metadata) === !0 && ($n = new Private.IsolatedRenderer($n)), Private.currentPreferredMimetype.set($n, Zt), $n.renderModel(Qt).catch((kn) => {
      const Kn = document.createElement("pre"), er = this._translator.load("jupyterlab");
      Kn.textContent = er.__("Javascript Error: %1", kn.message), $n.node.appendChild(Kn), $n.node.className = "lm-Widget jp-RenderedText", $n.node.setAttribute("data-mime-type", "application/vnd.jupyter.stderr");
    }), $n;
  }
  /**
   * Wrap a output widget within a output panel
   *
   * @param output Output widget to wrap
   * @param executionCount Execution count
   * @returns The output panel
   */
  _wrappedOutput(Qt, Zt = null) {
    const $n = new Private.OutputPanel();
    $n.addClass(OUTPUT_AREA_ITEM_CLASS);
    const Sn = this.contentFactory.createOutputPrompt();
    return Sn.executionCount = Zt, Sn.addClass(OUTPUT_AREA_PROMPT_CLASS), $n.addWidget(Sn), Qt.addClass(OUTPUT_AREA_OUTPUT_CLASS), $n.addWidget(Qt), $n;
  }
}
class SimplifiedOutputArea extends OutputArea {
  /**
   * Handle an input request from a kernel by doing nothing.
   */
  onInputRequest(Qt, Zt) {
  }
  /**
   * Create an output item without a prompt, just the output widgets
   */
  createOutputItem(Qt) {
    const Zt = this.createRenderedMimetype(Qt);
    if (!Zt)
      return null;
    const $n = new Private.OutputPanel();
    return $n.addClass(OUTPUT_AREA_ITEM_CLASS), Zt.addClass(OUTPUT_AREA_OUTPUT_CLASS), $n.addWidget(Zt), $n;
  }
}
(function(_e) {
  async function Qt(Sn, kn, Kn, er) {
    var Cr;
    let kr = !0;
    er && Array.isArray(er.tags) && er.tags.indexOf("raises-exception") !== -1 && (kr = !1);
    const Yr = {
      code: Sn,
      stop_on_error: kr
    }, Ms = (Cr = Kn.session) === null || Cr === void 0 ? void 0 : Cr.kernel;
    if (!Ms)
      throw new Error("Session has no kernel.");
    const Ds = Ms.requestExecute(Yr, !1, er);
    return kn.future = Ds, Ds.done;
  }
  _e.execute = Qt;
  function Zt(Sn, kn) {
    const Kn = kn[Sn];
    return Kn && Kn.isolated !== void 0 ? !!Kn.isolated : !!kn.isolated;
  }
  _e.isIsolated = Zt;
  class $n {
    /**
     * Create the output prompt for the widget.
     */
    createOutputPrompt() {
      return new OutputPrompt();
    }
    /**
     * Create an stdin widget.
     */
    createStdin(kn) {
      return new Stdin(kn);
    }
  }
  _e.ContentFactory = $n, _e.defaultContentFactory = new $n();
})(OutputArea || (OutputArea = {}));
class OutputPrompt extends Widget {
  /*
   * Create an output prompt widget.
   */
  constructor() {
    super(), this._executionCount = null, this.addClass(OUTPUT_PROMPT_CLASS$1);
  }
  /**
   * The execution count for the prompt.
   */
  get executionCount() {
    return this._executionCount;
  }
  set executionCount(Qt) {
    this._executionCount = Qt, Qt === null ? this.node.textContent = "" : this.node.textContent = `[${Qt}]:`;
  }
}
class Stdin extends Widget {
  static _historyIx(Qt, Zt) {
    const $n = Stdin._history.get(Qt);
    if (!$n)
      return;
    const Sn = $n.length;
    if (Zt <= 0)
      return Sn + Zt;
  }
  static _historyAt(Qt, Zt) {
    const $n = Stdin._history.get(Qt);
    if (!$n)
      return;
    const Sn = $n.length, kn = Stdin._historyIx(Qt, Zt);
    if (kn !== void 0 && kn < Sn)
      return $n[kn];
  }
  static _historyPush(Qt, Zt) {
    const $n = Stdin._history.get(Qt);
    $n.push(Zt), $n.length > 1e3 && $n.shift();
  }
  static _historySearch(Qt, Zt, $n, Sn = !0) {
    const kn = Stdin._history.get(Qt), Kn = kn.length, er = Stdin._historyIx(Qt, $n), Cr = (kr) => kr.search(Zt) !== -1;
    if (er !== void 0)
      if (Sn) {
        if (er === 0)
          return;
        const kr = kn.slice(0, er).findLastIndex(Cr);
        if (kr !== -1)
          return kr - Kn;
      } else {
        if (er >= Kn - 1)
          return;
        const kr = kn.slice(er + 1).findIndex(Cr);
        if (kr !== -1)
          return kr - Kn + er + 1;
      }
  }
  /**
   * Construct a new input widget.
   */
  constructor(Qt) {
    var Zt;
    super({
      node: Private.createInputWidgetNode(Qt.prompt, Qt.password)
    }), this._promise = new PromiseDelegate(), this.addClass(STDIN_CLASS), this._future = Qt.future, this._historyIndex = 0, this._historyKey = Qt.inputHistoryScope === "session" ? Qt.parent_header.session : "", this._historyPat = "", this._parentHeader = Qt.parent_header, this._password = Qt.password, this._trans = ((Zt = Qt.translator) !== null && Zt !== void 0 ? Zt : nullTranslator).load("jupyterlab"), this._value = Qt.prompt + " ", this._input = this.node.getElementsByTagName("input")[0], this._input.placeholder = this._trans.__("↑↓ for history. Search history with c-↑/c-↓"), Stdin._history.has(this._historyKey) || Stdin._history.set(this._historyKey, []);
  }
  /**
   * The value of the widget.
   */
  get value() {
    return this._promise.promise.then(() => this._value);
  }
  /**
   * Handle the DOM events for the widget.
   *
   * @param event - The DOM event sent to the widget.
   *
   * #### Notes
   * This method implements the DOM `EventListener` interface and is
   * called in response to events on the dock panel's node. It should
   * not be called directly by user code.
   */
  handleEvent(Qt) {
    const Zt = this._input;
    if (Qt.type === "keydown") {
      if (Qt.key === "Enter")
        this.resetSearch(), this._future.sendInputReply({
          status: "ok",
          value: Zt.value
        }, this._parentHeader), this._password ? this._value += "········" : (this._value += Zt.value, Stdin._historyPush(this._historyKey, Zt.value)), this._promise.resolve(void 0);
      else if (Qt.key === "Escape")
        this.resetSearch(), Zt.blur();
      else if (Qt.ctrlKey && (Qt.key === "ArrowUp" || Qt.key === "ArrowDown")) {
        this._historyPat === "" && (this._historyPat = Zt.value);
        const $n = Qt.key === "ArrowUp", Sn = Stdin._historySearch(this._historyKey, this._historyPat, this._historyIndex, $n);
        if (Sn !== void 0) {
          const kn = Stdin._historyAt(this._historyKey, Sn);
          kn !== void 0 && (this._historyIndex === 0 && (this._valueCache = Zt.value), this._setInputValue(kn), this._historyIndex = Sn, Qt.preventDefault());
        }
      } else if (Qt.key === "ArrowUp") {
        this.resetSearch();
        const $n = Stdin._historyAt(this._historyKey, this._historyIndex - 1);
        $n && (this._historyIndex === 0 && (this._valueCache = Zt.value), this._setInputValue($n), --this._historyIndex, Qt.preventDefault());
      } else if (Qt.key === "ArrowDown" && (this.resetSearch(), this._historyIndex !== 0))
        if (this._historyIndex === -1)
          this._setInputValue(this._valueCache), ++this._historyIndex;
        else {
          const $n = Stdin._historyAt(this._historyKey, this._historyIndex + 1);
          $n && (this._setInputValue($n), ++this._historyIndex);
        }
    }
  }
  resetSearch() {
    this._historyPat = "";
  }
  /**
   * Handle `after-attach` messages sent to the widget.
   */
  onAfterAttach(Qt) {
    this._input.addEventListener("keydown", this), this._input.focus();
  }
  /**
   * Handle `before-detach` messages sent to the widget.
   */
  onBeforeDetach(Qt) {
    this._input.removeEventListener("keydown", this);
  }
  _setInputValue(Qt) {
    this._input.value = Qt, this._input.setSelectionRange(Qt.length, Qt.length);
  }
}
Stdin._history = /* @__PURE__ */ new Map();
var Private;
(function(_e) {
  function Qt(kn, Kn) {
    const er = document.createElement("div"), Cr = document.createElement("pre");
    Cr.className = STDIN_PROMPT_CLASS, Cr.textContent = kn;
    const kr = document.createElement("input");
    return kr.className = STDIN_INPUT_CLASS, Kn && (kr.type = "password"), er.appendChild(Cr), Cr.appendChild(kr), er;
  }
  _e.createInputWidgetNode = Qt;
  class Zt extends Widget {
    /**
     * Create an isolated renderer.
     */
    constructor(Kn) {
      super({ node: document.createElement("iframe") }), this.addClass("jp-mod-isolated"), this._wrapped = Kn;
      const er = this.node;
      er.frameBorder = "0", er.scrolling = "auto", er.addEventListener("load", () => {
        er.contentDocument.open(), er.contentDocument.write(this._wrapped.node.innerHTML), er.contentDocument.close();
        const Cr = er.contentDocument.body;
        er.style.height = `${Cr.scrollHeight}px`, er.heightChangeObserver = new ResizeObserver(() => {
          er.style.height = `${Cr.scrollHeight}px`;
        }), er.heightChangeObserver.observe(Cr);
      });
    }
    /**
     * Render a mime model.
     *
     * @param model - The mime model to render.
     *
     * @returns A promise which resolves when rendering is complete.
     *
     * #### Notes
     * This method may be called multiple times during the lifetime
     * of the widget to update it if and when new data is available.
     */
    renderModel(Kn) {
      return this._wrapped.renderModel(Kn);
    }
  }
  _e.IsolatedRenderer = Zt, _e.currentPreferredMimetype = new AttachedProperty({
    name: "preferredMimetype",
    create: (kn) => ""
  });
  class $n extends Panel {
    /**
     * Construct a new `OutputPanel` widget.
     */
    constructor(Kn) {
      super(Kn);
    }
    /**
     * A callback that focuses on the widget.
     */
    _onContext(Kn) {
      this.node.focus();
    }
    /**
     * Handle `after-attach` messages sent to the widget.
     */
    onAfterAttach(Kn) {
      super.onAfterAttach(Kn), this.node.addEventListener("contextmenu", this._onContext.bind(this));
    }
    /**
     * Handle `before-detach` messages sent to the widget.
     */
    onBeforeDetach(Kn) {
      super.onAfterDetach(Kn), this.node.removeEventListener("contextmenu", this._onContext.bind(this));
    }
  }
  _e.OutputPanel = $n;
  class Sn extends Widget {
    /**
     * Widget constructor
     *
     * ### Notes
     * The widget will be disposed on click after calling the callback.
     *
     * @param maxNumberOutputs Maximal number of outputs to display
     * @param _onClick Callback on click event on the widget
     */
    constructor(Kn, er) {
      const Cr = document.createElement("div"), kr = `The first ${Kn} are displayed`, Yr = "Show more outputs";
      Cr.insertAdjacentHTML("afterbegin", `<a title=${kr}>
          <pre>${Yr}</pre>
        </a>`), super({
        node: Cr
      }), this._onClick = er, this.addClass("jp-TrimmedOutputs"), this.addClass("jp-RenderedHTMLCommon");
    }
    /**
     * Handle the DOM events for widget.
     *
     * @param event - The DOM event sent to the widget.
     *
     * #### Notes
     * This method implements the DOM `EventListener` interface and is
     * called in response to events on the widget's DOM node. It should
     * not be called directly by user code.
     */
    handleEvent(Kn) {
      Kn.type === "click" && this._onClick(Kn);
    }
    /**
     * Handle `after-attach` messages for the widget.
     */
    onAfterAttach(Kn) {
      super.onAfterAttach(Kn), this.node.addEventListener("click", this);
    }
    /**
     * A message handler invoked on a `'before-detach'`
     * message
     */
    onBeforeDetach(Kn) {
      super.onBeforeDetach(Kn), this.node.removeEventListener("click", this);
    }
  }
  _e.TrimmedOutputs = Sn;
})(Private || (Private = {}));
const PLACEHOLDER_CLASS = "jp-Placeholder", INPUT_PROMPT_CLASS = "jp-Placeholder-prompt jp-InputPrompt", OUTPUT_PROMPT_CLASS = "jp-Placeholder-prompt jp-OutputPrompt", CONTENT_CLASS = "jp-Placeholder-content", INPUT_PLACEHOLDER_CLASS = "jp-InputPlaceholder", OUTPUT_PLACEHOLDER_CLASS = "jp-OutputPlaceholder";
let Placeholder$2 = class extends Widget {
  /**
   * Construct a new placeholder.
   */
  constructor(Qt) {
    var Zt, $n, Sn;
    const kn = document.createElement("div");
    super({ node: kn });
    const Kn = ((Zt = Qt.translator) !== null && Zt !== void 0 ? Zt : nullTranslator).load("jupyterlab"), er = document.createElement("div");
    er.className = ($n = Qt.promptClass) !== null && $n !== void 0 ? $n : "", kn.insertAdjacentHTML("afterbegin", er.outerHTML), this._cell = document.createElement("div"), this._cell.classList.add(CONTENT_CLASS), this._cell.title = Kn.__("Click to expand");
    const Cr = this._cell.appendChild(document.createElement("div"));
    Cr.classList.add("jp-Placeholder-contentContainer"), this._textContent = Cr.appendChild(document.createElement("span")), this._textContent.className = "jp-PlaceholderText", this._textContent.innerText = (Sn = Qt.text) !== null && Sn !== void 0 ? Sn : "", kn.appendChild(this._cell), ellipsesIcon.element({
      container: Cr.appendChild(document.createElement("span")),
      className: "jp-MoreHorizIcon",
      elementPosition: "center",
      height: "auto",
      width: "32px"
    }), this.addClass(PLACEHOLDER_CLASS), this._callback = Qt.callback;
  }
  /**
   * The text displayed in the placeholder.
   */
  set text(Qt) {
    this._textContent.innerText = Qt;
  }
  get text() {
    return this._textContent.innerText;
  }
  onAfterAttach(Qt) {
    super.onAfterAttach(Qt), this.node.addEventListener("click", this._callback);
  }
  onBeforeDetach(Qt) {
    this.node.removeEventListener("click", this._callback), super.onBeforeDetach(Qt);
  }
}, InputPlaceholder$1 = class extends Placeholder$2 {
  /**
   * Construct a new input placeholder.
   */
  constructor(Qt) {
    super({ ...Qt, promptClass: INPUT_PROMPT_CLASS }), this.addClass(INPUT_PLACEHOLDER_CLASS);
  }
};
class OutputPlaceholder extends Placeholder$2 {
  /**
   * Construct a new output placeholder.
   */
  constructor(Qt) {
    super({ ...Qt, promptClass: OUTPUT_PROMPT_CLASS }), this.addClass(OUTPUT_PLACEHOLDER_CLASS);
  }
}
let Text$1 = class zD {
  /**
  Get the line description around the given position.
  */
  lineAt(Qt) {
    if (Qt < 0 || Qt > this.length)
      throw new RangeError(`Invalid position ${Qt} in document of length ${this.length}`);
    return this.lineInner(Qt, !1, 1, 0);
  }
  /**
  Get the description for the given (1-based) line number.
  */
  line(Qt) {
    if (Qt < 1 || Qt > this.lines)
      throw new RangeError(`Invalid line number ${Qt} in ${this.lines}-line document`);
    return this.lineInner(Qt, !0, 1, 0);
  }
  /**
  Replace a range of the text with the given content.
  */
  replace(Qt, Zt, $n) {
    let Sn = [];
    return this.decompose(
      0,
      Qt,
      Sn,
      2
      /* Open.To */
    ), $n.length && $n.decompose(
      0,
      $n.length,
      Sn,
      3
      /* Open.To */
    ), this.decompose(
      Zt,
      this.length,
      Sn,
      1
      /* Open.From */
    ), TextNode.from(Sn, this.length - (Zt - Qt) + $n.length);
  }
  /**
  Append another document to this one.
  */
  append(Qt) {
    return this.replace(this.length, this.length, Qt);
  }
  /**
  Retrieve the text between the given points.
  */
  slice(Qt, Zt = this.length) {
    let $n = [];
    return this.decompose(Qt, Zt, $n, 0), TextNode.from($n, Zt - Qt);
  }
  /**
  Test whether this text is equal to another instance.
  */
  eq(Qt) {
    if (Qt == this)
      return !0;
    if (Qt.length != this.length || Qt.lines != this.lines)
      return !1;
    let Zt = this.scanIdentical(Qt, 1), $n = this.length - this.scanIdentical(Qt, -1), Sn = new RawTextCursor(this), kn = new RawTextCursor(Qt);
    for (let Kn = Zt, er = Zt; ; ) {
      if (Sn.next(Kn), kn.next(Kn), Kn = 0, Sn.lineBreak != kn.lineBreak || Sn.done != kn.done || Sn.value != kn.value)
        return !1;
      if (er += Sn.value.length, Sn.done || er >= $n)
        return !0;
    }
  }
  /**
  Iterate over the text. When `dir` is `-1`, iteration happens
  from end to start. This will return lines and the breaks between
  them as separate strings.
  */
  iter(Qt = 1) {
    return new RawTextCursor(this, Qt);
  }
  /**
  Iterate over a range of the text. When `from` > `to`, the
  iterator will run in reverse.
  */
  iterRange(Qt, Zt = this.length) {
    return new PartialTextCursor(this, Qt, Zt);
  }
  /**
  Return a cursor that iterates over the given range of lines,
  _without_ returning the line breaks between, and yielding empty
  strings for empty lines.
  
  When `from` and `to` are given, they should be 1-based line numbers.
  */
  iterLines(Qt, Zt) {
    let $n;
    if (Qt == null)
      $n = this.iter();
    else {
      Zt == null && (Zt = this.lines + 1);
      let Sn = this.line(Qt).from;
      $n = this.iterRange(Sn, Math.max(Sn, Zt == this.lines + 1 ? this.length : Zt <= 1 ? 0 : this.line(Zt - 1).to));
    }
    return new LineCursor($n);
  }
  /**
  Return the document as a string, using newline characters to
  separate lines.
  */
  toString() {
    return this.sliceString(0);
  }
  /**
  Convert the document to an array of lines (which can be
  deserialized again via [`Text.of`](https://codemirror.net/6/docs/ref/#state.Text^of)).
  */
  toJSON() {
    let Qt = [];
    return this.flatten(Qt), Qt;
  }
  /**
  @internal
  */
  constructor() {
  }
  /**
  Create a `Text` instance for the given array of lines.
  */
  static of(Qt) {
    if (Qt.length == 0)
      throw new RangeError("A document must have at least one line");
    return Qt.length == 1 && !Qt[0] ? zD.empty : Qt.length <= 32 ? new TextLeaf(Qt) : TextNode.from(TextLeaf.split(Qt, []));
  }
};
class TextLeaf extends Text$1 {
  constructor(Qt, Zt = textLength(Qt)) {
    super(), this.text = Qt, this.length = Zt;
  }
  get lines() {
    return this.text.length;
  }
  get children() {
    return null;
  }
  lineInner(Qt, Zt, $n, Sn) {
    for (let kn = 0; ; kn++) {
      let Kn = this.text[kn], er = Sn + Kn.length;
      if ((Zt ? $n : er) >= Qt)
        return new Line(Sn, er, $n, Kn);
      Sn = er + 1, $n++;
    }
  }
  decompose(Qt, Zt, $n, Sn) {
    let kn = Qt <= 0 && Zt >= this.length ? this : new TextLeaf(sliceText(this.text, Qt, Zt), Math.min(Zt, this.length) - Math.max(0, Qt));
    if (Sn & 1) {
      let Kn = $n.pop(), er = appendText(kn.text, Kn.text.slice(), 0, kn.length);
      if (er.length <= 32)
        $n.push(new TextLeaf(er, Kn.length + kn.length));
      else {
        let Cr = er.length >> 1;
        $n.push(new TextLeaf(er.slice(0, Cr)), new TextLeaf(er.slice(Cr)));
      }
    } else
      $n.push(kn);
  }
  replace(Qt, Zt, $n) {
    if (!($n instanceof TextLeaf))
      return super.replace(Qt, Zt, $n);
    let Sn = appendText(this.text, appendText($n.text, sliceText(this.text, 0, Qt)), Zt), kn = this.length + $n.length - (Zt - Qt);
    return Sn.length <= 32 ? new TextLeaf(Sn, kn) : TextNode.from(TextLeaf.split(Sn, []), kn);
  }
  sliceString(Qt, Zt = this.length, $n = `
`) {
    let Sn = "";
    for (let kn = 0, Kn = 0; kn <= Zt && Kn < this.text.length; Kn++) {
      let er = this.text[Kn], Cr = kn + er.length;
      kn > Qt && Kn && (Sn += $n), Qt < Cr && Zt > kn && (Sn += er.slice(Math.max(0, Qt - kn), Zt - kn)), kn = Cr + 1;
    }
    return Sn;
  }
  flatten(Qt) {
    for (let Zt of this.text)
      Qt.push(Zt);
  }
  scanIdentical() {
    return 0;
  }
  static split(Qt, Zt) {
    let $n = [], Sn = -1;
    for (let kn of Qt)
      $n.push(kn), Sn += kn.length + 1, $n.length == 32 && (Zt.push(new TextLeaf($n, Sn)), $n = [], Sn = -1);
    return Sn > -1 && Zt.push(new TextLeaf($n, Sn)), Zt;
  }
}
class TextNode extends Text$1 {
  constructor(Qt, Zt) {
    super(), this.children = Qt, this.length = Zt, this.lines = 0;
    for (let $n of Qt)
      this.lines += $n.lines;
  }
  lineInner(Qt, Zt, $n, Sn) {
    for (let kn = 0; ; kn++) {
      let Kn = this.children[kn], er = Sn + Kn.length, Cr = $n + Kn.lines - 1;
      if ((Zt ? Cr : er) >= Qt)
        return Kn.lineInner(Qt, Zt, $n, Sn);
      Sn = er + 1, $n = Cr + 1;
    }
  }
  decompose(Qt, Zt, $n, Sn) {
    for (let kn = 0, Kn = 0; Kn <= Zt && kn < this.children.length; kn++) {
      let er = this.children[kn], Cr = Kn + er.length;
      if (Qt <= Cr && Zt >= Kn) {
        let kr = Sn & ((Kn <= Qt ? 1 : 0) | (Cr >= Zt ? 2 : 0));
        Kn >= Qt && Cr <= Zt && !kr ? $n.push(er) : er.decompose(Qt - Kn, Zt - Kn, $n, kr);
      }
      Kn = Cr + 1;
    }
  }
  replace(Qt, Zt, $n) {
    if ($n.lines < this.lines)
      for (let Sn = 0, kn = 0; Sn < this.children.length; Sn++) {
        let Kn = this.children[Sn], er = kn + Kn.length;
        if (Qt >= kn && Zt <= er) {
          let Cr = Kn.replace(Qt - kn, Zt - kn, $n), kr = this.lines - Kn.lines + Cr.lines;
          if (Cr.lines < kr >> 5 - 1 && Cr.lines > kr >> 5 + 1) {
            let Yr = this.children.slice();
            return Yr[Sn] = Cr, new TextNode(Yr, this.length - (Zt - Qt) + $n.length);
          }
          return super.replace(kn, er, Cr);
        }
        kn = er + 1;
      }
    return super.replace(Qt, Zt, $n);
  }
  sliceString(Qt, Zt = this.length, $n = `
`) {
    let Sn = "";
    for (let kn = 0, Kn = 0; kn < this.children.length && Kn <= Zt; kn++) {
      let er = this.children[kn], Cr = Kn + er.length;
      Kn > Qt && kn && (Sn += $n), Qt < Cr && Zt > Kn && (Sn += er.sliceString(Qt - Kn, Zt - Kn, $n)), Kn = Cr + 1;
    }
    return Sn;
  }
  flatten(Qt) {
    for (let Zt of this.children)
      Zt.flatten(Qt);
  }
  scanIdentical(Qt, Zt) {
    if (!(Qt instanceof TextNode))
      return 0;
    let $n = 0, [Sn, kn, Kn, er] = Zt > 0 ? [0, 0, this.children.length, Qt.children.length] : [this.children.length - 1, Qt.children.length - 1, -1, -1];
    for (; ; Sn += Zt, kn += Zt) {
      if (Sn == Kn || kn == er)
        return $n;
      let Cr = this.children[Sn], kr = Qt.children[kn];
      if (Cr != kr)
        return $n + Cr.scanIdentical(kr, Zt);
      $n += Cr.length + 1;
    }
  }
  static from(Qt, Zt = Qt.reduce(($n, Sn) => $n + Sn.length + 1, -1)) {
    let $n = 0;
    for (let Ls of Qt)
      $n += Ls.lines;
    if ($n < 32) {
      let Ls = [];
      for (let js of Qt)
        js.flatten(Ls);
      return new TextLeaf(Ls, Zt);
    }
    let Sn = Math.max(
      32,
      $n >> 5
      /* Tree.BranchShift */
    ), kn = Sn << 1, Kn = Sn >> 1, er = [], Cr = 0, kr = -1, Yr = [];
    function Ms(Ls) {
      let js;
      if (Ls.lines > kn && Ls instanceof TextNode)
        for (let zs of Ls.children)
          Ms(zs);
      else
        Ls.lines > Kn && (Cr > Kn || !Cr) ? (Ds(), er.push(Ls)) : Ls instanceof TextLeaf && Cr && (js = Yr[Yr.length - 1]) instanceof TextLeaf && Ls.lines + js.lines <= 32 ? (Cr += Ls.lines, kr += Ls.length + 1, Yr[Yr.length - 1] = new TextLeaf(js.text.concat(Ls.text), js.length + 1 + Ls.length)) : (Cr + Ls.lines > Sn && Ds(), Cr += Ls.lines, kr += Ls.length + 1, Yr.push(Ls));
    }
    function Ds() {
      Cr != 0 && (er.push(Yr.length == 1 ? Yr[0] : TextNode.from(Yr, kr)), kr = -1, Cr = Yr.length = 0);
    }
    for (let Ls of Qt)
      Ms(Ls);
    return Ds(), er.length == 1 ? er[0] : new TextNode(er, Zt);
  }
}
Text$1.empty = /* @__PURE__ */ new TextLeaf([""], 0);
function textLength(_e) {
  let Qt = -1;
  for (let Zt of _e)
    Qt += Zt.length + 1;
  return Qt;
}
function appendText(_e, Qt, Zt = 0, $n = 1e9) {
  for (let Sn = 0, kn = 0, Kn = !0; kn < _e.length && Sn <= $n; kn++) {
    let er = _e[kn], Cr = Sn + er.length;
    Cr >= Zt && (Cr > $n && (er = er.slice(0, $n - Sn)), Sn < Zt && (er = er.slice(Zt - Sn)), Kn ? (Qt[Qt.length - 1] += er, Kn = !1) : Qt.push(er)), Sn = Cr + 1;
  }
  return Qt;
}
function sliceText(_e, Qt, Zt) {
  return appendText(_e, [""], Qt, Zt);
}
class RawTextCursor {
  constructor(Qt, Zt = 1) {
    this.dir = Zt, this.done = !1, this.lineBreak = !1, this.value = "", this.nodes = [Qt], this.offsets = [Zt > 0 ? 1 : (Qt instanceof TextLeaf ? Qt.text.length : Qt.children.length) << 1];
  }
  nextInner(Qt, Zt) {
    for (this.done = this.lineBreak = !1; ; ) {
      let $n = this.nodes.length - 1, Sn = this.nodes[$n], kn = this.offsets[$n], Kn = kn >> 1, er = Sn instanceof TextLeaf ? Sn.text.length : Sn.children.length;
      if (Kn == (Zt > 0 ? er : 0)) {
        if ($n == 0)
          return this.done = !0, this.value = "", this;
        Zt > 0 && this.offsets[$n - 1]++, this.nodes.pop(), this.offsets.pop();
      } else if ((kn & 1) == (Zt > 0 ? 0 : 1)) {
        if (this.offsets[$n] += Zt, Qt == 0)
          return this.lineBreak = !0, this.value = `
`, this;
        Qt--;
      } else if (Sn instanceof TextLeaf) {
        let Cr = Sn.text[Kn + (Zt < 0 ? -1 : 0)];
        if (this.offsets[$n] += Zt, Cr.length > Math.max(0, Qt))
          return this.value = Qt == 0 ? Cr : Zt > 0 ? Cr.slice(Qt) : Cr.slice(0, Cr.length - Qt), this;
        Qt -= Cr.length;
      } else {
        let Cr = Sn.children[Kn + (Zt < 0 ? -1 : 0)];
        Qt > Cr.length ? (Qt -= Cr.length, this.offsets[$n] += Zt) : (Zt < 0 && this.offsets[$n]--, this.nodes.push(Cr), this.offsets.push(Zt > 0 ? 1 : (Cr instanceof TextLeaf ? Cr.text.length : Cr.children.length) << 1));
      }
    }
  }
  next(Qt = 0) {
    return Qt < 0 && (this.nextInner(-Qt, -this.dir), Qt = this.value.length), this.nextInner(Qt, this.dir);
  }
}
class PartialTextCursor {
  constructor(Qt, Zt, $n) {
    this.value = "", this.done = !1, this.cursor = new RawTextCursor(Qt, Zt > $n ? -1 : 1), this.pos = Zt > $n ? Qt.length : 0, this.from = Math.min(Zt, $n), this.to = Math.max(Zt, $n);
  }
  nextInner(Qt, Zt) {
    if (Zt < 0 ? this.pos <= this.from : this.pos >= this.to)
      return this.value = "", this.done = !0, this;
    Qt += Math.max(0, Zt < 0 ? this.pos - this.to : this.from - this.pos);
    let $n = Zt < 0 ? this.pos - this.from : this.to - this.pos;
    Qt > $n && (Qt = $n), $n -= Qt;
    let { value: Sn } = this.cursor.next(Qt);
    return this.pos += (Sn.length + Qt) * Zt, this.value = Sn.length <= $n ? Sn : Zt < 0 ? Sn.slice(Sn.length - $n) : Sn.slice(0, $n), this.done = !this.value, this;
  }
  next(Qt = 0) {
    return Qt < 0 ? Qt = Math.max(Qt, this.from - this.pos) : Qt > 0 && (Qt = Math.min(Qt, this.to - this.pos)), this.nextInner(Qt, this.cursor.dir);
  }
  get lineBreak() {
    return this.cursor.lineBreak && this.value != "";
  }
}
class LineCursor {
  constructor(Qt) {
    this.inner = Qt, this.afterBreak = !0, this.value = "", this.done = !1;
  }
  next(Qt = 0) {
    let { done: Zt, lineBreak: $n, value: Sn } = this.inner.next(Qt);
    return Zt ? (this.done = !0, this.value = "") : $n ? this.afterBreak ? this.value = "" : (this.afterBreak = !0, this.next()) : (this.value = Sn, this.afterBreak = !1), this;
  }
  get lineBreak() {
    return !1;
  }
}
typeof Symbol < "u" && (Text$1.prototype[Symbol.iterator] = function() {
  return this.iter();
}, RawTextCursor.prototype[Symbol.iterator] = PartialTextCursor.prototype[Symbol.iterator] = LineCursor.prototype[Symbol.iterator] = function() {
  return this;
});
class Line {
  /**
  @internal
  */
  constructor(Qt, Zt, $n, Sn) {
    this.from = Qt, this.to = Zt, this.number = $n, this.text = Sn;
  }
  /**
  The length of the line (not including any line break after it).
  */
  get length() {
    return this.to - this.from;
  }
}
let extend$2 = /* @__PURE__ */ "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((_e) => _e ? parseInt(_e, 36) : 1);
for (let _e = 1; _e < extend$2.length; _e++)
  extend$2[_e] += extend$2[_e - 1];
function isExtendingChar(_e) {
  for (let Qt = 1; Qt < extend$2.length; Qt += 2)
    if (extend$2[Qt] > _e)
      return extend$2[Qt - 1] <= _e;
  return !1;
}
function isRegionalIndicator(_e) {
  return _e >= 127462 && _e <= 127487;
}
const ZWJ = 8205;
function findClusterBreak(_e, Qt, Zt = !0, $n = !0) {
  return (Zt ? nextClusterBreak : prevClusterBreak)(_e, Qt, $n);
}
function nextClusterBreak(_e, Qt, Zt) {
  if (Qt == _e.length)
    return Qt;
  Qt && surrogateLow(_e.charCodeAt(Qt)) && surrogateHigh(_e.charCodeAt(Qt - 1)) && Qt--;
  let $n = codePointAt(_e, Qt);
  for (Qt += codePointSize($n); Qt < _e.length; ) {
    let Sn = codePointAt(_e, Qt);
    if ($n == ZWJ || Sn == ZWJ || Zt && isExtendingChar(Sn))
      Qt += codePointSize(Sn), $n = Sn;
    else if (isRegionalIndicator(Sn)) {
      let kn = 0, Kn = Qt - 2;
      for (; Kn >= 0 && isRegionalIndicator(codePointAt(_e, Kn)); )
        kn++, Kn -= 2;
      if (kn % 2 == 0)
        break;
      Qt += 2;
    } else
      break;
  }
  return Qt;
}
function prevClusterBreak(_e, Qt, Zt) {
  for (; Qt > 0; ) {
    let $n = nextClusterBreak(_e, Qt - 2, Zt);
    if ($n < Qt)
      return $n;
    Qt--;
  }
  return 0;
}
function surrogateLow(_e) {
  return _e >= 56320 && _e < 57344;
}
function surrogateHigh(_e) {
  return _e >= 55296 && _e < 56320;
}
function codePointAt(_e, Qt) {
  let Zt = _e.charCodeAt(Qt);
  if (!surrogateHigh(Zt) || Qt + 1 == _e.length)
    return Zt;
  let $n = _e.charCodeAt(Qt + 1);
  return surrogateLow($n) ? (Zt - 55296 << 10) + ($n - 56320) + 65536 : Zt;
}
function codePointSize(_e) {
  return _e < 65536 ? 1 : 2;
}
const DefaultSplit = /\r\n?|\n/;
var MapMode = /* @__PURE__ */ function(_e) {
  return _e[_e.Simple = 0] = "Simple", _e[_e.TrackDel = 1] = "TrackDel", _e[_e.TrackBefore = 2] = "TrackBefore", _e[_e.TrackAfter = 3] = "TrackAfter", _e;
}(MapMode || (MapMode = {}));
class ChangeDesc {
  // Sections are encoded as pairs of integers. The first is the
  // length in the current document, and the second is -1 for
  // unaffected sections, and the length of the replacement content
  // otherwise. So an insertion would be (0, n>0), a deletion (n>0,
  // 0), and a replacement two positive numbers.
  /**
  @internal
  */
  constructor(Qt) {
    this.sections = Qt;
  }
  /**
  The length of the document before the change.
  */
  get length() {
    let Qt = 0;
    for (let Zt = 0; Zt < this.sections.length; Zt += 2)
      Qt += this.sections[Zt];
    return Qt;
  }
  /**
  The length of the document after the change.
  */
  get newLength() {
    let Qt = 0;
    for (let Zt = 0; Zt < this.sections.length; Zt += 2) {
      let $n = this.sections[Zt + 1];
      Qt += $n < 0 ? this.sections[Zt] : $n;
    }
    return Qt;
  }
  /**
  False when there are actual changes in this set.
  */
  get empty() {
    return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0;
  }
  /**
  Iterate over the unchanged parts left by these changes. `posA`
  provides the position of the range in the old document, `posB`
  the new position in the changed document.
  */
  iterGaps(Qt) {
    for (let Zt = 0, $n = 0, Sn = 0; Zt < this.sections.length; ) {
      let kn = this.sections[Zt++], Kn = this.sections[Zt++];
      Kn < 0 ? (Qt($n, Sn, kn), Sn += kn) : Sn += Kn, $n += kn;
    }
  }
  /**
  Iterate over the ranges changed by these changes. (See
  [`ChangeSet.iterChanges`](https://codemirror.net/6/docs/ref/#state.ChangeSet.iterChanges) for a
  variant that also provides you with the inserted text.)
  `fromA`/`toA` provides the extent of the change in the starting
  document, `fromB`/`toB` the extent of the replacement in the
  changed document.
  
  When `individual` is true, adjacent changes (which are kept
  separate for [position mapping](https://codemirror.net/6/docs/ref/#state.ChangeDesc.mapPos)) are
  reported separately.
  */
  iterChangedRanges(Qt, Zt = !1) {
    iterChanges(this, Qt, Zt);
  }
  /**
  Get a description of the inverted form of these changes.
  */
  get invertedDesc() {
    let Qt = [];
    for (let Zt = 0; Zt < this.sections.length; ) {
      let $n = this.sections[Zt++], Sn = this.sections[Zt++];
      Sn < 0 ? Qt.push($n, Sn) : Qt.push(Sn, $n);
    }
    return new ChangeDesc(Qt);
  }
  /**
  Compute the combined effect of applying another set of changes
  after this one. The length of the document after this set should
  match the length before `other`.
  */
  composeDesc(Qt) {
    return this.empty ? Qt : Qt.empty ? this : composeSets(this, Qt);
  }
  /**
  Map this description, which should start with the same document
  as `other`, over another set of changes, so that it can be
  applied after it. When `before` is true, map as if the changes
  in `other` happened before the ones in `this`.
  */
  mapDesc(Qt, Zt = !1) {
    return Qt.empty ? this : mapSet(this, Qt, Zt);
  }
  mapPos(Qt, Zt = -1, $n = MapMode.Simple) {
    let Sn = 0, kn = 0;
    for (let Kn = 0; Kn < this.sections.length; ) {
      let er = this.sections[Kn++], Cr = this.sections[Kn++], kr = Sn + er;
      if (Cr < 0) {
        if (kr > Qt)
          return kn + (Qt - Sn);
        kn += er;
      } else {
        if ($n != MapMode.Simple && kr >= Qt && ($n == MapMode.TrackDel && Sn < Qt && kr > Qt || $n == MapMode.TrackBefore && Sn < Qt || $n == MapMode.TrackAfter && kr > Qt))
          return null;
        if (kr > Qt || kr == Qt && Zt < 0 && !er)
          return Qt == Sn || Zt < 0 ? kn : kn + Cr;
        kn += Cr;
      }
      Sn = kr;
    }
    if (Qt > Sn)
      throw new RangeError(`Position ${Qt} is out of range for changeset of length ${Sn}`);
    return kn;
  }
  /**
  Check whether these changes touch a given range. When one of the
  changes entirely covers the range, the string `"cover"` is
  returned.
  */
  touchesRange(Qt, Zt = Qt) {
    for (let $n = 0, Sn = 0; $n < this.sections.length && Sn <= Zt; ) {
      let kn = this.sections[$n++], Kn = this.sections[$n++], er = Sn + kn;
      if (Kn >= 0 && Sn <= Zt && er >= Qt)
        return Sn < Qt && er > Zt ? "cover" : !0;
      Sn = er;
    }
    return !1;
  }
  /**
  @internal
  */
  toString() {
    let Qt = "";
    for (let Zt = 0; Zt < this.sections.length; ) {
      let $n = this.sections[Zt++], Sn = this.sections[Zt++];
      Qt += (Qt ? " " : "") + $n + (Sn >= 0 ? ":" + Sn : "");
    }
    return Qt;
  }
  /**
  Serialize this change desc to a JSON-representable value.
  */
  toJSON() {
    return this.sections;
  }
  /**
  Create a change desc from its JSON representation (as produced
  by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeDesc.toJSON).
  */
  static fromJSON(Qt) {
    if (!Array.isArray(Qt) || Qt.length % 2 || Qt.some((Zt) => typeof Zt != "number"))
      throw new RangeError("Invalid JSON representation of ChangeDesc");
    return new ChangeDesc(Qt);
  }
  /**
  @internal
  */
  static create(Qt) {
    return new ChangeDesc(Qt);
  }
}
class ChangeSet extends ChangeDesc {
  constructor(Qt, Zt) {
    super(Qt), this.inserted = Zt;
  }
  /**
  Apply the changes to a document, returning the modified
  document.
  */
  apply(Qt) {
    if (this.length != Qt.length)
      throw new RangeError("Applying change set to a document with the wrong length");
    return iterChanges(this, (Zt, $n, Sn, kn, Kn) => Qt = Qt.replace(Sn, Sn + ($n - Zt), Kn), !1), Qt;
  }
  mapDesc(Qt, Zt = !1) {
    return mapSet(this, Qt, Zt, !0);
  }
  /**
  Given the document as it existed _before_ the changes, return a
  change set that represents the inverse of this set, which could
  be used to go from the document created by the changes back to
  the document as it existed before the changes.
  */
  invert(Qt) {
    let Zt = this.sections.slice(), $n = [];
    for (let Sn = 0, kn = 0; Sn < Zt.length; Sn += 2) {
      let Kn = Zt[Sn], er = Zt[Sn + 1];
      if (er >= 0) {
        Zt[Sn] = er, Zt[Sn + 1] = Kn;
        let Cr = Sn >> 1;
        for (; $n.length < Cr; )
          $n.push(Text$1.empty);
        $n.push(Kn ? Qt.slice(kn, kn + Kn) : Text$1.empty);
      }
      kn += Kn;
    }
    return new ChangeSet(Zt, $n);
  }
  /**
  Combine two subsequent change sets into a single set. `other`
  must start in the document produced by `this`. If `this` goes
  `docA` → `docB` and `other` represents `docB` → `docC`, the
  returned value will represent the change `docA` → `docC`.
  */
  compose(Qt) {
    return this.empty ? Qt : Qt.empty ? this : composeSets(this, Qt, !0);
  }
  /**
  Given another change set starting in the same document, maps this
  change set over the other, producing a new change set that can be
  applied to the document produced by applying `other`. When
  `before` is `true`, order changes as if `this` comes before
  `other`, otherwise (the default) treat `other` as coming first.
  
  Given two changes `A` and `B`, `A.compose(B.map(A))` and
  `B.compose(A.map(B, true))` will produce the same document. This
  provides a basic form of [operational
  transformation](https://en.wikipedia.org/wiki/Operational_transformation),
  and can be used for collaborative editing.
  */
  map(Qt, Zt = !1) {
    return Qt.empty ? this : mapSet(this, Qt, Zt, !0);
  }
  /**
  Iterate over the changed ranges in the document, calling `f` for
  each, with the range in the original document (`fromA`-`toA`)
  and the range that replaces it in the new document
  (`fromB`-`toB`).
  
  When `individual` is true, adjacent changes are reported
  separately.
  */
  iterChanges(Qt, Zt = !1) {
    iterChanges(this, Qt, Zt);
  }
  /**
  Get a [change description](https://codemirror.net/6/docs/ref/#state.ChangeDesc) for this change
  set.
  */
  get desc() {
    return ChangeDesc.create(this.sections);
  }
  /**
  @internal
  */
  filter(Qt) {
    let Zt = [], $n = [], Sn = [], kn = new SectionIter(this);
    e:
      for (let Kn = 0, er = 0; ; ) {
        let Cr = Kn == Qt.length ? 1e9 : Qt[Kn++];
        for (; er < Cr || er == Cr && kn.len == 0; ) {
          if (kn.done)
            break e;
          let Yr = Math.min(kn.len, Cr - er);
          addSection(Sn, Yr, -1);
          let Ms = kn.ins == -1 ? -1 : kn.off == 0 ? kn.ins : 0;
          addSection(Zt, Yr, Ms), Ms > 0 && addInsert($n, Zt, kn.text), kn.forward(Yr), er += Yr;
        }
        let kr = Qt[Kn++];
        for (; er < kr; ) {
          if (kn.done)
            break e;
          let Yr = Math.min(kn.len, kr - er);
          addSection(Zt, Yr, -1), addSection(Sn, Yr, kn.ins == -1 ? -1 : kn.off == 0 ? kn.ins : 0), kn.forward(Yr), er += Yr;
        }
      }
    return {
      changes: new ChangeSet(Zt, $n),
      filtered: ChangeDesc.create(Sn)
    };
  }
  /**
  Serialize this change set to a JSON-representable value.
  */
  toJSON() {
    let Qt = [];
    for (let Zt = 0; Zt < this.sections.length; Zt += 2) {
      let $n = this.sections[Zt], Sn = this.sections[Zt + 1];
      Sn < 0 ? Qt.push($n) : Sn == 0 ? Qt.push([$n]) : Qt.push([$n].concat(this.inserted[Zt >> 1].toJSON()));
    }
    return Qt;
  }
  /**
  Create a change set for the given changes, for a document of the
  given length, using `lineSep` as line separator.
  */
  static of(Qt, Zt, $n) {
    let Sn = [], kn = [], Kn = 0, er = null;
    function Cr(Yr = !1) {
      if (!Yr && !Sn.length)
        return;
      Kn < Zt && addSection(Sn, Zt - Kn, -1);
      let Ms = new ChangeSet(Sn, kn);
      er = er ? er.compose(Ms.map(er)) : Ms, Sn = [], kn = [], Kn = 0;
    }
    function kr(Yr) {
      if (Array.isArray(Yr))
        for (let Ms of Yr)
          kr(Ms);
      else if (Yr instanceof ChangeSet) {
        if (Yr.length != Zt)
          throw new RangeError(`Mismatched change set length (got ${Yr.length}, expected ${Zt})`);
        Cr(), er = er ? er.compose(Yr.map(er)) : Yr;
      } else {
        let { from: Ms, to: Ds = Ms, insert: Ls } = Yr;
        if (Ms > Ds || Ms < 0 || Ds > Zt)
          throw new RangeError(`Invalid change range ${Ms} to ${Ds} (in doc of length ${Zt})`);
        let js = Ls ? typeof Ls == "string" ? Text$1.of(Ls.split($n || DefaultSplit)) : Ls : Text$1.empty, zs = js.length;
        if (Ms == Ds && zs == 0)
          return;
        Ms < Kn && Cr(), Ms > Kn && addSection(Sn, Ms - Kn, -1), addSection(Sn, Ds - Ms, zs), addInsert(kn, Sn, js), Kn = Ds;
      }
    }
    return kr(Qt), Cr(!er), er;
  }
  /**
  Create an empty changeset of the given length.
  */
  static empty(Qt) {
    return new ChangeSet(Qt ? [Qt, -1] : [], []);
  }
  /**
  Create a changeset from its JSON representation (as produced by
  [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeSet.toJSON).
  */
  static fromJSON(Qt) {
    if (!Array.isArray(Qt))
      throw new RangeError("Invalid JSON representation of ChangeSet");
    let Zt = [], $n = [];
    for (let Sn = 0; Sn < Qt.length; Sn++) {
      let kn = Qt[Sn];
      if (typeof kn == "number")
        Zt.push(kn, -1);
      else {
        if (!Array.isArray(kn) || typeof kn[0] != "number" || kn.some((Kn, er) => er && typeof Kn != "string"))
          throw new RangeError("Invalid JSON representation of ChangeSet");
        if (kn.length == 1)
          Zt.push(kn[0], 0);
        else {
          for (; $n.length < Sn; )
            $n.push(Text$1.empty);
          $n[Sn] = Text$1.of(kn.slice(1)), Zt.push(kn[0], $n[Sn].length);
        }
      }
    }
    return new ChangeSet(Zt, $n);
  }
  /**
  @internal
  */
  static createSet(Qt, Zt) {
    return new ChangeSet(Qt, Zt);
  }
}
function addSection(_e, Qt, Zt, $n = !1) {
  if (Qt == 0 && Zt <= 0)
    return;
  let Sn = _e.length - 2;
  Sn >= 0 && Zt <= 0 && Zt == _e[Sn + 1] ? _e[Sn] += Qt : Qt == 0 && _e[Sn] == 0 ? _e[Sn + 1] += Zt : $n ? (_e[Sn] += Qt, _e[Sn + 1] += Zt) : _e.push(Qt, Zt);
}
function addInsert(_e, Qt, Zt) {
  if (Zt.length == 0)
    return;
  let $n = Qt.length - 2 >> 1;
  if ($n < _e.length)
    _e[_e.length - 1] = _e[_e.length - 1].append(Zt);
  else {
    for (; _e.length < $n; )
      _e.push(Text$1.empty);
    _e.push(Zt);
  }
}
function iterChanges(_e, Qt, Zt) {
  let $n = _e.inserted;
  for (let Sn = 0, kn = 0, Kn = 0; Kn < _e.sections.length; ) {
    let er = _e.sections[Kn++], Cr = _e.sections[Kn++];
    if (Cr < 0)
      Sn += er, kn += er;
    else {
      let kr = Sn, Yr = kn, Ms = Text$1.empty;
      for (; kr += er, Yr += Cr, Cr && $n && (Ms = Ms.append($n[Kn - 2 >> 1])), !(Zt || Kn == _e.sections.length || _e.sections[Kn + 1] < 0); )
        er = _e.sections[Kn++], Cr = _e.sections[Kn++];
      Qt(Sn, kr, kn, Yr, Ms), Sn = kr, kn = Yr;
    }
  }
}
function mapSet(_e, Qt, Zt, $n = !1) {
  let Sn = [], kn = $n ? [] : null, Kn = new SectionIter(_e), er = new SectionIter(Qt);
  for (let Cr = -1; ; )
    if (Kn.ins == -1 && er.ins == -1) {
      let kr = Math.min(Kn.len, er.len);
      addSection(Sn, kr, -1), Kn.forward(kr), er.forward(kr);
    } else if (er.ins >= 0 && (Kn.ins < 0 || Cr == Kn.i || Kn.off == 0 && (er.len < Kn.len || er.len == Kn.len && !Zt))) {
      let kr = er.len;
      for (addSection(Sn, er.ins, -1); kr; ) {
        let Yr = Math.min(Kn.len, kr);
        Kn.ins >= 0 && Cr < Kn.i && Kn.len <= Yr && (addSection(Sn, 0, Kn.ins), kn && addInsert(kn, Sn, Kn.text), Cr = Kn.i), Kn.forward(Yr), kr -= Yr;
      }
      er.next();
    } else if (Kn.ins >= 0) {
      let kr = 0, Yr = Kn.len;
      for (; Yr; )
        if (er.ins == -1) {
          let Ms = Math.min(Yr, er.len);
          kr += Ms, Yr -= Ms, er.forward(Ms);
        } else if (er.ins == 0 && er.len < Yr)
          Yr -= er.len, er.next();
        else
          break;
      addSection(Sn, kr, Cr < Kn.i ? Kn.ins : 0), kn && Cr < Kn.i && addInsert(kn, Sn, Kn.text), Cr = Kn.i, Kn.forward(Kn.len - Yr);
    } else {
      if (Kn.done && er.done)
        return kn ? ChangeSet.createSet(Sn, kn) : ChangeDesc.create(Sn);
      throw new Error("Mismatched change set lengths");
    }
}
function composeSets(_e, Qt, Zt = !1) {
  let $n = [], Sn = Zt ? [] : null, kn = new SectionIter(_e), Kn = new SectionIter(Qt);
  for (let er = !1; ; ) {
    if (kn.done && Kn.done)
      return Sn ? ChangeSet.createSet($n, Sn) : ChangeDesc.create($n);
    if (kn.ins == 0)
      addSection($n, kn.len, 0, er), kn.next();
    else if (Kn.len == 0 && !Kn.done)
      addSection($n, 0, Kn.ins, er), Sn && addInsert(Sn, $n, Kn.text), Kn.next();
    else {
      if (kn.done || Kn.done)
        throw new Error("Mismatched change set lengths");
      {
        let Cr = Math.min(kn.len2, Kn.len), kr = $n.length;
        if (kn.ins == -1) {
          let Yr = Kn.ins == -1 ? -1 : Kn.off ? 0 : Kn.ins;
          addSection($n, Cr, Yr, er), Sn && Yr && addInsert(Sn, $n, Kn.text);
        } else
          Kn.ins == -1 ? (addSection($n, kn.off ? 0 : kn.len, Cr, er), Sn && addInsert(Sn, $n, kn.textBit(Cr))) : (addSection($n, kn.off ? 0 : kn.len, Kn.off ? 0 : Kn.ins, er), Sn && !Kn.off && addInsert(Sn, $n, Kn.text));
        er = (kn.ins > Cr || Kn.ins >= 0 && Kn.len > Cr) && (er || $n.length > kr), kn.forward2(Cr), Kn.forward(Cr);
      }
    }
  }
}
class SectionIter {
  constructor(Qt) {
    this.set = Qt, this.i = 0, this.next();
  }
  next() {
    let { sections: Qt } = this.set;
    this.i < Qt.length ? (this.len = Qt[this.i++], this.ins = Qt[this.i++]) : (this.len = 0, this.ins = -2), this.off = 0;
  }
  get done() {
    return this.ins == -2;
  }
  get len2() {
    return this.ins < 0 ? this.len : this.ins;
  }
  get text() {
    let { inserted: Qt } = this.set, Zt = this.i - 2 >> 1;
    return Zt >= Qt.length ? Text$1.empty : Qt[Zt];
  }
  textBit(Qt) {
    let { inserted: Zt } = this.set, $n = this.i - 2 >> 1;
    return $n >= Zt.length && !Qt ? Text$1.empty : Zt[$n].slice(this.off, Qt == null ? void 0 : this.off + Qt);
  }
  forward(Qt) {
    Qt == this.len ? this.next() : (this.len -= Qt, this.off += Qt);
  }
  forward2(Qt) {
    this.ins == -1 ? this.forward(Qt) : Qt == this.ins ? this.next() : (this.ins -= Qt, this.off += Qt);
  }
}
class SelectionRange {
  constructor(Qt, Zt, $n) {
    this.from = Qt, this.to = Zt, this.flags = $n;
  }
  /**
  The anchor of the range—the side that doesn't move when you
  extend it.
  */
  get anchor() {
    return this.flags & 16 ? this.to : this.from;
  }
  /**
  The head of the range, which is moved when the range is
  [extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend).
  */
  get head() {
    return this.flags & 16 ? this.from : this.to;
  }
  /**
  True when `anchor` and `head` are at the same position.
  */
  get empty() {
    return this.from == this.to;
  }
  /**
  If this is a cursor that is explicitly associated with the
  character on one of its sides, this returns the side. -1 means
  the character before its position, 1 the character after, and 0
  means no association.
  */
  get assoc() {
    return this.flags & 4 ? -1 : this.flags & 8 ? 1 : 0;
  }
  /**
  The bidirectional text level associated with this cursor, if
  any.
  */
  get bidiLevel() {
    let Qt = this.flags & 3;
    return Qt == 3 ? null : Qt;
  }
  /**
  The goal column (stored vertical offset) associated with a
  cursor. This is used to preserve the vertical position when
  [moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across
  lines of different length.
  */
  get goalColumn() {
    let Qt = this.flags >> 5;
    return Qt == 33554431 ? void 0 : Qt;
  }
  /**
  Map this range through a change, producing a valid range in the
  updated document.
  */
  map(Qt, Zt = -1) {
    let $n, Sn;
    return this.empty ? $n = Sn = Qt.mapPos(this.from, Zt) : ($n = Qt.mapPos(this.from, 1), Sn = Qt.mapPos(this.to, -1)), $n == this.from && Sn == this.to ? this : new SelectionRange($n, Sn, this.flags);
  }
  /**
  Extend this range to cover at least `from` to `to`.
  */
  extend(Qt, Zt = Qt) {
    if (Qt <= this.anchor && Zt >= this.anchor)
      return EditorSelection.range(Qt, Zt);
    let $n = Math.abs(Qt - this.anchor) > Math.abs(Zt - this.anchor) ? Qt : Zt;
    return EditorSelection.range(this.anchor, $n);
  }
  /**
  Compare this range to another range.
  */
  eq(Qt) {
    return this.anchor == Qt.anchor && this.head == Qt.head;
  }
  /**
  Return a JSON-serializable object representing the range.
  */
  toJSON() {
    return { anchor: this.anchor, head: this.head };
  }
  /**
  Convert a JSON representation of a range to a `SelectionRange`
  instance.
  */
  static fromJSON(Qt) {
    if (!Qt || typeof Qt.anchor != "number" || typeof Qt.head != "number")
      throw new RangeError("Invalid JSON representation for SelectionRange");
    return EditorSelection.range(Qt.anchor, Qt.head);
  }
  /**
  @internal
  */
  static create(Qt, Zt, $n) {
    return new SelectionRange(Qt, Zt, $n);
  }
}
class EditorSelection {
  constructor(Qt, Zt) {
    this.ranges = Qt, this.mainIndex = Zt;
  }
  /**
  Map a selection through a change. Used to adjust the selection
  position for changes.
  */
  map(Qt, Zt = -1) {
    return Qt.empty ? this : EditorSelection.create(this.ranges.map(($n) => $n.map(Qt, Zt)), this.mainIndex);
  }
  /**
  Compare this selection to another selection.
  */
  eq(Qt) {
    if (this.ranges.length != Qt.ranges.length || this.mainIndex != Qt.mainIndex)
      return !1;
    for (let Zt = 0; Zt < this.ranges.length; Zt++)
      if (!this.ranges[Zt].eq(Qt.ranges[Zt]))
        return !1;
    return !0;
  }
  /**
  Get the primary selection range. Usually, you should make sure
  your code applies to _all_ ranges, by using methods like
  [`changeByRange`](https://codemirror.net/6/docs/ref/#state.EditorState.changeByRange).
  */
  get main() {
    return this.ranges[this.mainIndex];
  }
  /**
  Make sure the selection only has one range. Returns a selection
  holding only the main range from this selection.
  */
  asSingle() {
    return this.ranges.length == 1 ? this : new EditorSelection([this.main], 0);
  }
  /**
  Extend this selection with an extra range.
  */
  addRange(Qt, Zt = !0) {
    return EditorSelection.create([Qt].concat(this.ranges), Zt ? 0 : this.mainIndex + 1);
  }
  /**
  Replace a given range with another range, and then normalize the
  selection to merge and sort ranges if necessary.
  */
  replaceRange(Qt, Zt = this.mainIndex) {
    let $n = this.ranges.slice();
    return $n[Zt] = Qt, EditorSelection.create($n, this.mainIndex);
  }
  /**
  Convert this selection to an object that can be serialized to
  JSON.
  */
  toJSON() {
    return { ranges: this.ranges.map((Qt) => Qt.toJSON()), main: this.mainIndex };
  }
  /**
  Create a selection from a JSON representation.
  */
  static fromJSON(Qt) {
    if (!Qt || !Array.isArray(Qt.ranges) || typeof Qt.main != "number" || Qt.main >= Qt.ranges.length)
      throw new RangeError("Invalid JSON representation for EditorSelection");
    return new EditorSelection(Qt.ranges.map((Zt) => SelectionRange.fromJSON(Zt)), Qt.main);
  }
  /**
  Create a selection holding a single range.
  */
  static single(Qt, Zt = Qt) {
    return new EditorSelection([EditorSelection.range(Qt, Zt)], 0);
  }
  /**
  Sort and merge the given set of ranges, creating a valid
  selection.
  */
  static create(Qt, Zt = 0) {
    if (Qt.length == 0)
      throw new RangeError("A selection needs at least one range");
    for (let $n = 0, Sn = 0; Sn < Qt.length; Sn++) {
      let kn = Qt[Sn];
      if (kn.empty ? kn.from <= $n : kn.from < $n)
        return EditorSelection.normalized(Qt.slice(), Zt);
      $n = kn.to;
    }
    return new EditorSelection(Qt, Zt);
  }
  /**
  Create a cursor selection range at the given position. You can
  safely ignore the optional arguments in most situations.
  */
  static cursor(Qt, Zt = 0, $n, Sn) {
    return SelectionRange.create(Qt, Qt, (Zt == 0 ? 0 : Zt < 0 ? 4 : 8) | ($n == null ? 3 : Math.min(2, $n)) | (Sn ?? 33554431) << 5);
  }
  /**
  Create a selection range.
  */
  static range(Qt, Zt, $n, Sn) {
    let kn = ($n ?? 33554431) << 5 | (Sn == null ? 3 : Math.min(2, Sn));
    return Zt < Qt ? SelectionRange.create(Zt, Qt, 24 | kn) : SelectionRange.create(Qt, Zt, (Zt > Qt ? 4 : 0) | kn);
  }
  /**
  @internal
  */
  static normalized(Qt, Zt = 0) {
    let $n = Qt[Zt];
    Qt.sort((Sn, kn) => Sn.from - kn.from), Zt = Qt.indexOf($n);
    for (let Sn = 1; Sn < Qt.length; Sn++) {
      let kn = Qt[Sn], Kn = Qt[Sn - 1];
      if (kn.empty ? kn.from <= Kn.to : kn.from < Kn.to) {
        let er = Kn.from, Cr = Math.max(kn.to, Kn.to);
        Sn <= Zt && Zt--, Qt.splice(--Sn, 2, kn.anchor > kn.head ? EditorSelection.range(Cr, er) : EditorSelection.range(er, Cr));
      }
    }
    return new EditorSelection(Qt, Zt);
  }
}
function checkSelection(_e, Qt) {
  for (let Zt of _e.ranges)
    if (Zt.to > Qt)
      throw new RangeError("Selection points outside of document");
}
let nextID = 0, Facet$2 = class FD {
  constructor(Qt, Zt, $n, Sn, kn) {
    this.combine = Qt, this.compareInput = Zt, this.compare = $n, this.isStatic = Sn, this.id = nextID++, this.default = Qt([]), this.extensions = typeof kn == "function" ? kn(this) : kn;
  }
  /**
  Define a new facet.
  */
  static define(Qt = {}) {
    return new FD(Qt.combine || ((Zt) => Zt), Qt.compareInput || ((Zt, $n) => Zt === $n), Qt.compare || (Qt.combine ? (Zt, $n) => Zt === $n : sameArray), !!Qt.static, Qt.enables);
  }
  /**
  Returns an extension that adds the given value to this facet.
  */
  of(Qt) {
    return new FacetProvider([], this, 0, Qt);
  }
  /**
  Create an extension that computes a value for the facet from a
  state. You must take care to declare the parts of the state that
  this value depends on, since your function is only called again
  for a new state when one of those parts changed.
  
  In cases where your value depends only on a single field, you'll
  want to use the [`from`](https://codemirror.net/6/docs/ref/#state.Facet.from) method instead.
  */
  compute(Qt, Zt) {
    if (this.isStatic)
      throw new Error("Can't compute a static facet");
    return new FacetProvider(Qt, this, 1, Zt);
  }
  /**
  Create an extension that computes zero or more values for this
  facet from a state.
  */
  computeN(Qt, Zt) {
    if (this.isStatic)
      throw new Error("Can't compute a static facet");
    return new FacetProvider(Qt, this, 2, Zt);
  }
  from(Qt, Zt) {
    return Zt || (Zt = ($n) => $n), this.compute([Qt], ($n) => Zt($n.field(Qt)));
  }
};
function sameArray(_e, Qt) {
  return _e == Qt || _e.length == Qt.length && _e.every((Zt, $n) => Zt === Qt[$n]);
}
class FacetProvider {
  constructor(Qt, Zt, $n, Sn) {
    this.dependencies = Qt, this.facet = Zt, this.type = $n, this.value = Sn, this.id = nextID++;
  }
  dynamicSlot(Qt) {
    var Zt;
    let $n = this.value, Sn = this.facet.compareInput, kn = this.id, Kn = Qt[kn] >> 1, er = this.type == 2, Cr = !1, kr = !1, Yr = [];
    for (let Ms of this.dependencies)
      Ms == "doc" ? Cr = !0 : Ms == "selection" ? kr = !0 : ((Zt = Qt[Ms.id]) !== null && Zt !== void 0 ? Zt : 1) & 1 || Yr.push(Qt[Ms.id]);
    return {
      create(Ms) {
        return Ms.values[Kn] = $n(Ms), 1;
      },
      update(Ms, Ds) {
        if (Cr && Ds.docChanged || kr && (Ds.docChanged || Ds.selection) || ensureAll(Ms, Yr)) {
          let Ls = $n(Ms);
          if (er ? !compareArray(Ls, Ms.values[Kn], Sn) : !Sn(Ls, Ms.values[Kn]))
            return Ms.values[Kn] = Ls, 1;
        }
        return 0;
      },
      reconfigure: (Ms, Ds) => {
        let Ls, js = Ds.config.address[kn];
        if (js != null) {
          let zs = getAddr(Ds, js);
          if (this.dependencies.every((Fs) => Fs instanceof Facet$2 ? Ds.facet(Fs) === Ms.facet(Fs) : Fs instanceof StateField ? Ds.field(Fs, !1) == Ms.field(Fs, !1) : !0) || (er ? compareArray(Ls = $n(Ms), zs, Sn) : Sn(Ls = $n(Ms), zs)))
            return Ms.values[Kn] = zs, 0;
        } else
          Ls = $n(Ms);
        return Ms.values[Kn] = Ls, 1;
      }
    };
  }
}
function compareArray(_e, Qt, Zt) {
  if (_e.length != Qt.length)
    return !1;
  for (let $n = 0; $n < _e.length; $n++)
    if (!Zt(_e[$n], Qt[$n]))
      return !1;
  return !0;
}
function ensureAll(_e, Qt) {
  let Zt = !1;
  for (let $n of Qt)
    ensureAddr(_e, $n) & 1 && (Zt = !0);
  return Zt;
}
function dynamicFacetSlot(_e, Qt, Zt) {
  let $n = Zt.map((Cr) => _e[Cr.id]), Sn = Zt.map((Cr) => Cr.type), kn = $n.filter((Cr) => !(Cr & 1)), Kn = _e[Qt.id] >> 1;
  function er(Cr) {
    let kr = [];
    for (let Yr = 0; Yr < $n.length; Yr++) {
      let Ms = getAddr(Cr, $n[Yr]);
      if (Sn[Yr] == 2)
        for (let Ds of Ms)
          kr.push(Ds);
      else
        kr.push(Ms);
    }
    return Qt.combine(kr);
  }
  return {
    create(Cr) {
      for (let kr of $n)
        ensureAddr(Cr, kr);
      return Cr.values[Kn] = er(Cr), 1;
    },
    update(Cr, kr) {
      if (!ensureAll(Cr, kn))
        return 0;
      let Yr = er(Cr);
      return Qt.compare(Yr, Cr.values[Kn]) ? 0 : (Cr.values[Kn] = Yr, 1);
    },
    reconfigure(Cr, kr) {
      let Yr = ensureAll(Cr, $n), Ms = kr.config.facets[Qt.id], Ds = kr.facet(Qt);
      if (Ms && !Yr && sameArray(Zt, Ms))
        return Cr.values[Kn] = Ds, 0;
      let Ls = er(Cr);
      return Qt.compare(Ls, Ds) ? (Cr.values[Kn] = Ds, 0) : (Cr.values[Kn] = Ls, 1);
    }
  };
}
const initField = /* @__PURE__ */ Facet$2.define({ static: !0 });
class StateField {
  constructor(Qt, Zt, $n, Sn, kn) {
    this.id = Qt, this.createF = Zt, this.updateF = $n, this.compareF = Sn, this.spec = kn, this.provides = void 0;
  }
  /**
  Define a state field.
  */
  static define(Qt) {
    let Zt = new StateField(nextID++, Qt.create, Qt.update, Qt.compare || (($n, Sn) => $n === Sn), Qt);
    return Qt.provide && (Zt.provides = Qt.provide(Zt)), Zt;
  }
  create(Qt) {
    let Zt = Qt.facet(initField).find(($n) => $n.field == this);
    return ((Zt == null ? void 0 : Zt.create) || this.createF)(Qt);
  }
  /**
  @internal
  */
  slot(Qt) {
    let Zt = Qt[this.id] >> 1;
    return {
      create: ($n) => ($n.values[Zt] = this.create($n), 1),
      update: ($n, Sn) => {
        let kn = $n.values[Zt], Kn = this.updateF(kn, Sn);
        return this.compareF(kn, Kn) ? 0 : ($n.values[Zt] = Kn, 1);
      },
      reconfigure: ($n, Sn) => Sn.config.address[this.id] != null ? ($n.values[Zt] = Sn.field(this), 0) : ($n.values[Zt] = this.create($n), 1)
    };
  }
  /**
  Returns an extension that enables this field and overrides the
  way it is initialized. Can be useful when you need to provide a
  non-default starting value for the field.
  */
  init(Qt) {
    return [this, initField.of({ field: this, create: Qt })];
  }
  /**
  State field instances can be used as
  [`Extension`](https://codemirror.net/6/docs/ref/#state.Extension) values to enable the field in a
  given state.
  */
  get extension() {
    return this;
  }
}
const Prec_ = { lowest: 4, low: 3, default: 2, high: 1, highest: 0 };
function prec(_e) {
  return (Qt) => new PrecExtension(Qt, _e);
}
const Prec = {
  /**
  The highest precedence level, for extensions that should end up
  near the start of the precedence ordering.
  */
  highest: /* @__PURE__ */ prec(Prec_.highest),
  /**
  A higher-than-default precedence, for extensions that should
  come before those with default precedence.
  */
  high: /* @__PURE__ */ prec(Prec_.high),
  /**
  The default precedence, which is also used for extensions
  without an explicit precedence.
  */
  default: /* @__PURE__ */ prec(Prec_.default),
  /**
  A lower-than-default precedence.
  */
  low: /* @__PURE__ */ prec(Prec_.low),
  /**
  The lowest precedence level. Meant for things that should end up
  near the end of the extension order.
  */
  lowest: /* @__PURE__ */ prec(Prec_.lowest)
};
class PrecExtension {
  constructor(Qt, Zt) {
    this.inner = Qt, this.prec = Zt;
  }
}
class Compartment {
  /**
  Create an instance of this compartment to add to your [state
  configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions).
  */
  of(Qt) {
    return new CompartmentInstance(this, Qt);
  }
  /**
  Create an [effect](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) that
  reconfigures this compartment.
  */
  reconfigure(Qt) {
    return Compartment.reconfigure.of({ compartment: this, extension: Qt });
  }
  /**
  Get the current content of the compartment in the state, or
  `undefined` if it isn't present.
  */
  get(Qt) {
    return Qt.config.compartments.get(this);
  }
}
class CompartmentInstance {
  constructor(Qt, Zt) {
    this.compartment = Qt, this.inner = Zt;
  }
}
class Configuration {
  constructor(Qt, Zt, $n, Sn, kn, Kn) {
    for (this.base = Qt, this.compartments = Zt, this.dynamicSlots = $n, this.address = Sn, this.staticValues = kn, this.facets = Kn, this.statusTemplate = []; this.statusTemplate.length < $n.length; )
      this.statusTemplate.push(
        0
        /* SlotStatus.Unresolved */
      );
  }
  staticFacet(Qt) {
    let Zt = this.address[Qt.id];
    return Zt == null ? Qt.default : this.staticValues[Zt >> 1];
  }
  static resolve(Qt, Zt, $n) {
    let Sn = [], kn = /* @__PURE__ */ Object.create(null), Kn = /* @__PURE__ */ new Map();
    for (let Ds of flatten$1(Qt, Zt, Kn))
      Ds instanceof StateField ? Sn.push(Ds) : (kn[Ds.facet.id] || (kn[Ds.facet.id] = [])).push(Ds);
    let er = /* @__PURE__ */ Object.create(null), Cr = [], kr = [];
    for (let Ds of Sn)
      er[Ds.id] = kr.length << 1, kr.push((Ls) => Ds.slot(Ls));
    let Yr = $n == null ? void 0 : $n.config.facets;
    for (let Ds in kn) {
      let Ls = kn[Ds], js = Ls[0].facet, zs = Yr && Yr[Ds] || [];
      if (Ls.every(
        (Fs) => Fs.type == 0
        /* Provider.Static */
      ))
        if (er[js.id] = Cr.length << 1 | 1, sameArray(zs, Ls))
          Cr.push($n.facet(js));
        else {
          let Fs = js.combine(Ls.map((Bs) => Bs.value));
          Cr.push($n && js.compare(Fs, $n.facet(js)) ? $n.facet(js) : Fs);
        }
      else {
        for (let Fs of Ls)
          Fs.type == 0 ? (er[Fs.id] = Cr.length << 1 | 1, Cr.push(Fs.value)) : (er[Fs.id] = kr.length << 1, kr.push((Bs) => Fs.dynamicSlot(Bs)));
        er[js.id] = kr.length << 1, kr.push((Fs) => dynamicFacetSlot(Fs, js, Ls));
      }
    }
    let Ms = kr.map((Ds) => Ds(er));
    return new Configuration(Qt, Kn, Ms, er, Cr, kn);
  }
}
function flatten$1(_e, Qt, Zt) {
  let $n = [[], [], [], [], []], Sn = /* @__PURE__ */ new Map();
  function kn(Kn, er) {
    let Cr = Sn.get(Kn);
    if (Cr != null) {
      if (Cr <= er)
        return;
      let kr = $n[Cr].indexOf(Kn);
      kr > -1 && $n[Cr].splice(kr, 1), Kn instanceof CompartmentInstance && Zt.delete(Kn.compartment);
    }
    if (Sn.set(Kn, er), Array.isArray(Kn))
      for (let kr of Kn)
        kn(kr, er);
    else if (Kn instanceof CompartmentInstance) {
      if (Zt.has(Kn.compartment))
        throw new RangeError("Duplicate use of compartment in extensions");
      let kr = Qt.get(Kn.compartment) || Kn.inner;
      Zt.set(Kn.compartment, kr), kn(kr, er);
    } else if (Kn instanceof PrecExtension)
      kn(Kn.inner, Kn.prec);
    else if (Kn instanceof StateField)
      $n[er].push(Kn), Kn.provides && kn(Kn.provides, er);
    else if (Kn instanceof FacetProvider)
      $n[er].push(Kn), Kn.facet.extensions && kn(Kn.facet.extensions, Prec_.default);
    else {
      let kr = Kn.extension;
      if (!kr)
        throw new Error(`Unrecognized extension value in extension set (${Kn}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);
      kn(kr, er);
    }
  }
  return kn(_e, Prec_.default), $n.reduce((Kn, er) => Kn.concat(er));
}
function ensureAddr(_e, Qt) {
  if (Qt & 1)
    return 2;
  let Zt = Qt >> 1, $n = _e.status[Zt];
  if ($n == 4)
    throw new Error("Cyclic dependency between fields and/or facets");
  if ($n & 2)
    return $n;
  _e.status[Zt] = 4;
  let Sn = _e.computeSlot(_e, _e.config.dynamicSlots[Zt]);
  return _e.status[Zt] = 2 | Sn;
}
function getAddr(_e, Qt) {
  return Qt & 1 ? _e.config.staticValues[Qt >> 1] : _e.values[Qt >> 1];
}
const languageData = /* @__PURE__ */ Facet$2.define(), allowMultipleSelections = /* @__PURE__ */ Facet$2.define({
  combine: (_e) => _e.some((Qt) => Qt),
  static: !0
}), lineSeparator = /* @__PURE__ */ Facet$2.define({
  combine: (_e) => _e.length ? _e[0] : void 0,
  static: !0
}), changeFilter = /* @__PURE__ */ Facet$2.define(), transactionFilter = /* @__PURE__ */ Facet$2.define(), transactionExtender = /* @__PURE__ */ Facet$2.define(), readOnly = /* @__PURE__ */ Facet$2.define({
  combine: (_e) => _e.length ? _e[0] : !1
});
class Annotation {
  /**
  @internal
  */
  constructor(Qt, Zt) {
    this.type = Qt, this.value = Zt;
  }
  /**
  Define a new type of annotation.
  */
  static define() {
    return new AnnotationType();
  }
}
class AnnotationType {
  /**
  Create an instance of this annotation.
  */
  of(Qt) {
    return new Annotation(this, Qt);
  }
}
class StateEffectType {
  /**
  @internal
  */
  constructor(Qt) {
    this.map = Qt;
  }
  /**
  Create a [state effect](https://codemirror.net/6/docs/ref/#state.StateEffect) instance of this
  type.
  */
  of(Qt) {
    return new StateEffect(this, Qt);
  }
}
class StateEffect {
  /**
  @internal
  */
  constructor(Qt, Zt) {
    this.type = Qt, this.value = Zt;
  }
  /**
  Map this effect through a position mapping. Will return
  `undefined` when that ends up deleting the effect.
  */
  map(Qt) {
    let Zt = this.type.map(this.value, Qt);
    return Zt === void 0 ? void 0 : Zt == this.value ? this : new StateEffect(this.type, Zt);
  }
  /**
  Tells you whether this effect object is of a given
  [type](https://codemirror.net/6/docs/ref/#state.StateEffectType).
  */
  is(Qt) {
    return this.type == Qt;
  }
  /**
  Define a new effect type. The type parameter indicates the type
  of values that his effect holds. It should be a type that
  doesn't include `undefined`, since that is used in
  [mapping](https://codemirror.net/6/docs/ref/#state.StateEffect.map) to indicate that an effect is
  removed.
  */
  static define(Qt = {}) {
    return new StateEffectType(Qt.map || ((Zt) => Zt));
  }
  /**
  Map an array of effects through a change set.
  */
  static mapEffects(Qt, Zt) {
    if (!Qt.length)
      return Qt;
    let $n = [];
    for (let Sn of Qt) {
      let kn = Sn.map(Zt);
      kn && $n.push(kn);
    }
    return $n;
  }
}
StateEffect.reconfigure = /* @__PURE__ */ StateEffect.define();
StateEffect.appendConfig = /* @__PURE__ */ StateEffect.define();
class Transaction {
  constructor(Qt, Zt, $n, Sn, kn, Kn) {
    this.startState = Qt, this.changes = Zt, this.selection = $n, this.effects = Sn, this.annotations = kn, this.scrollIntoView = Kn, this._doc = null, this._state = null, $n && checkSelection($n, Zt.newLength), kn.some((er) => er.type == Transaction.time) || (this.annotations = kn.concat(Transaction.time.of(Date.now())));
  }
  /**
  @internal
  */
  static create(Qt, Zt, $n, Sn, kn, Kn) {
    return new Transaction(Qt, Zt, $n, Sn, kn, Kn);
  }
  /**
  The new document produced by the transaction. Contrary to
  [`.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state)`.doc`, accessing this won't
  force the entire new state to be computed right away, so it is
  recommended that [transaction
  filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) use this getter
  when they need to look at the new document.
  */
  get newDoc() {
    return this._doc || (this._doc = this.changes.apply(this.startState.doc));
  }
  /**
  The new selection produced by the transaction. If
  [`this.selection`](https://codemirror.net/6/docs/ref/#state.Transaction.selection) is undefined,
  this will [map](https://codemirror.net/6/docs/ref/#state.EditorSelection.map) the start state's
  current selection through the changes made by the transaction.
  */
  get newSelection() {
    return this.selection || this.startState.selection.map(this.changes);
  }
  /**
  The new state created by the transaction. Computed on demand
  (but retained for subsequent access), so it is recommended not to
  access it in [transaction
  filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) when possible.
  */
  get state() {
    return this._state || this.startState.applyTransaction(this), this._state;
  }
  /**
  Get the value of the given annotation type, if any.
  */
  annotation(Qt) {
    for (let Zt of this.annotations)
      if (Zt.type == Qt)
        return Zt.value;
  }
  /**
  Indicates whether the transaction changed the document.
  */
  get docChanged() {
    return !this.changes.empty;
  }
  /**
  Indicates whether this transaction reconfigures the state
  (through a [configuration compartment](https://codemirror.net/6/docs/ref/#state.Compartment) or
  with a top-level configuration
  [effect](https://codemirror.net/6/docs/ref/#state.StateEffect^reconfigure).
  */
  get reconfigured() {
    return this.startState.config != this.state.config;
  }
  /**
  Returns true if the transaction has a [user
  event](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent) annotation that is equal to
  or more specific than `event`. For example, if the transaction
  has `"select.pointer"` as user event, `"select"` and
  `"select.pointer"` will match it.
  */
  isUserEvent(Qt) {
    let Zt = this.annotation(Transaction.userEvent);
    return !!(Zt && (Zt == Qt || Zt.length > Qt.length && Zt.slice(0, Qt.length) == Qt && Zt[Qt.length] == "."));
  }
}
Transaction.time = /* @__PURE__ */ Annotation.define();
Transaction.userEvent = /* @__PURE__ */ Annotation.define();
Transaction.addToHistory = /* @__PURE__ */ Annotation.define();
Transaction.remote = /* @__PURE__ */ Annotation.define();
function joinRanges(_e, Qt) {
  let Zt = [];
  for (let $n = 0, Sn = 0; ; ) {
    let kn, Kn;
    if ($n < _e.length && (Sn == Qt.length || Qt[Sn] >= _e[$n]))
      kn = _e[$n++], Kn = _e[$n++];
    else if (Sn < Qt.length)
      kn = Qt[Sn++], Kn = Qt[Sn++];
    else
      return Zt;
    !Zt.length || Zt[Zt.length - 1] < kn ? Zt.push(kn, Kn) : Zt[Zt.length - 1] < Kn && (Zt[Zt.length - 1] = Kn);
  }
}
function mergeTransaction(_e, Qt, Zt) {
  var $n;
  let Sn, kn, Kn;
  return Zt ? (Sn = Qt.changes, kn = ChangeSet.empty(Qt.changes.length), Kn = _e.changes.compose(Qt.changes)) : (Sn = Qt.changes.map(_e.changes), kn = _e.changes.mapDesc(Qt.changes, !0), Kn = _e.changes.compose(Sn)), {
    changes: Kn,
    selection: Qt.selection ? Qt.selection.map(kn) : ($n = _e.selection) === null || $n === void 0 ? void 0 : $n.map(Sn),
    effects: StateEffect.mapEffects(_e.effects, Sn).concat(StateEffect.mapEffects(Qt.effects, kn)),
    annotations: _e.annotations.length ? _e.annotations.concat(Qt.annotations) : Qt.annotations,
    scrollIntoView: _e.scrollIntoView || Qt.scrollIntoView
  };
}
function resolveTransactionInner(_e, Qt, Zt) {
  let $n = Qt.selection, Sn = asArray(Qt.annotations);
  return Qt.userEvent && (Sn = Sn.concat(Transaction.userEvent.of(Qt.userEvent))), {
    changes: Qt.changes instanceof ChangeSet ? Qt.changes : ChangeSet.of(Qt.changes || [], Zt, _e.facet(lineSeparator)),
    selection: $n && ($n instanceof EditorSelection ? $n : EditorSelection.single($n.anchor, $n.head)),
    effects: asArray(Qt.effects),
    annotations: Sn,
    scrollIntoView: !!Qt.scrollIntoView
  };
}
function resolveTransaction(_e, Qt, Zt) {
  let $n = resolveTransactionInner(_e, Qt.length ? Qt[0] : {}, _e.doc.length);
  Qt.length && Qt[0].filter === !1 && (Zt = !1);
  for (let kn = 1; kn < Qt.length; kn++) {
    Qt[kn].filter === !1 && (Zt = !1);
    let Kn = !!Qt[kn].sequential;
    $n = mergeTransaction($n, resolveTransactionInner(_e, Qt[kn], Kn ? $n.changes.newLength : _e.doc.length), Kn);
  }
  let Sn = Transaction.create(_e, $n.changes, $n.selection, $n.effects, $n.annotations, $n.scrollIntoView);
  return extendTransaction(Zt ? filterTransaction(Sn) : Sn);
}
function filterTransaction(_e) {
  let Qt = _e.startState, Zt = !0;
  for (let Sn of Qt.facet(changeFilter)) {
    let kn = Sn(_e);
    if (kn === !1) {
      Zt = !1;
      break;
    }
    Array.isArray(kn) && (Zt = Zt === !0 ? kn : joinRanges(Zt, kn));
  }
  if (Zt !== !0) {
    let Sn, kn;
    if (Zt === !1)
      kn = _e.changes.invertedDesc, Sn = ChangeSet.empty(Qt.doc.length);
    else {
      let Kn = _e.changes.filter(Zt);
      Sn = Kn.changes, kn = Kn.filtered.mapDesc(Kn.changes).invertedDesc;
    }
    _e = Transaction.create(Qt, Sn, _e.selection && _e.selection.map(kn), StateEffect.mapEffects(_e.effects, kn), _e.annotations, _e.scrollIntoView);
  }
  let $n = Qt.facet(transactionFilter);
  for (let Sn = $n.length - 1; Sn >= 0; Sn--) {
    let kn = $n[Sn](_e);
    kn instanceof Transaction ? _e = kn : Array.isArray(kn) && kn.length == 1 && kn[0] instanceof Transaction ? _e = kn[0] : _e = resolveTransaction(Qt, asArray(kn), !1);
  }
  return _e;
}
function extendTransaction(_e) {
  let Qt = _e.startState, Zt = Qt.facet(transactionExtender), $n = _e;
  for (let Sn = Zt.length - 1; Sn >= 0; Sn--) {
    let kn = Zt[Sn](_e);
    kn && Object.keys(kn).length && ($n = mergeTransaction($n, resolveTransactionInner(Qt, kn, _e.changes.newLength), !0));
  }
  return $n == _e ? _e : Transaction.create(Qt, _e.changes, _e.selection, $n.effects, $n.annotations, $n.scrollIntoView);
}
const none$1 = [];
function asArray(_e) {
  return _e == null ? none$1 : Array.isArray(_e) ? _e : [_e];
}
var CharCategory = /* @__PURE__ */ function(_e) {
  return _e[_e.Word = 0] = "Word", _e[_e.Space = 1] = "Space", _e[_e.Other = 2] = "Other", _e;
}(CharCategory || (CharCategory = {}));
const nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
let wordChar;
try {
  wordChar = /* @__PURE__ */ new RegExp("[\\p{Alphabetic}\\p{Number}_]", "u");
} catch (_e) {
}
function hasWordChar(_e) {
  if (wordChar)
    return wordChar.test(_e);
  for (let Qt = 0; Qt < _e.length; Qt++) {
    let Zt = _e[Qt];
    if (/\w/.test(Zt) || Zt > "" && (Zt.toUpperCase() != Zt.toLowerCase() || nonASCIISingleCaseWordChar.test(Zt)))
      return !0;
  }
  return !1;
}
function makeCategorizer(_e) {
  return (Qt) => {
    if (!/\S/.test(Qt))
      return CharCategory.Space;
    if (hasWordChar(Qt))
      return CharCategory.Word;
    for (let Zt = 0; Zt < _e.length; Zt++)
      if (Qt.indexOf(_e[Zt]) > -1)
        return CharCategory.Word;
    return CharCategory.Other;
  };
}
class EditorState {
  constructor(Qt, Zt, $n, Sn, kn, Kn) {
    this.config = Qt, this.doc = Zt, this.selection = $n, this.values = Sn, this.status = Qt.statusTemplate.slice(), this.computeSlot = kn, Kn && (Kn._state = this);
    for (let er = 0; er < this.config.dynamicSlots.length; er++)
      ensureAddr(this, er << 1);
    this.computeSlot = null;
  }
  field(Qt, Zt = !0) {
    let $n = this.config.address[Qt.id];
    if ($n == null) {
      if (Zt)
        throw new RangeError("Field is not present in this state");
      return;
    }
    return ensureAddr(this, $n), getAddr(this, $n);
  }
  /**
  Create a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction) that updates this
  state. Any number of [transaction specs](https://codemirror.net/6/docs/ref/#state.TransactionSpec)
  can be passed. Unless
  [`sequential`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.sequential) is set, the
  [changes](https://codemirror.net/6/docs/ref/#state.TransactionSpec.changes) (if any) of each spec
  are assumed to start in the _current_ document (not the document
  produced by previous specs), and its
  [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) and
  [effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) are assumed to refer
  to the document created by its _own_ changes. The resulting
  transaction contains the combined effect of all the different
  specs. For [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection), later
  specs take precedence over earlier ones.
  */
  update(...Qt) {
    return resolveTransaction(this, Qt, !0);
  }
  /**
  @internal
  */
  applyTransaction(Qt) {
    let Zt = this.config, { base: $n, compartments: Sn } = Zt;
    for (let Kn of Qt.effects)
      Kn.is(Compartment.reconfigure) ? (Zt && (Sn = /* @__PURE__ */ new Map(), Zt.compartments.forEach((er, Cr) => Sn.set(Cr, er)), Zt = null), Sn.set(Kn.value.compartment, Kn.value.extension)) : Kn.is(StateEffect.reconfigure) ? (Zt = null, $n = Kn.value) : Kn.is(StateEffect.appendConfig) && (Zt = null, $n = asArray($n).concat(Kn.value));
    let kn;
    Zt ? kn = Qt.startState.values.slice() : (Zt = Configuration.resolve($n, Sn, this), kn = new EditorState(Zt, this.doc, this.selection, Zt.dynamicSlots.map(() => null), (er, Cr) => Cr.reconfigure(er, this), null).values), new EditorState(Zt, Qt.newDoc, Qt.newSelection, kn, (Kn, er) => er.update(Kn, Qt), Qt);
  }
  /**
  Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that
  replaces every selection range with the given content.
  */
  replaceSelection(Qt) {
    return typeof Qt == "string" && (Qt = this.toText(Qt)), this.changeByRange((Zt) => ({
      changes: { from: Zt.from, to: Zt.to, insert: Qt },
      range: EditorSelection.cursor(Zt.from + Qt.length)
    }));
  }
  /**
  Create a set of changes and a new selection by running the given
  function for each range in the active selection. The function
  can return an optional set of changes (in the coordinate space
  of the start document), plus an updated range (in the coordinate
  space of the document produced by the call's own changes). This
  method will merge all the changes and ranges into a single
  changeset and selection, and return it as a [transaction
  spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec), which can be passed to
  [`update`](https://codemirror.net/6/docs/ref/#state.EditorState.update).
  */
  changeByRange(Qt) {
    let Zt = this.selection, $n = Qt(Zt.ranges[0]), Sn = this.changes($n.changes), kn = [$n.range], Kn = asArray($n.effects);
    for (let er = 1; er < Zt.ranges.length; er++) {
      let Cr = Qt(Zt.ranges[er]), kr = this.changes(Cr.changes), Yr = kr.map(Sn);
      for (let Ds = 0; Ds < er; Ds++)
        kn[Ds] = kn[Ds].map(Yr);
      let Ms = Sn.mapDesc(kr, !0);
      kn.push(Cr.range.map(Ms)), Sn = Sn.compose(Yr), Kn = StateEffect.mapEffects(Kn, Yr).concat(StateEffect.mapEffects(asArray(Cr.effects), Ms));
    }
    return {
      changes: Sn,
      selection: EditorSelection.create(kn, Zt.mainIndex),
      effects: Kn
    };
  }
  /**
  Create a [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet) from the given change
  description, taking the state's document length and line
  separator into account.
  */
  changes(Qt = []) {
    return Qt instanceof ChangeSet ? Qt : ChangeSet.of(Qt, this.doc.length, this.facet(EditorState.lineSeparator));
  }
  /**
  Using the state's [line
  separator](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator), create a
  [`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string.
  */
  toText(Qt) {
    return Text$1.of(Qt.split(this.facet(EditorState.lineSeparator) || DefaultSplit));
  }
  /**
  Return the given range of the document as a string.
  */
  sliceDoc(Qt = 0, Zt = this.doc.length) {
    return this.doc.sliceString(Qt, Zt, this.lineBreak);
  }
  /**
  Get the value of a state [facet](https://codemirror.net/6/docs/ref/#state.Facet).
  */
  facet(Qt) {
    let Zt = this.config.address[Qt.id];
    return Zt == null ? Qt.default : (ensureAddr(this, Zt), getAddr(this, Zt));
  }
  /**
  Convert this state to a JSON-serializable object. When custom
  fields should be serialized, you can pass them in as an object
  mapping property names (in the resulting object, which should
  not use `doc` or `selection`) to fields.
  */
  toJSON(Qt) {
    let Zt = {
      doc: this.sliceDoc(),
      selection: this.selection.toJSON()
    };
    if (Qt)
      for (let $n in Qt) {
        let Sn = Qt[$n];
        Sn instanceof StateField && this.config.address[Sn.id] != null && (Zt[$n] = Sn.spec.toJSON(this.field(Qt[$n]), this));
      }
    return Zt;
  }
  /**
  Deserialize a state from its JSON representation. When custom
  fields should be deserialized, pass the same object you passed
  to [`toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) when serializing as
  third argument.
  */
  static fromJSON(Qt, Zt = {}, $n) {
    if (!Qt || typeof Qt.doc != "string")
      throw new RangeError("Invalid JSON representation for EditorState");
    let Sn = [];
    if ($n) {
      for (let kn in $n)
        if (Object.prototype.hasOwnProperty.call(Qt, kn)) {
          let Kn = $n[kn], er = Qt[kn];
          Sn.push(Kn.init((Cr) => Kn.spec.fromJSON(er, Cr)));
        }
    }
    return EditorState.create({
      doc: Qt.doc,
      selection: EditorSelection.fromJSON(Qt.selection),
      extensions: Zt.extensions ? Sn.concat([Zt.extensions]) : Sn
    });
  }
  /**
  Create a new state. You'll usually only need this when
  initializing an editor—updated states are created by applying
  transactions.
  */
  static create(Qt = {}) {
    let Zt = Configuration.resolve(Qt.extensions || [], /* @__PURE__ */ new Map()), $n = Qt.doc instanceof Text$1 ? Qt.doc : Text$1.of((Qt.doc || "").split(Zt.staticFacet(EditorState.lineSeparator) || DefaultSplit)), Sn = Qt.selection ? Qt.selection instanceof EditorSelection ? Qt.selection : EditorSelection.single(Qt.selection.anchor, Qt.selection.head) : EditorSelection.single(0);
    return checkSelection(Sn, $n.length), Zt.staticFacet(allowMultipleSelections) || (Sn = Sn.asSingle()), new EditorState(Zt, $n, Sn, Zt.dynamicSlots.map(() => null), (kn, Kn) => Kn.create(kn), null);
  }
  /**
  The size (in columns) of a tab in the document, determined by
  the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet.
  */
  get tabSize() {
    return this.facet(EditorState.tabSize);
  }
  /**
  Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator)
  string for this state.
  */
  get lineBreak() {
    return this.facet(EditorState.lineSeparator) || `
`;
  }
  /**
  Returns true when the editor is
  [configured](https://codemirror.net/6/docs/ref/#state.EditorState^readOnly) to be read-only.
  */
  get readOnly() {
    return this.facet(readOnly);
  }
  /**
  Look up a translation for the given phrase (via the
  [`phrases`](https://codemirror.net/6/docs/ref/#state.EditorState^phrases) facet), or return the
  original string if no translation is found.
  
  If additional arguments are passed, they will be inserted in
  place of markers like `$1` (for the first value) and `$2`, etc.
  A single `$` is equivalent to `$1`, and `$$` will produce a
  literal dollar sign.
  */
  phrase(Qt, ...Zt) {
    for (let $n of this.facet(EditorState.phrases))
      if (Object.prototype.hasOwnProperty.call($n, Qt)) {
        Qt = $n[Qt];
        break;
      }
    return Zt.length && (Qt = Qt.replace(/\$(\$|\d*)/g, ($n, Sn) => {
      if (Sn == "$")
        return "$";
      let kn = +(Sn || 1);
      return !kn || kn > Zt.length ? $n : Zt[kn - 1];
    })), Qt;
  }
  /**
  Find the values for a given language data field, provided by the
  the [`languageData`](https://codemirror.net/6/docs/ref/#state.EditorState^languageData) facet.
  
  Examples of language data fields are...
  
  - [`"commentTokens"`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) for specifying
    comment syntax.
  - [`"autocomplete"`](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion^config.override)
    for providing language-specific completion sources.
  - [`"wordChars"`](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) for adding
    characters that should be considered part of words in this
    language.
  - [`"closeBrackets"`](https://codemirror.net/6/docs/ref/#autocomplete.CloseBracketConfig) controls
    bracket closing behavior.
  */
  languageDataAt(Qt, Zt, $n = -1) {
    let Sn = [];
    for (let kn of this.facet(languageData))
      for (let Kn of kn(this, Zt, $n))
        Object.prototype.hasOwnProperty.call(Kn, Qt) && Sn.push(Kn[Qt]);
    return Sn;
  }
  /**
  Return a function that can categorize strings (expected to
  represent a single [grapheme cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak))
  into one of:
  
   - Word (contains an alphanumeric character or a character
     explicitly listed in the local language's `"wordChars"`
     language data, which should be a string)
   - Space (contains only whitespace)
   - Other (anything else)
  */
  charCategorizer(Qt) {
    return makeCategorizer(this.languageDataAt("wordChars", Qt).join(""));
  }
  /**
  Find the word at the given position, meaning the range
  containing all [word](https://codemirror.net/6/docs/ref/#state.CharCategory.Word) characters
  around it. If no word characters are adjacent to the position,
  this returns null.
  */
  wordAt(Qt) {
    let { text: Zt, from: $n, length: Sn } = this.doc.lineAt(Qt), kn = this.charCategorizer(Qt), Kn = Qt - $n, er = Qt - $n;
    for (; Kn > 0; ) {
      let Cr = findClusterBreak(Zt, Kn, !1);
      if (kn(Zt.slice(Cr, Kn)) != CharCategory.Word)
        break;
      Kn = Cr;
    }
    for (; er < Sn; ) {
      let Cr = findClusterBreak(Zt, er);
      if (kn(Zt.slice(er, Cr)) != CharCategory.Word)
        break;
      er = Cr;
    }
    return Kn == er ? null : EditorSelection.range(Kn + $n, er + $n);
  }
}
EditorState.allowMultipleSelections = allowMultipleSelections;
EditorState.tabSize = /* @__PURE__ */ Facet$2.define({
  combine: (_e) => _e.length ? _e[0] : 4
});
EditorState.lineSeparator = lineSeparator;
EditorState.readOnly = readOnly;
EditorState.phrases = /* @__PURE__ */ Facet$2.define({
  compare(_e, Qt) {
    let Zt = Object.keys(_e), $n = Object.keys(Qt);
    return Zt.length == $n.length && Zt.every((Sn) => _e[Sn] == Qt[Sn]);
  }
});
EditorState.languageData = languageData;
EditorState.changeFilter = changeFilter;
EditorState.transactionFilter = transactionFilter;
EditorState.transactionExtender = transactionExtender;
Compartment.reconfigure = /* @__PURE__ */ StateEffect.define();
class RangeValue {
  /**
  Compare this value with another value. Used when comparing
  rangesets. The default implementation compares by identity.
  Unless you are only creating a fixed number of unique instances
  of your value type, it is a good idea to implement this
  properly.
  */
  eq(Qt) {
    return this == Qt;
  }
  /**
  Create a [range](https://codemirror.net/6/docs/ref/#state.Range) with this value.
  */
  range(Qt, Zt = Qt) {
    return Range$1.create(Qt, Zt, this);
  }
}
RangeValue.prototype.startSide = RangeValue.prototype.endSide = 0;
RangeValue.prototype.point = !1;
RangeValue.prototype.mapMode = MapMode.TrackDel;
let Range$1 = class BD {
  constructor(Qt, Zt, $n) {
    this.from = Qt, this.to = Zt, this.value = $n;
  }
  /**
  @internal
  */
  static create(Qt, Zt, $n) {
    return new BD(Qt, Zt, $n);
  }
};
function cmpRange(_e, Qt) {
  return _e.from - Qt.from || _e.value.startSide - Qt.value.startSide;
}
class Chunk {
  constructor(Qt, Zt, $n, Sn) {
    this.from = Qt, this.to = Zt, this.value = $n, this.maxPoint = Sn;
  }
  get length() {
    return this.to[this.to.length - 1];
  }
  // Find the index of the given position and side. Use the ranges'
  // `from` pos when `end == false`, `to` when `end == true`.
  findIndex(Qt, Zt, $n, Sn = 0) {
    let kn = $n ? this.to : this.from;
    for (let Kn = Sn, er = kn.length; ; ) {
      if (Kn == er)
        return Kn;
      let Cr = Kn + er >> 1, kr = kn[Cr] - Qt || ($n ? this.value[Cr].endSide : this.value[Cr].startSide) - Zt;
      if (Cr == Kn)
        return kr >= 0 ? Kn : er;
      kr >= 0 ? er = Cr : Kn = Cr + 1;
    }
  }
  between(Qt, Zt, $n, Sn) {
    for (let kn = this.findIndex(Zt, -1e9, !0), Kn = this.findIndex($n, 1e9, !1, kn); kn < Kn; kn++)
      if (Sn(this.from[kn] + Qt, this.to[kn] + Qt, this.value[kn]) === !1)
        return !1;
  }
  map(Qt, Zt) {
    let $n = [], Sn = [], kn = [], Kn = -1, er = -1;
    for (let Cr = 0; Cr < this.value.length; Cr++) {
      let kr = this.value[Cr], Yr = this.from[Cr] + Qt, Ms = this.to[Cr] + Qt, Ds, Ls;
      if (Yr == Ms) {
        let js = Zt.mapPos(Yr, kr.startSide, kr.mapMode);
        if (js == null || (Ds = Ls = js, kr.startSide != kr.endSide && (Ls = Zt.mapPos(Yr, kr.endSide), Ls < Ds)))
          continue;
      } else if (Ds = Zt.mapPos(Yr, kr.startSide), Ls = Zt.mapPos(Ms, kr.endSide), Ds > Ls || Ds == Ls && kr.startSide > 0 && kr.endSide <= 0)
        continue;
      (Ls - Ds || kr.endSide - kr.startSide) < 0 || (Kn < 0 && (Kn = Ds), kr.point && (er = Math.max(er, Ls - Ds)), $n.push(kr), Sn.push(Ds - Kn), kn.push(Ls - Kn));
    }
    return { mapped: $n.length ? new Chunk(Sn, kn, $n, er) : null, pos: Kn };
  }
}
class RangeSet {
  constructor(Qt, Zt, $n, Sn) {
    this.chunkPos = Qt, this.chunk = Zt, this.nextLayer = $n, this.maxPoint = Sn;
  }
  /**
  @internal
  */
  static create(Qt, Zt, $n, Sn) {
    return new RangeSet(Qt, Zt, $n, Sn);
  }
  /**
  @internal
  */
  get length() {
    let Qt = this.chunk.length - 1;
    return Qt < 0 ? 0 : Math.max(this.chunkEnd(Qt), this.nextLayer.length);
  }
  /**
  The number of ranges in the set.
  */
  get size() {
    if (this.isEmpty)
      return 0;
    let Qt = this.nextLayer.size;
    for (let Zt of this.chunk)
      Qt += Zt.value.length;
    return Qt;
  }
  /**
  @internal
  */
  chunkEnd(Qt) {
    return this.chunkPos[Qt] + this.chunk[Qt].length;
  }
  /**
  Update the range set, optionally adding new ranges or filtering
  out existing ones.
  
  (Note: The type parameter is just there as a kludge to work
  around TypeScript variance issues that prevented `RangeSet<X>`
  from being a subtype of `RangeSet<Y>` when `X` is a subtype of
  `Y`.)
  */
  update(Qt) {
    let { add: Zt = [], sort: $n = !1, filterFrom: Sn = 0, filterTo: kn = this.length } = Qt, Kn = Qt.filter;
    if (Zt.length == 0 && !Kn)
      return this;
    if ($n && (Zt = Zt.slice().sort(cmpRange)), this.isEmpty)
      return Zt.length ? RangeSet.of(Zt) : this;
    let er = new LayerCursor(this, null, -1).goto(0), Cr = 0, kr = [], Yr = new RangeSetBuilder();
    for (; er.value || Cr < Zt.length; )
      if (Cr < Zt.length && (er.from - Zt[Cr].from || er.startSide - Zt[Cr].value.startSide) >= 0) {
        let Ms = Zt[Cr++];
        Yr.addInner(Ms.from, Ms.to, Ms.value) || kr.push(Ms);
      } else
        er.rangeIndex == 1 && er.chunkIndex < this.chunk.length && (Cr == Zt.length || this.chunkEnd(er.chunkIndex) < Zt[Cr].from) && (!Kn || Sn > this.chunkEnd(er.chunkIndex) || kn < this.chunkPos[er.chunkIndex]) && Yr.addChunk(this.chunkPos[er.chunkIndex], this.chunk[er.chunkIndex]) ? er.nextChunk() : ((!Kn || Sn > er.to || kn < er.from || Kn(er.from, er.to, er.value)) && (Yr.addInner(er.from, er.to, er.value) || kr.push(Range$1.create(er.from, er.to, er.value))), er.next());
    return Yr.finishInner(this.nextLayer.isEmpty && !kr.length ? RangeSet.empty : this.nextLayer.update({ add: kr, filter: Kn, filterFrom: Sn, filterTo: kn }));
  }
  /**
  Map this range set through a set of changes, return the new set.
  */
  map(Qt) {
    if (Qt.empty || this.isEmpty)
      return this;
    let Zt = [], $n = [], Sn = -1;
    for (let Kn = 0; Kn < this.chunk.length; Kn++) {
      let er = this.chunkPos[Kn], Cr = this.chunk[Kn], kr = Qt.touchesRange(er, er + Cr.length);
      if (kr === !1)
        Sn = Math.max(Sn, Cr.maxPoint), Zt.push(Cr), $n.push(Qt.mapPos(er));
      else if (kr === !0) {
        let { mapped: Yr, pos: Ms } = Cr.map(er, Qt);
        Yr && (Sn = Math.max(Sn, Yr.maxPoint), Zt.push(Yr), $n.push(Ms));
      }
    }
    let kn = this.nextLayer.map(Qt);
    return Zt.length == 0 ? kn : new RangeSet($n, Zt, kn || RangeSet.empty, Sn);
  }
  /**
  Iterate over the ranges that touch the region `from` to `to`,
  calling `f` for each. There is no guarantee that the ranges will
  be reported in any specific order. When the callback returns
  `false`, iteration stops.
  */
  between(Qt, Zt, $n) {
    if (!this.isEmpty) {
      for (let Sn = 0; Sn < this.chunk.length; Sn++) {
        let kn = this.chunkPos[Sn], Kn = this.chunk[Sn];
        if (Zt >= kn && Qt <= kn + Kn.length && Kn.between(kn, Qt - kn, Zt - kn, $n) === !1)
          return;
      }
      this.nextLayer.between(Qt, Zt, $n);
    }
  }
  /**
  Iterate over the ranges in this set, in order, including all
  ranges that end at or after `from`.
  */
  iter(Qt = 0) {
    return HeapCursor.from([this]).goto(Qt);
  }
  /**
  @internal
  */
  get isEmpty() {
    return this.nextLayer == this;
  }
  /**
  Iterate over the ranges in a collection of sets, in order,
  starting from `from`.
  */
  static iter(Qt, Zt = 0) {
    return HeapCursor.from(Qt).goto(Zt);
  }
  /**
  Iterate over two groups of sets, calling methods on `comparator`
  to notify it of possible differences.
  */
  static compare(Qt, Zt, $n, Sn, kn = -1) {
    let Kn = Qt.filter((Ms) => Ms.maxPoint > 0 || !Ms.isEmpty && Ms.maxPoint >= kn), er = Zt.filter((Ms) => Ms.maxPoint > 0 || !Ms.isEmpty && Ms.maxPoint >= kn), Cr = findSharedChunks(Kn, er, $n), kr = new SpanCursor(Kn, Cr, kn), Yr = new SpanCursor(er, Cr, kn);
    $n.iterGaps((Ms, Ds, Ls) => compare$a(kr, Ms, Yr, Ds, Ls, Sn)), $n.empty && $n.length == 0 && compare$a(kr, 0, Yr, 0, 0, Sn);
  }
  /**
  Compare the contents of two groups of range sets, returning true
  if they are equivalent in the given range.
  */
  static eq(Qt, Zt, $n = 0, Sn) {
    Sn == null && (Sn = 1e9 - 1);
    let kn = Qt.filter((Yr) => !Yr.isEmpty && Zt.indexOf(Yr) < 0), Kn = Zt.filter((Yr) => !Yr.isEmpty && Qt.indexOf(Yr) < 0);
    if (kn.length != Kn.length)
      return !1;
    if (!kn.length)
      return !0;
    let er = findSharedChunks(kn, Kn), Cr = new SpanCursor(kn, er, 0).goto($n), kr = new SpanCursor(Kn, er, 0).goto($n);
    for (; ; ) {
      if (Cr.to != kr.to || !sameValues(Cr.active, kr.active) || Cr.point && (!kr.point || !Cr.point.eq(kr.point)))
        return !1;
      if (Cr.to > Sn)
        return !0;
      Cr.next(), kr.next();
    }
  }
  /**
  Iterate over a group of range sets at the same time, notifying
  the iterator about the ranges covering every given piece of
  content. Returns the open count (see
  [`SpanIterator.span`](https://codemirror.net/6/docs/ref/#state.SpanIterator.span)) at the end
  of the iteration.
  */
  static spans(Qt, Zt, $n, Sn, kn = -1) {
    let Kn = new SpanCursor(Qt, null, kn).goto(Zt), er = Zt, Cr = Kn.openStart;
    for (; ; ) {
      let kr = Math.min(Kn.to, $n);
      if (Kn.point) {
        let Yr = Kn.activeForPoint(Kn.to), Ms = Kn.pointFrom < Zt ? Yr.length + 1 : Math.min(Yr.length, Cr);
        Sn.point(er, kr, Kn.point, Yr, Ms, Kn.pointRank), Cr = Math.min(Kn.openEnd(kr), Yr.length);
      } else
        kr > er && (Sn.span(er, kr, Kn.active, Cr), Cr = Kn.openEnd(kr));
      if (Kn.to > $n)
        return Cr + (Kn.point && Kn.to > $n ? 1 : 0);
      er = Kn.to, Kn.next();
    }
  }
  /**
  Create a range set for the given range or array of ranges. By
  default, this expects the ranges to be _sorted_ (by start
  position and, if two start at the same position,
  `value.startSide`). You can pass `true` as second argument to
  cause the method to sort them.
  */
  static of(Qt, Zt = !1) {
    let $n = new RangeSetBuilder();
    for (let Sn of Qt instanceof Range$1 ? [Qt] : Zt ? lazySort(Qt) : Qt)
      $n.add(Sn.from, Sn.to, Sn.value);
    return $n.finish();
  }
}
RangeSet.empty = /* @__PURE__ */ new RangeSet([], [], null, -1);
function lazySort(_e) {
  if (_e.length > 1)
    for (let Qt = _e[0], Zt = 1; Zt < _e.length; Zt++) {
      let $n = _e[Zt];
      if (cmpRange(Qt, $n) > 0)
        return _e.slice().sort(cmpRange);
      Qt = $n;
    }
  return _e;
}
RangeSet.empty.nextLayer = RangeSet.empty;
class RangeSetBuilder {
  finishChunk(Qt) {
    this.chunks.push(new Chunk(this.from, this.to, this.value, this.maxPoint)), this.chunkPos.push(this.chunkStart), this.chunkStart = -1, this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint), this.maxPoint = -1, Qt && (this.from = [], this.to = [], this.value = []);
  }
  /**
  Create an empty builder.
  */
  constructor() {
    this.chunks = [], this.chunkPos = [], this.chunkStart = -1, this.last = null, this.lastFrom = -1e9, this.lastTo = -1e9, this.from = [], this.to = [], this.value = [], this.maxPoint = -1, this.setMaxPoint = -1, this.nextLayer = null;
  }
  /**
  Add a range. Ranges should be added in sorted (by `from` and
  `value.startSide`) order.
  */
  add(Qt, Zt, $n) {
    this.addInner(Qt, Zt, $n) || (this.nextLayer || (this.nextLayer = new RangeSetBuilder())).add(Qt, Zt, $n);
  }
  /**
  @internal
  */
  addInner(Qt, Zt, $n) {
    let Sn = Qt - this.lastTo || $n.startSide - this.last.endSide;
    if (Sn <= 0 && (Qt - this.lastFrom || $n.startSide - this.last.startSide) < 0)
      throw new Error("Ranges must be added sorted by `from` position and `startSide`");
    return Sn < 0 ? !1 : (this.from.length == 250 && this.finishChunk(!0), this.chunkStart < 0 && (this.chunkStart = Qt), this.from.push(Qt - this.chunkStart), this.to.push(Zt - this.chunkStart), this.last = $n, this.lastFrom = Qt, this.lastTo = Zt, this.value.push($n), $n.point && (this.maxPoint = Math.max(this.maxPoint, Zt - Qt)), !0);
  }
  /**
  @internal
  */
  addChunk(Qt, Zt) {
    if ((Qt - this.lastTo || Zt.value[0].startSide - this.last.endSide) < 0)
      return !1;
    this.from.length && this.finishChunk(!0), this.setMaxPoint = Math.max(this.setMaxPoint, Zt.maxPoint), this.chunks.push(Zt), this.chunkPos.push(Qt);
    let $n = Zt.value.length - 1;
    return this.last = Zt.value[$n], this.lastFrom = Zt.from[$n] + Qt, this.lastTo = Zt.to[$n] + Qt, !0;
  }
  /**
  Finish the range set. Returns the new set. The builder can't be
  used anymore after this has been called.
  */
  finish() {
    return this.finishInner(RangeSet.empty);
  }
  /**
  @internal
  */
  finishInner(Qt) {
    if (this.from.length && this.finishChunk(!1), this.chunks.length == 0)
      return Qt;
    let Zt = RangeSet.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(Qt) : Qt, this.setMaxPoint);
    return this.from = null, Zt;
  }
}
function findSharedChunks(_e, Qt, Zt) {
  let $n = /* @__PURE__ */ new Map();
  for (let kn of _e)
    for (let Kn = 0; Kn < kn.chunk.length; Kn++)
      kn.chunk[Kn].maxPoint <= 0 && $n.set(kn.chunk[Kn], kn.chunkPos[Kn]);
  let Sn = /* @__PURE__ */ new Set();
  for (let kn of Qt)
    for (let Kn = 0; Kn < kn.chunk.length; Kn++) {
      let er = $n.get(kn.chunk[Kn]);
      er != null && (Zt ? Zt.mapPos(er) : er) == kn.chunkPos[Kn] && !(Zt != null && Zt.touchesRange(er, er + kn.chunk[Kn].length)) && Sn.add(kn.chunk[Kn]);
    }
  return Sn;
}
class LayerCursor {
  constructor(Qt, Zt, $n, Sn = 0) {
    this.layer = Qt, this.skip = Zt, this.minPoint = $n, this.rank = Sn;
  }
  get startSide() {
    return this.value ? this.value.startSide : 0;
  }
  get endSide() {
    return this.value ? this.value.endSide : 0;
  }
  goto(Qt, Zt = -1e9) {
    return this.chunkIndex = this.rangeIndex = 0, this.gotoInner(Qt, Zt, !1), this;
  }
  gotoInner(Qt, Zt, $n) {
    for (; this.chunkIndex < this.layer.chunk.length; ) {
      let Sn = this.layer.chunk[this.chunkIndex];
      if (!(this.skip && this.skip.has(Sn) || this.layer.chunkEnd(this.chunkIndex) < Qt || Sn.maxPoint < this.minPoint))
        break;
      this.chunkIndex++, $n = !1;
    }
    if (this.chunkIndex < this.layer.chunk.length) {
      let Sn = this.layer.chunk[this.chunkIndex].findIndex(Qt - this.layer.chunkPos[this.chunkIndex], Zt, !0);
      (!$n || this.rangeIndex < Sn) && this.setRangeIndex(Sn);
    }
    this.next();
  }
  forward(Qt, Zt) {
    (this.to - Qt || this.endSide - Zt) < 0 && this.gotoInner(Qt, Zt, !0);
  }
  next() {
    for (; ; )
      if (this.chunkIndex == this.layer.chunk.length) {
        this.from = this.to = 1e9, this.value = null;
        break;
      } else {
        let Qt = this.layer.chunkPos[this.chunkIndex], Zt = this.layer.chunk[this.chunkIndex], $n = Qt + Zt.from[this.rangeIndex];
        if (this.from = $n, this.to = Qt + Zt.to[this.rangeIndex], this.value = Zt.value[this.rangeIndex], this.setRangeIndex(this.rangeIndex + 1), this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint)
          break;
      }
  }
  setRangeIndex(Qt) {
    if (Qt == this.layer.chunk[this.chunkIndex].value.length) {
      if (this.chunkIndex++, this.skip)
        for (; this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex]); )
          this.chunkIndex++;
      this.rangeIndex = 0;
    } else
      this.rangeIndex = Qt;
  }
  nextChunk() {
    this.chunkIndex++, this.rangeIndex = 0, this.next();
  }
  compare(Qt) {
    return this.from - Qt.from || this.startSide - Qt.startSide || this.rank - Qt.rank || this.to - Qt.to || this.endSide - Qt.endSide;
  }
}
class HeapCursor {
  constructor(Qt) {
    this.heap = Qt;
  }
  static from(Qt, Zt = null, $n = -1) {
    let Sn = [];
    for (let kn = 0; kn < Qt.length; kn++)
      for (let Kn = Qt[kn]; !Kn.isEmpty; Kn = Kn.nextLayer)
        Kn.maxPoint >= $n && Sn.push(new LayerCursor(Kn, Zt, $n, kn));
    return Sn.length == 1 ? Sn[0] : new HeapCursor(Sn);
  }
  get startSide() {
    return this.value ? this.value.startSide : 0;
  }
  goto(Qt, Zt = -1e9) {
    for (let $n of this.heap)
      $n.goto(Qt, Zt);
    for (let $n = this.heap.length >> 1; $n >= 0; $n--)
      heapBubble(this.heap, $n);
    return this.next(), this;
  }
  forward(Qt, Zt) {
    for (let $n of this.heap)
      $n.forward(Qt, Zt);
    for (let $n = this.heap.length >> 1; $n >= 0; $n--)
      heapBubble(this.heap, $n);
    (this.to - Qt || this.value.endSide - Zt) < 0 && this.next();
  }
  next() {
    if (this.heap.length == 0)
      this.from = this.to = 1e9, this.value = null, this.rank = -1;
    else {
      let Qt = this.heap[0];
      this.from = Qt.from, this.to = Qt.to, this.value = Qt.value, this.rank = Qt.rank, Qt.value && Qt.next(), heapBubble(this.heap, 0);
    }
  }
}
function heapBubble(_e, Qt) {
  for (let Zt = _e[Qt]; ; ) {
    let $n = (Qt << 1) + 1;
    if ($n >= _e.length)
      break;
    let Sn = _e[$n];
    if ($n + 1 < _e.length && Sn.compare(_e[$n + 1]) >= 0 && (Sn = _e[$n + 1], $n++), Zt.compare(Sn) < 0)
      break;
    _e[$n] = Zt, _e[Qt] = Sn, Qt = $n;
  }
}
class SpanCursor {
  constructor(Qt, Zt, $n) {
    this.minPoint = $n, this.active = [], this.activeTo = [], this.activeRank = [], this.minActive = -1, this.point = null, this.pointFrom = 0, this.pointRank = 0, this.to = -1e9, this.endSide = 0, this.openStart = -1, this.cursor = HeapCursor.from(Qt, Zt, $n);
  }
  goto(Qt, Zt = -1e9) {
    return this.cursor.goto(Qt, Zt), this.active.length = this.activeTo.length = this.activeRank.length = 0, this.minActive = -1, this.to = Qt, this.endSide = Zt, this.openStart = -1, this.next(), this;
  }
  forward(Qt, Zt) {
    for (; this.minActive > -1 && (this.activeTo[this.minActive] - Qt || this.active[this.minActive].endSide - Zt) < 0; )
      this.removeActive(this.minActive);
    this.cursor.forward(Qt, Zt);
  }
  removeActive(Qt) {
    remove$2(this.active, Qt), remove$2(this.activeTo, Qt), remove$2(this.activeRank, Qt), this.minActive = findMinIndex(this.active, this.activeTo);
  }
  addActive(Qt) {
    let Zt = 0, { value: $n, to: Sn, rank: kn } = this.cursor;
    for (; Zt < this.activeRank.length && this.activeRank[Zt] <= kn; )
      Zt++;
    insert$2(this.active, Zt, $n), insert$2(this.activeTo, Zt, Sn), insert$2(this.activeRank, Zt, kn), Qt && insert$2(Qt, Zt, this.cursor.from), this.minActive = findMinIndex(this.active, this.activeTo);
  }
  // After calling this, if `this.point` != null, the next range is a
  // point. Otherwise, it's a regular range, covered by `this.active`.
  next() {
    let Qt = this.to, Zt = this.point;
    this.point = null;
    let $n = this.openStart < 0 ? [] : null;
    for (; ; ) {
      let Sn = this.minActive;
      if (Sn > -1 && (this.activeTo[Sn] - this.cursor.from || this.active[Sn].endSide - this.cursor.startSide) < 0) {
        if (this.activeTo[Sn] > Qt) {
          this.to = this.activeTo[Sn], this.endSide = this.active[Sn].endSide;
          break;
        }
        this.removeActive(Sn), $n && remove$2($n, Sn);
      } else if (this.cursor.value)
        if (this.cursor.from > Qt) {
          this.to = this.cursor.from, this.endSide = this.cursor.startSide;
          break;
        } else {
          let kn = this.cursor.value;
          if (!kn.point)
            this.addActive($n), this.cursor.next();
          else if (Zt && this.cursor.to == this.to && this.cursor.from < this.cursor.to)
            this.cursor.next();
          else {
            this.point = kn, this.pointFrom = this.cursor.from, this.pointRank = this.cursor.rank, this.to = this.cursor.to, this.endSide = kn.endSide, this.cursor.next(), this.forward(this.to, this.endSide);
            break;
          }
        }
      else {
        this.to = this.endSide = 1e9;
        break;
      }
    }
    if ($n) {
      this.openStart = 0;
      for (let Sn = $n.length - 1; Sn >= 0 && $n[Sn] < Qt; Sn--)
        this.openStart++;
    }
  }
  activeForPoint(Qt) {
    if (!this.active.length)
      return this.active;
    let Zt = [];
    for (let $n = this.active.length - 1; $n >= 0 && !(this.activeRank[$n] < this.pointRank); $n--)
      (this.activeTo[$n] > Qt || this.activeTo[$n] == Qt && this.active[$n].endSide >= this.point.endSide) && Zt.push(this.active[$n]);
    return Zt.reverse();
  }
  openEnd(Qt) {
    let Zt = 0;
    for (let $n = this.activeTo.length - 1; $n >= 0 && this.activeTo[$n] > Qt; $n--)
      Zt++;
    return Zt;
  }
}
function compare$a(_e, Qt, Zt, $n, Sn, kn) {
  _e.goto(Qt), Zt.goto($n);
  let Kn = $n + Sn, er = $n, Cr = $n - Qt;
  for (; ; ) {
    let kr = _e.to + Cr - Zt.to || _e.endSide - Zt.endSide, Yr = kr < 0 ? _e.to + Cr : Zt.to, Ms = Math.min(Yr, Kn);
    if (_e.point || Zt.point ? _e.point && Zt.point && (_e.point == Zt.point || _e.point.eq(Zt.point)) && sameValues(_e.activeForPoint(_e.to), Zt.activeForPoint(Zt.to)) || kn.comparePoint(er, Ms, _e.point, Zt.point) : Ms > er && !sameValues(_e.active, Zt.active) && kn.compareRange(er, Ms, _e.active, Zt.active), Yr > Kn)
      break;
    er = Yr, kr <= 0 && _e.next(), kr >= 0 && Zt.next();
  }
}
function sameValues(_e, Qt) {
  if (_e.length != Qt.length)
    return !1;
  for (let Zt = 0; Zt < _e.length; Zt++)
    if (_e[Zt] != Qt[Zt] && !_e[Zt].eq(Qt[Zt]))
      return !1;
  return !0;
}
function remove$2(_e, Qt) {
  for (let Zt = Qt, $n = _e.length - 1; Zt < $n; Zt++)
    _e[Zt] = _e[Zt + 1];
  _e.pop();
}
function insert$2(_e, Qt, Zt) {
  for (let $n = _e.length - 1; $n >= Qt; $n--)
    _e[$n + 1] = _e[$n];
  _e[Qt] = Zt;
}
function findMinIndex(_e, Qt) {
  let Zt = -1, $n = 1e9;
  for (let Sn = 0; Sn < Qt.length; Sn++)
    (Qt[Sn] - $n || _e[Sn].endSide - _e[Zt].endSide) < 0 && (Zt = Sn, $n = Qt[Sn]);
  return Zt;
}
function findColumn(_e, Qt, Zt, $n) {
  for (let Sn = 0, kn = 0; ; ) {
    if (kn >= Qt)
      return Sn;
    if (Sn == _e.length)
      break;
    kn += _e.charCodeAt(Sn) == 9 ? Zt - kn % Zt : 1, Sn = findClusterBreak(_e, Sn);
  }
  return $n === !0 ? -1 : _e.length;
}
const C$4 = "ͼ", COUNT = typeof Symbol > "u" ? "__" + C$4 : Symbol.for(C$4), SET = typeof Symbol > "u" ? "__styleSet" + Math.floor(Math.random() * 1e8) : Symbol("styleSet"), top = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : {};
class StyleModule {
  // :: (Object<Style>, ?{finish: ?(string) → string})
  // Create a style module from the given spec.
  //
  // When `finish` is given, it is called on regular (non-`@`)
  // selectors (after `&` expansion) to compute the final selector.
  constructor(Qt, Zt) {
    this.rules = [];
    let { finish: $n } = Zt || {};
    function Sn(Kn) {
      return /^@/.test(Kn) ? [Kn] : Kn.split(/,\s*/);
    }
    function kn(Kn, er, Cr, kr) {
      let Yr = [], Ms = /^@(\w+)\b/.exec(Kn[0]), Ds = Ms && Ms[1] == "keyframes";
      if (Ms && er == null)
        return Cr.push(Kn[0] + ";");
      for (let Ls in er) {
        let js = er[Ls];
        if (/&/.test(Ls))
          kn(
            Ls.split(/,\s*/).map((zs) => Kn.map((Fs) => zs.replace(/&/, Fs))).reduce((zs, Fs) => zs.concat(Fs)),
            js,
            Cr
          );
        else if (js && typeof js == "object") {
          if (!Ms)
            throw new RangeError("The value of a property (" + Ls + ") should be a primitive value.");
          kn(Sn(Ls), js, Yr, Ds);
        } else
          js != null && Yr.push(Ls.replace(/_.*/, "").replace(/[A-Z]/g, (zs) => "-" + zs.toLowerCase()) + ": " + js + ";");
      }
      (Yr.length || Ds) && Cr.push(($n && !Ms && !kr ? Kn.map($n) : Kn).join(", ") + " {" + Yr.join(" ") + "}");
    }
    for (let Kn in Qt)
      kn(Sn(Kn), Qt[Kn], this.rules);
  }
  // :: () → string
  // Returns a string containing the module's CSS rules.
  getRules() {
    return this.rules.join(`
`);
  }
  // :: () → string
  // Generate a new unique CSS class name.
  static newName() {
    let Qt = top[COUNT] || 1;
    return top[COUNT] = Qt + 1, C$4 + Qt.toString(36);
  }
  // :: (union<Document, ShadowRoot>, union<[StyleModule], StyleModule>, ?{nonce: ?string})
  //
  // Mount the given set of modules in the given DOM root, which ensures
  // that the CSS rules defined by the module are available in that
  // context.
  //
  // Rules are only added to the document once per root.
  //
  // Rule order will follow the order of the modules, so that rules from
  // modules later in the array take precedence of those from earlier
  // modules. If you call this function multiple times for the same root
  // in a way that changes the order of already mounted modules, the old
  // order will be changed.
  //
  // If a Content Security Policy nonce is provided, it is added to
  // the `<style>` tag generated by the library.
  static mount(Qt, Zt, $n) {
    let Sn = Qt[SET], kn = $n && $n.nonce;
    Sn ? kn && Sn.setNonce(kn) : Sn = new StyleSet(Qt, kn), Sn.mount(Array.isArray(Zt) ? Zt : [Zt]);
  }
}
let adoptedSet = /* @__PURE__ */ new Map();
class StyleSet {
  constructor(Qt, Zt) {
    let $n = Qt.ownerDocument || Qt, Sn = $n.defaultView;
    if (!Qt.head && Qt.adoptedStyleSheets && Sn.CSSStyleSheet) {
      let kn = adoptedSet.get($n);
      if (kn)
        return Qt.adoptedStyleSheets = [kn.sheet, ...Qt.adoptedStyleSheets], Qt[SET] = kn;
      this.sheet = new Sn.CSSStyleSheet(), Qt.adoptedStyleSheets = [this.sheet, ...Qt.adoptedStyleSheets], adoptedSet.set($n, this);
    } else {
      this.styleTag = $n.createElement("style"), Zt && this.styleTag.setAttribute("nonce", Zt);
      let kn = Qt.head || Qt;
      kn.insertBefore(this.styleTag, kn.firstChild);
    }
    this.modules = [], Qt[SET] = this;
  }
  mount(Qt) {
    let Zt = this.sheet, $n = 0, Sn = 0;
    for (let kn = 0; kn < Qt.length; kn++) {
      let Kn = Qt[kn], er = this.modules.indexOf(Kn);
      if (er < Sn && er > -1 && (this.modules.splice(er, 1), Sn--, er = -1), er == -1) {
        if (this.modules.splice(Sn++, 0, Kn), Zt)
          for (let Cr = 0; Cr < Kn.rules.length; Cr++)
            Zt.insertRule(Kn.rules[Cr], $n++);
      } else {
        for (; Sn < er; )
          $n += this.modules[Sn++].rules.length;
        $n += Kn.rules.length, Sn++;
      }
    }
    if (!Zt) {
      let kn = "";
      for (let Kn = 0; Kn < this.modules.length; Kn++)
        kn += this.modules[Kn].getRules() + `
`;
      this.styleTag.textContent = kn;
    }
  }
  setNonce(Qt) {
    this.styleTag && this.styleTag.getAttribute("nonce") != Qt && this.styleTag.setAttribute("nonce", Qt);
  }
}
var base$2 = {
  8: "Backspace",
  9: "Tab",
  10: "Enter",
  12: "NumLock",
  13: "Enter",
  16: "Shift",
  17: "Control",
  18: "Alt",
  20: "CapsLock",
  27: "Escape",
  32: " ",
  33: "PageUp",
  34: "PageDown",
  35: "End",
  36: "Home",
  37: "ArrowLeft",
  38: "ArrowUp",
  39: "ArrowRight",
  40: "ArrowDown",
  44: "PrintScreen",
  45: "Insert",
  46: "Delete",
  59: ";",
  61: "=",
  91: "Meta",
  92: "Meta",
  106: "*",
  107: "+",
  108: ",",
  109: "-",
  110: ".",
  111: "/",
  144: "NumLock",
  145: "ScrollLock",
  160: "Shift",
  161: "Shift",
  162: "Control",
  163: "Control",
  164: "Alt",
  165: "Alt",
  173: "-",
  186: ";",
  187: "=",
  188: ",",
  189: "-",
  190: ".",
  191: "/",
  192: "`",
  219: "[",
  220: "\\",
  221: "]",
  222: "'"
}, shift$2 = {
  48: ")",
  49: "!",
  50: "@",
  51: "#",
  52: "$",
  53: "%",
  54: "^",
  55: "&",
  56: "*",
  57: "(",
  59: ":",
  61: "+",
  173: "_",
  186: ":",
  187: "+",
  188: "<",
  189: "_",
  190: ">",
  191: "?",
  192: "~",
  219: "{",
  220: "|",
  221: "}",
  222: '"'
};
for (var i$1 = 0; i$1 < 10; i$1++)
  base$2[48 + i$1] = base$2[96 + i$1] = String(i$1);
for (var i$1 = 1; i$1 <= 24; i$1++)
  base$2[i$1 + 111] = "F" + i$1;
for (var i$1 = 65; i$1 <= 90; i$1++)
  base$2[i$1] = String.fromCharCode(i$1 + 32), shift$2[i$1] = String.fromCharCode(i$1);
for (var code in base$2)
  shift$2.hasOwnProperty(code) || (shift$2[code] = base$2[code]);
function getSelection(_e) {
  let Qt;
  return _e.nodeType == 11 ? Qt = _e.getSelection ? _e : _e.ownerDocument : Qt = _e, Qt.getSelection();
}
function contains$4(_e, Qt) {
  return Qt ? _e == Qt || _e.contains(Qt.nodeType != 1 ? Qt.parentNode : Qt) : !1;
}
function deepActiveElement(_e) {
  let Qt = _e.activeElement;
  for (; Qt && Qt.shadowRoot; )
    Qt = Qt.shadowRoot.activeElement;
  return Qt;
}
function hasSelection(_e, Qt) {
  if (!Qt.anchorNode)
    return !1;
  try {
    return contains$4(_e, Qt.anchorNode);
  } catch {
    return !1;
  }
}
function clientRectsFor(_e) {
  return _e.nodeType == 3 ? textRange(_e, 0, _e.nodeValue.length).getClientRects() : _e.nodeType == 1 ? _e.getClientRects() : [];
}
function isEquivalentPosition(_e, Qt, Zt, $n) {
  return Zt ? scanFor(_e, Qt, Zt, $n, -1) || scanFor(_e, Qt, Zt, $n, 1) : !1;
}
function domIndex(_e) {
  for (var Qt = 0; ; Qt++)
    if (_e = _e.previousSibling, !_e)
      return Qt;
}
function scanFor(_e, Qt, Zt, $n, Sn) {
  for (; ; ) {
    if (_e == Zt && Qt == $n)
      return !0;
    if (Qt == (Sn < 0 ? 0 : maxOffset(_e))) {
      if (_e.nodeName == "DIV")
        return !1;
      let kn = _e.parentNode;
      if (!kn || kn.nodeType != 1)
        return !1;
      Qt = domIndex(_e) + (Sn < 0 ? 0 : 1), _e = kn;
    } else if (_e.nodeType == 1) {
      if (_e = _e.childNodes[Qt + (Sn < 0 ? -1 : 0)], _e.nodeType == 1 && _e.contentEditable == "false")
        return !1;
      Qt = Sn < 0 ? maxOffset(_e) : 0;
    } else
      return !1;
  }
}
function maxOffset(_e) {
  return _e.nodeType == 3 ? _e.nodeValue.length : _e.childNodes.length;
}
function flattenRect(_e, Qt) {
  let Zt = Qt ? _e.left : _e.right;
  return { left: Zt, right: Zt, top: _e.top, bottom: _e.bottom };
}
function windowRect(_e) {
  return {
    left: 0,
    right: _e.innerWidth,
    top: 0,
    bottom: _e.innerHeight
  };
}
function scrollRectIntoView(_e, Qt, Zt, $n, Sn, kn, Kn, er) {
  let Cr = _e.ownerDocument, kr = Cr.defaultView || window;
  for (let Yr = _e, Ms = !1; Yr && !Ms; )
    if (Yr.nodeType == 1) {
      let Ds, Ls = Yr == Cr.body;
      if (Ls)
        Ds = windowRect(kr);
      else {
        if (/^(fixed|sticky)$/.test(getComputedStyle(Yr).position) && (Ms = !0), Yr.scrollHeight <= Yr.clientHeight && Yr.scrollWidth <= Yr.clientWidth) {
          Yr = Yr.assignedSlot || Yr.parentNode;
          continue;
        }
        let Fs = Yr.getBoundingClientRect();
        Ds = {
          left: Fs.left,
          right: Fs.left + Yr.clientWidth,
          top: Fs.top,
          bottom: Fs.top + Yr.clientHeight
        };
      }
      let js = 0, zs = 0;
      if (Sn == "nearest")
        Qt.top < Ds.top ? (zs = -(Ds.top - Qt.top + Kn), Zt > 0 && Qt.bottom > Ds.bottom + zs && (zs = Qt.bottom - Ds.bottom + zs + Kn)) : Qt.bottom > Ds.bottom && (zs = Qt.bottom - Ds.bottom + Kn, Zt < 0 && Qt.top - zs < Ds.top && (zs = -(Ds.top + zs - Qt.top + Kn)));
      else {
        let Fs = Qt.bottom - Qt.top, Bs = Ds.bottom - Ds.top;
        zs = (Sn == "center" && Fs <= Bs ? Qt.top + Fs / 2 - Bs / 2 : Sn == "start" || Sn == "center" && Zt < 0 ? Qt.top - Kn : Qt.bottom - Bs + Kn) - Ds.top;
      }
      if ($n == "nearest" ? Qt.left < Ds.left ? (js = -(Ds.left - Qt.left + kn), Zt > 0 && Qt.right > Ds.right + js && (js = Qt.right - Ds.right + js + kn)) : Qt.right > Ds.right && (js = Qt.right - Ds.right + kn, Zt < 0 && Qt.left < Ds.left + js && (js = -(Ds.left + js - Qt.left + kn))) : js = ($n == "center" ? Qt.left + (Qt.right - Qt.left) / 2 - (Ds.right - Ds.left) / 2 : $n == "start" == er ? Qt.left - kn : Qt.right - (Ds.right - Ds.left) + kn) - Ds.left, js || zs)
        if (Ls)
          kr.scrollBy(js, zs);
        else {
          let Fs = 0, Bs = 0;
          if (zs) {
            let Hs = Yr.scrollTop;
            Yr.scrollTop += zs, Bs = Yr.scrollTop - Hs;
          }
          if (js) {
            let Hs = Yr.scrollLeft;
            Yr.scrollLeft += js, Fs = Yr.scrollLeft - Hs;
          }
          Qt = {
            left: Qt.left - Fs,
            top: Qt.top - Bs,
            right: Qt.right - Fs,
            bottom: Qt.bottom - Bs
          }, Fs && Math.abs(Fs - js) < 1 && ($n = "nearest"), Bs && Math.abs(Bs - zs) < 1 && (Sn = "nearest");
        }
      if (Ls)
        break;
      Yr = Yr.assignedSlot || Yr.parentNode;
    } else if (Yr.nodeType == 11)
      Yr = Yr.host;
    else
      break;
}
function scrollableParent(_e) {
  let Qt = _e.ownerDocument;
  for (let Zt = _e.parentNode; Zt && Zt != Qt.body; )
    if (Zt.nodeType == 1) {
      if (Zt.scrollHeight > Zt.clientHeight || Zt.scrollWidth > Zt.clientWidth)
        return Zt;
      Zt = Zt.assignedSlot || Zt.parentNode;
    } else if (Zt.nodeType == 11)
      Zt = Zt.host;
    else
      break;
  return null;
}
class DOMSelectionState {
  constructor() {
    this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0;
  }
  eq(Qt) {
    return this.anchorNode == Qt.anchorNode && this.anchorOffset == Qt.anchorOffset && this.focusNode == Qt.focusNode && this.focusOffset == Qt.focusOffset;
  }
  setRange(Qt) {
    let { anchorNode: Zt, focusNode: $n } = Qt;
    this.set(Zt, Math.min(Qt.anchorOffset, Zt ? maxOffset(Zt) : 0), $n, Math.min(Qt.focusOffset, $n ? maxOffset($n) : 0));
  }
  set(Qt, Zt, $n, Sn) {
    this.anchorNode = Qt, this.anchorOffset = Zt, this.focusNode = $n, this.focusOffset = Sn;
  }
}
let preventScrollSupported = null;
function focusPreventScroll(_e) {
  if (_e.setActive)
    return _e.setActive();
  if (preventScrollSupported)
    return _e.focus(preventScrollSupported);
  let Qt = [];
  for (let Zt = _e; Zt && (Qt.push(Zt, Zt.scrollTop, Zt.scrollLeft), Zt != Zt.ownerDocument); Zt = Zt.parentNode)
    ;
  if (_e.focus(preventScrollSupported == null ? {
    get preventScroll() {
      return preventScrollSupported = { preventScroll: !0 }, !0;
    }
  } : void 0), !preventScrollSupported) {
    preventScrollSupported = !1;
    for (let Zt = 0; Zt < Qt.length; ) {
      let $n = Qt[Zt++], Sn = Qt[Zt++], kn = Qt[Zt++];
      $n.scrollTop != Sn && ($n.scrollTop = Sn), $n.scrollLeft != kn && ($n.scrollLeft = kn);
    }
  }
}
let scratchRange;
function textRange(_e, Qt, Zt = Qt) {
  let $n = scratchRange || (scratchRange = document.createRange());
  return $n.setEnd(_e, Zt), $n.setStart(_e, Qt), $n;
}
function dispatchKey(_e, Qt, Zt) {
  let $n = { key: Qt, code: Qt, keyCode: Zt, which: Zt, cancelable: !0 }, Sn = new KeyboardEvent("keydown", $n);
  Sn.synthetic = !0, _e.dispatchEvent(Sn);
  let kn = new KeyboardEvent("keyup", $n);
  return kn.synthetic = !0, _e.dispatchEvent(kn), Sn.defaultPrevented || kn.defaultPrevented;
}
function getRoot$1(_e) {
  for (; _e; ) {
    if (_e && (_e.nodeType == 9 || _e.nodeType == 11 && _e.host))
      return _e;
    _e = _e.assignedSlot || _e.parentNode;
  }
  return null;
}
function clearAttributes(_e) {
  for (; _e.attributes.length; )
    _e.removeAttributeNode(_e.attributes[0]);
}
function atElementStart(_e, Qt) {
  let Zt = Qt.focusNode, $n = Qt.focusOffset;
  if (!Zt || Qt.anchorNode != Zt || Qt.anchorOffset != $n)
    return !1;
  for ($n = Math.min($n, maxOffset(Zt)); ; )
    if ($n) {
      if (Zt.nodeType != 1)
        return !1;
      let Sn = Zt.childNodes[$n - 1];
      Sn.contentEditable == "false" ? $n-- : (Zt = Sn, $n = maxOffset(Zt));
    } else {
      if (Zt == _e)
        return !0;
      $n = domIndex(Zt), Zt = Zt.parentNode;
    }
}
function isScrolledToBottom(_e) {
  return _e.scrollTop > Math.max(1, _e.scrollHeight - _e.clientHeight - 4);
}
class DOMPos {
  constructor(Qt, Zt, $n = !0) {
    this.node = Qt, this.offset = Zt, this.precise = $n;
  }
  static before(Qt, Zt) {
    return new DOMPos(Qt.parentNode, domIndex(Qt), Zt);
  }
  static after(Qt, Zt) {
    return new DOMPos(Qt.parentNode, domIndex(Qt) + 1, Zt);
  }
}
const noChildren = [];
class ContentView {
  constructor() {
    this.parent = null, this.dom = null, this.flags = 2;
  }
  get overrideDOMText() {
    return null;
  }
  get posAtStart() {
    return this.parent ? this.parent.posBefore(this) : 0;
  }
  get posAtEnd() {
    return this.posAtStart + this.length;
  }
  posBefore(Qt) {
    let Zt = this.posAtStart;
    for (let $n of this.children) {
      if ($n == Qt)
        return Zt;
      Zt += $n.length + $n.breakAfter;
    }
    throw new RangeError("Invalid child in posBefore");
  }
  posAfter(Qt) {
    return this.posBefore(Qt) + Qt.length;
  }
  sync(Qt, Zt) {
    if (this.flags & 2) {
      let $n = this.dom, Sn = null, kn;
      for (let Kn of this.children) {
        if (Kn.flags & 7) {
          if (!Kn.dom && (kn = Sn ? Sn.nextSibling : $n.firstChild)) {
            let er = ContentView.get(kn);
            (!er || !er.parent && er.canReuseDOM(Kn)) && Kn.reuseDOM(kn);
          }
          Kn.sync(Qt, Zt), Kn.flags &= -8;
        }
        if (kn = Sn ? Sn.nextSibling : $n.firstChild, Zt && !Zt.written && Zt.node == $n && kn != Kn.dom && (Zt.written = !0), Kn.dom.parentNode == $n)
          for (; kn && kn != Kn.dom; )
            kn = rm$1(kn);
        else
          $n.insertBefore(Kn.dom, kn);
        Sn = Kn.dom;
      }
      for (kn = Sn ? Sn.nextSibling : $n.firstChild, kn && Zt && Zt.node == $n && (Zt.written = !0); kn; )
        kn = rm$1(kn);
    } else if (this.flags & 1)
      for (let $n of this.children)
        $n.flags & 7 && ($n.sync(Qt, Zt), $n.flags &= -8);
  }
  reuseDOM(Qt) {
  }
  localPosFromDOM(Qt, Zt) {
    let $n;
    if (Qt == this.dom)
      $n = this.dom.childNodes[Zt];
    else {
      let Sn = maxOffset(Qt) == 0 ? 0 : Zt == 0 ? -1 : 1;
      for (; ; ) {
        let kn = Qt.parentNode;
        if (kn == this.dom)
          break;
        Sn == 0 && kn.firstChild != kn.lastChild && (Qt == kn.firstChild ? Sn = -1 : Sn = 1), Qt = kn;
      }
      Sn < 0 ? $n = Qt : $n = Qt.nextSibling;
    }
    if ($n == this.dom.firstChild)
      return 0;
    for (; $n && !ContentView.get($n); )
      $n = $n.nextSibling;
    if (!$n)
      return this.length;
    for (let Sn = 0, kn = 0; ; Sn++) {
      let Kn = this.children[Sn];
      if (Kn.dom == $n)
        return kn;
      kn += Kn.length + Kn.breakAfter;
    }
  }
  domBoundsAround(Qt, Zt, $n = 0) {
    let Sn = -1, kn = -1, Kn = -1, er = -1;
    for (let Cr = 0, kr = $n, Yr = $n; Cr < this.children.length; Cr++) {
      let Ms = this.children[Cr], Ds = kr + Ms.length;
      if (kr < Qt && Ds > Zt)
        return Ms.domBoundsAround(Qt, Zt, kr);
      if (Ds >= Qt && Sn == -1 && (Sn = Cr, kn = kr), kr > Zt && Ms.dom.parentNode == this.dom) {
        Kn = Cr, er = Yr;
        break;
      }
      Yr = Ds, kr = Ds + Ms.breakAfter;
    }
    return {
      from: kn,
      to: er < 0 ? $n + this.length : er,
      startDOM: (Sn ? this.children[Sn - 1].dom.nextSibling : null) || this.dom.firstChild,
      endDOM: Kn < this.children.length && Kn >= 0 ? this.children[Kn].dom : null
    };
  }
  markDirty(Qt = !1) {
    this.flags |= 2, this.markParentsDirty(Qt);
  }
  markParentsDirty(Qt) {
    for (let Zt = this.parent; Zt; Zt = Zt.parent) {
      if (Qt && (Zt.flags |= 2), Zt.flags & 1)
        return;
      Zt.flags |= 1, Qt = !1;
    }
  }
  setParent(Qt) {
    this.parent != Qt && (this.parent = Qt, this.flags & 7 && this.markParentsDirty(!0));
  }
  setDOM(Qt) {
    this.dom && (this.dom.cmView = null), this.dom = Qt, Qt.cmView = this;
  }
  get rootView() {
    for (let Qt = this; ; ) {
      let Zt = Qt.parent;
      if (!Zt)
        return Qt;
      Qt = Zt;
    }
  }
  replaceChildren(Qt, Zt, $n = noChildren) {
    this.markDirty();
    for (let Sn = Qt; Sn < Zt; Sn++) {
      let kn = this.children[Sn];
      kn.parent == this && kn.destroy();
    }
    this.children.splice(Qt, Zt - Qt, ...$n);
    for (let Sn = 0; Sn < $n.length; Sn++)
      $n[Sn].setParent(this);
  }
  ignoreMutation(Qt) {
    return !1;
  }
  ignoreEvent(Qt) {
    return !1;
  }
  childCursor(Qt = this.length) {
    return new ChildCursor(this.children, Qt, this.children.length);
  }
  childPos(Qt, Zt = 1) {
    return this.childCursor().findPos(Qt, Zt);
  }
  toString() {
    let Qt = this.constructor.name.replace("View", "");
    return Qt + (this.children.length ? "(" + this.children.join() + ")" : this.length ? "[" + (Qt == "Text" ? this.text : this.length) + "]" : "") + (this.breakAfter ? "#" : "");
  }
  static get(Qt) {
    return Qt.cmView;
  }
  get isEditable() {
    return !0;
  }
  get isWidget() {
    return !1;
  }
  get isHidden() {
    return !1;
  }
  merge(Qt, Zt, $n, Sn, kn, Kn) {
    return !1;
  }
  become(Qt) {
    return !1;
  }
  canReuseDOM(Qt) {
    return Qt.constructor == this.constructor && !((this.flags | Qt.flags) & 8);
  }
  // When this is a zero-length view with a side, this should return a
  // number <= 0 to indicate it is before its position, or a
  // number > 0 when after its position.
  getSide() {
    return 0;
  }
  destroy() {
    this.parent = null;
  }
}
ContentView.prototype.breakAfter = 0;
function rm$1(_e) {
  let Qt = _e.nextSibling;
  return _e.parentNode.removeChild(_e), Qt;
}
class ChildCursor {
  constructor(Qt, Zt, $n) {
    this.children = Qt, this.pos = Zt, this.i = $n, this.off = 0;
  }
  findPos(Qt, Zt = 1) {
    for (; ; ) {
      if (Qt > this.pos || Qt == this.pos && (Zt > 0 || this.i == 0 || this.children[this.i - 1].breakAfter))
        return this.off = Qt - this.pos, this;
      let $n = this.children[--this.i];
      this.pos -= $n.length + $n.breakAfter;
    }
  }
}
function replaceRange(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr) {
  let { children: kr } = _e, Yr = kr.length ? kr[Qt] : null, Ms = kn.length ? kn[kn.length - 1] : null, Ds = Ms ? Ms.breakAfter : Kn;
  if (!(Qt == $n && Yr && !Kn && !Ds && kn.length < 2 && Yr.merge(Zt, Sn, kn.length ? Ms : null, Zt == 0, er, Cr))) {
    if ($n < kr.length) {
      let Ls = kr[$n];
      Ls && Sn < Ls.length ? (Qt == $n && (Ls = Ls.split(Sn), Sn = 0), !Ds && Ms && Ls.merge(0, Sn, Ms, !0, 0, Cr) ? kn[kn.length - 1] = Ls : (Sn && Ls.merge(0, Sn, null, !1, 0, Cr), kn.push(Ls))) : Ls != null && Ls.breakAfter && (Ms ? Ms.breakAfter = 1 : Kn = 1), $n++;
    }
    for (Yr && (Yr.breakAfter = Kn, Zt > 0 && (!Kn && kn.length && Yr.merge(Zt, Yr.length, kn[0], !1, er, 0) ? Yr.breakAfter = kn.shift().breakAfter : (Zt < Yr.length || Yr.children.length && Yr.children[Yr.children.length - 1].length == 0) && Yr.merge(Zt, Yr.length, null, !1, er, 0), Qt++)); Qt < $n && kn.length; )
      if (kr[$n - 1].become(kn[kn.length - 1]))
        $n--, kn.pop(), Cr = kn.length ? 0 : er;
      else if (kr[Qt].become(kn[0]))
        Qt++, kn.shift(), er = kn.length ? 0 : Cr;
      else
        break;
    !kn.length && Qt && $n < kr.length && !kr[Qt - 1].breakAfter && kr[$n].merge(0, 0, kr[Qt - 1], !1, er, Cr) && Qt--, (Qt < $n || kn.length) && _e.replaceChildren(Qt, $n, kn);
  }
}
function mergeChildrenInto(_e, Qt, Zt, $n, Sn, kn) {
  let Kn = _e.childCursor(), { i: er, off: Cr } = Kn.findPos(Zt, 1), { i: kr, off: Yr } = Kn.findPos(Qt, -1), Ms = Qt - Zt;
  for (let Ds of $n)
    Ms += Ds.length;
  _e.length += Ms, replaceRange(_e, kr, Yr, er, Cr, $n, 0, Sn, kn);
}
const LineBreakPlaceholder = "";
class DOMReader {
  constructor(Qt, Zt) {
    this.points = Qt, this.text = "", this.lineSeparator = Zt.facet(EditorState.lineSeparator);
  }
  append(Qt) {
    this.text += Qt;
  }
  lineBreak() {
    this.text += LineBreakPlaceholder;
  }
  readRange(Qt, Zt) {
    if (!Qt)
      return this;
    let $n = Qt.parentNode;
    for (let Sn = Qt; ; ) {
      this.findPointBefore($n, Sn);
      let kn = this.text.length;
      this.readNode(Sn);
      let Kn = Sn.nextSibling;
      if (Kn == Zt)
        break;
      let er = ContentView.get(Sn), Cr = ContentView.get(Kn);
      (er && Cr ? er.breakAfter : (er ? er.breakAfter : isBlockElement(Sn)) || isBlockElement(Kn) && (Sn.nodeName != "BR" || Sn.cmIgnore) && this.text.length > kn) && this.lineBreak(), Sn = Kn;
    }
    return this.findPointBefore($n, Zt), this;
  }
  readTextNode(Qt) {
    let Zt = Qt.nodeValue;
    for (let $n of this.points)
      $n.node == Qt && ($n.pos = this.text.length + Math.min($n.offset, Zt.length));
    for (let $n = 0, Sn = this.lineSeparator ? null : /\r\n?|\n/g; ; ) {
      let kn = -1, Kn = 1, er;
      if (this.lineSeparator ? (kn = Zt.indexOf(this.lineSeparator, $n), Kn = this.lineSeparator.length) : (er = Sn.exec(Zt)) && (kn = er.index, Kn = er[0].length), this.append(Zt.slice($n, kn < 0 ? Zt.length : kn)), kn < 0)
        break;
      if (this.lineBreak(), Kn > 1)
        for (let Cr of this.points)
          Cr.node == Qt && Cr.pos > this.text.length && (Cr.pos -= Kn - 1);
      $n = kn + Kn;
    }
  }
  readNode(Qt) {
    if (Qt.cmIgnore)
      return;
    let Zt = ContentView.get(Qt), $n = Zt && Zt.overrideDOMText;
    if ($n != null) {
      this.findPointInside(Qt, $n.length);
      for (let Sn = $n.iter(); !Sn.next().done; )
        Sn.lineBreak ? this.lineBreak() : this.append(Sn.value);
    } else
      Qt.nodeType == 3 ? this.readTextNode(Qt) : Qt.nodeName == "BR" ? Qt.nextSibling && this.lineBreak() : Qt.nodeType == 1 && this.readRange(Qt.firstChild, null);
  }
  findPointBefore(Qt, Zt) {
    for (let $n of this.points)
      $n.node == Qt && Qt.childNodes[$n.offset] == Zt && ($n.pos = this.text.length);
  }
  findPointInside(Qt, Zt) {
    for (let $n of this.points)
      (Qt.nodeType == 3 ? $n.node == Qt : Qt.contains($n.node)) && ($n.pos = this.text.length + Math.min(Zt, $n.offset));
  }
}
function isBlockElement(_e) {
  return _e.nodeType == 1 && /^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(_e.nodeName);
}
class DOMPoint {
  constructor(Qt, Zt) {
    this.node = Qt, this.offset = Zt, this.pos = -1;
  }
}
let nav = typeof navigator < "u" ? navigator : { userAgent: "", vendor: "", platform: "" }, doc = typeof document < "u" ? document : { documentElement: { style: {} } };
const ie_edge = /* @__PURE__ */ /Edge\/(\d+)/.exec(nav.userAgent), ie_upto10 = /* @__PURE__ */ /MSIE \d/.test(nav.userAgent), ie_11up = /* @__PURE__ */ /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nav.userAgent), ie$2 = !!(ie_upto10 || ie_11up || ie_edge), gecko = !ie$2 && /* @__PURE__ */ /gecko\/(\d+)/i.test(nav.userAgent), chrome = !ie$2 && /* @__PURE__ */ /Chrome\/(\d+)/.exec(nav.userAgent), webkit = "webkitFontSmoothing" in doc.documentElement.style, safari = !ie$2 && /* @__PURE__ */ /Apple Computer/.test(nav.vendor), ios = safari && (/* @__PURE__ */ /Mobile\/\w+/.test(nav.userAgent) || nav.maxTouchPoints > 2);
var browser = {
  mac: ios || /* @__PURE__ */ /Mac/.test(nav.platform),
  windows: /* @__PURE__ */ /Win/.test(nav.platform),
  linux: /* @__PURE__ */ /Linux|X11/.test(nav.platform),
  ie: ie$2,
  ie_version: ie_upto10 ? doc.documentMode || 6 : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0,
  gecko,
  gecko_version: gecko ? +(/* @__PURE__ */ /Firefox\/(\d+)/.exec(nav.userAgent) || [0, 0])[1] : 0,
  chrome: !!chrome,
  chrome_version: chrome ? +chrome[1] : 0,
  ios,
  android: /* @__PURE__ */ /Android\b/.test(nav.userAgent),
  webkit,
  safari,
  webkit_version: webkit ? +(/* @__PURE__ */ /\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0,
  tabSize: doc.documentElement.style.tabSize != null ? "tab-size" : "-moz-tab-size"
};
const MaxJoinLen = 256;
class TextView extends ContentView {
  constructor(Qt) {
    super(), this.text = Qt;
  }
  get length() {
    return this.text.length;
  }
  createDOM(Qt) {
    this.setDOM(Qt || document.createTextNode(this.text));
  }
  sync(Qt, Zt) {
    this.dom || this.createDOM(), this.dom.nodeValue != this.text && (Zt && Zt.node == this.dom && (Zt.written = !0), this.dom.nodeValue = this.text);
  }
  reuseDOM(Qt) {
    Qt.nodeType == 3 && this.createDOM(Qt);
  }
  merge(Qt, Zt, $n) {
    return this.flags & 8 || $n && (!($n instanceof TextView) || this.length - (Zt - Qt) + $n.length > MaxJoinLen || $n.flags & 8) ? !1 : (this.text = this.text.slice(0, Qt) + ($n ? $n.text : "") + this.text.slice(Zt), this.markDirty(), !0);
  }
  split(Qt) {
    let Zt = new TextView(this.text.slice(Qt));
    return this.text = this.text.slice(0, Qt), this.markDirty(), Zt.flags |= this.flags & 8, Zt;
  }
  localPosFromDOM(Qt, Zt) {
    return Qt == this.dom ? Zt : Zt ? this.text.length : 0;
  }
  domAtPos(Qt) {
    return new DOMPos(this.dom, Qt);
  }
  domBoundsAround(Qt, Zt, $n) {
    return { from: $n, to: $n + this.length, startDOM: this.dom, endDOM: this.dom.nextSibling };
  }
  coordsAt(Qt, Zt) {
    return textCoords(this.dom, Qt, Zt);
  }
}
class MarkView extends ContentView {
  constructor(Qt, Zt = [], $n = 0) {
    super(), this.mark = Qt, this.children = Zt, this.length = $n;
    for (let Sn of Zt)
      Sn.setParent(this);
  }
  setAttrs(Qt) {
    if (clearAttributes(Qt), this.mark.class && (Qt.className = this.mark.class), this.mark.attrs)
      for (let Zt in this.mark.attrs)
        Qt.setAttribute(Zt, this.mark.attrs[Zt]);
    return Qt;
  }
  canReuseDOM(Qt) {
    return super.canReuseDOM(Qt) && !((this.flags | Qt.flags) & 8);
  }
  reuseDOM(Qt) {
    Qt.nodeName == this.mark.tagName.toUpperCase() && (this.setDOM(Qt), this.flags |= 6);
  }
  sync(Qt, Zt) {
    this.dom ? this.flags & 4 && this.setAttrs(this.dom) : this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))), super.sync(Qt, Zt);
  }
  merge(Qt, Zt, $n, Sn, kn, Kn) {
    return $n && (!($n instanceof MarkView && $n.mark.eq(this.mark)) || Qt && kn <= 0 || Zt < this.length && Kn <= 0) ? !1 : (mergeChildrenInto(this, Qt, Zt, $n ? $n.children : [], kn - 1, Kn - 1), this.markDirty(), !0);
  }
  split(Qt) {
    let Zt = [], $n = 0, Sn = -1, kn = 0;
    for (let er of this.children) {
      let Cr = $n + er.length;
      Cr > Qt && Zt.push($n < Qt ? er.split(Qt - $n) : er), Sn < 0 && $n >= Qt && (Sn = kn), $n = Cr, kn++;
    }
    let Kn = this.length - Qt;
    return this.length = Qt, Sn > -1 && (this.children.length = Sn, this.markDirty()), new MarkView(this.mark, Zt, Kn);
  }
  domAtPos(Qt) {
    return inlineDOMAtPos(this, Qt);
  }
  coordsAt(Qt, Zt) {
    return coordsInChildren(this, Qt, Zt);
  }
}
function textCoords(_e, Qt, Zt) {
  let $n = _e.nodeValue.length;
  Qt > $n && (Qt = $n);
  let Sn = Qt, kn = Qt, Kn = 0;
  Qt == 0 && Zt < 0 || Qt == $n && Zt >= 0 ? browser.chrome || browser.gecko || (Qt ? (Sn--, Kn = 1) : kn < $n && (kn++, Kn = -1)) : Zt < 0 ? Sn-- : kn < $n && kn++;
  let er = textRange(_e, Sn, kn).getClientRects();
  if (!er.length)
    return null;
  let Cr = er[(Kn ? Kn < 0 : Zt >= 0) ? 0 : er.length - 1];
  return browser.safari && !Kn && Cr.width == 0 && (Cr = Array.prototype.find.call(er, (kr) => kr.width) || Cr), Kn ? flattenRect(Cr, Kn < 0) : Cr || null;
}
class WidgetView extends ContentView {
  static create(Qt, Zt, $n) {
    return new WidgetView(Qt, Zt, $n);
  }
  constructor(Qt, Zt, $n) {
    super(), this.widget = Qt, this.length = Zt, this.side = $n, this.prevWidget = null;
  }
  split(Qt) {
    let Zt = WidgetView.create(this.widget, this.length - Qt, this.side);
    return this.length -= Qt, Zt;
  }
  sync(Qt) {
    (!this.dom || !this.widget.updateDOM(this.dom, Qt)) && (this.dom && this.prevWidget && this.prevWidget.destroy(this.dom), this.prevWidget = null, this.setDOM(this.widget.toDOM(Qt)), this.dom.contentEditable = "false");
  }
  getSide() {
    return this.side;
  }
  merge(Qt, Zt, $n, Sn, kn, Kn) {
    return $n && (!($n instanceof WidgetView) || !this.widget.compare($n.widget) || Qt > 0 && kn <= 0 || Zt < this.length && Kn <= 0) ? !1 : (this.length = Qt + ($n ? $n.length : 0) + (this.length - Zt), !0);
  }
  become(Qt) {
    return Qt instanceof WidgetView && Qt.side == this.side && this.widget.constructor == Qt.widget.constructor ? (this.widget.compare(Qt.widget) || this.markDirty(!0), this.dom && !this.prevWidget && (this.prevWidget = this.widget), this.widget = Qt.widget, this.length = Qt.length, !0) : !1;
  }
  ignoreMutation() {
    return !0;
  }
  ignoreEvent(Qt) {
    return this.widget.ignoreEvent(Qt);
  }
  get overrideDOMText() {
    if (this.length == 0)
      return Text$1.empty;
    let Qt = this;
    for (; Qt.parent; )
      Qt = Qt.parent;
    let { view: Zt } = Qt, $n = Zt && Zt.state.doc, Sn = this.posAtStart;
    return $n ? $n.slice(Sn, Sn + this.length) : Text$1.empty;
  }
  domAtPos(Qt) {
    return (this.length ? Qt == 0 : this.side > 0) ? DOMPos.before(this.dom) : DOMPos.after(this.dom, Qt == this.length);
  }
  domBoundsAround() {
    return null;
  }
  coordsAt(Qt, Zt) {
    let $n = this.widget.coordsAt(this.dom, Qt, Zt);
    if ($n)
      return $n;
    let Sn = this.dom.getClientRects(), kn = null;
    if (!Sn.length)
      return null;
    let Kn = this.side ? this.side < 0 : Qt > 0;
    for (let er = Kn ? Sn.length - 1 : 0; kn = Sn[er], !(Qt > 0 ? er == 0 : er == Sn.length - 1 || kn.top < kn.bottom); er += Kn ? -1 : 1)
      ;
    return flattenRect(kn, !Kn);
  }
  get isEditable() {
    return !1;
  }
  get isWidget() {
    return !0;
  }
  get isHidden() {
    return this.widget.isHidden;
  }
  destroy() {
    super.destroy(), this.dom && this.widget.destroy(this.dom);
  }
}
class WidgetBufferView extends ContentView {
  constructor(Qt) {
    super(), this.side = Qt;
  }
  get length() {
    return 0;
  }
  merge() {
    return !1;
  }
  become(Qt) {
    return Qt instanceof WidgetBufferView && Qt.side == this.side;
  }
  split() {
    return new WidgetBufferView(this.side);
  }
  sync() {
    if (!this.dom) {
      let Qt = document.createElement("img");
      Qt.className = "cm-widgetBuffer", Qt.setAttribute("aria-hidden", "true"), this.setDOM(Qt);
    }
  }
  getSide() {
    return this.side;
  }
  domAtPos(Qt) {
    return this.side > 0 ? DOMPos.before(this.dom) : DOMPos.after(this.dom);
  }
  localPosFromDOM() {
    return 0;
  }
  domBoundsAround() {
    return null;
  }
  coordsAt(Qt) {
    return this.dom.getBoundingClientRect();
  }
  get overrideDOMText() {
    return Text$1.empty;
  }
  get isHidden() {
    return !0;
  }
}
TextView.prototype.children = WidgetView.prototype.children = WidgetBufferView.prototype.children = noChildren;
function inlineDOMAtPos(_e, Qt) {
  let Zt = _e.dom, { children: $n } = _e, Sn = 0;
  for (let kn = 0; Sn < $n.length; Sn++) {
    let Kn = $n[Sn], er = kn + Kn.length;
    if (!(er == kn && Kn.getSide() <= 0)) {
      if (Qt > kn && Qt < er && Kn.dom.parentNode == Zt)
        return Kn.domAtPos(Qt - kn);
      if (Qt <= kn)
        break;
      kn = er;
    }
  }
  for (let kn = Sn; kn > 0; kn--) {
    let Kn = $n[kn - 1];
    if (Kn.dom.parentNode == Zt)
      return Kn.domAtPos(Kn.length);
  }
  for (let kn = Sn; kn < $n.length; kn++) {
    let Kn = $n[kn];
    if (Kn.dom.parentNode == Zt)
      return Kn.domAtPos(0);
  }
  return new DOMPos(Zt, 0);
}
function joinInlineInto(_e, Qt, Zt) {
  let $n, { children: Sn } = _e;
  Zt > 0 && Qt instanceof MarkView && Sn.length && ($n = Sn[Sn.length - 1]) instanceof MarkView && $n.mark.eq(Qt.mark) ? joinInlineInto($n, Qt.children[0], Zt - 1) : (Sn.push(Qt), Qt.setParent(_e)), _e.length += Qt.length;
}
function coordsInChildren(_e, Qt, Zt) {
  let $n = null, Sn = -1, kn = null, Kn = -1;
  function er(kr, Yr) {
    for (let Ms = 0, Ds = 0; Ms < kr.children.length && Ds <= Yr; Ms++) {
      let Ls = kr.children[Ms], js = Ds + Ls.length;
      js >= Yr && (Ls.children.length ? er(Ls, Yr - Ds) : (!kn || kn.isHidden && Zt > 0) && (js > Yr || Ds == js && Ls.getSide() > 0) ? (kn = Ls, Kn = Yr - Ds) : (Ds < Yr || Ds == js && Ls.getSide() < 0 && !Ls.isHidden) && ($n = Ls, Sn = Yr - Ds)), Ds = js;
    }
  }
  er(_e, Qt);
  let Cr = (Zt < 0 ? $n : kn) || $n || kn;
  return Cr ? Cr.coordsAt(Math.max(0, Cr == $n ? Sn : Kn), Zt) : fallbackRect(_e);
}
function fallbackRect(_e) {
  let Qt = _e.dom.lastChild;
  if (!Qt)
    return _e.dom.getBoundingClientRect();
  let Zt = clientRectsFor(Qt);
  return Zt[Zt.length - 1] || null;
}
function combineAttrs(_e, Qt) {
  for (let Zt in _e)
    Zt == "class" && Qt.class ? Qt.class += " " + _e.class : Zt == "style" && Qt.style ? Qt.style += ";" + _e.style : Qt[Zt] = _e[Zt];
  return Qt;
}
const noAttrs = /* @__PURE__ */ Object.create(null);
function attrsEq(_e, Qt, Zt) {
  if (_e == Qt)
    return !0;
  _e || (_e = noAttrs), Qt || (Qt = noAttrs);
  let $n = Object.keys(_e), Sn = Object.keys(Qt);
  if ($n.length - (Zt && $n.indexOf(Zt) > -1 ? 1 : 0) != Sn.length - (Zt && Sn.indexOf(Zt) > -1 ? 1 : 0))
    return !1;
  for (let kn of $n)
    if (kn != Zt && (Sn.indexOf(kn) == -1 || _e[kn] !== Qt[kn]))
      return !1;
  return !0;
}
function updateAttrs(_e, Qt, Zt) {
  let $n = !1;
  if (Qt)
    for (let Sn in Qt)
      Zt && Sn in Zt || ($n = !0, Sn == "style" ? _e.style.cssText = "" : _e.removeAttribute(Sn));
  if (Zt)
    for (let Sn in Zt)
      Qt && Qt[Sn] == Zt[Sn] || ($n = !0, Sn == "style" ? _e.style.cssText = Zt[Sn] : _e.setAttribute(Sn, Zt[Sn]));
  return $n;
}
function getAttrs(_e) {
  let Qt = /* @__PURE__ */ Object.create(null);
  for (let Zt = 0; Zt < _e.attributes.length; Zt++) {
    let $n = _e.attributes[Zt];
    Qt[$n.name] = $n.value;
  }
  return Qt;
}
class WidgetType {
  /**
  Compare this instance to another instance of the same type.
  (TypeScript can't express this, but only instances of the same
  specific class will be passed to this method.) This is used to
  avoid redrawing widgets when they are replaced by a new
  decoration of the same type. The default implementation just
  returns `false`, which will cause new instances of the widget to
  always be redrawn.
  */
  eq(Qt) {
    return !1;
  }
  /**
  Update a DOM element created by a widget of the same type (but
  different, non-`eq` content) to reflect this widget. May return
  true to indicate that it could update, false to indicate it
  couldn't (in which case the widget will be redrawn). The default
  implementation just returns false.
  */
  updateDOM(Qt, Zt) {
    return !1;
  }
  /**
  @internal
  */
  compare(Qt) {
    return this == Qt || this.constructor == Qt.constructor && this.eq(Qt);
  }
  /**
  The estimated height this widget will have, to be used when
  estimating the height of content that hasn't been drawn. May
  return -1 to indicate you don't know. The default implementation
  returns -1.
  */
  get estimatedHeight() {
    return -1;
  }
  /**
  For inline widgets that are displayed inline (as opposed to
  `inline-block`) and introduce line breaks (through `<br>` tags
  or textual newlines), this must indicate the amount of line
  breaks they introduce. Defaults to 0.
  */
  get lineBreaks() {
    return 0;
  }
  /**
  Can be used to configure which kinds of events inside the widget
  should be ignored by the editor. The default is to ignore all
  events.
  */
  ignoreEvent(Qt) {
    return !0;
  }
  /**
  Override the way screen coordinates for positions at/in the
  widget are found. `pos` will be the offset into the widget, and
  `side` the side of the position that is being queried—less than
  zero for before, greater than zero for after, and zero for
  directly at that position.
  */
  coordsAt(Qt, Zt, $n) {
    return null;
  }
  /**
  @internal
  */
  get isHidden() {
    return !1;
  }
  /**
  This is called when the an instance of the widget is removed
  from the editor view.
  */
  destroy(Qt) {
  }
}
var BlockType = /* @__PURE__ */ function(_e) {
  return _e[_e.Text = 0] = "Text", _e[_e.WidgetBefore = 1] = "WidgetBefore", _e[_e.WidgetAfter = 2] = "WidgetAfter", _e[_e.WidgetRange = 3] = "WidgetRange", _e;
}(BlockType || (BlockType = {}));
class Decoration extends RangeValue {
  constructor(Qt, Zt, $n, Sn) {
    super(), this.startSide = Qt, this.endSide = Zt, this.widget = $n, this.spec = Sn;
  }
  /**
  @internal
  */
  get heightRelevant() {
    return !1;
  }
  /**
  Create a mark decoration, which influences the styling of the
  content in its range. Nested mark decorations will cause nested
  DOM elements to be created. Nesting order is determined by
  precedence of the [facet](https://codemirror.net/6/docs/ref/#view.EditorView^decorations), with
  the higher-precedence decorations creating the inner DOM nodes.
  Such elements are split on line boundaries and on the boundaries
  of lower-precedence decorations.
  */
  static mark(Qt) {
    return new MarkDecoration(Qt);
  }
  /**
  Create a widget decoration, which displays a DOM element at the
  given position.
  */
  static widget(Qt) {
    let Zt = Math.max(-1e4, Math.min(1e4, Qt.side || 0)), $n = !!Qt.block;
    return Zt += $n && !Qt.inlineOrder ? Zt > 0 ? 3e8 : -4e8 : Zt > 0 ? 1e8 : -1e8, new PointDecoration(Qt, Zt, Zt, $n, Qt.widget || null, !1);
  }
  /**
  Create a replace decoration which replaces the given range with
  a widget, or simply hides it.
  */
  static replace(Qt) {
    let Zt = !!Qt.block, $n, Sn;
    if (Qt.isBlockGap)
      $n = -5e8, Sn = 4e8;
    else {
      let { start: kn, end: Kn } = getInclusive(Qt, Zt);
      $n = (kn ? Zt ? -3e8 : -1 : 5e8) - 1, Sn = (Kn ? Zt ? 2e8 : 1 : -6e8) + 1;
    }
    return new PointDecoration(Qt, $n, Sn, Zt, Qt.widget || null, !0);
  }
  /**
  Create a line decoration, which can add DOM attributes to the
  line starting at the given position.
  */
  static line(Qt) {
    return new LineDecoration(Qt);
  }
  /**
  Build a [`DecorationSet`](https://codemirror.net/6/docs/ref/#view.DecorationSet) from the given
  decorated range or ranges. If the ranges aren't already sorted,
  pass `true` for `sort` to make the library sort them for you.
  */
  static set(Qt, Zt = !1) {
    return RangeSet.of(Qt, Zt);
  }
  /**
  @internal
  */
  hasHeight() {
    return this.widget ? this.widget.estimatedHeight > -1 : !1;
  }
}
Decoration.none = RangeSet.empty;
class MarkDecoration extends Decoration {
  constructor(Qt) {
    let { start: Zt, end: $n } = getInclusive(Qt);
    super(Zt ? -1 : 5e8, $n ? 1 : -6e8, null, Qt), this.tagName = Qt.tagName || "span", this.class = Qt.class || "", this.attrs = Qt.attributes || null;
  }
  eq(Qt) {
    var Zt, $n;
    return this == Qt || Qt instanceof MarkDecoration && this.tagName == Qt.tagName && (this.class || ((Zt = this.attrs) === null || Zt === void 0 ? void 0 : Zt.class)) == (Qt.class || (($n = Qt.attrs) === null || $n === void 0 ? void 0 : $n.class)) && attrsEq(this.attrs, Qt.attrs, "class");
  }
  range(Qt, Zt = Qt) {
    if (Qt >= Zt)
      throw new RangeError("Mark decorations may not be empty");
    return super.range(Qt, Zt);
  }
}
MarkDecoration.prototype.point = !1;
class LineDecoration extends Decoration {
  constructor(Qt) {
    super(-2e8, -2e8, null, Qt);
  }
  eq(Qt) {
    return Qt instanceof LineDecoration && this.spec.class == Qt.spec.class && attrsEq(this.spec.attributes, Qt.spec.attributes);
  }
  range(Qt, Zt = Qt) {
    if (Zt != Qt)
      throw new RangeError("Line decoration ranges must be zero-length");
    return super.range(Qt, Zt);
  }
}
LineDecoration.prototype.mapMode = MapMode.TrackBefore;
LineDecoration.prototype.point = !0;
class PointDecoration extends Decoration {
  constructor(Qt, Zt, $n, Sn, kn, Kn) {
    super(Zt, $n, kn, Qt), this.block = Sn, this.isReplace = Kn, this.mapMode = Sn ? Zt <= 0 ? MapMode.TrackBefore : MapMode.TrackAfter : MapMode.TrackDel;
  }
  // Only relevant when this.block == true
  get type() {
    return this.startSide < this.endSide ? BlockType.WidgetRange : this.startSide <= 0 ? BlockType.WidgetBefore : BlockType.WidgetAfter;
  }
  get heightRelevant() {
    return this.block || !!this.widget && (this.widget.estimatedHeight >= 5 || this.widget.lineBreaks > 0);
  }
  eq(Qt) {
    return Qt instanceof PointDecoration && widgetsEq(this.widget, Qt.widget) && this.block == Qt.block && this.startSide == Qt.startSide && this.endSide == Qt.endSide;
  }
  range(Qt, Zt = Qt) {
    if (this.isReplace && (Qt > Zt || Qt == Zt && this.startSide > 0 && this.endSide <= 0))
      throw new RangeError("Invalid range for replacement decoration");
    if (!this.isReplace && Zt != Qt)
      throw new RangeError("Widget decorations can only have zero-length ranges");
    return super.range(Qt, Zt);
  }
}
PointDecoration.prototype.point = !0;
function getInclusive(_e, Qt = !1) {
  let { inclusiveStart: Zt, inclusiveEnd: $n } = _e;
  return Zt == null && (Zt = _e.inclusive), $n == null && ($n = _e.inclusive), { start: Zt ?? Qt, end: $n ?? Qt };
}
function widgetsEq(_e, Qt) {
  return _e == Qt || !!(_e && Qt && _e.compare(Qt));
}
function addRange(_e, Qt, Zt, $n = 0) {
  let Sn = Zt.length - 1;
  Sn >= 0 && Zt[Sn] + $n >= _e ? Zt[Sn] = Math.max(Zt[Sn], Qt) : Zt.push(_e, Qt);
}
class LineView extends ContentView {
  constructor() {
    super(...arguments), this.children = [], this.length = 0, this.prevAttrs = void 0, this.attrs = null, this.breakAfter = 0;
  }
  // Consumes source
  merge(Qt, Zt, $n, Sn, kn, Kn) {
    if ($n) {
      if (!($n instanceof LineView))
        return !1;
      this.dom || $n.transferDOM(this);
    }
    return Sn && this.setDeco($n ? $n.attrs : null), mergeChildrenInto(this, Qt, Zt, $n ? $n.children : [], kn, Kn), !0;
  }
  split(Qt) {
    let Zt = new LineView();
    if (Zt.breakAfter = this.breakAfter, this.length == 0)
      return Zt;
    let { i: $n, off: Sn } = this.childPos(Qt);
    Sn && (Zt.append(this.children[$n].split(Sn), 0), this.children[$n].merge(Sn, this.children[$n].length, null, !1, 0, 0), $n++);
    for (let kn = $n; kn < this.children.length; kn++)
      Zt.append(this.children[kn], 0);
    for (; $n > 0 && this.children[$n - 1].length == 0; )
      this.children[--$n].destroy();
    return this.children.length = $n, this.markDirty(), this.length = Qt, Zt;
  }
  transferDOM(Qt) {
    this.dom && (this.markDirty(), Qt.setDOM(this.dom), Qt.prevAttrs = this.prevAttrs === void 0 ? this.attrs : this.prevAttrs, this.prevAttrs = void 0, this.dom = null);
  }
  setDeco(Qt) {
    attrsEq(this.attrs, Qt) || (this.dom && (this.prevAttrs = this.attrs, this.markDirty()), this.attrs = Qt);
  }
  append(Qt, Zt) {
    joinInlineInto(this, Qt, Zt);
  }
  // Only called when building a line view in ContentBuilder
  addLineDeco(Qt) {
    let Zt = Qt.spec.attributes, $n = Qt.spec.class;
    Zt && (this.attrs = combineAttrs(Zt, this.attrs || {})), $n && (this.attrs = combineAttrs({ class: $n }, this.attrs || {}));
  }
  domAtPos(Qt) {
    return inlineDOMAtPos(this, Qt);
  }
  reuseDOM(Qt) {
    Qt.nodeName == "DIV" && (this.setDOM(Qt), this.flags |= 6);
  }
  sync(Qt, Zt) {
    var $n;
    this.dom ? this.flags & 4 && (clearAttributes(this.dom), this.dom.className = "cm-line", this.prevAttrs = this.attrs ? null : void 0) : (this.setDOM(document.createElement("div")), this.dom.className = "cm-line", this.prevAttrs = this.attrs ? null : void 0), this.prevAttrs !== void 0 && (updateAttrs(this.dom, this.prevAttrs, this.attrs), this.dom.classList.add("cm-line"), this.prevAttrs = void 0), super.sync(Qt, Zt);
    let Sn = this.dom.lastChild;
    for (; Sn && ContentView.get(Sn) instanceof MarkView; )
      Sn = Sn.lastChild;
    if (!Sn || !this.length || Sn.nodeName != "BR" && (($n = ContentView.get(Sn)) === null || $n === void 0 ? void 0 : $n.isEditable) == !1 && (!browser.ios || !this.children.some((kn) => kn instanceof TextView))) {
      let kn = document.createElement("BR");
      kn.cmIgnore = !0, this.dom.appendChild(kn);
    }
  }
  measureTextSize() {
    if (this.children.length == 0 || this.length > 20)
      return null;
    let Qt = 0, Zt;
    for (let $n of this.children) {
      if (!($n instanceof TextView) || /[^ -~]/.test($n.text))
        return null;
      let Sn = clientRectsFor($n.dom);
      if (Sn.length != 1)
        return null;
      Qt += Sn[0].width, Zt = Sn[0].height;
    }
    return Qt ? {
      lineHeight: this.dom.getBoundingClientRect().height,
      charWidth: Qt / this.length,
      textHeight: Zt
    } : null;
  }
  coordsAt(Qt, Zt) {
    let $n = coordsInChildren(this, Qt, Zt);
    if (!this.children.length && $n && this.parent) {
      let { heightOracle: Sn } = this.parent.view.viewState, kn = $n.bottom - $n.top;
      if (Math.abs(kn - Sn.lineHeight) < 2 && Sn.textHeight < kn) {
        let Kn = (kn - Sn.textHeight) / 2;
        return { top: $n.top + Kn, bottom: $n.bottom - Kn, left: $n.left, right: $n.left };
      }
    }
    return $n;
  }
  become(Qt) {
    return !1;
  }
  get type() {
    return BlockType.Text;
  }
  static find(Qt, Zt) {
    for (let $n = 0, Sn = 0; $n < Qt.children.length; $n++) {
      let kn = Qt.children[$n], Kn = Sn + kn.length;
      if (Kn >= Zt) {
        if (kn instanceof LineView)
          return kn;
        if (Kn > Zt)
          break;
      }
      Sn = Kn + kn.breakAfter;
    }
    return null;
  }
}
class BlockWidgetView extends ContentView {
  constructor(Qt, Zt, $n) {
    super(), this.widget = Qt, this.length = Zt, this.type = $n, this.breakAfter = 0, this.prevWidget = null;
  }
  merge(Qt, Zt, $n, Sn, kn, Kn) {
    return $n && (!($n instanceof BlockWidgetView) || !this.widget.compare($n.widget) || Qt > 0 && kn <= 0 || Zt < this.length && Kn <= 0) ? !1 : (this.length = Qt + ($n ? $n.length : 0) + (this.length - Zt), !0);
  }
  domAtPos(Qt) {
    return Qt == 0 ? DOMPos.before(this.dom) : DOMPos.after(this.dom, Qt == this.length);
  }
  split(Qt) {
    let Zt = this.length - Qt;
    this.length = Qt;
    let $n = new BlockWidgetView(this.widget, Zt, this.type);
    return $n.breakAfter = this.breakAfter, $n;
  }
  get children() {
    return noChildren;
  }
  sync(Qt) {
    (!this.dom || !this.widget.updateDOM(this.dom, Qt)) && (this.dom && this.prevWidget && this.prevWidget.destroy(this.dom), this.prevWidget = null, this.setDOM(this.widget.toDOM(Qt)), this.dom.contentEditable = "false");
  }
  get overrideDOMText() {
    return this.parent ? this.parent.view.state.doc.slice(this.posAtStart, this.posAtEnd) : Text$1.empty;
  }
  domBoundsAround() {
    return null;
  }
  become(Qt) {
    return Qt instanceof BlockWidgetView && Qt.widget.constructor == this.widget.constructor ? (Qt.widget.compare(this.widget) || this.markDirty(!0), this.dom && !this.prevWidget && (this.prevWidget = this.widget), this.widget = Qt.widget, this.length = Qt.length, this.type = Qt.type, this.breakAfter = Qt.breakAfter, !0) : !1;
  }
  ignoreMutation() {
    return !0;
  }
  ignoreEvent(Qt) {
    return this.widget.ignoreEvent(Qt);
  }
  get isEditable() {
    return !1;
  }
  get isWidget() {
    return !0;
  }
  coordsAt(Qt, Zt) {
    return this.widget.coordsAt(this.dom, Qt, Zt);
  }
  destroy() {
    super.destroy(), this.dom && this.widget.destroy(this.dom);
  }
}
class ContentBuilder {
  constructor(Qt, Zt, $n, Sn) {
    this.doc = Qt, this.pos = Zt, this.end = $n, this.disallowBlockEffectsFor = Sn, this.content = [], this.curLine = null, this.breakAtStart = 0, this.pendingBuffer = 0, this.bufferMarks = [], this.atCursorPos = !0, this.openStart = -1, this.openEnd = -1, this.text = "", this.textOff = 0, this.cursor = Qt.iter(), this.skip = Zt;
  }
  posCovered() {
    if (this.content.length == 0)
      return !this.breakAtStart && this.doc.lineAt(this.pos).from != this.pos;
    let Qt = this.content[this.content.length - 1];
    return !Qt.breakAfter && !(Qt instanceof BlockWidgetView && Qt.type == BlockType.WidgetBefore);
  }
  getLine() {
    return this.curLine || (this.content.push(this.curLine = new LineView()), this.atCursorPos = !0), this.curLine;
  }
  flushBuffer(Qt = this.bufferMarks) {
    this.pendingBuffer && (this.curLine.append(wrapMarks(new WidgetBufferView(-1), Qt), Qt.length), this.pendingBuffer = 0);
  }
  addBlockWidget(Qt) {
    this.flushBuffer(), this.curLine = null, this.content.push(Qt);
  }
  finish(Qt) {
    this.pendingBuffer && Qt <= this.bufferMarks.length ? this.flushBuffer() : this.pendingBuffer = 0, this.posCovered() || this.getLine();
  }
  buildText(Qt, Zt, $n) {
    for (; Qt > 0; ) {
      if (this.textOff == this.text.length) {
        let { value: kn, lineBreak: Kn, done: er } = this.cursor.next(this.skip);
        if (this.skip = 0, er)
          throw new Error("Ran out of text content when drawing inline views");
        if (Kn) {
          this.posCovered() || this.getLine(), this.content.length ? this.content[this.content.length - 1].breakAfter = 1 : this.breakAtStart = 1, this.flushBuffer(), this.curLine = null, this.atCursorPos = !0, Qt--;
          continue;
        } else
          this.text = kn, this.textOff = 0;
      }
      let Sn = Math.min(
        this.text.length - this.textOff,
        Qt,
        512
        /* T.Chunk */
      );
      this.flushBuffer(Zt.slice(Zt.length - $n)), this.getLine().append(wrapMarks(new TextView(this.text.slice(this.textOff, this.textOff + Sn)), Zt), $n), this.atCursorPos = !0, this.textOff += Sn, Qt -= Sn, $n = 0;
    }
  }
  span(Qt, Zt, $n, Sn) {
    this.buildText(Zt - Qt, $n, Sn), this.pos = Zt, this.openStart < 0 && (this.openStart = Sn);
  }
  point(Qt, Zt, $n, Sn, kn, Kn) {
    if (this.disallowBlockEffectsFor[Kn] && $n instanceof PointDecoration) {
      if ($n.block)
        throw new RangeError("Block decorations may not be specified via plugins");
      if (Zt > this.doc.lineAt(this.pos).to)
        throw new RangeError("Decorations that replace line breaks may not be specified via plugins");
    }
    let er = Zt - Qt;
    if ($n instanceof PointDecoration)
      if ($n.block) {
        let { type: Cr } = $n;
        Cr == BlockType.WidgetAfter && !this.posCovered() && this.getLine(), this.addBlockWidget(new BlockWidgetView($n.widget || new NullWidget("div"), er, Cr));
      } else {
        let Cr = WidgetView.create($n.widget || new NullWidget("span"), er, er ? 0 : $n.startSide), kr = this.atCursorPos && !Cr.isEditable && kn <= Sn.length && (Qt < Zt || $n.startSide > 0), Yr = !Cr.isEditable && (Qt < Zt || kn > Sn.length || $n.startSide <= 0), Ms = this.getLine();
        this.pendingBuffer == 2 && !kr && !Cr.isEditable && (this.pendingBuffer = 0), this.flushBuffer(Sn), kr && (Ms.append(wrapMarks(new WidgetBufferView(1), Sn), kn), kn = Sn.length + Math.max(0, kn - Sn.length)), Ms.append(wrapMarks(Cr, Sn), kn), this.atCursorPos = Yr, this.pendingBuffer = Yr ? Qt < Zt || kn > Sn.length ? 1 : 2 : 0, this.pendingBuffer && (this.bufferMarks = Sn.slice());
      }
    else
      this.doc.lineAt(this.pos).from == this.pos && this.getLine().addLineDeco($n);
    er && (this.textOff + er <= this.text.length ? this.textOff += er : (this.skip += er - (this.text.length - this.textOff), this.text = "", this.textOff = 0), this.pos = Zt), this.openStart < 0 && (this.openStart = kn);
  }
  static build(Qt, Zt, $n, Sn, kn) {
    let Kn = new ContentBuilder(Qt, Zt, $n, kn);
    return Kn.openEnd = RangeSet.spans(Sn, Zt, $n, Kn), Kn.openStart < 0 && (Kn.openStart = Kn.openEnd), Kn.finish(Kn.openEnd), Kn;
  }
}
function wrapMarks(_e, Qt) {
  for (let Zt of Qt)
    _e = new MarkView(Zt, [_e], _e.length);
  return _e;
}
class NullWidget extends WidgetType {
  constructor(Qt) {
    super(), this.tag = Qt;
  }
  eq(Qt) {
    return Qt.tag == this.tag;
  }
  toDOM() {
    return document.createElement(this.tag);
  }
  updateDOM(Qt) {
    return Qt.nodeName.toLowerCase() == this.tag;
  }
  get isHidden() {
    return !0;
  }
}
const clickAddsSelectionRange = /* @__PURE__ */ Facet$2.define(), dragMovesSelection$1 = /* @__PURE__ */ Facet$2.define(), mouseSelectionStyle = /* @__PURE__ */ Facet$2.define(), exceptionSink = /* @__PURE__ */ Facet$2.define(), updateListener = /* @__PURE__ */ Facet$2.define(), inputHandler = /* @__PURE__ */ Facet$2.define(), focusChangeEffect = /* @__PURE__ */ Facet$2.define(), perLineTextDirection = /* @__PURE__ */ Facet$2.define({
  combine: (_e) => _e.some((Qt) => Qt)
}), nativeSelectionHidden = /* @__PURE__ */ Facet$2.define({
  combine: (_e) => _e.some((Qt) => Qt)
});
class ScrollTarget {
  constructor(Qt, Zt = "nearest", $n = "nearest", Sn = 5, kn = 5) {
    this.range = Qt, this.y = Zt, this.x = $n, this.yMargin = Sn, this.xMargin = kn;
  }
  map(Qt) {
    return Qt.empty ? this : new ScrollTarget(this.range.map(Qt), this.y, this.x, this.yMargin, this.xMargin);
  }
}
const scrollIntoView = /* @__PURE__ */ StateEffect.define({ map: (_e, Qt) => _e.map(Qt) });
function logException(_e, Qt, Zt) {
  let $n = _e.facet(exceptionSink);
  $n.length ? $n[0](Qt) : window.onerror ? window.onerror(String(Qt), Zt, void 0, void 0, Qt) : Zt ? console.error(Zt + ":", Qt) : console.error(Qt);
}
const editable = /* @__PURE__ */ Facet$2.define({ combine: (_e) => _e.length ? _e[0] : !0 });
let nextPluginID = 0;
const viewPlugin = /* @__PURE__ */ Facet$2.define();
class ViewPlugin {
  constructor(Qt, Zt, $n, Sn) {
    this.id = Qt, this.create = Zt, this.domEventHandlers = $n, this.extension = Sn(this);
  }
  /**
  Define a plugin from a constructor function that creates the
  plugin's value, given an editor view.
  */
  static define(Qt, Zt) {
    const { eventHandlers: $n, provide: Sn, decorations: kn } = Zt || {};
    return new ViewPlugin(nextPluginID++, Qt, $n, (Kn) => {
      let er = [viewPlugin.of(Kn)];
      return kn && er.push(decorations.of((Cr) => {
        let kr = Cr.plugin(Kn);
        return kr ? kn(kr) : Decoration.none;
      })), Sn && er.push(Sn(Kn)), er;
    });
  }
  /**
  Create a plugin for a class whose constructor takes a single
  editor view as argument.
  */
  static fromClass(Qt, Zt) {
    return ViewPlugin.define(($n) => new Qt($n), Zt);
  }
}
class PluginInstance {
  constructor(Qt) {
    this.spec = Qt, this.mustUpdate = null, this.value = null;
  }
  update(Qt) {
    if (this.value) {
      if (this.mustUpdate) {
        let Zt = this.mustUpdate;
        if (this.mustUpdate = null, this.value.update)
          try {
            this.value.update(Zt);
          } catch ($n) {
            if (logException(Zt.state, $n, "CodeMirror plugin crashed"), this.value.destroy)
              try {
                this.value.destroy();
              } catch {
              }
            this.deactivate();
          }
      }
    } else if (this.spec)
      try {
        this.value = this.spec.create(Qt);
      } catch (Zt) {
        logException(Qt.state, Zt, "CodeMirror plugin crashed"), this.deactivate();
      }
    return this;
  }
  destroy(Qt) {
    var Zt;
    if (!((Zt = this.value) === null || Zt === void 0) && Zt.destroy)
      try {
        this.value.destroy();
      } catch ($n) {
        logException(Qt.state, $n, "CodeMirror plugin crashed");
      }
  }
  deactivate() {
    this.spec = this.value = null;
  }
}
const editorAttributes = /* @__PURE__ */ Facet$2.define(), contentAttributes = /* @__PURE__ */ Facet$2.define(), decorations = /* @__PURE__ */ Facet$2.define(), atomicRanges = /* @__PURE__ */ Facet$2.define(), bidiIsolatedRanges = /* @__PURE__ */ Facet$2.define();
function getIsolatedRanges(_e, Qt, Zt) {
  let $n = _e.state.facet(bidiIsolatedRanges);
  if (!$n.length)
    return $n;
  let Sn = $n.map((Kn) => Kn instanceof Function ? Kn(_e) : Kn), kn = [];
  return RangeSet.spans(Sn, Qt, Zt, {
    point() {
    },
    span(Kn, er, Cr, kr) {
      let Yr = kn;
      for (let Ms = Cr.length - 1; Ms >= 0; Ms--, kr--) {
        let Ds = Cr[Ms].spec.bidiIsolate, Ls;
        if (Ds != null)
          if (kr > 0 && Yr.length && (Ls = Yr[Yr.length - 1]).to == Kn && Ls.direction == Ds)
            Ls.to = er, Yr = Ls.inner;
          else {
            let js = { from: Kn, to: er, direction: Ds, inner: [] };
            Yr.push(js), Yr = js.inner;
          }
      }
    }
  }), kn;
}
const scrollMargins = /* @__PURE__ */ Facet$2.define();
function getScrollMargins(_e) {
  let Qt = 0, Zt = 0, $n = 0, Sn = 0;
  for (let kn of _e.state.facet(scrollMargins)) {
    let Kn = kn(_e);
    Kn && (Kn.left != null && (Qt = Math.max(Qt, Kn.left)), Kn.right != null && (Zt = Math.max(Zt, Kn.right)), Kn.top != null && ($n = Math.max($n, Kn.top)), Kn.bottom != null && (Sn = Math.max(Sn, Kn.bottom)));
  }
  return { left: Qt, right: Zt, top: $n, bottom: Sn };
}
const styleModule = /* @__PURE__ */ Facet$2.define();
class ChangedRange {
  constructor(Qt, Zt, $n, Sn) {
    this.fromA = Qt, this.toA = Zt, this.fromB = $n, this.toB = Sn;
  }
  join(Qt) {
    return new ChangedRange(Math.min(this.fromA, Qt.fromA), Math.max(this.toA, Qt.toA), Math.min(this.fromB, Qt.fromB), Math.max(this.toB, Qt.toB));
  }
  addToSet(Qt) {
    let Zt = Qt.length, $n = this;
    for (; Zt > 0; Zt--) {
      let Sn = Qt[Zt - 1];
      if (!(Sn.fromA > $n.toA)) {
        if (Sn.toA < $n.fromA)
          break;
        $n = $n.join(Sn), Qt.splice(Zt - 1, 1);
      }
    }
    return Qt.splice(Zt, 0, $n), Qt;
  }
  static extendWithRanges(Qt, Zt) {
    if (Zt.length == 0)
      return Qt;
    let $n = [];
    for (let Sn = 0, kn = 0, Kn = 0, er = 0; ; Sn++) {
      let Cr = Sn == Qt.length ? null : Qt[Sn], kr = Kn - er, Yr = Cr ? Cr.fromB : 1e9;
      for (; kn < Zt.length && Zt[kn] < Yr; ) {
        let Ms = Zt[kn], Ds = Zt[kn + 1], Ls = Math.max(er, Ms), js = Math.min(Yr, Ds);
        if (Ls <= js && new ChangedRange(Ls + kr, js + kr, Ls, js).addToSet($n), Ds > Yr)
          break;
        kn += 2;
      }
      if (!Cr)
        return $n;
      new ChangedRange(Cr.fromA, Cr.toA, Cr.fromB, Cr.toB).addToSet($n), Kn = Cr.toA, er = Cr.toB;
    }
  }
}
class ViewUpdate {
  constructor(Qt, Zt, $n) {
    this.view = Qt, this.state = Zt, this.transactions = $n, this.flags = 0, this.startState = Qt.state, this.changes = ChangeSet.empty(this.startState.doc.length);
    for (let kn of $n)
      this.changes = this.changes.compose(kn.changes);
    let Sn = [];
    this.changes.iterChangedRanges((kn, Kn, er, Cr) => Sn.push(new ChangedRange(kn, Kn, er, Cr))), this.changedRanges = Sn;
  }
  /**
  @internal
  */
  static create(Qt, Zt, $n) {
    return new ViewUpdate(Qt, Zt, $n);
  }
  /**
  Tells you whether the [viewport](https://codemirror.net/6/docs/ref/#view.EditorView.viewport) or
  [visible ranges](https://codemirror.net/6/docs/ref/#view.EditorView.visibleRanges) changed in this
  update.
  */
  get viewportChanged() {
    return (this.flags & 4) > 0;
  }
  /**
  Indicates whether the height of a block element in the editor
  changed in this update.
  */
  get heightChanged() {
    return (this.flags & 2) > 0;
  }
  /**
  Returns true when the document was modified or the size of the
  editor, or elements within the editor, changed.
  */
  get geometryChanged() {
    return this.docChanged || (this.flags & 10) > 0;
  }
  /**
  True when this update indicates a focus change.
  */
  get focusChanged() {
    return (this.flags & 1) > 0;
  }
  /**
  Whether the document changed in this update.
  */
  get docChanged() {
    return !this.changes.empty;
  }
  /**
  Whether the selection was explicitly set in this update.
  */
  get selectionSet() {
    return this.transactions.some((Qt) => Qt.selection);
  }
  /**
  @internal
  */
  get empty() {
    return this.flags == 0 && this.transactions.length == 0;
  }
}
var Direction = /* @__PURE__ */ function(_e) {
  return _e[_e.LTR = 0] = "LTR", _e[_e.RTL = 1] = "RTL", _e;
}(Direction || (Direction = {}));
const LTR = Direction.LTR, RTL = Direction.RTL;
function dec(_e) {
  let Qt = [];
  for (let Zt = 0; Zt < _e.length; Zt++)
    Qt.push(1 << +_e[Zt]);
  return Qt;
}
const LowTypes = /* @__PURE__ */ dec("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"), ArabicTypes = /* @__PURE__ */ dec("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"), Brackets = /* @__PURE__ */ Object.create(null), BracketStack = [];
for (let _e of ["()", "[]", "{}"]) {
  let Qt = /* @__PURE__ */ _e.charCodeAt(0), Zt = /* @__PURE__ */ _e.charCodeAt(1);
  Brackets[Qt] = Zt, Brackets[Zt] = -Qt;
}
function charType(_e) {
  return _e <= 247 ? LowTypes[_e] : 1424 <= _e && _e <= 1524 ? 2 : 1536 <= _e && _e <= 1785 ? ArabicTypes[_e - 1536] : 1774 <= _e && _e <= 2220 ? 4 : 8192 <= _e && _e <= 8203 ? 256 : 64336 <= _e && _e <= 65023 ? 4 : _e == 8204 ? 256 : 1;
}
const BidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;
class BidiSpan {
  /**
  The direction of this span.
  */
  get dir() {
    return this.level % 2 ? RTL : LTR;
  }
  /**
  @internal
  */
  constructor(Qt, Zt, $n) {
    this.from = Qt, this.to = Zt, this.level = $n;
  }
  /**
  @internal
  */
  side(Qt, Zt) {
    return this.dir == Zt == Qt ? this.to : this.from;
  }
  /**
  @internal
  */
  static find(Qt, Zt, $n, Sn) {
    let kn = -1;
    for (let Kn = 0; Kn < Qt.length; Kn++) {
      let er = Qt[Kn];
      if (er.from <= Zt && er.to >= Zt) {
        if (er.level == $n)
          return Kn;
        (kn < 0 || (Sn != 0 ? Sn < 0 ? er.from < Zt : er.to > Zt : Qt[kn].level > er.level)) && (kn = Kn);
      }
    }
    if (kn < 0)
      throw new RangeError("Index out of range");
    return kn;
  }
}
function isolatesEq(_e, Qt) {
  if (_e.length != Qt.length)
    return !1;
  for (let Zt = 0; Zt < _e.length; Zt++) {
    let $n = _e[Zt], Sn = Qt[Zt];
    if ($n.from != Sn.from || $n.to != Sn.to || $n.direction != Sn.direction || !isolatesEq($n.inner, Sn.inner))
      return !1;
  }
  return !0;
}
const types$2 = [];
function computeCharTypes(_e, Qt, Zt, $n, Sn) {
  for (let kn = 0; kn <= $n.length; kn++) {
    let Kn = kn ? $n[kn - 1].to : Qt, er = kn < $n.length ? $n[kn].from : Zt, Cr = kn ? 256 : Sn;
    for (let kr = Kn, Yr = Cr, Ms = Cr; kr < er; kr++) {
      let Ds = charType(_e.charCodeAt(kr));
      Ds == 512 ? Ds = Yr : Ds == 8 && Ms == 4 && (Ds = 16), types$2[kr] = Ds == 4 ? 2 : Ds, Ds & 7 && (Ms = Ds), Yr = Ds;
    }
    for (let kr = Kn, Yr = Cr, Ms = Cr; kr < er; kr++) {
      let Ds = types$2[kr];
      if (Ds == 128)
        kr < er - 1 && Yr == types$2[kr + 1] && Yr & 24 ? Ds = types$2[kr] = Yr : types$2[kr] = 256;
      else if (Ds == 64) {
        let Ls = kr + 1;
        for (; Ls < er && types$2[Ls] == 64; )
          Ls++;
        let js = kr && Yr == 8 || Ls < Zt && types$2[Ls] == 8 ? Ms == 1 ? 1 : 8 : 256;
        for (let zs = kr; zs < Ls; zs++)
          types$2[zs] = js;
        kr = Ls - 1;
      } else
        Ds == 8 && Ms == 1 && (types$2[kr] = 1);
      Yr = Ds, Ds & 7 && (Ms = Ds);
    }
  }
}
function processBracketPairs(_e, Qt, Zt, $n, Sn) {
  let kn = Sn == 1 ? 2 : 1;
  for (let Kn = 0, er = 0, Cr = 0; Kn <= $n.length; Kn++) {
    let kr = Kn ? $n[Kn - 1].to : Qt, Yr = Kn < $n.length ? $n[Kn].from : Zt;
    for (let Ms = kr, Ds, Ls, js; Ms < Yr; Ms++)
      if (Ls = Brackets[Ds = _e.charCodeAt(Ms)])
        if (Ls < 0) {
          for (let zs = er - 3; zs >= 0; zs -= 3)
            if (BracketStack[zs + 1] == -Ls) {
              let Fs = BracketStack[zs + 2], Bs = Fs & 2 ? Sn : Fs & 4 ? Fs & 1 ? kn : Sn : 0;
              Bs && (types$2[Ms] = types$2[BracketStack[zs]] = Bs), er = zs;
              break;
            }
        } else {
          if (BracketStack.length == 189)
            break;
          BracketStack[er++] = Ms, BracketStack[er++] = Ds, BracketStack[er++] = Cr;
        }
      else if ((js = types$2[Ms]) == 2 || js == 1) {
        let zs = js == Sn;
        Cr = zs ? 0 : 1;
        for (let Fs = er - 3; Fs >= 0; Fs -= 3) {
          let Bs = BracketStack[Fs + 2];
          if (Bs & 2)
            break;
          if (zs)
            BracketStack[Fs + 2] |= 2;
          else {
            if (Bs & 4)
              break;
            BracketStack[Fs + 2] |= 4;
          }
        }
      }
  }
}
function processNeutrals(_e, Qt, Zt, $n) {
  for (let Sn = 0, kn = $n; Sn <= Zt.length; Sn++) {
    let Kn = Sn ? Zt[Sn - 1].to : _e, er = Sn < Zt.length ? Zt[Sn].from : Qt;
    for (let Cr = Kn; Cr < er; ) {
      let kr = types$2[Cr];
      if (kr == 256) {
        let Yr = Cr + 1;
        for (; ; )
          if (Yr == er) {
            if (Sn == Zt.length)
              break;
            Yr = Zt[Sn++].to, er = Sn < Zt.length ? Zt[Sn].from : Qt;
          } else if (types$2[Yr] == 256)
            Yr++;
          else
            break;
        let Ms = kn == 1, Ds = (Yr < Qt ? types$2[Yr] : $n) == 1, Ls = Ms == Ds ? Ms ? 1 : 2 : $n;
        for (let js = Yr, zs = Sn, Fs = zs ? Zt[zs - 1].to : _e; js > Cr; )
          js == Fs && (js = Zt[--zs].from, Fs = zs ? Zt[zs - 1].to : _e), types$2[--js] = Ls;
        Cr = Yr;
      } else
        kn = kr, Cr++;
    }
  }
}
function emitSpans(_e, Qt, Zt, $n, Sn, kn, Kn) {
  let er = $n % 2 ? 2 : 1;
  if ($n % 2 == Sn % 2)
    for (let Cr = Qt, kr = 0; Cr < Zt; ) {
      let Yr = !0, Ms = !1;
      if (kr == kn.length || Cr < kn[kr].from) {
        let zs = types$2[Cr];
        zs != er && (Yr = !1, Ms = zs == 16);
      }
      let Ds = !Yr && er == 1 ? [] : null, Ls = Yr ? $n : $n + 1, js = Cr;
      e:
        for (; ; )
          if (kr < kn.length && js == kn[kr].from) {
            if (Ms)
              break e;
            let zs = kn[kr];
            if (!Yr)
              for (let Fs = zs.to, Bs = kr + 1; ; ) {
                if (Fs == Zt)
                  break e;
                if (Bs < kn.length && kn[Bs].from == Fs)
                  Fs = kn[Bs++].to;
                else {
                  if (types$2[Fs] == er)
                    break e;
                  break;
                }
              }
            if (kr++, Ds)
              Ds.push(zs);
            else {
              zs.from > Cr && Kn.push(new BidiSpan(Cr, zs.from, Ls));
              let Fs = zs.direction == LTR != !(Ls % 2);
              computeSectionOrder(_e, Fs ? $n + 1 : $n, Sn, zs.inner, zs.from, zs.to, Kn), Cr = zs.to;
            }
            js = zs.to;
          } else {
            if (js == Zt || (Yr ? types$2[js] != er : types$2[js] == er))
              break;
            js++;
          }
      Ds ? emitSpans(_e, Cr, js, $n + 1, Sn, Ds, Kn) : Cr < js && Kn.push(new BidiSpan(Cr, js, Ls)), Cr = js;
    }
  else
    for (let Cr = Zt, kr = kn.length; Cr > Qt; ) {
      let Yr = !0, Ms = !1;
      if (!kr || Cr > kn[kr - 1].to) {
        let zs = types$2[Cr - 1];
        zs != er && (Yr = !1, Ms = zs == 16);
      }
      let Ds = !Yr && er == 1 ? [] : null, Ls = Yr ? $n : $n + 1, js = Cr;
      e:
        for (; ; )
          if (kr && js == kn[kr - 1].to) {
            if (Ms)
              break e;
            let zs = kn[--kr];
            if (!Yr)
              for (let Fs = zs.from, Bs = kr; ; ) {
                if (Fs == Qt)
                  break e;
                if (Bs && kn[Bs - 1].to == Fs)
                  Fs = kn[--Bs].from;
                else {
                  if (types$2[Fs - 1] == er)
                    break e;
                  break;
                }
              }
            if (Ds)
              Ds.push(zs);
            else {
              zs.to < Cr && Kn.push(new BidiSpan(zs.to, Cr, Ls));
              let Fs = zs.direction == LTR != !(Ls % 2);
              computeSectionOrder(_e, Fs ? $n + 1 : $n, Sn, zs.inner, zs.from, zs.to, Kn), Cr = zs.from;
            }
            js = zs.from;
          } else {
            if (js == Qt || (Yr ? types$2[js - 1] != er : types$2[js - 1] == er))
              break;
            js--;
          }
      Ds ? emitSpans(_e, js, Cr, $n + 1, Sn, Ds, Kn) : js < Cr && Kn.push(new BidiSpan(js, Cr, Ls)), Cr = js;
    }
}
function computeSectionOrder(_e, Qt, Zt, $n, Sn, kn, Kn) {
  let er = Qt % 2 ? 2 : 1;
  computeCharTypes(_e, Sn, kn, $n, er), processBracketPairs(_e, Sn, kn, $n, er), processNeutrals(Sn, kn, $n, er), emitSpans(_e, Sn, kn, Qt, Zt, $n, Kn);
}
function computeOrder(_e, Qt, Zt) {
  if (!_e)
    return [new BidiSpan(0, 0, Qt == RTL ? 1 : 0)];
  if (Qt == LTR && !Zt.length && !BidiRE.test(_e))
    return trivialOrder(_e.length);
  if (Zt.length)
    for (; _e.length > types$2.length; )
      types$2[types$2.length] = 256;
  let $n = [], Sn = Qt == LTR ? 0 : 1;
  return computeSectionOrder(_e, Sn, Sn, Zt, 0, _e.length, $n), $n;
}
function trivialOrder(_e) {
  return [new BidiSpan(0, _e, 0)];
}
let movedOver = "";
function moveVisually(_e, Qt, Zt, $n, Sn) {
  var kn;
  let Kn = $n.head - _e.from, er = -1;
  if (Kn == 0) {
    if (!Sn || !_e.length)
      return null;
    Qt[0].level != Zt && (Kn = Qt[0].side(!1, Zt), er = 0);
  } else if (Kn == _e.length) {
    if (Sn)
      return null;
    let Ds = Qt[Qt.length - 1];
    Ds.level != Zt && (Kn = Ds.side(!0, Zt), er = Qt.length - 1);
  }
  er < 0 && (er = BidiSpan.find(Qt, Kn, (kn = $n.bidiLevel) !== null && kn !== void 0 ? kn : -1, $n.assoc));
  let Cr = Qt[er];
  Kn == Cr.side(Sn, Zt) && (Cr = Qt[er += Sn ? 1 : -1], Kn = Cr.side(!Sn, Zt));
  let kr = Sn == (Cr.dir == Zt), Yr = findClusterBreak(_e.text, Kn, kr);
  if (movedOver = _e.text.slice(Math.min(Kn, Yr), Math.max(Kn, Yr)), Yr != Cr.side(Sn, Zt))
    return EditorSelection.cursor(Yr + _e.from, kr ? -1 : 1, Cr.level);
  let Ms = er == (Sn ? Qt.length - 1 : 0) ? null : Qt[er + (Sn ? 1 : -1)];
  return !Ms && Cr.level != Zt ? EditorSelection.cursor(Sn ? _e.to : _e.from, Sn ? -1 : 1, Zt) : Ms && Ms.level < Cr.level ? EditorSelection.cursor(Ms.side(!Sn, Zt) + _e.from, Sn ? 1 : -1, Ms.level) : EditorSelection.cursor(Yr + _e.from, Sn ? -1 : 1, Cr.level);
}
class DocView extends ContentView {
  get length() {
    return this.view.state.doc.length;
  }
  constructor(Qt) {
    super(), this.view = Qt, this.decorations = [], this.dynamicDecorationMap = [], this.hasComposition = null, this.markedForComposition = /* @__PURE__ */ new Set(), this.minWidth = 0, this.minWidthFrom = 0, this.minWidthTo = 0, this.impreciseAnchor = null, this.impreciseHead = null, this.forceSelection = !1, this.lastUpdate = Date.now(), this.setDOM(Qt.contentDOM), this.children = [new LineView()], this.children[0].setParent(this), this.updateDeco(), this.updateInner([new ChangedRange(0, 0, 0, Qt.state.doc.length)], 0, null);
  }
  // Update the document view to a given state.
  update(Qt) {
    let Zt = Qt.changedRanges;
    this.minWidth > 0 && Zt.length && (Zt.every(({ fromA: er, toA: Cr }) => Cr < this.minWidthFrom || er > this.minWidthTo) ? (this.minWidthFrom = Qt.changes.mapPos(this.minWidthFrom, 1), this.minWidthTo = Qt.changes.mapPos(this.minWidthTo, 1)) : this.minWidth = this.minWidthFrom = this.minWidthTo = 0);
    let $n = this.view.inputState.composing < 0 ? null : findCompositionRange(this.view, Qt.changes);
    if (this.hasComposition) {
      this.markedForComposition.clear();
      let { from: er, to: Cr } = this.hasComposition;
      Zt = new ChangedRange(er, Cr, Qt.changes.mapPos(er, -1), Qt.changes.mapPos(Cr, 1)).addToSet(Zt.slice());
    }
    this.hasComposition = $n ? { from: $n.range.fromB, to: $n.range.toB } : null, (browser.ie || browser.chrome) && !$n && Qt && Qt.state.doc.lines != Qt.startState.doc.lines && (this.forceSelection = !0);
    let Sn = this.decorations, kn = this.updateDeco(), Kn = findChangedDeco(Sn, kn, Qt.changes);
    return Zt = ChangedRange.extendWithRanges(Zt, Kn), !(this.flags & 7) && Zt.length == 0 ? !1 : (this.updateInner(Zt, Qt.startState.doc.length, $n), Qt.transactions.length && (this.lastUpdate = Date.now()), !0);
  }
  // Used by update and the constructor do perform the actual DOM
  // update
  updateInner(Qt, Zt, $n) {
    this.view.viewState.mustMeasureContent = !0, this.updateChildren(Qt, Zt, $n);
    let { observer: Sn } = this.view;
    Sn.ignore(() => {
      this.dom.style.height = this.view.viewState.contentHeight + "px", this.dom.style.flexBasis = this.minWidth ? this.minWidth + "px" : "";
      let Kn = browser.chrome || browser.ios ? { node: Sn.selectionRange.focusNode, written: !1 } : void 0;
      this.sync(this.view, Kn), this.flags &= -8, Kn && (Kn.written || Sn.selectionRange.focusNode != Kn.node) && (this.forceSelection = !0), this.dom.style.height = "";
    }), this.markedForComposition.forEach(
      (Kn) => Kn.flags &= -9
      /* ViewFlag.Composition */
    );
    let kn = [];
    if (this.view.viewport.from || this.view.viewport.to < this.view.state.doc.length)
      for (let Kn of this.children)
        Kn instanceof BlockWidgetView && Kn.widget instanceof BlockGapWidget && kn.push(Kn.dom);
    Sn.updateGaps(kn);
  }
  updateChildren(Qt, Zt, $n) {
    let Sn = $n ? $n.range.addToSet(Qt.slice()) : Qt, kn = this.childCursor(Zt);
    for (let Kn = Sn.length - 1; ; Kn--) {
      let er = Kn >= 0 ? Sn[Kn] : null;
      if (!er)
        break;
      let { fromA: Cr, toA: kr, fromB: Yr, toB: Ms } = er, Ds, Ls, js, zs;
      if ($n && $n.range.fromB < Ms && $n.range.toB > Yr) {
        let Ys = ContentBuilder.build(this.view.state.doc, Yr, $n.range.fromB, this.decorations, this.dynamicDecorationMap), El = ContentBuilder.build(this.view.state.doc, $n.range.toB, Ms, this.decorations, this.dynamicDecorationMap);
        Ls = Ys.breakAtStart, js = Ys.openStart, zs = El.openEnd;
        let Mu = this.compositionView($n);
        El.breakAtStart ? Mu.breakAfter = 1 : El.content.length && Mu.merge(Mu.length, Mu.length, El.content[0], !1, El.openStart, 0) && (Mu.breakAfter = El.content[0].breakAfter, El.content.shift()), Ys.content.length && Mu.merge(0, 0, Ys.content[Ys.content.length - 1], !0, 0, Ys.openEnd) && Ys.content.pop(), Ds = Ys.content.concat(Mu).concat(El.content);
      } else
        ({ content: Ds, breakAtStart: Ls, openStart: js, openEnd: zs } = ContentBuilder.build(this.view.state.doc, Yr, Ms, this.decorations, this.dynamicDecorationMap));
      let { i: Fs, off: Bs } = kn.findPos(kr, 1), { i: Hs, off: Ws } = kn.findPos(Cr, -1);
      replaceRange(this, Hs, Ws, Fs, Bs, Ds, Ls, js, zs);
    }
    $n && this.fixCompositionDOM($n);
  }
  compositionView(Qt) {
    let Zt = new TextView(Qt.text.nodeValue);
    Zt.flags |= 8;
    for (let { deco: Sn } of Qt.marks)
      Zt = new MarkView(Sn, [Zt], Zt.length);
    let $n = new LineView();
    return $n.append(Zt, 0), $n;
  }
  fixCompositionDOM(Qt) {
    let Zt = (kn, Kn) => {
      Kn.flags |= 8, this.markedForComposition.add(Kn);
      let er = ContentView.get(kn);
      er != Kn && (er && (er.dom = null), Kn.setDOM(kn));
    }, $n = this.childPos(Qt.range.fromB, 1), Sn = this.children[$n.i];
    Zt(Qt.line, Sn);
    for (let kn = Qt.marks.length - 1; kn >= -1; kn--)
      $n = Sn.childPos($n.off, 1), Sn = Sn.children[$n.i], Zt(kn >= 0 ? Qt.marks[kn].node : Qt.text, Sn);
  }
  // Sync the DOM selection to this.state.selection
  updateSelection(Qt = !1, Zt = !1) {
    (Qt || !this.view.observer.selectionRange.focusNode) && this.view.observer.readSelectionRange();
    let $n = this.view.root.activeElement, Sn = $n == this.dom, kn = !Sn && hasSelection(this.dom, this.view.observer.selectionRange) && !($n && this.dom.contains($n));
    if (!(Sn || Zt || kn))
      return;
    let Kn = this.forceSelection;
    this.forceSelection = !1;
    let er = this.view.state.selection.main, Cr = this.domAtPos(er.anchor), kr = er.empty ? Cr : this.domAtPos(er.head);
    if (browser.gecko && er.empty && !this.hasComposition && betweenUneditable(Cr)) {
      let Ms = document.createTextNode("");
      this.view.observer.ignore(() => Cr.node.insertBefore(Ms, Cr.node.childNodes[Cr.offset] || null)), Cr = kr = new DOMPos(Ms, 0), Kn = !0;
    }
    let Yr = this.view.observer.selectionRange;
    (Kn || !Yr.focusNode || !isEquivalentPosition(Cr.node, Cr.offset, Yr.anchorNode, Yr.anchorOffset) || !isEquivalentPosition(kr.node, kr.offset, Yr.focusNode, Yr.focusOffset)) && (this.view.observer.ignore(() => {
      browser.android && browser.chrome && this.dom.contains(Yr.focusNode) && inUneditable(Yr.focusNode, this.dom) && (this.dom.blur(), this.dom.focus({ preventScroll: !0 }));
      let Ms = getSelection(this.view.root);
      if (Ms)
        if (er.empty) {
          if (browser.gecko) {
            let Ds = nextToUneditable(Cr.node, Cr.offset);
            if (Ds && Ds != 3) {
              let Ls = nearbyTextNode(Cr.node, Cr.offset, Ds == 1 ? 1 : -1);
              Ls && (Cr = new DOMPos(Ls, Ds == 1 ? 0 : Ls.nodeValue.length));
            }
          }
          Ms.collapse(Cr.node, Cr.offset), er.bidiLevel != null && Yr.caretBidiLevel != null && (Yr.caretBidiLevel = er.bidiLevel);
        } else if (Ms.extend) {
          Ms.collapse(Cr.node, Cr.offset);
          try {
            Ms.extend(kr.node, kr.offset);
          } catch {
          }
        } else {
          let Ds = document.createRange();
          er.anchor > er.head && ([Cr, kr] = [kr, Cr]), Ds.setEnd(kr.node, kr.offset), Ds.setStart(Cr.node, Cr.offset), Ms.removeAllRanges(), Ms.addRange(Ds);
        }
      kn && this.view.root.activeElement == this.dom && (this.dom.blur(), $n && $n.focus());
    }), this.view.observer.setSelectionRange(Cr, kr)), this.impreciseAnchor = Cr.precise ? null : new DOMPos(Yr.anchorNode, Yr.anchorOffset), this.impreciseHead = kr.precise ? null : new DOMPos(Yr.focusNode, Yr.focusOffset);
  }
  enforceCursorAssoc() {
    if (this.hasComposition)
      return;
    let { view: Qt } = this, Zt = Qt.state.selection.main, $n = getSelection(Qt.root), { anchorNode: Sn, anchorOffset: kn } = Qt.observer.selectionRange;
    if (!$n || !Zt.empty || !Zt.assoc || !$n.modify)
      return;
    let Kn = LineView.find(this, Zt.head);
    if (!Kn)
      return;
    let er = Kn.posAtStart;
    if (Zt.head == er || Zt.head == er + Kn.length)
      return;
    let Cr = this.coordsAt(Zt.head, -1), kr = this.coordsAt(Zt.head, 1);
    if (!Cr || !kr || Cr.bottom > kr.top)
      return;
    let Yr = this.domAtPos(Zt.head + Zt.assoc);
    $n.collapse(Yr.node, Yr.offset), $n.modify("move", Zt.assoc < 0 ? "forward" : "backward", "lineboundary"), Qt.observer.readSelectionRange();
    let Ms = Qt.observer.selectionRange;
    Qt.docView.posFromDOM(Ms.anchorNode, Ms.anchorOffset) != Zt.from && $n.collapse(Sn, kn);
  }
  nearest(Qt) {
    for (let Zt = Qt; Zt; ) {
      let $n = ContentView.get(Zt);
      if ($n && $n.rootView == this)
        return $n;
      Zt = Zt.parentNode;
    }
    return null;
  }
  posFromDOM(Qt, Zt) {
    let $n = this.nearest(Qt);
    if (!$n)
      throw new RangeError("Trying to find position for a DOM position outside of the document");
    return $n.localPosFromDOM(Qt, Zt) + $n.posAtStart;
  }
  domAtPos(Qt) {
    let { i: Zt, off: $n } = this.childCursor().findPos(Qt, -1);
    for (; Zt < this.children.length - 1; ) {
      let Sn = this.children[Zt];
      if ($n < Sn.length || Sn instanceof LineView)
        break;
      Zt++, $n = 0;
    }
    return this.children[Zt].domAtPos($n);
  }
  coordsAt(Qt, Zt) {
    for (let $n = this.length, Sn = this.children.length - 1; ; Sn--) {
      let kn = this.children[Sn], Kn = $n - kn.breakAfter - kn.length;
      if (Qt > Kn || Qt == Kn && kn.type != BlockType.WidgetBefore && kn.type != BlockType.WidgetAfter && (!Sn || Zt == 2 || this.children[Sn - 1].breakAfter || this.children[Sn - 1].type == BlockType.WidgetBefore && Zt > -2))
        return kn.coordsAt(Qt - Kn, Zt);
      $n = Kn;
    }
  }
  coordsForChar(Qt) {
    let { i: Zt, off: $n } = this.childPos(Qt, 1), Sn = this.children[Zt];
    if (!(Sn instanceof LineView))
      return null;
    for (; Sn.children.length; ) {
      let { i: er, off: Cr } = Sn.childPos($n, 1);
      for (; ; er++) {
        if (er == Sn.children.length)
          return null;
        if ((Sn = Sn.children[er]).length)
          break;
      }
      $n = Cr;
    }
    if (!(Sn instanceof TextView))
      return null;
    let kn = findClusterBreak(Sn.text, $n);
    if (kn == $n)
      return null;
    let Kn = textRange(Sn.dom, $n, kn).getClientRects();
    return !Kn.length || Kn[0].top >= Kn[0].bottom ? null : Kn[0];
  }
  measureVisibleLineHeights(Qt) {
    let Zt = [], { from: $n, to: Sn } = Qt, kn = this.view.contentDOM.clientWidth, Kn = kn > Math.max(this.view.scrollDOM.clientWidth, this.minWidth) + 1, er = -1, Cr = this.view.textDirection == Direction.LTR;
    for (let kr = 0, Yr = 0; Yr < this.children.length; Yr++) {
      let Ms = this.children[Yr], Ds = kr + Ms.length;
      if (Ds > Sn)
        break;
      if (kr >= $n) {
        let Ls = Ms.dom.getBoundingClientRect();
        if (Zt.push(Ls.height), Kn) {
          let js = Ms.dom.lastChild, zs = js ? clientRectsFor(js) : [];
          if (zs.length) {
            let Fs = zs[zs.length - 1], Bs = Cr ? Fs.right - Ls.left : Ls.right - Fs.left;
            Bs > er && (er = Bs, this.minWidth = kn, this.minWidthFrom = kr, this.minWidthTo = Ds);
          }
        }
      }
      kr = Ds + Ms.breakAfter;
    }
    return Zt;
  }
  textDirectionAt(Qt) {
    let { i: Zt } = this.childPos(Qt, 1);
    return getComputedStyle(this.children[Zt].dom).direction == "rtl" ? Direction.RTL : Direction.LTR;
  }
  measureTextSize() {
    for (let kn of this.children)
      if (kn instanceof LineView) {
        let Kn = kn.measureTextSize();
        if (Kn)
          return Kn;
      }
    let Qt = document.createElement("div"), Zt, $n, Sn;
    return Qt.className = "cm-line", Qt.style.width = "99999px", Qt.style.position = "absolute", Qt.textContent = "abc def ghi jkl mno pqr stu", this.view.observer.ignore(() => {
      this.dom.appendChild(Qt);
      let kn = clientRectsFor(Qt.firstChild)[0];
      Zt = Qt.getBoundingClientRect().height, $n = kn ? kn.width / 27 : 7, Sn = kn ? kn.height : Zt, Qt.remove();
    }), { lineHeight: Zt, charWidth: $n, textHeight: Sn };
  }
  childCursor(Qt = this.length) {
    let Zt = this.children.length;
    return Zt && (Qt -= this.children[--Zt].length), new ChildCursor(this.children, Qt, Zt);
  }
  computeBlockGapDeco() {
    let Qt = [], Zt = this.view.viewState;
    for (let $n = 0, Sn = 0; ; Sn++) {
      let kn = Sn == Zt.viewports.length ? null : Zt.viewports[Sn], Kn = kn ? kn.from - 1 : this.length;
      if (Kn > $n) {
        let er = Zt.lineBlockAt(Kn).bottom - Zt.lineBlockAt($n).top;
        Qt.push(Decoration.replace({
          widget: new BlockGapWidget(er),
          block: !0,
          inclusive: !0,
          isBlockGap: !0
        }).range($n, Kn));
      }
      if (!kn)
        break;
      $n = kn.to + 1;
    }
    return Decoration.set(Qt);
  }
  updateDeco() {
    let Qt = this.view.state.facet(decorations).map((Zt, $n) => (this.dynamicDecorationMap[$n] = typeof Zt == "function") ? Zt(this.view) : Zt);
    for (let Zt = Qt.length; Zt < Qt.length + 3; Zt++)
      this.dynamicDecorationMap[Zt] = !1;
    return this.decorations = [
      ...Qt,
      this.computeBlockGapDeco(),
      this.view.viewState.lineGapDeco
    ];
  }
  scrollIntoView(Qt) {
    let { range: Zt } = Qt, $n = this.coordsAt(Zt.head, Zt.empty ? Zt.assoc : Zt.head > Zt.anchor ? -1 : 1), Sn;
    if (!$n)
      return;
    !Zt.empty && (Sn = this.coordsAt(Zt.anchor, Zt.anchor > Zt.head ? -1 : 1)) && ($n = {
      left: Math.min($n.left, Sn.left),
      top: Math.min($n.top, Sn.top),
      right: Math.max($n.right, Sn.right),
      bottom: Math.max($n.bottom, Sn.bottom)
    });
    let kn = getScrollMargins(this.view), Kn = {
      left: $n.left - kn.left,
      top: $n.top - kn.top,
      right: $n.right + kn.right,
      bottom: $n.bottom + kn.bottom
    };
    scrollRectIntoView(this.view.scrollDOM, Kn, Zt.head < Zt.anchor ? -1 : 1, Qt.x, Qt.y, Qt.xMargin, Qt.yMargin, this.view.textDirection == Direction.LTR);
  }
}
function betweenUneditable(_e) {
  return _e.node.nodeType == 1 && _e.node.firstChild && (_e.offset == 0 || _e.node.childNodes[_e.offset - 1].contentEditable == "false") && (_e.offset == _e.node.childNodes.length || _e.node.childNodes[_e.offset].contentEditable == "false");
}
class BlockGapWidget extends WidgetType {
  constructor(Qt) {
    super(), this.height = Qt;
  }
  toDOM() {
    let Qt = document.createElement("div");
    return this.updateDOM(Qt), Qt;
  }
  eq(Qt) {
    return Qt.height == this.height;
  }
  updateDOM(Qt) {
    return Qt.style.height = this.height + "px", !0;
  }
  get estimatedHeight() {
    return this.height;
  }
}
function findCompositionNode(_e, Qt) {
  let Zt = _e.observer.selectionRange, $n = Zt.focusNode && nearbyTextNode(Zt.focusNode, Zt.focusOffset, 0);
  if (!$n)
    return null;
  let Sn = ContentView.get($n), kn, Kn;
  if (Sn instanceof TextView)
    kn = Sn.posAtStart, Kn = kn + Sn.length;
  else {
    let er = Math.max(0, $n.nodeValue.length - Qt);
    e:
      for (let Cr = 0, kr = $n; ; ) {
        for (let Ms = kr.previousSibling, Ds; Ms; Ms = Ms.previousSibling) {
          if (Ds = ContentView.get(Ms)) {
            Kn = Ds.posAtEnd + Cr, kn = Math.max(0, Kn - er);
            break e;
          }
          let Ls = new DOMReader([], _e.state);
          if (Ls.readNode(Ms), Ls.text.indexOf(LineBreakPlaceholder) > -1)
            return null;
          Cr += Ls.text.length;
        }
        if (kr = kr.parentNode, !kr)
          return null;
        let Yr = ContentView.get(kr);
        if (Yr) {
          kn = Yr.posAtStart + Cr, Kn = kn + er;
          break;
        }
      }
  }
  return { from: kn, to: Kn, node: $n };
}
function findCompositionRange(_e, Qt) {
  let Zt = findCompositionNode(_e, Qt.newLength - Qt.length);
  if (!Zt)
    return null;
  let { from: $n, to: Sn, node: kn } = Zt, Kn = Qt.mapPos($n, -1), er = Qt.mapPos(Sn, 1), Cr = kn.nodeValue;
  if (/[\n\r]/.test(Cr))
    return null;
  if (er - Kn != Cr.length) {
    let Ds = Qt.mapPos($n, 1), Ls = Qt.mapPos(Sn, -1);
    if (Ls - Ds == Cr.length)
      Kn = Ds, er = Ls;
    else if (_e.state.doc.sliceString(er - Cr.length, er) == Cr)
      Kn = er - Cr.length;
    else if (_e.state.doc.sliceString(Kn, Kn + Cr.length) == Cr)
      er = Kn + Cr.length;
    else
      return null;
  }
  let { main: kr } = _e.state.selection;
  if (_e.state.doc.sliceString(Kn, er) != Cr || Kn > kr.head || er < kr.head)
    return null;
  let Yr = [], Ms = new ChangedRange($n, Sn, Kn, er);
  for (let Ds = kn.parentNode; ; Ds = Ds.parentNode) {
    let Ls = ContentView.get(Ds);
    if (Ls instanceof MarkView)
      Yr.push({ node: Ds, deco: Ls.mark });
    else {
      if (Ls instanceof LineView || Ds.nodeName == "DIV" && Ds.parentNode == _e.contentDOM)
        return { range: Ms, text: kn, marks: Yr, line: Ds };
      if (Ds != _e.contentDOM)
        Yr.push({ node: Ds, deco: new MarkDecoration({
          inclusive: !0,
          attributes: getAttrs(Ds),
          tagName: Ds.tagName.toLowerCase()
        }) });
      else
        return null;
    }
  }
}
function nearbyTextNode(_e, Qt, Zt) {
  if (Zt <= 0)
    for (let $n = _e, Sn = Qt; ; ) {
      if ($n.nodeType == 3)
        return $n;
      if ($n.nodeType == 1 && Sn > 0)
        $n = $n.childNodes[Sn - 1], Sn = maxOffset($n);
      else
        break;
    }
  if (Zt >= 0)
    for (let $n = _e, Sn = Qt; ; ) {
      if ($n.nodeType == 3)
        return $n;
      if ($n.nodeType == 1 && Sn < $n.childNodes.length && Zt >= 0)
        $n = $n.childNodes[Sn], Sn = 0;
      else
        break;
    }
  return null;
}
function nextToUneditable(_e, Qt) {
  return _e.nodeType != 1 ? 0 : (Qt && _e.childNodes[Qt - 1].contentEditable == "false" ? 1 : 0) | (Qt < _e.childNodes.length && _e.childNodes[Qt].contentEditable == "false" ? 2 : 0);
}
let DecorationComparator$1 = class {
  constructor() {
    this.changes = [];
  }
  compareRange(Qt, Zt) {
    addRange(Qt, Zt, this.changes);
  }
  comparePoint(Qt, Zt) {
    addRange(Qt, Zt, this.changes);
  }
};
function findChangedDeco(_e, Qt, Zt) {
  let $n = new DecorationComparator$1();
  return RangeSet.compare(_e, Qt, Zt, $n), $n.changes;
}
function inUneditable(_e, Qt) {
  for (let Zt = _e; Zt && Zt != Qt; Zt = Zt.assignedSlot || Zt.parentNode)
    if (Zt.nodeType == 1 && Zt.contentEditable == "false")
      return !0;
  return !1;
}
function groupAt(_e, Qt, Zt = 1) {
  let $n = _e.charCategorizer(Qt), Sn = _e.doc.lineAt(Qt), kn = Qt - Sn.from;
  if (Sn.length == 0)
    return EditorSelection.cursor(Qt);
  kn == 0 ? Zt = 1 : kn == Sn.length && (Zt = -1);
  let Kn = kn, er = kn;
  Zt < 0 ? Kn = findClusterBreak(Sn.text, kn, !1) : er = findClusterBreak(Sn.text, kn);
  let Cr = $n(Sn.text.slice(Kn, er));
  for (; Kn > 0; ) {
    let kr = findClusterBreak(Sn.text, Kn, !1);
    if ($n(Sn.text.slice(kr, Kn)) != Cr)
      break;
    Kn = kr;
  }
  for (; er < Sn.length; ) {
    let kr = findClusterBreak(Sn.text, er);
    if ($n(Sn.text.slice(er, kr)) != Cr)
      break;
    er = kr;
  }
  return EditorSelection.range(Kn + Sn.from, er + Sn.from);
}
function getdx(_e, Qt) {
  return Qt.left > _e ? Qt.left - _e : Math.max(0, _e - Qt.right);
}
function getdy(_e, Qt) {
  return Qt.top > _e ? Qt.top - _e : Math.max(0, _e - Qt.bottom);
}
function yOverlap(_e, Qt) {
  return _e.top < Qt.bottom - 1 && _e.bottom > Qt.top + 1;
}
function upTop(_e, Qt) {
  return Qt < _e.top ? { top: Qt, left: _e.left, right: _e.right, bottom: _e.bottom } : _e;
}
function upBot(_e, Qt) {
  return Qt > _e.bottom ? { top: _e.top, left: _e.left, right: _e.right, bottom: Qt } : _e;
}
function domPosAtCoords(_e, Qt, Zt) {
  let $n, Sn, kn, Kn, er = !1, Cr, kr, Yr, Ms;
  for (let js = _e.firstChild; js; js = js.nextSibling) {
    let zs = clientRectsFor(js);
    for (let Fs = 0; Fs < zs.length; Fs++) {
      let Bs = zs[Fs];
      Sn && yOverlap(Sn, Bs) && (Bs = upTop(upBot(Bs, Sn.bottom), Sn.top));
      let Hs = getdx(Qt, Bs), Ws = getdy(Zt, Bs);
      if (Hs == 0 && Ws == 0)
        return js.nodeType == 3 ? domPosInText(js, Qt, Zt) : domPosAtCoords(js, Qt, Zt);
      if (!$n || Kn > Ws || Kn == Ws && kn > Hs) {
        $n = js, Sn = Bs, kn = Hs, Kn = Ws;
        let Ys = Ws ? Zt < Bs.top ? -1 : 1 : Hs ? Qt < Bs.left ? -1 : 1 : 0;
        er = !Ys || (Ys > 0 ? Fs < zs.length - 1 : Fs > 0);
      }
      Hs == 0 ? Zt > Bs.bottom && (!Yr || Yr.bottom < Bs.bottom) ? (Cr = js, Yr = Bs) : Zt < Bs.top && (!Ms || Ms.top > Bs.top) && (kr = js, Ms = Bs) : Yr && yOverlap(Yr, Bs) ? Yr = upBot(Yr, Bs.bottom) : Ms && yOverlap(Ms, Bs) && (Ms = upTop(Ms, Bs.top));
    }
  }
  if (Yr && Yr.bottom >= Zt ? ($n = Cr, Sn = Yr) : Ms && Ms.top <= Zt && ($n = kr, Sn = Ms), !$n)
    return { node: _e, offset: 0 };
  let Ds = Math.max(Sn.left, Math.min(Sn.right, Qt));
  if ($n.nodeType == 3)
    return domPosInText($n, Ds, Zt);
  if (er && $n.contentEditable != "false")
    return domPosAtCoords($n, Ds, Zt);
  let Ls = Array.prototype.indexOf.call(_e.childNodes, $n) + (Qt >= (Sn.left + Sn.right) / 2 ? 1 : 0);
  return { node: _e, offset: Ls };
}
function domPosInText(_e, Qt, Zt) {
  let $n = _e.nodeValue.length, Sn = -1, kn = 1e9, Kn = 0;
  for (let er = 0; er < $n; er++) {
    let Cr = textRange(_e, er, er + 1).getClientRects();
    for (let kr = 0; kr < Cr.length; kr++) {
      let Yr = Cr[kr];
      if (Yr.top == Yr.bottom)
        continue;
      Kn || (Kn = Qt - Yr.left);
      let Ms = (Yr.top > Zt ? Yr.top - Zt : Zt - Yr.bottom) - 1;
      if (Yr.left - 1 <= Qt && Yr.right + 1 >= Qt && Ms < kn) {
        let Ds = Qt >= (Yr.left + Yr.right) / 2, Ls = Ds;
        if ((browser.chrome || browser.gecko) && textRange(_e, er).getBoundingClientRect().left == Yr.right && (Ls = !Ds), Ms <= 0)
          return { node: _e, offset: er + (Ls ? 1 : 0) };
        Sn = er + (Ls ? 1 : 0), kn = Ms;
      }
    }
  }
  return { node: _e, offset: Sn > -1 ? Sn : Kn > 0 ? _e.nodeValue.length : 0 };
}
function posAtCoords(_e, Qt, Zt, $n = -1) {
  var Sn, kn;
  let Kn = _e.contentDOM.getBoundingClientRect(), er = Kn.top + _e.viewState.paddingTop, Cr, { docHeight: kr } = _e.viewState, { x: Yr, y: Ms } = Qt, Ds = Ms - er;
  if (Ds < 0)
    return 0;
  if (Ds > kr)
    return _e.state.doc.length;
  for (let Ys = _e.viewState.heightOracle.textHeight / 2, El = !1; Cr = _e.elementAtHeight(Ds), Cr.type != BlockType.Text; )
    for (; Ds = $n > 0 ? Cr.bottom + Ys : Cr.top - Ys, !(Ds >= 0 && Ds <= kr); ) {
      if (El)
        return Zt ? null : 0;
      El = !0, $n = -$n;
    }
  Ms = er + Ds;
  let Ls = Cr.from;
  if (Ls < _e.viewport.from)
    return _e.viewport.from == 0 ? 0 : Zt ? null : posAtCoordsImprecise(_e, Kn, Cr, Yr, Ms);
  if (Ls > _e.viewport.to)
    return _e.viewport.to == _e.state.doc.length ? _e.state.doc.length : Zt ? null : posAtCoordsImprecise(_e, Kn, Cr, Yr, Ms);
  let js = _e.dom.ownerDocument, zs = _e.root.elementFromPoint ? _e.root : js, Fs = zs.elementFromPoint(Yr, Ms);
  Fs && !_e.contentDOM.contains(Fs) && (Fs = null), Fs || (Yr = Math.max(Kn.left + 1, Math.min(Kn.right - 1, Yr)), Fs = zs.elementFromPoint(Yr, Ms), Fs && !_e.contentDOM.contains(Fs) && (Fs = null));
  let Bs, Hs = -1;
  if (Fs && ((Sn = _e.docView.nearest(Fs)) === null || Sn === void 0 ? void 0 : Sn.isEditable) != !1) {
    if (js.caretPositionFromPoint) {
      let Ys = js.caretPositionFromPoint(Yr, Ms);
      Ys && ({ offsetNode: Bs, offset: Hs } = Ys);
    } else if (js.caretRangeFromPoint) {
      let Ys = js.caretRangeFromPoint(Yr, Ms);
      Ys && ({ startContainer: Bs, startOffset: Hs } = Ys, (!_e.contentDOM.contains(Bs) || browser.safari && isSuspiciousSafariCaretResult(Bs, Hs, Yr) || browser.chrome && isSuspiciousChromeCaretResult(Bs, Hs, Yr)) && (Bs = void 0));
    }
  }
  if (!Bs || !_e.docView.dom.contains(Bs)) {
    let Ys = LineView.find(_e.docView, Ls);
    if (!Ys)
      return Ds > Cr.top + Cr.height / 2 ? Cr.to : Cr.from;
    ({ node: Bs, offset: Hs } = domPosAtCoords(Ys.dom, Yr, Ms));
  }
  let Ws = _e.docView.nearest(Bs);
  if (!Ws)
    return null;
  if (Ws.isWidget && ((kn = Ws.dom) === null || kn === void 0 ? void 0 : kn.nodeType) == 1) {
    let Ys = Ws.dom.getBoundingClientRect();
    return Qt.y < Ys.top || Qt.y <= Ys.bottom && Qt.x <= (Ys.left + Ys.right) / 2 ? Ws.posAtStart : Ws.posAtEnd;
  } else
    return Ws.localPosFromDOM(Bs, Hs) + Ws.posAtStart;
}
function posAtCoordsImprecise(_e, Qt, Zt, $n, Sn) {
  let kn = Math.round(($n - Qt.left) * _e.defaultCharacterWidth);
  if (_e.lineWrapping && Zt.height > _e.defaultLineHeight * 1.5) {
    let er = _e.viewState.heightOracle.textHeight, Cr = Math.floor((Sn - Zt.top - (_e.defaultLineHeight - er) * 0.5) / er);
    kn += Cr * _e.viewState.heightOracle.lineLength;
  }
  let Kn = _e.state.sliceDoc(Zt.from, Zt.to);
  return Zt.from + findColumn(Kn, kn, _e.state.tabSize);
}
function isSuspiciousSafariCaretResult(_e, Qt, Zt) {
  let $n;
  if (_e.nodeType != 3 || Qt != ($n = _e.nodeValue.length))
    return !1;
  for (let Sn = _e.nextSibling; Sn; Sn = Sn.nextSibling)
    if (Sn.nodeType != 1 || Sn.nodeName != "BR")
      return !1;
  return textRange(_e, $n - 1, $n).getBoundingClientRect().left > Zt;
}
function isSuspiciousChromeCaretResult(_e, Qt, Zt) {
  if (Qt != 0)
    return !1;
  for (let Sn = _e; ; ) {
    let kn = Sn.parentNode;
    if (!kn || kn.nodeType != 1 || kn.firstChild != Sn)
      return !1;
    if (kn.classList.contains("cm-line"))
      break;
    Sn = kn;
  }
  let $n = _e.nodeType == 1 ? _e.getBoundingClientRect() : textRange(_e, 0, Math.max(_e.nodeValue.length, 1)).getBoundingClientRect();
  return Zt - $n.left > 5;
}
function blockAt(_e, Qt) {
  let Zt = _e.lineBlockAt(Qt);
  if (Array.isArray(Zt.type)) {
    for (let $n of Zt.type)
      if ($n.to > Qt || $n.to == Qt && ($n.to == Zt.to || $n.type == BlockType.Text))
        return $n;
  }
  return Zt;
}
function moveToLineBoundary(_e, Qt, Zt, $n) {
  let Sn = blockAt(_e, Qt.head), kn = !$n || Sn.type != BlockType.Text || !(_e.lineWrapping || Sn.widgetLineBreaks) ? null : _e.coordsAtPos(Qt.assoc < 0 && Qt.head > Sn.from ? Qt.head - 1 : Qt.head);
  if (kn) {
    let Kn = _e.dom.getBoundingClientRect(), er = _e.textDirectionAt(Sn.from), Cr = _e.posAtCoords({
      x: Zt == (er == Direction.LTR) ? Kn.right - 1 : Kn.left + 1,
      y: (kn.top + kn.bottom) / 2
    });
    if (Cr != null)
      return EditorSelection.cursor(Cr, Zt ? -1 : 1);
  }
  return EditorSelection.cursor(Zt ? Sn.to : Sn.from, Zt ? -1 : 1);
}
function moveByChar(_e, Qt, Zt, $n) {
  let Sn = _e.state.doc.lineAt(Qt.head), kn = _e.bidiSpans(Sn), Kn = _e.textDirectionAt(Sn.from);
  for (let er = Qt, Cr = null; ; ) {
    let kr = moveVisually(Sn, kn, Kn, er, Zt), Yr = movedOver;
    if (!kr) {
      if (Sn.number == (Zt ? _e.state.doc.lines : 1))
        return er;
      Yr = `
`, Sn = _e.state.doc.line(Sn.number + (Zt ? 1 : -1)), kn = _e.bidiSpans(Sn), kr = EditorSelection.cursor(Zt ? Sn.from : Sn.to);
    }
    if (Cr) {
      if (!Cr(Yr))
        return er;
    } else {
      if (!$n)
        return kr;
      Cr = $n(Yr);
    }
    er = kr;
  }
}
function byGroup(_e, Qt, Zt) {
  let $n = _e.state.charCategorizer(Qt), Sn = $n(Zt);
  return (kn) => {
    let Kn = $n(kn);
    return Sn == CharCategory.Space && (Sn = Kn), Sn == Kn;
  };
}
function moveVertically(_e, Qt, Zt, $n) {
  let Sn = Qt.head, kn = Zt ? 1 : -1;
  if (Sn == (Zt ? _e.state.doc.length : 0))
    return EditorSelection.cursor(Sn, Qt.assoc);
  let Kn = Qt.goalColumn, er, Cr = _e.contentDOM.getBoundingClientRect(), kr = _e.coordsAtPos(Sn), Yr = _e.documentTop;
  if (kr)
    Kn == null && (Kn = kr.left - Cr.left), er = kn < 0 ? kr.top : kr.bottom;
  else {
    let Ls = _e.viewState.lineBlockAt(Sn);
    Kn == null && (Kn = Math.min(Cr.right - Cr.left, _e.defaultCharacterWidth * (Sn - Ls.from))), er = (kn < 0 ? Ls.top : Ls.bottom) + Yr;
  }
  let Ms = Cr.left + Kn, Ds = $n ?? _e.viewState.heightOracle.textHeight >> 1;
  for (let Ls = 0; ; Ls += 10) {
    let js = er + (Ds + Ls) * kn, zs = posAtCoords(_e, { x: Ms, y: js }, !1, kn);
    if (js < Cr.top || js > Cr.bottom || (kn < 0 ? zs < Sn : zs > Sn))
      return EditorSelection.cursor(zs, Qt.assoc, void 0, Kn);
  }
}
function skipAtomicRanges(_e, Qt, Zt) {
  for (; ; ) {
    let $n = 0;
    for (let Sn of _e)
      Sn.between(Qt - 1, Qt + 1, (kn, Kn, er) => {
        if (Qt > kn && Qt < Kn) {
          let Cr = $n || Zt || (Qt - kn < Kn - Qt ? -1 : 1);
          Qt = Cr < 0 ? kn : Kn, $n = Cr;
        }
      });
    if (!$n)
      return Qt;
  }
}
function skipAtoms(_e, Qt, Zt) {
  let $n = skipAtomicRanges(_e.state.facet(atomicRanges).map((Sn) => Sn(_e)), Zt.from, Qt.head > Zt.from ? -1 : 1);
  return $n == Zt.from ? Zt : EditorSelection.cursor($n, $n < Zt.from ? 1 : -1);
}
class InputState {
  setSelectionOrigin(Qt) {
    this.lastSelectionOrigin = Qt, this.lastSelectionTime = Date.now();
  }
  constructor(Qt) {
    this.lastKeyCode = 0, this.lastKeyTime = 0, this.lastTouchTime = 0, this.lastFocusTime = 0, this.lastScrollTop = 0, this.lastScrollLeft = 0, this.chromeScrollHack = -1, this.pendingIOSKey = void 0, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastEscPress = 0, this.lastContextMenu = 0, this.scrollHandlers = [], this.registeredEvents = [], this.customHandlers = [], this.composing = -1, this.compositionFirstChange = null, this.compositionEndedAt = 0, this.compositionPendingKey = !1, this.compositionPendingChange = !1, this.mouseSelection = null;
    let Zt = ($n, Sn) => {
      this.ignoreDuringComposition(Sn) || Sn.type == "keydown" && this.keydown(Qt, Sn) || (this.mustFlushObserver(Sn) && Qt.observer.forceFlush(), this.runCustomHandlers(Sn.type, Qt, Sn) ? Sn.preventDefault() : $n(Qt, Sn));
    };
    for (let $n in handlers) {
      let Sn = handlers[$n];
      Qt.contentDOM.addEventListener($n, (kn) => {
        eventBelongsToEditor(Qt, kn) && Zt(Sn, kn);
      }, handlerOptions[$n]), this.registeredEvents.push($n);
    }
    Qt.scrollDOM.addEventListener("mousedown", ($n) => {
      if ($n.target == Qt.scrollDOM && $n.clientY > Qt.contentDOM.getBoundingClientRect().bottom && (Zt(handlers.mousedown, $n), !$n.defaultPrevented && $n.button == 2)) {
        let Sn = Qt.contentDOM.style.minHeight;
        Qt.contentDOM.style.minHeight = "100%", setTimeout(() => Qt.contentDOM.style.minHeight = Sn, 200);
      }
    }), Qt.scrollDOM.addEventListener("drop", ($n) => {
      $n.target == Qt.scrollDOM && $n.clientY > Qt.contentDOM.getBoundingClientRect().bottom && Zt(handlers.drop, $n);
    }), browser.chrome && browser.chrome_version == 102 && Qt.scrollDOM.addEventListener("wheel", () => {
      this.chromeScrollHack < 0 ? Qt.contentDOM.style.pointerEvents = "none" : window.clearTimeout(this.chromeScrollHack), this.chromeScrollHack = setTimeout(() => {
        this.chromeScrollHack = -1, Qt.contentDOM.style.pointerEvents = "";
      }, 100);
    }, { passive: !0 }), this.notifiedFocused = Qt.hasFocus, browser.safari && Qt.contentDOM.addEventListener("input", () => null), browser.gecko && firefoxCopyCutHack(Qt.contentDOM.ownerDocument);
  }
  ensureHandlers(Qt, Zt) {
    var $n;
    let Sn;
    this.customHandlers = [];
    for (let kn of Zt)
      if (Sn = ($n = kn.update(Qt).spec) === null || $n === void 0 ? void 0 : $n.domEventHandlers) {
        this.customHandlers.push({ plugin: kn.value, handlers: Sn });
        for (let Kn in Sn)
          this.registeredEvents.indexOf(Kn) < 0 && Kn != "scroll" && (this.registeredEvents.push(Kn), Qt.contentDOM.addEventListener(Kn, (er) => {
            eventBelongsToEditor(Qt, er) && this.runCustomHandlers(Kn, Qt, er) && er.preventDefault();
          }));
      }
  }
  runCustomHandlers(Qt, Zt, $n) {
    for (let Sn of this.customHandlers) {
      let kn = Sn.handlers[Qt];
      if (kn)
        try {
          if (kn.call(Sn.plugin, $n, Zt) || $n.defaultPrevented)
            return !0;
        } catch (Kn) {
          logException(Zt.state, Kn);
        }
    }
    return !1;
  }
  runScrollHandlers(Qt, Zt) {
    this.lastScrollTop = Qt.scrollDOM.scrollTop, this.lastScrollLeft = Qt.scrollDOM.scrollLeft;
    for (let $n of this.customHandlers) {
      let Sn = $n.handlers.scroll;
      if (Sn)
        try {
          Sn.call($n.plugin, Zt, Qt);
        } catch (kn) {
          logException(Qt.state, kn);
        }
    }
  }
  keydown(Qt, Zt) {
    if (this.lastKeyCode = Zt.keyCode, this.lastKeyTime = Date.now(), Zt.keyCode == 9 && Date.now() < this.lastEscPress + 2e3)
      return !0;
    if (Zt.keyCode != 27 && modifierCodes.indexOf(Zt.keyCode) < 0 && (Qt.inputState.lastEscPress = 0), browser.android && browser.chrome && !Zt.synthetic && (Zt.keyCode == 13 || Zt.keyCode == 8))
      return Qt.observer.delayAndroidKey(Zt.key, Zt.keyCode), !0;
    let $n;
    return browser.ios && !Zt.synthetic && !Zt.altKey && !Zt.metaKey && (($n = PendingKeys.find((Sn) => Sn.keyCode == Zt.keyCode)) && !Zt.ctrlKey || EmacsyPendingKeys.indexOf(Zt.key) > -1 && Zt.ctrlKey && !Zt.shiftKey) ? (this.pendingIOSKey = $n || Zt, setTimeout(() => this.flushIOSKey(Qt), 250), !0) : !1;
  }
  flushIOSKey(Qt) {
    let Zt = this.pendingIOSKey;
    return Zt ? (this.pendingIOSKey = void 0, dispatchKey(Qt.contentDOM, Zt.key, Zt.keyCode)) : !1;
  }
  ignoreDuringComposition(Qt) {
    return /^key/.test(Qt.type) ? this.composing > 0 ? !0 : browser.safari && !browser.ios && this.compositionPendingKey && Date.now() - this.compositionEndedAt < 100 ? (this.compositionPendingKey = !1, !0) : !1 : !1;
  }
  mustFlushObserver(Qt) {
    return Qt.type == "keydown" && Qt.keyCode != 229;
  }
  startMouseSelection(Qt) {
    this.mouseSelection && this.mouseSelection.destroy(), this.mouseSelection = Qt;
  }
  update(Qt) {
    this.mouseSelection && this.mouseSelection.update(Qt), Qt.transactions.length && (this.lastKeyCode = this.lastSelectionTime = 0);
  }
  destroy() {
    this.mouseSelection && this.mouseSelection.destroy();
  }
}
const PendingKeys = [
  { key: "Backspace", keyCode: 8, inputType: "deleteContentBackward" },
  { key: "Enter", keyCode: 13, inputType: "insertParagraph" },
  { key: "Enter", keyCode: 13, inputType: "insertLineBreak" },
  { key: "Delete", keyCode: 46, inputType: "deleteContentForward" }
], EmacsyPendingKeys = "dthko", modifierCodes = [16, 17, 18, 20, 91, 92, 224, 225], dragScrollMargin = 6;
function dragScrollSpeed(_e) {
  return Math.max(0, _e) * 0.7 + 8;
}
function dist$1(_e, Qt) {
  return Math.max(Math.abs(_e.clientX - Qt.clientX), Math.abs(_e.clientY - Qt.clientY));
}
class MouseSelection {
  constructor(Qt, Zt, $n, Sn) {
    this.view = Qt, this.startEvent = Zt, this.style = $n, this.mustSelect = Sn, this.scrollSpeed = { x: 0, y: 0 }, this.scrolling = -1, this.lastEvent = Zt, this.scrollParent = scrollableParent(Qt.contentDOM), this.atoms = Qt.state.facet(atomicRanges).map((Kn) => Kn(Qt));
    let kn = Qt.contentDOM.ownerDocument;
    kn.addEventListener("mousemove", this.move = this.move.bind(this)), kn.addEventListener("mouseup", this.up = this.up.bind(this)), this.extend = Zt.shiftKey, this.multiple = Qt.state.facet(EditorState.allowMultipleSelections) && addsSelectionRange(Qt, Zt), this.dragging = isInPrimarySelection(Qt, Zt) && getClickType(Zt) == 1 ? null : !1;
  }
  start(Qt) {
    this.dragging === !1 && (Qt.preventDefault(), this.select(Qt));
  }
  move(Qt) {
    var Zt;
    if (Qt.buttons == 0)
      return this.destroy();
    if (this.dragging || this.dragging == null && dist$1(this.startEvent, Qt) < 10)
      return;
    this.select(this.lastEvent = Qt);
    let $n = 0, Sn = 0, kn = ((Zt = this.scrollParent) === null || Zt === void 0 ? void 0 : Zt.getBoundingClientRect()) || { left: 0, top: 0, right: this.view.win.innerWidth, bottom: this.view.win.innerHeight }, Kn = getScrollMargins(this.view);
    Qt.clientX - Kn.left <= kn.left + dragScrollMargin ? $n = -dragScrollSpeed(kn.left - Qt.clientX) : Qt.clientX + Kn.right >= kn.right - dragScrollMargin && ($n = dragScrollSpeed(Qt.clientX - kn.right)), Qt.clientY - Kn.top <= kn.top + dragScrollMargin ? Sn = -dragScrollSpeed(kn.top - Qt.clientY) : Qt.clientY + Kn.bottom >= kn.bottom - dragScrollMargin && (Sn = dragScrollSpeed(Qt.clientY - kn.bottom)), this.setScrollSpeed($n, Sn);
  }
  up(Qt) {
    this.dragging == null && this.select(this.lastEvent), this.dragging || Qt.preventDefault(), this.destroy();
  }
  destroy() {
    this.setScrollSpeed(0, 0);
    let Qt = this.view.contentDOM.ownerDocument;
    Qt.removeEventListener("mousemove", this.move), Qt.removeEventListener("mouseup", this.up), this.view.inputState.mouseSelection = null;
  }
  setScrollSpeed(Qt, Zt) {
    this.scrollSpeed = { x: Qt, y: Zt }, Qt || Zt ? this.scrolling < 0 && (this.scrolling = setInterval(() => this.scroll(), 50)) : this.scrolling > -1 && (clearInterval(this.scrolling), this.scrolling = -1);
  }
  scroll() {
    this.scrollParent ? (this.scrollParent.scrollLeft += this.scrollSpeed.x, this.scrollParent.scrollTop += this.scrollSpeed.y) : this.view.win.scrollBy(this.scrollSpeed.x, this.scrollSpeed.y), this.dragging === !1 && this.select(this.lastEvent);
  }
  skipAtoms(Qt) {
    let Zt = null;
    for (let $n = 0; $n < Qt.ranges.length; $n++) {
      let Sn = Qt.ranges[$n], kn = null;
      if (Sn.empty) {
        let Kn = skipAtomicRanges(this.atoms, Sn.from, 0);
        Kn != Sn.from && (kn = EditorSelection.cursor(Kn, -1));
      } else {
        let Kn = skipAtomicRanges(this.atoms, Sn.from, -1), er = skipAtomicRanges(this.atoms, Sn.to, 1);
        (Kn != Sn.from || er != Sn.to) && (kn = EditorSelection.range(Sn.from == Sn.anchor ? Kn : er, Sn.from == Sn.head ? Kn : er));
      }
      kn && (Zt || (Zt = Qt.ranges.slice()), Zt[$n] = kn);
    }
    return Zt ? EditorSelection.create(Zt, Qt.mainIndex) : Qt;
  }
  select(Qt) {
    let { view: Zt } = this, $n = this.skipAtoms(this.style.get(Qt, this.extend, this.multiple));
    (this.mustSelect || !$n.eq(Zt.state.selection) || $n.main.assoc != Zt.state.selection.main.assoc && this.dragging === !1) && this.view.dispatch({
      selection: $n,
      userEvent: "select.pointer"
    }), this.mustSelect = !1;
  }
  update(Qt) {
    Qt.docChanged && this.dragging && (this.dragging = this.dragging.map(Qt.changes)), this.style.update(Qt) && setTimeout(() => this.select(this.lastEvent), 20);
  }
}
function addsSelectionRange(_e, Qt) {
  let Zt = _e.state.facet(clickAddsSelectionRange);
  return Zt.length ? Zt[0](Qt) : browser.mac ? Qt.metaKey : Qt.ctrlKey;
}
function dragMovesSelection(_e, Qt) {
  let Zt = _e.state.facet(dragMovesSelection$1);
  return Zt.length ? Zt[0](Qt) : browser.mac ? !Qt.altKey : !Qt.ctrlKey;
}
function isInPrimarySelection(_e, Qt) {
  let { main: Zt } = _e.state.selection;
  if (Zt.empty)
    return !1;
  let $n = getSelection(_e.root);
  if (!$n || $n.rangeCount == 0)
    return !0;
  let Sn = $n.getRangeAt(0).getClientRects();
  for (let kn = 0; kn < Sn.length; kn++) {
    let Kn = Sn[kn];
    if (Kn.left <= Qt.clientX && Kn.right >= Qt.clientX && Kn.top <= Qt.clientY && Kn.bottom >= Qt.clientY)
      return !0;
  }
  return !1;
}
function eventBelongsToEditor(_e, Qt) {
  if (!Qt.bubbles)
    return !0;
  if (Qt.defaultPrevented)
    return !1;
  for (let Zt = Qt.target, $n; Zt != _e.contentDOM; Zt = Zt.parentNode)
    if (!Zt || Zt.nodeType == 11 || ($n = ContentView.get(Zt)) && $n.ignoreEvent(Qt))
      return !1;
  return !0;
}
const handlers = /* @__PURE__ */ Object.create(null), handlerOptions = /* @__PURE__ */ Object.create(null), brokenClipboardAPI = browser.ie && browser.ie_version < 15 || browser.ios && browser.webkit_version < 604;
function capturePaste(_e) {
  let Qt = _e.dom.parentNode;
  if (!Qt)
    return;
  let Zt = Qt.appendChild(document.createElement("textarea"));
  Zt.style.cssText = "position: fixed; left: -10000px; top: 10px", Zt.focus(), setTimeout(() => {
    _e.focus(), Zt.remove(), doPaste(_e, Zt.value);
  }, 50);
}
function doPaste(_e, Qt) {
  let { state: Zt } = _e, $n, Sn = 1, kn = Zt.toText(Qt), Kn = kn.lines == Zt.selection.ranges.length;
  if (lastLinewiseCopy != null && Zt.selection.ranges.every((Cr) => Cr.empty) && lastLinewiseCopy == kn.toString()) {
    let Cr = -1;
    $n = Zt.changeByRange((kr) => {
      let Yr = Zt.doc.lineAt(kr.from);
      if (Yr.from == Cr)
        return { range: kr };
      Cr = Yr.from;
      let Ms = Zt.toText((Kn ? kn.line(Sn++).text : Qt) + Zt.lineBreak);
      return {
        changes: { from: Yr.from, insert: Ms },
        range: EditorSelection.cursor(kr.from + Ms.length)
      };
    });
  } else
    Kn ? $n = Zt.changeByRange((Cr) => {
      let kr = kn.line(Sn++);
      return {
        changes: { from: Cr.from, to: Cr.to, insert: kr.text },
        range: EditorSelection.cursor(Cr.from + kr.length)
      };
    }) : $n = Zt.replaceSelection(kn);
  _e.dispatch($n, {
    userEvent: "input.paste",
    scrollIntoView: !0
  });
}
handlers.keydown = (_e, Qt) => {
  _e.inputState.setSelectionOrigin("select"), Qt.keyCode == 27 && (_e.inputState.lastEscPress = Date.now());
};
handlers.touchstart = (_e, Qt) => {
  _e.inputState.lastTouchTime = Date.now(), _e.inputState.setSelectionOrigin("select.pointer");
};
handlers.touchmove = (_e) => {
  _e.inputState.setSelectionOrigin("select.pointer");
};
handlerOptions.touchstart = handlerOptions.touchmove = { passive: !0 };
handlers.mousedown = (_e, Qt) => {
  if (_e.observer.flush(), _e.inputState.lastTouchTime > Date.now() - 2e3)
    return;
  let Zt = null;
  for (let $n of _e.state.facet(mouseSelectionStyle))
    if (Zt = $n(_e, Qt), Zt)
      break;
  if (!Zt && Qt.button == 0 && (Zt = basicMouseSelection(_e, Qt)), Zt) {
    let $n = !_e.hasFocus;
    _e.inputState.startMouseSelection(new MouseSelection(_e, Qt, Zt, $n)), $n && _e.observer.ignore(() => focusPreventScroll(_e.contentDOM)), _e.inputState.mouseSelection && _e.inputState.mouseSelection.start(Qt);
  }
};
function rangeForClick(_e, Qt, Zt, $n) {
  if ($n == 1)
    return EditorSelection.cursor(Qt, Zt);
  if ($n == 2)
    return groupAt(_e.state, Qt, Zt);
  {
    let Sn = LineView.find(_e.docView, Qt), kn = _e.state.doc.lineAt(Sn ? Sn.posAtEnd : Qt), Kn = Sn ? Sn.posAtStart : kn.from, er = Sn ? Sn.posAtEnd : kn.to;
    return er < _e.state.doc.length && er == kn.to && er++, EditorSelection.range(Kn, er);
  }
}
let insideY = (_e, Qt) => _e >= Qt.top && _e <= Qt.bottom, inside = (_e, Qt, Zt) => insideY(Qt, Zt) && _e >= Zt.left && _e <= Zt.right;
function findPositionSide(_e, Qt, Zt, $n) {
  let Sn = LineView.find(_e.docView, Qt);
  if (!Sn)
    return 1;
  let kn = Qt - Sn.posAtStart;
  if (kn == 0)
    return 1;
  if (kn == Sn.length)
    return -1;
  let Kn = Sn.coordsAt(kn, -1);
  if (Kn && inside(Zt, $n, Kn))
    return -1;
  let er = Sn.coordsAt(kn, 1);
  return er && inside(Zt, $n, er) ? 1 : Kn && insideY($n, Kn) ? -1 : 1;
}
function queryPos(_e, Qt) {
  let Zt = _e.posAtCoords({ x: Qt.clientX, y: Qt.clientY }, !1);
  return { pos: Zt, bias: findPositionSide(_e, Zt, Qt.clientX, Qt.clientY) };
}
const BadMouseDetail = browser.ie && browser.ie_version <= 11;
let lastMouseDown = null, lastMouseDownCount = 0, lastMouseDownTime = 0;
function getClickType(_e) {
  if (!BadMouseDetail)
    return _e.detail;
  let Qt = lastMouseDown, Zt = lastMouseDownTime;
  return lastMouseDown = _e, lastMouseDownTime = Date.now(), lastMouseDownCount = !Qt || Zt > Date.now() - 400 && Math.abs(Qt.clientX - _e.clientX) < 2 && Math.abs(Qt.clientY - _e.clientY) < 2 ? (lastMouseDownCount + 1) % 3 : 1;
}
function basicMouseSelection(_e, Qt) {
  let Zt = queryPos(_e, Qt), $n = getClickType(Qt), Sn = _e.state.selection;
  return {
    update(kn) {
      kn.docChanged && (Zt.pos = kn.changes.mapPos(Zt.pos), Sn = Sn.map(kn.changes));
    },
    get(kn, Kn, er) {
      let Cr = queryPos(_e, kn), kr, Yr = rangeForClick(_e, Cr.pos, Cr.bias, $n);
      if (Zt.pos != Cr.pos && !Kn) {
        let Ms = rangeForClick(_e, Zt.pos, Zt.bias, $n), Ds = Math.min(Ms.from, Yr.from), Ls = Math.max(Ms.to, Yr.to);
        Yr = Ds < Yr.from ? EditorSelection.range(Ds, Ls) : EditorSelection.range(Ls, Ds);
      }
      return Kn ? Sn.replaceRange(Sn.main.extend(Yr.from, Yr.to)) : er && $n == 1 && Sn.ranges.length > 1 && (kr = removeRangeAround(Sn, Cr.pos)) ? kr : er ? Sn.addRange(Yr) : EditorSelection.create([Yr]);
    }
  };
}
function removeRangeAround(_e, Qt) {
  for (let Zt = 0; Zt < _e.ranges.length; Zt++) {
    let { from: $n, to: Sn } = _e.ranges[Zt];
    if ($n <= Qt && Sn >= Qt)
      return EditorSelection.create(_e.ranges.slice(0, Zt).concat(_e.ranges.slice(Zt + 1)), _e.mainIndex == Zt ? 0 : _e.mainIndex - (_e.mainIndex > Zt ? 1 : 0));
  }
  return null;
}
handlers.dragstart = (_e, Qt) => {
  let { selection: { main: Zt } } = _e.state, { mouseSelection: $n } = _e.inputState;
  $n && ($n.dragging = Zt), Qt.dataTransfer && (Qt.dataTransfer.setData("Text", _e.state.sliceDoc(Zt.from, Zt.to)), Qt.dataTransfer.effectAllowed = "copyMove");
};
function dropText(_e, Qt, Zt, $n) {
  if (!Zt)
    return;
  let Sn = _e.posAtCoords({ x: Qt.clientX, y: Qt.clientY }, !1);
  Qt.preventDefault();
  let { mouseSelection: kn } = _e.inputState, Kn = $n && kn && kn.dragging && dragMovesSelection(_e, Qt) ? { from: kn.dragging.from, to: kn.dragging.to } : null, er = { from: Sn, insert: Zt }, Cr = _e.state.changes(Kn ? [Kn, er] : er);
  _e.focus(), _e.dispatch({
    changes: Cr,
    selection: { anchor: Cr.mapPos(Sn, -1), head: Cr.mapPos(Sn, 1) },
    userEvent: Kn ? "move.drop" : "input.drop"
  });
}
handlers.drop = (_e, Qt) => {
  if (!Qt.dataTransfer)
    return;
  if (_e.state.readOnly)
    return Qt.preventDefault();
  let Zt = Qt.dataTransfer.files;
  if (Zt && Zt.length) {
    Qt.preventDefault();
    let $n = Array(Zt.length), Sn = 0, kn = () => {
      ++Sn == Zt.length && dropText(_e, Qt, $n.filter((Kn) => Kn != null).join(_e.state.lineBreak), !1);
    };
    for (let Kn = 0; Kn < Zt.length; Kn++) {
      let er = new FileReader();
      er.onerror = kn, er.onload = () => {
        /[\x00-\x08\x0e-\x1f]{2}/.test(er.result) || ($n[Kn] = er.result), kn();
      }, er.readAsText(Zt[Kn]);
    }
  } else
    dropText(_e, Qt, Qt.dataTransfer.getData("Text"), !0);
};
handlers.paste = (_e, Qt) => {
  if (_e.state.readOnly)
    return Qt.preventDefault();
  _e.observer.flush();
  let Zt = brokenClipboardAPI ? null : Qt.clipboardData;
  Zt ? (doPaste(_e, Zt.getData("text/plain") || Zt.getData("text/uri-text")), Qt.preventDefault()) : capturePaste(_e);
};
function captureCopy(_e, Qt) {
  let Zt = _e.dom.parentNode;
  if (!Zt)
    return;
  let $n = Zt.appendChild(document.createElement("textarea"));
  $n.style.cssText = "position: fixed; left: -10000px; top: 10px", $n.value = Qt, $n.focus(), $n.selectionEnd = Qt.length, $n.selectionStart = 0, setTimeout(() => {
    $n.remove(), _e.focus();
  }, 50);
}
function copiedRange(_e) {
  let Qt = [], Zt = [], $n = !1;
  for (let Sn of _e.selection.ranges)
    Sn.empty || (Qt.push(_e.sliceDoc(Sn.from, Sn.to)), Zt.push(Sn));
  if (!Qt.length) {
    let Sn = -1;
    for (let { from: kn } of _e.selection.ranges) {
      let Kn = _e.doc.lineAt(kn);
      Kn.number > Sn && (Qt.push(Kn.text), Zt.push({ from: Kn.from, to: Math.min(_e.doc.length, Kn.to + 1) })), Sn = Kn.number;
    }
    $n = !0;
  }
  return { text: Qt.join(_e.lineBreak), ranges: Zt, linewise: $n };
}
let lastLinewiseCopy = null;
handlers.copy = handlers.cut = (_e, Qt) => {
  let { text: Zt, ranges: $n, linewise: Sn } = copiedRange(_e.state);
  if (!Zt && !Sn)
    return;
  lastLinewiseCopy = Sn ? Zt : null;
  let kn = brokenClipboardAPI ? null : Qt.clipboardData;
  kn ? (Qt.preventDefault(), kn.clearData(), kn.setData("text/plain", Zt)) : captureCopy(_e, Zt), Qt.type == "cut" && !_e.state.readOnly && _e.dispatch({
    changes: $n,
    scrollIntoView: !0,
    userEvent: "delete.cut"
  });
};
const isFocusChange = /* @__PURE__ */ Annotation.define();
function focusChangeTransaction(_e, Qt) {
  let Zt = [];
  for (let $n of _e.facet(focusChangeEffect)) {
    let Sn = $n(_e, Qt);
    Sn && Zt.push(Sn);
  }
  return Zt ? _e.update({ effects: Zt, annotations: isFocusChange.of(!0) }) : null;
}
function updateForFocusChange(_e) {
  setTimeout(() => {
    let Qt = _e.hasFocus;
    if (Qt != _e.inputState.notifiedFocused) {
      let Zt = focusChangeTransaction(_e.state, Qt);
      Zt ? _e.dispatch(Zt) : _e.update([]);
    }
  }, 10);
}
handlers.focus = (_e) => {
  _e.inputState.lastFocusTime = Date.now(), !_e.scrollDOM.scrollTop && (_e.inputState.lastScrollTop || _e.inputState.lastScrollLeft) && (_e.scrollDOM.scrollTop = _e.inputState.lastScrollTop, _e.scrollDOM.scrollLeft = _e.inputState.lastScrollLeft), updateForFocusChange(_e);
};
handlers.blur = (_e) => {
  _e.observer.clearSelectionRange(), updateForFocusChange(_e);
};
handlers.compositionstart = handlers.compositionupdate = (_e) => {
  _e.inputState.compositionFirstChange == null && (_e.inputState.compositionFirstChange = !0), _e.inputState.composing < 0 && (_e.inputState.composing = 0);
};
handlers.compositionend = (_e) => {
  _e.inputState.composing = -1, _e.inputState.compositionEndedAt = Date.now(), _e.inputState.compositionPendingKey = !0, _e.inputState.compositionPendingChange = _e.observer.pendingRecords().length > 0, _e.inputState.compositionFirstChange = null, browser.chrome && browser.android ? _e.observer.flushSoon() : _e.inputState.compositionPendingChange ? Promise.resolve().then(() => _e.observer.flush()) : setTimeout(() => {
    _e.inputState.composing < 0 && _e.docView.hasComposition && _e.update([]);
  }, 50);
};
handlers.contextmenu = (_e) => {
  _e.inputState.lastContextMenu = Date.now();
};
handlers.beforeinput = (_e, Qt) => {
  var Zt;
  let $n;
  if (browser.chrome && browser.android && ($n = PendingKeys.find((Sn) => Sn.inputType == Qt.inputType)) && (_e.observer.delayAndroidKey($n.key, $n.keyCode), $n.key == "Backspace" || $n.key == "Delete")) {
    let Sn = ((Zt = window.visualViewport) === null || Zt === void 0 ? void 0 : Zt.height) || 0;
    setTimeout(() => {
      var kn;
      (((kn = window.visualViewport) === null || kn === void 0 ? void 0 : kn.height) || 0) > Sn + 10 && _e.hasFocus && (_e.contentDOM.blur(), _e.focus());
    }, 100);
  }
};
const appliedFirefoxHack = /* @__PURE__ */ new Set();
function firefoxCopyCutHack(_e) {
  appliedFirefoxHack.has(_e) || (appliedFirefoxHack.add(_e), _e.addEventListener("copy", () => {
  }), _e.addEventListener("cut", () => {
  }));
}
const wrappingWhiteSpace = ["pre-wrap", "normal", "pre-line", "break-spaces"];
class HeightOracle {
  constructor(Qt) {
    this.lineWrapping = Qt, this.doc = Text$1.empty, this.heightSamples = {}, this.lineHeight = 14, this.charWidth = 7, this.textHeight = 14, this.lineLength = 30, this.heightChanged = !1;
  }
  heightForGap(Qt, Zt) {
    let $n = this.doc.lineAt(Zt).number - this.doc.lineAt(Qt).number + 1;
    return this.lineWrapping && ($n += Math.max(0, Math.ceil((Zt - Qt - $n * this.lineLength * 0.5) / this.lineLength))), this.lineHeight * $n;
  }
  heightForLine(Qt) {
    return this.lineWrapping ? (1 + Math.max(0, Math.ceil((Qt - this.lineLength) / (this.lineLength - 5)))) * this.lineHeight : this.lineHeight;
  }
  setDoc(Qt) {
    return this.doc = Qt, this;
  }
  mustRefreshForWrapping(Qt) {
    return wrappingWhiteSpace.indexOf(Qt) > -1 != this.lineWrapping;
  }
  mustRefreshForHeights(Qt) {
    let Zt = !1;
    for (let $n = 0; $n < Qt.length; $n++) {
      let Sn = Qt[$n];
      Sn < 0 ? $n++ : this.heightSamples[Math.floor(Sn * 10)] || (Zt = !0, this.heightSamples[Math.floor(Sn * 10)] = !0);
    }
    return Zt;
  }
  refresh(Qt, Zt, $n, Sn, kn, Kn) {
    let er = wrappingWhiteSpace.indexOf(Qt) > -1, Cr = Math.round(Zt) != Math.round(this.lineHeight) || this.lineWrapping != er;
    if (this.lineWrapping = er, this.lineHeight = Zt, this.charWidth = $n, this.textHeight = Sn, this.lineLength = kn, Cr) {
      this.heightSamples = {};
      for (let kr = 0; kr < Kn.length; kr++) {
        let Yr = Kn[kr];
        Yr < 0 ? kr++ : this.heightSamples[Math.floor(Yr * 10)] = !0;
      }
    }
    return Cr;
  }
}
class MeasuredHeights {
  constructor(Qt, Zt) {
    this.from = Qt, this.heights = Zt, this.index = 0;
  }
  get more() {
    return this.index < this.heights.length;
  }
}
class BlockInfo {
  /**
  @internal
  */
  constructor(Qt, Zt, $n, Sn, kn) {
    this.from = Qt, this.length = Zt, this.top = $n, this.height = Sn, this._content = kn;
  }
  /**
  The type of element this is. When querying lines, this may be
  an array of all the blocks that make up the line.
  */
  get type() {
    return typeof this._content == "number" ? BlockType.Text : Array.isArray(this._content) ? this._content : this._content.type;
  }
  /**
  The end of the element as a document position.
  */
  get to() {
    return this.from + this.length;
  }
  /**
  The bottom position of the element.
  */
  get bottom() {
    return this.top + this.height;
  }
  /**
  If this is a widget block, this will return the widget
  associated with it.
  */
  get widget() {
    return this._content instanceof PointDecoration ? this._content.widget : null;
  }
  /**
  If this is a textblock, this holds the number of line breaks
  that appear in widgets inside the block.
  */
  get widgetLineBreaks() {
    return typeof this._content == "number" ? this._content : 0;
  }
  /**
  @internal
  */
  join(Qt) {
    let Zt = (Array.isArray(this._content) ? this._content : [this]).concat(Array.isArray(Qt._content) ? Qt._content : [Qt]);
    return new BlockInfo(this.from, this.length + Qt.length, this.top, this.height + Qt.height, Zt);
  }
}
var QueryType = /* @__PURE__ */ function(_e) {
  return _e[_e.ByPos = 0] = "ByPos", _e[_e.ByHeight = 1] = "ByHeight", _e[_e.ByPosNoHeight = 2] = "ByPosNoHeight", _e;
}(QueryType || (QueryType = {}));
const Epsilon$1 = 1e-3;
class HeightMap {
  constructor(Qt, Zt, $n = 2) {
    this.length = Qt, this.height = Zt, this.flags = $n;
  }
  get outdated() {
    return (this.flags & 2) > 0;
  }
  set outdated(Qt) {
    this.flags = (Qt ? 2 : 0) | this.flags & -3;
  }
  setHeight(Qt, Zt) {
    this.height != Zt && (Math.abs(this.height - Zt) > Epsilon$1 && (Qt.heightChanged = !0), this.height = Zt);
  }
  // Base case is to replace a leaf node, which simply builds a tree
  // from the new nodes and returns that (HeightMapBranch and
  // HeightMapGap override this to actually use from/to)
  replace(Qt, Zt, $n) {
    return HeightMap.of($n);
  }
  // Again, these are base cases, and are overridden for branch and gap nodes.
  decomposeLeft(Qt, Zt) {
    Zt.push(this);
  }
  decomposeRight(Qt, Zt) {
    Zt.push(this);
  }
  applyChanges(Qt, Zt, $n, Sn) {
    let kn = this, Kn = $n.doc;
    for (let er = Sn.length - 1; er >= 0; er--) {
      let { fromA: Cr, toA: kr, fromB: Yr, toB: Ms } = Sn[er], Ds = kn.lineAt(Cr, QueryType.ByPosNoHeight, $n.setDoc(Zt), 0, 0), Ls = Ds.to >= kr ? Ds : kn.lineAt(kr, QueryType.ByPosNoHeight, $n, 0, 0);
      for (Ms += Ls.to - kr, kr = Ls.to; er > 0 && Ds.from <= Sn[er - 1].toA; )
        Cr = Sn[er - 1].fromA, Yr = Sn[er - 1].fromB, er--, Cr < Ds.from && (Ds = kn.lineAt(Cr, QueryType.ByPosNoHeight, $n, 0, 0));
      Yr += Ds.from - Cr, Cr = Ds.from;
      let js = NodeBuilder.build($n.setDoc(Kn), Qt, Yr, Ms);
      kn = kn.replace(Cr, kr, js);
    }
    return kn.updateHeight($n, 0);
  }
  static empty() {
    return new HeightMapText(0, 0);
  }
  // nodes uses null values to indicate the position of line breaks.
  // There are never line breaks at the start or end of the array, or
  // two line breaks next to each other, and the array isn't allowed
  // to be empty (same restrictions as return value from the builder).
  static of(Qt) {
    if (Qt.length == 1)
      return Qt[0];
    let Zt = 0, $n = Qt.length, Sn = 0, kn = 0;
    for (; ; )
      if (Zt == $n)
        if (Sn > kn * 2) {
          let er = Qt[Zt - 1];
          er.break ? Qt.splice(--Zt, 1, er.left, null, er.right) : Qt.splice(--Zt, 1, er.left, er.right), $n += 1 + er.break, Sn -= er.size;
        } else if (kn > Sn * 2) {
          let er = Qt[$n];
          er.break ? Qt.splice($n, 1, er.left, null, er.right) : Qt.splice($n, 1, er.left, er.right), $n += 2 + er.break, kn -= er.size;
        } else
          break;
      else if (Sn < kn) {
        let er = Qt[Zt++];
        er && (Sn += er.size);
      } else {
        let er = Qt[--$n];
        er && (kn += er.size);
      }
    let Kn = 0;
    return Qt[Zt - 1] == null ? (Kn = 1, Zt--) : Qt[Zt] == null && (Kn = 1, $n++), new HeightMapBranch(HeightMap.of(Qt.slice(0, Zt)), Kn, HeightMap.of(Qt.slice($n)));
  }
}
HeightMap.prototype.size = 1;
class HeightMapBlock extends HeightMap {
  constructor(Qt, Zt, $n) {
    super(Qt, Zt), this.deco = $n;
  }
  blockAt(Qt, Zt, $n, Sn) {
    return new BlockInfo(Sn, this.length, $n, this.height, this.deco || 0);
  }
  lineAt(Qt, Zt, $n, Sn, kn) {
    return this.blockAt(0, $n, Sn, kn);
  }
  forEachLine(Qt, Zt, $n, Sn, kn, Kn) {
    Qt <= kn + this.length && Zt >= kn && Kn(this.blockAt(0, $n, Sn, kn));
  }
  updateHeight(Qt, Zt = 0, $n = !1, Sn) {
    return Sn && Sn.from <= Zt && Sn.more && this.setHeight(Qt, Sn.heights[Sn.index++]), this.outdated = !1, this;
  }
  toString() {
    return `block(${this.length})`;
  }
}
class HeightMapText extends HeightMapBlock {
  constructor(Qt, Zt) {
    super(Qt, Zt, null), this.collapsed = 0, this.widgetHeight = 0, this.breaks = 0;
  }
  blockAt(Qt, Zt, $n, Sn) {
    return new BlockInfo(Sn, this.length, $n, this.height, this.breaks);
  }
  replace(Qt, Zt, $n) {
    let Sn = $n[0];
    return $n.length == 1 && (Sn instanceof HeightMapText || Sn instanceof HeightMapGap && Sn.flags & 4) && Math.abs(this.length - Sn.length) < 10 ? (Sn instanceof HeightMapGap ? Sn = new HeightMapText(Sn.length, this.height) : Sn.height = this.height, this.outdated || (Sn.outdated = !1), Sn) : HeightMap.of($n);
  }
  updateHeight(Qt, Zt = 0, $n = !1, Sn) {
    return Sn && Sn.from <= Zt && Sn.more ? this.setHeight(Qt, Sn.heights[Sn.index++]) : ($n || this.outdated) && this.setHeight(Qt, Math.max(this.widgetHeight, Qt.heightForLine(this.length - this.collapsed)) + this.breaks * Qt.lineHeight), this.outdated = !1, this;
  }
  toString() {
    return `line(${this.length}${this.collapsed ? -this.collapsed : ""}${this.widgetHeight ? ":" + this.widgetHeight : ""})`;
  }
}
class HeightMapGap extends HeightMap {
  constructor(Qt) {
    super(Qt, 0);
  }
  heightMetrics(Qt, Zt) {
    let $n = Qt.doc.lineAt(Zt).number, Sn = Qt.doc.lineAt(Zt + this.length).number, kn = Sn - $n + 1, Kn, er = 0;
    if (Qt.lineWrapping) {
      let Cr = Math.min(this.height, Qt.lineHeight * kn);
      Kn = Cr / kn, this.length > kn + 1 && (er = (this.height - Cr) / (this.length - kn - 1));
    } else
      Kn = this.height / kn;
    return { firstLine: $n, lastLine: Sn, perLine: Kn, perChar: er };
  }
  blockAt(Qt, Zt, $n, Sn) {
    let { firstLine: kn, lastLine: Kn, perLine: er, perChar: Cr } = this.heightMetrics(Zt, Sn);
    if (Zt.lineWrapping) {
      let kr = Sn + Math.round(Math.max(0, Math.min(1, (Qt - $n) / this.height)) * this.length), Yr = Zt.doc.lineAt(kr), Ms = er + Yr.length * Cr, Ds = Math.max($n, Qt - Ms / 2);
      return new BlockInfo(Yr.from, Yr.length, Ds, Ms, 0);
    } else {
      let kr = Math.max(0, Math.min(Kn - kn, Math.floor((Qt - $n) / er))), { from: Yr, length: Ms } = Zt.doc.line(kn + kr);
      return new BlockInfo(Yr, Ms, $n + er * kr, er, 0);
    }
  }
  lineAt(Qt, Zt, $n, Sn, kn) {
    if (Zt == QueryType.ByHeight)
      return this.blockAt(Qt, $n, Sn, kn);
    if (Zt == QueryType.ByPosNoHeight) {
      let { from: Ls, to: js } = $n.doc.lineAt(Qt);
      return new BlockInfo(Ls, js - Ls, 0, 0, 0);
    }
    let { firstLine: Kn, perLine: er, perChar: Cr } = this.heightMetrics($n, kn), kr = $n.doc.lineAt(Qt), Yr = er + kr.length * Cr, Ms = kr.number - Kn, Ds = Sn + er * Ms + Cr * (kr.from - kn - Ms);
    return new BlockInfo(kr.from, kr.length, Math.max(Sn, Math.min(Ds, Sn + this.height - Yr)), Yr, 0);
  }
  forEachLine(Qt, Zt, $n, Sn, kn, Kn) {
    Qt = Math.max(Qt, kn), Zt = Math.min(Zt, kn + this.length);
    let { firstLine: er, perLine: Cr, perChar: kr } = this.heightMetrics($n, kn);
    for (let Yr = Qt, Ms = Sn; Yr <= Zt; ) {
      let Ds = $n.doc.lineAt(Yr);
      if (Yr == Qt) {
        let js = Ds.number - er;
        Ms += Cr * js + kr * (Qt - kn - js);
      }
      let Ls = Cr + kr * Ds.length;
      Kn(new BlockInfo(Ds.from, Ds.length, Ms, Ls, 0)), Ms += Ls, Yr = Ds.to + 1;
    }
  }
  replace(Qt, Zt, $n) {
    let Sn = this.length - Zt;
    if (Sn > 0) {
      let kn = $n[$n.length - 1];
      kn instanceof HeightMapGap ? $n[$n.length - 1] = new HeightMapGap(kn.length + Sn) : $n.push(null, new HeightMapGap(Sn - 1));
    }
    if (Qt > 0) {
      let kn = $n[0];
      kn instanceof HeightMapGap ? $n[0] = new HeightMapGap(Qt + kn.length) : $n.unshift(new HeightMapGap(Qt - 1), null);
    }
    return HeightMap.of($n);
  }
  decomposeLeft(Qt, Zt) {
    Zt.push(new HeightMapGap(Qt - 1), null);
  }
  decomposeRight(Qt, Zt) {
    Zt.push(null, new HeightMapGap(this.length - Qt - 1));
  }
  updateHeight(Qt, Zt = 0, $n = !1, Sn) {
    let kn = Zt + this.length;
    if (Sn && Sn.from <= Zt + this.length && Sn.more) {
      let Kn = [], er = Math.max(Zt, Sn.from), Cr = -1;
      for (Sn.from > Zt && Kn.push(new HeightMapGap(Sn.from - Zt - 1).updateHeight(Qt, Zt)); er <= kn && Sn.more; ) {
        let Yr = Qt.doc.lineAt(er).length;
        Kn.length && Kn.push(null);
        let Ms = Sn.heights[Sn.index++];
        Cr == -1 ? Cr = Ms : Math.abs(Ms - Cr) >= Epsilon$1 && (Cr = -2);
        let Ds = new HeightMapText(Yr, Ms);
        Ds.outdated = !1, Kn.push(Ds), er += Yr + 1;
      }
      er <= kn && Kn.push(null, new HeightMapGap(kn - er).updateHeight(Qt, er));
      let kr = HeightMap.of(Kn);
      return (Cr < 0 || Math.abs(kr.height - this.height) >= Epsilon$1 || Math.abs(Cr - this.heightMetrics(Qt, Zt).perLine) >= Epsilon$1) && (Qt.heightChanged = !0), kr;
    } else
      ($n || this.outdated) && (this.setHeight(Qt, Qt.heightForGap(Zt, Zt + this.length)), this.outdated = !1);
    return this;
  }
  toString() {
    return `gap(${this.length})`;
  }
}
class HeightMapBranch extends HeightMap {
  constructor(Qt, Zt, $n) {
    super(Qt.length + Zt + $n.length, Qt.height + $n.height, Zt | (Qt.outdated || $n.outdated ? 2 : 0)), this.left = Qt, this.right = $n, this.size = Qt.size + $n.size;
  }
  get break() {
    return this.flags & 1;
  }
  blockAt(Qt, Zt, $n, Sn) {
    let kn = $n + this.left.height;
    return Qt < kn ? this.left.blockAt(Qt, Zt, $n, Sn) : this.right.blockAt(Qt, Zt, kn, Sn + this.left.length + this.break);
  }
  lineAt(Qt, Zt, $n, Sn, kn) {
    let Kn = Sn + this.left.height, er = kn + this.left.length + this.break, Cr = Zt == QueryType.ByHeight ? Qt < Kn : Qt < er, kr = Cr ? this.left.lineAt(Qt, Zt, $n, Sn, kn) : this.right.lineAt(Qt, Zt, $n, Kn, er);
    if (this.break || (Cr ? kr.to < er : kr.from > er))
      return kr;
    let Yr = Zt == QueryType.ByPosNoHeight ? QueryType.ByPosNoHeight : QueryType.ByPos;
    return Cr ? kr.join(this.right.lineAt(er, Yr, $n, Kn, er)) : this.left.lineAt(er, Yr, $n, Sn, kn).join(kr);
  }
  forEachLine(Qt, Zt, $n, Sn, kn, Kn) {
    let er = Sn + this.left.height, Cr = kn + this.left.length + this.break;
    if (this.break)
      Qt < Cr && this.left.forEachLine(Qt, Zt, $n, Sn, kn, Kn), Zt >= Cr && this.right.forEachLine(Qt, Zt, $n, er, Cr, Kn);
    else {
      let kr = this.lineAt(Cr, QueryType.ByPos, $n, Sn, kn);
      Qt < kr.from && this.left.forEachLine(Qt, kr.from - 1, $n, Sn, kn, Kn), kr.to >= Qt && kr.from <= Zt && Kn(kr), Zt > kr.to && this.right.forEachLine(kr.to + 1, Zt, $n, er, Cr, Kn);
    }
  }
  replace(Qt, Zt, $n) {
    let Sn = this.left.length + this.break;
    if (Zt < Sn)
      return this.balanced(this.left.replace(Qt, Zt, $n), this.right);
    if (Qt > this.left.length)
      return this.balanced(this.left, this.right.replace(Qt - Sn, Zt - Sn, $n));
    let kn = [];
    Qt > 0 && this.decomposeLeft(Qt, kn);
    let Kn = kn.length;
    for (let er of $n)
      kn.push(er);
    if (Qt > 0 && mergeGaps(kn, Kn - 1), Zt < this.length) {
      let er = kn.length;
      this.decomposeRight(Zt, kn), mergeGaps(kn, er);
    }
    return HeightMap.of(kn);
  }
  decomposeLeft(Qt, Zt) {
    let $n = this.left.length;
    if (Qt <= $n)
      return this.left.decomposeLeft(Qt, Zt);
    Zt.push(this.left), this.break && ($n++, Qt >= $n && Zt.push(null)), Qt > $n && this.right.decomposeLeft(Qt - $n, Zt);
  }
  decomposeRight(Qt, Zt) {
    let $n = this.left.length, Sn = $n + this.break;
    if (Qt >= Sn)
      return this.right.decomposeRight(Qt - Sn, Zt);
    Qt < $n && this.left.decomposeRight(Qt, Zt), this.break && Qt < Sn && Zt.push(null), Zt.push(this.right);
  }
  balanced(Qt, Zt) {
    return Qt.size > 2 * Zt.size || Zt.size > 2 * Qt.size ? HeightMap.of(this.break ? [Qt, null, Zt] : [Qt, Zt]) : (this.left = Qt, this.right = Zt, this.height = Qt.height + Zt.height, this.outdated = Qt.outdated || Zt.outdated, this.size = Qt.size + Zt.size, this.length = Qt.length + this.break + Zt.length, this);
  }
  updateHeight(Qt, Zt = 0, $n = !1, Sn) {
    let { left: kn, right: Kn } = this, er = Zt + kn.length + this.break, Cr = null;
    return Sn && Sn.from <= Zt + kn.length && Sn.more ? Cr = kn = kn.updateHeight(Qt, Zt, $n, Sn) : kn.updateHeight(Qt, Zt, $n), Sn && Sn.from <= er + Kn.length && Sn.more ? Cr = Kn = Kn.updateHeight(Qt, er, $n, Sn) : Kn.updateHeight(Qt, er, $n), Cr ? this.balanced(kn, Kn) : (this.height = this.left.height + this.right.height, this.outdated = !1, this);
  }
  toString() {
    return this.left + (this.break ? " " : "-") + this.right;
  }
}
function mergeGaps(_e, Qt) {
  let Zt, $n;
  _e[Qt] == null && (Zt = _e[Qt - 1]) instanceof HeightMapGap && ($n = _e[Qt + 1]) instanceof HeightMapGap && _e.splice(Qt - 1, 3, new HeightMapGap(Zt.length + 1 + $n.length));
}
const relevantWidgetHeight = 5;
class NodeBuilder {
  constructor(Qt, Zt) {
    this.pos = Qt, this.oracle = Zt, this.nodes = [], this.lineStart = -1, this.lineEnd = -1, this.covering = null, this.writtenTo = Qt;
  }
  get isCovered() {
    return this.covering && this.nodes[this.nodes.length - 1] == this.covering;
  }
  span(Qt, Zt) {
    if (this.lineStart > -1) {
      let $n = Math.min(Zt, this.lineEnd), Sn = this.nodes[this.nodes.length - 1];
      Sn instanceof HeightMapText ? Sn.length += $n - this.pos : ($n > this.pos || !this.isCovered) && this.nodes.push(new HeightMapText($n - this.pos, -1)), this.writtenTo = $n, Zt > $n && (this.nodes.push(null), this.writtenTo++, this.lineStart = -1);
    }
    this.pos = Zt;
  }
  point(Qt, Zt, $n) {
    if (Qt < Zt || $n.heightRelevant) {
      let Sn = $n.widget ? $n.widget.estimatedHeight : 0, kn = $n.widget ? $n.widget.lineBreaks : 0;
      Sn < 0 && (Sn = this.oracle.lineHeight);
      let Kn = Zt - Qt;
      $n.block ? this.addBlock(new HeightMapBlock(Kn, Sn, $n)) : (Kn || kn || Sn >= relevantWidgetHeight) && this.addLineDeco(Sn, kn, Kn);
    } else
      Zt > Qt && this.span(Qt, Zt);
    this.lineEnd > -1 && this.lineEnd < this.pos && (this.lineEnd = this.oracle.doc.lineAt(this.pos).to);
  }
  enterLine() {
    if (this.lineStart > -1)
      return;
    let { from: Qt, to: Zt } = this.oracle.doc.lineAt(this.pos);
    this.lineStart = Qt, this.lineEnd = Zt, this.writtenTo < Qt && ((this.writtenTo < Qt - 1 || this.nodes[this.nodes.length - 1] == null) && this.nodes.push(this.blankContent(this.writtenTo, Qt - 1)), this.nodes.push(null)), this.pos > Qt && this.nodes.push(new HeightMapText(this.pos - Qt, -1)), this.writtenTo = this.pos;
  }
  blankContent(Qt, Zt) {
    let $n = new HeightMapGap(Zt - Qt);
    return this.oracle.doc.lineAt(Qt).to == Zt && ($n.flags |= 4), $n;
  }
  ensureLine() {
    this.enterLine();
    let Qt = this.nodes.length ? this.nodes[this.nodes.length - 1] : null;
    if (Qt instanceof HeightMapText)
      return Qt;
    let Zt = new HeightMapText(0, -1);
    return this.nodes.push(Zt), Zt;
  }
  addBlock(Qt) {
    var Zt;
    this.enterLine();
    let $n = (Zt = Qt.deco) === null || Zt === void 0 ? void 0 : Zt.type;
    $n == BlockType.WidgetAfter && !this.isCovered && this.ensureLine(), this.nodes.push(Qt), this.writtenTo = this.pos = this.pos + Qt.length, $n != BlockType.WidgetBefore && (this.covering = Qt);
  }
  addLineDeco(Qt, Zt, $n) {
    let Sn = this.ensureLine();
    Sn.length += $n, Sn.collapsed += $n, Sn.widgetHeight = Math.max(Sn.widgetHeight, Qt), Sn.breaks += Zt, this.writtenTo = this.pos = this.pos + $n;
  }
  finish(Qt) {
    let Zt = this.nodes.length == 0 ? null : this.nodes[this.nodes.length - 1];
    this.lineStart > -1 && !(Zt instanceof HeightMapText) && !this.isCovered ? this.nodes.push(new HeightMapText(0, -1)) : (this.writtenTo < this.pos || Zt == null) && this.nodes.push(this.blankContent(this.writtenTo, this.pos));
    let $n = Qt;
    for (let Sn of this.nodes)
      Sn instanceof HeightMapText && Sn.updateHeight(this.oracle, $n), $n += Sn ? Sn.length : 1;
    return this.nodes;
  }
  // Always called with a region that on both sides either stretches
  // to a line break or the end of the document.
  // The returned array uses null to indicate line breaks, but never
  // starts or ends in a line break, or has multiple line breaks next
  // to each other.
  static build(Qt, Zt, $n, Sn) {
    let kn = new NodeBuilder($n, Qt);
    return RangeSet.spans(Zt, $n, Sn, kn, 0), kn.finish($n);
  }
}
function heightRelevantDecoChanges(_e, Qt, Zt) {
  let $n = new DecorationComparator();
  return RangeSet.compare(_e, Qt, Zt, $n, 0), $n.changes;
}
class DecorationComparator {
  constructor() {
    this.changes = [];
  }
  compareRange() {
  }
  comparePoint(Qt, Zt, $n, Sn) {
    (Qt < Zt || $n && $n.heightRelevant || Sn && Sn.heightRelevant) && addRange(Qt, Zt, this.changes, 5);
  }
}
function visiblePixelRange(_e, Qt) {
  let Zt = _e.getBoundingClientRect(), $n = _e.ownerDocument, Sn = $n.defaultView || window, kn = Math.max(0, Zt.left), Kn = Math.min(Sn.innerWidth, Zt.right), er = Math.max(0, Zt.top), Cr = Math.min(Sn.innerHeight, Zt.bottom);
  for (let kr = _e.parentNode; kr && kr != $n.body; )
    if (kr.nodeType == 1) {
      let Yr = kr, Ms = window.getComputedStyle(Yr);
      if ((Yr.scrollHeight > Yr.clientHeight || Yr.scrollWidth > Yr.clientWidth) && Ms.overflow != "visible") {
        let Ds = Yr.getBoundingClientRect();
        kn = Math.max(kn, Ds.left), Kn = Math.min(Kn, Ds.right), er = Math.max(er, Ds.top), Cr = kr == _e.parentNode ? Ds.bottom : Math.min(Cr, Ds.bottom);
      }
      kr = Ms.position == "absolute" || Ms.position == "fixed" ? Yr.offsetParent : Yr.parentNode;
    } else if (kr.nodeType == 11)
      kr = kr.host;
    else
      break;
  return {
    left: kn - Zt.left,
    right: Math.max(kn, Kn) - Zt.left,
    top: er - (Zt.top + Qt),
    bottom: Math.max(er, Cr) - (Zt.top + Qt)
  };
}
function fullPixelRange(_e, Qt) {
  let Zt = _e.getBoundingClientRect();
  return {
    left: 0,
    right: Zt.right - Zt.left,
    top: Qt,
    bottom: Zt.bottom - (Zt.top + Qt)
  };
}
class LineGap {
  constructor(Qt, Zt, $n) {
    this.from = Qt, this.to = Zt, this.size = $n;
  }
  static same(Qt, Zt) {
    if (Qt.length != Zt.length)
      return !1;
    for (let $n = 0; $n < Qt.length; $n++) {
      let Sn = Qt[$n], kn = Zt[$n];
      if (Sn.from != kn.from || Sn.to != kn.to || Sn.size != kn.size)
        return !1;
    }
    return !0;
  }
  draw(Qt) {
    return Decoration.replace({ widget: new LineGapWidget(this.size, Qt) }).range(this.from, this.to);
  }
}
class LineGapWidget extends WidgetType {
  constructor(Qt, Zt) {
    super(), this.size = Qt, this.vertical = Zt;
  }
  eq(Qt) {
    return Qt.size == this.size && Qt.vertical == this.vertical;
  }
  toDOM() {
    let Qt = document.createElement("div");
    return this.vertical ? Qt.style.height = this.size + "px" : (Qt.style.width = this.size + "px", Qt.style.height = "2px", Qt.style.display = "inline-block"), Qt;
  }
  get estimatedHeight() {
    return this.vertical ? this.size : -1;
  }
}
class ViewState {
  constructor(Qt) {
    this.state = Qt, this.pixelViewport = { left: 0, right: window.innerWidth, top: 0, bottom: 0 }, this.inView = !0, this.paddingTop = 0, this.paddingBottom = 0, this.contentDOMWidth = 0, this.contentDOMHeight = 0, this.editorHeight = 0, this.editorWidth = 0, this.scrollTop = 0, this.scrolledToBottom = !0, this.scrollAnchorPos = 0, this.scrollAnchorHeight = -1, this.scaler = IdScaler, this.scrollTarget = null, this.printing = !1, this.mustMeasureContent = !0, this.defaultTextDirection = Direction.LTR, this.visibleRanges = [], this.mustEnforceCursorAssoc = !1;
    let Zt = Qt.facet(contentAttributes).some(($n) => typeof $n != "function" && $n.class == "cm-lineWrapping");
    this.heightOracle = new HeightOracle(Zt), this.stateDeco = Qt.facet(decorations).filter(($n) => typeof $n != "function"), this.heightMap = HeightMap.empty().applyChanges(this.stateDeco, Text$1.empty, this.heightOracle.setDoc(Qt.doc), [new ChangedRange(0, 0, 0, Qt.doc.length)]), this.viewport = this.getViewport(0, null), this.updateViewportLines(), this.updateForViewport(), this.lineGaps = this.ensureLineGaps([]), this.lineGapDeco = Decoration.set(this.lineGaps.map(($n) => $n.draw(!1))), this.computeVisibleRanges();
  }
  updateForViewport() {
    let Qt = [this.viewport], { main: Zt } = this.state.selection;
    for (let $n = 0; $n <= 1; $n++) {
      let Sn = $n ? Zt.head : Zt.anchor;
      if (!Qt.some(({ from: kn, to: Kn }) => Sn >= kn && Sn <= Kn)) {
        let { from: kn, to: Kn } = this.lineBlockAt(Sn);
        Qt.push(new Viewport(kn, Kn));
      }
    }
    this.viewports = Qt.sort(($n, Sn) => $n.from - Sn.from), this.scaler = this.heightMap.height <= 7e6 ? IdScaler : new BigScaler(this.heightOracle, this.heightMap, this.viewports);
  }
  updateViewportLines() {
    this.viewportLines = [], this.heightMap.forEachLine(this.viewport.from, this.viewport.to, this.heightOracle.setDoc(this.state.doc), 0, 0, (Qt) => {
      this.viewportLines.push(this.scaler.scale == 1 ? Qt : scaleBlock(Qt, this.scaler));
    });
  }
  update(Qt, Zt = null) {
    this.state = Qt.state;
    let $n = this.stateDeco;
    this.stateDeco = this.state.facet(decorations).filter((Yr) => typeof Yr != "function");
    let Sn = Qt.changedRanges, kn = ChangedRange.extendWithRanges(Sn, heightRelevantDecoChanges($n, this.stateDeco, Qt ? Qt.changes : ChangeSet.empty(this.state.doc.length))), Kn = this.heightMap.height, er = this.scrolledToBottom ? null : this.scrollAnchorAt(this.scrollTop);
    this.heightMap = this.heightMap.applyChanges(this.stateDeco, Qt.startState.doc, this.heightOracle.setDoc(this.state.doc), kn), this.heightMap.height != Kn && (Qt.flags |= 2), er ? (this.scrollAnchorPos = Qt.changes.mapPos(er.from, -1), this.scrollAnchorHeight = er.top) : (this.scrollAnchorPos = -1, this.scrollAnchorHeight = this.heightMap.height);
    let Cr = kn.length ? this.mapViewport(this.viewport, Qt.changes) : this.viewport;
    (Zt && (Zt.range.head < Cr.from || Zt.range.head > Cr.to) || !this.viewportIsAppropriate(Cr)) && (Cr = this.getViewport(0, Zt));
    let kr = !Qt.changes.empty || Qt.flags & 2 || Cr.from != this.viewport.from || Cr.to != this.viewport.to;
    this.viewport = Cr, this.updateForViewport(), kr && this.updateViewportLines(), (this.lineGaps.length || this.viewport.to - this.viewport.from > 4e3) && this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps, Qt.changes))), Qt.flags |= this.computeVisibleRanges(), Zt && (this.scrollTarget = Zt), !this.mustEnforceCursorAssoc && Qt.selectionSet && Qt.view.lineWrapping && Qt.state.selection.main.empty && Qt.state.selection.main.assoc && !Qt.state.facet(nativeSelectionHidden) && (this.mustEnforceCursorAssoc = !0);
  }
  measure(Qt) {
    let Zt = Qt.contentDOM, $n = window.getComputedStyle(Zt), Sn = this.heightOracle, kn = $n.whiteSpace;
    this.defaultTextDirection = $n.direction == "rtl" ? Direction.RTL : Direction.LTR;
    let Kn = this.heightOracle.mustRefreshForWrapping(kn), er = Zt.getBoundingClientRect(), Cr = Kn || this.mustMeasureContent || this.contentDOMHeight != er.height;
    this.contentDOMHeight = er.height, this.mustMeasureContent = !1;
    let kr = 0, Yr = 0, Ms = parseInt($n.paddingTop) || 0, Ds = parseInt($n.paddingBottom) || 0;
    (this.paddingTop != Ms || this.paddingBottom != Ds) && (this.paddingTop = Ms, this.paddingBottom = Ds, kr |= 10), this.editorWidth != Qt.scrollDOM.clientWidth && (Sn.lineWrapping && (Cr = !0), this.editorWidth = Qt.scrollDOM.clientWidth, kr |= 8), this.scrollTop != Qt.scrollDOM.scrollTop && (this.scrollAnchorHeight = -1, this.scrollTop = Qt.scrollDOM.scrollTop), this.scrolledToBottom = isScrolledToBottom(Qt.scrollDOM);
    let Ls = (this.printing ? fullPixelRange : visiblePixelRange)(Zt, this.paddingTop), js = Ls.top - this.pixelViewport.top, zs = Ls.bottom - this.pixelViewport.bottom;
    this.pixelViewport = Ls;
    let Fs = this.pixelViewport.bottom > this.pixelViewport.top && this.pixelViewport.right > this.pixelViewport.left;
    if (Fs != this.inView && (this.inView = Fs, Fs && (Cr = !0)), !this.inView && !this.scrollTarget)
      return 0;
    let Bs = er.width;
    if ((this.contentDOMWidth != Bs || this.editorHeight != Qt.scrollDOM.clientHeight) && (this.contentDOMWidth = er.width, this.editorHeight = Qt.scrollDOM.clientHeight, kr |= 8), Cr) {
      let Ws = Qt.docView.measureVisibleLineHeights(this.viewport);
      if (Sn.mustRefreshForHeights(Ws) && (Kn = !0), Kn || Sn.lineWrapping && Math.abs(Bs - this.contentDOMWidth) > Sn.charWidth) {
        let { lineHeight: Ys, charWidth: El, textHeight: Mu } = Qt.docView.measureTextSize();
        Kn = Ys > 0 && Sn.refresh(kn, Ys, El, Mu, Bs / El, Ws), Kn && (Qt.docView.minWidth = 0, kr |= 8);
      }
      js > 0 && zs > 0 ? Yr = Math.max(js, zs) : js < 0 && zs < 0 && (Yr = Math.min(js, zs)), Sn.heightChanged = !1;
      for (let Ys of this.viewports) {
        let El = Ys.from == this.viewport.from ? Ws : Qt.docView.measureVisibleLineHeights(Ys);
        this.heightMap = (Kn ? HeightMap.empty().applyChanges(this.stateDeco, Text$1.empty, this.heightOracle, [new ChangedRange(0, 0, 0, Qt.state.doc.length)]) : this.heightMap).updateHeight(Sn, 0, Kn, new MeasuredHeights(Ys.from, El));
      }
      Sn.heightChanged && (kr |= 2);
    }
    let Hs = !this.viewportIsAppropriate(this.viewport, Yr) || this.scrollTarget && (this.scrollTarget.range.head < this.viewport.from || this.scrollTarget.range.head > this.viewport.to);
    return Hs && (this.viewport = this.getViewport(Yr, this.scrollTarget)), this.updateForViewport(), (kr & 2 || Hs) && this.updateViewportLines(), (this.lineGaps.length || this.viewport.to - this.viewport.from > 4e3) && this.updateLineGaps(this.ensureLineGaps(Kn ? [] : this.lineGaps, Qt)), kr |= this.computeVisibleRanges(), this.mustEnforceCursorAssoc && (this.mustEnforceCursorAssoc = !1, Qt.docView.enforceCursorAssoc()), kr;
  }
  get visibleTop() {
    return this.scaler.fromDOM(this.pixelViewport.top);
  }
  get visibleBottom() {
    return this.scaler.fromDOM(this.pixelViewport.bottom);
  }
  getViewport(Qt, Zt) {
    let $n = 0.5 - Math.max(-0.5, Math.min(0.5, Qt / 1e3 / 2)), Sn = this.heightMap, kn = this.heightOracle, { visibleTop: Kn, visibleBottom: er } = this, Cr = new Viewport(Sn.lineAt(Kn - $n * 1e3, QueryType.ByHeight, kn, 0, 0).from, Sn.lineAt(er + (1 - $n) * 1e3, QueryType.ByHeight, kn, 0, 0).to);
    if (Zt) {
      let { head: kr } = Zt.range;
      if (kr < Cr.from || kr > Cr.to) {
        let Yr = Math.min(this.editorHeight, this.pixelViewport.bottom - this.pixelViewport.top), Ms = Sn.lineAt(kr, QueryType.ByPos, kn, 0, 0), Ds;
        Zt.y == "center" ? Ds = (Ms.top + Ms.bottom) / 2 - Yr / 2 : Zt.y == "start" || Zt.y == "nearest" && kr < Cr.from ? Ds = Ms.top : Ds = Ms.bottom - Yr, Cr = new Viewport(Sn.lineAt(Ds - 1e3 / 2, QueryType.ByHeight, kn, 0, 0).from, Sn.lineAt(Ds + Yr + 1e3 / 2, QueryType.ByHeight, kn, 0, 0).to);
      }
    }
    return Cr;
  }
  mapViewport(Qt, Zt) {
    let $n = Zt.mapPos(Qt.from, -1), Sn = Zt.mapPos(Qt.to, 1);
    return new Viewport(this.heightMap.lineAt($n, QueryType.ByPos, this.heightOracle, 0, 0).from, this.heightMap.lineAt(Sn, QueryType.ByPos, this.heightOracle, 0, 0).to);
  }
  // Checks if a given viewport covers the visible part of the
  // document and not too much beyond that.
  viewportIsAppropriate({ from: Qt, to: Zt }, $n = 0) {
    if (!this.inView)
      return !0;
    let { top: Sn } = this.heightMap.lineAt(Qt, QueryType.ByPos, this.heightOracle, 0, 0), { bottom: kn } = this.heightMap.lineAt(Zt, QueryType.ByPos, this.heightOracle, 0, 0), { visibleTop: Kn, visibleBottom: er } = this;
    return (Qt == 0 || Sn <= Kn - Math.max(10, Math.min(
      -$n,
      250
      /* VP.MaxCoverMargin */
    ))) && (Zt == this.state.doc.length || kn >= er + Math.max(10, Math.min(
      $n,
      250
      /* VP.MaxCoverMargin */
    ))) && Sn > Kn - 2 * 1e3 && kn < er + 2 * 1e3;
  }
  mapLineGaps(Qt, Zt) {
    if (!Qt.length || Zt.empty)
      return Qt;
    let $n = [];
    for (let Sn of Qt)
      Zt.touchesRange(Sn.from, Sn.to) || $n.push(new LineGap(Zt.mapPos(Sn.from), Zt.mapPos(Sn.to), Sn.size));
    return $n;
  }
  // Computes positions in the viewport where the start or end of a
  // line should be hidden, trying to reuse existing line gaps when
  // appropriate to avoid unneccesary redraws.
  // Uses crude character-counting for the positioning and sizing,
  // since actual DOM coordinates aren't always available and
  // predictable. Relies on generous margins (see LG.Margin) to hide
  // the artifacts this might produce from the user.
  ensureLineGaps(Qt, Zt) {
    let $n = this.heightOracle.lineWrapping, Sn = $n ? 1e4 : 2e3, kn = Sn >> 1, Kn = Sn << 1;
    if (this.defaultTextDirection != Direction.LTR && !$n)
      return [];
    let er = [], Cr = (kr, Yr, Ms, Ds) => {
      if (Yr - kr < kn)
        return;
      let Ls = this.state.selection.main, js = [Ls.from];
      Ls.empty || js.push(Ls.to);
      for (let Fs of js)
        if (Fs > kr && Fs < Yr) {
          Cr(kr, Fs - 10, Ms, Ds), Cr(Fs + 10, Yr, Ms, Ds);
          return;
        }
      let zs = find$4(Qt, (Fs) => Fs.from >= Ms.from && Fs.to <= Ms.to && Math.abs(Fs.from - kr) < kn && Math.abs(Fs.to - Yr) < kn && !js.some((Bs) => Fs.from < Bs && Fs.to > Bs));
      if (!zs) {
        if (Yr < Ms.to && Zt && $n && Zt.visibleRanges.some((Fs) => Fs.from <= Yr && Fs.to >= Yr)) {
          let Fs = Zt.moveToLineBoundary(EditorSelection.cursor(Yr), !1, !0).head;
          Fs > kr && (Yr = Fs);
        }
        zs = new LineGap(kr, Yr, this.gapSize(Ms, kr, Yr, Ds));
      }
      er.push(zs);
    };
    for (let kr of this.viewportLines) {
      if (kr.length < Kn)
        continue;
      let Yr = lineStructure(kr.from, kr.to, this.stateDeco);
      if (Yr.total < Kn)
        continue;
      let Ms = this.scrollTarget ? this.scrollTarget.range.head : null, Ds, Ls;
      if ($n) {
        let js = Sn / this.heightOracle.lineLength * this.heightOracle.lineHeight, zs, Fs;
        if (Ms != null) {
          let Bs = findFraction(Yr, Ms), Hs = ((this.visibleBottom - this.visibleTop) / 2 + js) / kr.height;
          zs = Bs - Hs, Fs = Bs + Hs;
        } else
          zs = (this.visibleTop - kr.top - js) / kr.height, Fs = (this.visibleBottom - kr.top + js) / kr.height;
        Ds = findPosition(Yr, zs), Ls = findPosition(Yr, Fs);
      } else {
        let js = Yr.total * this.heightOracle.charWidth, zs = Sn * this.heightOracle.charWidth, Fs, Bs;
        if (Ms != null) {
          let Hs = findFraction(Yr, Ms), Ws = ((this.pixelViewport.right - this.pixelViewport.left) / 2 + zs) / js;
          Fs = Hs - Ws, Bs = Hs + Ws;
        } else
          Fs = (this.pixelViewport.left - zs) / js, Bs = (this.pixelViewport.right + zs) / js;
        Ds = findPosition(Yr, Fs), Ls = findPosition(Yr, Bs);
      }
      Ds > kr.from && Cr(kr.from, Ds, kr, Yr), Ls < kr.to && Cr(Ls, kr.to, kr, Yr);
    }
    return er;
  }
  gapSize(Qt, Zt, $n, Sn) {
    let kn = findFraction(Sn, $n) - findFraction(Sn, Zt);
    return this.heightOracle.lineWrapping ? Qt.height * kn : Sn.total * this.heightOracle.charWidth * kn;
  }
  updateLineGaps(Qt) {
    LineGap.same(Qt, this.lineGaps) || (this.lineGaps = Qt, this.lineGapDeco = Decoration.set(Qt.map((Zt) => Zt.draw(this.heightOracle.lineWrapping))));
  }
  computeVisibleRanges() {
    let Qt = this.stateDeco;
    this.lineGaps.length && (Qt = Qt.concat(this.lineGapDeco));
    let Zt = [];
    RangeSet.spans(Qt, this.viewport.from, this.viewport.to, {
      span(Sn, kn) {
        Zt.push({ from: Sn, to: kn });
      },
      point() {
      }
    }, 20);
    let $n = Zt.length != this.visibleRanges.length || this.visibleRanges.some((Sn, kn) => Sn.from != Zt[kn].from || Sn.to != Zt[kn].to);
    return this.visibleRanges = Zt, $n ? 4 : 0;
  }
  lineBlockAt(Qt) {
    return Qt >= this.viewport.from && Qt <= this.viewport.to && this.viewportLines.find((Zt) => Zt.from <= Qt && Zt.to >= Qt) || scaleBlock(this.heightMap.lineAt(Qt, QueryType.ByPos, this.heightOracle, 0, 0), this.scaler);
  }
  lineBlockAtHeight(Qt) {
    return scaleBlock(this.heightMap.lineAt(this.scaler.fromDOM(Qt), QueryType.ByHeight, this.heightOracle, 0, 0), this.scaler);
  }
  scrollAnchorAt(Qt) {
    let Zt = this.lineBlockAtHeight(Qt + 8);
    return Zt.from >= this.viewport.from || this.viewportLines[0].top - Qt > 200 ? Zt : this.viewportLines[0];
  }
  elementAtHeight(Qt) {
    return scaleBlock(this.heightMap.blockAt(this.scaler.fromDOM(Qt), this.heightOracle, 0, 0), this.scaler);
  }
  get docHeight() {
    return this.scaler.toDOM(this.heightMap.height);
  }
  get contentHeight() {
    return this.docHeight + this.paddingTop + this.paddingBottom;
  }
}
class Viewport {
  constructor(Qt, Zt) {
    this.from = Qt, this.to = Zt;
  }
}
function lineStructure(_e, Qt, Zt) {
  let $n = [], Sn = _e, kn = 0;
  return RangeSet.spans(Zt, _e, Qt, {
    span() {
    },
    point(Kn, er) {
      Kn > Sn && ($n.push({ from: Sn, to: Kn }), kn += Kn - Sn), Sn = er;
    }
  }, 20), Sn < Qt && ($n.push({ from: Sn, to: Qt }), kn += Qt - Sn), { total: kn, ranges: $n };
}
function findPosition({ total: _e, ranges: Qt }, Zt) {
  if (Zt <= 0)
    return Qt[0].from;
  if (Zt >= 1)
    return Qt[Qt.length - 1].to;
  let $n = Math.floor(_e * Zt);
  for (let Sn = 0; ; Sn++) {
    let { from: kn, to: Kn } = Qt[Sn], er = Kn - kn;
    if ($n <= er)
      return kn + $n;
    $n -= er;
  }
}
function findFraction(_e, Qt) {
  let Zt = 0;
  for (let { from: $n, to: Sn } of _e.ranges) {
    if (Qt <= Sn) {
      Zt += Qt - $n;
      break;
    }
    Zt += Sn - $n;
  }
  return Zt / _e.total;
}
function find$4(_e, Qt) {
  for (let Zt of _e)
    if (Qt(Zt))
      return Zt;
}
const IdScaler = {
  toDOM(_e) {
    return _e;
  },
  fromDOM(_e) {
    return _e;
  },
  scale: 1
};
class BigScaler {
  constructor(Qt, Zt, $n) {
    let Sn = 0, kn = 0, Kn = 0;
    this.viewports = $n.map(({ from: er, to: Cr }) => {
      let kr = Zt.lineAt(er, QueryType.ByPos, Qt, 0, 0).top, Yr = Zt.lineAt(Cr, QueryType.ByPos, Qt, 0, 0).bottom;
      return Sn += Yr - kr, { from: er, to: Cr, top: kr, bottom: Yr, domTop: 0, domBottom: 0 };
    }), this.scale = (7e6 - Sn) / (Zt.height - Sn);
    for (let er of this.viewports)
      er.domTop = Kn + (er.top - kn) * this.scale, Kn = er.domBottom = er.domTop + (er.bottom - er.top), kn = er.bottom;
  }
  toDOM(Qt) {
    for (let Zt = 0, $n = 0, Sn = 0; ; Zt++) {
      let kn = Zt < this.viewports.length ? this.viewports[Zt] : null;
      if (!kn || Qt < kn.top)
        return Sn + (Qt - $n) * this.scale;
      if (Qt <= kn.bottom)
        return kn.domTop + (Qt - kn.top);
      $n = kn.bottom, Sn = kn.domBottom;
    }
  }
  fromDOM(Qt) {
    for (let Zt = 0, $n = 0, Sn = 0; ; Zt++) {
      let kn = Zt < this.viewports.length ? this.viewports[Zt] : null;
      if (!kn || Qt < kn.domTop)
        return $n + (Qt - Sn) / this.scale;
      if (Qt <= kn.domBottom)
        return kn.top + (Qt - kn.domTop);
      $n = kn.bottom, Sn = kn.domBottom;
    }
  }
}
function scaleBlock(_e, Qt) {
  if (Qt.scale == 1)
    return _e;
  let Zt = Qt.toDOM(_e.top), $n = Qt.toDOM(_e.bottom);
  return new BlockInfo(_e.from, _e.length, Zt, $n - Zt, Array.isArray(_e._content) ? _e._content.map((Sn) => scaleBlock(Sn, Qt)) : _e._content);
}
const theme = /* @__PURE__ */ Facet$2.define({ combine: (_e) => _e.join(" ") }), darkTheme$1 = /* @__PURE__ */ Facet$2.define({ combine: (_e) => _e.indexOf(!0) > -1 }), baseThemeID = /* @__PURE__ */ StyleModule.newName(), baseLightID = /* @__PURE__ */ StyleModule.newName(), baseDarkID = /* @__PURE__ */ StyleModule.newName(), lightDarkIDs = { "&light": "." + baseLightID, "&dark": "." + baseDarkID };
function buildTheme(_e, Qt, Zt) {
  return new StyleModule(Qt, {
    finish($n) {
      return /&/.test($n) ? $n.replace(/&\w*/, (Sn) => {
        if (Sn == "&")
          return _e;
        if (!Zt || !Zt[Sn])
          throw new RangeError(`Unsupported selector: ${Sn}`);
        return Zt[Sn];
      }) : _e + " " + $n;
    }
  });
}
const baseTheme$1 = /* @__PURE__ */ buildTheme("." + baseThemeID, {
  "&": {
    position: "relative !important",
    boxSizing: "border-box",
    "&.cm-focused": {
      // Provide a simple default outline to make sure a focused
      // editor is visually distinct. Can't leave the default behavior
      // because that will apply to the content element, which is
      // inside the scrollable container and doesn't include the
      // gutters. We also can't use an 'auto' outline, since those
      // are, for some reason, drawn behind the element content, which
      // will cause things like the active line background to cover
      // the outline (#297).
      outline: "1px dotted #212121"
    },
    display: "flex !important",
    flexDirection: "column"
  },
  ".cm-scroller": {
    display: "flex !important",
    alignItems: "flex-start !important",
    fontFamily: "monospace",
    lineHeight: 1.4,
    height: "100%",
    overflowX: "auto",
    position: "relative",
    zIndex: 0
  },
  ".cm-content": {
    margin: 0,
    flexGrow: 2,
    flexShrink: 0,
    display: "block",
    whiteSpace: "pre",
    wordWrap: "normal",
    boxSizing: "border-box",
    padding: "4px 0",
    outline: "none",
    "&[contenteditable=true]": {
      WebkitUserModify: "read-write-plaintext-only"
    }
  },
  ".cm-lineWrapping": {
    whiteSpace_fallback: "pre-wrap",
    whiteSpace: "break-spaces",
    wordBreak: "break-word",
    overflowWrap: "anywhere",
    flexShrink: 1
  },
  "&light .cm-content": { caretColor: "black" },
  "&dark .cm-content": { caretColor: "white" },
  ".cm-line": {
    display: "block",
    padding: "0 2px 0 6px"
  },
  ".cm-layer": {
    position: "absolute",
    left: 0,
    top: 0,
    contain: "size style",
    "& > *": {
      position: "absolute"
    }
  },
  "&light .cm-selectionBackground": {
    background: "#d9d9d9"
  },
  "&dark .cm-selectionBackground": {
    background: "#222"
  },
  "&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": {
    background: "#d7d4f0"
  },
  "&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": {
    background: "#233"
  },
  ".cm-cursorLayer": {
    pointerEvents: "none"
  },
  "&.cm-focused > .cm-scroller > .cm-cursorLayer": {
    animation: "steps(1) cm-blink 1.2s infinite"
  },
  // Two animations defined so that we can switch between them to
  // restart the animation without forcing another style
  // recomputation.
  "@keyframes cm-blink": { "0%": {}, "50%": { opacity: 0 }, "100%": {} },
  "@keyframes cm-blink2": { "0%": {}, "50%": { opacity: 0 }, "100%": {} },
  ".cm-cursor, .cm-dropCursor": {
    borderLeft: "1.2px solid black",
    marginLeft: "-0.6px",
    pointerEvents: "none"
  },
  ".cm-cursor": {
    display: "none"
  },
  "&dark .cm-cursor": {
    borderLeftColor: "#444"
  },
  ".cm-dropCursor": {
    position: "absolute"
  },
  "&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor": {
    display: "block"
  },
  "&light .cm-activeLine": { backgroundColor: "#cceeff44" },
  "&dark .cm-activeLine": { backgroundColor: "#99eeff33" },
  "&light .cm-specialChar": { color: "red" },
  "&dark .cm-specialChar": { color: "#f78" },
  ".cm-gutters": {
    flexShrink: 0,
    display: "flex",
    height: "100%",
    boxSizing: "border-box",
    insetInlineStart: 0,
    zIndex: 200
  },
  "&light .cm-gutters": {
    backgroundColor: "#f5f5f5",
    color: "#6c6c6c",
    borderRight: "1px solid #ddd"
  },
  "&dark .cm-gutters": {
    backgroundColor: "#333338",
    color: "#ccc"
  },
  ".cm-gutter": {
    display: "flex !important",
    flexDirection: "column",
    flexShrink: 0,
    boxSizing: "border-box",
    minHeight: "100%",
    overflow: "hidden"
  },
  ".cm-gutterElement": {
    boxSizing: "border-box"
  },
  ".cm-lineNumbers .cm-gutterElement": {
    padding: "0 3px 0 5px",
    minWidth: "20px",
    textAlign: "right",
    whiteSpace: "nowrap"
  },
  "&light .cm-activeLineGutter": {
    backgroundColor: "#e2f2ff"
  },
  "&dark .cm-activeLineGutter": {
    backgroundColor: "#222227"
  },
  ".cm-panels": {
    boxSizing: "border-box",
    position: "sticky",
    left: 0,
    right: 0
  },
  "&light .cm-panels": {
    backgroundColor: "#f5f5f5",
    color: "black"
  },
  "&light .cm-panels-top": {
    borderBottom: "1px solid #ddd"
  },
  "&light .cm-panels-bottom": {
    borderTop: "1px solid #ddd"
  },
  "&dark .cm-panels": {
    backgroundColor: "#333338",
    color: "white"
  },
  ".cm-tab": {
    display: "inline-block",
    overflow: "hidden",
    verticalAlign: "bottom"
  },
  ".cm-widgetBuffer": {
    verticalAlign: "text-top",
    height: "1em",
    width: 0,
    display: "inline"
  },
  ".cm-placeholder": {
    color: "#888",
    display: "inline-block",
    verticalAlign: "top"
  },
  ".cm-highlightSpace:before": {
    content: "attr(data-display)",
    position: "absolute",
    pointerEvents: "none",
    color: "#888"
  },
  ".cm-highlightTab": {
    backgroundImage: `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,
    backgroundSize: "auto 100%",
    backgroundPosition: "right 90%",
    backgroundRepeat: "no-repeat"
  },
  ".cm-trailingSpace": {
    backgroundColor: "#ff332255"
  },
  ".cm-button": {
    verticalAlign: "middle",
    color: "inherit",
    fontSize: "70%",
    padding: ".2em 1em",
    borderRadius: "1px"
  },
  "&light .cm-button": {
    backgroundImage: "linear-gradient(#eff1f5, #d9d9df)",
    border: "1px solid #888",
    "&:active": {
      backgroundImage: "linear-gradient(#b4b4b4, #d0d3d6)"
    }
  },
  "&dark .cm-button": {
    backgroundImage: "linear-gradient(#393939, #111)",
    border: "1px solid #888",
    "&:active": {
      backgroundImage: "linear-gradient(#111, #333)"
    }
  },
  ".cm-textfield": {
    verticalAlign: "middle",
    color: "inherit",
    fontSize: "70%",
    border: "1px solid silver",
    padding: ".2em .5em"
  },
  "&light .cm-textfield": {
    backgroundColor: "white"
  },
  "&dark .cm-textfield": {
    border: "1px solid #555",
    backgroundColor: "inherit"
  }
}, lightDarkIDs);
class DOMChange {
  constructor(Qt, Zt, $n, Sn) {
    this.typeOver = Sn, this.bounds = null, this.text = "";
    let { impreciseHead: kn, impreciseAnchor: Kn } = Qt.docView;
    if (Qt.state.readOnly && Zt > -1)
      this.newSel = null;
    else if (Zt > -1 && (this.bounds = Qt.docView.domBoundsAround(Zt, $n, 0))) {
      let er = kn || Kn ? [] : selectionPoints(Qt), Cr = new DOMReader(er, Qt.state);
      Cr.readRange(this.bounds.startDOM, this.bounds.endDOM), this.text = Cr.text, this.newSel = selectionFromPoints(er, this.bounds.from);
    } else {
      let er = Qt.observer.selectionRange, Cr = kn && kn.node == er.focusNode && kn.offset == er.focusOffset || !contains$4(Qt.contentDOM, er.focusNode) ? Qt.state.selection.main.head : Qt.docView.posFromDOM(er.focusNode, er.focusOffset), kr = Kn && Kn.node == er.anchorNode && Kn.offset == er.anchorOffset || !contains$4(Qt.contentDOM, er.anchorNode) ? Qt.state.selection.main.anchor : Qt.docView.posFromDOM(er.anchorNode, er.anchorOffset);
      this.newSel = EditorSelection.single(kr, Cr);
    }
  }
}
function applyDOMChange(_e, Qt) {
  let Zt, { newSel: $n } = Qt, Sn = _e.state.selection.main, kn = _e.inputState.lastKeyTime > Date.now() - 100 ? _e.inputState.lastKeyCode : -1;
  if (Qt.bounds) {
    let { from: Kn, to: er } = Qt.bounds, Cr = Sn.from, kr = null;
    (kn === 8 || browser.android && Qt.text.length < er - Kn) && (Cr = Sn.to, kr = "end");
    let Yr = findDiff(_e.state.doc.sliceString(Kn, er, LineBreakPlaceholder), Qt.text, Cr - Kn, kr);
    Yr && (browser.chrome && kn == 13 && Yr.toB == Yr.from + 2 && Qt.text.slice(Yr.from, Yr.toB) == LineBreakPlaceholder + LineBreakPlaceholder && Yr.toB--, Zt = {
      from: Kn + Yr.from,
      to: Kn + Yr.toA,
      insert: Text$1.of(Qt.text.slice(Yr.from, Yr.toB).split(LineBreakPlaceholder))
    });
  } else
    $n && (!_e.hasFocus && _e.state.facet(editable) || $n.main.eq(Sn)) && ($n = null);
  if (!Zt && !$n)
    return !1;
  if (!Zt && Qt.typeOver && !Sn.empty && $n && $n.main.empty ? Zt = { from: Sn.from, to: Sn.to, insert: _e.state.doc.slice(Sn.from, Sn.to) } : Zt && Zt.from >= Sn.from && Zt.to <= Sn.to && (Zt.from != Sn.from || Zt.to != Sn.to) && Sn.to - Sn.from - (Zt.to - Zt.from) <= 4 ? Zt = {
    from: Sn.from,
    to: Sn.to,
    insert: _e.state.doc.slice(Sn.from, Zt.from).append(Zt.insert).append(_e.state.doc.slice(Zt.to, Sn.to))
  } : (browser.mac || browser.android) && Zt && Zt.from == Zt.to && Zt.from == Sn.head - 1 && /^\. ?$/.test(Zt.insert.toString()) && _e.contentDOM.getAttribute("autocorrect") == "off" ? ($n && Zt.insert.length == 2 && ($n = EditorSelection.single($n.main.anchor - 1, $n.main.head - 1)), Zt = { from: Sn.from, to: Sn.to, insert: Text$1.of([" "]) }) : browser.chrome && Zt && Zt.from == Zt.to && Zt.from == Sn.head && Zt.insert.toString() == `
 ` && _e.lineWrapping && ($n && ($n = EditorSelection.single($n.main.anchor - 1, $n.main.head - 1)), Zt = { from: Sn.from, to: Sn.to, insert: Text$1.of([" "]) }), Zt) {
    if (browser.ios && _e.inputState.flushIOSKey(_e) || browser.android && (Zt.from == Sn.from && Zt.to == Sn.to && Zt.insert.length == 1 && Zt.insert.lines == 2 && dispatchKey(_e.contentDOM, "Enter", 13) || (Zt.from == Sn.from - 1 && Zt.to == Sn.to && Zt.insert.length == 0 || kn == 8 && Zt.insert.length < Zt.to - Zt.from && Zt.to > Sn.head) && dispatchKey(_e.contentDOM, "Backspace", 8) || Zt.from == Sn.from && Zt.to == Sn.to + 1 && Zt.insert.length == 0 && dispatchKey(_e.contentDOM, "Delete", 46)))
      return !0;
    let Kn = Zt.insert.toString();
    _e.inputState.composing >= 0 && _e.inputState.composing++;
    let er, Cr = () => er || (er = applyDefaultInsert(_e, Zt, $n));
    return _e.state.facet(inputHandler).some((kr) => kr(_e, Zt.from, Zt.to, Kn, Cr)) || _e.dispatch(Cr()), !0;
  } else if ($n && !$n.main.eq(Sn)) {
    let Kn = !1, er = "select";
    return _e.inputState.lastSelectionTime > Date.now() - 50 && (_e.inputState.lastSelectionOrigin == "select" && (Kn = !0), er = _e.inputState.lastSelectionOrigin), _e.dispatch({ selection: $n, scrollIntoView: Kn, userEvent: er }), !0;
  } else
    return !1;
}
function applyDefaultInsert(_e, Qt, Zt) {
  let $n, Sn = _e.state, kn = Sn.selection.main;
  if (Qt.from >= kn.from && Qt.to <= kn.to && Qt.to - Qt.from >= (kn.to - kn.from) / 3 && (!Zt || Zt.main.empty && Zt.main.from == Qt.from + Qt.insert.length) && _e.inputState.composing < 0) {
    let er = kn.from < Qt.from ? Sn.sliceDoc(kn.from, Qt.from) : "", Cr = kn.to > Qt.to ? Sn.sliceDoc(Qt.to, kn.to) : "";
    $n = Sn.replaceSelection(_e.state.toText(er + Qt.insert.sliceString(0, void 0, _e.state.lineBreak) + Cr));
  } else {
    let er = Sn.changes(Qt), Cr = Zt && Zt.main.to <= er.newLength ? Zt.main : void 0;
    if (Sn.selection.ranges.length > 1 && _e.inputState.composing >= 0 && Qt.to <= kn.to && Qt.to >= kn.to - 10) {
      let kr = _e.state.sliceDoc(Qt.from, Qt.to), Yr = findCompositionNode(_e, Qt.insert.length - (Qt.to - Qt.from)) || _e.state.doc.lineAt(kn.head), Ms = kn.to - Qt.to, Ds = kn.to - kn.from;
      $n = Sn.changeByRange((Ls) => {
        if (Ls.from == kn.from && Ls.to == kn.to)
          return { changes: er, range: Cr || Ls.map(er) };
        let js = Ls.to - Ms, zs = js - kr.length;
        if (Ls.to - Ls.from != Ds || _e.state.sliceDoc(zs, js) != kr || // Unfortunately, there's no way to make multiple
        // changes in the same node work without aborting
        // composition, so cursors in the composition range are
        // ignored.
        Yr && Ls.to >= Yr.from && Ls.from <= Yr.to)
          return { range: Ls };
        let Fs = Sn.changes({ from: zs, to: js, insert: Qt.insert }), Bs = Ls.to - kn.to;
        return {
          changes: Fs,
          range: Cr ? EditorSelection.range(Math.max(0, Cr.anchor + Bs), Math.max(0, Cr.head + Bs)) : Ls.map(Fs)
        };
      });
    } else
      $n = {
        changes: er,
        selection: Cr && Sn.selection.replaceRange(Cr)
      };
  }
  let Kn = "input.type";
  return (_e.composing || _e.inputState.compositionPendingChange && _e.inputState.compositionEndedAt > Date.now() - 50) && (_e.inputState.compositionPendingChange = !1, Kn += ".compose", _e.inputState.compositionFirstChange && (Kn += ".start", _e.inputState.compositionFirstChange = !1)), Sn.update($n, { userEvent: Kn, scrollIntoView: !0 });
}
function findDiff(_e, Qt, Zt, $n) {
  let Sn = Math.min(_e.length, Qt.length), kn = 0;
  for (; kn < Sn && _e.charCodeAt(kn) == Qt.charCodeAt(kn); )
    kn++;
  if (kn == Sn && _e.length == Qt.length)
    return null;
  let Kn = _e.length, er = Qt.length;
  for (; Kn > 0 && er > 0 && _e.charCodeAt(Kn - 1) == Qt.charCodeAt(er - 1); )
    Kn--, er--;
  if ($n == "end") {
    let Cr = Math.max(0, kn - Math.min(Kn, er));
    Zt -= Kn + Cr - kn;
  }
  if (Kn < kn && _e.length < Qt.length) {
    let Cr = Zt <= kn && Zt >= Kn ? kn - Zt : 0;
    kn -= Cr, er = kn + (er - Kn), Kn = kn;
  } else if (er < kn) {
    let Cr = Zt <= kn && Zt >= er ? kn - Zt : 0;
    kn -= Cr, Kn = kn + (Kn - er), er = kn;
  }
  return { from: kn, toA: Kn, toB: er };
}
function selectionPoints(_e) {
  let Qt = [];
  if (_e.root.activeElement != _e.contentDOM)
    return Qt;
  let { anchorNode: Zt, anchorOffset: $n, focusNode: Sn, focusOffset: kn } = _e.observer.selectionRange;
  return Zt && (Qt.push(new DOMPoint(Zt, $n)), (Sn != Zt || kn != $n) && Qt.push(new DOMPoint(Sn, kn))), Qt;
}
function selectionFromPoints(_e, Qt) {
  if (_e.length == 0)
    return null;
  let Zt = _e[0].pos, $n = _e.length == 2 ? _e[1].pos : Zt;
  return Zt > -1 && $n > -1 ? EditorSelection.single(Zt + Qt, $n + Qt) : null;
}
const observeOptions = {
  childList: !0,
  characterData: !0,
  subtree: !0,
  attributes: !0,
  characterDataOldValue: !0
}, useCharData = browser.ie && browser.ie_version <= 11;
class DOMObserver {
  constructor(Qt) {
    this.view = Qt, this.active = !1, this.selectionRange = new DOMSelectionState(), this.selectionChanged = !1, this.delayedFlush = -1, this.resizeTimeout = -1, this.queue = [], this.delayedAndroidKey = null, this.flushingAndroidKey = -1, this.lastChange = 0, this.scrollTargets = [], this.intersection = null, this.resizeScroll = null, this.resizeContent = null, this.intersecting = !1, this.gapIntersection = null, this.gaps = [], this.parentCheck = -1, this.dom = Qt.contentDOM, this.observer = new MutationObserver((Zt) => {
      for (let $n of Zt)
        this.queue.push($n);
      (browser.ie && browser.ie_version <= 11 || browser.ios && Qt.composing) && Zt.some(($n) => $n.type == "childList" && $n.removedNodes.length || $n.type == "characterData" && $n.oldValue.length > $n.target.nodeValue.length) ? this.flushSoon() : this.flush();
    }), useCharData && (this.onCharData = (Zt) => {
      this.queue.push({
        target: Zt.target,
        type: "characterData",
        oldValue: Zt.prevValue
      }), this.flushSoon();
    }), this.onSelectionChange = this.onSelectionChange.bind(this), this.onResize = this.onResize.bind(this), this.onPrint = this.onPrint.bind(this), this.onScroll = this.onScroll.bind(this), typeof ResizeObserver == "function" && (this.resizeScroll = new ResizeObserver(() => {
      var Zt;
      ((Zt = this.view.docView) === null || Zt === void 0 ? void 0 : Zt.lastUpdate) < Date.now() - 75 && this.onResize();
    }), this.resizeScroll.observe(Qt.scrollDOM), this.resizeContent = new ResizeObserver(() => this.view.requestMeasure()), this.resizeContent.observe(Qt.contentDOM)), this.addWindowListeners(this.win = Qt.win), this.start(), typeof IntersectionObserver == "function" && (this.intersection = new IntersectionObserver((Zt) => {
      this.parentCheck < 0 && (this.parentCheck = setTimeout(this.listenForScroll.bind(this), 1e3)), Zt.length > 0 && Zt[Zt.length - 1].intersectionRatio > 0 != this.intersecting && (this.intersecting = !this.intersecting, this.intersecting != this.view.inView && this.onScrollChanged(document.createEvent("Event")));
    }, { threshold: [0, 1e-3] }), this.intersection.observe(this.dom), this.gapIntersection = new IntersectionObserver((Zt) => {
      Zt.length > 0 && Zt[Zt.length - 1].intersectionRatio > 0 && this.onScrollChanged(document.createEvent("Event"));
    }, {})), this.listenForScroll(), this.readSelectionRange();
  }
  onScrollChanged(Qt) {
    this.view.inputState.runScrollHandlers(this.view, Qt), this.intersecting && this.view.measure();
  }
  onScroll(Qt) {
    this.intersecting && this.flush(!1), this.onScrollChanged(Qt);
  }
  onResize() {
    this.resizeTimeout < 0 && (this.resizeTimeout = setTimeout(() => {
      this.resizeTimeout = -1, this.view.requestMeasure();
    }, 50));
  }
  onPrint() {
    this.view.viewState.printing = !0, this.view.measure(), setTimeout(() => {
      this.view.viewState.printing = !1, this.view.requestMeasure();
    }, 500);
  }
  updateGaps(Qt) {
    if (this.gapIntersection && (Qt.length != this.gaps.length || this.gaps.some((Zt, $n) => Zt != Qt[$n]))) {
      this.gapIntersection.disconnect();
      for (let Zt of Qt)
        this.gapIntersection.observe(Zt);
      this.gaps = Qt;
    }
  }
  onSelectionChange(Qt) {
    let Zt = this.selectionChanged;
    if (!this.readSelectionRange() || this.delayedAndroidKey)
      return;
    let { view: $n } = this, Sn = this.selectionRange;
    if ($n.state.facet(editable) ? $n.root.activeElement != this.dom : !hasSelection($n.dom, Sn))
      return;
    let kn = Sn.anchorNode && $n.docView.nearest(Sn.anchorNode);
    if (kn && kn.ignoreEvent(Qt)) {
      Zt || (this.selectionChanged = !1);
      return;
    }
    (browser.ie && browser.ie_version <= 11 || browser.android && browser.chrome) && !$n.state.selection.main.empty && // (Selection.isCollapsed isn't reliable on IE)
    Sn.focusNode && isEquivalentPosition(Sn.focusNode, Sn.focusOffset, Sn.anchorNode, Sn.anchorOffset) ? this.flushSoon() : this.flush(!1);
  }
  readSelectionRange() {
    let { view: Qt } = this, Zt = browser.safari && Qt.root.nodeType == 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariSelectionRangeHack(this.view) || getSelection(Qt.root);
    if (!Zt || this.selectionRange.eq(Zt))
      return !1;
    let $n = hasSelection(this.dom, Zt);
    return $n && !this.selectionChanged && Qt.inputState.lastFocusTime > Date.now() - 200 && Qt.inputState.lastTouchTime < Date.now() - 300 && atElementStart(this.dom, Zt) ? (this.view.inputState.lastFocusTime = 0, Qt.docView.updateSelection(), !1) : (this.selectionRange.setRange(Zt), $n && (this.selectionChanged = !0), !0);
  }
  setSelectionRange(Qt, Zt) {
    this.selectionRange.set(Qt.node, Qt.offset, Zt.node, Zt.offset), this.selectionChanged = !1;
  }
  clearSelectionRange() {
    this.selectionRange.set(null, 0, null, 0);
  }
  listenForScroll() {
    this.parentCheck = -1;
    let Qt = 0, Zt = null;
    for (let $n = this.dom; $n; )
      if ($n.nodeType == 1)
        !Zt && Qt < this.scrollTargets.length && this.scrollTargets[Qt] == $n ? Qt++ : Zt || (Zt = this.scrollTargets.slice(0, Qt)), Zt && Zt.push($n), $n = $n.assignedSlot || $n.parentNode;
      else if ($n.nodeType == 11)
        $n = $n.host;
      else
        break;
    if (Qt < this.scrollTargets.length && !Zt && (Zt = this.scrollTargets.slice(0, Qt)), Zt) {
      for (let $n of this.scrollTargets)
        $n.removeEventListener("scroll", this.onScroll);
      for (let $n of this.scrollTargets = Zt)
        $n.addEventListener("scroll", this.onScroll);
    }
  }
  ignore(Qt) {
    if (!this.active)
      return Qt();
    try {
      return this.stop(), Qt();
    } finally {
      this.start(), this.clear();
    }
  }
  start() {
    this.active || (this.observer.observe(this.dom, observeOptions), useCharData && this.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.active = !0);
  }
  stop() {
    this.active && (this.active = !1, this.observer.disconnect(), useCharData && this.dom.removeEventListener("DOMCharacterDataModified", this.onCharData));
  }
  // Throw away any pending changes
  clear() {
    this.processRecords(), this.queue.length = 0, this.selectionChanged = !1;
  }
  // Chrome Android, especially in combination with GBoard, not only
  // doesn't reliably fire regular key events, but also often
  // surrounds the effect of enter or backspace with a bunch of
  // composition events that, when interrupted, cause text duplication
  // or other kinds of corruption. This hack makes the editor back off
  // from handling DOM changes for a moment when such a key is
  // detected (via beforeinput or keydown), and then tries to flush
  // them or, if that has no effect, dispatches the given key.
  delayAndroidKey(Qt, Zt) {
    var $n;
    if (!this.delayedAndroidKey) {
      let Sn = () => {
        let kn = this.delayedAndroidKey;
        kn && (this.clearDelayedAndroidKey(), this.view.inputState.lastKeyCode = kn.keyCode, this.view.inputState.lastKeyTime = Date.now(), !this.flush() && kn.force && dispatchKey(this.dom, kn.key, kn.keyCode));
      };
      this.flushingAndroidKey = this.view.win.requestAnimationFrame(Sn);
    }
    (!this.delayedAndroidKey || Qt == "Enter") && (this.delayedAndroidKey = {
      key: Qt,
      keyCode: Zt,
      // Only run the key handler when no changes are detected if
      // this isn't coming right after another change, in which case
      // it is probably part of a weird chain of updates, and should
      // be ignored if it returns the DOM to its previous state.
      force: this.lastChange < Date.now() - 50 || !!(!(($n = this.delayedAndroidKey) === null || $n === void 0) && $n.force)
    });
  }
  clearDelayedAndroidKey() {
    this.win.cancelAnimationFrame(this.flushingAndroidKey), this.delayedAndroidKey = null, this.flushingAndroidKey = -1;
  }
  flushSoon() {
    this.delayedFlush < 0 && (this.delayedFlush = this.view.win.requestAnimationFrame(() => {
      this.delayedFlush = -1, this.flush();
    }));
  }
  forceFlush() {
    this.delayedFlush >= 0 && (this.view.win.cancelAnimationFrame(this.delayedFlush), this.delayedFlush = -1), this.flush();
  }
  pendingRecords() {
    for (let Qt of this.observer.takeRecords())
      this.queue.push(Qt);
    return this.queue;
  }
  processRecords() {
    let Qt = this.pendingRecords();
    Qt.length && (this.queue = []);
    let Zt = -1, $n = -1, Sn = !1;
    for (let kn of Qt) {
      let Kn = this.readMutation(kn);
      Kn && (Kn.typeOver && (Sn = !0), Zt == -1 ? { from: Zt, to: $n } = Kn : (Zt = Math.min(Kn.from, Zt), $n = Math.max(Kn.to, $n)));
    }
    return { from: Zt, to: $n, typeOver: Sn };
  }
  readChange() {
    let { from: Qt, to: Zt, typeOver: $n } = this.processRecords(), Sn = this.selectionChanged && hasSelection(this.dom, this.selectionRange);
    return Qt < 0 && !Sn ? null : (Qt > -1 && (this.lastChange = Date.now()), this.view.inputState.lastFocusTime = 0, this.selectionChanged = !1, new DOMChange(this.view, Qt, Zt, $n));
  }
  // Apply pending changes, if any
  flush(Qt = !0) {
    if (this.delayedFlush >= 0 || this.delayedAndroidKey)
      return !1;
    Qt && this.readSelectionRange();
    let Zt = this.readChange();
    if (!Zt)
      return !1;
    let $n = this.view.state, Sn = applyDOMChange(this.view, Zt);
    return this.view.state == $n && this.view.update([]), Sn;
  }
  readMutation(Qt) {
    let Zt = this.view.docView.nearest(Qt.target);
    if (!Zt || Zt.ignoreMutation(Qt))
      return null;
    if (Zt.markDirty(Qt.type == "attributes"), Qt.type == "attributes" && (Zt.flags |= 4), Qt.type == "childList") {
      let $n = findChild(Zt, Qt.previousSibling || Qt.target.previousSibling, -1), Sn = findChild(Zt, Qt.nextSibling || Qt.target.nextSibling, 1);
      return {
        from: $n ? Zt.posAfter($n) : Zt.posAtStart,
        to: Sn ? Zt.posBefore(Sn) : Zt.posAtEnd,
        typeOver: !1
      };
    } else
      return Qt.type == "characterData" ? { from: Zt.posAtStart, to: Zt.posAtEnd, typeOver: Qt.target.nodeValue == Qt.oldValue } : null;
  }
  setWindow(Qt) {
    Qt != this.win && (this.removeWindowListeners(this.win), this.win = Qt, this.addWindowListeners(this.win));
  }
  addWindowListeners(Qt) {
    Qt.addEventListener("resize", this.onResize), Qt.addEventListener("beforeprint", this.onPrint), Qt.addEventListener("scroll", this.onScroll), Qt.document.addEventListener("selectionchange", this.onSelectionChange);
  }
  removeWindowListeners(Qt) {
    Qt.removeEventListener("scroll", this.onScroll), Qt.removeEventListener("resize", this.onResize), Qt.removeEventListener("beforeprint", this.onPrint), Qt.document.removeEventListener("selectionchange", this.onSelectionChange);
  }
  destroy() {
    var Qt, Zt, $n, Sn;
    this.stop(), (Qt = this.intersection) === null || Qt === void 0 || Qt.disconnect(), (Zt = this.gapIntersection) === null || Zt === void 0 || Zt.disconnect(), ($n = this.resizeScroll) === null || $n === void 0 || $n.disconnect(), (Sn = this.resizeContent) === null || Sn === void 0 || Sn.disconnect();
    for (let kn of this.scrollTargets)
      kn.removeEventListener("scroll", this.onScroll);
    this.removeWindowListeners(this.win), clearTimeout(this.parentCheck), clearTimeout(this.resizeTimeout), this.win.cancelAnimationFrame(this.delayedFlush), this.win.cancelAnimationFrame(this.flushingAndroidKey);
  }
}
function findChild(_e, Qt, Zt) {
  for (; Qt; ) {
    let $n = ContentView.get(Qt);
    if ($n && $n.parent == _e)
      return $n;
    let Sn = Qt.parentNode;
    Qt = Sn != _e.dom ? Sn : Zt > 0 ? Qt.nextSibling : Qt.previousSibling;
  }
  return null;
}
function safariSelectionRangeHack(_e) {
  let Qt = null;
  function Zt(Cr) {
    Cr.preventDefault(), Cr.stopImmediatePropagation(), Qt = Cr.getTargetRanges()[0];
  }
  if (_e.contentDOM.addEventListener("beforeinput", Zt, !0), _e.dom.ownerDocument.execCommand("indent"), _e.contentDOM.removeEventListener("beforeinput", Zt, !0), !Qt)
    return null;
  let $n = Qt.startContainer, Sn = Qt.startOffset, kn = Qt.endContainer, Kn = Qt.endOffset, er = _e.docView.domAtPos(_e.state.selection.main.anchor);
  return isEquivalentPosition(er.node, er.offset, kn, Kn) && ([$n, Sn, kn, Kn] = [kn, Kn, $n, Sn]), { anchorNode: $n, anchorOffset: Sn, focusNode: kn, focusOffset: Kn };
}
class EditorView {
  /**
  The current editor state.
  */
  get state() {
    return this.viewState.state;
  }
  /**
  To be able to display large documents without consuming too much
  memory or overloading the browser, CodeMirror only draws the
  code that is visible (plus a margin around it) to the DOM. This
  property tells you the extent of the current drawn viewport, in
  document positions.
  */
  get viewport() {
    return this.viewState.viewport;
  }
  /**
  When there are, for example, large collapsed ranges in the
  viewport, its size can be a lot bigger than the actual visible
  content. Thus, if you are doing something like styling the
  content in the viewport, it is preferable to only do so for
  these ranges, which are the subset of the viewport that is
  actually drawn.
  */
  get visibleRanges() {
    return this.viewState.visibleRanges;
  }
  /**
  Returns false when the editor is entirely scrolled out of view
  or otherwise hidden.
  */
  get inView() {
    return this.viewState.inView;
  }
  /**
  Indicates whether the user is currently composing text via
  [IME](https://en.wikipedia.org/wiki/Input_method), and at least
  one change has been made in the current composition.
  */
  get composing() {
    return this.inputState.composing > 0;
  }
  /**
  Indicates whether the user is currently in composing state. Note
  that on some platforms, like Android, this will be the case a
  lot, since just putting the cursor on a word starts a
  composition there.
  */
  get compositionStarted() {
    return this.inputState.composing >= 0;
  }
  /**
  The document or shadow root that the view lives in.
  */
  get root() {
    return this._root;
  }
  /**
  @internal
  */
  get win() {
    return this.dom.ownerDocument.defaultView || window;
  }
  /**
  Construct a new view. You'll want to either provide a `parent`
  option, or put `view.dom` into your document after creating a
  view, so that the user can see the editor.
  */
  constructor(Qt = {}) {
    this.plugins = [], this.pluginMap = /* @__PURE__ */ new Map(), this.editorAttrs = {}, this.contentAttrs = {}, this.bidiCache = [], this.destroyed = !1, this.updateState = 2, this.measureScheduled = -1, this.measureRequests = [], this.contentDOM = document.createElement("div"), this.scrollDOM = document.createElement("div"), this.scrollDOM.tabIndex = -1, this.scrollDOM.className = "cm-scroller", this.scrollDOM.appendChild(this.contentDOM), this.announceDOM = document.createElement("div"), this.announceDOM.style.cssText = "position: fixed; top: -10000px", this.announceDOM.setAttribute("aria-live", "polite"), this.dom = document.createElement("div"), this.dom.appendChild(this.announceDOM), this.dom.appendChild(this.scrollDOM);
    let { dispatch: Zt } = Qt;
    this.dispatchTransactions = Qt.dispatchTransactions || Zt && (($n) => $n.forEach((Sn) => Zt(Sn, this))) || (($n) => this.update($n)), this.dispatch = this.dispatch.bind(this), this._root = Qt.root || getRoot$1(Qt.parent) || document, this.viewState = new ViewState(Qt.state || EditorState.create(Qt)), this.plugins = this.state.facet(viewPlugin).map(($n) => new PluginInstance($n));
    for (let $n of this.plugins)
      $n.update(this);
    this.observer = new DOMObserver(this), this.inputState = new InputState(this), this.inputState.ensureHandlers(this, this.plugins), this.docView = new DocView(this), this.mountStyles(), this.updateAttrs(), this.updateState = 0, this.requestMeasure(), Qt.parent && Qt.parent.appendChild(this.dom);
  }
  dispatch(...Qt) {
    let Zt = Qt.length == 1 && Qt[0] instanceof Transaction ? Qt : Qt.length == 1 && Array.isArray(Qt[0]) ? Qt[0] : [this.state.update(...Qt)];
    this.dispatchTransactions(Zt, this);
  }
  /**
  Update the view for the given array of transactions. This will
  update the visible document and selection to match the state
  produced by the transactions, and notify view plugins of the
  change. You should usually call
  [`dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch) instead, which uses this
  as a primitive.
  */
  update(Qt) {
    if (this.updateState != 0)
      throw new Error("Calls to EditorView.update are not allowed while an update is in progress");
    let Zt = !1, $n = !1, Sn, kn = this.state;
    for (let Ds of Qt) {
      if (Ds.startState != kn)
        throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");
      kn = Ds.state;
    }
    if (this.destroyed) {
      this.viewState.state = kn;
      return;
    }
    let Kn = this.hasFocus, er = 0, Cr = null;
    Qt.some((Ds) => Ds.annotation(isFocusChange)) ? (this.inputState.notifiedFocused = Kn, er = 1) : Kn != this.inputState.notifiedFocused && (this.inputState.notifiedFocused = Kn, Cr = focusChangeTransaction(kn, Kn), Cr || (er = 1));
    let kr = this.observer.delayedAndroidKey, Yr = null;
    if (kr ? (this.observer.clearDelayedAndroidKey(), Yr = this.observer.readChange(), (Yr && !this.state.doc.eq(kn.doc) || !this.state.selection.eq(kn.selection)) && (Yr = null)) : this.observer.clear(), kn.facet(EditorState.phrases) != this.state.facet(EditorState.phrases))
      return this.setState(kn);
    Sn = ViewUpdate.create(this, kn, Qt), Sn.flags |= er;
    let Ms = this.viewState.scrollTarget;
    try {
      this.updateState = 2;
      for (let Ds of Qt) {
        if (Ms && (Ms = Ms.map(Ds.changes)), Ds.scrollIntoView) {
          let { main: Ls } = Ds.state.selection;
          Ms = new ScrollTarget(Ls.empty ? Ls : EditorSelection.cursor(Ls.head, Ls.head > Ls.anchor ? -1 : 1));
        }
        for (let Ls of Ds.effects)
          Ls.is(scrollIntoView) && (Ms = Ls.value);
      }
      this.viewState.update(Sn, Ms), this.bidiCache = CachedOrder.update(this.bidiCache, Sn.changes), Sn.empty || (this.updatePlugins(Sn), this.inputState.update(Sn)), Zt = this.docView.update(Sn), this.state.facet(styleModule) != this.styleModules && this.mountStyles(), $n = this.updateAttrs(), this.showAnnouncements(Qt), this.docView.updateSelection(Zt, Qt.some((Ds) => Ds.isUserEvent("select.pointer")));
    } finally {
      this.updateState = 0;
    }
    if (Sn.startState.facet(theme) != Sn.state.facet(theme) && (this.viewState.mustMeasureContent = !0), (Zt || $n || Ms || this.viewState.mustEnforceCursorAssoc || this.viewState.mustMeasureContent) && this.requestMeasure(), !Sn.empty)
      for (let Ds of this.state.facet(updateListener))
        Ds(Sn);
    (Cr || Yr) && Promise.resolve().then(() => {
      Cr && this.state == Cr.startState && this.dispatch(Cr), Yr && !applyDOMChange(this, Yr) && kr.force && dispatchKey(this.contentDOM, kr.key, kr.keyCode);
    });
  }
  /**
  Reset the view to the given state. (This will cause the entire
  document to be redrawn and all view plugins to be reinitialized,
  so you should probably only use it when the new state isn't
  derived from the old state. Otherwise, use
  [`dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch) instead.)
  */
  setState(Qt) {
    if (this.updateState != 0)
      throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");
    if (this.destroyed) {
      this.viewState.state = Qt;
      return;
    }
    this.updateState = 2;
    let Zt = this.hasFocus;
    try {
      for (let $n of this.plugins)
        $n.destroy(this);
      this.viewState = new ViewState(Qt), this.plugins = Qt.facet(viewPlugin).map(($n) => new PluginInstance($n)), this.pluginMap.clear();
      for (let $n of this.plugins)
        $n.update(this);
      this.docView = new DocView(this), this.inputState.ensureHandlers(this, this.plugins), this.mountStyles(), this.updateAttrs(), this.bidiCache = [];
    } finally {
      this.updateState = 0;
    }
    Zt && this.focus(), this.requestMeasure();
  }
  updatePlugins(Qt) {
    let Zt = Qt.startState.facet(viewPlugin), $n = Qt.state.facet(viewPlugin);
    if (Zt != $n) {
      let Sn = [];
      for (let kn of $n) {
        let Kn = Zt.indexOf(kn);
        if (Kn < 0)
          Sn.push(new PluginInstance(kn));
        else {
          let er = this.plugins[Kn];
          er.mustUpdate = Qt, Sn.push(er);
        }
      }
      for (let kn of this.plugins)
        kn.mustUpdate != Qt && kn.destroy(this);
      this.plugins = Sn, this.pluginMap.clear(), this.inputState.ensureHandlers(this, this.plugins);
    } else
      for (let Sn of this.plugins)
        Sn.mustUpdate = Qt;
    for (let Sn = 0; Sn < this.plugins.length; Sn++)
      this.plugins[Sn].update(this);
  }
  /**
  @internal
  */
  measure(Qt = !0) {
    if (this.destroyed)
      return;
    if (this.measureScheduled > -1 && this.win.cancelAnimationFrame(this.measureScheduled), this.observer.delayedAndroidKey) {
      this.measureScheduled = -1, this.requestMeasure();
      return;
    }
    this.measureScheduled = 0, Qt && this.observer.forceFlush();
    let Zt = null, $n = this.scrollDOM, { scrollTop: Sn } = $n, { scrollAnchorPos: kn, scrollAnchorHeight: Kn } = this.viewState;
    Sn != this.viewState.scrollTop && (Kn = -1), this.viewState.scrollAnchorHeight = -1;
    try {
      for (let er = 0; ; er++) {
        if (Kn < 0)
          if (isScrolledToBottom($n))
            kn = -1, Kn = this.viewState.heightMap.height;
          else {
            let Ls = this.viewState.scrollAnchorAt(Sn);
            kn = Ls.from, Kn = Ls.top;
          }
        this.updateState = 1;
        let Cr = this.viewState.measure(this);
        if (!Cr && !this.measureRequests.length && this.viewState.scrollTarget == null)
          break;
        if (er > 5) {
          console.warn(this.measureRequests.length ? "Measure loop restarted more than 5 times" : "Viewport failed to stabilize");
          break;
        }
        let kr = [];
        Cr & 4 || ([this.measureRequests, kr] = [kr, this.measureRequests]);
        let Yr = kr.map((Ls) => {
          try {
            return Ls.read(this);
          } catch (js) {
            return logException(this.state, js), BadMeasure;
          }
        }), Ms = ViewUpdate.create(this, this.state, []), Ds = !1;
        Ms.flags |= Cr, Zt ? Zt.flags |= Cr : Zt = Ms, this.updateState = 2, Ms.empty || (this.updatePlugins(Ms), this.inputState.update(Ms), this.updateAttrs(), Ds = this.docView.update(Ms));
        for (let Ls = 0; Ls < kr.length; Ls++)
          if (Yr[Ls] != BadMeasure)
            try {
              let js = kr[Ls];
              js.write && js.write(Yr[Ls], this);
            } catch (js) {
              logException(this.state, js);
            }
        if (Ds && this.docView.updateSelection(!0), !Ms.viewportChanged && this.measureRequests.length == 0) {
          if (this.viewState.editorHeight)
            if (this.viewState.scrollTarget) {
              this.docView.scrollIntoView(this.viewState.scrollTarget), this.viewState.scrollTarget = null;
              continue;
            } else {
              let js = (kn < 0 ? this.viewState.heightMap.height : this.viewState.lineBlockAt(kn).top) - Kn;
              if (js > 1 || js < -1) {
                Sn = $n.scrollTop = Sn + js, Kn = -1;
                continue;
              }
            }
          break;
        }
      }
    } finally {
      this.updateState = 0, this.measureScheduled = -1;
    }
    if (Zt && !Zt.empty)
      for (let er of this.state.facet(updateListener))
        er(Zt);
  }
  /**
  Get the CSS classes for the currently active editor themes.
  */
  get themeClasses() {
    return baseThemeID + " " + (this.state.facet(darkTheme$1) ? baseDarkID : baseLightID) + " " + this.state.facet(theme);
  }
  updateAttrs() {
    let Qt = attrsFromFacet(this, editorAttributes, {
      class: "cm-editor" + (this.hasFocus ? " cm-focused " : " ") + this.themeClasses
    }), Zt = {
      spellcheck: "false",
      autocorrect: "off",
      autocapitalize: "off",
      translate: "no",
      contenteditable: this.state.facet(editable) ? "true" : "false",
      class: "cm-content",
      style: `${browser.tabSize}: ${this.state.tabSize}`,
      role: "textbox",
      "aria-multiline": "true"
    };
    this.state.readOnly && (Zt["aria-readonly"] = "true"), attrsFromFacet(this, contentAttributes, Zt);
    let $n = this.observer.ignore(() => {
      let Sn = updateAttrs(this.contentDOM, this.contentAttrs, Zt), kn = updateAttrs(this.dom, this.editorAttrs, Qt);
      return Sn || kn;
    });
    return this.editorAttrs = Qt, this.contentAttrs = Zt, $n;
  }
  showAnnouncements(Qt) {
    let Zt = !0;
    for (let $n of Qt)
      for (let Sn of $n.effects)
        if (Sn.is(EditorView.announce)) {
          Zt && (this.announceDOM.textContent = ""), Zt = !1;
          let kn = this.announceDOM.appendChild(document.createElement("div"));
          kn.textContent = Sn.value;
        }
  }
  mountStyles() {
    this.styleModules = this.state.facet(styleModule);
    let Qt = this.state.facet(EditorView.cspNonce);
    StyleModule.mount(this.root, this.styleModules.concat(baseTheme$1).reverse(), Qt ? { nonce: Qt } : void 0);
  }
  readMeasured() {
    if (this.updateState == 2)
      throw new Error("Reading the editor layout isn't allowed during an update");
    this.updateState == 0 && this.measureScheduled > -1 && this.measure(!1);
  }
  /**
  Schedule a layout measurement, optionally providing callbacks to
  do custom DOM measuring followed by a DOM write phase. Using
  this is preferable reading DOM layout directly from, for
  example, an event handler, because it'll make sure measuring and
  drawing done by other components is synchronized, avoiding
  unnecessary DOM layout computations.
  */
  requestMeasure(Qt) {
    if (this.measureScheduled < 0 && (this.measureScheduled = this.win.requestAnimationFrame(() => this.measure())), Qt) {
      if (this.measureRequests.indexOf(Qt) > -1)
        return;
      if (Qt.key != null) {
        for (let Zt = 0; Zt < this.measureRequests.length; Zt++)
          if (this.measureRequests[Zt].key === Qt.key) {
            this.measureRequests[Zt] = Qt;
            return;
          }
      }
      this.measureRequests.push(Qt);
    }
  }
  /**
  Get the value of a specific plugin, if present. Note that
  plugins that crash can be dropped from a view, so even when you
  know you registered a given plugin, it is recommended to check
  the return value of this method.
  */
  plugin(Qt) {
    let Zt = this.pluginMap.get(Qt);
    return (Zt === void 0 || Zt && Zt.spec != Qt) && this.pluginMap.set(Qt, Zt = this.plugins.find(($n) => $n.spec == Qt) || null), Zt && Zt.update(this).value;
  }
  /**
  The top position of the document, in screen coordinates. This
  may be negative when the editor is scrolled down. Points
  directly to the top of the first line, not above the padding.
  */
  get documentTop() {
    return this.contentDOM.getBoundingClientRect().top + this.viewState.paddingTop;
  }
  /**
  Reports the padding above and below the document.
  */
  get documentPadding() {
    return { top: this.viewState.paddingTop, bottom: this.viewState.paddingBottom };
  }
  /**
  Find the text line or block widget at the given vertical
  position (which is interpreted as relative to the [top of the
  document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop)).
  */
  elementAtHeight(Qt) {
    return this.readMeasured(), this.viewState.elementAtHeight(Qt);
  }
  /**
  Find the line block (see
  [`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) at the given
  height, again interpreted relative to the [top of the
  document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop).
  */
  lineBlockAtHeight(Qt) {
    return this.readMeasured(), this.viewState.lineBlockAtHeight(Qt);
  }
  /**
  Get the extent and vertical position of all [line
  blocks](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) in the viewport. Positions
  are relative to the [top of the
  document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop);
  */
  get viewportLineBlocks() {
    return this.viewState.viewportLines;
  }
  /**
  Find the line block around the given document position. A line
  block is a range delimited on both sides by either a
  non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^replace) line breaks, or the
  start/end of the document. It will usually just hold a line of
  text, but may be broken into multiple textblocks by block
  widgets.
  */
  lineBlockAt(Qt) {
    return this.viewState.lineBlockAt(Qt);
  }
  /**
  The editor's total content height.
  */
  get contentHeight() {
    return this.viewState.contentHeight;
  }
  /**
  Move a cursor position by [grapheme
  cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak). `forward` determines whether
  the motion is away from the line start, or towards it. In
  bidirectional text, the line is traversed in visual order, using
  the editor's [text direction](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection).
  When the start position was the last one on the line, the
  returned position will be across the line break. If there is no
  further line, the original position is returned.
  
  By default, this method moves over a single cluster. The
  optional `by` argument can be used to move across more. It will
  be called with the first cluster as argument, and should return
  a predicate that determines, for each subsequent cluster,
  whether it should also be moved over.
  */
  moveByChar(Qt, Zt, $n) {
    return skipAtoms(this, Qt, moveByChar(this, Qt, Zt, $n));
  }
  /**
  Move a cursor position across the next group of either
  [letters](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) or non-letter
  non-whitespace characters.
  */
  moveByGroup(Qt, Zt) {
    return skipAtoms(this, Qt, moveByChar(this, Qt, Zt, ($n) => byGroup(this, Qt.head, $n)));
  }
  /**
  Move to the next line boundary in the given direction. If
  `includeWrap` is true, line wrapping is on, and there is a
  further wrap point on the current line, the wrap point will be
  returned. Otherwise this function will return the start or end
  of the line.
  */
  moveToLineBoundary(Qt, Zt, $n = !0) {
    return moveToLineBoundary(this, Qt, Zt, $n);
  }
  /**
  Move a cursor position vertically. When `distance` isn't given,
  it defaults to moving to the next line (including wrapped
  lines). Otherwise, `distance` should provide a positive distance
  in pixels.
  
  When `start` has a
  [`goalColumn`](https://codemirror.net/6/docs/ref/#state.SelectionRange.goalColumn), the vertical
  motion will use that as a target horizontal position. Otherwise,
  the cursor's own horizontal position is used. The returned
  cursor will have its goal column set to whichever column was
  used.
  */
  moveVertically(Qt, Zt, $n) {
    return skipAtoms(this, Qt, moveVertically(this, Qt, Zt, $n));
  }
  /**
  Find the DOM parent node and offset (child offset if `node` is
  an element, character offset when it is a text node) at the
  given document position.
  
  Note that for positions that aren't currently in
  `visibleRanges`, the resulting DOM position isn't necessarily
  meaningful (it may just point before or after a placeholder
  element).
  */
  domAtPos(Qt) {
    return this.docView.domAtPos(Qt);
  }
  /**
  Find the document position at the given DOM node. Can be useful
  for associating positions with DOM events. Will raise an error
  when `node` isn't part of the editor content.
  */
  posAtDOM(Qt, Zt = 0) {
    return this.docView.posFromDOM(Qt, Zt);
  }
  posAtCoords(Qt, Zt = !0) {
    return this.readMeasured(), posAtCoords(this, Qt, Zt);
  }
  /**
  Get the screen coordinates at the given document position.
  `side` determines whether the coordinates are based on the
  element before (-1) or after (1) the position (if no element is
  available on the given side, the method will transparently use
  another strategy to get reasonable coordinates).
  */
  coordsAtPos(Qt, Zt = 1) {
    this.readMeasured();
    let $n = this.docView.coordsAt(Qt, Zt);
    if (!$n || $n.left == $n.right)
      return $n;
    let Sn = this.state.doc.lineAt(Qt), kn = this.bidiSpans(Sn), Kn = kn[BidiSpan.find(kn, Qt - Sn.from, -1, Zt)];
    return flattenRect($n, Kn.dir == Direction.LTR == Zt > 0);
  }
  /**
  Return the rectangle around a given character. If `pos` does not
  point in front of a character that is in the viewport and
  rendered (i.e. not replaced, not a line break), this will return
  null. For space characters that are a line wrap point, this will
  return the position before the line break.
  */
  coordsForChar(Qt) {
    return this.readMeasured(), this.docView.coordsForChar(Qt);
  }
  /**
  The default width of a character in the editor. May not
  accurately reflect the width of all characters (given variable
  width fonts or styling of invididual ranges).
  */
  get defaultCharacterWidth() {
    return this.viewState.heightOracle.charWidth;
  }
  /**
  The default height of a line in the editor. May not be accurate
  for all lines.
  */
  get defaultLineHeight() {
    return this.viewState.heightOracle.lineHeight;
  }
  /**
  The text direction
  ([`direction`](https://developer.mozilla.org/en-US/docs/Web/CSS/direction)
  CSS property) of the editor's content element.
  */
  get textDirection() {
    return this.viewState.defaultTextDirection;
  }
  /**
  Find the text direction of the block at the given position, as
  assigned by CSS. If
  [`perLineTextDirection`](https://codemirror.net/6/docs/ref/#view.EditorView^perLineTextDirection)
  isn't enabled, or the given position is outside of the viewport,
  this will always return the same as
  [`textDirection`](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection). Note that
  this may trigger a DOM layout.
  */
  textDirectionAt(Qt) {
    return !this.state.facet(perLineTextDirection) || Qt < this.viewport.from || Qt > this.viewport.to ? this.textDirection : (this.readMeasured(), this.docView.textDirectionAt(Qt));
  }
  /**
  Whether this editor [wraps lines](https://codemirror.net/6/docs/ref/#view.EditorView.lineWrapping)
  (as determined by the
  [`white-space`](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space)
  CSS property of its content element).
  */
  get lineWrapping() {
    return this.viewState.heightOracle.lineWrapping;
  }
  /**
  Returns the bidirectional text structure of the given line
  (which should be in the current document) as an array of span
  objects. The order of these spans matches the [text
  direction](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection)—if that is
  left-to-right, the leftmost spans come first, otherwise the
  rightmost spans come first.
  */
  bidiSpans(Qt) {
    if (Qt.length > MaxBidiLine)
      return trivialOrder(Qt.length);
    let Zt = this.textDirectionAt(Qt.from), $n;
    for (let kn of this.bidiCache)
      if (kn.from == Qt.from && kn.dir == Zt && (kn.fresh || isolatesEq(kn.isolates, $n = getIsolatedRanges(this, Qt.from, Qt.to))))
        return kn.order;
    $n || ($n = getIsolatedRanges(this, Qt.from, Qt.to));
    let Sn = computeOrder(Qt.text, Zt, $n);
    return this.bidiCache.push(new CachedOrder(Qt.from, Qt.to, Zt, $n, !0, Sn)), Sn;
  }
  /**
  Check whether the editor has focus.
  */
  get hasFocus() {
    var Qt;
    return (this.dom.ownerDocument.hasFocus() || browser.safari && ((Qt = this.inputState) === null || Qt === void 0 ? void 0 : Qt.lastContextMenu) > Date.now() - 3e4) && this.root.activeElement == this.contentDOM;
  }
  /**
  Put focus on the editor.
  */
  focus() {
    this.observer.ignore(() => {
      focusPreventScroll(this.contentDOM), this.docView.updateSelection();
    });
  }
  /**
  Update the [root](https://codemirror.net/6/docs/ref/##view.EditorViewConfig.root) in which the editor lives. This is only
  necessary when moving the editor's existing DOM to a new window or shadow root.
  */
  setRoot(Qt) {
    this._root != Qt && (this._root = Qt, this.observer.setWindow((Qt.nodeType == 9 ? Qt : Qt.ownerDocument).defaultView || window), this.mountStyles());
  }
  /**
  Clean up this editor view, removing its element from the
  document, unregistering event handlers, and notifying
  plugins. The view instance can no longer be used after
  calling this.
  */
  destroy() {
    for (let Qt of this.plugins)
      Qt.destroy(this);
    this.plugins = [], this.inputState.destroy(), this.dom.remove(), this.observer.destroy(), this.measureScheduled > -1 && this.win.cancelAnimationFrame(this.measureScheduled), this.destroyed = !0;
  }
  /**
  Returns an effect that can be
  [added](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) to a transaction to
  cause it to scroll the given position or range into view.
  */
  static scrollIntoView(Qt, Zt = {}) {
    return scrollIntoView.of(new ScrollTarget(typeof Qt == "number" ? EditorSelection.cursor(Qt) : Qt, Zt.y, Zt.x, Zt.yMargin, Zt.xMargin));
  }
  /**
  Returns an extension that can be used to add DOM event handlers.
  The value should be an object mapping event names to handler
  functions. For any given event, such functions are ordered by
  extension precedence, and the first handler to return true will
  be assumed to have handled that event, and no other handlers or
  built-in behavior will be activated for it. These are registered
  on the [content element](https://codemirror.net/6/docs/ref/#view.EditorView.contentDOM), except
  for `scroll` handlers, which will be called any time the
  editor's [scroll element](https://codemirror.net/6/docs/ref/#view.EditorView.scrollDOM) or one of
  its parent nodes is scrolled.
  */
  static domEventHandlers(Qt) {
    return ViewPlugin.define(() => ({}), { eventHandlers: Qt });
  }
  /**
  Create a theme extension. The first argument can be a
  [`style-mod`](https://github.com/marijnh/style-mod#documentation)
  style spec providing the styles for the theme. These will be
  prefixed with a generated class for the style.
  
  Because the selectors will be prefixed with a scope class, rule
  that directly match the editor's [wrapper
  element](https://codemirror.net/6/docs/ref/#view.EditorView.dom)—to which the scope class will be
  added—need to be explicitly differentiated by adding an `&` to
  the selector for that element—for example
  `&.cm-focused`.
  
  When `dark` is set to true, the theme will be marked as dark,
  which will cause the `&dark` rules from [base
  themes](https://codemirror.net/6/docs/ref/#view.EditorView^baseTheme) to be used (as opposed to
  `&light` when a light theme is active).
  */
  static theme(Qt, Zt) {
    let $n = StyleModule.newName(), Sn = [theme.of($n), styleModule.of(buildTheme(`.${$n}`, Qt))];
    return Zt && Zt.dark && Sn.push(darkTheme$1.of(!0)), Sn;
  }
  /**
  Create an extension that adds styles to the base theme. Like
  with [`theme`](https://codemirror.net/6/docs/ref/#view.EditorView^theme), use `&` to indicate the
  place of the editor wrapper element when directly targeting
  that. You can also use `&dark` or `&light` instead to only
  target editors with a dark or light theme.
  */
  static baseTheme(Qt) {
    return Prec.lowest(styleModule.of(buildTheme("." + baseThemeID, Qt, lightDarkIDs)));
  }
  /**
  Retrieve an editor view instance from the view's DOM
  representation.
  */
  static findFromDOM(Qt) {
    var Zt;
    let $n = Qt.querySelector(".cm-content"), Sn = $n && ContentView.get($n) || ContentView.get(Qt);
    return ((Zt = Sn == null ? void 0 : Sn.rootView) === null || Zt === void 0 ? void 0 : Zt.view) || null;
  }
}
EditorView.styleModule = styleModule;
EditorView.inputHandler = inputHandler;
EditorView.focusChangeEffect = focusChangeEffect;
EditorView.perLineTextDirection = perLineTextDirection;
EditorView.exceptionSink = exceptionSink;
EditorView.updateListener = updateListener;
EditorView.editable = editable;
EditorView.mouseSelectionStyle = mouseSelectionStyle;
EditorView.dragMovesSelection = dragMovesSelection$1;
EditorView.clickAddsSelectionRange = clickAddsSelectionRange;
EditorView.decorations = decorations;
EditorView.atomicRanges = atomicRanges;
EditorView.bidiIsolatedRanges = bidiIsolatedRanges;
EditorView.scrollMargins = scrollMargins;
EditorView.darkTheme = darkTheme$1;
EditorView.cspNonce = /* @__PURE__ */ Facet$2.define({ combine: (_e) => _e.length ? _e[0] : "" });
EditorView.contentAttributes = contentAttributes;
EditorView.editorAttributes = editorAttributes;
EditorView.lineWrapping = /* @__PURE__ */ EditorView.contentAttributes.of({ class: "cm-lineWrapping" });
EditorView.announce = /* @__PURE__ */ StateEffect.define();
const MaxBidiLine = 4096, BadMeasure = {};
class CachedOrder {
  constructor(Qt, Zt, $n, Sn, kn, Kn) {
    this.from = Qt, this.to = Zt, this.dir = $n, this.isolates = Sn, this.fresh = kn, this.order = Kn;
  }
  static update(Qt, Zt) {
    if (Zt.empty && !Qt.some((kn) => kn.fresh))
      return Qt;
    let $n = [], Sn = Qt.length ? Qt[Qt.length - 1].dir : Direction.LTR;
    for (let kn = Math.max(0, Qt.length - 10); kn < Qt.length; kn++) {
      let Kn = Qt[kn];
      Kn.dir == Sn && !Zt.touchesRange(Kn.from, Kn.to) && $n.push(new CachedOrder(Zt.mapPos(Kn.from, 1), Zt.mapPos(Kn.to, -1), Kn.dir, Kn.isolates, !1, Kn.order));
    }
    return $n;
  }
}
function attrsFromFacet(_e, Qt, Zt) {
  for (let $n = _e.state.facet(Qt), Sn = $n.length - 1; Sn >= 0; Sn--) {
    let kn = $n[Sn], Kn = typeof kn == "function" ? kn(_e) : kn;
    Kn && combineAttrs(Kn, Zt);
  }
  return Zt;
}
const CanHidePrimary = !browser.ios, themeSpec = {
  ".cm-line": {
    "& ::selection": { backgroundColor: "transparent !important" },
    "&::selection": { backgroundColor: "transparent !important" }
  }
};
CanHidePrimary && (themeSpec[".cm-line"].caretColor = "transparent !important");
class GutterMarker extends RangeValue {
  /**
  @internal
  */
  compare(Qt) {
    return this == Qt || this.constructor == Qt.constructor && this.eq(Qt);
  }
  /**
  Compare this marker to another marker of the same type.
  */
  eq(Qt) {
    return !1;
  }
  /**
  Called if the marker has a `toDOM` method and its representation
  was removed from a gutter.
  */
  destroy(Qt) {
  }
}
GutterMarker.prototype.elementClass = "";
GutterMarker.prototype.toDOM = void 0;
GutterMarker.prototype.mapMode = MapMode.TrackBefore;
GutterMarker.prototype.startSide = GutterMarker.prototype.endSide = -1;
GutterMarker.prototype.point = !0;
function isHTML(_e) {
  return _e === "text/html";
}
function getHTMLHeadings(_e, Qt = !0) {
  var Zt;
  const $n = document.createElement("div");
  $n.innerHTML = _e;
  const Sn = new Array(), kn = $n.querySelectorAll("h1, h2, h3, h4, h5, h6");
  for (const Kn of kn) {
    const er = parseInt(Kn.tagName[1], 10);
    Sn.push({
      text: (Zt = Kn.textContent) !== null && Zt !== void 0 ? Zt : "",
      level: er,
      id: Kn == null ? void 0 : Kn.getAttribute("id"),
      skip: Kn.classList.contains("jp-toc-ignore") || Kn.classList.contains("tocSkip")
    });
  }
  return Sn;
}
function getHeadings(_e) {
  const Qt = _e.split(`
`), Zt = new Array();
  let $n, Sn = 0;
  if (Qt[Sn] === "---") {
    for (let kn = Sn + 1; kn < Qt.length; kn++)
      if (Qt[kn] === "---") {
        Sn = kn + 1;
        break;
      }
  }
  for (; Sn < Qt.length; Sn++) {
    const kn = Qt[Sn];
    if (kn === "" || (kn.startsWith("```") && ($n = !$n), $n))
      continue;
    const Kn = parseHeading(kn, Qt[Sn + 1]);
    Kn && Zt.push({
      ...Kn,
      line: Sn
    });
  }
  return Zt;
}
const MARKDOWN_MIME_TYPE = [
  "text/x-ipythongfm",
  "text/x-markdown",
  "text/x-gfm",
  "text/markdown"
];
function isMarkdown(_e) {
  return MARKDOWN_MIME_TYPE.includes(_e);
}
function parseHeading(_e, Qt) {
  let Zt = _e.match(/^([#]{1,6}) (.*)/);
  return Zt ? {
    text: cleanTitle(Zt[2]),
    level: Zt[1].length,
    raw: _e,
    skip: skipHeading.test(Zt[0])
  } : Qt && (Zt = Qt.match(/^ {0,3}([=]{2,}|[-]{2,})\s*$/), Zt) ? {
    text: cleanTitle(_e),
    level: Zt[1][0] === "=" ? 1 : 2,
    raw: [_e, Qt].join(`
`),
    skip: skipHeading.test(_e)
  } : (Zt = _e.match(/<h([1-6]).*>(.*)<\/h\1>/i), Zt ? {
    text: Zt[2],
    level: parseInt(Zt[1], 10),
    skip: skipHeading.test(Zt[0]),
    raw: _e
  } : null);
}
function cleanTitle(_e) {
  return _e.replace(/\[(.+)\]\(.+\)/g, "$1");
}
const skipHeading = /<\w+\s(.*?\s)?class="(.*?\s)?(jp-toc-ignore|tocSkip)(\s.*?)?"(\s.*?)?>/, RESIZE_HANDLE_CLASS = "jp-CellResizeHandle", CELL_RESIZED_CLASS = "jp-mod-resizedCell";
class ResizeHandle extends Widget {
  constructor(Qt) {
    super(), this.targetNode = Qt, this._isActive = !1, this._isDragging = !1, this.addClass(RESIZE_HANDLE_CLASS), this._resizer = new Throttler((Zt) => this._resize(Zt), 50);
  }
  /**
   * Dispose the resizer handle.
   */
  dispose() {
    this._resizer.dispose(), super.dispose();
  }
  /**
   * Handle the DOM events for the widget.
   *
   * @param event - The DOM event sent to the widget.
   *
   */
  handleEvent(Qt) {
    var Zt, $n;
    switch (Qt.type) {
      case "dblclick":
        (Zt = this.targetNode.parentNode) === null || Zt === void 0 || Zt.childNodes.forEach((Sn) => {
          Sn.classList.remove(CELL_RESIZED_CLASS);
        }), document.documentElement.style.setProperty("--jp-side-by-side-output-size", "1fr"), this._isActive = !1;
        break;
      case "mousedown":
        this._isDragging = !0, this._isActive || (($n = this.targetNode.parentNode) === null || $n === void 0 || $n.childNodes.forEach((Sn) => {
          Sn.classList.add(CELL_RESIZED_CLASS);
        }), this._isActive = !0), window.addEventListener("mousemove", this), window.addEventListener("mouseup", this);
        break;
      case "mousemove": {
        this._isActive && this._isDragging && this._resizer.invoke(Qt);
        break;
      }
      case "mouseup":
        this._isDragging = !1, window.removeEventListener("mousemove", this), window.removeEventListener("mouseup", this);
        break;
    }
  }
  /**
   * Handle `after-attach` messages.
   */
  onAfterAttach(Qt) {
    this.node.addEventListener("dblclick", this), this.node.addEventListener("mousedown", this), super.onAfterAttach(Qt);
  }
  /**
   * Handle `before-detach` messages.
   */
  onBeforeDetach(Qt) {
    this.node.removeEventListener("dblclick", this), this.node.removeEventListener("mousedown", this), super.onBeforeDetach(Qt);
  }
  _resize(Qt) {
    const { width: Zt, x: $n } = this.targetNode.getBoundingClientRect(), Sn = Qt.clientX - $n, kn = Zt / Sn - 1;
    if (0 < kn) {
      const Kn = Math.max(Math.min(Math.abs(kn), 50), 0.05);
      document.documentElement.style.setProperty("--jp-side-by-side-output-size", `${Kn}fr`);
    }
  }
}
const CELL_CLASS = "jp-Cell", CELL_HEADER_CLASS = "jp-Cell-header", CELL_FOOTER_CLASS = "jp-Cell-footer", CELL_INPUT_WRAPPER_CLASS = "jp-Cell-inputWrapper", CELL_OUTPUT_WRAPPER_CLASS = "jp-Cell-outputWrapper", CELL_INPUT_AREA_CLASS = "jp-Cell-inputArea", CELL_OUTPUT_AREA_CLASS = "jp-Cell-outputArea", CELL_INPUT_COLLAPSER_CLASS = "jp-Cell-inputCollapser", CELL_OUTPUT_COLLAPSER_CLASS = "jp-Cell-outputCollapser", DIRTY_CLASS = "jp-mod-dirty", CODE_CELL_CLASS = "jp-CodeCell", MARKDOWN_CELL_CLASS = "jp-MarkdownCell", MARKDOWN_OUTPUT_CLASS = "jp-MarkdownOutput", MARKDOWN_HEADING_COLLAPSED = "jp-MarkdownHeadingCollapsed", HEADING_COLLAPSER_CLASS = "jp-collapseHeadingButton", SHOW_HIDDEN_CELLS_CLASS = "jp-showHiddenCellsButton", RENDERED_CLASS = "jp-mod-rendered", NO_OUTPUTS_CLASS = "jp-mod-noOutputs", DEFAULT_MARKDOWN_TEXT = "Type Markdown and LaTeX: $ α^2 $", RENDER_TIMEOUT = 1e3, CONTENTS_MIME_RICH = "application/x-jupyter-icontentsrich";
class Cell extends Widget {
  /**
   * Construct a new base cell widget.
   */
  constructor(Qt) {
    var Zt, $n, Sn, kn;
    super(), this.prompt = "", this._displayChanged = new Signal(this), this._editorConfig = {}, this._inputHidden = !1, this._inViewportChanged = new Signal(this), this._readOnly = !1, this._ready = new PromiseDelegate(), this._resizeDebouncer = new Debouncer(() => {
      this._displayChanged.emit();
    }, 0), this._syncCollapse = !1, this._syncEditable = !1, this.addClass(CELL_CLASS);
    const Kn = this._model = Qt.model;
    this.contentFactory = Qt.contentFactory, this.layout = (Zt = Qt.layout) !== null && Zt !== void 0 ? Zt : new PanelLayout(), this.translator = ($n = Qt.translator) !== null && $n !== void 0 ? $n : nullTranslator, this._editorConfig = (Sn = Qt.editorConfig) !== null && Sn !== void 0 ? Sn : {}, this._placeholder = !0, this._inViewport = !1, this.placeholder = (kn = Qt.placeholder) !== null && kn !== void 0 ? kn : !0, Kn.metadataChanged.connect(this.onMetadataChanged, this);
  }
  /**
   * Initialize view state from model.
   *
   * #### Notes
   * Should be called after construction. For convenience, returns this, so it
   * can be chained in the construction, like `new Foo().initializeState();`
   */
  initializeState() {
    return this.loadCollapseState(), this.loadEditableState(), this;
  }
  /**
   * Signal to indicate that widget has changed visibly (in size, in type, etc)
   */
  get displayChanged() {
    return this._displayChanged;
  }
  /**
   * Whether the cell is in viewport or not.
   */
  get inViewport() {
    return this._inViewport;
  }
  set inViewport(Qt) {
    this._inViewport !== Qt && (this._inViewport = Qt, this._inViewportChanged.emit(this._inViewport));
  }
  /**
   * Will emit true just after the node is attached to the DOM
   * Will emit false just before the node is detached of the DOM
   */
  get inViewportChanged() {
    return this._inViewportChanged;
  }
  /**
   * Whether the cell is a placeholder not yet fully rendered or not.
   */
  get placeholder() {
    return this._placeholder;
  }
  set placeholder(Qt) {
    this._placeholder !== Qt && Qt === !1 && (this.initializeDOM(), this._placeholder = Qt, this._ready.resolve());
  }
  /**
   * Get the prompt node used by the cell.
   */
  get promptNode() {
    return this.placeholder ? null : this._inputHidden ? this._inputPlaceholder.node.firstElementChild : this._input.promptNode;
  }
  /**
   * Get the CodeEditorWrapper used by the cell.
   */
  get editorWidget() {
    var Qt, Zt;
    return (Zt = (Qt = this._input) === null || Qt === void 0 ? void 0 : Qt.editorWidget) !== null && Zt !== void 0 ? Zt : null;
  }
  /**
   * Get the CodeEditor used by the cell.
   */
  get editor() {
    var Qt, Zt;
    return (Zt = (Qt = this._input) === null || Qt === void 0 ? void 0 : Qt.editor) !== null && Zt !== void 0 ? Zt : null;
  }
  /**
   * Editor configuration
   */
  get editorConfig() {
    return this._editorConfig;
  }
  /**
   * Cell headings
   */
  get headings() {
    return new Array();
  }
  /**
   * Get the model used by the cell.
   */
  get model() {
    return this._model;
  }
  /**
   * Get the input area for the cell.
   */
  get inputArea() {
    return this._input;
  }
  /**
   * The read only state of the cell.
   */
  get readOnly() {
    return this._readOnly;
  }
  set readOnly(Qt) {
    Qt !== this._readOnly && (this._readOnly = Qt, this.syncEditable && this.saveEditableState(), this.update());
  }
  /**
   * Whether the cell is a placeholder that defer rendering
   *
   * #### Notes
   * You can wait for the promise `Cell.ready` to wait for the
   * cell to be rendered.
   */
  isPlaceholder() {
    return this.placeholder;
  }
  /**
   * Save view editable state to model
   */
  saveEditableState() {
    const { sharedModel: Qt } = this.model, Zt = Qt.getMetadata("editable");
    this.readOnly && Zt === !1 || !this.readOnly && Zt === void 0 || (this.readOnly ? Qt.setMetadata("editable", !1) : Qt.deleteMetadata("editable"));
  }
  /**
   * Load view editable state from model.
   */
  loadEditableState() {
    this.readOnly = this.model.sharedModel.getMetadata("editable") === !1;
  }
  /**
   * A promise that resolves when the widget renders for the first time.
   */
  get ready() {
    return this._ready.promise;
  }
  /**
   * Set the prompt for the widget.
   */
  setPrompt(Qt) {
    var Zt;
    this.prompt = Qt, (Zt = this._input) === null || Zt === void 0 || Zt.setPrompt(Qt);
  }
  /**
   * The view state of input being hidden.
   */
  get inputHidden() {
    return this._inputHidden;
  }
  set inputHidden(Qt) {
    var Zt;
    if (this._inputHidden !== Qt) {
      if (!this.placeholder) {
        const $n = this._inputWrapper.layout;
        Qt ? (this._input.parent = null, this._inputPlaceholder && (this._inputPlaceholder.text = (Zt = this.model.sharedModel.getSource().split(`
`)) === null || Zt === void 0 ? void 0 : Zt[0]), $n.addWidget(this._inputPlaceholder)) : (this._inputPlaceholder.parent = null, $n.addWidget(this._input));
      }
      this._inputHidden = Qt, this.syncCollapse && this.saveCollapseState(), this.handleInputHidden(Qt);
    }
  }
  /**
   * Save view collapse state to model
   */
  saveCollapseState() {
    const Qt = { ...this.model.getMetadata("jupyter") };
    this.inputHidden && Qt.source_hidden === !0 || !this.inputHidden && Qt.source_hidden === void 0 || (this.inputHidden ? Qt.source_hidden = !0 : delete Qt.source_hidden, Object.keys(Qt).length === 0 ? this.model.deleteMetadata("jupyter") : this.model.setMetadata("jupyter", Qt));
  }
  /**
   * Revert view collapse state from model.
   */
  loadCollapseState() {
    var Qt;
    const Zt = (Qt = this.model.getMetadata("jupyter")) !== null && Qt !== void 0 ? Qt : {};
    this.inputHidden = !!Zt.source_hidden;
  }
  /**
   * Handle the input being hidden.
   *
   * #### Notes
   * This is called by the `inputHidden` setter so that subclasses
   * can perform actions upon the input being hidden without accessing
   * private state.
   */
  handleInputHidden(Qt) {
  }
  /**
   * Whether to sync the collapse state to the cell model.
   */
  get syncCollapse() {
    return this._syncCollapse;
  }
  set syncCollapse(Qt) {
    this._syncCollapse !== Qt && (this._syncCollapse = Qt, Qt && this.loadCollapseState());
  }
  /**
   * Whether to sync the editable state to the cell model.
   */
  get syncEditable() {
    return this._syncEditable;
  }
  set syncEditable(Qt) {
    this._syncEditable !== Qt && (this._syncEditable = Qt, Qt && this.loadEditableState());
  }
  /**
   * Clone the cell, using the same model.
   */
  clone() {
    const Qt = this.constructor;
    return new Qt({
      model: this.model,
      contentFactory: this.contentFactory,
      placeholder: !1,
      translator: this.translator
    });
  }
  /**
   * Dispose of the resources held by the widget.
   */
  dispose() {
    this.isDisposed || (this._resizeDebouncer.dispose(), this._input = null, this._model = null, this._inputWrapper = null, this._inputPlaceholder = null, super.dispose());
  }
  /**
   * Update the editor configuration with the partial provided dictionary.
   *
   * @param v Partial editor configuration
   */
  updateEditorConfig(Qt) {
    this._editorConfig = { ...this._editorConfig, ...Qt }, this.editor && this.editor.setOptions(this._editorConfig);
  }
  /**
   * Create children widgets.
   */
  initializeDOM() {
    if (!this.placeholder)
      return;
    const Qt = this.contentFactory, Zt = this._model, $n = Qt.createCellHeader();
    $n.addClass(CELL_HEADER_CLASS), this.layout.addWidget($n);
    const Sn = this._inputWrapper = new Panel();
    Sn.addClass(CELL_INPUT_WRAPPER_CLASS);
    const kn = new InputCollapser();
    kn.addClass(CELL_INPUT_COLLAPSER_CLASS);
    const Kn = this._input = new InputArea({
      model: Zt,
      contentFactory: Qt,
      editorOptions: this.getEditorOptions()
    });
    Kn.addClass(CELL_INPUT_AREA_CLASS), Sn.addWidget(kn), Sn.addWidget(Kn), this.layout.addWidget(Sn), this._inputPlaceholder = new InputPlaceholder$1({
      callback: () => {
        this.inputHidden = !this.inputHidden;
      },
      text: Kn.model.sharedModel.getSource().split(`
`)[0],
      translator: this.translator
    }), Kn.model.contentChanged.connect((Cr, kr) => {
      var Yr;
      this._inputPlaceholder && this.inputHidden && (this._inputPlaceholder.text = (Yr = Cr.sharedModel.getSource().split(`
`)) === null || Yr === void 0 ? void 0 : Yr[0]);
    }), this.inputHidden && (Kn.parent = null, Sn.layout.addWidget(this._inputPlaceholder));
    const er = this.contentFactory.createCellFooter();
    er.addClass(CELL_FOOTER_CLASS), this.layout.addWidget(er);
  }
  /**
   * Get the editor options at initialization.
   *
   * @returns Editor options
   */
  getEditorOptions() {
    return { config: this.editorConfig };
  }
  /**
   * Handle `before-attach` messages.
   */
  onBeforeAttach(Qt) {
    this.placeholder && (this.placeholder = !1);
  }
  /**
   * Handle `after-attach` messages.
   */
  onAfterAttach(Qt) {
    this.update();
  }
  /**
   * Handle `'activate-request'` messages.
   */
  onActivateRequest(Qt) {
    var Zt;
    (Zt = this.editor) === null || Zt === void 0 || Zt.focus();
  }
  /**
   * Handle `resize` messages.
   */
  onResize(Qt) {
    this._resizeDebouncer.invoke();
  }
  /**
   * Handle `update-request` messages.
   */
  onUpdateRequest(Qt) {
    var Zt, $n;
    this._model && ((Zt = this.editor) === null || Zt === void 0 ? void 0 : Zt.getOption("readOnly")) !== this._readOnly && (($n = this.editor) === null || $n === void 0 || $n.setOption("readOnly", this._readOnly));
  }
  onContentChanged() {
    var Qt;
    this.inputHidden && this._inputPlaceholder && (this._inputPlaceholder.text = (Qt = this.model.sharedModel.getSource().split(`
`)) === null || Qt === void 0 ? void 0 : Qt[0]);
  }
  /**
   * Handle changes in the metadata.
   */
  onMetadataChanged(Qt, Zt) {
    switch (Zt.key) {
      case "jupyter":
        this.syncCollapse && this.loadCollapseState();
        break;
      case "editable":
        this.syncEditable && this.loadEditableState();
        break;
    }
  }
}
(function(_e) {
  (function(Zt) {
    Zt[Zt.HTML = 0] = "HTML", Zt[Zt.Markdown = 1] = "Markdown";
  })(_e.HeadingType || (_e.HeadingType = {}));
  class Qt {
    /**
     * Create a content factory for a cell.
     */
    constructor($n) {
      this._editorFactory = $n.editorFactory;
    }
    /**
     * The readonly editor factory that create code editors
     */
    get editorFactory() {
      return this._editorFactory;
    }
    /**
     * Create a new cell header for the parent widget.
     */
    createCellHeader() {
      return new CellHeader();
    }
    /**
     * Create a new cell footer for the parent widget.
     */
    createCellFooter() {
      return new CellFooter();
    }
    /**
     * Create an input prompt.
     */
    createInputPrompt() {
      return new InputPrompt();
    }
    /**
     * Create the output prompt for the widget.
     */
    createOutputPrompt() {
      return new OutputPrompt();
    }
    /**
     * Create an stdin widget.
     */
    createStdin($n) {
      return new Stdin($n);
    }
  }
  _e.ContentFactory = Qt;
})(Cell || (Cell = {}));
class CodeCellLayout extends PanelLayout {
  /**
   * A message handler invoked on a `'before-attach'` message.
   *
   * #### Notes
   * The default implementation of this method forwards the message
   * to all widgets. It assumes all widget nodes are attached to the
   * parent widget node.
   *
   * This may be reimplemented by subclasses as needed.
   */
  onBeforeAttach(Qt) {
    let Zt = !0;
    const $n = this.parent.node.firstElementChild;
    for (const Sn of this)
      $n && (Sn.node === $n ? Zt = !1 : (MessageLoop.sendMessage(Sn, Qt), Zt ? this.parent.node.insertBefore(Sn.node, $n) : this.parent.node.appendChild(Sn.node), this.parent.isHidden || Sn.setFlag(Widget.Flag.IsVisible), MessageLoop.sendMessage(Sn, Widget.Msg.AfterAttach)));
  }
  /**
   * A message handler invoked on an `'after-detach'` message.
   *
   * #### Notes
   * The default implementation of this method forwards the message
   * to all widgets. It assumes all widget nodes are attached to the
   * parent widget node.
   *
   * This may be reimplemented by subclasses as needed.
   */
  onAfterDetach(Qt) {
    for (const Zt of this)
      !Zt.hasClass(CELL_OUTPUT_WRAPPER_CLASS) && Zt.node.isConnected && (MessageLoop.sendMessage(Zt, Widget.Msg.BeforeDetach), this.parent.node.removeChild(Zt.node), MessageLoop.sendMessage(Zt, Qt));
  }
}
class CodeCell extends Cell {
  /**
   * Construct a code cell widget.
   */
  constructor(Qt) {
    var Zt;
    super({ layout: new CodeCellLayout(), ...Qt, placeholder: !0 }), this._headingsCache = null, this._outputHidden = !1, this._outputWrapper = null, this._outputPlaceholder = null, this._syncScrolled = !1, this.addClass(CODE_CELL_CLASS);
    const $n = this.translator.load("jupyterlab"), Sn = this._rendermime = Qt.rendermime, kn = this.contentFactory, Kn = this.model;
    this.maxNumberOutputs = Qt.maxNumberOutputs;
    const er = Kn.outputs.length === 0 ? $n.__("Code Cell Content") : $n.__("Code Cell Content with Output");
    this.node.setAttribute("aria-label", er);
    const Cr = this._output = new OutputArea({
      model: this.model.outputs,
      rendermime: Sn,
      contentFactory: kn,
      maxNumberOutputs: this.maxNumberOutputs,
      translator: this.translator,
      promptOverlay: !0,
      inputHistoryScope: Qt.inputHistoryScope
    });
    Cr.addClass(CELL_OUTPUT_AREA_CLASS), Cr.toggleScrolling.connect(() => {
      this.outputsScrolled = !this.outputsScrolled;
    }), this.placeholder = (Zt = Qt.placeholder) !== null && Zt !== void 0 ? Zt : !0, Kn.outputs.changed.connect(this.onOutputChanged, this), Kn.outputs.stateChanged.connect(this.onOutputChanged, this), Kn.stateChanged.connect(this.onStateChanged, this);
  }
  /**
   * Create children widgets.
   */
  initializeDOM() {
    if (!this.placeholder)
      return;
    super.initializeDOM(), this.setPrompt(this.prompt);
    const Qt = this._outputWrapper = new Panel();
    Qt.addClass(CELL_OUTPUT_WRAPPER_CLASS);
    const Zt = new OutputCollapser();
    Zt.addClass(CELL_OUTPUT_COLLAPSER_CLASS), Qt.addWidget(Zt), this.model.outputs.length === 0 && this.addClass(NO_OUTPUTS_CLASS), this._output.outputLengthChanged.connect(this._outputLengthHandler, this), Qt.addWidget(this._output);
    const $n = this.layout;
    $n.insertWidget($n.widgets.length - 1, new ResizeHandle(this.node)), $n.insertWidget($n.widgets.length - 1, Qt), this.model.isDirty && this.addClass(DIRTY_CLASS), this._outputPlaceholder = new OutputPlaceholder({
      callback: () => {
        this.outputHidden = !this.outputHidden;
      },
      text: this.getOutputPlaceholderText(),
      translator: this.translator
    });
    const Sn = Qt.layout;
    this.outputHidden && (Sn.removeWidget(this._output), Sn.addWidget(this._outputPlaceholder), this.inputHidden && !Qt.isHidden && this._outputWrapper.hide());
    const kn = this.translator.load("jupyterlab"), Kn = this.model.outputs.length === 0 ? kn.__("Code Cell Content") : kn.__("Code Cell Content with Output");
    this.node.setAttribute("aria-label", Kn);
  }
  getOutputPlaceholderText() {
    var Qt;
    const Zt = this.model.outputs.get(0);
    if (!(Zt == null ? void 0 : Zt.data))
      return;
    const kn = [
      "text/html",
      "image/svg+xml",
      "application/pdf",
      "text/markdown",
      "text/plain",
      "application/vnd.jupyter.stderr",
      "application/vnd.jupyter.stdout",
      "text"
    ].find((er) => {
      const Cr = Zt.data[er];
      return (Array.isArray(Cr) ? typeof Cr[0] : typeof Cr) == "string";
    }), Kn = Zt.data[kn ?? ""];
    if (Kn !== void 0)
      return (Qt = Array.isArray(Kn) ? Kn : Kn == null ? void 0 : Kn.split(`
`)) === null || Qt === void 0 ? void 0 : Qt.find((er) => er !== "");
  }
  /**
   * Initialize view state from model.
   *
   * #### Notes
   * Should be called after construction. For convenience, returns this, so it
   * can be chained in the construction, like `new Foo().initializeState();`
   */
  initializeState() {
    return super.initializeState(), this.loadScrolledState(), this.setPrompt(`${this.model.executionCount || ""}`), this;
  }
  get headings() {
    if (!this._headingsCache) {
      const Qt = [], Zt = this.model.outputs;
      for (let $n = 0; $n < Zt.length; $n++) {
        const Sn = Zt.get($n);
        let kn = null, Kn = null;
        Object.keys(Sn.data).forEach((er) => {
          !Kn && isMarkdown(er) ? Kn = er : !kn && isHTML(er) && (kn = er);
        }), kn ? Qt.push(...getHTMLHeadings(this._rendermime.sanitizer.sanitize(Sn.data[kn])).map((er) => ({
          ...er,
          outputIndex: $n,
          type: Cell.HeadingType.HTML
        }))) : Kn && Qt.push(...getHeadings(Sn.data[Kn]).map((er) => ({
          ...er,
          outputIndex: $n,
          type: Cell.HeadingType.Markdown
        })));
      }
      this._headingsCache = Qt;
    }
    return [...this._headingsCache];
  }
  /**
   * Get the output area for the cell.
   */
  get outputArea() {
    return this._output;
  }
  /**
   * The view state of output being collapsed.
   */
  get outputHidden() {
    return this._outputHidden;
  }
  set outputHidden(Qt) {
    var Zt;
    if (this._outputHidden !== Qt) {
      if (!this.placeholder) {
        const $n = this._outputWrapper.layout;
        Qt ? ($n.removeWidget(this._output), $n.addWidget(this._outputPlaceholder), this.inputHidden && !this._outputWrapper.isHidden && this._outputWrapper.hide(), this._outputPlaceholder && (this._outputPlaceholder.text = (Zt = this.getOutputPlaceholderText()) !== null && Zt !== void 0 ? Zt : "")) : (this._outputWrapper.isHidden && this._outputWrapper.show(), $n.removeWidget(this._outputPlaceholder), $n.addWidget(this._output));
      }
      this._outputHidden = Qt, this.syncCollapse && this.saveCollapseState();
    }
  }
  /**
   * Save view collapse state to model
   */
  saveCollapseState() {
    this.model.sharedModel.transact(() => {
      super.saveCollapseState();
      const Qt = this.model.getMetadata("collapsed");
      this.outputHidden && Qt === !0 || !this.outputHidden && Qt === void 0 || (this.outputHidden ? this.model.setMetadata("collapsed", !0) : this.model.deleteMetadata("collapsed"));
    }, !1);
  }
  /**
   * Revert view collapse state from model.
   *
   * We consider the `collapsed` metadata key as the source of truth for outputs
   * being hidden.
   */
  loadCollapseState() {
    super.loadCollapseState(), this.outputHidden = !!this.model.getMetadata("collapsed");
  }
  /**
   * Whether the output is in a scrolled state?
   */
  get outputsScrolled() {
    return this._outputsScrolled;
  }
  set outputsScrolled(Qt) {
    this.toggleClass("jp-mod-outputsScrolled", Qt), this._outputsScrolled = Qt, this.syncScrolled && this.saveScrolledState();
  }
  /**
   * Save view collapse state to model
   */
  saveScrolledState() {
    const Qt = this.model.getMetadata("scrolled");
    this.outputsScrolled && Qt === !0 || !this.outputsScrolled && Qt === void 0 || (this.outputsScrolled ? this.model.setMetadata("scrolled", !0) : this.model.deleteMetadata("scrolled"));
  }
  /**
   * Revert view collapse state from model.
   */
  loadScrolledState() {
    this.model.getMetadata("scrolled") === "auto" ? this.outputsScrolled = !1 : this.outputsScrolled = !!this.model.getMetadata("scrolled");
  }
  /**
   * Whether to sync the scrolled state to the cell model.
   */
  get syncScrolled() {
    return this._syncScrolled;
  }
  set syncScrolled(Qt) {
    this._syncScrolled !== Qt && (this._syncScrolled = Qt, Qt && this.loadScrolledState());
  }
  /**
   * Handle the input being hidden.
   *
   * #### Notes
   * This method is called by the case cell implementation and is
   * subclasses here so the code cell can watch to see when input
   * is hidden without accessing private state.
   */
  handleInputHidden(Qt) {
    this.placeholder || (!Qt && this._outputWrapper.isHidden ? this._outputWrapper.show() : Qt && !this._outputWrapper.isHidden && this._outputHidden && this._outputWrapper.hide());
  }
  /**
   * Clone the cell, using the same model.
   */
  clone() {
    const Qt = this.constructor;
    return new Qt({
      model: this.model,
      contentFactory: this.contentFactory,
      rendermime: this._rendermime,
      placeholder: !1,
      translator: this.translator
    });
  }
  /**
   * Clone the OutputArea alone, returning a simplified output area, using the same model.
   */
  cloneOutputArea() {
    return new SimplifiedOutputArea({
      model: this.model.outputs,
      contentFactory: this.contentFactory,
      rendermime: this._rendermime
    });
  }
  /**
   * Dispose of the resources used by the widget.
   */
  dispose() {
    this.isDisposed || (this._output.outputLengthChanged.disconnect(this._outputLengthHandler, this), this._rendermime = null, this._output = null, this._outputWrapper = null, this._outputPlaceholder = null, super.dispose());
  }
  /**
   * Handle changes in the model.
   */
  onStateChanged(Qt, Zt) {
    switch (Zt.name) {
      case "executionCount":
        this.setPrompt(`${Qt.executionCount || ""}`);
        break;
      case "isDirty":
        Qt.isDirty ? this.addClass(DIRTY_CLASS) : this.removeClass(DIRTY_CLASS);
        break;
    }
  }
  /**
   * Callback on output changes
   */
  onOutputChanged() {
    var Qt;
    this._headingsCache = null, this._outputPlaceholder && this.outputHidden && (this._outputPlaceholder.text = (Qt = this.getOutputPlaceholderText()) !== null && Qt !== void 0 ? Qt : "");
  }
  /**
   * Handle changes in the metadata.
   */
  onMetadataChanged(Qt, Zt) {
    switch (Zt.key) {
      case "scrolled":
        this.syncScrolled && this.loadScrolledState();
        break;
      case "collapsed":
        this.syncCollapse && this.loadCollapseState();
        break;
    }
    super.onMetadataChanged(Qt, Zt);
  }
  /**
   * Handle changes in the number of outputs in the output area.
   */
  _outputLengthHandler(Qt, Zt) {
    const $n = Zt === 0;
    this.toggleClass(NO_OUTPUTS_CLASS, $n);
    const Sn = this.translator.load("jupyterlab"), kn = $n ? Sn.__("Code Cell Content") : Sn.__("Code Cell Content with Output");
    this.node.setAttribute("aria-label", kn);
  }
}
(function(_e) {
  async function Qt(Zt, $n, Sn) {
    var kn;
    const Kn = Zt.model, er = Kn.sharedModel.getSource();
    if (!er.trim() || !(!((kn = $n.session) === null || kn === void 0) && kn.kernel)) {
      Kn.sharedModel.transact(() => {
        Kn.clearExecution();
      }, !1);
      return;
    }
    const Cr = { cellId: Kn.sharedModel.getId() };
    Sn = {
      ...Kn.metadata,
      ...Sn,
      ...Cr
    };
    const { recordTiming: kr } = Sn;
    Kn.sharedModel.transact(() => {
      Kn.clearExecution(), Zt.outputHidden = !1;
    }, !1), Zt.setPrompt("*"), Kn.trusted = !0;
    let Yr;
    try {
      const Ms = OutputArea.execute(er, Zt.outputArea, $n, Sn);
      if (kr) {
        const Ls = (js) => {
          let zs;
          switch (js.header.msg_type) {
            case "status":
              zs = `status.${js.content.execution_state}`;
              break;
            case "execute_input":
              zs = "execute_input";
              break;
            default:
              return !0;
          }
          const Fs = js.header.date || (/* @__PURE__ */ new Date()).toISOString(), Bs = Object.assign({}, Kn.getMetadata("execution"));
          return Bs[`iopub.${zs}`] = Fs, Kn.setMetadata("execution", Bs), !0;
        };
        Zt.outputArea.future.registerMessageHook(Ls);
      } else
        Kn.deleteMetadata("execution");
      Yr = Zt.outputArea.future;
      const Ds = await Ms;
      if (Kn.executionCount = Ds.content.execution_count, kr) {
        const Ls = Object.assign({}, Kn.getMetadata("execution")), js = Ds.metadata.started;
        js && (Ls["shell.execute_reply.started"] = js);
        const zs = Ds.header.date;
        Ls["shell.execute_reply"] = zs || (/* @__PURE__ */ new Date()).toISOString(), Kn.setMetadata("execution", Ls);
      }
      return Ds;
    } catch (Ms) {
      throw Yr && !Zt.isDisposed && Zt.outputArea.future === Yr && Zt.setPrompt(""), Ms;
    }
  }
  _e.execute = Qt;
})(CodeCell || (CodeCell = {}));
class AttachmentsCell extends Cell {
  /**
   * Handle the DOM events for the widget.
   *
   * @param event - The DOM event sent to the widget.
   *
   * #### Notes
   * This method implements the DOM `EventListener` interface and is
   * called in response to events on the notebook panel's node. It should
   * not be called directly by user code.
   */
  handleEvent(Qt) {
    switch (Qt.type) {
      case "lm-dragover":
        this._evtDragOver(Qt);
        break;
      case "lm-drop":
        this._evtDrop(Qt);
        break;
    }
  }
  /**
   * Get the editor options at initialization.
   *
   * @returns Editor options
   */
  getEditorOptions() {
    var Qt, Zt;
    const $n = (Qt = super.getEditorOptions()) !== null && Qt !== void 0 ? Qt : {};
    return $n.extensions = [
      ...(Zt = $n.extensions) !== null && Zt !== void 0 ? Zt : [],
      EditorView.domEventHandlers({
        dragenter: (Sn) => {
          Sn.preventDefault();
        },
        dragover: (Sn) => {
          Sn.preventDefault();
        },
        drop: (Sn) => {
          this._evtNativeDrop(Sn);
        },
        paste: (Sn) => {
          this._evtPaste(Sn);
        }
      })
    ], $n;
  }
  /**
   * Handle `after-attach` messages for the widget.
   */
  onAfterAttach(Qt) {
    super.onAfterAttach(Qt);
    const Zt = this.node;
    Zt.addEventListener("lm-dragover", this), Zt.addEventListener("lm-drop", this);
  }
  /**
   * A message handler invoked on a `'before-detach'`
   * message
   */
  onBeforeDetach(Qt) {
    const Zt = this.node;
    Zt.removeEventListener("lm-dragover", this), Zt.removeEventListener("lm-drop", this), super.onBeforeDetach(Qt);
  }
  _evtDragOver(Qt) {
    some$1(imageRendererFactory.mimeTypes, ($n) => Qt.mimeData.hasData(CONTENTS_MIME_RICH) ? Qt.mimeData.getData(CONTENTS_MIME_RICH).model.mimetype === $n : !1) && (Qt.preventDefault(), Qt.stopPropagation(), Qt.dropAction = Qt.proposedAction);
  }
  /**
   * Handle the `paste` event for the widget
   */
  _evtPaste(Qt) {
    if (Qt.clipboardData) {
      const Zt = Qt.clipboardData.items;
      for (let $n = 0; $n < Zt.length; $n++) {
        if (Zt[$n].type === "text/plain") {
          if ($n < Zt.length - 1 && Zt[$n + 1].kind === "file")
            continue;
          Zt[$n].getAsString((Sn) => {
            var kn, Kn;
            (Kn = (kn = this.editor).replaceSelection) === null || Kn === void 0 || Kn.call(kn, Sn);
          });
        }
        this._attachFiles(Qt.clipboardData.items);
      }
    }
    Qt.preventDefault();
  }
  /**
   * Handle the `drop` event for the widget
   */
  _evtNativeDrop(Qt) {
    Qt.dataTransfer && this._attachFiles(Qt.dataTransfer.items), Qt.preventDefault();
  }
  /**
   * Handle the `'lm-drop'` event for the widget.
   */
  _evtDrop(Qt) {
    const Zt = Qt.mimeData.types().filter(($n) => {
      if ($n === CONTENTS_MIME_RICH) {
        const Sn = Qt.mimeData.getData(CONTENTS_MIME_RICH);
        return imageRendererFactory.mimeTypes.indexOf(Sn.model.mimetype) !== -1;
      }
      return imageRendererFactory.mimeTypes.indexOf($n) !== -1;
    });
    if (Zt.length !== 0) {
      if (Qt.preventDefault(), Qt.stopPropagation(), Qt.proposedAction === "none") {
        Qt.dropAction = "none";
        return;
      }
      Qt.dropAction = "copy";
      for (const $n of Zt)
        if ($n === CONTENTS_MIME_RICH) {
          const { model: Sn, withContent: kn } = Qt.mimeData.getData(CONTENTS_MIME_RICH);
          if (Sn.type === "file") {
            const Kn = this._generateURI(Sn.name);
            this.updateCellSourceWithAttachment(Sn.name, Kn), kn().then((er) => {
              this.model.attachments.set(Kn, {
                [er.mimetype]: er.content
              });
            });
          }
        } else {
          const Sn = this._generateURI();
          this.model.attachments.set(Sn, {
            [$n]: Qt.mimeData.getData($n)
          }), this.updateCellSourceWithAttachment(Sn, Sn);
        }
    }
  }
  /**
   * Attaches all DataTransferItems (obtained from
   * clipboard or native drop events) to the cell
   */
  _attachFiles(Qt) {
    for (let Zt = 0; Zt < Qt.length; Zt++) {
      const $n = Qt[Zt];
      if ($n.kind === "file") {
        const Sn = $n.getAsFile();
        Sn && this._attachFile(Sn);
      }
    }
  }
  /**
   * Takes in a file object and adds it to
   * the cell attachments
   */
  _attachFile(Qt) {
    const Zt = new FileReader();
    Zt.onload = ($n) => {
      const { href: Sn, protocol: kn } = lib$3.URLExt.parse(Zt.result);
      if (kn !== "data:")
        return;
      const er = /([\w+\/\+]+)?(?:;(charset=[\w\d-]*|base64))?,(.*)/.exec(Sn);
      if (!er || er.length !== 4)
        return;
      const Cr = er[1], kr = er[3], Yr = { [Cr]: kr }, Ms = this._generateURI(Qt.name);
      Cr.startsWith("image/") && (this.model.attachments.set(Ms, Yr), this.updateCellSourceWithAttachment(Qt.name, Ms));
    }, Zt.onerror = ($n) => {
      console.error(`Failed to attach ${Qt.name}` + $n);
    }, Zt.readAsDataURL(Qt);
  }
  /**
   * Generates a unique URI for a file
   * while preserving the file extension.
   */
  _generateURI(Qt = "") {
    const Zt = Qt.lastIndexOf(".");
    return Zt !== -1 ? UUID$1.uuid4().concat(Qt.substring(Zt)) : UUID$1.uuid4();
  }
}
class MarkdownCell extends AttachmentsCell {
  /**
   * Construct a Markdown cell widget.
   */
  constructor(Qt) {
    var Zt, $n, Sn, kn;
    super({ ...Qt, placeholder: !0 }), this._headingsCache = null, this._headingCollapsedChanged = new Signal(this), this._prevText = "", this._rendered = !0, this._renderedChanged = new Signal(this), this._showEditorForReadOnlyMarkdown = !0, this.addClass(MARKDOWN_CELL_CLASS), this.model.contentChanged.connect(this.onContentChanged, this);
    const Kn = this.translator.load("jupyterlab");
    this.node.setAttribute("aria-label", Kn.__("Markdown Cell Content")), this._rendermime = Qt.rendermime.clone({
      resolver: new AttachmentsResolver({
        parent: (Zt = Qt.rendermime.resolver) !== null && Zt !== void 0 ? Zt : void 0,
        model: this.model.attachments
      })
    }), this._renderer = this._rendermime.createRenderer("text/markdown"), this._renderer.addClass(MARKDOWN_OUTPUT_CLASS), this._headingCollapsed = ($n = this.model.getMetadata(MARKDOWN_HEADING_COLLAPSED)) !== null && $n !== void 0 ? $n : !1, this._showEditorForReadOnlyMarkdown = (Sn = Qt.showEditorForReadOnlyMarkdown) !== null && Sn !== void 0 ? Sn : MarkdownCell.defaultShowEditorForReadOnlyMarkdown, this.placeholder = (kn = Qt.placeholder) !== null && kn !== void 0 ? kn : !0, this._monitor = new lib$3.ActivityMonitor({
      signal: this.model.contentChanged,
      timeout: RENDER_TIMEOUT
    }), this.ready.then(() => {
      this.isDisposed || this._monitor.activityStopped.connect(() => {
        this._rendered && this.update();
      }, this);
    }).catch((er) => {
      console.error("Failed to be ready", er);
    });
  }
  /**
   * Text that represents the highest heading (i.e. lowest level) if cell is a heading.
   * Returns empty string if not a heading.
   */
  get headingInfo() {
    const Qt = this.headings;
    if (Qt.length > 0) {
      const { text: Zt, level: $n } = Qt.reduce((Sn, kn) => Sn.level <= kn.level ? Sn : kn, Qt[0]);
      return { text: Zt, level: $n };
    } else
      return { text: "", level: -1 };
  }
  get headings() {
    if (!this._headingsCache) {
      const Qt = getHeadings(this.model.sharedModel.getSource());
      this._headingsCache = Qt.map((Zt) => ({ ...Zt, type: Cell.HeadingType.Markdown }));
    }
    return [...this._headingsCache];
  }
  /**
   * Whether the heading is collapsed or not.
   */
  get headingCollapsed() {
    return this._headingCollapsed;
  }
  set headingCollapsed(Qt) {
    var Zt;
    if (this._headingCollapsed !== Qt) {
      this._headingCollapsed = Qt, Qt ? this.model.setMetadata(MARKDOWN_HEADING_COLLAPSED, Qt) : this.model.getMetadata(MARKDOWN_HEADING_COLLAPSED) !== "undefined" && this.model.deleteMetadata(MARKDOWN_HEADING_COLLAPSED);
      const $n = (Zt = this.inputArea) === null || Zt === void 0 ? void 0 : Zt.promptNode.getElementsByClassName(HEADING_COLLAPSER_CLASS)[0];
      $n && (Qt ? $n.classList.add("jp-mod-collapsed") : $n.classList.remove("jp-mod-collapsed")), this.renderCollapseButtons(this._renderer), this._headingCollapsedChanged.emit(this._headingCollapsed);
    }
  }
  /**
   * Number of collapsed sub cells.
   */
  get numberChildNodes() {
    return this._numberChildNodes;
  }
  set numberChildNodes(Qt) {
    this._numberChildNodes = Qt, this.renderCollapseButtons(this._renderer);
  }
  /**
   * Signal emitted when the cell collapsed state changes.
   */
  get headingCollapsedChanged() {
    return this._headingCollapsedChanged;
  }
  /**
   * Whether the cell is rendered.
   */
  get rendered() {
    return this._rendered;
  }
  set rendered(Qt) {
    this.readOnly && this._showEditorForReadOnlyMarkdown === !1 && (Qt = !0), Qt !== this._rendered && (this._rendered = Qt, this._handleRendered().then(() => {
      this._displayChanged.emit(), this._renderedChanged.emit(this._rendered);
    }).catch((Zt) => {
      console.error("Failed to render", Zt);
    }));
  }
  /**
   * Signal emitted when the markdown cell rendered state changes
   */
  get renderedChanged() {
    return this._renderedChanged;
  }
  /*
   * Whether the Markdown editor is visible in read-only mode.
   */
  get showEditorForReadOnly() {
    return this._showEditorForReadOnlyMarkdown;
  }
  set showEditorForReadOnly(Qt) {
    this._showEditorForReadOnlyMarkdown = Qt, Qt === !1 && (this.rendered = !0);
  }
  /**
   * Renderer
   */
  get renderer() {
    return this._renderer;
  }
  /**
   * Dispose of the resources held by the widget.
   */
  dispose() {
    this.isDisposed || (this._monitor.dispose(), super.dispose());
  }
  /**
   * Create children widgets.
   */
  initializeDOM() {
    this.placeholder && (super.initializeDOM(), this.renderCollapseButtons(this._renderer), this._handleRendered().catch((Qt) => {
      console.error("Failed to render", Qt);
    }));
  }
  maybeCreateCollapseButton() {
    var Qt;
    const { level: Zt } = this.headingInfo;
    if (Zt > 0 && ((Qt = this.inputArea) === null || Qt === void 0 ? void 0 : Qt.promptNode.getElementsByClassName(HEADING_COLLAPSER_CLASS).length) == 0) {
      let $n = this.inputArea.promptNode.appendChild(document.createElement("button"));
      $n.className = `jp-Button ${HEADING_COLLAPSER_CLASS}`, $n.setAttribute("data-heading-level", Zt.toString()), this._headingCollapsed ? $n.classList.add("jp-mod-collapsed") : $n.classList.remove("jp-mod-collapsed"), $n.onclick = (Sn) => {
        this.headingCollapsed = !this.headingCollapsed;
      };
    }
  }
  /**
   * Create, update or remove the hidden cells button.
   * Note that the actual visibility is controlled in Static Notebook by toggling jp-mod-showHiddenCellsButton class.
   */
  maybeCreateOrUpdateExpandButton() {
    const Qt = this.node.getElementsByClassName(SHOW_HIDDEN_CELLS_CLASS);
    let $n = this.translator.load("jupyterlab")._n("%1 cell hidden", "%1 cells hidden", this._numberChildNodes);
    if (this.headingCollapsed && this._numberChildNodes > 0 && Qt.length == 0) {
      const er = document.createElement("button");
      er.className = `jp-mod-minimal jp-Button ${SHOW_HIDDEN_CELLS_CLASS}`, addIcon.render(er);
      const Cr = document.createElement("div");
      Cr.textContent = $n, er.appendChild(Cr), er.onclick = () => {
        this.headingCollapsed = !1;
      }, this.node.appendChild(er);
    }
    if (this.headingCollapsed && this._numberChildNodes > 0 && Qt.length == 1 && (Qt[0].childNodes[1].textContent = $n), !(this.headingCollapsed && this._numberChildNodes > 0))
      for (const er of Qt)
        this.node.removeChild(er);
  }
  /**
   * Callback on content changed
   */
  onContentChanged() {
    super.onContentChanged(), this._headingsCache = null;
  }
  /**
   * Render the collapse button for heading cells,
   * and for collapsed heading cells render the "expand hidden cells"
   * button.
   */
  renderCollapseButtons(Qt) {
    this.node.classList.toggle(MARKDOWN_HEADING_COLLAPSED, this._headingCollapsed), this.maybeCreateCollapseButton(), this.maybeCreateOrUpdateExpandButton();
  }
  /**
   * Render an input instead of the text editor.
   */
  renderInput(Qt) {
    this.addClass(RENDERED_CLASS), !this.placeholder && !this.isDisposed && (this.renderCollapseButtons(Qt), this.inputArea.renderInput(Qt));
  }
  /**
   * Show the text editor instead of rendered input.
   */
  showEditor() {
    if (this.removeClass(RENDERED_CLASS), !this.placeholder && !this.isDisposed) {
      this.inputArea.showEditor();
      let Qt = (this.model.sharedModel.getSource().match(/^#+/g) || [""])[0].length;
      Qt > 0 && this.inputArea.editor.setCursorPosition({
        column: Qt + 1,
        line: 0
      });
    }
  }
  /*
   * Handle `update-request` messages.
   */
  onUpdateRequest(Qt) {
    this._handleRendered().catch((Zt) => {
      console.error("Failed to render", Zt);
    }), super.onUpdateRequest(Qt);
  }
  /**
   * Modify the cell source to include a reference to the attachment.
   */
  updateCellSourceWithAttachment(Qt, Zt) {
    var $n, Sn;
    const kn = `![${Qt}](attachment:${Zt ?? Qt})`;
    (Sn = ($n = this.editor) === null || $n === void 0 ? void 0 : $n.replaceSelection) === null || Sn === void 0 || Sn.call($n, kn);
  }
  /**
   * Handle the rendered state.
   */
  async _handleRendered() {
    this._rendered ? (await this._updateRenderedInput(), this._rendered && this.renderInput(this._renderer)) : this.showEditor();
  }
  /**
   * Update the rendered input.
   */
  _updateRenderedInput() {
    if (this.placeholder)
      return Promise.resolve();
    const Qt = this.model, Zt = Qt && Qt.sharedModel.getSource() || DEFAULT_MARKDOWN_TEXT;
    if (Zt !== this._prevText) {
      const $n = new MimeModel({ data: { "text/markdown": Zt } });
      return this._prevText = Zt, this._renderer.renderModel($n);
    }
    return Promise.resolve();
  }
  /**
   * Clone the cell, using the same model.
   */
  clone() {
    const Qt = this.constructor;
    return new Qt({
      model: this.model,
      contentFactory: this.contentFactory,
      rendermime: this._rendermime,
      placeholder: !1,
      translator: this.translator
    });
  }
}
(function(_e) {
  _e.defaultShowEditorForReadOnlyMarkdown = !0;
})(MarkdownCell || (MarkdownCell = {}));
var lzString = { exports: {} };
lzString.exports;
(function(_e) {
  var Qt = function() {
    var Zt = String.fromCharCode, $n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", Sn = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$", kn = {};
    function Kn(Cr, kr) {
      if (!kn[Cr]) {
        kn[Cr] = {};
        for (var Yr = 0; Yr < Cr.length; Yr++)
          kn[Cr][Cr.charAt(Yr)] = Yr;
      }
      return kn[Cr][kr];
    }
    var er = {
      compressToBase64: function(Cr) {
        if (Cr == null)
          return "";
        var kr = er._compress(Cr, 6, function(Yr) {
          return $n.charAt(Yr);
        });
        switch (kr.length % 4) {
          default:
          case 0:
            return kr;
          case 1:
            return kr + "===";
          case 2:
            return kr + "==";
          case 3:
            return kr + "=";
        }
      },
      decompressFromBase64: function(Cr) {
        return Cr == null ? "" : Cr == "" ? null : er._decompress(Cr.length, 32, function(kr) {
          return Kn($n, Cr.charAt(kr));
        });
      },
      compressToUTF16: function(Cr) {
        return Cr == null ? "" : er._compress(Cr, 15, function(kr) {
          return Zt(kr + 32);
        }) + " ";
      },
      decompressFromUTF16: function(Cr) {
        return Cr == null ? "" : Cr == "" ? null : er._decompress(Cr.length, 16384, function(kr) {
          return Cr.charCodeAt(kr) - 32;
        });
      },
      //compress into uint8array (UCS-2 big endian format)
      compressToUint8Array: function(Cr) {
        for (var kr = er.compress(Cr), Yr = new Uint8Array(kr.length * 2), Ms = 0, Ds = kr.length; Ms < Ds; Ms++) {
          var Ls = kr.charCodeAt(Ms);
          Yr[Ms * 2] = Ls >>> 8, Yr[Ms * 2 + 1] = Ls % 256;
        }
        return Yr;
      },
      //decompress from uint8array (UCS-2 big endian format)
      decompressFromUint8Array: function(Cr) {
        if (Cr == null)
          return er.decompress(Cr);
        for (var kr = new Array(Cr.length / 2), Yr = 0, Ms = kr.length; Yr < Ms; Yr++)
          kr[Yr] = Cr[Yr * 2] * 256 + Cr[Yr * 2 + 1];
        var Ds = [];
        return kr.forEach(function(Ls) {
          Ds.push(Zt(Ls));
        }), er.decompress(Ds.join(""));
      },
      //compress into a string that is already URI encoded
      compressToEncodedURIComponent: function(Cr) {
        return Cr == null ? "" : er._compress(Cr, 6, function(kr) {
          return Sn.charAt(kr);
        });
      },
      //decompress from an output of compressToEncodedURIComponent
      decompressFromEncodedURIComponent: function(Cr) {
        return Cr == null ? "" : Cr == "" ? null : (Cr = Cr.replace(/ /g, "+"), er._decompress(Cr.length, 32, function(kr) {
          return Kn(Sn, Cr.charAt(kr));
        }));
      },
      compress: function(Cr) {
        return er._compress(Cr, 16, function(kr) {
          return Zt(kr);
        });
      },
      _compress: function(Cr, kr, Yr) {
        if (Cr == null)
          return "";
        var Ms, Ds, Ls = {}, js = {}, zs = "", Fs = "", Bs = "", Hs = 2, Ws = 3, Ys = 2, El = [], Mu = 0, Pl = 0, Iu;
        for (Iu = 0; Iu < Cr.length; Iu += 1)
          if (zs = Cr.charAt(Iu), Object.prototype.hasOwnProperty.call(Ls, zs) || (Ls[zs] = Ws++, js[zs] = !0), Fs = Bs + zs, Object.prototype.hasOwnProperty.call(Ls, Fs))
            Bs = Fs;
          else {
            if (Object.prototype.hasOwnProperty.call(js, Bs)) {
              if (Bs.charCodeAt(0) < 256) {
                for (Ms = 0; Ms < Ys; Ms++)
                  Mu = Mu << 1, Pl == kr - 1 ? (Pl = 0, El.push(Yr(Mu)), Mu = 0) : Pl++;
                for (Ds = Bs.charCodeAt(0), Ms = 0; Ms < 8; Ms++)
                  Mu = Mu << 1 | Ds & 1, Pl == kr - 1 ? (Pl = 0, El.push(Yr(Mu)), Mu = 0) : Pl++, Ds = Ds >> 1;
              } else {
                for (Ds = 1, Ms = 0; Ms < Ys; Ms++)
                  Mu = Mu << 1 | Ds, Pl == kr - 1 ? (Pl = 0, El.push(Yr(Mu)), Mu = 0) : Pl++, Ds = 0;
                for (Ds = Bs.charCodeAt(0), Ms = 0; Ms < 16; Ms++)
                  Mu = Mu << 1 | Ds & 1, Pl == kr - 1 ? (Pl = 0, El.push(Yr(Mu)), Mu = 0) : Pl++, Ds = Ds >> 1;
              }
              Hs--, Hs == 0 && (Hs = Math.pow(2, Ys), Ys++), delete js[Bs];
            } else
              for (Ds = Ls[Bs], Ms = 0; Ms < Ys; Ms++)
                Mu = Mu << 1 | Ds & 1, Pl == kr - 1 ? (Pl = 0, El.push(Yr(Mu)), Mu = 0) : Pl++, Ds = Ds >> 1;
            Hs--, Hs == 0 && (Hs = Math.pow(2, Ys), Ys++), Ls[Fs] = Ws++, Bs = String(zs);
          }
        if (Bs !== "") {
          if (Object.prototype.hasOwnProperty.call(js, Bs)) {
            if (Bs.charCodeAt(0) < 256) {
              for (Ms = 0; Ms < Ys; Ms++)
                Mu = Mu << 1, Pl == kr - 1 ? (Pl = 0, El.push(Yr(Mu)), Mu = 0) : Pl++;
              for (Ds = Bs.charCodeAt(0), Ms = 0; Ms < 8; Ms++)
                Mu = Mu << 1 | Ds & 1, Pl == kr - 1 ? (Pl = 0, El.push(Yr(Mu)), Mu = 0) : Pl++, Ds = Ds >> 1;
            } else {
              for (Ds = 1, Ms = 0; Ms < Ys; Ms++)
                Mu = Mu << 1 | Ds, Pl == kr - 1 ? (Pl = 0, El.push(Yr(Mu)), Mu = 0) : Pl++, Ds = 0;
              for (Ds = Bs.charCodeAt(0), Ms = 0; Ms < 16; Ms++)
                Mu = Mu << 1 | Ds & 1, Pl == kr - 1 ? (Pl = 0, El.push(Yr(Mu)), Mu = 0) : Pl++, Ds = Ds >> 1;
            }
            Hs--, Hs == 0 && (Hs = Math.pow(2, Ys), Ys++), delete js[Bs];
          } else
            for (Ds = Ls[Bs], Ms = 0; Ms < Ys; Ms++)
              Mu = Mu << 1 | Ds & 1, Pl == kr - 1 ? (Pl = 0, El.push(Yr(Mu)), Mu = 0) : Pl++, Ds = Ds >> 1;
          Hs--, Hs == 0 && (Hs = Math.pow(2, Ys), Ys++);
        }
        for (Ds = 2, Ms = 0; Ms < Ys; Ms++)
          Mu = Mu << 1 | Ds & 1, Pl == kr - 1 ? (Pl = 0, El.push(Yr(Mu)), Mu = 0) : Pl++, Ds = Ds >> 1;
        for (; ; )
          if (Mu = Mu << 1, Pl == kr - 1) {
            El.push(Yr(Mu));
            break;
          } else
            Pl++;
        return El.join("");
      },
      decompress: function(Cr) {
        return Cr == null ? "" : Cr == "" ? null : er._decompress(Cr.length, 32768, function(kr) {
          return Cr.charCodeAt(kr);
        });
      },
      _decompress: function(Cr, kr, Yr) {
        var Ms = [], Ds = 4, Ls = 4, js = 3, zs = "", Fs = [], Bs, Hs, Ws, Ys, El, Mu, Pl, Iu = { val: Yr(0), position: kr, index: 1 };
        for (Bs = 0; Bs < 3; Bs += 1)
          Ms[Bs] = Bs;
        for (Ws = 0, El = Math.pow(2, 2), Mu = 1; Mu != El; )
          Ys = Iu.val & Iu.position, Iu.position >>= 1, Iu.position == 0 && (Iu.position = kr, Iu.val = Yr(Iu.index++)), Ws |= (Ys > 0 ? 1 : 0) * Mu, Mu <<= 1;
        switch (Ws) {
          case 0:
            for (Ws = 0, El = Math.pow(2, 8), Mu = 1; Mu != El; )
              Ys = Iu.val & Iu.position, Iu.position >>= 1, Iu.position == 0 && (Iu.position = kr, Iu.val = Yr(Iu.index++)), Ws |= (Ys > 0 ? 1 : 0) * Mu, Mu <<= 1;
            Pl = Zt(Ws);
            break;
          case 1:
            for (Ws = 0, El = Math.pow(2, 16), Mu = 1; Mu != El; )
              Ys = Iu.val & Iu.position, Iu.position >>= 1, Iu.position == 0 && (Iu.position = kr, Iu.val = Yr(Iu.index++)), Ws |= (Ys > 0 ? 1 : 0) * Mu, Mu <<= 1;
            Pl = Zt(Ws);
            break;
          case 2:
            return "";
        }
        for (Ms[3] = Pl, Hs = Pl, Fs.push(Pl); ; ) {
          if (Iu.index > Cr)
            return "";
          for (Ws = 0, El = Math.pow(2, js), Mu = 1; Mu != El; )
            Ys = Iu.val & Iu.position, Iu.position >>= 1, Iu.position == 0 && (Iu.position = kr, Iu.val = Yr(Iu.index++)), Ws |= (Ys > 0 ? 1 : 0) * Mu, Mu <<= 1;
          switch (Pl = Ws) {
            case 0:
              for (Ws = 0, El = Math.pow(2, 8), Mu = 1; Mu != El; )
                Ys = Iu.val & Iu.position, Iu.position >>= 1, Iu.position == 0 && (Iu.position = kr, Iu.val = Yr(Iu.index++)), Ws |= (Ys > 0 ? 1 : 0) * Mu, Mu <<= 1;
              Ms[Ls++] = Zt(Ws), Pl = Ls - 1, Ds--;
              break;
            case 1:
              for (Ws = 0, El = Math.pow(2, 16), Mu = 1; Mu != El; )
                Ys = Iu.val & Iu.position, Iu.position >>= 1, Iu.position == 0 && (Iu.position = kr, Iu.val = Yr(Iu.index++)), Ws |= (Ys > 0 ? 1 : 0) * Mu, Mu <<= 1;
              Ms[Ls++] = Zt(Ws), Pl = Ls - 1, Ds--;
              break;
            case 2:
              return Fs.join("");
          }
          if (Ds == 0 && (Ds = Math.pow(2, js), js++), Ms[Pl])
            zs = Ms[Pl];
          else if (Pl === Ls)
            zs = Hs + Hs.charAt(0);
          else
            return null;
          Fs.push(zs), Ms[Ls++] = Hs + zs.charAt(0), Ds--, Hs = zs, Ds == 0 && (Ds = Math.pow(2, js), js++);
        }
      }
    };
    return er;
  }();
  _e != null ? _e.exports = Qt : typeof angular < "u" && angular != null && angular.module("LZString", []).factory("LZString", function() {
    return Qt;
  });
})(lzString);
var lzStringExports = lzString.exports;
function decompressString(_e) {
  return lzStringExports.decompressFromUTF16(_e);
}
function getCellStoreEngine(_e) {
  return {
    getItem(Qt) {
      const Zt = _e.model.getMetadata(Qt);
      return Zt && decompressString(Zt);
    },
    setItem(Qt, Zt) {
      _e.model.setMetadata(Qt, Zt && lzStringExports.compressToUTF16(Zt));
    },
    removeItem(Qt) {
      return _e.model.deleteMetadata(Qt);
    }
  };
}
function n$3(_e) {
  for (var Qt = arguments.length, Zt = Array(Qt > 1 ? Qt - 1 : 0), $n = 1; $n < Qt; $n++)
    Zt[$n - 1] = arguments[$n];
  throw Error("[Immer] minified error nr: " + _e + (Zt.length ? " " + Zt.map(function(Sn) {
    return "'" + Sn + "'";
  }).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
}
function r$3(_e) {
  return !!_e && !!_e[Q$1];
}
function t$4(_e) {
  var Qt;
  return !!_e && (function(Zt) {
    if (!Zt || typeof Zt != "object")
      return !1;
    var $n = Object.getPrototypeOf(Zt);
    if ($n === null)
      return !0;
    var Sn = Object.hasOwnProperty.call($n, "constructor") && $n.constructor;
    return Sn === Object || typeof Sn == "function" && Function.toString.call(Sn) === Z$1;
  }(_e) || Array.isArray(_e) || !!_e[L$1] || !!(!((Qt = _e.constructor) === null || Qt === void 0) && Qt[L$1]) || s(_e) || v$2(_e));
}
function i(_e, Qt, Zt) {
  Zt === void 0 && (Zt = !1), o(_e) === 0 ? (Zt ? Object.keys : nn$1)(_e).forEach(function($n) {
    Zt && typeof $n == "symbol" || Qt($n, _e[$n], _e);
  }) : _e.forEach(function($n, Sn) {
    return Qt(Sn, $n, _e);
  });
}
function o(_e) {
  var Qt = _e[Q$1];
  return Qt ? Qt.i > 3 ? Qt.i - 4 : Qt.i : Array.isArray(_e) ? 1 : s(_e) ? 2 : v$2(_e) ? 3 : 0;
}
function u$3(_e, Qt) {
  return o(_e) === 2 ? _e.has(Qt) : Object.prototype.hasOwnProperty.call(_e, Qt);
}
function a$2(_e, Qt) {
  return o(_e) === 2 ? _e.get(Qt) : _e[Qt];
}
function f$1(_e, Qt, Zt) {
  var $n = o(_e);
  $n === 2 ? _e.set(Qt, Zt) : $n === 3 ? _e.add(Zt) : _e[Qt] = Zt;
}
function c$3(_e, Qt) {
  return _e === Qt ? _e !== 0 || 1 / _e == 1 / Qt : _e != _e && Qt != Qt;
}
function s(_e) {
  return X$3 && _e instanceof Map;
}
function v$2(_e) {
  return q$4 && _e instanceof Set;
}
function p$3(_e) {
  return _e.o || _e.t;
}
function l$2(_e) {
  if (Array.isArray(_e))
    return Array.prototype.slice.call(_e);
  var Qt = rn$1(_e);
  delete Qt[Q$1];
  for (var Zt = nn$1(Qt), $n = 0; $n < Zt.length; $n++) {
    var Sn = Zt[$n], kn = Qt[Sn];
    kn.writable === !1 && (kn.writable = !0, kn.configurable = !0), (kn.get || kn.set) && (Qt[Sn] = { configurable: !0, writable: !0, enumerable: kn.enumerable, value: _e[Sn] });
  }
  return Object.create(Object.getPrototypeOf(_e), Qt);
}
function d$1(_e, Qt) {
  return Qt === void 0 && (Qt = !1), y$6(_e) || r$3(_e) || !t$4(_e) || (o(_e) > 1 && (_e.set = _e.add = _e.clear = _e.delete = h$4), Object.freeze(_e), Qt && i(_e, function(Zt, $n) {
    return d$1($n, !0);
  }, !0)), _e;
}
function h$4() {
  n$3(2);
}
function y$6(_e) {
  return _e == null || typeof _e != "object" || Object.isFrozen(_e);
}
function b$3(_e) {
  var Qt = tn$1[_e];
  return Qt || n$3(18, _e), Qt;
}
function m$5(_e, Qt) {
  tn$1[_e] || (tn$1[_e] = Qt);
}
function _$1() {
  return U$1;
}
function j$1(_e, Qt) {
  Qt && (b$3("Patches"), _e.u = [], _e.s = [], _e.v = Qt);
}
function g$2(_e) {
  O(_e), _e.p.forEach(S$1), _e.p = null;
}
function O(_e) {
  _e === U$1 && (U$1 = _e.l);
}
function w$4(_e) {
  return U$1 = { p: [], l: U$1, h: _e, m: !0, _: 0 };
}
function S$1(_e) {
  var Qt = _e[Q$1];
  Qt.i === 0 || Qt.i === 1 ? Qt.j() : Qt.g = !0;
}
function P$1(_e, Qt) {
  Qt._ = Qt.p.length;
  var Zt = Qt.p[0], $n = _e !== void 0 && _e !== Zt;
  return Qt.h.O || b$3("ES5").S(Qt, _e, $n), $n ? (Zt[Q$1].P && (g$2(Qt), n$3(4)), t$4(_e) && (_e = M$2(Qt, _e), Qt.l || x$6(Qt, _e)), Qt.u && b$3("Patches").M(Zt[Q$1].t, _e, Qt.u, Qt.s)) : _e = M$2(Qt, Zt, []), g$2(Qt), Qt.u && Qt.v(Qt.u, Qt.s), _e !== H$2 ? _e : void 0;
}
function M$2(_e, Qt, Zt) {
  if (y$6(Qt))
    return Qt;
  var $n = Qt[Q$1];
  if (!$n)
    return i(Qt, function(er, Cr) {
      return A$2(_e, $n, Qt, er, Cr, Zt);
    }, !0), Qt;
  if ($n.A !== _e)
    return Qt;
  if (!$n.P)
    return x$6(_e, $n.t, !0), $n.t;
  if (!$n.I) {
    $n.I = !0, $n.A._--;
    var Sn = $n.i === 4 || $n.i === 5 ? $n.o = l$2($n.k) : $n.o, kn = Sn, Kn = !1;
    $n.i === 3 && (kn = new Set(Sn), Sn.clear(), Kn = !0), i(kn, function(er, Cr) {
      return A$2(_e, $n, Sn, er, Cr, Zt, Kn);
    }), x$6(_e, Sn, !1), Zt && _e.u && b$3("Patches").N($n, Zt, _e.u, _e.s);
  }
  return $n.o;
}
function A$2(_e, Qt, Zt, $n, Sn, kn, Kn) {
  if (r$3(Sn)) {
    var er = M$2(_e, Sn, kn && Qt && Qt.i !== 3 && !u$3(Qt.R, $n) ? kn.concat($n) : void 0);
    if (f$1(Zt, $n, er), !r$3(er))
      return;
    _e.m = !1;
  } else
    Kn && Zt.add(Sn);
  if (t$4(Sn) && !y$6(Sn)) {
    if (!_e.h.D && _e._ < 1)
      return;
    M$2(_e, Sn), Qt && Qt.A.l || x$6(_e, Sn);
  }
}
function x$6(_e, Qt, Zt) {
  Zt === void 0 && (Zt = !1), !_e.l && _e.h.D && _e.m && d$1(Qt, Zt);
}
function z$2(_e, Qt) {
  var Zt = _e[Q$1];
  return (Zt ? p$3(Zt) : _e)[Qt];
}
function I$1(_e, Qt) {
  if (Qt in _e)
    for (var Zt = Object.getPrototypeOf(_e); Zt; ) {
      var $n = Object.getOwnPropertyDescriptor(Zt, Qt);
      if ($n)
        return $n;
      Zt = Object.getPrototypeOf(Zt);
    }
}
function k$3(_e) {
  _e.P || (_e.P = !0, _e.l && k$3(_e.l));
}
function E$2(_e) {
  _e.o || (_e.o = l$2(_e.t));
}
function N$1(_e, Qt, Zt) {
  var $n = s(Qt) ? b$3("MapSet").F(Qt, Zt) : v$2(Qt) ? b$3("MapSet").T(Qt, Zt) : _e.O ? function(Sn, kn) {
    var Kn = Array.isArray(Sn), er = { i: Kn ? 1 : 0, A: kn ? kn.A : _$1(), P: !1, I: !1, R: {}, l: kn, t: Sn, k: null, o: null, j: null, C: !1 }, Cr = er, kr = en$1;
    Kn && (Cr = [er], kr = on$2);
    var Yr = Proxy.revocable(Cr, kr), Ms = Yr.revoke, Ds = Yr.proxy;
    return er.k = Ds, er.j = Ms, Ds;
  }(Qt, Zt) : b$3("ES5").J(Qt, Zt);
  return (Zt ? Zt.A : _$1()).p.push($n), $n;
}
function R(_e) {
  return r$3(_e) || n$3(22, _e), function Qt(Zt) {
    if (!t$4(Zt))
      return Zt;
    var $n, Sn = Zt[Q$1], kn = o(Zt);
    if (Sn) {
      if (!Sn.P && (Sn.i < 4 || !b$3("ES5").K(Sn)))
        return Sn.t;
      Sn.I = !0, $n = D$3(Zt, kn), Sn.I = !1;
    } else
      $n = D$3(Zt, kn);
    return i($n, function(Kn, er) {
      Sn && a$2(Sn.t, Kn) === er || f$1($n, Kn, Qt(er));
    }), kn === 3 ? new Set($n) : $n;
  }(_e);
}
function D$3(_e, Qt) {
  switch (Qt) {
    case 2:
      return new Map(_e);
    case 3:
      return Array.from(_e);
  }
  return l$2(_e);
}
function F$1() {
  function _e(kn, Kn) {
    var er = Sn[kn];
    return er ? er.enumerable = Kn : Sn[kn] = er = { configurable: !0, enumerable: Kn, get: function() {
      var Cr = this[Q$1];
      return en$1.get(Cr, kn);
    }, set: function(Cr) {
      var kr = this[Q$1];
      en$1.set(kr, kn, Cr);
    } }, er;
  }
  function Qt(kn) {
    for (var Kn = kn.length - 1; Kn >= 0; Kn--) {
      var er = kn[Kn][Q$1];
      if (!er.P)
        switch (er.i) {
          case 5:
            $n(er) && k$3(er);
            break;
          case 4:
            Zt(er) && k$3(er);
        }
    }
  }
  function Zt(kn) {
    for (var Kn = kn.t, er = kn.k, Cr = nn$1(er), kr = Cr.length - 1; kr >= 0; kr--) {
      var Yr = Cr[kr];
      if (Yr !== Q$1) {
        var Ms = Kn[Yr];
        if (Ms === void 0 && !u$3(Kn, Yr))
          return !0;
        var Ds = er[Yr], Ls = Ds && Ds[Q$1];
        if (Ls ? Ls.t !== Ms : !c$3(Ds, Ms))
          return !0;
      }
    }
    var js = !!Kn[Q$1];
    return Cr.length !== nn$1(Kn).length + (js ? 0 : 1);
  }
  function $n(kn) {
    var Kn = kn.k;
    if (Kn.length !== kn.t.length)
      return !0;
    var er = Object.getOwnPropertyDescriptor(Kn, Kn.length - 1);
    if (er && !er.get)
      return !0;
    for (var Cr = 0; Cr < Kn.length; Cr++)
      if (!Kn.hasOwnProperty(Cr))
        return !0;
    return !1;
  }
  var Sn = {};
  m$5("ES5", { J: function(kn, Kn) {
    var er = Array.isArray(kn), Cr = function(Yr, Ms) {
      if (Yr) {
        for (var Ds = Array(Ms.length), Ls = 0; Ls < Ms.length; Ls++)
          Object.defineProperty(Ds, "" + Ls, _e(Ls, !0));
        return Ds;
      }
      var js = rn$1(Ms);
      delete js[Q$1];
      for (var zs = nn$1(js), Fs = 0; Fs < zs.length; Fs++) {
        var Bs = zs[Fs];
        js[Bs] = _e(Bs, Yr || !!js[Bs].enumerable);
      }
      return Object.create(Object.getPrototypeOf(Ms), js);
    }(er, kn), kr = { i: er ? 5 : 4, A: Kn ? Kn.A : _$1(), P: !1, I: !1, R: {}, l: Kn, t: kn, k: Cr, o: null, g: !1, C: !1 };
    return Object.defineProperty(Cr, Q$1, { value: kr, writable: !0 }), Cr;
  }, S: function(kn, Kn, er) {
    er ? r$3(Kn) && Kn[Q$1].A === kn && Qt(kn.p) : (kn.u && function Cr(kr) {
      if (kr && typeof kr == "object") {
        var Yr = kr[Q$1];
        if (Yr) {
          var Ms = Yr.t, Ds = Yr.k, Ls = Yr.R, js = Yr.i;
          if (js === 4)
            i(Ds, function(Ws) {
              Ws !== Q$1 && (Ms[Ws] !== void 0 || u$3(Ms, Ws) ? Ls[Ws] || Cr(Ds[Ws]) : (Ls[Ws] = !0, k$3(Yr)));
            }), i(Ms, function(Ws) {
              Ds[Ws] !== void 0 || u$3(Ds, Ws) || (Ls[Ws] = !1, k$3(Yr));
            });
          else if (js === 5) {
            if ($n(Yr) && (k$3(Yr), Ls.length = !0), Ds.length < Ms.length)
              for (var zs = Ds.length; zs < Ms.length; zs++)
                Ls[zs] = !1;
            else
              for (var Fs = Ms.length; Fs < Ds.length; Fs++)
                Ls[Fs] = !0;
            for (var Bs = Math.min(Ds.length, Ms.length), Hs = 0; Hs < Bs; Hs++)
              Ds.hasOwnProperty(Hs) || (Ls[Hs] = !0), Ls[Hs] === void 0 && Cr(Ds[Hs]);
          }
        }
      }
    }(kn.p[0]), Qt(kn.p));
  }, K: function(kn) {
    return kn.i === 4 ? Zt(kn) : $n(kn);
  } });
}
var G$1, U$1, W$1 = typeof Symbol < "u" && typeof Symbol("x") == "symbol", X$3 = typeof Map < "u", q$4 = typeof Set < "u", B$3 = typeof Proxy < "u" && Proxy.revocable !== void 0 && typeof Reflect < "u", H$2 = W$1 ? Symbol.for("immer-nothing") : ((G$1 = {})["immer-nothing"] = !0, G$1), L$1 = W$1 ? Symbol.for("immer-draftable") : "__$immer_draftable", Q$1 = W$1 ? Symbol.for("immer-state") : "__$immer_state", Z$1 = "" + Object.prototype.constructor, nn$1 = typeof Reflect < "u" && Reflect.ownKeys ? Reflect.ownKeys : Object.getOwnPropertySymbols !== void 0 ? function(_e) {
  return Object.getOwnPropertyNames(_e).concat(Object.getOwnPropertySymbols(_e));
} : Object.getOwnPropertyNames, rn$1 = Object.getOwnPropertyDescriptors || function(_e) {
  var Qt = {};
  return nn$1(_e).forEach(function(Zt) {
    Qt[Zt] = Object.getOwnPropertyDescriptor(_e, Zt);
  }), Qt;
}, tn$1 = {}, en$1 = { get: function(_e, Qt) {
  if (Qt === Q$1)
    return _e;
  var Zt = p$3(_e);
  if (!u$3(Zt, Qt))
    return function(Sn, kn, Kn) {
      var er, Cr = I$1(kn, Kn);
      return Cr ? "value" in Cr ? Cr.value : (er = Cr.get) === null || er === void 0 ? void 0 : er.call(Sn.k) : void 0;
    }(_e, Zt, Qt);
  var $n = Zt[Qt];
  return _e.I || !t$4($n) ? $n : $n === z$2(_e.t, Qt) ? (E$2(_e), _e.o[Qt] = N$1(_e.A.h, $n, _e)) : $n;
}, has: function(_e, Qt) {
  return Qt in p$3(_e);
}, ownKeys: function(_e) {
  return Reflect.ownKeys(p$3(_e));
}, set: function(_e, Qt, Zt) {
  var $n = I$1(p$3(_e), Qt);
  if ($n != null && $n.set)
    return $n.set.call(_e.k, Zt), !0;
  if (!_e.P) {
    var Sn = z$2(p$3(_e), Qt), kn = Sn == null ? void 0 : Sn[Q$1];
    if (kn && kn.t === Zt)
      return _e.o[Qt] = Zt, _e.R[Qt] = !1, !0;
    if (c$3(Zt, Sn) && (Zt !== void 0 || u$3(_e.t, Qt)))
      return !0;
    E$2(_e), k$3(_e);
  }
  return _e.o[Qt] === Zt && (Zt !== void 0 || Qt in _e.o) || Number.isNaN(Zt) && Number.isNaN(_e.o[Qt]) || (_e.o[Qt] = Zt, _e.R[Qt] = !0), !0;
}, deleteProperty: function(_e, Qt) {
  return z$2(_e.t, Qt) !== void 0 || Qt in _e.t ? (_e.R[Qt] = !1, E$2(_e), k$3(_e)) : delete _e.R[Qt], _e.o && delete _e.o[Qt], !0;
}, getOwnPropertyDescriptor: function(_e, Qt) {
  var Zt = p$3(_e), $n = Reflect.getOwnPropertyDescriptor(Zt, Qt);
  return $n && { writable: !0, configurable: _e.i !== 1 || Qt !== "length", enumerable: $n.enumerable, value: Zt[Qt] };
}, defineProperty: function() {
  n$3(11);
}, getPrototypeOf: function(_e) {
  return Object.getPrototypeOf(_e.t);
}, setPrototypeOf: function() {
  n$3(12);
} }, on$2 = {};
i(en$1, function(_e, Qt) {
  on$2[_e] = function() {
    return arguments[0] = arguments[0][0], Qt.apply(this, arguments);
  };
}), on$2.deleteProperty = function(_e, Qt) {
  return on$2.set.call(this, _e, Qt, void 0);
}, on$2.set = function(_e, Qt, Zt) {
  return en$1.set.call(this, _e[0], Qt, Zt, _e[0]);
};
var un$1 = function() {
  function _e(Zt) {
    var $n = this;
    this.O = B$3, this.D = !0, this.produce = function(Sn, kn, Kn) {
      if (typeof Sn == "function" && typeof kn != "function") {
        var er = kn;
        kn = Sn;
        var Cr = $n;
        return function(zs) {
          var Fs = this;
          zs === void 0 && (zs = er);
          for (var Bs = arguments.length, Hs = Array(Bs > 1 ? Bs - 1 : 0), Ws = 1; Ws < Bs; Ws++)
            Hs[Ws - 1] = arguments[Ws];
          return Cr.produce(zs, function(Ys) {
            var El;
            return (El = kn).call.apply(El, [Fs, Ys].concat(Hs));
          });
        };
      }
      var kr;
      if (typeof kn != "function" && n$3(6), Kn !== void 0 && typeof Kn != "function" && n$3(7), t$4(Sn)) {
        var Yr = w$4($n), Ms = N$1($n, Sn, void 0), Ds = !0;
        try {
          kr = kn(Ms), Ds = !1;
        } finally {
          Ds ? g$2(Yr) : O(Yr);
        }
        return typeof Promise < "u" && kr instanceof Promise ? kr.then(function(zs) {
          return j$1(Yr, Kn), P$1(zs, Yr);
        }, function(zs) {
          throw g$2(Yr), zs;
        }) : (j$1(Yr, Kn), P$1(kr, Yr));
      }
      if (!Sn || typeof Sn != "object") {
        if ((kr = kn(Sn)) === void 0 && (kr = Sn), kr === H$2 && (kr = void 0), $n.D && d$1(kr, !0), Kn) {
          var Ls = [], js = [];
          b$3("Patches").M(Sn, kr, Ls, js), Kn(Ls, js);
        }
        return kr;
      }
      n$3(21, Sn);
    }, this.produceWithPatches = function(Sn, kn) {
      if (typeof Sn == "function")
        return function(kr) {
          for (var Yr = arguments.length, Ms = Array(Yr > 1 ? Yr - 1 : 0), Ds = 1; Ds < Yr; Ds++)
            Ms[Ds - 1] = arguments[Ds];
          return $n.produceWithPatches(kr, function(Ls) {
            return Sn.apply(void 0, [Ls].concat(Ms));
          });
        };
      var Kn, er, Cr = $n.produce(Sn, kn, function(kr, Yr) {
        Kn = kr, er = Yr;
      });
      return typeof Promise < "u" && Cr instanceof Promise ? Cr.then(function(kr) {
        return [kr, Kn, er];
      }) : [Cr, Kn, er];
    }, typeof (Zt == null ? void 0 : Zt.useProxies) == "boolean" && this.setUseProxies(Zt.useProxies), typeof (Zt == null ? void 0 : Zt.autoFreeze) == "boolean" && this.setAutoFreeze(Zt.autoFreeze);
  }
  var Qt = _e.prototype;
  return Qt.createDraft = function(Zt) {
    t$4(Zt) || n$3(8), r$3(Zt) && (Zt = R(Zt));
    var $n = w$4(this), Sn = N$1(this, Zt, void 0);
    return Sn[Q$1].C = !0, O($n), Sn;
  }, Qt.finishDraft = function(Zt, $n) {
    var Sn = Zt && Zt[Q$1], kn = Sn.A;
    return j$1(kn, $n), P$1(void 0, kn);
  }, Qt.setAutoFreeze = function(Zt) {
    this.D = Zt;
  }, Qt.setUseProxies = function(Zt) {
    Zt && !B$3 && n$3(20), this.O = Zt;
  }, Qt.applyPatches = function(Zt, $n) {
    var Sn;
    for (Sn = $n.length - 1; Sn >= 0; Sn--) {
      var kn = $n[Sn];
      if (kn.path.length === 0 && kn.op === "replace") {
        Zt = kn.value;
        break;
      }
    }
    Sn > -1 && ($n = $n.slice(Sn + 1));
    var Kn = b$3("Patches").$;
    return r$3(Zt) ? Kn(Zt, $n) : this.produce(Zt, function(er) {
      return Kn(er, $n);
    });
  }, _e;
}(), an$1 = new un$1(), fn$1 = an$1.produce;
an$1.produceWithPatches.bind(an$1);
an$1.setAutoFreeze.bind(an$1);
an$1.setUseProxies.bind(an$1);
an$1.applyPatches.bind(an$1);
an$1.createDraft.bind(an$1);
an$1.finishDraft.bind(an$1);
function _typeof$2(_e) {
  "@babel/helpers - typeof";
  return _typeof$2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(Qt) {
    return typeof Qt;
  } : function(Qt) {
    return Qt && typeof Symbol == "function" && Qt.constructor === Symbol && Qt !== Symbol.prototype ? "symbol" : typeof Qt;
  }, _typeof$2(_e);
}
function _toPrimitive$2(_e, Qt) {
  if (_typeof$2(_e) !== "object" || _e === null)
    return _e;
  var Zt = _e[Symbol.toPrimitive];
  if (Zt !== void 0) {
    var $n = Zt.call(_e, Qt || "default");
    if (_typeof$2($n) !== "object")
      return $n;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return (Qt === "string" ? String : Number)(_e);
}
function _toPropertyKey$2(_e) {
  var Qt = _toPrimitive$2(_e, "string");
  return _typeof$2(Qt) === "symbol" ? Qt : String(Qt);
}
function _defineProperty$4(_e, Qt, Zt) {
  return Qt = _toPropertyKey$2(Qt), Qt in _e ? Object.defineProperty(_e, Qt, {
    value: Zt,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : _e[Qt] = Zt, _e;
}
function ownKeys$2(_e, Qt) {
  var Zt = Object.keys(_e);
  if (Object.getOwnPropertySymbols) {
    var $n = Object.getOwnPropertySymbols(_e);
    Qt && ($n = $n.filter(function(Sn) {
      return Object.getOwnPropertyDescriptor(_e, Sn).enumerable;
    })), Zt.push.apply(Zt, $n);
  }
  return Zt;
}
function _objectSpread2(_e) {
  for (var Qt = 1; Qt < arguments.length; Qt++) {
    var Zt = arguments[Qt] != null ? arguments[Qt] : {};
    Qt % 2 ? ownKeys$2(Object(Zt), !0).forEach(function($n) {
      _defineProperty$4(_e, $n, Zt[$n]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(_e, Object.getOwnPropertyDescriptors(Zt)) : ownKeys$2(Object(Zt)).forEach(function($n) {
      Object.defineProperty(_e, $n, Object.getOwnPropertyDescriptor(Zt, $n));
    });
  }
  return _e;
}
function formatProdErrorMessage(_e) {
  return "Minified Redux error #" + _e + "; visit https://redux.js.org/Errors?code=" + _e + " for the full message or use the non-minified dev environment for full errors. ";
}
var $$observable = function() {
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
}(), randomString = function _e() {
  return Math.random().toString(36).substring(7).split("").join(".");
}, ActionTypes = {
  INIT: "@@redux/INIT" + randomString(),
  REPLACE: "@@redux/REPLACE" + randomString(),
  PROBE_UNKNOWN_ACTION: function _e() {
    return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
  }
};
function isPlainObject$1(_e) {
  if (typeof _e != "object" || _e === null)
    return !1;
  for (var Qt = _e; Object.getPrototypeOf(Qt) !== null; )
    Qt = Object.getPrototypeOf(Qt);
  return Object.getPrototypeOf(_e) === Qt;
}
function createStore$1(_e, Qt, Zt) {
  var $n;
  if (typeof Qt == "function" && typeof Zt == "function" || typeof Zt == "function" && typeof arguments[3] == "function")
    throw new Error(formatProdErrorMessage(0));
  if (typeof Qt == "function" && typeof Zt > "u" && (Zt = Qt, Qt = void 0), typeof Zt < "u") {
    if (typeof Zt != "function")
      throw new Error(formatProdErrorMessage(1));
    return Zt(createStore$1)(_e, Qt);
  }
  if (typeof _e != "function")
    throw new Error(formatProdErrorMessage(2));
  var Sn = _e, kn = Qt, Kn = [], er = Kn, Cr = !1;
  function kr() {
    er === Kn && (er = Kn.slice());
  }
  function Yr() {
    if (Cr)
      throw new Error(formatProdErrorMessage(3));
    return kn;
  }
  function Ms(zs) {
    if (typeof zs != "function")
      throw new Error(formatProdErrorMessage(4));
    if (Cr)
      throw new Error(formatProdErrorMessage(5));
    var Fs = !0;
    return kr(), er.push(zs), function() {
      if (Fs) {
        if (Cr)
          throw new Error(formatProdErrorMessage(6));
        Fs = !1, kr();
        var Hs = er.indexOf(zs);
        er.splice(Hs, 1), Kn = null;
      }
    };
  }
  function Ds(zs) {
    if (!isPlainObject$1(zs))
      throw new Error(formatProdErrorMessage(7));
    if (typeof zs.type > "u")
      throw new Error(formatProdErrorMessage(8));
    if (Cr)
      throw new Error(formatProdErrorMessage(9));
    try {
      Cr = !0, kn = Sn(kn, zs);
    } finally {
      Cr = !1;
    }
    for (var Fs = Kn = er, Bs = 0; Bs < Fs.length; Bs++) {
      var Hs = Fs[Bs];
      Hs();
    }
    return zs;
  }
  function Ls(zs) {
    if (typeof zs != "function")
      throw new Error(formatProdErrorMessage(10));
    Sn = zs, Ds({
      type: ActionTypes.REPLACE
    });
  }
  function js() {
    var zs, Fs = Ms;
    return zs = {
      /**
       * The minimal observable subscription method.
       * @param {Object} observer Any object that can be used as an observer.
       * The observer object should have a `next` method.
       * @returns {subscription} An object with an `unsubscribe` method that can
       * be used to unsubscribe the observable from the store, and prevent further
       * emission of values from the observable.
       */
      subscribe: function(Hs) {
        if (typeof Hs != "object" || Hs === null)
          throw new Error(formatProdErrorMessage(11));
        function Ws() {
          Hs.next && Hs.next(Yr());
        }
        Ws();
        var Ys = Fs(Ws);
        return {
          unsubscribe: Ys
        };
      }
    }, zs[$$observable] = function() {
      return this;
    }, zs;
  }
  return Ds({
    type: ActionTypes.INIT
  }), $n = {
    dispatch: Ds,
    subscribe: Ms,
    getState: Yr,
    replaceReducer: Ls
  }, $n[$$observable] = js, $n;
}
function assertReducerShape(_e) {
  Object.keys(_e).forEach(function(Qt) {
    var Zt = _e[Qt], $n = Zt(void 0, {
      type: ActionTypes.INIT
    });
    if (typeof $n > "u")
      throw new Error(formatProdErrorMessage(12));
    if (typeof Zt(void 0, {
      type: ActionTypes.PROBE_UNKNOWN_ACTION()
    }) > "u")
      throw new Error(formatProdErrorMessage(13));
  });
}
function combineReducers(_e) {
  for (var Qt = Object.keys(_e), Zt = {}, $n = 0; $n < Qt.length; $n++) {
    var Sn = Qt[$n];
    typeof _e[Sn] == "function" && (Zt[Sn] = _e[Sn]);
  }
  var kn = Object.keys(Zt), Kn;
  try {
    assertReducerShape(Zt);
  } catch (er) {
    Kn = er;
  }
  return function(Cr, kr) {
    if (Cr === void 0 && (Cr = {}), Kn)
      throw Kn;
    for (var Yr = !1, Ms = {}, Ds = 0; Ds < kn.length; Ds++) {
      var Ls = kn[Ds], js = Zt[Ls], zs = Cr[Ls], Fs = js(zs, kr);
      if (typeof Fs > "u")
        throw kr && kr.type, new Error(formatProdErrorMessage(14));
      Ms[Ls] = Fs, Yr = Yr || Fs !== zs;
    }
    return Yr = Yr || kn.length !== Object.keys(Cr).length, Yr ? Ms : Cr;
  };
}
function bindActionCreator(_e, Qt) {
  return function() {
    return Qt(_e.apply(this, arguments));
  };
}
function bindActionCreators$1(_e, Qt) {
  if (typeof _e == "function")
    return bindActionCreator(_e, Qt);
  if (typeof _e != "object" || _e === null)
    throw new Error(formatProdErrorMessage(16));
  var Zt = {};
  for (var $n in _e) {
    var Sn = _e[$n];
    typeof Sn == "function" && (Zt[$n] = bindActionCreator(Sn, Qt));
  }
  return Zt;
}
function compose$1() {
  for (var _e = arguments.length, Qt = new Array(_e), Zt = 0; Zt < _e; Zt++)
    Qt[Zt] = arguments[Zt];
  return Qt.length === 0 ? function($n) {
    return $n;
  } : Qt.length === 1 ? Qt[0] : Qt.reduce(function($n, Sn) {
    return function() {
      return $n(Sn.apply(void 0, arguments));
    };
  });
}
function applyMiddleware() {
  for (var _e = arguments.length, Qt = new Array(_e), Zt = 0; Zt < _e; Zt++)
    Qt[Zt] = arguments[Zt];
  return function($n) {
    return function() {
      var Sn = $n.apply(void 0, arguments), kn = function() {
        throw new Error(formatProdErrorMessage(15));
      }, Kn = {
        getState: Sn.getState,
        dispatch: function() {
          return kn.apply(void 0, arguments);
        }
      }, er = Qt.map(function(Cr) {
        return Cr(Kn);
      });
      return kn = compose$1.apply(void 0, er)(Sn.dispatch), _objectSpread2(_objectSpread2({}, Sn), {}, {
        dispatch: kn
      });
    };
  };
}
function createThunkMiddleware(_e) {
  var Qt = function($n) {
    var Sn = $n.dispatch, kn = $n.getState;
    return function(Kn) {
      return function(er) {
        return typeof er == "function" ? er(Sn, kn, _e) : Kn(er);
      };
    };
  };
  return Qt;
}
var thunk = createThunkMiddleware();
thunk.withExtraArgument = createThunkMiddleware;
const thunkMiddleware = thunk;
var __extends$1 = globalThis && globalThis.__extends || function() {
  var _e = function(Qt, Zt) {
    return _e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function($n, Sn) {
      $n.__proto__ = Sn;
    } || function($n, Sn) {
      for (var kn in Sn)
        Object.prototype.hasOwnProperty.call(Sn, kn) && ($n[kn] = Sn[kn]);
    }, _e(Qt, Zt);
  };
  return function(Qt, Zt) {
    if (typeof Zt != "function" && Zt !== null)
      throw new TypeError("Class extends value " + String(Zt) + " is not a constructor or null");
    _e(Qt, Zt);
    function $n() {
      this.constructor = Qt;
    }
    Qt.prototype = Zt === null ? Object.create(Zt) : ($n.prototype = Zt.prototype, new $n());
  };
}(), __generator = globalThis && globalThis.__generator || function(_e, Qt) {
  var Zt = { label: 0, sent: function() {
    if (kn[0] & 1)
      throw kn[1];
    return kn[1];
  }, trys: [], ops: [] }, $n, Sn, kn, Kn;
  return Kn = { next: er(0), throw: er(1), return: er(2) }, typeof Symbol == "function" && (Kn[Symbol.iterator] = function() {
    return this;
  }), Kn;
  function er(kr) {
    return function(Yr) {
      return Cr([kr, Yr]);
    };
  }
  function Cr(kr) {
    if ($n)
      throw new TypeError("Generator is already executing.");
    for (; Zt; )
      try {
        if ($n = 1, Sn && (kn = kr[0] & 2 ? Sn.return : kr[0] ? Sn.throw || ((kn = Sn.return) && kn.call(Sn), 0) : Sn.next) && !(kn = kn.call(Sn, kr[1])).done)
          return kn;
        switch (Sn = 0, kn && (kr = [kr[0] & 2, kn.value]), kr[0]) {
          case 0:
          case 1:
            kn = kr;
            break;
          case 4:
            return Zt.label++, { value: kr[1], done: !1 };
          case 5:
            Zt.label++, Sn = kr[1], kr = [0];
            continue;
          case 7:
            kr = Zt.ops.pop(), Zt.trys.pop();
            continue;
          default:
            if (kn = Zt.trys, !(kn = kn.length > 0 && kn[kn.length - 1]) && (kr[0] === 6 || kr[0] === 2)) {
              Zt = 0;
              continue;
            }
            if (kr[0] === 3 && (!kn || kr[1] > kn[0] && kr[1] < kn[3])) {
              Zt.label = kr[1];
              break;
            }
            if (kr[0] === 6 && Zt.label < kn[1]) {
              Zt.label = kn[1], kn = kr;
              break;
            }
            if (kn && Zt.label < kn[2]) {
              Zt.label = kn[2], Zt.ops.push(kr);
              break;
            }
            kn[2] && Zt.ops.pop(), Zt.trys.pop();
            continue;
        }
        kr = Qt.call(_e, Zt);
      } catch (Yr) {
        kr = [6, Yr], Sn = 0;
      } finally {
        $n = kn = 0;
      }
    if (kr[0] & 5)
      throw kr[1];
    return { value: kr[0] ? kr[1] : void 0, done: !0 };
  }
}, __spreadArray = globalThis && globalThis.__spreadArray || function(_e, Qt) {
  for (var Zt = 0, $n = Qt.length, Sn = _e.length; Zt < $n; Zt++, Sn++)
    _e[Sn] = Qt[Zt];
  return _e;
}, __defProp$2E = Object.defineProperty, __defProps$1j = Object.defineProperties, __getOwnPropDescs$1j = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2H = Object.getOwnPropertySymbols, __hasOwnProp$2H = Object.prototype.hasOwnProperty, __propIsEnum$2H = Object.prototype.propertyIsEnumerable, __defNormalProp$2E = function(_e, Qt, Zt) {
  return Qt in _e ? __defProp$2E(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt;
}, __spreadValues$2E = function(_e, Qt) {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2H.call(Qt, Zt) && __defNormalProp$2E(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2H)
    for (var $n = 0, Sn = __getOwnPropSymbols$2H(Qt); $n < Sn.length; $n++) {
      var Zt = Sn[$n];
      __propIsEnum$2H.call(Qt, Zt) && __defNormalProp$2E(_e, Zt, Qt[Zt]);
    }
  return _e;
}, __spreadProps$1j = function(_e, Qt) {
  return __defProps$1j(_e, __getOwnPropDescs$1j(Qt));
}, __async = function(_e, Qt, Zt) {
  return new Promise(function($n, Sn) {
    var kn = function(Cr) {
      try {
        er(Zt.next(Cr));
      } catch (kr) {
        Sn(kr);
      }
    }, Kn = function(Cr) {
      try {
        er(Zt.throw(Cr));
      } catch (kr) {
        Sn(kr);
      }
    }, er = function(Cr) {
      return Cr.done ? $n(Cr.value) : Promise.resolve(Cr.value).then(kn, Kn);
    };
    er((Zt = Zt.apply(_e, Qt)).next());
  });
}, composeWithDevTools = typeof window < "u" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
  if (arguments.length !== 0)
    return typeof arguments[0] == "object" ? compose$1 : compose$1.apply(null, arguments);
};
function isPlainObject(_e) {
  if (typeof _e != "object" || _e === null)
    return !1;
  var Qt = Object.getPrototypeOf(_e);
  if (Qt === null)
    return !0;
  for (var Zt = Qt; Object.getPrototypeOf(Zt) !== null; )
    Zt = Object.getPrototypeOf(Zt);
  return Qt === Zt;
}
var MiddlewareArray = (
  /** @class */
  function(_e) {
    __extends$1(Qt, _e);
    function Qt() {
      for (var Zt = [], $n = 0; $n < arguments.length; $n++)
        Zt[$n] = arguments[$n];
      var Sn = _e.apply(this, Zt) || this;
      return Object.setPrototypeOf(Sn, Qt.prototype), Sn;
    }
    return Object.defineProperty(Qt, Symbol.species, {
      get: function() {
        return Qt;
      },
      enumerable: !1,
      configurable: !0
    }), Qt.prototype.concat = function() {
      for (var Zt = [], $n = 0; $n < arguments.length; $n++)
        Zt[$n] = arguments[$n];
      return _e.prototype.concat.apply(this, Zt);
    }, Qt.prototype.prepend = function() {
      for (var Zt = [], $n = 0; $n < arguments.length; $n++)
        Zt[$n] = arguments[$n];
      return Zt.length === 1 && Array.isArray(Zt[0]) ? new (Qt.bind.apply(Qt, __spreadArray([void 0], Zt[0].concat(this))))() : new (Qt.bind.apply(Qt, __spreadArray([void 0], Zt.concat(this))))();
    }, Qt;
  }(Array)
), EnhancerArray = (
  /** @class */
  function(_e) {
    __extends$1(Qt, _e);
    function Qt() {
      for (var Zt = [], $n = 0; $n < arguments.length; $n++)
        Zt[$n] = arguments[$n];
      var Sn = _e.apply(this, Zt) || this;
      return Object.setPrototypeOf(Sn, Qt.prototype), Sn;
    }
    return Object.defineProperty(Qt, Symbol.species, {
      get: function() {
        return Qt;
      },
      enumerable: !1,
      configurable: !0
    }), Qt.prototype.concat = function() {
      for (var Zt = [], $n = 0; $n < arguments.length; $n++)
        Zt[$n] = arguments[$n];
      return _e.prototype.concat.apply(this, Zt);
    }, Qt.prototype.prepend = function() {
      for (var Zt = [], $n = 0; $n < arguments.length; $n++)
        Zt[$n] = arguments[$n];
      return Zt.length === 1 && Array.isArray(Zt[0]) ? new (Qt.bind.apply(Qt, __spreadArray([void 0], Zt[0].concat(this))))() : new (Qt.bind.apply(Qt, __spreadArray([void 0], Zt.concat(this))))();
    }, Qt;
  }(Array)
);
function freezeDraftable(_e) {
  return t$4(_e) ? fn$1(_e, function() {
  }) : _e;
}
function isBoolean$3(_e) {
  return typeof _e == "boolean";
}
function curryGetDefaultMiddleware() {
  return function(Qt) {
    return getDefaultMiddleware(Qt);
  };
}
function getDefaultMiddleware(_e) {
  _e === void 0 && (_e = {});
  var Qt = _e.thunk, Zt = Qt === void 0 ? !0 : Qt;
  _e.immutableCheck, _e.serializableCheck;
  var $n = new MiddlewareArray();
  return Zt && (isBoolean$3(Zt) ? $n.push(thunkMiddleware) : $n.push(thunkMiddleware.withExtraArgument(Zt.extraArgument))), $n;
}
var IS_PRODUCTION = !0;
function configureStore(_e) {
  var Qt = curryGetDefaultMiddleware(), Zt = _e || {}, $n = Zt.reducer, Sn = $n === void 0 ? void 0 : $n, kn = Zt.middleware, Kn = kn === void 0 ? Qt() : kn, er = Zt.devTools, Cr = er === void 0 ? !0 : er, kr = Zt.preloadedState, Yr = kr === void 0 ? void 0 : kr, Ms = Zt.enhancers, Ds = Ms === void 0 ? void 0 : Ms, Ls;
  if (typeof Sn == "function")
    Ls = Sn;
  else if (isPlainObject(Sn))
    Ls = combineReducers(Sn);
  else
    throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');
  var js = Kn;
  typeof js == "function" && (js = js(Qt));
  var zs = applyMiddleware.apply(void 0, js), Fs = compose$1;
  Cr && (Fs = composeWithDevTools(__spreadValues$2E({
    trace: !IS_PRODUCTION
  }, typeof Cr == "object" && Cr)));
  var Bs = new EnhancerArray(zs), Hs = Bs;
  Array.isArray(Ds) ? Hs = __spreadArray([zs], Ds) : typeof Ds == "function" && (Hs = Ds(Bs));
  var Ws = Fs.apply(void 0, Hs);
  return createStore$1(Ls, Yr, Ws);
}
function createAction(_e, Qt) {
  function Zt() {
    for (var $n = [], Sn = 0; Sn < arguments.length; Sn++)
      $n[Sn] = arguments[Sn];
    if (Qt) {
      var kn = Qt.apply(void 0, $n);
      if (!kn)
        throw new Error("prepareAction did not return an object");
      return __spreadValues$2E(__spreadValues$2E({
        type: _e,
        payload: kn.payload
      }, "meta" in kn && { meta: kn.meta }), "error" in kn && { error: kn.error });
    }
    return { type: _e, payload: $n[0] };
  }
  return Zt.toString = function() {
    return "" + _e;
  }, Zt.type = _e, Zt.match = function($n) {
    return $n.type === _e;
  }, Zt;
}
function isAction(_e) {
  return isPlainObject(_e) && "type" in _e;
}
function executeReducerBuilderCallback(_e) {
  var Qt = {}, Zt = [], $n, Sn = {
    addCase: function(kn, Kn) {
      var er = typeof kn == "string" ? kn : kn.type;
      if (er in Qt)
        throw new Error("addCase cannot be called with two reducers for the same action type");
      return Qt[er] = Kn, Sn;
    },
    addMatcher: function(kn, Kn) {
      return Zt.push({ matcher: kn, reducer: Kn }), Sn;
    },
    addDefaultCase: function(kn) {
      return $n = kn, Sn;
    }
  };
  return _e(Sn), [Qt, Zt, $n];
}
function isStateFunction(_e) {
  return typeof _e == "function";
}
function createReducer(_e, Qt, Zt, $n) {
  Zt === void 0 && (Zt = []);
  var Sn = typeof Qt == "function" ? executeReducerBuilderCallback(Qt) : [Qt, Zt, $n], kn = Sn[0], Kn = Sn[1], er = Sn[2], Cr;
  if (isStateFunction(_e))
    Cr = function() {
      return freezeDraftable(_e());
    };
  else {
    var kr = freezeDraftable(_e);
    Cr = function() {
      return kr;
    };
  }
  function Yr(Ms, Ds) {
    Ms === void 0 && (Ms = Cr());
    var Ls = __spreadArray([
      kn[Ds.type]
    ], Kn.filter(function(js) {
      var zs = js.matcher;
      return zs(Ds);
    }).map(function(js) {
      var zs = js.reducer;
      return zs;
    }));
    return Ls.filter(function(js) {
      return !!js;
    }).length === 0 && (Ls = [er]), Ls.reduce(function(js, zs) {
      if (zs)
        if (r$3(js)) {
          var Fs = js, Bs = zs(Fs, Ds);
          return Bs === void 0 ? js : Bs;
        } else {
          if (t$4(js))
            return fn$1(js, function(Hs) {
              return zs(Hs, Ds);
            });
          var Bs = zs(js, Ds);
          if (Bs === void 0) {
            if (js === null)
              return js;
            throw Error("A case reducer on a non-draftable value must not return undefined");
          }
          return Bs;
        }
      return js;
    }, Ms);
  }
  return Yr.getInitialState = Cr, Yr;
}
function getType2(_e, Qt) {
  return _e + "/" + Qt;
}
function createSlice(_e) {
  var Qt = _e.name;
  if (!Qt)
    throw new Error("`name` is a required option for createSlice");
  typeof process < "u";
  var Zt = typeof _e.initialState == "function" ? _e.initialState : freezeDraftable(_e.initialState), $n = _e.reducers || {}, Sn = Object.keys($n), kn = {}, Kn = {}, er = {};
  Sn.forEach(function(Yr) {
    var Ms = $n[Yr], Ds = getType2(Qt, Yr), Ls, js;
    "reducer" in Ms ? (Ls = Ms.reducer, js = Ms.prepare) : Ls = Ms, kn[Yr] = Ls, Kn[Ds] = Ls, er[Yr] = js ? createAction(Ds, js) : createAction(Ds);
  });
  function Cr() {
    var Yr = typeof _e.extraReducers == "function" ? executeReducerBuilderCallback(_e.extraReducers) : [_e.extraReducers], Ms = Yr[0], Ds = Ms === void 0 ? {} : Ms, Ls = Yr[1], js = Ls === void 0 ? [] : Ls, zs = Yr[2], Fs = zs === void 0 ? void 0 : zs, Bs = __spreadValues$2E(__spreadValues$2E({}, Ds), Kn);
    return createReducer(Zt, function(Hs) {
      for (var Ws in Bs)
        Hs.addCase(Ws, Bs[Ws]);
      for (var Ys = 0, El = js; Ys < El.length; Ys++) {
        var Mu = El[Ys];
        Hs.addMatcher(Mu.matcher, Mu.reducer);
      }
      Fs && Hs.addDefaultCase(Fs);
    });
  }
  var kr;
  return {
    name: Qt,
    reducer: function(Yr, Ms) {
      return kr || (kr = Cr()), kr(Yr, Ms);
    },
    actions: er,
    caseReducers: kn,
    getInitialState: function() {
      return kr || (kr = Cr()), kr.getInitialState();
    }
  };
}
var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW", nanoid = function(_e) {
  _e === void 0 && (_e = 21);
  for (var Qt = "", Zt = _e; Zt--; )
    Qt += urlAlphabet[Math.random() * 64 | 0];
  return Qt;
}, commonProperties = [
  "name",
  "message",
  "stack",
  "code"
], RejectWithValue = (
  /** @class */
  function() {
    function _e(Qt, Zt) {
      this.payload = Qt, this.meta = Zt;
    }
    return _e;
  }()
), FulfillWithMeta = (
  /** @class */
  function() {
    function _e(Qt, Zt) {
      this.payload = Qt, this.meta = Zt;
    }
    return _e;
  }()
), miniSerializeError = function(_e) {
  if (typeof _e == "object" && _e !== null) {
    for (var Qt = {}, Zt = 0, $n = commonProperties; Zt < $n.length; Zt++) {
      var Sn = $n[Zt];
      typeof _e[Sn] == "string" && (Qt[Sn] = _e[Sn]);
    }
    return Qt;
  }
  return { message: String(_e) };
};
(function() {
  function _e(Qt, Zt, $n) {
    var Sn = createAction(Qt + "/fulfilled", function(kr, Yr, Ms, Ds) {
      return {
        payload: kr,
        meta: __spreadProps$1j(__spreadValues$2E({}, Ds || {}), {
          arg: Ms,
          requestId: Yr,
          requestStatus: "fulfilled"
        })
      };
    }), kn = createAction(Qt + "/pending", function(kr, Yr, Ms) {
      return {
        payload: void 0,
        meta: __spreadProps$1j(__spreadValues$2E({}, Ms || {}), {
          arg: Yr,
          requestId: kr,
          requestStatus: "pending"
        })
      };
    }), Kn = createAction(Qt + "/rejected", function(kr, Yr, Ms, Ds, Ls) {
      return {
        payload: Ds,
        error: ($n && $n.serializeError || miniSerializeError)(kr || "Rejected"),
        meta: __spreadProps$1j(__spreadValues$2E({}, Ls || {}), {
          arg: Ms,
          requestId: Yr,
          rejectedWithValue: !!Ds,
          requestStatus: "rejected",
          aborted: (kr == null ? void 0 : kr.name) === "AbortError",
          condition: (kr == null ? void 0 : kr.name) === "ConditionError"
        })
      };
    }), er = typeof AbortController < "u" ? AbortController : (
      /** @class */
      function() {
        function kr() {
          this.signal = {
            aborted: !1,
            addEventListener: function() {
            },
            dispatchEvent: function() {
              return !1;
            },
            onabort: function() {
            },
            removeEventListener: function() {
            },
            reason: void 0,
            throwIfAborted: function() {
            }
          };
        }
        return kr.prototype.abort = function() {
        }, kr;
      }()
    );
    function Cr(kr) {
      return function(Yr, Ms, Ds) {
        var Ls = $n != null && $n.idGenerator ? $n.idGenerator(kr) : nanoid(), js = new er(), zs;
        function Fs(Hs) {
          zs = Hs, js.abort();
        }
        var Bs = function() {
          return __async(this, null, function() {
            var Hs, Ws, Ys, El, Mu, Pl, Iu;
            return __generator(this, function(Tu) {
              switch (Tu.label) {
                case 0:
                  return Tu.trys.push([0, 4, , 5]), El = (Hs = $n == null ? void 0 : $n.condition) == null ? void 0 : Hs.call($n, kr, { getState: Ms, extra: Ds }), isThenable(El) ? [4, El] : [3, 2];
                case 1:
                  El = Tu.sent(), Tu.label = 2;
                case 2:
                  if (El === !1 || js.signal.aborted)
                    throw {
                      name: "ConditionError",
                      message: "Aborted due to condition callback returning false."
                    };
                  return Mu = new Promise(function(Au, Nu) {
                    return js.signal.addEventListener("abort", function() {
                      return Nu({
                        name: "AbortError",
                        message: zs || "Aborted"
                      });
                    });
                  }), Yr(kn(Ls, kr, (Ws = $n == null ? void 0 : $n.getPendingMeta) == null ? void 0 : Ws.call($n, { requestId: Ls, arg: kr }, { getState: Ms, extra: Ds }))), [4, Promise.race([
                    Mu,
                    Promise.resolve(Zt(kr, {
                      dispatch: Yr,
                      getState: Ms,
                      extra: Ds,
                      requestId: Ls,
                      signal: js.signal,
                      abort: Fs,
                      rejectWithValue: function(Au, Nu) {
                        return new RejectWithValue(Au, Nu);
                      },
                      fulfillWithValue: function(Au, Nu) {
                        return new FulfillWithMeta(Au, Nu);
                      }
                    })).then(function(Au) {
                      if (Au instanceof RejectWithValue)
                        throw Au;
                      return Au instanceof FulfillWithMeta ? Sn(Au.payload, Ls, kr, Au.meta) : Sn(Au, Ls, kr);
                    })
                  ])];
                case 3:
                  return Ys = Tu.sent(), [3, 5];
                case 4:
                  return Pl = Tu.sent(), Ys = Pl instanceof RejectWithValue ? Kn(null, Ls, kr, Pl.payload, Pl.meta) : Kn(Pl, Ls, kr), [3, 5];
                case 5:
                  return Iu = $n && !$n.dispatchConditionRejection && Kn.match(Ys) && Ys.meta.condition, Iu || Yr(Ys), [2, Ys];
              }
            });
          });
        }();
        return Object.assign(Bs, {
          abort: Fs,
          requestId: Ls,
          arg: kr,
          unwrap: function() {
            return Bs.then(unwrapResult);
          }
        });
      };
    }
    return Object.assign(Cr, {
      pending: kn,
      rejected: Kn,
      fulfilled: Sn,
      typePrefix: Qt
    });
  }
  return _e.withTypes = function() {
    return _e;
  }, _e;
})();
function unwrapResult(_e) {
  if (_e.meta && _e.meta.rejectedWithValue)
    throw _e.payload;
  if (_e.error)
    throw _e.error;
  return _e.payload;
}
function isThenable(_e) {
  return _e !== null && typeof _e == "object" && typeof _e.then == "function";
}
var hasMatchFunction = function(_e) {
  return _e && typeof _e.match == "function";
}, matches = function(_e, Qt) {
  return hasMatchFunction(_e) ? _e.match(Qt) : _e(Qt);
};
function isAnyOf() {
  for (var _e = [], Qt = 0; Qt < arguments.length; Qt++)
    _e[Qt] = arguments[Qt];
  return function(Zt) {
    return _e.some(function($n) {
      return matches($n, Zt);
    });
  };
}
var assertFunction = function(_e, Qt) {
  if (typeof _e != "function")
    throw new TypeError(Qt + " is not a function");
}, noop$a = function() {
}, catchRejection = function(_e, Qt) {
  return Qt === void 0 && (Qt = noop$a), _e.catch(Qt), _e;
}, addAbortSignalListener = function(_e, Qt) {
  return _e.addEventListener("abort", Qt, { once: !0 }), function() {
    return _e.removeEventListener("abort", Qt);
  };
}, abortControllerWithReason = function(_e, Qt) {
  var Zt = _e.signal;
  Zt.aborted || ("reason" in Zt || Object.defineProperty(Zt, "reason", {
    enumerable: !0,
    value: Qt,
    configurable: !0,
    writable: !0
  }), _e.abort(Qt));
}, task = "task", listener$1 = "listener", completed = "completed", cancelled = "cancelled", taskCancelled = "task-" + cancelled, taskCompleted = "task-" + completed, listenerCancelled = listener$1 + "-" + cancelled, listenerCompleted = listener$1 + "-" + completed, TaskAbortError = (
  /** @class */
  function() {
    function _e(Qt) {
      this.code = Qt, this.name = "TaskAbortError", this.message = task + " " + cancelled + " (reason: " + Qt + ")";
    }
    return _e;
  }()
), validateActive = function(_e) {
  if (_e.aborted)
    throw new TaskAbortError(_e.reason);
};
function raceWithSignal(_e, Qt) {
  var Zt = noop$a;
  return new Promise(function($n, Sn) {
    var kn = function() {
      return Sn(new TaskAbortError(_e.reason));
    };
    if (_e.aborted) {
      kn();
      return;
    }
    Zt = addAbortSignalListener(_e, kn), Qt.finally(function() {
      return Zt();
    }).then($n, Sn);
  }).finally(function() {
    Zt = noop$a;
  });
}
var runTask = function(_e, Qt) {
  return __async(void 0, null, function() {
    var Zt, $n;
    return __generator(this, function(Sn) {
      switch (Sn.label) {
        case 0:
          return Sn.trys.push([0, 3, 4, 5]), [4, Promise.resolve()];
        case 1:
          return Sn.sent(), [4, _e()];
        case 2:
          return Zt = Sn.sent(), [2, {
            status: "ok",
            value: Zt
          }];
        case 3:
          return $n = Sn.sent(), [2, {
            status: $n instanceof TaskAbortError ? "cancelled" : "rejected",
            error: $n
          }];
        case 4:
          return Qt == null || Qt(), [
            7
            /*endfinally*/
          ];
        case 5:
          return [
            2
            /*return*/
          ];
      }
    });
  });
}, createPause = function(_e) {
  return function(Qt) {
    return catchRejection(raceWithSignal(_e, Qt).then(function(Zt) {
      return validateActive(_e), Zt;
    }));
  };
}, createDelay = function(_e) {
  var Qt = createPause(_e);
  return function(Zt) {
    return Qt(new Promise(function($n) {
      return setTimeout($n, Zt);
    }));
  };
}, assign$1 = Object.assign, INTERNAL_NIL_TOKEN = {}, alm = "listenerMiddleware", createFork = function(_e) {
  var Qt = function(Zt) {
    return addAbortSignalListener(_e, function() {
      return abortControllerWithReason(Zt, _e.reason);
    });
  };
  return function(Zt) {
    assertFunction(Zt, "taskExecutor");
    var $n = new AbortController();
    Qt($n);
    var Sn = runTask(function() {
      return __async(void 0, null, function() {
        var kn;
        return __generator(this, function(Kn) {
          switch (Kn.label) {
            case 0:
              return validateActive(_e), validateActive($n.signal), [4, Zt({
                pause: createPause($n.signal),
                delay: createDelay($n.signal),
                signal: $n.signal
              })];
            case 1:
              return kn = Kn.sent(), validateActive($n.signal), [2, kn];
          }
        });
      });
    }, function() {
      return abortControllerWithReason($n, taskCompleted);
    });
    return {
      result: createPause(_e)(Sn),
      cancel: function() {
        abortControllerWithReason($n, taskCancelled);
      }
    };
  };
}, createTakePattern = function(_e, Qt) {
  var Zt = function($n, Sn) {
    return __async(void 0, null, function() {
      var kn, Kn, er, Cr;
      return __generator(this, function(kr) {
        switch (kr.label) {
          case 0:
            validateActive(Qt), kn = function() {
            }, Kn = new Promise(function(Yr, Ms) {
              var Ds = _e({
                predicate: $n,
                effect: function(Ls, js) {
                  js.unsubscribe(), Yr([
                    Ls,
                    js.getState(),
                    js.getOriginalState()
                  ]);
                }
              });
              kn = function() {
                Ds(), Ms();
              };
            }), er = [
              Kn
            ], Sn != null && er.push(new Promise(function(Yr) {
              return setTimeout(Yr, Sn, null);
            })), kr.label = 1;
          case 1:
            return kr.trys.push([1, , 3, 4]), [4, raceWithSignal(Qt, Promise.race(er))];
          case 2:
            return Cr = kr.sent(), validateActive(Qt), [2, Cr];
          case 3:
            return kn(), [
              7
              /*endfinally*/
            ];
          case 4:
            return [
              2
              /*return*/
            ];
        }
      });
    });
  };
  return function($n, Sn) {
    return catchRejection(Zt($n, Sn));
  };
}, getListenerEntryPropsFrom = function(_e) {
  var Qt = _e.type, Zt = _e.actionCreator, $n = _e.matcher, Sn = _e.predicate, kn = _e.effect;
  if (Qt)
    Sn = createAction(Qt).match;
  else if (Zt)
    Qt = Zt.type, Sn = Zt.match;
  else if ($n)
    Sn = $n;
  else if (!Sn)
    throw new Error("Creating or removing a listener requires one of the known fields for matching an action");
  return assertFunction(kn, "options.listener"), { predicate: Sn, type: Qt, effect: kn };
}, createListenerEntry = function(_e) {
  var Qt = getListenerEntryPropsFrom(_e), Zt = Qt.type, $n = Qt.predicate, Sn = Qt.effect, kn = nanoid(), Kn = {
    id: kn,
    effect: Sn,
    type: Zt,
    predicate: $n,
    pending: /* @__PURE__ */ new Set(),
    unsubscribe: function() {
      throw new Error("Unsubscribe not initialized");
    }
  };
  return Kn;
}, cancelActiveListeners = function(_e) {
  _e.pending.forEach(function(Qt) {
    abortControllerWithReason(Qt, listenerCancelled);
  });
}, createClearListenerMiddleware = function(_e) {
  return function() {
    _e.forEach(cancelActiveListeners), _e.clear();
  };
}, safelyNotifyError = function(_e, Qt, Zt) {
  try {
    _e(Qt, Zt);
  } catch ($n) {
    setTimeout(function() {
      throw $n;
    }, 0);
  }
}, addListener = createAction(alm + "/add"), clearAllListeners = createAction(alm + "/removeAll"), removeListener = createAction(alm + "/remove"), defaultErrorHandler = function() {
  for (var _e = [], Qt = 0; Qt < arguments.length; Qt++)
    _e[Qt] = arguments[Qt];
  console.error.apply(console, __spreadArray([alm + "/error"], _e));
};
function createListenerMiddleware(_e) {
  var Qt = this;
  _e === void 0 && (_e = {});
  var Zt = /* @__PURE__ */ new Map(), $n = _e.extra, Sn = _e.onError, kn = Sn === void 0 ? defaultErrorHandler : Sn;
  assertFunction(kn, "onError");
  var Kn = function(Ls) {
    return Ls.unsubscribe = function() {
      return Zt.delete(Ls.id);
    }, Zt.set(Ls.id, Ls), function(js) {
      Ls.unsubscribe(), js != null && js.cancelActive && cancelActiveListeners(Ls);
    };
  }, er = function(Ls) {
    for (var js = 0, zs = Array.from(Zt.values()); js < zs.length; js++) {
      var Fs = zs[js];
      if (Ls(Fs))
        return Fs;
    }
  }, Cr = function(Ls) {
    var js = er(function(zs) {
      return zs.effect === Ls.effect;
    });
    return js || (js = createListenerEntry(Ls)), Kn(js);
  }, kr = function(Ls) {
    var js = getListenerEntryPropsFrom(Ls), zs = js.type, Fs = js.effect, Bs = js.predicate, Hs = er(function(Ws) {
      var Ys = typeof zs == "string" ? Ws.type === zs : Ws.predicate === Bs;
      return Ys && Ws.effect === Fs;
    });
    return Hs && (Hs.unsubscribe(), Ls.cancelActive && cancelActiveListeners(Hs)), !!Hs;
  }, Yr = function(Ls, js, zs, Fs) {
    return __async(Qt, null, function() {
      var Bs, Hs, Ws;
      return __generator(this, function(Ys) {
        switch (Ys.label) {
          case 0:
            Bs = new AbortController(), Hs = createTakePattern(Cr, Bs.signal), Ys.label = 1;
          case 1:
            return Ys.trys.push([1, 3, 4, 5]), Ls.pending.add(Bs), [4, Promise.resolve(Ls.effect(js, assign$1({}, zs, {
              getOriginalState: Fs,
              condition: function(El, Mu) {
                return Hs(El, Mu).then(Boolean);
              },
              take: Hs,
              delay: createDelay(Bs.signal),
              pause: createPause(Bs.signal),
              extra: $n,
              signal: Bs.signal,
              fork: createFork(Bs.signal),
              unsubscribe: Ls.unsubscribe,
              subscribe: function() {
                Zt.set(Ls.id, Ls);
              },
              cancelActiveListeners: function() {
                Ls.pending.forEach(function(El, Mu, Pl) {
                  El !== Bs && (abortControllerWithReason(El, listenerCancelled), Pl.delete(El));
                });
              }
            })))];
          case 2:
            return Ys.sent(), [3, 5];
          case 3:
            return Ws = Ys.sent(), Ws instanceof TaskAbortError || safelyNotifyError(kn, Ws, {
              raisedBy: "effect"
            }), [3, 5];
          case 4:
            return abortControllerWithReason(Bs, listenerCompleted), Ls.pending.delete(Bs), [
              7
              /*endfinally*/
            ];
          case 5:
            return [
              2
              /*return*/
            ];
        }
      });
    });
  }, Ms = createClearListenerMiddleware(Zt), Ds = function(Ls) {
    return function(js) {
      return function(zs) {
        if (!isAction(zs))
          return js(zs);
        if (addListener.match(zs))
          return Cr(zs.payload);
        if (clearAllListeners.match(zs)) {
          Ms();
          return;
        }
        if (removeListener.match(zs))
          return kr(zs.payload);
        var Fs = Ls.getState(), Bs = function() {
          if (Fs === INTERNAL_NIL_TOKEN)
            throw new Error(alm + ": getOriginalState can only be called synchronously");
          return Fs;
        }, Hs;
        try {
          if (Hs = js(zs), Zt.size > 0)
            for (var Ws = Ls.getState(), Ys = Array.from(Zt.values()), El = 0, Mu = Ys; El < Mu.length; El++) {
              var Pl = Mu[El], Iu = !1;
              try {
                Iu = Pl.predicate(zs, Ws, Fs);
              } catch (Tu) {
                Iu = !1, safelyNotifyError(kn, Tu, {
                  raisedBy: "predicate"
                });
              }
              Iu && Yr(Pl, zs, Ls, Bs);
            }
        } finally {
          Fs = INTERNAL_NIL_TOKEN;
        }
        return Hs;
      };
    };
  };
  return {
    middleware: Ds,
    startListening: Cr,
    stopListening: kr,
    clearListeners: Ms
  };
}
var promise;
typeof queueMicrotask == "function" && queueMicrotask.bind(typeof window < "u" ? window : typeof global < "u" ? global : globalThis);
F$1();
function Qe$1() {
  const _e = /* @__PURE__ */ new Map();
  return {
    listen(Qt, Zt) {
      return _e.has(Qt) || _e.set(Qt, []), _e.get(Qt).push(Zt), () => {
        _e.set(
          Qt,
          (_e.get(Qt) || []).filter(($n) => $n !== Zt)
        );
      };
    },
    fire(Qt, Zt) {
      const $n = _e.get(Qt);
      $n && $n.forEach((Sn) => Sn(Zt));
    }
  };
}
let H$1;
const Ge$1 = new Uint8Array(16);
function Ye$1() {
  if (!H$1 && (H$1 = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !H$1))
    throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
  return H$1(Ge$1);
}
const m$4 = [];
for (let _e = 0; _e < 256; ++_e)
  m$4.push((_e + 256).toString(16).slice(1));
function qe$1(_e, Qt = 0) {
  return (m$4[_e[Qt + 0]] + m$4[_e[Qt + 1]] + m$4[_e[Qt + 2]] + m$4[_e[Qt + 3]] + "-" + m$4[_e[Qt + 4]] + m$4[_e[Qt + 5]] + "-" + m$4[_e[Qt + 6]] + m$4[_e[Qt + 7]] + "-" + m$4[_e[Qt + 8]] + m$4[_e[Qt + 9]] + "-" + m$4[_e[Qt + 10]] + m$4[_e[Qt + 11]] + m$4[_e[Qt + 12]] + m$4[_e[Qt + 13]] + m$4[_e[Qt + 14]] + m$4[_e[Qt + 15]]).toLowerCase();
}
const Xe$1 = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Pe$1 = {
  randomUUID: Xe$1
};
function Ne$1(_e, Qt, Zt) {
  if (Pe$1.randomUUID && !Qt && !_e)
    return Pe$1.randomUUID();
  _e = _e || {};
  const $n = _e.random || (_e.rng || Ye$1)();
  if ($n[6] = $n[6] & 15 | 64, $n[8] = $n[8] & 63 | 128, Qt) {
    Zt = Zt || 0;
    for (let Sn = 0; Sn < 16; ++Sn)
      Qt[Zt + Sn] = $n[Sn];
    return Qt;
  }
  return qe$1($n);
}
class N {
  static get() {
    let Qt = Ne$1();
    for (; this.ids.has(Qt); )
      Qt = Ne$1();
    return this.ids.set(Qt, !0), Qt;
  }
}
N.ids = /* @__PURE__ */ new Map();
function P(_e) {
  return "parent" in _e;
}
function Mt$1(_e) {
  return !P(_e);
}
function Ze$1(_e) {
  const { label: Qt = void 0, state: Zt, initialArtifact: $n, initialMetadata: Sn } = _e, kn = {
    annotation: [],
    bookmark: []
  }, Kn = Object.keys(Sn || {}).reduce(
    (Cr, kr) => (Cr[kr] = [], Sn && Sn[kr] && Cr[kr].push({
      type: kr,
      id: N.get(),
      val: Sn[kr],
      createdOn: Date.now()
    }), Cr),
    kn
  ), er = $n ? [
    {
      id: N.get(),
      createdOn: Date.now(),
      val: $n
    }
  ] : [];
  return {
    id: N.get(),
    label: Qt || "Root",
    event: "Root",
    children: [],
    level: 0,
    createdOn: Date.now(),
    meta: Kn,
    artifacts: er,
    state: {
      type: "checkpoint",
      val: Zt
    }
  };
}
function Ve$1({
  parent: _e,
  state: Qt,
  label: Zt,
  sideEffects: $n = {
    do: [],
    undo: []
  },
  initialMetadata: Sn,
  initialArtifact: kn,
  event: Kn
}) {
  const er = {
    annotation: [],
    bookmark: []
  }, Cr = Object.keys(Sn || {}).reduce(
    (Yr, Ms) => (Yr[Ms] = [], Sn && Sn[Ms] && Yr[Ms].push({
      type: Ms,
      id: N.get(),
      val: Sn[Ms],
      createdOn: Date.now()
    }), Yr),
    er
  ), kr = kn ? [
    {
      id: N.get(),
      createdOn: Date.now(),
      val: kn
    }
  ] : [];
  return {
    id: N.get(),
    label: Zt,
    event: Kn,
    children: [],
    parent: _e.id,
    createdOn: Date.now(),
    meta: Cr,
    artifacts: kr,
    sideEffects: $n,
    state: Qt,
    level: _e.level + 1
  };
}
function g$1(_e) {
  for (var Qt = arguments.length, Zt = Array(Qt > 1 ? Qt - 1 : 0), $n = 1; $n < Qt; $n++)
    Zt[$n - 1] = arguments[$n];
  if ({}.NODE_ENV !== "production") {
    var Sn = ct$1[_e], kn = Sn ? typeof Sn == "function" ? Sn.apply(null, Zt) : Sn : "unknown error nr: " + _e;
    throw Error("[Immer] " + kn);
  }
  throw Error("[Immer] minified error nr: " + _e + (Zt.length ? " " + Zt.map(function(Kn) {
    return "'" + Kn + "'";
  }).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
}
function M$1(_e) {
  return !!_e && !!_e[_];
}
function S(_e) {
  var Qt;
  return !!_e && (function(Zt) {
    if (!Zt || typeof Zt != "object")
      return !1;
    var $n = Object.getPrototypeOf(Zt);
    if ($n === null)
      return !0;
    var Sn = Object.hasOwnProperty.call($n, "constructor") && $n.constructor;
    return Sn === Object || typeof Sn == "function" && Function.toString.call(Sn) === st$1;
  }(_e) || Array.isArray(_e) || !!_e[J] || !!(!((Qt = _e.constructor) === null || Qt === void 0) && Qt[J]) || X$2(_e) || Z(_e));
}
function C$3(_e, Qt, Zt) {
  Zt === void 0 && (Zt = !1), D$2(_e) === 0 ? (Zt ? Object.keys : Oe)(_e).forEach(function($n) {
    Zt && typeof $n == "symbol" || Qt($n, _e[$n], _e);
  }) : _e.forEach(function($n, Sn) {
    return Qt(Sn, $n, _e);
  });
}
function D$2(_e) {
  var Qt = _e[_];
  return Qt ? Qt.i > 3 ? Qt.i - 4 : Qt.i : Array.isArray(_e) ? 1 : X$2(_e) ? 2 : Z(_e) ? 3 : 0;
}
function k$2(_e, Qt) {
  return D$2(_e) === 2 ? _e.has(Qt) : Object.prototype.hasOwnProperty.call(_e, Qt);
}
function B$2(_e, Qt) {
  return D$2(_e) === 2 ? _e.get(Qt) : _e[Qt];
}
function Ue(_e, Qt, Zt) {
  var $n = D$2(_e);
  $n === 2 ? _e.set(Qt, Zt) : $n === 3 ? (_e.delete(Qt), _e.add(Zt)) : _e[Qt] = Zt;
}
function et$1(_e, Qt) {
  return _e === Qt ? _e !== 0 || 1 / _e == 1 / Qt : _e != _e && Qt != Qt;
}
function X$2(_e) {
  return it$1 && _e instanceof Map;
}
function Z(_e) {
  return ut$1 && _e instanceof Set;
}
function I(_e) {
  return _e.o || _e.t;
}
function ve$1(_e) {
  if (Array.isArray(_e))
    return Array.prototype.slice.call(_e);
  var Qt = ft$1(_e);
  delete Qt[_];
  for (var Zt = Oe(Qt), $n = 0; $n < Zt.length; $n++) {
    var Sn = Zt[$n], kn = Qt[Sn];
    kn.writable === !1 && (kn.writable = !0, kn.configurable = !0), (kn.get || kn.set) && (Qt[Sn] = { configurable: !0, writable: !0, enumerable: kn.enumerable, value: _e[Sn] });
  }
  return Object.create(Object.getPrototypeOf(_e), Qt);
}
function ye$1(_e, Qt) {
  return Qt === void 0 && (Qt = !1), ge$1(_e) || M$1(_e) || !S(_e) || (D$2(_e) > 1 && (_e.set = _e.add = _e.clear = _e.delete = tt$1), Object.freeze(_e), Qt && C$3(_e, function(Zt, $n) {
    return ye$1($n, !0);
  }, !0)), _e;
}
function tt$1() {
  g$1(2);
}
function ge$1(_e) {
  return _e == null || typeof _e != "object" || Object.isFrozen(_e);
}
function T(_e) {
  var Qt = ce[_e];
  return Qt || g$1(18, _e), Qt;
}
function rt$1(_e, Qt) {
  ce[_e] || (ce[_e] = Qt);
}
function Te$1() {
  return {}.NODE_ENV === "production" || F || g$1(0), F;
}
function te(_e, Qt) {
  Qt && (T("Patches"), _e.u = [], _e.s = [], _e.v = Qt);
}
function W(_e) {
  ae$1(_e), _e.p.forEach(nt$1), _e.p = null;
}
function ae$1(_e) {
  _e === F && (F = _e.l);
}
function Se$1(_e) {
  return F = { p: [], l: F, h: _e, m: !0, _: 0 };
}
function nt$1(_e) {
  var Qt = _e[_];
  Qt.i === 0 || Qt.i === 1 ? Qt.j() : Qt.O = !0;
}
function re$3(_e, Qt) {
  Qt._ = Qt.p.length;
  var Zt = Qt.p[0], $n = _e !== void 0 && _e !== Zt;
  return Qt.h.g || T("ES5").S(Qt, _e, $n), $n ? (Zt[_].P && (W(Qt), g$1(4)), S(_e) && (_e = Q(Qt, _e), Qt.l || G(Qt, _e)), Qt.u && T("Patches").M(Zt[_].t, _e, Qt.u, Qt.s)) : _e = Q(Qt, Zt, []), W(Qt), Qt.u && Qt.v(Qt.u, Qt.s), _e !== me ? _e : void 0;
}
function Q(_e, Qt, Zt) {
  if (ge$1(Qt))
    return Qt;
  var $n = Qt[_];
  if (!$n)
    return C$3(Qt, function(kn, Kn) {
      return De$1(_e, $n, Qt, kn, Kn, Zt);
    }, !0), Qt;
  if ($n.A !== _e)
    return Qt;
  if (!$n.P)
    return G(_e, $n.t, !0), $n.t;
  if (!$n.I) {
    $n.I = !0, $n.A._--;
    var Sn = $n.i === 4 || $n.i === 5 ? $n.o = ve$1($n.k) : $n.o;
    C$3($n.i === 3 ? new Set(Sn) : Sn, function(kn, Kn) {
      return De$1(_e, $n, Sn, kn, Kn, Zt);
    }), G(_e, Sn, !1), Zt && _e.u && T("Patches").R($n, Zt, _e.u, _e.s);
  }
  return $n.o;
}
function De$1(_e, Qt, Zt, $n, Sn, kn) {
  if ({}.NODE_ENV !== "production" && Sn === Zt && g$1(5), M$1(Sn)) {
    var Kn = Q(_e, Sn, kn && Qt && Qt.i !== 3 && !k$2(Qt.D, $n) ? kn.concat($n) : void 0);
    if (Ue(Zt, $n, Kn), !M$1(Kn))
      return;
    _e.m = !1;
  }
  if (S(Sn) && !ge$1(Sn)) {
    if (!_e.h.F && _e._ < 1)
      return;
    Q(_e, Sn), Qt && Qt.A.l || G(_e, Sn);
  }
}
function G(_e, Qt, Zt) {
  Zt === void 0 && (Zt = !1), _e.h.F && _e.m && ye$1(Qt, Zt);
}
function ne$1(_e, Qt) {
  var Zt = _e[_];
  return (Zt ? I(Zt) : _e)[Qt];
}
function Re(_e, Qt) {
  if (Qt in _e)
    for (var Zt = Object.getPrototypeOf(_e); Zt; ) {
      var $n = Object.getOwnPropertyDescriptor(Zt, Qt);
      if ($n)
        return $n;
      Zt = Object.getPrototypeOf(Zt);
    }
}
function ie$1(_e) {
  _e.P || (_e.P = !0, _e.l && ie$1(_e.l));
}
function oe$1(_e) {
  _e.o || (_e.o = ve$1(_e.t));
}
function ue$1(_e, Qt, Zt) {
  var $n = X$2(Qt) ? T("MapSet").N(Qt, Zt) : Z(Qt) ? T("MapSet").T(Qt, Zt) : _e.g ? function(Sn, kn) {
    var Kn = Array.isArray(Sn), er = { i: Kn ? 1 : 0, A: kn ? kn.A : Te$1(), P: !1, I: !1, D: {}, l: kn, t: Sn, k: null, o: null, j: null, C: !1 }, Cr = er, kr = se;
    Kn && (Cr = [er], kr = x$5);
    var Yr = Proxy.revocable(Cr, kr), Ms = Yr.revoke, Ds = Yr.proxy;
    return er.k = Ds, er.j = Ms, Ds;
  }(Qt, Zt) : T("ES5").J(Qt, Zt);
  return (Zt ? Zt.A : Te$1()).p.push($n), $n;
}
function ot$1(_e) {
  return M$1(_e) || g$1(22, _e), function Qt(Zt) {
    if (!S(Zt))
      return Zt;
    var $n, Sn = Zt[_], kn = D$2(Zt);
    if (Sn) {
      if (!Sn.P && (Sn.i < 4 || !T("ES5").K(Sn)))
        return Sn.t;
      Sn.I = !0, $n = Ie(Zt, kn), Sn.I = !1;
    } else
      $n = Ie(Zt, kn);
    return C$3($n, function(Kn, er) {
      Sn && B$2(Sn.t, Kn) === er || Ue($n, Kn, Qt(er));
    }), kn === 3 ? new Set($n) : $n;
  }(_e);
}
function Ie(_e, Qt) {
  switch (Qt) {
    case 2:
      return new Map(_e);
    case 3:
      return Array.from(_e);
  }
  return ve$1(_e);
}
function at() {
  function _e($n) {
    if (!S($n))
      return $n;
    if (Array.isArray($n))
      return $n.map(_e);
    if (X$2($n))
      return new Map(Array.from($n.entries()).map(function(Kn) {
        return [Kn[0], _e(Kn[1])];
      }));
    if (Z($n))
      return new Set(Array.from($n).map(_e));
    var Sn = Object.create(Object.getPrototypeOf($n));
    for (var kn in $n)
      Sn[kn] = _e($n[kn]);
    return k$2($n, J) && (Sn[J] = $n[J]), Sn;
  }
  function Qt($n) {
    return M$1($n) ? _e($n) : $n;
  }
  var Zt = "add";
  rt$1("Patches", { $: function($n, Sn) {
    return Sn.forEach(function(kn) {
      for (var Kn = kn.path, er = kn.op, Cr = $n, kr = 0; kr < Kn.length - 1; kr++) {
        var Yr = D$2(Cr), Ms = "" + Kn[kr];
        Yr !== 0 && Yr !== 1 || Ms !== "__proto__" && Ms !== "constructor" || g$1(24), typeof Cr == "function" && Ms === "prototype" && g$1(24), typeof (Cr = B$2(Cr, Ms)) != "object" && g$1(15, Kn.join("/"));
      }
      var Ds = D$2(Cr), Ls = _e(kn.value), js = Kn[Kn.length - 1];
      switch (er) {
        case "replace":
          switch (Ds) {
            case 2:
              return Cr.set(js, Ls);
            case 3:
              g$1(16);
            default:
              return Cr[js] = Ls;
          }
        case Zt:
          switch (Ds) {
            case 1:
              return js === "-" ? Cr.push(Ls) : Cr.splice(js, 0, Ls);
            case 2:
              return Cr.set(js, Ls);
            case 3:
              return Cr.add(Ls);
            default:
              return Cr[js] = Ls;
          }
        case "remove":
          switch (Ds) {
            case 1:
              return Cr.splice(js, 1);
            case 2:
              return Cr.delete(js);
            case 3:
              return Cr.delete(kn.value);
            default:
              return delete Cr[js];
          }
        default:
          g$1(17, er);
      }
    }), $n;
  }, R: function($n, Sn, kn, Kn) {
    switch ($n.i) {
      case 0:
      case 4:
      case 2:
        return function(er, Cr, kr, Yr) {
          var Ms = er.t, Ds = er.o;
          C$3(er.D, function(Ls, js) {
            var zs = B$2(Ms, Ls), Fs = B$2(Ds, Ls), Bs = js ? k$2(Ms, Ls) ? "replace" : Zt : "remove";
            if (zs !== Fs || Bs !== "replace") {
              var Hs = Cr.concat(Ls);
              kr.push(Bs === "remove" ? { op: Bs, path: Hs } : { op: Bs, path: Hs, value: Fs }), Yr.push(Bs === Zt ? { op: "remove", path: Hs } : Bs === "remove" ? { op: Zt, path: Hs, value: Qt(zs) } : { op: "replace", path: Hs, value: Qt(zs) });
            }
          });
        }($n, Sn, kn, Kn);
      case 5:
      case 1:
        return function(er, Cr, kr, Yr) {
          var Ms = er.t, Ds = er.D, Ls = er.o;
          if (Ls.length < Ms.length) {
            var js = [Ls, Ms];
            Ms = js[0], Ls = js[1];
            var zs = [Yr, kr];
            kr = zs[0], Yr = zs[1];
          }
          for (var Fs = 0; Fs < Ms.length; Fs++)
            if (Ds[Fs] && Ls[Fs] !== Ms[Fs]) {
              var Bs = Cr.concat([Fs]);
              kr.push({ op: "replace", path: Bs, value: Qt(Ls[Fs]) }), Yr.push({ op: "replace", path: Bs, value: Qt(Ms[Fs]) });
            }
          for (var Hs = Ms.length; Hs < Ls.length; Hs++) {
            var Ws = Cr.concat([Hs]);
            kr.push({ op: Zt, path: Ws, value: Qt(Ls[Hs]) });
          }
          Ms.length < Ls.length && Yr.push({ op: "replace", path: Cr.concat(["length"]), value: Ms.length });
        }($n, Sn, kn, Kn);
      case 3:
        return function(er, Cr, kr, Yr) {
          var Ms = er.t, Ds = er.o, Ls = 0;
          Ms.forEach(function(js) {
            if (!Ds.has(js)) {
              var zs = Cr.concat([Ls]);
              kr.push({ op: "remove", path: zs, value: js }), Yr.unshift({ op: Zt, path: zs, value: js });
            }
            Ls++;
          }), Ls = 0, Ds.forEach(function(js) {
            if (!Ms.has(js)) {
              var zs = Cr.concat([Ls]);
              kr.push({ op: Zt, path: zs, value: js }), Yr.unshift({ op: "remove", path: zs, value: js });
            }
            Ls++;
          });
        }($n, Sn, kn, Kn);
    }
  }, M: function($n, Sn, kn, Kn) {
    kn.push({ op: "replace", path: [], value: Sn === me ? void 0 : Sn }), Kn.push({ op: "replace", path: [], value: $n });
  } });
}
var Le$1, F, we = typeof Symbol < "u" && typeof Symbol("x") == "symbol", it$1 = typeof Map < "u", ut$1 = typeof Set < "u", je = typeof Proxy < "u" && Proxy.revocable !== void 0 && typeof Reflect < "u", me = we ? Symbol.for("immer-nothing") : ((Le$1 = {})["immer-nothing"] = !0, Le$1), J = we ? Symbol.for("immer-draftable") : "__$immer_draftable", _ = we ? Symbol.for("immer-state") : "__$immer_state", ct$1 = { 0: "Illegal state", 1: "Immer drafts cannot have computed properties", 2: "This object has been frozen and should not be mutated", 3: function(_e) {
  return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + _e;
}, 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", 5: "Immer forbids circular references", 6: "The first or second argument to `produce` must be a function", 7: "The third argument to `produce` must be a function or undefined", 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object", 9: "First argument to `finishDraft` must be a draft returned by `createDraft`", 10: "The given draft is already finalized", 11: "Object.defineProperty() cannot be used on an Immer draft", 12: "Object.setPrototypeOf() cannot be used on an Immer draft", 13: "Immer only supports deleting array indices", 14: "Immer only supports setting array indices and the 'length' property", 15: function(_e) {
  return "Cannot apply patch, path doesn't resolve: " + _e;
}, 16: 'Sets cannot have "replace" patches.', 17: function(_e) {
  return "Unsupported patch operation: " + _e;
}, 18: function(_e) {
  return "The plugin for '" + _e + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + _e + "()` when initializing your application.";
}, 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available", 21: function(_e) {
  return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '" + _e + "'";
}, 22: function(_e) {
  return "'current' expects a draft, got: " + _e;
}, 23: function(_e) {
  return "'original' expects a draft, got: " + _e;
}, 24: "Patching reserved attributes like __proto__, prototype and constructor is not allowed" }, st$1 = "" + Object.prototype.constructor, Oe = typeof Reflect < "u" && Reflect.ownKeys ? Reflect.ownKeys : Object.getOwnPropertySymbols !== void 0 ? function(_e) {
  return Object.getOwnPropertyNames(_e).concat(Object.getOwnPropertySymbols(_e));
} : Object.getOwnPropertyNames, ft$1 = Object.getOwnPropertyDescriptors || function(_e) {
  var Qt = {};
  return Oe(_e).forEach(function(Zt) {
    Qt[Zt] = Object.getOwnPropertyDescriptor(_e, Zt);
  }), Qt;
}, ce = {}, se = { get: function(_e, Qt) {
  if (Qt === _)
    return _e;
  var Zt = I(_e);
  if (!k$2(Zt, Qt))
    return function(Sn, kn, Kn) {
      var er, Cr = Re(kn, Kn);
      return Cr ? "value" in Cr ? Cr.value : (er = Cr.get) === null || er === void 0 ? void 0 : er.call(Sn.k) : void 0;
    }(_e, Zt, Qt);
  var $n = Zt[Qt];
  return _e.I || !S($n) ? $n : $n === ne$1(_e.t, Qt) ? (oe$1(_e), _e.o[Qt] = ue$1(_e.A.h, $n, _e)) : $n;
}, has: function(_e, Qt) {
  return Qt in I(_e);
}, ownKeys: function(_e) {
  return Reflect.ownKeys(I(_e));
}, set: function(_e, Qt, Zt) {
  var $n = Re(I(_e), Qt);
  if ($n != null && $n.set)
    return $n.set.call(_e.k, Zt), !0;
  if (!_e.P) {
    var Sn = ne$1(I(_e), Qt), kn = Sn == null ? void 0 : Sn[_];
    if (kn && kn.t === Zt)
      return _e.o[Qt] = Zt, _e.D[Qt] = !1, !0;
    if (et$1(Zt, Sn) && (Zt !== void 0 || k$2(_e.t, Qt)))
      return !0;
    oe$1(_e), ie$1(_e);
  }
  return _e.o[Qt] === Zt && typeof Zt != "number" && (Zt !== void 0 || Qt in _e.o) || (_e.o[Qt] = Zt, _e.D[Qt] = !0, !0);
}, deleteProperty: function(_e, Qt) {
  return ne$1(_e.t, Qt) !== void 0 || Qt in _e.t ? (_e.D[Qt] = !1, oe$1(_e), ie$1(_e)) : delete _e.D[Qt], _e.o && delete _e.o[Qt], !0;
}, getOwnPropertyDescriptor: function(_e, Qt) {
  var Zt = I(_e), $n = Reflect.getOwnPropertyDescriptor(Zt, Qt);
  return $n && { writable: !0, configurable: _e.i !== 1 || Qt !== "length", enumerable: $n.enumerable, value: Zt[Qt] };
}, defineProperty: function() {
  g$1(11);
}, getPrototypeOf: function(_e) {
  return Object.getPrototypeOf(_e.t);
}, setPrototypeOf: function() {
  g$1(12);
} }, x$5 = {};
C$3(se, function(_e, Qt) {
  x$5[_e] = function() {
    return arguments[0] = arguments[0][0], Qt.apply(this, arguments);
  };
}), x$5.deleteProperty = function(_e, Qt) {
  return {}.NODE_ENV !== "production" && isNaN(parseInt(Qt)) && g$1(13), x$5.set.call(this, _e, Qt, void 0);
}, x$5.set = function(_e, Qt, Zt) {
  return {}.NODE_ENV !== "production" && Qt !== "length" && isNaN(parseInt(Qt)) && g$1(14), se.set.call(this, _e[0], Qt, Zt, _e[0]);
};
var lt$3 = function() {
  function _e(Zt) {
    var $n = this;
    this.g = je, this.F = !0, this.produce = function(Sn, kn, Kn) {
      if (typeof Sn == "function" && typeof kn != "function") {
        var er = kn;
        kn = Sn;
        var Cr = $n;
        return function(zs) {
          var Fs = this;
          zs === void 0 && (zs = er);
          for (var Bs = arguments.length, Hs = Array(Bs > 1 ? Bs - 1 : 0), Ws = 1; Ws < Bs; Ws++)
            Hs[Ws - 1] = arguments[Ws];
          return Cr.produce(zs, function(Ys) {
            var El;
            return (El = kn).call.apply(El, [Fs, Ys].concat(Hs));
          });
        };
      }
      var kr;
      if (typeof kn != "function" && g$1(6), Kn !== void 0 && typeof Kn != "function" && g$1(7), S(Sn)) {
        var Yr = Se$1($n), Ms = ue$1($n, Sn, void 0), Ds = !0;
        try {
          kr = kn(Ms), Ds = !1;
        } finally {
          Ds ? W(Yr) : ae$1(Yr);
        }
        return typeof Promise < "u" && kr instanceof Promise ? kr.then(function(zs) {
          return te(Yr, Kn), re$3(zs, Yr);
        }, function(zs) {
          throw W(Yr), zs;
        }) : (te(Yr, Kn), re$3(kr, Yr));
      }
      if (!Sn || typeof Sn != "object") {
        if ((kr = kn(Sn)) === void 0 && (kr = Sn), kr === me && (kr = void 0), $n.F && ye$1(kr, !0), Kn) {
          var Ls = [], js = [];
          T("Patches").M(Sn, kr, Ls, js), Kn(Ls, js);
        }
        return kr;
      }
      g$1(21, Sn);
    }, this.produceWithPatches = function(Sn, kn) {
      if (typeof Sn == "function")
        return function(kr) {
          for (var Yr = arguments.length, Ms = Array(Yr > 1 ? Yr - 1 : 0), Ds = 1; Ds < Yr; Ds++)
            Ms[Ds - 1] = arguments[Ds];
          return $n.produceWithPatches(kr, function(Ls) {
            return Sn.apply(void 0, [Ls].concat(Ms));
          });
        };
      var Kn, er, Cr = $n.produce(Sn, kn, function(kr, Yr) {
        Kn = kr, er = Yr;
      });
      return typeof Promise < "u" && Cr instanceof Promise ? Cr.then(function(kr) {
        return [kr, Kn, er];
      }) : [Cr, Kn, er];
    }, typeof (Zt == null ? void 0 : Zt.useProxies) == "boolean" && this.setUseProxies(Zt.useProxies), typeof (Zt == null ? void 0 : Zt.autoFreeze) == "boolean" && this.setAutoFreeze(Zt.autoFreeze);
  }
  var Qt = _e.prototype;
  return Qt.createDraft = function(Zt) {
    S(Zt) || g$1(8), M$1(Zt) && (Zt = ot$1(Zt));
    var $n = Se$1(this), Sn = ue$1(this, Zt, void 0);
    return Sn[_].C = !0, ae$1($n), Sn;
  }, Qt.finishDraft = function(Zt, $n) {
    var Sn = Zt && Zt[_];
    ({}).NODE_ENV !== "production" && (Sn && Sn.C || g$1(9), Sn.I && g$1(10));
    var kn = Sn.A;
    return te(kn, $n), re$3(void 0, kn);
  }, Qt.setAutoFreeze = function(Zt) {
    this.F = Zt;
  }, Qt.setUseProxies = function(Zt) {
    Zt && !je && g$1(20), this.g = Zt;
  }, Qt.applyPatches = function(Zt, $n) {
    var Sn;
    for (Sn = $n.length - 1; Sn >= 0; Sn--) {
      var kn = $n[Sn];
      if (kn.path.length === 0 && kn.op === "replace") {
        Zt = kn.value;
        break;
      }
    }
    Sn > -1 && ($n = $n.slice(Sn + 1));
    var Kn = T("Patches").$;
    return M$1(Zt) ? Kn(Zt, $n) : this.produce(Zt, function(er) {
      return Kn(er, $n);
    });
  }, _e;
}(), b$2 = new lt$3(), pt = b$2.produce;
b$2.produceWithPatches.bind(b$2);
b$2.setAutoFreeze.bind(b$2);
b$2.setUseProxies.bind(b$2);
b$2.applyPatches.bind(b$2);
b$2.createDraft.bind(b$2);
b$2.finishDraft.bind(b$2);
function dt$1(_e, Qt = {}) {
  const {
    artifact: Zt = void 0,
    metadata: $n = void 0,
    rootLabel: Sn = "Root"
  } = Qt, kn = Ze$1({
    state: _e,
    label: Sn,
    initialArtifact: Zt,
    initialMetadata: $n
  }), Kn = {
    nodes: {
      [kn.id]: kn
    },
    root: kn.id,
    current: kn.id
  };
  return createSlice({
    name: "provenance-graph",
    initialState: Kn,
    reducers: {
      addMetadata(er, Cr) {
        const { id: kr, meta: Yr } = Cr.payload, Ms = er.nodes[kr].meta, Ds = Object.keys(Yr).reduce((Ls, js) => (Ls[js] || (Ls[js] = []), Ls[js].push({
          type: js,
          id: N.get(),
          val: Yr[js],
          createdOn: Date.now()
        }), Ls), Ms);
        er.nodes[Cr.payload.id].meta = Ds;
      },
      addArtifact(er, Cr) {
        er.nodes[Cr.payload.id].artifacts.push({
          id: N.get(),
          createdOn: Date.now(),
          val: Cr.payload.artifact
        });
      },
      changeCurrent(er, Cr) {
        er.current = Cr.payload;
      },
      addNode(er, { payload: Cr }) {
        er.nodes[Cr.id] = Cr, er.nodes[Cr.parent].children.push(Cr.id), er.current = Cr.id;
      },
      load(er, { payload: Cr }) {
        return Cr;
      }
    }
  });
}
function ht(_e) {
  const Qt = /* @__PURE__ */ new Map(), { reducer: Zt, actions: $n, getInitialState: Sn } = dt$1(_e), kn = createListenerMiddleware();
  kn.startListening({
    matcher: isAnyOf($n.changeCurrent, $n.addNode),
    effect: (er, Cr) => {
      Cr.cancelActiveListeners(), Qt.forEach((kr) => {
        const Yr = isAnyOf($n.addNode)(er), { skipOnNew: Ms } = kr.config;
        Ms && Yr || kr.func(Yr ? "new" : "traversal");
      });
    }
  });
  const Kn = configureStore({
    reducer: Zt,
    middleware: (er) => er().prepend(kn.middleware)
  });
  return {
    initialState: Sn(),
    get backend() {
      return Kn.getState();
    },
    get current() {
      return Kn.getState().nodes[Kn.getState().current];
    },
    get root() {
      return Kn.getState().nodes[Kn.getState().root];
    },
    currentChange(er, Cr) {
      const kr = {
        id: N.get(),
        func: er,
        config: Cr
      };
      return Qt.set(kr.id, kr), () => Qt.delete(kr.id);
    },
    update: Kn.dispatch,
    ...$n
  };
}
/*!
 * https://github.com/Starcounter-Jack/JSON-Patch
 * (c) 2017-2022 Joachim Wester
 * MIT licensed
 */
var vt$1 = globalThis && globalThis.__extends || function() {
  var _e = function(Qt, Zt) {
    return _e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function($n, Sn) {
      $n.__proto__ = Sn;
    } || function($n, Sn) {
      for (var kn in Sn)
        Sn.hasOwnProperty(kn) && ($n[kn] = Sn[kn]);
    }, _e(Qt, Zt);
  };
  return function(Qt, Zt) {
    _e(Qt, Zt);
    function $n() {
      this.constructor = Qt;
    }
    Qt.prototype = Zt === null ? Object.create(Zt) : ($n.prototype = Zt.prototype, new $n());
  };
}(), yt$1 = Object.prototype.hasOwnProperty;
function fe$1(_e, Qt) {
  return yt$1.call(_e, Qt);
}
function le(_e) {
  if (Array.isArray(_e)) {
    for (var Qt = new Array(_e.length), Zt = 0; Zt < Qt.length; Zt++)
      Qt[Zt] = "" + Zt;
    return Qt;
  }
  if (Object.keys)
    return Object.keys(_e);
  var $n = [];
  for (var Sn in _e)
    fe$1(_e, Sn) && $n.push(Sn);
  return $n;
}
function E$1(_e) {
  switch (typeof _e) {
    case "object":
      return JSON.parse(JSON.stringify(_e));
    case "undefined":
      return null;
    default:
      return _e;
  }
}
function pe(_e) {
  for (var Qt = 0, Zt = _e.length, $n; Qt < Zt; ) {
    if ($n = _e.charCodeAt(Qt), $n >= 48 && $n <= 57) {
      Qt++;
      continue;
    }
    return !1;
  }
  return !0;
}
function L(_e) {
  return _e.indexOf("/") === -1 && _e.indexOf("~") === -1 ? _e : _e.replace(/~/g, "~0").replace(/\//g, "~1");
}
function Ce$1(_e) {
  return _e.replace(/~1/g, "/").replace(/~0/g, "~");
}
function de(_e) {
  if (_e === void 0)
    return !0;
  if (_e) {
    if (Array.isArray(_e)) {
      for (var Qt = 0, Zt = _e.length; Qt < Zt; Qt++)
        if (de(_e[Qt]))
          return !0;
    } else if (typeof _e == "object") {
      for (var $n = le(_e), Sn = $n.length, kn = 0; kn < Sn; kn++)
        if (de(_e[$n[kn]]))
          return !0;
    }
  }
  return !1;
}
function Me$1(_e, Qt) {
  var Zt = [_e];
  for (var $n in Qt) {
    var Sn = typeof Qt[$n] == "object" ? JSON.stringify(Qt[$n], null, 2) : Qt[$n];
    typeof Sn < "u" && Zt.push($n + ": " + Sn);
  }
  return Zt.join(`
`);
}
var Fe$1 = (
  /** @class */
  function(_e) {
    vt$1(Qt, _e);
    function Qt(Zt, $n, Sn, kn, Kn) {
      var er = this.constructor, Cr = _e.call(this, Me$1(Zt, { name: $n, index: Sn, operation: kn, tree: Kn })) || this;
      return Cr.name = $n, Cr.index = Sn, Cr.operation = kn, Cr.tree = Kn, Object.setPrototypeOf(Cr, er.prototype), Cr.message = Me$1(Zt, { name: $n, index: Sn, operation: kn, tree: Kn }), Cr;
    }
    return Qt;
  }(Error)
), y$5 = Fe$1, gt$3 = E$1, U = {
  add: function(_e, Qt, Zt) {
    return _e[Qt] = this.value, { newDocument: Zt };
  },
  remove: function(_e, Qt, Zt) {
    var $n = _e[Qt];
    return delete _e[Qt], { newDocument: Zt, removed: $n };
  },
  replace: function(_e, Qt, Zt) {
    var $n = _e[Qt];
    return _e[Qt] = this.value, { newDocument: Zt, removed: $n };
  },
  move: function(_e, Qt, Zt) {
    var $n = Y$2(Zt, this.path);
    $n && ($n = E$1($n));
    var Sn = j(Zt, { op: "remove", path: this.from }).removed;
    return j(Zt, { op: "add", path: this.path, value: Sn }), { newDocument: Zt, removed: $n };
  },
  copy: function(_e, Qt, Zt) {
    var $n = Y$2(Zt, this.from);
    return j(Zt, { op: "add", path: this.path, value: E$1($n) }), { newDocument: Zt };
  },
  test: function(_e, Qt, Zt) {
    return { newDocument: Zt, test: K$1(_e[Qt], this.value) };
  },
  _get: function(_e, Qt, Zt) {
    return this.value = _e[Qt], { newDocument: Zt };
  }
}, wt$1 = {
  add: function(_e, Qt, Zt) {
    return pe(Qt) ? _e.splice(Qt, 0, this.value) : _e[Qt] = this.value, { newDocument: Zt, index: Qt };
  },
  remove: function(_e, Qt, Zt) {
    var $n = _e.splice(Qt, 1);
    return { newDocument: Zt, removed: $n[0] };
  },
  replace: function(_e, Qt, Zt) {
    var $n = _e[Qt];
    return _e[Qt] = this.value, { newDocument: Zt, removed: $n };
  },
  move: U.move,
  copy: U.copy,
  test: U.test,
  _get: U._get
};
function Y$2(_e, Qt) {
  if (Qt == "")
    return _e;
  var Zt = { op: "_get", path: Qt };
  return j(_e, Zt), Zt.value;
}
function j(_e, Qt, Zt, $n, Sn, kn) {
  if (Zt === void 0 && (Zt = !1), $n === void 0 && ($n = !0), Sn === void 0 && (Sn = !0), kn === void 0 && (kn = 0), Zt && (typeof Zt == "function" ? Zt(Qt, 0, _e, Qt.path) : q$3(Qt, 0)), Qt.path === "") {
    var Kn = { newDocument: _e };
    if (Qt.op === "add")
      return Kn.newDocument = Qt.value, Kn;
    if (Qt.op === "replace")
      return Kn.newDocument = Qt.value, Kn.removed = _e, Kn;
    if (Qt.op === "move" || Qt.op === "copy")
      return Kn.newDocument = Y$2(_e, Qt.from), Qt.op === "move" && (Kn.removed = _e), Kn;
    if (Qt.op === "test") {
      if (Kn.test = K$1(_e, Qt.value), Kn.test === !1)
        throw new y$5("Test operation failed", "TEST_OPERATION_FAILED", kn, Qt, _e);
      return Kn.newDocument = _e, Kn;
    } else {
      if (Qt.op === "remove")
        return Kn.removed = _e, Kn.newDocument = null, Kn;
      if (Qt.op === "_get")
        return Qt.value = _e, Kn;
      if (Zt)
        throw new y$5("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", kn, Qt, _e);
      return Kn;
    }
  } else {
    $n || (_e = E$1(_e));
    var er = Qt.path || "", Cr = er.split("/"), kr = _e, Yr = 1, Ms = Cr.length, Ds = void 0, Ls = void 0, js = void 0;
    for (typeof Zt == "function" ? js = Zt : js = q$3; ; ) {
      if (Ls = Cr[Yr], Ls && Ls.indexOf("~") != -1 && (Ls = Ce$1(Ls)), Sn && (Ls == "__proto__" || Ls == "prototype" && Yr > 0 && Cr[Yr - 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 (Zt && Ds === void 0 && (kr[Ls] === void 0 ? Ds = Cr.slice(0, Yr).join("/") : Yr == Ms - 1 && (Ds = Qt.path), Ds !== void 0 && js(Qt, 0, _e, Ds)), Yr++, Array.isArray(kr)) {
        if (Ls === "-")
          Ls = kr.length;
        else {
          if (Zt && !pe(Ls))
            throw new y$5("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", kn, Qt, _e);
          pe(Ls) && (Ls = ~~Ls);
        }
        if (Yr >= Ms) {
          if (Zt && Qt.op === "add" && Ls > kr.length)
            throw new y$5("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", kn, Qt, _e);
          var Kn = wt$1[Qt.op].call(Qt, kr, Ls, _e);
          if (Kn.test === !1)
            throw new y$5("Test operation failed", "TEST_OPERATION_FAILED", kn, Qt, _e);
          return Kn;
        }
      } else if (Yr >= Ms) {
        var Kn = U[Qt.op].call(Qt, kr, Ls, _e);
        if (Kn.test === !1)
          throw new y$5("Test operation failed", "TEST_OPERATION_FAILED", kn, Qt, _e);
        return Kn;
      }
      if (kr = kr[Ls], Zt && Yr < Ms && (!kr || typeof kr != "object"))
        throw new y$5("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", kn, Qt, _e);
    }
  }
}
function V$1(_e, Qt, Zt, $n, Sn) {
  if ($n === void 0 && ($n = !0), Sn === void 0 && (Sn = !0), Zt && !Array.isArray(Qt))
    throw new y$5("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
  $n || (_e = E$1(_e));
  for (var kn = new Array(Qt.length), Kn = 0, er = Qt.length; Kn < er; Kn++)
    kn[Kn] = j(_e, Qt[Kn], Zt, !0, Sn, Kn), _e = kn[Kn].newDocument;
  return kn.newDocument = _e, kn;
}
function mt(_e, Qt, Zt) {
  var $n = j(_e, Qt);
  if ($n.test === !1)
    throw new y$5("Test operation failed", "TEST_OPERATION_FAILED", Zt, Qt, _e);
  return $n.newDocument;
}
function q$3(_e, Qt, Zt, $n) {
  if (typeof _e != "object" || _e === null || Array.isArray(_e))
    throw new y$5("Operation is not an object", "OPERATION_NOT_AN_OBJECT", Qt, _e, Zt);
  if (U[_e.op]) {
    if (typeof _e.path != "string")
      throw new y$5("Operation `path` property is not a string", "OPERATION_PATH_INVALID", Qt, _e, Zt);
    if (_e.path.indexOf("/") !== 0 && _e.path.length > 0)
      throw new y$5('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", Qt, _e, Zt);
    if ((_e.op === "move" || _e.op === "copy") && typeof _e.from != "string")
      throw new y$5("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", Qt, _e, Zt);
    if ((_e.op === "add" || _e.op === "replace" || _e.op === "test") && _e.value === void 0)
      throw new y$5("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", Qt, _e, Zt);
    if ((_e.op === "add" || _e.op === "replace" || _e.op === "test") && de(_e.value))
      throw new y$5("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", Qt, _e, Zt);
    if (Zt) {
      if (_e.op == "add") {
        var Sn = _e.path.split("/").length, kn = $n.split("/").length;
        if (Sn !== kn + 1 && Sn !== kn)
          throw new y$5("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", Qt, _e, Zt);
      } else if (_e.op === "replace" || _e.op === "remove" || _e.op === "_get") {
        if (_e.path !== $n)
          throw new y$5("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", Qt, _e, Zt);
      } else if (_e.op === "move" || _e.op === "copy") {
        var Kn = { op: "_get", path: _e.from, value: void 0 }, er = xe$1([Kn], Zt);
        if (er && er.name === "OPERATION_PATH_UNRESOLVABLE")
          throw new y$5("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", Qt, _e, Zt);
      }
    }
  } else
    throw new y$5("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", Qt, _e, Zt);
}
function xe$1(_e, Qt, Zt) {
  try {
    if (!Array.isArray(_e))
      throw new y$5("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
    if (Qt)
      V$1(E$1(Qt), E$1(_e), Zt || !0);
    else {
      Zt = Zt || q$3;
      for (var $n = 0; $n < _e.length; $n++)
        Zt(_e[$n], $n, Qt, void 0);
    }
  } catch (Sn) {
    if (Sn instanceof y$5)
      return Sn;
    throw Sn;
  }
}
function K$1(_e, Qt) {
  if (_e === Qt)
    return !0;
  if (_e && Qt && typeof _e == "object" && typeof Qt == "object") {
    var Zt = Array.isArray(_e), $n = Array.isArray(Qt), Sn, kn, Kn;
    if (Zt && $n) {
      if (kn = _e.length, kn != Qt.length)
        return !1;
      for (Sn = kn; Sn-- !== 0; )
        if (!K$1(_e[Sn], Qt[Sn]))
          return !1;
      return !0;
    }
    if (Zt != $n)
      return !1;
    var er = Object.keys(_e);
    if (kn = er.length, kn !== Object.keys(Qt).length)
      return !1;
    for (Sn = kn; Sn-- !== 0; )
      if (!Qt.hasOwnProperty(er[Sn]))
        return !1;
    for (Sn = kn; Sn-- !== 0; )
      if (Kn = er[Sn], !K$1(_e[Kn], Qt[Kn]))
        return !1;
    return !0;
  }
  return _e !== _e && Qt !== Qt;
}
const Ot$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  JsonPatchError: y$5,
  _areEquals: K$1,
  applyOperation: j,
  applyPatch: V$1,
  applyReducer: mt,
  deepClone: gt$3,
  getValueByPointer: Y$2,
  validate: xe$1,
  validator: q$3
}, Symbol.toStringTag, { value: "Module" }));
/*!
 * https://github.com/Starcounter-Jack/JSON-Patch
 * (c) 2017-2021 Joachim Wester
 * MIT license
 */
var Ae = /* @__PURE__ */ new WeakMap(), At$1 = (
  /** @class */
  function() {
    function _e(Qt) {
      this.observers = /* @__PURE__ */ new Map(), this.obj = Qt;
    }
    return _e;
  }()
), Et$1 = (
  /** @class */
  function() {
    function _e(Qt, Zt) {
      this.callback = Qt, this.observer = Zt;
    }
    return _e;
  }()
);
function _t$2(_e) {
  return Ae.get(_e);
}
function bt$1(_e, Qt) {
  return _e.observers.get(Qt);
}
function Pt$1(_e, Qt) {
  _e.observers.delete(Qt.callback);
}
function Nt(_e, Qt) {
  Qt.unobserve();
}
function Tt$1(_e, Qt) {
  var Zt = [], $n, Sn = _t$2(_e);
  if (!Sn)
    Sn = new At$1(_e), Ae.set(_e, Sn);
  else {
    var kn = bt$1(Sn, Qt);
    $n = kn && kn.observer;
  }
  if ($n)
    return $n;
  if ($n = {}, Sn.value = E$1(_e), Qt) {
    $n.callback = Qt, $n.next = null;
    var Kn = function() {
      he($n);
    }, er = function() {
      clearTimeout($n.next), $n.next = setTimeout(Kn);
    };
    typeof window < "u" && (window.addEventListener("mouseup", er), window.addEventListener("keyup", er), window.addEventListener("mousedown", er), window.addEventListener("keydown", er), window.addEventListener("change", er));
  }
  return $n.patches = Zt, $n.object = _e, $n.unobserve = function() {
    he($n), clearTimeout($n.next), Pt$1(Sn, $n), typeof window < "u" && (window.removeEventListener("mouseup", er), window.removeEventListener("keyup", er), window.removeEventListener("mousedown", er), window.removeEventListener("keydown", er), window.removeEventListener("change", er));
  }, Sn.observers.set(Qt, new Et$1(Qt, $n)), $n;
}
function he(_e, Qt) {
  Qt === void 0 && (Qt = !1);
  var Zt = Ae.get(_e.object);
  Ee(Zt.value, _e.object, _e.patches, "", Qt), _e.patches.length && V$1(Zt.value, _e.patches);
  var $n = _e.patches;
  return $n.length > 0 && (_e.patches = [], _e.callback && _e.callback($n)), $n;
}
function Ee(_e, Qt, Zt, $n, Sn) {
  if (Qt !== _e) {
    typeof Qt.toJSON == "function" && (Qt = Qt.toJSON());
    for (var kn = le(Qt), Kn = le(_e), er = !1, Cr = Kn.length - 1; Cr >= 0; Cr--) {
      var kr = Kn[Cr], Yr = _e[kr];
      if (fe$1(Qt, kr) && !(Qt[kr] === void 0 && Yr !== void 0 && Array.isArray(Qt) === !1)) {
        var Ms = Qt[kr];
        typeof Yr == "object" && Yr != null && typeof Ms == "object" && Ms != null && Array.isArray(Yr) === Array.isArray(Ms) ? Ee(Yr, Ms, Zt, $n + "/" + L(kr), Sn) : Yr !== Ms && (Sn && Zt.push({ op: "test", path: $n + "/" + L(kr), value: E$1(Yr) }), Zt.push({ op: "replace", path: $n + "/" + L(kr), value: E$1(Ms) }));
      } else
        Array.isArray(_e) === Array.isArray(Qt) ? (Sn && Zt.push({ op: "test", path: $n + "/" + L(kr), value: E$1(Yr) }), Zt.push({ op: "remove", path: $n + "/" + L(kr) }), er = !0) : (Sn && Zt.push({ op: "test", path: $n, value: _e }), Zt.push({ op: "replace", path: $n, value: Qt }));
    }
    if (!(!er && kn.length == Kn.length))
      for (var Cr = 0; Cr < kn.length; Cr++) {
        var kr = kn[Cr];
        !fe$1(_e, kr) && Qt[kr] !== void 0 && Zt.push({ op: "add", path: $n + "/" + L(kr), value: E$1(Qt[kr]) });
      }
  }
}
function ze$1(_e, Qt, Zt) {
  Zt === void 0 && (Zt = !1);
  var $n = [];
  return Ee(_e, Qt, $n, "", Zt), $n;
}
const St$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  compare: ze$1,
  generate: he,
  observe: Tt$1,
  unobserve: Nt
}, Symbol.toStringTag, { value: "Module" }));
Object.assign({}, Ot$1, St$1, {
  JsonPatchError: Fe$1,
  deepClone: E$1,
  escapePathComponent: L,
  unescapePathComponent: Ce$1
});
var z$1 = /* @__PURE__ */ ((_e) => (_e.TRAVERSAL_START = "Traversal_Start", _e.TRAVERSAL_END = "Traversal_End", _e))(z$1 || {});
function $$2(_e, Qt) {
  const Zt = _e.state;
  if (Zt.type === "checkpoint")
    return Zt.val;
  const { checkpointRef: $n } = Zt, Sn = Qt[$n], kn = Je$1(Sn, _e, Qt);
  kn.shift();
  const Kn = kn.map((Cr) => Qt[Cr]).map((Cr) => Cr.state.val).reduce((Cr, kr) => [...Cr, ...kr], []), er = $$2(Sn, Qt);
  return V$1(
    er,
    E$1(Kn),
    !0,
    !1
  ).newDocument;
}
function Dt$1(_e, Qt) {
  const Zt = Object.keys(_e).length;
  return new Set(
    Qt.map(($n) => $n.path.split("/")[0])
  ).size < Zt / 2 ? "patch" : "checkpoint";
}
function Ut$1({
  registry: _e,
  initialState: Qt
}) {
  let Zt = !1;
  const $n = Qe$1(), Sn = ht(Qt);
  function kn(Yr) {
    return Sn.backend.nodes[Yr];
  }
  $n.listen(z$1.TRAVERSAL_START, () => {
    Zt = !0;
  }), $n.listen(z$1.TRAVERSAL_END, () => {
    Zt = !1;
  });
  const Kn = {
    add(Yr, Ms = Sn.current.id) {
      Sn.update(
        Sn.addMetadata({
          id: Ms,
          meta: Yr
        })
      );
    },
    latestOfType(Yr, Ms = Sn.current.id) {
      var Ds;
      return (Ds = Sn.backend.nodes[Ms].meta[Yr]) == null ? void 0 : Ds.at(-1);
    },
    allOfType(Yr, Ms = Sn.current.id) {
      return Sn.backend.nodes[Ms].meta[Yr];
    },
    latest(Yr = Sn.current.id) {
      const Ms = Sn.backend.nodes[Yr].meta, Ds = Object.keys(Ms).reduce(
        (Ls, js) => {
          const zs = Ms[js].at(-1);
          return zs && (Ls[js] = zs), Ls;
        },
        {}
      );
      return Object.keys(Ds).length > 0 ? Ds : void 0;
    },
    all(Yr = Sn.current.id) {
      return Sn.backend.nodes[Yr].meta;
    },
    types(Yr = Sn.current.id) {
      return Object.keys(Sn.backend.nodes[Yr].meta);
    }
  }, er = {
    add(Yr, Ms = Sn.current.id) {
      Sn.update(
        Sn.addArtifact({
          id: Ms,
          artifact: Yr
        })
      );
    },
    latest(Yr = Sn.current.id) {
      return Sn.backend.nodes[Yr].artifacts.at(-1);
    },
    all(Yr = Sn.current.id) {
      return Sn.backend.nodes[Yr].artifacts;
    }
  }, Cr = {
    add(Yr, Ms = Sn.current.id) {
      Kn.add({ annotation: Yr }, Ms);
    },
    latest(Yr = Sn.current.id) {
      var Ms;
      return (Ms = Kn.latestOfType("annotation", Yr)) == null ? void 0 : Ms.val;
    },
    all(Yr = Sn.current.id) {
      var Ms;
      return (Ms = Kn.allOfType("annotation", Yr)) == null ? void 0 : Ms.map((Ds) => Ds.val);
    }
  }, kr = {
    add(Yr = Sn.current.id) {
      Kn.add({ bookmark: !0 }, Yr);
    },
    remove(Yr = Sn.current.id) {
      Kn.add({ bookmark: !1 }, Yr);
    },
    is(Yr = Sn.current.id) {
      var Ms;
      return !!((Ms = Kn.latestOfType("bookmark", Yr)) != null && Ms.val);
    },
    toggle(Yr = Sn.current.id) {
      kr.is(Yr) ? kr.remove(Yr) : kr.add(Yr);
    }
  };
  return {
    registry: _e,
    get isTraversing() {
      return Zt;
    },
    getState(Yr = Sn.current) {
      return $$2(Yr, Sn.backend.nodes);
    },
    graph: Sn,
    get current() {
      return Sn.current;
    },
    get root() {
      return Sn.root;
    },
    record({
      label: Yr,
      state: Ms,
      sideEffects: Ds,
      eventType: Ls,
      onlySideEffects: js = !1
    }) {
      let zs = null, Fs = null;
      const Bs = $$2(
        this.current,
        this.graph.backend.nodes
      );
      if (js)
        Fs = {
          type: "checkpoint",
          val: Ms
        };
      else {
        const Hs = ze$1(Bs, Ms);
        if (Dt$1(Ms, Hs) === "checkpoint")
          Fs = {
            type: "checkpoint",
            val: Ms
          };
        else {
          const Ws = this.current.state.type === "checkpoint" ? this.current.id : this.current.state.checkpointRef;
          Fs = {
            type: "patch",
            val: Hs,
            checkpointRef: Ws
          };
        }
      }
      if (!Fs)
        throw new Error(
          `Could not calculate new state. Previous state is: ${JSON.stringify(
            this.current.state,
            null,
            2
          )}`
        );
      if (zs = Ve$1({
        label: Yr,
        state: Fs,
        parent: this.current,
        sideEffects: Ds,
        event: Ls
      }), !zs)
        throw new Error("State Node creation failed!");
      Sn.update(Sn.addNode(zs));
    },
    async apply(Yr, Ms) {
      const Ds = _e.get(Ms.type), Ls = $$2(
        this.current,
        this.graph.backend.nodes
      );
      if (Ds.config.hasSideEffects) {
        const { do: js = Ms, undo: zs } = Ds.func(Ms.payload);
        this.record({
          label: Yr,
          state: Ls,
          sideEffects: { do: [js], undo: [zs] },
          eventType: Ds.config.eventType
        });
      } else {
        const js = Ds.func(Ls, Ms.payload);
        this.record({
          label: Yr,
          state: js,
          sideEffects: { do: [], undo: [] },
          eventType: Ds.config.eventType
        });
      }
    },
    async to(Yr) {
      $n.fire(z$1.TRAVERSAL_START);
      const Ms = Je$1(
        Sn.current,
        Sn.backend.nodes[Yr],
        Sn.backend.nodes
      ), Ds = [];
      for (let Ls = 0; Ls < Ms.length - 1; ++Ls) {
        const js = kn(Ms[Ls]), zs = kn(Ms[Ls + 1]);
        It$1(js, zs) ? P(js) && Ds.push(
          ...js.sideEffects.undo
        ) : P(zs) && Ds.push(...zs.sideEffects.do);
      }
      for (const Ls of Ds) {
        const js = _e.get(Ls.type).func;
        await js(Ls.payload);
      }
      Sn.update(Sn.changeCurrent(Yr)), $n.fire(z$1.TRAVERSAL_END);
    },
    undo() {
      const { current: Yr } = Sn;
      return P(Yr) ? this.to(Yr.parent) : Promise.resolve(console.warn("Already at root!"));
    },
    redo(Yr = "latest") {
      const { current: Ms } = Sn;
      return Ms.children.length > 0 ? this.to(
        Ms.children[Yr === "oldest" ? 0 : Ms.children.length - 1]
      ) : Promise.resolve(
        console.warn("Already at latest in this branch!")
      );
    },
    currentChange(Yr, Ms = !1) {
      return Sn.currentChange(Yr, {
        skipOnNew: Ms
      });
    },
    done() {
      console.log("Setup later for URL sharing.");
    },
    tree() {
      return ke(Sn.root, Sn.backend.nodes);
    },
    on(Yr, Ms) {
      $n.listen(Yr, Ms);
    },
    export() {
      return JSON.stringify(Sn.backend);
    },
    exportObject() {
      return JSON.parse(
        JSON.stringify(Sn.backend)
      );
    },
    import(Yr) {
      const Ms = JSON.parse(Yr), Ds = Ms.current;
      Ms.current = Ms.root, Sn.update(Sn.load(Ms)), this.to(Ds);
    },
    importObject(Yr) {
      const Ms = Yr.current;
      Yr.current = Yr.root, Sn.update(Sn.load(Yr)), this.to(Ms);
    },
    metadata: Kn,
    artifact: er,
    annotations: Cr,
    bookmarks: kr
  };
}
function Rt$1(_e, Qt, Zt) {
  let [$n, Sn] = [_e, Qt];
  $n.level > Sn.level && ([$n, Sn] = [Sn, $n]);
  let kn = Sn.level - $n.level;
  for (; P(Sn) && kn !== 0; )
    Sn = Zt[Sn.parent], kn -= 1;
  if ($n.id === Sn.id)
    return $n.id;
  for (; $n.id !== Sn.id; )
    P($n) && ($n = Zt[$n.parent]), P(Sn) && (Sn = Zt[Sn.parent]);
  return $n.id;
}
function Je$1(_e, Qt, Zt) {
  const $n = Rt$1(_e, Qt, Zt), Sn = Zt[$n], kn = [], Kn = [];
  let [er, Cr] = [_e, Qt];
  for (; er.id !== Sn.id; )
    kn.push(er), P(er) && (er = Zt[er.parent]);
  for (kn.push(er); Cr.id !== Sn.id; )
    Kn.push(Cr), P(Cr) && (Cr = Zt[Cr.parent]);
  const kr = Kn.reverse();
  return [...kn, ...kr].map((Yr) => Yr.id);
}
function It$1(_e, Qt) {
  if (P(_e) && _e.parent === Qt.id)
    return !0;
  if (P(Qt) && Qt.parent === _e.id)
    return !1;
  throw new Error(
    "Incorrect use of function. Nodes are not connected to each other."
  );
}
function ke(_e, Qt) {
  return {
    ..._e,
    children: _e.children.map((Zt) => ke(Qt[Zt], Qt)),
    name: `${_e.label}`
  };
}
at();
function Lt(_e) {
  return _e.length === 2 ? pt(_e) : _e;
}
let Ke$1 = class UD {
  static create() {
    return new UD();
  }
  constructor() {
    this.registry = /* @__PURE__ */ new Map();
  }
  has(Qt) {
    return this.registry.has(Qt);
  }
  register(Qt, Zt, $n) {
    const Sn = Zt.length === 2;
    if (Zt.length > 2)
      throw new Error("Incorrect action function signature. Action function can only have two arguments at most!");
    if (this.has(Qt))
      throw new Error(`Already registered: ${Qt}`);
    const { label: kn = Qt, eventType: Kn = Qt } = $n || {};
    return this.registry.set(Qt, {
      func: Lt(Zt),
      config: {
        hasSideEffects: !Sn,
        label: typeof kn == "string" ? () => kn : kn,
        eventType: Kn
      }
    }), createAction(Qt);
  }
  get(Qt) {
    const Zt = this.registry.get(Qt);
    if (!Zt)
      throw new Error(`Not registered: ${Qt}`);
    return Zt;
  }
}, getRandomValues;
const rnds8 = new Uint8Array(16);
function rng() {
  if (!getRandomValues && (getRandomValues = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !getRandomValues))
    throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
  return getRandomValues(rnds8);
}
const byteToHex = [];
for (let _e = 0; _e < 256; ++_e)
  byteToHex.push((_e + 256).toString(16).slice(1));
function unsafeStringify(_e, Qt = 0) {
  return (byteToHex[_e[Qt + 0]] + byteToHex[_e[Qt + 1]] + byteToHex[_e[Qt + 2]] + byteToHex[_e[Qt + 3]] + "-" + byteToHex[_e[Qt + 4]] + byteToHex[_e[Qt + 5]] + "-" + byteToHex[_e[Qt + 6]] + byteToHex[_e[Qt + 7]] + "-" + byteToHex[_e[Qt + 8]] + byteToHex[_e[Qt + 9]] + "-" + byteToHex[_e[Qt + 10]] + byteToHex[_e[Qt + 11]] + byteToHex[_e[Qt + 12]] + byteToHex[_e[Qt + 13]] + byteToHex[_e[Qt + 14]] + byteToHex[_e[Qt + 15]]).toLowerCase();
}
const randomUUID = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), native = {
  randomUUID
};
function v4(_e, Qt, Zt) {
  if (native.randomUUID && !Qt && !_e)
    return native.randomUUID();
  _e = _e || {};
  const $n = _e.random || (_e.rng || rng)();
  if ($n[6] = $n[6] & 15 | 64, $n[8] = $n[8] & 63 | 128, Qt) {
    Zt = Zt || 0;
    for (let Sn = 0; Sn < 16; ++Sn)
      Qt[Zt + Sn] = $n[Sn];
    return Qt;
  }
  return unsafeStringify($n);
}
function UUID() {
  return v4();
}
function getLabelFromLabelLike(_e) {
  return typeof _e == "function" ? _e() : _e;
}
const defaultTrrackState = {
  id: UUID(),
  type: "create"
}, _TrrackManager = class PI {
  constructor(Qt) {
    this._cell = Qt, this._notifyTrrackInstanceChange = new Signal(this), this._registry = Ke$1.create(), this._notifyCurrentChange = new Signal(this), this._unsubscribeCurrentChangeListener = null, PI._instanceMaps.set(Qt, this), this._addInteractionAction = this._registerAddInteractionAction(), this.loadTrrack(this._cell.trrackGraph);
  }
  static getInstance(Qt) {
    return new PI(Qt);
  }
  get trrackInstanceChange() {
    return this._notifyTrrackInstanceChange;
  }
  get currentChange() {
    return this._notifyCurrentChange;
  }
  get trrack() {
    return this._trrack;
  }
  reset() {
    this.loadTrrack(), this._cell.generatedDataframesState.set({});
  }
  loadTrrack(Qt = null) {
    const Zt = () => {
      this._cell.trrackGraphState.set(this._graph), window.Persist.Commands.registry.notifyCommandChanged(), this._notifyCurrentChange.emit(this._trrack.current.id);
    };
    this._unsubscribeCurrentChangeListener && this._unsubscribeCurrentChangeListener(), this._trrack = Ut$1({
      registry: this._registry,
      initialState: defaultTrrackState
    }), Qt && Qt.root !== this._trrack.root.id && this._trrack.importObject(Qt), this._unsubscribeCurrentChangeListener = this._trrack.currentChange(Zt), Zt(), this._notifyTrrackInstanceChange.emit(this._trrack);
  }
  apply(Qt, Zt) {
    return this._trrack.apply(
      getLabelFromLabelLike(Zt),
      this._addInteractionAction(Qt)
    );
  }
  get _graph() {
    return this._trrack.exportObject();
  }
  _registerAddInteractionAction() {
    return (Qt) => (this._registry.has(Qt.type) || this._registry.register(
      Qt.type,
      (Zt, $n) => $n
    ), {
      type: Qt.type,
      payload: Qt
    });
  }
};
_TrrackManager._instanceMaps = /* @__PURE__ */ new WeakMap();
let TrrackManager = _TrrackManager;
function stripImmutableClone(_e) {
  return lodashExports.cloneDeep(_e);
}
function stripImmutableCloneJSON(_e) {
  return JSON.parse(JSON.stringify(_e));
}
const CODE_CELL = "code-cell", TRRACK_GRAPH = "trrack_graph", GENERATED_DATAFRAMES = "__GENERATED_DATAFRAMES__", HAS_PERSIST_OUTPUT = "__has_persist_output";
class TrrackableCell extends CodeCell {
  constructor(Qt) {
    if (super(Qt), !window.Persist.CellMap)
      throw new Error("Entry point not executed");
    window.Persist.CellMap.set(this.cell_id, this);
    const Zt = this.model.getMetadata(GENERATED_DATAFRAMES), $n = {};
    Zt && JSON.parse(decompressString(Zt)), this._generatedDataframes = hookstate(
      $n,
      extend$4(
        subscribable(),
        localstored({
          key: GENERATED_DATAFRAMES,
          engine: getCellStoreEngine(this)
        })
      )
    );
    const Sn = this.model.getMetadata(TRRACK_GRAPH), kn = Sn ? JSON.parse(decompressString(Sn)) : null;
    this._trrackGraph = hookstate(
      kn,
      localstored({
        key: TRRACK_GRAPH,
        engine: getCellStoreEngine(this)
      })
    ), this.trrackManager = TrrackManager.getInstance(this), this.node.dataset.id = this.cell_id, this.node.dataset.celltype = CODE_CELL;
    const Kn = async (er, Cr) => {
      var Ls;
      await this.ready;
      const Yr = this.node.querySelector(".jp-CellFooter");
      if (er.length !== 0) {
        Yr && (Yr.innerHTML = "");
        return;
      }
      let Ms = !1;
      const Ds = (Ls = this.editorWidget) == null ? void 0 : Ls.editor;
      if (Ds)
        for (let js = 0; js < Ds.lineCount; ++js) {
          const zs = Ds.getLine(js);
          if (zs && zs.includes("PR.") && !zs.includes("DEV")) {
            Ms = !0;
            break;
          }
        }
      Ms && Yr && (Yr.style.height = "auto", Yr.innerHTML = `
                <div style="height:20px;width:100%;text-align:center">
                This cell is a persist cell. Please run the cell to enable interactive output.
                </div>
                  `);
    };
    this.model.outputs.changed.connect(Kn, this), Kn(this.model.outputs);
  }
  tagAsPersistCell(Qt = !0) {
    this.model.setMetadata(HAS_PERSIST_OUTPUT, Qt);
  }
  get generatedDataframesState() {
    return this._generatedDataframes;
  }
  get generatedDataframes() {
    return stripImmutableCloneJSON(
      this._generatedDataframes.get({ noproxy: !0 })
    );
  }
  get trrackGraphState() {
    return this._trrackGraph;
  }
  get trrackGraph() {
    return stripImmutableClone(this._trrackGraph.get({ noproxy: !0 }));
  }
  get cell_id() {
    return this.model.id;
  }
  dispose() {
    this.isDisposed || (window.Persist.CellMap.delete(this.cell_id), Signal.clearData(this), super.dispose());
  }
}
((_e) => {
  function Qt($n) {
    return new _e($n);
  }
  _e.create = Qt;
  function Zt($n) {
    return $n instanceof _e;
  }
  _e.isTrrackableCell = Zt;
})(TrrackableCell || (TrrackableCell = {}));
var zeroRightClassName = "right-scroll-bar-position", fullWidthClassName = "width-before-scroll-bar", noScrollbarsClassName = "with-scroll-bars-hidden", removedBarSizeVariable = "--removed-body-scroll-bar-size";
function assignRef$1(_e, Qt) {
  return typeof _e == "function" ? _e(Qt) : _e && (_e.current = Qt), _e;
}
function useCallbackRef(_e, Qt) {
  var Zt = reactExports.useState(function() {
    return {
      // value
      value: _e,
      // last callback
      callback: Qt,
      // "memoized" public interface
      facade: {
        get current() {
          return Zt.value;
        },
        set current($n) {
          var Sn = Zt.value;
          Sn !== $n && (Zt.value = $n, Zt.callback($n, Sn));
        }
      }
    };
  })[0];
  return Zt.callback = Qt, Zt.facade;
}
function useMergeRefs(_e, Qt) {
  return useCallbackRef(Qt || null, function(Zt) {
    return _e.forEach(function($n) {
      return assignRef$1($n, Zt);
    });
  });
}
function ItoI(_e) {
  return _e;
}
function innerCreateMedium(_e, Qt) {
  Qt === void 0 && (Qt = ItoI);
  var Zt = [], $n = !1, Sn = {
    read: function() {
      if ($n)
        throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
      return Zt.length ? Zt[Zt.length - 1] : _e;
    },
    useMedium: function(kn) {
      var Kn = Qt(kn, $n);
      return Zt.push(Kn), function() {
        Zt = Zt.filter(function(er) {
          return er !== Kn;
        });
      };
    },
    assignSyncMedium: function(kn) {
      for ($n = !0; Zt.length; ) {
        var Kn = Zt;
        Zt = [], Kn.forEach(kn);
      }
      Zt = {
        push: function(er) {
          return kn(er);
        },
        filter: function() {
          return Zt;
        }
      };
    },
    assignMedium: function(kn) {
      $n = !0;
      var Kn = [];
      if (Zt.length) {
        var er = Zt;
        Zt = [], er.forEach(kn), Kn = Zt;
      }
      var Cr = function() {
        var Yr = Kn;
        Kn = [], Yr.forEach(kn);
      }, kr = function() {
        return Promise.resolve().then(Cr);
      };
      kr(), Zt = {
        push: function(Yr) {
          Kn.push(Yr), kr();
        },
        filter: function(Yr) {
          return Kn = Kn.filter(Yr), Zt;
        }
      };
    }
  };
  return Sn;
}
function createSidecarMedium(_e) {
  _e === void 0 && (_e = {});
  var Qt = innerCreateMedium(null);
  return Qt.options = __assign({ async: !0, ssr: !1 }, _e), Qt;
}
var SideCar$1 = function(_e) {
  var Qt = _e.sideCar, Zt = __rest$1(_e, ["sideCar"]);
  if (!Qt)
    throw new Error("Sidecar: please provide `sideCar` property to import the right car");
  var $n = Qt.read();
  if (!$n)
    throw new Error("Sidecar medium not found");
  return reactExports.createElement($n, __assign({}, Zt));
};
SideCar$1.isSideCarExport = !0;
function exportSidecar(_e, Qt) {
  return _e.useMedium(Qt), SideCar$1;
}
var effectCar = createSidecarMedium(), nothing = function() {
}, RemoveScroll$1 = reactExports.forwardRef(function(_e, Qt) {
  var Zt = reactExports.useRef(null), $n = reactExports.useState({
    onScrollCapture: nothing,
    onWheelCapture: nothing,
    onTouchMoveCapture: nothing
  }), Sn = $n[0], kn = $n[1], Kn = _e.forwardProps, er = _e.children, Cr = _e.className, kr = _e.removeScrollBar, Yr = _e.enabled, Ms = _e.shards, Ds = _e.sideCar, Ls = _e.noIsolation, js = _e.inert, zs = _e.allowPinchZoom, Fs = _e.as, Bs = Fs === void 0 ? "div" : Fs, Hs = _e.gapMode, Ws = __rest$1(_e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), Ys = Ds, El = useMergeRefs([Zt, Qt]), Mu = __assign(__assign({}, Ws), Sn);
  return reactExports.createElement(
    reactExports.Fragment,
    null,
    Yr && reactExports.createElement(Ys, { sideCar: effectCar, removeScrollBar: kr, shards: Ms, noIsolation: Ls, inert: js, setCallbacks: kn, allowPinchZoom: !!zs, lockRef: Zt, gapMode: Hs }),
    Kn ? reactExports.cloneElement(reactExports.Children.only(er), __assign(__assign({}, Mu), { ref: El })) : reactExports.createElement(Bs, __assign({}, Mu, { className: Cr, ref: El }), er)
  );
});
RemoveScroll$1.defaultProps = {
  enabled: !0,
  removeScrollBar: !0,
  inert: !1
};
RemoveScroll$1.classNames = {
  fullWidth: fullWidthClassName,
  zeroRight: zeroRightClassName
};
var currentNonce, getNonce = function() {
  if (currentNonce)
    return currentNonce;
  if (typeof __webpack_nonce__ < "u")
    return __webpack_nonce__;
};
function makeStyleTag() {
  if (!document)
    return null;
  var _e = document.createElement("style");
  _e.type = "text/css";
  var Qt = getNonce();
  return Qt && _e.setAttribute("nonce", Qt), _e;
}
function injectStyles(_e, Qt) {
  _e.styleSheet ? _e.styleSheet.cssText = Qt : _e.appendChild(document.createTextNode(Qt));
}
function insertStyleTag(_e) {
  var Qt = document.head || document.getElementsByTagName("head")[0];
  Qt.appendChild(_e);
}
var stylesheetSingleton = function() {
  var _e = 0, Qt = null;
  return {
    add: function(Zt) {
      _e == 0 && (Qt = makeStyleTag()) && (injectStyles(Qt, Zt), insertStyleTag(Qt)), _e++;
    },
    remove: function() {
      _e--, !_e && Qt && (Qt.parentNode && Qt.parentNode.removeChild(Qt), Qt = null);
    }
  };
}, styleHookSingleton = function() {
  var _e = stylesheetSingleton();
  return function(Qt, Zt) {
    reactExports.useEffect(function() {
      return _e.add(Qt), function() {
        _e.remove();
      };
    }, [Qt && Zt]);
  };
}, styleSingleton = function() {
  var _e = styleHookSingleton(), Qt = function(Zt) {
    var $n = Zt.styles, Sn = Zt.dynamic;
    return _e($n, Sn), null;
  };
  return Qt;
}, zeroGap = {
  left: 0,
  top: 0,
  right: 0,
  gap: 0
}, parse$9 = function(_e) {
  return parseInt(_e || "", 10) || 0;
}, getOffset = function(_e) {
  var Qt = window.getComputedStyle(document.body), Zt = Qt[_e === "padding" ? "paddingLeft" : "marginLeft"], $n = Qt[_e === "padding" ? "paddingTop" : "marginTop"], Sn = Qt[_e === "padding" ? "paddingRight" : "marginRight"];
  return [parse$9(Zt), parse$9($n), parse$9(Sn)];
}, getGapWidth = function(_e) {
  if (_e === void 0 && (_e = "margin"), typeof window > "u")
    return zeroGap;
  var Qt = getOffset(_e), Zt = document.documentElement.clientWidth, $n = window.innerWidth;
  return {
    left: Qt[0],
    top: Qt[1],
    right: Qt[2],
    gap: Math.max(0, $n - Zt + Qt[2] - Qt[0])
  };
}, Style = styleSingleton(), getStyles$4 = function(_e, Qt, Zt, $n) {
  var Sn = _e.left, kn = _e.top, Kn = _e.right, er = _e.gap;
  return Zt === void 0 && (Zt = "margin"), `
  .`.concat(noScrollbarsClassName, ` {
   overflow: hidden `).concat($n, `;
   padding-right: `).concat(er, "px ").concat($n, `;
  }
  body {
    overflow: hidden `).concat($n, `;
    overscroll-behavior: contain;
    `).concat([
    Qt && "position: relative ".concat($n, ";"),
    Zt === "margin" && `
    padding-left: `.concat(Sn, `px;
    padding-top: `).concat(kn, `px;
    padding-right: `).concat(Kn, `px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(er, "px ").concat($n, `;
    `),
    Zt === "padding" && "padding-right: ".concat(er, "px ").concat($n, ";")
  ].filter(Boolean).join(""), `
  }
  
  .`).concat(zeroRightClassName, ` {
    right: `).concat(er, "px ").concat($n, `;
  }
  
  .`).concat(fullWidthClassName, ` {
    margin-right: `).concat(er, "px ").concat($n, `;
  }
  
  .`).concat(zeroRightClassName, " .").concat(zeroRightClassName, ` {
    right: 0 `).concat($n, `;
  }
  
  .`).concat(fullWidthClassName, " .").concat(fullWidthClassName, ` {
    margin-right: 0 `).concat($n, `;
  }
  
  body {
    `).concat(removedBarSizeVariable, ": ").concat(er, `px;
  }
`);
}, RemoveScrollBar = function(_e) {
  var Qt = _e.noRelative, Zt = _e.noImportant, $n = _e.gapMode, Sn = $n === void 0 ? "margin" : $n, kn = reactExports.useMemo(function() {
    return getGapWidth(Sn);
  }, [Sn]);
  return reactExports.createElement(Style, { styles: getStyles$4(kn, !Qt, Sn, Zt ? "" : "!important") });
}, passiveSupported$1 = !1;
if (typeof window < "u")
  try {
    var options = Object.defineProperty({}, "passive", {
      get: function() {
        return passiveSupported$1 = !0, !0;
      }
    });
    window.addEventListener("test", options, options), window.removeEventListener("test", options, options);
  } catch {
    passiveSupported$1 = !1;
  }
var nonPassive = passiveSupported$1 ? { passive: !1 } : !1, alwaysContainsScroll = function(_e) {
  return _e.tagName === "TEXTAREA";
}, elementCanBeScrolled = function(_e, Qt) {
  var Zt = window.getComputedStyle(_e);
  return (
    // not-not-scrollable
    Zt[Qt] !== "hidden" && // contains scroll inside self
    !(Zt.overflowY === Zt.overflowX && !alwaysContainsScroll(_e) && Zt[Qt] === "visible")
  );
}, elementCouldBeVScrolled = function(_e) {
  return elementCanBeScrolled(_e, "overflowY");
}, elementCouldBeHScrolled = function(_e) {
  return elementCanBeScrolled(_e, "overflowX");
}, locationCouldBeScrolled = function(_e, Qt) {
  var Zt = Qt.ownerDocument, $n = Qt;
  do {
    typeof ShadowRoot < "u" && $n instanceof ShadowRoot && ($n = $n.host);
    var Sn = elementCouldBeScrolled(_e, $n);
    if (Sn) {
      var kn = getScrollVariables(_e, $n), Kn = kn[1], er = kn[2];
      if (Kn > er)
        return !0;
    }
    $n = $n.parentNode;
  } while ($n && $n !== Zt.body);
  return !1;
}, getVScrollVariables = function(_e) {
  var Qt = _e.scrollTop, Zt = _e.scrollHeight, $n = _e.clientHeight;
  return [
    Qt,
    Zt,
    $n
  ];
}, getHScrollVariables = function(_e) {
  var Qt = _e.scrollLeft, Zt = _e.scrollWidth, $n = _e.clientWidth;
  return [
    Qt,
    Zt,
    $n
  ];
}, elementCouldBeScrolled = function(_e, Qt) {
  return _e === "v" ? elementCouldBeVScrolled(Qt) : elementCouldBeHScrolled(Qt);
}, getScrollVariables = function(_e, Qt) {
  return _e === "v" ? getVScrollVariables(Qt) : getHScrollVariables(Qt);
}, getDirectionFactor = function(_e, Qt) {
  return _e === "h" && Qt === "rtl" ? -1 : 1;
}, handleScroll = function(_e, Qt, Zt, $n, Sn) {
  var kn = getDirectionFactor(_e, window.getComputedStyle(Qt).direction), Kn = kn * $n, er = Zt.target, Cr = Qt.contains(er), kr = !1, Yr = Kn > 0, Ms = 0, Ds = 0;
  do {
    var Ls = getScrollVariables(_e, er), js = Ls[0], zs = Ls[1], Fs = Ls[2], Bs = zs - Fs - kn * js;
    (js || Bs) && elementCouldBeScrolled(_e, er) && (Ms += Bs, Ds += js), er instanceof ShadowRoot ? er = er.host : er = er.parentNode;
  } while (
    // portaled content
    !Cr && er !== document.body || // self content
    Cr && (Qt.contains(er) || Qt === er)
  );
  return (Yr && (Sn && Math.abs(Ms) < 1 || !Sn && Kn > Ms) || !Yr && (Sn && Math.abs(Ds) < 1 || !Sn && -Kn > Ds)) && (kr = !0), kr;
}, getTouchXY = function(_e) {
  return "changedTouches" in _e ? [_e.changedTouches[0].clientX, _e.changedTouches[0].clientY] : [0, 0];
}, getDeltaXY = function(_e) {
  return [_e.deltaX, _e.deltaY];
}, extractRef = function(_e) {
  return _e && "current" in _e ? _e.current : _e;
}, deltaCompare = function(_e, Qt) {
  return _e[0] === Qt[0] && _e[1] === Qt[1];
}, generateStyle = function(_e) {
  return `
  .block-interactivity-`.concat(_e, ` {pointer-events: none;}
  .allow-interactivity-`).concat(_e, ` {pointer-events: all;}
`);
}, idCounter$1 = 0, lockStack = [];
function RemoveScrollSideCar(_e) {
  var Qt = reactExports.useRef([]), Zt = reactExports.useRef([0, 0]), $n = reactExports.useRef(), Sn = reactExports.useState(idCounter$1++)[0], kn = reactExports.useState(styleSingleton)[0], Kn = reactExports.useRef(_e);
  reactExports.useEffect(function() {
    Kn.current = _e;
  }, [_e]), reactExports.useEffect(function() {
    if (_e.inert) {
      document.body.classList.add("block-interactivity-".concat(Sn));
      var zs = __spreadArray$1([_e.lockRef.current], (_e.shards || []).map(extractRef), !0).filter(Boolean);
      return zs.forEach(function(Fs) {
        return Fs.classList.add("allow-interactivity-".concat(Sn));
      }), function() {
        document.body.classList.remove("block-interactivity-".concat(Sn)), zs.forEach(function(Fs) {
          return Fs.classList.remove("allow-interactivity-".concat(Sn));
        });
      };
    }
  }, [_e.inert, _e.lockRef.current, _e.shards]);
  var er = reactExports.useCallback(function(zs, Fs) {
    if ("touches" in zs && zs.touches.length === 2)
      return !Kn.current.allowPinchZoom;
    var Bs = getTouchXY(zs), Hs = Zt.current, Ws = "deltaX" in zs ? zs.deltaX : Hs[0] - Bs[0], Ys = "deltaY" in zs ? zs.deltaY : Hs[1] - Bs[1], El, Mu = zs.target, Pl = Math.abs(Ws) > Math.abs(Ys) ? "h" : "v";
    if ("touches" in zs && Pl === "h" && Mu.type === "range")
      return !1;
    var Iu = locationCouldBeScrolled(Pl, Mu);
    if (!Iu)
      return !0;
    if (Iu ? El = Pl : (El = Pl === "v" ? "h" : "v", Iu = locationCouldBeScrolled(Pl, Mu)), !Iu)
      return !1;
    if (!$n.current && "changedTouches" in zs && (Ws || Ys) && ($n.current = El), !El)
      return !0;
    var Tu = $n.current || El;
    return handleScroll(Tu, Fs, zs, Tu === "h" ? Ws : Ys, !0);
  }, []), Cr = reactExports.useCallback(function(zs) {
    var Fs = zs;
    if (!(!lockStack.length || lockStack[lockStack.length - 1] !== kn)) {
      var Bs = "deltaY" in Fs ? getDeltaXY(Fs) : getTouchXY(Fs), Hs = Qt.current.filter(function(El) {
        return El.name === Fs.type && (El.target === Fs.target || Fs.target === El.shadowParent) && deltaCompare(El.delta, Bs);
      })[0];
      if (Hs && Hs.should) {
        Fs.cancelable && Fs.preventDefault();
        return;
      }
      if (!Hs) {
        var Ws = (Kn.current.shards || []).map(extractRef).filter(Boolean).filter(function(El) {
          return El.contains(Fs.target);
        }), Ys = Ws.length > 0 ? er(Fs, Ws[0]) : !Kn.current.noIsolation;
        Ys && Fs.cancelable && Fs.preventDefault();
      }
    }
  }, []), kr = reactExports.useCallback(function(zs, Fs, Bs, Hs) {
    var Ws = { name: zs, delta: Fs, target: Bs, should: Hs, shadowParent: getOutermostShadowParent(Bs) };
    Qt.current.push(Ws), setTimeout(function() {
      Qt.current = Qt.current.filter(function(Ys) {
        return Ys !== Ws;
      });
    }, 1);
  }, []), Yr = reactExports.useCallback(function(zs) {
    Zt.current = getTouchXY(zs), $n.current = void 0;
  }, []), Ms = reactExports.useCallback(function(zs) {
    kr(zs.type, getDeltaXY(zs), zs.target, er(zs, _e.lockRef.current));
  }, []), Ds = reactExports.useCallback(function(zs) {
    kr(zs.type, getTouchXY(zs), zs.target, er(zs, _e.lockRef.current));
  }, []);
  reactExports.useEffect(function() {
    return lockStack.push(kn), _e.setCallbacks({
      onScrollCapture: Ms,
      onWheelCapture: Ms,
      onTouchMoveCapture: Ds
    }), document.addEventListener("wheel", Cr, nonPassive), document.addEventListener("touchmove", Cr, nonPassive), document.addEventListener("touchstart", Yr, nonPassive), function() {
      lockStack = lockStack.filter(function(zs) {
        return zs !== kn;
      }), document.removeEventListener("wheel", Cr, nonPassive), document.removeEventListener("touchmove", Cr, nonPassive), document.removeEventListener("touchstart", Yr, nonPassive);
    };
  }, []);
  var Ls = _e.removeScrollBar, js = _e.inert;
  return reactExports.createElement(
    reactExports.Fragment,
    null,
    js ? reactExports.createElement(kn, { styles: generateStyle(Sn) }) : null,
    Ls ? reactExports.createElement(RemoveScrollBar, { gapMode: _e.gapMode }) : null
  );
}
function getOutermostShadowParent(_e) {
  for (var Qt = null; _e !== null; )
    _e instanceof ShadowRoot && (Qt = _e.host, _e = _e.host), _e = _e.parentNode;
  return Qt;
}
const SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
var ReactRemoveScroll = reactExports.forwardRef(function(_e, Qt) {
  return reactExports.createElement(RemoveScroll$1, __assign({}, _e, { ref: Qt, sideCar: SideCar }));
});
ReactRemoveScroll.classNames = RemoveScroll$1.classNames;
const RemoveScroll = ReactRemoveScroll;
function createPolymorphicComponent(_e) {
  return _e;
}
function findElementAncestor(_e, Qt) {
  let Zt = _e;
  for (; (Zt = Zt.parentElement) && !Zt.matches(Qt); )
    ;
  return Zt;
}
function getPreviousIndex(_e, Qt, Zt) {
  for (let $n = _e - 1; $n >= 0; $n -= 1)
    if (!Qt[$n].disabled)
      return $n;
  if (Zt) {
    for (let $n = Qt.length - 1; $n > -1; $n -= 1)
      if (!Qt[$n].disabled)
        return $n;
  }
  return _e;
}
function getNextIndex$1(_e, Qt, Zt) {
  for (let $n = _e + 1; $n < Qt.length; $n += 1)
    if (!Qt[$n].disabled)
      return $n;
  if (Zt) {
    for (let $n = 0; $n < Qt.length; $n += 1)
      if (!Qt[$n].disabled)
        return $n;
  }
  return _e;
}
function onSameLevel(_e, Qt, Zt) {
  return findElementAncestor(_e, Zt) === findElementAncestor(Qt, Zt);
}
function createScopedKeydownHandler({
  parentSelector: _e,
  siblingSelector: Qt,
  onKeyDown: Zt,
  loop: $n = !0,
  activateOnFocus: Sn = !1,
  dir: kn = "rtl",
  orientation: Kn
}) {
  return (er) => {
    var Cr;
    Zt == null || Zt(er);
    const kr = Array.from(((Cr = findElementAncestor(er.currentTarget, _e)) == null ? void 0 : Cr.querySelectorAll(Qt)) || []).filter((zs) => onSameLevel(er.currentTarget, zs, _e)), Yr = kr.findIndex((zs) => er.currentTarget === zs), Ms = getNextIndex$1(Yr, kr, $n), Ds = getPreviousIndex(Yr, kr, $n), Ls = kn === "rtl" ? Ds : Ms, js = kn === "rtl" ? Ms : Ds;
    switch (er.key) {
      case "ArrowRight": {
        Kn === "horizontal" && (er.stopPropagation(), er.preventDefault(), kr[Ls].focus(), Sn && kr[Ls].click());
        break;
      }
      case "ArrowLeft": {
        Kn === "horizontal" && (er.stopPropagation(), er.preventDefault(), kr[js].focus(), Sn && kr[js].click());
        break;
      }
      case "ArrowUp": {
        Kn === "vertical" && (er.stopPropagation(), er.preventDefault(), kr[Ds].focus(), Sn && kr[Ds].click());
        break;
      }
      case "ArrowDown": {
        Kn === "vertical" && (er.stopPropagation(), er.preventDefault(), kr[Ms].focus(), Sn && kr[Ms].click());
        break;
      }
      case "Home": {
        er.stopPropagation(), er.preventDefault(), !kr[0].disabled && kr[0].focus();
        break;
      }
      case "End": {
        er.stopPropagation(), er.preventDefault();
        const zs = kr.length - 1;
        !kr[zs].disabled && kr[zs].focus();
        break;
      }
    }
  };
}
function getContextItemIndex(_e, Qt, Zt) {
  var $n;
  return Zt ? Array.from((($n = findElementAncestor(Zt, Qt)) == null ? void 0 : $n.querySelectorAll(_e)) || []).findIndex((Sn) => Sn === Zt) : null;
}
function createSafeContext(_e) {
  const Qt = reactExports.createContext(null);
  return [({ children: Sn, value: kn }) => /* @__PURE__ */ React.createElement(Qt.Provider, {
    value: kn
  }, Sn), () => {
    const Sn = reactExports.useContext(Qt);
    if (Sn === null)
      throw new Error(_e);
    return Sn;
  }];
}
function packSx(_e) {
  return Array.isArray(_e) ? _e : [_e];
}
function getSafeId(_e, Qt) {
  return (Zt) => {
    if (typeof Zt != "string" || Zt.trim().length === 0)
      throw new Error(Qt);
    return `${_e}-${Zt}`;
  };
}
const noop$9 = () => {
};
function closeOnEscape(_e, Qt = { active: !0 }) {
  return typeof _e != "function" || !Qt.active ? Qt.onKeyDown || noop$9 : (Zt) => {
    var $n;
    Zt.key === "Escape" && (_e(Zt), ($n = Qt.onTrigger) == null || $n.call(Qt));
  };
}
function createEventHandler(_e, Qt) {
  return (Zt) => {
    _e == null || _e(Zt), Qt == null || Qt(Zt);
  };
}
function useHovered() {
  const [_e, Qt] = reactExports.useState(-1);
  return [_e, { setHovered: Qt, resetHovered: () => Qt(-1) }];
}
function groupOptions({ data: _e }) {
  const Qt = [], Zt = [], $n = _e.reduce((Sn, kn, Kn) => (kn.group ? Sn[kn.group] ? Sn[kn.group].push(Kn) : Sn[kn.group] = [Kn] : Zt.push(Kn), Sn), {});
  return Object.keys($n).forEach((Sn) => {
    Qt.push(...$n[Sn].map((kn) => _e[kn]));
  }), Qt.push(...Zt.map((Sn) => _e[Sn])), Qt;
}
function isElement$3(_e) {
  return Array.isArray(_e) || _e === null ? !1 : typeof _e == "object" ? _e.type !== React.Fragment : !1;
}
function toVal(_e) {
  var Qt, Zt, $n = "";
  if (typeof _e == "string" || typeof _e == "number")
    $n += _e;
  else if (typeof _e == "object")
    if (Array.isArray(_e))
      for (Qt = 0; Qt < _e.length; Qt++)
        _e[Qt] && (Zt = toVal(_e[Qt])) && ($n && ($n += " "), $n += Zt);
    else
      for (Qt in _e)
        _e[Qt] && ($n && ($n += " "), $n += Qt);
  return $n;
}
function clsx() {
  for (var _e = 0, Qt, Zt, $n = ""; _e < arguments.length; )
    (Qt = arguments[_e++]) && (Zt = toVal(Qt)) && ($n && ($n += " "), $n += Zt);
  return $n;
}
const DEFAULT_COLORS = {
  dark: [
    "#C1C2C5",
    "#A6A7AB",
    "#909296",
    "#5c5f66",
    "#373A40",
    "#2C2E33",
    "#25262b",
    "#1A1B1E",
    "#141517",
    "#101113"
  ],
  gray: [
    "#f8f9fa",
    "#f1f3f5",
    "#e9ecef",
    "#dee2e6",
    "#ced4da",
    "#adb5bd",
    "#868e96",
    "#495057",
    "#343a40",
    "#212529"
  ],
  red: [
    "#fff5f5",
    "#ffe3e3",
    "#ffc9c9",
    "#ffa8a8",
    "#ff8787",
    "#ff6b6b",
    "#fa5252",
    "#f03e3e",
    "#e03131",
    "#c92a2a"
  ],
  pink: [
    "#fff0f6",
    "#ffdeeb",
    "#fcc2d7",
    "#faa2c1",
    "#f783ac",
    "#f06595",
    "#e64980",
    "#d6336c",
    "#c2255c",
    "#a61e4d"
  ],
  grape: [
    "#f8f0fc",
    "#f3d9fa",
    "#eebefa",
    "#e599f7",
    "#da77f2",
    "#cc5de8",
    "#be4bdb",
    "#ae3ec9",
    "#9c36b5",
    "#862e9c"
  ],
  violet: [
    "#f3f0ff",
    "#e5dbff",
    "#d0bfff",
    "#b197fc",
    "#9775fa",
    "#845ef7",
    "#7950f2",
    "#7048e8",
    "#6741d9",
    "#5f3dc4"
  ],
  indigo: [
    "#edf2ff",
    "#dbe4ff",
    "#bac8ff",
    "#91a7ff",
    "#748ffc",
    "#5c7cfa",
    "#4c6ef5",
    "#4263eb",
    "#3b5bdb",
    "#364fc7"
  ],
  blue: [
    "#e7f5ff",
    "#d0ebff",
    "#a5d8ff",
    "#74c0fc",
    "#4dabf7",
    "#339af0",
    "#228be6",
    "#1c7ed6",
    "#1971c2",
    "#1864ab"
  ],
  cyan: [
    "#e3fafc",
    "#c5f6fa",
    "#99e9f2",
    "#66d9e8",
    "#3bc9db",
    "#22b8cf",
    "#15aabf",
    "#1098ad",
    "#0c8599",
    "#0b7285"
  ],
  teal: [
    "#e6fcf5",
    "#c3fae8",
    "#96f2d7",
    "#63e6be",
    "#38d9a9",
    "#20c997",
    "#12b886",
    "#0ca678",
    "#099268",
    "#087f5b"
  ],
  green: [
    "#ebfbee",
    "#d3f9d8",
    "#b2f2bb",
    "#8ce99a",
    "#69db7c",
    "#51cf66",
    "#40c057",
    "#37b24d",
    "#2f9e44",
    "#2b8a3e"
  ],
  lime: [
    "#f4fce3",
    "#e9fac8",
    "#d8f5a2",
    "#c0eb75",
    "#a9e34b",
    "#94d82d",
    "#82c91e",
    "#74b816",
    "#66a80f",
    "#5c940d"
  ],
  yellow: [
    "#fff9db",
    "#fff3bf",
    "#ffec99",
    "#ffe066",
    "#ffd43b",
    "#fcc419",
    "#fab005",
    "#f59f00",
    "#f08c00",
    "#e67700"
  ],
  orange: [
    "#fff4e6",
    "#ffe8cc",
    "#ffd8a8",
    "#ffc078",
    "#ffa94d",
    "#ff922b",
    "#fd7e14",
    "#f76707",
    "#e8590c",
    "#d9480f"
  ]
};
function fontStyles(_e) {
  return () => ({ fontFamily: _e.fontFamily || "sans-serif" });
}
var __defProp$2D = Object.defineProperty, __getOwnPropSymbols$2G = Object.getOwnPropertySymbols, __hasOwnProp$2G = Object.prototype.hasOwnProperty, __propIsEnum$2G = Object.prototype.propertyIsEnumerable, __defNormalProp$2D = (_e, Qt, Zt) => Qt in _e ? __defProp$2D(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2D = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2G.call(Qt, Zt) && __defNormalProp$2D(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2G)
    for (var Zt of __getOwnPropSymbols$2G(Qt))
      __propIsEnum$2G.call(Qt, Zt) && __defNormalProp$2D(_e, Zt, Qt[Zt]);
  return _e;
};
function focusStyles(_e) {
  return (Qt) => ({
    WebkitTapHighlightColor: "transparent",
    [Qt || "&:focus"]: __spreadValues$2D({}, _e.focusRing === "always" || _e.focusRing === "auto" ? _e.focusRingStyles.styles(_e) : _e.focusRingStyles.resetStyles(_e)),
    [Qt ? Qt.replace(":focus", ":focus:not(:focus-visible)") : "&:focus:not(:focus-visible)"]: __spreadValues$2D({}, _e.focusRing === "auto" || _e.focusRing === "never" ? _e.focusRingStyles.resetStyles(_e) : null)
  });
}
function primaryShade(_e) {
  return (Qt) => typeof _e.primaryShade == "number" ? _e.primaryShade : _e.primaryShade[Qt || _e.colorScheme];
}
function themeColor(_e) {
  const Qt = primaryShade(_e);
  return (Zt, $n, Sn = !0, kn = !0) => {
    if (typeof Zt == "string" && Zt.includes(".")) {
      const [er, Cr] = Zt.split("."), kr = parseInt(Cr, 10);
      if (er in _e.colors && kr >= 0 && kr < 10)
        return _e.colors[er][typeof $n == "number" && !kn ? $n : kr];
    }
    const Kn = typeof $n == "number" ? $n : Qt();
    return Zt in _e.colors ? _e.colors[Zt][Kn] : Sn ? _e.colors[_e.primaryColor][Kn] : Zt;
  };
}
function getGradientColorStops(_e) {
  let Qt = "";
  for (let Zt = 1; Zt < _e.length - 1; Zt += 1)
    Qt += `${_e[Zt]} ${Zt / (_e.length - 1) * 100}%, `;
  return `${_e[0]} 0%, ${Qt}${_e[_e.length - 1]} 100%`;
}
function linearGradient(_e, ...Qt) {
  return `linear-gradient(${_e}deg, ${getGradientColorStops(Qt)})`;
}
function radialGradient(..._e) {
  return `radial-gradient(circle, ${getGradientColorStops(_e)})`;
}
function gradient$3(_e) {
  const Qt = themeColor(_e), Zt = primaryShade(_e);
  return ($n) => {
    const Sn = {
      from: ($n == null ? void 0 : $n.from) || _e.defaultGradient.from,
      to: ($n == null ? void 0 : $n.to) || _e.defaultGradient.to,
      deg: ($n == null ? void 0 : $n.deg) || _e.defaultGradient.deg
    };
    return `linear-gradient(${Sn.deg}deg, ${Qt(Sn.from, Zt(), !1)} 0%, ${Qt(Sn.to, Zt(), !1)} 100%)`;
  };
}
function createConverter(_e) {
  return (Qt) => {
    if (typeof Qt == "number")
      return `${Qt / 16}${_e}`;
    if (typeof Qt == "string") {
      const Zt = Qt.replace("px", "");
      if (!Number.isNaN(Number(Zt)))
        return `${Number(Zt) / 16}${_e}`;
    }
    return Qt;
  };
}
const rem$1 = createConverter("rem"), em$1 = createConverter("em");
function getSize$1({
  size: _e,
  sizes: Qt,
  units: Zt
}) {
  return _e in Qt ? Qt[_e] : typeof _e == "number" ? Zt === "em" ? em$1(_e) : rem$1(_e) : _e || Qt.md;
}
function getBreakpointValue(_e) {
  return typeof _e == "number" ? _e : typeof _e == "string" && _e.includes("rem") ? Number(_e.replace("rem", "")) * 16 : typeof _e == "string" && _e.includes("em") ? Number(_e.replace("em", "")) * 16 : Number(_e);
}
function largerThan(_e) {
  return (Qt) => `@media (min-width: ${em$1(getBreakpointValue(getSize$1({ size: Qt, sizes: _e.breakpoints })))})`;
}
function smallerThan(_e) {
  return (Qt) => `@media (max-width: ${em$1(getBreakpointValue(getSize$1({ size: Qt, sizes: _e.breakpoints })) - 1)})`;
}
function isHexColor(_e) {
  return /^#?([0-9A-F]{3}){1,2}$/i.test(_e);
}
function hexToRgba(_e) {
  let Qt = _e.replace("#", "");
  if (Qt.length === 3) {
    const Kn = Qt.split("");
    Qt = [
      Kn[0],
      Kn[0],
      Kn[1],
      Kn[1],
      Kn[2],
      Kn[2]
    ].join("");
  }
  const Zt = parseInt(Qt, 16), $n = Zt >> 16 & 255, Sn = Zt >> 8 & 255, kn = Zt & 255;
  return {
    r: $n,
    g: Sn,
    b: kn,
    a: 1
  };
}
function rgbStringToRgba(_e) {
  const [Qt, Zt, $n, Sn] = _e.replace(/[^0-9,.]/g, "").split(",").map(Number);
  return { r: Qt, g: Zt, b: $n, a: Sn || 1 };
}
function toRgba(_e) {
  return isHexColor(_e) ? hexToRgba(_e) : _e.startsWith("rgb") ? rgbStringToRgba(_e) : {
    r: 0,
    g: 0,
    b: 0,
    a: 1
  };
}
function rgba$1(_e, Qt) {
  if (typeof _e != "string" || Qt > 1 || Qt < 0)
    return "rgba(0, 0, 0, 1)";
  if (_e.startsWith("var(--"))
    return _e;
  const { r: Zt, g: $n, b: Sn } = toRgba(_e);
  return `rgba(${Zt}, ${$n}, ${Sn}, ${Qt})`;
}
function cover(_e = 0) {
  return {
    position: "absolute",
    top: rem$1(_e),
    right: rem$1(_e),
    left: rem$1(_e),
    bottom: rem$1(_e)
  };
}
function darken(_e, Qt) {
  if (typeof _e == "string" && _e.startsWith("var(--"))
    return _e;
  const { r: Zt, g: $n, b: Sn, a: kn } = toRgba(_e), Kn = 1 - Qt, er = (Cr) => Math.round(Cr * Kn);
  return `rgba(${er(Zt)}, ${er($n)}, ${er(Sn)}, ${kn})`;
}
function lighten(_e, Qt) {
  if (typeof _e == "string" && _e.startsWith("var(--"))
    return _e;
  const { r: Zt, g: $n, b: Sn, a: kn } = toRgba(_e), Kn = (er) => Math.round(er + (255 - er) * Qt);
  return `rgba(${Kn(Zt)}, ${Kn($n)}, ${Kn(Sn)}, ${kn})`;
}
function radius$1(_e) {
  return (Qt) => {
    if (typeof Qt == "number")
      return rem$1(Qt);
    const Zt = typeof _e.defaultRadius == "number" ? _e.defaultRadius : _e.radius[_e.defaultRadius] || _e.defaultRadius;
    return _e.radius[Qt] || Qt || Zt;
  };
}
function getColorIndexInfo(_e, Qt) {
  if (typeof _e == "string" && _e.includes(".")) {
    const [Zt, $n] = _e.split("."), Sn = parseInt($n, 10);
    if (Zt in Qt.colors && Sn >= 0 && Sn < 10)
      return { isSplittedColor: !0, key: Zt, shade: Sn };
  }
  return { isSplittedColor: !1 };
}
function variant(_e) {
  const Qt = themeColor(_e), Zt = primaryShade(_e), $n = gradient$3(_e);
  return ({ variant: Sn, color: kn, gradient: Kn, primaryFallback: er }) => {
    const Cr = getColorIndexInfo(kn, _e);
    switch (Sn) {
      case "light":
        return {
          border: "transparent",
          background: rgba$1(Qt(kn, _e.colorScheme === "dark" ? 8 : 0, er, !1), _e.colorScheme === "dark" ? 0.2 : 1),
          color: kn === "dark" ? _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.colors.dark[9] : Qt(kn, _e.colorScheme === "dark" ? 2 : Zt("light")),
          hover: rgba$1(Qt(kn, _e.colorScheme === "dark" ? 7 : 1, er, !1), _e.colorScheme === "dark" ? 0.25 : 0.65)
        };
      case "subtle":
        return {
          border: "transparent",
          background: "transparent",
          color: kn === "dark" ? _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.colors.dark[9] : Qt(kn, _e.colorScheme === "dark" ? 2 : Zt("light")),
          hover: rgba$1(Qt(kn, _e.colorScheme === "dark" ? 8 : 0, er, !1), _e.colorScheme === "dark" ? 0.2 : 1)
        };
      case "outline":
        return {
          border: Qt(kn, _e.colorScheme === "dark" ? 5 : Zt("light")),
          background: "transparent",
          color: Qt(kn, _e.colorScheme === "dark" ? 5 : Zt("light")),
          hover: _e.colorScheme === "dark" ? rgba$1(Qt(kn, 5, er, !1), 0.05) : rgba$1(Qt(kn, 0, er, !1), 0.35)
        };
      case "default":
        return {
          border: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[4],
          background: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.white,
          color: _e.colorScheme === "dark" ? _e.white : _e.black,
          hover: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[0]
        };
      case "white":
        return {
          border: "transparent",
          background: _e.white,
          color: Qt(kn, Zt()),
          hover: null
        };
      case "transparent":
        return {
          border: "transparent",
          color: kn === "dark" ? _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.colors.dark[9] : Qt(kn, _e.colorScheme === "dark" ? 2 : Zt("light")),
          background: "transparent",
          hover: null
        };
      case "gradient":
        return {
          background: $n(Kn),
          color: _e.white,
          border: "transparent",
          hover: null
        };
      default: {
        const kr = Zt(), Yr = Cr.isSplittedColor ? Cr.shade : kr, Ms = Cr.isSplittedColor ? Cr.key : kn;
        return {
          border: "transparent",
          background: Qt(Ms, Yr, er),
          color: _e.white,
          hover: Qt(Ms, Yr === 9 ? 8 : Yr + 1)
        };
      }
    }
  };
}
function primaryColor(_e) {
  return (Qt) => {
    const Zt = primaryShade(_e)(Qt);
    return _e.colors[_e.primaryColor][Zt];
  };
}
function hover$1(_e) {
  return {
    "@media (hover: hover)": {
      "&:hover": _e
    },
    "@media (hover: none)": {
      "&:active": _e
    }
  };
}
function placeholderStyles(_e) {
  return () => ({
    userSelect: "none",
    color: _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[5]
  });
}
function dimmed(_e) {
  return () => _e.colorScheme === "dark" ? _e.colors.dark[2] : _e.colors.gray[6];
}
const fns = {
  fontStyles,
  themeColor,
  focusStyles,
  linearGradient,
  radialGradient,
  smallerThan,
  largerThan,
  rgba: rgba$1,
  cover,
  darken,
  lighten,
  radius: radius$1,
  variant,
  primaryShade,
  hover: hover$1,
  gradient: gradient$3,
  primaryColor,
  placeholderStyles,
  dimmed
};
var __defProp$2C = Object.defineProperty, __defProps$1i = Object.defineProperties, __getOwnPropDescs$1i = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2F = Object.getOwnPropertySymbols, __hasOwnProp$2F = Object.prototype.hasOwnProperty, __propIsEnum$2F = Object.prototype.propertyIsEnumerable, __defNormalProp$2C = (_e, Qt, Zt) => Qt in _e ? __defProp$2C(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2C = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2F.call(Qt, Zt) && __defNormalProp$2C(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2F)
    for (var Zt of __getOwnPropSymbols$2F(Qt))
      __propIsEnum$2F.call(Qt, Zt) && __defNormalProp$2C(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$1i = (_e, Qt) => __defProps$1i(_e, __getOwnPropDescs$1i(Qt));
function attachFunctions(_e) {
  return __spreadProps$1i(__spreadValues$2C({}, _e), {
    fn: {
      fontStyles: fns.fontStyles(_e),
      themeColor: fns.themeColor(_e),
      focusStyles: fns.focusStyles(_e),
      largerThan: fns.largerThan(_e),
      smallerThan: fns.smallerThan(_e),
      radialGradient: fns.radialGradient,
      linearGradient: fns.linearGradient,
      gradient: fns.gradient(_e),
      rgba: fns.rgba,
      cover: fns.cover,
      lighten: fns.lighten,
      darken: fns.darken,
      primaryShade: fns.primaryShade(_e),
      radius: fns.radius(_e),
      variant: fns.variant(_e),
      hover: fns.hover,
      primaryColor: fns.primaryColor(_e),
      placeholderStyles: fns.placeholderStyles(_e),
      dimmed: fns.dimmed(_e)
    }
  });
}
const _DEFAULT_THEME = {
  dir: "ltr",
  primaryShade: {
    light: 6,
    dark: 8
  },
  focusRing: "auto",
  loader: "oval",
  colorScheme: "light",
  white: "#fff",
  black: "#000",
  defaultRadius: "sm",
  transitionTimingFunction: "ease",
  colors: DEFAULT_COLORS,
  lineHeight: 1.55,
  fontFamily: "-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",
  fontFamilyMonospace: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",
  primaryColor: "blue",
  respectReducedMotion: !0,
  cursorType: "default",
  defaultGradient: {
    from: "indigo",
    to: "cyan",
    deg: 45
  },
  shadows: {
    xs: "0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1)",
    sm: "0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 0.625rem 0.9375rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.4375rem 0.4375rem -0.3125rem",
    md: "0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.25rem 1.5625rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.625rem 0.625rem -0.3125rem",
    lg: "0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.75rem 1.4375rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 0.75rem 0.75rem -0.4375rem",
    xl: "0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem"
  },
  fontSizes: {
    xs: "0.75rem",
    sm: "0.875rem",
    md: "1rem",
    lg: "1.125rem",
    xl: "1.25rem"
  },
  radius: {
    xs: "0.125rem",
    sm: "0.25rem",
    md: "0.5rem",
    lg: "1rem",
    xl: "2rem"
  },
  spacing: {
    xs: "0.625rem",
    sm: "0.75rem",
    md: "1rem",
    lg: "1.25rem",
    xl: "1.5rem"
  },
  breakpoints: {
    xs: "36em",
    sm: "48em",
    md: "62em",
    lg: "75em",
    xl: "88em"
  },
  headings: {
    fontFamily: "-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",
    fontWeight: 700,
    sizes: {
      h1: { fontSize: "2.125rem", lineHeight: 1.3, fontWeight: void 0 },
      h2: { fontSize: "1.625rem", lineHeight: 1.35, fontWeight: void 0 },
      h3: { fontSize: "1.375rem", lineHeight: 1.4, fontWeight: void 0 },
      h4: { fontSize: "1.125rem", lineHeight: 1.45, fontWeight: void 0 },
      h5: { fontSize: "1rem", lineHeight: 1.5, fontWeight: void 0 },
      h6: { fontSize: "0.875rem", lineHeight: 1.5, fontWeight: void 0 }
    }
  },
  other: {},
  components: {},
  activeStyles: { transform: "translateY(0.0625rem)" },
  datesLocale: "en",
  globalStyles: void 0,
  focusRingStyles: {
    styles: (_e) => ({
      outlineOffset: "0.125rem",
      outline: `0.125rem solid ${_e.colors[_e.primaryColor][_e.colorScheme === "dark" ? 7 : 5]}`
    }),
    resetStyles: () => ({ outline: "none" }),
    inputStyles: (_e) => ({
      outline: "none",
      borderColor: _e.colors[_e.primaryColor][typeof _e.primaryShade == "object" ? _e.primaryShade[_e.colorScheme] : _e.primaryShade]
    })
  }
}, DEFAULT_THEME = attachFunctions(_DEFAULT_THEME);
function sheetForTag(_e) {
  if (_e.sheet)
    return _e.sheet;
  for (var Qt = 0; Qt < document.styleSheets.length; Qt++)
    if (document.styleSheets[Qt].ownerNode === _e)
      return document.styleSheets[Qt];
}
function createStyleElement(_e) {
  var Qt = document.createElement("style");
  return Qt.setAttribute("data-emotion", _e.key), _e.nonce !== void 0 && Qt.setAttribute("nonce", _e.nonce), Qt.appendChild(document.createTextNode("")), Qt.setAttribute("data-s", ""), Qt;
}
var StyleSheet = /* @__PURE__ */ function() {
  function _e(Zt) {
    var $n = this;
    this._insertTag = function(Sn) {
      var kn;
      $n.tags.length === 0 ? $n.insertionPoint ? kn = $n.insertionPoint.nextSibling : $n.prepend ? kn = $n.container.firstChild : kn = $n.before : kn = $n.tags[$n.tags.length - 1].nextSibling, $n.container.insertBefore(Sn, kn), $n.tags.push(Sn);
    }, this.isSpeedy = Zt.speedy === void 0 ? !0 : Zt.speedy, this.tags = [], this.ctr = 0, this.nonce = Zt.nonce, this.key = Zt.key, this.container = Zt.container, this.prepend = Zt.prepend, this.insertionPoint = Zt.insertionPoint, this.before = null;
  }
  var Qt = _e.prototype;
  return Qt.hydrate = function($n) {
    $n.forEach(this._insertTag);
  }, Qt.insert = function($n) {
    this.ctr % (this.isSpeedy ? 65e3 : 1) === 0 && this._insertTag(createStyleElement(this));
    var Sn = this.tags[this.tags.length - 1];
    if (this.isSpeedy) {
      var kn = sheetForTag(Sn);
      try {
        kn.insertRule($n, kn.cssRules.length);
      } catch {
      }
    } else
      Sn.appendChild(document.createTextNode($n));
    this.ctr++;
  }, Qt.flush = function() {
    this.tags.forEach(function($n) {
      return $n.parentNode && $n.parentNode.removeChild($n);
    }), this.tags = [], this.ctr = 0;
  }, _e;
}(), MS = "-ms-", MOZ = "-moz-", WEBKIT = "-webkit-", COMMENT = "comm", RULESET = "rule", DECLARATION = "decl", IMPORT = "@import", KEYFRAMES = "@keyframes", LAYER = "@layer", abs$3 = Math.abs, from = String.fromCharCode, assign = Object.assign;
function hash$1(_e, Qt) {
  return charat(_e, 0) ^ 45 ? (((Qt << 2 ^ charat(_e, 0)) << 2 ^ charat(_e, 1)) << 2 ^ charat(_e, 2)) << 2 ^ charat(_e, 3) : 0;
}
function trim$1(_e) {
  return _e.trim();
}
function match$1(_e, Qt) {
  return (_e = Qt.exec(_e)) ? _e[0] : _e;
}
function replace$2(_e, Qt, Zt) {
  return _e.replace(Qt, Zt);
}
function indexof$1(_e, Qt) {
  return _e.indexOf(Qt);
}
function charat(_e, Qt) {
  return _e.charCodeAt(Qt) | 0;
}
function substr(_e, Qt, Zt) {
  return _e.slice(Qt, Zt);
}
function strlen(_e) {
  return _e.length;
}
function sizeof(_e) {
  return _e.length;
}
function append$2(_e, Qt) {
  return Qt.push(_e), _e;
}
function combine$1(_e, Qt) {
  return _e.map(Qt).join("");
}
var line$3 = 1, column = 1, length$1 = 0, position$2 = 0, character = 0, characters = "";
function node(_e, Qt, Zt, $n, Sn, kn, Kn) {
  return { value: _e, root: Qt, parent: Zt, type: $n, props: Sn, children: kn, line: line$3, column, length: Kn, return: "" };
}
function copy$3(_e, Qt) {
  return assign(node("", null, null, "", null, null, 0), _e, { length: -_e.length }, Qt);
}
function char() {
  return character;
}
function prev() {
  return character = position$2 > 0 ? charat(characters, --position$2) : 0, column--, character === 10 && (column = 1, line$3--), character;
}
function next() {
  return character = position$2 < length$1 ? charat(characters, position$2++) : 0, column++, character === 10 && (column = 1, line$3++), character;
}
function peek$2() {
  return charat(characters, position$2);
}
function caret() {
  return position$2;
}
function slice$3(_e, Qt) {
  return substr(characters, _e, Qt);
}
function token(_e) {
  switch (_e) {
    case 0:
    case 9:
    case 10:
    case 13:
    case 32:
      return 5;
    case 33:
    case 43:
    case 44:
    case 47:
    case 62:
    case 64:
    case 126:
    case 59:
    case 123:
    case 125:
      return 4;
    case 58:
      return 3;
    case 34:
    case 39:
    case 40:
    case 91:
      return 2;
    case 41:
    case 93:
      return 1;
  }
  return 0;
}
function alloc(_e) {
  return line$3 = column = 1, length$1 = strlen(characters = _e), position$2 = 0, [];
}
function dealloc(_e) {
  return characters = "", _e;
}
function delimit(_e) {
  return trim$1(slice$3(position$2 - 1, delimiter(_e === 91 ? _e + 2 : _e === 40 ? _e + 1 : _e)));
}
function whitespace(_e) {
  for (; (character = peek$2()) && character < 33; )
    next();
  return token(_e) > 2 || token(character) > 3 ? "" : " ";
}
function escaping(_e, Qt) {
  for (; --Qt && next() && !(character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97); )
    ;
  return slice$3(_e, caret() + (Qt < 6 && peek$2() == 32 && next() == 32));
}
function delimiter(_e) {
  for (; next(); )
    switch (character) {
      case _e:
        return position$2;
      case 34:
      case 39:
        _e !== 34 && _e !== 39 && delimiter(character);
        break;
      case 40:
        _e === 41 && delimiter(_e);
        break;
      case 92:
        next();
        break;
    }
  return position$2;
}
function commenter(_e, Qt) {
  for (; next() && _e + character !== 47 + 10; )
    if (_e + character === 42 + 42 && peek$2() === 47)
      break;
  return "/*" + slice$3(Qt, position$2 - 1) + "*" + from(_e === 47 ? _e : next());
}
function identifier(_e) {
  for (; !token(peek$2()); )
    next();
  return slice$3(_e, position$2);
}
function compile$1(_e) {
  return dealloc(parse$8("", null, null, null, [""], _e = alloc(_e), 0, [0], _e));
}
function parse$8(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr) {
  for (var kr = 0, Yr = 0, Ms = Kn, Ds = 0, Ls = 0, js = 0, zs = 1, Fs = 1, Bs = 1, Hs = 0, Ws = "", Ys = Sn, El = kn, Mu = $n, Pl = Ws; Fs; )
    switch (js = Hs, Hs = next()) {
      case 40:
        if (js != 108 && charat(Pl, Ms - 1) == 58) {
          indexof$1(Pl += replace$2(delimit(Hs), "&", "&\f"), "&\f") != -1 && (Bs = -1);
          break;
        }
      case 34:
      case 39:
      case 91:
        Pl += delimit(Hs);
        break;
      case 9:
      case 10:
      case 13:
      case 32:
        Pl += whitespace(js);
        break;
      case 92:
        Pl += escaping(caret() - 1, 7);
        continue;
      case 47:
        switch (peek$2()) {
          case 42:
          case 47:
            append$2(comment(commenter(next(), caret()), Qt, Zt), Cr);
            break;
          default:
            Pl += "/";
        }
        break;
      case 123 * zs:
        er[kr++] = strlen(Pl) * Bs;
      case 125 * zs:
      case 59:
      case 0:
        switch (Hs) {
          case 0:
          case 125:
            Fs = 0;
          case 59 + Yr:
            Bs == -1 && (Pl = replace$2(Pl, /\f/g, "")), Ls > 0 && strlen(Pl) - Ms && append$2(Ls > 32 ? declaration(Pl + ";", $n, Zt, Ms - 1) : declaration(replace$2(Pl, " ", "") + ";", $n, Zt, Ms - 2), Cr);
            break;
          case 59:
            Pl += ";";
          default:
            if (append$2(Mu = ruleset(Pl, Qt, Zt, kr, Yr, Sn, er, Ws, Ys = [], El = [], Ms), kn), Hs === 123)
              if (Yr === 0)
                parse$8(Pl, Qt, Mu, Mu, Ys, kn, Ms, er, El);
              else
                switch (Ds === 99 && charat(Pl, 3) === 110 ? 100 : Ds) {
                  case 100:
                  case 108:
                  case 109:
                  case 115:
                    parse$8(_e, Mu, Mu, $n && append$2(ruleset(_e, Mu, Mu, 0, 0, Sn, er, Ws, Sn, Ys = [], Ms), El), Sn, El, Ms, er, $n ? Ys : El);
                    break;
                  default:
                    parse$8(Pl, Mu, Mu, Mu, [""], El, 0, er, El);
                }
        }
        kr = Yr = Ls = 0, zs = Bs = 1, Ws = Pl = "", Ms = Kn;
        break;
      case 58:
        Ms = 1 + strlen(Pl), Ls = js;
      default:
        if (zs < 1) {
          if (Hs == 123)
            --zs;
          else if (Hs == 125 && zs++ == 0 && prev() == 125)
            continue;
        }
        switch (Pl += from(Hs), Hs * zs) {
          case 38:
            Bs = Yr > 0 ? 1 : (Pl += "\f", -1);
            break;
          case 44:
            er[kr++] = (strlen(Pl) - 1) * Bs, Bs = 1;
            break;
          case 64:
            peek$2() === 45 && (Pl += delimit(next())), Ds = peek$2(), Yr = Ms = strlen(Ws = Pl += identifier(caret())), Hs++;
            break;
          case 45:
            js === 45 && strlen(Pl) == 2 && (zs = 0);
        }
    }
  return kn;
}
function ruleset(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr, kr, Yr) {
  for (var Ms = Sn - 1, Ds = Sn === 0 ? kn : [""], Ls = sizeof(Ds), js = 0, zs = 0, Fs = 0; js < $n; ++js)
    for (var Bs = 0, Hs = substr(_e, Ms + 1, Ms = abs$3(zs = Kn[js])), Ws = _e; Bs < Ls; ++Bs)
      (Ws = trim$1(zs > 0 ? Ds[Bs] + " " + Hs : replace$2(Hs, /&\f/g, Ds[Bs]))) && (Cr[Fs++] = Ws);
  return node(_e, Qt, Zt, Sn === 0 ? RULESET : er, Cr, kr, Yr);
}
function comment(_e, Qt, Zt) {
  return node(_e, Qt, Zt, COMMENT, from(char()), substr(_e, 2, -2), 0);
}
function declaration(_e, Qt, Zt, $n) {
  return node(_e, Qt, Zt, DECLARATION, substr(_e, 0, $n), substr(_e, $n + 1, -1), $n);
}
function serialize(_e, Qt) {
  for (var Zt = "", $n = sizeof(_e), Sn = 0; Sn < $n; Sn++)
    Zt += Qt(_e[Sn], Sn, _e, Qt) || "";
  return Zt;
}
function stringify$3(_e, Qt, Zt, $n) {
  switch (_e.type) {
    case LAYER:
      if (_e.children.length)
        break;
    case IMPORT:
    case DECLARATION:
      return _e.return = _e.return || _e.value;
    case COMMENT:
      return "";
    case KEYFRAMES:
      return _e.return = _e.value + "{" + serialize(_e.children, $n) + "}";
    case RULESET:
      _e.value = _e.props.join(",");
  }
  return strlen(Zt = serialize(_e.children, $n)) ? _e.return = _e.value + "{" + Zt + "}" : "";
}
function middleware(_e) {
  var Qt = sizeof(_e);
  return function(Zt, $n, Sn, kn) {
    for (var Kn = "", er = 0; er < Qt; er++)
      Kn += _e[er](Zt, $n, Sn, kn) || "";
    return Kn;
  };
}
function rulesheet(_e) {
  return function(Qt) {
    Qt.root || (Qt = Qt.return) && _e(Qt);
  };
}
function memoize$1(_e) {
  var Qt = /* @__PURE__ */ Object.create(null);
  return function(Zt) {
    return Qt[Zt] === void 0 && (Qt[Zt] = _e(Zt)), Qt[Zt];
  };
}
var identifierWithPointTracking = function _e(Qt, Zt, $n) {
  for (var Sn = 0, kn = 0; Sn = kn, kn = peek$2(), Sn === 38 && kn === 12 && (Zt[$n] = 1), !token(kn); )
    next();
  return slice$3(Qt, position$2);
}, toRules = function _e(Qt, Zt) {
  var $n = -1, Sn = 44;
  do
    switch (token(Sn)) {
      case 0:
        Sn === 38 && peek$2() === 12 && (Zt[$n] = 1), Qt[$n] += identifierWithPointTracking(position$2 - 1, Zt, $n);
        break;
      case 2:
        Qt[$n] += delimit(Sn);
        break;
      case 4:
        if (Sn === 44) {
          Qt[++$n] = peek$2() === 58 ? "&\f" : "", Zt[$n] = Qt[$n].length;
          break;
        }
      default:
        Qt[$n] += from(Sn);
    }
  while (Sn = next());
  return Qt;
}, getRules = function _e(Qt, Zt) {
  return dealloc(toRules(alloc(Qt), Zt));
}, fixedElements = /* @__PURE__ */ new WeakMap(), compat = function _e(Qt) {
  if (!(Qt.type !== "rule" || !Qt.parent || // positive .length indicates that this rule contains pseudo
  // negative .length indicates that this rule has been already prefixed
  Qt.length < 1)) {
    for (var Zt = Qt.value, $n = Qt.parent, Sn = Qt.column === $n.column && Qt.line === $n.line; $n.type !== "rule"; )
      if ($n = $n.parent, !$n)
        return;
    if (!(Qt.props.length === 1 && Zt.charCodeAt(0) !== 58 && !fixedElements.get($n)) && !Sn) {
      fixedElements.set(Qt, !0);
      for (var kn = [], Kn = getRules(Zt, kn), er = $n.props, Cr = 0, kr = 0; Cr < Kn.length; Cr++)
        for (var Yr = 0; Yr < er.length; Yr++, kr++)
          Qt.props[kr] = kn[Cr] ? Kn[Cr].replace(/&\f/g, er[Yr]) : er[Yr] + " " + Kn[Cr];
    }
  }
}, removeLabel = function _e(Qt) {
  if (Qt.type === "decl") {
    var Zt = Qt.value;
    // charcode for l
    Zt.charCodeAt(0) === 108 && // charcode for b
    Zt.charCodeAt(2) === 98 && (Qt.return = "", Qt.value = "");
  }
};
function prefix$3(_e, Qt) {
  switch (hash$1(_e, Qt)) {
    case 5103:
      return WEBKIT + "print-" + _e + _e;
    case 5737:
    case 4201:
    case 3177:
    case 3433:
    case 1641:
    case 4457:
    case 2921:
    case 5572:
    case 6356:
    case 5844:
    case 3191:
    case 6645:
    case 3005:
    case 6391:
    case 5879:
    case 5623:
    case 6135:
    case 4599:
    case 4855:
    case 4215:
    case 6389:
    case 5109:
    case 5365:
    case 5621:
    case 3829:
      return WEBKIT + _e + _e;
    case 5349:
    case 4246:
    case 4810:
    case 6968:
    case 2756:
      return WEBKIT + _e + MOZ + _e + MS + _e + _e;
    case 6828:
    case 4268:
      return WEBKIT + _e + MS + _e + _e;
    case 6165:
      return WEBKIT + _e + MS + "flex-" + _e + _e;
    case 5187:
      return WEBKIT + _e + replace$2(_e, /(\w+).+(:[^]+)/, WEBKIT + "box-$1$2" + MS + "flex-$1$2") + _e;
    case 5443:
      return WEBKIT + _e + MS + "flex-item-" + replace$2(_e, /flex-|-self/, "") + _e;
    case 4675:
      return WEBKIT + _e + MS + "flex-line-pack" + replace$2(_e, /align-content|flex-|-self/, "") + _e;
    case 5548:
      return WEBKIT + _e + MS + replace$2(_e, "shrink", "negative") + _e;
    case 5292:
      return WEBKIT + _e + MS + replace$2(_e, "basis", "preferred-size") + _e;
    case 6060:
      return WEBKIT + "box-" + replace$2(_e, "-grow", "") + WEBKIT + _e + MS + replace$2(_e, "grow", "positive") + _e;
    case 4554:
      return WEBKIT + replace$2(_e, /([^-])(transform)/g, "$1" + WEBKIT + "$2") + _e;
    case 6187:
      return replace$2(replace$2(replace$2(_e, /(zoom-|grab)/, WEBKIT + "$1"), /(image-set)/, WEBKIT + "$1"), _e, "") + _e;
    case 5495:
    case 3959:
      return replace$2(_e, /(image-set\([^]*)/, WEBKIT + "$1$`$1");
    case 4968:
      return replace$2(replace$2(_e, /(.+:)(flex-)?(.*)/, WEBKIT + "box-pack:$3" + MS + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + WEBKIT + _e + _e;
    case 4095:
    case 3583:
    case 4068:
    case 2532:
      return replace$2(_e, /(.+)-inline(.+)/, WEBKIT + "$1$2") + _e;
    case 8116:
    case 7059:
    case 5753:
    case 5535:
    case 5445:
    case 5701:
    case 4933:
    case 4677:
    case 5533:
    case 5789:
    case 5021:
    case 4765:
      if (strlen(_e) - 1 - Qt > 6)
        switch (charat(_e, Qt + 1)) {
          case 109:
            if (charat(_e, Qt + 4) !== 45)
              break;
          case 102:
            return replace$2(_e, /(.+:)(.+)-([^]+)/, "$1" + WEBKIT + "$2-$3$1" + MOZ + (charat(_e, Qt + 3) == 108 ? "$3" : "$2-$3")) + _e;
          case 115:
            return ~indexof$1(_e, "stretch") ? prefix$3(replace$2(_e, "stretch", "fill-available"), Qt) + _e : _e;
        }
      break;
    case 4949:
      if (charat(_e, Qt + 1) !== 115)
        break;
    case 6444:
      switch (charat(_e, strlen(_e) - 3 - (~indexof$1(_e, "!important") && 10))) {
        case 107:
          return replace$2(_e, ":", ":" + WEBKIT) + _e;
        case 101:
          return replace$2(_e, /(.+:)([^;!]+)(;|!.+)?/, "$1" + WEBKIT + (charat(_e, 14) === 45 ? "inline-" : "") + "box$3$1" + WEBKIT + "$2$3$1" + MS + "$2box$3") + _e;
      }
      break;
    case 5936:
      switch (charat(_e, Qt + 11)) {
        case 114:
          return WEBKIT + _e + MS + replace$2(_e, /[svh]\w+-[tblr]{2}/, "tb") + _e;
        case 108:
          return WEBKIT + _e + MS + replace$2(_e, /[svh]\w+-[tblr]{2}/, "tb-rl") + _e;
        case 45:
          return WEBKIT + _e + MS + replace$2(_e, /[svh]\w+-[tblr]{2}/, "lr") + _e;
      }
      return WEBKIT + _e + MS + _e + _e;
  }
  return _e;
}
var prefixer = function _e(Qt, Zt, $n, Sn) {
  if (Qt.length > -1 && !Qt.return)
    switch (Qt.type) {
      case DECLARATION:
        Qt.return = prefix$3(Qt.value, Qt.length);
        break;
      case KEYFRAMES:
        return serialize([copy$3(Qt, {
          value: replace$2(Qt.value, "@", "@" + WEBKIT)
        })], Sn);
      case RULESET:
        if (Qt.length)
          return combine$1(Qt.props, function(kn) {
            switch (match$1(kn, /(::plac\w+|:read-\w+)/)) {
              case ":read-only":
              case ":read-write":
                return serialize([copy$3(Qt, {
                  props: [replace$2(kn, /:(read-\w+)/, ":" + MOZ + "$1")]
                })], Sn);
              case "::placeholder":
                return serialize([copy$3(Qt, {
                  props: [replace$2(kn, /:(plac\w+)/, ":" + WEBKIT + "input-$1")]
                }), copy$3(Qt, {
                  props: [replace$2(kn, /:(plac\w+)/, ":" + MOZ + "$1")]
                }), copy$3(Qt, {
                  props: [replace$2(kn, /:(plac\w+)/, MS + "input-$1")]
                })], Sn);
            }
            return "";
          });
    }
}, defaultStylisPlugins = [prefixer], createCache = function _e(Qt) {
  var Zt = Qt.key;
  if (Zt === "css") {
    var $n = document.querySelectorAll("style[data-emotion]:not([data-s])");
    Array.prototype.forEach.call($n, function(zs) {
      var Fs = zs.getAttribute("data-emotion");
      Fs.indexOf(" ") !== -1 && (document.head.appendChild(zs), zs.setAttribute("data-s", ""));
    });
  }
  var Sn = Qt.stylisPlugins || defaultStylisPlugins, kn = {}, Kn, er = [];
  Kn = Qt.container || document.head, Array.prototype.forEach.call(
    // this means we will ignore elements which don't have a space in them which
    // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
    document.querySelectorAll('style[data-emotion^="' + Zt + ' "]'),
    function(zs) {
      for (var Fs = zs.getAttribute("data-emotion").split(" "), Bs = 1; Bs < Fs.length; Bs++)
        kn[Fs[Bs]] = !0;
      er.push(zs);
    }
  );
  var Cr, kr = [compat, removeLabel];
  {
    var Yr, Ms = [stringify$3, rulesheet(function(zs) {
      Yr.insert(zs);
    })], Ds = middleware(kr.concat(Sn, Ms)), Ls = function(Fs) {
      return serialize(compile$1(Fs), Ds);
    };
    Cr = function(Fs, Bs, Hs, Ws) {
      Yr = Hs, Ls(Fs ? Fs + "{" + Bs.styles + "}" : Bs.styles), Ws && (js.inserted[Bs.name] = !0);
    };
  }
  var js = {
    key: Zt,
    sheet: new StyleSheet({
      key: Zt,
      container: Kn,
      nonce: Qt.nonce,
      speedy: Qt.speedy,
      prepend: Qt.prepend,
      insertionPoint: Qt.insertionPoint
    }),
    nonce: Qt.nonce,
    inserted: kn,
    registered: {},
    insert: Cr
  };
  return js.sheet.hydrate(er), js;
};
function _extends$6() {
  return _extends$6 = Object.assign ? Object.assign.bind() : function(_e) {
    for (var Qt = 1; Qt < arguments.length; Qt++) {
      var Zt = arguments[Qt];
      for (var $n in Zt)
        Object.prototype.hasOwnProperty.call(Zt, $n) && (_e[$n] = Zt[$n]);
    }
    return _e;
  }, _extends$6.apply(this, arguments);
}
var reactIs$1 = { exports: {} }, reactIs_production_min = {};
/** @license React v16.13.1
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var b$1 = typeof Symbol == "function" && Symbol.for, c$2 = b$1 ? Symbol.for("react.element") : 60103, d = b$1 ? Symbol.for("react.portal") : 60106, e$2 = b$1 ? Symbol.for("react.fragment") : 60107, f = b$1 ? Symbol.for("react.strict_mode") : 60108, g = b$1 ? Symbol.for("react.profiler") : 60114, h$3 = b$1 ? Symbol.for("react.provider") : 60109, k$1 = b$1 ? Symbol.for("react.context") : 60110, l$1 = b$1 ? Symbol.for("react.async_mode") : 60111, m$3 = b$1 ? Symbol.for("react.concurrent_mode") : 60111, n$2 = b$1 ? Symbol.for("react.forward_ref") : 60112, p$2 = b$1 ? Symbol.for("react.suspense") : 60113, q$2 = b$1 ? Symbol.for("react.suspense_list") : 60120, r$2 = b$1 ? Symbol.for("react.memo") : 60115, t$3 = b$1 ? Symbol.for("react.lazy") : 60116, v$1 = b$1 ? Symbol.for("react.block") : 60121, w$3 = b$1 ? Symbol.for("react.fundamental") : 60117, x$4 = b$1 ? Symbol.for("react.responder") : 60118, y$4 = b$1 ? Symbol.for("react.scope") : 60119;
function z(_e) {
  if (typeof _e == "object" && _e !== null) {
    var Qt = _e.$$typeof;
    switch (Qt) {
      case c$2:
        switch (_e = _e.type, _e) {
          case l$1:
          case m$3:
          case e$2:
          case g:
          case f:
          case p$2:
            return _e;
          default:
            switch (_e = _e && _e.$$typeof, _e) {
              case k$1:
              case n$2:
              case t$3:
              case r$2:
              case h$3:
                return _e;
              default:
                return Qt;
            }
        }
      case d:
        return Qt;
    }
  }
}
function A$1(_e) {
  return z(_e) === m$3;
}
reactIs_production_min.AsyncMode = l$1;
reactIs_production_min.ConcurrentMode = m$3;
reactIs_production_min.ContextConsumer = k$1;
reactIs_production_min.ContextProvider = h$3;
reactIs_production_min.Element = c$2;
reactIs_production_min.ForwardRef = n$2;
reactIs_production_min.Fragment = e$2;
reactIs_production_min.Lazy = t$3;
reactIs_production_min.Memo = r$2;
reactIs_production_min.Portal = d;
reactIs_production_min.Profiler = g;
reactIs_production_min.StrictMode = f;
reactIs_production_min.Suspense = p$2;
reactIs_production_min.isAsyncMode = function(_e) {
  return A$1(_e) || z(_e) === l$1;
};
reactIs_production_min.isConcurrentMode = A$1;
reactIs_production_min.isContextConsumer = function(_e) {
  return z(_e) === k$1;
};
reactIs_production_min.isContextProvider = function(_e) {
  return z(_e) === h$3;
};
reactIs_production_min.isElement = function(_e) {
  return typeof _e == "object" && _e !== null && _e.$$typeof === c$2;
};
reactIs_production_min.isForwardRef = function(_e) {
  return z(_e) === n$2;
};
reactIs_production_min.isFragment = function(_e) {
  return z(_e) === e$2;
};
reactIs_production_min.isLazy = function(_e) {
  return z(_e) === t$3;
};
reactIs_production_min.isMemo = function(_e) {
  return z(_e) === r$2;
};
reactIs_production_min.isPortal = function(_e) {
  return z(_e) === d;
};
reactIs_production_min.isProfiler = function(_e) {
  return z(_e) === g;
};
reactIs_production_min.isStrictMode = function(_e) {
  return z(_e) === f;
};
reactIs_production_min.isSuspense = function(_e) {
  return z(_e) === p$2;
};
reactIs_production_min.isValidElementType = function(_e) {
  return typeof _e == "string" || typeof _e == "function" || _e === e$2 || _e === m$3 || _e === g || _e === f || _e === p$2 || _e === q$2 || typeof _e == "object" && _e !== null && (_e.$$typeof === t$3 || _e.$$typeof === r$2 || _e.$$typeof === h$3 || _e.$$typeof === k$1 || _e.$$typeof === n$2 || _e.$$typeof === w$3 || _e.$$typeof === x$4 || _e.$$typeof === y$4 || _e.$$typeof === v$1);
};
reactIs_production_min.typeOf = z;
reactIs$1.exports = reactIs_production_min;
var reactIsExports = reactIs$1.exports, reactIs = reactIsExports, REACT_STATICS = {
  childContextTypes: !0,
  contextType: !0,
  contextTypes: !0,
  defaultProps: !0,
  displayName: !0,
  getDefaultProps: !0,
  getDerivedStateFromError: !0,
  getDerivedStateFromProps: !0,
  mixins: !0,
  propTypes: !0,
  type: !0
}, KNOWN_STATICS = {
  name: !0,
  length: !0,
  prototype: !0,
  caller: !0,
  callee: !0,
  arguments: !0,
  arity: !0
}, FORWARD_REF_STATICS = {
  $$typeof: !0,
  render: !0,
  defaultProps: !0,
  displayName: !0,
  propTypes: !0
}, MEMO_STATICS = {
  $$typeof: !0,
  compare: !0,
  defaultProps: !0,
  displayName: !0,
  propTypes: !0,
  type: !0
}, TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
function getStatics(_e) {
  return reactIs.isMemo(_e) ? MEMO_STATICS : TYPE_STATICS[_e.$$typeof] || REACT_STATICS;
}
var defineProperty = Object.defineProperty, getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, getPrototypeOf = Object.getPrototypeOf, objectPrototype = Object.prototype;
function hoistNonReactStatics(_e, Qt, Zt) {
  if (typeof Qt != "string") {
    if (objectPrototype) {
      var $n = getPrototypeOf(Qt);
      $n && $n !== objectPrototype && hoistNonReactStatics(_e, $n, Zt);
    }
    var Sn = getOwnPropertyNames(Qt);
    getOwnPropertySymbols && (Sn = Sn.concat(getOwnPropertySymbols(Qt)));
    for (var kn = getStatics(_e), Kn = getStatics(Qt), er = 0; er < Sn.length; ++er) {
      var Cr = Sn[er];
      if (!KNOWN_STATICS[Cr] && !(Zt && Zt[Cr]) && !(Kn && Kn[Cr]) && !(kn && kn[Cr])) {
        var kr = getOwnPropertyDescriptor(Qt, Cr);
        try {
          defineProperty(_e, Cr, kr);
        } catch {
        }
      }
    }
  }
  return _e;
}
var hoistNonReactStatics_cjs = hoistNonReactStatics;
const hoistStatics = /* @__PURE__ */ getDefaultExportFromCjs$1(hoistNonReactStatics_cjs);
var isBrowser = !0;
function getRegisteredStyles(_e, Qt, Zt) {
  var $n = "";
  return Zt.split(" ").forEach(function(Sn) {
    _e[Sn] !== void 0 ? Qt.push(_e[Sn] + ";") : $n += Sn + " ";
  }), $n;
}
var registerStyles = function _e(Qt, Zt, $n) {
  var Sn = Qt.key + "-" + Zt.name;
  // we only need to add the styles to the registered cache if the
  // class name could be used further down
  // the tree but if it's a string tag, we know it won't
  // so we don't have to add it to registered cache.
  // this improves memory usage since we can avoid storing the whole style string
  ($n === !1 || // we need to always store it if we're in compat mode and
  // in node since emotion-server relies on whether a style is in
  // the registered cache to know whether a style is global or not
  // also, note that this check will be dead code eliminated in the browser
  isBrowser === !1) && Qt.registered[Sn] === void 0 && (Qt.registered[Sn] = Zt.styles);
}, insertStyles = function _e(Qt, Zt, $n) {
  registerStyles(Qt, Zt, $n);
  var Sn = Qt.key + "-" + Zt.name;
  if (Qt.inserted[Zt.name] === void 0) {
    var kn = Zt;
    do
      Qt.insert(Zt === kn ? "." + Sn : "", kn, Qt.sheet, !0), kn = kn.next;
    while (kn !== void 0);
  }
};
function murmur2(_e) {
  for (var Qt = 0, Zt, $n = 0, Sn = _e.length; Sn >= 4; ++$n, Sn -= 4)
    Zt = _e.charCodeAt($n) & 255 | (_e.charCodeAt(++$n) & 255) << 8 | (_e.charCodeAt(++$n) & 255) << 16 | (_e.charCodeAt(++$n) & 255) << 24, Zt = /* Math.imul(k, m): */
    (Zt & 65535) * 1540483477 + ((Zt >>> 16) * 59797 << 16), Zt ^= /* k >>> r: */
    Zt >>> 24, Qt = /* Math.imul(k, m): */
    (Zt & 65535) * 1540483477 + ((Zt >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
    (Qt & 65535) * 1540483477 + ((Qt >>> 16) * 59797 << 16);
  switch (Sn) {
    case 3:
      Qt ^= (_e.charCodeAt($n + 2) & 255) << 16;
    case 2:
      Qt ^= (_e.charCodeAt($n + 1) & 255) << 8;
    case 1:
      Qt ^= _e.charCodeAt($n) & 255, Qt = /* Math.imul(h, m): */
      (Qt & 65535) * 1540483477 + ((Qt >>> 16) * 59797 << 16);
  }
  return Qt ^= Qt >>> 13, Qt = /* Math.imul(h, m): */
  (Qt & 65535) * 1540483477 + ((Qt >>> 16) * 59797 << 16), ((Qt ^ Qt >>> 15) >>> 0).toString(36);
}
var unitlessKeys = {
  animationIterationCount: 1,
  aspectRatio: 1,
  borderImageOutset: 1,
  borderImageSlice: 1,
  borderImageWidth: 1,
  boxFlex: 1,
  boxFlexGroup: 1,
  boxOrdinalGroup: 1,
  columnCount: 1,
  columns: 1,
  flex: 1,
  flexGrow: 1,
  flexPositive: 1,
  flexShrink: 1,
  flexNegative: 1,
  flexOrder: 1,
  gridRow: 1,
  gridRowEnd: 1,
  gridRowSpan: 1,
  gridRowStart: 1,
  gridColumn: 1,
  gridColumnEnd: 1,
  gridColumnSpan: 1,
  gridColumnStart: 1,
  msGridRow: 1,
  msGridRowSpan: 1,
  msGridColumn: 1,
  msGridColumnSpan: 1,
  fontWeight: 1,
  lineHeight: 1,
  opacity: 1,
  order: 1,
  orphans: 1,
  tabSize: 1,
  widows: 1,
  zIndex: 1,
  zoom: 1,
  WebkitLineClamp: 1,
  // SVG-related properties
  fillOpacity: 1,
  floodOpacity: 1,
  stopOpacity: 1,
  strokeDasharray: 1,
  strokeDashoffset: 1,
  strokeMiterlimit: 1,
  strokeOpacity: 1,
  strokeWidth: 1
}, hyphenateRegex = /[A-Z]|^ms/g, animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g, isCustomProperty = function _e(Qt) {
  return Qt.charCodeAt(1) === 45;
}, isProcessableValue = function _e(Qt) {
  return Qt != null && typeof Qt != "boolean";
}, processStyleName = /* @__PURE__ */ memoize$1(function(_e) {
  return isCustomProperty(_e) ? _e : _e.replace(hyphenateRegex, "-$&").toLowerCase();
}), processStyleValue = function _e(Qt, Zt) {
  switch (Qt) {
    case "animation":
    case "animationName":
      if (typeof Zt == "string")
        return Zt.replace(animationRegex, function($n, Sn, kn) {
          return cursor$2 = {
            name: Sn,
            styles: kn,
            next: cursor$2
          }, Sn;
        });
  }
  return unitlessKeys[Qt] !== 1 && !isCustomProperty(Qt) && typeof Zt == "number" && Zt !== 0 ? Zt + "px" : Zt;
}, noComponentSelectorMessage = "Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";
function handleInterpolation(_e, Qt, Zt) {
  if (Zt == null)
    return "";
  if (Zt.__emotion_styles !== void 0)
    return Zt;
  switch (typeof Zt) {
    case "boolean":
      return "";
    case "object": {
      if (Zt.anim === 1)
        return cursor$2 = {
          name: Zt.name,
          styles: Zt.styles,
          next: cursor$2
        }, Zt.name;
      if (Zt.styles !== void 0) {
        var $n = Zt.next;
        if ($n !== void 0)
          for (; $n !== void 0; )
            cursor$2 = {
              name: $n.name,
              styles: $n.styles,
              next: cursor$2
            }, $n = $n.next;
        var Sn = Zt.styles + ";";
        return Sn;
      }
      return createStringFromObject(_e, Qt, Zt);
    }
    case "function": {
      if (_e !== void 0) {
        var kn = cursor$2, Kn = Zt(_e);
        return cursor$2 = kn, handleInterpolation(_e, Qt, Kn);
      }
      break;
    }
  }
  if (Qt == null)
    return Zt;
  var er = Qt[Zt];
  return er !== void 0 ? er : Zt;
}
function createStringFromObject(_e, Qt, Zt) {
  var $n = "";
  if (Array.isArray(Zt))
    for (var Sn = 0; Sn < Zt.length; Sn++)
      $n += handleInterpolation(_e, Qt, Zt[Sn]) + ";";
  else
    for (var kn in Zt) {
      var Kn = Zt[kn];
      if (typeof Kn != "object")
        Qt != null && Qt[Kn] !== void 0 ? $n += kn + "{" + Qt[Kn] + "}" : isProcessableValue(Kn) && ($n += processStyleName(kn) + ":" + processStyleValue(kn, Kn) + ";");
      else if (Array.isArray(Kn) && typeof Kn[0] == "string" && (Qt == null || Qt[Kn[0]] === void 0))
        for (var er = 0; er < Kn.length; er++)
          isProcessableValue(Kn[er]) && ($n += processStyleName(kn) + ":" + processStyleValue(kn, Kn[er]) + ";");
      else {
        var Cr = handleInterpolation(_e, Qt, Kn);
        switch (kn) {
          case "animation":
          case "animationName": {
            $n += processStyleName(kn) + ":" + Cr + ";";
            break;
          }
          default:
            $n += kn + "{" + Cr + "}";
        }
      }
    }
  return $n;
}
var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g, cursor$2, serializeStyles = function _e(Qt, Zt, $n) {
  if (Qt.length === 1 && typeof Qt[0] == "object" && Qt[0] !== null && Qt[0].styles !== void 0)
    return Qt[0];
  var Sn = !0, kn = "";
  cursor$2 = void 0;
  var Kn = Qt[0];
  Kn == null || Kn.raw === void 0 ? (Sn = !1, kn += handleInterpolation($n, Zt, Kn)) : kn += Kn[0];
  for (var er = 1; er < Qt.length; er++)
    kn += handleInterpolation($n, Zt, Qt[er]), Sn && (kn += Kn[er]);
  labelPattern.lastIndex = 0;
  for (var Cr = "", kr; (kr = labelPattern.exec(kn)) !== null; )
    Cr += "-" + // $FlowFixMe we know it's not null
    kr[1];
  var Yr = murmur2(kn) + Cr;
  return {
    name: Yr,
    styles: kn,
    next: cursor$2
  };
};
function css() {
  for (var _e = arguments.length, Qt = new Array(_e), Zt = 0; Zt < _e; Zt++)
    Qt[Zt] = arguments[Zt];
  return serializeStyles(Qt);
}
var keyframes = function _e() {
  var Qt = css.apply(void 0, arguments), Zt = "animation-" + Qt.name;
  return {
    name: Zt,
    styles: "@keyframes " + Zt + "{" + Qt.styles + "}",
    anim: 1,
    toString: function() {
      return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
    }
  };
};
function filterProps(_e) {
  return Object.keys(_e).reduce((Qt, Zt) => (_e[Zt] !== void 0 && (Qt[Zt] = _e[Zt]), Qt), {});
}
var __defProp$2B = Object.defineProperty, __getOwnPropSymbols$2E = Object.getOwnPropertySymbols, __hasOwnProp$2E = Object.prototype.hasOwnProperty, __propIsEnum$2E = Object.prototype.propertyIsEnumerable, __defNormalProp$2B = (_e, Qt, Zt) => Qt in _e ? __defProp$2B(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2B = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2E.call(Qt, Zt) && __defNormalProp$2B(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2E)
    for (var Zt of __getOwnPropSymbols$2E(Qt))
      __propIsEnum$2E.call(Qt, Zt) && __defNormalProp$2B(_e, Zt, Qt[Zt]);
  return _e;
};
const MantineProviderContext = reactExports.createContext({
  theme: DEFAULT_THEME
});
function useMantineTheme() {
  var _e;
  return ((_e = reactExports.useContext(MantineProviderContext)) == null ? void 0 : _e.theme) || DEFAULT_THEME;
}
function useMantineProviderStyles(_e) {
  const Qt = useMantineTheme(), Zt = ($n) => {
    var Sn, kn, Kn, er;
    return {
      styles: ((Sn = Qt.components[$n]) == null ? void 0 : Sn.styles) || {},
      classNames: ((kn = Qt.components[$n]) == null ? void 0 : kn.classNames) || {},
      variants: (Kn = Qt.components[$n]) == null ? void 0 : Kn.variants,
      sizes: (er = Qt.components[$n]) == null ? void 0 : er.sizes
    };
  };
  return Array.isArray(_e) ? _e.map(Zt) : [Zt(_e)];
}
function useMantineEmotionCache() {
  var _e;
  return (_e = reactExports.useContext(MantineProviderContext)) == null ? void 0 : _e.emotionCache;
}
function useComponentDefaultProps(_e, Qt, Zt) {
  var $n;
  const Sn = useMantineTheme(), kn = ($n = Sn.components[_e]) == null ? void 0 : $n.defaultProps, Kn = typeof kn == "function" ? kn(Sn) : kn;
  return __spreadValues$2B(__spreadValues$2B(__spreadValues$2B({}, Qt), Kn), filterProps(Zt));
}
const elevations = {
  app: 100,
  modal: 200,
  popover: 300,
  overlay: 400,
  max: 9999
};
function getDefaultZIndex(_e) {
  return elevations[_e];
}
function useGuaranteedMemo(_e, Qt) {
  const Zt = reactExports.useRef();
  return (!Zt.current || Qt.length !== Zt.current.prevDeps.length || Zt.current.prevDeps.map(($n, Sn) => $n === Qt[Sn]).indexOf(!1) >= 0) && (Zt.current = {
    v: _e(),
    prevDeps: [...Qt]
  }), Zt.current.v;
}
const defaultMantineEmotionCache = createCache({ key: "mantine", prepend: !0 });
function useEmotionCache() {
  return useMantineEmotionCache() || defaultMantineEmotionCache;
}
var __defProp$2A = Object.defineProperty, __getOwnPropSymbols$2D = Object.getOwnPropertySymbols, __hasOwnProp$2D = Object.prototype.hasOwnProperty, __propIsEnum$2D = Object.prototype.propertyIsEnumerable, __defNormalProp$2A = (_e, Qt, Zt) => Qt in _e ? __defProp$2A(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2A = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2D.call(Qt, Zt) && __defNormalProp$2A(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2D)
    for (var Zt of __getOwnPropSymbols$2D(Qt))
      __propIsEnum$2D.call(Qt, Zt) && __defNormalProp$2A(_e, Zt, Qt[Zt]);
  return _e;
};
const refPropertyName = "ref";
function getRef(_e) {
  let Qt;
  if (_e.length !== 1)
    return { args: _e, ref: Qt };
  const [Zt] = _e;
  if (!(Zt instanceof Object))
    return { args: _e, ref: Qt };
  if (!(refPropertyName in Zt))
    return { args: _e, ref: Qt };
  Qt = Zt[refPropertyName];
  const $n = __spreadValues$2A({}, Zt);
  return delete $n[refPropertyName], { args: [$n], ref: Qt };
}
const { cssFactory } = (() => {
  function _e(Zt, $n, Sn) {
    const kn = [], Kn = getRegisteredStyles(Zt, kn, Sn);
    return kn.length < 2 ? Sn : Kn + $n(kn);
  }
  function Qt(Zt) {
    const { cache: $n } = Zt, Sn = (...Kn) => {
      const { ref: er, args: Cr } = getRef(Kn), kr = serializeStyles(Cr, $n.registered);
      return insertStyles($n, kr, !1), `${$n.key}-${kr.name}${er === void 0 ? "" : ` ${er}`}`;
    };
    return { css: Sn, cx: (...Kn) => _e($n.registered, Sn, clsx(Kn)) };
  }
  return { cssFactory: Qt };
})();
function useCss() {
  const _e = useEmotionCache();
  return useGuaranteedMemo(() => cssFactory({ cache: _e }), [_e]);
}
function mergeClassNames({
  cx: _e,
  classes: Qt,
  context: Zt,
  classNames: $n,
  name: Sn,
  cache: kn
}) {
  const Kn = Zt.reduce((er, Cr) => (Object.keys(Cr.classNames).forEach((kr) => {
    typeof er[kr] != "string" ? er[kr] = `${Cr.classNames[kr]}` : er[kr] = `${er[kr]} ${Cr.classNames[kr]}`;
  }), er), {});
  return Object.keys(Qt).reduce((er, Cr) => (er[Cr] = _e(Qt[Cr], Kn[Cr], $n != null && $n[Cr], Array.isArray(Sn) ? Sn.filter(Boolean).map((kr) => `${(kn == null ? void 0 : kn.key) || "mantine"}-${kr}-${Cr}`).join(" ") : Sn ? `${(kn == null ? void 0 : kn.key) || "mantine"}-${Sn}-${Cr}` : null), er), {});
}
var __defProp$2z = Object.defineProperty, __getOwnPropSymbols$2C = Object.getOwnPropertySymbols, __hasOwnProp$2C = Object.prototype.hasOwnProperty, __propIsEnum$2C = Object.prototype.propertyIsEnumerable, __defNormalProp$2z = (_e, Qt, Zt) => Qt in _e ? __defProp$2z(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2z = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2C.call(Qt, Zt) && __defNormalProp$2z(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2C)
    for (var Zt of __getOwnPropSymbols$2C(Qt))
      __propIsEnum$2C.call(Qt, Zt) && __defNormalProp$2z(_e, Zt, Qt[Zt]);
  return _e;
};
function assignAccStyles(_e, Qt) {
  return Qt && Object.keys(Qt).forEach((Zt) => {
    _e[Zt] ? _e[Zt] = __spreadValues$2z(__spreadValues$2z({}, _e[Zt]), Qt[Zt]) : _e[Zt] = __spreadValues$2z({}, Qt[Zt]);
  }), _e;
}
function getStyles$3(_e, Qt, Zt, $n) {
  const Sn = (kn) => typeof kn == "function" ? kn(Qt, Zt || {}, $n) : kn || {};
  return Array.isArray(_e) ? _e.map((kn) => Sn(kn.styles)).reduce((kn, Kn) => assignAccStyles(kn, Kn), {}) : Sn(_e);
}
function getContextVariation({ ctx: _e, theme: Qt, params: Zt, variant: $n, size: Sn }) {
  return _e.reduce((kn, Kn) => (Kn.variants && $n in Kn.variants && assignAccStyles(kn, Kn.variants[$n](Qt, Zt, { variant: $n, size: Sn })), Kn.sizes && Sn in Kn.sizes && assignAccStyles(kn, Kn.sizes[Sn](Qt, Zt, { variant: $n, size: Sn })), kn), {});
}
function createStyles(_e) {
  const Qt = typeof _e == "function" ? _e : () => _e;
  function Zt($n, Sn) {
    const kn = useMantineTheme(), Kn = useMantineProviderStyles(Sn == null ? void 0 : Sn.name), er = useMantineEmotionCache(), Cr = { variant: Sn == null ? void 0 : Sn.variant, size: Sn == null ? void 0 : Sn.size }, { css: kr, cx: Yr } = useCss(), Ms = Qt(kn, $n, Cr), Ds = getStyles$3(Sn == null ? void 0 : Sn.styles, kn, $n, Cr), Ls = getStyles$3(Kn, kn, $n, Cr), js = getContextVariation({
      ctx: Kn,
      theme: kn,
      params: $n,
      variant: Sn == null ? void 0 : Sn.variant,
      size: Sn == null ? void 0 : Sn.size
    }), zs = Object.fromEntries(Object.keys(Ms).map((Fs) => {
      const Bs = Yr({ [kr(Ms[Fs])]: !(Sn != null && Sn.unstyled) }, kr(js[Fs]), kr(Ls[Fs]), kr(Ds[Fs]));
      return [Fs, Bs];
    }));
    return {
      classes: mergeClassNames({
        cx: Yr,
        classes: zs,
        context: Kn,
        classNames: Sn == null ? void 0 : Sn.classNames,
        name: Sn == null ? void 0 : Sn.name,
        cache: er
      }),
      cx: Yr,
      theme: kn
    };
  }
  return Zt;
}
function getStylesRef(_e) {
  return `___ref-${_e || ""}`;
}
var __defProp$2y = Object.defineProperty, __defProps$1h = Object.defineProperties, __getOwnPropDescs$1h = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2B = Object.getOwnPropertySymbols, __hasOwnProp$2B = Object.prototype.hasOwnProperty, __propIsEnum$2B = Object.prototype.propertyIsEnumerable, __defNormalProp$2y = (_e, Qt, Zt) => Qt in _e ? __defProp$2y(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2y = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2B.call(Qt, Zt) && __defNormalProp$2y(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2B)
    for (var Zt of __getOwnPropSymbols$2B(Qt))
      __propIsEnum$2B.call(Qt, Zt) && __defNormalProp$2y(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$1h = (_e, Qt) => __defProps$1h(_e, __getOwnPropDescs$1h(Qt));
const popIn = {
  in: { opacity: 1, transform: "scale(1)" },
  out: { opacity: 0, transform: `scale(.9) translateY(${rem$1(10)})` },
  transitionProperty: "transform, opacity"
}, transitions$1 = {
  fade: {
    in: { opacity: 1 },
    out: { opacity: 0 },
    transitionProperty: "opacity"
  },
  scale: {
    in: { opacity: 1, transform: "scale(1)" },
    out: { opacity: 0, transform: "scale(0)" },
    common: { transformOrigin: "top" },
    transitionProperty: "transform, opacity"
  },
  "scale-y": {
    in: { opacity: 1, transform: "scaleY(1)" },
    out: { opacity: 0, transform: "scaleY(0)" },
    common: { transformOrigin: "top" },
    transitionProperty: "transform, opacity"
  },
  "scale-x": {
    in: { opacity: 1, transform: "scaleX(1)" },
    out: { opacity: 0, transform: "scaleX(0)" },
    common: { transformOrigin: "left" },
    transitionProperty: "transform, opacity"
  },
  "skew-up": {
    in: { opacity: 1, transform: "translateY(0) skew(0deg, 0deg)" },
    out: { opacity: 0, transform: `translateY(-${rem$1(20)}) skew(-10deg, -5deg)` },
    common: { transformOrigin: "top" },
    transitionProperty: "transform, opacity"
  },
  "skew-down": {
    in: { opacity: 1, transform: "translateY(0) skew(0deg, 0deg)" },
    out: { opacity: 0, transform: `translateY(${rem$1(20)}) skew(-10deg, -5deg)` },
    common: { transformOrigin: "bottom" },
    transitionProperty: "transform, opacity"
  },
  "rotate-left": {
    in: { opacity: 1, transform: "translateY(0) rotate(0deg)" },
    out: { opacity: 0, transform: `translateY(${rem$1(20)}) rotate(-5deg)` },
    common: { transformOrigin: "bottom" },
    transitionProperty: "transform, opacity"
  },
  "rotate-right": {
    in: { opacity: 1, transform: "translateY(0) rotate(0deg)" },
    out: { opacity: 0, transform: `translateY(${rem$1(20)}) rotate(5deg)` },
    common: { transformOrigin: "top" },
    transitionProperty: "transform, opacity"
  },
  "slide-down": {
    in: { opacity: 1, transform: "translateY(0)" },
    out: { opacity: 0, transform: "translateY(-100%)" },
    common: { transformOrigin: "top" },
    transitionProperty: "transform, opacity"
  },
  "slide-up": {
    in: { opacity: 1, transform: "translateY(0)" },
    out: { opacity: 0, transform: "translateY(100%)" },
    common: { transformOrigin: "bottom" },
    transitionProperty: "transform, opacity"
  },
  "slide-left": {
    in: { opacity: 1, transform: "translateX(0)" },
    out: { opacity: 0, transform: "translateX(100%)" },
    common: { transformOrigin: "left" },
    transitionProperty: "transform, opacity"
  },
  "slide-right": {
    in: { opacity: 1, transform: "translateX(0)" },
    out: { opacity: 0, transform: "translateX(-100%)" },
    common: { transformOrigin: "right" },
    transitionProperty: "transform, opacity"
  },
  pop: __spreadProps$1h(__spreadValues$2y({}, popIn), {
    common: { transformOrigin: "center center" }
  }),
  "pop-bottom-left": __spreadProps$1h(__spreadValues$2y({}, popIn), {
    common: { transformOrigin: "bottom left" }
  }),
  "pop-bottom-right": __spreadProps$1h(__spreadValues$2y({}, popIn), {
    common: { transformOrigin: "bottom right" }
  }),
  "pop-top-left": __spreadProps$1h(__spreadValues$2y({}, popIn), {
    common: { transformOrigin: "top left" }
  }),
  "pop-top-right": __spreadProps$1h(__spreadValues$2y({}, popIn), {
    common: { transformOrigin: "top right" }
  })
}, DEFAULT_EVENTS = ["mousedown", "touchstart"];
function useClickOutside(_e, Qt, Zt) {
  const $n = reactExports.useRef();
  return reactExports.useEffect(() => {
    const Sn = (kn) => {
      const { target: Kn } = kn ?? {};
      if (Array.isArray(Zt)) {
        const er = (Kn == null ? void 0 : Kn.hasAttribute("data-ignore-outside-clicks")) || !document.body.contains(Kn) && Kn.tagName !== "HTML";
        Zt.every((kr) => !!kr && !kn.composedPath().includes(kr)) && !er && _e();
      } else
        $n.current && !$n.current.contains(Kn) && _e();
    };
    return (Qt || DEFAULT_EVENTS).forEach((kn) => document.addEventListener(kn, Sn)), () => {
      (Qt || DEFAULT_EVENTS).forEach((kn) => document.removeEventListener(kn, Sn));
    };
  }, [$n, _e, Zt]), $n;
}
function useClipboard({ timeout: _e = 2e3 } = {}) {
  const [Qt, Zt] = reactExports.useState(null), [$n, Sn] = reactExports.useState(!1), [kn, Kn] = reactExports.useState(null), er = (Yr) => {
    clearTimeout(kn), Kn(setTimeout(() => Sn(!1), _e)), Sn(Yr);
  };
  return { copy: (Yr) => {
    "clipboard" in navigator ? navigator.clipboard.writeText(Yr).then(() => er(!0)).catch((Ms) => Zt(Ms)) : Zt(new Error("useClipboard: navigator.clipboard is not supported"));
  }, reset: () => {
    Sn(!1), Zt(null), clearTimeout(kn);
  }, error: Qt, copied: $n };
}
function attachMediaListener(_e, Qt) {
  try {
    return _e.addEventListener("change", Qt), () => _e.removeEventListener("change", Qt);
  } catch {
    return _e.addListener(Qt), () => _e.removeListener(Qt);
  }
}
function getInitialValue(_e, Qt) {
  return typeof Qt == "boolean" ? Qt : typeof window < "u" && "matchMedia" in window ? window.matchMedia(_e).matches : !1;
}
function useMediaQuery(_e, Qt, { getInitialValueInEffect: Zt } = {
  getInitialValueInEffect: !0
}) {
  const [$n, Sn] = reactExports.useState(Zt ? Qt : getInitialValue(_e, Qt)), kn = reactExports.useRef();
  return reactExports.useEffect(() => {
    if ("matchMedia" in window)
      return kn.current = window.matchMedia(_e), Sn(kn.current.matches), attachMediaListener(kn.current, (Kn) => Sn(Kn.matches));
  }, [_e]), $n;
}
function clamp$2(_e, Qt, Zt) {
  return Math.min(Math.max(_e, Qt), Zt);
}
function useDebouncedValue(_e, Qt, Zt = { leading: !1 }) {
  const [$n, Sn] = reactExports.useState(_e), kn = reactExports.useRef(!1), Kn = reactExports.useRef(null), er = reactExports.useRef(!1), Cr = () => window.clearTimeout(Kn.current);
  return reactExports.useEffect(() => {
    kn.current && (!er.current && Zt.leading ? (er.current = !0, Sn(_e)) : (Cr(), Kn.current = window.setTimeout(() => {
      er.current = !1, Sn(_e);
    }, Qt)));
  }, [_e, Zt.leading, Qt]), reactExports.useEffect(() => (kn.current = !0, Cr), []), [$n, Cr];
}
const useIsomorphicEffect = typeof document < "u" ? reactExports.useLayoutEffect : reactExports.useEffect;
function useDidUpdate(_e, Qt) {
  const Zt = reactExports.useRef(!1);
  reactExports.useEffect(() => () => {
    Zt.current = !1;
  }, []), reactExports.useEffect(() => {
    if (Zt.current)
      return _e();
    Zt.current = !0;
  }, Qt);
}
function useFocusReturn({ opened: _e, shouldReturnFocus: Qt = !0 }) {
  const Zt = reactExports.useRef(), $n = () => {
    var Sn;
    Zt.current && "focus" in Zt.current && typeof Zt.current.focus == "function" && ((Sn = Zt.current) == null || Sn.focus({ preventScroll: !0 }));
  };
  return useDidUpdate(() => {
    let Sn = -1;
    const kn = (Kn) => {
      Kn.key === "Tab" && window.clearTimeout(Sn);
    };
    return document.addEventListener("keydown", kn), _e ? Zt.current = document.activeElement : Qt && (Sn = window.setTimeout($n, 10)), () => {
      window.clearTimeout(Sn), document.removeEventListener("keydown", kn);
    };
  }, [_e, Qt]), $n;
}
const TABBABLE_NODES = /input|select|textarea|button|object/, FOCUS_SELECTOR = "a, input, select, textarea, button, object, [tabindex]";
function hidden(_e) {
  return _e.style.display === "none";
}
function visible(_e) {
  if (_e.getAttribute("aria-hidden") || _e.getAttribute("hidden") || _e.getAttribute("type") === "hidden")
    return !1;
  let Zt = _e;
  for (; Zt && !(Zt === document.body || Zt.nodeType === 11); ) {
    if (hidden(Zt))
      return !1;
    Zt = Zt.parentNode;
  }
  return !0;
}
function getElementTabIndex(_e) {
  let Qt = _e.getAttribute("tabindex");
  return Qt === null && (Qt = void 0), parseInt(Qt, 10);
}
function focusable(_e) {
  const Qt = _e.nodeName.toLowerCase(), Zt = !Number.isNaN(getElementTabIndex(_e));
  return (TABBABLE_NODES.test(Qt) && !_e.disabled || _e instanceof HTMLAnchorElement && _e.href || Zt) && visible(_e);
}
function tabbable(_e) {
  const Qt = getElementTabIndex(_e);
  return (Number.isNaN(Qt) || Qt >= 0) && focusable(_e);
}
function findTabbableDescendants(_e) {
  return Array.from(_e.querySelectorAll(FOCUS_SELECTOR)).filter(tabbable);
}
function scopeTab(_e, Qt) {
  const Zt = findTabbableDescendants(_e);
  if (!Zt.length) {
    Qt.preventDefault();
    return;
  }
  const $n = Zt[Qt.shiftKey ? 0 : Zt.length - 1], Sn = _e.getRootNode();
  if (!($n === Sn.activeElement || _e === Sn.activeElement))
    return;
  Qt.preventDefault();
  const Kn = Zt[Qt.shiftKey ? Zt.length - 1 : 0];
  Kn && Kn.focus();
}
function randomId() {
  return `mantine-${Math.random().toString(36).slice(2, 11)}`;
}
function createAriaHider(_e, Qt = "body > :not(script)") {
  const Zt = randomId(), $n = Array.from(document.querySelectorAll(Qt)).map((Sn) => {
    var kn;
    if ((kn = Sn == null ? void 0 : Sn.shadowRoot) != null && kn.contains(_e) || Sn.contains(_e))
      return;
    const Kn = Sn.getAttribute("aria-hidden"), er = Sn.getAttribute("data-hidden"), Cr = Sn.getAttribute("data-focus-id");
    return Sn.setAttribute("data-focus-id", Zt), Kn === null || Kn === "false" ? Sn.setAttribute("aria-hidden", "true") : !er && !Cr && Sn.setAttribute("data-hidden", Kn), {
      node: Sn,
      ariaHidden: er || null
    };
  });
  return () => {
    $n.forEach((Sn) => {
      !Sn || Zt !== Sn.node.getAttribute("data-focus-id") || (Sn.ariaHidden === null ? Sn.node.removeAttribute("aria-hidden") : Sn.node.setAttribute("aria-hidden", Sn.ariaHidden), Sn.node.removeAttribute("data-focus-id"), Sn.node.removeAttribute("data-hidden"));
    });
  };
}
function useFocusTrap(_e = !0) {
  const Qt = reactExports.useRef(), Zt = reactExports.useRef(null), $n = (kn) => {
    let Kn = kn.querySelector("[data-autofocus]");
    if (!Kn) {
      const er = Array.from(kn.querySelectorAll(FOCUS_SELECTOR));
      Kn = er.find(tabbable) || er.find(focusable) || null, !Kn && focusable(kn) && (Kn = kn);
    }
    Kn && Kn.focus({ preventScroll: !0 });
  }, Sn = reactExports.useCallback((kn) => {
    if (_e) {
      if (kn === null) {
        Zt.current && (Zt.current(), Zt.current = null);
        return;
      }
      Zt.current = createAriaHider(kn), Qt.current !== kn && (kn ? (setTimeout(() => {
        kn.getRootNode() && $n(kn);
      }), Qt.current = kn) : Qt.current = null);
    }
  }, [_e]);
  return reactExports.useEffect(() => {
    if (!_e)
      return;
    Qt.current && setTimeout(() => $n(Qt.current));
    const kn = (Kn) => {
      Kn.key === "Tab" && Qt.current && scopeTab(Qt.current, Kn);
    };
    return document.addEventListener("keydown", kn), () => {
      document.removeEventListener("keydown", kn), Zt.current && Zt.current();
    };
  }, [_e]), Sn;
}
const __useId = React["useId".toString()] || (() => {
});
function useReactId$1() {
  const _e = __useId();
  return _e ? `mantine-${_e.replace(/:/g, "")}` : "";
}
function useId$1(_e) {
  const Qt = useReactId$1(), [Zt, $n] = reactExports.useState(Qt);
  return useIsomorphicEffect(() => {
    $n(randomId());
  }, []), typeof _e == "string" ? _e : typeof window > "u" ? Qt : Zt;
}
var __defProp$2x = Object.defineProperty, __defProps$1g = Object.defineProperties, __getOwnPropDescs$1g = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2A = Object.getOwnPropertySymbols, __hasOwnProp$2A = Object.prototype.hasOwnProperty, __propIsEnum$2A = Object.prototype.propertyIsEnumerable, __defNormalProp$2x = (_e, Qt, Zt) => Qt in _e ? __defProp$2x(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2x = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2A.call(Qt, Zt) && __defNormalProp$2x(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2A)
    for (var Zt of __getOwnPropSymbols$2A(Qt))
      __propIsEnum$2A.call(Qt, Zt) && __defNormalProp$2x(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$1g = (_e, Qt) => __defProps$1g(_e, __getOwnPropDescs$1g(Qt));
function useListState(_e = []) {
  const [Qt, Zt] = reactExports.useState(_e);
  return [
    Qt,
    {
      setState: Zt,
      append: (...zs) => Zt((Fs) => [...Fs, ...zs]),
      prepend: (...zs) => Zt((Fs) => [...zs, ...Fs]),
      insert: (zs, ...Fs) => Zt((Bs) => [...Bs.slice(0, zs), ...Fs, ...Bs.slice(zs)]),
      pop: () => Zt((zs) => {
        const Fs = [...zs];
        return Fs.pop(), Fs;
      }),
      shift: () => Zt((zs) => {
        const Fs = [...zs];
        return Fs.shift(), Fs;
      }),
      apply: (zs) => Zt((Fs) => Fs.map((Bs, Hs) => zs(Bs, Hs))),
      applyWhere: (zs, Fs) => Zt((Bs) => Bs.map((Hs, Ws) => zs(Hs, Ws) ? Fs(Hs, Ws) : Hs)),
      remove: (...zs) => Zt((Fs) => Fs.filter((Bs, Hs) => !zs.includes(Hs))),
      reorder: ({ from: zs, to: Fs }) => Zt((Bs) => {
        const Hs = [...Bs], Ws = Bs[zs];
        return Hs.splice(zs, 1), Hs.splice(Fs, 0, Ws), Hs;
      }),
      setItem: (zs, Fs) => Zt((Bs) => {
        const Hs = [...Bs];
        return Hs[zs] = Fs, Hs;
      }),
      setItemProp: (zs, Fs, Bs) => Zt((Hs) => {
        const Ws = [...Hs];
        return Ws[zs] = __spreadProps$1g(__spreadValues$2x({}, Ws[zs]), { [Fs]: Bs }), Ws;
      }),
      filter: (zs) => {
        Zt((Fs) => Fs.filter(zs));
      }
    }
  ];
}
function useWindowEvent(_e, Qt, Zt) {
  reactExports.useEffect(() => (window.addEventListener(_e, Qt, Zt), () => window.removeEventListener(_e, Qt, Zt)), [_e, Qt]);
}
function serializeJSON(_e, Qt) {
  try {
    return JSON.stringify(_e);
  } catch {
    throw new Error(`@mantine/hooks ${Qt}: Failed to serialize the value`);
  }
}
function deserializeJSON(_e) {
  try {
    return JSON.parse(_e);
  } catch {
    return _e;
  }
}
function createStorage(_e, Qt) {
  const Zt = _e === "localStorage" ? "mantine-local-storage" : "mantine-session-storage";
  return function({
    key: Sn,
    defaultValue: kn = void 0,
    getInitialValueInEffect: Kn = !0,
    deserialize: er = deserializeJSON,
    serialize: Cr = (kr) => serializeJSON(kr, Qt)
  }) {
    const kr = reactExports.useCallback((js) => {
      if (typeof window > "u" || !(_e in window) || window[_e] === null || js)
        return kn;
      const zs = window[_e].getItem(Sn);
      return zs !== null ? er(zs) : kn;
    }, [Sn, kn]), [Yr, Ms] = reactExports.useState(kr(Kn)), Ds = reactExports.useCallback((js) => {
      js instanceof Function ? Ms((zs) => {
        const Fs = js(zs);
        return window[_e].setItem(Sn, Cr(Fs)), window.dispatchEvent(new CustomEvent(Zt, { detail: { key: Sn, value: js(zs) } })), Fs;
      }) : (window[_e].setItem(Sn, Cr(js)), window.dispatchEvent(new CustomEvent(Zt, { detail: { key: Sn, value: js } })), Ms(js));
    }, [Sn]), Ls = reactExports.useCallback(() => {
      window[_e].removeItem(Sn), window.dispatchEvent(new CustomEvent(Zt, { detail: { key: Sn, value: kn } }));
    }, []);
    return useWindowEvent("storage", (js) => {
      var zs;
      js.storageArea === window[_e] && js.key === Sn && Ms(er((zs = js.newValue) != null ? zs : void 0));
    }), useWindowEvent(Zt, (js) => {
      js.detail.key === Sn && Ms(js.detail.value);
    }), reactExports.useEffect(() => {
      kn !== void 0 && Yr === void 0 && Ds(kn);
    }, [kn, Yr, Ds]), reactExports.useEffect(() => {
      Kn && Ms(kr());
    }, [Sn]), [
      Yr === void 0 ? kn : Yr,
      Ds,
      Ls
    ];
  };
}
function useLocalStorage(_e) {
  return createStorage("localStorage", "use-local-storage")(_e);
}
function useSessionStorage(_e) {
  return createStorage("sessionStorage", "use-session-storage")(_e);
}
function assignRef(_e, Qt) {
  typeof _e == "function" ? _e(Qt) : typeof _e == "object" && _e !== null && "current" in _e && (_e.current = Qt);
}
function mergeRefs(..._e) {
  return (Qt) => {
    _e.forEach((Zt) => assignRef(Zt, Qt));
  };
}
function useMergedRef(..._e) {
  return reactExports.useCallback(mergeRefs(..._e), _e);
}
function useMove(_e, Qt, Zt = "ltr") {
  const $n = reactExports.useRef(), Sn = reactExports.useRef(!1), kn = reactExports.useRef(!1), Kn = reactExports.useRef(0), [er, Cr] = reactExports.useState(!1);
  return reactExports.useEffect(() => {
    Sn.current = !0;
  }, []), reactExports.useEffect(() => {
    const kr = ({ x: Hs, y: Ws }) => {
      cancelAnimationFrame(Kn.current), Kn.current = requestAnimationFrame(() => {
        if (Sn.current && $n.current) {
          $n.current.style.userSelect = "none";
          const Ys = $n.current.getBoundingClientRect();
          if (Ys.width && Ys.height) {
            const El = clamp$2((Hs - Ys.left) / Ys.width, 0, 1);
            _e({
              x: Zt === "ltr" ? El : 1 - El,
              y: clamp$2((Ws - Ys.top) / Ys.height, 0, 1)
            });
          }
        }
      });
    }, Yr = () => {
      document.addEventListener("mousemove", zs), document.addEventListener("mouseup", Ls), document.addEventListener("touchmove", Bs), document.addEventListener("touchend", Ls);
    }, Ms = () => {
      document.removeEventListener("mousemove", zs), document.removeEventListener("mouseup", Ls), document.removeEventListener("touchmove", Bs), document.removeEventListener("touchend", Ls);
    }, Ds = () => {
      !kn.current && Sn.current && (kn.current = !0, typeof (Qt == null ? void 0 : Qt.onScrubStart) == "function" && Qt.onScrubStart(), Cr(!0), Yr());
    }, Ls = () => {
      kn.current && Sn.current && (kn.current = !1, Cr(!1), Ms(), setTimeout(() => {
        typeof (Qt == null ? void 0 : Qt.onScrubEnd) == "function" && Qt.onScrubEnd();
      }, 0));
    }, js = (Hs) => {
      Ds(), Hs.preventDefault(), zs(Hs);
    }, zs = (Hs) => kr({ x: Hs.clientX, y: Hs.clientY }), Fs = (Hs) => {
      Hs.cancelable && Hs.preventDefault(), Ds(), Bs(Hs);
    }, Bs = (Hs) => {
      Hs.cancelable && Hs.preventDefault(), kr({ x: Hs.changedTouches[0].clientX, y: Hs.changedTouches[0].clientY });
    };
    return $n.current.addEventListener("mousedown", js), $n.current.addEventListener("touchstart", Fs, { passive: !1 }), () => {
      $n.current && ($n.current.removeEventListener("mousedown", js), $n.current.removeEventListener("touchstart", Fs));
    };
  }, [Zt, _e]), { ref: $n, active: er };
}
function useUncontrolled({
  value: _e,
  defaultValue: Qt,
  finalValue: Zt,
  onChange: $n = () => {
  }
}) {
  const [Sn, kn] = reactExports.useState(Qt !== void 0 ? Qt : Zt), Kn = (er) => {
    kn(er), $n == null || $n(er);
  };
  return _e !== void 0 ? [_e, $n, !0] : [Sn, Kn, !1];
}
function range$6(_e, Qt) {
  const Zt = Qt - _e + 1;
  return Array.from({ length: Zt }, ($n, Sn) => Sn + _e);
}
const DOTS = "dots";
function usePagination({
  total: _e,
  siblings: Qt = 1,
  boundaries: Zt = 1,
  page: $n,
  initialPage: Sn = 1,
  onChange: kn
}) {
  const Kn = Math.max(Math.trunc(_e), 0), [er, Cr] = useUncontrolled({
    value: $n,
    onChange: kn,
    defaultValue: Sn,
    finalValue: Sn
  }), kr = (zs) => {
    zs <= 0 ? Cr(1) : zs > Kn ? Cr(Kn) : Cr(zs);
  }, Yr = () => kr(er + 1), Ms = () => kr(er - 1), Ds = () => kr(1), Ls = () => kr(Kn);
  return {
    range: reactExports.useMemo(() => {
      if (Qt * 2 + 3 + Zt * 2 >= Kn)
        return range$6(1, Kn);
      const Fs = Math.max(er - Qt, Zt), Bs = Math.min(er + Qt, Kn - Zt), Hs = Fs > Zt + 2, Ws = Bs < Kn - (Zt + 1);
      if (!Hs && Ws) {
        const Ys = Qt * 2 + Zt + 2;
        return [...range$6(1, Ys), DOTS, ...range$6(Kn - (Zt - 1), Kn)];
      }
      if (Hs && !Ws) {
        const Ys = Zt + 1 + 2 * Qt;
        return [...range$6(1, Zt), DOTS, ...range$6(Kn - Ys, Kn)];
      }
      return [
        ...range$6(1, Zt),
        DOTS,
        ...range$6(Fs, Bs),
        DOTS,
        ...range$6(Kn - Zt + 1, Kn)
      ];
    }, [Kn, Qt, er]),
    active: er,
    setPage: kr,
    next: Yr,
    previous: Ms,
    first: Ds,
    last: Ls
  };
}
function useReducedMotion(_e, Qt) {
  return useMediaQuery("(prefers-reduced-motion: reduce)", _e, Qt);
}
const easeInOutQuad = (_e) => _e < 0.5 ? 2 * _e * _e : -1 + (4 - 2 * _e) * _e, getRelativePosition = ({
  axis: _e,
  target: Qt,
  parent: Zt,
  alignment: $n,
  offset: Sn,
  isList: kn
}) => {
  if (!Qt || !Zt && typeof document > "u")
    return 0;
  const Kn = !!Zt, Cr = (Zt || document.body).getBoundingClientRect(), kr = Qt.getBoundingClientRect(), Yr = (Ms) => kr[Ms] - Cr[Ms];
  if (_e === "y") {
    const Ms = Yr("top");
    if (Ms === 0)
      return 0;
    if ($n === "start") {
      const Ls = Ms - Sn;
      return Ls <= kr.height * (kn ? 0 : 1) || !kn ? Ls : 0;
    }
    const Ds = Kn ? Cr.height : window.innerHeight;
    if ($n === "end") {
      const Ls = Ms + Sn - Ds + kr.height;
      return Ls >= -kr.height * (kn ? 0 : 1) || !kn ? Ls : 0;
    }
    return $n === "center" ? Ms - Ds / 2 + kr.height / 2 : 0;
  }
  if (_e === "x") {
    const Ms = Yr("left");
    if (Ms === 0)
      return 0;
    if ($n === "start") {
      const Ls = Ms - Sn;
      return Ls <= kr.width || !kn ? Ls : 0;
    }
    const Ds = Kn ? Cr.width : window.innerWidth;
    if ($n === "end") {
      const Ls = Ms + Sn - Ds + kr.width;
      return Ls >= -kr.width || !kn ? Ls : 0;
    }
    return $n === "center" ? Ms - Ds / 2 + kr.width / 2 : 0;
  }
  return 0;
}, getScrollStart = ({ axis: _e, parent: Qt }) => {
  if (!Qt && typeof document > "u")
    return 0;
  const Zt = _e === "y" ? "scrollTop" : "scrollLeft";
  if (Qt)
    return Qt[Zt];
  const { body: $n, documentElement: Sn } = document;
  return $n[Zt] + Sn[Zt];
}, setScrollParam = ({ axis: _e, parent: Qt, distance: Zt }) => {
  if (!Qt && typeof document > "u")
    return;
  const $n = _e === "y" ? "scrollTop" : "scrollLeft";
  if (Qt)
    Qt[$n] = Zt;
  else {
    const { body: Sn, documentElement: kn } = document;
    Sn[$n] = Zt, kn[$n] = Zt;
  }
};
function useScrollIntoView({
  duration: _e = 1250,
  axis: Qt = "y",
  onScrollFinish: Zt,
  easing: $n = easeInOutQuad,
  offset: Sn = 0,
  cancelable: kn = !0,
  isList: Kn = !1
} = {}) {
  const er = reactExports.useRef(0), Cr = reactExports.useRef(0), kr = reactExports.useRef(!1), Yr = reactExports.useRef(null), Ms = reactExports.useRef(null), Ds = useReducedMotion(), Ls = () => {
    er.current && cancelAnimationFrame(er.current);
  }, js = reactExports.useCallback(({ alignment: Fs = "start" } = {}) => {
    var Bs;
    kr.current = !1, er.current && Ls();
    const Hs = (Bs = getScrollStart({ parent: Yr.current, axis: Qt })) != null ? Bs : 0, Ws = getRelativePosition({
      parent: Yr.current,
      target: Ms.current,
      axis: Qt,
      alignment: Fs,
      offset: Sn,
      isList: Kn
    }) - (Yr.current ? 0 : Hs);
    function Ys() {
      Cr.current === 0 && (Cr.current = performance.now());
      const Mu = performance.now() - Cr.current, Pl = Ds || _e === 0 ? 1 : Mu / _e, Iu = Hs + Ws * $n(Pl);
      setScrollParam({
        parent: Yr.current,
        axis: Qt,
        distance: Iu
      }), !kr.current && Pl < 1 ? er.current = requestAnimationFrame(Ys) : (typeof Zt == "function" && Zt(), Cr.current = 0, er.current = 0, Ls());
    }
    Ys();
  }, [Qt, _e, $n, Kn, Sn, Zt, Ds]), zs = () => {
    kn && (kr.current = !0);
  };
  return useWindowEvent("wheel", zs, {
    passive: !0
  }), useWindowEvent("touchmove", zs, {
    passive: !0
  }), reactExports.useEffect(() => Ls, []), {
    scrollableRef: Yr,
    targetRef: Ms,
    scrollIntoView: js,
    cancel: Ls
  };
}
function useIntersection(_e) {
  const [Qt, Zt] = reactExports.useState(null), $n = reactExports.useRef();
  return { ref: reactExports.useCallback((kn) => {
    if ($n.current && ($n.current.disconnect(), $n.current = null), kn === null) {
      Zt(null);
      return;
    }
    $n.current = new IntersectionObserver(([Kn]) => {
      Zt(Kn);
    }, _e), $n.current.observe(kn);
  }, [_e == null ? void 0 : _e.rootMargin, _e == null ? void 0 : _e.root, _e == null ? void 0 : _e.threshold]), entry: Qt };
}
var __defProp$2w = Object.defineProperty, __defProps$1f = Object.defineProperties, __getOwnPropDescs$1f = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2z = Object.getOwnPropertySymbols, __hasOwnProp$2z = Object.prototype.hasOwnProperty, __propIsEnum$2z = Object.prototype.propertyIsEnumerable, __defNormalProp$2w = (_e, Qt, Zt) => Qt in _e ? __defProp$2w(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2w = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2z.call(Qt, Zt) && __defNormalProp$2w(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2z)
    for (var Zt of __getOwnPropSymbols$2z(Qt))
      __propIsEnum$2z.call(Qt, Zt) && __defNormalProp$2w(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$1f = (_e, Qt) => __defProps$1f(_e, __getOwnPropDescs$1f(Qt));
function parseHotkey(_e) {
  const Qt = _e.toLowerCase().split("+").map((kn) => kn.trim()), Zt = {
    alt: Qt.includes("alt"),
    ctrl: Qt.includes("ctrl"),
    meta: Qt.includes("meta"),
    mod: Qt.includes("mod"),
    shift: Qt.includes("shift")
  }, $n = ["alt", "ctrl", "meta", "shift", "mod"], Sn = Qt.find((kn) => !$n.includes(kn));
  return __spreadProps$1f(__spreadValues$2w({}, Zt), {
    key: Sn
  });
}
function isExactHotkey(_e, Qt) {
  const { alt: Zt, ctrl: $n, meta: Sn, mod: kn, shift: Kn, key: er } = _e, { altKey: Cr, ctrlKey: kr, metaKey: Yr, shiftKey: Ms, key: Ds } = Qt;
  if (Zt !== Cr)
    return !1;
  if (kn) {
    if (!kr && !Yr)
      return !1;
  } else if ($n !== kr || Sn !== Yr)
    return !1;
  return Kn !== Ms ? !1 : !!(er && (Ds.toLowerCase() === er.toLowerCase() || Qt.code.replace("Key", "").toLowerCase() === er.toLowerCase()));
}
function getHotkeyMatcher(_e) {
  return (Qt) => isExactHotkey(parseHotkey(_e), Qt);
}
function getHotkeyHandler(_e) {
  return (Qt) => {
    const Zt = "nativeEvent" in Qt ? Qt.nativeEvent : Qt;
    _e.forEach(([$n, Sn, kn = { preventDefault: !0 }]) => {
      getHotkeyMatcher($n)(Zt) && (kn.preventDefault && Qt.preventDefault(), Sn(Zt));
    });
  };
}
function useValidatedState(_e, Qt, Zt) {
  const [$n, Sn] = reactExports.useState(_e), [kn, Kn] = reactExports.useState(Qt(_e) ? _e : void 0), [er, Cr] = reactExports.useState(typeof Zt == "boolean" ? Zt : Qt(_e));
  return [{ value: $n, lastValidValue: kn, valid: er }, (Yr) => {
    Qt(Yr) ? (Kn(Yr), Cr(!0)) : Cr(!1), Sn(Yr);
  }];
}
function getInputOnChange(_e) {
  return (Qt) => {
    if (!Qt)
      _e(Qt);
    else if (typeof Qt == "function")
      _e(Qt);
    else if (typeof Qt == "object" && "nativeEvent" in Qt) {
      const { currentTarget: Zt } = Qt;
      Zt.type === "checkbox" ? _e(Zt.checked) : _e(Zt.value);
    } else
      _e(Qt);
  };
}
function useInputState(_e) {
  const [Qt, Zt] = reactExports.useState(_e);
  return [Qt, getInputOnChange(Zt)];
}
function useDisclosure(_e = !1, Qt) {
  const { onOpen: Zt, onClose: $n } = Qt || {}, [Sn, kn] = reactExports.useState(_e), Kn = reactExports.useCallback(() => {
    kn((kr) => kr || (Zt == null || Zt(), !0));
  }, [Zt]), er = reactExports.useCallback(() => {
    kn((kr) => kr && ($n == null || $n(), !1));
  }, [$n]), Cr = reactExports.useCallback(() => {
    Sn ? er() : Kn();
  }, [er, Kn, Sn]);
  return [Sn, { open: Kn, close: er, toggle: Cr }];
}
var __getOwnPropSymbols$2y = Object.getOwnPropertySymbols, __hasOwnProp$2y = Object.prototype.hasOwnProperty, __propIsEnum$2y = Object.prototype.propertyIsEnumerable, __objRest$1X = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2y.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2y)
    for (var $n of __getOwnPropSymbols$2y(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2y.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function extractSystemStyles(_e) {
  const Qt = _e, {
    m: Zt,
    mx: $n,
    my: Sn,
    mt: kn,
    mb: Kn,
    ml: er,
    mr: Cr,
    p: kr,
    px: Yr,
    py: Ms,
    pt: Ds,
    pb: Ls,
    pl: js,
    pr: zs,
    bg: Fs,
    c: Bs,
    opacity: Hs,
    ff: Ws,
    fz: Ys,
    fw: El,
    lts: Mu,
    ta: Pl,
    lh: Iu,
    fs: Tu,
    tt: Au,
    td: Nu,
    w: gm,
    miw: pm,
    maw: zu,
    h: Yu,
    mih: sm,
    mah: mm,
    bgsz: hm,
    bgp: ym,
    bgr: _m,
    bga: Sm,
    pos: wm,
    top: Nm,
    left: Cm,
    bottom: Im,
    right: Am,
    inset: Vm,
    display: Rm
  } = Qt, Dm = __objRest$1X(Qt, [
    "m",
    "mx",
    "my",
    "mt",
    "mb",
    "ml",
    "mr",
    "p",
    "px",
    "py",
    "pt",
    "pb",
    "pl",
    "pr",
    "bg",
    "c",
    "opacity",
    "ff",
    "fz",
    "fw",
    "lts",
    "ta",
    "lh",
    "fs",
    "tt",
    "td",
    "w",
    "miw",
    "maw",
    "h",
    "mih",
    "mah",
    "bgsz",
    "bgp",
    "bgr",
    "bga",
    "pos",
    "top",
    "left",
    "bottom",
    "right",
    "inset",
    "display"
  ]);
  return { systemStyles: filterProps({
    m: Zt,
    mx: $n,
    my: Sn,
    mt: kn,
    mb: Kn,
    ml: er,
    mr: Cr,
    p: kr,
    px: Yr,
    py: Ms,
    pt: Ds,
    pb: Ls,
    pl: js,
    pr: zs,
    bg: Fs,
    c: Bs,
    opacity: Hs,
    ff: Ws,
    fz: Ys,
    fw: El,
    lts: Mu,
    ta: Pl,
    lh: Iu,
    fs: Tu,
    tt: Au,
    td: Nu,
    w: gm,
    miw: pm,
    maw: zu,
    h: Yu,
    mih: sm,
    mah: mm,
    bgsz: hm,
    bgp: ym,
    bgr: _m,
    bga: Sm,
    pos: wm,
    top: Nm,
    left: Cm,
    bottom: Im,
    right: Am,
    inset: Vm,
    display: Rm
  }), rest: Dm };
}
function getSortedKeys(_e, Qt) {
  const Zt = Object.keys(_e).filter(($n) => $n !== "base").sort(($n, Sn) => getBreakpointValue(getSize$1({ size: $n, sizes: Qt.breakpoints })) - getBreakpointValue(getSize$1({ size: Sn, sizes: Qt.breakpoints })));
  return "base" in _e ? ["base", ...Zt] : Zt;
}
function getResponsiveValue({ value: _e, theme: Qt, getValue: Zt, property: $n }) {
  if (_e == null)
    return;
  if (typeof _e == "object")
    return getSortedKeys(_e, Qt).reduce((Kn, er) => {
      if (er === "base" && _e.base !== void 0) {
        const kr = Zt(_e.base, Qt);
        return Array.isArray($n) ? ($n.forEach((Yr) => {
          Kn[Yr] = kr;
        }), Kn) : (Kn[$n] = kr, Kn);
      }
      const Cr = Zt(_e[er], Qt);
      return Array.isArray($n) ? (Kn[Qt.fn.largerThan(er)] = {}, $n.forEach((kr) => {
        Kn[Qt.fn.largerThan(er)][kr] = Cr;
      }), Kn) : (Kn[Qt.fn.largerThan(er)] = {
        [$n]: Cr
      }, Kn);
    }, {});
  const Sn = Zt(_e, Qt);
  return Array.isArray($n) ? $n.reduce((kn, Kn) => (kn[Kn] = Sn, kn), {}) : { [$n]: Sn };
}
function getColorValue(_e, Qt) {
  return _e === "dimmed" ? Qt.colorScheme === "dark" ? Qt.colors.dark[2] : Qt.colors.gray[6] : Qt.fn.variant({ variant: "filled", color: _e, primaryFallback: !1 }).background;
}
function getSizeValue(_e) {
  return rem$1(_e);
}
function identity$8(_e) {
  return _e;
}
function getFontSizeValue(_e, Qt) {
  return getSize$1({ size: _e, sizes: Qt.fontSizes });
}
const NEGATIVE_VALUES = ["-xs", "-sm", "-md", "-lg", "-xl"];
function getSpacingValue(_e, Qt) {
  return NEGATIVE_VALUES.includes(_e) ? `calc(${getSize$1({
    size: _e.replace("-", ""),
    sizes: Qt.spacing
  })} * -1)` : getSize$1({ size: _e, sizes: Qt.spacing });
}
const valueGetters = {
  identity: identity$8,
  color: getColorValue,
  size: getSizeValue,
  fontSize: getFontSizeValue,
  spacing: getSpacingValue
}, SYSTEM_PROPS = {
  m: { type: "spacing", property: "margin" },
  mt: { type: "spacing", property: "marginTop" },
  mb: { type: "spacing", property: "marginBottom" },
  ml: { type: "spacing", property: "marginLeft" },
  mr: { type: "spacing", property: "marginRight" },
  mx: { type: "spacing", property: ["marginRight", "marginLeft"] },
  my: { type: "spacing", property: ["marginTop", "marginBottom"] },
  p: { type: "spacing", property: "padding" },
  pt: { type: "spacing", property: "paddingTop" },
  pb: { type: "spacing", property: "paddingBottom" },
  pl: { type: "spacing", property: "paddingLeft" },
  pr: { type: "spacing", property: "paddingRight" },
  px: { type: "spacing", property: ["paddingRight", "paddingLeft"] },
  py: { type: "spacing", property: ["paddingTop", "paddingBottom"] },
  bg: { type: "color", property: "background" },
  c: { type: "color", property: "color" },
  opacity: { type: "identity", property: "opacity" },
  ff: { type: "identity", property: "fontFamily" },
  fz: { type: "fontSize", property: "fontSize" },
  fw: { type: "identity", property: "fontWeight" },
  lts: { type: "size", property: "letterSpacing" },
  ta: { type: "identity", property: "textAlign" },
  lh: { type: "identity", property: "lineHeight" },
  fs: { type: "identity", property: "fontStyle" },
  tt: { type: "identity", property: "textTransform" },
  td: { type: "identity", property: "textDecoration" },
  w: { type: "spacing", property: "width" },
  miw: { type: "spacing", property: "minWidth" },
  maw: { type: "spacing", property: "maxWidth" },
  h: { type: "spacing", property: "height" },
  mih: { type: "spacing", property: "minHeight" },
  mah: { type: "spacing", property: "maxHeight" },
  bgsz: { type: "size", property: "backgroundSize" },
  bgp: { type: "identity", property: "backgroundPosition" },
  bgr: { type: "identity", property: "backgroundRepeat" },
  bga: { type: "identity", property: "backgroundAttachment" },
  pos: { type: "identity", property: "position" },
  top: { type: "identity", property: "top" },
  left: { type: "size", property: "left" },
  bottom: { type: "size", property: "bottom" },
  right: { type: "size", property: "right" },
  inset: { type: "size", property: "inset" },
  display: { type: "identity", property: "display" }
};
var __defProp$2v = Object.defineProperty, __getOwnPropSymbols$2x = Object.getOwnPropertySymbols, __hasOwnProp$2x = Object.prototype.hasOwnProperty, __propIsEnum$2x = Object.prototype.propertyIsEnumerable, __defNormalProp$2v = (_e, Qt, Zt) => Qt in _e ? __defProp$2v(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2v = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2x.call(Qt, Zt) && __defNormalProp$2v(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2x)
    for (var Zt of __getOwnPropSymbols$2x(Qt))
      __propIsEnum$2x.call(Qt, Zt) && __defNormalProp$2v(_e, Zt, Qt[Zt]);
  return _e;
};
function getSystemStyles(_e, Qt, Zt = SYSTEM_PROPS) {
  return Object.keys(Zt).reduce((Sn, kn) => (kn in _e && _e[kn] !== void 0 && Sn.push(getResponsiveValue({
    value: _e[kn],
    getValue: valueGetters[Zt[kn].type],
    property: Zt[kn].property,
    theme: Qt
  })), Sn), []).reduce((Sn, kn) => (Object.keys(kn).forEach((Kn) => {
    typeof kn[Kn] == "object" && kn[Kn] !== null && Kn in Sn ? Sn[Kn] = __spreadValues$2v(__spreadValues$2v({}, Sn[Kn]), kn[Kn]) : Sn[Kn] = kn[Kn];
  }), Sn), {});
}
function extractSx(_e, Qt) {
  return typeof _e == "function" ? _e(Qt) : _e;
}
function useSx(_e, Qt, Zt) {
  const $n = useMantineTheme(), { css: Sn, cx: kn } = useCss();
  return Array.isArray(_e) ? kn(Zt, Sn(getSystemStyles(Qt, $n)), _e.map((Kn) => Sn(extractSx(Kn, $n)))) : kn(Zt, Sn(extractSx(_e, $n)), Sn(getSystemStyles(Qt, $n)));
}
var __defProp$2u = Object.defineProperty, __getOwnPropSymbols$2w = Object.getOwnPropertySymbols, __hasOwnProp$2w = Object.prototype.hasOwnProperty, __propIsEnum$2w = Object.prototype.propertyIsEnumerable, __defNormalProp$2u = (_e, Qt, Zt) => Qt in _e ? __defProp$2u(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2u = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2w.call(Qt, Zt) && __defNormalProp$2u(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2w)
    for (var Zt of __getOwnPropSymbols$2w(Qt))
      __propIsEnum$2w.call(Qt, Zt) && __defNormalProp$2u(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1W = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2w.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2w)
    for (var $n of __getOwnPropSymbols$2w(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2w.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const _Box = reactExports.forwardRef((_e, Qt) => {
  var Zt = _e, { className: $n, component: Sn, style: kn, sx: Kn } = Zt, er = __objRest$1W(Zt, ["className", "component", "style", "sx"]);
  const { systemStyles: Cr, rest: kr } = extractSystemStyles(er), Yr = Sn || "div";
  return /* @__PURE__ */ React.createElement(Yr, __spreadValues$2u({
    ref: Qt,
    className: useSx(Kn, Cr, $n),
    style: kn
  }, kr));
});
_Box.displayName = "@mantine/core/Box";
const Box = _Box;
var __defProp$2t = Object.defineProperty, __defProps$1e = Object.defineProperties, __getOwnPropDescs$1e = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2v = Object.getOwnPropertySymbols, __hasOwnProp$2v = Object.prototype.hasOwnProperty, __propIsEnum$2v = Object.prototype.propertyIsEnumerable, __defNormalProp$2t = (_e, Qt, Zt) => Qt in _e ? __defProp$2t(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2t = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2v.call(Qt, Zt) && __defNormalProp$2t(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2v)
    for (var Zt of __getOwnPropSymbols$2v(Qt))
      __propIsEnum$2v.call(Qt, Zt) && __defNormalProp$2t(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$1e = (_e, Qt) => __defProps$1e(_e, __getOwnPropDescs$1e(Qt)), useStyles$2A = createStyles((_e) => ({
  root: __spreadProps$1e(__spreadValues$2t(__spreadValues$2t({}, _e.fn.focusStyles()), _e.fn.fontStyles()), {
    cursor: "pointer",
    border: 0,
    padding: 0,
    appearance: "none",
    fontSize: _e.fontSizes.md,
    backgroundColor: "transparent",
    textAlign: "left",
    color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
    textDecoration: "none",
    boxSizing: "border-box"
  })
}));
const useStyles$2B = useStyles$2A;
var __defProp$2s = Object.defineProperty, __getOwnPropSymbols$2u = Object.getOwnPropertySymbols, __hasOwnProp$2u = Object.prototype.hasOwnProperty, __propIsEnum$2u = Object.prototype.propertyIsEnumerable, __defNormalProp$2s = (_e, Qt, Zt) => Qt in _e ? __defProp$2s(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2s = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2u.call(Qt, Zt) && __defNormalProp$2s(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2u)
    for (var Zt of __getOwnPropSymbols$2u(Qt))
      __propIsEnum$2u.call(Qt, Zt) && __defNormalProp$2s(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1V = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2u.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2u)
    for (var $n of __getOwnPropSymbols$2u(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2u.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const _UnstyledButton = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("UnstyledButton", {}, _e), {
    className: $n,
    component: Sn = "button",
    unstyled: kn,
    variant: Kn
  } = Zt, er = __objRest$1V(Zt, [
    "className",
    "component",
    "unstyled",
    "variant"
  ]), { classes: Cr, cx: kr } = useStyles$2B(null, { name: "UnstyledButton", unstyled: kn, variant: Kn });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$2s({
    component: Sn,
    ref: Qt,
    className: kr(Cr.root, $n),
    type: Sn === "button" ? "button" : void 0
  }, er));
});
_UnstyledButton.displayName = "@mantine/core/UnstyledButton";
const UnstyledButton = _UnstyledButton;
var __defProp$2r = Object.defineProperty, __defProps$1d = Object.defineProperties, __getOwnPropDescs$1d = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2t = Object.getOwnPropertySymbols, __hasOwnProp$2t = Object.prototype.hasOwnProperty, __propIsEnum$2t = Object.prototype.propertyIsEnumerable, __defNormalProp$2r = (_e, Qt, Zt) => Qt in _e ? __defProp$2r(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2r = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2t.call(Qt, Zt) && __defNormalProp$2r(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2t)
    for (var Zt of __getOwnPropSymbols$2t(Qt))
      __propIsEnum$2t.call(Qt, Zt) && __defNormalProp$2r(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$1d = (_e, Qt) => __defProps$1d(_e, __getOwnPropDescs$1d(Qt)), __objRest$1U = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2t.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2t)
    for (var $n of __getOwnPropSymbols$2t(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2t.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function getAutoHeightDuration(_e) {
  if (!_e || typeof _e == "string")
    return 0;
  const Qt = _e / 36;
  return Math.round((4 + 15 * Qt ** 0.25 + Qt / 5) * 10);
}
function getElementHeight(_e) {
  return _e != null && _e.current ? _e.current.scrollHeight : "auto";
}
const raf = typeof window < "u" && window.requestAnimationFrame;
function useCollapse({
  transitionDuration: _e,
  transitionTimingFunction: Qt = "ease",
  onTransitionEnd: Zt = () => {
  },
  opened: $n
}) {
  const Sn = reactExports.useRef(null), kn = 0, Kn = {
    display: "none",
    height: 0,
    overflow: "hidden"
  }, [er, Cr] = reactExports.useState($n ? {} : Kn), kr = (js) => {
    reactDomExports.flushSync(() => Cr(js));
  }, Yr = (js) => {
    kr((zs) => __spreadValues$2r(__spreadValues$2r({}, zs), js));
  };
  function Ms(js) {
    return {
      transition: `height ${_e || getAutoHeightDuration(js)}ms ${Qt}`
    };
  }
  useDidUpdate(() => {
    raf($n ? () => {
      Yr({ willChange: "height", display: "block", overflow: "hidden" }), raf(() => {
        const js = getElementHeight(Sn);
        Yr(__spreadProps$1d(__spreadValues$2r({}, Ms(js)), { height: js }));
      });
    } : () => {
      const js = getElementHeight(Sn);
      Yr(__spreadProps$1d(__spreadValues$2r({}, Ms(js)), { willChange: "height", height: js })), raf(() => Yr({ height: kn, overflow: "hidden" }));
    });
  }, [$n]);
  const Ds = (js) => {
    if (!(js.target !== Sn.current || js.propertyName !== "height"))
      if ($n) {
        const zs = getElementHeight(Sn);
        zs === er.height ? kr({}) : Yr({ height: zs }), Zt();
      } else
        er.height === kn && (kr(Kn), Zt());
  };
  function Ls(js = {}) {
    var zs = js, { style: Fs = {}, refKey: Bs = "ref" } = zs, Hs = __objRest$1U(zs, ["style", "refKey"]);
    const Ws = Hs[Bs];
    return __spreadProps$1d(__spreadValues$2r({
      "aria-hidden": !$n
    }, Hs), {
      [Bs]: mergeRefs(Sn, Ws),
      onTransitionEnd: Ds,
      style: __spreadValues$2r(__spreadValues$2r({ boxSizing: "border-box" }, Fs), er)
    });
  }
  return Ls;
}
var __defProp$2q = Object.defineProperty, __getOwnPropSymbols$2s = Object.getOwnPropertySymbols, __hasOwnProp$2s = Object.prototype.hasOwnProperty, __propIsEnum$2s = Object.prototype.propertyIsEnumerable, __defNormalProp$2q = (_e, Qt, Zt) => Qt in _e ? __defProp$2q(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2q = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2s.call(Qt, Zt) && __defNormalProp$2q(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2s)
    for (var Zt of __getOwnPropSymbols$2s(Qt))
      __propIsEnum$2s.call(Qt, Zt) && __defNormalProp$2q(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1T = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2s.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2s)
    for (var $n of __getOwnPropSymbols$2s(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2s.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1u = {
  transitionDuration: 200,
  transitionTimingFunction: "ease",
  animateOpacity: !0
}, Collapse = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Collapse", defaultProps$1u, _e), {
    children: $n,
    in: Sn,
    transitionDuration: kn,
    transitionTimingFunction: Kn,
    style: er,
    onTransitionEnd: Cr,
    animateOpacity: kr
  } = Zt, Yr = __objRest$1T(Zt, [
    "children",
    "in",
    "transitionDuration",
    "transitionTimingFunction",
    "style",
    "onTransitionEnd",
    "animateOpacity"
  ]), Ms = useMantineTheme(), Ds = useReducedMotion(), js = (Ms.respectReducedMotion ? Ds : !1) ? 0 : kn, { systemStyles: zs, rest: Fs } = extractSystemStyles(Yr), Bs = useCollapse({
    opened: Sn,
    transitionDuration: js,
    transitionTimingFunction: Kn,
    onTransitionEnd: Cr
  });
  return js === 0 ? Sn ? /* @__PURE__ */ React.createElement(Box, __spreadValues$2q({}, Fs), $n) : null : /* @__PURE__ */ React.createElement(Box, __spreadValues$2q({}, Bs(__spreadValues$2q(__spreadValues$2q({ style: er, ref: Qt }, Fs), zs))), /* @__PURE__ */ React.createElement("div", {
    style: {
      opacity: Sn || !kr ? 1 : 0,
      transition: kr ? `opacity ${js}ms ${Kn}` : "none"
    }
  }, $n));
});
Collapse.displayName = "@mantine/core/Collapse";
var __defProp$2p = Object.defineProperty, __getOwnPropSymbols$2r = Object.getOwnPropertySymbols, __hasOwnProp$2r = Object.prototype.hasOwnProperty, __propIsEnum$2r = Object.prototype.propertyIsEnumerable, __defNormalProp$2p = (_e, Qt, Zt) => Qt in _e ? __defProp$2p(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2p = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2r.call(Qt, Zt) && __defNormalProp$2p(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2r)
    for (var Zt of __getOwnPropSymbols$2r(Qt))
      __propIsEnum$2r.call(Qt, Zt) && __defNormalProp$2p(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1S = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2r.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2r)
    for (var $n of __getOwnPropSymbols$2r(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2r.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function ChevronIcon$1(_e) {
  const Qt = _e, { style: Zt } = Qt, $n = __objRest$1S(Qt, ["style"]);
  return /* @__PURE__ */ React.createElement("svg", __spreadValues$2p({
    viewBox: "0 0 15 15",
    fill: "none",
    xmlns: "http://www.w3.org/2000/svg",
    style: __spreadValues$2p({ width: rem$1(16), height: rem$1(16) }, Zt)
  }, $n), /* @__PURE__ */ React.createElement("path", {
    d: "M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",
    fill: "currentColor",
    fillRule: "evenodd",
    clipRule: "evenodd"
  }));
}
var __defProp$2o = Object.defineProperty, __defProps$1c = Object.defineProperties, __getOwnPropDescs$1c = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2q = Object.getOwnPropertySymbols, __hasOwnProp$2q = Object.prototype.hasOwnProperty, __propIsEnum$2q = Object.prototype.propertyIsEnumerable, __defNormalProp$2o = (_e, Qt, Zt) => Qt in _e ? __defProp$2o(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2o = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2q.call(Qt, Zt) && __defNormalProp$2o(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2q)
    for (var Zt of __getOwnPropSymbols$2q(Qt))
      __propIsEnum$2q.call(Qt, Zt) && __defNormalProp$2o(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$1c = (_e, Qt) => __defProps$1c(_e, __getOwnPropDescs$1c(Qt));
const ACTION_ICON_VARIANTS = [
  "subtle",
  "filled",
  "outline",
  "light",
  "default",
  "transparent",
  "gradient"
], sizes$g = {
  xs: rem$1(18),
  sm: rem$1(22),
  md: rem$1(28),
  lg: rem$1(34),
  xl: rem$1(44)
};
function getVariantStyles$7({ variant: _e, theme: Qt, color: Zt, gradient: $n }) {
  const Sn = Qt.fn.variant({ color: Zt, variant: _e, gradient: $n });
  return _e === "gradient" ? {
    border: 0,
    backgroundImage: Sn.background,
    color: Sn.color,
    "&:hover": Qt.fn.hover({
      backgroundSize: "200%"
    })
  } : ACTION_ICON_VARIANTS.includes(_e) ? __spreadValues$2o({
    border: `${rem$1(1)} solid ${Sn.border}`,
    backgroundColor: Sn.background,
    color: Sn.color
  }, Qt.fn.hover({
    backgroundColor: Sn.hover
  })) : null;
}
var useStyles$2y = createStyles((_e, { radius: Qt, color: Zt, gradient: $n }, { variant: Sn, size: kn }) => ({
  root: __spreadProps$1c(__spreadValues$2o({
    position: "relative",
    borderRadius: _e.fn.radius(Qt),
    padding: 0,
    lineHeight: 1,
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    height: getSize$1({ size: kn, sizes: sizes$g }),
    minHeight: getSize$1({ size: kn, sizes: sizes$g }),
    width: getSize$1({ size: kn, sizes: sizes$g }),
    minWidth: getSize$1({ size: kn, sizes: sizes$g })
  }, getVariantStyles$7({ variant: Sn, theme: _e, color: Zt, gradient: $n })), {
    "&:active": _e.activeStyles,
    "& [data-action-icon-loader]": {
      maxWidth: "70%"
    },
    "&:disabled, &[data-disabled]": {
      color: _e.colors.gray[_e.colorScheme === "dark" ? 6 : 4],
      cursor: "not-allowed",
      backgroundColor: Sn === "transparent" ? void 0 : _e.fn.themeColor("gray", _e.colorScheme === "dark" ? 8 : 1),
      borderColor: Sn === "transparent" ? void 0 : _e.fn.themeColor("gray", _e.colorScheme === "dark" ? 8 : 1),
      backgroundImage: "none",
      pointerEvents: "none",
      "&:active": {
        transform: "none"
      }
    },
    "&[data-loading]": {
      pointerEvents: "none",
      "&::before": __spreadProps$1c(__spreadValues$2o({
        content: '""'
      }, _e.fn.cover(rem$1(-1))), {
        backgroundColor: _e.colorScheme === "dark" ? _e.fn.rgba(_e.colors.dark[7], 0.5) : "rgba(255, 255, 255, .5)",
        borderRadius: _e.fn.radius(Qt),
        cursor: "not-allowed"
      })
    }
  })
}));
const useStyles$2z = useStyles$2y;
var __defProp$2n = Object.defineProperty, __getOwnPropSymbols$2p = Object.getOwnPropertySymbols, __hasOwnProp$2p = Object.prototype.hasOwnProperty, __propIsEnum$2p = Object.prototype.propertyIsEnumerable, __defNormalProp$2n = (_e, Qt, Zt) => Qt in _e ? __defProp$2n(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2n = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2p.call(Qt, Zt) && __defNormalProp$2n(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2p)
    for (var Zt of __getOwnPropSymbols$2p(Qt))
      __propIsEnum$2p.call(Qt, Zt) && __defNormalProp$2n(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1R = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2p.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2p)
    for (var $n of __getOwnPropSymbols$2p(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2p.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function Bars(_e) {
  var Qt = _e, { size: Zt, color: $n } = Qt, Sn = __objRest$1R(Qt, ["size", "color"]);
  const kn = Sn, { style: Kn } = kn, er = __objRest$1R(kn, ["style"]);
  return /* @__PURE__ */ React.createElement("svg", __spreadValues$2n({
    viewBox: "0 0 135 140",
    xmlns: "http://www.w3.org/2000/svg",
    fill: $n,
    style: __spreadValues$2n({ width: Zt }, Kn)
  }, er), /* @__PURE__ */ React.createElement("rect", {
    y: "10",
    width: "15",
    height: "120",
    rx: "6"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "height",
    begin: "0.5s",
    dur: "1s",
    values: "120;110;100;90;80;70;60;50;40;140;120",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "y",
    begin: "0.5s",
    dur: "1s",
    values: "10;15;20;25;30;35;40;45;50;0;10",
    calcMode: "linear",
    repeatCount: "indefinite"
  })), /* @__PURE__ */ React.createElement("rect", {
    x: "30",
    y: "10",
    width: "15",
    height: "120",
    rx: "6"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "height",
    begin: "0.25s",
    dur: "1s",
    values: "120;110;100;90;80;70;60;50;40;140;120",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "y",
    begin: "0.25s",
    dur: "1s",
    values: "10;15;20;25;30;35;40;45;50;0;10",
    calcMode: "linear",
    repeatCount: "indefinite"
  })), /* @__PURE__ */ React.createElement("rect", {
    x: "60",
    width: "15",
    height: "140",
    rx: "6"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "height",
    begin: "0s",
    dur: "1s",
    values: "120;110;100;90;80;70;60;50;40;140;120",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "y",
    begin: "0s",
    dur: "1s",
    values: "10;15;20;25;30;35;40;45;50;0;10",
    calcMode: "linear",
    repeatCount: "indefinite"
  })), /* @__PURE__ */ React.createElement("rect", {
    x: "90",
    y: "10",
    width: "15",
    height: "120",
    rx: "6"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "height",
    begin: "0.25s",
    dur: "1s",
    values: "120;110;100;90;80;70;60;50;40;140;120",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "y",
    begin: "0.25s",
    dur: "1s",
    values: "10;15;20;25;30;35;40;45;50;0;10",
    calcMode: "linear",
    repeatCount: "indefinite"
  })), /* @__PURE__ */ React.createElement("rect", {
    x: "120",
    y: "10",
    width: "15",
    height: "120",
    rx: "6"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "height",
    begin: "0.5s",
    dur: "1s",
    values: "120;110;100;90;80;70;60;50;40;140;120",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "y",
    begin: "0.5s",
    dur: "1s",
    values: "10;15;20;25;30;35;40;45;50;0;10",
    calcMode: "linear",
    repeatCount: "indefinite"
  })));
}
var __defProp$2m = Object.defineProperty, __getOwnPropSymbols$2o = Object.getOwnPropertySymbols, __hasOwnProp$2o = Object.prototype.hasOwnProperty, __propIsEnum$2o = Object.prototype.propertyIsEnumerable, __defNormalProp$2m = (_e, Qt, Zt) => Qt in _e ? __defProp$2m(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2m = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2o.call(Qt, Zt) && __defNormalProp$2m(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2o)
    for (var Zt of __getOwnPropSymbols$2o(Qt))
      __propIsEnum$2o.call(Qt, Zt) && __defNormalProp$2m(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1Q = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2o.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2o)
    for (var $n of __getOwnPropSymbols$2o(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2o.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function Oval(_e) {
  var Qt = _e, { size: Zt, color: $n } = Qt, Sn = __objRest$1Q(Qt, ["size", "color"]);
  const kn = Sn, { style: Kn } = kn, er = __objRest$1Q(kn, ["style"]);
  return /* @__PURE__ */ React.createElement("svg", __spreadValues$2m({
    viewBox: "0 0 38 38",
    xmlns: "http://www.w3.org/2000/svg",
    stroke: $n,
    style: __spreadValues$2m({ width: Zt, height: Zt }, Kn)
  }, er), /* @__PURE__ */ React.createElement("g", {
    fill: "none",
    fillRule: "evenodd"
  }, /* @__PURE__ */ React.createElement("g", {
    transform: "translate(2.5 2.5)",
    strokeWidth: "5"
  }, /* @__PURE__ */ React.createElement("circle", {
    strokeOpacity: ".5",
    cx: "16",
    cy: "16",
    r: "16"
  }), /* @__PURE__ */ React.createElement("path", {
    d: "M32 16c0-9.94-8.06-16-16-16"
  }, /* @__PURE__ */ React.createElement("animateTransform", {
    attributeName: "transform",
    type: "rotate",
    from: "0 16 16",
    to: "360 16 16",
    dur: "1s",
    repeatCount: "indefinite"
  })))));
}
var __defProp$2l = Object.defineProperty, __getOwnPropSymbols$2n = Object.getOwnPropertySymbols, __hasOwnProp$2n = Object.prototype.hasOwnProperty, __propIsEnum$2n = Object.prototype.propertyIsEnumerable, __defNormalProp$2l = (_e, Qt, Zt) => Qt in _e ? __defProp$2l(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2l = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2n.call(Qt, Zt) && __defNormalProp$2l(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2n)
    for (var Zt of __getOwnPropSymbols$2n(Qt))
      __propIsEnum$2n.call(Qt, Zt) && __defNormalProp$2l(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1P = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2n.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2n)
    for (var $n of __getOwnPropSymbols$2n(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2n.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function Dots(_e) {
  var Qt = _e, { size: Zt, color: $n } = Qt, Sn = __objRest$1P(Qt, ["size", "color"]);
  const kn = Sn, { style: Kn } = kn, er = __objRest$1P(kn, ["style"]);
  return /* @__PURE__ */ React.createElement("svg", __spreadValues$2l({
    viewBox: "0 0 120 30",
    xmlns: "http://www.w3.org/2000/svg",
    fill: $n,
    style: __spreadValues$2l({ width: Zt }, Kn)
  }, er), /* @__PURE__ */ React.createElement("circle", {
    cx: "15",
    cy: "15",
    r: "15"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "r",
    from: "15",
    to: "15",
    begin: "0s",
    dur: "0.8s",
    values: "15;9;15",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "fill-opacity",
    from: "1",
    to: "1",
    begin: "0s",
    dur: "0.8s",
    values: "1;.5;1",
    calcMode: "linear",
    repeatCount: "indefinite"
  })), /* @__PURE__ */ React.createElement("circle", {
    cx: "60",
    cy: "15",
    r: "9",
    fillOpacity: "0.3"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "r",
    from: "9",
    to: "9",
    begin: "0s",
    dur: "0.8s",
    values: "9;15;9",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "fill-opacity",
    from: "0.5",
    to: "0.5",
    begin: "0s",
    dur: "0.8s",
    values: ".5;1;.5",
    calcMode: "linear",
    repeatCount: "indefinite"
  })), /* @__PURE__ */ React.createElement("circle", {
    cx: "105",
    cy: "15",
    r: "15"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "r",
    from: "15",
    to: "15",
    begin: "0s",
    dur: "0.8s",
    values: "15;9;15",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "fill-opacity",
    from: "1",
    to: "1",
    begin: "0s",
    dur: "0.8s",
    values: "1;.5;1",
    calcMode: "linear",
    repeatCount: "indefinite"
  })));
}
var __defProp$2k = Object.defineProperty, __getOwnPropSymbols$2m = Object.getOwnPropertySymbols, __hasOwnProp$2m = Object.prototype.hasOwnProperty, __propIsEnum$2m = Object.prototype.propertyIsEnumerable, __defNormalProp$2k = (_e, Qt, Zt) => Qt in _e ? __defProp$2k(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2k = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2m.call(Qt, Zt) && __defNormalProp$2k(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2m)
    for (var Zt of __getOwnPropSymbols$2m(Qt))
      __propIsEnum$2m.call(Qt, Zt) && __defNormalProp$2k(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1O = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2m.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2m)
    for (var $n of __getOwnPropSymbols$2m(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2m.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const LOADERS = {
  bars: Bars,
  oval: Oval,
  dots: Dots
}, sizes$f = {
  xs: rem$1(18),
  sm: rem$1(22),
  md: rem$1(36),
  lg: rem$1(44),
  xl: rem$1(58)
}, defaultProps$1t = {
  size: "md"
};
function Loader(_e) {
  const Qt = useComponentDefaultProps("Loader", defaultProps$1t, _e), { size: Zt, color: $n, variant: Sn } = Qt, kn = __objRest$1O(Qt, ["size", "color", "variant"]), Kn = useMantineTheme(), er = Sn in LOADERS ? Sn : Kn.loader;
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$2k({
    role: "presentation",
    component: LOADERS[er] || LOADERS.bars,
    size: getSize$1({ size: Zt, sizes: sizes$f }),
    color: Kn.fn.variant({
      variant: "filled",
      primaryFallback: !1,
      color: $n || Kn.primaryColor
    }).background
  }, kn));
}
Loader.displayName = "@mantine/core/Loader";
var __defProp$2j = Object.defineProperty, __getOwnPropSymbols$2l = Object.getOwnPropertySymbols, __hasOwnProp$2l = Object.prototype.hasOwnProperty, __propIsEnum$2l = Object.prototype.propertyIsEnumerable, __defNormalProp$2j = (_e, Qt, Zt) => Qt in _e ? __defProp$2j(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2j = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2l.call(Qt, Zt) && __defNormalProp$2j(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2l)
    for (var Zt of __getOwnPropSymbols$2l(Qt))
      __propIsEnum$2l.call(Qt, Zt) && __defNormalProp$2j(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1N = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2l.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2l)
    for (var $n of __getOwnPropSymbols$2l(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2l.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1s = {
  color: "gray",
  size: "md",
  variant: "subtle"
}, _ActionIcon = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("ActionIcon", defaultProps$1s, _e), {
    className: $n,
    color: Sn,
    children: kn,
    radius: Kn,
    size: er,
    variant: Cr,
    gradient: kr,
    disabled: Yr,
    loaderProps: Ms,
    loading: Ds,
    unstyled: Ls,
    __staticSelector: js
  } = Zt, zs = __objRest$1N(Zt, [
    "className",
    "color",
    "children",
    "radius",
    "size",
    "variant",
    "gradient",
    "disabled",
    "loaderProps",
    "loading",
    "unstyled",
    "__staticSelector"
  ]), { classes: Fs, cx: Bs, theme: Hs } = useStyles$2z({ radius: Kn, color: Sn, gradient: kr }, { name: ["ActionIcon", js], unstyled: Ls, size: er, variant: Cr }), Ws = /* @__PURE__ */ React.createElement(Loader, __spreadValues$2j({
    color: Hs.fn.variant({ color: Sn, variant: Cr }).color,
    size: "100%",
    "data-action-icon-loader": !0
  }, Ms));
  return /* @__PURE__ */ React.createElement(UnstyledButton, __spreadValues$2j({
    className: Bs(Fs.root, $n),
    ref: Qt,
    disabled: Yr,
    "data-disabled": Yr || void 0,
    "data-loading": Ds || void 0,
    unstyled: Ls
  }, zs), Ds ? Ws : kn);
});
_ActionIcon.displayName = "@mantine/core/ActionIcon";
const ActionIcon = _ActionIcon;
var __defProp$2i = Object.defineProperty, __defProps$1b = Object.defineProperties, __getOwnPropDescs$1b = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2k = Object.getOwnPropertySymbols, __hasOwnProp$2k = Object.prototype.hasOwnProperty, __propIsEnum$2k = Object.prototype.propertyIsEnumerable, __defNormalProp$2i = (_e, Qt, Zt) => Qt in _e ? __defProp$2i(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2i = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2k.call(Qt, Zt) && __defNormalProp$2i(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2k)
    for (var Zt of __getOwnPropSymbols$2k(Qt))
      __propIsEnum$2k.call(Qt, Zt) && __defNormalProp$2i(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$1b = (_e, Qt) => __defProps$1b(_e, __getOwnPropDescs$1b(Qt)), __objRest$1M = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2k.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2k)
    for (var $n of __getOwnPropSymbols$2k(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2k.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function Portal(_e) {
  const Qt = useComponentDefaultProps("Portal", {}, _e), { children: Zt, target: $n, className: Sn, innerRef: kn } = Qt, Kn = __objRest$1M(Qt, ["children", "target", "className", "innerRef"]), er = useMantineTheme(), [Cr, kr] = reactExports.useState(!1), Yr = reactExports.useRef();
  return useIsomorphicEffect(() => (kr(!0), Yr.current = $n ? typeof $n == "string" ? document.querySelector($n) : $n : document.createElement("div"), $n || document.body.appendChild(Yr.current), () => {
    !$n && document.body.removeChild(Yr.current);
  }), [$n]), Cr ? reactDomExports.createPortal(/* @__PURE__ */ React.createElement("div", __spreadProps$1b(__spreadValues$2i({
    className: Sn,
    dir: er.dir
  }, Kn), {
    ref: kn
  }), Zt), Yr.current) : null;
}
Portal.displayName = "@mantine/core/Portal";
var __defProp$2h = Object.defineProperty, __getOwnPropSymbols$2j = Object.getOwnPropertySymbols, __hasOwnProp$2j = Object.prototype.hasOwnProperty, __propIsEnum$2j = Object.prototype.propertyIsEnumerable, __defNormalProp$2h = (_e, Qt, Zt) => Qt in _e ? __defProp$2h(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2h = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2j.call(Qt, Zt) && __defNormalProp$2h(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2j)
    for (var Zt of __getOwnPropSymbols$2j(Qt))
      __propIsEnum$2j.call(Qt, Zt) && __defNormalProp$2h(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1L = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2j.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2j)
    for (var $n of __getOwnPropSymbols$2j(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2j.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function OptionalPortal(_e) {
  var Qt = _e, { withinPortal: Zt = !0, children: $n } = Qt, Sn = __objRest$1L(Qt, ["withinPortal", "children"]);
  return Zt ? /* @__PURE__ */ React.createElement(Portal, __spreadValues$2h({}, Sn), $n) : /* @__PURE__ */ React.createElement(React.Fragment, null, $n);
}
OptionalPortal.displayName = "@mantine/core/OptionalPortal";
var __defProp$2g = Object.defineProperty, __defProps$1a = Object.defineProperties, __getOwnPropDescs$1a = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2i = Object.getOwnPropertySymbols, __hasOwnProp$2i = Object.prototype.hasOwnProperty, __propIsEnum$2i = Object.prototype.propertyIsEnumerable, __defNormalProp$2g = (_e, Qt, Zt) => Qt in _e ? __defProp$2g(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2g = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2i.call(Qt, Zt) && __defNormalProp$2g(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2i)
    for (var Zt of __getOwnPropSymbols$2i(Qt))
      __propIsEnum$2i.call(Qt, Zt) && __defNormalProp$2g(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$1a = (_e, Qt) => __defProps$1a(_e, __getOwnPropDescs$1a(Qt));
function getVariantStyles$6({ variant: _e, color: Qt, theme: Zt }) {
  if (_e === "filled")
    return {
      backgroundColor: Zt.fn.variant({ variant: "filled", color: Qt }).background,
      color: Zt.white
    };
  if (_e === "outline") {
    const $n = Zt.fn.variant({ variant: "outline", color: Qt });
    return {
      color: $n.color,
      borderColor: $n.border,
      backgroundColor: Zt.colorScheme === "dark" ? Zt.colors.dark[6] : Zt.white
    };
  }
  if (_e === "light") {
    const $n = Zt.fn.variant({ variant: "light", color: Qt });
    return {
      backgroundColor: $n.background,
      color: $n.color
    };
  }
  return null;
}
var useStyles$2w = createStyles((_e, { radius: Qt, color: Zt }, { variant: $n }) => ({
  root: __spreadValues$2g(__spreadProps$1a(__spreadValues$2g({}, _e.fn.fontStyles()), {
    position: "relative",
    overflow: "hidden",
    paddingTop: _e.spacing.sm,
    paddingBottom: _e.spacing.sm,
    paddingLeft: _e.spacing.md,
    paddingRight: _e.spacing.sm,
    borderRadius: _e.fn.radius(Qt),
    border: `${rem$1(1)} solid transparent`
  }), getVariantStyles$6({ variant: $n, color: Zt, theme: _e })),
  wrapper: {
    display: "flex"
  },
  body: {
    flex: 1
  },
  title: {
    boxSizing: "border-box",
    margin: 0,
    marginBottom: _e.spacing.xs,
    display: "flex",
    alignItems: "center",
    justifyContent: "space-between",
    lineHeight: _e.lineHeight,
    fontSize: _e.fontSizes.sm,
    fontWeight: 700,
    "&[data-with-close-button]": {
      paddingRight: _e.spacing.md
    }
  },
  label: {
    display: "block",
    overflow: "hidden",
    textOverflow: "ellipsis"
  },
  icon: {
    lineHeight: 1,
    width: rem$1(20),
    height: rem$1(20),
    display: "flex",
    alignItems: "center",
    justifyContent: "flex-start",
    marginRight: _e.spacing.md,
    marginTop: 1
  },
  message: __spreadProps$1a(__spreadValues$2g({}, _e.fn.fontStyles()), {
    lineHeight: _e.lineHeight,
    textOverflow: "ellipsis",
    overflow: "hidden",
    fontSize: _e.fontSizes.sm,
    color: $n === "filled" ? _e.white : _e.colorScheme === "dark" ? $n === "light" ? _e.white : _e.colors.dark[0] : _e.black
  }),
  closeButton: {
    width: rem$1(10),
    height: rem$1(10),
    color: $n === "filled" ? _e.white : _e.colorScheme === "dark" ? $n === "light" ? _e.white : _e.colors.dark[0] : _e.black
  }
}));
const useStyles$2x = useStyles$2w;
var __defProp$2f = Object.defineProperty, __getOwnPropSymbols$2h = Object.getOwnPropertySymbols, __hasOwnProp$2h = Object.prototype.hasOwnProperty, __propIsEnum$2h = Object.prototype.propertyIsEnumerable, __defNormalProp$2f = (_e, Qt, Zt) => Qt in _e ? __defProp$2f(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2f = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2h.call(Qt, Zt) && __defNormalProp$2f(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2h)
    for (var Zt of __getOwnPropSymbols$2h(Qt))
      __propIsEnum$2h.call(Qt, Zt) && __defNormalProp$2f(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1K = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2h.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2h)
    for (var $n of __getOwnPropSymbols$2h(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2h.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function CloseIcon(_e) {
  const Qt = _e, { width: Zt, height: $n, style: Sn } = Qt, kn = __objRest$1K(Qt, ["width", "height", "style"]);
  return /* @__PURE__ */ React.createElement("svg", __spreadValues$2f({
    viewBox: "0 0 15 15",
    fill: "none",
    xmlns: "http://www.w3.org/2000/svg",
    style: __spreadValues$2f({ width: Zt, height: $n }, Sn)
  }, kn), /* @__PURE__ */ React.createElement("path", {
    d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",
    fill: "currentColor",
    fillRule: "evenodd",
    clipRule: "evenodd"
  }));
}
CloseIcon.displayName = "@mantine/core/CloseIcon";
var __defProp$2e = Object.defineProperty, __getOwnPropSymbols$2g = Object.getOwnPropertySymbols, __hasOwnProp$2g = Object.prototype.hasOwnProperty, __propIsEnum$2g = Object.prototype.propertyIsEnumerable, __defNormalProp$2e = (_e, Qt, Zt) => Qt in _e ? __defProp$2e(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2e = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2g.call(Qt, Zt) && __defNormalProp$2e(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2g)
    for (var Zt of __getOwnPropSymbols$2g(Qt))
      __propIsEnum$2g.call(Qt, Zt) && __defNormalProp$2e(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1J = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2g.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2g)
    for (var $n of __getOwnPropSymbols$2g(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2g.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const iconSizes$2 = {
  xs: rem$1(12),
  sm: rem$1(16),
  md: rem$1(20),
  lg: rem$1(28),
  xl: rem$1(34)
}, defaultProps$1r = {
  size: "sm"
}, _CloseButton = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("CloseButton", defaultProps$1r, _e), { iconSize: $n, size: Sn, children: kn } = Zt, Kn = __objRest$1J(Zt, ["iconSize", "size", "children"]), er = rem$1($n || iconSizes$2[Sn]);
  return /* @__PURE__ */ React.createElement(ActionIcon, __spreadValues$2e({
    ref: Qt,
    __staticSelector: "CloseButton",
    size: Sn
  }, Kn), kn || /* @__PURE__ */ React.createElement(CloseIcon, {
    width: er,
    height: er
  }));
});
_CloseButton.displayName = "@mantine/core/CloseButton";
const CloseButton = _CloseButton;
var __defProp$2d = Object.defineProperty, __getOwnPropSymbols$2f = Object.getOwnPropertySymbols, __hasOwnProp$2f = Object.prototype.hasOwnProperty, __propIsEnum$2f = Object.prototype.propertyIsEnumerable, __defNormalProp$2d = (_e, Qt, Zt) => Qt in _e ? __defProp$2d(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2d = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2f.call(Qt, Zt) && __defNormalProp$2d(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2f)
    for (var Zt of __getOwnPropSymbols$2f(Qt))
      __propIsEnum$2f.call(Qt, Zt) && __defNormalProp$2d(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1I = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2f.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2f)
    for (var $n of __getOwnPropSymbols$2f(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2f.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1q = {
  variant: "light"
}, Alert = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Alert", defaultProps$1q, _e), {
    id: $n,
    className: Sn,
    title: kn,
    variant: Kn,
    children: er,
    color: Cr,
    classNames: kr,
    icon: Yr,
    styles: Ms,
    onClose: Ds,
    radius: Ls,
    withCloseButton: js,
    closeButtonLabel: zs,
    unstyled: Fs
  } = Zt, Bs = __objRest$1I(Zt, [
    "id",
    "className",
    "title",
    "variant",
    "children",
    "color",
    "classNames",
    "icon",
    "styles",
    "onClose",
    "radius",
    "withCloseButton",
    "closeButtonLabel",
    "unstyled"
  ]), { classes: Hs, cx: Ws } = useStyles$2x({ color: Cr, radius: Ls }, { classNames: kr, styles: Ms, unstyled: Fs, variant: Kn, name: "Alert" }), Ys = useId$1($n), El = kn && `${Ys}-title`, Mu = `${Ys}-body`;
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$2d({
    id: Ys,
    role: "alert",
    "aria-labelledby": El,
    "aria-describedby": Mu,
    className: Ws(Hs.root, Hs[Kn], Sn),
    ref: Qt
  }, Bs), /* @__PURE__ */ React.createElement("div", {
    className: Hs.wrapper
  }, Yr && /* @__PURE__ */ React.createElement("div", {
    className: Hs.icon
  }, Yr), /* @__PURE__ */ React.createElement("div", {
    className: Hs.body
  }, kn && /* @__PURE__ */ React.createElement("div", {
    className: Hs.title,
    "data-with-close-button": js || void 0
  }, /* @__PURE__ */ React.createElement("span", {
    id: El,
    className: Hs.label
  }, kn)), /* @__PURE__ */ React.createElement("div", {
    id: Mu,
    className: Hs.message
  }, er)), js && /* @__PURE__ */ React.createElement(CloseButton, {
    className: Hs.closeButton,
    onClick: Ds,
    variant: "transparent",
    size: 16,
    iconSize: 16,
    "aria-label": zs
  })));
});
Alert.displayName = "@mantine/core/Alert";
var __defProp$2c = Object.defineProperty, __defProps$19 = Object.defineProperties, __getOwnPropDescs$19 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2e = Object.getOwnPropertySymbols, __hasOwnProp$2e = Object.prototype.hasOwnProperty, __propIsEnum$2e = Object.prototype.propertyIsEnumerable, __defNormalProp$2c = (_e, Qt, Zt) => Qt in _e ? __defProp$2c(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2c = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2e.call(Qt, Zt) && __defNormalProp$2c(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2e)
    for (var Zt of __getOwnPropSymbols$2e(Qt))
      __propIsEnum$2e.call(Qt, Zt) && __defNormalProp$2c(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$19 = (_e, Qt) => __defProps$19(_e, __getOwnPropDescs$19(Qt));
function getTextDecoration({
  underline: _e,
  strikethrough: Qt
}) {
  const Zt = [];
  return _e && Zt.push("underline"), Qt && Zt.push("line-through"), Zt.length > 0 ? Zt.join(" ") : "none";
}
function getTextColor({ theme: _e, color: Qt }) {
  return Qt === "dimmed" ? _e.fn.dimmed() : typeof Qt == "string" && (Qt in _e.colors || Qt.split(".")[0] in _e.colors) ? _e.fn.variant({ variant: "filled", color: Qt }).background : Qt || "inherit";
}
function getLineClamp(_e) {
  return typeof _e == "number" ? {
    overflow: "hidden",
    textOverflow: "ellipsis",
    display: "-webkit-box",
    WebkitLineClamp: _e,
    WebkitBoxOrient: "vertical"
  } : null;
}
function getTruncate({ theme: _e, truncate: Qt }) {
  return Qt === "start" ? {
    overflow: "hidden",
    textOverflow: "ellipsis",
    whiteSpace: "nowrap",
    direction: _e.dir === "ltr" ? "rtl" : "ltr",
    textAlign: _e.dir === "ltr" ? "right" : "left"
  } : Qt ? {
    overflow: "hidden",
    textOverflow: "ellipsis",
    whiteSpace: "nowrap"
  } : null;
}
var useStyles$2u = createStyles((_e, {
  color: Qt,
  lineClamp: Zt,
  truncate: $n,
  inline: Sn,
  inherit: kn,
  underline: Kn,
  gradient: er,
  weight: Cr,
  transform: kr,
  align: Yr,
  strikethrough: Ms,
  italic: Ds
}, { size: Ls }) => {
  const js = _e.fn.variant({ variant: "gradient", gradient: er });
  return {
    root: __spreadProps$19(__spreadValues$2c(__spreadValues$2c(__spreadValues$2c(__spreadValues$2c({}, _e.fn.fontStyles()), _e.fn.focusStyles()), getLineClamp(Zt)), getTruncate({ theme: _e, truncate: $n })), {
      color: getTextColor({ color: Qt, theme: _e }),
      fontFamily: kn ? "inherit" : _e.fontFamily,
      fontSize: kn || Ls === void 0 ? "inherit" : getSize$1({ size: Ls, sizes: _e.fontSizes }),
      lineHeight: kn ? "inherit" : Sn ? 1 : _e.lineHeight,
      textDecoration: getTextDecoration({ underline: Kn, strikethrough: Ms }),
      WebkitTapHighlightColor: "transparent",
      fontWeight: kn ? "inherit" : Cr,
      textTransform: kr,
      textAlign: Yr,
      fontStyle: Ds ? "italic" : void 0
    }),
    gradient: {
      backgroundImage: js.background,
      WebkitBackgroundClip: "text",
      WebkitTextFillColor: "transparent"
    }
  };
});
const useStyles$2v = useStyles$2u;
var __defProp$2b = Object.defineProperty, __getOwnPropSymbols$2d = Object.getOwnPropertySymbols, __hasOwnProp$2d = Object.prototype.hasOwnProperty, __propIsEnum$2d = Object.prototype.propertyIsEnumerable, __defNormalProp$2b = (_e, Qt, Zt) => Qt in _e ? __defProp$2b(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2b = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2d.call(Qt, Zt) && __defNormalProp$2b(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2d)
    for (var Zt of __getOwnPropSymbols$2d(Qt))
      __propIsEnum$2d.call(Qt, Zt) && __defNormalProp$2b(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1H = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2d.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2d)
    for (var $n of __getOwnPropSymbols$2d(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2d.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1p = {
  variant: "text"
}, _Text = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Text", defaultProps$1p, _e), {
    className: $n,
    size: Sn,
    weight: kn,
    transform: Kn,
    color: er,
    align: Cr,
    variant: kr,
    lineClamp: Yr,
    truncate: Ms,
    gradient: Ds,
    inline: Ls,
    inherit: js,
    underline: zs,
    strikethrough: Fs,
    italic: Bs,
    classNames: Hs,
    styles: Ws,
    unstyled: Ys,
    span: El,
    __staticSelector: Mu
  } = Zt, Pl = __objRest$1H(Zt, [
    "className",
    "size",
    "weight",
    "transform",
    "color",
    "align",
    "variant",
    "lineClamp",
    "truncate",
    "gradient",
    "inline",
    "inherit",
    "underline",
    "strikethrough",
    "italic",
    "classNames",
    "styles",
    "unstyled",
    "span",
    "__staticSelector"
  ]), { classes: Iu, cx: Tu } = useStyles$2v({
    color: er,
    lineClamp: Yr,
    truncate: Ms,
    inline: Ls,
    inherit: js,
    underline: zs,
    strikethrough: Fs,
    italic: Bs,
    weight: kn,
    transform: Kn,
    align: Cr,
    gradient: Ds
  }, { unstyled: Ys, name: Mu || "Text", variant: kr, size: Sn });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$2b({
    ref: Qt,
    className: Tu(Iu.root, { [Iu.gradient]: kr === "gradient" }, $n),
    component: El ? "span" : "div"
  }, Pl));
});
_Text.displayName = "@mantine/core/Text";
const Text = _Text, sizes$e = {
  xs: rem$1(1),
  sm: rem$1(2),
  md: rem$1(3),
  lg: rem$1(4),
  xl: rem$1(5)
};
function getColor(_e, Qt) {
  const Zt = _e.fn.variant({ variant: "outline", color: Qt }).border;
  return typeof Qt == "string" && (Qt in _e.colors || Qt.split(".")[0] in _e.colors) ? Zt : Qt === void 0 ? _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[4] : Qt;
}
var useStyles$2s = createStyles((_e, { color: Qt }, { size: Zt, variant: $n }) => ({
  root: {},
  withLabel: {
    borderTop: "0 !important"
  },
  left: {
    "&::before": {
      display: "none"
    }
  },
  right: {
    "&::after": {
      display: "none"
    }
  },
  label: {
    display: "flex",
    alignItems: "center",
    "&::before": {
      content: '""',
      flex: 1,
      height: rem$1(1),
      borderTop: `${getSize$1({ size: Zt, sizes: sizes$e })} ${$n} ${getColor(_e, Qt)}`,
      marginRight: _e.spacing.xs
    },
    "&::after": {
      content: '""',
      flex: 1,
      borderTop: `${getSize$1({ size: Zt, sizes: sizes$e })} ${$n} ${getColor(_e, Qt)}`,
      marginLeft: _e.spacing.xs
    }
  },
  labelDefaultStyles: {
    color: Qt === "dark" ? _e.colors.dark[1] : _e.fn.themeColor(Qt, _e.colorScheme === "dark" ? 5 : _e.fn.primaryShade(), !1)
  },
  horizontal: {
    border: 0,
    borderTopWidth: rem$1(getSize$1({ size: Zt, sizes: sizes$e })),
    borderTopColor: getColor(_e, Qt),
    borderTopStyle: $n,
    margin: 0
  },
  vertical: {
    border: 0,
    alignSelf: "stretch",
    height: "auto",
    borderLeftWidth: rem$1(getSize$1({ size: Zt, sizes: sizes$e })),
    borderLeftColor: getColor(_e, Qt),
    borderLeftStyle: $n
  }
}));
const useStyles$2t = useStyles$2s;
var __defProp$2a = Object.defineProperty, __defProps$18 = Object.defineProperties, __getOwnPropDescs$18 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2c = Object.getOwnPropertySymbols, __hasOwnProp$2c = Object.prototype.hasOwnProperty, __propIsEnum$2c = Object.prototype.propertyIsEnumerable, __defNormalProp$2a = (_e, Qt, Zt) => Qt in _e ? __defProp$2a(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2a = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2c.call(Qt, Zt) && __defNormalProp$2a(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2c)
    for (var Zt of __getOwnPropSymbols$2c(Qt))
      __propIsEnum$2c.call(Qt, Zt) && __defNormalProp$2a(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$18 = (_e, Qt) => __defProps$18(_e, __getOwnPropDescs$18(Qt)), __objRest$1G = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2c.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2c)
    for (var $n of __getOwnPropSymbols$2c(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2c.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1o = {
  orientation: "horizontal",
  size: "xs",
  labelPosition: "left",
  variant: "solid"
}, Divider = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Divider", defaultProps$1o, _e), {
    className: $n,
    color: Sn,
    orientation: kn,
    size: Kn,
    label: er,
    labelPosition: Cr,
    labelProps: kr,
    variant: Yr,
    styles: Ms,
    classNames: Ds,
    unstyled: Ls
  } = Zt, js = __objRest$1G(Zt, [
    "className",
    "color",
    "orientation",
    "size",
    "label",
    "labelPosition",
    "labelProps",
    "variant",
    "styles",
    "classNames",
    "unstyled"
  ]), { classes: zs, cx: Fs } = useStyles$2t({ color: Sn }, { classNames: Ds, styles: Ms, unstyled: Ls, name: "Divider", variant: Yr, size: Kn }), Bs = kn === "vertical", Hs = kn === "horizontal", Ws = !!er && Hs, Ys = !(kr != null && kr.color);
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$2a({
    ref: Qt,
    className: Fs(zs.root, {
      [zs.vertical]: Bs,
      [zs.horizontal]: Hs,
      [zs.withLabel]: Ws
    }, $n),
    role: "separator"
  }, js), Ws && /* @__PURE__ */ React.createElement(Text, __spreadProps$18(__spreadValues$2a({}, kr), {
    size: (kr == null ? void 0 : kr.size) || "xs",
    mt: rem$1(2),
    className: Fs(zs.label, zs[Cr], {
      [zs.labelDefaultStyles]: Ys
    })
  }), er));
});
Divider.displayName = "@mantine/core/Divider";
var __defProp$29 = Object.defineProperty, __defProps$17 = Object.defineProperties, __getOwnPropDescs$17 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2b = Object.getOwnPropertySymbols, __hasOwnProp$2b = Object.prototype.hasOwnProperty, __propIsEnum$2b = Object.prototype.propertyIsEnumerable, __defNormalProp$29 = (_e, Qt, Zt) => Qt in _e ? __defProp$29(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$29 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2b.call(Qt, Zt) && __defNormalProp$29(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2b)
    for (var Zt of __getOwnPropSymbols$2b(Qt))
      __propIsEnum$2b.call(Qt, Zt) && __defNormalProp$29(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$17 = (_e, Qt) => __defProps$17(_e, __getOwnPropDescs$17(Qt)), useStyles$2q = createStyles((_e, Qt, { size: Zt }) => ({
  item: __spreadProps$17(__spreadValues$29({}, _e.fn.fontStyles()), {
    boxSizing: "border-box",
    wordBreak: "break-all",
    textAlign: "left",
    width: "100%",
    padding: `calc(${getSize$1({ size: Zt, sizes: _e.spacing })} / 1.5) ${getSize$1({
      size: Zt,
      sizes: _e.spacing
    })}`,
    cursor: "pointer",
    fontSize: getSize$1({ size: Zt, sizes: _e.fontSizes }),
    color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
    borderRadius: _e.fn.radius(),
    "&[data-hovered]": {
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[1]
    },
    "&[data-selected]": __spreadValues$29({
      backgroundColor: _e.fn.variant({ variant: "filled" }).background,
      color: _e.fn.variant({ variant: "filled" }).color
    }, _e.fn.hover({ backgroundColor: _e.fn.variant({ variant: "filled" }).hover })),
    "&[data-disabled]": {
      cursor: "default",
      color: _e.colors.dark[2]
    }
  }),
  nothingFound: {
    boxSizing: "border-box",
    color: _e.colors.gray[6],
    paddingTop: `calc(${getSize$1({ size: Zt, sizes: _e.spacing })} / 2)`,
    paddingBottom: `calc(${getSize$1({ size: Zt, sizes: _e.spacing })} / 2)`,
    textAlign: "center"
  },
  separator: {
    boxSizing: "border-box",
    textAlign: "left",
    width: "100%",
    padding: `calc(${getSize$1({ size: Zt, sizes: _e.spacing })} / 1.5) ${getSize$1({
      size: Zt,
      sizes: _e.spacing
    })}`
  },
  separatorLabel: {
    color: _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[5]
  }
}));
const useStyles$2r = useStyles$2q;
var __defProp$28 = Object.defineProperty, __getOwnPropSymbols$2a = Object.getOwnPropertySymbols, __hasOwnProp$2a = Object.prototype.hasOwnProperty, __propIsEnum$2a = Object.prototype.propertyIsEnumerable, __defNormalProp$28 = (_e, Qt, Zt) => Qt in _e ? __defProp$28(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$28 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2a.call(Qt, Zt) && __defNormalProp$28(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2a)
    for (var Zt of __getOwnPropSymbols$2a(Qt))
      __propIsEnum$2a.call(Qt, Zt) && __defNormalProp$28(_e, Zt, Qt[Zt]);
  return _e;
};
function SelectItems({
  data: _e,
  hovered: Qt,
  classNames: Zt,
  styles: $n,
  isItemSelected: Sn,
  uuid: kn,
  __staticSelector: Kn,
  onItemHover: er,
  onItemSelect: Cr,
  itemsRefs: kr,
  itemComponent: Yr,
  size: Ms,
  nothingFound: Ds,
  creatable: Ls,
  createLabel: js,
  unstyled: zs,
  variant: Fs
}) {
  const { classes: Bs } = useStyles$2r(null, {
    classNames: Zt,
    styles: $n,
    unstyled: zs,
    name: Kn,
    variant: Fs,
    size: Ms
  }), Hs = [], Ws = [];
  let Ys = null;
  const El = (Pl, Iu) => {
    const Tu = typeof Sn == "function" ? Sn(Pl.value) : !1;
    return /* @__PURE__ */ React.createElement(Yr, __spreadValues$28({
      key: Pl.value,
      className: Bs.item,
      "data-disabled": Pl.disabled || void 0,
      "data-hovered": !Pl.disabled && Qt === Iu || void 0,
      "data-selected": !Pl.disabled && Tu || void 0,
      selected: Tu,
      onMouseEnter: () => er(Iu),
      id: `${kn}-${Iu}`,
      role: "option",
      tabIndex: -1,
      "aria-selected": Qt === Iu,
      ref: (Au) => {
        kr && kr.current && (kr.current[Pl.value] = Au);
      },
      onMouseDown: Pl.disabled ? null : (Au) => {
        Au.preventDefault(), Cr(Pl);
      },
      disabled: Pl.disabled,
      variant: Fs
    }, Pl));
  };
  let Mu = null;
  if (_e.forEach((Pl, Iu) => {
    Pl.creatable ? Ys = Iu : Pl.group ? (Mu !== Pl.group && (Mu = Pl.group, Ws.push(/* @__PURE__ */ React.createElement("div", {
      className: Bs.separator,
      key: `__mantine-divider-${Iu}`
    }, /* @__PURE__ */ React.createElement(Divider, {
      classNames: { label: Bs.separatorLabel },
      label: Pl.group
    })))), Ws.push(El(Pl, Iu))) : Hs.push(El(Pl, Iu));
  }), Ls) {
    const Pl = _e[Ys];
    Hs.push(/* @__PURE__ */ React.createElement("div", {
      key: randomId(),
      className: Bs.item,
      "data-hovered": Qt === Ys || void 0,
      onMouseEnter: () => er(Ys),
      onMouseDown: (Iu) => {
        Iu.preventDefault(), Cr(Pl);
      },
      tabIndex: -1,
      ref: (Iu) => {
        kr && kr.current && (kr.current[Pl.value] = Iu);
      }
    }, js));
  }
  return Ws.length > 0 && Hs.length > 0 && Hs.unshift(/* @__PURE__ */ React.createElement("div", {
    className: Bs.separator,
    key: "empty-group-separator"
  }, /* @__PURE__ */ React.createElement(Divider, null))), Ws.length > 0 || Hs.length > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, Ws, Hs) : /* @__PURE__ */ React.createElement(Text, {
    size: Ms,
    unstyled: zs,
    className: Bs.nothingFound
  }, Ds);
}
SelectItems.displayName = "@mantine/core/SelectItems";
var __defProp$27 = Object.defineProperty, __getOwnPropSymbols$29 = Object.getOwnPropertySymbols, __hasOwnProp$29 = Object.prototype.hasOwnProperty, __propIsEnum$29 = Object.prototype.propertyIsEnumerable, __defNormalProp$27 = (_e, Qt, Zt) => Qt in _e ? __defProp$27(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$27 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$29.call(Qt, Zt) && __defNormalProp$27(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$29)
    for (var Zt of __getOwnPropSymbols$29(Qt))
      __propIsEnum$29.call(Qt, Zt) && __defNormalProp$27(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1F = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$29.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$29)
    for (var $n of __getOwnPropSymbols$29(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$29.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const DefaultItem = reactExports.forwardRef((_e, Qt) => {
  var Zt = _e, { label: $n, value: Sn } = Zt, kn = __objRest$1F(Zt, ["label", "value"]);
  return /* @__PURE__ */ React.createElement("div", __spreadValues$27({
    ref: Qt
  }, kn), $n || Sn);
});
DefaultItem.displayName = "@mantine/core/DefaultItem";
function $6ed0406888f73fc4$var$setRef(_e, Qt) {
  typeof _e == "function" ? _e(Qt) : _e != null && (_e.current = Qt);
}
function $6ed0406888f73fc4$export$43e446d32b3d21af(..._e) {
  return (Qt) => _e.forEach(
    (Zt) => $6ed0406888f73fc4$var$setRef(Zt, Qt)
  );
}
function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(..._e) {
  return reactExports.useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(..._e), _e);
}
const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { children: Zt, ...$n } = _e, Sn = reactExports.Children.toArray(Zt), kn = Sn.find($5e63c961fc1ce211$var$isSlottable);
  if (kn) {
    const Kn = kn.props.children, er = Sn.map((Cr) => Cr === kn ? reactExports.Children.count(Kn) > 1 ? reactExports.Children.only(null) : /* @__PURE__ */ reactExports.isValidElement(Kn) ? Kn.props.children : null : Cr);
    return /* @__PURE__ */ reactExports.createElement($5e63c961fc1ce211$var$SlotClone, _extends$6({}, $n, {
      ref: Qt
    }), /* @__PURE__ */ reactExports.isValidElement(Kn) ? /* @__PURE__ */ reactExports.cloneElement(Kn, void 0, er) : null);
  }
  return /* @__PURE__ */ reactExports.createElement($5e63c961fc1ce211$var$SlotClone, _extends$6({}, $n, {
    ref: Qt
  }), Zt);
});
$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = "Slot";
const $5e63c961fc1ce211$var$SlotClone = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { children: Zt, ...$n } = _e;
  return /* @__PURE__ */ reactExports.isValidElement(Zt) ? /* @__PURE__ */ reactExports.cloneElement(Zt, {
    ...$5e63c961fc1ce211$var$mergeProps($n, Zt.props),
    ref: $6ed0406888f73fc4$export$43e446d32b3d21af(Qt, Zt.ref)
  }) : reactExports.Children.count(Zt) > 1 ? reactExports.Children.only(null) : null;
});
$5e63c961fc1ce211$var$SlotClone.displayName = "SlotClone";
const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: _e }) => /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, _e);
function $5e63c961fc1ce211$var$isSlottable(_e) {
  return /* @__PURE__ */ reactExports.isValidElement(_e) && _e.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
}
function $5e63c961fc1ce211$var$mergeProps(_e, Qt) {
  const Zt = {
    ...Qt
  };
  for (const $n in Qt) {
    const Sn = _e[$n], kn = Qt[$n];
    /^on[A-Z]/.test($n) ? Sn && kn ? Zt[$n] = (...er) => {
      kn(...er), Sn(...er);
    } : Sn && (Zt[$n] = Sn) : $n === "style" ? Zt[$n] = {
      ...Sn,
      ...kn
    } : $n === "className" && (Zt[$n] = [
      Sn,
      kn
    ].filter(Boolean).join(" "));
  }
  return {
    ..._e,
    ...Zt
  };
}
const $8927f6f2acc4f386$var$NODES = [
  "a",
  "button",
  "div",
  "h2",
  "h3",
  "img",
  "label",
  "li",
  "nav",
  "ol",
  "p",
  "span",
  "svg",
  "ul"
], $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((_e, Qt) => {
  const Zt = /* @__PURE__ */ reactExports.forwardRef(($n, Sn) => {
    const { asChild: kn, ...Kn } = $n, er = kn ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : Qt;
    return reactExports.useEffect(() => {
      window[Symbol.for("radix-ui")] = !0;
    }, []), /* @__PURE__ */ reactExports.createElement(er, _extends$6({}, Kn, {
      ref: Sn
    }));
  });
  return Zt.displayName = `Primitive.${Qt}`, {
    ..._e,
    [Qt]: Zt
  };
}, {}), $9f79659886946c16$export$e5c5a5f917a5871c = globalThis != null && globalThis.document ? reactExports.useLayoutEffect : () => {
};
function $fe963b355347cc68$export$3e6543de14f8614f(_e, Qt) {
  return reactExports.useReducer((Zt, $n) => {
    const Sn = Qt[Zt][$n];
    return Sn ?? Zt;
  }, _e);
}
const $921a889cee6df7e8$export$99c2b779aa4e8b8b = (_e) => {
  const { present: Qt, children: Zt } = _e, $n = $921a889cee6df7e8$var$usePresence(Qt), Sn = typeof Zt == "function" ? Zt({
    present: $n.isPresent
  }) : reactExports.Children.only(Zt), kn = $6ed0406888f73fc4$export$c7b2cbe3552a0d05($n.ref, Sn.ref);
  return typeof Zt == "function" || $n.isPresent ? /* @__PURE__ */ reactExports.cloneElement(Sn, {
    ref: kn
  }) : null;
};
$921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = "Presence";
function $921a889cee6df7e8$var$usePresence(_e) {
  const [Qt, Zt] = reactExports.useState(), $n = reactExports.useRef({}), Sn = reactExports.useRef(_e), kn = reactExports.useRef("none"), Kn = _e ? "mounted" : "unmounted", [er, Cr] = $fe963b355347cc68$export$3e6543de14f8614f(Kn, {
    mounted: {
      UNMOUNT: "unmounted",
      ANIMATION_OUT: "unmountSuspended"
    },
    unmountSuspended: {
      MOUNT: "mounted",
      ANIMATION_END: "unmounted"
    },
    unmounted: {
      MOUNT: "mounted"
    }
  });
  return reactExports.useEffect(() => {
    const kr = $921a889cee6df7e8$var$getAnimationName($n.current);
    kn.current = er === "mounted" ? kr : "none";
  }, [
    er
  ]), $9f79659886946c16$export$e5c5a5f917a5871c(() => {
    const kr = $n.current, Yr = Sn.current;
    if (Yr !== _e) {
      const Ds = kn.current, Ls = $921a889cee6df7e8$var$getAnimationName(kr);
      _e ? Cr("MOUNT") : Ls === "none" || (kr == null ? void 0 : kr.display) === "none" ? Cr("UNMOUNT") : Cr(Yr && Ds !== Ls ? "ANIMATION_OUT" : "UNMOUNT"), Sn.current = _e;
    }
  }, [
    _e,
    Cr
  ]), $9f79659886946c16$export$e5c5a5f917a5871c(() => {
    if (Qt) {
      const kr = (Ms) => {
        const Ls = $921a889cee6df7e8$var$getAnimationName($n.current).includes(Ms.animationName);
        Ms.target === Qt && Ls && reactDomExports.flushSync(
          () => Cr("ANIMATION_END")
        );
      }, Yr = (Ms) => {
        Ms.target === Qt && (kn.current = $921a889cee6df7e8$var$getAnimationName($n.current));
      };
      return Qt.addEventListener("animationstart", Yr), Qt.addEventListener("animationcancel", kr), Qt.addEventListener("animationend", kr), () => {
        Qt.removeEventListener("animationstart", Yr), Qt.removeEventListener("animationcancel", kr), Qt.removeEventListener("animationend", kr);
      };
    } else
      Cr("ANIMATION_END");
  }, [
    Qt,
    Cr
  ]), {
    isPresent: [
      "mounted",
      "unmountSuspended"
    ].includes(er),
    ref: reactExports.useCallback((kr) => {
      kr && ($n.current = getComputedStyle(kr)), Zt(kr);
    }, [])
  };
}
function $921a889cee6df7e8$var$getAnimationName(_e) {
  return (_e == null ? void 0 : _e.animationName) || "none";
}
function $c512c27ab02ef895$export$50c7b4e9d9f19c1(_e, Qt = []) {
  let Zt = [];
  function $n(kn, Kn) {
    const er = /* @__PURE__ */ reactExports.createContext(Kn), Cr = Zt.length;
    Zt = [
      ...Zt,
      Kn
    ];
    function kr(Ms) {
      const { scope: Ds, children: Ls, ...js } = Ms, zs = (Ds == null ? void 0 : Ds[_e][Cr]) || er, Fs = reactExports.useMemo(
        () => js,
        Object.values(js)
      );
      return /* @__PURE__ */ reactExports.createElement(zs.Provider, {
        value: Fs
      }, Ls);
    }
    function Yr(Ms, Ds) {
      const Ls = (Ds == null ? void 0 : Ds[_e][Cr]) || er, js = reactExports.useContext(Ls);
      if (js)
        return js;
      if (Kn !== void 0)
        return Kn;
      throw new Error(`\`${Ms}\` must be used within \`${kn}\``);
    }
    return kr.displayName = kn + "Provider", [
      kr,
      Yr
    ];
  }
  const Sn = () => {
    const kn = Zt.map((Kn) => /* @__PURE__ */ reactExports.createContext(Kn));
    return function(er) {
      const Cr = (er == null ? void 0 : er[_e]) || kn;
      return reactExports.useMemo(
        () => ({
          [`__scope${_e}`]: {
            ...er,
            [_e]: Cr
          }
        }),
        [
          er,
          Cr
        ]
      );
    };
  };
  return Sn.scopeName = _e, [
    $n,
    $c512c27ab02ef895$var$composeContextScopes(Sn, ...Qt)
  ];
}
function $c512c27ab02ef895$var$composeContextScopes(..._e) {
  const Qt = _e[0];
  if (_e.length === 1)
    return Qt;
  const Zt = () => {
    const $n = _e.map(
      (Sn) => ({
        useScope: Sn(),
        scopeName: Sn.scopeName
      })
    );
    return function(kn) {
      const Kn = $n.reduce((er, { useScope: Cr, scopeName: kr }) => {
        const Ms = Cr(kn)[`__scope${kr}`];
        return {
          ...er,
          ...Ms
        };
      }, {});
      return reactExports.useMemo(
        () => ({
          [`__scope${Qt.scopeName}`]: Kn
        }),
        [
          Kn
        ]
      );
    };
  };
  return Zt.scopeName = Qt.scopeName, Zt;
}
function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(_e) {
  const Qt = reactExports.useRef(_e);
  return reactExports.useEffect(() => {
    Qt.current = _e;
  }), reactExports.useMemo(
    () => (...Zt) => {
      var $n;
      return ($n = Qt.current) === null || $n === void 0 ? void 0 : $n.call(Qt, ...Zt);
    },
    []
  );
}
const $f631663db3294ace$var$DirectionContext = /* @__PURE__ */ reactExports.createContext(void 0);
function $f631663db3294ace$export$b39126d51d94e6f3(_e) {
  const Qt = reactExports.useContext($f631663db3294ace$var$DirectionContext);
  return _e || Qt || "ltr";
}
function $ae6933e535247d3d$export$7d15b64cf5a3a4c4(_e, [Qt, Zt]) {
  return Math.min(Zt, Math.max(Qt, _e));
}
function $e42e1063c40fb3ef$export$b9ecd428b558ff10(_e, Qt, { checkForDefaultPrevented: Zt = !0 } = {}) {
  return function(Sn) {
    if (_e == null || _e(Sn), Zt === !1 || !Sn.defaultPrevented)
      return Qt == null ? void 0 : Qt(Sn);
  };
}
function $6c2e24571c90391f$export$3e6543de14f8614f(_e, Qt) {
  return reactExports.useReducer((Zt, $n) => {
    const Sn = Qt[Zt][$n];
    return Sn ?? Zt;
  }, _e);
}
const $57acba87d6e25586$var$SCROLL_AREA_NAME = "ScrollArea", [$57acba87d6e25586$var$createScrollAreaContext, $57acba87d6e25586$export$488468afe3a6f2b1] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($57acba87d6e25586$var$SCROLL_AREA_NAME), [$57acba87d6e25586$var$ScrollAreaProvider, $57acba87d6e25586$var$useScrollAreaContext] = $57acba87d6e25586$var$createScrollAreaContext($57acba87d6e25586$var$SCROLL_AREA_NAME), $57acba87d6e25586$export$ccf8d8d7bbf3c2cc = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { __scopeScrollArea: Zt, type: $n = "hover", dir: Sn, scrollHideDelay: kn = 600, ...Kn } = _e, [er, Cr] = reactExports.useState(null), [kr, Yr] = reactExports.useState(null), [Ms, Ds] = reactExports.useState(null), [Ls, js] = reactExports.useState(null), [zs, Fs] = reactExports.useState(null), [Bs, Hs] = reactExports.useState(0), [Ws, Ys] = reactExports.useState(0), [El, Mu] = reactExports.useState(!1), [Pl, Iu] = reactExports.useState(!1), Tu = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
    Qt,
    (Nu) => Cr(Nu)
  ), Au = $f631663db3294ace$export$b39126d51d94e6f3(Sn);
  return /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaProvider, {
    scope: Zt,
    type: $n,
    dir: Au,
    scrollHideDelay: kn,
    scrollArea: er,
    viewport: kr,
    onViewportChange: Yr,
    content: Ms,
    onContentChange: Ds,
    scrollbarX: Ls,
    onScrollbarXChange: js,
    scrollbarXEnabled: El,
    onScrollbarXEnabledChange: Mu,
    scrollbarY: zs,
    onScrollbarYChange: Fs,
    scrollbarYEnabled: Pl,
    onScrollbarYEnabledChange: Iu,
    onCornerWidthChange: Hs,
    onCornerHeightChange: Ys
  }, /* @__PURE__ */ reactExports.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$6({
    dir: Au
  }, Kn, {
    ref: Tu,
    style: {
      position: "relative",
      // Pass corner sizes as CSS vars to reduce re-renders of context consumers
      "--radix-scroll-area-corner-width": Bs + "px",
      "--radix-scroll-area-corner-height": Ws + "px",
      ..._e.style
    }
  })));
}), $57acba87d6e25586$var$VIEWPORT_NAME = "ScrollAreaViewport", $57acba87d6e25586$export$a21cbf9f11fca853 = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { __scopeScrollArea: Zt, children: $n, ...Sn } = _e, kn = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$VIEWPORT_NAME, Zt), Kn = reactExports.useRef(null), er = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(Qt, Kn, kn.onViewportChange);
  return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement("style", {
    dangerouslySetInnerHTML: {
      __html: "[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"
    }
  }), /* @__PURE__ */ reactExports.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$6({
    "data-radix-scroll-area-viewport": ""
  }, Sn, {
    ref: er,
    style: {
      /**
      * We don't support `visible` because the intention is to have at least one scrollbar
      * if this component is used and `visible` will behave like `auto` in that case
      * https://developer.mozilla.org/en-US/docs/Web/CSS/overflowed#description
      *
      * We don't handle `auto` because the intention is for the native implementation
      * to be hidden if using this component. We just want to ensure the node is scrollable
      * so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
      * the browser from having to work out whether to render native scrollbars or not,
      * we tell it to with the intention of hiding them in CSS.
      */
      overflowX: kn.scrollbarXEnabled ? "scroll" : "hidden",
      overflowY: kn.scrollbarYEnabled ? "scroll" : "hidden",
      ..._e.style
    }
  }), /* @__PURE__ */ reactExports.createElement("div", {
    ref: kn.onContentChange,
    style: {
      minWidth: "100%",
      display: "table"
    }
  }, $n)));
}), $57acba87d6e25586$var$SCROLLBAR_NAME = "ScrollAreaScrollbar", $57acba87d6e25586$export$2fabd85d0eba3c57 = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { forceMount: Zt, ...$n } = _e, Sn = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, _e.__scopeScrollArea), { onScrollbarXEnabledChange: kn, onScrollbarYEnabledChange: Kn } = Sn, er = _e.orientation === "horizontal";
  return reactExports.useEffect(() => (er ? kn(!0) : Kn(!0), () => {
    er ? kn(!1) : Kn(!1);
  }), [
    er,
    kn,
    Kn
  ]), Sn.type === "hover" ? /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaScrollbarHover, _extends$6({}, $n, {
    ref: Qt,
    forceMount: Zt
  })) : Sn.type === "scroll" ? /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaScrollbarScroll, _extends$6({}, $n, {
    ref: Qt,
    forceMount: Zt
  })) : Sn.type === "auto" ? /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends$6({}, $n, {
    ref: Qt,
    forceMount: Zt
  })) : Sn.type === "always" ? /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$6({}, $n, {
    ref: Qt
  })) : null;
}), $57acba87d6e25586$var$ScrollAreaScrollbarHover = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { forceMount: Zt, ...$n } = _e, Sn = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, _e.__scopeScrollArea), [kn, Kn] = reactExports.useState(!1);
  return reactExports.useEffect(() => {
    const er = Sn.scrollArea;
    let Cr = 0;
    if (er) {
      const kr = () => {
        window.clearTimeout(Cr), Kn(!0);
      }, Yr = () => {
        Cr = window.setTimeout(
          () => Kn(!1),
          Sn.scrollHideDelay
        );
      };
      return er.addEventListener("pointerenter", kr), er.addEventListener("pointerleave", Yr), () => {
        window.clearTimeout(Cr), er.removeEventListener("pointerenter", kr), er.removeEventListener("pointerleave", Yr);
      };
    }
  }, [
    Sn.scrollArea,
    Sn.scrollHideDelay
  ]), /* @__PURE__ */ reactExports.createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
    present: Zt || kn
  }, /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends$6({
    "data-state": kn ? "visible" : "hidden"
  }, $n, {
    ref: Qt
  })));
}), $57acba87d6e25586$var$ScrollAreaScrollbarScroll = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { forceMount: Zt, ...$n } = _e, Sn = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, _e.__scopeScrollArea), kn = _e.orientation === "horizontal", Kn = $57acba87d6e25586$var$useDebounceCallback(
    () => Cr("SCROLL_END"),
    100
  ), [er, Cr] = $6c2e24571c90391f$export$3e6543de14f8614f("hidden", {
    hidden: {
      SCROLL: "scrolling"
    },
    scrolling: {
      SCROLL_END: "idle",
      POINTER_ENTER: "interacting"
    },
    interacting: {
      SCROLL: "interacting",
      POINTER_LEAVE: "idle"
    },
    idle: {
      HIDE: "hidden",
      SCROLL: "scrolling",
      POINTER_ENTER: "interacting"
    }
  });
  return reactExports.useEffect(() => {
    if (er === "idle") {
      const kr = window.setTimeout(
        () => Cr("HIDE"),
        Sn.scrollHideDelay
      );
      return () => window.clearTimeout(kr);
    }
  }, [
    er,
    Sn.scrollHideDelay,
    Cr
  ]), reactExports.useEffect(() => {
    const kr = Sn.viewport, Yr = kn ? "scrollLeft" : "scrollTop";
    if (kr) {
      let Ms = kr[Yr];
      const Ds = () => {
        const Ls = kr[Yr];
        Ms !== Ls && (Cr("SCROLL"), Kn()), Ms = Ls;
      };
      return kr.addEventListener("scroll", Ds), () => kr.removeEventListener("scroll", Ds);
    }
  }, [
    Sn.viewport,
    kn,
    Cr,
    Kn
  ]), /* @__PURE__ */ reactExports.createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
    present: Zt || er !== "hidden"
  }, /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$6({
    "data-state": er === "hidden" ? "hidden" : "visible"
  }, $n, {
    ref: Qt,
    onPointerEnter: $e42e1063c40fb3ef$export$b9ecd428b558ff10(
      _e.onPointerEnter,
      () => Cr("POINTER_ENTER")
    ),
    onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(
      _e.onPointerLeave,
      () => Cr("POINTER_LEAVE")
    )
  })));
}), $57acba87d6e25586$var$ScrollAreaScrollbarAuto = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const Zt = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, _e.__scopeScrollArea), { forceMount: $n, ...Sn } = _e, [kn, Kn] = reactExports.useState(!1), er = _e.orientation === "horizontal", Cr = $57acba87d6e25586$var$useDebounceCallback(() => {
    if (Zt.viewport) {
      const kr = Zt.viewport.offsetWidth < Zt.viewport.scrollWidth, Yr = Zt.viewport.offsetHeight < Zt.viewport.scrollHeight;
      Kn(er ? kr : Yr);
    }
  }, 10);
  return $57acba87d6e25586$var$useResizeObserver(Zt.viewport, Cr), $57acba87d6e25586$var$useResizeObserver(Zt.content, Cr), /* @__PURE__ */ reactExports.createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
    present: $n || kn
  }, /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$6({
    "data-state": kn ? "visible" : "hidden"
  }, Sn, {
    ref: Qt
  })));
}), $57acba87d6e25586$var$ScrollAreaScrollbarVisible = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { orientation: Zt = "vertical", ...$n } = _e, Sn = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, _e.__scopeScrollArea), kn = reactExports.useRef(null), Kn = reactExports.useRef(0), [er, Cr] = reactExports.useState({
    content: 0,
    viewport: 0,
    scrollbar: {
      size: 0,
      paddingStart: 0,
      paddingEnd: 0
    }
  }), kr = $57acba87d6e25586$var$getThumbRatio(er.viewport, er.content), Yr = {
    ...$n,
    sizes: er,
    onSizesChange: Cr,
    hasThumb: kr > 0 && kr < 1,
    onThumbChange: (Ds) => kn.current = Ds,
    onThumbPointerUp: () => Kn.current = 0,
    onThumbPointerDown: (Ds) => Kn.current = Ds
  };
  function Ms(Ds, Ls) {
    return $57acba87d6e25586$var$getScrollPositionFromPointer(Ds, Kn.current, er, Ls);
  }
  return Zt === "horizontal" ? /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaScrollbarX, _extends$6({}, Yr, {
    ref: Qt,
    onThumbPositionChange: () => {
      if (Sn.viewport && kn.current) {
        const Ds = Sn.viewport.scrollLeft, Ls = $57acba87d6e25586$var$getThumbOffsetFromScroll(Ds, er, Sn.dir);
        kn.current.style.transform = `translate3d(${Ls}px, 0, 0)`;
      }
    },
    onWheelScroll: (Ds) => {
      Sn.viewport && (Sn.viewport.scrollLeft = Ds);
    },
    onDragScroll: (Ds) => {
      Sn.viewport && (Sn.viewport.scrollLeft = Ms(Ds, Sn.dir));
    }
  })) : Zt === "vertical" ? /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaScrollbarY, _extends$6({}, Yr, {
    ref: Qt,
    onThumbPositionChange: () => {
      if (Sn.viewport && kn.current) {
        const Ds = Sn.viewport.scrollTop, Ls = $57acba87d6e25586$var$getThumbOffsetFromScroll(Ds, er);
        kn.current.style.transform = `translate3d(0, ${Ls}px, 0)`;
      }
    },
    onWheelScroll: (Ds) => {
      Sn.viewport && (Sn.viewport.scrollTop = Ds);
    },
    onDragScroll: (Ds) => {
      Sn.viewport && (Sn.viewport.scrollTop = Ms(Ds));
    }
  })) : null;
}), $57acba87d6e25586$var$ScrollAreaScrollbarX = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { sizes: Zt, onSizesChange: $n, ...Sn } = _e, kn = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, _e.__scopeScrollArea), [Kn, er] = reactExports.useState(), Cr = reactExports.useRef(null), kr = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(Qt, Cr, kn.onScrollbarXChange);
  return reactExports.useEffect(() => {
    Cr.current && er(getComputedStyle(Cr.current));
  }, [
    Cr
  ]), /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends$6({
    "data-orientation": "horizontal"
  }, Sn, {
    ref: kr,
    sizes: Zt,
    style: {
      bottom: 0,
      left: kn.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
      right: kn.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
      "--radix-scroll-area-thumb-width": $57acba87d6e25586$var$getThumbSize(Zt) + "px",
      ..._e.style
    },
    onThumbPointerDown: (Yr) => _e.onThumbPointerDown(Yr.x),
    onDragScroll: (Yr) => _e.onDragScroll(Yr.x),
    onWheelScroll: (Yr, Ms) => {
      if (kn.viewport) {
        const Ds = kn.viewport.scrollLeft + Yr.deltaX;
        _e.onWheelScroll(Ds), $57acba87d6e25586$var$isScrollingWithinScrollbarBounds(Ds, Ms) && Yr.preventDefault();
      }
    },
    onResize: () => {
      Cr.current && kn.viewport && Kn && $n({
        content: kn.viewport.scrollWidth,
        viewport: kn.viewport.offsetWidth,
        scrollbar: {
          size: Cr.current.clientWidth,
          paddingStart: $57acba87d6e25586$var$toInt(Kn.paddingLeft),
          paddingEnd: $57acba87d6e25586$var$toInt(Kn.paddingRight)
        }
      });
    }
  }));
}), $57acba87d6e25586$var$ScrollAreaScrollbarY = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { sizes: Zt, onSizesChange: $n, ...Sn } = _e, kn = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, _e.__scopeScrollArea), [Kn, er] = reactExports.useState(), Cr = reactExports.useRef(null), kr = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(Qt, Cr, kn.onScrollbarYChange);
  return reactExports.useEffect(() => {
    Cr.current && er(getComputedStyle(Cr.current));
  }, [
    Cr
  ]), /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends$6({
    "data-orientation": "vertical"
  }, Sn, {
    ref: kr,
    sizes: Zt,
    style: {
      top: 0,
      right: kn.dir === "ltr" ? 0 : void 0,
      left: kn.dir === "rtl" ? 0 : void 0,
      bottom: "var(--radix-scroll-area-corner-height)",
      "--radix-scroll-area-thumb-height": $57acba87d6e25586$var$getThumbSize(Zt) + "px",
      ..._e.style
    },
    onThumbPointerDown: (Yr) => _e.onThumbPointerDown(Yr.y),
    onDragScroll: (Yr) => _e.onDragScroll(Yr.y),
    onWheelScroll: (Yr, Ms) => {
      if (kn.viewport) {
        const Ds = kn.viewport.scrollTop + Yr.deltaY;
        _e.onWheelScroll(Ds), $57acba87d6e25586$var$isScrollingWithinScrollbarBounds(Ds, Ms) && Yr.preventDefault();
      }
    },
    onResize: () => {
      Cr.current && kn.viewport && Kn && $n({
        content: kn.viewport.scrollHeight,
        viewport: kn.viewport.offsetHeight,
        scrollbar: {
          size: Cr.current.clientHeight,
          paddingStart: $57acba87d6e25586$var$toInt(Kn.paddingTop),
          paddingEnd: $57acba87d6e25586$var$toInt(Kn.paddingBottom)
        }
      });
    }
  }));
}), [$57acba87d6e25586$var$ScrollbarProvider, $57acba87d6e25586$var$useScrollbarContext] = $57acba87d6e25586$var$createScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME), $57acba87d6e25586$var$ScrollAreaScrollbarImpl = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { __scopeScrollArea: Zt, sizes: $n, hasThumb: Sn, onThumbChange: kn, onThumbPointerUp: Kn, onThumbPointerDown: er, onThumbPositionChange: Cr, onDragScroll: kr, onWheelScroll: Yr, onResize: Ms, ...Ds } = _e, Ls = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, Zt), [js, zs] = reactExports.useState(null), Fs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
    Qt,
    (Tu) => zs(Tu)
  ), Bs = reactExports.useRef(null), Hs = reactExports.useRef(""), Ws = Ls.viewport, Ys = $n.content - $n.viewport, El = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(Yr), Mu = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(Cr), Pl = $57acba87d6e25586$var$useDebounceCallback(Ms, 10);
  function Iu(Tu) {
    if (Bs.current) {
      const Au = Tu.clientX - Bs.current.left, Nu = Tu.clientY - Bs.current.top;
      kr({
        x: Au,
        y: Nu
      });
    }
  }
  return reactExports.useEffect(() => {
    const Tu = (Au) => {
      const Nu = Au.target;
      (js == null ? void 0 : js.contains(Nu)) && El(Au, Ys);
    };
    return document.addEventListener("wheel", Tu, {
      passive: !1
    }), () => document.removeEventListener("wheel", Tu, {
      passive: !1
    });
  }, [
    Ws,
    js,
    Ys,
    El
  ]), reactExports.useEffect(Mu, [
    $n,
    Mu
  ]), $57acba87d6e25586$var$useResizeObserver(js, Pl), $57acba87d6e25586$var$useResizeObserver(Ls.content, Pl), /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollbarProvider, {
    scope: Zt,
    scrollbar: js,
    hasThumb: Sn,
    onThumbChange: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(kn),
    onThumbPointerUp: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(Kn),
    onThumbPositionChange: Mu,
    onThumbPointerDown: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(er)
  }, /* @__PURE__ */ reactExports.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$6({}, Ds, {
    ref: Fs,
    style: {
      position: "absolute",
      ...Ds.style
    },
    onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(_e.onPointerDown, (Tu) => {
      Tu.button === 0 && (Tu.target.setPointerCapture(Tu.pointerId), Bs.current = js.getBoundingClientRect(), Hs.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", Iu(Tu));
    }),
    onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(_e.onPointerMove, Iu),
    onPointerUp: $e42e1063c40fb3ef$export$b9ecd428b558ff10(_e.onPointerUp, (Tu) => {
      const Au = Tu.target;
      Au.hasPointerCapture(Tu.pointerId) && Au.releasePointerCapture(Tu.pointerId), document.body.style.webkitUserSelect = Hs.current, Bs.current = null;
    })
  })));
}), $57acba87d6e25586$var$THUMB_NAME = "ScrollAreaThumb", $57acba87d6e25586$export$9fba1154677d7cd2 = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { forceMount: Zt, ...$n } = _e, Sn = $57acba87d6e25586$var$useScrollbarContext($57acba87d6e25586$var$THUMB_NAME, _e.__scopeScrollArea);
  return /* @__PURE__ */ reactExports.createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
    present: Zt || Sn.hasThumb
  }, /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaThumbImpl, _extends$6({
    ref: Qt
  }, $n)));
}), $57acba87d6e25586$var$ScrollAreaThumbImpl = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { __scopeScrollArea: Zt, style: $n, ...Sn } = _e, kn = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$THUMB_NAME, Zt), Kn = $57acba87d6e25586$var$useScrollbarContext($57acba87d6e25586$var$THUMB_NAME, Zt), { onThumbPositionChange: er } = Kn, Cr = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
    Qt,
    (Ms) => Kn.onThumbChange(Ms)
  ), kr = reactExports.useRef(), Yr = $57acba87d6e25586$var$useDebounceCallback(() => {
    kr.current && (kr.current(), kr.current = void 0);
  }, 100);
  return reactExports.useEffect(() => {
    const Ms = kn.viewport;
    if (Ms) {
      const Ds = () => {
        if (Yr(), !kr.current) {
          const Ls = $57acba87d6e25586$var$addUnlinkedScrollListener(Ms, er);
          kr.current = Ls, er();
        }
      };
      return er(), Ms.addEventListener("scroll", Ds), () => Ms.removeEventListener("scroll", Ds);
    }
  }, [
    kn.viewport,
    Yr,
    er
  ]), /* @__PURE__ */ reactExports.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$6({
    "data-state": Kn.hasThumb ? "visible" : "hidden"
  }, Sn, {
    ref: Cr,
    style: {
      width: "var(--radix-scroll-area-thumb-width)",
      height: "var(--radix-scroll-area-thumb-height)",
      ...$n
    },
    onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(_e.onPointerDownCapture, (Ms) => {
      const Ls = Ms.target.getBoundingClientRect(), js = Ms.clientX - Ls.left, zs = Ms.clientY - Ls.top;
      Kn.onThumbPointerDown({
        x: js,
        y: zs
      });
    }),
    onPointerUp: $e42e1063c40fb3ef$export$b9ecd428b558ff10(_e.onPointerUp, Kn.onThumbPointerUp)
  }));
}), $57acba87d6e25586$var$CORNER_NAME = "ScrollAreaCorner", $57acba87d6e25586$export$56969d565df7cc4b = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const Zt = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$CORNER_NAME, _e.__scopeScrollArea), $n = !!(Zt.scrollbarX && Zt.scrollbarY);
  return Zt.type !== "scroll" && $n ? /* @__PURE__ */ reactExports.createElement($57acba87d6e25586$var$ScrollAreaCornerImpl, _extends$6({}, _e, {
    ref: Qt
  })) : null;
}), $57acba87d6e25586$var$ScrollAreaCornerImpl = /* @__PURE__ */ reactExports.forwardRef((_e, Qt) => {
  const { __scopeScrollArea: Zt, ...$n } = _e, Sn = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$CORNER_NAME, Zt), [kn, Kn] = reactExports.useState(0), [er, Cr] = reactExports.useState(0), kr = !!(kn && er);
  return $57acba87d6e25586$var$useResizeObserver(Sn.scrollbarX, () => {
    var Yr;
    const Ms = ((Yr = Sn.scrollbarX) === null || Yr === void 0 ? void 0 : Yr.offsetHeight) || 0;
    Sn.onCornerHeightChange(Ms), Cr(Ms);
  }), $57acba87d6e25586$var$useResizeObserver(Sn.scrollbarY, () => {
    var Yr;
    const Ms = ((Yr = Sn.scrollbarY) === null || Yr === void 0 ? void 0 : Yr.offsetWidth) || 0;
    Sn.onCornerWidthChange(Ms), Kn(Ms);
  }), kr ? /* @__PURE__ */ reactExports.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$6({}, $n, {
    ref: Qt,
    style: {
      width: kn,
      height: er,
      position: "absolute",
      right: Sn.dir === "ltr" ? 0 : void 0,
      left: Sn.dir === "rtl" ? 0 : void 0,
      bottom: 0,
      ..._e.style
    }
  })) : null;
});
function $57acba87d6e25586$var$toInt(_e) {
  return _e ? parseInt(_e, 10) : 0;
}
function $57acba87d6e25586$var$getThumbRatio(_e, Qt) {
  const Zt = _e / Qt;
  return isNaN(Zt) ? 0 : Zt;
}
function $57acba87d6e25586$var$getThumbSize(_e) {
  const Qt = $57acba87d6e25586$var$getThumbRatio(_e.viewport, _e.content), Zt = _e.scrollbar.paddingStart + _e.scrollbar.paddingEnd, $n = (_e.scrollbar.size - Zt) * Qt;
  return Math.max($n, 18);
}
function $57acba87d6e25586$var$getScrollPositionFromPointer(_e, Qt, Zt, $n = "ltr") {
  const Sn = $57acba87d6e25586$var$getThumbSize(Zt), kn = Sn / 2, Kn = Qt || kn, er = Sn - Kn, Cr = Zt.scrollbar.paddingStart + Kn, kr = Zt.scrollbar.size - Zt.scrollbar.paddingEnd - er, Yr = Zt.content - Zt.viewport, Ms = $n === "ltr" ? [
    0,
    Yr
  ] : [
    Yr * -1,
    0
  ];
  return $57acba87d6e25586$var$linearScale([
    Cr,
    kr
  ], Ms)(_e);
}
function $57acba87d6e25586$var$getThumbOffsetFromScroll(_e, Qt, Zt = "ltr") {
  const $n = $57acba87d6e25586$var$getThumbSize(Qt), Sn = Qt.scrollbar.paddingStart + Qt.scrollbar.paddingEnd, kn = Qt.scrollbar.size - Sn, Kn = Qt.content - Qt.viewport, er = kn - $n, Cr = Zt === "ltr" ? [
    0,
    Kn
  ] : [
    Kn * -1,
    0
  ], kr = $ae6933e535247d3d$export$7d15b64cf5a3a4c4(_e, Cr);
  return $57acba87d6e25586$var$linearScale([
    0,
    Kn
  ], [
    0,
    er
  ])(kr);
}
function $57acba87d6e25586$var$linearScale(_e, Qt) {
  return (Zt) => {
    if (_e[0] === _e[1] || Qt[0] === Qt[1])
      return Qt[0];
    const $n = (Qt[1] - Qt[0]) / (_e[1] - _e[0]);
    return Qt[0] + $n * (Zt - _e[0]);
  };
}
function $57acba87d6e25586$var$isScrollingWithinScrollbarBounds(_e, Qt) {
  return _e > 0 && _e < Qt;
}
const $57acba87d6e25586$var$addUnlinkedScrollListener = (_e, Qt = () => {
}) => {
  let Zt = {
    left: _e.scrollLeft,
    top: _e.scrollTop
  }, $n = 0;
  return function Sn() {
    const kn = {
      left: _e.scrollLeft,
      top: _e.scrollTop
    }, Kn = Zt.left !== kn.left, er = Zt.top !== kn.top;
    (Kn || er) && Qt(), Zt = kn, $n = window.requestAnimationFrame(Sn);
  }(), () => window.cancelAnimationFrame($n);
};
function $57acba87d6e25586$var$useDebounceCallback(_e, Qt) {
  const Zt = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(_e), $n = reactExports.useRef(0);
  return reactExports.useEffect(
    () => () => window.clearTimeout($n.current),
    []
  ), reactExports.useCallback(() => {
    window.clearTimeout($n.current), $n.current = window.setTimeout(Zt, Qt);
  }, [
    Zt,
    Qt
  ]);
}
function $57acba87d6e25586$var$useResizeObserver(_e, Qt) {
  const Zt = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(Qt);
  $9f79659886946c16$export$e5c5a5f917a5871c(() => {
    let $n = 0;
    if (_e) {
      const Sn = new ResizeObserver(() => {
        cancelAnimationFrame($n), $n = window.requestAnimationFrame(Zt);
      });
      return Sn.observe(_e), () => {
        window.cancelAnimationFrame($n), Sn.unobserve(_e);
      };
    }
  }, [
    _e,
    Zt
  ]);
}
const $57acba87d6e25586$export$be92b6f5f03c0fe9 = $57acba87d6e25586$export$ccf8d8d7bbf3c2cc, $57acba87d6e25586$export$d5c6c08dc2d3ca7 = $57acba87d6e25586$export$a21cbf9f11fca853, $57acba87d6e25586$export$9a4e88b92edfce6b = $57acba87d6e25586$export$2fabd85d0eba3c57, $57acba87d6e25586$export$6521433ed15a34db = $57acba87d6e25586$export$9fba1154677d7cd2, $57acba87d6e25586$export$ac61190d9fc311a9 = $57acba87d6e25586$export$56969d565df7cc4b;
var useStyles$2o = createStyles((_e, { scrollbarSize: Qt, offsetScrollbars: Zt, scrollbarHovered: $n, hidden: Sn }) => ({
  root: {
    overflow: "hidden"
  },
  viewport: {
    width: "100%",
    height: "100%",
    paddingRight: Zt ? rem$1(Qt) : void 0,
    paddingBottom: Zt ? rem$1(Qt) : void 0
  },
  scrollbar: {
    display: Sn ? "none" : "flex",
    userSelect: "none",
    touchAction: "none",
    boxSizing: "border-box",
    padding: `calc(${rem$1(Qt)}  / 5)`,
    transition: "background-color 150ms ease, opacity 150ms ease",
    "&:hover": {
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[8] : _e.colors.gray[0],
      [`& .${getStylesRef("thumb")}`]: {
        backgroundColor: _e.colorScheme === "dark" ? _e.fn.rgba(_e.white, 0.5) : _e.fn.rgba(_e.black, 0.5)
      }
    },
    '&[data-orientation="vertical"]': {
      width: rem$1(Qt)
    },
    '&[data-orientation="horizontal"]': {
      flexDirection: "column",
      height: rem$1(Qt)
    },
    '&[data-state="hidden"]': {
      display: "none",
      opacity: 0
    }
  },
  thumb: {
    ref: getStylesRef("thumb"),
    flex: 1,
    backgroundColor: _e.colorScheme === "dark" ? _e.fn.rgba(_e.white, 0.4) : _e.fn.rgba(_e.black, 0.4),
    borderRadius: rem$1(Qt),
    position: "relative",
    transition: "background-color 150ms ease",
    display: Sn ? "none" : void 0,
    overflow: "hidden",
    "&::before": {
      content: '""',
      position: "absolute",
      top: "50%",
      left: "50%",
      transform: "translate(-50%, -50%)",
      width: "100%",
      height: "100%",
      minWidth: rem$1(44),
      minHeight: rem$1(44)
    }
  },
  corner: {
    backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[0],
    transition: "opacity 150ms ease",
    opacity: $n ? 1 : 0,
    display: Sn ? "none" : void 0
  }
}));
const useStyles$2p = useStyles$2o;
var __defProp$26 = Object.defineProperty, __defProps$16 = Object.defineProperties, __getOwnPropDescs$16 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$28 = Object.getOwnPropertySymbols, __hasOwnProp$28 = Object.prototype.hasOwnProperty, __propIsEnum$28 = Object.prototype.propertyIsEnumerable, __defNormalProp$26 = (_e, Qt, Zt) => Qt in _e ? __defProp$26(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$26 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$28.call(Qt, Zt) && __defNormalProp$26(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$28)
    for (var Zt of __getOwnPropSymbols$28(Qt))
      __propIsEnum$28.call(Qt, Zt) && __defNormalProp$26(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$16 = (_e, Qt) => __defProps$16(_e, __getOwnPropDescs$16(Qt)), __objRest$1E = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$28.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$28)
    for (var $n of __getOwnPropSymbols$28(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$28.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1n = {
  scrollbarSize: 12,
  scrollHideDelay: 1e3,
  type: "hover",
  offsetScrollbars: !1
}, _ScrollArea = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("ScrollArea", defaultProps$1n, _e), {
    children: $n,
    className: Sn,
    classNames: kn,
    styles: Kn,
    scrollbarSize: er,
    scrollHideDelay: Cr,
    type: kr,
    dir: Yr,
    offsetScrollbars: Ms,
    viewportRef: Ds,
    onScrollPositionChange: Ls,
    unstyled: js,
    variant: zs,
    viewportProps: Fs
  } = Zt, Bs = __objRest$1E(Zt, [
    "children",
    "className",
    "classNames",
    "styles",
    "scrollbarSize",
    "scrollHideDelay",
    "type",
    "dir",
    "offsetScrollbars",
    "viewportRef",
    "onScrollPositionChange",
    "unstyled",
    "variant",
    "viewportProps"
  ]), [Hs, Ws] = reactExports.useState(!1), Ys = useMantineTheme(), { classes: El, cx: Mu } = useStyles$2p({ scrollbarSize: er, offsetScrollbars: Ms, scrollbarHovered: Hs, hidden: kr === "never" }, { name: "ScrollArea", classNames: kn, styles: Kn, unstyled: js, variant: zs });
  return /* @__PURE__ */ React.createElement($57acba87d6e25586$export$be92b6f5f03c0fe9, {
    type: kr === "never" ? "always" : kr,
    scrollHideDelay: Cr,
    dir: Yr || Ys.dir,
    ref: Qt,
    asChild: !0
  }, /* @__PURE__ */ React.createElement(Box, __spreadValues$26({
    className: Mu(El.root, Sn)
  }, Bs), /* @__PURE__ */ React.createElement($57acba87d6e25586$export$d5c6c08dc2d3ca7, __spreadProps$16(__spreadValues$26({}, Fs), {
    className: El.viewport,
    ref: Ds,
    onScroll: typeof Ls == "function" ? ({ currentTarget: Pl }) => Ls({
      x: Pl.scrollLeft,
      y: Pl.scrollTop
    }) : void 0
  }), $n), /* @__PURE__ */ React.createElement($57acba87d6e25586$export$9a4e88b92edfce6b, {
    orientation: "horizontal",
    className: El.scrollbar,
    forceMount: !0,
    onMouseEnter: () => Ws(!0),
    onMouseLeave: () => Ws(!1)
  }, /* @__PURE__ */ React.createElement($57acba87d6e25586$export$6521433ed15a34db, {
    className: El.thumb
  })), /* @__PURE__ */ React.createElement($57acba87d6e25586$export$9a4e88b92edfce6b, {
    orientation: "vertical",
    className: El.scrollbar,
    forceMount: !0,
    onMouseEnter: () => Ws(!0),
    onMouseLeave: () => Ws(!1)
  }, /* @__PURE__ */ React.createElement($57acba87d6e25586$export$6521433ed15a34db, {
    className: El.thumb
  })), /* @__PURE__ */ React.createElement($57acba87d6e25586$export$ac61190d9fc311a9, {
    className: El.corner
  })));
}), ScrollAreaAutosize = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("ScrollAreaAutosize", defaultProps$1n, _e), {
    children: $n,
    classNames: Sn,
    styles: kn,
    scrollbarSize: Kn,
    scrollHideDelay: er,
    type: Cr,
    dir: kr,
    offsetScrollbars: Yr,
    viewportRef: Ms,
    onScrollPositionChange: Ds,
    unstyled: Ls,
    sx: js,
    variant: zs,
    viewportProps: Fs
  } = Zt, Bs = __objRest$1E(Zt, [
    "children",
    "classNames",
    "styles",
    "scrollbarSize",
    "scrollHideDelay",
    "type",
    "dir",
    "offsetScrollbars",
    "viewportRef",
    "onScrollPositionChange",
    "unstyled",
    "sx",
    "variant",
    "viewportProps"
  ]);
  return /* @__PURE__ */ React.createElement(Box, __spreadProps$16(__spreadValues$26({}, Bs), {
    ref: Qt,
    sx: [{ display: "flex" }, ...packSx(js)]
  }), /* @__PURE__ */ React.createElement(Box, {
    sx: { display: "flex", flexDirection: "column", flex: 1 }
  }, /* @__PURE__ */ React.createElement(_ScrollArea, {
    classNames: Sn,
    styles: kn,
    scrollHideDelay: er,
    scrollbarSize: Kn,
    type: Cr,
    dir: kr,
    offsetScrollbars: Yr,
    viewportRef: Ms,
    onScrollPositionChange: Ds,
    unstyled: Ls,
    variant: zs,
    viewportProps: Fs
  }, $n)));
});
ScrollAreaAutosize.displayName = "@mantine/core/ScrollAreaAutosize";
_ScrollArea.displayName = "@mantine/core/ScrollArea";
_ScrollArea.Autosize = ScrollAreaAutosize;
const ScrollArea = _ScrollArea;
var __defProp$25 = Object.defineProperty, __defProps$15 = Object.defineProperties, __getOwnPropDescs$15 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$27 = Object.getOwnPropertySymbols, __hasOwnProp$27 = Object.prototype.hasOwnProperty, __propIsEnum$27 = Object.prototype.propertyIsEnumerable, __defNormalProp$25 = (_e, Qt, Zt) => Qt in _e ? __defProp$25(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$25 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$27.call(Qt, Zt) && __defNormalProp$25(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$27)
    for (var Zt of __getOwnPropSymbols$27(Qt))
      __propIsEnum$27.call(Qt, Zt) && __defNormalProp$25(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$15 = (_e, Qt) => __defProps$15(_e, __getOwnPropDescs$15(Qt)), __objRest$1D = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$27.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$27)
    for (var $n of __getOwnPropSymbols$27(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$27.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const SelectScrollArea = reactExports.forwardRef((_e, Qt) => {
  var Zt = _e, { style: $n } = Zt, Sn = __objRest$1D(Zt, ["style"]);
  return /* @__PURE__ */ React.createElement(ScrollArea, __spreadProps$15(__spreadValues$25({}, Sn), {
    style: __spreadValues$25({ width: "100%" }, $n),
    viewportProps: { tabIndex: -1 },
    viewportRef: Qt
  }), Sn.children);
});
SelectScrollArea.displayName = "@mantine/core/SelectScrollArea";
var useStyles$2m = createStyles(() => ({
  dropdown: {},
  itemsWrapper: {
    padding: rem$1(4),
    display: "flex",
    width: "100%",
    boxSizing: "border-box"
  }
}));
const useStyles$2n = useStyles$2m, min$4 = Math.min, max$4 = Math.max, round = Math.round, floor$1 = Math.floor, createCoords = (_e) => ({
  x: _e,
  y: _e
}), oppositeSideMap = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
}, oppositeAlignmentMap = {
  start: "end",
  end: "start"
};
function clamp$1(_e, Qt, Zt) {
  return max$4(_e, min$4(Qt, Zt));
}
function evaluate$1(_e, Qt) {
  return typeof _e == "function" ? _e(Qt) : _e;
}
function getSide(_e) {
  return _e.split("-")[0];
}
function getAlignment(_e) {
  return _e.split("-")[1];
}
function getOppositeAxis(_e) {
  return _e === "x" ? "y" : "x";
}
function getAxisLength(_e) {
  return _e === "y" ? "height" : "width";
}
function getSideAxis(_e) {
  return ["top", "bottom"].includes(getSide(_e)) ? "y" : "x";
}
function getAlignmentAxis(_e) {
  return getOppositeAxis(getSideAxis(_e));
}
function getAlignmentSides(_e, Qt, Zt) {
  Zt === void 0 && (Zt = !1);
  const $n = getAlignment(_e), Sn = getAlignmentAxis(_e), kn = getAxisLength(Sn);
  let Kn = Sn === "x" ? $n === (Zt ? "end" : "start") ? "right" : "left" : $n === "start" ? "bottom" : "top";
  return Qt.reference[kn] > Qt.floating[kn] && (Kn = getOppositePlacement(Kn)), [Kn, getOppositePlacement(Kn)];
}
function getExpandedPlacements(_e) {
  const Qt = getOppositePlacement(_e);
  return [getOppositeAlignmentPlacement(_e), Qt, getOppositeAlignmentPlacement(Qt)];
}
function getOppositeAlignmentPlacement(_e) {
  return _e.replace(/start|end/g, (Qt) => oppositeAlignmentMap[Qt]);
}
function getSideList(_e, Qt, Zt) {
  const $n = ["left", "right"], Sn = ["right", "left"], kn = ["top", "bottom"], Kn = ["bottom", "top"];
  switch (_e) {
    case "top":
    case "bottom":
      return Zt ? Qt ? Sn : $n : Qt ? $n : Sn;
    case "left":
    case "right":
      return Qt ? kn : Kn;
    default:
      return [];
  }
}
function getOppositeAxisPlacements(_e, Qt, Zt, $n) {
  const Sn = getAlignment(_e);
  let kn = getSideList(getSide(_e), Zt === "start", $n);
  return Sn && (kn = kn.map((Kn) => Kn + "-" + Sn), Qt && (kn = kn.concat(kn.map(getOppositeAlignmentPlacement)))), kn;
}
function getOppositePlacement(_e) {
  return _e.replace(/left|right|bottom|top/g, (Qt) => oppositeSideMap[Qt]);
}
function expandPaddingObject(_e) {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    ..._e
  };
}
function getPaddingObject(_e) {
  return typeof _e != "number" ? expandPaddingObject(_e) : {
    top: _e,
    right: _e,
    bottom: _e,
    left: _e
  };
}
function rectToClientRect(_e) {
  return {
    ..._e,
    top: _e.y,
    left: _e.x,
    right: _e.x + _e.width,
    bottom: _e.y + _e.height
  };
}
function computeCoordsFromPlacement(_e, Qt, Zt) {
  let {
    reference: $n,
    floating: Sn
  } = _e;
  const kn = getSideAxis(Qt), Kn = getAlignmentAxis(Qt), er = getAxisLength(Kn), Cr = getSide(Qt), kr = kn === "y", Yr = $n.x + $n.width / 2 - Sn.width / 2, Ms = $n.y + $n.height / 2 - Sn.height / 2, Ds = $n[er] / 2 - Sn[er] / 2;
  let Ls;
  switch (Cr) {
    case "top":
      Ls = {
        x: Yr,
        y: $n.y - Sn.height
      };
      break;
    case "bottom":
      Ls = {
        x: Yr,
        y: $n.y + $n.height
      };
      break;
    case "right":
      Ls = {
        x: $n.x + $n.width,
        y: Ms
      };
      break;
    case "left":
      Ls = {
        x: $n.x - Sn.width,
        y: Ms
      };
      break;
    default:
      Ls = {
        x: $n.x,
        y: $n.y
      };
  }
  switch (getAlignment(Qt)) {
    case "start":
      Ls[Kn] -= Ds * (Zt && kr ? -1 : 1);
      break;
    case "end":
      Ls[Kn] += Ds * (Zt && kr ? -1 : 1);
      break;
  }
  return Ls;
}
const computePosition$1 = async (_e, Qt, Zt) => {
  const {
    placement: $n = "bottom",
    strategy: Sn = "absolute",
    middleware: kn = [],
    platform: Kn
  } = Zt, er = kn.filter(Boolean), Cr = await (Kn.isRTL == null ? void 0 : Kn.isRTL(Qt));
  let kr = await Kn.getElementRects({
    reference: _e,
    floating: Qt,
    strategy: Sn
  }), {
    x: Yr,
    y: Ms
  } = computeCoordsFromPlacement(kr, $n, Cr), Ds = $n, Ls = {}, js = 0;
  for (let zs = 0; zs < er.length; zs++) {
    const {
      name: Fs,
      fn: Bs
    } = er[zs], {
      x: Hs,
      y: Ws,
      data: Ys,
      reset: El
    } = await Bs({
      x: Yr,
      y: Ms,
      initialPlacement: $n,
      placement: Ds,
      strategy: Sn,
      middlewareData: Ls,
      rects: kr,
      platform: Kn,
      elements: {
        reference: _e,
        floating: Qt
      }
    });
    if (Yr = Hs ?? Yr, Ms = Ws ?? Ms, Ls = {
      ...Ls,
      [Fs]: {
        ...Ls[Fs],
        ...Ys
      }
    }, El && js <= 50) {
      js++, typeof El == "object" && (El.placement && (Ds = El.placement), El.rects && (kr = El.rects === !0 ? await Kn.getElementRects({
        reference: _e,
        floating: Qt,
        strategy: Sn
      }) : El.rects), {
        x: Yr,
        y: Ms
      } = computeCoordsFromPlacement(kr, Ds, Cr)), zs = -1;
      continue;
    }
  }
  return {
    x: Yr,
    y: Ms,
    placement: Ds,
    strategy: Sn,
    middlewareData: Ls
  };
};
async function detectOverflow(_e, Qt) {
  var Zt;
  Qt === void 0 && (Qt = {});
  const {
    x: $n,
    y: Sn,
    platform: kn,
    rects: Kn,
    elements: er,
    strategy: Cr
  } = _e, {
    boundary: kr = "clippingAncestors",
    rootBoundary: Yr = "viewport",
    elementContext: Ms = "floating",
    altBoundary: Ds = !1,
    padding: Ls = 0
  } = evaluate$1(Qt, _e), js = getPaddingObject(Ls), Fs = er[Ds ? Ms === "floating" ? "reference" : "floating" : Ms], Bs = rectToClientRect(await kn.getClippingRect({
    element: (Zt = await (kn.isElement == null ? void 0 : kn.isElement(Fs))) == null || Zt ? Fs : Fs.contextElement || await (kn.getDocumentElement == null ? void 0 : kn.getDocumentElement(er.floating)),
    boundary: kr,
    rootBoundary: Yr,
    strategy: Cr
  })), Hs = Ms === "floating" ? {
    ...Kn.floating,
    x: $n,
    y: Sn
  } : Kn.reference, Ws = await (kn.getOffsetParent == null ? void 0 : kn.getOffsetParent(er.floating)), Ys = await (kn.isElement == null ? void 0 : kn.isElement(Ws)) ? await (kn.getScale == null ? void 0 : kn.getScale(Ws)) || {
    x: 1,
    y: 1
  } : {
    x: 1,
    y: 1
  }, El = rectToClientRect(kn.convertOffsetParentRelativeRectToViewportRelativeRect ? await kn.convertOffsetParentRelativeRectToViewportRelativeRect({
    rect: Hs,
    offsetParent: Ws,
    strategy: Cr
  }) : Hs);
  return {
    top: (Bs.top - El.top + js.top) / Ys.y,
    bottom: (El.bottom - Bs.bottom + js.bottom) / Ys.y,
    left: (Bs.left - El.left + js.left) / Ys.x,
    right: (El.right - Bs.right + js.right) / Ys.x
  };
}
const arrow$1 = (_e) => ({
  name: "arrow",
  options: _e,
  async fn(Qt) {
    const {
      x: Zt,
      y: $n,
      placement: Sn,
      rects: kn,
      platform: Kn,
      elements: er
    } = Qt, {
      element: Cr,
      padding: kr = 0
    } = evaluate$1(_e, Qt) || {};
    if (Cr == null)
      return {};
    const Yr = getPaddingObject(kr), Ms = {
      x: Zt,
      y: $n
    }, Ds = getAlignmentAxis(Sn), Ls = getAxisLength(Ds), js = await Kn.getDimensions(Cr), zs = Ds === "y", Fs = zs ? "top" : "left", Bs = zs ? "bottom" : "right", Hs = zs ? "clientHeight" : "clientWidth", Ws = kn.reference[Ls] + kn.reference[Ds] - Ms[Ds] - kn.floating[Ls], Ys = Ms[Ds] - kn.reference[Ds], El = await (Kn.getOffsetParent == null ? void 0 : Kn.getOffsetParent(Cr));
    let Mu = El ? El[Hs] : 0;
    (!Mu || !await (Kn.isElement == null ? void 0 : Kn.isElement(El))) && (Mu = er.floating[Hs] || kn.floating[Ls]);
    const Pl = Ws / 2 - Ys / 2, Iu = Mu / 2 - js[Ls] / 2 - 1, Tu = min$4(Yr[Fs], Iu), Au = min$4(Yr[Bs], Iu), Nu = Tu, gm = Mu - js[Ls] - Au, pm = Mu / 2 - js[Ls] / 2 + Pl, zu = clamp$1(Nu, pm, gm), sm = getAlignment(Sn) != null && pm != zu && kn.reference[Ls] / 2 - (pm < Nu ? Tu : Au) - js[Ls] / 2 < 0 ? pm < Nu ? Nu - pm : gm - pm : 0;
    return {
      [Ds]: Ms[Ds] - sm,
      data: {
        [Ds]: zu,
        centerOffset: pm - zu + sm
      }
    };
  }
}), flip$1 = function(_e) {
  return _e === void 0 && (_e = {}), {
    name: "flip",
    options: _e,
    async fn(Qt) {
      var Zt;
      const {
        placement: $n,
        middlewareData: Sn,
        rects: kn,
        initialPlacement: Kn,
        platform: er,
        elements: Cr
      } = Qt, {
        mainAxis: kr = !0,
        crossAxis: Yr = !0,
        fallbackPlacements: Ms,
        fallbackStrategy: Ds = "bestFit",
        fallbackAxisSideDirection: Ls = "none",
        flipAlignment: js = !0,
        ...zs
      } = evaluate$1(_e, Qt), Fs = getSide($n), Bs = getSide(Kn) === Kn, Hs = await (er.isRTL == null ? void 0 : er.isRTL(Cr.floating)), Ws = Ms || (Bs || !js ? [getOppositePlacement(Kn)] : getExpandedPlacements(Kn));
      !Ms && Ls !== "none" && Ws.push(...getOppositeAxisPlacements(Kn, js, Ls, Hs));
      const Ys = [Kn, ...Ws], El = await detectOverflow(Qt, zs), Mu = [];
      let Pl = ((Zt = Sn.flip) == null ? void 0 : Zt.overflows) || [];
      if (kr && Mu.push(El[Fs]), Yr) {
        const Nu = getAlignmentSides($n, kn, Hs);
        Mu.push(El[Nu[0]], El[Nu[1]]);
      }
      if (Pl = [...Pl, {
        placement: $n,
        overflows: Mu
      }], !Mu.every((Nu) => Nu <= 0)) {
        var Iu, Tu;
        const Nu = (((Iu = Sn.flip) == null ? void 0 : Iu.index) || 0) + 1, gm = Ys[Nu];
        if (gm)
          return {
            data: {
              index: Nu,
              overflows: Pl
            },
            reset: {
              placement: gm
            }
          };
        let pm = (Tu = Pl.filter((zu) => zu.overflows[0] <= 0).sort((zu, Yu) => zu.overflows[1] - Yu.overflows[1])[0]) == null ? void 0 : Tu.placement;
        if (!pm)
          switch (Ds) {
            case "bestFit": {
              var Au;
              const zu = (Au = Pl.map((Yu) => [Yu.placement, Yu.overflows.filter((sm) => sm > 0).reduce((sm, mm) => sm + mm, 0)]).sort((Yu, sm) => Yu[1] - sm[1])[0]) == null ? void 0 : Au[0];
              zu && (pm = zu);
              break;
            }
            case "initialPlacement":
              pm = Kn;
              break;
          }
        if ($n !== pm)
          return {
            reset: {
              placement: pm
            }
          };
      }
      return {};
    }
  };
};
function getBoundingRect(_e) {
  const Qt = min$4(..._e.map((kn) => kn.left)), Zt = min$4(..._e.map((kn) => kn.top)), $n = max$4(..._e.map((kn) => kn.right)), Sn = max$4(..._e.map((kn) => kn.bottom));
  return {
    x: Qt,
    y: Zt,
    width: $n - Qt,
    height: Sn - Zt
  };
}
function getRectsByLine(_e) {
  const Qt = _e.slice().sort((Sn, kn) => Sn.y - kn.y), Zt = [];
  let $n = null;
  for (let Sn = 0; Sn < Qt.length; Sn++) {
    const kn = Qt[Sn];
    !$n || kn.y - $n.y > $n.height / 2 ? Zt.push([kn]) : Zt[Zt.length - 1].push(kn), $n = kn;
  }
  return Zt.map((Sn) => rectToClientRect(getBoundingRect(Sn)));
}
const inline = function(_e) {
  return _e === void 0 && (_e = {}), {
    name: "inline",
    options: _e,
    async fn(Qt) {
      const {
        placement: Zt,
        elements: $n,
        rects: Sn,
        platform: kn,
        strategy: Kn
      } = Qt, {
        padding: er = 2,
        x: Cr,
        y: kr
      } = evaluate$1(_e, Qt), Yr = Array.from(await (kn.getClientRects == null ? void 0 : kn.getClientRects($n.reference)) || []), Ms = getRectsByLine(Yr), Ds = rectToClientRect(getBoundingRect(Yr)), Ls = getPaddingObject(er);
      function js() {
        if (Ms.length === 2 && Ms[0].left > Ms[1].right && Cr != null && kr != null)
          return Ms.find((Fs) => Cr > Fs.left - Ls.left && Cr < Fs.right + Ls.right && kr > Fs.top - Ls.top && kr < Fs.bottom + Ls.bottom) || Ds;
        if (Ms.length >= 2) {
          if (getSideAxis(Zt) === "y") {
            const Au = Ms[0], Nu = Ms[Ms.length - 1], gm = getSide(Zt) === "top", pm = Au.top, zu = Nu.bottom, Yu = gm ? Au.left : Nu.left, sm = gm ? Au.right : Nu.right, mm = sm - Yu, hm = zu - pm;
            return {
              top: pm,
              bottom: zu,
              left: Yu,
              right: sm,
              width: mm,
              height: hm,
              x: Yu,
              y: pm
            };
          }
          const Fs = getSide(Zt) === "left", Bs = max$4(...Ms.map((Au) => Au.right)), Hs = min$4(...Ms.map((Au) => Au.left)), Ws = Ms.filter((Au) => Fs ? Au.left === Hs : Au.right === Bs), Ys = Ws[0].top, El = Ws[Ws.length - 1].bottom, Mu = Hs, Pl = Bs, Iu = Pl - Mu, Tu = El - Ys;
          return {
            top: Ys,
            bottom: El,
            left: Mu,
            right: Pl,
            width: Iu,
            height: Tu,
            x: Mu,
            y: Ys
          };
        }
        return Ds;
      }
      const zs = await kn.getElementRects({
        reference: {
          getBoundingClientRect: js
        },
        floating: $n.floating,
        strategy: Kn
      });
      return Sn.reference.x !== zs.reference.x || Sn.reference.y !== zs.reference.y || Sn.reference.width !== zs.reference.width || Sn.reference.height !== zs.reference.height ? {
        reset: {
          rects: zs
        }
      } : {};
    }
  };
};
async function convertValueToCoords(_e, Qt) {
  const {
    placement: Zt,
    platform: $n,
    elements: Sn
  } = _e, kn = await ($n.isRTL == null ? void 0 : $n.isRTL(Sn.floating)), Kn = getSide(Zt), er = getAlignment(Zt), Cr = getSideAxis(Zt) === "y", kr = ["left", "top"].includes(Kn) ? -1 : 1, Yr = kn && Cr ? -1 : 1, Ms = evaluate$1(Qt, _e);
  let {
    mainAxis: Ds,
    crossAxis: Ls,
    alignmentAxis: js
  } = typeof Ms == "number" ? {
    mainAxis: Ms,
    crossAxis: 0,
    alignmentAxis: null
  } : {
    mainAxis: 0,
    crossAxis: 0,
    alignmentAxis: null,
    ...Ms
  };
  return er && typeof js == "number" && (Ls = er === "end" ? js * -1 : js), Cr ? {
    x: Ls * Yr,
    y: Ds * kr
  } : {
    x: Ds * kr,
    y: Ls * Yr
  };
}
const offset$4 = function(_e) {
  return _e === void 0 && (_e = 0), {
    name: "offset",
    options: _e,
    async fn(Qt) {
      const {
        x: Zt,
        y: $n
      } = Qt, Sn = await convertValueToCoords(Qt, _e);
      return {
        x: Zt + Sn.x,
        y: $n + Sn.y,
        data: Sn
      };
    }
  };
}, shift$1 = function(_e) {
  return _e === void 0 && (_e = {}), {
    name: "shift",
    options: _e,
    async fn(Qt) {
      const {
        x: Zt,
        y: $n,
        placement: Sn
      } = Qt, {
        mainAxis: kn = !0,
        crossAxis: Kn = !1,
        limiter: er = {
          fn: (Fs) => {
            let {
              x: Bs,
              y: Hs
            } = Fs;
            return {
              x: Bs,
              y: Hs
            };
          }
        },
        ...Cr
      } = evaluate$1(_e, Qt), kr = {
        x: Zt,
        y: $n
      }, Yr = await detectOverflow(Qt, Cr), Ms = getSideAxis(getSide(Sn)), Ds = getOppositeAxis(Ms);
      let Ls = kr[Ds], js = kr[Ms];
      if (kn) {
        const Fs = Ds === "y" ? "top" : "left", Bs = Ds === "y" ? "bottom" : "right", Hs = Ls + Yr[Fs], Ws = Ls - Yr[Bs];
        Ls = clamp$1(Hs, Ls, Ws);
      }
      if (Kn) {
        const Fs = Ms === "y" ? "top" : "left", Bs = Ms === "y" ? "bottom" : "right", Hs = js + Yr[Fs], Ws = js - Yr[Bs];
        js = clamp$1(Hs, js, Ws);
      }
      const zs = er.fn({
        ...Qt,
        [Ds]: Ls,
        [Ms]: js
      });
      return {
        ...zs,
        data: {
          x: zs.x - Zt,
          y: zs.y - $n
        }
      };
    }
  };
}, limitShift = function(_e) {
  return _e === void 0 && (_e = {}), {
    options: _e,
    fn(Qt) {
      const {
        x: Zt,
        y: $n,
        placement: Sn,
        rects: kn,
        middlewareData: Kn
      } = Qt, {
        offset: er = 0,
        mainAxis: Cr = !0,
        crossAxis: kr = !0
      } = evaluate$1(_e, Qt), Yr = {
        x: Zt,
        y: $n
      }, Ms = getSideAxis(Sn), Ds = getOppositeAxis(Ms);
      let Ls = Yr[Ds], js = Yr[Ms];
      const zs = evaluate$1(er, Qt), Fs = typeof zs == "number" ? {
        mainAxis: zs,
        crossAxis: 0
      } : {
        mainAxis: 0,
        crossAxis: 0,
        ...zs
      };
      if (Cr) {
        const Ws = Ds === "y" ? "height" : "width", Ys = kn.reference[Ds] - kn.floating[Ws] + Fs.mainAxis, El = kn.reference[Ds] + kn.reference[Ws] - Fs.mainAxis;
        Ls < Ys ? Ls = Ys : Ls > El && (Ls = El);
      }
      if (kr) {
        var Bs, Hs;
        const Ws = Ds === "y" ? "width" : "height", Ys = ["top", "left"].includes(getSide(Sn)), El = kn.reference[Ms] - kn.floating[Ws] + (Ys && ((Bs = Kn.offset) == null ? void 0 : Bs[Ms]) || 0) + (Ys ? 0 : Fs.crossAxis), Mu = kn.reference[Ms] + kn.reference[Ws] + (Ys ? 0 : ((Hs = Kn.offset) == null ? void 0 : Hs[Ms]) || 0) - (Ys ? Fs.crossAxis : 0);
        js < El ? js = El : js > Mu && (js = Mu);
      }
      return {
        [Ds]: Ls,
        [Ms]: js
      };
    }
  };
}, size = function(_e) {
  return _e === void 0 && (_e = {}), {
    name: "size",
    options: _e,
    async fn(Qt) {
      const {
        placement: Zt,
        rects: $n,
        platform: Sn,
        elements: kn
      } = Qt, {
        apply: Kn = () => {
        },
        ...er
      } = evaluate$1(_e, Qt), Cr = await detectOverflow(Qt, er), kr = getSide(Zt), Yr = getAlignment(Zt), Ms = getSideAxis(Zt) === "y", {
        width: Ds,
        height: Ls
      } = $n.floating;
      let js, zs;
      kr === "top" || kr === "bottom" ? (js = kr, zs = Yr === (await (Sn.isRTL == null ? void 0 : Sn.isRTL(kn.floating)) ? "start" : "end") ? "left" : "right") : (zs = kr, js = Yr === "end" ? "top" : "bottom");
      const Fs = Ls - Cr[js], Bs = Ds - Cr[zs], Hs = !Qt.middlewareData.shift;
      let Ws = Fs, Ys = Bs;
      if (Ms) {
        const Mu = Ds - Cr.left - Cr.right;
        Ys = Yr || Hs ? min$4(Bs, Mu) : Mu;
      } else {
        const Mu = Ls - Cr.top - Cr.bottom;
        Ws = Yr || Hs ? min$4(Fs, Mu) : Mu;
      }
      if (Hs && !Yr) {
        const Mu = max$4(Cr.left, 0), Pl = max$4(Cr.right, 0), Iu = max$4(Cr.top, 0), Tu = max$4(Cr.bottom, 0);
        Ms ? Ys = Ds - 2 * (Mu !== 0 || Pl !== 0 ? Mu + Pl : max$4(Cr.left, Cr.right)) : Ws = Ls - 2 * (Iu !== 0 || Tu !== 0 ? Iu + Tu : max$4(Cr.top, Cr.bottom));
      }
      await Kn({
        ...Qt,
        availableWidth: Ys,
        availableHeight: Ws
      });
      const El = await Sn.getDimensions(kn.floating);
      return Ds !== El.width || Ls !== El.height ? {
        reset: {
          rects: !0
        }
      } : {};
    }
  };
};
function getNodeName(_e) {
  return isNode(_e) ? (_e.nodeName || "").toLowerCase() : "#document";
}
function getWindow$1(_e) {
  var Qt;
  return (_e == null || (Qt = _e.ownerDocument) == null ? void 0 : Qt.defaultView) || window;
}
function getDocumentElement$1(_e) {
  var Qt;
  return (Qt = (isNode(_e) ? _e.ownerDocument : _e.document) || window.document) == null ? void 0 : Qt.documentElement;
}
function isNode(_e) {
  return _e instanceof Node || _e instanceof getWindow$1(_e).Node;
}
function isElement$2(_e) {
  return _e instanceof Element || _e instanceof getWindow$1(_e).Element;
}
function isHTMLElement$1(_e) {
  return _e instanceof HTMLElement || _e instanceof getWindow$1(_e).HTMLElement;
}
function isShadowRoot$1(_e) {
  return typeof ShadowRoot > "u" ? !1 : _e instanceof ShadowRoot || _e instanceof getWindow$1(_e).ShadowRoot;
}
function isOverflowElement(_e) {
  const {
    overflow: Qt,
    overflowX: Zt,
    overflowY: $n,
    display: Sn
  } = getComputedStyle$1(_e);
  return /auto|scroll|overlay|hidden|clip/.test(Qt + $n + Zt) && !["inline", "contents"].includes(Sn);
}
function isTableElement(_e) {
  return ["table", "td", "th"].includes(getNodeName(_e));
}
function isContainingBlock(_e) {
  const Qt = isWebKit(), Zt = getComputedStyle$1(_e);
  return Zt.transform !== "none" || Zt.perspective !== "none" || (Zt.containerType ? Zt.containerType !== "normal" : !1) || !Qt && (Zt.backdropFilter ? Zt.backdropFilter !== "none" : !1) || !Qt && (Zt.filter ? Zt.filter !== "none" : !1) || ["transform", "perspective", "filter"].some(($n) => (Zt.willChange || "").includes($n)) || ["paint", "layout", "strict", "content"].some(($n) => (Zt.contain || "").includes($n));
}
function getContainingBlock(_e) {
  let Qt = getParentNode(_e);
  for (; isHTMLElement$1(Qt) && !isLastTraversableNode(Qt); ) {
    if (isContainingBlock(Qt))
      return Qt;
    Qt = getParentNode(Qt);
  }
  return null;
}
function isWebKit() {
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
function isLastTraversableNode(_e) {
  return ["html", "body", "#document"].includes(getNodeName(_e));
}
function getComputedStyle$1(_e) {
  return getWindow$1(_e).getComputedStyle(_e);
}
function getNodeScroll(_e) {
  return isElement$2(_e) ? {
    scrollLeft: _e.scrollLeft,
    scrollTop: _e.scrollTop
  } : {
    scrollLeft: _e.pageXOffset,
    scrollTop: _e.pageYOffset
  };
}
function getParentNode(_e) {
  if (getNodeName(_e) === "html")
    return _e;
  const Qt = (
    // Step into the shadow DOM of the parent of a slotted node.
    _e.assignedSlot || // DOM Element detected.
    _e.parentNode || // ShadowRoot detected.
    isShadowRoot$1(_e) && _e.host || // Fallback.
    getDocumentElement$1(_e)
  );
  return isShadowRoot$1(Qt) ? Qt.host : Qt;
}
function getNearestOverflowAncestor(_e) {
  const Qt = getParentNode(_e);
  return isLastTraversableNode(Qt) ? _e.ownerDocument ? _e.ownerDocument.body : _e.body : isHTMLElement$1(Qt) && isOverflowElement(Qt) ? Qt : getNearestOverflowAncestor(Qt);
}
function getOverflowAncestors(_e, Qt) {
  var Zt;
  Qt === void 0 && (Qt = []);
  const $n = getNearestOverflowAncestor(_e), Sn = $n === ((Zt = _e.ownerDocument) == null ? void 0 : Zt.body), kn = getWindow$1($n);
  return Sn ? Qt.concat(kn, kn.visualViewport || [], isOverflowElement($n) ? $n : []) : Qt.concat($n, getOverflowAncestors($n));
}
function getCssDimensions(_e) {
  const Qt = getComputedStyle$1(_e);
  let Zt = parseFloat(Qt.width) || 0, $n = parseFloat(Qt.height) || 0;
  const Sn = isHTMLElement$1(_e), kn = Sn ? _e.offsetWidth : Zt, Kn = Sn ? _e.offsetHeight : $n, er = round(Zt) !== kn || round($n) !== Kn;
  return er && (Zt = kn, $n = Kn), {
    width: Zt,
    height: $n,
    $: er
  };
}
function unwrapElement(_e) {
  return isElement$2(_e) ? _e : _e.contextElement;
}
function getScale$1(_e) {
  const Qt = unwrapElement(_e);
  if (!isHTMLElement$1(Qt))
    return createCoords(1);
  const Zt = Qt.getBoundingClientRect(), {
    width: $n,
    height: Sn,
    $: kn
  } = getCssDimensions(Qt);
  let Kn = (kn ? round(Zt.width) : Zt.width) / $n, er = (kn ? round(Zt.height) : Zt.height) / Sn;
  return (!Kn || !Number.isFinite(Kn)) && (Kn = 1), (!er || !Number.isFinite(er)) && (er = 1), {
    x: Kn,
    y: er
  };
}
const noOffsets = /* @__PURE__ */ createCoords(0);
function getVisualOffsets(_e) {
  const Qt = getWindow$1(_e);
  return !isWebKit() || !Qt.visualViewport ? noOffsets : {
    x: Qt.visualViewport.offsetLeft,
    y: Qt.visualViewport.offsetTop
  };
}
function shouldAddVisualOffsets(_e, Qt, Zt) {
  return Qt === void 0 && (Qt = !1), !Zt || Qt && Zt !== getWindow$1(_e) ? !1 : Qt;
}
function getBoundingClientRect(_e, Qt, Zt, $n) {
  Qt === void 0 && (Qt = !1), Zt === void 0 && (Zt = !1);
  const Sn = _e.getBoundingClientRect(), kn = unwrapElement(_e);
  let Kn = createCoords(1);
  Qt && ($n ? isElement$2($n) && (Kn = getScale$1($n)) : Kn = getScale$1(_e));
  const er = shouldAddVisualOffsets(kn, Zt, $n) ? getVisualOffsets(kn) : createCoords(0);
  let Cr = (Sn.left + er.x) / Kn.x, kr = (Sn.top + er.y) / Kn.y, Yr = Sn.width / Kn.x, Ms = Sn.height / Kn.y;
  if (kn) {
    const Ds = getWindow$1(kn), Ls = $n && isElement$2($n) ? getWindow$1($n) : $n;
    let js = Ds.frameElement;
    for (; js && $n && Ls !== Ds; ) {
      const zs = getScale$1(js), Fs = js.getBoundingClientRect(), Bs = getComputedStyle$1(js), Hs = Fs.left + (js.clientLeft + parseFloat(Bs.paddingLeft)) * zs.x, Ws = Fs.top + (js.clientTop + parseFloat(Bs.paddingTop)) * zs.y;
      Cr *= zs.x, kr *= zs.y, Yr *= zs.x, Ms *= zs.y, Cr += Hs, kr += Ws, js = getWindow$1(js).frameElement;
    }
  }
  return rectToClientRect({
    width: Yr,
    height: Ms,
    x: Cr,
    y: kr
  });
}
function convertOffsetParentRelativeRectToViewportRelativeRect(_e) {
  let {
    rect: Qt,
    offsetParent: Zt,
    strategy: $n
  } = _e;
  const Sn = isHTMLElement$1(Zt), kn = getDocumentElement$1(Zt);
  if (Zt === kn)
    return Qt;
  let Kn = {
    scrollLeft: 0,
    scrollTop: 0
  }, er = createCoords(1);
  const Cr = createCoords(0);
  if ((Sn || !Sn && $n !== "fixed") && ((getNodeName(Zt) !== "body" || isOverflowElement(kn)) && (Kn = getNodeScroll(Zt)), isHTMLElement$1(Zt))) {
    const kr = getBoundingClientRect(Zt);
    er = getScale$1(Zt), Cr.x = kr.x + Zt.clientLeft, Cr.y = kr.y + Zt.clientTop;
  }
  return {
    width: Qt.width * er.x,
    height: Qt.height * er.y,
    x: Qt.x * er.x - Kn.scrollLeft * er.x + Cr.x,
    y: Qt.y * er.y - Kn.scrollTop * er.y + Cr.y
  };
}
function getClientRects(_e) {
  return Array.from(_e.getClientRects());
}
function getWindowScrollBarX(_e) {
  return getBoundingClientRect(getDocumentElement$1(_e)).left + getNodeScroll(_e).scrollLeft;
}
function getDocumentRect(_e) {
  const Qt = getDocumentElement$1(_e), Zt = getNodeScroll(_e), $n = _e.ownerDocument.body, Sn = max$4(Qt.scrollWidth, Qt.clientWidth, $n.scrollWidth, $n.clientWidth), kn = max$4(Qt.scrollHeight, Qt.clientHeight, $n.scrollHeight, $n.clientHeight);
  let Kn = -Zt.scrollLeft + getWindowScrollBarX(_e);
  const er = -Zt.scrollTop;
  return getComputedStyle$1($n).direction === "rtl" && (Kn += max$4(Qt.clientWidth, $n.clientWidth) - Sn), {
    width: Sn,
    height: kn,
    x: Kn,
    y: er
  };
}
function getViewportRect(_e, Qt) {
  const Zt = getWindow$1(_e), $n = getDocumentElement$1(_e), Sn = Zt.visualViewport;
  let kn = $n.clientWidth, Kn = $n.clientHeight, er = 0, Cr = 0;
  if (Sn) {
    kn = Sn.width, Kn = Sn.height;
    const kr = isWebKit();
    (!kr || kr && Qt === "fixed") && (er = Sn.offsetLeft, Cr = Sn.offsetTop);
  }
  return {
    width: kn,
    height: Kn,
    x: er,
    y: Cr
  };
}
function getInnerBoundingClientRect(_e, Qt) {
  const Zt = getBoundingClientRect(_e, !0, Qt === "fixed"), $n = Zt.top + _e.clientTop, Sn = Zt.left + _e.clientLeft, kn = isHTMLElement$1(_e) ? getScale$1(_e) : createCoords(1), Kn = _e.clientWidth * kn.x, er = _e.clientHeight * kn.y, Cr = Sn * kn.x, kr = $n * kn.y;
  return {
    width: Kn,
    height: er,
    x: Cr,
    y: kr
  };
}
function getClientRectFromClippingAncestor(_e, Qt, Zt) {
  let $n;
  if (Qt === "viewport")
    $n = getViewportRect(_e, Zt);
  else if (Qt === "document")
    $n = getDocumentRect(getDocumentElement$1(_e));
  else if (isElement$2(Qt))
    $n = getInnerBoundingClientRect(Qt, Zt);
  else {
    const Sn = getVisualOffsets(_e);
    $n = {
      ...Qt,
      x: Qt.x - Sn.x,
      y: Qt.y - Sn.y
    };
  }
  return rectToClientRect($n);
}
function hasFixedPositionAncestor(_e, Qt) {
  const Zt = getParentNode(_e);
  return Zt === Qt || !isElement$2(Zt) || isLastTraversableNode(Zt) ? !1 : getComputedStyle$1(Zt).position === "fixed" || hasFixedPositionAncestor(Zt, Qt);
}
function getClippingElementAncestors(_e, Qt) {
  const Zt = Qt.get(_e);
  if (Zt)
    return Zt;
  let $n = getOverflowAncestors(_e).filter((er) => isElement$2(er) && getNodeName(er) !== "body"), Sn = null;
  const kn = getComputedStyle$1(_e).position === "fixed";
  let Kn = kn ? getParentNode(_e) : _e;
  for (; isElement$2(Kn) && !isLastTraversableNode(Kn); ) {
    const er = getComputedStyle$1(Kn), Cr = isContainingBlock(Kn);
    !Cr && er.position === "fixed" && (Sn = null), (kn ? !Cr && !Sn : !Cr && er.position === "static" && !!Sn && ["absolute", "fixed"].includes(Sn.position) || isOverflowElement(Kn) && !Cr && hasFixedPositionAncestor(_e, Kn)) ? $n = $n.filter((Yr) => Yr !== Kn) : Sn = er, Kn = getParentNode(Kn);
  }
  return Qt.set(_e, $n), $n;
}
function getClippingRect(_e) {
  let {
    element: Qt,
    boundary: Zt,
    rootBoundary: $n,
    strategy: Sn
  } = _e;
  const Kn = [...Zt === "clippingAncestors" ? getClippingElementAncestors(Qt, this._c) : [].concat(Zt), $n], er = Kn[0], Cr = Kn.reduce((kr, Yr) => {
    const Ms = getClientRectFromClippingAncestor(Qt, Yr, Sn);
    return kr.top = max$4(Ms.top, kr.top), kr.right = min$4(Ms.right, kr.right), kr.bottom = min$4(Ms.bottom, kr.bottom), kr.left = max$4(Ms.left, kr.left), kr;
  }, getClientRectFromClippingAncestor(Qt, er, Sn));
  return {
    width: Cr.right - Cr.left,
    height: Cr.bottom - Cr.top,
    x: Cr.left,
    y: Cr.top
  };
}
function getDimensions(_e) {
  return getCssDimensions(_e);
}
function getRectRelativeToOffsetParent(_e, Qt, Zt) {
  const $n = isHTMLElement$1(Qt), Sn = getDocumentElement$1(Qt), kn = Zt === "fixed", Kn = getBoundingClientRect(_e, !0, kn, Qt);
  let er = {
    scrollLeft: 0,
    scrollTop: 0
  };
  const Cr = createCoords(0);
  if ($n || !$n && !kn)
    if ((getNodeName(Qt) !== "body" || isOverflowElement(Sn)) && (er = getNodeScroll(Qt)), $n) {
      const kr = getBoundingClientRect(Qt, !0, kn, Qt);
      Cr.x = kr.x + Qt.clientLeft, Cr.y = kr.y + Qt.clientTop;
    } else
      Sn && (Cr.x = getWindowScrollBarX(Sn));
  return {
    x: Kn.left + er.scrollLeft - Cr.x,
    y: Kn.top + er.scrollTop - Cr.y,
    width: Kn.width,
    height: Kn.height
  };
}
function getTrueOffsetParent(_e, Qt) {
  return !isHTMLElement$1(_e) || getComputedStyle$1(_e).position === "fixed" ? null : Qt ? Qt(_e) : _e.offsetParent;
}
function getOffsetParent(_e, Qt) {
  const Zt = getWindow$1(_e);
  if (!isHTMLElement$1(_e))
    return Zt;
  let $n = getTrueOffsetParent(_e, Qt);
  for (; $n && isTableElement($n) && getComputedStyle$1($n).position === "static"; )
    $n = getTrueOffsetParent($n, Qt);
  return $n && (getNodeName($n) === "html" || getNodeName($n) === "body" && getComputedStyle$1($n).position === "static" && !isContainingBlock($n)) ? Zt : $n || getContainingBlock(_e) || Zt;
}
const getElementRects = async function(_e) {
  let {
    reference: Qt,
    floating: Zt,
    strategy: $n
  } = _e;
  const Sn = this.getOffsetParent || getOffsetParent, kn = this.getDimensions;
  return {
    reference: getRectRelativeToOffsetParent(Qt, await Sn(Zt), $n),
    floating: {
      x: 0,
      y: 0,
      ...await kn(Zt)
    }
  };
};
function isRTL(_e) {
  return getComputedStyle$1(_e).direction === "rtl";
}
const platform = {
  convertOffsetParentRelativeRectToViewportRelativeRect,
  getDocumentElement: getDocumentElement$1,
  getClippingRect,
  getOffsetParent,
  getElementRects,
  getClientRects,
  getDimensions,
  getScale: getScale$1,
  isElement: isElement$2,
  isRTL
};
function observeMove(_e, Qt) {
  let Zt = null, $n;
  const Sn = getDocumentElement$1(_e);
  function kn() {
    clearTimeout($n), Zt && Zt.disconnect(), Zt = null;
  }
  function Kn(er, Cr) {
    er === void 0 && (er = !1), Cr === void 0 && (Cr = 1), kn();
    const {
      left: kr,
      top: Yr,
      width: Ms,
      height: Ds
    } = _e.getBoundingClientRect();
    if (er || Qt(), !Ms || !Ds)
      return;
    const Ls = floor$1(Yr), js = floor$1(Sn.clientWidth - (kr + Ms)), zs = floor$1(Sn.clientHeight - (Yr + Ds)), Fs = floor$1(kr), Hs = {
      rootMargin: -Ls + "px " + -js + "px " + -zs + "px " + -Fs + "px",
      threshold: max$4(0, min$4(1, Cr)) || 1
    };
    let Ws = !0;
    function Ys(El) {
      const Mu = El[0].intersectionRatio;
      if (Mu !== Cr) {
        if (!Ws)
          return Kn();
        Mu ? Kn(!1, Mu) : $n = setTimeout(() => {
          Kn(!1, 1e-7);
        }, 100);
      }
      Ws = !1;
    }
    try {
      Zt = new IntersectionObserver(Ys, {
        ...Hs,
        // Handle <iframe>s
        root: Sn.ownerDocument
      });
    } catch {
      Zt = new IntersectionObserver(Ys, Hs);
    }
    Zt.observe(_e);
  }
  return Kn(!0), kn;
}
function autoUpdate(_e, Qt, Zt, $n) {
  $n === void 0 && ($n = {});
  const {
    ancestorScroll: Sn = !0,
    ancestorResize: kn = !0,
    elementResize: Kn = typeof ResizeObserver == "function",
    layoutShift: er = typeof IntersectionObserver == "function",
    animationFrame: Cr = !1
  } = $n, kr = unwrapElement(_e), Yr = Sn || kn ? [...kr ? getOverflowAncestors(kr) : [], ...getOverflowAncestors(Qt)] : [];
  Yr.forEach((Bs) => {
    Sn && Bs.addEventListener("scroll", Zt, {
      passive: !0
    }), kn && Bs.addEventListener("resize", Zt);
  });
  const Ms = kr && er ? observeMove(kr, Zt) : null;
  let Ds = -1, Ls = null;
  Kn && (Ls = new ResizeObserver((Bs) => {
    let [Hs] = Bs;
    Hs && Hs.target === kr && Ls && (Ls.unobserve(Qt), cancelAnimationFrame(Ds), Ds = requestAnimationFrame(() => {
      Ls && Ls.observe(Qt);
    })), Zt();
  }), kr && !Cr && Ls.observe(kr), Ls.observe(Qt));
  let js, zs = Cr ? getBoundingClientRect(_e) : null;
  Cr && Fs();
  function Fs() {
    const Bs = getBoundingClientRect(_e);
    zs && (Bs.x !== zs.x || Bs.y !== zs.y || Bs.width !== zs.width || Bs.height !== zs.height) && Zt(), zs = Bs, js = requestAnimationFrame(Fs);
  }
  return Zt(), () => {
    Yr.forEach((Bs) => {
      Sn && Bs.removeEventListener("scroll", Zt), kn && Bs.removeEventListener("resize", Zt);
    }), Ms && Ms(), Ls && Ls.disconnect(), Ls = null, Cr && cancelAnimationFrame(js);
  };
}
const computePosition = (_e, Qt, Zt) => {
  const $n = /* @__PURE__ */ new Map(), Sn = {
    platform,
    ...Zt
  }, kn = {
    ...Sn.platform,
    _c: $n
  };
  return computePosition$1(_e, Qt, {
    ...Sn,
    platform: kn
  });
}, arrow = (_e) => {
  const {
    element: Qt,
    padding: Zt
  } = _e;
  function $n(Sn) {
    return Object.prototype.hasOwnProperty.call(Sn, "current");
  }
  return {
    name: "arrow",
    options: _e,
    fn(Sn) {
      return $n(Qt) ? Qt.current != null ? arrow$1({
        element: Qt.current,
        padding: Zt
      }).fn(Sn) : {} : Qt ? arrow$1({
        element: Qt,
        padding: Zt
      }).fn(Sn) : {};
    }
  };
};
var index$5 = typeof document < "u" ? reactExports.useLayoutEffect : reactExports.useEffect;
function deepEqual$1(_e, Qt) {
  if (_e === Qt)
    return !0;
  if (typeof _e != typeof Qt)
    return !1;
  if (typeof _e == "function" && _e.toString() === Qt.toString())
    return !0;
  let Zt, $n, Sn;
  if (_e && Qt && typeof _e == "object") {
    if (Array.isArray(_e)) {
      if (Zt = _e.length, Zt != Qt.length)
        return !1;
      for ($n = Zt; $n-- !== 0; )
        if (!deepEqual$1(_e[$n], Qt[$n]))
          return !1;
      return !0;
    }
    if (Sn = Object.keys(_e), Zt = Sn.length, Zt !== Object.keys(Qt).length)
      return !1;
    for ($n = Zt; $n-- !== 0; )
      if (!Object.prototype.hasOwnProperty.call(Qt, Sn[$n]))
        return !1;
    for ($n = Zt; $n-- !== 0; ) {
      const kn = Sn[$n];
      if (!(kn === "_owner" && _e.$$typeof) && !deepEqual$1(_e[kn], Qt[kn]))
        return !1;
    }
    return !0;
  }
  return _e !== _e && Qt !== Qt;
}
function useLatestRef$1(_e) {
  const Qt = reactExports.useRef(_e);
  return index$5(() => {
    Qt.current = _e;
  }), Qt;
}
function useFloating$1(_e) {
  _e === void 0 && (_e = {});
  const {
    placement: Qt = "bottom",
    strategy: Zt = "absolute",
    middleware: $n = [],
    platform: Sn,
    whileElementsMounted: kn,
    open: Kn
  } = _e, [er, Cr] = reactExports.useState({
    x: null,
    y: null,
    strategy: Zt,
    placement: Qt,
    middlewareData: {},
    isPositioned: !1
  }), [kr, Yr] = reactExports.useState($n);
  deepEqual$1(kr, $n) || Yr($n);
  const Ms = reactExports.useRef(null), Ds = reactExports.useRef(null), Ls = reactExports.useRef(er), js = useLatestRef$1(kn), zs = useLatestRef$1(Sn), [Fs, Bs] = reactExports.useState(null), [Hs, Ws] = reactExports.useState(null), Ys = reactExports.useCallback((Au) => {
    Ms.current !== Au && (Ms.current = Au, Bs(Au));
  }, []), El = reactExports.useCallback((Au) => {
    Ds.current !== Au && (Ds.current = Au, Ws(Au));
  }, []), Mu = reactExports.useCallback(() => {
    if (!Ms.current || !Ds.current)
      return;
    const Au = {
      placement: Qt,
      strategy: Zt,
      middleware: kr
    };
    zs.current && (Au.platform = zs.current), computePosition(Ms.current, Ds.current, Au).then((Nu) => {
      const gm = {
        ...Nu,
        isPositioned: !0
      };
      Pl.current && !deepEqual$1(Ls.current, gm) && (Ls.current = gm, reactDomExports.flushSync(() => {
        Cr(gm);
      }));
    });
  }, [kr, Qt, Zt, zs]);
  index$5(() => {
    Kn === !1 && Ls.current.isPositioned && (Ls.current.isPositioned = !1, Cr((Au) => ({
      ...Au,
      isPositioned: !1
    })));
  }, [Kn]);
  const Pl = reactExports.useRef(!1);
  index$5(() => (Pl.current = !0, () => {
    Pl.current = !1;
  }), []), index$5(() => {
    if (Fs && Hs) {
      if (js.current)
        return js.current(Fs, Hs, Mu);
      Mu();
    }
  }, [Fs, Hs, Mu, js]);
  const Iu = reactExports.useMemo(() => ({
    reference: Ms,
    floating: Ds,
    setReference: Ys,
    setFloating: El
  }), [Ys, El]), Tu = reactExports.useMemo(() => ({
    reference: Fs,
    floating: Hs
  }), [Fs, Hs]);
  return reactExports.useMemo(() => ({
    ...er,
    update: Mu,
    refs: Iu,
    elements: Tu,
    reference: Ys,
    floating: El
  }), [er, Mu, Iu, Tu, Ys, El]);
}
var index$4 = typeof document < "u" ? reactExports.useLayoutEffect : reactExports.useEffect;
let serverHandoffComplete = !1, count$4 = 0;
const genId = () => "floating-ui-" + count$4++;
function useFloatingId() {
  const [_e, Qt] = reactExports.useState(() => serverHandoffComplete ? genId() : void 0);
  return index$4(() => {
    _e == null && Qt(genId());
  }, []), reactExports.useEffect(() => {
    serverHandoffComplete || (serverHandoffComplete = !0);
  }, []), _e;
}
const useReactId = A$4[/* @__PURE__ */ "useId".toString()], useId = useReactId || useFloatingId;
function createPubSub() {
  const _e = /* @__PURE__ */ new Map();
  return {
    emit(Qt, Zt) {
      var $n;
      ($n = _e.get(Qt)) == null || $n.forEach((Sn) => Sn(Zt));
    },
    on(Qt, Zt) {
      _e.set(Qt, [..._e.get(Qt) || [], Zt]);
    },
    off(Qt, Zt) {
      _e.set(Qt, (_e.get(Qt) || []).filter(($n) => $n !== Zt));
    }
  };
}
const FloatingNodeContext = /* @__PURE__ */ reactExports.createContext(null), FloatingTreeContext = /* @__PURE__ */ reactExports.createContext(null), useFloatingParentNodeId = () => {
  var _e;
  return ((_e = reactExports.useContext(FloatingNodeContext)) == null ? void 0 : _e.id) || null;
}, useFloatingTree = () => reactExports.useContext(FloatingTreeContext);
function getDocument(_e) {
  return (_e == null ? void 0 : _e.ownerDocument) || document;
}
function getPlatform() {
  const _e = navigator.userAgentData;
  return _e != null && _e.platform ? _e.platform : navigator.platform;
}
function getUserAgent() {
  const _e = navigator.userAgentData;
  return _e && Array.isArray(_e.brands) ? _e.brands.map((Qt) => {
    let {
      brand: Zt,
      version: $n
    } = Qt;
    return Zt + "/" + $n;
  }).join(" ") : navigator.userAgent;
}
function getWindow(_e) {
  return getDocument(_e).defaultView || window;
}
function isElement$1(_e) {
  return _e ? _e instanceof getWindow(_e).Element : !1;
}
function isHTMLElement(_e) {
  return _e ? _e instanceof getWindow(_e).HTMLElement : !1;
}
function isShadowRoot(_e) {
  if (typeof ShadowRoot > "u")
    return !1;
  const Qt = getWindow(_e).ShadowRoot;
  return _e instanceof Qt || _e instanceof ShadowRoot;
}
function isVirtualClick(_e) {
  if (_e.mozInputSource === 0 && _e.isTrusted)
    return !0;
  const Qt = /Android/i;
  return (Qt.test(getPlatform()) || Qt.test(getUserAgent())) && _e.pointerType ? _e.type === "click" && _e.buttons === 1 : _e.detail === 0 && !_e.pointerType;
}
function isVirtualPointerEvent(_e) {
  return _e.width === 0 && _e.height === 0 || _e.width === 1 && _e.height === 1 && _e.pressure === 0 && _e.detail === 0 && _e.pointerType !== "mouse" || // iOS VoiceOver returns 0.333• for width/height.
  _e.width < 1 && _e.height < 1 && _e.pressure === 0 && _e.detail === 0;
}
function isMouseLikePointerType(_e, Qt) {
  const Zt = ["mouse", "pen"];
  return Qt || Zt.push("", void 0), Zt.includes(_e);
}
function useLatestRef(_e) {
  const Qt = reactExports.useRef(_e);
  return index$4(() => {
    Qt.current = _e;
  }), Qt;
}
const safePolygonIdentifier = "data-floating-ui-safe-polygon";
function getDelay(_e, Qt, Zt) {
  return Zt && !isMouseLikePointerType(Zt) ? 0 : typeof _e == "number" ? _e : _e == null ? void 0 : _e[Qt];
}
const useHover = function(_e, Qt) {
  let {
    enabled: Zt = !0,
    delay: $n = 0,
    handleClose: Sn = null,
    mouseOnly: kn = !1,
    restMs: Kn = 0,
    move: er = !0
  } = Qt === void 0 ? {} : Qt;
  const {
    open: Cr,
    onOpenChange: kr,
    dataRef: Yr,
    events: Ms,
    elements: {
      domReference: Ds,
      floating: Ls
    },
    refs: js
  } = _e, zs = useFloatingTree(), Fs = useFloatingParentNodeId(), Bs = useLatestRef(Sn), Hs = useLatestRef($n), Ws = reactExports.useRef(), Ys = reactExports.useRef(), El = reactExports.useRef(), Mu = reactExports.useRef(), Pl = reactExports.useRef(!0), Iu = reactExports.useRef(!1), Tu = reactExports.useRef(() => {
  }), Au = reactExports.useCallback(() => {
    var zu;
    const Yu = (zu = Yr.current.openEvent) == null ? void 0 : zu.type;
    return (Yu == null ? void 0 : Yu.includes("mouse")) && Yu !== "mousedown";
  }, [Yr]);
  reactExports.useEffect(() => {
    if (!Zt)
      return;
    function zu() {
      clearTimeout(Ys.current), clearTimeout(Mu.current), Pl.current = !0;
    }
    return Ms.on("dismiss", zu), () => {
      Ms.off("dismiss", zu);
    };
  }, [Zt, Ms]), reactExports.useEffect(() => {
    if (!Zt || !Bs.current || !Cr)
      return;
    function zu() {
      Au() && kr(!1);
    }
    const Yu = getDocument(Ls).documentElement;
    return Yu.addEventListener("mouseleave", zu), () => {
      Yu.removeEventListener("mouseleave", zu);
    };
  }, [Ls, Cr, kr, Zt, Bs, Yr, Au]);
  const Nu = reactExports.useCallback(function(zu) {
    zu === void 0 && (zu = !0);
    const Yu = getDelay(Hs.current, "close", Ws.current);
    Yu && !El.current ? (clearTimeout(Ys.current), Ys.current = setTimeout(() => kr(!1), Yu)) : zu && (clearTimeout(Ys.current), kr(!1));
  }, [Hs, kr]), gm = reactExports.useCallback(() => {
    Tu.current(), El.current = void 0;
  }, []), pm = reactExports.useCallback(() => {
    if (Iu.current) {
      const zu = getDocument(js.floating.current).body;
      zu.style.pointerEvents = "", zu.removeAttribute(safePolygonIdentifier), Iu.current = !1;
    }
  }, [js]);
  return reactExports.useEffect(() => {
    if (!Zt)
      return;
    function zu() {
      return Yr.current.openEvent ? ["click", "mousedown"].includes(Yr.current.openEvent.type) : !1;
    }
    function Yu(hm) {
      if (clearTimeout(Ys.current), Pl.current = !1, kn && !isMouseLikePointerType(Ws.current) || Kn > 0 && getDelay(Hs.current, "open") === 0)
        return;
      Yr.current.openEvent = hm;
      const ym = getDelay(Hs.current, "open", Ws.current);
      ym ? Ys.current = setTimeout(() => {
        kr(!0);
      }, ym) : kr(!0);
    }
    function sm(hm) {
      if (zu())
        return;
      Tu.current();
      const ym = getDocument(Ls);
      if (clearTimeout(Mu.current), Bs.current) {
        Cr || clearTimeout(Ys.current), El.current = Bs.current({
          ..._e,
          tree: zs,
          x: hm.clientX,
          y: hm.clientY,
          onClose() {
            pm(), gm(), Nu();
          }
        });
        const _m = El.current;
        ym.addEventListener("mousemove", _m), Tu.current = () => {
          ym.removeEventListener("mousemove", _m);
        };
        return;
      }
      Nu();
    }
    function mm(hm) {
      zu() || Bs.current == null || Bs.current({
        ..._e,
        tree: zs,
        x: hm.clientX,
        y: hm.clientY,
        onClose() {
          pm(), gm(), Nu();
        }
      })(hm);
    }
    if (isElement$1(Ds)) {
      const hm = Ds;
      return Cr && hm.addEventListener("mouseleave", mm), Ls == null || Ls.addEventListener("mouseleave", mm), er && hm.addEventListener("mousemove", Yu, {
        once: !0
      }), hm.addEventListener("mouseenter", Yu), hm.addEventListener("mouseleave", sm), () => {
        Cr && hm.removeEventListener("mouseleave", mm), Ls == null || Ls.removeEventListener("mouseleave", mm), er && hm.removeEventListener("mousemove", Yu), hm.removeEventListener("mouseenter", Yu), hm.removeEventListener("mouseleave", sm);
      };
    }
  }, [Ds, Ls, Zt, _e, kn, Kn, er, Nu, gm, pm, kr, Cr, zs, Hs, Bs, Yr]), index$4(() => {
    var zu;
    if (Zt && Cr && (zu = Bs.current) != null && zu.__options.blockPointerEvents && Au()) {
      const mm = getDocument(Ls).body;
      if (mm.setAttribute(safePolygonIdentifier, ""), mm.style.pointerEvents = "none", Iu.current = !0, isElement$1(Ds) && Ls) {
        var Yu, sm;
        const hm = Ds, ym = zs == null || (Yu = zs.nodesRef.current.find((_m) => _m.id === Fs)) == null || (sm = Yu.context) == null ? void 0 : sm.elements.floating;
        return ym && (ym.style.pointerEvents = ""), hm.style.pointerEvents = "auto", Ls.style.pointerEvents = "auto", () => {
          hm.style.pointerEvents = "", Ls.style.pointerEvents = "";
        };
      }
    }
  }, [Zt, Cr, Fs, Ls, Ds, zs, Bs, Yr, Au]), index$4(() => {
    Cr || (Ws.current = void 0, gm(), pm());
  }, [Cr, gm, pm]), reactExports.useEffect(() => () => {
    gm(), clearTimeout(Ys.current), clearTimeout(Mu.current), pm();
  }, [Zt, gm, pm]), reactExports.useMemo(() => {
    if (!Zt)
      return {};
    function zu(Yu) {
      Ws.current = Yu.pointerType;
    }
    return {
      reference: {
        onPointerDown: zu,
        onPointerEnter: zu,
        onMouseMove() {
          Cr || Kn === 0 || (clearTimeout(Mu.current), Mu.current = setTimeout(() => {
            Pl.current || kr(!0);
          }, Kn));
        }
      },
      floating: {
        onMouseEnter() {
          clearTimeout(Ys.current);
        },
        onMouseLeave() {
          Ms.emit("dismiss", {
            type: "mouseLeave",
            data: {
              returnFocus: !1
            }
          }), Nu(!1);
        }
      }
    };
  }, [Ms, Zt, Kn, Cr, kr, Nu]);
}, FloatingDelayGroupContext = /* @__PURE__ */ reactExports.createContext({
  delay: 0,
  initialDelay: 0,
  timeoutMs: 0,
  currentId: null,
  setCurrentId: () => {
  },
  setState: () => {
  },
  isInstantPhase: !1
}), useDelayGroupContext = () => reactExports.useContext(FloatingDelayGroupContext), FloatingDelayGroup = (_e) => {
  let {
    children: Qt,
    delay: Zt,
    timeoutMs: $n = 0
  } = _e;
  const [Sn, kn] = reactExports.useReducer((Cr, kr) => ({
    ...Cr,
    ...kr
  }), {
    delay: Zt,
    timeoutMs: $n,
    initialDelay: Zt,
    currentId: null,
    isInstantPhase: !1
  }), Kn = reactExports.useRef(null), er = reactExports.useCallback((Cr) => {
    kn({
      currentId: Cr
    });
  }, []);
  return index$4(() => {
    Sn.currentId ? Kn.current === null ? Kn.current = Sn.currentId : kn({
      isInstantPhase: !0
    }) : (kn({
      isInstantPhase: !1
    }), Kn.current = null);
  }, [Sn.currentId]), /* @__PURE__ */ reactExports.createElement(FloatingDelayGroupContext.Provider, {
    value: reactExports.useMemo(() => ({
      ...Sn,
      setState: kn,
      setCurrentId: er
    }), [Sn, kn, er])
  }, Qt);
}, useDelayGroup = (_e, Qt) => {
  let {
    open: Zt,
    onOpenChange: $n
  } = _e, {
    id: Sn
  } = Qt;
  const {
    currentId: kn,
    setCurrentId: Kn,
    initialDelay: er,
    setState: Cr,
    timeoutMs: kr
  } = useDelayGroupContext();
  reactExports.useEffect(() => {
    kn && (Cr({
      delay: {
        open: 1,
        close: getDelay(er, "close")
      }
    }), kn !== Sn && $n(!1));
  }, [Sn, $n, Cr, kn, er]), reactExports.useEffect(() => {
    function Yr() {
      $n(!1), Cr({
        delay: er,
        currentId: null
      });
    }
    if (!Zt && kn === Sn)
      if (kr) {
        const Ms = window.setTimeout(Yr, kr);
        return () => {
          clearTimeout(Ms);
        };
      } else
        Yr();
  }, [Zt, Cr, kn, Sn, $n, er, kr]), reactExports.useEffect(() => {
    Zt && Kn(Sn);
  }, [Zt, Kn, Sn]);
};
function activeElement$1(_e) {
  let Qt = _e.activeElement;
  for (; ((Zt = Qt) == null || ($n = Zt.shadowRoot) == null ? void 0 : $n.activeElement) != null; ) {
    var Zt, $n;
    Qt = Qt.shadowRoot.activeElement;
  }
  return Qt;
}
function contains$3(_e, Qt) {
  if (!_e || !Qt)
    return !1;
  const Zt = Qt.getRootNode && Qt.getRootNode();
  if (_e.contains(Qt))
    return !0;
  if (Zt && isShadowRoot(Zt)) {
    let $n = Qt;
    do {
      if ($n && _e === $n)
        return !0;
      $n = $n.parentNode || $n.host;
    } while ($n);
  }
  return !1;
}
function getChildren(_e, Qt) {
  let Zt = _e.filter((Sn) => {
    var kn;
    return Sn.parentId === Qt && ((kn = Sn.context) == null ? void 0 : kn.open);
  }) || [], $n = Zt;
  for (; $n.length; )
    $n = _e.filter((Sn) => {
      var kn;
      return (kn = $n) == null ? void 0 : kn.some((Kn) => {
        var er;
        return Sn.parentId === Kn.id && ((er = Sn.context) == null ? void 0 : er.open);
      });
    }) || [], Zt = Zt.concat($n);
  return Zt;
}
function getTarget$1(_e) {
  return "composedPath" in _e ? _e.composedPath()[0] : _e.target;
}
const useInsertionEffect = A$4[/* @__PURE__ */ "useInsertionEffect".toString()], useSafeInsertionEffect = useInsertionEffect || ((_e) => _e());
function useEvent(_e) {
  const Qt = reactExports.useRef(() => {
  });
  return useSafeInsertionEffect(() => {
    Qt.current = _e;
  }), reactExports.useCallback(function() {
    for (var Zt = arguments.length, $n = new Array(Zt), Sn = 0; Sn < Zt; Sn++)
      $n[Sn] = arguments[Sn];
    return Qt.current == null ? void 0 : Qt.current(...$n);
  }, []);
}
function isEventTargetWithin(_e, Qt) {
  if (Qt == null)
    return !1;
  if ("composedPath" in _e)
    return _e.composedPath().includes(Qt);
  const Zt = _e;
  return Zt.target != null && Qt.contains(Zt.target);
}
const bubbleHandlerKeys = {
  pointerdown: "onPointerDown",
  mousedown: "onMouseDown",
  click: "onClick"
}, captureHandlerKeys = {
  pointerdown: "onPointerDownCapture",
  mousedown: "onMouseDownCapture",
  click: "onClickCapture"
}, normalizeBubblesProp = function(_e) {
  var Qt, Zt;
  return _e === void 0 && (_e = !0), {
    escapeKeyBubbles: typeof _e == "boolean" ? _e : (Qt = _e.escapeKey) != null ? Qt : !0,
    outsidePressBubbles: typeof _e == "boolean" ? _e : (Zt = _e.outsidePress) != null ? Zt : !0
  };
}, useDismiss = function(_e, Qt) {
  let {
    open: Zt,
    onOpenChange: $n,
    events: Sn,
    nodeId: kn,
    elements: {
      reference: Kn,
      domReference: er,
      floating: Cr
    },
    dataRef: kr
  } = _e, {
    enabled: Yr = !0,
    escapeKey: Ms = !0,
    outsidePress: Ds = !0,
    outsidePressEvent: Ls = "pointerdown",
    referencePress: js = !1,
    referencePressEvent: zs = "pointerdown",
    ancestorScroll: Fs = !1,
    bubbles: Bs = !0
  } = Qt === void 0 ? {} : Qt;
  const Hs = useFloatingTree(), Ws = useFloatingParentNodeId() != null, Ys = useEvent(typeof Ds == "function" ? Ds : () => !1), El = typeof Ds == "function" ? Ys : Ds, Mu = reactExports.useRef(!1), {
    escapeKeyBubbles: Pl,
    outsidePressBubbles: Iu
  } = normalizeBubblesProp(Bs);
  return reactExports.useEffect(() => {
    if (!Zt || !Yr)
      return;
    kr.current.__escapeKeyBubbles = Pl, kr.current.__outsidePressBubbles = Iu;
    function Tu(zu) {
      if (zu.key === "Escape") {
        const Yu = Hs ? getChildren(Hs.nodesRef.current, kn) : [];
        if (Yu.length > 0) {
          let sm = !0;
          if (Yu.forEach((mm) => {
            var hm;
            if ((hm = mm.context) != null && hm.open && !mm.context.dataRef.current.__escapeKeyBubbles) {
              sm = !1;
              return;
            }
          }), !sm)
            return;
        }
        Sn.emit("dismiss", {
          type: "escapeKey",
          data: {
            returnFocus: {
              preventScroll: !1
            }
          }
        }), $n(!1);
      }
    }
    function Au(zu) {
      const Yu = Mu.current;
      if (Mu.current = !1, Yu || typeof El == "function" && !El(zu))
        return;
      const sm = getTarget$1(zu);
      if (isHTMLElement(sm) && Cr) {
        const ym = Cr.ownerDocument.defaultView || window, _m = sm.scrollWidth > sm.clientWidth, Sm = sm.scrollHeight > sm.clientHeight;
        let wm = Sm && zu.offsetX > sm.clientWidth;
        if (Sm && ym.getComputedStyle(sm).direction === "rtl" && (wm = zu.offsetX <= sm.offsetWidth - sm.clientWidth), wm || _m && zu.offsetY > sm.clientHeight)
          return;
      }
      const mm = Hs && getChildren(Hs.nodesRef.current, kn).some((ym) => {
        var _m;
        return isEventTargetWithin(zu, (_m = ym.context) == null ? void 0 : _m.elements.floating);
      });
      if (isEventTargetWithin(zu, Cr) || isEventTargetWithin(zu, er) || mm)
        return;
      const hm = Hs ? getChildren(Hs.nodesRef.current, kn) : [];
      if (hm.length > 0) {
        let ym = !0;
        if (hm.forEach((_m) => {
          var Sm;
          if ((Sm = _m.context) != null && Sm.open && !_m.context.dataRef.current.__outsidePressBubbles) {
            ym = !1;
            return;
          }
        }), !ym)
          return;
      }
      Sn.emit("dismiss", {
        type: "outsidePress",
        data: {
          returnFocus: Ws ? {
            preventScroll: !0
          } : isVirtualClick(zu) || isVirtualPointerEvent(zu)
        }
      }), $n(!1);
    }
    function Nu() {
      $n(!1);
    }
    const gm = getDocument(Cr);
    Ms && gm.addEventListener("keydown", Tu), El && gm.addEventListener(Ls, Au);
    let pm = [];
    return Fs && (isElement$1(er) && (pm = getOverflowAncestors(er)), isElement$1(Cr) && (pm = pm.concat(getOverflowAncestors(Cr))), !isElement$1(Kn) && Kn && Kn.contextElement && (pm = pm.concat(getOverflowAncestors(Kn.contextElement)))), pm = pm.filter((zu) => {
      var Yu;
      return zu !== ((Yu = gm.defaultView) == null ? void 0 : Yu.visualViewport);
    }), pm.forEach((zu) => {
      zu.addEventListener("scroll", Nu, {
        passive: !0
      });
    }), () => {
      Ms && gm.removeEventListener("keydown", Tu), El && gm.removeEventListener(Ls, Au), pm.forEach((zu) => {
        zu.removeEventListener("scroll", Nu);
      });
    };
  }, [kr, Cr, er, Kn, Ms, El, Ls, Sn, Hs, kn, Zt, $n, Fs, Yr, Pl, Iu, Ws]), reactExports.useEffect(() => {
    Mu.current = !1;
  }, [El, Ls]), reactExports.useMemo(() => Yr ? {
    reference: {
      [bubbleHandlerKeys[zs]]: () => {
        js && (Sn.emit("dismiss", {
          type: "referencePress",
          data: {
            returnFocus: !1
          }
        }), $n(!1));
      }
    },
    floating: {
      [captureHandlerKeys[Ls]]: () => {
        Mu.current = !0;
      }
    }
  } : {}, [Yr, Sn, js, Ls, zs, $n]);
}, useFocus = function(_e, Qt) {
  let {
    open: Zt,
    onOpenChange: $n,
    dataRef: Sn,
    events: kn,
    refs: Kn,
    elements: {
      floating: er,
      domReference: Cr
    }
  } = _e, {
    enabled: kr = !0,
    keyboardOnly: Yr = !0
  } = Qt === void 0 ? {} : Qt;
  const Ms = reactExports.useRef(""), Ds = reactExports.useRef(!1), Ls = reactExports.useRef();
  return reactExports.useEffect(() => {
    if (!kr)
      return;
    const zs = getDocument(er).defaultView || window;
    function Fs() {
      !Zt && isHTMLElement(Cr) && Cr === activeElement$1(getDocument(Cr)) && (Ds.current = !0);
    }
    return zs.addEventListener("blur", Fs), () => {
      zs.removeEventListener("blur", Fs);
    };
  }, [er, Cr, Zt, kr]), reactExports.useEffect(() => {
    if (!kr)
      return;
    function js(zs) {
      (zs.type === "referencePress" || zs.type === "escapeKey") && (Ds.current = !0);
    }
    return kn.on("dismiss", js), () => {
      kn.off("dismiss", js);
    };
  }, [kn, kr]), reactExports.useEffect(() => () => {
    clearTimeout(Ls.current);
  }, []), reactExports.useMemo(() => kr ? {
    reference: {
      onPointerDown(js) {
        let {
          pointerType: zs
        } = js;
        Ms.current = zs, Ds.current = !!(zs && Yr);
      },
      onMouseLeave() {
        Ds.current = !1;
      },
      onFocus(js) {
        var zs;
        Ds.current || js.type === "focus" && ((zs = Sn.current.openEvent) == null ? void 0 : zs.type) === "mousedown" && Sn.current.openEvent && isEventTargetWithin(Sn.current.openEvent, Cr) || (Sn.current.openEvent = js.nativeEvent, $n(!0));
      },
      onBlur(js) {
        Ds.current = !1;
        const zs = js.relatedTarget, Fs = isElement$1(zs) && zs.hasAttribute("data-floating-ui-focus-guard") && zs.getAttribute("data-type") === "outside";
        Ls.current = setTimeout(() => {
          contains$3(Kn.floating.current, zs) || contains$3(Cr, zs) || Fs || $n(!1);
        });
      }
    }
  } : {}, [kr, Yr, Cr, Kn, Sn, $n]);
}, useRole = function(_e, Qt) {
  let {
    open: Zt
  } = _e, {
    enabled: $n = !0,
    role: Sn = "dialog"
  } = Qt === void 0 ? {} : Qt;
  const kn = useId(), Kn = useId();
  return reactExports.useMemo(() => {
    const er = {
      id: kn,
      role: Sn
    };
    return $n ? Sn === "tooltip" ? {
      reference: {
        "aria-describedby": Zt ? kn : void 0
      },
      floating: er
    } : {
      reference: {
        "aria-expanded": Zt ? "true" : "false",
        "aria-haspopup": Sn === "alertdialog" ? "dialog" : Sn,
        "aria-controls": Zt ? kn : void 0,
        ...Sn === "listbox" && {
          role: "combobox"
        },
        ...Sn === "menu" && {
          id: Kn
        }
      },
      floating: {
        ...er,
        ...Sn === "menu" && {
          "aria-labelledby": Kn
        }
      }
    } : {};
  }, [$n, Sn, Zt, kn, Kn]);
};
function useFloating(_e) {
  _e === void 0 && (_e = {});
  const {
    open: Qt = !1,
    onOpenChange: Zt,
    nodeId: $n
  } = _e, Sn = useFloating$1(_e), kn = useFloatingTree(), Kn = reactExports.useRef(null), er = reactExports.useRef({}), Cr = reactExports.useState(() => createPubSub())[0], [kr, Yr] = reactExports.useState(null), Ms = reactExports.useCallback((Bs) => {
    const Hs = isElement$1(Bs) ? {
      getBoundingClientRect: () => Bs.getBoundingClientRect(),
      contextElement: Bs
    } : Bs;
    Sn.refs.setReference(Hs);
  }, [Sn.refs]), Ds = reactExports.useCallback((Bs) => {
    (isElement$1(Bs) || Bs === null) && (Kn.current = Bs, Yr(Bs)), (isElement$1(Sn.refs.reference.current) || Sn.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
    // `null` to support `positionReference` + an unstable `reference`
    // callback ref.
    Bs !== null && !isElement$1(Bs)) && Sn.refs.setReference(Bs);
  }, [Sn.refs]), Ls = reactExports.useMemo(() => ({
    ...Sn.refs,
    setReference: Ds,
    setPositionReference: Ms,
    domReference: Kn
  }), [Sn.refs, Ds, Ms]), js = reactExports.useMemo(() => ({
    ...Sn.elements,
    domReference: kr
  }), [Sn.elements, kr]), zs = useEvent(Zt), Fs = reactExports.useMemo(() => ({
    ...Sn,
    refs: Ls,
    elements: js,
    dataRef: er,
    nodeId: $n,
    events: Cr,
    open: Qt,
    onOpenChange: zs
  }), [Sn, $n, Cr, Qt, zs, Ls, js]);
  return index$4(() => {
    const Bs = kn == null ? void 0 : kn.nodesRef.current.find((Hs) => Hs.id === $n);
    Bs && (Bs.context = Fs);
  }), reactExports.useMemo(() => ({
    ...Sn,
    context: Fs,
    refs: Ls,
    reference: Ds,
    positionReference: Ms
  }), [Sn, Ls, Fs, Ds, Ms]);
}
function mergeProps(_e, Qt, Zt) {
  const $n = /* @__PURE__ */ new Map();
  return {
    ...Zt === "floating" && {
      tabIndex: -1
    },
    ..._e,
    ...Qt.map((Sn) => Sn ? Sn[Zt] : null).concat(_e).reduce((Sn, kn) => (kn && Object.entries(kn).forEach((Kn) => {
      let [er, Cr] = Kn;
      if (er.indexOf("on") === 0) {
        if ($n.has(er) || $n.set(er, []), typeof Cr == "function") {
          var kr;
          (kr = $n.get(er)) == null || kr.push(Cr), Sn[er] = function() {
            for (var Yr, Ms = arguments.length, Ds = new Array(Ms), Ls = 0; Ls < Ms; Ls++)
              Ds[Ls] = arguments[Ls];
            (Yr = $n.get(er)) == null || Yr.forEach((js) => js(...Ds));
          };
        }
      } else
        Sn[er] = Cr;
    }), Sn), {})
  };
}
const useInteractions = function(_e) {
  _e === void 0 && (_e = []);
  const Qt = _e, Zt = reactExports.useCallback(
    (kn) => mergeProps(kn, _e, "reference"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    Qt
  ), $n = reactExports.useCallback(
    (kn) => mergeProps(kn, _e, "floating"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    Qt
  ), Sn = reactExports.useCallback(
    (kn) => mergeProps(kn, _e, "item"),
    // Granularly check for `item` changes, because the `getItemProps` getter
    // should be as referentially stable as possible since it may be passed as
    // a prop to many components. All `item` key values must therefore be
    // memoized.
    // eslint-disable-next-line react-hooks/exhaustive-deps
    _e.map((kn) => kn == null ? void 0 : kn.item)
  );
  return reactExports.useMemo(() => ({
    getReferenceProps: Zt,
    getFloatingProps: $n,
    getItemProps: Sn
  }), [Zt, $n, Sn]);
};
function useFloatingAutoUpdate({
  opened: _e,
  floating: Qt,
  position: Zt,
  positionDependencies: $n
}) {
  const [Sn, kn] = reactExports.useState(0);
  reactExports.useEffect(() => {
    if (Qt.refs.reference.current && Qt.refs.floating.current)
      return autoUpdate(Qt.refs.reference.current, Qt.refs.floating.current, Qt.update);
  }, [
    Qt.refs.reference.current,
    Qt.refs.floating.current,
    _e,
    Sn,
    Zt
  ]), useDidUpdate(() => {
    Qt.update();
  }, $n), useDidUpdate(() => {
    kn((Kn) => Kn + 1);
  }, [_e]);
}
function getPopoverMiddlewares(_e) {
  const Qt = [offset$4(_e.offset)];
  return _e.middlewares.shift && Qt.push(shift$1({ limiter: limitShift() })), _e.middlewares.flip && Qt.push(flip$1()), _e.middlewares.inline && Qt.push(inline()), Qt.push(arrow({ element: _e.arrowRef, padding: _e.arrowOffset })), Qt;
}
function usePopover(_e) {
  const [Qt, Zt] = useUncontrolled({
    value: _e.opened,
    defaultValue: _e.defaultOpened,
    finalValue: !1,
    onChange: _e.onChange
  }), $n = () => {
    var Kn;
    (Kn = _e.onClose) == null || Kn.call(_e), Zt(!1);
  }, Sn = () => {
    var Kn, er;
    Qt ? ((Kn = _e.onClose) == null || Kn.call(_e), Zt(!1)) : ((er = _e.onOpen) == null || er.call(_e), Zt(!0));
  }, kn = useFloating({
    placement: _e.position,
    middleware: [
      ...getPopoverMiddlewares(_e),
      ..._e.width === "target" ? [
        size({
          apply({ rects: Kn }) {
            var er, Cr;
            Object.assign((Cr = (er = kn.refs.floating.current) == null ? void 0 : er.style) != null ? Cr : {}, {
              width: `${Kn.reference.width}px`
            });
          }
        })
      ] : []
    ]
  });
  return useFloatingAutoUpdate({
    opened: _e.opened,
    position: _e.position,
    positionDependencies: _e.positionDependencies,
    floating: kn
  }), useDidUpdate(() => {
    var Kn;
    (Kn = _e.onPositionChange) == null || Kn.call(_e, kn.placement);
  }, [kn.placement]), useDidUpdate(() => {
    var Kn, er;
    _e.opened ? (er = _e.onOpen) == null || er.call(_e) : (Kn = _e.onClose) == null || Kn.call(_e);
  }, [_e.opened]), {
    floating: kn,
    controlled: typeof _e.opened == "boolean",
    opened: Qt,
    onClose: $n,
    onToggle: Sn
  };
}
const POPOVER_ERRORS = {
  context: "Popover component was not found in the tree",
  children: "Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
}, [PopoverContextProvider, usePopoverContext] = createSafeContext(POPOVER_ERRORS.context);
var __defProp$24 = Object.defineProperty, __defProps$14 = Object.defineProperties, __getOwnPropDescs$14 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$26 = Object.getOwnPropertySymbols, __hasOwnProp$26 = Object.prototype.hasOwnProperty, __propIsEnum$26 = Object.prototype.propertyIsEnumerable, __defNormalProp$24 = (_e, Qt, Zt) => Qt in _e ? __defProp$24(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$24 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$26.call(Qt, Zt) && __defNormalProp$24(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$26)
    for (var Zt of __getOwnPropSymbols$26(Qt))
      __propIsEnum$26.call(Qt, Zt) && __defNormalProp$24(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$14 = (_e, Qt) => __defProps$14(_e, __getOwnPropDescs$14(Qt)), __objRest$1C = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$26.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$26)
    for (var $n of __getOwnPropSymbols$26(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$26.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1m = {
  refProp: "ref",
  popupType: "dialog",
  shouldOverrideDefaultTargetId: !0
}, PopoverTarget = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("PopoverTarget", defaultProps$1m, _e), { children: $n, refProp: Sn, popupType: kn, shouldOverrideDefaultTargetId: Kn } = Zt, er = __objRest$1C(Zt, ["children", "refProp", "popupType", "shouldOverrideDefaultTargetId"]);
  if (!isElement$3($n))
    throw new Error(POPOVER_ERRORS.children);
  const Cr = er, kr = usePopoverContext(), Yr = useMergedRef(kr.reference, $n.ref, Qt), Ms = kr.withRoles ? {
    "aria-haspopup": kn,
    "aria-expanded": kr.opened,
    "aria-controls": kr.getDropdownId(),
    id: Kn ? kr.getTargetId() : $n.props.id
  } : {};
  return reactExports.cloneElement($n, __spreadValues$24(__spreadProps$14(__spreadValues$24(__spreadValues$24(__spreadValues$24({}, Cr), Ms), kr.targetProps), {
    className: clsx(kr.targetProps.className, Cr.className, $n.props.className),
    [Sn]: Yr
  }), kr.controlled ? null : { onClick: kr.onToggle }));
});
PopoverTarget.displayName = "@mantine/core/PopoverTarget";
var useStyles$2k = createStyles((_e, { radius: Qt, shadow: Zt }) => ({
  dropdown: {
    position: "absolute",
    backgroundColor: _e.white,
    background: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.white,
    border: `${rem$1(1)} solid ${_e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2]}`,
    padding: `${_e.spacing.sm} ${_e.spacing.md}`,
    boxShadow: _e.shadows[Zt] || Zt || "none",
    borderRadius: _e.fn.radius(Qt),
    "&:focus": {
      outline: 0
    }
  },
  arrow: {
    backgroundColor: "inherit",
    border: `${rem$1(1)} solid ${_e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2]}`,
    zIndex: 1
  }
}));
const useStyles$2l = useStyles$2k;
var __defProp$23 = Object.defineProperty, __getOwnPropSymbols$25 = Object.getOwnPropertySymbols, __hasOwnProp$25 = Object.prototype.hasOwnProperty, __propIsEnum$25 = Object.prototype.propertyIsEnumerable, __defNormalProp$23 = (_e, Qt, Zt) => Qt in _e ? __defProp$23(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$23 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$25.call(Qt, Zt) && __defNormalProp$23(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$25)
    for (var Zt of __getOwnPropSymbols$25(Qt))
      __propIsEnum$25.call(Qt, Zt) && __defNormalProp$23(_e, Zt, Qt[Zt]);
  return _e;
};
const transitionStatuses = {
  entering: "in",
  entered: "in",
  exiting: "out",
  exited: "out",
  "pre-exiting": "out",
  "pre-entering": "out"
};
function getTransitionStyles({
  transition: _e,
  state: Qt,
  duration: Zt,
  timingFunction: $n
}) {
  const Sn = {
    transitionDuration: `${Zt}ms`,
    transitionTimingFunction: $n
  };
  return typeof _e == "string" ? _e in transitions$1 ? __spreadValues$23(__spreadValues$23(__spreadValues$23({
    transitionProperty: transitions$1[_e].transitionProperty
  }, Sn), transitions$1[_e].common), transitions$1[_e][transitionStatuses[Qt]]) : null : __spreadValues$23(__spreadValues$23(__spreadValues$23({
    transitionProperty: _e.transitionProperty
  }, Sn), _e.common), _e[transitionStatuses[Qt]]);
}
function useTransition({
  duration: _e,
  exitDuration: Qt,
  timingFunction: Zt,
  mounted: $n,
  onEnter: Sn,
  onExit: kn,
  onEntered: Kn,
  onExited: er
}) {
  const Cr = useMantineTheme(), kr = useReducedMotion(), Yr = Cr.respectReducedMotion ? kr : !1, [Ms, Ds] = reactExports.useState(Yr ? 0 : _e), [Ls, js] = reactExports.useState($n ? "entered" : "exited"), zs = reactExports.useRef(-1), Fs = (Bs) => {
    const Hs = Bs ? Sn : kn, Ws = Bs ? Kn : er;
    js(Bs ? "pre-entering" : "pre-exiting"), window.clearTimeout(zs.current);
    const Ys = Yr ? 0 : Bs ? _e : Qt;
    if (Ds(Ys), Ys === 0)
      typeof Hs == "function" && Hs(), typeof Ws == "function" && Ws(), js(Bs ? "entered" : "exited");
    else {
      const El = window.setTimeout(() => {
        typeof Hs == "function" && Hs(), js(Bs ? "entering" : "exiting");
      }, 10);
      zs.current = window.setTimeout(() => {
        window.clearTimeout(El), typeof Ws == "function" && Ws(), js(Bs ? "entered" : "exited");
      }, Ys);
    }
  };
  return useDidUpdate(() => {
    Fs($n);
  }, [$n]), reactExports.useEffect(() => () => window.clearTimeout(zs.current), []), {
    transitionDuration: Ms,
    transitionStatus: Ls,
    transitionTimingFunction: Zt || Cr.transitionTimingFunction
  };
}
function Transition$1({
  keepMounted: _e,
  transition: Qt,
  duration: Zt = 250,
  exitDuration: $n = Zt,
  mounted: Sn,
  children: kn,
  timingFunction: Kn,
  onExit: er,
  onEntered: Cr,
  onEnter: kr,
  onExited: Yr
}) {
  const { transitionDuration: Ms, transitionStatus: Ds, transitionTimingFunction: Ls } = useTransition({
    mounted: Sn,
    exitDuration: $n,
    duration: Zt,
    timingFunction: Kn,
    onExit: er,
    onEntered: Cr,
    onEnter: kr,
    onExited: Yr
  });
  return Ms === 0 ? Sn ? /* @__PURE__ */ React.createElement(React.Fragment, null, kn({})) : _e ? kn({ display: "none" }) : null : Ds === "exited" ? _e ? kn({ display: "none" }) : null : /* @__PURE__ */ React.createElement(React.Fragment, null, kn(getTransitionStyles({
    transition: Qt,
    duration: Ms,
    state: Ds,
    timingFunction: Ls
  })));
}
Transition$1.displayName = "@mantine/core/Transition";
function FocusTrap({
  children: _e,
  active: Qt = !0,
  refProp: Zt = "ref"
}) {
  const $n = useFocusTrap(Qt), Sn = useMergedRef($n, _e == null ? void 0 : _e.ref);
  return isElement$3(_e) ? reactExports.cloneElement(_e, { [Zt]: Sn }) : _e;
}
FocusTrap.displayName = "@mantine/core/FocusTrap";
var __defProp$22 = Object.defineProperty, __defProps$13 = Object.defineProperties, __getOwnPropDescs$13 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$24 = Object.getOwnPropertySymbols, __hasOwnProp$24 = Object.prototype.hasOwnProperty, __propIsEnum$24 = Object.prototype.propertyIsEnumerable, __defNormalProp$22 = (_e, Qt, Zt) => Qt in _e ? __defProp$22(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$22 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$24.call(Qt, Zt) && __defNormalProp$22(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$24)
    for (var Zt of __getOwnPropSymbols$24(Qt))
      __propIsEnum$24.call(Qt, Zt) && __defNormalProp$22(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$13 = (_e, Qt) => __defProps$13(_e, __getOwnPropDescs$13(Qt));
function horizontalSide(_e, Qt, Zt, $n) {
  return _e === "center" || $n === "center" ? { top: Qt } : _e === "end" ? { bottom: Zt } : _e === "start" ? { top: Zt } : {};
}
function verticalSide(_e, Qt, Zt, $n, Sn) {
  return _e === "center" || $n === "center" ? { left: Qt } : _e === "end" ? { [Sn === "ltr" ? "right" : "left"]: Zt } : _e === "start" ? { [Sn === "ltr" ? "left" : "right"]: Zt } : {};
}
const radiusByFloatingSide = {
  bottom: "borderTopLeftRadius",
  left: "borderTopRightRadius",
  right: "borderBottomLeftRadius",
  top: "borderBottomRightRadius"
};
function getArrowPositionStyles({
  position: _e,
  arrowSize: Qt,
  arrowOffset: Zt,
  arrowRadius: $n,
  arrowPosition: Sn,
  arrowX: kn,
  arrowY: Kn,
  dir: er
}) {
  const [Cr, kr = "center"] = _e.split("-"), Yr = {
    width: rem$1(Qt),
    height: rem$1(Qt),
    transform: "rotate(45deg)",
    position: "absolute",
    [radiusByFloatingSide[Cr]]: rem$1($n)
  }, Ms = rem$1(-Qt / 2);
  return Cr === "left" ? __spreadProps$13(__spreadValues$22(__spreadValues$22({}, Yr), horizontalSide(kr, Kn, Zt, Sn)), {
    right: Ms,
    borderLeftColor: "transparent",
    borderBottomColor: "transparent"
  }) : Cr === "right" ? __spreadProps$13(__spreadValues$22(__spreadValues$22({}, Yr), horizontalSide(kr, Kn, Zt, Sn)), {
    left: Ms,
    borderRightColor: "transparent",
    borderTopColor: "transparent"
  }) : Cr === "top" ? __spreadProps$13(__spreadValues$22(__spreadValues$22({}, Yr), verticalSide(kr, kn, Zt, Sn, er)), {
    bottom: Ms,
    borderTopColor: "transparent",
    borderLeftColor: "transparent"
  }) : Cr === "bottom" ? __spreadProps$13(__spreadValues$22(__spreadValues$22({}, Yr), verticalSide(kr, kn, Zt, Sn, er)), {
    top: Ms,
    borderBottomColor: "transparent",
    borderRightColor: "transparent"
  }) : {};
}
var __defProp$21 = Object.defineProperty, __defProps$12 = Object.defineProperties, __getOwnPropDescs$12 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$23 = Object.getOwnPropertySymbols, __hasOwnProp$23 = Object.prototype.hasOwnProperty, __propIsEnum$23 = Object.prototype.propertyIsEnumerable, __defNormalProp$21 = (_e, Qt, Zt) => Qt in _e ? __defProp$21(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$21 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$23.call(Qt, Zt) && __defNormalProp$21(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$23)
    for (var Zt of __getOwnPropSymbols$23(Qt))
      __propIsEnum$23.call(Qt, Zt) && __defNormalProp$21(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$12 = (_e, Qt) => __defProps$12(_e, __getOwnPropDescs$12(Qt)), __objRest$1B = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$23.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$23)
    for (var $n of __getOwnPropSymbols$23(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$23.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const FloatingArrow = reactExports.forwardRef((_e, Qt) => {
  var Zt = _e, {
    position: $n,
    arrowSize: Sn,
    arrowOffset: kn,
    arrowRadius: Kn,
    arrowPosition: er,
    visible: Cr,
    arrowX: kr,
    arrowY: Yr
  } = Zt, Ms = __objRest$1B(Zt, [
    "position",
    "arrowSize",
    "arrowOffset",
    "arrowRadius",
    "arrowPosition",
    "visible",
    "arrowX",
    "arrowY"
  ]);
  const Ds = useMantineTheme();
  return Cr ? /* @__PURE__ */ React.createElement("div", __spreadProps$12(__spreadValues$21({}, Ms), {
    ref: Qt,
    style: getArrowPositionStyles({
      position: $n,
      arrowSize: Sn,
      arrowOffset: kn,
      arrowRadius: Kn,
      arrowPosition: er,
      dir: Ds.dir,
      arrowX: kr,
      arrowY: Yr
    })
  })) : null;
});
FloatingArrow.displayName = "@mantine/core/FloatingArrow";
var __defProp$20 = Object.defineProperty, __defProps$11 = Object.defineProperties, __getOwnPropDescs$11 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$22 = Object.getOwnPropertySymbols, __hasOwnProp$22 = Object.prototype.hasOwnProperty, __propIsEnum$22 = Object.prototype.propertyIsEnumerable, __defNormalProp$20 = (_e, Qt, Zt) => Qt in _e ? __defProp$20(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$20 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$22.call(Qt, Zt) && __defNormalProp$20(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$22)
    for (var Zt of __getOwnPropSymbols$22(Qt))
      __propIsEnum$22.call(Qt, Zt) && __defNormalProp$20(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$11 = (_e, Qt) => __defProps$11(_e, __getOwnPropDescs$11(Qt)), __objRest$1A = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$22.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$22)
    for (var $n of __getOwnPropSymbols$22(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$22.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1l = {};
function PopoverDropdown(_e) {
  var Qt;
  const Zt = useComponentDefaultProps("PopoverDropdown", defaultProps$1l, _e), { style: $n, className: Sn, children: kn, onKeyDownCapture: Kn } = Zt, er = __objRest$1A(Zt, ["style", "className", "children", "onKeyDownCapture"]), Cr = usePopoverContext(), { classes: kr, cx: Yr } = useStyles$2l({ radius: Cr.radius, shadow: Cr.shadow }, {
    name: Cr.__staticSelector,
    classNames: Cr.classNames,
    styles: Cr.styles,
    unstyled: Cr.unstyled,
    variant: Cr.variant
  }), Ms = useFocusReturn({
    opened: Cr.opened,
    shouldReturnFocus: Cr.returnFocus
  }), Ds = Cr.withRoles ? {
    "aria-labelledby": Cr.getTargetId(),
    id: Cr.getDropdownId(),
    role: "dialog"
  } : {};
  return Cr.disabled ? null : /* @__PURE__ */ React.createElement(OptionalPortal, __spreadProps$11(__spreadValues$20({}, Cr.portalProps), {
    withinPortal: Cr.withinPortal
  }), /* @__PURE__ */ React.createElement(Transition$1, __spreadProps$11(__spreadValues$20({
    mounted: Cr.opened
  }, Cr.transitionProps), {
    transition: Cr.transitionProps.transition || "fade",
    duration: (Qt = Cr.transitionProps.duration) != null ? Qt : 150,
    keepMounted: Cr.keepMounted,
    exitDuration: typeof Cr.transitionProps.exitDuration == "number" ? Cr.transitionProps.exitDuration : Cr.transitionProps.duration
  }), (Ls) => {
    var js, zs;
    return /* @__PURE__ */ React.createElement(FocusTrap, {
      active: Cr.trapFocus
    }, /* @__PURE__ */ React.createElement(Box, __spreadValues$20(__spreadProps$11(__spreadValues$20({}, Ds), {
      tabIndex: -1,
      ref: Cr.floating,
      style: __spreadProps$11(__spreadValues$20(__spreadValues$20({}, $n), Ls), {
        zIndex: Cr.zIndex,
        top: (js = Cr.y) != null ? js : 0,
        left: (zs = Cr.x) != null ? zs : 0,
        width: Cr.width === "target" ? void 0 : rem$1(Cr.width)
      }),
      className: Yr(kr.dropdown, Sn),
      onKeyDownCapture: closeOnEscape(Cr.onClose, {
        active: Cr.closeOnEscape,
        onTrigger: Ms,
        onKeyDown: Kn
      }),
      "data-position": Cr.placement
    }), er), kn, /* @__PURE__ */ React.createElement(FloatingArrow, {
      ref: Cr.arrowRef,
      arrowX: Cr.arrowX,
      arrowY: Cr.arrowY,
      visible: Cr.withArrow,
      position: Cr.placement,
      arrowSize: Cr.arrowSize,
      arrowRadius: Cr.arrowRadius,
      arrowOffset: Cr.arrowOffset,
      arrowPosition: Cr.arrowPosition,
      className: kr.arrow
    })));
  }));
}
PopoverDropdown.displayName = "@mantine/core/PopoverDropdown";
function getFloatingPosition(_e, Qt) {
  if (_e === "rtl" && (Qt.includes("right") || Qt.includes("left"))) {
    const [Zt, $n] = Qt.split("-"), Sn = Zt === "right" ? "left" : "right";
    return $n === void 0 ? Sn : `${Sn}-${$n}`;
  }
  return Qt;
}
var __getOwnPropSymbols$21 = Object.getOwnPropertySymbols, __hasOwnProp$21 = Object.prototype.hasOwnProperty, __propIsEnum$21 = Object.prototype.propertyIsEnumerable, __objRest$1z = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$21.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$21)
    for (var $n of __getOwnPropSymbols$21(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$21.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1k = {
  position: "bottom",
  offset: 8,
  positionDependencies: [],
  transitionProps: { transition: "fade", duration: 150 },
  middlewares: { flip: !0, shift: !0, inline: !1 },
  arrowSize: 7,
  arrowOffset: 5,
  arrowRadius: 0,
  arrowPosition: "side",
  closeOnClickOutside: !0,
  withinPortal: !1,
  closeOnEscape: !0,
  trapFocus: !1,
  withRoles: !0,
  returnFocus: !1,
  clickOutsideEvents: ["mousedown", "touchstart"],
  zIndex: getDefaultZIndex("popover"),
  __staticSelector: "Popover",
  width: "max-content"
};
function Popover(_e) {
  var Qt, Zt, $n, Sn, kn, Kn;
  const er = reactExports.useRef(null), Cr = useComponentDefaultProps("Popover", defaultProps$1k, _e), {
    children: kr,
    position: Yr,
    offset: Ms,
    onPositionChange: Ds,
    positionDependencies: Ls,
    opened: js,
    transitionProps: zs,
    width: Fs,
    middlewares: Bs,
    withArrow: Hs,
    arrowSize: Ws,
    arrowOffset: Ys,
    arrowRadius: El,
    arrowPosition: Mu,
    unstyled: Pl,
    classNames: Iu,
    styles: Tu,
    closeOnClickOutside: Au,
    withinPortal: Nu,
    portalProps: gm,
    closeOnEscape: pm,
    clickOutsideEvents: zu,
    trapFocus: Yu,
    onClose: sm,
    onOpen: mm,
    onChange: hm,
    zIndex: ym,
    radius: _m,
    shadow: Sm,
    id: wm,
    defaultOpened: Nm,
    __staticSelector: Cm,
    withRoles: Im,
    disabled: Am,
    returnFocus: Vm,
    variant: Rm,
    keepMounted: Dm
  } = Cr, km = __objRest$1z(Cr, [
    "children",
    "position",
    "offset",
    "onPositionChange",
    "positionDependencies",
    "opened",
    "transitionProps",
    "width",
    "middlewares",
    "withArrow",
    "arrowSize",
    "arrowOffset",
    "arrowRadius",
    "arrowPosition",
    "unstyled",
    "classNames",
    "styles",
    "closeOnClickOutside",
    "withinPortal",
    "portalProps",
    "closeOnEscape",
    "clickOutsideEvents",
    "trapFocus",
    "onClose",
    "onOpen",
    "onChange",
    "zIndex",
    "radius",
    "shadow",
    "id",
    "defaultOpened",
    "__staticSelector",
    "withRoles",
    "disabled",
    "returnFocus",
    "variant",
    "keepMounted"
  ]), [zm, Pm] = reactExports.useState(null), [i$, o$] = reactExports.useState(null), u$ = useId$1(wm), h$ = useMantineTheme(), d$ = usePopover({
    middlewares: Bs,
    width: Fs,
    position: getFloatingPosition(h$.dir, Yr),
    offset: typeof Ms == "number" ? Ms + (Hs ? Ws / 2 : 0) : Ms,
    arrowRef: er,
    arrowOffset: Ys,
    onPositionChange: Ds,
    positionDependencies: Ls,
    opened: js,
    defaultOpened: Nm,
    onChange: hm,
    onOpen: mm,
    onClose: sm
  });
  useClickOutside(() => d$.opened && Au && d$.onClose(), zu, [zm, i$]);
  const v$ = reactExports.useCallback((s$) => {
    Pm(s$), d$.floating.reference(s$);
  }, [d$.floating.reference]), $$ = reactExports.useCallback((s$) => {
    o$(s$), d$.floating.floating(s$);
  }, [d$.floating.floating]);
  return /* @__PURE__ */ React.createElement(PopoverContextProvider, {
    value: {
      returnFocus: Vm,
      disabled: Am,
      controlled: d$.controlled,
      reference: v$,
      floating: $$,
      x: d$.floating.x,
      y: d$.floating.y,
      arrowX: ($n = (Zt = (Qt = d$.floating) == null ? void 0 : Qt.middlewareData) == null ? void 0 : Zt.arrow) == null ? void 0 : $n.x,
      arrowY: (Kn = (kn = (Sn = d$.floating) == null ? void 0 : Sn.middlewareData) == null ? void 0 : kn.arrow) == null ? void 0 : Kn.y,
      opened: d$.opened,
      arrowRef: er,
      transitionProps: zs,
      width: Fs,
      withArrow: Hs,
      arrowSize: Ws,
      arrowOffset: Ys,
      arrowRadius: El,
      arrowPosition: Mu,
      placement: d$.floating.placement,
      trapFocus: Yu,
      withinPortal: Nu,
      portalProps: gm,
      zIndex: ym,
      radius: _m,
      shadow: Sm,
      closeOnEscape: pm,
      onClose: d$.onClose,
      onToggle: d$.onToggle,
      getTargetId: () => `${u$}-target`,
      getDropdownId: () => `${u$}-dropdown`,
      withRoles: Im,
      targetProps: km,
      __staticSelector: Cm,
      classNames: Iu,
      styles: Tu,
      unstyled: Pl,
      variant: Rm,
      keepMounted: Dm
    }
  }, kr);
}
Popover.Target = PopoverTarget;
Popover.Dropdown = PopoverDropdown;
Popover.displayName = "@mantine/core/Popover";
var __defProp$1$ = Object.defineProperty, __getOwnPropSymbols$20 = Object.getOwnPropertySymbols, __hasOwnProp$20 = Object.prototype.hasOwnProperty, __propIsEnum$20 = Object.prototype.propertyIsEnumerable, __defNormalProp$1$ = (_e, Qt, Zt) => Qt in _e ? __defProp$1$(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1$ = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$20.call(Qt, Zt) && __defNormalProp$1$(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$20)
    for (var Zt of __getOwnPropSymbols$20(Qt))
      __propIsEnum$20.call(Qt, Zt) && __defNormalProp$1$(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1y = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$20.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$20)
    for (var $n of __getOwnPropSymbols$20(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$20.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function SelectPopoverDropdown(_e) {
  var Qt = _e, {
    children: Zt,
    component: $n = "div",
    maxHeight: Sn = 220,
    direction: kn = "column",
    id: Kn,
    innerRef: er,
    __staticSelector: Cr,
    styles: kr,
    classNames: Yr,
    unstyled: Ms
  } = Qt, Ds = __objRest$1y(Qt, [
    "children",
    "component",
    "maxHeight",
    "direction",
    "id",
    "innerRef",
    "__staticSelector",
    "styles",
    "classNames",
    "unstyled"
  ]);
  const { classes: Ls } = useStyles$2n(null, { name: Cr, styles: kr, classNames: Yr, unstyled: Ms });
  return /* @__PURE__ */ React.createElement(Popover.Dropdown, __spreadValues$1$({
    p: 0,
    onMouseDown: (js) => js.preventDefault()
  }, Ds), /* @__PURE__ */ React.createElement("div", {
    style: { maxHeight: rem$1(Sn), display: "flex" }
  }, /* @__PURE__ */ React.createElement(Box, {
    component: $n || "div",
    id: `${Kn}-items`,
    "aria-labelledby": `${Kn}-label`,
    role: "listbox",
    onMouseDown: (js) => js.preventDefault(),
    style: { flex: 1, overflowY: $n !== SelectScrollArea ? "auto" : void 0 },
    "data-combobox-popover": !0,
    tabIndex: -1,
    ref: er
  }, /* @__PURE__ */ React.createElement("div", {
    className: Ls.itemsWrapper,
    style: { flexDirection: kn }
  }, Zt))));
}
function SelectPopover({
  opened: _e,
  transitionProps: Qt = { transition: "fade", duration: 0 },
  shadow: Zt,
  withinPortal: $n,
  portalProps: Sn,
  children: kn,
  __staticSelector: Kn,
  onDirectionChange: er,
  switchDirectionOnFlip: Cr,
  zIndex: kr,
  dropdownPosition: Yr,
  positionDependencies: Ms = [],
  classNames: Ds,
  styles: Ls,
  unstyled: js,
  readOnly: zs,
  variant: Fs
}) {
  return /* @__PURE__ */ React.createElement(Popover, {
    unstyled: js,
    classNames: Ds,
    styles: Ls,
    width: "target",
    withRoles: !1,
    opened: _e,
    middlewares: { flip: Yr === "flip", shift: !1 },
    position: Yr === "flip" ? "bottom" : Yr,
    positionDependencies: Ms,
    zIndex: kr,
    __staticSelector: Kn,
    withinPortal: $n,
    portalProps: Sn,
    transitionProps: Qt,
    shadow: Zt,
    disabled: zs,
    onPositionChange: (Bs) => Cr && (er == null ? void 0 : er(Bs === "top" ? "column-reverse" : "column")),
    variant: Fs
  }, kn);
}
SelectPopover.Target = Popover.Target;
SelectPopover.Dropdown = SelectPopoverDropdown;
function filterData$2({ data: _e, limit: Qt, value: Zt, filter: $n }) {
  const Sn = [];
  for (let kn = 0; kn < _e.length && ($n(Zt, _e[kn]) && Sn.push(_e[kn]), !(Sn.length >= Qt)); kn += 1)
    ;
  return Sn;
}
var useStyles$2i = createStyles(() => ({
  wrapper: {
    position: "relative"
  }
}));
const useStyles$2j = useStyles$2i;
var __defProp$1_ = Object.defineProperty, __defProps$10 = Object.defineProperties, __getOwnPropDescs$10 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1$ = Object.getOwnPropertySymbols, __hasOwnProp$1$ = Object.prototype.hasOwnProperty, __propIsEnum$1$ = Object.prototype.propertyIsEnumerable, __defNormalProp$1_ = (_e, Qt, Zt) => Qt in _e ? __defProp$1_(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1_ = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1$.call(Qt, Zt) && __defNormalProp$1_(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1$)
    for (var Zt of __getOwnPropSymbols$1$(Qt))
      __propIsEnum$1$.call(Qt, Zt) && __defNormalProp$1_(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$10 = (_e, Qt) => __defProps$10(_e, __getOwnPropDescs$10(Qt)), __objRest$1x = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1$.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1$)
    for (var $n of __getOwnPropSymbols$1$(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1$.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function useInputProps(_e, Qt, Zt) {
  const $n = useComponentDefaultProps(_e, Qt, Zt), {
    label: Sn,
    description: kn,
    error: Kn,
    required: er,
    classNames: Cr,
    styles: kr,
    className: Yr,
    unstyled: Ms,
    __staticSelector: Ds,
    sx: Ls,
    errorProps: js,
    labelProps: zs,
    descriptionProps: Fs,
    wrapperProps: Bs,
    id: Hs,
    size: Ws,
    style: Ys,
    inputContainer: El,
    inputWrapperOrder: Mu,
    withAsterisk: Pl,
    variant: Iu
  } = $n, Tu = __objRest$1x($n, [
    "label",
    "description",
    "error",
    "required",
    "classNames",
    "styles",
    "className",
    "unstyled",
    "__staticSelector",
    "sx",
    "errorProps",
    "labelProps",
    "descriptionProps",
    "wrapperProps",
    "id",
    "size",
    "style",
    "inputContainer",
    "inputWrapperOrder",
    "withAsterisk",
    "variant"
  ]), Au = useId$1(Hs), { systemStyles: Nu, rest: gm } = extractSystemStyles(Tu), pm = __spreadValues$1_({
    label: Sn,
    description: kn,
    error: Kn,
    required: er,
    classNames: Cr,
    className: Yr,
    __staticSelector: Ds,
    sx: Ls,
    errorProps: js,
    labelProps: zs,
    descriptionProps: Fs,
    unstyled: Ms,
    styles: kr,
    id: Au,
    size: Ws,
    style: Ys,
    inputContainer: El,
    inputWrapperOrder: Mu,
    withAsterisk: Pl,
    variant: Iu
  }, Bs);
  return __spreadProps$10(__spreadValues$1_({}, gm), {
    classNames: Cr,
    styles: kr,
    unstyled: Ms,
    wrapperProps: __spreadValues$1_(__spreadValues$1_({}, pm), Nu),
    inputProps: {
      required: er,
      classNames: Cr,
      styles: kr,
      unstyled: Ms,
      id: Au,
      size: Ws,
      __staticSelector: Ds,
      error: Kn,
      variant: Iu
    }
  });
}
var useStyles$2g = createStyles((_e, Qt, { size: Zt }) => ({
  label: {
    display: "inline-block",
    fontSize: getSize$1({ size: Zt, sizes: _e.fontSizes }),
    fontWeight: 500,
    color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.colors.gray[9],
    wordBreak: "break-word",
    cursor: "default",
    WebkitTapHighlightColor: "transparent"
  },
  required: {
    color: _e.fn.variant({ variant: "filled", color: "red" }).background
  }
}));
const useStyles$2h = useStyles$2g;
var __defProp$1Z = Object.defineProperty, __getOwnPropSymbols$1_ = Object.getOwnPropertySymbols, __hasOwnProp$1_ = Object.prototype.hasOwnProperty, __propIsEnum$1_ = Object.prototype.propertyIsEnumerable, __defNormalProp$1Z = (_e, Qt, Zt) => Qt in _e ? __defProp$1Z(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1Z = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1_.call(Qt, Zt) && __defNormalProp$1Z(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1_)
    for (var Zt of __getOwnPropSymbols$1_(Qt))
      __propIsEnum$1_.call(Qt, Zt) && __defNormalProp$1Z(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1w = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1_.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1_)
    for (var $n of __getOwnPropSymbols$1_(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1_.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1j = {
  labelElement: "label",
  size: "sm"
}, InputLabel = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("InputLabel", defaultProps$1j, _e), {
    labelElement: $n,
    children: Sn,
    required: kn,
    size: Kn,
    classNames: er,
    styles: Cr,
    unstyled: kr,
    className: Yr,
    htmlFor: Ms,
    __staticSelector: Ds,
    variant: Ls,
    onMouseDown: js
  } = Zt, zs = __objRest$1w(Zt, [
    "labelElement",
    "children",
    "required",
    "size",
    "classNames",
    "styles",
    "unstyled",
    "className",
    "htmlFor",
    "__staticSelector",
    "variant",
    "onMouseDown"
  ]), { classes: Fs, cx: Bs } = useStyles$2h(null, {
    name: ["InputWrapper", Ds],
    classNames: er,
    styles: Cr,
    unstyled: kr,
    variant: Ls,
    size: Kn
  });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1Z({
    component: $n,
    ref: Qt,
    className: Bs(Fs.label, Yr),
    htmlFor: $n === "label" ? Ms : void 0,
    onMouseDown: (Hs) => {
      js == null || js(Hs), !Hs.defaultPrevented && Hs.detail > 1 && Hs.preventDefault();
    }
  }, zs), Sn, kn && /* @__PURE__ */ React.createElement("span", {
    className: Fs.required,
    "aria-hidden": !0
  }, " *"));
});
InputLabel.displayName = "@mantine/core/InputLabel";
var useStyles$2e = createStyles((_e, Qt, { size: Zt }) => ({
  error: {
    wordBreak: "break-word",
    color: _e.fn.variant({ variant: "filled", color: "red" }).background,
    fontSize: `calc(${getSize$1({ size: Zt, sizes: _e.fontSizes })} - ${rem$1(2)})`,
    lineHeight: 1.2,
    display: "block"
  }
}));
const useStyles$2f = useStyles$2e;
var __defProp$1Y = Object.defineProperty, __getOwnPropSymbols$1Z = Object.getOwnPropertySymbols, __hasOwnProp$1Z = Object.prototype.hasOwnProperty, __propIsEnum$1Z = Object.prototype.propertyIsEnumerable, __defNormalProp$1Y = (_e, Qt, Zt) => Qt in _e ? __defProp$1Y(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1Y = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1Z.call(Qt, Zt) && __defNormalProp$1Y(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1Z)
    for (var Zt of __getOwnPropSymbols$1Z(Qt))
      __propIsEnum$1Z.call(Qt, Zt) && __defNormalProp$1Y(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1v = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1Z.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1Z)
    for (var $n of __getOwnPropSymbols$1Z(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1Z.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1i = {
  size: "sm"
}, InputError = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("InputError", defaultProps$1i, _e), {
    children: $n,
    className: Sn,
    classNames: kn,
    styles: Kn,
    unstyled: er,
    size: Cr,
    __staticSelector: kr,
    variant: Yr
  } = Zt, Ms = __objRest$1v(Zt, [
    "children",
    "className",
    "classNames",
    "styles",
    "unstyled",
    "size",
    "__staticSelector",
    "variant"
  ]), { classes: Ds, cx: Ls } = useStyles$2f(null, {
    name: ["InputWrapper", kr],
    classNames: kn,
    styles: Kn,
    unstyled: er,
    variant: Yr,
    size: Cr
  });
  return /* @__PURE__ */ React.createElement(Text, __spreadValues$1Y({
    className: Ls(Ds.error, Sn),
    ref: Qt
  }, Ms), $n);
});
InputError.displayName = "@mantine/core/InputError";
var useStyles$2c = createStyles((_e, Qt, { size: Zt }) => ({
  description: {
    wordBreak: "break-word",
    color: _e.colorScheme === "dark" ? _e.colors.dark[2] : _e.colors.gray[6],
    fontSize: `calc(${getSize$1({ size: Zt, sizes: _e.fontSizes })} - ${rem$1(2)})`,
    lineHeight: 1.2,
    display: "block"
  }
}));
const useStyles$2d = useStyles$2c;
var __defProp$1X = Object.defineProperty, __getOwnPropSymbols$1Y = Object.getOwnPropertySymbols, __hasOwnProp$1Y = Object.prototype.hasOwnProperty, __propIsEnum$1Y = Object.prototype.propertyIsEnumerable, __defNormalProp$1X = (_e, Qt, Zt) => Qt in _e ? __defProp$1X(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1X = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1Y.call(Qt, Zt) && __defNormalProp$1X(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1Y)
    for (var Zt of __getOwnPropSymbols$1Y(Qt))
      __propIsEnum$1Y.call(Qt, Zt) && __defNormalProp$1X(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1u = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1Y.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1Y)
    for (var $n of __getOwnPropSymbols$1Y(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1Y.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1h = {
  size: "sm"
}, InputDescription = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("InputDescription", defaultProps$1h, _e), {
    children: $n,
    className: Sn,
    classNames: kn,
    styles: Kn,
    unstyled: er,
    size: Cr,
    __staticSelector: kr,
    variant: Yr
  } = Zt, Ms = __objRest$1u(Zt, [
    "children",
    "className",
    "classNames",
    "styles",
    "unstyled",
    "size",
    "__staticSelector",
    "variant"
  ]), { classes: Ds, cx: Ls } = useStyles$2d(null, {
    name: ["InputWrapper", kr],
    classNames: kn,
    styles: Kn,
    unstyled: er,
    variant: Yr,
    size: Cr
  });
  return /* @__PURE__ */ React.createElement(Text, __spreadValues$1X({
    color: "dimmed",
    className: Ls(Ds.description, Sn),
    ref: Qt,
    unstyled: er
  }, Ms), $n);
});
InputDescription.displayName = "@mantine/core/InputDescription";
const InputWrapperContext = reactExports.createContext({
  offsetBottom: !1,
  offsetTop: !1,
  describedBy: void 0
}), InputWrapperProvider = InputWrapperContext.Provider, useInputWrapperContext = () => reactExports.useContext(InputWrapperContext);
function getInputOffsets(_e, { hasDescription: Qt, hasError: Zt }) {
  const $n = _e.findIndex((Cr) => Cr === "input"), Sn = _e[$n - 1], kn = _e[$n + 1];
  return { offsetBottom: Qt && kn === "description" || Zt && kn === "error", offsetTop: Qt && Sn === "description" || Zt && Sn === "error" };
}
var __defProp$1W = Object.defineProperty, __defProps$$ = Object.defineProperties, __getOwnPropDescs$$ = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1X = Object.getOwnPropertySymbols, __hasOwnProp$1X = Object.prototype.hasOwnProperty, __propIsEnum$1X = Object.prototype.propertyIsEnumerable, __defNormalProp$1W = (_e, Qt, Zt) => Qt in _e ? __defProp$1W(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1W = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1X.call(Qt, Zt) && __defNormalProp$1W(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1X)
    for (var Zt of __getOwnPropSymbols$1X(Qt))
      __propIsEnum$1X.call(Qt, Zt) && __defNormalProp$1W(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$$ = (_e, Qt) => __defProps$$(_e, __getOwnPropDescs$$(Qt)), useStyles$2a = createStyles((_e) => ({
  root: __spreadProps$$(__spreadValues$1W({}, _e.fn.fontStyles()), {
    lineHeight: _e.lineHeight
  })
}));
const useStyles$2b = useStyles$2a;
var __defProp$1V = Object.defineProperty, __defProps$_ = Object.defineProperties, __getOwnPropDescs$_ = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1W = Object.getOwnPropertySymbols, __hasOwnProp$1W = Object.prototype.hasOwnProperty, __propIsEnum$1W = Object.prototype.propertyIsEnumerable, __defNormalProp$1V = (_e, Qt, Zt) => Qt in _e ? __defProp$1V(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1V = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1W.call(Qt, Zt) && __defNormalProp$1V(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1W)
    for (var Zt of __getOwnPropSymbols$1W(Qt))
      __propIsEnum$1W.call(Qt, Zt) && __defNormalProp$1V(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$_ = (_e, Qt) => __defProps$_(_e, __getOwnPropDescs$_(Qt)), __objRest$1t = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1W.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1W)
    for (var $n of __getOwnPropSymbols$1W(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1W.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1g = {
  labelElement: "label",
  size: "sm",
  inputContainer: (_e) => _e,
  inputWrapperOrder: ["label", "description", "input", "error"]
}, InputWrapper = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("InputWrapper", defaultProps$1g, _e), {
    className: $n,
    label: Sn,
    children: kn,
    required: Kn,
    id: er,
    error: Cr,
    description: kr,
    labelElement: Yr,
    labelProps: Ms,
    descriptionProps: Ds,
    errorProps: Ls,
    classNames: js,
    styles: zs,
    size: Fs,
    inputContainer: Bs,
    __staticSelector: Hs,
    unstyled: Ws,
    inputWrapperOrder: Ys,
    withAsterisk: El,
    variant: Mu
  } = Zt, Pl = __objRest$1t(Zt, [
    "className",
    "label",
    "children",
    "required",
    "id",
    "error",
    "description",
    "labelElement",
    "labelProps",
    "descriptionProps",
    "errorProps",
    "classNames",
    "styles",
    "size",
    "inputContainer",
    "__staticSelector",
    "unstyled",
    "inputWrapperOrder",
    "withAsterisk",
    "variant"
  ]), { classes: Iu, cx: Tu } = useStyles$2b(null, {
    classNames: js,
    styles: zs,
    name: ["InputWrapper", Hs],
    unstyled: Ws,
    variant: Mu,
    size: Fs
  }), Au = {
    classNames: js,
    styles: zs,
    unstyled: Ws,
    size: Fs,
    variant: Mu,
    __staticSelector: Hs
  }, Nu = typeof El == "boolean" ? El : Kn, gm = er ? `${er}-error` : Ls == null ? void 0 : Ls.id, pm = er ? `${er}-description` : Ds == null ? void 0 : Ds.id, Yu = `${!!Cr && typeof Cr != "boolean" ? gm : ""} ${kr ? pm : ""}`, sm = Yu.trim().length > 0 ? Yu.trim() : void 0, mm = Sn && /* @__PURE__ */ React.createElement(InputLabel, __spreadValues$1V(__spreadValues$1V({
    key: "label",
    labelElement: Yr,
    id: er ? `${er}-label` : void 0,
    htmlFor: er,
    required: Nu
  }, Au), Ms), Sn), hm = kr && /* @__PURE__ */ React.createElement(InputDescription, __spreadProps$_(__spreadValues$1V(__spreadValues$1V({
    key: "description"
  }, Ds), Au), {
    size: (Ds == null ? void 0 : Ds.size) || Au.size,
    id: (Ds == null ? void 0 : Ds.id) || pm
  }), kr), ym = /* @__PURE__ */ React.createElement(reactExports.Fragment, {
    key: "input"
  }, Bs(kn)), _m = typeof Cr != "boolean" && Cr && /* @__PURE__ */ React.createElement(InputError, __spreadProps$_(__spreadValues$1V(__spreadValues$1V({}, Ls), Au), {
    size: (Ls == null ? void 0 : Ls.size) || Au.size,
    key: "error",
    id: (Ls == null ? void 0 : Ls.id) || gm
  }), Cr), Sm = Ys.map((wm) => {
    switch (wm) {
      case "label":
        return mm;
      case "input":
        return ym;
      case "description":
        return hm;
      case "error":
        return _m;
      default:
        return null;
    }
  });
  return /* @__PURE__ */ React.createElement(InputWrapperProvider, {
    value: __spreadValues$1V({
      describedBy: sm
    }, getInputOffsets(Ys, {
      hasDescription: !!hm,
      hasError: !!_m
    }))
  }, /* @__PURE__ */ React.createElement(Box, __spreadValues$1V({
    className: Tu(Iu.root, $n),
    ref: Qt
  }, Pl), Sm));
});
InputWrapper.displayName = "@mantine/core/InputWrapper";
var __defProp$1U = Object.defineProperty, __getOwnPropSymbols$1V = Object.getOwnPropertySymbols, __hasOwnProp$1V = Object.prototype.hasOwnProperty, __propIsEnum$1V = Object.prototype.propertyIsEnumerable, __defNormalProp$1U = (_e, Qt, Zt) => Qt in _e ? __defProp$1U(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1U = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1V.call(Qt, Zt) && __defNormalProp$1U(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1V)
    for (var Zt of __getOwnPropSymbols$1V(Qt))
      __propIsEnum$1V.call(Qt, Zt) && __defNormalProp$1U(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1s = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1V.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1V)
    for (var $n of __getOwnPropSymbols$1V(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1V.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1f = {}, InputPlaceholder = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("InputPlaceholder", defaultProps$1f, _e), { sx: $n } = Zt, Sn = __objRest$1s(Zt, ["sx"]);
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1U({
    component: "span",
    sx: [(kn) => kn.fn.placeholderStyles(), ...packSx($n)],
    ref: Qt
  }, Sn));
});
InputPlaceholder.displayName = "@mantine/core/InputPlaceholder";
var __defProp$1T = Object.defineProperty, __defProps$Z = Object.defineProperties, __getOwnPropDescs$Z = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1U = Object.getOwnPropertySymbols, __hasOwnProp$1U = Object.prototype.hasOwnProperty, __propIsEnum$1U = Object.prototype.propertyIsEnumerable, __defNormalProp$1T = (_e, Qt, Zt) => Qt in _e ? __defProp$1T(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1T = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1U.call(Qt, Zt) && __defNormalProp$1T(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1U)
    for (var Zt of __getOwnPropSymbols$1U(Qt))
      __propIsEnum$1U.call(Qt, Zt) && __defNormalProp$1T(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$Z = (_e, Qt) => __defProps$Z(_e, __getOwnPropDescs$Z(Qt));
const sizes$d = {
  xs: rem$1(30),
  sm: rem$1(36),
  md: rem$1(42),
  lg: rem$1(50),
  xl: rem$1(60)
}, INPUT_VARIANTS = ["default", "filled", "unstyled"];
function getVariantStyles$5({ theme: _e, variant: Qt }) {
  return INPUT_VARIANTS.includes(Qt) ? Qt === "default" ? {
    border: `${rem$1(1)} solid ${_e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[4]}`,
    backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.white,
    transition: "border-color 100ms ease",
    "&:focus, &:focus-within": _e.focusRingStyles.inputStyles(_e)
  } : Qt === "filled" ? {
    border: `${rem$1(1)} solid transparent`,
    backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[1],
    "&:focus, &:focus-within": _e.focusRingStyles.inputStyles(_e)
  } : {
    borderWidth: 0,
    color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
    backgroundColor: "transparent",
    minHeight: rem$1(28),
    outline: 0,
    "&:focus, &:focus-within": {
      outline: "none",
      borderColor: "transparent"
    },
    "&:disabled": {
      backgroundColor: "transparent",
      "&:focus, &:focus-within": {
        outline: "none",
        borderColor: "transparent"
      }
    }
  } : null;
}
var useStyles$28 = createStyles((_e, {
  multiline: Qt,
  radius: Zt,
  invalid: $n,
  rightSectionWidth: Sn,
  withRightSection: kn,
  iconWidth: Kn,
  offsetBottom: er,
  offsetTop: Cr,
  pointer: kr
}, { variant: Yr, size: Ms }) => {
  const Ds = _e.fn.variant({
    variant: "filled",
    color: "red"
  }).background, Ls = Yr === "default" || Yr === "filled" ? {
    minHeight: getSize$1({ size: Ms, sizes: sizes$d }),
    paddingLeft: `calc(${getSize$1({ size: Ms, sizes: sizes$d })}  / 3)`,
    paddingRight: kn ? Sn || getSize$1({ size: Ms, sizes: sizes$d }) : `calc(${getSize$1({ size: Ms, sizes: sizes$d })}  / 3)`,
    borderRadius: _e.fn.radius(Zt)
  } : Yr === "unstyled" && kn ? {
    paddingRight: Sn || getSize$1({ size: Ms, sizes: sizes$d })
  } : null;
  return {
    wrapper: {
      position: "relative",
      marginTop: Cr ? `calc(${_e.spacing.xs} / 2)` : void 0,
      marginBottom: er ? `calc(${_e.spacing.xs} / 2)` : void 0,
      "&:has(input:disabled)": {
        "& .mantine-Input-rightSection": {
          display: "none"
        }
      }
    },
    input: __spreadProps$Z(__spreadValues$1T(__spreadValues$1T(__spreadProps$Z(__spreadValues$1T({}, _e.fn.fontStyles()), {
      height: Qt ? Yr === "unstyled" ? void 0 : "auto" : getSize$1({ size: Ms, sizes: sizes$d }),
      WebkitTapHighlightColor: "transparent",
      lineHeight: Qt ? _e.lineHeight : `calc(${getSize$1({ size: Ms, sizes: sizes$d })} - ${rem$1(2)})`,
      appearance: "none",
      resize: "none",
      boxSizing: "border-box",
      fontSize: getSize$1({ size: Ms, sizes: _e.fontSizes }),
      width: "100%",
      color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
      display: "block",
      textAlign: "left",
      cursor: kr ? "pointer" : void 0
    }), getVariantStyles$5({ theme: _e, variant: Yr })), Ls), {
      "&:disabled, &[data-disabled]": {
        backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[1],
        color: _e.colors.dark[2],
        opacity: 0.6,
        cursor: "not-allowed",
        pointerEvents: "none",
        "&::placeholder": {
          color: _e.colors.dark[2]
        }
      },
      "&[data-invalid]": {
        color: Ds,
        borderColor: Ds,
        "&::placeholder": {
          opacity: 1,
          color: Ds
        }
      },
      "&[data-with-icon]": {
        paddingLeft: typeof Kn == "number" ? rem$1(Kn) : getSize$1({ size: Ms, sizes: sizes$d })
      },
      "&::placeholder": __spreadProps$Z(__spreadValues$1T({}, _e.fn.placeholderStyles()), {
        opacity: 1
      }),
      "&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration": {
        appearance: "none"
      },
      "&[type=number]": {
        MozAppearance: "textfield"
      }
    }),
    icon: {
      pointerEvents: "none",
      position: "absolute",
      zIndex: 1,
      left: 0,
      top: 0,
      bottom: 0,
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      width: Kn ? rem$1(Kn) : getSize$1({ size: Ms, sizes: sizes$d }),
      color: $n ? _e.colors.red[_e.colorScheme === "dark" ? 6 : 7] : _e.colorScheme === "dark" ? _e.colors.dark[2] : _e.colors.gray[5]
    },
    rightSection: {
      position: "absolute",
      top: 0,
      bottom: 0,
      right: 0,
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      width: Sn || getSize$1({ size: Ms, sizes: sizes$d })
    }
  };
});
const useStyles$29 = useStyles$28;
var __defProp$1S = Object.defineProperty, __defProps$Y = Object.defineProperties, __getOwnPropDescs$Y = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1T = Object.getOwnPropertySymbols, __hasOwnProp$1T = Object.prototype.hasOwnProperty, __propIsEnum$1T = Object.prototype.propertyIsEnumerable, __defNormalProp$1S = (_e, Qt, Zt) => Qt in _e ? __defProp$1S(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1S = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1T.call(Qt, Zt) && __defNormalProp$1S(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1T)
    for (var Zt of __getOwnPropSymbols$1T(Qt))
      __propIsEnum$1T.call(Qt, Zt) && __defNormalProp$1S(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$Y = (_e, Qt) => __defProps$Y(_e, __getOwnPropDescs$Y(Qt)), __objRest$1r = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1T.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1T)
    for (var $n of __getOwnPropSymbols$1T(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1T.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1e = {
  size: "sm",
  variant: "default"
}, _Input = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Input", defaultProps$1e, _e), {
    className: $n,
    error: Sn,
    required: kn,
    disabled: Kn,
    variant: er,
    icon: Cr,
    style: kr,
    rightSectionWidth: Yr,
    iconWidth: Ms,
    rightSection: Ds,
    rightSectionProps: Ls,
    radius: js,
    size: zs,
    wrapperProps: Fs,
    classNames: Bs,
    styles: Hs,
    __staticSelector: Ws,
    multiline: Ys,
    sx: El,
    unstyled: Mu,
    pointer: Pl
  } = Zt, Iu = __objRest$1r(Zt, [
    "className",
    "error",
    "required",
    "disabled",
    "variant",
    "icon",
    "style",
    "rightSectionWidth",
    "iconWidth",
    "rightSection",
    "rightSectionProps",
    "radius",
    "size",
    "wrapperProps",
    "classNames",
    "styles",
    "__staticSelector",
    "multiline",
    "sx",
    "unstyled",
    "pointer"
  ]), { offsetBottom: Tu, offsetTop: Au, describedBy: Nu } = useInputWrapperContext(), { classes: gm, cx: pm } = useStyles$29({
    radius: js,
    multiline: Ys,
    invalid: !!Sn,
    rightSectionWidth: Yr ? rem$1(Yr) : void 0,
    iconWidth: Ms,
    withRightSection: !!Ds,
    offsetBottom: Tu,
    offsetTop: Au,
    pointer: Pl
  }, { classNames: Bs, styles: Hs, name: ["Input", Ws], unstyled: Mu, variant: er, size: zs }), { systemStyles: zu, rest: Yu } = extractSystemStyles(Iu);
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1S(__spreadValues$1S({
    className: pm(gm.wrapper, $n),
    sx: El,
    style: kr
  }, zu), Fs), Cr && /* @__PURE__ */ React.createElement("div", {
    className: gm.icon
  }, Cr), /* @__PURE__ */ React.createElement(Box, __spreadProps$Y(__spreadValues$1S({
    component: "input"
  }, Yu), {
    ref: Qt,
    required: kn,
    "aria-invalid": !!Sn,
    "aria-describedby": Nu,
    disabled: Kn,
    "data-disabled": Kn || void 0,
    "data-with-icon": !!Cr || void 0,
    "data-invalid": !!Sn || void 0,
    className: gm.input
  })), Ds && /* @__PURE__ */ React.createElement("div", __spreadProps$Y(__spreadValues$1S({}, Ls), {
    className: gm.rightSection
  }), Ds));
});
_Input.displayName = "@mantine/core/Input";
_Input.Wrapper = InputWrapper;
_Input.Label = InputLabel;
_Input.Description = InputDescription;
_Input.Error = InputError;
_Input.Placeholder = InputPlaceholder;
const Input = _Input;
var __defProp$1R = Object.defineProperty, __defProps$X = Object.defineProperties, __getOwnPropDescs$X = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1S = Object.getOwnPropertySymbols, __hasOwnProp$1S = Object.prototype.hasOwnProperty, __propIsEnum$1S = Object.prototype.propertyIsEnumerable, __defNormalProp$1R = (_e, Qt, Zt) => Qt in _e ? __defProp$1R(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1R = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1S.call(Qt, Zt) && __defNormalProp$1R(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1S)
    for (var Zt of __getOwnPropSymbols$1S(Qt))
      __propIsEnum$1S.call(Qt, Zt) && __defNormalProp$1R(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$X = (_e, Qt) => __defProps$X(_e, __getOwnPropDescs$X(Qt)), __objRest$1q = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1S.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1S)
    for (var $n of __getOwnPropSymbols$1S(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1S.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function defaultFilter$3(_e, Qt) {
  return Qt.value.toLowerCase().trim().includes(_e.toLowerCase().trim());
}
const defaultProps$1d = {
  required: !1,
  size: "sm",
  shadow: "sm",
  limit: 5,
  itemComponent: DefaultItem,
  transitionProps: { transition: "fade", duration: 0 },
  initiallyOpened: !1,
  filter: defaultFilter$3,
  switchDirectionOnFlip: !1,
  zIndex: getDefaultZIndex("popover"),
  dropdownPosition: "flip",
  maxDropdownHeight: "auto",
  positionDependencies: []
}, Autocomplete = reactExports.forwardRef((_e, Qt) => {
  const Zt = useInputProps("Autocomplete", defaultProps$1d, _e), {
    inputProps: $n,
    wrapperProps: Sn,
    shadow: kn,
    data: Kn,
    limit: er,
    value: Cr,
    defaultValue: kr,
    onChange: Yr,
    unstyled: Ms,
    itemComponent: Ds,
    onItemSubmit: Ls,
    onKeyDown: js,
    onFocus: zs,
    onBlur: Fs,
    onClick: Bs,
    transitionProps: Hs,
    initiallyOpened: Ws,
    classNames: Ys,
    styles: El,
    filter: Mu,
    nothingFound: Pl,
    onDropdownClose: Iu,
    onDropdownOpen: Tu,
    withinPortal: Au,
    switchDirectionOnFlip: Nu,
    zIndex: gm,
    dropdownPosition: pm,
    maxDropdownHeight: zu,
    dropdownComponent: Yu,
    positionDependencies: sm,
    readOnly: mm,
    hoverOnSearchChange: hm
  } = Zt, ym = __objRest$1q(Zt, [
    "inputProps",
    "wrapperProps",
    "shadow",
    "data",
    "limit",
    "value",
    "defaultValue",
    "onChange",
    "unstyled",
    "itemComponent",
    "onItemSubmit",
    "onKeyDown",
    "onFocus",
    "onBlur",
    "onClick",
    "transitionProps",
    "initiallyOpened",
    "classNames",
    "styles",
    "filter",
    "nothingFound",
    "onDropdownClose",
    "onDropdownOpen",
    "withinPortal",
    "switchDirectionOnFlip",
    "zIndex",
    "dropdownPosition",
    "maxDropdownHeight",
    "dropdownComponent",
    "positionDependencies",
    "readOnly",
    "hoverOnSearchChange"
  ]), { classes: _m } = useStyles$2j(null, { classNames: Ys, styles: El, name: "Autocomplete", unstyled: Ms }), [Sm, wm] = reactExports.useState(Ws), [Nm, Cm] = reactExports.useState(-1), [Im, Am] = reactExports.useState("column"), Vm = reactExports.useRef(null), [Rm, Dm] = reactExports.useState(!1), [km, zm] = useUncontrolled({
    value: Cr,
    defaultValue: kr,
    finalValue: "",
    onChange: Yr
  }), Pm = (l$) => {
    wm(l$);
    const _$ = l$ ? Tu : Iu;
    typeof _$ == "function" && _$();
  };
  useDidUpdate(() => {
    Cm(hm && km ? 0 : -1);
  }, [km, hm]);
  const i$ = (l$) => {
    zm(l$.value), typeof Ls == "function" && Ls(l$), Pm(!1);
  }, o$ = Kn.map((l$) => typeof l$ == "string" ? { value: l$ } : l$), u$ = groupOptions({
    data: filterData$2({ data: o$, value: km, limit: er, filter: Mu })
  }), h$ = (l$) => {
    if (Rm)
      return;
    typeof js == "function" && js(l$);
    const _$ = Im === "column", a$ = () => {
      Cm((m$) => m$ < u$.length - 1 ? m$ + 1 : m$);
    }, n$ = () => {
      Cm((m$) => m$ > 0 ? m$ - 1 : m$);
    };
    switch (l$.key) {
      case "ArrowUp": {
        l$.preventDefault(), _$ ? n$() : a$();
        break;
      }
      case "ArrowDown": {
        l$.preventDefault(), _$ ? a$() : n$();
        break;
      }
      case "Enter": {
        u$[Nm] && Sm && (l$.preventDefault(), zm(u$[Nm].value), typeof Ls == "function" && Ls(u$[Nm]), Pm(!1));
        break;
      }
      case "Escape":
        Sm && (l$.preventDefault(), Pm(!1));
    }
  }, d$ = (l$) => {
    typeof zs == "function" && zs(l$), Pm(!0);
  }, v$ = (l$) => {
    typeof Fs == "function" && Fs(l$), Pm(!1);
  }, $$ = (l$) => {
    typeof Bs == "function" && Bs(l$), Pm(!0);
  }, s$ = Sm && (u$.length > 0 || u$.length === 0 && !!Pl);
  return /* @__PURE__ */ React.createElement(Input.Wrapper, __spreadProps$X(__spreadValues$1R({}, Sn), {
    __staticSelector: "Autocomplete"
  }), /* @__PURE__ */ React.createElement(SelectPopover, {
    opened: s$,
    transitionProps: Hs,
    shadow: "sm",
    withinPortal: Au,
    __staticSelector: "Autocomplete",
    onDirectionChange: Am,
    switchDirectionOnFlip: Nu,
    zIndex: gm,
    dropdownPosition: pm,
    positionDependencies: sm,
    classNames: Ys,
    styles: El,
    unstyled: Ms,
    readOnly: mm,
    variant: $n.variant
  }, /* @__PURE__ */ React.createElement(SelectPopover.Target, null, /* @__PURE__ */ React.createElement("div", {
    className: _m.wrapper,
    "aria-controls": $n.id,
    onMouseLeave: () => Cm(-1),
    tabIndex: -1
  }, /* @__PURE__ */ React.createElement(Input, __spreadProps$X(__spreadValues$1R(__spreadValues$1R({
    type: "search",
    autoComplete: "off"
  }, $n), ym), {
    readOnly: mm,
    "data-mantine-stop-propagation": Sm,
    ref: useMergedRef(Qt, Vm),
    onKeyDown: h$,
    classNames: Ys,
    styles: El,
    __staticSelector: "Autocomplete",
    value: km,
    onChange: (l$) => {
      zm(l$.currentTarget.value), Pm(!0);
    },
    onFocus: d$,
    onBlur: v$,
    onClick: $$,
    onCompositionStart: () => Dm(!0),
    onCompositionEnd: () => Dm(!1),
    role: "combobox",
    "aria-haspopup": "listbox",
    "aria-owns": s$ ? `${$n.id}-items` : null,
    "aria-expanded": s$,
    "aria-autocomplete": "list",
    "aria-controls": s$ ? `${$n.id}-items` : null,
    "aria-activedescendant": Nm >= 0 ? `${$n.id}-${Nm}` : null
  })))), /* @__PURE__ */ React.createElement(SelectPopover.Dropdown, {
    component: Yu || SelectScrollArea,
    maxHeight: zu,
    direction: Im,
    id: $n.id,
    __staticSelector: "Autocomplete",
    classNames: Ys,
    styles: El
  }, /* @__PURE__ */ React.createElement(SelectItems, {
    data: u$,
    hovered: Nm,
    classNames: Ys,
    styles: El,
    uuid: $n.id,
    __staticSelector: "Autocomplete",
    onItemHover: Cm,
    onItemSelect: i$,
    itemComponent: Ds,
    size: $n.size,
    nothingFound: Pl,
    variant: $n.variant
  }))));
});
Autocomplete.displayName = "@mantine/core/Autocomplete";
var __defProp$1Q = Object.defineProperty, __defProps$W = Object.defineProperties, __getOwnPropDescs$W = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1R = Object.getOwnPropertySymbols, __hasOwnProp$1R = Object.prototype.hasOwnProperty, __propIsEnum$1R = Object.prototype.propertyIsEnumerable, __defNormalProp$1Q = (_e, Qt, Zt) => Qt in _e ? __defProp$1Q(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1Q = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1R.call(Qt, Zt) && __defNormalProp$1Q(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1R)
    for (var Zt of __getOwnPropSymbols$1R(Qt))
      __propIsEnum$1R.call(Qt, Zt) && __defNormalProp$1Q(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$W = (_e, Qt) => __defProps$W(_e, __getOwnPropDescs$W(Qt));
const BADGE_VARIANTS = ["light", "filled", "outline", "dot", "gradient"], sizes$c = {
  xs: { fontSize: rem$1(9), height: rem$1(16) },
  sm: { fontSize: rem$1(10), height: rem$1(18) },
  md: { fontSize: rem$1(11), height: rem$1(20) },
  lg: { fontSize: rem$1(13), height: rem$1(26) },
  xl: { fontSize: rem$1(16), height: rem$1(32) }
}, dotSizes = {
  xs: rem$1(4),
  sm: rem$1(4),
  md: rem$1(6),
  lg: rem$1(8),
  xl: rem$1(10)
};
function getVariantStyles$4({ theme: _e, variant: Qt, color: Zt, size: $n, gradient: Sn }) {
  if (!BADGE_VARIANTS.includes(Qt))
    return null;
  if (Qt === "dot") {
    const Kn = getSize$1({ size: $n, sizes: dotSizes });
    return {
      backgroundColor: "transparent",
      color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.colors.gray[7],
      border: `${rem$1(1)} solid ${_e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[3]}`,
      paddingLeft: `calc(${getSize$1({ size: $n, sizes: _e.spacing })} / 1.5 - ${Kn} / 2)`,
      "&::before": {
        content: '""',
        display: "block",
        width: Kn,
        height: Kn,
        borderRadius: Kn,
        backgroundColor: _e.fn.themeColor(Zt, _e.colorScheme === "dark" ? 4 : _e.fn.primaryShade("light"), !0),
        marginRight: Kn
      }
    };
  }
  const kn = _e.fn.variant({ color: Zt, variant: Qt, gradient: Sn });
  return {
    background: kn.background,
    color: kn.color,
    border: `${rem$1(Qt === "gradient" ? 0 : 1)} solid ${kn.border}`
  };
}
var useStyles$26 = createStyles((_e, { color: Qt, radius: Zt, gradient: $n, fullWidth: Sn }, { variant: kn, size: Kn }) => {
  const { fontSize: er, height: Cr } = Kn in sizes$c ? sizes$c[Kn] : sizes$c.md;
  return {
    leftSection: {
      marginRight: `calc(${_e.spacing.xs} / 2)`
    },
    rightSection: {
      marginLeft: `calc(${_e.spacing.xs} / 2)`
    },
    inner: {
      whiteSpace: "nowrap",
      overflow: "hidden",
      textOverflow: "ellipsis"
    },
    root: __spreadValues$1Q(__spreadProps$W(__spreadValues$1Q(__spreadValues$1Q({}, _e.fn.focusStyles()), _e.fn.fontStyles()), {
      fontSize: er,
      height: Cr,
      WebkitTapHighlightColor: "transparent",
      lineHeight: `calc(${Cr} - ${rem$1(2)})`,
      textDecoration: "none",
      padding: `0 calc(${getSize$1({ size: Kn, sizes: _e.spacing })} / 1.5)`,
      boxSizing: "border-box",
      display: Sn ? "flex" : "inline-flex",
      alignItems: "center",
      justifyContent: "center",
      width: Sn ? "100%" : "auto",
      textTransform: "uppercase",
      borderRadius: _e.fn.radius(Zt),
      fontWeight: 700,
      letterSpacing: rem$1(0.25),
      cursor: "inherit",
      textOverflow: "ellipsis",
      overflow: "hidden"
    }), getVariantStyles$4({ theme: _e, variant: kn, color: Qt, size: Kn, gradient: $n }))
  };
});
const useStyles$27 = useStyles$26;
var __defProp$1P = Object.defineProperty, __getOwnPropSymbols$1Q = Object.getOwnPropertySymbols, __hasOwnProp$1Q = Object.prototype.hasOwnProperty, __propIsEnum$1Q = Object.prototype.propertyIsEnumerable, __defNormalProp$1P = (_e, Qt, Zt) => Qt in _e ? __defProp$1P(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1P = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1Q.call(Qt, Zt) && __defNormalProp$1P(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1Q)
    for (var Zt of __getOwnPropSymbols$1Q(Qt))
      __propIsEnum$1Q.call(Qt, Zt) && __defNormalProp$1P(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1p = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1Q.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1Q)
    for (var $n of __getOwnPropSymbols$1Q(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1Q.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1c = {
  variant: "light",
  size: "md",
  radius: "xl"
}, _Badge = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Badge", defaultProps$1c, _e), {
    className: $n,
    color: Sn,
    variant: kn,
    fullWidth: Kn,
    children: er,
    size: Cr,
    leftSection: kr,
    rightSection: Yr,
    radius: Ms,
    gradient: Ds,
    classNames: Ls,
    styles: js,
    unstyled: zs
  } = Zt, Fs = __objRest$1p(Zt, [
    "className",
    "color",
    "variant",
    "fullWidth",
    "children",
    "size",
    "leftSection",
    "rightSection",
    "radius",
    "gradient",
    "classNames",
    "styles",
    "unstyled"
  ]), { classes: Bs, cx: Hs } = useStyles$27({ fullWidth: Kn, color: Sn, radius: Ms, gradient: Ds }, { classNames: Ls, styles: js, name: "Badge", unstyled: zs, variant: kn, size: Cr });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1P({
    className: Hs(Bs.root, $n),
    ref: Qt
  }, Fs), kr && /* @__PURE__ */ React.createElement("span", {
    className: Bs.leftSection
  }, kr), /* @__PURE__ */ React.createElement("span", {
    className: Bs.inner
  }, er), Yr && /* @__PURE__ */ React.createElement("span", {
    className: Bs.rightSection
  }, Yr));
});
_Badge.displayName = "@mantine/core/Badge";
const Badge = _Badge;
var useStyles$24 = createStyles((_e, { orientation: Qt, buttonBorderWidth: Zt }) => ({
  root: {
    display: "flex",
    flexDirection: Qt === "vertical" ? "column" : "row",
    "& [data-button]": {
      "&:first-of-type:not(:last-of-type)": {
        borderBottomRightRadius: 0,
        [Qt === "vertical" ? "borderBottomLeftRadius" : "borderTopRightRadius"]: 0,
        [Qt === "vertical" ? "borderBottomWidth" : "borderRightWidth"]: `calc(${rem$1(Zt)} / 2)`
      },
      "&:last-of-type:not(:first-of-type)": {
        borderTopLeftRadius: 0,
        [Qt === "vertical" ? "borderTopRightRadius" : "borderBottomLeftRadius"]: 0,
        [Qt === "vertical" ? "borderTopWidth" : "borderLeftWidth"]: `calc(${rem$1(Zt)} / 2)`
      },
      "&:not(:first-of-type):not(:last-of-type)": {
        borderRadius: 0,
        [Qt === "vertical" ? "borderTopWidth" : "borderLeftWidth"]: `calc(${rem$1(Zt)} / 2)`,
        [Qt === "vertical" ? "borderBottomWidth" : "borderRightWidth"]: `calc(${rem$1(Zt)} / 2)`
      },
      "& + [data-button]": {
        [Qt === "vertical" ? "marginTop" : "marginLeft"]: `calc(${Zt} * -1)`,
        "@media (min-resolution: 192dpi)": {
          [Qt === "vertical" ? "marginTop" : "marginLeft"]: 0
        }
      }
    }
  }
}));
const useStyles$25 = useStyles$24;
var __defProp$1O = Object.defineProperty, __getOwnPropSymbols$1P = Object.getOwnPropertySymbols, __hasOwnProp$1P = Object.prototype.hasOwnProperty, __propIsEnum$1P = Object.prototype.propertyIsEnumerable, __defNormalProp$1O = (_e, Qt, Zt) => Qt in _e ? __defProp$1O(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1O = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1P.call(Qt, Zt) && __defNormalProp$1O(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1P)
    for (var Zt of __getOwnPropSymbols$1P(Qt))
      __propIsEnum$1P.call(Qt, Zt) && __defNormalProp$1O(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1o = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1P.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1P)
    for (var $n of __getOwnPropSymbols$1P(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1P.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1b = {
  orientation: "horizontal",
  buttonBorderWidth: 1
}, ButtonGroup = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("ButtonGroup", defaultProps$1b, _e), { className: $n, orientation: Sn, buttonBorderWidth: kn, unstyled: Kn } = Zt, er = __objRest$1o(Zt, ["className", "orientation", "buttonBorderWidth", "unstyled"]), { classes: Cr, cx: kr } = useStyles$25({ orientation: Sn, buttonBorderWidth: kn }, { name: "ButtonGroup", unstyled: Kn });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1O({
    className: kr(Cr.root, $n),
    ref: Qt
  }, er));
});
ButtonGroup.displayName = "@mantine/core/ButtonGroup";
var __defProp$1N = Object.defineProperty, __defProps$V = Object.defineProperties, __getOwnPropDescs$V = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1O = Object.getOwnPropertySymbols, __hasOwnProp$1O = Object.prototype.hasOwnProperty, __propIsEnum$1O = Object.prototype.propertyIsEnumerable, __defNormalProp$1N = (_e, Qt, Zt) => Qt in _e ? __defProp$1N(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1N = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1O.call(Qt, Zt) && __defNormalProp$1N(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1O)
    for (var Zt of __getOwnPropSymbols$1O(Qt))
      __propIsEnum$1O.call(Qt, Zt) && __defNormalProp$1N(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$V = (_e, Qt) => __defProps$V(_e, __getOwnPropDescs$V(Qt));
const BUTTON_VARIANTS = [
  "filled",
  "outline",
  "light",
  "white",
  "default",
  "subtle",
  "gradient"
], sizes$b = {
  xs: { height: sizes$d.xs, paddingLeft: rem$1(14), paddingRight: rem$1(14) },
  sm: { height: sizes$d.sm, paddingLeft: rem$1(18), paddingRight: rem$1(18) },
  md: { height: sizes$d.md, paddingLeft: rem$1(22), paddingRight: rem$1(22) },
  lg: { height: sizes$d.lg, paddingLeft: rem$1(26), paddingRight: rem$1(26) },
  xl: { height: sizes$d.xl, paddingLeft: rem$1(32), paddingRight: rem$1(32) },
  "compact-xs": { height: rem$1(22), paddingLeft: rem$1(7), paddingRight: rem$1(7) },
  "compact-sm": { height: rem$1(26), paddingLeft: rem$1(8), paddingRight: rem$1(8) },
  "compact-md": { height: rem$1(30), paddingLeft: rem$1(10), paddingRight: rem$1(10) },
  "compact-lg": { height: rem$1(34), paddingLeft: rem$1(12), paddingRight: rem$1(12) },
  "compact-xl": { height: rem$1(40), paddingLeft: rem$1(14), paddingRight: rem$1(14) }
};
function getSizeStyles({ compact: _e, size: Qt, withLeftIcon: Zt, withRightIcon: $n }) {
  if (_e)
    return sizes$b[`compact-${Qt}`];
  const Sn = sizes$b[Qt];
  return Sn ? __spreadProps$V(__spreadValues$1N({}, Sn), {
    paddingLeft: Zt ? `calc(${Sn.paddingLeft}  / 1.5)` : Sn.paddingLeft,
    paddingRight: $n ? `calc(${Sn.paddingRight}  / 1.5)` : Sn.paddingRight
  }) : {};
}
const getWidthStyles = (_e) => ({
  display: _e ? "block" : "inline-block",
  width: _e ? "100%" : "auto"
});
function getVariantStyles$3({ variant: _e, theme: Qt, color: Zt, gradient: $n }) {
  if (!BUTTON_VARIANTS.includes(_e))
    return null;
  const Sn = Qt.fn.variant({ color: Zt, variant: _e, gradient: $n });
  return _e === "gradient" ? __spreadValues$1N({
    border: 0,
    backgroundImage: Sn.background,
    color: Sn.color
  }, Qt.fn.hover({ backgroundSize: "200%" })) : __spreadValues$1N({
    border: `${rem$1(1)} solid ${Sn.border}`,
    backgroundColor: Sn.background,
    color: Sn.color
  }, Qt.fn.hover({ backgroundColor: Sn.hover }));
}
var useStyles$22 = createStyles((_e, {
  radius: Qt,
  fullWidth: Zt,
  compact: $n,
  withLeftIcon: Sn,
  withRightIcon: kn,
  color: Kn,
  gradient: er
}, { variant: Cr, size: kr }) => ({
  root: __spreadProps$V(__spreadValues$1N(__spreadProps$V(__spreadValues$1N(__spreadValues$1N(__spreadValues$1N(__spreadValues$1N({}, getSizeStyles({ compact: $n, size: kr, withLeftIcon: Sn, withRightIcon: kn })), _e.fn.fontStyles()), _e.fn.focusStyles()), getWidthStyles(Zt)), {
    borderRadius: _e.fn.radius(Qt),
    fontWeight: 600,
    position: "relative",
    lineHeight: 1,
    fontSize: getSize$1({ size: kr, sizes: _e.fontSizes }),
    userSelect: "none",
    cursor: "pointer"
  }), getVariantStyles$3({ variant: Cr, theme: _e, color: Kn, gradient: er })), {
    "&:active": _e.activeStyles,
    "&:disabled, &[data-disabled]": {
      borderColor: "transparent",
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2],
      color: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[5],
      cursor: "not-allowed",
      backgroundImage: "none",
      pointerEvents: "none",
      "&:active": {
        transform: "none"
      }
    },
    "&[data-loading]": {
      pointerEvents: "none",
      "&::before": __spreadProps$V(__spreadValues$1N({
        content: '""'
      }, _e.fn.cover(rem$1(-1))), {
        backgroundColor: _e.colorScheme === "dark" ? _e.fn.rgba(_e.colors.dark[7], 0.5) : "rgba(255, 255, 255, .5)",
        borderRadius: _e.fn.radius(Qt),
        cursor: "not-allowed"
      })
    }
  }),
  icon: {
    display: "flex",
    alignItems: "center"
  },
  leftIcon: {
    marginRight: _e.spacing.xs
  },
  rightIcon: {
    marginLeft: _e.spacing.xs
  },
  centerLoader: {
    position: "absolute",
    left: "50%",
    transform: "translateX(-50%)",
    opacity: 0.5
  },
  inner: {
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    height: "100%",
    overflow: "visible"
  },
  label: {
    whiteSpace: "nowrap",
    height: "100%",
    overflow: "hidden",
    display: "flex",
    alignItems: "center"
  }
}));
const useStyles$23 = useStyles$22;
var __defProp$1M = Object.defineProperty, __getOwnPropSymbols$1N = Object.getOwnPropertySymbols, __hasOwnProp$1N = Object.prototype.hasOwnProperty, __propIsEnum$1N = Object.prototype.propertyIsEnumerable, __defNormalProp$1M = (_e, Qt, Zt) => Qt in _e ? __defProp$1M(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1M = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1N.call(Qt, Zt) && __defNormalProp$1M(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1N)
    for (var Zt of __getOwnPropSymbols$1N(Qt))
      __propIsEnum$1N.call(Qt, Zt) && __defNormalProp$1M(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1n = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1N.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1N)
    for (var $n of __getOwnPropSymbols$1N(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1N.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1a = {
  size: "sm",
  type: "button",
  variant: "filled",
  loaderPosition: "left"
}, _Button = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Button", defaultProps$1a, _e), {
    className: $n,
    size: Sn,
    color: kn,
    type: Kn,
    disabled: er,
    children: Cr,
    leftIcon: kr,
    rightIcon: Yr,
    fullWidth: Ms,
    variant: Ds,
    radius: Ls,
    uppercase: js,
    compact: zs,
    loading: Fs,
    loaderPosition: Bs,
    loaderProps: Hs,
    gradient: Ws,
    classNames: Ys,
    styles: El,
    unstyled: Mu
  } = Zt, Pl = __objRest$1n(Zt, [
    "className",
    "size",
    "color",
    "type",
    "disabled",
    "children",
    "leftIcon",
    "rightIcon",
    "fullWidth",
    "variant",
    "radius",
    "uppercase",
    "compact",
    "loading",
    "loaderPosition",
    "loaderProps",
    "gradient",
    "classNames",
    "styles",
    "unstyled"
  ]), { classes: Iu, cx: Tu, theme: Au } = useStyles$23({
    radius: Ls,
    color: kn,
    fullWidth: Ms,
    compact: zs,
    gradient: Ws,
    withLeftIcon: !!kr,
    withRightIcon: !!Yr
  }, { name: "Button", unstyled: Mu, classNames: Ys, styles: El, variant: Ds, size: Sn }), Nu = Au.fn.variant({ color: kn, variant: Ds }), gm = /* @__PURE__ */ React.createElement(Loader, __spreadValues$1M({
    color: Nu.color,
    size: `calc(${getSize$1({ size: Sn, sizes: sizes$b }).height} / 2)`
  }, Hs));
  return /* @__PURE__ */ React.createElement(UnstyledButton, __spreadValues$1M({
    className: Tu(Iu.root, $n),
    type: Kn,
    disabled: er,
    "data-button": !0,
    "data-disabled": er || void 0,
    "data-loading": Fs || void 0,
    ref: Qt,
    unstyled: Mu
  }, Pl), /* @__PURE__ */ React.createElement("div", {
    className: Iu.inner
  }, (kr || Fs && Bs === "left") && /* @__PURE__ */ React.createElement("span", {
    className: Tu(Iu.icon, Iu.leftIcon)
  }, Fs && Bs === "left" ? gm : kr), Fs && Bs === "center" && /* @__PURE__ */ React.createElement("span", {
    className: Iu.centerLoader
  }, gm), /* @__PURE__ */ React.createElement("span", {
    className: Iu.label,
    style: { textTransform: js ? "uppercase" : void 0 }
  }, Cr), (Yr || Fs && Bs === "right") && /* @__PURE__ */ React.createElement("span", {
    className: Tu(Iu.icon, Iu.rightIcon)
  }, Fs && Bs === "right" ? gm : Yr)));
});
_Button.displayName = "@mantine/core/Button";
_Button.Group = ButtonGroup;
const Button = _Button;
var useStyles$20 = createStyles((_e, { radius: Qt, shadow: Zt }) => ({
  root: {
    outline: 0,
    WebkitTapHighlightColor: "transparent",
    display: "block",
    textDecoration: "none",
    color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
    backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[7] : _e.white,
    boxSizing: "border-box",
    borderRadius: _e.fn.radius(Qt),
    boxShadow: _e.shadows[Zt] || Zt || "none",
    "&[data-with-border]": {
      border: `${rem$1(1)} solid ${_e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[3]}`
    }
  }
}));
const useStyles$21 = useStyles$20;
var __defProp$1L = Object.defineProperty, __getOwnPropSymbols$1M = Object.getOwnPropertySymbols, __hasOwnProp$1M = Object.prototype.hasOwnProperty, __propIsEnum$1M = Object.prototype.propertyIsEnumerable, __defNormalProp$1L = (_e, Qt, Zt) => Qt in _e ? __defProp$1L(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1L = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1M.call(Qt, Zt) && __defNormalProp$1L(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1M)
    for (var Zt of __getOwnPropSymbols$1M(Qt))
      __propIsEnum$1M.call(Qt, Zt) && __defNormalProp$1L(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1m = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1M.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1M)
    for (var $n of __getOwnPropSymbols$1M(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1M.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$19 = {}, _Paper = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Paper", defaultProps$19, _e), { className: $n, children: Sn, radius: kn, withBorder: Kn, shadow: er, unstyled: Cr, variant: kr } = Zt, Yr = __objRest$1m(Zt, ["className", "children", "radius", "withBorder", "shadow", "unstyled", "variant"]), { classes: Ms, cx: Ds } = useStyles$21({ radius: kn, shadow: er }, { name: "Paper", unstyled: Cr, variant: kr });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1L({
    className: Ds(Ms.root, $n),
    "data-with-border": Kn || void 0,
    ref: Qt
  }, Yr), Sn);
});
_Paper.displayName = "@mantine/core/Paper";
const Paper = _Paper, CardContext = reactExports.createContext({ padding: 0 }), CardProvider = CardContext.Provider, useCardPadding = () => reactExports.useContext(CardContext).padding;
var useStyles$1_ = createStyles((_e, { padding: Qt, withBorder: Zt, inheritPadding: $n }) => {
  const Sn = getSize$1({ size: Qt, sizes: _e.spacing }), kn = `calc(-1 * ${Sn})`, Kn = _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[3];
  return {
    cardSection: {
      display: "block",
      marginLeft: kn,
      marginRight: kn,
      paddingLeft: $n ? Sn : void 0,
      paddingRight: $n ? Sn : void 0,
      borderTop: Zt ? `${rem$1(1)} solid ${Kn}` : void 0,
      borderBottom: Zt ? `${rem$1(1)} solid ${Kn}` : void 0,
      "& + &": {
        borderTop: 0
      },
      "&[data-first]": {
        marginTop: kn,
        borderTop: 0,
        borderBottom: Zt ? `${rem$1(1)} solid ${Kn}` : void 0
      },
      "&[data-last]": {
        marginBottom: kn,
        borderBottom: 0
      }
    }
  };
});
const useStyles$1$ = useStyles$1_;
var __defProp$1K = Object.defineProperty, __getOwnPropSymbols$1L = Object.getOwnPropertySymbols, __hasOwnProp$1L = Object.prototype.hasOwnProperty, __propIsEnum$1L = Object.prototype.propertyIsEnumerable, __defNormalProp$1K = (_e, Qt, Zt) => Qt in _e ? __defProp$1K(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1K = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1L.call(Qt, Zt) && __defNormalProp$1K(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1L)
    for (var Zt of __getOwnPropSymbols$1L(Qt))
      __propIsEnum$1L.call(Qt, Zt) && __defNormalProp$1K(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1l = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1L.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1L)
    for (var $n of __getOwnPropSymbols$1L(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1L.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$18 = {
  withBorder: !1,
  inheritPadding: !1
}, _CardSection = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("CardSection", defaultProps$18, _e), { className: $n, withBorder: Sn, inheritPadding: kn, unstyled: Kn, variant: er } = Zt, Cr = __objRest$1l(Zt, ["className", "withBorder", "inheritPadding", "unstyled", "variant"]), { classes: kr, cx: Yr } = useStyles$1$({ padding: useCardPadding(), withBorder: Sn, inheritPadding: kn }, { name: "Card", unstyled: Kn, variant: er });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1K({
    className: Yr(kr.cardSection, $n),
    ref: Qt
  }, Cr));
});
_CardSection.displayName = "@mantine/core/CardSection";
const CardSection = _CardSection;
var useStyles$1Y = createStyles((_e) => ({
  root: {
    position: "relative",
    overflow: "hidden",
    backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.white
  }
}));
const useStyles$1Z = useStyles$1Y;
var __defProp$1J = Object.defineProperty, __getOwnPropSymbols$1K = Object.getOwnPropertySymbols, __hasOwnProp$1K = Object.prototype.hasOwnProperty, __propIsEnum$1K = Object.prototype.propertyIsEnumerable, __defNormalProp$1J = (_e, Qt, Zt) => Qt in _e ? __defProp$1J(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1J = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1K.call(Qt, Zt) && __defNormalProp$1J(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1K)
    for (var Zt of __getOwnPropSymbols$1K(Qt))
      __propIsEnum$1K.call(Qt, Zt) && __defNormalProp$1J(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1k = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1K.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1K)
    for (var $n of __getOwnPropSymbols$1K(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1K.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$17 = {
  padding: "md"
}, _Card = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Card", defaultProps$17, _e), { className: $n, padding: Sn, radius: kn, children: Kn, unstyled: er, variant: Cr } = Zt, kr = __objRest$1k(Zt, ["className", "padding", "radius", "children", "unstyled", "variant"]), { classes: Yr, cx: Ms } = useStyles$1Z(null, { name: "Card", unstyled: er, variant: Cr }), Ds = reactExports.Children.toArray(Kn), Ls = Ds.map((js, zs) => typeof js == "object" && js && "type" in js && js.type === CardSection ? reactExports.cloneElement(js, {
    variant: Cr,
    padding: Sn,
    "data-first": zs === 0 || void 0,
    "data-last": zs === Ds.length - 1 || void 0
  }) : js);
  return /* @__PURE__ */ React.createElement(CardProvider, {
    value: { padding: Sn }
  }, /* @__PURE__ */ React.createElement(Paper, __spreadValues$1J({
    className: Ms(Yr.root, $n),
    radius: kn,
    p: Sn,
    ref: Qt
  }, kr), Ls));
});
_Card.Section = CardSection;
_Card.displayName = "@mantine/core/Card";
const Card = _Card;
var useStyles$1W = createStyles((_e, { inline: Qt }) => ({
  root: {
    display: Qt ? "inline-flex" : "flex",
    alignItems: "center",
    justifyContent: "center"
  }
}));
const useStyles$1X = useStyles$1W;
var __defProp$1I = Object.defineProperty, __getOwnPropSymbols$1J = Object.getOwnPropertySymbols, __hasOwnProp$1J = Object.prototype.hasOwnProperty, __propIsEnum$1J = Object.prototype.propertyIsEnumerable, __defNormalProp$1I = (_e, Qt, Zt) => Qt in _e ? __defProp$1I(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1I = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1J.call(Qt, Zt) && __defNormalProp$1I(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1J)
    for (var Zt of __getOwnPropSymbols$1J(Qt))
      __propIsEnum$1J.call(Qt, Zt) && __defNormalProp$1I(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1j = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1J.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1J)
    for (var $n of __getOwnPropSymbols$1J(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1J.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const _Center = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Center", {}, _e), { inline: $n, className: Sn, unstyled: kn, variant: Kn } = Zt, er = __objRest$1j(Zt, ["inline", "className", "unstyled", "variant"]), { classes: Cr, cx: kr } = useStyles$1X({ inline: $n }, { name: "Center", unstyled: kn, variant: Kn });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1I({
    ref: Qt,
    className: kr(Cr.root, Sn)
  }, er));
});
_Center.displayName = "@mantine/core/Center";
const Center$2 = _Center, CheckboxGroupContext = reactExports.createContext(null), CheckboxGroupProvider = CheckboxGroupContext.Provider, useCheckboxGroupContext = () => reactExports.useContext(CheckboxGroupContext);
var __defProp$1H = Object.defineProperty, __getOwnPropSymbols$1I = Object.getOwnPropertySymbols, __hasOwnProp$1I = Object.prototype.hasOwnProperty, __propIsEnum$1I = Object.prototype.propertyIsEnumerable, __defNormalProp$1H = (_e, Qt, Zt) => Qt in _e ? __defProp$1H(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1H = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1I.call(Qt, Zt) && __defNormalProp$1H(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1I)
    for (var Zt of __getOwnPropSymbols$1I(Qt))
      __propIsEnum$1I.call(Qt, Zt) && __defNormalProp$1H(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1i = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1I.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1I)
    for (var $n of __getOwnPropSymbols$1I(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1I.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$16 = {
  size: "sm"
}, CheckboxGroup = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("CheckboxGroup", defaultProps$16, _e), { children: $n, value: Sn, defaultValue: kn, onChange: Kn, size: er, wrapperProps: Cr } = Zt, kr = __objRest$1i(Zt, ["children", "value", "defaultValue", "onChange", "size", "wrapperProps"]), [Yr, Ms] = useUncontrolled({
    value: Sn,
    defaultValue: kn,
    finalValue: [],
    onChange: Kn
  }), Ds = (Ls) => {
    const js = Ls.currentTarget.value;
    Ms(Yr.includes(js) ? Yr.filter((zs) => zs !== js) : [...Yr, js]);
  };
  return /* @__PURE__ */ React.createElement(CheckboxGroupProvider, {
    value: { value: Yr, onChange: Ds, size: er }
  }, /* @__PURE__ */ React.createElement(Input.Wrapper, __spreadValues$1H(__spreadValues$1H({
    labelElement: "div",
    size: er,
    __staticSelector: "CheckboxGroup",
    ref: Qt
  }, Cr), kr), $n));
});
CheckboxGroup.displayName = "@mantine/core/CheckboxGroup";
var __defProp$1G = Object.defineProperty, __getOwnPropSymbols$1H = Object.getOwnPropertySymbols, __hasOwnProp$1H = Object.prototype.hasOwnProperty, __propIsEnum$1H = Object.prototype.propertyIsEnumerable, __defNormalProp$1G = (_e, Qt, Zt) => Qt in _e ? __defProp$1G(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1G = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1H.call(Qt, Zt) && __defNormalProp$1G(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1H)
    for (var Zt of __getOwnPropSymbols$1H(Qt))
      __propIsEnum$1H.call(Qt, Zt) && __defNormalProp$1G(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1h = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1H.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1H)
    for (var $n of __getOwnPropSymbols$1H(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1H.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function CheckIcon(_e) {
  const Qt = _e, { width: Zt, height: $n, style: Sn } = Qt, kn = __objRest$1h(Qt, ["width", "height", "style"]);
  return /* @__PURE__ */ React.createElement("svg", __spreadValues$1G({
    viewBox: "0 0 10 7",
    fill: "none",
    xmlns: "http://www.w3.org/2000/svg",
    style: __spreadValues$1G({ width: Zt, height: $n }, Sn)
  }, kn), /* @__PURE__ */ React.createElement("path", {
    d: "M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z",
    fill: "currentColor",
    fillRule: "evenodd",
    clipRule: "evenodd"
  }));
}
function CheckboxIcon(_e) {
  var Qt = _e, { indeterminate: Zt } = Qt, $n = __objRest$1h(Qt, ["indeterminate"]);
  return Zt ? /* @__PURE__ */ React.createElement("svg", __spreadValues$1G({
    xmlns: "http://www.w3.org/2000/svg",
    fill: "none",
    viewBox: "0 0 32 6"
  }, $n), /* @__PURE__ */ React.createElement("rect", {
    width: "32",
    height: "6",
    fill: "currentColor",
    rx: "3"
  })) : /* @__PURE__ */ React.createElement(CheckIcon, __spreadValues$1G({}, $n));
}
var __defProp$1F = Object.defineProperty, __defProps$U = Object.defineProperties, __getOwnPropDescs$U = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1G = Object.getOwnPropertySymbols, __hasOwnProp$1G = Object.prototype.hasOwnProperty, __propIsEnum$1G = Object.prototype.propertyIsEnumerable, __defNormalProp$1F = (_e, Qt, Zt) => Qt in _e ? __defProp$1F(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1F = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1G.call(Qt, Zt) && __defNormalProp$1F(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1G)
    for (var Zt of __getOwnPropSymbols$1G(Qt))
      __propIsEnum$1G.call(Qt, Zt) && __defNormalProp$1F(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$U = (_e, Qt) => __defProps$U(_e, __getOwnPropDescs$U(Qt));
const sizes$a = {
  xs: rem$1(16),
  sm: rem$1(20),
  md: rem$1(24),
  lg: rem$1(30),
  xl: rem$1(36)
};
var useStyles$1U = createStyles((_e, {
  radius: Qt,
  color: Zt,
  transitionDuration: $n,
  labelPosition: Sn,
  error: kn,
  indeterminate: Kn
}, { size: er }) => {
  const Cr = getSize$1({ size: er, sizes: sizes$a }), kr = _e.fn.variant({ variant: "filled", color: Zt });
  return {
    icon: __spreadProps$U(__spreadValues$1F({}, _e.fn.cover()), {
      ref: getStylesRef("icon"),
      color: Kn ? "inherit" : _e.white,
      transform: Kn ? "none" : `translateY(${rem$1(5)}) scale(0.5)`,
      opacity: Kn ? 1 : 0,
      transitionProperty: "opacity, transform",
      transitionTimingFunction: "ease",
      transitionDuration: `${$n}ms`,
      pointerEvents: "none",
      width: "60%",
      position: "absolute",
      zIndex: 1,
      margin: "auto",
      "@media (prefers-reduced-motion)": {
        transitionDuration: _e.respectReducedMotion ? "0ms" : void 0
      }
    }),
    inner: {
      position: "relative",
      width: Cr,
      height: Cr,
      order: Sn === "left" ? 2 : 1
    },
    input: __spreadProps$U(__spreadValues$1F({}, _e.fn.focusStyles()), {
      appearance: "none",
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.white,
      border: `${rem$1(1)} solid ${kn ? _e.fn.variant({ variant: "filled", color: "red" }).background : _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[4]}`,
      width: Cr,
      height: Cr,
      borderRadius: _e.fn.radius(Qt),
      padding: 0,
      display: "block",
      margin: 0,
      transition: `border-color ${$n}ms ease, background-color ${$n}ms ease`,
      cursor: _e.cursorType,
      "&:checked": {
        backgroundColor: kr.background,
        borderColor: kr.background,
        [`& + .${getStylesRef("icon")}`]: {
          opacity: 1,
          color: _e.white,
          transform: "translateY(0) scale(1)"
        }
      },
      "&:disabled": {
        backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2],
        borderColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[3],
        cursor: "not-allowed",
        pointerEvents: "none",
        [`& + .${getStylesRef("icon")}`]: {
          color: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[5]
        }
      }
    })
  };
});
const useStyles$1V = useStyles$1U;
var __defProp$1E = Object.defineProperty, __defProps$T = Object.defineProperties, __getOwnPropDescs$T = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1F = Object.getOwnPropertySymbols, __hasOwnProp$1F = Object.prototype.hasOwnProperty, __propIsEnum$1F = Object.prototype.propertyIsEnumerable, __defNormalProp$1E = (_e, Qt, Zt) => Qt in _e ? __defProp$1E(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1E = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1F.call(Qt, Zt) && __defNormalProp$1E(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1F)
    for (var Zt of __getOwnPropSymbols$1F(Qt))
      __propIsEnum$1F.call(Qt, Zt) && __defNormalProp$1E(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$T = (_e, Qt) => __defProps$T(_e, __getOwnPropDescs$T(Qt));
const sizes$9 = {
  xs: rem$1(16),
  sm: rem$1(20),
  md: rem$1(24),
  lg: rem$1(30),
  xl: rem$1(36)
};
var useStyles$1S = createStyles((_e, { labelPosition: Qt }, { size: Zt }) => ({
  root: {},
  body: {
    display: "flex",
    "&:has(input:disabled) label": {
      color: _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[5]
    }
  },
  labelWrapper: __spreadProps$T(__spreadValues$1E({}, _e.fn.fontStyles()), {
    display: "inline-flex",
    flexDirection: "column",
    WebkitTapHighlightColor: "transparent",
    fontSize: Zt in sizes$9 ? getSize$1({ size: Zt, sizes: _e.fontSizes }) : void 0,
    lineHeight: Zt in sizes$9 ? getSize$1({ size: Zt, sizes: sizes$9 }) : void 0,
    color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
    cursor: _e.cursorType,
    order: Qt === "left" ? 1 : 2
  }),
  description: {
    marginTop: `calc(${_e.spacing.xs} / 2)`,
    [Qt === "left" ? "paddingRight" : "paddingLeft"]: _e.spacing.sm
  },
  error: {
    marginTop: `calc(${_e.spacing.xs} / 2)`,
    [Qt === "left" ? "paddingRight" : "paddingLeft"]: _e.spacing.sm
  },
  label: {
    cursor: _e.cursorType,
    [Qt === "left" ? "paddingRight" : "paddingLeft"]: _e.spacing.sm,
    "&:disabled, &[data-disabled]": {
      color: _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[5]
    }
  }
}));
const useStyles$1T = useStyles$1S;
var __defProp$1D = Object.defineProperty, __getOwnPropSymbols$1E = Object.getOwnPropertySymbols, __hasOwnProp$1E = Object.prototype.hasOwnProperty, __propIsEnum$1E = Object.prototype.propertyIsEnumerable, __defNormalProp$1D = (_e, Qt, Zt) => Qt in _e ? __defProp$1D(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1D = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1E.call(Qt, Zt) && __defNormalProp$1D(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1E)
    for (var Zt of __getOwnPropSymbols$1E(Qt))
      __propIsEnum$1E.call(Qt, Zt) && __defNormalProp$1D(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1g = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1E.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1E)
    for (var $n of __getOwnPropSymbols$1E(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1E.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const InlineInput = reactExports.forwardRef((_e, Qt) => {
  var Zt = _e, {
    __staticSelector: $n,
    className: Sn,
    classNames: kn,
    styles: Kn,
    unstyled: er,
    children: Cr,
    label: kr,
    description: Yr,
    id: Ms,
    disabled: Ds,
    error: Ls,
    size: js,
    labelPosition: zs,
    variant: Fs
  } = Zt, Bs = __objRest$1g(Zt, [
    "__staticSelector",
    "className",
    "classNames",
    "styles",
    "unstyled",
    "children",
    "label",
    "description",
    "id",
    "disabled",
    "error",
    "size",
    "labelPosition",
    "variant"
  ]);
  const { classes: Hs, cx: Ws } = useStyles$1T({ labelPosition: zs }, { name: $n, styles: Kn, classNames: kn, unstyled: er, variant: Fs, size: js });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1D({
    className: Ws(Hs.root, Sn),
    ref: Qt
  }, Bs), /* @__PURE__ */ React.createElement("div", {
    className: Ws(Hs.body)
  }, Cr, /* @__PURE__ */ React.createElement("div", {
    className: Hs.labelWrapper
  }, kr != null && /* @__PURE__ */ React.createElement("label", {
    className: Hs.label,
    "data-disabled": Ds || void 0,
    htmlFor: Ms
  }, kr), Yr && /* @__PURE__ */ React.createElement(Input.Description, {
    className: Hs.description
  }, Yr), Ls && Ls !== "boolean" && /* @__PURE__ */ React.createElement(Input.Error, {
    className: Hs.error
  }, Ls))));
});
InlineInput.displayName = "@mantine/core/InlineInput";
var __defProp$1C = Object.defineProperty, __getOwnPropSymbols$1D = Object.getOwnPropertySymbols, __hasOwnProp$1D = Object.prototype.hasOwnProperty, __propIsEnum$1D = Object.prototype.propertyIsEnumerable, __defNormalProp$1C = (_e, Qt, Zt) => Qt in _e ? __defProp$1C(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1C = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1D.call(Qt, Zt) && __defNormalProp$1C(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1D)
    for (var Zt of __getOwnPropSymbols$1D(Qt))
      __propIsEnum$1D.call(Qt, Zt) && __defNormalProp$1C(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1f = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1D.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1D)
    for (var $n of __getOwnPropSymbols$1D(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1D.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$15 = {
  size: "sm",
  transitionDuration: 100,
  icon: CheckboxIcon,
  labelPosition: "right"
}, Checkbox = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Checkbox", defaultProps$15, _e), {
    className: $n,
    style: Sn,
    sx: kn,
    checked: Kn,
    disabled: er,
    color: Cr,
    label: kr,
    indeterminate: Yr,
    id: Ms,
    size: Ds,
    radius: Ls,
    wrapperProps: js,
    children: zs,
    classNames: Fs,
    styles: Bs,
    transitionDuration: Hs,
    icon: Ws,
    unstyled: Ys,
    labelPosition: El,
    description: Mu,
    error: Pl,
    variant: Iu
  } = Zt, Tu = __objRest$1f(Zt, [
    "className",
    "style",
    "sx",
    "checked",
    "disabled",
    "color",
    "label",
    "indeterminate",
    "id",
    "size",
    "radius",
    "wrapperProps",
    "children",
    "classNames",
    "styles",
    "transitionDuration",
    "icon",
    "unstyled",
    "labelPosition",
    "description",
    "error",
    "variant"
  ]), Au = useCheckboxGroupContext(), Nu = useId$1(Ms), { systemStyles: gm, rest: pm } = extractSystemStyles(Tu), { classes: zu } = useStyles$1V({
    radius: Ls,
    color: Cr,
    transitionDuration: Hs,
    labelPosition: El,
    error: !!Pl,
    indeterminate: Yr
  }, { name: "Checkbox", classNames: Fs, styles: Bs, unstyled: Ys, variant: Iu, size: (Au == null ? void 0 : Au.size) || Ds }), Yu = Au ? {
    checked: Au.value.includes(pm.value),
    onChange: Au.onChange
  } : {};
  return /* @__PURE__ */ React.createElement(InlineInput, __spreadValues$1C(__spreadValues$1C({
    className: $n,
    sx: kn,
    style: Sn,
    id: Nu,
    size: (Au == null ? void 0 : Au.size) || Ds,
    labelPosition: El,
    label: kr,
    description: Mu,
    error: Pl,
    disabled: er,
    __staticSelector: "Checkbox",
    classNames: Fs,
    styles: Bs,
    unstyled: Ys,
    "data-checked": Yu.checked || void 0,
    variant: Iu
  }, gm), js), /* @__PURE__ */ React.createElement("div", {
    className: zu.inner
  }, /* @__PURE__ */ React.createElement("input", __spreadValues$1C(__spreadValues$1C({
    id: Nu,
    ref: Qt,
    type: "checkbox",
    className: zu.input,
    checked: Kn,
    disabled: er
  }, pm), Yu)), /* @__PURE__ */ React.createElement(Ws, {
    indeterminate: Yr,
    className: zu.icon
  })));
});
Checkbox.displayName = "@mantine/core/Checkbox";
Checkbox.Group = CheckboxGroup;
var __defProp$1B = Object.defineProperty, __getOwnPropSymbols$1C = Object.getOwnPropertySymbols, __hasOwnProp$1C = Object.prototype.hasOwnProperty, __propIsEnum$1C = Object.prototype.propertyIsEnumerable, __defNormalProp$1B = (_e, Qt, Zt) => Qt in _e ? __defProp$1B(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1B = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1C.call(Qt, Zt) && __defNormalProp$1B(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1C)
    for (var Zt of __getOwnPropSymbols$1C(Qt))
      __propIsEnum$1C.call(Qt, Zt) && __defNormalProp$1B(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1e = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1C.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1C)
    for (var $n of __getOwnPropSymbols$1C(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1C.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$14 = {
  timeout: 1e3
};
function CopyButton(_e) {
  const Qt = useComponentDefaultProps("CopyButton", defaultProps$14, _e), { children: Zt, timeout: $n, value: Sn } = Qt, kn = __objRest$1e(Qt, ["children", "timeout", "value"]), Kn = useClipboard({ timeout: $n }), er = () => Kn.copy(Sn);
  return /* @__PURE__ */ React.createElement(React.Fragment, null, Zt(__spreadValues$1B({ copy: er, copied: Kn.copied }, kn)));
}
CopyButton.displayName = "@mantine/core/CopyButton";
const [ModalBaseProvider, useModalBaseContext] = createSafeContext("ModalBase component was not found in tree");
var useStyles$1Q = createStyles(() => ({
  close: {
    marginLeft: "auto",
    marginRight: 0
  }
}));
const useStyles$1R = useStyles$1Q;
var __defProp$1A = Object.defineProperty, __getOwnPropSymbols$1B = Object.getOwnPropertySymbols, __hasOwnProp$1B = Object.prototype.hasOwnProperty, __propIsEnum$1B = Object.prototype.propertyIsEnumerable, __defNormalProp$1A = (_e, Qt, Zt) => Qt in _e ? __defProp$1A(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1A = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1B.call(Qt, Zt) && __defNormalProp$1A(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1B)
    for (var Zt of __getOwnPropSymbols$1B(Qt))
      __propIsEnum$1B.call(Qt, Zt) && __defNormalProp$1A(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1d = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1B.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1B)
    for (var $n of __getOwnPropSymbols$1B(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1B.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$13 = {
  size: "sm"
}, ModalBaseCloseButton = reactExports.forwardRef((_e, Qt) => {
  const Zt = useModalBaseContext(), $n = useComponentDefaultProps(`${Zt.__staticSelector}CloseButton`, defaultProps$13, _e), { className: Sn } = $n, kn = __objRest$1d($n, ["className"]), { classes: Kn, cx: er } = useStyles$1R(null, Zt.stylesApi);
  return /* @__PURE__ */ React.createElement(CloseButton, __spreadValues$1A({
    className: er(Kn.close, Sn),
    ref: Qt,
    onClick: Zt.onClose
  }, kn));
});
var useStyles$1O = createStyles(() => ({
  overlay: {}
}));
const useStyles$1P = useStyles$1O;
var __defProp$1z = Object.defineProperty, __defProps$S = Object.defineProperties, __getOwnPropDescs$S = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1A = Object.getOwnPropertySymbols, __hasOwnProp$1A = Object.prototype.hasOwnProperty, __propIsEnum$1A = Object.prototype.propertyIsEnumerable, __defNormalProp$1z = (_e, Qt, Zt) => Qt in _e ? __defProp$1z(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1z = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1A.call(Qt, Zt) && __defNormalProp$1z(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1A)
    for (var Zt of __getOwnPropSymbols$1A(Qt))
      __propIsEnum$1A.call(Qt, Zt) && __defNormalProp$1z(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$S = (_e, Qt) => __defProps$S(_e, __getOwnPropDescs$S(Qt)), useStyles$1M = createStyles((_e, { color: Qt, opacity: Zt, blur: $n, radius: Sn, gradient: kn, fixed: Kn, zIndex: er }) => ({
  root: __spreadProps$S(__spreadValues$1z({}, _e.fn.cover(0)), {
    position: Kn ? "fixed" : "absolute",
    backgroundColor: kn ? void 0 : _e.fn.rgba(Qt, Zt),
    backgroundImage: kn,
    backdropFilter: $n ? `blur(${rem$1($n)})` : void 0,
    borderRadius: _e.fn.radius(Sn),
    zIndex: er,
    "&[data-center]": {
      display: "flex",
      alignItems: "center",
      justifyContent: "center"
    }
  })
}));
const useStyles$1N = useStyles$1M;
var __defProp$1y = Object.defineProperty, __getOwnPropSymbols$1z = Object.getOwnPropertySymbols, __hasOwnProp$1z = Object.prototype.hasOwnProperty, __propIsEnum$1z = Object.prototype.propertyIsEnumerable, __defNormalProp$1y = (_e, Qt, Zt) => Qt in _e ? __defProp$1y(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1y = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1z.call(Qt, Zt) && __defNormalProp$1y(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1z)
    for (var Zt of __getOwnPropSymbols$1z(Qt))
      __propIsEnum$1z.call(Qt, Zt) && __defNormalProp$1y(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1c = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1z.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1z)
    for (var $n of __getOwnPropSymbols$1z(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1z.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$12 = {
  opacity: 0.6,
  color: "#000",
  zIndex: getDefaultZIndex("modal"),
  radius: 0
}, _Overlay = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Overlay", defaultProps$12, _e), {
    variant: $n,
    opacity: Sn,
    color: kn,
    blur: Kn,
    gradient: er,
    zIndex: Cr,
    radius: kr,
    children: Yr,
    className: Ms,
    classNames: Ds,
    styles: Ls,
    unstyled: js,
    center: zs,
    fixed: Fs
  } = Zt, Bs = __objRest$1c(Zt, [
    "variant",
    "opacity",
    "color",
    "blur",
    "gradient",
    "zIndex",
    "radius",
    "children",
    "className",
    "classNames",
    "styles",
    "unstyled",
    "center",
    "fixed"
  ]), { classes: Hs, cx: Ws } = useStyles$1N({ color: kn, opacity: Sn, blur: Kn, radius: kr, gradient: er, fixed: Fs, zIndex: Cr }, { name: "Overlay", classNames: Ds, styles: Ls, unstyled: js, variant: $n });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1y({
    ref: Qt,
    className: Ws(Hs.root, Ms),
    "data-center": zs || void 0
  }, Bs), Yr);
});
_Overlay.displayName = "@mantine/core/Overlay";
const Overlay = _Overlay;
var __defProp$1x = Object.defineProperty, __defProps$R = Object.defineProperties, __getOwnPropDescs$R = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1y = Object.getOwnPropertySymbols, __hasOwnProp$1y = Object.prototype.hasOwnProperty, __propIsEnum$1y = Object.prototype.propertyIsEnumerable, __defNormalProp$1x = (_e, Qt, Zt) => Qt in _e ? __defProp$1x(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1x = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1y.call(Qt, Zt) && __defNormalProp$1x(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1y)
    for (var Zt of __getOwnPropSymbols$1y(Qt))
      __propIsEnum$1y.call(Qt, Zt) && __defNormalProp$1x(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$R = (_e, Qt) => __defProps$R(_e, __getOwnPropDescs$R(Qt)), __objRest$1b = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1y.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1y)
    for (var $n of __getOwnPropSymbols$1y(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1y.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$11 = {}, ModalBaseOverlay = reactExports.forwardRef((_e, Qt) => {
  const Zt = useModalBaseContext(), $n = useComponentDefaultProps(`${Zt.__staticSelector}Overlay`, defaultProps$11, _e), { onClick: Sn, transitionProps: kn, style: Kn, className: er } = $n, Cr = __objRest$1b($n, ["onClick", "transitionProps", "style", "className"]), { classes: kr, cx: Yr } = useStyles$1P(null, Zt.stylesApi), Ms = (Ds) => {
    Sn == null || Sn(Ds), Zt.closeOnClickOutside && Zt.onClose();
  };
  return /* @__PURE__ */ React.createElement(Transition$1, __spreadProps$R(__spreadValues$1x(__spreadValues$1x({
    mounted: Zt.opened
  }, Zt.transitionProps), kn), {
    transition: "fade"
  }), (Ds) => /* @__PURE__ */ React.createElement(Overlay, __spreadValues$1x({
    ref: Qt,
    onClick: Ms,
    fixed: !0,
    style: __spreadValues$1x(__spreadValues$1x({}, Kn), Ds),
    className: Yr(kr.overlay, er),
    zIndex: Zt.zIndex
  }, Cr)));
});
var useStyles$1K = createStyles((_e, { zIndex: Qt }) => ({
  inner: {
    position: "fixed",
    width: "100%",
    top: 0,
    bottom: 0,
    maxHeight: "100%",
    zIndex: Qt,
    pointerEvents: "none"
  },
  content: {
    pointerEvents: "all"
  }
}));
const useStyles$1L = useStyles$1K;
var __defProp$1w = Object.defineProperty, __getOwnPropSymbols$1x = Object.getOwnPropertySymbols, __hasOwnProp$1x = Object.prototype.hasOwnProperty, __propIsEnum$1x = Object.prototype.propertyIsEnumerable, __defNormalProp$1w = (_e, Qt, Zt) => Qt in _e ? __defProp$1w(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1w = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1x.call(Qt, Zt) && __defNormalProp$1w(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1x)
    for (var Zt of __getOwnPropSymbols$1x(Qt))
      __propIsEnum$1x.call(Qt, Zt) && __defNormalProp$1w(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$1a = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1x.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1x)
    for (var $n of __getOwnPropSymbols$1x(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1x.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$10 = {}, ModalBaseContent = reactExports.forwardRef((_e, Qt) => {
  const Zt = useModalBaseContext(), $n = useComponentDefaultProps(`${Zt.__staticSelector}Content`, defaultProps$10, _e), { className: Sn, transitionProps: kn, style: Kn, onKeyDown: er } = $n, Cr = __objRest$1a($n, ["className", "transitionProps", "style", "onKeyDown"]), { classes: kr, cx: Yr } = useStyles$1L({ zIndex: Zt.zIndex }, Zt.stylesApi), Ms = (Ds) => {
    var Ls;
    ((Ls = Ds.target) == null ? void 0 : Ls.getAttribute("data-mantine-stop-propagation")) !== "true" && Ds.key === "Escape" && Zt.closeOnEscape && Zt.onClose(), er == null || er(Ds);
  };
  return /* @__PURE__ */ React.createElement(Transition$1, __spreadValues$1w(__spreadValues$1w({
    mounted: Zt.opened,
    transition: "pop"
  }, Zt.transitionProps), kn), (Ds) => /* @__PURE__ */ React.createElement("div", {
    className: Yr(kr.inner)
  }, /* @__PURE__ */ React.createElement(FocusTrap, {
    active: Zt.opened && Zt.trapFocus
  }, /* @__PURE__ */ React.createElement(Paper, __spreadValues$1w({
    component: "section",
    role: "dialog",
    tabIndex: -1,
    "aria-modal": !0,
    "aria-describedby": Zt.bodyMounted ? Zt.getBodyId() : void 0,
    "aria-labelledby": Zt.titleMounted ? Zt.getTitleId() : void 0,
    onKeyDown: Ms,
    ref: Qt,
    className: Yr(kr.content, Sn),
    style: __spreadValues$1w(__spreadValues$1w({}, Kn), Ds),
    shadow: Zt.shadow
  }, Cr), Cr.children))));
});
var useStyles$1I = createStyles((_e, { padding: Qt }) => {
  const Zt = getSize$1({ size: Qt, sizes: _e.spacing });
  return {
    header: {
      display: "flex",
      justifyContent: "space-between",
      alignItems: "center",
      padding: Zt,
      paddingRight: `calc(${Zt} - ${rem$1(5)})`,
      position: "sticky",
      top: 0,
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[7] : _e.white,
      zIndex: 1e3
    }
  };
});
const useStyles$1J = useStyles$1I;
var __defProp$1v = Object.defineProperty, __getOwnPropSymbols$1w = Object.getOwnPropertySymbols, __hasOwnProp$1w = Object.prototype.hasOwnProperty, __propIsEnum$1w = Object.prototype.propertyIsEnumerable, __defNormalProp$1v = (_e, Qt, Zt) => Qt in _e ? __defProp$1v(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1v = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1w.call(Qt, Zt) && __defNormalProp$1v(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1w)
    for (var Zt of __getOwnPropSymbols$1w(Qt))
      __propIsEnum$1w.call(Qt, Zt) && __defNormalProp$1v(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$19 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1w.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1w)
    for (var $n of __getOwnPropSymbols$1w(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1w.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$$ = {}, ModalBaseHeader = reactExports.forwardRef((_e, Qt) => {
  const Zt = useModalBaseContext(), $n = useComponentDefaultProps(`${Zt.__staticSelector}Header`, defaultProps$$, _e), { className: Sn } = $n, kn = __objRest$19($n, ["className"]), { classes: Kn, cx: er } = useStyles$1J({ padding: Zt.padding }, Zt.stylesApi);
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1v({
    ref: Qt,
    className: er(Kn.header, Sn)
  }, kn));
});
var useStyles$1G = createStyles((_e) => ({
  title: {
    lineHeight: 1,
    padding: 0,
    margin: 0,
    fontWeight: 400,
    fontSize: _e.fontSizes.md
  }
}));
const useStyles$1H = useStyles$1G;
var __defProp$1u = Object.defineProperty, __getOwnPropSymbols$1v = Object.getOwnPropertySymbols, __hasOwnProp$1v = Object.prototype.hasOwnProperty, __propIsEnum$1v = Object.prototype.propertyIsEnumerable, __defNormalProp$1u = (_e, Qt, Zt) => Qt in _e ? __defProp$1u(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1u = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1v.call(Qt, Zt) && __defNormalProp$1u(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1v)
    for (var Zt of __getOwnPropSymbols$1v(Qt))
      __propIsEnum$1v.call(Qt, Zt) && __defNormalProp$1u(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$18 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1v.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1v)
    for (var $n of __getOwnPropSymbols$1v(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1v.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$_ = {}, ModalBaseTitle = reactExports.forwardRef((_e, Qt) => {
  const Zt = useModalBaseContext(), $n = useComponentDefaultProps(`${Zt.__staticSelector}Title`, defaultProps$_, _e), { className: Sn } = $n, kn = __objRest$18($n, ["className"]), { classes: Kn, cx: er } = useStyles$1H(null, Zt.stylesApi);
  return reactExports.useEffect(() => (Zt.setTitleMounted(!0), () => Zt.setTitleMounted(!1)), []), /* @__PURE__ */ React.createElement(Box, __spreadValues$1u({
    component: "h2",
    id: Zt.getTitleId(),
    className: er(Kn.title, Sn),
    ref: Qt
  }, kn));
});
var useStyles$1E = createStyles((_e, { padding: Qt }) => ({
  body: {
    padding: getSize$1({ size: Qt, sizes: _e.spacing }),
    "&:not(:only-child)": {
      paddingTop: 0
    }
  }
}));
const useStyles$1F = useStyles$1E;
var __defProp$1t = Object.defineProperty, __getOwnPropSymbols$1u = Object.getOwnPropertySymbols, __hasOwnProp$1u = Object.prototype.hasOwnProperty, __propIsEnum$1u = Object.prototype.propertyIsEnumerable, __defNormalProp$1t = (_e, Qt, Zt) => Qt in _e ? __defProp$1t(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1t = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1u.call(Qt, Zt) && __defNormalProp$1t(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1u)
    for (var Zt of __getOwnPropSymbols$1u(Qt))
      __propIsEnum$1u.call(Qt, Zt) && __defNormalProp$1t(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$17 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1u.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1u)
    for (var $n of __getOwnPropSymbols$1u(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1u.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$Z = {}, ModalBaseBody = reactExports.forwardRef((_e, Qt) => {
  const Zt = useModalBaseContext(), $n = useComponentDefaultProps(`${Zt.__staticSelector}Body`, defaultProps$Z, _e), { className: Sn } = $n, kn = __objRest$17($n, ["className"]), { classes: Kn, cx: er } = useStyles$1F({ padding: Zt.padding }, Zt.stylesApi);
  return reactExports.useEffect(() => (Zt.setBodyMounted(!0), () => Zt.setBodyMounted(!1)), []), /* @__PURE__ */ React.createElement(Box, __spreadValues$1t({
    id: Zt.getBodyId(),
    className: er(Kn.body, Sn),
    ref: Qt
  }, kn));
});
function NativeScrollArea({ children: _e }) {
  return /* @__PURE__ */ React.createElement(React.Fragment, null, _e);
}
function useLockScroll({ opened: _e, transitionDuration: Qt }) {
  const [Zt, $n] = reactExports.useState(_e), Sn = reactExports.useRef(), Kn = useReducedMotion() ? 0 : Qt;
  return reactExports.useEffect(() => (_e ? ($n(!0), window.clearTimeout(Sn.current)) : Kn === 0 ? $n(!1) : Sn.current = window.setTimeout(() => $n(!1), Kn), () => window.clearTimeout(Sn.current)), [_e, Kn]), Zt;
}
var useStyles$1C = createStyles(() => ({
  root: {}
}));
const useStyles$1D = useStyles$1C;
var __defProp$1s = Object.defineProperty, __defProps$Q = Object.defineProperties, __getOwnPropDescs$Q = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1t = Object.getOwnPropertySymbols, __hasOwnProp$1t = Object.prototype.hasOwnProperty, __propIsEnum$1t = Object.prototype.propertyIsEnumerable, __defNormalProp$1s = (_e, Qt, Zt) => Qt in _e ? __defProp$1s(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1s = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1t.call(Qt, Zt) && __defNormalProp$1s(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1t)
    for (var Zt of __getOwnPropSymbols$1t(Qt))
      __propIsEnum$1t.call(Qt, Zt) && __defNormalProp$1s(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$Q = (_e, Qt) => __defProps$Q(_e, __getOwnPropDescs$Q(Qt)), __objRest$16 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1t.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1t)
    for (var $n of __getOwnPropSymbols$1t(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1t.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const ModalBaseDefaultProps = {
  closeOnClickOutside: !0,
  withinPortal: !0,
  lockScroll: !0,
  trapFocus: !0,
  returnFocus: !0,
  closeOnEscape: !0,
  keepMounted: !1,
  zIndex: getDefaultZIndex("modal"),
  padding: "md",
  size: "md",
  shadow: "xl"
};
function ModalBase(_e) {
  const Qt = useComponentDefaultProps("ModalBase", ModalBaseDefaultProps, _e), {
    opened: Zt,
    onClose: $n,
    children: Sn,
    closeOnClickOutside: kn,
    __staticSelector: Kn,
    transitionProps: er,
    withinPortal: Cr,
    portalProps: kr,
    keepMounted: Yr,
    target: Ms,
    zIndex: Ds,
    lockScroll: Ls,
    trapFocus: js,
    closeOnEscape: zs,
    returnFocus: Fs,
    padding: Bs,
    shadow: Hs,
    id: Ws,
    size: Ys,
    variant: El,
    classNames: Mu,
    unstyled: Pl,
    styles: Iu,
    className: Tu
  } = Qt, Au = __objRest$16(Qt, [
    "opened",
    "onClose",
    "children",
    "closeOnClickOutside",
    "__staticSelector",
    "transitionProps",
    "withinPortal",
    "portalProps",
    "keepMounted",
    "target",
    "zIndex",
    "lockScroll",
    "trapFocus",
    "closeOnEscape",
    "returnFocus",
    "padding",
    "shadow",
    "id",
    "size",
    "variant",
    "classNames",
    "unstyled",
    "styles",
    "className"
  ]), { classes: Nu, cx: gm } = useStyles$1D(null, {
    name: Kn,
    classNames: Mu,
    styles: Iu,
    unstyled: Pl,
    variant: El,
    size: Ys
  }), pm = useId$1(Ws), [zu, Yu] = reactExports.useState(!1), [sm, mm] = reactExports.useState(!1), hm = typeof (er == null ? void 0 : er.duration) == "number" ? er == null ? void 0 : er.duration : 200, ym = useLockScroll({ opened: Zt, transitionDuration: hm });
  return useWindowEvent("keydown", (_m) => {
    !js && _m.key === "Escape" && zs && $n();
  }), useFocusReturn({ opened: Zt, shouldReturnFocus: js && Fs }), /* @__PURE__ */ React.createElement(OptionalPortal, __spreadProps$Q(__spreadValues$1s({}, kr), {
    withinPortal: Cr,
    target: Ms
  }), /* @__PURE__ */ React.createElement(ModalBaseProvider, {
    value: {
      __staticSelector: Kn,
      opened: Zt,
      onClose: $n,
      closeOnClickOutside: kn,
      transitionProps: __spreadProps$Q(__spreadValues$1s({}, er), { duration: hm, keepMounted: Yr }),
      zIndex: Ds,
      padding: Bs,
      id: pm,
      getTitleId: () => `${pm}-title`,
      getBodyId: () => `${pm}-body`,
      titleMounted: zu,
      bodyMounted: sm,
      setTitleMounted: Yu,
      setBodyMounted: mm,
      trapFocus: js,
      closeOnEscape: zs,
      shadow: Hs,
      stylesApi: {
        name: Kn,
        size: Ys,
        variant: El,
        classNames: Mu,
        styles: Iu,
        unstyled: Pl
      }
    }
  }, /* @__PURE__ */ React.createElement(RemoveScroll, {
    enabled: ym && Ls
  }, /* @__PURE__ */ React.createElement(Box, __spreadValues$1s({
    className: gm(Nu.root, Tu)
  }, Au), Sn))));
}
ModalBase.CloseButton = ModalBaseCloseButton;
ModalBase.Overlay = ModalBaseOverlay;
ModalBase.Content = ModalBaseContent;
ModalBase.Header = ModalBaseHeader;
ModalBase.Title = ModalBaseTitle;
ModalBase.Body = ModalBaseBody;
ModalBase.NativeScrollArea = NativeScrollArea;
const FLEX_SYSTEM_PROPS = {
  gap: { type: "spacing", property: "gap" },
  rowGap: { type: "spacing", property: "rowGap" },
  columnGap: { type: "spacing", property: "columnGap" },
  align: { type: "identity", property: "alignItems" },
  justify: { type: "identity", property: "justifyContent" },
  wrap: { type: "identity", property: "flexWrap" },
  direction: { type: "identity", property: "flexDirection" }
};
var __defProp$1r = Object.defineProperty, __defProps$P = Object.defineProperties, __getOwnPropDescs$P = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1s = Object.getOwnPropertySymbols, __hasOwnProp$1s = Object.prototype.hasOwnProperty, __propIsEnum$1s = Object.prototype.propertyIsEnumerable, __defNormalProp$1r = (_e, Qt, Zt) => Qt in _e ? __defProp$1r(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1r = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1s.call(Qt, Zt) && __defNormalProp$1r(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1s)
    for (var Zt of __getOwnPropSymbols$1s(Qt))
      __propIsEnum$1s.call(Qt, Zt) && __defNormalProp$1r(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$P = (_e, Qt) => __defProps$P(_e, __getOwnPropDescs$P(Qt)), __objRest$15 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1s.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1s)
    for (var $n of __getOwnPropSymbols$1s(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1s.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$Y = {}, Flex = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Flex", defaultProps$Y, _e), { gap: $n, rowGap: Sn, columnGap: kn, align: Kn, justify: er, wrap: Cr, direction: kr, sx: Yr } = Zt, Ms = __objRest$15(Zt, ["gap", "rowGap", "columnGap", "align", "justify", "wrap", "direction", "sx"]);
  return /* @__PURE__ */ React.createElement(Box, __spreadProps$P(__spreadValues$1r({}, Ms), {
    sx: [
      { display: "flex" },
      (Ds) => getSystemStyles({ gap: $n, rowGap: Sn, columnGap: kn, align: Kn, justify: er, wrap: Cr, direction: kr }, Ds, FLEX_SYSTEM_PROPS),
      ...packSx(Yr)
    ],
    ref: Qt
  }));
});
Flex.displayName = "@mantine/core/Flex";
function filterFalsyChildren(_e) {
  return reactExports.Children.toArray(_e).filter(Boolean);
}
const GROUP_POSITIONS = {
  left: "flex-start",
  center: "center",
  right: "flex-end",
  apart: "space-between"
};
var useStyles$1A = createStyles((_e, { spacing: Qt, position: Zt, noWrap: $n, grow: Sn, align: kn, count: Kn }) => ({
  root: {
    boxSizing: "border-box",
    display: "flex",
    flexDirection: "row",
    alignItems: kn || "center",
    flexWrap: $n ? "nowrap" : "wrap",
    justifyContent: GROUP_POSITIONS[Zt],
    gap: getSize$1({ size: Qt, sizes: _e.spacing }),
    "& > *": {
      boxSizing: "border-box",
      maxWidth: Sn ? `calc(${100 / Kn}% - (${rem$1(getSize$1({ size: Qt, sizes: _e.spacing }))} - ${getSize$1({ size: Qt, sizes: _e.spacing })} / ${Kn}))` : void 0,
      flexGrow: Sn ? 1 : 0
    }
  }
}));
const useStyles$1B = useStyles$1A;
var __defProp$1q = Object.defineProperty, __getOwnPropSymbols$1r = Object.getOwnPropertySymbols, __hasOwnProp$1r = Object.prototype.hasOwnProperty, __propIsEnum$1r = Object.prototype.propertyIsEnumerable, __defNormalProp$1q = (_e, Qt, Zt) => Qt in _e ? __defProp$1q(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1q = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1r.call(Qt, Zt) && __defNormalProp$1q(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1r)
    for (var Zt of __getOwnPropSymbols$1r(Qt))
      __propIsEnum$1r.call(Qt, Zt) && __defNormalProp$1q(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$14 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1r.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1r)
    for (var $n of __getOwnPropSymbols$1r(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1r.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$X = {
  position: "left",
  spacing: "md"
}, Group$1 = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Group", defaultProps$X, _e), {
    className: $n,
    position: Sn,
    align: kn,
    children: Kn,
    noWrap: er,
    grow: Cr,
    spacing: kr,
    unstyled: Yr,
    variant: Ms
  } = Zt, Ds = __objRest$14(Zt, [
    "className",
    "position",
    "align",
    "children",
    "noWrap",
    "grow",
    "spacing",
    "unstyled",
    "variant"
  ]), Ls = filterFalsyChildren(Kn), { classes: js, cx: zs } = useStyles$1B({
    align: kn,
    grow: Cr,
    noWrap: er,
    spacing: kr,
    position: Sn,
    count: Ls.length
  }, { unstyled: Yr, name: "Group", variant: Ms });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1q({
    className: zs(js.root, $n),
    ref: Qt
  }, Ds), Ls);
});
Group$1.displayName = "@mantine/core/Group";
var useStyles$1y = createStyles((_e, { color: Qt }) => ({
  root: {
    backgroundColor: _e.fn.themeColor(Qt, _e.colorScheme === "dark" ? 5 : 2),
    color: _e.colorScheme === "dark" ? _e.colors.dark[9] : "inherit"
  }
}));
const useStyles$1z = useStyles$1y;
var __defProp$1p = Object.defineProperty, __getOwnPropSymbols$1q = Object.getOwnPropertySymbols, __hasOwnProp$1q = Object.prototype.hasOwnProperty, __propIsEnum$1q = Object.prototype.propertyIsEnumerable, __defNormalProp$1p = (_e, Qt, Zt) => Qt in _e ? __defProp$1p(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1p = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1q.call(Qt, Zt) && __defNormalProp$1p(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1q)
    for (var Zt of __getOwnPropSymbols$1q(Qt))
      __propIsEnum$1q.call(Qt, Zt) && __defNormalProp$1p(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$13 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1q.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1q)
    for (var $n of __getOwnPropSymbols$1q(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1q.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$W = {
  color: "yellow"
}, Mark$3 = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Mark", defaultProps$W, _e), { color: $n, className: Sn, unstyled: kn, variant: Kn } = Zt, er = __objRest$13(Zt, ["color", "className", "unstyled", "variant"]), { classes: Cr, cx: kr } = useStyles$1z({ color: $n }, { unstyled: kn, name: "Mark", variant: Kn });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1p({
    component: "mark",
    ref: Qt,
    className: kr(Cr.root, Sn)
  }, er));
});
Mark$3.displayName = "@mantine/core/Mark";
function escapeRegex(_e) {
  return _e.replace(/[-[\]{}()*+?.,\\^$|#]/g, "\\$&");
}
function highlighter(_e, Qt) {
  if (Qt == null)
    return [{ chunk: _e, highlighted: !1 }];
  const Zt = Array.isArray(Qt) ? Qt.map(escapeRegex) : escapeRegex(Qt);
  if (!(Array.isArray(Zt) ? Zt.filter((er) => er.trim().length > 0).length > 0 : Zt.trim() !== ""))
    return [{ chunk: _e, highlighted: !1 }];
  const Sn = typeof Zt == "string" ? Zt.trim() : Zt.filter((er) => er.trim().length !== 0).map((er) => er.trim()).join("|"), kn = new RegExp(`(${Sn})`, "gi");
  return _e.split(kn).map((er) => ({ chunk: er, highlighted: kn.test(er) })).filter(({ chunk: er }) => er);
}
var __defProp$1o = Object.defineProperty, __getOwnPropSymbols$1p = Object.getOwnPropertySymbols, __hasOwnProp$1p = Object.prototype.hasOwnProperty, __propIsEnum$1p = Object.prototype.propertyIsEnumerable, __defNormalProp$1o = (_e, Qt, Zt) => Qt in _e ? __defProp$1o(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1o = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1p.call(Qt, Zt) && __defNormalProp$1o(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1p)
    for (var Zt of __getOwnPropSymbols$1p(Qt))
      __propIsEnum$1p.call(Qt, Zt) && __defNormalProp$1o(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$12 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1p.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1p)
    for (var $n of __getOwnPropSymbols$1p(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1p.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$V = {
  highlightColor: "yellow"
}, _Highlight = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Highlight", defaultProps$V, _e), { children: $n, highlight: Sn, highlightColor: kn, highlightStyles: Kn, unstyled: er } = Zt, Cr = __objRest$12(Zt, ["children", "highlight", "highlightColor", "highlightStyles", "unstyled"]), kr = highlighter($n, Sn);
  return /* @__PURE__ */ React.createElement(Text, __spreadValues$1o({
    unstyled: er,
    ref: Qt,
    __staticSelector: "Highlight"
  }, Cr), kr.map(({ chunk: Yr, highlighted: Ms }, Ds) => Ms ? /* @__PURE__ */ React.createElement(Mark$3, {
    unstyled: er,
    key: Ds,
    color: kn,
    sx: Kn,
    "data-highlight": Yr
  }, Yr) : /* @__PURE__ */ React.createElement("span", {
    key: Ds
  }, Yr)));
});
_Highlight.displayName = "@mantine/core/Highlight";
const Highlight = _Highlight, HOVER_CARD_ERRORS = {
  context: "HoverCard component was not found in the tree",
  children: "HoverCard.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
}, [HoverCardContextProvider, useHoverCardContext] = createSafeContext(HOVER_CARD_ERRORS.context);
var __defProp$1n = Object.defineProperty, __getOwnPropSymbols$1o = Object.getOwnPropertySymbols, __hasOwnProp$1o = Object.prototype.hasOwnProperty, __propIsEnum$1o = Object.prototype.propertyIsEnumerable, __defNormalProp$1n = (_e, Qt, Zt) => Qt in _e ? __defProp$1n(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1n = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1o.call(Qt, Zt) && __defNormalProp$1n(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1o)
    for (var Zt of __getOwnPropSymbols$1o(Qt))
      __propIsEnum$1o.call(Qt, Zt) && __defNormalProp$1n(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$11 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1o.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1o)
    for (var $n of __getOwnPropSymbols$1o(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1o.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$U = {};
function HoverCardDropdown(_e) {
  const Qt = useComponentDefaultProps("HoverCardDropdown", defaultProps$U, _e), { children: Zt, onMouseEnter: $n, onMouseLeave: Sn } = Qt, kn = __objRest$11(Qt, ["children", "onMouseEnter", "onMouseLeave"]), Kn = useHoverCardContext(), er = createEventHandler($n, Kn.openDropdown), Cr = createEventHandler(Sn, Kn.closeDropdown);
  return /* @__PURE__ */ React.createElement(Popover.Dropdown, __spreadValues$1n({
    onMouseEnter: er,
    onMouseLeave: Cr
  }, kn), Zt);
}
HoverCardDropdown.displayName = "@mantine/core/HoverCardDropdown";
var __defProp$1m = Object.defineProperty, __getOwnPropSymbols$1n = Object.getOwnPropertySymbols, __hasOwnProp$1n = Object.prototype.hasOwnProperty, __propIsEnum$1n = Object.prototype.propertyIsEnumerable, __defNormalProp$1m = (_e, Qt, Zt) => Qt in _e ? __defProp$1m(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1m = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1n.call(Qt, Zt) && __defNormalProp$1m(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1n)
    for (var Zt of __getOwnPropSymbols$1n(Qt))
      __propIsEnum$1n.call(Qt, Zt) && __defNormalProp$1m(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$10 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1n.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1n)
    for (var $n of __getOwnPropSymbols$1n(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1n.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$T = {
  refProp: "ref"
}, HoverCardTarget = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("HoverCardTarget", defaultProps$T, _e), { children: $n, refProp: Sn } = Zt, kn = __objRest$10(Zt, ["children", "refProp"]);
  if (!isElement$3($n))
    throw new Error(HOVER_CARD_ERRORS.children);
  const Kn = useHoverCardContext(), er = createEventHandler($n.props.onMouseEnter, Kn.openDropdown), Cr = createEventHandler($n.props.onMouseLeave, Kn.closeDropdown);
  return /* @__PURE__ */ React.createElement(Popover.Target, __spreadValues$1m({
    refProp: Sn,
    ref: Qt
  }, kn), reactExports.cloneElement($n, { onMouseEnter: er, onMouseLeave: Cr }));
});
HoverCardTarget.displayName = "@mantine/core/HoverCardTarget";
function useDelayedHover({ open: _e, close: Qt, openDelay: Zt, closeDelay: $n }) {
  const Sn = reactExports.useRef(-1), kn = reactExports.useRef(-1), Kn = () => {
    window.clearTimeout(Sn.current), window.clearTimeout(kn.current);
  }, er = () => {
    Kn(), Zt === 0 ? _e() : Sn.current = window.setTimeout(_e, Zt);
  }, Cr = () => {
    Kn(), $n === 0 ? Qt() : kn.current = window.setTimeout(Qt, $n);
  };
  return reactExports.useEffect(() => Kn, []), { openDropdown: er, closeDropdown: Cr };
}
var __defProp$1l = Object.defineProperty, __getOwnPropSymbols$1m = Object.getOwnPropertySymbols, __hasOwnProp$1m = Object.prototype.hasOwnProperty, __propIsEnum$1m = Object.prototype.propertyIsEnumerable, __defNormalProp$1l = (_e, Qt, Zt) => Qt in _e ? __defProp$1l(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1l = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1m.call(Qt, Zt) && __defNormalProp$1l(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1m)
    for (var Zt of __getOwnPropSymbols$1m(Qt))
      __propIsEnum$1m.call(Qt, Zt) && __defNormalProp$1l(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$$ = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1m.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1m)
    for (var $n of __getOwnPropSymbols$1m(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1m.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$S = {
  openDelay: 0,
  closeDelay: 150,
  initiallyOpened: !1
};
function HoverCard(_e) {
  const Qt = useComponentDefaultProps("HoverCard", defaultProps$S, _e), { children: Zt, onOpen: $n, onClose: Sn, openDelay: kn, closeDelay: Kn, initiallyOpened: er } = Qt, Cr = __objRest$$(Qt, ["children", "onOpen", "onClose", "openDelay", "closeDelay", "initiallyOpened"]), [kr, { open: Yr, close: Ms }] = useDisclosure(er, { onClose: Sn, onOpen: $n }), { openDropdown: Ds, closeDropdown: Ls } = useDelayedHover({ open: Yr, close: Ms, openDelay: kn, closeDelay: Kn });
  return /* @__PURE__ */ React.createElement(HoverCardContextProvider, {
    value: { openDropdown: Ds, closeDropdown: Ls }
  }, /* @__PURE__ */ React.createElement(Popover, __spreadValues$1l({
    opened: kr,
    __staticSelector: "HoverCard"
  }, Cr), Zt));
}
HoverCard.displayName = "@mantine/core/HoverCard";
HoverCard.Target = HoverCardTarget;
HoverCard.Dropdown = HoverCardDropdown;
var __defProp$1k = Object.defineProperty, __defProps$O = Object.defineProperties, __getOwnPropDescs$O = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1l = Object.getOwnPropertySymbols, __hasOwnProp$1l = Object.prototype.hasOwnProperty, __propIsEnum$1l = Object.prototype.propertyIsEnumerable, __defNormalProp$1k = (_e, Qt, Zt) => Qt in _e ? __defProp$1k(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1k = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1l.call(Qt, Zt) && __defNormalProp$1k(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1l)
    for (var Zt of __getOwnPropSymbols$1l(Qt))
      __propIsEnum$1l.call(Qt, Zt) && __defNormalProp$1k(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$O = (_e, Qt) => __defProps$O(_e, __getOwnPropDescs$O(Qt));
const processingAnimation = (_e) => keyframes({
  from: {
    boxShadow: `0 0 ${rem$1(0.5)} 0 ${_e}`,
    opacity: 0.6
  },
  to: {
    boxShadow: `0 0 ${rem$1(0.5)} ${rem$1(4.4)} ${_e}`,
    opacity: 0
  }
});
function getPositionStyles(_e, Qt = 0) {
  const Zt = {}, [$n, Sn] = _e.split("-");
  let kn = "", Kn = "";
  return $n === "top" && (Zt.top = Qt, Kn = "-50%"), $n === "middle" && (Zt.top = "50%", Kn = "-50%"), $n === "bottom" && (Zt.bottom = Qt, Kn = "50%"), Sn === "start" && (Zt.left = Qt, kn = "-50%"), Sn === "center" && (Zt.left = "50%", kn = "-50%"), Sn === "end" && (Zt.right = Qt, kn = "50%"), Zt.transform = `translate(${kn}, ${Kn})`, Zt;
}
var useStyles$1w = createStyles((_e, {
  radius: Qt,
  color: Zt,
  position: $n,
  offset: Sn,
  inline: kn,
  withBorder: Kn,
  withLabel: er,
  zIndex: Cr
}, { size: kr }) => {
  const { background: Yr } = _e.fn.variant({
    variant: "filled",
    primaryFallback: !1,
    color: Zt || _e.primaryColor
  }), Ms = rem$1(kr);
  return {
    root: {
      position: "relative",
      display: kn ? "inline-block" : "block"
    },
    indicator: __spreadProps$O(__spreadValues$1k({}, getPositionStyles($n, Sn)), {
      zIndex: Cr,
      position: "absolute",
      [er ? "minWidth" : "width"]: Ms,
      height: Ms,
      display: "flex",
      justifyContent: "center",
      alignItems: "center",
      fontSize: _e.fontSizes.xs,
      paddingLeft: er ? `calc(${_e.spacing.xs} / 2)` : 0,
      paddingRight: er ? `calc(${_e.spacing.xs} / 2)` : 0,
      borderRadius: _e.fn.radius(Qt),
      backgroundColor: _e.fn.variant({
        variant: "filled",
        primaryFallback: !1,
        color: Zt || _e.primaryColor
      }).background,
      border: Kn ? `${rem$1(2)} solid ${_e.colorScheme === "dark" ? _e.colors.dark[7] : _e.white}` : void 0,
      color: _e.white,
      whiteSpace: "nowrap"
    }),
    processing: {
      animation: `${processingAnimation(Yr)} 1000ms linear infinite`
    },
    common: __spreadProps$O(__spreadValues$1k({}, getPositionStyles($n, Sn)), {
      position: "absolute",
      [er ? "minWidth" : "width"]: Ms,
      height: Ms,
      borderRadius: _e.fn.radius(Qt)
    })
  };
});
const useStyles$1x = useStyles$1w;
var __defProp$1j = Object.defineProperty, __getOwnPropSymbols$1k = Object.getOwnPropertySymbols, __hasOwnProp$1k = Object.prototype.hasOwnProperty, __propIsEnum$1k = Object.prototype.propertyIsEnumerable, __defNormalProp$1j = (_e, Qt, Zt) => Qt in _e ? __defProp$1j(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1j = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1k.call(Qt, Zt) && __defNormalProp$1j(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1k)
    for (var Zt of __getOwnPropSymbols$1k(Qt))
      __propIsEnum$1k.call(Qt, Zt) && __defNormalProp$1j(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$_ = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1k.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1k)
    for (var $n of __getOwnPropSymbols$1k(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1k.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$R = {
  position: "top-end",
  offset: 0,
  inline: !1,
  withBorder: !1,
  disabled: !1,
  processing: !1,
  size: 10,
  radius: 1e3,
  zIndex: getDefaultZIndex("app")
}, Indicator = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Indicator", defaultProps$R, _e), {
    children: $n,
    position: Sn,
    offset: kn,
    size: Kn,
    radius: er,
    inline: Cr,
    withBorder: kr,
    className: Yr,
    color: Ms,
    styles: Ds,
    label: Ls,
    classNames: js,
    disabled: zs,
    zIndex: Fs,
    unstyled: Bs,
    processing: Hs,
    variant: Ws
  } = Zt, Ys = __objRest$_(Zt, [
    "children",
    "position",
    "offset",
    "size",
    "radius",
    "inline",
    "withBorder",
    "className",
    "color",
    "styles",
    "label",
    "classNames",
    "disabled",
    "zIndex",
    "unstyled",
    "processing",
    "variant"
  ]), { classes: El, cx: Mu } = useStyles$1x({ position: Sn, offset: kn, radius: er, inline: Cr, color: Ms, withBorder: kr, zIndex: Fs, withLabel: !!Ls }, { name: "Indicator", classNames: js, styles: Ds, unstyled: Bs, variant: Ws, size: Kn });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1j({
    ref: Qt,
    className: Mu(El.root, Yr)
  }, Ys), !zs && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
    className: Mu(El.indicator, El.common)
  }, Ls), Hs && /* @__PURE__ */ React.createElement("div", {
    className: Mu(El.processing, El.common)
  })), $n);
});
Indicator.displayName = "@mantine/core/Indicator";
function _objectWithoutPropertiesLoose$2(_e, Qt) {
  if (_e == null)
    return {};
  var Zt = {}, $n = Object.keys(_e), Sn, kn;
  for (kn = 0; kn < $n.length; kn++)
    Sn = $n[kn], !(Qt.indexOf(Sn) >= 0) && (Zt[Sn] = _e[Sn]);
  return Zt;
}
var index$3 = reactExports.useLayoutEffect, useLatest = function _e(Qt) {
  var Zt = reactExports.useRef(Qt);
  return index$3(function() {
    Zt.current = Qt;
  }), Zt;
}, updateRef = function _e(Qt, Zt) {
  if (typeof Qt == "function") {
    Qt(Zt);
    return;
  }
  Qt.current = Zt;
}, useComposedRef = function _e(Qt, Zt) {
  var $n = reactExports.useRef();
  return reactExports.useCallback(function(Sn) {
    Qt.current = Sn, $n.current && updateRef($n.current, null), $n.current = Zt, Zt && updateRef(Zt, Sn);
  }, [Zt]);
}, HIDDEN_TEXTAREA_STYLE = {
  "min-height": "0",
  "max-height": "none",
  height: "0",
  visibility: "hidden",
  overflow: "hidden",
  position: "absolute",
  "z-index": "-1000",
  top: "0",
  right: "0"
}, forceHiddenStyles = function _e(Qt) {
  Object.keys(HIDDEN_TEXTAREA_STYLE).forEach(function(Zt) {
    Qt.style.setProperty(Zt, HIDDEN_TEXTAREA_STYLE[Zt], "important");
  });
}, hiddenTextarea = null, getHeight = function _e(Qt, Zt) {
  var $n = Qt.scrollHeight;
  return Zt.sizingStyle.boxSizing === "border-box" ? $n + Zt.borderSize : $n - Zt.paddingSize;
};
function calculateNodeHeight(_e, Qt, Zt, $n) {
  Zt === void 0 && (Zt = 1), $n === void 0 && ($n = 1 / 0), hiddenTextarea || (hiddenTextarea = document.createElement("textarea"), hiddenTextarea.setAttribute("tabindex", "-1"), hiddenTextarea.setAttribute("aria-hidden", "true"), forceHiddenStyles(hiddenTextarea)), hiddenTextarea.parentNode === null && document.body.appendChild(hiddenTextarea);
  var Sn = _e.paddingSize, kn = _e.borderSize, Kn = _e.sizingStyle, er = Kn.boxSizing;
  Object.keys(Kn).forEach(function(Ds) {
    var Ls = Ds;
    hiddenTextarea.style[Ls] = Kn[Ls];
  }), forceHiddenStyles(hiddenTextarea), hiddenTextarea.value = Qt;
  var Cr = getHeight(hiddenTextarea, _e);
  hiddenTextarea.value = "x";
  var kr = hiddenTextarea.scrollHeight - Sn, Yr = kr * Zt;
  er === "border-box" && (Yr = Yr + Sn + kn), Cr = Math.max(Yr, Cr);
  var Ms = kr * $n;
  return er === "border-box" && (Ms = Ms + Sn + kn), Cr = Math.min(Ms, Cr), [Cr, kr];
}
var noop$8 = function _e() {
}, pick$3 = function _e(Qt, Zt) {
  return Qt.reduce(function($n, Sn) {
    return $n[Sn] = Zt[Sn], $n;
  }, {});
}, SIZING_STYLE = [
  "borderBottomWidth",
  "borderLeftWidth",
  "borderRightWidth",
  "borderTopWidth",
  "boxSizing",
  "fontFamily",
  "fontSize",
  "fontStyle",
  "fontWeight",
  "letterSpacing",
  "lineHeight",
  "paddingBottom",
  "paddingLeft",
  "paddingRight",
  "paddingTop",
  // non-standard
  "tabSize",
  "textIndent",
  // non-standard
  "textRendering",
  "textTransform",
  "width",
  "wordBreak"
], isIE = !!document.documentElement.currentStyle, getSizingData = function _e(Qt) {
  var Zt = window.getComputedStyle(Qt);
  if (Zt === null)
    return null;
  var $n = pick$3(SIZING_STYLE, Zt), Sn = $n.boxSizing;
  if (Sn === "")
    return null;
  isIE && Sn === "border-box" && ($n.width = parseFloat($n.width) + parseFloat($n.borderRightWidth) + parseFloat($n.borderLeftWidth) + parseFloat($n.paddingRight) + parseFloat($n.paddingLeft) + "px");
  var kn = parseFloat($n.paddingBottom) + parseFloat($n.paddingTop), Kn = parseFloat($n.borderBottomWidth) + parseFloat($n.borderTopWidth);
  return {
    sizingStyle: $n,
    paddingSize: kn,
    borderSize: Kn
  };
}, useWindowResizeListener = function _e(Qt) {
  var Zt = useLatest(Qt);
  reactExports.useLayoutEffect(function() {
    var $n = function(kn) {
      Zt.current(kn);
    };
    return window.addEventListener("resize", $n), function() {
      window.removeEventListener("resize", $n);
    };
  }, []);
}, TextareaAutosize = function _e(Qt, Zt) {
  var $n = Qt.cacheMeasurements, Sn = Qt.maxRows, kn = Qt.minRows, Kn = Qt.onChange, er = Kn === void 0 ? noop$8 : Kn, Cr = Qt.onHeightChange, kr = Cr === void 0 ? noop$8 : Cr, Yr = _objectWithoutPropertiesLoose$2(Qt, ["cacheMeasurements", "maxRows", "minRows", "onChange", "onHeightChange"]), Ms = Yr.value !== void 0, Ds = reactExports.useRef(null), Ls = useComposedRef(Ds, Zt), js = reactExports.useRef(0), zs = reactExports.useRef(), Fs = function() {
    var Ws = Ds.current, Ys = $n && zs.current ? zs.current : getSizingData(Ws);
    if (Ys) {
      zs.current = Ys;
      var El = calculateNodeHeight(Ys, Ws.value || Ws.placeholder || "x", kn, Sn), Mu = El[0], Pl = El[1];
      js.current !== Mu && (js.current = Mu, Ws.style.setProperty("height", Mu + "px", "important"), kr(Mu, {
        rowHeight: Pl
      }));
    }
  }, Bs = function(Ws) {
    Ms || Fs(), er(Ws);
  };
  return reactExports.useLayoutEffect(Fs), useWindowResizeListener(Fs), /* @__PURE__ */ reactExports.createElement("textarea", _extends$6({}, Yr, {
    onChange: Bs,
    ref: Ls
  }));
}, index$2 = /* @__PURE__ */ reactExports.forwardRef(TextareaAutosize);
const TextareaAutosize$1 = index$2;
var useStyles$1u = createStyles((_e) => ({
  input: {
    paddingTop: _e.spacing.xs,
    paddingBottom: _e.spacing.xs
  }
}));
const useStyles$1v = useStyles$1u;
var __defProp$1i = Object.defineProperty, __defProps$N = Object.defineProperties, __getOwnPropDescs$N = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1j = Object.getOwnPropertySymbols, __hasOwnProp$1j = Object.prototype.hasOwnProperty, __propIsEnum$1j = Object.prototype.propertyIsEnumerable, __defNormalProp$1i = (_e, Qt, Zt) => Qt in _e ? __defProp$1i(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1i = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1j.call(Qt, Zt) && __defNormalProp$1i(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1j)
    for (var Zt of __getOwnPropSymbols$1j(Qt))
      __propIsEnum$1j.call(Qt, Zt) && __defNormalProp$1i(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$N = (_e, Qt) => __defProps$N(_e, __getOwnPropDescs$N(Qt)), __objRest$Z = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1j.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1j)
    for (var $n of __getOwnPropSymbols$1j(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1j.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$Q = {
  autosize: !1,
  size: "sm",
  __staticSelector: "Textarea"
}, Textarea = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Textarea", defaultProps$Q, _e), {
    autosize: $n,
    maxRows: Sn,
    minRows: kn,
    label: Kn,
    error: er,
    description: Cr,
    id: kr,
    className: Yr,
    required: Ms,
    style: Ds,
    wrapperProps: Ls,
    classNames: js,
    styles: zs,
    size: Fs,
    __staticSelector: Bs,
    sx: Hs,
    errorProps: Ws,
    descriptionProps: Ys,
    labelProps: El,
    inputWrapperOrder: Mu,
    inputContainer: Pl,
    unstyled: Iu,
    withAsterisk: Tu,
    variant: Au
  } = Zt, Nu = __objRest$Z(Zt, [
    "autosize",
    "maxRows",
    "minRows",
    "label",
    "error",
    "description",
    "id",
    "className",
    "required",
    "style",
    "wrapperProps",
    "classNames",
    "styles",
    "size",
    "__staticSelector",
    "sx",
    "errorProps",
    "descriptionProps",
    "labelProps",
    "inputWrapperOrder",
    "inputContainer",
    "unstyled",
    "withAsterisk",
    "variant"
  ]), gm = useId$1(kr), { classes: pm, cx: zu } = useStyles$1v(), { systemStyles: Yu, rest: sm } = extractSystemStyles(Nu), mm = __spreadValues$1i({
    required: Ms,
    ref: Qt,
    error: er,
    id: gm,
    classNames: __spreadProps$N(__spreadValues$1i({}, js), { input: zu(pm.input, js == null ? void 0 : js.input) }),
    styles: zs,
    __staticSelector: Bs,
    size: Fs,
    multiline: !0,
    unstyled: Iu,
    variant: Au
  }, sm);
  return /* @__PURE__ */ React.createElement(Input.Wrapper, __spreadValues$1i(__spreadValues$1i({
    label: Kn,
    error: er,
    id: gm,
    description: Cr,
    required: Ms,
    style: Ds,
    className: Yr,
    classNames: js,
    styles: zs,
    size: Fs,
    __staticSelector: Bs,
    sx: Hs,
    errorProps: Ws,
    labelProps: El,
    descriptionProps: Ys,
    inputContainer: Pl,
    inputWrapperOrder: Mu,
    unstyled: Iu,
    withAsterisk: Tu,
    variant: Au
  }, Yu), Ls), $n ? /* @__PURE__ */ React.createElement(Input, __spreadProps$N(__spreadValues$1i({}, mm), {
    component: TextareaAutosize$1,
    maxRows: Sn,
    minRows: kn
  })) : /* @__PURE__ */ React.createElement(Input, __spreadProps$N(__spreadValues$1i({}, mm), {
    component: "textarea",
    rows: kn
  })));
});
Textarea.displayName = "@mantine/core/Textarea";
const [ListProvider, useListContext] = createSafeContext("List component was not found in tree");
var useStyles$1s = createStyles((_e, { spacing: Qt, center: Zt }) => ({
  itemWrapper: {
    ref: getStylesRef("itemWrapper"),
    display: "inline-flex",
    flexDirection: "column",
    whiteSpace: "normal"
  },
  item: {
    whiteSpace: "nowrap",
    lineHeight: Zt ? 1 : _e.lineHeight,
    "&:not(:first-of-type)": {
      marginTop: getSize$1({ size: Qt, sizes: _e.spacing })
    },
    "&[data-with-icon]": {
      listStyle: "none",
      [`& .${getStylesRef("itemWrapper")}`]: {
        display: "inline-flex",
        alignItems: Zt ? "center" : "flex-start",
        flexDirection: "row"
      }
    }
  },
  itemIcon: {
    display: "inline-block",
    verticalAlign: "middle",
    marginRight: _e.spacing.sm
  }
}));
const useStyles$1t = useStyles$1s;
var __defProp$1h = Object.defineProperty, __getOwnPropSymbols$1i = Object.getOwnPropertySymbols, __hasOwnProp$1i = Object.prototype.hasOwnProperty, __propIsEnum$1i = Object.prototype.propertyIsEnumerable, __defNormalProp$1h = (_e, Qt, Zt) => Qt in _e ? __defProp$1h(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1h = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1i.call(Qt, Zt) && __defNormalProp$1h(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1i)
    for (var Zt of __getOwnPropSymbols$1i(Qt))
      __propIsEnum$1i.call(Qt, Zt) && __defNormalProp$1h(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$Y = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1i.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1i)
    for (var $n of __getOwnPropSymbols$1i(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1i.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$P = {}, ListItem = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("ListItem", defaultProps$P, _e), { className: $n, children: Sn, icon: kn } = Zt, Kn = __objRest$Y(Zt, ["className", "children", "icon"]), {
    icon: er,
    spacing: Cr,
    center: kr,
    listStyleType: Yr,
    size: Ms,
    withPadding: Ds,
    classNames: Ls,
    styles: js,
    unstyled: zs,
    variant: Fs
  } = useListContext(), Bs = kn || er, { classes: Hs, cx: Ws } = useStyles$1t({ withPadding: Ds, listStyleType: Yr, center: kr, spacing: Cr }, { classNames: Ls, styles: js, unstyled: zs, name: "List", variant: Fs, size: Ms });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1h({
    component: "li",
    className: Ws(Hs.item, $n),
    "data-with-icon": !!Bs || void 0,
    ref: Qt
  }, Kn), /* @__PURE__ */ React.createElement("div", {
    className: Hs.itemWrapper
  }, Bs && /* @__PURE__ */ React.createElement("span", {
    className: Hs.itemIcon
  }, Bs), /* @__PURE__ */ React.createElement("span", null, Sn)));
});
ListItem.displayName = "@mantine/core/ListItem";
var __defProp$1g = Object.defineProperty, __defProps$M = Object.defineProperties, __getOwnPropDescs$M = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1h = Object.getOwnPropertySymbols, __hasOwnProp$1h = Object.prototype.hasOwnProperty, __propIsEnum$1h = Object.prototype.propertyIsEnumerable, __defNormalProp$1g = (_e, Qt, Zt) => Qt in _e ? __defProp$1g(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1g = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1h.call(Qt, Zt) && __defNormalProp$1g(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1h)
    for (var Zt of __getOwnPropSymbols$1h(Qt))
      __propIsEnum$1h.call(Qt, Zt) && __defNormalProp$1g(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$M = (_e, Qt) => __defProps$M(_e, __getOwnPropDescs$M(Qt)), useStyles$1q = createStyles((_e, { withPadding: Qt, listStyleType: Zt }, { size: $n }) => ({
  root: __spreadProps$M(__spreadValues$1g({}, _e.fn.fontStyles()), {
    listStyleType: Zt,
    color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
    fontSize: getSize$1({ size: $n, sizes: _e.fontSizes }),
    lineHeight: _e.lineHeight,
    margin: 0,
    paddingLeft: Qt ? _e.spacing.xl : 0,
    listStylePosition: "inside"
  })
}));
const useStyles$1r = useStyles$1q;
var __defProp$1f = Object.defineProperty, __getOwnPropSymbols$1g = Object.getOwnPropertySymbols, __hasOwnProp$1g = Object.prototype.hasOwnProperty, __propIsEnum$1g = Object.prototype.propertyIsEnumerable, __defNormalProp$1f = (_e, Qt, Zt) => Qt in _e ? __defProp$1f(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1f = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1g.call(Qt, Zt) && __defNormalProp$1f(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1g)
    for (var Zt of __getOwnPropSymbols$1g(Qt))
      __propIsEnum$1g.call(Qt, Zt) && __defNormalProp$1f(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$X = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1g.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1g)
    for (var $n of __getOwnPropSymbols$1g(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1g.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$O = {
  type: "unordered",
  size: "md",
  spacing: 0
}, List = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("List", defaultProps$O, _e), {
    children: $n,
    type: Sn,
    size: kn,
    listStyleType: Kn,
    withPadding: er,
    center: Cr,
    spacing: kr,
    icon: Yr,
    className: Ms,
    styles: Ds,
    classNames: Ls,
    unstyled: js,
    variant: zs
  } = Zt, Fs = __objRest$X(Zt, [
    "children",
    "type",
    "size",
    "listStyleType",
    "withPadding",
    "center",
    "spacing",
    "icon",
    "className",
    "styles",
    "classNames",
    "unstyled",
    "variant"
  ]), { classes: Bs, cx: Hs } = useStyles$1r({ withPadding: er, listStyleType: Kn, center: Cr, spacing: kr }, { classNames: Ls, styles: Ds, name: "List", unstyled: js, size: kn, variant: zs });
  return /* @__PURE__ */ React.createElement(ListProvider, {
    value: {
      spacing: kr,
      center: Cr,
      icon: Yr,
      listStyleType: Kn,
      size: kn,
      withPadding: er,
      classNames: Ls,
      styles: Ds,
      unstyled: js,
      variant: zs
    }
  }, /* @__PURE__ */ React.createElement(Box, __spreadValues$1f({
    component: Sn === "unordered" ? "ul" : "ol",
    className: Hs(Bs.root, Ms),
    ref: Qt
  }, Fs), $n));
});
List.Item = ListItem;
List.displayName = "@mantine/core/List";
var __defProp$1e = Object.defineProperty, __defProps$L = Object.defineProperties, __getOwnPropDescs$L = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1f = Object.getOwnPropertySymbols, __hasOwnProp$1f = Object.prototype.hasOwnProperty, __propIsEnum$1f = Object.prototype.propertyIsEnumerable, __defNormalProp$1e = (_e, Qt, Zt) => Qt in _e ? __defProp$1e(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1e = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1f.call(Qt, Zt) && __defNormalProp$1e(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1f)
    for (var Zt of __getOwnPropSymbols$1f(Qt))
      __propIsEnum$1f.call(Qt, Zt) && __defNormalProp$1e(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$L = (_e, Qt) => __defProps$L(_e, __getOwnPropDescs$L(Qt)), useStyles$1o = createStyles((_e) => ({
  root: __spreadProps$L(__spreadValues$1e({}, _e.fn.cover()), {
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    overflow: "hidden"
  })
}));
const useStyles$1p = useStyles$1o;
var __defProp$1d = Object.defineProperty, __defProps$K = Object.defineProperties, __getOwnPropDescs$K = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1e = Object.getOwnPropertySymbols, __hasOwnProp$1e = Object.prototype.hasOwnProperty, __propIsEnum$1e = Object.prototype.propertyIsEnumerable, __defNormalProp$1d = (_e, Qt, Zt) => Qt in _e ? __defProp$1d(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1d = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1e.call(Qt, Zt) && __defNormalProp$1d(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1e)
    for (var Zt of __getOwnPropSymbols$1e(Qt))
      __propIsEnum$1e.call(Qt, Zt) && __defNormalProp$1d(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$K = (_e, Qt) => __defProps$K(_e, __getOwnPropDescs$K(Qt)), __objRest$W = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1e.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1e)
    for (var $n of __getOwnPropSymbols$1e(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1e.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$N = {
  overlayOpacity: 0.75,
  transitionDuration: 0,
  radius: 0,
  zIndex: getDefaultZIndex("overlay")
}, LoadingOverlay = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("LoadingOverlay", defaultProps$N, _e), {
    className: $n,
    visible: Sn,
    loaderProps: kn,
    overlayOpacity: Kn,
    overlayColor: er,
    transitionDuration: Cr,
    exitTransitionDuration: kr,
    zIndex: Yr,
    style: Ms,
    loader: Ds,
    radius: Ls,
    overlayBlur: js,
    unstyled: zs,
    variant: Fs,
    keepMounted: Bs
  } = Zt, Hs = __objRest$W(Zt, [
    "className",
    "visible",
    "loaderProps",
    "overlayOpacity",
    "overlayColor",
    "transitionDuration",
    "exitTransitionDuration",
    "zIndex",
    "style",
    "loader",
    "radius",
    "overlayBlur",
    "unstyled",
    "variant",
    "keepMounted"
  ]), { classes: Ws, cx: Ys, theme: El } = useStyles$1p(null, { name: "LoadingOverlay", unstyled: zs, variant: Fs }), Mu = `calc(${Yr} + 1)`;
  return /* @__PURE__ */ React.createElement(Transition$1, {
    keepMounted: Bs,
    duration: Cr,
    exitDuration: kr,
    mounted: Sn,
    transition: "fade"
  }, (Pl) => /* @__PURE__ */ React.createElement(Box, __spreadValues$1d({
    className: Ys(Ws.root, $n),
    style: __spreadProps$K(__spreadValues$1d(__spreadValues$1d({}, Pl), Ms), { zIndex: Yr }),
    ref: Qt
  }, Hs), Ds ? /* @__PURE__ */ React.createElement("div", {
    style: { zIndex: Mu }
  }, Ds) : /* @__PURE__ */ React.createElement(Loader, __spreadValues$1d({
    style: { zIndex: Mu }
  }, kn)), /* @__PURE__ */ React.createElement(Overlay, {
    opacity: Kn,
    zIndex: Yr,
    radius: Ls,
    blur: js,
    unstyled: zs,
    color: er || (El.colorScheme === "dark" ? El.colors.dark[5] : El.white)
  })));
});
LoadingOverlay.displayName = "@mantine/core/LoadingOverlay";
const MENU_ERRORS = {
  context: "Menu component was not found in the tree",
  children: "Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
}, [MenuContextProvider, useMenuContext] = createSafeContext(MENU_ERRORS.context);
var useStyles$1m = createStyles((_e) => ({
  divider: {
    marginTop: rem$1(4),
    marginBottom: rem$1(4),
    borderTop: `${rem$1(1)} solid ${_e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2]}`
  }
}));
const useStyles$1n = useStyles$1m;
var __defProp$1c = Object.defineProperty, __getOwnPropSymbols$1d = Object.getOwnPropertySymbols, __hasOwnProp$1d = Object.prototype.hasOwnProperty, __propIsEnum$1d = Object.prototype.propertyIsEnumerable, __defNormalProp$1c = (_e, Qt, Zt) => Qt in _e ? __defProp$1c(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1c = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1d.call(Qt, Zt) && __defNormalProp$1c(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1d)
    for (var Zt of __getOwnPropSymbols$1d(Qt))
      __propIsEnum$1d.call(Qt, Zt) && __defNormalProp$1c(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$V = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1d.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1d)
    for (var $n of __getOwnPropSymbols$1d(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1d.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$M = {}, MenuDivider = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("MenuDivider", defaultProps$M, _e), { children: $n, className: Sn } = Zt, kn = __objRest$V(Zt, ["children", "className"]), { classNames: Kn, styles: er, unstyled: Cr, variant: kr } = useMenuContext(), { classes: Yr, cx: Ms } = useStyles$1n(null, { name: "Menu", classNames: Kn, styles: er, unstyled: Cr, variant: kr });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1c({
    className: Ms(Yr.divider, Sn),
    ref: Qt
  }, kn));
});
MenuDivider.displayName = "@mantine/core/MenuDivider";
var __defProp$1b = Object.defineProperty, __getOwnPropSymbols$1c = Object.getOwnPropertySymbols, __hasOwnProp$1c = Object.prototype.hasOwnProperty, __propIsEnum$1c = Object.prototype.propertyIsEnumerable, __defNormalProp$1b = (_e, Qt, Zt) => Qt in _e ? __defProp$1b(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1b = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1c.call(Qt, Zt) && __defNormalProp$1b(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1c)
    for (var Zt of __getOwnPropSymbols$1c(Qt))
      __propIsEnum$1c.call(Qt, Zt) && __defNormalProp$1b(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$U = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1c.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1c)
    for (var $n of __getOwnPropSymbols$1c(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1c.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$L = {};
function MenuDropdown(_e) {
  const Qt = useComponentDefaultProps("MenuDropdown", defaultProps$L, _e), { children: Zt, onMouseEnter: $n, onMouseLeave: Sn } = Qt, kn = __objRest$U(Qt, ["children", "onMouseEnter", "onMouseLeave"]), Kn = reactExports.useRef(), er = useMenuContext(), Cr = (Ms) => {
    var Ds;
    (Ms.key === "ArrowUp" || Ms.key === "ArrowDown") && (Ms.preventDefault(), (Ds = Kn.current.querySelectorAll("[data-menu-item]:not(:disabled)")[0]) == null || Ds.focus());
  }, kr = createEventHandler($n, () => er.trigger === "hover" && er.openDropdown()), Yr = createEventHandler(Sn, () => er.trigger === "hover" && er.closeDropdown());
  return /* @__PURE__ */ React.createElement(Popover.Dropdown, __spreadValues$1b({
    onMouseEnter: kr,
    onMouseLeave: Yr,
    role: "menu",
    "aria-orientation": "vertical"
  }, kn), /* @__PURE__ */ React.createElement("div", {
    tabIndex: -1,
    "data-menu-dropdown": !0,
    "data-autofocus": !0,
    onKeyDown: Cr,
    ref: Kn,
    style: { outline: 0 }
  }, Zt));
}
MenuDropdown.displayName = "@mantine/core/MenuDropdown";
var __defProp$1a = Object.defineProperty, __defProps$J = Object.defineProperties, __getOwnPropDescs$J = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1b = Object.getOwnPropertySymbols, __hasOwnProp$1b = Object.prototype.hasOwnProperty, __propIsEnum$1b = Object.prototype.propertyIsEnumerable, __defNormalProp$1a = (_e, Qt, Zt) => Qt in _e ? __defProp$1a(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1a = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1b.call(Qt, Zt) && __defNormalProp$1a(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1b)
    for (var Zt of __getOwnPropSymbols$1b(Qt))
      __propIsEnum$1b.call(Qt, Zt) && __defNormalProp$1a(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$J = (_e, Qt) => __defProps$J(_e, __getOwnPropDescs$J(Qt)), useStyles$1k = createStyles((_e, { color: Qt, radius: Zt }) => ({
  item: __spreadProps$J(__spreadValues$1a({}, _e.fn.fontStyles()), {
    WebkitTapHighlightColor: "transparent",
    fontSize: _e.fontSizes.sm,
    border: 0,
    backgroundColor: "transparent",
    outline: 0,
    width: "100%",
    textAlign: "left",
    textDecoration: "none",
    boxSizing: "border-box",
    padding: `${_e.spacing.xs} ${_e.spacing.sm}`,
    cursor: "pointer",
    borderRadius: _e.fn.radius(Zt),
    color: Qt ? _e.fn.variant({ variant: "filled", primaryFallback: !1, color: Qt }).background : _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
    display: "flex",
    alignItems: "center",
    "&:disabled": {
      color: _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[5],
      pointerEvents: "none",
      userSelect: "none"
    },
    "&[data-hovered]": {
      backgroundColor: Qt ? _e.fn.variant({ variant: "light", color: Qt }).background : _e.colorScheme === "dark" ? _e.fn.rgba(_e.colors.dark[3], 0.35) : _e.colors.gray[1]
    }
  }),
  itemLabel: {
    flex: 1
  },
  itemIcon: {
    display: "flex",
    justifyContent: "center",
    alignItems: "center",
    marginRight: _e.spacing.xs
  },
  itemRightSection: {}
}));
const useStyles$1l = useStyles$1k;
var __defProp$19 = Object.defineProperty, __defProps$I = Object.defineProperties, __getOwnPropDescs$I = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1a = Object.getOwnPropertySymbols, __hasOwnProp$1a = Object.prototype.hasOwnProperty, __propIsEnum$1a = Object.prototype.propertyIsEnumerable, __defNormalProp$19 = (_e, Qt, Zt) => Qt in _e ? __defProp$19(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$19 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$1a.call(Qt, Zt) && __defNormalProp$19(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$1a)
    for (var Zt of __getOwnPropSymbols$1a(Qt))
      __propIsEnum$1a.call(Qt, Zt) && __defNormalProp$19(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$I = (_e, Qt) => __defProps$I(_e, __getOwnPropDescs$I(Qt)), __objRest$T = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1a.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1a)
    for (var $n of __getOwnPropSymbols$1a(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1a.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$K = {}, _MenuItem = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("MenuItem", defaultProps$K, _e), { children: $n, className: Sn, color: kn, closeMenuOnClick: Kn, icon: er, rightSection: Cr } = Zt, kr = __objRest$T(Zt, ["children", "className", "color", "closeMenuOnClick", "icon", "rightSection"]), Yr = useMenuContext(), { classes: Ms, cx: Ds, theme: Ls } = useStyles$1l({ radius: Yr.radius, color: kn }, {
    name: "Menu",
    classNames: Yr.classNames,
    styles: Yr.styles,
    unstyled: Yr.unstyled,
    variant: Yr.variant
  }), js = reactExports.useRef(), zs = Yr.getItemIndex(js.current), Fs = kr, Bs = createEventHandler(Fs.onMouseLeave, () => Yr.setHovered(-1)), Hs = createEventHandler(Fs.onMouseEnter, () => Yr.setHovered(Yr.getItemIndex(js.current))), Ws = createEventHandler(Fs.onClick, () => {
    typeof Kn == "boolean" ? Kn && Yr.closeDropdownImmediately() : Yr.closeOnItemClick && Yr.closeDropdownImmediately();
  }), Ys = createEventHandler(Fs.onFocus, () => Yr.setHovered(Yr.getItemIndex(js.current)));
  return /* @__PURE__ */ React.createElement(Box, __spreadProps$I(__spreadValues$19({
    component: "button",
    type: "button"
  }, kr), {
    tabIndex: -1,
    onFocus: Ys,
    className: Ds(Ms.item, Sn),
    ref: useMergedRef(js, Qt),
    role: "menuitem",
    "data-menu-item": !0,
    "data-hovered": Yr.hovered === zs ? !0 : void 0,
    onMouseEnter: Hs,
    onMouseLeave: Bs,
    onClick: Ws,
    onKeyDown: createScopedKeydownHandler({
      siblingSelector: "[data-menu-item]",
      parentSelector: "[data-menu-dropdown]",
      activateOnFocus: !1,
      loop: Yr.loop,
      dir: Ls.dir,
      orientation: "vertical",
      onKeyDown: Fs.onKeydown
    })
  }), er && /* @__PURE__ */ React.createElement("div", {
    className: Ms.itemIcon
  }, er), $n && /* @__PURE__ */ React.createElement("div", {
    className: Ms.itemLabel
  }, $n), Cr && /* @__PURE__ */ React.createElement("div", {
    className: Ms.itemRightSection
  }, Cr));
});
_MenuItem.displayName = "@mantine/core/MenuItem";
const MenuItem = _MenuItem;
var useStyles$1i = createStyles((_e) => ({
  label: {
    color: _e.colorScheme === "dark" ? _e.colors.dark[2] : _e.colors.gray[6],
    fontWeight: 500,
    fontSize: _e.fontSizes.xs,
    padding: `calc(${_e.spacing.xs} / 2) ${_e.spacing.sm}`,
    cursor: "default"
  }
}));
const useStyles$1j = useStyles$1i;
var __defProp$18 = Object.defineProperty, __getOwnPropSymbols$19 = Object.getOwnPropertySymbols, __hasOwnProp$19 = Object.prototype.hasOwnProperty, __propIsEnum$19 = Object.prototype.propertyIsEnumerable, __defNormalProp$18 = (_e, Qt, Zt) => Qt in _e ? __defProp$18(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$18 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$19.call(Qt, Zt) && __defNormalProp$18(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$19)
    for (var Zt of __getOwnPropSymbols$19(Qt))
      __propIsEnum$19.call(Qt, Zt) && __defNormalProp$18(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$S = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$19.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$19)
    for (var $n of __getOwnPropSymbols$19(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$19.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$J = {}, MenuLabel = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("MenuLabel", defaultProps$J, _e), { children: $n, className: Sn } = Zt, kn = __objRest$S(Zt, ["children", "className"]), { classNames: Kn, styles: er, unstyled: Cr, variant: kr } = useMenuContext(), { classes: Yr, cx: Ms } = useStyles$1j(null, { name: "Menu", classNames: Kn, styles: er, unstyled: Cr, variant: kr });
  return /* @__PURE__ */ React.createElement(Text, __spreadValues$18({
    className: Ms(Yr.label, Sn),
    ref: Qt
  }, kn), $n);
});
MenuLabel.displayName = "@mantine/core/MenuLabel";
var __defProp$17 = Object.defineProperty, __getOwnPropSymbols$18 = Object.getOwnPropertySymbols, __hasOwnProp$18 = Object.prototype.hasOwnProperty, __propIsEnum$18 = Object.prototype.propertyIsEnumerable, __defNormalProp$17 = (_e, Qt, Zt) => Qt in _e ? __defProp$17(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$17 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$18.call(Qt, Zt) && __defNormalProp$17(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$18)
    for (var Zt of __getOwnPropSymbols$18(Qt))
      __propIsEnum$18.call(Qt, Zt) && __defNormalProp$17(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$R = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$18.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$18)
    for (var $n of __getOwnPropSymbols$18(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$18.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$I = {
  refProp: "ref"
}, MenuTarget = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("MenuTarget", defaultProps$I, _e), { children: $n, refProp: Sn } = Zt, kn = __objRest$R(Zt, ["children", "refProp"]);
  if (!isElement$3($n))
    throw new Error(MENU_ERRORS.children);
  const Kn = useMenuContext(), er = createEventHandler($n.props.onClick, () => Kn.trigger === "click" && Kn.toggleDropdown()), Cr = createEventHandler($n.props.onMouseEnter, () => Kn.trigger === "hover" && Kn.openDropdown()), kr = createEventHandler($n.props.onMouseLeave, () => Kn.trigger === "hover" && Kn.closeDropdown());
  return /* @__PURE__ */ React.createElement(Popover.Target, __spreadValues$17({
    refProp: Sn,
    popupType: "menu",
    ref: Qt
  }, kn), reactExports.cloneElement($n, {
    onClick: er,
    onMouseEnter: Cr,
    onMouseLeave: kr,
    "data-expanded": Kn.opened ? !0 : void 0
  }));
});
MenuTarget.displayName = "@mantine/core/MenuTarget";
var useStyles$1g = createStyles({
  dropdown: { padding: rem$1(4) }
});
const useStyles$1h = useStyles$1g;
var __defProp$16 = Object.defineProperty, __defProps$H = Object.defineProperties, __getOwnPropDescs$H = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$17 = Object.getOwnPropertySymbols, __hasOwnProp$17 = Object.prototype.hasOwnProperty, __propIsEnum$17 = Object.prototype.propertyIsEnumerable, __defNormalProp$16 = (_e, Qt, Zt) => Qt in _e ? __defProp$16(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$16 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$17.call(Qt, Zt) && __defNormalProp$16(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$17)
    for (var Zt of __getOwnPropSymbols$17(Qt))
      __propIsEnum$17.call(Qt, Zt) && __defNormalProp$16(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$H = (_e, Qt) => __defProps$H(_e, __getOwnPropDescs$H(Qt)), __objRest$Q = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$17.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$17)
    for (var $n of __getOwnPropSymbols$17(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$17.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$H = {
  closeOnItemClick: !0,
  loop: !0,
  trigger: "click",
  openDelay: 0,
  closeDelay: 100
};
function Menu(_e) {
  const Qt = useComponentDefaultProps("Menu", defaultProps$H, _e), {
    children: Zt,
    onOpen: $n,
    onClose: Sn,
    opened: kn,
    defaultOpened: Kn,
    onChange: er,
    closeOnItemClick: Cr,
    loop: kr,
    closeOnEscape: Yr,
    trigger: Ms,
    openDelay: Ds,
    closeDelay: Ls,
    classNames: js,
    styles: zs,
    unstyled: Fs,
    radius: Bs,
    variant: Hs
  } = Qt, Ws = __objRest$Q(Qt, [
    "children",
    "onOpen",
    "onClose",
    "opened",
    "defaultOpened",
    "onChange",
    "closeOnItemClick",
    "loop",
    "closeOnEscape",
    "trigger",
    "openDelay",
    "closeDelay",
    "classNames",
    "styles",
    "unstyled",
    "radius",
    "variant"
  ]), { classes: Ys, cx: El } = useStyles$1h(), [Mu, { setHovered: Pl, resetHovered: Iu }] = useHovered(), [Tu, Au] = useUncontrolled({
    value: kn,
    defaultValue: Kn,
    finalValue: !1,
    onChange: er
  }), Nu = () => {
    Au(!1), Tu && (Sn == null || Sn());
  }, gm = () => {
    Au(!0), !Tu && ($n == null || $n());
  }, pm = () => Tu ? Nu() : gm(), { openDropdown: zu, closeDropdown: Yu } = useDelayedHover({ open: gm, close: Nu, closeDelay: Ls, openDelay: Ds }), sm = (mm) => getContextItemIndex("[data-menu-item]", "[data-menu-dropdown]", mm);
  return useDidUpdate(() => {
    Iu();
  }, [Tu]), /* @__PURE__ */ React.createElement(MenuContextProvider, {
    value: {
      opened: Tu,
      toggleDropdown: pm,
      getItemIndex: sm,
      hovered: Mu,
      setHovered: Pl,
      closeOnItemClick: Cr,
      closeDropdown: Ms === "click" ? Nu : Yu,
      openDropdown: Ms === "click" ? gm : zu,
      closeDropdownImmediately: Nu,
      loop: kr,
      trigger: Ms,
      radius: Bs,
      classNames: js,
      styles: zs,
      unstyled: Fs,
      variant: Hs
    }
  }, /* @__PURE__ */ React.createElement(Popover, __spreadProps$H(__spreadValues$16({}, Ws), {
    radius: Bs,
    opened: Tu,
    onChange: pm,
    defaultOpened: Kn,
    trapFocus: Ms === "click",
    closeOnEscape: Yr && Ms === "click",
    __staticSelector: "Menu",
    classNames: __spreadProps$H(__spreadValues$16({}, js), { dropdown: El(Ys.dropdown, js == null ? void 0 : js.dropdown) }),
    styles: zs,
    unstyled: Fs,
    variant: Hs
  }), Zt));
}
Menu.displayName = "@mantine/core/Menu";
Menu.Item = MenuItem;
Menu.Label = MenuLabel;
Menu.Dropdown = MenuDropdown;
Menu.Target = MenuTarget;
Menu.Divider = MenuDivider;
const [ModalProvider, useModalContext] = createSafeContext("Modal component was not found in tree"), sizes$8 = {
  xs: rem$1(320),
  sm: rem$1(380),
  md: rem$1(440),
  lg: rem$1(620),
  xl: rem$1(780)
};
var useStyles$1e = createStyles((_e, { yOffset: Qt, xOffset: Zt, centered: $n, fullScreen: Sn }, { size: kn }) => ({
  content: {
    flex: Sn ? "0 0 100%" : `0 0 ${getSize$1({ size: kn, sizes: sizes$8 })}`,
    maxWidth: "100%",
    maxHeight: Sn ? void 0 : `calc(100dvh - (${rem$1(Qt)} * 2))`,
    height: Sn ? "100vh" : void 0,
    borderRadius: Sn ? 0 : void 0,
    overflowY: "auto"
  },
  inner: {
    paddingTop: Sn ? 0 : Qt,
    paddingBottom: Sn ? 0 : Qt,
    paddingLeft: Sn ? 0 : Zt,
    paddingRight: Sn ? 0 : Zt,
    display: "flex",
    justifyContent: "center",
    alignItems: $n ? "center" : "flex-start"
  }
}));
const useStyles$1f = useStyles$1e;
var __defProp$15 = Object.defineProperty, __defProps$G = Object.defineProperties, __getOwnPropDescs$G = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$16 = Object.getOwnPropertySymbols, __hasOwnProp$16 = Object.prototype.hasOwnProperty, __propIsEnum$16 = Object.prototype.propertyIsEnumerable, __defNormalProp$15 = (_e, Qt, Zt) => Qt in _e ? __defProp$15(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$15 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$16.call(Qt, Zt) && __defNormalProp$15(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$16)
    for (var Zt of __getOwnPropSymbols$16(Qt))
      __propIsEnum$16.call(Qt, Zt) && __defNormalProp$15(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$G = (_e, Qt) => __defProps$G(_e, __getOwnPropDescs$G(Qt)), __objRest$P = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$16.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$16)
    for (var $n of __getOwnPropSymbols$16(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$16.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$G = __spreadProps$G(__spreadValues$15({}, ModalBaseDefaultProps), {
  yOffset: "5dvh",
  xOffset: "5vw"
});
function ModalRoot(_e) {
  const Qt = useComponentDefaultProps("ModalRoot", defaultProps$G, _e), {
    classNames: Zt,
    variant: $n,
    size: Sn,
    yOffset: kn,
    xOffset: Kn,
    scrollAreaComponent: er,
    radius: Cr,
    centered: kr,
    fullScreen: Yr
  } = Qt, Ms = __objRest$P(Qt, [
    "classNames",
    "variant",
    "size",
    "yOffset",
    "xOffset",
    "scrollAreaComponent",
    "radius",
    "centered",
    "fullScreen"
  ]), { classes: Ds, cx: Ls } = useStyles$1f({ yOffset: kn, xOffset: Kn, centered: kr, fullScreen: Yr }, { name: "Modal", variant: $n, size: Sn });
  return /* @__PURE__ */ React.createElement(ModalProvider, {
    value: { yOffset: kn, scrollAreaComponent: er, radius: Cr }
  }, /* @__PURE__ */ React.createElement(ModalBase, __spreadValues$15({
    __staticSelector: "Modal",
    size: Sn,
    variant: $n,
    classNames: __spreadProps$G(__spreadValues$15({}, Zt), {
      content: Ls(Ds.content, Zt == null ? void 0 : Zt.content),
      inner: Ls(Ds.inner, Zt == null ? void 0 : Zt.inner)
    })
  }, Ms)));
}
var __defProp$14 = Object.defineProperty, __getOwnPropSymbols$15 = Object.getOwnPropertySymbols, __hasOwnProp$15 = Object.prototype.hasOwnProperty, __propIsEnum$15 = Object.prototype.propertyIsEnumerable, __defNormalProp$14 = (_e, Qt, Zt) => Qt in _e ? __defProp$14(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$14 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$15.call(Qt, Zt) && __defNormalProp$14(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$15)
    for (var Zt of __getOwnPropSymbols$15(Qt))
      __propIsEnum$15.call(Qt, Zt) && __defNormalProp$14(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$O = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$15.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$15)
    for (var $n of __getOwnPropSymbols$15(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$15.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$F = {
  shadow: "xl"
}, ModalContent = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("ModalContent", defaultProps$F, _e), { children: $n, scrollAreaComponent: Sn } = Zt, kn = __objRest$O(Zt, ["children", "scrollAreaComponent"]), Kn = useModalContext(), er = Sn || Kn.scrollAreaComponent || ModalBase.NativeScrollArea;
  return /* @__PURE__ */ React.createElement(ModalBase.Content, __spreadValues$14({
    ref: Qt,
    radius: Kn.radius
  }, kn), /* @__PURE__ */ React.createElement(er, {
    style: { maxHeight: `calc(100dvh - (${rem$1(Kn.yOffset)} * 2))` }
  }, $n));
});
var __defProp$13 = Object.defineProperty, __defProps$F = Object.defineProperties, __getOwnPropDescs$F = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$14 = Object.getOwnPropertySymbols, __hasOwnProp$14 = Object.prototype.hasOwnProperty, __propIsEnum$14 = Object.prototype.propertyIsEnumerable, __defNormalProp$13 = (_e, Qt, Zt) => Qt in _e ? __defProp$13(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$13 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$14.call(Qt, Zt) && __defNormalProp$13(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$14)
    for (var Zt of __getOwnPropSymbols$14(Qt))
      __propIsEnum$14.call(Qt, Zt) && __defNormalProp$13(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$F = (_e, Qt) => __defProps$F(_e, __getOwnPropDescs$F(Qt)), __objRest$N = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$14.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$14)
    for (var $n of __getOwnPropSymbols$14(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$14.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$E = __spreadProps$F(__spreadValues$13({}, ModalBaseDefaultProps), {
  transitionProps: { duration: 200, transition: "pop" },
  withOverlay: !0,
  withCloseButton: !0
});
function Modal(_e) {
  const Qt = useComponentDefaultProps("Modal", defaultProps$E, _e), {
    title: Zt,
    withOverlay: $n,
    overlayProps: Sn,
    withCloseButton: kn,
    closeButtonProps: Kn,
    children: er
  } = Qt, Cr = __objRest$N(Qt, [
    "title",
    "withOverlay",
    "overlayProps",
    "withCloseButton",
    "closeButtonProps",
    "children"
  ]), kr = !!Zt || kn;
  return /* @__PURE__ */ React.createElement(ModalRoot, __spreadValues$13({}, Cr), $n && /* @__PURE__ */ React.createElement(ModalBase.Overlay, __spreadValues$13({}, Sn)), /* @__PURE__ */ React.createElement(ModalContent, null, kr && /* @__PURE__ */ React.createElement(ModalBase.Header, null, Zt && /* @__PURE__ */ React.createElement(ModalBase.Title, null, Zt), kn && /* @__PURE__ */ React.createElement(ModalBase.CloseButton, __spreadValues$13({}, Kn))), /* @__PURE__ */ React.createElement(ModalBase.Body, null, er)));
}
Modal.Root = ModalRoot;
Modal.CloseButton = ModalBase.CloseButton;
Modal.Overlay = ModalBase.Overlay;
Modal.Content = ModalContent;
Modal.Header = ModalBase.Header;
Modal.Title = ModalBase.Title;
Modal.Body = ModalBase.Body;
Modal.NativeScrollArea = ModalBase.NativeScrollArea;
const sizes$7 = {
  xs: rem$1(16),
  sm: rem$1(22),
  md: rem$1(26),
  lg: rem$1(30),
  xl: rem$1(36)
}, fontSizes = {
  xs: rem$1(10),
  sm: rem$1(12),
  md: rem$1(14),
  lg: rem$1(16),
  xl: rem$1(18)
};
var useStyles$1c = createStyles((_e, { disabled: Qt, radius: Zt, readOnly: $n }, { size: Sn, variant: kn }) => ({
  defaultValue: {
    display: "flex",
    alignItems: "center",
    backgroundColor: Qt ? _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[3] : _e.colorScheme === "dark" ? _e.colors.dark[7] : kn === "filled" ? _e.white : _e.colors.gray[1],
    color: Qt ? _e.colorScheme === "dark" ? _e.colors.dark[1] : _e.colors.gray[7] : _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.colors.gray[7],
    height: getSize$1({ size: Sn, sizes: sizes$7 }),
    paddingLeft: `calc(${getSize$1({ size: Sn, sizes: _e.spacing })} / 1.5)`,
    paddingRight: Qt || $n ? getSize$1({ size: Sn, sizes: _e.spacing }) : 0,
    fontWeight: 500,
    fontSize: getSize$1({ size: Sn, sizes: fontSizes }),
    borderRadius: getSize$1({ size: Zt, sizes: _e.radius }),
    cursor: Qt ? "not-allowed" : "default",
    userSelect: "none",
    maxWidth: `calc(100% - ${rem$1(10)})`
  },
  defaultValueRemove: {
    color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.colors.gray[7],
    marginLeft: `calc(${getSize$1({ size: Sn, sizes: _e.spacing })} / 6)`
  },
  defaultValueLabel: {
    display: "block",
    overflow: "hidden",
    textOverflow: "ellipsis",
    whiteSpace: "nowrap"
  }
}));
const useStyles$1d = useStyles$1c;
var __defProp$12 = Object.defineProperty, __getOwnPropSymbols$13 = Object.getOwnPropertySymbols, __hasOwnProp$13 = Object.prototype.hasOwnProperty, __propIsEnum$13 = Object.prototype.propertyIsEnumerable, __defNormalProp$12 = (_e, Qt, Zt) => Qt in _e ? __defProp$12(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$12 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$13.call(Qt, Zt) && __defNormalProp$12(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$13)
    for (var Zt of __getOwnPropSymbols$13(Qt))
      __propIsEnum$13.call(Qt, Zt) && __defNormalProp$12(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$M = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$13.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$13)
    for (var $n of __getOwnPropSymbols$13(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$13.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const buttonSizes = {
  xs: 16,
  sm: 22,
  md: 24,
  lg: 26,
  xl: 30
};
function DefaultValue(_e) {
  var Qt = _e, {
    label: Zt,
    classNames: $n,
    styles: Sn,
    className: kn,
    onRemove: Kn,
    disabled: er,
    readOnly: Cr,
    size: kr,
    radius: Yr = "sm",
    variant: Ms,
    unstyled: Ds
  } = Qt, Ls = __objRest$M(Qt, [
    "label",
    "classNames",
    "styles",
    "className",
    "onRemove",
    "disabled",
    "readOnly",
    "size",
    "radius",
    "variant",
    "unstyled"
  ]);
  const { classes: js, cx: zs } = useStyles$1d({ disabled: er, readOnly: Cr, radius: Yr }, { name: "MultiSelect", classNames: $n, styles: Sn, unstyled: Ds, size: kr, variant: Ms });
  return /* @__PURE__ */ React.createElement("div", __spreadValues$12({
    className: zs(js.defaultValue, kn)
  }, Ls), /* @__PURE__ */ React.createElement("span", {
    className: js.defaultValueLabel
  }, Zt), !er && !Cr && /* @__PURE__ */ React.createElement(CloseButton, {
    "aria-hidden": !0,
    onMouseDown: Kn,
    size: buttonSizes[kr],
    radius: 2,
    color: "blue",
    variant: "transparent",
    iconSize: "70%",
    className: js.defaultValueRemove,
    tabIndex: -1,
    unstyled: Ds
  }));
}
DefaultValue.displayName = "@mantine/core/MultiSelect/DefaultValue";
function filterData$1({
  data: _e,
  searchable: Qt,
  limit: Zt,
  searchValue: $n,
  filter: Sn,
  value: kn,
  disableSelectedItemFiltering: Kn
}) {
  if (!Qt && kn.length === 0)
    return _e;
  if (!Qt) {
    const Cr = [];
    for (let kr = 0; kr < _e.length; kr += 1)
      (Kn || !kn.some((Yr) => Yr === _e[kr].value && !_e[kr].disabled)) && Cr.push(_e[kr]);
    return Cr;
  }
  const er = [];
  for (let Cr = 0; Cr < _e.length && (Sn($n, !Kn && kn.some((kr) => kr === _e[Cr].value && !_e[Cr].disabled), _e[Cr]) && er.push(_e[Cr]), !(er.length >= Zt)); Cr += 1)
    ;
  return er;
}
var __defProp$11 = Object.defineProperty, __getOwnPropSymbols$12 = Object.getOwnPropertySymbols, __hasOwnProp$12 = Object.prototype.hasOwnProperty, __propIsEnum$12 = Object.prototype.propertyIsEnumerable, __defNormalProp$11 = (_e, Qt, Zt) => Qt in _e ? __defProp$11(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$11 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$12.call(Qt, Zt) && __defNormalProp$11(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$12)
    for (var Zt of __getOwnPropSymbols$12(Qt))
      __propIsEnum$12.call(Qt, Zt) && __defNormalProp$11(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$L = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$12.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$12)
    for (var $n of __getOwnPropSymbols$12(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$12.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const iconSizes$1 = {
  xs: rem$1(14),
  sm: rem$1(18),
  md: rem$1(20),
  lg: rem$1(24),
  xl: rem$1(28)
};
function ChevronIcon(_e) {
  var Qt = _e, { size: Zt, error: $n, style: Sn } = Qt, kn = __objRest$L(Qt, ["size", "error", "style"]);
  const Kn = useMantineTheme(), er = getSize$1({ size: Zt, sizes: iconSizes$1 });
  return /* @__PURE__ */ React.createElement("svg", __spreadValues$11({
    viewBox: "0 0 15 15",
    fill: "none",
    xmlns: "http://www.w3.org/2000/svg",
    style: __spreadValues$11({
      color: $n ? Kn.colors.red[6] : Kn.colors.gray[6],
      width: er,
      height: er
    }, Sn),
    "data-chevron": !0
  }, kn), /* @__PURE__ */ React.createElement("path", {
    d: "M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",
    fill: "currentColor",
    fillRule: "evenodd",
    clipRule: "evenodd"
  }));
}
var __defProp$10 = Object.defineProperty, __defProps$E = Object.defineProperties, __getOwnPropDescs$E = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$11 = Object.getOwnPropertySymbols, __hasOwnProp$11 = Object.prototype.hasOwnProperty, __propIsEnum$11 = Object.prototype.propertyIsEnumerable, __defNormalProp$10 = (_e, Qt, Zt) => Qt in _e ? __defProp$10(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$10 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$11.call(Qt, Zt) && __defNormalProp$10(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$11)
    for (var Zt of __getOwnPropSymbols$11(Qt))
      __propIsEnum$11.call(Qt, Zt) && __defNormalProp$10(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$E = (_e, Qt) => __defProps$E(_e, __getOwnPropDescs$E(Qt));
function SelectRightSection({
  shouldClear: _e,
  clearButtonProps: Qt,
  onClear: Zt,
  size: $n,
  error: Sn
}) {
  return _e ? /* @__PURE__ */ React.createElement(CloseButton, __spreadProps$E(__spreadValues$10({}, Qt), {
    variant: "transparent",
    onClick: Zt,
    size: $n,
    onMouseDown: (kn) => kn.preventDefault()
  })) : /* @__PURE__ */ React.createElement(ChevronIcon, {
    error: Sn,
    size: $n
  });
}
SelectRightSection.displayName = "@mantine/core/SelectRightSection";
var __defProp$$ = Object.defineProperty, __defProps$D = Object.defineProperties, __getOwnPropDescs$D = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$10 = Object.getOwnPropertySymbols, __hasOwnProp$10 = Object.prototype.hasOwnProperty, __propIsEnum$10 = Object.prototype.propertyIsEnumerable, __defNormalProp$$ = (_e, Qt, Zt) => Qt in _e ? __defProp$$(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$$ = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$10.call(Qt, Zt) && __defNormalProp$$(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$10)
    for (var Zt of __getOwnPropSymbols$10(Qt))
      __propIsEnum$10.call(Qt, Zt) && __defNormalProp$$(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$D = (_e, Qt) => __defProps$D(_e, __getOwnPropDescs$D(Qt)), __objRest$K = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$10.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$10)
    for (var $n of __getOwnPropSymbols$10(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$10.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function getSelectRightSectionProps(_e) {
  var Qt = _e, {
    styles: Zt,
    rightSection: $n,
    rightSectionWidth: Sn,
    theme: kn
  } = Qt, Kn = __objRest$K(Qt, [
    "styles",
    "rightSection",
    "rightSectionWidth",
    "theme"
  ]);
  if ($n)
    return { rightSection: $n, rightSectionWidth: Sn, styles: Zt };
  const er = typeof Zt == "function" ? Zt(kn) : Zt;
  return {
    rightSection: !Kn.readOnly && !(Kn.disabled && Kn.shouldClear) && /* @__PURE__ */ React.createElement(SelectRightSection, __spreadValues$$({}, Kn)),
    styles: __spreadProps$D(__spreadValues$$({}, er), {
      rightSection: __spreadProps$D(__spreadValues$$({}, er == null ? void 0 : er.rightSection), {
        pointerEvents: Kn.shouldClear ? void 0 : "none"
      })
    })
  };
}
var __defProp$_ = Object.defineProperty, __defProps$C = Object.defineProperties, __getOwnPropDescs$C = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$$ = Object.getOwnPropertySymbols, __hasOwnProp$$ = Object.prototype.hasOwnProperty, __propIsEnum$$ = Object.prototype.propertyIsEnumerable, __defNormalProp$_ = (_e, Qt, Zt) => Qt in _e ? __defProp$_(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$_ = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$$.call(Qt, Zt) && __defNormalProp$_(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$$)
    for (var Zt of __getOwnPropSymbols$$(Qt))
      __propIsEnum$$.call(Qt, Zt) && __defNormalProp$_(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$C = (_e, Qt) => __defProps$C(_e, __getOwnPropDescs$C(Qt)), useStyles$1a = createStyles((_e, { invalid: Qt }, { size: Zt }) => ({
  wrapper: {
    position: "relative",
    "&:has(input:disabled)": {
      cursor: "not-allowed",
      pointerEvents: "none",
      "& .mantine-MultiSelect-input": {
        backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[1],
        color: _e.colors.dark[2],
        opacity: 0.6,
        "&::placeholder": {
          color: _e.colors.dark[2]
        }
      },
      "& .mantine-MultiSelect-defaultValue": {
        backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[3],
        color: _e.colorScheme === "dark" ? _e.colors.dark[1] : _e.colors.gray[7]
      }
    }
  },
  values: {
    minHeight: `calc(${getSize$1({ size: Zt, sizes: sizes$d })} - ${rem$1(2)})`,
    display: "flex",
    alignItems: "center",
    flexWrap: "wrap",
    marginLeft: `calc(-${_e.spacing.xs} / 2)`,
    boxSizing: "border-box",
    "&[data-clearable]": {
      marginRight: getSize$1({ size: Zt, sizes: sizes$d })
    }
  },
  value: {
    margin: `calc(${_e.spacing.xs} / 2 - ${rem$1(2)}) calc(${_e.spacing.xs} / 2)`
  },
  searchInput: __spreadProps$C(__spreadValues$_({}, _e.fn.fontStyles()), {
    flex: 1,
    minWidth: rem$1(60),
    backgroundColor: "transparent",
    border: 0,
    outline: 0,
    fontSize: getSize$1({ size: Zt, sizes: _e.fontSizes }),
    padding: 0,
    marginLeft: `calc(${_e.spacing.xs} / 2)`,
    appearance: "none",
    color: "inherit",
    maxHeight: getSize$1({ size: Zt, sizes: sizes$7 }),
    "&::placeholder": {
      opacity: 1,
      color: Qt ? _e.colors.red[_e.fn.primaryShade()] : _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[5]
    },
    "&:disabled": {
      cursor: "not-allowed",
      pointerEvents: "none"
    }
  }),
  searchInputEmpty: {
    width: "100%"
  },
  searchInputInputHidden: {
    flex: 0,
    width: 0,
    minWidth: 0,
    margin: 0,
    overflow: "hidden"
  },
  searchInputPointer: {
    cursor: "pointer",
    "&:disabled": {
      cursor: "not-allowed",
      pointerEvents: "none"
    }
  },
  input: {
    cursor: "pointer",
    "&:disabled": {
      cursor: "not-allowed",
      pointerEvents: "none"
    }
  }
}));
const useStyles$1b = useStyles$1a;
var __defProp$Z = Object.defineProperty, __defProps$B = Object.defineProperties, __getOwnPropDescs$B = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$_ = Object.getOwnPropertySymbols, __hasOwnProp$_ = Object.prototype.hasOwnProperty, __propIsEnum$_ = Object.prototype.propertyIsEnumerable, __defNormalProp$Z = (_e, Qt, Zt) => Qt in _e ? __defProp$Z(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$Z = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$_.call(Qt, Zt) && __defNormalProp$Z(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$_)
    for (var Zt of __getOwnPropSymbols$_(Qt))
      __propIsEnum$_.call(Qt, Zt) && __defNormalProp$Z(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$B = (_e, Qt) => __defProps$B(_e, __getOwnPropDescs$B(Qt)), __objRest$J = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$_.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$_)
    for (var $n of __getOwnPropSymbols$_(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$_.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function defaultFilter$2(_e, Qt, Zt) {
  return Qt ? !1 : Zt.label.toLowerCase().trim().includes(_e.toLowerCase().trim());
}
function defaultShouldCreate$1(_e, Qt) {
  return !!_e && !Qt.some((Zt) => Zt.value.toLowerCase() === _e.toLowerCase());
}
function filterValue(_e, Qt) {
  if (!Array.isArray(_e))
    return;
  if (Qt.length === 0)
    return [];
  const Zt = Qt.map(($n) => typeof $n == "object" ? $n.value : $n);
  return _e.filter(($n) => Zt.includes($n));
}
const defaultProps$D = {
  size: "sm",
  valueComponent: DefaultValue,
  itemComponent: DefaultItem,
  transitionProps: { transition: "fade", duration: 0 },
  maxDropdownHeight: 220,
  shadow: "sm",
  searchable: !1,
  filter: defaultFilter$2,
  limit: 1 / 0,
  clearSearchOnChange: !0,
  clearable: !1,
  clearSearchOnBlur: !1,
  disabled: !1,
  initiallyOpened: !1,
  creatable: !1,
  shouldCreate: defaultShouldCreate$1,
  switchDirectionOnFlip: !1,
  zIndex: getDefaultZIndex("popover"),
  selectOnBlur: !1,
  positionDependencies: [],
  dropdownPosition: "flip"
}, MultiSelect = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("MultiSelect", defaultProps$D, _e), {
    className: $n,
    style: Sn,
    required: kn,
    label: Kn,
    description: er,
    size: Cr,
    error: kr,
    classNames: Yr,
    styles: Ms,
    wrapperProps: Ds,
    value: Ls,
    defaultValue: js,
    data: zs,
    onChange: Fs,
    valueComponent: Bs,
    itemComponent: Hs,
    id: Ws,
    transitionProps: Ys,
    maxDropdownHeight: El,
    shadow: Mu,
    nothingFound: Pl,
    onFocus: Iu,
    onBlur: Tu,
    searchable: Au,
    placeholder: Nu,
    filter: gm,
    limit: pm,
    clearSearchOnChange: zu,
    clearable: Yu,
    clearSearchOnBlur: sm,
    variant: mm,
    onSearchChange: hm,
    searchValue: ym,
    disabled: _m,
    initiallyOpened: Sm,
    radius: wm,
    icon: Nm,
    rightSection: Cm,
    rightSectionWidth: Im,
    creatable: Am,
    getCreateLabel: Vm,
    shouldCreate: Rm,
    onCreate: Dm,
    sx: km,
    dropdownComponent: zm,
    onDropdownClose: Pm,
    onDropdownOpen: i$,
    maxSelectedValues: o$,
    withinPortal: u$,
    portalProps: h$,
    switchDirectionOnFlip: d$,
    zIndex: v$,
    selectOnBlur: $$,
    name: s$,
    dropdownPosition: l$,
    errorProps: _$,
    labelProps: a$,
    descriptionProps: n$,
    form: m$,
    positionDependencies: j$,
    onKeyDown: Q$,
    unstyled: z$,
    inputContainer: wS,
    inputWrapperOrder: aS,
    readOnly: cS,
    withAsterisk: $S,
    clearButtonProps: B$,
    hoverOnSearchChange: IS,
    disableSelectedItemFiltering: RS
  } = Zt, eE = __objRest$J(Zt, [
    "className",
    "style",
    "required",
    "label",
    "description",
    "size",
    "error",
    "classNames",
    "styles",
    "wrapperProps",
    "value",
    "defaultValue",
    "data",
    "onChange",
    "valueComponent",
    "itemComponent",
    "id",
    "transitionProps",
    "maxDropdownHeight",
    "shadow",
    "nothingFound",
    "onFocus",
    "onBlur",
    "searchable",
    "placeholder",
    "filter",
    "limit",
    "clearSearchOnChange",
    "clearable",
    "clearSearchOnBlur",
    "variant",
    "onSearchChange",
    "searchValue",
    "disabled",
    "initiallyOpened",
    "radius",
    "icon",
    "rightSection",
    "rightSectionWidth",
    "creatable",
    "getCreateLabel",
    "shouldCreate",
    "onCreate",
    "sx",
    "dropdownComponent",
    "onDropdownClose",
    "onDropdownOpen",
    "maxSelectedValues",
    "withinPortal",
    "portalProps",
    "switchDirectionOnFlip",
    "zIndex",
    "selectOnBlur",
    "name",
    "dropdownPosition",
    "errorProps",
    "labelProps",
    "descriptionProps",
    "form",
    "positionDependencies",
    "onKeyDown",
    "unstyled",
    "inputContainer",
    "inputWrapperOrder",
    "readOnly",
    "withAsterisk",
    "clearButtonProps",
    "hoverOnSearchChange",
    "disableSelectedItemFiltering"
  ]), { classes: rS, cx: sS, theme: PS } = useStyles$1b({ invalid: !!kr }, { name: "MultiSelect", classNames: Yr, styles: Ms, unstyled: z$, size: Cr, variant: mm }), { systemStyles: G$, rest: tS } = extractSystemStyles(eE), hS = reactExports.useRef(), aE = reactExports.useRef({}), gS = useId$1(Ws), [lS, M$] = reactExports.useState(Sm), [Z$, O$] = reactExports.useState(-1), [U$, R$] = reactExports.useState("column"), [k$, yS] = useUncontrolled({
    value: ym,
    defaultValue: "",
    finalValue: void 0,
    onChange: hm
  }), [HS, WE] = reactExports.useState(!1), { scrollIntoView: wE, targetRef: GE, scrollableRef: lM } = useScrollIntoView({
    duration: 0,
    offset: 5,
    cancelable: !1,
    isList: !0
  }), YE = Am && typeof Vm == "function";
  let g$ = null;
  const V$ = zs.map((b$) => typeof b$ == "string" ? { label: b$, value: b$ } : b$), uS = groupOptions({ data: V$ }), [D$, xE] = useUncontrolled({
    value: filterValue(Ls, zs),
    defaultValue: filterValue(js, zs),
    finalValue: [],
    onChange: Fs
  }), LS = reactExports.useRef(!!o$ && o$ < D$.length), xM = (b$) => {
    if (!cS) {
      const Y$ = D$.filter((OS) => OS !== b$);
      xE(Y$), o$ && Y$.length < o$ && (LS.current = !1);
    }
  }, hC = (b$) => {
    yS(b$.currentTarget.value), !_m && !LS.current && Au && M$(!0);
  }, gC = (b$) => {
    typeof Iu == "function" && Iu(b$), !_m && !LS.current && Au && M$(!0);
  }, dS = filterData$1({
    data: uS,
    searchable: Au,
    searchValue: k$,
    limit: pm,
    filter: gm,
    value: D$,
    disableSelectedItemFiltering: RS
  });
  YE && Rm(k$, uS) && (g$ = Vm(k$), dS.push({ label: k$, value: k$, creatable: !0 }));
  const VS = Math.min(Z$, dS.length - 1), EM = (b$, Y$, OS) => {
    let sE = b$;
    for (; OS(sE); )
      if (sE = Y$(sE), !dS[sE].disabled)
        return sE;
    return b$;
  };
  useDidUpdate(() => {
    O$(IS && k$ ? 0 : -1);
  }, [k$, IS]), useDidUpdate(() => {
    !_m && D$.length > zs.length && M$(!1), o$ && D$.length < o$ && (LS.current = !1), o$ && D$.length >= o$ && (LS.current = !0, M$(!1));
  }, [D$]);
  const pE = (b$) => {
    if (!cS)
      if (zu && yS(""), D$.includes(b$.value))
        xM(b$.value);
      else {
        if (b$.creatable && typeof Dm == "function") {
          const Y$ = Dm(b$.value);
          typeof Y$ < "u" && Y$ !== null && xE(typeof Y$ == "string" ? [...D$, Y$] : [...D$, Y$.value]);
        } else
          xE([...D$, b$.value]);
        D$.length === o$ - 1 && (LS.current = !0, M$(!1)), dS.length === 1 && M$(!1);
      }
  }, mC = (b$) => {
    typeof Tu == "function" && Tu(b$), $$ && dS[VS] && lS && pE(dS[VS]), sm && yS(""), M$(!1);
  }, yC = (b$) => {
    if (HS || (Q$ == null || Q$(b$), cS) || b$.key !== "Backspace" && o$ && LS.current)
      return;
    const Y$ = U$ === "column", OS = () => {
      O$((lE) => {
        var WS;
        const EE = EM(lE, (tE) => tE + 1, (tE) => tE < dS.length - 1);
        return lS && (GE.current = aE.current[(WS = dS[EE]) == null ? void 0 : WS.value], wE({
          alignment: Y$ ? "end" : "start"
        })), EE;
      });
    }, sE = () => {
      O$((lE) => {
        var WS;
        const EE = EM(lE, (tE) => tE - 1, (tE) => tE > 0);
        return lS && (GE.current = aE.current[(WS = dS[EE]) == null ? void 0 : WS.value], wE({
          alignment: Y$ ? "start" : "end"
        })), EE;
      });
    };
    switch (b$.key) {
      case "ArrowUp": {
        b$.preventDefault(), M$(!0), Y$ ? sE() : OS();
        break;
      }
      case "ArrowDown": {
        b$.preventDefault(), M$(!0), Y$ ? OS() : sE();
        break;
      }
      case "Enter": {
        b$.preventDefault(), dS[VS] && lS ? pE(dS[VS]) : M$(!0);
        break;
      }
      case " ": {
        Au || (b$.preventDefault(), dS[VS] && lS ? pE(dS[VS]) : M$(!0));
        break;
      }
      case "Backspace": {
        D$.length > 0 && k$.length === 0 && (xE(D$.slice(0, -1)), M$(!0), o$ && (LS.current = !1));
        break;
      }
      case "Home": {
        if (!Au) {
          b$.preventDefault(), lS || M$(!0);
          const lE = dS.findIndex((WS) => !WS.disabled);
          O$(lE), wE({
            alignment: Y$ ? "end" : "start"
          });
        }
        break;
      }
      case "End": {
        if (!Au) {
          b$.preventDefault(), lS || M$(!0);
          const lE = dS.map((WS) => !!WS.disabled).lastIndexOf(!1);
          O$(lE), wE({
            alignment: Y$ ? "end" : "start"
          });
        }
        break;
      }
      case "Escape":
        M$(!1);
    }
  }, vC = D$.map((b$) => {
    let Y$ = uS.find((OS) => OS.value === b$ && !OS.disabled);
    return !Y$ && YE && (Y$ = {
      value: b$,
      label: b$
    }), Y$;
  }).filter((b$) => !!b$).map((b$, Y$) => /* @__PURE__ */ React.createElement(Bs, __spreadProps$B(__spreadValues$Z({}, b$), {
    variant: mm,
    disabled: _m,
    className: rS.value,
    readOnly: cS,
    onRemove: (OS) => {
      OS.preventDefault(), OS.stopPropagation(), xM(b$.value);
    },
    key: b$.value,
    size: Cr,
    styles: Ms,
    classNames: Yr,
    radius: wm,
    index: Y$
  }))), MM = (b$) => D$.includes(b$), CM = () => {
    var b$;
    yS(""), xE([]), (b$ = hS.current) == null || b$.focus(), o$ && (LS.current = !1);
  }, RE = !cS && (dS.length > 0 ? lS : lS && !!Pl);
  return useDidUpdate(() => {
    const b$ = RE ? i$ : Pm;
    typeof b$ == "function" && b$();
  }, [RE]), /* @__PURE__ */ React.createElement(Input.Wrapper, __spreadValues$Z(__spreadValues$Z({
    required: kn,
    id: gS,
    label: Kn,
    error: kr,
    description: er,
    size: Cr,
    className: $n,
    style: Sn,
    classNames: Yr,
    styles: Ms,
    __staticSelector: "MultiSelect",
    sx: km,
    errorProps: _$,
    descriptionProps: n$,
    labelProps: a$,
    inputContainer: wS,
    inputWrapperOrder: aS,
    unstyled: z$,
    withAsterisk: $S,
    variant: mm
  }, G$), Ds), /* @__PURE__ */ React.createElement(SelectPopover, {
    opened: RE,
    transitionProps: Ys,
    shadow: "sm",
    withinPortal: u$,
    portalProps: h$,
    __staticSelector: "MultiSelect",
    onDirectionChange: R$,
    switchDirectionOnFlip: d$,
    zIndex: v$,
    dropdownPosition: l$,
    positionDependencies: [...j$, k$],
    classNames: Yr,
    styles: Ms,
    unstyled: z$,
    variant: mm
  }, /* @__PURE__ */ React.createElement(SelectPopover.Target, null, /* @__PURE__ */ React.createElement("div", {
    className: rS.wrapper,
    role: "combobox",
    "aria-haspopup": "listbox",
    "aria-owns": lS && RE ? `${gS}-items` : null,
    "aria-controls": gS,
    "aria-expanded": lS,
    onMouseLeave: () => O$(-1),
    tabIndex: -1
  }, /* @__PURE__ */ React.createElement("input", {
    type: "hidden",
    name: s$,
    value: D$.join(","),
    form: m$,
    disabled: _m
  }), /* @__PURE__ */ React.createElement(Input, __spreadValues$Z({
    __staticSelector: "MultiSelect",
    style: { overflow: "hidden" },
    component: "div",
    multiline: !0,
    size: Cr,
    variant: mm,
    disabled: _m,
    error: kr,
    required: kn,
    radius: wm,
    icon: Nm,
    unstyled: z$,
    onMouseDown: (b$) => {
      var Y$;
      b$.preventDefault(), !_m && !LS.current && M$(!lS), (Y$ = hS.current) == null || Y$.focus();
    },
    classNames: __spreadProps$B(__spreadValues$Z({}, Yr), {
      input: sS({ [rS.input]: !Au }, Yr == null ? void 0 : Yr.input)
    })
  }, getSelectRightSectionProps({
    theme: PS,
    rightSection: Cm,
    rightSectionWidth: Im,
    styles: Ms,
    size: Cr,
    shouldClear: Yu && D$.length > 0,
    onClear: CM,
    error: kr,
    disabled: _m,
    clearButtonProps: B$,
    readOnly: cS
  })), /* @__PURE__ */ React.createElement("div", {
    className: rS.values,
    "data-clearable": Yu || void 0
  }, vC, /* @__PURE__ */ React.createElement("input", __spreadValues$Z({
    ref: useMergedRef(Qt, hS),
    type: "search",
    id: gS,
    className: sS(rS.searchInput, {
      [rS.searchInputPointer]: !Au,
      [rS.searchInputInputHidden]: !lS && D$.length > 0 || !Au && D$.length > 0,
      [rS.searchInputEmpty]: D$.length === 0
    }),
    onKeyDown: yC,
    value: k$,
    onChange: hC,
    onFocus: gC,
    onBlur: mC,
    readOnly: !Au || LS.current || cS,
    placeholder: D$.length === 0 ? Nu : void 0,
    disabled: _m,
    "data-mantine-stop-propagation": lS,
    autoComplete: "off",
    onCompositionStart: () => WE(!0),
    onCompositionEnd: () => WE(!1)
  }, tS)))))), /* @__PURE__ */ React.createElement(SelectPopover.Dropdown, {
    component: zm || SelectScrollArea,
    maxHeight: El,
    direction: U$,
    id: gS,
    innerRef: lM,
    __staticSelector: "MultiSelect",
    classNames: Yr,
    styles: Ms
  }, /* @__PURE__ */ React.createElement(SelectItems, {
    data: dS,
    hovered: VS,
    classNames: Yr,
    styles: Ms,
    uuid: gS,
    __staticSelector: "MultiSelect",
    onItemHover: O$,
    onItemSelect: pE,
    itemsRefs: aE,
    itemComponent: Hs,
    size: Cr,
    nothingFound: Pl,
    isItemSelected: MM,
    creatable: Am && !!g$,
    createLabel: g$,
    unstyled: z$,
    variant: mm
  }))));
});
MultiSelect.displayName = "@mantine/core/MultiSelect";
var __defProp$Y = Object.defineProperty, __defProps$A = Object.defineProperties, __getOwnPropDescs$A = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$Z = Object.getOwnPropertySymbols, __hasOwnProp$Z = Object.prototype.hasOwnProperty, __propIsEnum$Z = Object.prototype.propertyIsEnumerable, __defNormalProp$Y = (_e, Qt, Zt) => Qt in _e ? __defProp$Y(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$Y = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$Z.call(Qt, Zt) && __defNormalProp$Y(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$Z)
    for (var Zt of __getOwnPropSymbols$Z(Qt))
      __propIsEnum$Z.call(Qt, Zt) && __defNormalProp$Y(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$A = (_e, Qt) => __defProps$A(_e, __getOwnPropDescs$A(Qt)), __objRest$I = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$Z.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$Z)
    for (var $n of __getOwnPropSymbols$Z(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$Z.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$C = {
  type: "text",
  size: "sm",
  __staticSelector: "TextInput"
}, TextInput = reactExports.forwardRef((_e, Qt) => {
  const Zt = useInputProps("TextInput", defaultProps$C, _e), { inputProps: $n, wrapperProps: Sn } = Zt, kn = __objRest$I(Zt, ["inputProps", "wrapperProps"]);
  return /* @__PURE__ */ React.createElement(Input.Wrapper, __spreadValues$Y({}, Sn), /* @__PURE__ */ React.createElement(Input, __spreadProps$A(__spreadValues$Y(__spreadValues$Y({}, $n), kn), {
    ref: Qt
  })));
});
TextInput.displayName = "@mantine/core/TextInput";
const [PaginationProvider, usePaginationContext] = createSafeContext("Pagination.Root component was not found in tree"), defaultProps$B = {
  siblings: 1,
  boundaries: 1
};
function PaginationRoot(_e) {
  const {
    total: Qt,
    value: Zt,
    defaultValue: $n,
    onChange: Sn,
    disabled: kn,
    children: Kn,
    siblings: er,
    boundaries: Cr,
    color: kr,
    radius: Yr,
    onNextPage: Ms,
    onPreviousPage: Ds,
    onFirstPage: Ls,
    onLastPage: js,
    getItemProps: zs,
    classNames: Fs,
    styles: Bs,
    unstyled: Hs,
    variant: Ws,
    size: Ys
  } = useComponentDefaultProps("PaginationRoot", defaultProps$B, _e), { range: El, setPage: Mu, next: Pl, previous: Iu, active: Tu, first: Au, last: Nu } = usePagination({
    page: Zt,
    initialPage: $n,
    onChange: Sn,
    total: Qt,
    siblings: er,
    boundaries: Cr
  }), gm = createEventHandler(Ms, Pl), pm = createEventHandler(Ds, Iu), zu = createEventHandler(Ls, Au), Yu = createEventHandler(js, Nu);
  return /* @__PURE__ */ React.createElement(PaginationProvider, {
    value: {
      total: Qt,
      range: El,
      active: Tu,
      disabled: kn,
      color: kr,
      radius: Yr,
      getItemProps: zs,
      onChange: Mu,
      onNext: gm,
      onPrevious: pm,
      onFirst: zu,
      onLast: Yu,
      stylesApi: {
        name: "Pagination",
        classNames: Fs,
        styles: Bs,
        unstyled: Hs,
        variant: Ws,
        size: Ys
      }
    }
  }, Kn);
}
const sizes$6 = {
  xs: rem$1(22),
  sm: rem$1(26),
  md: rem$1(32),
  lg: rem$1(38),
  xl: rem$1(44)
};
var useStyles$18 = createStyles((_e, { color: Qt, radius: Zt, withPadding: $n }, { size: Sn }) => {
  const kn = _e.fn.variant({ color: Qt, variant: "filled" });
  return {
    control: {
      cursor: "pointer",
      userSelect: "none",
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      border: `${rem$1(1)} solid ${_e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[4]}`,
      color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
      height: getSize$1({ size: Sn, sizes: sizes$6 }),
      minWidth: getSize$1({ size: Sn, sizes: sizes$6 }),
      padding: $n ? `0 calc(${getSize$1({ size: Sn, sizes: _e.spacing })} / 2)` : void 0,
      fontSize: getSize$1({ size: Sn, sizes: _e.fontSizes }),
      borderRadius: _e.fn.radius(Zt),
      lineHeight: 1,
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.white,
      "&:not([data-disabled])": _e.fn.hover({
        backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[0]
      }),
      "&:active:not([data-disabled])": _e.activeStyles,
      "&[data-disabled]": {
        opacity: 0.4,
        cursor: "not-allowed",
        pointerEvents: "none"
      },
      "&[data-active]": {
        borderColor: "transparent",
        color: kn.color,
        backgroundColor: kn.background,
        "&:not([data-disabled])": _e.fn.hover({
          backgroundColor: kn.hover
        })
      }
    }
  };
});
const useStyles$19 = useStyles$18;
var __defProp$X = Object.defineProperty, __defProps$z = Object.defineProperties, __getOwnPropDescs$z = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$Y = Object.getOwnPropertySymbols, __hasOwnProp$Y = Object.prototype.hasOwnProperty, __propIsEnum$Y = Object.prototype.propertyIsEnumerable, __defNormalProp$X = (_e, Qt, Zt) => Qt in _e ? __defProp$X(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$X = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$Y.call(Qt, Zt) && __defNormalProp$X(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$Y)
    for (var Zt of __getOwnPropSymbols$Y(Qt))
      __propIsEnum$Y.call(Qt, Zt) && __defNormalProp$X(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$z = (_e, Qt) => __defProps$z(_e, __getOwnPropDescs$z(Qt)), __objRest$H = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$Y.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$Y)
    for (var $n of __getOwnPropSymbols$Y(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$Y.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$A = {
  withPadding: !0
}, PaginationControl = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("PaginationControl", defaultProps$A, _e), { active: $n, className: Sn, disabled: kn, withPadding: Kn } = Zt, er = __objRest$H(Zt, ["active", "className", "disabled", "withPadding"]), Cr = usePaginationContext(), { classes: kr, cx: Yr } = useStyles$19({ color: Cr.color, radius: Cr.radius, withPadding: Kn }, Cr.stylesApi);
  return /* @__PURE__ */ React.createElement(UnstyledButton, __spreadProps$z(__spreadValues$X({}, er), {
    disabled: kn,
    "data-active": $n || void 0,
    "data-disabled": kn || void 0,
    ref: Qt,
    className: Yr(kr.control, Sn)
  }));
});
PaginationControl.displayName = "@mantine/core/PaginationControl";
var __defProp$W = Object.defineProperty, __defProps$y = Object.defineProperties, __getOwnPropDescs$y = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$X = Object.getOwnPropertySymbols, __hasOwnProp$X = Object.prototype.hasOwnProperty, __propIsEnum$X = Object.prototype.propertyIsEnumerable, __defNormalProp$W = (_e, Qt, Zt) => Qt in _e ? __defProp$W(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$W = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$X.call(Qt, Zt) && __defNormalProp$W(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$X)
    for (var Zt of __getOwnPropSymbols$X(Qt))
      __propIsEnum$X.call(Qt, Zt) && __defNormalProp$W(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$y = (_e, Qt) => __defProps$y(_e, __getOwnPropDescs$y(Qt)), __objRest$G = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$X.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$X)
    for (var $n of __getOwnPropSymbols$X(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$X.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function getIconSize(_e) {
  return `calc(${getSize$1({ size: _e, sizes: sizes$6 })} / 2)`;
}
function PaginationIcon(_e) {
  var Qt = _e, { size: Zt, style: $n, children: Sn, path: kn } = Qt, Kn = __objRest$G(Qt, ["size", "style", "children", "path"]);
  return /* @__PURE__ */ React.createElement("svg", __spreadValues$W({
    viewBox: "0 0 16 16",
    xmlns: "http://www.w3.org/2000/svg",
    style: __spreadValues$W({ width: Zt, height: Zt }, $n)
  }, Kn), /* @__PURE__ */ React.createElement("path", {
    d: kn,
    fill: "currentColor"
  }));
}
const PaginationNextIcon = (_e) => /* @__PURE__ */ React.createElement(PaginationIcon, __spreadProps$y(__spreadValues$W({}, _e), {
  path: "M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z"
})), PaginationPreviousIcon = (_e) => /* @__PURE__ */ React.createElement(PaginationIcon, __spreadProps$y(__spreadValues$W({}, _e), {
  path: "M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z"
})), PaginationFirstIcon = (_e) => /* @__PURE__ */ React.createElement(PaginationIcon, __spreadProps$y(__spreadValues$W({}, _e), {
  path: "M6.85355 3.85355C7.04882 3.65829 7.04882 3.34171 6.85355 3.14645C6.65829 2.95118 6.34171 2.95118 6.14645 3.14645L2.14645 7.14645C1.95118 7.34171 1.95118 7.65829 2.14645 7.85355L6.14645 11.8536C6.34171 12.0488 6.65829 12.0488 6.85355 11.8536C7.04882 11.6583 7.04882 11.3417 6.85355 11.1464L3.20711 7.5L6.85355 3.85355ZM12.8536 3.85355C13.0488 3.65829 13.0488 3.34171 12.8536 3.14645C12.6583 2.95118 12.3417 2.95118 12.1464 3.14645L8.14645 7.14645C7.95118 7.34171 7.95118 7.65829 8.14645 7.85355L12.1464 11.8536C12.3417 12.0488 12.6583 12.0488 12.8536 11.8536C13.0488 11.6583 13.0488 11.3417 12.8536 11.1464L9.20711 7.5L12.8536 3.85355Z"
})), PaginationLastIcon = (_e) => /* @__PURE__ */ React.createElement(PaginationIcon, __spreadProps$y(__spreadValues$W({}, _e), {
  path: "M2.14645 11.1464C1.95118 11.3417 1.95118 11.6583 2.14645 11.8536C2.34171 12.0488 2.65829 12.0488 2.85355 11.8536L6.85355 7.85355C7.04882 7.65829 7.04882 7.34171 6.85355 7.14645L2.85355 3.14645C2.65829 2.95118 2.34171 2.95118 2.14645 3.14645C1.95118 3.34171 1.95118 3.65829 2.14645 3.85355L5.79289 7.5L2.14645 11.1464ZM8.14645 11.1464C7.95118 11.3417 7.95118 11.6583 8.14645 11.8536C8.34171 12.0488 8.65829 12.0488 8.85355 11.8536L12.8536 7.85355C13.0488 7.65829 13.0488 7.34171 12.8536 7.14645L8.85355 3.14645C8.65829 2.95118 8.34171 2.95118 8.14645 3.14645C7.95118 3.34171 7.95118 3.65829 8.14645 3.85355L11.7929 7.5L8.14645 11.1464Z"
})), PaginationDotsIcon = (_e) => /* @__PURE__ */ React.createElement(PaginationIcon, __spreadProps$y(__spreadValues$W({}, _e), {
  path: "M2 8c0-.733.6-1.333 1.333-1.333.734 0 1.334.6 1.334 1.333s-.6 1.333-1.334 1.333C2.6 9.333 2 8.733 2 8zm9.333 0c0-.733.6-1.333 1.334-1.333C13.4 6.667 14 7.267 14 8s-.6 1.333-1.333 1.333c-.734 0-1.334-.6-1.334-1.333zM6.667 8c0-.733.6-1.333 1.333-1.333s1.333.6 1.333 1.333S8.733 9.333 8 9.333 6.667 8.733 6.667 8z"
}));
var useStyles$16 = createStyles((_e, Qt, { size: Zt }) => ({
  dots: {
    height: getSize$1({ size: Zt, sizes: sizes$6 }),
    minWidth: getSize$1({ size: Zt, sizes: sizes$6 }),
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    pointerEvents: "none"
  }
}));
const useStyles$17 = useStyles$16;
var __defProp$V = Object.defineProperty, __getOwnPropSymbols$W = Object.getOwnPropertySymbols, __hasOwnProp$W = Object.prototype.hasOwnProperty, __propIsEnum$W = Object.prototype.propertyIsEnumerable, __defNormalProp$V = (_e, Qt, Zt) => Qt in _e ? __defProp$V(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$V = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$W.call(Qt, Zt) && __defNormalProp$V(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$W)
    for (var Zt of __getOwnPropSymbols$W(Qt))
      __propIsEnum$W.call(Qt, Zt) && __defNormalProp$V(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$F = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$W.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$W)
    for (var $n of __getOwnPropSymbols$W(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$W.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$z = {
  icon: PaginationDotsIcon
}, PaginationDots = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("PaginationDots", defaultProps$z, _e), {
    className: $n,
    icon: Sn
  } = Zt, kn = __objRest$F(Zt, [
    "className",
    "icon"
  ]), Kn = usePaginationContext(), { classes: er, cx: Cr } = useStyles$17(null, Kn.stylesApi);
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$V({
    ref: Qt,
    className: Cr(er.dots, $n)
  }, kn), /* @__PURE__ */ React.createElement(Sn, {
    size: getIconSize(Kn.stylesApi.size)
  }));
});
PaginationDots.displayName = "@mantine/core/PaginationDots";
var __defProp$U = Object.defineProperty, __getOwnPropSymbols$V = Object.getOwnPropertySymbols, __hasOwnProp$V = Object.prototype.hasOwnProperty, __propIsEnum$V = Object.prototype.propertyIsEnumerable, __defNormalProp$U = (_e, Qt, Zt) => Qt in _e ? __defProp$U(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$U = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$V.call(Qt, Zt) && __defNormalProp$U(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$V)
    for (var Zt of __getOwnPropSymbols$V(Qt))
      __propIsEnum$V.call(Qt, Zt) && __defNormalProp$U(_e, Zt, Qt[Zt]);
  return _e;
};
function PaginationItems({ dotsIcon: _e }) {
  const Qt = usePaginationContext(), Zt = Qt.range.map(($n, Sn) => {
    var kn;
    return $n === "dots" ? /* @__PURE__ */ React.createElement(PaginationDots, {
      icon: _e,
      key: Sn
    }) : /* @__PURE__ */ React.createElement(PaginationControl, __spreadValues$U({
      key: Sn,
      active: $n === Qt.active,
      "aria-current": $n === Qt.active ? "page" : void 0,
      onClick: () => Qt.onChange($n),
      disabled: Qt.disabled
    }, (kn = Qt.getItemProps) == null ? void 0 : kn.call(Qt, $n)), $n);
  });
  return /* @__PURE__ */ React.createElement(React.Fragment, null, Zt);
}
PaginationItems.displayName = "@mantine/core/PaginationItems";
var useStyles$14 = createStyles((_e) => ({
  icon: {
    transform: _e.dir === "rtl" ? "rotate(180deg)" : "unset"
  }
}));
const useStyles$15 = useStyles$14;
var __defProp$T = Object.defineProperty, __getOwnPropSymbols$U = Object.getOwnPropertySymbols, __hasOwnProp$U = Object.prototype.hasOwnProperty, __propIsEnum$U = Object.prototype.propertyIsEnumerable, __defNormalProp$T = (_e, Qt, Zt) => Qt in _e ? __defProp$T(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$T = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$U.call(Qt, Zt) && __defNormalProp$T(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$U)
    for (var Zt of __getOwnPropSymbols$U(Qt))
      __propIsEnum$U.call(Qt, Zt) && __defNormalProp$T(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$E = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$U.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$U)
    for (var $n of __getOwnPropSymbols$U(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$U.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function createEdgeComponent({ icon: _e, name: Qt, action: Zt, type: $n }) {
  const Sn = { icon: _e }, kn = reactExports.forwardRef((Kn, er) => {
    const Cr = useComponentDefaultProps(Qt, Sn, Kn), { icon: kr } = Cr, Yr = __objRest$E(Cr, ["icon"]), { classes: Ms } = useStyles$15(), Ds = usePaginationContext(), Ls = $n === "next" ? Ds.active === Ds.total : Ds.active === 1;
    return /* @__PURE__ */ React.createElement(PaginationControl, __spreadValues$T({
      disabled: Ds.disabled || Ls,
      ref: er,
      onClick: Ds[Zt],
      withPadding: !1
    }, Yr), /* @__PURE__ */ React.createElement(kr, {
      className: Ms.icon,
      size: getIconSize(Ds.stylesApi.size)
    }));
  });
  return kn.displayName = `@mantine/core/${Qt}`, kn;
}
const PaginationNext = createEdgeComponent({
  icon: PaginationNextIcon,
  name: "PaginationNext",
  action: "onNext",
  type: "next"
}), PaginationPrevious = createEdgeComponent({
  icon: PaginationPreviousIcon,
  name: "PaginationPrevious",
  action: "onPrevious",
  type: "previous"
}), PaginationFirst = createEdgeComponent({
  icon: PaginationFirstIcon,
  name: "PaginationFirst",
  action: "onFirst",
  type: "previous"
}), PaginationLast = createEdgeComponent({
  icon: PaginationLastIcon,
  name: "PaginationLast",
  action: "onLast",
  type: "next"
});
var __defProp$S = Object.defineProperty, __getOwnPropSymbols$T = Object.getOwnPropertySymbols, __hasOwnProp$T = Object.prototype.hasOwnProperty, __propIsEnum$T = Object.prototype.propertyIsEnumerable, __defNormalProp$S = (_e, Qt, Zt) => Qt in _e ? __defProp$S(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$S = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$T.call(Qt, Zt) && __defNormalProp$S(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$T)
    for (var Zt of __getOwnPropSymbols$T(Qt))
      __propIsEnum$T.call(Qt, Zt) && __defNormalProp$S(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$D = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$T.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$T)
    for (var $n of __getOwnPropSymbols$T(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$T.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$y = {
  withControls: !0,
  siblings: 1,
  boundaries: 1
};
function Pagination$1(_e) {
  const Qt = useComponentDefaultProps("Pagination", defaultProps$y, _e), {
    withEdges: Zt,
    withControls: $n,
    classNames: Sn,
    styles: kn,
    unstyled: Kn,
    variant: er,
    size: Cr,
    total: kr,
    value: Yr,
    defaultValue: Ms,
    onChange: Ds,
    disabled: Ls,
    siblings: js,
    boundaries: zs,
    color: Fs,
    radius: Bs,
    onNextPage: Hs,
    onPreviousPage: Ws,
    onFirstPage: Ys,
    onLastPage: El,
    getItemProps: Mu,
    getControlProps: Pl,
    spacing: Iu,
    nextIcon: Tu,
    previousIcon: Au,
    lastIcon: Nu,
    firstIcon: gm,
    dotsIcon: pm
  } = Qt, zu = __objRest$D(Qt, [
    "withEdges",
    "withControls",
    "classNames",
    "styles",
    "unstyled",
    "variant",
    "size",
    "total",
    "value",
    "defaultValue",
    "onChange",
    "disabled",
    "siblings",
    "boundaries",
    "color",
    "radius",
    "onNextPage",
    "onPreviousPage",
    "onFirstPage",
    "onLastPage",
    "getItemProps",
    "getControlProps",
    "spacing",
    "nextIcon",
    "previousIcon",
    "lastIcon",
    "firstIcon",
    "dotsIcon"
  ]), Yu = useMantineTheme();
  return kr <= 0 ? null : /* @__PURE__ */ React.createElement(PaginationRoot, {
    classNames: Sn,
    styles: kn,
    unstyled: Kn,
    variant: er,
    size: Cr,
    total: kr,
    value: Yr,
    defaultValue: Ms,
    onChange: Ds,
    disabled: Ls,
    siblings: js,
    boundaries: zs,
    color: Fs,
    radius: Bs,
    onNextPage: Hs,
    onPreviousPage: Ws,
    onFirstPage: Ys,
    onLastPage: El,
    getItemProps: Mu
  }, /* @__PURE__ */ React.createElement(Group$1, __spreadValues$S({
    spacing: Iu ?? `calc(${getSize$1({ size: Cr, sizes: Yu.spacing })} / 2)`
  }, zu), Zt && /* @__PURE__ */ React.createElement(PaginationFirst, __spreadValues$S({
    icon: gm
  }, Pl == null ? void 0 : Pl("first"))), $n && /* @__PURE__ */ React.createElement(PaginationPrevious, __spreadValues$S({
    icon: Au
  }, Pl == null ? void 0 : Pl("previous"))), /* @__PURE__ */ React.createElement(PaginationItems, {
    dotsIcon: pm
  }), $n && /* @__PURE__ */ React.createElement(PaginationNext, __spreadValues$S({
    icon: Tu
  }, Pl == null ? void 0 : Pl("next"))), Zt && /* @__PURE__ */ React.createElement(PaginationLast, __spreadValues$S({
    icon: Nu
  }, Pl == null ? void 0 : Pl("last")))));
}
Pagination$1.displayName = "@mantine/core/Pagination";
Pagination$1.Root = PaginationRoot;
Pagination$1.Items = PaginationItems;
Pagination$1.Control = PaginationControl;
Pagination$1.Dots = PaginationDots;
Pagination$1.Next = PaginationNext;
Pagination$1.Previous = PaginationPrevious;
Pagination$1.Last = PaginationLast;
Pagination$1.First = PaginationFirst;
const sizes$5 = {
  xs: rem$1(3),
  sm: rem$1(5),
  md: rem$1(8),
  lg: rem$1(12),
  xl: rem$1(16)
}, stripesAnimation = keyframes({
  from: { backgroundPosition: "0 0" },
  to: { backgroundPosition: `${rem$1(40)} 0` }
});
var useStyles$12 = createStyles((_e, { color: Qt, radius: Zt }, { size: $n }) => ({
  root: {
    position: "relative",
    height: getSize$1({ size: $n, sizes: sizes$5 }),
    backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2],
    borderRadius: _e.fn.radius(Zt),
    overflow: "hidden"
  },
  bar: {
    position: "absolute",
    top: 0,
    bottom: 0,
    left: 0,
    height: "100%",
    display: "flex",
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: _e.fn.variant({
      variant: "filled",
      primaryFallback: !1,
      color: Qt || _e.primaryColor
    }).background,
    transition: "width 100ms linear",
    "&[data-animate]": {
      animation: `${stripesAnimation} 1000ms linear infinite`
    },
    "&[data-striped]": {
      backgroundSize: `${rem$1(20)} ${rem$1(20)}`,
      backgroundImage: "linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent)"
    },
    "&:last-of-type": {
      borderTopRightRadius: _e.fn.radius(Zt),
      borderBottomRightRadius: _e.fn.radius(Zt)
    },
    "&:first-of-type": {
      borderTopLeftRadius: _e.fn.radius(Zt),
      borderBottomLeftRadius: _e.fn.radius(Zt)
    },
    "@media (prefers-reduced-motion)": {
      transitionDuration: _e.respectReducedMotion ? "0ms" : void 0
    }
  },
  label: {
    color: _e.white,
    fontSize: `calc(${getSize$1({ size: $n, sizes: sizes$5 })} * 0.65)`,
    fontWeight: 700,
    userSelect: "none",
    overflow: "hidden",
    whiteSpace: "nowrap"
  }
}));
const useStyles$13 = useStyles$12, TooltipGroupContext = reactExports.createContext(!1), TooltipGroupProvider = TooltipGroupContext.Provider, useTooltipGroupContext = () => reactExports.useContext(TooltipGroupContext);
function TooltipGroup({ children: _e, openDelay: Qt = 0, closeDelay: Zt = 0 }) {
  return /* @__PURE__ */ React.createElement(TooltipGroupProvider, {
    value: !0
  }, /* @__PURE__ */ React.createElement(FloatingDelayGroup, {
    delay: { open: Qt, close: Zt }
  }, _e));
}
TooltipGroup.displayName = "@mantine/core/TooltipGroup";
var __defProp$R = Object.defineProperty, __defProps$x = Object.defineProperties, __getOwnPropDescs$x = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$S = Object.getOwnPropertySymbols, __hasOwnProp$S = Object.prototype.hasOwnProperty, __propIsEnum$S = Object.prototype.propertyIsEnumerable, __defNormalProp$R = (_e, Qt, Zt) => Qt in _e ? __defProp$R(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$R = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$S.call(Qt, Zt) && __defNormalProp$R(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$S)
    for (var Zt of __getOwnPropSymbols$S(Qt))
      __propIsEnum$S.call(Qt, Zt) && __defNormalProp$R(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$x = (_e, Qt) => __defProps$x(_e, __getOwnPropDescs$x(Qt));
function getColors(_e, Qt) {
  if (!Qt)
    return {
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.gray[2] : _e.colors.gray[9],
      color: _e.colorScheme === "dark" ? _e.black : _e.white
    };
  const Zt = _e.fn.variant({ variant: "filled", color: Qt, primaryFallback: !1 });
  return {
    backgroundColor: Zt.background,
    color: Zt.color
  };
}
var useStyles$10 = createStyles((_e, { color: Qt, radius: Zt, width: $n, multiline: Sn }) => ({
  tooltip: __spreadProps$x(__spreadValues$R(__spreadValues$R({}, _e.fn.fontStyles()), getColors(_e, Qt)), {
    lineHeight: _e.lineHeight,
    fontSize: _e.fontSizes.sm,
    borderRadius: _e.fn.radius(Zt),
    padding: `calc(${_e.spacing.xs} / 2) ${_e.spacing.xs}`,
    position: "absolute",
    whiteSpace: Sn ? "unset" : "nowrap",
    pointerEvents: "none",
    width: $n
  }),
  arrow: {
    backgroundColor: "inherit",
    border: 0,
    zIndex: 1
  }
}));
const useStyles$11 = useStyles$10, TOOLTIP_ERRORS = {
  children: "Tooltip component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported"
};
function useFloatingTooltip({
  offset: _e,
  position: Qt
}) {
  const [Zt, $n] = reactExports.useState(!1), Sn = reactExports.useRef(), { x: kn, y: Kn, reference: er, floating: Cr, refs: kr, update: Yr, placement: Ms } = useFloating({
    placement: Qt,
    middleware: [
      shift$1({
        crossAxis: !0,
        padding: 5,
        rootBoundary: "document"
      })
    ]
  }), Ds = Ms.includes("right") ? _e : Qt.includes("left") ? _e * -1 : 0, Ls = Ms.includes("bottom") ? _e : Qt.includes("top") ? _e * -1 : 0, js = reactExports.useCallback(({ clientX: zs, clientY: Fs }) => {
    er({
      getBoundingClientRect() {
        return {
          width: 0,
          height: 0,
          x: zs,
          y: Fs,
          left: zs + Ds,
          top: Fs + Ls,
          right: zs,
          bottom: Fs
        };
      }
    });
  }, [er]);
  return reactExports.useEffect(() => {
    if (kr.floating.current) {
      const zs = Sn.current;
      zs.addEventListener("mousemove", js);
      const Fs = getOverflowAncestors(kr.floating.current);
      return Fs.forEach((Bs) => {
        Bs.addEventListener("scroll", Yr);
      }), () => {
        zs.removeEventListener("mousemove", js), Fs.forEach((Bs) => {
          Bs.removeEventListener("scroll", Yr);
        });
      };
    }
  }, [er, kr.floating.current, Yr, js, Zt]), { handleMouseMove: js, x: kn, y: Kn, opened: Zt, setOpened: $n, boundaryRef: Sn, floating: Cr };
}
var __defProp$Q = Object.defineProperty, __defProps$w = Object.defineProperties, __getOwnPropDescs$w = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$R = Object.getOwnPropertySymbols, __hasOwnProp$R = Object.prototype.hasOwnProperty, __propIsEnum$R = Object.prototype.propertyIsEnumerable, __defNormalProp$Q = (_e, Qt, Zt) => Qt in _e ? __defProp$Q(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$Q = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$R.call(Qt, Zt) && __defNormalProp$Q(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$R)
    for (var Zt of __getOwnPropSymbols$R(Qt))
      __propIsEnum$R.call(Qt, Zt) && __defNormalProp$Q(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$w = (_e, Qt) => __defProps$w(_e, __getOwnPropDescs$w(Qt)), __objRest$C = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$R.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$R)
    for (var $n of __getOwnPropSymbols$R(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$R.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$x = {
  refProp: "ref",
  withinPortal: !0,
  offset: 10,
  position: "right",
  zIndex: getDefaultZIndex("popover")
};
function TooltipFloating(_e) {
  var Qt;
  const Zt = useComponentDefaultProps("TooltipFloating", defaultProps$x, _e), {
    children: $n,
    refProp: Sn,
    withinPortal: kn,
    portalProps: Kn,
    style: er,
    className: Cr,
    classNames: kr,
    styles: Yr,
    unstyled: Ms,
    radius: Ds,
    color: Ls,
    label: js,
    offset: zs,
    position: Fs,
    multiline: Bs,
    width: Hs,
    zIndex: Ws,
    disabled: Ys,
    variant: El
  } = Zt, Mu = __objRest$C(Zt, [
    "children",
    "refProp",
    "withinPortal",
    "portalProps",
    "style",
    "className",
    "classNames",
    "styles",
    "unstyled",
    "radius",
    "color",
    "label",
    "offset",
    "position",
    "multiline",
    "width",
    "zIndex",
    "disabled",
    "variant"
  ]), { handleMouseMove: Pl, x: Iu, y: Tu, opened: Au, boundaryRef: Nu, floating: gm, setOpened: pm } = useFloatingTooltip({
    offset: zs,
    position: Fs
  }), { classes: zu, cx: Yu } = useStyles$11({ radius: Ds, color: Ls, multiline: Bs, width: Hs }, { name: "TooltipFloating", classNames: kr, styles: Yr, unstyled: Ms, variant: El });
  if (!isElement$3($n))
    throw new Error(TOOLTIP_ERRORS.children);
  const sm = useMergedRef(Nu, $n.ref), mm = (ym) => {
    var _m, Sm;
    (Sm = (_m = $n.props).onMouseEnter) == null || Sm.call(_m, ym), Pl(ym), pm(!0);
  }, hm = (ym) => {
    var _m, Sm;
    (Sm = (_m = $n.props).onMouseLeave) == null || Sm.call(_m, ym), pm(!1);
  };
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(OptionalPortal, __spreadProps$w(__spreadValues$Q({}, Kn), {
    withinPortal: kn
  }), /* @__PURE__ */ React.createElement(Box, __spreadProps$w(__spreadValues$Q({}, Mu), {
    ref: gm,
    className: Yu(zu.tooltip, Cr),
    style: __spreadProps$w(__spreadValues$Q({}, er), {
      zIndex: Ws,
      display: !Ys && Au ? "block" : "none",
      top: Tu ?? "",
      left: (Qt = Math.round(Iu)) != null ? Qt : ""
    })
  }), js)), reactExports.cloneElement($n, __spreadProps$w(__spreadValues$Q({}, $n.props), {
    [Sn]: sm,
    onMouseEnter: mm,
    onMouseLeave: hm
  })));
}
TooltipFloating.displayName = "@mantine/core/TooltipFloating";
function useTooltip(_e) {
  const [Qt, Zt] = reactExports.useState(!1), Sn = typeof _e.opened == "boolean" ? _e.opened : Qt, kn = useTooltipGroupContext(), Kn = useId$1(), { delay: er, currentId: Cr, setCurrentId: kr } = useDelayGroupContext(), Yr = reactExports.useCallback((Iu) => {
    Zt(Iu), Iu && kr(Kn);
  }, [kr, Kn]), {
    x: Ms,
    y: Ds,
    reference: Ls,
    floating: js,
    context: zs,
    refs: Fs,
    update: Bs,
    placement: Hs,
    middlewareData: { arrow: { x: Ws, y: Ys } = {} }
  } = useFloating({
    placement: _e.position,
    open: Sn,
    onOpenChange: Yr,
    middleware: [
      offset$4(_e.offset),
      shift$1({ padding: 8 }),
      flip$1(),
      arrow({ element: _e.arrowRef, padding: _e.arrowOffset }),
      ..._e.inline ? [inline()] : []
    ]
  }), { getReferenceProps: El, getFloatingProps: Mu } = useInteractions([
    useHover(zs, {
      enabled: _e.events.hover,
      delay: kn ? er : { open: _e.openDelay, close: _e.closeDelay },
      mouseOnly: !_e.events.touch
    }),
    useFocus(zs, { enabled: _e.events.focus, keyboardOnly: !0 }),
    useRole(zs, { role: "tooltip" }),
    useDismiss(zs, { enabled: typeof _e.opened === void 0 }),
    useDelayGroup(zs, { id: Kn })
  ]);
  return useFloatingAutoUpdate({
    opened: Sn,
    position: _e.position,
    positionDependencies: _e.positionDependencies,
    floating: { refs: Fs, update: Bs }
  }), useDidUpdate(() => {
    var Iu;
    (Iu = _e.onPositionChange) == null || Iu.call(_e, Hs);
  }, [Hs]), {
    x: Ms,
    y: Ds,
    arrowX: Ws,
    arrowY: Ys,
    reference: Ls,
    floating: js,
    getFloatingProps: Mu,
    getReferenceProps: El,
    isGroupPhase: Sn && Cr && Cr !== Kn,
    opened: Sn,
    placement: Hs
  };
}
var __defProp$P = Object.defineProperty, __defProps$v = Object.defineProperties, __getOwnPropDescs$v = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$Q = Object.getOwnPropertySymbols, __hasOwnProp$Q = Object.prototype.hasOwnProperty, __propIsEnum$Q = Object.prototype.propertyIsEnumerable, __defNormalProp$P = (_e, Qt, Zt) => Qt in _e ? __defProp$P(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$P = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$Q.call(Qt, Zt) && __defNormalProp$P(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$Q)
    for (var Zt of __getOwnPropSymbols$Q(Qt))
      __propIsEnum$Q.call(Qt, Zt) && __defNormalProp$P(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$v = (_e, Qt) => __defProps$v(_e, __getOwnPropDescs$v(Qt)), __objRest$B = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$Q.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$Q)
    for (var $n of __getOwnPropSymbols$Q(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$Q.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$w = {
  position: "top",
  refProp: "ref",
  withinPortal: !1,
  inline: !1,
  arrowSize: 4,
  arrowOffset: 5,
  arrowRadius: 0,
  arrowPosition: "side",
  offset: 5,
  transitionProps: { duration: 100, transition: "fade" },
  width: "auto",
  events: { hover: !0, focus: !1, touch: !1 },
  zIndex: getDefaultZIndex("popover"),
  positionDependencies: []
}, _Tooltip = reactExports.forwardRef((_e, Qt) => {
  var Zt;
  const $n = reactExports.useRef(null), Sn = useComponentDefaultProps("Tooltip", defaultProps$w, _e), {
    children: kn,
    position: Kn,
    refProp: er,
    label: Cr,
    openDelay: kr,
    closeDelay: Yr,
    onPositionChange: Ms,
    opened: Ds,
    withinPortal: Ls,
    portalProps: js,
    radius: zs,
    color: Fs,
    classNames: Bs,
    styles: Hs,
    unstyled: Ws,
    style: Ys,
    className: El,
    withArrow: Mu,
    arrowSize: Pl,
    arrowOffset: Iu,
    arrowRadius: Tu,
    arrowPosition: Au,
    offset: Nu,
    transitionProps: gm,
    multiline: pm,
    width: zu,
    events: Yu,
    zIndex: sm,
    disabled: mm,
    positionDependencies: hm,
    onClick: ym,
    onMouseEnter: _m,
    onMouseLeave: Sm,
    inline: wm,
    variant: Nm,
    keepMounted: Cm
  } = Sn, Im = __objRest$B(Sn, [
    "children",
    "position",
    "refProp",
    "label",
    "openDelay",
    "closeDelay",
    "onPositionChange",
    "opened",
    "withinPortal",
    "portalProps",
    "radius",
    "color",
    "classNames",
    "styles",
    "unstyled",
    "style",
    "className",
    "withArrow",
    "arrowSize",
    "arrowOffset",
    "arrowRadius",
    "arrowPosition",
    "offset",
    "transitionProps",
    "multiline",
    "width",
    "events",
    "zIndex",
    "disabled",
    "positionDependencies",
    "onClick",
    "onMouseEnter",
    "onMouseLeave",
    "inline",
    "variant",
    "keepMounted"
  ]), { classes: Am, cx: Vm, theme: Rm } = useStyles$11({ radius: zs, color: Fs, width: zu, multiline: pm }, { name: "Tooltip", classNames: Bs, styles: Hs, unstyled: Ws, variant: Nm }), Dm = useTooltip({
    position: getFloatingPosition(Rm.dir, Kn),
    closeDelay: Yr,
    openDelay: kr,
    onPositionChange: Ms,
    opened: Ds,
    events: Yu,
    arrowRef: $n,
    arrowOffset: Iu,
    offset: Nu + (Mu ? Pl / 2 : 0),
    positionDependencies: [...hm, kn],
    inline: wm
  });
  if (!isElement$3(kn))
    throw new Error(TOOLTIP_ERRORS.children);
  const km = useMergedRef(Dm.reference, kn.ref, Qt);
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(OptionalPortal, __spreadProps$v(__spreadValues$P({}, js), {
    withinPortal: Ls
  }), /* @__PURE__ */ React.createElement(Transition$1, __spreadProps$v(__spreadValues$P({
    keepMounted: Cm,
    mounted: !mm && Dm.opened
  }, gm), {
    transition: gm.transition || "fade",
    duration: Dm.isGroupPhase ? 10 : (Zt = gm.duration) != null ? Zt : 100
  }), (zm) => {
    var Pm, i$;
    return /* @__PURE__ */ React.createElement(Box, __spreadValues$P(__spreadValues$P({}, Im), Dm.getFloatingProps({
      ref: Dm.floating,
      className: Am.tooltip,
      style: __spreadProps$v(__spreadValues$P(__spreadValues$P({}, Ys), zm), {
        zIndex: sm,
        top: (Pm = Dm.y) != null ? Pm : 0,
        left: (i$ = Dm.x) != null ? i$ : 0
      })
    })), Cr, /* @__PURE__ */ React.createElement(FloatingArrow, {
      ref: $n,
      arrowX: Dm.arrowX,
      arrowY: Dm.arrowY,
      visible: Mu,
      position: Dm.placement,
      arrowSize: Pl,
      arrowOffset: Iu,
      arrowRadius: Tu,
      arrowPosition: Au,
      className: Am.arrow
    }));
  })), reactExports.cloneElement(kn, Dm.getReferenceProps(__spreadValues$P({
    onClick: ym,
    onMouseEnter: _m,
    onMouseLeave: Sm,
    onMouseMove: _e.onMouseMove,
    onPointerDown: _e.onPointerDown,
    onPointerEnter: _e.onPointerEnter,
    [er]: km,
    className: Vm(El, kn.props.className)
  }, kn.props))));
});
_Tooltip.Group = TooltipGroup;
_Tooltip.Floating = TooltipFloating;
_Tooltip.displayName = "@mantine/core/Tooltip";
const Tooltip = _Tooltip;
var __defProp$O = Object.defineProperty, __defProps$u = Object.defineProperties, __getOwnPropDescs$u = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$P = Object.getOwnPropertySymbols, __hasOwnProp$P = Object.prototype.hasOwnProperty, __propIsEnum$P = Object.prototype.propertyIsEnumerable, __defNormalProp$O = (_e, Qt, Zt) => Qt in _e ? __defProp$O(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$O = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$P.call(Qt, Zt) && __defNormalProp$O(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$P)
    for (var Zt of __getOwnPropSymbols$P(Qt))
      __propIsEnum$P.call(Qt, Zt) && __defNormalProp$O(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$u = (_e, Qt) => __defProps$u(_e, __getOwnPropDescs$u(Qt)), __objRest$A = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$P.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$P)
    for (var $n of __getOwnPropSymbols$P(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$P.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function getCumulativeSections(_e) {
  return _e.reduce((Qt, Zt) => (Qt.sections.push(__spreadProps$u(__spreadValues$O({}, Zt), { accumulated: Qt.accumulated })), Qt.accumulated += Zt.value, Qt), { accumulated: 0, sections: [] }).sections;
}
const defaultProps$v = {
  size: "md",
  radius: "sm",
  striped: !1,
  animate: !1,
  label: ""
}, Progress = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Progress", defaultProps$v, _e), {
    className: $n,
    value: Sn,
    color: kn,
    size: Kn,
    radius: er,
    striped: Cr,
    animate: kr,
    label: Yr,
    "aria-label": Ms,
    classNames: Ds,
    styles: Ls,
    sections: js,
    unstyled: zs,
    variant: Fs
  } = Zt, Bs = __objRest$A(Zt, [
    "className",
    "value",
    "color",
    "size",
    "radius",
    "striped",
    "animate",
    "label",
    "aria-label",
    "classNames",
    "styles",
    "sections",
    "unstyled",
    "variant"
  ]), { classes: Hs, cx: Ws, theme: Ys } = useStyles$13({ color: kn, radius: er }, { name: "Progress", classNames: Ds, styles: Ls, unstyled: zs, variant: Fs, size: Kn }), El = Array.isArray(js) ? getCumulativeSections(js).map((Mu, Pl) => {
    var Iu = Mu, {
      tooltip: Tu,
      accumulated: Au,
      value: Nu,
      label: gm,
      color: pm
    } = Iu, zu = __objRest$A(Iu, [
      "tooltip",
      "accumulated",
      "value",
      "label",
      "color"
    ]);
    return /* @__PURE__ */ React.createElement(Tooltip.Floating, {
      label: Tu,
      disabled: !Tu,
      key: Pl
    }, /* @__PURE__ */ React.createElement(Box, __spreadProps$u(__spreadValues$O({}, zu), {
      className: Ws(Hs.bar, zu.className),
      "data-striped": Cr || kr || void 0,
      "data-animate": kr || void 0,
      sx: {
        width: `${Nu}%`,
        left: `${Au}%`,
        backgroundColor: Ys.fn.variant({
          variant: "filled",
          primaryFallback: !1,
          color: pm || Ys.primaryColor
        }).background
      }
    }), gm && /* @__PURE__ */ React.createElement(Text, {
      className: Hs.label
    }, gm)));
  }) : null;
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$O({
    className: Ws(Hs.root, $n),
    ref: Qt
  }, Bs), El || /* @__PURE__ */ React.createElement("div", {
    role: "progressbar",
    "aria-valuemax": 100,
    "aria-valuemin": 0,
    "aria-valuenow": Sn,
    "aria-label": Ms,
    className: Hs.bar,
    style: { width: `${Sn}%` },
    "data-striped": Cr || kr || void 0,
    "data-animate": kr || void 0
  }, Yr ? /* @__PURE__ */ React.createElement(Text, {
    className: Hs.label
  }, Yr) : ""));
});
Progress.displayName = "@mantine/core/Progress";
var __defProp$N = Object.defineProperty, __getOwnPropSymbols$O = Object.getOwnPropertySymbols, __hasOwnProp$O = Object.prototype.hasOwnProperty, __propIsEnum$O = Object.prototype.propertyIsEnumerable, __defNormalProp$N = (_e, Qt, Zt) => Qt in _e ? __defProp$N(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$N = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$O.call(Qt, Zt) && __defNormalProp$N(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$O)
    for (var Zt of __getOwnPropSymbols$O(Qt))
      __propIsEnum$O.call(Qt, Zt) && __defNormalProp$N(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$z = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$O.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$O)
    for (var $n of __getOwnPropSymbols$O(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$O.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function RadioIcon(_e) {
  const Qt = _e, { width: Zt, height: $n, style: Sn } = Qt, kn = __objRest$z(Qt, ["width", "height", "style"]);
  return /* @__PURE__ */ React.createElement("svg", __spreadValues$N({
    xmlns: "http://www.w3.org/2000/svg",
    fill: "none",
    viewBox: "0 0 5 5",
    style: __spreadValues$N({ width: Zt, height: $n }, Sn)
  }, kn), /* @__PURE__ */ React.createElement("path", {
    fill: "currentColor",
    d: "M0 2.5a2.5 2.5 0 115 0 2.5 2.5 0 01-5 0z"
  }));
}
const RadioGroupContext = reactExports.createContext(null), RadioGroupProvider = RadioGroupContext.Provider, useRadioGroupContext = () => reactExports.useContext(RadioGroupContext);
var __defProp$M = Object.defineProperty, __getOwnPropSymbols$N = Object.getOwnPropertySymbols, __hasOwnProp$N = Object.prototype.hasOwnProperty, __propIsEnum$N = Object.prototype.propertyIsEnumerable, __defNormalProp$M = (_e, Qt, Zt) => Qt in _e ? __defProp$M(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$M = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$N.call(Qt, Zt) && __defNormalProp$M(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$N)
    for (var Zt of __getOwnPropSymbols$N(Qt))
      __propIsEnum$N.call(Qt, Zt) && __defNormalProp$M(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$y = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$N.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$N)
    for (var $n of __getOwnPropSymbols$N(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$N.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$u = {
  size: "sm"
}, RadioGroup = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("RadioGroup", defaultProps$u, _e), {
    children: $n,
    value: Sn,
    defaultValue: kn,
    onChange: Kn,
    size: er,
    wrapperProps: Cr,
    unstyled: kr,
    name: Yr
  } = Zt, Ms = __objRest$y(Zt, [
    "children",
    "value",
    "defaultValue",
    "onChange",
    "size",
    "wrapperProps",
    "unstyled",
    "name"
  ]), Ds = useId$1(Yr), [Ls, js] = useUncontrolled({
    value: Sn,
    defaultValue: kn,
    finalValue: "",
    onChange: Kn
  }), zs = (Fs) => js(Fs.currentTarget.value);
  return /* @__PURE__ */ React.createElement(RadioGroupProvider, {
    value: { value: Ls, onChange: zs, size: er, name: Ds }
  }, /* @__PURE__ */ React.createElement(Input.Wrapper, __spreadValues$M(__spreadValues$M({
    labelElement: "div",
    size: er,
    __staticSelector: "RadioGroup",
    ref: Qt,
    unstyled: kr
  }, Cr), Ms), $n));
});
RadioGroup.displayName = "@mantine/core/RadioGroup";
var __defProp$L = Object.defineProperty, __defProps$t = Object.defineProperties, __getOwnPropDescs$t = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$M = Object.getOwnPropertySymbols, __hasOwnProp$M = Object.prototype.hasOwnProperty, __propIsEnum$M = Object.prototype.propertyIsEnumerable, __defNormalProp$L = (_e, Qt, Zt) => Qt in _e ? __defProp$L(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$L = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$M.call(Qt, Zt) && __defNormalProp$L(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$M)
    for (var Zt of __getOwnPropSymbols$M(Qt))
      __propIsEnum$M.call(Qt, Zt) && __defNormalProp$L(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$t = (_e, Qt) => __defProps$t(_e, __getOwnPropDescs$t(Qt));
const sizes$4 = {
  xs: rem$1(16),
  sm: rem$1(20),
  md: rem$1(24),
  lg: rem$1(30),
  xl: rem$1(36)
}, iconSizes = {
  xs: rem$1(6),
  sm: rem$1(8),
  md: rem$1(10),
  lg: rem$1(14),
  xl: rem$1(16)
};
var useStyles$_ = createStyles((_e, { color: Qt, transitionDuration: Zt, labelPosition: $n, error: Sn }, { size: kn }) => {
  const Kn = _e.fn.variant({ variant: "filled", color: Qt }), er = _e.fn.variant({ variant: "filled", color: "red" }).background;
  return {
    inner: {
      order: $n === "left" ? 2 : 1,
      position: "relative",
      alignSelf: "flex-start"
    },
    icon: {
      ref: getStylesRef("icon"),
      color: _e.white,
      opacity: 0,
      transform: `scale(0.75) translateY(${rem$1(2)})`,
      transition: `opacity ${Zt}ms ${_e.transitionTimingFunction}`,
      pointerEvents: "none",
      width: getSize$1({ sizes: iconSizes, size: kn }),
      height: getSize$1({ sizes: iconSizes, size: kn }),
      position: "absolute",
      top: `calc(50% - ${getSize$1({ sizes: iconSizes, size: kn })} / 2)`,
      left: `calc(50% - ${getSize$1({ sizes: iconSizes, size: kn })} / 2)`
    },
    radio: __spreadProps$t(__spreadValues$L({}, _e.fn.focusStyles()), {
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.white,
      border: `${rem$1(1)} solid ${Sn ? er : _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[4]}`,
      position: "relative",
      appearance: "none",
      width: getSize$1({ sizes: sizes$4, size: kn }),
      height: getSize$1({ sizes: sizes$4, size: kn }),
      borderRadius: getSize$1({ sizes: sizes$4, size: kn }),
      margin: 0,
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      transitionProperty: "background-color, border-color",
      transitionTimingFunction: _e.transitionTimingFunction,
      transitionDuration: `${Zt}ms`,
      cursor: _e.cursorType,
      "&:checked": {
        background: Kn.background,
        borderColor: Kn.background,
        [`& + .${getStylesRef("icon")}`]: {
          opacity: 1,
          transform: "scale(1)"
        }
      },
      "&:disabled": {
        borderColor: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[4],
        backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[1],
        [`& + .${getStylesRef("icon")}`]: {
          color: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[4]
        }
      }
    })
  };
});
const useStyles$$ = useStyles$_;
var __defProp$K = Object.defineProperty, __getOwnPropSymbols$L = Object.getOwnPropertySymbols, __hasOwnProp$L = Object.prototype.hasOwnProperty, __propIsEnum$L = Object.prototype.propertyIsEnumerable, __defNormalProp$K = (_e, Qt, Zt) => Qt in _e ? __defProp$K(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$K = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$L.call(Qt, Zt) && __defNormalProp$K(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$L)
    for (var Zt of __getOwnPropSymbols$L(Qt))
      __propIsEnum$L.call(Qt, Zt) && __defNormalProp$K(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$x = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$L.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$L)
    for (var $n of __getOwnPropSymbols$L(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$L.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$t = {
  icon: RadioIcon,
  transitionDuration: 100,
  size: "sm",
  labelPosition: "right"
}, Radio = reactExports.forwardRef((_e, Qt) => {
  var Zt, $n;
  const Sn = useComponentDefaultProps("Radio", defaultProps$t, _e), {
    className: kn,
    style: Kn,
    id: er,
    label: Cr,
    size: kr,
    title: Yr,
    disabled: Ms,
    color: Ds,
    classNames: Ls,
    styles: js,
    sx: zs,
    icon: Fs,
    transitionDuration: Bs,
    wrapperProps: Hs,
    unstyled: Ws,
    labelPosition: Ys,
    description: El,
    error: Mu,
    variant: Pl
  } = Sn, Iu = __objRest$x(Sn, [
    "className",
    "style",
    "id",
    "label",
    "size",
    "title",
    "disabled",
    "color",
    "classNames",
    "styles",
    "sx",
    "icon",
    "transitionDuration",
    "wrapperProps",
    "unstyled",
    "labelPosition",
    "description",
    "error",
    "variant"
  ]), Tu = useRadioGroupContext(), Au = (Zt = Tu == null ? void 0 : Tu.size) != null ? Zt : kr, Nu = _e.size ? kr : Au, { classes: gm } = useStyles$$({ color: Ds, transitionDuration: Bs, labelPosition: Ys, error: !!Mu }, { name: "Radio", classNames: Ls, styles: js, unstyled: Ws, variant: Pl, size: Nu }), { systemStyles: pm, rest: zu } = extractSystemStyles(Iu), Yu = useId$1(er), sm = Tu ? {
    checked: Tu.value === zu.value,
    name: ($n = zu.name) != null ? $n : Tu.name,
    onChange: Tu.onChange
  } : {};
  return /* @__PURE__ */ React.createElement(InlineInput, __spreadValues$K(__spreadValues$K({
    className: kn,
    sx: zs,
    style: Kn,
    id: Yu,
    size: Nu,
    labelPosition: Ys,
    label: Cr,
    description: El,
    error: Mu,
    disabled: Ms,
    __staticSelector: "Radio",
    classNames: Ls,
    styles: js,
    unstyled: Ws,
    "data-checked": sm.checked || void 0,
    variant: Pl
  }, pm), Hs), /* @__PURE__ */ React.createElement("div", {
    className: gm.inner
  }, /* @__PURE__ */ React.createElement("input", __spreadValues$K(__spreadValues$K({
    ref: Qt,
    className: gm.radio,
    type: "radio",
    id: Yu,
    disabled: Ms
  }, zu), sm)), /* @__PURE__ */ React.createElement(Fs, {
    className: gm.icon,
    "aria-hidden": !0
  })));
});
Radio.displayName = "@mantine/core/Radio";
Radio.Group = RadioGroup;
function filterData({
  data: _e,
  searchable: Qt,
  limit: Zt,
  searchValue: $n,
  filter: Sn,
  value: kn,
  filterDataOnExactSearchMatch: Kn
}) {
  if (!Qt)
    return _e;
  const er = kn != null && _e.find((kr) => kr.value === kn) || null;
  if (er && !Kn && (er == null ? void 0 : er.label) === $n) {
    if (Zt) {
      if (Zt >= _e.length)
        return _e;
      const kr = _e.indexOf(er), Yr = kr + Zt, Ms = Yr - _e.length;
      return Ms > 0 ? _e.slice(kr - Ms) : _e.slice(kr, Yr);
    }
    return _e;
  }
  const Cr = [];
  for (let kr = 0; kr < _e.length && (Sn($n, _e[kr]) && Cr.push(_e[kr]), !(Cr.length >= Zt)); kr += 1)
    ;
  return Cr;
}
var useStyles$Y = createStyles(() => ({
  input: {
    "&:not(:disabled)": {
      cursor: "pointer",
      "&::selection": {
        backgroundColor: "transparent"
      }
    }
  }
}));
const useStyles$Z = useStyles$Y;
var __defProp$J = Object.defineProperty, __defProps$s = Object.defineProperties, __getOwnPropDescs$s = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$K = Object.getOwnPropertySymbols, __hasOwnProp$K = Object.prototype.hasOwnProperty, __propIsEnum$K = Object.prototype.propertyIsEnumerable, __defNormalProp$J = (_e, Qt, Zt) => Qt in _e ? __defProp$J(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$J = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$K.call(Qt, Zt) && __defNormalProp$J(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$K)
    for (var Zt of __getOwnPropSymbols$K(Qt))
      __propIsEnum$K.call(Qt, Zt) && __defNormalProp$J(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$s = (_e, Qt) => __defProps$s(_e, __getOwnPropDescs$s(Qt)), __objRest$w = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$K.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$K)
    for (var $n of __getOwnPropSymbols$K(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$K.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function defaultFilter$1(_e, Qt) {
  return Qt.label.toLowerCase().trim().includes(_e.toLowerCase().trim());
}
function defaultShouldCreate(_e, Qt) {
  return !!_e && !Qt.some((Zt) => Zt.label.toLowerCase() === _e.toLowerCase());
}
const defaultProps$s = {
  required: !1,
  size: "sm",
  shadow: "sm",
  itemComponent: DefaultItem,
  transitionProps: { transition: "fade", duration: 0 },
  initiallyOpened: !1,
  filter: defaultFilter$1,
  maxDropdownHeight: 220,
  searchable: !1,
  clearable: !1,
  limit: 1 / 0,
  disabled: !1,
  creatable: !1,
  shouldCreate: defaultShouldCreate,
  selectOnBlur: !1,
  switchDirectionOnFlip: !1,
  filterDataOnExactSearchMatch: !1,
  zIndex: getDefaultZIndex("popover"),
  positionDependencies: [],
  dropdownPosition: "flip"
}, Select = reactExports.forwardRef((_e, Qt) => {
  const Zt = useInputProps("Select", defaultProps$s, _e), {
    inputProps: $n,
    wrapperProps: Sn,
    shadow: kn,
    data: Kn,
    value: er,
    defaultValue: Cr,
    onChange: kr,
    itemComponent: Yr,
    onKeyDown: Ms,
    onBlur: Ds,
    onFocus: Ls,
    transitionProps: js,
    initiallyOpened: zs,
    unstyled: Fs,
    classNames: Bs,
    styles: Hs,
    filter: Ws,
    maxDropdownHeight: Ys,
    searchable: El,
    clearable: Mu,
    nothingFound: Pl,
    limit: Iu,
    disabled: Tu,
    onSearchChange: Au,
    searchValue: Nu,
    rightSection: gm,
    rightSectionWidth: pm,
    creatable: zu,
    getCreateLabel: Yu,
    shouldCreate: sm,
    selectOnBlur: mm,
    onCreate: hm,
    dropdownComponent: ym,
    onDropdownClose: _m,
    onDropdownOpen: Sm,
    withinPortal: wm,
    portalProps: Nm,
    switchDirectionOnFlip: Cm,
    zIndex: Im,
    name: Am,
    dropdownPosition: Vm,
    allowDeselect: Rm,
    placeholder: Dm,
    filterDataOnExactSearchMatch: km,
    form: zm,
    positionDependencies: Pm,
    readOnly: i$,
    clearButtonProps: o$,
    hoverOnSearchChange: u$
  } = Zt, h$ = __objRest$w(Zt, [
    "inputProps",
    "wrapperProps",
    "shadow",
    "data",
    "value",
    "defaultValue",
    "onChange",
    "itemComponent",
    "onKeyDown",
    "onBlur",
    "onFocus",
    "transitionProps",
    "initiallyOpened",
    "unstyled",
    "classNames",
    "styles",
    "filter",
    "maxDropdownHeight",
    "searchable",
    "clearable",
    "nothingFound",
    "limit",
    "disabled",
    "onSearchChange",
    "searchValue",
    "rightSection",
    "rightSectionWidth",
    "creatable",
    "getCreateLabel",
    "shouldCreate",
    "selectOnBlur",
    "onCreate",
    "dropdownComponent",
    "onDropdownClose",
    "onDropdownOpen",
    "withinPortal",
    "portalProps",
    "switchDirectionOnFlip",
    "zIndex",
    "name",
    "dropdownPosition",
    "allowDeselect",
    "placeholder",
    "filterDataOnExactSearchMatch",
    "form",
    "positionDependencies",
    "readOnly",
    "clearButtonProps",
    "hoverOnSearchChange"
  ]), { classes: d$, cx: v$, theme: $$ } = useStyles$Z(), [s$, l$] = reactExports.useState(zs), [_$, a$] = reactExports.useState(-1), n$ = reactExports.useRef(), m$ = reactExports.useRef({}), [j$, Q$] = reactExports.useState("column"), z$ = j$ === "column", { scrollIntoView: wS, targetRef: aS, scrollableRef: cS } = useScrollIntoView({
    duration: 0,
    offset: 5,
    cancelable: !1,
    isList: !0
  }), $S = Rm === void 0 ? Mu : Rm, B$ = (g$) => {
    if (s$ !== g$) {
      l$(g$);
      const V$ = g$ ? Sm : _m;
      typeof V$ == "function" && V$();
    }
  }, IS = zu && typeof Yu == "function";
  let RS = null;
  const eE = Kn.map((g$) => typeof g$ == "string" ? { label: g$, value: g$ } : g$), rS = groupOptions({ data: eE }), [sS, PS, G$] = useUncontrolled({
    value: er,
    defaultValue: Cr,
    finalValue: null,
    onChange: kr
  }), tS = rS.find((g$) => g$.value === sS), [hS, aE] = useUncontrolled({
    value: Nu,
    defaultValue: (tS == null ? void 0 : tS.label) || "",
    finalValue: void 0,
    onChange: Au
  }), gS = (g$) => {
    aE(g$), El && typeof Au == "function" && Au(g$);
  }, lS = () => {
    var g$;
    i$ || (PS(null), G$ || gS(""), (g$ = n$.current) == null || g$.focus());
  };
  reactExports.useEffect(() => {
    const g$ = rS.find((V$) => V$.value === sS);
    g$ ? gS(g$.label) : (!IS || !sS) && gS("");
  }, [sS]), reactExports.useEffect(() => {
    tS && (!El || !s$) && gS(tS.label);
  }, [tS == null ? void 0 : tS.label]);
  const M$ = (g$) => {
    if (!i$)
      if ($S && (tS == null ? void 0 : tS.value) === g$.value)
        PS(null), B$(!1);
      else {
        if (g$.creatable && typeof hm == "function") {
          const V$ = hm(g$.value);
          typeof V$ < "u" && V$ !== null && PS(typeof V$ == "string" ? V$ : V$.value);
        } else
          PS(g$.value);
        G$ || gS(g$.label), a$(-1), B$(!1), n$.current.focus();
      }
  }, Z$ = filterData({
    data: rS,
    searchable: El,
    limit: Iu,
    searchValue: hS,
    filter: Ws,
    filterDataOnExactSearchMatch: km,
    value: sS
  });
  IS && sm(hS, Z$) && (RS = Yu(hS), Z$.push({ label: hS, value: hS, creatable: !0 }));
  const O$ = (g$, V$, uS) => {
    let D$ = g$;
    for (; uS(D$); )
      if (D$ = V$(D$), !Z$[D$].disabled)
        return D$;
    return g$;
  };
  useDidUpdate(() => {
    a$(u$ && hS ? 0 : -1);
  }, [hS, u$]);
  const U$ = sS ? Z$.findIndex((g$) => g$.value === sS) : 0, R$ = !i$ && (Z$.length > 0 ? s$ : s$ && !!Pl), k$ = () => {
    a$((g$) => {
      var V$;
      const uS = O$(g$, (D$) => D$ - 1, (D$) => D$ > 0);
      return aS.current = m$.current[(V$ = Z$[uS]) == null ? void 0 : V$.value], R$ && wS({ alignment: z$ ? "start" : "end" }), uS;
    });
  }, yS = () => {
    a$((g$) => {
      var V$;
      const uS = O$(g$, (D$) => D$ + 1, (D$) => D$ < Z$.length - 1);
      return aS.current = m$.current[(V$ = Z$[uS]) == null ? void 0 : V$.value], R$ && wS({ alignment: z$ ? "end" : "start" }), uS;
    });
  }, HS = () => window.setTimeout(() => {
    var g$;
    aS.current = m$.current[(g$ = Z$[U$]) == null ? void 0 : g$.value], wS({ alignment: z$ ? "end" : "start" });
  }, 50);
  useDidUpdate(() => {
    R$ && HS();
  }, [R$]);
  const WE = (g$) => {
    switch (typeof Ms == "function" && Ms(g$), g$.key) {
      case "ArrowUp": {
        g$.preventDefault(), s$ ? z$ ? k$() : yS() : (a$(U$), B$(!0), HS());
        break;
      }
      case "ArrowDown": {
        g$.preventDefault(), s$ ? z$ ? yS() : k$() : (a$(U$), B$(!0), HS());
        break;
      }
      case "Home": {
        if (!El) {
          g$.preventDefault(), s$ || B$(!0);
          const V$ = Z$.findIndex((uS) => !uS.disabled);
          a$(V$), R$ && wS({ alignment: z$ ? "end" : "start" });
        }
        break;
      }
      case "End": {
        if (!El) {
          g$.preventDefault(), s$ || B$(!0);
          const V$ = Z$.map((uS) => !!uS.disabled).lastIndexOf(!1);
          a$(V$), R$ && wS({ alignment: z$ ? "end" : "start" });
        }
        break;
      }
      case "Escape": {
        g$.preventDefault(), B$(!1), a$(-1);
        break;
      }
      case " ": {
        El || (g$.preventDefault(), Z$[_$] && s$ ? M$(Z$[_$]) : (B$(!0), a$(U$), HS()));
        break;
      }
      case "Enter":
        El || g$.preventDefault(), Z$[_$] && s$ && (g$.preventDefault(), M$(Z$[_$]));
    }
  }, wE = (g$) => {
    typeof Ds == "function" && Ds(g$);
    const V$ = rS.find((uS) => uS.value === sS);
    mm && Z$[_$] && s$ && M$(Z$[_$]), gS((V$ == null ? void 0 : V$.label) || ""), B$(!1);
  }, GE = (g$) => {
    typeof Ls == "function" && Ls(g$), El && B$(!0);
  }, lM = (g$) => {
    i$ || (gS(g$.currentTarget.value), Mu && g$.currentTarget.value === "" && PS(null), a$(-1), B$(!0));
  }, YE = () => {
    i$ || (B$(!s$), sS && !s$ && a$(U$));
  };
  return /* @__PURE__ */ React.createElement(Input.Wrapper, __spreadProps$s(__spreadValues$J({}, Sn), {
    __staticSelector: "Select"
  }), /* @__PURE__ */ React.createElement(SelectPopover, {
    opened: R$,
    transitionProps: js,
    shadow: kn,
    withinPortal: wm,
    portalProps: Nm,
    __staticSelector: "Select",
    onDirectionChange: Q$,
    switchDirectionOnFlip: Cm,
    zIndex: Im,
    dropdownPosition: Vm,
    positionDependencies: [...Pm, hS],
    classNames: Bs,
    styles: Hs,
    unstyled: Fs,
    variant: $n.variant
  }, /* @__PURE__ */ React.createElement(SelectPopover.Target, null, /* @__PURE__ */ React.createElement("div", {
    role: "combobox",
    "aria-haspopup": "listbox",
    "aria-owns": R$ ? `${$n.id}-items` : null,
    "aria-controls": $n.id,
    "aria-expanded": R$,
    onMouseLeave: () => a$(-1),
    tabIndex: -1
  }, /* @__PURE__ */ React.createElement("input", {
    type: "hidden",
    name: Am,
    value: sS || "",
    form: zm,
    disabled: Tu
  }), /* @__PURE__ */ React.createElement(Input, __spreadValues$J(__spreadProps$s(__spreadValues$J(__spreadValues$J({
    autoComplete: "off",
    type: "search"
  }, $n), h$), {
    ref: useMergedRef(Qt, n$),
    onKeyDown: WE,
    __staticSelector: "Select",
    value: hS,
    placeholder: Dm,
    onChange: lM,
    "aria-autocomplete": "list",
    "aria-controls": R$ ? `${$n.id}-items` : null,
    "aria-activedescendant": _$ >= 0 ? `${$n.id}-${_$}` : null,
    onMouseDown: YE,
    onBlur: wE,
    onFocus: GE,
    readOnly: !El || i$,
    disabled: Tu,
    "data-mantine-stop-propagation": R$,
    name: null,
    classNames: __spreadProps$s(__spreadValues$J({}, Bs), {
      input: v$({ [d$.input]: !El }, Bs == null ? void 0 : Bs.input)
    })
  }), getSelectRightSectionProps({
    theme: $$,
    rightSection: gm,
    rightSectionWidth: pm,
    styles: Hs,
    size: $n.size,
    shouldClear: Mu && !!tS,
    onClear: lS,
    error: Sn.error,
    clearButtonProps: o$,
    disabled: Tu,
    readOnly: i$
  }))))), /* @__PURE__ */ React.createElement(SelectPopover.Dropdown, {
    component: ym || SelectScrollArea,
    maxHeight: Ys,
    direction: j$,
    id: $n.id,
    innerRef: cS,
    __staticSelector: "Select",
    classNames: Bs,
    styles: Hs
  }, /* @__PURE__ */ React.createElement(SelectItems, {
    data: Z$,
    hovered: _$,
    classNames: Bs,
    styles: Hs,
    isItemSelected: (g$) => g$ === sS,
    uuid: $n.id,
    __staticSelector: "Select",
    onItemHover: a$,
    onItemSelect: M$,
    itemsRefs: m$,
    itemComponent: Yr,
    size: $n.size,
    nothingFound: Pl,
    creatable: IS && !!RS,
    createLabel: RS,
    "aria-label": Sn.label,
    unstyled: Fs,
    variant: $n.variant
  }))));
});
Select.displayName = "@mantine/core/Select";
var __defProp$I = Object.defineProperty, __defProps$r = Object.defineProperties, __getOwnPropDescs$r = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$J = Object.getOwnPropertySymbols, __hasOwnProp$J = Object.prototype.hasOwnProperty, __propIsEnum$J = Object.prototype.propertyIsEnumerable, __defNormalProp$I = (_e, Qt, Zt) => Qt in _e ? __defProp$I(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$I = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$J.call(Qt, Zt) && __defNormalProp$I(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$J)
    for (var Zt of __getOwnPropSymbols$J(Qt))
      __propIsEnum$J.call(Qt, Zt) && __defNormalProp$I(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$r = (_e, Qt) => __defProps$r(_e, __getOwnPropDescs$r(Qt));
const fade = keyframes({
  "from, to": { opacity: 0.4 },
  "50%": { opacity: 1 }
});
var useStyles$W = createStyles((_e, { height: Qt, width: Zt, radius: $n, circle: Sn, animate: kn }) => ({
  root: {
    height: rem$1(Qt),
    width: rem$1(Sn ? Qt : Zt),
    borderRadius: Sn ? rem$1(Qt) : _e.fn.radius($n),
    position: "relative",
    WebkitTransform: "translateZ(0)"
  },
  visible: {
    overflow: "hidden",
    "&::before": __spreadProps$r(__spreadValues$I({}, _e.fn.cover(0)), {
      content: '""',
      background: _e.colorScheme === "dark" ? _e.colors.dark[7] : _e.white,
      zIndex: 10
    }),
    "&::after": __spreadProps$r(__spreadValues$I({}, _e.fn.cover(0)), {
      content: '""',
      background: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[3],
      animation: kn ? `${fade} 1500ms linear infinite` : "none",
      zIndex: 11
    })
  }
}));
const useStyles$X = useStyles$W;
var __defProp$H = Object.defineProperty, __getOwnPropSymbols$I = Object.getOwnPropertySymbols, __hasOwnProp$I = Object.prototype.hasOwnProperty, __propIsEnum$I = Object.prototype.propertyIsEnumerable, __defNormalProp$H = (_e, Qt, Zt) => Qt in _e ? __defProp$H(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$H = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$I.call(Qt, Zt) && __defNormalProp$H(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$I)
    for (var Zt of __getOwnPropSymbols$I(Qt))
      __propIsEnum$I.call(Qt, Zt) && __defNormalProp$H(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$v = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$I.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$I)
    for (var $n of __getOwnPropSymbols$I(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$I.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$r = {
  height: "auto",
  width: "100%",
  visible: !0,
  animate: !0
}, Skeleton = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Skeleton", defaultProps$r, _e), {
    height: $n,
    width: Sn,
    visible: kn,
    animate: Kn,
    className: er,
    circle: Cr,
    radius: kr,
    unstyled: Yr,
    variant: Ms
  } = Zt, Ds = __objRest$v(Zt, [
    "height",
    "width",
    "visible",
    "animate",
    "className",
    "circle",
    "radius",
    "unstyled",
    "variant"
  ]), { classes: Ls, cx: js } = useStyles$X({ height: $n, width: Sn, circle: Cr, radius: kr, animate: Kn }, { name: "Skeleton", unstyled: Yr, variant: Ms });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$H({
    className: js(Ls.root, { [Ls.visible]: kn }, er),
    ref: Qt
  }, Ds));
});
Skeleton.displayName = "@mantine/core/Skeleton";
function getPosition({ value: _e, min: Qt, max: Zt }) {
  const $n = (_e - Qt) / (Zt - Qt) * 100;
  return Math.min(Math.max($n, 0), 100);
}
function getChangeValue({
  value: _e,
  containerWidth: Qt,
  min: Zt,
  max: $n,
  step: Sn,
  precision: kn
}) {
  const er = (Qt ? Math.min(Math.max(_e, 0), Qt) / Qt : _e) * ($n - Zt), Cr = (er !== 0 ? Math.round(er / Sn) * Sn : 0) + Zt, kr = Math.max(Cr, Zt);
  return kn !== void 0 ? Number(kr.toFixed(kn)) : kr;
}
var __defProp$G = Object.defineProperty, __defProps$q = Object.defineProperties, __getOwnPropDescs$q = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$H = Object.getOwnPropertySymbols, __hasOwnProp$H = Object.prototype.hasOwnProperty, __propIsEnum$H = Object.prototype.propertyIsEnumerable, __defNormalProp$G = (_e, Qt, Zt) => Qt in _e ? __defProp$G(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$G = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$H.call(Qt, Zt) && __defNormalProp$G(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$H)
    for (var Zt of __getOwnPropSymbols$H(Qt))
      __propIsEnum$H.call(Qt, Zt) && __defNormalProp$G(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$q = (_e, Qt) => __defProps$q(_e, __getOwnPropDescs$q(Qt));
const sizes$3 = {
  xs: rem$1(4),
  sm: rem$1(6),
  md: rem$1(8),
  lg: rem$1(10),
  xl: rem$1(12)
};
var useStyles$U = createStyles((_e) => ({
  root: __spreadProps$q(__spreadValues$G({}, _e.fn.fontStyles()), {
    WebkitTapHighlightColor: "transparent",
    outline: 0,
    display: "flex",
    flexDirection: "column",
    alignItems: "center",
    touchAction: "none",
    position: "relative"
  })
}));
const useStyles$V = useStyles$U;
var __defProp$F = Object.defineProperty, __defProps$p = Object.defineProperties, __getOwnPropDescs$p = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$G = Object.getOwnPropertySymbols, __hasOwnProp$G = Object.prototype.hasOwnProperty, __propIsEnum$G = Object.prototype.propertyIsEnumerable, __defNormalProp$F = (_e, Qt, Zt) => Qt in _e ? __defProp$F(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$F = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$G.call(Qt, Zt) && __defNormalProp$F(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$G)
    for (var Zt of __getOwnPropSymbols$G(Qt))
      __propIsEnum$G.call(Qt, Zt) && __defNormalProp$F(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$p = (_e, Qt) => __defProps$p(_e, __getOwnPropDescs$p(Qt)), useStyles$S = createStyles((_e, { color: Qt, disabled: Zt, thumbSize: $n }, { size: Sn }) => ({
  label: {
    position: "absolute",
    top: rem$1(-36),
    backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[9],
    fontSize: _e.fontSizes.xs,
    color: _e.white,
    padding: `calc(${_e.spacing.xs} / 2)`,
    borderRadius: _e.radius.sm,
    whiteSpace: "nowrap",
    pointerEvents: "none",
    userSelect: "none",
    touchAction: "none"
  },
  thumb: __spreadProps$p(__spreadValues$F({}, _e.fn.focusStyles()), {
    boxSizing: "border-box",
    position: "absolute",
    display: Zt ? "none" : "flex",
    height: $n ? rem$1($n) : `calc(${getSize$1({ sizes: sizes$3, size: Sn })} * 2)`,
    width: $n ? rem$1($n) : `calc(${getSize$1({ sizes: sizes$3, size: Sn })} * 2)`,
    backgroundColor: _e.colorScheme === "dark" ? _e.fn.themeColor(Qt, _e.fn.primaryShade()) : _e.white,
    border: `${rem$1(4)} solid ${_e.colorScheme === "dark" ? _e.white : _e.fn.themeColor(Qt, _e.fn.primaryShade())}`,
    color: _e.colorScheme === "dark" ? _e.white : _e.fn.themeColor(Qt, _e.fn.primaryShade()),
    transform: "translate(-50%, -50%)",
    top: "50%",
    cursor: "pointer",
    borderRadius: 1e3,
    alignItems: "center",
    justifyContent: "center",
    transitionDuration: "100ms",
    transitionProperty: "box-shadow, transform",
    transitionTimingFunction: _e.transitionTimingFunction,
    zIndex: 3,
    userSelect: "none",
    touchAction: "none"
  }),
  dragging: {
    transform: "translate(-50%, -50%) scale(1.05)",
    boxShadow: _e.shadows.sm
  }
}));
const useStyles$T = useStyles$S, Thumb = reactExports.forwardRef(({
  max: _e,
  min: Qt,
  value: Zt,
  position: $n,
  label: Sn,
  dragging: kn,
  onMouseDown: Kn,
  onKeyDownCapture: er,
  color: Cr,
  classNames: kr,
  styles: Yr,
  size: Ms,
  labelTransition: Ds,
  labelTransitionDuration: Ls,
  labelTransitionTimingFunction: js,
  labelAlwaysOn: zs,
  thumbLabel: Fs,
  onFocus: Bs,
  onBlur: Hs,
  showLabelOnHover: Ws,
  isHovered: Ys,
  children: El = null,
  disabled: Mu,
  unstyled: Pl,
  thumbSize: Iu,
  variant: Tu
}, Au) => {
  const { classes: Nu, cx: gm, theme: pm } = useStyles$T({ color: Cr, disabled: Mu, thumbSize: Iu }, { name: "Slider", classNames: kr, styles: Yr, unstyled: Pl, variant: Tu, size: Ms }), [zu, Yu] = reactExports.useState(!1), sm = zs || kn || zu || Ws && Ys;
  return /* @__PURE__ */ React.createElement(Box, {
    tabIndex: 0,
    role: "slider",
    "aria-label": Fs,
    "aria-valuemax": _e,
    "aria-valuemin": Qt,
    "aria-valuenow": Zt,
    ref: Au,
    className: gm(Nu.thumb, { [Nu.dragging]: kn }),
    onFocus: () => {
      Yu(!0), typeof Bs == "function" && Bs();
    },
    onBlur: () => {
      Yu(!1), typeof Hs == "function" && Hs();
    },
    onTouchStart: Kn,
    onMouseDown: Kn,
    onKeyDownCapture: er,
    onClick: (mm) => mm.stopPropagation(),
    style: { [pm.dir === "rtl" ? "right" : "left"]: `${$n}%` }
  }, El, /* @__PURE__ */ React.createElement(Transition$1, {
    mounted: Sn != null && sm,
    duration: Ls,
    transition: Ds,
    timingFunction: js || pm.transitionTimingFunction
  }, (mm) => /* @__PURE__ */ React.createElement("div", {
    style: mm,
    className: Nu.label
  }, Sn)));
});
Thumb.displayName = "@mantine/core/SliderThumb";
function isMarkFilled({ mark: _e, offset: Qt, value: Zt, inverted: $n = !1 }) {
  return $n ? typeof Qt == "number" && _e.value <= Qt || _e.value >= Zt : typeof Qt == "number" ? _e.value >= Qt && _e.value <= Zt : _e.value <= Zt;
}
var useStyles$Q = createStyles((_e, { color: Qt, disabled: Zt, thumbSize: $n }, { size: Sn }) => ({
  marksContainer: {
    position: "absolute",
    right: $n ? rem$1($n / 2) : getSize$1({ sizes: sizes$3, size: Sn }),
    left: $n ? rem$1($n / 2) : getSize$1({ sizes: sizes$3, size: Sn }),
    "&:has(~ input:disabled)": {
      "& .mantine-Slider-markFilled": {
        border: `${rem$1(2)} solid ${_e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2]}`,
        borderColor: _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[4]
      }
    }
  },
  markWrapper: {
    position: "absolute",
    top: `calc(${rem$1(getSize$1({ sizes: sizes$3, size: Sn }))} / 2)`,
    zIndex: 2,
    height: 0
  },
  mark: {
    boxSizing: "border-box",
    border: `${rem$1(2)} solid ${_e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2]}`,
    height: getSize$1({ sizes: sizes$3, size: Sn }),
    width: getSize$1({ sizes: sizes$3, size: Sn }),
    borderRadius: 1e3,
    transform: `translateX(calc(-${getSize$1({ sizes: sizes$3, size: Sn })} / 2))`,
    backgroundColor: _e.white,
    pointerEvents: "none"
  },
  markFilled: {
    borderColor: Zt ? _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[4] : _e.fn.variant({ variant: "filled", color: Qt }).background
  },
  markLabel: {
    transform: `translate(-50%, calc(${_e.spacing.xs} / 2))`,
    fontSize: _e.fontSizes.sm,
    color: _e.colorScheme === "dark" ? _e.colors.dark[2] : _e.colors.gray[6],
    whiteSpace: "nowrap",
    cursor: "pointer",
    userSelect: "none"
  }
}));
const useStyles$R = useStyles$Q;
function Marks$1({
  marks: _e,
  color: Qt,
  size: Zt,
  thumbSize: $n,
  min: Sn,
  max: kn,
  value: Kn,
  classNames: er,
  styles: Cr,
  offset: kr,
  onChange: Yr,
  disabled: Ms,
  unstyled: Ds,
  inverted: Ls,
  variant: js
}) {
  const { classes: zs, cx: Fs } = useStyles$R({ color: Qt, disabled: Ms, thumbSize: $n }, { name: "Slider", classNames: er, styles: Cr, unstyled: Ds, variant: js, size: Zt }), Bs = _e.map((Hs, Ws) => /* @__PURE__ */ React.createElement(Box, {
    className: zs.markWrapper,
    sx: { left: `${getPosition({ value: Hs.value, min: Sn, max: kn })}%` },
    key: Ws
  }, /* @__PURE__ */ React.createElement("div", {
    className: Fs(zs.mark, {
      [zs.markFilled]: isMarkFilled({ mark: Hs, value: Kn, offset: kr, inverted: Ls })
    })
  }), Hs.label && /* @__PURE__ */ React.createElement("div", {
    className: zs.markLabel,
    onMouseDown: (Ys) => {
      Ys.stopPropagation(), !Ms && Yr(Hs.value);
    },
    onTouchStart: (Ys) => {
      Ys.stopPropagation(), !Ms && Yr(Hs.value);
    }
  }, Hs.label)));
  return /* @__PURE__ */ React.createElement("div", {
    className: zs.marksContainer
  }, Bs);
}
Marks$1.displayName = "@mantine/core/SliderMarks";
var useStyles$O = createStyles((_e, { radius: Qt, color: Zt, disabled: $n, inverted: Sn, thumbSize: kn }, { size: Kn }) => ({
  trackContainer: {
    display: "flex",
    alignItems: "center",
    width: "100%",
    height: `calc(${getSize$1({ sizes: sizes$3, size: Kn })} * 2)`,
    cursor: "pointer",
    "&:has(~ input:disabled)": {
      "&": {
        pointerEvents: "none"
      },
      "& .mantine-Slider-thumb": {
        display: "none"
      },
      "& .mantine-Slider-track::before": {
        content: '""',
        backgroundColor: Sn ? _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[4] : _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2]
      },
      "& .mantine-Slider-bar": {
        backgroundColor: Sn ? _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2] : _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[4]
      }
    }
  },
  track: {
    position: "relative",
    height: getSize$1({ sizes: sizes$3, size: Kn }),
    width: "100%",
    marginRight: kn ? rem$1(kn / 2) : getSize$1({ size: Kn, sizes: sizes$3 }),
    marginLeft: kn ? rem$1(kn / 2) : getSize$1({ size: Kn, sizes: sizes$3 }),
    "&::before": {
      content: '""',
      position: "absolute",
      top: 0,
      bottom: 0,
      borderRadius: _e.fn.radius(Qt),
      right: `calc(${kn ? rem$1(kn / 2) : getSize$1({ size: Kn, sizes: sizes$3 })} * -1)`,
      left: `calc(${kn ? rem$1(kn / 2) : getSize$1({ size: Kn, sizes: sizes$3 })} * -1)`,
      backgroundColor: Sn ? $n ? _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[4] : _e.fn.variant({ variant: "filled", color: Zt }).background : _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2],
      zIndex: 0
    }
  },
  bar: {
    position: "absolute",
    zIndex: 1,
    top: 0,
    bottom: 0,
    backgroundColor: Sn ? _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2] : $n ? _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[4] : _e.fn.variant({ variant: "filled", color: Zt }).background,
    borderRadius: _e.fn.radius(Qt)
  }
}));
const useStyles$P = useStyles$O;
var __defProp$E = Object.defineProperty, __defProps$o = Object.defineProperties, __getOwnPropDescs$o = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$F = Object.getOwnPropertySymbols, __hasOwnProp$F = Object.prototype.hasOwnProperty, __propIsEnum$F = Object.prototype.propertyIsEnumerable, __defNormalProp$E = (_e, Qt, Zt) => Qt in _e ? __defProp$E(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$E = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$F.call(Qt, Zt) && __defNormalProp$E(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$F)
    for (var Zt of __getOwnPropSymbols$F(Qt))
      __propIsEnum$F.call(Qt, Zt) && __defNormalProp$E(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$o = (_e, Qt) => __defProps$o(_e, __getOwnPropDescs$o(Qt)), __objRest$u = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$F.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$F)
    for (var $n of __getOwnPropSymbols$F(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$F.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function Track(_e) {
  var Qt = _e, {
    filled: Zt,
    size: $n,
    thumbSize: Sn,
    color: kn,
    classNames: Kn,
    styles: er,
    radius: Cr,
    children: kr,
    offset: Yr,
    disabled: Ms,
    marksOffset: Ds,
    unstyled: Ls,
    inverted: js,
    variant: zs,
    containerProps: Fs
  } = Qt, Bs = __objRest$u(Qt, [
    "filled",
    "size",
    "thumbSize",
    "color",
    "classNames",
    "styles",
    "radius",
    "children",
    "offset",
    "disabled",
    "marksOffset",
    "unstyled",
    "inverted",
    "variant",
    "containerProps"
  ]);
  const { classes: Hs } = useStyles$P({ color: kn, radius: Cr, disabled: Ms, inverted: js, thumbSize: Sn }, { name: "Slider", classNames: Kn, styles: er, unstyled: Ls, variant: zs, size: $n });
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", __spreadValues$E({
    className: Hs.trackContainer
  }, Fs), /* @__PURE__ */ React.createElement("div", {
    className: Hs.track
  }, /* @__PURE__ */ React.createElement(Box, {
    className: Hs.bar,
    sx: {
      left: `calc(${Yr}% - ${Sn ? rem$1(Sn / 2) : getSize$1({ size: $n, sizes: sizes$3 })})`,
      width: `calc(${Zt}% + 2 * ${Sn ? rem$1(Sn / 2) : getSize$1({ size: $n, sizes: sizes$3 })})`
    }
  }), kr)), /* @__PURE__ */ React.createElement(Marks$1, __spreadProps$o(__spreadValues$E({}, Bs), {
    size: $n,
    thumbSize: Sn,
    color: kn,
    offset: Ds,
    classNames: Kn,
    styles: er,
    disabled: Ms,
    unstyled: Ls,
    inverted: js,
    variant: zs
  })));
}
Track.displayName = "@mantine/core/SliderTrack";
var __defProp$D = Object.defineProperty, __defProps$n = Object.defineProperties, __getOwnPropDescs$n = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$E = Object.getOwnPropertySymbols, __hasOwnProp$E = Object.prototype.hasOwnProperty, __propIsEnum$E = Object.prototype.propertyIsEnumerable, __defNormalProp$D = (_e, Qt, Zt) => Qt in _e ? __defProp$D(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$D = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$E.call(Qt, Zt) && __defNormalProp$D(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$E)
    for (var Zt of __getOwnPropSymbols$E(Qt))
      __propIsEnum$E.call(Qt, Zt) && __defNormalProp$D(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$n = (_e, Qt) => __defProps$n(_e, __getOwnPropDescs$n(Qt)), __objRest$t = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$E.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$E)
    for (var $n of __getOwnPropSymbols$E(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$E.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const SliderRoot = reactExports.forwardRef((_e, Qt) => {
  var Zt = _e, {
    className: $n,
    size: Sn,
    classNames: kn,
    styles: Kn,
    disabled: er,
    unstyled: Cr,
    variant: kr
  } = Zt, Yr = __objRest$t(Zt, [
    "className",
    "size",
    "classNames",
    "styles",
    "disabled",
    "unstyled",
    "variant"
  ]);
  const { classes: Ms, cx: Ds } = useStyles$V(null, {
    name: "Slider",
    classNames: kn,
    styles: Kn,
    unstyled: Cr,
    variant: kr,
    size: Sn
  });
  return /* @__PURE__ */ React.createElement(Box, __spreadProps$n(__spreadValues$D({}, Yr), {
    tabIndex: -1,
    className: Ds(Ms.root, $n),
    ref: Qt
  }));
});
SliderRoot.displayName = "@mantine/core/SliderRoot";
function getFloatingValue(_e, Qt) {
  return parseFloat(_e.toFixed(Qt));
}
function getPrecision(_e) {
  if (!_e)
    return 0;
  const Qt = _e.toString().split(".");
  return Qt.length > 1 ? Qt[1].length : 0;
}
function getClientPosition(_e) {
  return "TouchEvent" in window && _e instanceof window.TouchEvent ? _e.touches[0].clientX : _e.clientX;
}
var __defProp$C = Object.defineProperty, __defProps$m = Object.defineProperties, __getOwnPropDescs$m = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$D = Object.getOwnPropertySymbols, __hasOwnProp$D = Object.prototype.hasOwnProperty, __propIsEnum$D = Object.prototype.propertyIsEnumerable, __defNormalProp$C = (_e, Qt, Zt) => Qt in _e ? __defProp$C(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$C = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$D.call(Qt, Zt) && __defNormalProp$C(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$D)
    for (var Zt of __getOwnPropSymbols$D(Qt))
      __propIsEnum$D.call(Qt, Zt) && __defNormalProp$C(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$m = (_e, Qt) => __defProps$m(_e, __getOwnPropDescs$m(Qt)), __objRest$s = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$D.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$D)
    for (var $n of __getOwnPropSymbols$D(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$D.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$q = {
  size: "md",
  radius: "xl",
  min: 0,
  max: 100,
  minRange: 10,
  step: 1,
  marks: [],
  label: (_e) => _e,
  labelTransition: "skew-down",
  labelTransitionDuration: 0,
  labelAlwaysOn: !1,
  thumbFromLabel: "",
  thumbToLabel: "",
  showLabelOnHover: !0,
  disabled: !1,
  scale: (_e) => _e
}, RangeSlider = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("RangeSlider", defaultProps$q, _e), {
    classNames: $n,
    styles: Sn,
    color: kn,
    value: Kn,
    onChange: er,
    onChangeEnd: Cr,
    size: kr,
    radius: Yr,
    min: Ms,
    max: Ds,
    minRange: Ls,
    maxRange: js,
    step: zs,
    precision: Fs,
    defaultValue: Bs,
    name: Hs,
    marks: Ws,
    label: Ys,
    labelTransition: El,
    labelTransitionDuration: Mu,
    labelTransitionTimingFunction: Pl,
    labelAlwaysOn: Iu,
    thumbFromLabel: Tu,
    thumbToLabel: Au,
    showLabelOnHover: Nu,
    thumbChildren: gm,
    disabled: pm,
    unstyled: zu,
    thumbSize: Yu,
    scale: sm,
    inverted: mm,
    variant: hm
  } = Zt, ym = __objRest$s(Zt, [
    "classNames",
    "styles",
    "color",
    "value",
    "onChange",
    "onChangeEnd",
    "size",
    "radius",
    "min",
    "max",
    "minRange",
    "maxRange",
    "step",
    "precision",
    "defaultValue",
    "name",
    "marks",
    "label",
    "labelTransition",
    "labelTransitionDuration",
    "labelTransitionTimingFunction",
    "labelAlwaysOn",
    "thumbFromLabel",
    "thumbToLabel",
    "showLabelOnHover",
    "thumbChildren",
    "disabled",
    "unstyled",
    "thumbSize",
    "scale",
    "inverted",
    "variant"
  ]), _m = Fs ?? getPrecision(zs), Sm = useMantineTheme(), [wm, Nm] = reactExports.useState(-1), [Cm, Im] = reactExports.useState(!1), [Am, Vm] = useUncontrolled({
    value: Kn,
    defaultValue: Bs,
    finalValue: [Ms, Ds],
    onChange: er
  }), Rm = reactExports.useRef(Am), Dm = reactExports.useRef([]), km = reactExports.useRef(void 0), zm = [
    getPosition({ value: Am[0], min: Ms, max: Ds }),
    getPosition({ value: Am[1], min: Ms, max: Ds })
  ], Pm = (a$) => {
    Vm(a$), Rm.current = a$;
  };
  reactExports.useEffect(() => {
    Array.isArray(Kn) && (Rm.current = Kn);
  }, Array.isArray(Kn) ? [Kn[0], Kn[1]] : [null, null]);
  const i$ = (a$, n$, m$) => {
    const j$ = [...Rm.current];
    j$[n$] = a$, n$ === 0 && (a$ > j$[1] - (Ls - 1e-9) && (j$[1] = Math.min(a$ + Ls, Ds)), a$ > (Ds - (Ls - 1e-9) || Ms) && (j$[n$] = Rm.current[n$]), j$[1] - a$ > js && (j$[1] = a$ + js)), n$ === 1 && (a$ < j$[0] + Ls && (j$[0] = Math.max(a$ - Ls, Ms)), a$ < j$[0] + Ls && (j$[n$] = Rm.current[n$]), a$ - j$[0] > js && (j$[0] = a$ - js)), Pm(j$), m$ && (Cr == null || Cr(Rm.current));
  }, o$ = (a$) => {
    if (!pm) {
      const n$ = getChangeValue({ value: a$, min: Ms, max: Ds, step: zs, precision: _m });
      i$(n$, km.current, !1);
    }
  }, { ref: u$, active: h$ } = useMove(({ x: a$ }) => o$(a$), { onScrubEnd: () => Cr == null ? void 0 : Cr(Rm.current) }, Sm.dir);
  function d$(a$) {
    km.current = a$;
  }
  const v$ = (a$) => {
    u$.current.focus();
    const n$ = u$.current.getBoundingClientRect(), m$ = getClientPosition(a$.nativeEvent), j$ = getChangeValue({
      value: m$ - n$.left,
      max: Ds,
      min: Ms,
      step: zs,
      containerWidth: n$.width
    }), Q$ = Math.abs(Am[0] - j$) > Math.abs(Am[1] - j$) ? 1 : 0, z$ = Sm.dir === "ltr" ? Q$ : Q$ === 1 ? 0 : 1;
    km.current = z$;
  }, $$ = () => wm !== 1 && wm !== 0 ? (Nm(0), 0) : wm, s$ = (a$) => {
    if (!pm)
      switch (a$.key) {
        case "ArrowUp": {
          a$.preventDefault();
          const n$ = $$();
          Dm.current[n$].focus(), i$(getFloatingValue(Math.min(Math.max(Rm.current[n$] + zs, Ms), Ds), _m), n$, !0);
          break;
        }
        case "ArrowRight": {
          a$.preventDefault();
          const n$ = $$();
          Dm.current[n$].focus(), i$(getFloatingValue(Math.min(Math.max(Sm.dir === "rtl" ? Rm.current[n$] - zs : Rm.current[n$] + zs, Ms), Ds), _m), n$, !0);
          break;
        }
        case "ArrowDown": {
          a$.preventDefault();
          const n$ = $$();
          Dm.current[n$].focus(), i$(getFloatingValue(Math.min(Math.max(Rm.current[n$] - zs, Ms), Ds), _m), n$, !0);
          break;
        }
        case "ArrowLeft": {
          a$.preventDefault();
          const n$ = $$();
          Dm.current[n$].focus(), i$(getFloatingValue(Math.min(Math.max(Sm.dir === "rtl" ? Rm.current[n$] + zs : Rm.current[n$] - zs, Ms), Ds), _m), n$, !0);
          break;
        }
      }
  }, l$ = {
    max: Ds,
    min: Ms,
    color: kn,
    size: kr,
    labelTransition: El,
    labelTransitionDuration: Mu,
    labelTransitionTimingFunction: Pl,
    labelAlwaysOn: Iu,
    onBlur: () => Nm(-1),
    classNames: $n,
    styles: Sn
  }, _$ = Array.isArray(gm);
  return /* @__PURE__ */ React.createElement(SliderRoot, __spreadProps$m(__spreadValues$C({}, ym), {
    size: kr,
    ref: Qt,
    styles: Sn,
    classNames: $n,
    disabled: pm,
    unstyled: zu,
    variant: hm
  }), /* @__PURE__ */ React.createElement(Track, {
    offset: zm[0],
    marksOffset: Am[0],
    filled: zm[1] - zm[0],
    marks: Ws,
    inverted: mm,
    size: kr,
    thumbSize: Yu,
    radius: Yr,
    color: kn,
    min: Ms,
    max: Ds,
    value: Am[1],
    styles: Sn,
    classNames: $n,
    onChange: (a$) => {
      const n$ = Math.abs(Am[0] - a$) > Math.abs(Am[1] - a$) ? 1 : 0, m$ = [...Am];
      m$[n$] = a$, Pm(m$);
    },
    disabled: pm,
    unstyled: zu,
    variant: hm,
    containerProps: {
      ref: u$,
      onMouseEnter: Nu ? () => Im(!0) : void 0,
      onMouseLeave: Nu ? () => Im(!1) : void 0,
      onTouchStartCapture: v$,
      onTouchEndCapture: () => {
        km.current = -1;
      },
      onMouseDownCapture: v$,
      onMouseUpCapture: () => {
        km.current = -1;
      },
      onKeyDownCapture: s$
    }
  }, /* @__PURE__ */ React.createElement(Thumb, __spreadProps$m(__spreadValues$C({}, l$), {
    value: sm(Am[0]),
    position: zm[0],
    dragging: h$,
    label: typeof Ys == "function" ? Ys(sm(Am[0])) : Ys,
    ref: (a$) => {
      Dm.current[0] = a$;
    },
    thumbLabel: Tu,
    onMouseDown: () => d$(0),
    onFocus: () => Nm(0),
    showLabelOnHover: Nu,
    isHovered: Cm,
    disabled: pm,
    unstyled: zu,
    thumbSize: Yu,
    variant: hm
  }), _$ ? gm[0] : gm), /* @__PURE__ */ React.createElement(Thumb, __spreadProps$m(__spreadValues$C({}, l$), {
    thumbLabel: Au,
    value: sm(Am[1]),
    position: zm[1],
    dragging: h$,
    label: typeof Ys == "function" ? Ys(sm(Am[1])) : Ys,
    ref: (a$) => {
      Dm.current[1] = a$;
    },
    onMouseDown: () => d$(1),
    onFocus: () => Nm(1),
    showLabelOnHover: Nu,
    isHovered: Cm,
    disabled: pm,
    unstyled: zu,
    thumbSize: Yu,
    variant: hm
  }), _$ ? gm[1] : gm)), /* @__PURE__ */ React.createElement("input", {
    type: "hidden",
    name: `${Hs}_from`,
    value: Am[0]
  }), /* @__PURE__ */ React.createElement("input", {
    type: "hidden",
    name: `${Hs}_to`,
    value: Am[1]
  }));
});
RangeSlider.displayName = "@mantine/core/RangeSlider";
var useStyles$M = createStyles((_e, { spacing: Qt, align: Zt, justify: $n }) => ({
  root: {
    display: "flex",
    flexDirection: "column",
    alignItems: Zt,
    justifyContent: $n,
    gap: getSize$1({ size: Qt, sizes: _e.spacing })
  }
}));
const useStyles$N = useStyles$M;
var __defProp$B = Object.defineProperty, __getOwnPropSymbols$C = Object.getOwnPropertySymbols, __hasOwnProp$C = Object.prototype.hasOwnProperty, __propIsEnum$C = Object.prototype.propertyIsEnumerable, __defNormalProp$B = (_e, Qt, Zt) => Qt in _e ? __defProp$B(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$B = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$C.call(Qt, Zt) && __defNormalProp$B(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$C)
    for (var Zt of __getOwnPropSymbols$C(Qt))
      __propIsEnum$C.call(Qt, Zt) && __defNormalProp$B(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$r = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$C.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$C)
    for (var $n of __getOwnPropSymbols$C(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$C.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$p = {
  spacing: "md",
  align: "stretch",
  justify: "flex-start"
}, Stack$1 = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Stack", defaultProps$p, _e), { spacing: $n, className: Sn, align: kn, justify: Kn, unstyled: er, variant: Cr } = Zt, kr = __objRest$r(Zt, ["spacing", "className", "align", "justify", "unstyled", "variant"]), { classes: Yr, cx: Ms } = useStyles$N({ spacing: $n, align: kn, justify: Kn }, { name: "Stack", unstyled: er, variant: Cr });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$B({
    className: Ms(Yr.root, Sn),
    ref: Qt
  }, kr));
});
Stack$1.displayName = "@mantine/core/Stack";
const SwitchGroupContext = reactExports.createContext(null), SwitchGroupProvider = SwitchGroupContext.Provider, useSwitchGroupContext = () => reactExports.useContext(SwitchGroupContext);
var __defProp$A = Object.defineProperty, __getOwnPropSymbols$B = Object.getOwnPropertySymbols, __hasOwnProp$B = Object.prototype.hasOwnProperty, __propIsEnum$B = Object.prototype.propertyIsEnumerable, __defNormalProp$A = (_e, Qt, Zt) => Qt in _e ? __defProp$A(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$A = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$B.call(Qt, Zt) && __defNormalProp$A(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$B)
    for (var Zt of __getOwnPropSymbols$B(Qt))
      __propIsEnum$B.call(Qt, Zt) && __defNormalProp$A(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$q = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$B.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$B)
    for (var $n of __getOwnPropSymbols$B(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$B.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$o = {
  size: "sm"
}, SwitchGroup = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("SwitchGroup", defaultProps$o, _e), { children: $n, value: Sn, defaultValue: kn, onChange: Kn, size: er, wrapperProps: Cr } = Zt, kr = __objRest$q(Zt, ["children", "value", "defaultValue", "onChange", "size", "wrapperProps"]), [Yr, Ms] = useUncontrolled({
    value: Sn,
    defaultValue: kn,
    finalValue: [],
    onChange: Kn
  }), Ds = (Ls) => {
    const js = Ls.currentTarget.value;
    Ms(Yr.includes(js) ? Yr.filter((zs) => zs !== js) : [...Yr, js]);
  };
  return /* @__PURE__ */ React.createElement(SwitchGroupProvider, {
    value: { value: Yr, onChange: Ds, size: er }
  }, /* @__PURE__ */ React.createElement(Input.Wrapper, __spreadValues$A(__spreadValues$A({
    labelElement: "div",
    size: er,
    __staticSelector: "SwitchGroup",
    ref: Qt
  }, Cr), kr), $n));
});
SwitchGroup.displayName = "@mantine/core/SwitchGroup";
var __defProp$z = Object.defineProperty, __defProps$l = Object.defineProperties, __getOwnPropDescs$l = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$A = Object.getOwnPropertySymbols, __hasOwnProp$A = Object.prototype.hasOwnProperty, __propIsEnum$A = Object.prototype.propertyIsEnumerable, __defNormalProp$z = (_e, Qt, Zt) => Qt in _e ? __defProp$z(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$z = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$A.call(Qt, Zt) && __defNormalProp$z(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$A)
    for (var Zt of __getOwnPropSymbols$A(Qt))
      __propIsEnum$A.call(Qt, Zt) && __defNormalProp$z(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$l = (_e, Qt) => __defProps$l(_e, __getOwnPropDescs$l(Qt));
const switchHeight = {
  xs: rem$1(16),
  sm: rem$1(20),
  md: rem$1(24),
  lg: rem$1(30),
  xl: rem$1(36)
}, switchWidth = {
  xs: rem$1(32),
  sm: rem$1(38),
  md: rem$1(46),
  lg: rem$1(56),
  xl: rem$1(72)
}, handleSizes = {
  xs: rem$1(12),
  sm: rem$1(14),
  md: rem$1(18),
  lg: rem$1(22),
  xl: rem$1(28)
}, labelFontSizes = {
  xs: rem$1(5),
  sm: rem$1(6),
  md: rem$1(7),
  lg: rem$1(9),
  xl: rem$1(11)
}, trackLabelPaddings = {
  xs: rem$1(4),
  sm: rem$1(5),
  md: rem$1(6),
  lg: rem$1(8),
  xl: rem$1(10)
};
var useStyles$K = createStyles((_e, { radius: Qt, color: Zt, labelPosition: $n, error: Sn }, { size: kn }) => {
  const Kn = getSize$1({ size: kn, sizes: handleSizes }), er = getSize$1({ size: Qt, sizes: _e.radius }), Cr = _e.fn.variant({ variant: "filled", color: Zt }), kr = getSize$1({ size: kn, sizes: switchWidth }), Yr = rem$1(kn === "xs" ? 1 : 2), Ms = _e.fn.variant({ variant: "filled", color: "red" }).background;
  return {
    root: {
      position: "relative"
    },
    input: {
      height: 0,
      width: 0,
      overflow: "hidden",
      whiteSpace: "nowrap",
      padding: 0,
      WebkitClipPath: "inset(50%)",
      clipPath: "inset(50%)",
      position: "absolute"
    },
    track: __spreadProps$l(__spreadValues$z({}, _e.fn.focusStyles("input:focus + &")), {
      cursor: _e.cursorType,
      overflow: "hidden",
      WebkitTapHighlightColor: "transparent",
      position: "relative",
      borderRadius: er,
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[2],
      border: `${rem$1(1)} solid ${Sn ? Ms : _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[3]}`,
      height: getSize$1({ size: kn, sizes: switchHeight }),
      minWidth: kr,
      margin: 0,
      transitionProperty: "background-color, border-color",
      transitionTimingFunction: _e.transitionTimingFunction,
      transitionDuration: "150ms",
      boxSizing: "border-box",
      appearance: "none",
      display: "flex",
      alignItems: "center",
      fontSize: getSize$1({ size: kn, sizes: labelFontSizes }),
      fontWeight: 600,
      order: $n === "left" ? 2 : 1,
      userSelect: "none",
      zIndex: 0,
      lineHeight: 0,
      color: _e.colorScheme === "dark" ? _e.colors.dark[1] : _e.colors.gray[6],
      transition: `color 150ms ${_e.transitionTimingFunction}`,
      "input:checked + &": {
        backgroundColor: Cr.background,
        borderColor: Cr.background,
        color: _e.white,
        transition: `color 150ms ${_e.transitionTimingFunction}`
      },
      "input:disabled + &": {
        backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2],
        borderColor: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2],
        cursor: "not-allowed",
        pointerEvents: "none"
      }
    }),
    thumb: {
      position: "absolute",
      zIndex: 1,
      borderRadius: er,
      boxSizing: "border-box",
      display: "flex",
      backgroundColor: _e.white,
      height: Kn,
      width: Kn,
      border: `${rem$1(1)} solid ${_e.colorScheme === "dark" ? _e.white : _e.colors.gray[3]}`,
      left: Yr,
      transition: `left 150ms ${_e.transitionTimingFunction}`,
      "& > *": {
        margin: "auto"
      },
      "@media (prefers-reduced-motion)": {
        transitionDuration: _e.respectReducedMotion ? "0ms" : ""
      },
      "input:checked + * > &": {
        left: `calc(100% - ${Kn} - ${Yr})`,
        borderColor: _e.white
      },
      "input:disabled + * > &": {
        borderColor: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2],
        backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[0]
      }
    },
    trackLabel: {
      height: "100%",
      display: "grid",
      placeContent: "center",
      minWidth: `calc(${kr} - ${Kn})`,
      paddingInline: getSize$1({ size: kn, sizes: trackLabelPaddings }),
      marginLeft: `calc(${Kn} + ${Yr})`,
      transition: `margin 150ms ${_e.transitionTimingFunction}`,
      "input:checked + * > &": {
        marginLeft: 0,
        marginRight: `calc(${Kn} + ${Yr})`
      }
    }
  };
});
const useStyles$L = useStyles$K;
var __defProp$y = Object.defineProperty, __defProps$k = Object.defineProperties, __getOwnPropDescs$k = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$z = Object.getOwnPropertySymbols, __hasOwnProp$z = Object.prototype.hasOwnProperty, __propIsEnum$z = Object.prototype.propertyIsEnumerable, __defNormalProp$y = (_e, Qt, Zt) => Qt in _e ? __defProp$y(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$y = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$z.call(Qt, Zt) && __defNormalProp$y(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$z)
    for (var Zt of __getOwnPropSymbols$z(Qt))
      __propIsEnum$z.call(Qt, Zt) && __defNormalProp$y(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$k = (_e, Qt) => __defProps$k(_e, __getOwnPropDescs$k(Qt)), __objRest$p = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$z.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$z)
    for (var $n of __getOwnPropSymbols$z(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$z.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$n = {
  offLabel: "",
  onLabel: "",
  size: "sm",
  radius: "xl",
  error: !1
}, Switch = reactExports.forwardRef((_e, Qt) => {
  var Zt;
  const $n = useComponentDefaultProps("Switch", defaultProps$n, _e), {
    className: Sn,
    color: kn,
    label: Kn,
    offLabel: er,
    onLabel: Cr,
    id: kr,
    style: Yr,
    size: Ms,
    radius: Ds,
    wrapperProps: Ls,
    children: js,
    unstyled: zs,
    styles: Fs,
    classNames: Bs,
    thumbIcon: Hs,
    sx: Ws,
    checked: Ys,
    defaultChecked: El,
    onChange: Mu,
    labelPosition: Pl,
    description: Iu,
    error: Tu,
    disabled: Au,
    variant: Nu
  } = $n, gm = __objRest$p($n, [
    "className",
    "color",
    "label",
    "offLabel",
    "onLabel",
    "id",
    "style",
    "size",
    "radius",
    "wrapperProps",
    "children",
    "unstyled",
    "styles",
    "classNames",
    "thumbIcon",
    "sx",
    "checked",
    "defaultChecked",
    "onChange",
    "labelPosition",
    "description",
    "error",
    "disabled",
    "variant"
  ]), pm = useSwitchGroupContext(), zu = (pm == null ? void 0 : pm.size) || Ms, { classes: Yu, cx: sm } = useStyles$L({ color: kn, radius: Ds, labelPosition: Pl, error: !!Tu }, { name: "Switch", classNames: Bs, styles: Fs, unstyled: zs, size: zu, variant: Nu }), { systemStyles: mm, rest: hm } = extractSystemStyles(gm), ym = useId$1(kr), _m = pm ? {
    checked: pm.value.includes(hm.value),
    onChange: pm.onChange
  } : {}, [Sm, wm] = useUncontrolled({
    value: (Zt = _m.checked) != null ? Zt : Ys,
    defaultValue: El,
    finalValue: !1
  });
  return /* @__PURE__ */ React.createElement(InlineInput, __spreadValues$y(__spreadValues$y({
    className: sm(Sn, Yu.root),
    sx: Ws,
    style: Yr,
    id: ym,
    size: (pm == null ? void 0 : pm.size) || Ms,
    labelPosition: Pl,
    label: Kn,
    description: Iu,
    error: Tu,
    disabled: Au,
    __staticSelector: "Switch",
    classNames: Bs,
    styles: Fs,
    unstyled: zs,
    "data-checked": _m.checked || void 0,
    variant: Nu
  }, mm), Ls), /* @__PURE__ */ React.createElement("input", __spreadProps$k(__spreadValues$y({}, hm), {
    disabled: Au,
    checked: Sm,
    onChange: (Nm) => {
      pm ? _m.onChange(Nm) : Mu == null || Mu(Nm), wm(Nm.currentTarget.checked);
    },
    id: ym,
    ref: Qt,
    type: "checkbox",
    className: Yu.input
  })), /* @__PURE__ */ React.createElement("label", {
    htmlFor: ym,
    className: Yu.track
  }, /* @__PURE__ */ React.createElement("div", {
    className: Yu.thumb
  }, Hs), /* @__PURE__ */ React.createElement("div", {
    className: Yu.trackLabel
  }, Sm ? Cr : er)));
});
Switch.displayName = "@mantine/core/Switch";
Switch.Group = SwitchGroup;
var __defProp$x = Object.defineProperty, __defProps$j = Object.defineProperties, __getOwnPropDescs$j = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$y = Object.getOwnPropertySymbols, __hasOwnProp$y = Object.prototype.hasOwnProperty, __propIsEnum$y = Object.prototype.propertyIsEnumerable, __defNormalProp$x = (_e, Qt, Zt) => Qt in _e ? __defProp$x(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$x = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$y.call(Qt, Zt) && __defNormalProp$x(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$y)
    for (var Zt of __getOwnPropSymbols$y(Qt))
      __propIsEnum$y.call(Qt, Zt) && __defNormalProp$x(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$j = (_e, Qt) => __defProps$j(_e, __getOwnPropDescs$j(Qt)), useStyles$I = createStyles((_e, {
  captionSide: Qt,
  horizontalSpacing: Zt,
  verticalSpacing: $n,
  fontSize: Sn,
  withBorder: kn,
  withColumnBorders: Kn
}) => {
  const er = `${rem$1(1)} solid ${_e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[3]}`;
  return {
    root: __spreadProps$j(__spreadValues$x({}, _e.fn.fontStyles()), {
      width: "100%",
      borderCollapse: "collapse",
      captionSide: Qt,
      color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
      lineHeight: _e.lineHeight,
      border: kn ? er : void 0,
      "& > caption": {
        marginTop: Qt === "top" ? 0 : _e.spacing.xs,
        marginBottom: Qt === "bottom" ? 0 : _e.spacing.xs,
        fontSize: _e.fontSizes.sm,
        color: _e.colorScheme === "dark" ? _e.colors.dark[2] : _e.colors.gray[6]
      },
      "& > thead > tr > th, & > tfoot > tr > th, & > tbody > tr > th": {
        textAlign: "left",
        fontWeight: "bold",
        color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.colors.gray[7],
        fontSize: getSize$1({ size: Sn, sizes: _e.fontSizes }),
        padding: `${getSize$1({ size: $n, sizes: _e.spacing })} ${getSize$1({
          size: Zt,
          sizes: _e.spacing
        })}`
      },
      "& > thead > tr > th": {
        borderBottom: er
      },
      "& > tfoot > tr > th, & > tbody > tr > th": {
        borderTop: er
      },
      "& > tbody > tr > td": {
        padding: `${getSize$1({
          size: $n,
          sizes: _e.spacing
        })} ${getSize$1({ size: Zt, sizes: _e.spacing })}`,
        borderTop: er,
        fontSize: getSize$1({ size: Sn, sizes: _e.fontSizes })
      },
      "& > tbody > tr:first-of-type > td, & > tbody > tr:first-of-type > th": {
        borderTop: "none"
      },
      "& > thead > tr > th, & > tbody > tr > td": {
        borderRight: Kn ? er : "none",
        "&:last-of-type": {
          borderRight: "none",
          borderLeft: Kn ? er : "none"
        }
      },
      "& > tbody > tr > th": {
        borderRight: Kn ? er : "none"
      },
      "&[data-striped] > tbody > tr:nth-of-type(odd)": {
        backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[0]
      },
      "&[data-hover] > tbody > tr": _e.fn.hover({
        backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[1]
      })
    })
  };
});
const useStyles$J = useStyles$I;
var __defProp$w = Object.defineProperty, __defProps$i = Object.defineProperties, __getOwnPropDescs$i = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$x = Object.getOwnPropertySymbols, __hasOwnProp$x = Object.prototype.hasOwnProperty, __propIsEnum$x = Object.prototype.propertyIsEnumerable, __defNormalProp$w = (_e, Qt, Zt) => Qt in _e ? __defProp$w(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$w = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$x.call(Qt, Zt) && __defNormalProp$w(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$x)
    for (var Zt of __getOwnPropSymbols$x(Qt))
      __propIsEnum$x.call(Qt, Zt) && __defNormalProp$w(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$i = (_e, Qt) => __defProps$i(_e, __getOwnPropDescs$i(Qt)), __objRest$o = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$x.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$x)
    for (var $n of __getOwnPropSymbols$x(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$x.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$m = {
  striped: !1,
  highlightOnHover: !1,
  captionSide: "top",
  horizontalSpacing: "xs",
  fontSize: "sm",
  verticalSpacing: 7,
  withBorder: !1,
  withColumnBorders: !1
}, Table = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Table", defaultProps$m, _e), {
    className: $n,
    children: Sn,
    striped: kn,
    highlightOnHover: Kn,
    captionSide: er,
    horizontalSpacing: Cr,
    verticalSpacing: kr,
    fontSize: Yr,
    unstyled: Ms,
    withBorder: Ds,
    withColumnBorders: Ls,
    variant: js
  } = Zt, zs = __objRest$o(Zt, [
    "className",
    "children",
    "striped",
    "highlightOnHover",
    "captionSide",
    "horizontalSpacing",
    "verticalSpacing",
    "fontSize",
    "unstyled",
    "withBorder",
    "withColumnBorders",
    "variant"
  ]), { classes: Fs, cx: Bs } = useStyles$J({ captionSide: er, verticalSpacing: kr, horizontalSpacing: Cr, fontSize: Yr, withBorder: Ds, withColumnBorders: Ls }, { unstyled: Ms, name: "Table", variant: js });
  return /* @__PURE__ */ React.createElement(Box, __spreadProps$i(__spreadValues$w({}, zs), {
    component: "table",
    ref: Qt,
    className: Bs(Fs.root, $n),
    "data-striped": kn || void 0,
    "data-hover": Kn || void 0
  }), Sn);
});
Table.displayName = "@mantine/core/Table";
const TABS_ERRORS = {
  context: "Tabs component was not found in the tree",
  value: "Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value"
}, [TabsContextProvider, useTabsContext] = createSafeContext(TABS_ERRORS.context);
var __defProp$v = Object.defineProperty, __getOwnPropSymbols$w = Object.getOwnPropertySymbols, __hasOwnProp$w = Object.prototype.hasOwnProperty, __propIsEnum$w = Object.prototype.propertyIsEnumerable, __defNormalProp$v = (_e, Qt, Zt) => Qt in _e ? __defProp$v(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$v = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$w.call(Qt, Zt) && __defNormalProp$v(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$w)
    for (var Zt of __getOwnPropSymbols$w(Qt))
      __propIsEnum$w.call(Qt, Zt) && __defNormalProp$v(_e, Zt, Qt[Zt]);
  return _e;
};
function getVariantStyles$2({ orientation: _e, inverted: Qt, placement: Zt }, $n, Sn) {
  const kn = _e === "vertical";
  return Sn === "default" ? {
    [kn ? Zt === "left" ? "borderRight" : "borderLeft" : Qt ? "borderTop" : "borderBottom"]: `${rem$1(2)} solid ${$n.colorScheme === "dark" ? $n.colors.dark[4] : $n.colors.gray[3]}`
  } : Sn === "outline" ? {
    [kn ? Zt === "left" ? "borderRight" : "borderLeft" : Qt ? "borderTop" : "borderBottom"]: `${rem$1(1)} solid ${$n.colorScheme === "dark" ? $n.colors.dark[4] : $n.colors.gray[3]}`
  } : Sn === "pills" ? {
    gap: `calc(${$n.spacing.sm} / 2)`
  } : {};
}
var useStyles$G = createStyles((_e, Qt, { variant: Zt }) => {
  const $n = Qt.orientation === "vertical";
  return {
    tabsList: __spreadValues$v({
      display: "flex",
      flexWrap: "wrap",
      flexDirection: $n ? "column" : "row",
      justifyContent: GROUP_POSITIONS[Qt.position],
      '& [role="tab"]': {
        flex: Qt.grow ? 1 : void 0
      }
    }, getVariantStyles$2(Qt, _e, Zt))
  };
});
const useStyles$H = useStyles$G;
var __defProp$u = Object.defineProperty, __defProps$h = Object.defineProperties, __getOwnPropDescs$h = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$v = Object.getOwnPropertySymbols, __hasOwnProp$v = Object.prototype.hasOwnProperty, __propIsEnum$v = Object.prototype.propertyIsEnumerable, __defNormalProp$u = (_e, Qt, Zt) => Qt in _e ? __defProp$u(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$u = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$v.call(Qt, Zt) && __defNormalProp$u(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$v)
    for (var Zt of __getOwnPropSymbols$v(Qt))
      __propIsEnum$v.call(Qt, Zt) && __defNormalProp$u(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$h = (_e, Qt) => __defProps$h(_e, __getOwnPropDescs$h(Qt)), __objRest$n = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$v.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$v)
    for (var $n of __getOwnPropSymbols$v(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$v.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$l = {
  grow: !1,
  position: "left"
}, TabsList = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("TabsList", defaultProps$l, _e), { children: $n, className: Sn, grow: kn, position: Kn } = Zt, er = __objRest$n(Zt, ["children", "className", "grow", "position"]), { orientation: Cr, variant: kr, color: Yr, radius: Ms, inverted: Ds, placement: Ls, classNames: js, styles: zs, unstyled: Fs } = useTabsContext(), { classes: Bs, cx: Hs } = useStyles$H({ orientation: Cr, grow: kn, color: Yr, position: Kn, radius: Ms, inverted: Ds, placement: Ls }, { name: "Tabs", unstyled: Fs, classNames: js, styles: zs, variant: kr });
  return /* @__PURE__ */ React.createElement(Box, __spreadProps$h(__spreadValues$u({}, er), {
    className: Hs(Bs.tabsList, Sn),
    ref: Qt,
    role: "tablist",
    "aria-orientation": Cr
  }), $n);
});
TabsList.displayName = "@mantine/core/TabsList";
var useStyles$E = createStyles((_e, { orientation: Qt }) => ({
  panel: {
    flex: Qt === "vertical" ? 1 : void 0
  }
}));
const useStyles$F = useStyles$E;
var __defProp$t = Object.defineProperty, __defProps$g = Object.defineProperties, __getOwnPropDescs$g = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$u = Object.getOwnPropertySymbols, __hasOwnProp$u = Object.prototype.hasOwnProperty, __propIsEnum$u = Object.prototype.propertyIsEnumerable, __defNormalProp$t = (_e, Qt, Zt) => Qt in _e ? __defProp$t(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$t = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$u.call(Qt, Zt) && __defNormalProp$t(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$u)
    for (var Zt of __getOwnPropSymbols$u(Qt))
      __propIsEnum$u.call(Qt, Zt) && __defNormalProp$t(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$g = (_e, Qt) => __defProps$g(_e, __getOwnPropDescs$g(Qt)), __objRest$m = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$u.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$u)
    for (var $n of __getOwnPropSymbols$u(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$u.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$k = {}, TabsPanel = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("TabsPanel", defaultProps$k, _e), { value: $n, children: Sn, sx: kn, className: Kn } = Zt, er = __objRest$m(Zt, ["value", "children", "sx", "className"]), Cr = useTabsContext(), { classes: kr, cx: Yr } = useStyles$F({
    orientation: Cr.orientation,
    color: Cr.color,
    radius: Cr.radius,
    inverted: Cr.inverted,
    placement: Cr.placement
  }, {
    name: "Tabs",
    unstyled: Cr.unstyled,
    classNames: Cr.classNames,
    styles: Cr.styles,
    variant: Cr.variant
  }), Ms = Cr.getPanelId($n), Ds = Cr.value === $n, Ls = Cr.keepMounted || Ds ? Sn : null;
  return reactExports.useEffect(() => (Cr.setMountedPanelIds((js) => [...js, Ms]), Cr.setMountedPanelIds((js) => js.filter((zs) => zs !== Ms))), [Ms]), /* @__PURE__ */ React.createElement(Box, __spreadProps$g(__spreadValues$t({}, er), {
    ref: Qt,
    sx: [{ display: Ds ? void 0 : "none" }, ...packSx(kn)],
    className: Yr(kr.panel, Kn),
    role: "tabpanel",
    id: Ms,
    "aria-labelledby": Cr.getTabId($n)
  }), Ls);
});
TabsPanel.displayName = "@mantine/core/TabsPanel";
var __defProp$s = Object.defineProperty, __defProps$f = Object.defineProperties, __getOwnPropDescs$f = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$t = Object.getOwnPropertySymbols, __hasOwnProp$t = Object.prototype.hasOwnProperty, __propIsEnum$t = Object.prototype.propertyIsEnumerable, __defNormalProp$s = (_e, Qt, Zt) => Qt in _e ? __defProp$s(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$s = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$t.call(Qt, Zt) && __defNormalProp$s(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$t)
    for (var Zt of __getOwnPropSymbols$t(Qt))
      __propIsEnum$t.call(Qt, Zt) && __defNormalProp$s(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$f = (_e, Qt) => __defProps$f(_e, __getOwnPropDescs$f(Qt));
function getVariantStyles$1(_e, { orientation: Qt, color: Zt, radius: $n, inverted: Sn, placement: kn }, Kn) {
  const er = Qt === "vertical", Cr = _e.fn.variant({ color: Zt, variant: "filled" }), kr = rem$1(_e.fn.radius($n)), Yr = Qt === "vertical" ? kn === "left" ? `${kr} 0 0 ${kr}` : ` 0 ${kr} ${kr} 0` : Sn ? `0 0 ${kr} ${kr}` : `${kr} ${kr} 0 0`;
  return Kn === "default" ? __spreadProps$f(__spreadValues$s({
    [er ? kn === "left" ? "borderRight" : "borderLeft" : Sn ? "borderTop" : "borderBottom"]: `${rem$1(2)} solid transparent`,
    [er ? kn === "left" ? "marginRight" : "marginLeft" : Sn ? "marginTop" : "marginBottom"]: rem$1(-2),
    borderRadius: Yr
  }, _e.fn.hover({
    backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[0],
    borderColor: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[3]
  })), {
    "&[data-active]": __spreadValues$s({
      borderColor: Cr.background,
      color: _e.colorScheme === "dark" ? _e.white : _e.black
    }, _e.fn.hover({ borderColor: Cr.background }))
  }) : Kn === "outline" ? {
    borderRadius: Yr,
    border: `${rem$1(1)} solid transparent`,
    [er ? kn === "left" ? "borderRight" : "borderLeft" : Sn ? "borderTop" : "borderBottom"]: "none",
    "&[data-active]": {
      borderColor: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[3],
      "&::before": {
        content: '""',
        backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[7] : _e.white,
        position: "absolute",
        bottom: er ? 0 : Sn ? "unset" : rem$1(-1),
        top: er ? 0 : Sn ? rem$1(-1) : "unset",
        [er ? "width" : "height"]: rem$1(1),
        right: er ? kn === "left" ? rem$1(-1) : "unset" : 0,
        left: er ? kn === "left" ? "unset" : rem$1(-1) : 0
      }
    }
  } : Kn === "pills" ? __spreadProps$f(__spreadValues$s({
    borderRadius: _e.fn.radius($n)
  }, _e.fn.hover({
    backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[0]
  })), {
    "&[data-active]": __spreadValues$s({
      backgroundColor: Cr.background,
      color: _e.white
    }, _e.fn.hover({ backgroundColor: Cr.background }))
  }) : {};
}
var useStyles$C = createStyles((_e, Qt, { variant: Zt }) => ({
  tabLabel: {},
  tab: __spreadValues$s({
    position: "relative",
    padding: `${_e.spacing.xs} ${_e.spacing.md}`,
    paddingLeft: Qt.withIcon ? _e.spacing.xs : void 0,
    paddingRight: Qt.withRightSection ? _e.spacing.xs : void 0,
    fontSize: _e.fontSizes.sm,
    whiteSpace: "nowrap",
    zIndex: 0,
    display: "flex",
    alignItems: "center",
    justifyContent: Qt.orientation === "horizontal" ? "center" : void 0,
    lineHeight: 1,
    "&:disabled": __spreadValues$s({
      opacity: 0.5,
      cursor: "not-allowed"
    }, _e.fn.hover({ backgroundColor: "transparent" })),
    "&:focus": {
      zIndex: 1
    }
  }, getVariantStyles$1(_e, Qt, Zt)),
  tabRightSection: {
    display: "flex",
    justifyContent: "center",
    alignItems: "center",
    "&:not(:only-child)": {
      marginLeft: rem$1(7)
    }
  },
  tabIcon: {
    display: "flex",
    justifyContent: "center",
    alignItems: "center",
    "&:not(:only-child)": {
      marginRight: rem$1(7)
    }
  }
}));
const useStyles$D = useStyles$C;
var __defProp$r = Object.defineProperty, __defProps$e = Object.defineProperties, __getOwnPropDescs$e = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$s = Object.getOwnPropertySymbols, __hasOwnProp$s = Object.prototype.hasOwnProperty, __propIsEnum$s = Object.prototype.propertyIsEnumerable, __defNormalProp$r = (_e, Qt, Zt) => Qt in _e ? __defProp$r(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$r = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$s.call(Qt, Zt) && __defNormalProp$r(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$s)
    for (var Zt of __getOwnPropSymbols$s(Qt))
      __propIsEnum$s.call(Qt, Zt) && __defNormalProp$r(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$e = (_e, Qt) => __defProps$e(_e, __getOwnPropDescs$e(Qt)), __objRest$l = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$s.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$s)
    for (var $n of __getOwnPropSymbols$s(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$s.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$j = {}, Tab = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("TabsTab", defaultProps$j, _e), { value: $n, children: Sn, onKeyDown: kn, onClick: Kn, className: er, icon: Cr, rightSection: kr, color: Yr } = Zt, Ms = __objRest$l(Zt, ["value", "children", "onKeyDown", "onClick", "className", "icon", "rightSection", "color"]), Ds = useTabsContext(), Ls = !!Cr, js = !!kr, { theme: zs, classes: Fs, cx: Bs } = useStyles$D({
    withIcon: Ls || js && !Sn,
    withRightSection: js || Ls && !Sn,
    orientation: Ds.orientation,
    color: Yr || Ds.color,
    radius: Ds.radius,
    inverted: Ds.inverted,
    placement: Ds.placement
  }, {
    name: "Tabs",
    unstyled: Ds.unstyled,
    classNames: Ds.classNames,
    styles: Ds.styles,
    variant: Ds.variant
  }), Hs = $n === Ds.value, Ws = Ds.getPanelId($n), Ys = Ds.mountedPanelIds.includes($n) ? Ws : void 0, El = (Mu) => {
    Ds.onTabChange(Ds.allowTabDeactivation && $n === Ds.value ? null : $n), Kn == null || Kn(Mu);
  };
  return /* @__PURE__ */ React.createElement(UnstyledButton, __spreadProps$e(__spreadValues$r({}, Ms), {
    unstyled: Ds.unstyled,
    className: Bs(Fs.tab, er),
    "data-active": Hs || void 0,
    ref: Qt,
    type: "button",
    role: "tab",
    id: Ds.getTabId($n),
    "aria-selected": Hs,
    tabIndex: Hs || Ds.value === null ? 0 : -1,
    "aria-controls": Ys,
    onClick: El,
    onKeyDown: createScopedKeydownHandler({
      siblingSelector: '[role="tab"]',
      parentSelector: '[role="tablist"]',
      activateOnFocus: Ds.activateTabWithKeyboard,
      loop: Ds.loop,
      dir: zs.dir,
      orientation: Ds.orientation,
      onKeyDown: kn
    })
  }), Cr && /* @__PURE__ */ React.createElement("span", {
    className: Fs.tabIcon
  }, Cr), Sn && /* @__PURE__ */ React.createElement("span", {
    className: Fs.tabLabel
  }, Sn), kr && /* @__PURE__ */ React.createElement("span", {
    className: Fs.tabRightSection
  }, kr));
});
Tab.displayName = "@mantine/core/Tab";
function TabsProvider({
  defaultValue: _e,
  value: Qt,
  onTabChange: Zt,
  orientation: $n,
  children: Sn,
  loop: kn,
  id: Kn,
  activateTabWithKeyboard: er,
  allowTabDeactivation: Cr,
  variant: kr,
  color: Yr,
  radius: Ms,
  inverted: Ds,
  placement: Ls,
  keepMounted: js = !0,
  classNames: zs,
  styles: Fs,
  unstyled: Bs
}) {
  const Hs = useId$1(Kn), [Ws, Ys] = reactExports.useState([]), [El, Mu] = useUncontrolled({
    value: Qt,
    defaultValue: _e,
    finalValue: null,
    onChange: Zt
  });
  return /* @__PURE__ */ React.createElement(TabsContextProvider, {
    value: {
      placement: Ls,
      value: El,
      orientation: $n,
      id: Hs,
      loop: kn,
      activateTabWithKeyboard: er,
      getTabId: getSafeId(`${Hs}-tab`, TABS_ERRORS.value),
      getPanelId: getSafeId(`${Hs}-panel`, TABS_ERRORS.value),
      onTabChange: Mu,
      setMountedPanelIds: Ys,
      mountedPanelIds: Ws,
      allowTabDeactivation: Cr,
      variant: kr,
      color: Yr,
      radius: Ms,
      inverted: Ds,
      keepMounted: js,
      classNames: zs,
      styles: Fs,
      unstyled: Bs
    }
  }, Sn);
}
TabsProvider.displayName = "@mantine/core/TabsProvider";
var useStyles$A = createStyles((_e, { orientation: Qt, placement: Zt }) => ({
  root: {
    display: Qt === "vertical" ? "flex" : void 0,
    flexDirection: Zt === "right" ? "row-reverse" : "row"
  }
}));
const useStyles$B = useStyles$A;
var __defProp$q = Object.defineProperty, __defProps$d = Object.defineProperties, __getOwnPropDescs$d = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$r = Object.getOwnPropertySymbols, __hasOwnProp$r = Object.prototype.hasOwnProperty, __propIsEnum$r = Object.prototype.propertyIsEnumerable, __defNormalProp$q = (_e, Qt, Zt) => Qt in _e ? __defProp$q(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$q = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$r.call(Qt, Zt) && __defNormalProp$q(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$r)
    for (var Zt of __getOwnPropSymbols$r(Qt))
      __propIsEnum$r.call(Qt, Zt) && __defNormalProp$q(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$d = (_e, Qt) => __defProps$d(_e, __getOwnPropDescs$d(Qt)), __objRest$k = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$r.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$r)
    for (var $n of __getOwnPropSymbols$r(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$r.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$i = {
  orientation: "horizontal",
  loop: !0,
  activateTabWithKeyboard: !0,
  allowTabDeactivation: !1,
  unstyled: !1,
  inverted: !1,
  variant: "default",
  placement: "left"
}, Tabs = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Tabs", defaultProps$i, _e), {
    defaultValue: $n,
    value: Sn,
    orientation: kn,
    loop: Kn,
    activateTabWithKeyboard: er,
    allowTabDeactivation: Cr,
    children: kr,
    id: Yr,
    onTabChange: Ms,
    variant: Ds,
    color: Ls,
    className: js,
    unstyled: zs,
    classNames: Fs,
    styles: Bs,
    radius: Hs,
    inverted: Ws,
    keepMounted: Ys,
    placement: El
  } = Zt, Mu = __objRest$k(Zt, [
    "defaultValue",
    "value",
    "orientation",
    "loop",
    "activateTabWithKeyboard",
    "allowTabDeactivation",
    "children",
    "id",
    "onTabChange",
    "variant",
    "color",
    "className",
    "unstyled",
    "classNames",
    "styles",
    "radius",
    "inverted",
    "keepMounted",
    "placement"
  ]), { classes: Pl, cx: Iu } = useStyles$B({ orientation: kn, color: Ls, radius: Hs, inverted: Ws, placement: El }, { unstyled: zs, name: "Tabs", classNames: Fs, styles: Bs, variant: Ds });
  return /* @__PURE__ */ React.createElement(TabsProvider, {
    activateTabWithKeyboard: er,
    defaultValue: $n,
    orientation: kn,
    onTabChange: Ms,
    value: Sn,
    id: Yr,
    loop: Kn,
    allowTabDeactivation: Cr,
    color: Ls,
    variant: Ds,
    radius: Hs,
    inverted: Ws,
    keepMounted: Ys,
    placement: El,
    classNames: Fs,
    styles: Bs,
    unstyled: zs
  }, /* @__PURE__ */ React.createElement(Box, __spreadProps$d(__spreadValues$q({}, Mu), {
    className: Iu(Pl.root, js),
    id: Yr,
    ref: Qt
  }), kr));
});
Tabs.List = TabsList;
Tabs.Tab = Tab;
Tabs.Panel = TabsPanel;
Tabs.displayName = "@mantine/core/Tabs";
var __defProp$p = Object.defineProperty, __defProps$c = Object.defineProperties, __getOwnPropDescs$c = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$q = Object.getOwnPropertySymbols, __hasOwnProp$q = Object.prototype.hasOwnProperty, __propIsEnum$q = Object.prototype.propertyIsEnumerable, __defNormalProp$p = (_e, Qt, Zt) => Qt in _e ? __defProp$p(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$p = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$q.call(Qt, Zt) && __defNormalProp$p(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$q)
    for (var Zt of __getOwnPropSymbols$q(Qt))
      __propIsEnum$q.call(Qt, Zt) && __defNormalProp$p(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$c = (_e, Qt) => __defProps$c(_e, __getOwnPropDescs$c(Qt));
const sizes$2 = {
  xs: rem$1(16),
  sm: rem$1(20),
  md: rem$1(26),
  lg: rem$1(32),
  xl: rem$1(40)
}, THEME_ICON_VARIANTS = ["filled", "light", "gradient", "outline", "default"];
function getVariantStyles({ theme: _e, variant: Qt, color: Zt, gradient: $n }) {
  if (!THEME_ICON_VARIANTS.includes(Qt))
    return null;
  const Sn = _e.fn.variant({
    variant: Qt,
    color: Zt || _e.primaryColor,
    gradient: $n,
    primaryFallback: !1
  });
  return {
    backgroundColor: Sn.background,
    color: Sn.color,
    backgroundImage: Qt === "gradient" ? Sn.background : void 0,
    border: `${rem$1(Qt === "gradient" ? 0 : 1)} solid ${Sn.border}`
  };
}
var useStyles$y = createStyles((_e, { color: Qt, radius: Zt, gradient: $n }, { variant: Sn, size: kn }) => {
  const Kn = getSize$1({ size: kn, sizes: sizes$2 });
  return {
    root: __spreadValues$p(__spreadProps$c(__spreadValues$p({}, _e.fn.fontStyles()), {
      display: "inline-flex",
      alignItems: "center",
      justifyContent: "center",
      boxSizing: "border-box",
      width: Kn,
      height: Kn,
      minWidth: Kn,
      minHeight: Kn,
      borderRadius: _e.fn.radius(Zt)
    }), getVariantStyles({ theme: _e, variant: Sn, gradient: $n, color: Qt }))
  };
});
const useStyles$z = useStyles$y;
var __defProp$o = Object.defineProperty, __getOwnPropSymbols$p = Object.getOwnPropertySymbols, __hasOwnProp$p = Object.prototype.hasOwnProperty, __propIsEnum$p = Object.prototype.propertyIsEnumerable, __defNormalProp$o = (_e, Qt, Zt) => Qt in _e ? __defProp$o(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$o = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$p.call(Qt, Zt) && __defNormalProp$o(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$p)
    for (var Zt of __getOwnPropSymbols$p(Qt))
      __propIsEnum$p.call(Qt, Zt) && __defNormalProp$o(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$j = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$p.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$p)
    for (var $n of __getOwnPropSymbols$p(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$p.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$h = {
  size: "md",
  variant: "filled"
}, ThemeIcon = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("ThemeIcon", defaultProps$h, _e), { className: $n, size: Sn, radius: kn, variant: Kn, color: er, children: Cr, gradient: kr, unstyled: Yr } = Zt, Ms = __objRest$j(Zt, ["className", "size", "radius", "variant", "color", "children", "gradient", "unstyled"]), { classes: Ds, cx: Ls } = useStyles$z({ variant: Kn, radius: kn, color: er, gradient: kr }, { name: "ThemeIcon", unstyled: Yr, variant: Kn, size: Sn });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$o({
    className: Ls(Ds.root, $n),
    ref: Qt
  }, Ms), Cr);
});
ThemeIcon.displayName = "@mantine/core/ThemeIcon";
var __defProp$n = Object.defineProperty, __defProps$b = Object.defineProperties, __getOwnPropDescs$b = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$o = Object.getOwnPropertySymbols, __hasOwnProp$o = Object.prototype.hasOwnProperty, __propIsEnum$o = Object.prototype.propertyIsEnumerable, __defNormalProp$n = (_e, Qt, Zt) => Qt in _e ? __defProp$n(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$n = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$o.call(Qt, Zt) && __defNormalProp$n(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$o)
    for (var Zt of __getOwnPropSymbols$o(Qt))
      __propIsEnum$o.call(Qt, Zt) && __defNormalProp$n(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$b = (_e, Qt) => __defProps$b(_e, __getOwnPropDescs$b(Qt));
function getFontSize$1(_e, Qt, Zt) {
  return typeof _e < "u" ? _e in Zt.headings.sizes ? Zt.headings.sizes[_e].fontSize : rem$1(_e) : Zt.headings.sizes[Qt].fontSize;
}
function getLineHeight(_e, Qt, Zt) {
  return typeof _e < "u" && _e in Zt.headings.sizes ? Zt.headings.sizes[_e].lineHeight : Zt.headings.sizes[Qt].lineHeight;
}
var useStyles$w = createStyles((_e, { element: Qt, weight: Zt, inline: $n }, { size: Sn }) => ({
  root: __spreadProps$b(__spreadValues$n({}, _e.fn.fontStyles()), {
    fontFamily: _e.headings.fontFamily,
    fontWeight: Zt || _e.headings.sizes[Qt].fontWeight || _e.headings.fontWeight,
    fontSize: getFontSize$1(Sn, Qt, _e),
    lineHeight: $n ? 1 : getLineHeight(Sn, Qt, _e),
    margin: 0
  })
}));
const useStyles$x = useStyles$w;
var __defProp$m = Object.defineProperty, __getOwnPropSymbols$n = Object.getOwnPropertySymbols, __hasOwnProp$n = Object.prototype.hasOwnProperty, __propIsEnum$n = Object.prototype.propertyIsEnumerable, __defNormalProp$m = (_e, Qt, Zt) => Qt in _e ? __defProp$m(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$m = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$n.call(Qt, Zt) && __defNormalProp$m(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$n)
    for (var Zt of __getOwnPropSymbols$n(Qt))
      __propIsEnum$n.call(Qt, Zt) && __defNormalProp$m(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$i = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$n.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$n)
    for (var $n of __getOwnPropSymbols$n(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$n.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$g = {
  order: 1
}, Title = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Title", defaultProps$g, _e), { className: $n, order: Sn, children: kn, unstyled: Kn, size: er, weight: Cr, inline: kr, variant: Yr } = Zt, Ms = __objRest$i(Zt, ["className", "order", "children", "unstyled", "size", "weight", "inline", "variant"]), { classes: Ds, cx: Ls } = useStyles$x({ element: `h${Sn}`, weight: Cr, inline: kr }, { name: "Title", unstyled: Kn, variant: Yr, size: er });
  return [1, 2, 3, 4, 5, 6].includes(Sn) ? /* @__PURE__ */ React.createElement(Text, __spreadValues$m({
    variant: Yr,
    component: `h${Sn}`,
    ref: Qt,
    className: Ls(Ds.root, $n)
  }, Ms), kn) : null;
});
Title.displayName = "@mantine/core/Title";
function useCell() {
  const _e = reactExports.useRef(null), [Qt, Zt] = reactExports.useState(null);
  return reactExports.useEffect(() => {
    const $n = _e.current;
    if ($n) {
      const Sn = $n.closest(
        `[data-celltype="${CODE_CELL}"]`
      );
      if (!Sn)
        return;
      const kn = Sn.dataset.id;
      if (!kn)
        return;
      const Kn = window.Persist.CellMap.get(kn);
      if (!Kn)
        return;
      Zt(Kn);
    }
  }, [_e]), { ref: _e, cell: Qt };
}
function withTrrackableCell(_e) {
  return (Zt) => {
    const { ref: $n, cell: Sn } = useCell();
    return /* @__PURE__ */ React.createElement(Flex, { direction: "column" }, /* @__PURE__ */ React.createElement("div", { ref: $n, style: { display: "none", height: 0, width: 0 } }), Sn && /* @__PURE__ */ React.createElement(_e, { ...Zt, cell: Sn }));
  };
}
/**
 * table-core
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
function functionalUpdate(_e, Qt) {
  return typeof _e == "function" ? _e(Qt) : _e;
}
function makeStateUpdater(_e, Qt) {
  return (Zt) => {
    Qt.setState(($n) => ({
      ...$n,
      [_e]: functionalUpdate(Zt, $n[_e])
    }));
  };
}
function isFunction$2(_e) {
  return _e instanceof Function;
}
function isNumberArray$1(_e) {
  return Array.isArray(_e) && _e.every((Qt) => typeof Qt == "number");
}
function flattenBy(_e, Qt) {
  const Zt = [], $n = (Sn) => {
    Sn.forEach((kn) => {
      Zt.push(kn);
      const Kn = Qt(kn);
      Kn != null && Kn.length && $n(Kn);
    });
  };
  return $n(_e), Zt;
}
function memo$1(_e, Qt, Zt) {
  let $n = [], Sn;
  return () => {
    let kn;
    Zt.key && Zt.debug && (kn = Date.now());
    const Kn = _e();
    if (!(Kn.length !== $n.length || Kn.some((kr, Yr) => $n[Yr] !== kr)))
      return Sn;
    $n = Kn;
    let Cr;
    if (Zt.key && Zt.debug && (Cr = Date.now()), Sn = Qt(...Kn), Zt == null || Zt.onChange == null || Zt.onChange(Sn), Zt.key && Zt.debug && Zt != null && Zt.debug()) {
      const kr = Math.round((Date.now() - kn) * 100) / 100, Yr = Math.round((Date.now() - Cr) * 100) / 100, Ms = Yr / 16, Ds = (Ls, js) => {
        for (Ls = String(Ls); Ls.length < js; )
          Ls = " " + Ls;
        return Ls;
      };
      console.info(`%c⏱ ${Ds(Yr, 5)} /${Ds(kr, 5)} ms`, `
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0, Math.min(120 - 120 * Ms, 120))}deg 100% 31%);`, Zt == null ? void 0 : Zt.key);
    }
    return Sn;
  };
}
function createColumn(_e, Qt, Zt, $n) {
  var Sn, kn;
  const er = {
    ..._e._getDefaultColumnDef(),
    ...Qt
  }, Cr = er.accessorKey;
  let kr = (Sn = (kn = er.id) != null ? kn : Cr ? Cr.replace(".", "_") : void 0) != null ? Sn : typeof er.header == "string" ? er.header : void 0, Yr;
  if (er.accessorFn ? Yr = er.accessorFn : Cr && (Cr.includes(".") ? Yr = (Ds) => {
    let Ls = Ds;
    for (const zs of Cr.split(".")) {
      var js;
      Ls = (js = Ls) == null ? void 0 : js[zs];
    }
    return Ls;
  } : Yr = (Ds) => Ds[er.accessorKey]), !kr)
    throw new Error();
  let Ms = {
    id: `${String(kr)}`,
    accessorFn: Yr,
    parent: $n,
    depth: Zt,
    columnDef: er,
    columns: [],
    getFlatColumns: memo$1(() => [!0], () => {
      var Ds;
      return [Ms, ...(Ds = Ms.columns) == null ? void 0 : Ds.flatMap((Ls) => Ls.getFlatColumns())];
    }, {
      key: "column.getFlatColumns",
      debug: () => {
        var Ds;
        return (Ds = _e.options.debugAll) != null ? Ds : _e.options.debugColumns;
      }
    }),
    getLeafColumns: memo$1(() => [_e._getOrderColumnsFn()], (Ds) => {
      var Ls;
      if ((Ls = Ms.columns) != null && Ls.length) {
        let js = Ms.columns.flatMap((zs) => zs.getLeafColumns());
        return Ds(js);
      }
      return [Ms];
    }, {
      key: "column.getLeafColumns",
      debug: () => {
        var Ds;
        return (Ds = _e.options.debugAll) != null ? Ds : _e.options.debugColumns;
      }
    })
  };
  for (const Ds of _e._features)
    Ds.createColumn == null || Ds.createColumn(Ms, _e);
  return Ms;
}
function createHeader(_e, Qt, Zt) {
  var $n;
  let kn = {
    id: ($n = Zt.id) != null ? $n : Qt.id,
    column: Qt,
    index: Zt.index,
    isPlaceholder: !!Zt.isPlaceholder,
    placeholderId: Zt.placeholderId,
    depth: Zt.depth,
    subHeaders: [],
    colSpan: 0,
    rowSpan: 0,
    headerGroup: null,
    getLeafHeaders: () => {
      const Kn = [], er = (Cr) => {
        Cr.subHeaders && Cr.subHeaders.length && Cr.subHeaders.map(er), Kn.push(Cr);
      };
      return er(kn), Kn;
    },
    getContext: () => ({
      table: _e,
      header: kn,
      column: Qt
    })
  };
  return _e._features.forEach((Kn) => {
    Kn.createHeader == null || Kn.createHeader(kn, _e);
  }), kn;
}
const Headers$1 = {
  createTable: (_e) => {
    _e.getHeaderGroups = memo$1(() => [_e.getAllColumns(), _e.getVisibleLeafColumns(), _e.getState().columnPinning.left, _e.getState().columnPinning.right], (Qt, Zt, $n, Sn) => {
      var kn, Kn;
      const er = (kn = $n == null ? void 0 : $n.map((Ms) => Zt.find((Ds) => Ds.id === Ms)).filter(Boolean)) != null ? kn : [], Cr = (Kn = Sn == null ? void 0 : Sn.map((Ms) => Zt.find((Ds) => Ds.id === Ms)).filter(Boolean)) != null ? Kn : [], kr = Zt.filter((Ms) => !($n != null && $n.includes(Ms.id)) && !(Sn != null && Sn.includes(Ms.id)));
      return buildHeaderGroups(Qt, [...er, ...kr, ...Cr], _e);
    }, {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getCenterHeaderGroups = memo$1(() => [_e.getAllColumns(), _e.getVisibleLeafColumns(), _e.getState().columnPinning.left, _e.getState().columnPinning.right], (Qt, Zt, $n, Sn) => (Zt = Zt.filter((kn) => !($n != null && $n.includes(kn.id)) && !(Sn != null && Sn.includes(kn.id))), buildHeaderGroups(Qt, Zt, _e, "center")), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getLeftHeaderGroups = memo$1(() => [_e.getAllColumns(), _e.getVisibleLeafColumns(), _e.getState().columnPinning.left], (Qt, Zt, $n) => {
      var Sn;
      const kn = (Sn = $n == null ? void 0 : $n.map((Kn) => Zt.find((er) => er.id === Kn)).filter(Boolean)) != null ? Sn : [];
      return buildHeaderGroups(Qt, kn, _e, "left");
    }, {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getRightHeaderGroups = memo$1(() => [_e.getAllColumns(), _e.getVisibleLeafColumns(), _e.getState().columnPinning.right], (Qt, Zt, $n) => {
      var Sn;
      const kn = (Sn = $n == null ? void 0 : $n.map((Kn) => Zt.find((er) => er.id === Kn)).filter(Boolean)) != null ? Sn : [];
      return buildHeaderGroups(Qt, kn, _e, "right");
    }, {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getFooterGroups = memo$1(() => [_e.getHeaderGroups()], (Qt) => [...Qt].reverse(), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getLeftFooterGroups = memo$1(() => [_e.getLeftHeaderGroups()], (Qt) => [...Qt].reverse(), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getCenterFooterGroups = memo$1(() => [_e.getCenterHeaderGroups()], (Qt) => [...Qt].reverse(), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getRightFooterGroups = memo$1(() => [_e.getRightHeaderGroups()], (Qt) => [...Qt].reverse(), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getFlatHeaders = memo$1(() => [_e.getHeaderGroups()], (Qt) => Qt.map((Zt) => Zt.headers).flat(), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getLeftFlatHeaders = memo$1(() => [_e.getLeftHeaderGroups()], (Qt) => Qt.map((Zt) => Zt.headers).flat(), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getCenterFlatHeaders = memo$1(() => [_e.getCenterHeaderGroups()], (Qt) => Qt.map((Zt) => Zt.headers).flat(), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getRightFlatHeaders = memo$1(() => [_e.getRightHeaderGroups()], (Qt) => Qt.map((Zt) => Zt.headers).flat(), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getCenterLeafHeaders = memo$1(() => [_e.getCenterFlatHeaders()], (Qt) => Qt.filter((Zt) => {
      var $n;
      return !(($n = Zt.subHeaders) != null && $n.length);
    }), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getLeftLeafHeaders = memo$1(() => [_e.getLeftFlatHeaders()], (Qt) => Qt.filter((Zt) => {
      var $n;
      return !(($n = Zt.subHeaders) != null && $n.length);
    }), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getRightLeafHeaders = memo$1(() => [_e.getRightFlatHeaders()], (Qt) => Qt.filter((Zt) => {
      var $n;
      return !(($n = Zt.subHeaders) != null && $n.length);
    }), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    }), _e.getLeafHeaders = memo$1(() => [_e.getLeftHeaderGroups(), _e.getCenterHeaderGroups(), _e.getRightHeaderGroups()], (Qt, Zt, $n) => {
      var Sn, kn, Kn, er, Cr, kr;
      return [...(Sn = (kn = Qt[0]) == null ? void 0 : kn.headers) != null ? Sn : [], ...(Kn = (er = Zt[0]) == null ? void 0 : er.headers) != null ? Kn : [], ...(Cr = (kr = $n[0]) == null ? void 0 : kr.headers) != null ? Cr : []].map((Yr) => Yr.getLeafHeaders()).flat();
    }, {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugHeaders;
      }
    });
  }
};
function buildHeaderGroups(_e, Qt, Zt, $n) {
  var Sn, kn;
  let Kn = 0;
  const er = function(Ds, Ls) {
    Ls === void 0 && (Ls = 1), Kn = Math.max(Kn, Ls), Ds.filter((js) => js.getIsVisible()).forEach((js) => {
      var zs;
      (zs = js.columns) != null && zs.length && er(js.columns, Ls + 1);
    }, 0);
  };
  er(_e);
  let Cr = [];
  const kr = (Ds, Ls) => {
    const js = {
      depth: Ls,
      id: [$n, `${Ls}`].filter(Boolean).join("_"),
      headers: []
    }, zs = [];
    Ds.forEach((Fs) => {
      const Bs = [...zs].reverse()[0], Hs = Fs.column.depth === js.depth;
      let Ws, Ys = !1;
      if (Hs && Fs.column.parent ? Ws = Fs.column.parent : (Ws = Fs.column, Ys = !0), Bs && (Bs == null ? void 0 : Bs.column) === Ws)
        Bs.subHeaders.push(Fs);
      else {
        const El = createHeader(Zt, Ws, {
          id: [$n, Ls, Ws.id, Fs == null ? void 0 : Fs.id].filter(Boolean).join("_"),
          isPlaceholder: Ys,
          placeholderId: Ys ? `${zs.filter((Mu) => Mu.column === Ws).length}` : void 0,
          depth: Ls,
          index: zs.length
        });
        El.subHeaders.push(Fs), zs.push(El);
      }
      js.headers.push(Fs), Fs.headerGroup = js;
    }), Cr.push(js), Ls > 0 && kr(zs, Ls - 1);
  }, Yr = Qt.map((Ds, Ls) => createHeader(Zt, Ds, {
    depth: Kn,
    index: Ls
  }));
  kr(Yr, Kn - 1), Cr.reverse();
  const Ms = (Ds) => Ds.filter((js) => js.column.getIsVisible()).map((js) => {
    let zs = 0, Fs = 0, Bs = [0];
    js.subHeaders && js.subHeaders.length ? (Bs = [], Ms(js.subHeaders).forEach((Ws) => {
      let {
        colSpan: Ys,
        rowSpan: El
      } = Ws;
      zs += Ys, Bs.push(El);
    })) : zs = 1;
    const Hs = Math.min(...Bs);
    return Fs = Fs + Hs, js.colSpan = zs, js.rowSpan = Fs, {
      colSpan: zs,
      rowSpan: Fs
    };
  });
  return Ms((Sn = (kn = Cr[0]) == null ? void 0 : kn.headers) != null ? Sn : []), Cr;
}
const defaultColumnSizing = {
  size: 150,
  minSize: 20,
  maxSize: Number.MAX_SAFE_INTEGER
}, getDefaultColumnSizingInfoState = () => ({
  startOffset: null,
  startSize: null,
  deltaOffset: null,
  deltaPercentage: null,
  isResizingColumn: !1,
  columnSizingStart: []
}), ColumnSizing = {
  getDefaultColumnDef: () => defaultColumnSizing,
  getInitialState: (_e) => ({
    columnSizing: {},
    columnSizingInfo: getDefaultColumnSizingInfoState(),
    ..._e
  }),
  getDefaultOptions: (_e) => ({
    columnResizeMode: "onEnd",
    onColumnSizingChange: makeStateUpdater("columnSizing", _e),
    onColumnSizingInfoChange: makeStateUpdater("columnSizingInfo", _e)
  }),
  createColumn: (_e, Qt) => {
    _e.getSize = () => {
      var Zt, $n, Sn;
      const kn = Qt.getState().columnSizing[_e.id];
      return Math.min(Math.max((Zt = _e.columnDef.minSize) != null ? Zt : defaultColumnSizing.minSize, ($n = kn ?? _e.columnDef.size) != null ? $n : defaultColumnSizing.size), (Sn = _e.columnDef.maxSize) != null ? Sn : defaultColumnSizing.maxSize);
    }, _e.getStart = (Zt) => {
      const $n = Zt ? Zt === "left" ? Qt.getLeftVisibleLeafColumns() : Qt.getRightVisibleLeafColumns() : Qt.getVisibleLeafColumns(), Sn = $n.findIndex((kn) => kn.id === _e.id);
      if (Sn > 0) {
        const kn = $n[Sn - 1];
        return kn.getStart(Zt) + kn.getSize();
      }
      return 0;
    }, _e.resetSize = () => {
      Qt.setColumnSizing((Zt) => {
        let {
          [_e.id]: $n,
          ...Sn
        } = Zt;
        return Sn;
      });
    }, _e.getCanResize = () => {
      var Zt, $n;
      return ((Zt = _e.columnDef.enableResizing) != null ? Zt : !0) && (($n = Qt.options.enableColumnResizing) != null ? $n : !0);
    }, _e.getIsResizing = () => Qt.getState().columnSizingInfo.isResizingColumn === _e.id;
  },
  createHeader: (_e, Qt) => {
    _e.getSize = () => {
      let Zt = 0;
      const $n = (Sn) => {
        if (Sn.subHeaders.length)
          Sn.subHeaders.forEach($n);
        else {
          var kn;
          Zt += (kn = Sn.column.getSize()) != null ? kn : 0;
        }
      };
      return $n(_e), Zt;
    }, _e.getStart = () => {
      if (_e.index > 0) {
        const Zt = _e.headerGroup.headers[_e.index - 1];
        return Zt.getStart() + Zt.getSize();
      }
      return 0;
    }, _e.getResizeHandler = () => {
      const Zt = Qt.getColumn(_e.column.id), $n = Zt == null ? void 0 : Zt.getCanResize();
      return (Sn) => {
        if (!Zt || !$n || (Sn.persist == null || Sn.persist(), isTouchStartEvent(Sn) && Sn.touches && Sn.touches.length > 1))
          return;
        const kn = _e.getSize(), Kn = _e ? _e.getLeafHeaders().map((zs) => [zs.column.id, zs.column.getSize()]) : [[Zt.id, Zt.getSize()]], er = isTouchStartEvent(Sn) ? Math.round(Sn.touches[0].clientX) : Sn.clientX, Cr = {}, kr = (zs, Fs) => {
          typeof Fs == "number" && (Qt.setColumnSizingInfo((Bs) => {
            var Hs, Ws;
            const Ys = Fs - ((Hs = Bs == null ? void 0 : Bs.startOffset) != null ? Hs : 0), El = Math.max(Ys / ((Ws = Bs == null ? void 0 : Bs.startSize) != null ? Ws : 0), -0.999999);
            return Bs.columnSizingStart.forEach((Mu) => {
              let [Pl, Iu] = Mu;
              Cr[Pl] = Math.round(Math.max(Iu + Iu * El, 0) * 100) / 100;
            }), {
              ...Bs,
              deltaOffset: Ys,
              deltaPercentage: El
            };
          }), (Qt.options.columnResizeMode === "onChange" || zs === "end") && Qt.setColumnSizing((Bs) => ({
            ...Bs,
            ...Cr
          })));
        }, Yr = (zs) => kr("move", zs), Ms = (zs) => {
          kr("end", zs), Qt.setColumnSizingInfo((Fs) => ({
            ...Fs,
            isResizingColumn: !1,
            startOffset: null,
            startSize: null,
            deltaOffset: null,
            deltaPercentage: null,
            columnSizingStart: []
          }));
        }, Ds = {
          moveHandler: (zs) => Yr(zs.clientX),
          upHandler: (zs) => {
            document.removeEventListener("mousemove", Ds.moveHandler), document.removeEventListener("mouseup", Ds.upHandler), Ms(zs.clientX);
          }
        }, Ls = {
          moveHandler: (zs) => (zs.cancelable && (zs.preventDefault(), zs.stopPropagation()), Yr(zs.touches[0].clientX), !1),
          upHandler: (zs) => {
            var Fs;
            document.removeEventListener("touchmove", Ls.moveHandler), document.removeEventListener("touchend", Ls.upHandler), zs.cancelable && (zs.preventDefault(), zs.stopPropagation()), Ms((Fs = zs.touches[0]) == null ? void 0 : Fs.clientX);
          }
        }, js = passiveEventSupported() ? {
          passive: !1
        } : !1;
        isTouchStartEvent(Sn) ? (document.addEventListener("touchmove", Ls.moveHandler, js), document.addEventListener("touchend", Ls.upHandler, js)) : (document.addEventListener("mousemove", Ds.moveHandler, js), document.addEventListener("mouseup", Ds.upHandler, js)), Qt.setColumnSizingInfo((zs) => ({
          ...zs,
          startOffset: er,
          startSize: kn,
          deltaOffset: 0,
          deltaPercentage: 0,
          columnSizingStart: Kn,
          isResizingColumn: Zt.id
        }));
      };
    };
  },
  createTable: (_e) => {
    _e.setColumnSizing = (Qt) => _e.options.onColumnSizingChange == null ? void 0 : _e.options.onColumnSizingChange(Qt), _e.setColumnSizingInfo = (Qt) => _e.options.onColumnSizingInfoChange == null ? void 0 : _e.options.onColumnSizingInfoChange(Qt), _e.resetColumnSizing = (Qt) => {
      var Zt;
      _e.setColumnSizing(Qt ? {} : (Zt = _e.initialState.columnSizing) != null ? Zt : {});
    }, _e.resetHeaderSizeInfo = (Qt) => {
      var Zt;
      _e.setColumnSizingInfo(Qt ? getDefaultColumnSizingInfoState() : (Zt = _e.initialState.columnSizingInfo) != null ? Zt : getDefaultColumnSizingInfoState());
    }, _e.getTotalSize = () => {
      var Qt, Zt;
      return (Qt = (Zt = _e.getHeaderGroups()[0]) == null ? void 0 : Zt.headers.reduce(($n, Sn) => $n + Sn.getSize(), 0)) != null ? Qt : 0;
    }, _e.getLeftTotalSize = () => {
      var Qt, Zt;
      return (Qt = (Zt = _e.getLeftHeaderGroups()[0]) == null ? void 0 : Zt.headers.reduce(($n, Sn) => $n + Sn.getSize(), 0)) != null ? Qt : 0;
    }, _e.getCenterTotalSize = () => {
      var Qt, Zt;
      return (Qt = (Zt = _e.getCenterHeaderGroups()[0]) == null ? void 0 : Zt.headers.reduce(($n, Sn) => $n + Sn.getSize(), 0)) != null ? Qt : 0;
    }, _e.getRightTotalSize = () => {
      var Qt, Zt;
      return (Qt = (Zt = _e.getRightHeaderGroups()[0]) == null ? void 0 : Zt.headers.reduce(($n, Sn) => $n + Sn.getSize(), 0)) != null ? Qt : 0;
    };
  }
};
let passiveSupported = null;
function passiveEventSupported() {
  if (typeof passiveSupported == "boolean")
    return passiveSupported;
  let _e = !1;
  try {
    const Qt = {
      get passive() {
        return _e = !0, !1;
      }
    }, Zt = () => {
    };
    window.addEventListener("test", Zt, Qt), window.removeEventListener("test", Zt);
  } catch {
    _e = !1;
  }
  return passiveSupported = _e, passiveSupported;
}
function isTouchStartEvent(_e) {
  return _e.type === "touchstart";
}
const Expanding = {
  getInitialState: (_e) => ({
    expanded: {},
    ..._e
  }),
  getDefaultOptions: (_e) => ({
    onExpandedChange: makeStateUpdater("expanded", _e),
    paginateExpandedRows: !0
  }),
  createTable: (_e) => {
    let Qt = !1, Zt = !1;
    _e._autoResetExpanded = () => {
      var $n, Sn;
      if (!Qt) {
        _e._queue(() => {
          Qt = !0;
        });
        return;
      }
      if (($n = (Sn = _e.options.autoResetAll) != null ? Sn : _e.options.autoResetExpanded) != null ? $n : !_e.options.manualExpanding) {
        if (Zt)
          return;
        Zt = !0, _e._queue(() => {
          _e.resetExpanded(), Zt = !1;
        });
      }
    }, _e.setExpanded = ($n) => _e.options.onExpandedChange == null ? void 0 : _e.options.onExpandedChange($n), _e.toggleAllRowsExpanded = ($n) => {
      $n ?? !_e.getIsAllRowsExpanded() ? _e.setExpanded(!0) : _e.setExpanded({});
    }, _e.resetExpanded = ($n) => {
      var Sn, kn;
      _e.setExpanded($n ? {} : (Sn = (kn = _e.initialState) == null ? void 0 : kn.expanded) != null ? Sn : {});
    }, _e.getCanSomeRowsExpand = () => _e.getPrePaginationRowModel().flatRows.some(($n) => $n.getCanExpand()), _e.getToggleAllRowsExpandedHandler = () => ($n) => {
      $n.persist == null || $n.persist(), _e.toggleAllRowsExpanded();
    }, _e.getIsSomeRowsExpanded = () => {
      const $n = _e.getState().expanded;
      return $n === !0 || Object.values($n).some(Boolean);
    }, _e.getIsAllRowsExpanded = () => {
      const $n = _e.getState().expanded;
      return typeof $n == "boolean" ? $n === !0 : !(!Object.keys($n).length || _e.getRowModel().flatRows.some((Sn) => !Sn.getIsExpanded()));
    }, _e.getExpandedDepth = () => {
      let $n = 0;
      return (_e.getState().expanded === !0 ? Object.keys(_e.getRowModel().rowsById) : Object.keys(_e.getState().expanded)).forEach((kn) => {
        const Kn = kn.split(".");
        $n = Math.max($n, Kn.length);
      }), $n;
    }, _e.getPreExpandedRowModel = () => _e.getSortedRowModel(), _e.getExpandedRowModel = () => (!_e._getExpandedRowModel && _e.options.getExpandedRowModel && (_e._getExpandedRowModel = _e.options.getExpandedRowModel(_e)), _e.options.manualExpanding || !_e._getExpandedRowModel ? _e.getPreExpandedRowModel() : _e._getExpandedRowModel());
  },
  createRow: (_e, Qt) => {
    _e.toggleExpanded = (Zt) => {
      Qt.setExpanded(($n) => {
        var Sn;
        const kn = $n === !0 ? !0 : !!($n != null && $n[_e.id]);
        let Kn = {};
        if ($n === !0 ? Object.keys(Qt.getRowModel().rowsById).forEach((er) => {
          Kn[er] = !0;
        }) : Kn = $n, Zt = (Sn = Zt) != null ? Sn : !kn, !kn && Zt)
          return {
            ...Kn,
            [_e.id]: !0
          };
        if (kn && !Zt) {
          const {
            [_e.id]: er,
            ...Cr
          } = Kn;
          return Cr;
        }
        return $n;
      });
    }, _e.getIsExpanded = () => {
      var Zt;
      const $n = Qt.getState().expanded;
      return !!((Zt = Qt.options.getIsRowExpanded == null ? void 0 : Qt.options.getIsRowExpanded(_e)) != null ? Zt : $n === !0 || $n != null && $n[_e.id]);
    }, _e.getCanExpand = () => {
      var Zt, $n, Sn;
      return (Zt = Qt.options.getRowCanExpand == null ? void 0 : Qt.options.getRowCanExpand(_e)) != null ? Zt : (($n = Qt.options.enableExpanding) != null ? $n : !0) && !!((Sn = _e.subRows) != null && Sn.length);
    }, _e.getIsAllParentsExpanded = () => {
      let Zt = !0, $n = _e;
      for (; Zt && $n.parentId; )
        $n = Qt.getRow($n.parentId, !0), Zt = $n.getIsExpanded();
      return Zt;
    }, _e.getToggleExpandedHandler = () => {
      const Zt = _e.getCanExpand();
      return () => {
        Zt && _e.toggleExpanded();
      };
    };
  }
}, includesString = (_e, Qt, Zt) => {
  var $n;
  const Sn = Zt.toLowerCase();
  return !!(!(($n = _e.getValue(Qt)) == null || ($n = $n.toString()) == null || ($n = $n.toLowerCase()) == null) && $n.includes(Sn));
};
includesString.autoRemove = (_e) => testFalsey(_e);
const includesStringSensitive = (_e, Qt, Zt) => {
  var $n;
  return !!(!(($n = _e.getValue(Qt)) == null || ($n = $n.toString()) == null) && $n.includes(Zt));
};
includesStringSensitive.autoRemove = (_e) => testFalsey(_e);
const equalsString = (_e, Qt, Zt) => {
  var $n;
  return (($n = _e.getValue(Qt)) == null || ($n = $n.toString()) == null ? void 0 : $n.toLowerCase()) === (Zt == null ? void 0 : Zt.toLowerCase());
};
equalsString.autoRemove = (_e) => testFalsey(_e);
const arrIncludes = (_e, Qt, Zt) => {
  var $n;
  return ($n = _e.getValue(Qt)) == null ? void 0 : $n.includes(Zt);
};
arrIncludes.autoRemove = (_e) => testFalsey(_e) || !(_e != null && _e.length);
const arrIncludesAll = (_e, Qt, Zt) => !Zt.some(($n) => {
  var Sn;
  return !((Sn = _e.getValue(Qt)) != null && Sn.includes($n));
});
arrIncludesAll.autoRemove = (_e) => testFalsey(_e) || !(_e != null && _e.length);
const arrIncludesSome = (_e, Qt, Zt) => Zt.some(($n) => {
  var Sn;
  return (Sn = _e.getValue(Qt)) == null ? void 0 : Sn.includes($n);
});
arrIncludesSome.autoRemove = (_e) => testFalsey(_e) || !(_e != null && _e.length);
const equals$1 = (_e, Qt, Zt) => _e.getValue(Qt) === Zt;
equals$1.autoRemove = (_e) => testFalsey(_e);
const weakEquals = (_e, Qt, Zt) => _e.getValue(Qt) == Zt;
weakEquals.autoRemove = (_e) => testFalsey(_e);
const inNumberRange = (_e, Qt, Zt) => {
  let [$n, Sn] = Zt;
  const kn = _e.getValue(Qt);
  return kn >= $n && kn <= Sn;
};
inNumberRange.resolveFilterValue = (_e) => {
  let [Qt, Zt] = _e, $n = typeof Qt != "number" ? parseFloat(Qt) : Qt, Sn = typeof Zt != "number" ? parseFloat(Zt) : Zt, kn = Qt === null || Number.isNaN($n) ? -1 / 0 : $n, Kn = Zt === null || Number.isNaN(Sn) ? 1 / 0 : Sn;
  if (kn > Kn) {
    const er = kn;
    kn = Kn, Kn = er;
  }
  return [kn, Kn];
};
inNumberRange.autoRemove = (_e) => testFalsey(_e) || testFalsey(_e[0]) && testFalsey(_e[1]);
const filterFns = {
  includesString,
  includesStringSensitive,
  equalsString,
  arrIncludes,
  arrIncludesAll,
  arrIncludesSome,
  equals: equals$1,
  weakEquals,
  inNumberRange
};
function testFalsey(_e) {
  return _e == null || _e === "";
}
const Filters = {
  getDefaultColumnDef: () => ({
    filterFn: "auto"
  }),
  getInitialState: (_e) => ({
    columnFilters: [],
    globalFilter: void 0,
    // filtersProgress: 1,
    // facetProgress: {},
    ..._e
  }),
  getDefaultOptions: (_e) => ({
    onColumnFiltersChange: makeStateUpdater("columnFilters", _e),
    onGlobalFilterChange: makeStateUpdater("globalFilter", _e),
    filterFromLeafRows: !1,
    maxLeafRowFilterDepth: 100,
    globalFilterFn: "auto",
    getColumnCanGlobalFilter: (Qt) => {
      var Zt;
      const $n = (Zt = _e.getCoreRowModel().flatRows[0]) == null || (Zt = Zt._getAllCellsByColumnId()[Qt.id]) == null ? void 0 : Zt.getValue();
      return typeof $n == "string" || typeof $n == "number";
    }
  }),
  createColumn: (_e, Qt) => {
    _e.getAutoFilterFn = () => {
      const Zt = Qt.getCoreRowModel().flatRows[0], $n = Zt == null ? void 0 : Zt.getValue(_e.id);
      return typeof $n == "string" ? filterFns.includesString : typeof $n == "number" ? filterFns.inNumberRange : typeof $n == "boolean" || $n !== null && typeof $n == "object" ? filterFns.equals : Array.isArray($n) ? filterFns.arrIncludes : filterFns.weakEquals;
    }, _e.getFilterFn = () => {
      var Zt, $n;
      return isFunction$2(_e.columnDef.filterFn) ? _e.columnDef.filterFn : _e.columnDef.filterFn === "auto" ? _e.getAutoFilterFn() : (
        // @ts-ignore
        (Zt = ($n = Qt.options.filterFns) == null ? void 0 : $n[_e.columnDef.filterFn]) != null ? Zt : filterFns[_e.columnDef.filterFn]
      );
    }, _e.getCanFilter = () => {
      var Zt, $n, Sn;
      return ((Zt = _e.columnDef.enableColumnFilter) != null ? Zt : !0) && (($n = Qt.options.enableColumnFilters) != null ? $n : !0) && ((Sn = Qt.options.enableFilters) != null ? Sn : !0) && !!_e.accessorFn;
    }, _e.getCanGlobalFilter = () => {
      var Zt, $n, Sn, kn;
      return ((Zt = _e.columnDef.enableGlobalFilter) != null ? Zt : !0) && (($n = Qt.options.enableGlobalFilter) != null ? $n : !0) && ((Sn = Qt.options.enableFilters) != null ? Sn : !0) && ((kn = Qt.options.getColumnCanGlobalFilter == null ? void 0 : Qt.options.getColumnCanGlobalFilter(_e)) != null ? kn : !0) && !!_e.accessorFn;
    }, _e.getIsFiltered = () => _e.getFilterIndex() > -1, _e.getFilterValue = () => {
      var Zt;
      return (Zt = Qt.getState().columnFilters) == null || (Zt = Zt.find(($n) => $n.id === _e.id)) == null ? void 0 : Zt.value;
    }, _e.getFilterIndex = () => {
      var Zt, $n;
      return (Zt = ($n = Qt.getState().columnFilters) == null ? void 0 : $n.findIndex((Sn) => Sn.id === _e.id)) != null ? Zt : -1;
    }, _e.setFilterValue = (Zt) => {
      Qt.setColumnFilters(($n) => {
        const Sn = _e.getFilterFn(), kn = $n == null ? void 0 : $n.find((Yr) => Yr.id === _e.id), Kn = functionalUpdate(Zt, kn ? kn.value : void 0);
        if (shouldAutoRemoveFilter(Sn, Kn, _e)) {
          var er;
          return (er = $n == null ? void 0 : $n.filter((Yr) => Yr.id !== _e.id)) != null ? er : [];
        }
        const Cr = {
          id: _e.id,
          value: Kn
        };
        if (kn) {
          var kr;
          return (kr = $n == null ? void 0 : $n.map((Yr) => Yr.id === _e.id ? Cr : Yr)) != null ? kr : [];
        }
        return $n != null && $n.length ? [...$n, Cr] : [Cr];
      });
    }, _e._getFacetedRowModel = Qt.options.getFacetedRowModel && Qt.options.getFacetedRowModel(Qt, _e.id), _e.getFacetedRowModel = () => _e._getFacetedRowModel ? _e._getFacetedRowModel() : Qt.getPreFilteredRowModel(), _e._getFacetedUniqueValues = Qt.options.getFacetedUniqueValues && Qt.options.getFacetedUniqueValues(Qt, _e.id), _e.getFacetedUniqueValues = () => _e._getFacetedUniqueValues ? _e._getFacetedUniqueValues() : /* @__PURE__ */ new Map(), _e._getFacetedMinMaxValues = Qt.options.getFacetedMinMaxValues && Qt.options.getFacetedMinMaxValues(Qt, _e.id), _e.getFacetedMinMaxValues = () => {
      if (_e._getFacetedMinMaxValues)
        return _e._getFacetedMinMaxValues();
    };
  },
  createRow: (_e, Qt) => {
    _e.columnFilters = {}, _e.columnFiltersMeta = {};
  },
  createTable: (_e) => {
    _e.getGlobalAutoFilterFn = () => filterFns.includesString, _e.getGlobalFilterFn = () => {
      var Qt, Zt;
      const {
        globalFilterFn: $n
      } = _e.options;
      return isFunction$2($n) ? $n : $n === "auto" ? _e.getGlobalAutoFilterFn() : (
        // @ts-ignore
        (Qt = (Zt = _e.options.filterFns) == null ? void 0 : Zt[$n]) != null ? Qt : filterFns[$n]
      );
    }, _e.setColumnFilters = (Qt) => {
      const Zt = _e.getAllLeafColumns(), $n = (Sn) => {
        var kn;
        return (kn = functionalUpdate(Qt, Sn)) == null ? void 0 : kn.filter((Kn) => {
          const er = Zt.find((Cr) => Cr.id === Kn.id);
          if (er) {
            const Cr = er.getFilterFn();
            if (shouldAutoRemoveFilter(Cr, Kn.value, er))
              return !1;
          }
          return !0;
        });
      };
      _e.options.onColumnFiltersChange == null || _e.options.onColumnFiltersChange($n);
    }, _e.setGlobalFilter = (Qt) => {
      _e.options.onGlobalFilterChange == null || _e.options.onGlobalFilterChange(Qt);
    }, _e.resetGlobalFilter = (Qt) => {
      _e.setGlobalFilter(Qt ? void 0 : _e.initialState.globalFilter);
    }, _e.resetColumnFilters = (Qt) => {
      var Zt, $n;
      _e.setColumnFilters(Qt ? [] : (Zt = ($n = _e.initialState) == null ? void 0 : $n.columnFilters) != null ? Zt : []);
    }, _e.getPreFilteredRowModel = () => _e.getCoreRowModel(), _e.getFilteredRowModel = () => (!_e._getFilteredRowModel && _e.options.getFilteredRowModel && (_e._getFilteredRowModel = _e.options.getFilteredRowModel(_e)), _e.options.manualFiltering || !_e._getFilteredRowModel ? _e.getPreFilteredRowModel() : _e._getFilteredRowModel()), _e._getGlobalFacetedRowModel = _e.options.getFacetedRowModel && _e.options.getFacetedRowModel(_e, "__global__"), _e.getGlobalFacetedRowModel = () => _e.options.manualFiltering || !_e._getGlobalFacetedRowModel ? _e.getPreFilteredRowModel() : _e._getGlobalFacetedRowModel(), _e._getGlobalFacetedUniqueValues = _e.options.getFacetedUniqueValues && _e.options.getFacetedUniqueValues(_e, "__global__"), _e.getGlobalFacetedUniqueValues = () => _e._getGlobalFacetedUniqueValues ? _e._getGlobalFacetedUniqueValues() : /* @__PURE__ */ new Map(), _e._getGlobalFacetedMinMaxValues = _e.options.getFacetedMinMaxValues && _e.options.getFacetedMinMaxValues(_e, "__global__"), _e.getGlobalFacetedMinMaxValues = () => {
      if (_e._getGlobalFacetedMinMaxValues)
        return _e._getGlobalFacetedMinMaxValues();
    };
  }
};
function shouldAutoRemoveFilter(_e, Qt, Zt) {
  return (_e && _e.autoRemove ? _e.autoRemove(Qt, Zt) : !1) || typeof Qt > "u" || typeof Qt == "string" && !Qt;
}
const sum$2 = (_e, Qt, Zt) => Zt.reduce(($n, Sn) => {
  const kn = Sn.getValue(_e);
  return $n + (typeof kn == "number" ? kn : 0);
}, 0), min$3 = (_e, Qt, Zt) => {
  let $n;
  return Zt.forEach((Sn) => {
    const kn = Sn.getValue(_e);
    kn != null && ($n > kn || $n === void 0 && kn >= kn) && ($n = kn);
  }), $n;
}, max$3 = (_e, Qt, Zt) => {
  let $n;
  return Zt.forEach((Sn) => {
    const kn = Sn.getValue(_e);
    kn != null && ($n < kn || $n === void 0 && kn >= kn) && ($n = kn);
  }), $n;
}, extent$1 = (_e, Qt, Zt) => {
  let $n, Sn;
  return Zt.forEach((kn) => {
    const Kn = kn.getValue(_e);
    Kn != null && ($n === void 0 ? Kn >= Kn && ($n = Sn = Kn) : ($n > Kn && ($n = Kn), Sn < Kn && (Sn = Kn)));
  }), [$n, Sn];
}, mean$1 = (_e, Qt) => {
  let Zt = 0, $n = 0;
  if (Qt.forEach((Sn) => {
    let kn = Sn.getValue(_e);
    kn != null && (kn = +kn) >= kn && (++Zt, $n += kn);
  }), Zt)
    return $n / Zt;
}, median$1 = (_e, Qt) => {
  if (!Qt.length)
    return;
  const Zt = Qt.map((kn) => kn.getValue(_e));
  if (!isNumberArray$1(Zt))
    return;
  if (Zt.length === 1)
    return Zt[0];
  const $n = Math.floor(Zt.length / 2), Sn = Zt.sort((kn, Kn) => kn - Kn);
  return Zt.length % 2 !== 0 ? Sn[$n] : (Sn[$n - 1] + Sn[$n]) / 2;
}, unique$1 = (_e, Qt) => Array.from(new Set(Qt.map((Zt) => Zt.getValue(_e))).values()), uniqueCount = (_e, Qt) => new Set(Qt.map((Zt) => Zt.getValue(_e))).size, count$3 = (_e, Qt) => Qt.length, aggregationFns = {
  sum: sum$2,
  min: min$3,
  max: max$3,
  extent: extent$1,
  mean: mean$1,
  median: median$1,
  unique: unique$1,
  uniqueCount,
  count: count$3
}, Grouping = {
  getDefaultColumnDef: () => ({
    aggregatedCell: (_e) => {
      var Qt, Zt;
      return (Qt = (Zt = _e.getValue()) == null || Zt.toString == null ? void 0 : Zt.toString()) != null ? Qt : null;
    },
    aggregationFn: "auto"
  }),
  getInitialState: (_e) => ({
    grouping: [],
    ..._e
  }),
  getDefaultOptions: (_e) => ({
    onGroupingChange: makeStateUpdater("grouping", _e),
    groupedColumnMode: "reorder"
  }),
  createColumn: (_e, Qt) => {
    _e.toggleGrouping = () => {
      Qt.setGrouping((Zt) => Zt != null && Zt.includes(_e.id) ? Zt.filter(($n) => $n !== _e.id) : [...Zt ?? [], _e.id]);
    }, _e.getCanGroup = () => {
      var Zt, $n, Sn, kn;
      return (Zt = ($n = (Sn = (kn = _e.columnDef.enableGrouping) != null ? kn : !0) != null ? Sn : Qt.options.enableGrouping) != null ? $n : !0) != null ? Zt : !!_e.accessorFn;
    }, _e.getIsGrouped = () => {
      var Zt;
      return (Zt = Qt.getState().grouping) == null ? void 0 : Zt.includes(_e.id);
    }, _e.getGroupedIndex = () => {
      var Zt;
      return (Zt = Qt.getState().grouping) == null ? void 0 : Zt.indexOf(_e.id);
    }, _e.getToggleGroupingHandler = () => {
      const Zt = _e.getCanGroup();
      return () => {
        Zt && _e.toggleGrouping();
      };
    }, _e.getAutoAggregationFn = () => {
      const Zt = Qt.getCoreRowModel().flatRows[0], $n = Zt == null ? void 0 : Zt.getValue(_e.id);
      if (typeof $n == "number")
        return aggregationFns.sum;
      if (Object.prototype.toString.call($n) === "[object Date]")
        return aggregationFns.extent;
    }, _e.getAggregationFn = () => {
      var Zt, $n;
      if (!_e)
        throw new Error();
      return isFunction$2(_e.columnDef.aggregationFn) ? _e.columnDef.aggregationFn : _e.columnDef.aggregationFn === "auto" ? _e.getAutoAggregationFn() : (Zt = ($n = Qt.options.aggregationFns) == null ? void 0 : $n[_e.columnDef.aggregationFn]) != null ? Zt : aggregationFns[_e.columnDef.aggregationFn];
    };
  },
  createTable: (_e) => {
    _e.setGrouping = (Qt) => _e.options.onGroupingChange == null ? void 0 : _e.options.onGroupingChange(Qt), _e.resetGrouping = (Qt) => {
      var Zt, $n;
      _e.setGrouping(Qt ? [] : (Zt = ($n = _e.initialState) == null ? void 0 : $n.grouping) != null ? Zt : []);
    }, _e.getPreGroupedRowModel = () => _e.getFilteredRowModel(), _e.getGroupedRowModel = () => (!_e._getGroupedRowModel && _e.options.getGroupedRowModel && (_e._getGroupedRowModel = _e.options.getGroupedRowModel(_e)), _e.options.manualGrouping || !_e._getGroupedRowModel ? _e.getPreGroupedRowModel() : _e._getGroupedRowModel());
  },
  createRow: (_e, Qt) => {
    _e.getIsGrouped = () => !!_e.groupingColumnId, _e.getGroupingValue = (Zt) => {
      if (_e._groupingValuesCache.hasOwnProperty(Zt))
        return _e._groupingValuesCache[Zt];
      const $n = Qt.getColumn(Zt);
      return $n != null && $n.columnDef.getGroupingValue ? (_e._groupingValuesCache[Zt] = $n.columnDef.getGroupingValue(_e.original), _e._groupingValuesCache[Zt]) : _e.getValue(Zt);
    }, _e._groupingValuesCache = {};
  },
  createCell: (_e, Qt, Zt, $n) => {
    _e.getIsGrouped = () => Qt.getIsGrouped() && Qt.id === Zt.groupingColumnId, _e.getIsPlaceholder = () => !_e.getIsGrouped() && Qt.getIsGrouped(), _e.getIsAggregated = () => {
      var Sn;
      return !_e.getIsGrouped() && !_e.getIsPlaceholder() && !!((Sn = Zt.subRows) != null && Sn.length);
    };
  }
};
function orderColumns(_e, Qt, Zt) {
  if (!(Qt != null && Qt.length) || !Zt)
    return _e;
  const $n = _e.filter((kn) => !Qt.includes(kn.id));
  return Zt === "remove" ? $n : [...Qt.map((kn) => _e.find((Kn) => Kn.id === kn)).filter(Boolean), ...$n];
}
const Ordering = {
  getInitialState: (_e) => ({
    columnOrder: [],
    ..._e
  }),
  getDefaultOptions: (_e) => ({
    onColumnOrderChange: makeStateUpdater("columnOrder", _e)
  }),
  createTable: (_e) => {
    _e.setColumnOrder = (Qt) => _e.options.onColumnOrderChange == null ? void 0 : _e.options.onColumnOrderChange(Qt), _e.resetColumnOrder = (Qt) => {
      var Zt;
      _e.setColumnOrder(Qt ? [] : (Zt = _e.initialState.columnOrder) != null ? Zt : []);
    }, _e._getOrderColumnsFn = memo$1(() => [_e.getState().columnOrder, _e.getState().grouping, _e.options.groupedColumnMode], (Qt, Zt, $n) => (Sn) => {
      let kn = [];
      if (!(Qt != null && Qt.length))
        kn = Sn;
      else {
        const Kn = [...Qt], er = [...Sn];
        for (; er.length && Kn.length; ) {
          const Cr = Kn.shift(), kr = er.findIndex((Yr) => Yr.id === Cr);
          kr > -1 && kn.push(er.splice(kr, 1)[0]);
        }
        kn = [...kn, ...er];
      }
      return orderColumns(kn, Zt, $n);
    }, {
      key: !1
      // debug: () => table.options.debugAll ?? table.options.debugTable,
    });
  }
}, defaultPageIndex = 0, defaultPageSize = 10, getDefaultPaginationState = () => ({
  pageIndex: defaultPageIndex,
  pageSize: defaultPageSize
}), Pagination = {
  getInitialState: (_e) => ({
    ..._e,
    pagination: {
      ...getDefaultPaginationState(),
      ..._e == null ? void 0 : _e.pagination
    }
  }),
  getDefaultOptions: (_e) => ({
    onPaginationChange: makeStateUpdater("pagination", _e)
  }),
  createTable: (_e) => {
    let Qt = !1, Zt = !1;
    _e._autoResetPageIndex = () => {
      var $n, Sn;
      if (!Qt) {
        _e._queue(() => {
          Qt = !0;
        });
        return;
      }
      if (($n = (Sn = _e.options.autoResetAll) != null ? Sn : _e.options.autoResetPageIndex) != null ? $n : !_e.options.manualPagination) {
        if (Zt)
          return;
        Zt = !0, _e._queue(() => {
          _e.resetPageIndex(), Zt = !1;
        });
      }
    }, _e.setPagination = ($n) => {
      const Sn = (kn) => functionalUpdate($n, kn);
      return _e.options.onPaginationChange == null ? void 0 : _e.options.onPaginationChange(Sn);
    }, _e.resetPagination = ($n) => {
      var Sn;
      _e.setPagination($n ? getDefaultPaginationState() : (Sn = _e.initialState.pagination) != null ? Sn : getDefaultPaginationState());
    }, _e.setPageIndex = ($n) => {
      _e.setPagination((Sn) => {
        let kn = functionalUpdate($n, Sn.pageIndex);
        const Kn = typeof _e.options.pageCount > "u" || _e.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : _e.options.pageCount - 1;
        return kn = Math.max(0, Math.min(kn, Kn)), {
          ...Sn,
          pageIndex: kn
        };
      });
    }, _e.resetPageIndex = ($n) => {
      var Sn, kn;
      _e.setPageIndex($n ? defaultPageIndex : (Sn = (kn = _e.initialState) == null || (kn = kn.pagination) == null ? void 0 : kn.pageIndex) != null ? Sn : defaultPageIndex);
    }, _e.resetPageSize = ($n) => {
      var Sn, kn;
      _e.setPageSize($n ? defaultPageSize : (Sn = (kn = _e.initialState) == null || (kn = kn.pagination) == null ? void 0 : kn.pageSize) != null ? Sn : defaultPageSize);
    }, _e.setPageSize = ($n) => {
      _e.setPagination((Sn) => {
        const kn = Math.max(1, functionalUpdate($n, Sn.pageSize)), Kn = Sn.pageSize * Sn.pageIndex, er = Math.floor(Kn / kn);
        return {
          ...Sn,
          pageIndex: er,
          pageSize: kn
        };
      });
    }, _e.setPageCount = ($n) => _e.setPagination((Sn) => {
      var kn;
      let Kn = functionalUpdate($n, (kn = _e.options.pageCount) != null ? kn : -1);
      return typeof Kn == "number" && (Kn = Math.max(-1, Kn)), {
        ...Sn,
        pageCount: Kn
      };
    }), _e.getPageOptions = memo$1(() => [_e.getPageCount()], ($n) => {
      let Sn = [];
      return $n && $n > 0 && (Sn = [...new Array($n)].fill(null).map((kn, Kn) => Kn)), Sn;
    }, {
      key: !1,
      debug: () => {
        var $n;
        return ($n = _e.options.debugAll) != null ? $n : _e.options.debugTable;
      }
    }), _e.getCanPreviousPage = () => _e.getState().pagination.pageIndex > 0, _e.getCanNextPage = () => {
      const {
        pageIndex: $n
      } = _e.getState().pagination, Sn = _e.getPageCount();
      return Sn === -1 ? !0 : Sn === 0 ? !1 : $n < Sn - 1;
    }, _e.previousPage = () => _e.setPageIndex(($n) => $n - 1), _e.nextPage = () => _e.setPageIndex(($n) => $n + 1), _e.getPrePaginationRowModel = () => _e.getExpandedRowModel(), _e.getPaginationRowModel = () => (!_e._getPaginationRowModel && _e.options.getPaginationRowModel && (_e._getPaginationRowModel = _e.options.getPaginationRowModel(_e)), _e.options.manualPagination || !_e._getPaginationRowModel ? _e.getPrePaginationRowModel() : _e._getPaginationRowModel()), _e.getPageCount = () => {
      var $n;
      return ($n = _e.options.pageCount) != null ? $n : Math.ceil(_e.getPrePaginationRowModel().rows.length / _e.getState().pagination.pageSize);
    };
  }
}, getDefaultColumnPinningState = () => ({
  left: [],
  right: []
}), getDefaultRowPinningState = () => ({
  top: [],
  bottom: []
}), Pinning = {
  getInitialState: (_e) => ({
    columnPinning: getDefaultColumnPinningState(),
    rowPinning: getDefaultRowPinningState(),
    ..._e
  }),
  getDefaultOptions: (_e) => ({
    onColumnPinningChange: makeStateUpdater("columnPinning", _e),
    onRowPinningChange: makeStateUpdater("rowPinning", _e)
  }),
  createColumn: (_e, Qt) => {
    _e.pin = (Zt) => {
      const $n = _e.getLeafColumns().map((Sn) => Sn.id).filter(Boolean);
      Qt.setColumnPinning((Sn) => {
        var kn, Kn;
        if (Zt === "right") {
          var er, Cr;
          return {
            left: ((er = Sn == null ? void 0 : Sn.left) != null ? er : []).filter((Ms) => !($n != null && $n.includes(Ms))),
            right: [...((Cr = Sn == null ? void 0 : Sn.right) != null ? Cr : []).filter((Ms) => !($n != null && $n.includes(Ms))), ...$n]
          };
        }
        if (Zt === "left") {
          var kr, Yr;
          return {
            left: [...((kr = Sn == null ? void 0 : Sn.left) != null ? kr : []).filter((Ms) => !($n != null && $n.includes(Ms))), ...$n],
            right: ((Yr = Sn == null ? void 0 : Sn.right) != null ? Yr : []).filter((Ms) => !($n != null && $n.includes(Ms)))
          };
        }
        return {
          left: ((kn = Sn == null ? void 0 : Sn.left) != null ? kn : []).filter((Ms) => !($n != null && $n.includes(Ms))),
          right: ((Kn = Sn == null ? void 0 : Sn.right) != null ? Kn : []).filter((Ms) => !($n != null && $n.includes(Ms)))
        };
      });
    }, _e.getCanPin = () => _e.getLeafColumns().some(($n) => {
      var Sn, kn, Kn;
      return ((Sn = $n.columnDef.enablePinning) != null ? Sn : !0) && ((kn = (Kn = Qt.options.enableColumnPinning) != null ? Kn : Qt.options.enablePinning) != null ? kn : !0);
    }), _e.getIsPinned = () => {
      const Zt = _e.getLeafColumns().map((er) => er.id), {
        left: $n,
        right: Sn
      } = Qt.getState().columnPinning, kn = Zt.some((er) => $n == null ? void 0 : $n.includes(er)), Kn = Zt.some((er) => Sn == null ? void 0 : Sn.includes(er));
      return kn ? "left" : Kn ? "right" : !1;
    }, _e.getPinnedIndex = () => {
      var Zt, $n;
      const Sn = _e.getIsPinned();
      return Sn ? (Zt = ($n = Qt.getState().columnPinning) == null || ($n = $n[Sn]) == null ? void 0 : $n.indexOf(_e.id)) != null ? Zt : -1 : 0;
    };
  },
  createRow: (_e, Qt) => {
    _e.pin = (Zt, $n, Sn) => {
      const kn = $n ? _e.getLeafRows().map((Cr) => {
        let {
          id: kr
        } = Cr;
        return kr;
      }) : [], Kn = Sn ? _e.getParentRows().map((Cr) => {
        let {
          id: kr
        } = Cr;
        return kr;
      }) : [], er = /* @__PURE__ */ new Set([...Kn, _e.id, ...kn]);
      Qt.setRowPinning((Cr) => {
        var kr, Yr;
        if (Zt === "bottom") {
          var Ms, Ds;
          return {
            top: ((Ms = Cr == null ? void 0 : Cr.top) != null ? Ms : []).filter((zs) => !(er != null && er.has(zs))),
            bottom: [...((Ds = Cr == null ? void 0 : Cr.bottom) != null ? Ds : []).filter((zs) => !(er != null && er.has(zs))), ...Array.from(er)]
          };
        }
        if (Zt === "top") {
          var Ls, js;
          return {
            top: [...((Ls = Cr == null ? void 0 : Cr.top) != null ? Ls : []).filter((zs) => !(er != null && er.has(zs))), ...Array.from(er)],
            bottom: ((js = Cr == null ? void 0 : Cr.bottom) != null ? js : []).filter((zs) => !(er != null && er.has(zs)))
          };
        }
        return {
          top: ((kr = Cr == null ? void 0 : Cr.top) != null ? kr : []).filter((zs) => !(er != null && er.has(zs))),
          bottom: ((Yr = Cr == null ? void 0 : Cr.bottom) != null ? Yr : []).filter((zs) => !(er != null && er.has(zs)))
        };
      });
    }, _e.getCanPin = () => {
      var Zt;
      const {
        enableRowPinning: $n,
        enablePinning: Sn
      } = Qt.options;
      return typeof $n == "function" ? $n(_e) : (Zt = $n ?? Sn) != null ? Zt : !0;
    }, _e.getIsPinned = () => {
      const Zt = [_e.id], {
        top: $n,
        bottom: Sn
      } = Qt.getState().rowPinning, kn = Zt.some((er) => $n == null ? void 0 : $n.includes(er)), Kn = Zt.some((er) => Sn == null ? void 0 : Sn.includes(er));
      return kn ? "top" : Kn ? "bottom" : !1;
    }, _e.getPinnedIndex = () => {
      var Zt, $n;
      const Sn = _e.getIsPinned();
      if (!Sn)
        return -1;
      const kn = (Zt = Qt._getPinnedRows(Sn)) == null ? void 0 : Zt.map((Kn) => {
        let {
          id: er
        } = Kn;
        return er;
      });
      return ($n = kn == null ? void 0 : kn.indexOf(_e.id)) != null ? $n : -1;
    }, _e.getCenterVisibleCells = memo$1(() => [_e._getAllVisibleCells(), Qt.getState().columnPinning.left, Qt.getState().columnPinning.right], (Zt, $n, Sn) => {
      const kn = [...$n ?? [], ...Sn ?? []];
      return Zt.filter((Kn) => !kn.includes(Kn.column.id));
    }, {
      key: !1,
      debug: () => {
        var Zt;
        return (Zt = Qt.options.debugAll) != null ? Zt : Qt.options.debugRows;
      }
    }), _e.getLeftVisibleCells = memo$1(() => [_e._getAllVisibleCells(), Qt.getState().columnPinning.left, ,], (Zt, $n) => ($n ?? []).map((kn) => Zt.find((Kn) => Kn.column.id === kn)).filter(Boolean).map((kn) => ({
      ...kn,
      position: "left"
    })), {
      key: !1,
      debug: () => {
        var Zt;
        return (Zt = Qt.options.debugAll) != null ? Zt : Qt.options.debugRows;
      }
    }), _e.getRightVisibleCells = memo$1(() => [_e._getAllVisibleCells(), Qt.getState().columnPinning.right], (Zt, $n) => ($n ?? []).map((kn) => Zt.find((Kn) => Kn.column.id === kn)).filter(Boolean).map((kn) => ({
      ...kn,
      position: "right"
    })), {
      key: !1,
      debug: () => {
        var Zt;
        return (Zt = Qt.options.debugAll) != null ? Zt : Qt.options.debugRows;
      }
    });
  },
  createTable: (_e) => {
    _e.setColumnPinning = (Qt) => _e.options.onColumnPinningChange == null ? void 0 : _e.options.onColumnPinningChange(Qt), _e.resetColumnPinning = (Qt) => {
      var Zt, $n;
      return _e.setColumnPinning(Qt ? getDefaultColumnPinningState() : (Zt = ($n = _e.initialState) == null ? void 0 : $n.columnPinning) != null ? Zt : getDefaultColumnPinningState());
    }, _e.getIsSomeColumnsPinned = (Qt) => {
      var Zt;
      const $n = _e.getState().columnPinning;
      if (!Qt) {
        var Sn, kn;
        return !!((Sn = $n.left) != null && Sn.length || (kn = $n.right) != null && kn.length);
      }
      return !!((Zt = $n[Qt]) != null && Zt.length);
    }, _e.getLeftLeafColumns = memo$1(() => [_e.getAllLeafColumns(), _e.getState().columnPinning.left], (Qt, Zt) => (Zt ?? []).map(($n) => Qt.find((Sn) => Sn.id === $n)).filter(Boolean), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugColumns;
      }
    }), _e.getRightLeafColumns = memo$1(() => [_e.getAllLeafColumns(), _e.getState().columnPinning.right], (Qt, Zt) => (Zt ?? []).map(($n) => Qt.find((Sn) => Sn.id === $n)).filter(Boolean), {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugColumns;
      }
    }), _e.getCenterLeafColumns = memo$1(() => [_e.getAllLeafColumns(), _e.getState().columnPinning.left, _e.getState().columnPinning.right], (Qt, Zt, $n) => {
      const Sn = [...Zt ?? [], ...$n ?? []];
      return Qt.filter((kn) => !Sn.includes(kn.id));
    }, {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugColumns;
      }
    }), _e.setRowPinning = (Qt) => _e.options.onRowPinningChange == null ? void 0 : _e.options.onRowPinningChange(Qt), _e.resetRowPinning = (Qt) => {
      var Zt, $n;
      return _e.setRowPinning(Qt ? getDefaultRowPinningState() : (Zt = ($n = _e.initialState) == null ? void 0 : $n.rowPinning) != null ? Zt : getDefaultRowPinningState());
    }, _e.getIsSomeRowsPinned = (Qt) => {
      var Zt;
      const $n = _e.getState().rowPinning;
      if (!Qt) {
        var Sn, kn;
        return !!((Sn = $n.top) != null && Sn.length || (kn = $n.bottom) != null && kn.length);
      }
      return !!((Zt = $n[Qt]) != null && Zt.length);
    }, _e._getPinnedRows = (Qt) => memo$1(() => [_e.getRowModel().rows, _e.getState().rowPinning[Qt]], (Zt, $n) => {
      var Sn;
      return ((Sn = _e.options.keepPinnedRows) == null || Sn ? (
        //get all rows that are pinned even if they would not be otherwise visible
        //account for expanded parent rows, but not pagination or filtering
        ($n ?? []).map((Kn) => {
          const er = _e.getRow(Kn, !0);
          return er.getIsAllParentsExpanded() ? er : null;
        })
      ) : (
        //else get only visible rows that are pinned
        ($n ?? []).map((Kn) => Zt.find((er) => er.id === Kn))
      )).filter(Boolean).map((Kn) => ({
        ...Kn,
        position: Qt
      }));
    }, {
      key: !1,
      debug: () => {
        var Zt;
        return (Zt = _e.options.debugAll) != null ? Zt : _e.options.debugRows;
      }
    })(), _e.getTopRows = () => _e._getPinnedRows("top"), _e.getBottomRows = () => _e._getPinnedRows("bottom"), _e.getCenterRows = memo$1(() => [_e.getRowModel().rows, _e.getState().rowPinning.top, _e.getState().rowPinning.bottom], (Qt, Zt, $n) => {
      const Sn = /* @__PURE__ */ new Set([...Zt ?? [], ...$n ?? []]);
      return Qt.filter((kn) => !Sn.has(kn.id));
    }, {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugRows;
      }
    });
  }
}, RowSelection = {
  getInitialState: (_e) => ({
    rowSelection: {},
    ..._e
  }),
  getDefaultOptions: (_e) => ({
    onRowSelectionChange: makeStateUpdater("rowSelection", _e),
    enableRowSelection: !0,
    enableMultiRowSelection: !0,
    enableSubRowSelection: !0
    // enableGroupingRowSelection: false,
    // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,
    // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,
  }),
  createTable: (_e) => {
    _e.setRowSelection = (Qt) => _e.options.onRowSelectionChange == null ? void 0 : _e.options.onRowSelectionChange(Qt), _e.resetRowSelection = (Qt) => {
      var Zt;
      return _e.setRowSelection(Qt ? {} : (Zt = _e.initialState.rowSelection) != null ? Zt : {});
    }, _e.toggleAllRowsSelected = (Qt) => {
      _e.setRowSelection((Zt) => {
        Qt = typeof Qt < "u" ? Qt : !_e.getIsAllRowsSelected();
        const $n = {
          ...Zt
        }, Sn = _e.getPreGroupedRowModel().flatRows;
        return Qt ? Sn.forEach((kn) => {
          kn.getCanSelect() && ($n[kn.id] = !0);
        }) : Sn.forEach((kn) => {
          delete $n[kn.id];
        }), $n;
      });
    }, _e.toggleAllPageRowsSelected = (Qt) => _e.setRowSelection((Zt) => {
      const $n = typeof Qt < "u" ? Qt : !_e.getIsAllPageRowsSelected(), Sn = {
        ...Zt
      };
      return _e.getRowModel().rows.forEach((kn) => {
        mutateRowIsSelected(Sn, kn.id, $n, !0, _e);
      }), Sn;
    }), _e.getPreSelectedRowModel = () => _e.getCoreRowModel(), _e.getSelectedRowModel = memo$1(() => [_e.getState().rowSelection, _e.getCoreRowModel()], (Qt, Zt) => Object.keys(Qt).length ? selectRowsFn(_e, Zt) : {
      rows: [],
      flatRows: [],
      rowsById: {}
    }, {
      key: !1,
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugTable;
      }
    }), _e.getFilteredSelectedRowModel = memo$1(() => [_e.getState().rowSelection, _e.getFilteredRowModel()], (Qt, Zt) => Object.keys(Qt).length ? selectRowsFn(_e, Zt) : {
      rows: [],
      flatRows: [],
      rowsById: {}
    }, {
      key: "getFilteredSelectedRowModel",
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugTable;
      }
    }), _e.getGroupedSelectedRowModel = memo$1(() => [_e.getState().rowSelection, _e.getSortedRowModel()], (Qt, Zt) => Object.keys(Qt).length ? selectRowsFn(_e, Zt) : {
      rows: [],
      flatRows: [],
      rowsById: {}
    }, {
      key: "getGroupedSelectedRowModel",
      debug: () => {
        var Qt;
        return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugTable;
      }
    }), _e.getIsAllRowsSelected = () => {
      const Qt = _e.getFilteredRowModel().flatRows, {
        rowSelection: Zt
      } = _e.getState();
      let $n = !!(Qt.length && Object.keys(Zt).length);
      return $n && Qt.some((Sn) => Sn.getCanSelect() && !Zt[Sn.id]) && ($n = !1), $n;
    }, _e.getIsAllPageRowsSelected = () => {
      const Qt = _e.getPaginationRowModel().flatRows.filter((Sn) => Sn.getCanSelect()), {
        rowSelection: Zt
      } = _e.getState();
      let $n = !!Qt.length;
      return $n && Qt.some((Sn) => !Zt[Sn.id]) && ($n = !1), $n;
    }, _e.getIsSomeRowsSelected = () => {
      var Qt;
      const Zt = Object.keys((Qt = _e.getState().rowSelection) != null ? Qt : {}).length;
      return Zt > 0 && Zt < _e.getFilteredRowModel().flatRows.length;
    }, _e.getIsSomePageRowsSelected = () => {
      const Qt = _e.getPaginationRowModel().flatRows;
      return _e.getIsAllPageRowsSelected() ? !1 : Qt.filter((Zt) => Zt.getCanSelect()).some((Zt) => Zt.getIsSelected() || Zt.getIsSomeSelected());
    }, _e.getToggleAllRowsSelectedHandler = () => (Qt) => {
      _e.toggleAllRowsSelected(Qt.target.checked);
    }, _e.getToggleAllPageRowsSelectedHandler = () => (Qt) => {
      _e.toggleAllPageRowsSelected(Qt.target.checked);
    };
  },
  createRow: (_e, Qt) => {
    _e.toggleSelected = (Zt, $n) => {
      const Sn = _e.getIsSelected();
      Qt.setRowSelection((kn) => {
        var Kn;
        if (Zt = typeof Zt < "u" ? Zt : !Sn, _e.getCanSelect() && Sn === Zt)
          return kn;
        const er = {
          ...kn
        };
        return mutateRowIsSelected(er, _e.id, Zt, (Kn = $n == null ? void 0 : $n.selectChildren) != null ? Kn : !0, Qt), er;
      });
    }, _e.getIsSelected = () => {
      const {
        rowSelection: Zt
      } = Qt.getState();
      return isRowSelected(_e, Zt);
    }, _e.getIsSomeSelected = () => {
      const {
        rowSelection: Zt
      } = Qt.getState();
      return isSubRowSelected(_e, Zt) === "some";
    }, _e.getIsAllSubRowsSelected = () => {
      const {
        rowSelection: Zt
      } = Qt.getState();
      return isSubRowSelected(_e, Zt) === "all";
    }, _e.getCanSelect = () => {
      var Zt;
      return typeof Qt.options.enableRowSelection == "function" ? Qt.options.enableRowSelection(_e) : (Zt = Qt.options.enableRowSelection) != null ? Zt : !0;
    }, _e.getCanSelectSubRows = () => {
      var Zt;
      return typeof Qt.options.enableSubRowSelection == "function" ? Qt.options.enableSubRowSelection(_e) : (Zt = Qt.options.enableSubRowSelection) != null ? Zt : !0;
    }, _e.getCanMultiSelect = () => {
      var Zt;
      return typeof Qt.options.enableMultiRowSelection == "function" ? Qt.options.enableMultiRowSelection(_e) : (Zt = Qt.options.enableMultiRowSelection) != null ? Zt : !0;
    }, _e.getToggleSelectedHandler = () => {
      const Zt = _e.getCanSelect();
      return ($n) => {
        var Sn;
        Zt && _e.toggleSelected((Sn = $n.target) == null ? void 0 : Sn.checked);
      };
    };
  }
}, mutateRowIsSelected = (_e, Qt, Zt, $n, Sn) => {
  var kn;
  const Kn = Sn.getRow(Qt);
  Zt ? (Kn.getCanMultiSelect() || Object.keys(_e).forEach((er) => delete _e[er]), Kn.getCanSelect() && (_e[Qt] = !0)) : delete _e[Qt], $n && (kn = Kn.subRows) != null && kn.length && Kn.getCanSelectSubRows() && Kn.subRows.forEach((er) => mutateRowIsSelected(_e, er.id, Zt, $n, Sn));
};
function selectRowsFn(_e, Qt) {
  const Zt = _e.getState().rowSelection, $n = [], Sn = {}, kn = function(Kn, er) {
    return Kn.map((Cr) => {
      var kr;
      const Yr = isRowSelected(Cr, Zt);
      if (Yr && ($n.push(Cr), Sn[Cr.id] = Cr), (kr = Cr.subRows) != null && kr.length && (Cr = {
        ...Cr,
        subRows: kn(Cr.subRows)
      }), Yr)
        return Cr;
    }).filter(Boolean);
  };
  return {
    rows: kn(Qt.rows),
    flatRows: $n,
    rowsById: Sn
  };
}
function isRowSelected(_e, Qt) {
  var Zt;
  return (Zt = Qt[_e.id]) != null ? Zt : !1;
}
function isSubRowSelected(_e, Qt, Zt) {
  var $n;
  if (!(($n = _e.subRows) != null && $n.length))
    return !1;
  let Sn = !0, kn = !1;
  return _e.subRows.forEach((Kn) => {
    if (!(kn && !Sn) && (Kn.getCanSelect() && (isRowSelected(Kn, Qt) ? kn = !0 : Sn = !1), Kn.subRows && Kn.subRows.length)) {
      const er = isSubRowSelected(Kn, Qt);
      er === "all" ? kn = !0 : (er === "some" && (kn = !0), Sn = !1);
    }
  }), Sn ? "all" : kn ? "some" : !1;
}
const reSplitAlphaNumeric = /([0-9]+)/gm, alphanumeric = (_e, Qt, Zt) => compareAlphanumeric(toString$1(_e.getValue(Zt)).toLowerCase(), toString$1(Qt.getValue(Zt)).toLowerCase()), alphanumericCaseSensitive = (_e, Qt, Zt) => compareAlphanumeric(toString$1(_e.getValue(Zt)), toString$1(Qt.getValue(Zt))), text$3 = (_e, Qt, Zt) => compareBasic(toString$1(_e.getValue(Zt)).toLowerCase(), toString$1(Qt.getValue(Zt)).toLowerCase()), textCaseSensitive = (_e, Qt, Zt) => compareBasic(toString$1(_e.getValue(Zt)), toString$1(Qt.getValue(Zt))), datetime$1 = (_e, Qt, Zt) => {
  const $n = _e.getValue(Zt), Sn = Qt.getValue(Zt);
  return $n > Sn ? 1 : $n < Sn ? -1 : 0;
}, basic = (_e, Qt, Zt) => compareBasic(_e.getValue(Zt), Qt.getValue(Zt));
function compareBasic(_e, Qt) {
  return _e === Qt ? 0 : _e > Qt ? 1 : -1;
}
function toString$1(_e) {
  return typeof _e == "boolean" ? String(_e) : typeof _e == "number" ? isNaN(_e) || _e === 1 / 0 || _e === -1 / 0 ? "" : String(_e) : typeof _e == "string" ? _e : "";
}
function compareAlphanumeric(_e, Qt) {
  const Zt = parseFloat(_e), $n = parseFloat(Qt);
  if (!isNaN(Zt) && !isNaN($n))
    return compareBasic(Zt, $n);
  const Sn = _e.split(reSplitAlphaNumeric).filter(Boolean), kn = Qt.split(reSplitAlphaNumeric).filter(Boolean);
  for (; Sn.length && kn.length; ) {
    const Kn = Sn.shift(), er = kn.shift(), Cr = parseInt(Kn, 10), kr = parseInt(er, 10), Yr = [Cr, kr].sort();
    if (isNaN(Yr[0])) {
      if (Kn > er)
        return 1;
      if (er > Kn)
        return -1;
      continue;
    }
    if (isNaN(Yr[1]))
      return isNaN(Cr) ? -1 : 1;
    if (Cr > kr)
      return 1;
    if (kr > Cr)
      return -1;
  }
  return Sn.length - kn.length;
}
const sortingFns = {
  alphanumeric,
  alphanumericCaseSensitive,
  text: text$3,
  textCaseSensitive,
  datetime: datetime$1,
  basic
}, Sorting = {
  getInitialState: (_e) => ({
    sorting: [],
    ..._e
  }),
  getDefaultColumnDef: () => ({
    sortingFn: "auto",
    sortUndefined: 1
  }),
  getDefaultOptions: (_e) => ({
    onSortingChange: makeStateUpdater("sorting", _e),
    isMultiSortEvent: (Qt) => Qt.shiftKey
  }),
  createColumn: (_e, Qt) => {
    _e.getAutoSortingFn = () => {
      const Zt = Qt.getFilteredRowModel().flatRows.slice(10);
      let $n = !1;
      for (const Sn of Zt) {
        const kn = Sn == null ? void 0 : Sn.getValue(_e.id);
        if (Object.prototype.toString.call(kn) === "[object Date]")
          return sortingFns.datetime;
        if (typeof kn == "string" && ($n = !0, kn.split(reSplitAlphaNumeric).length > 1))
          return sortingFns.alphanumeric;
      }
      return $n ? sortingFns.text : sortingFns.basic;
    }, _e.getAutoSortDir = () => {
      const Zt = Qt.getFilteredRowModel().flatRows[0];
      return typeof (Zt == null ? void 0 : Zt.getValue(_e.id)) == "string" ? "asc" : "desc";
    }, _e.getSortingFn = () => {
      var Zt, $n;
      if (!_e)
        throw new Error();
      return isFunction$2(_e.columnDef.sortingFn) ? _e.columnDef.sortingFn : _e.columnDef.sortingFn === "auto" ? _e.getAutoSortingFn() : (Zt = ($n = Qt.options.sortingFns) == null ? void 0 : $n[_e.columnDef.sortingFn]) != null ? Zt : sortingFns[_e.columnDef.sortingFn];
    }, _e.toggleSorting = (Zt, $n) => {
      const Sn = _e.getNextSortingOrder(), kn = typeof Zt < "u" && Zt !== null;
      Qt.setSorting((Kn) => {
        const er = Kn == null ? void 0 : Kn.find((Ls) => Ls.id === _e.id), Cr = Kn == null ? void 0 : Kn.findIndex((Ls) => Ls.id === _e.id);
        let kr = [], Yr, Ms = kn ? Zt : Sn === "desc";
        if (Kn != null && Kn.length && _e.getCanMultiSort() && $n ? er ? Yr = "toggle" : Yr = "add" : Kn != null && Kn.length && Cr !== Kn.length - 1 ? Yr = "replace" : er ? Yr = "toggle" : Yr = "replace", Yr === "toggle" && (kn || Sn || (Yr = "remove")), Yr === "add") {
          var Ds;
          kr = [...Kn, {
            id: _e.id,
            desc: Ms
          }], kr.splice(0, kr.length - ((Ds = Qt.options.maxMultiSortColCount) != null ? Ds : Number.MAX_SAFE_INTEGER));
        } else
          Yr === "toggle" ? kr = Kn.map((Ls) => Ls.id === _e.id ? {
            ...Ls,
            desc: Ms
          } : Ls) : Yr === "remove" ? kr = Kn.filter((Ls) => Ls.id !== _e.id) : kr = [{
            id: _e.id,
            desc: Ms
          }];
        return kr;
      });
    }, _e.getFirstSortDir = () => {
      var Zt, $n;
      return ((Zt = ($n = _e.columnDef.sortDescFirst) != null ? $n : Qt.options.sortDescFirst) != null ? Zt : _e.getAutoSortDir() === "desc") ? "desc" : "asc";
    }, _e.getNextSortingOrder = (Zt) => {
      var $n, Sn;
      const kn = _e.getFirstSortDir(), Kn = _e.getIsSorted();
      return Kn ? Kn !== kn && (($n = Qt.options.enableSortingRemoval) == null || $n) && // If enableSortRemove, enable in general
      (!(Zt && (Sn = Qt.options.enableMultiRemove) != null) || Sn) ? !1 : Kn === "desc" ? "asc" : "desc" : kn;
    }, _e.getCanSort = () => {
      var Zt, $n;
      return ((Zt = _e.columnDef.enableSorting) != null ? Zt : !0) && (($n = Qt.options.enableSorting) != null ? $n : !0) && !!_e.accessorFn;
    }, _e.getCanMultiSort = () => {
      var Zt, $n;
      return (Zt = ($n = _e.columnDef.enableMultiSort) != null ? $n : Qt.options.enableMultiSort) != null ? Zt : !!_e.accessorFn;
    }, _e.getIsSorted = () => {
      var Zt;
      const $n = (Zt = Qt.getState().sorting) == null ? void 0 : Zt.find((Sn) => Sn.id === _e.id);
      return $n ? $n.desc ? "desc" : "asc" : !1;
    }, _e.getSortIndex = () => {
      var Zt, $n;
      return (Zt = ($n = Qt.getState().sorting) == null ? void 0 : $n.findIndex((Sn) => Sn.id === _e.id)) != null ? Zt : -1;
    }, _e.clearSorting = () => {
      Qt.setSorting((Zt) => Zt != null && Zt.length ? Zt.filter(($n) => $n.id !== _e.id) : []);
    }, _e.getToggleSortingHandler = () => {
      const Zt = _e.getCanSort();
      return ($n) => {
        Zt && ($n.persist == null || $n.persist(), _e.toggleSorting == null || _e.toggleSorting(void 0, _e.getCanMultiSort() ? Qt.options.isMultiSortEvent == null ? void 0 : Qt.options.isMultiSortEvent($n) : !1));
      };
    };
  },
  createTable: (_e) => {
    _e.setSorting = (Qt) => _e.options.onSortingChange == null ? void 0 : _e.options.onSortingChange(Qt), _e.resetSorting = (Qt) => {
      var Zt, $n;
      _e.setSorting(Qt ? [] : (Zt = ($n = _e.initialState) == null ? void 0 : $n.sorting) != null ? Zt : []);
    }, _e.getPreSortedRowModel = () => _e.getGroupedRowModel(), _e.getSortedRowModel = () => (!_e._getSortedRowModel && _e.options.getSortedRowModel && (_e._getSortedRowModel = _e.options.getSortedRowModel(_e)), _e.options.manualSorting || !_e._getSortedRowModel ? _e.getPreSortedRowModel() : _e._getSortedRowModel());
  }
}, Visibility = {
  getInitialState: (_e) => ({
    columnVisibility: {},
    ..._e
  }),
  getDefaultOptions: (_e) => ({
    onColumnVisibilityChange: makeStateUpdater("columnVisibility", _e)
  }),
  createColumn: (_e, Qt) => {
    _e.toggleVisibility = (Zt) => {
      _e.getCanHide() && Qt.setColumnVisibility(($n) => ({
        ...$n,
        [_e.id]: Zt ?? !_e.getIsVisible()
      }));
    }, _e.getIsVisible = () => {
      var Zt, $n;
      return (Zt = ($n = Qt.getState().columnVisibility) == null ? void 0 : $n[_e.id]) != null ? Zt : !0;
    }, _e.getCanHide = () => {
      var Zt, $n;
      return ((Zt = _e.columnDef.enableHiding) != null ? Zt : !0) && (($n = Qt.options.enableHiding) != null ? $n : !0);
    }, _e.getToggleVisibilityHandler = () => (Zt) => {
      _e.toggleVisibility == null || _e.toggleVisibility(Zt.target.checked);
    };
  },
  createRow: (_e, Qt) => {
    _e._getAllVisibleCells = memo$1(() => [_e.getAllCells(), Qt.getState().columnVisibility], (Zt) => Zt.filter(($n) => $n.column.getIsVisible()), {
      key: "row._getAllVisibleCells",
      debug: () => {
        var Zt;
        return (Zt = Qt.options.debugAll) != null ? Zt : Qt.options.debugRows;
      }
    }), _e.getVisibleCells = memo$1(() => [_e.getLeftVisibleCells(), _e.getCenterVisibleCells(), _e.getRightVisibleCells()], (Zt, $n, Sn) => [...Zt, ...$n, ...Sn], {
      key: !1,
      debug: () => {
        var Zt;
        return (Zt = Qt.options.debugAll) != null ? Zt : Qt.options.debugRows;
      }
    });
  },
  createTable: (_e) => {
    const Qt = (Zt, $n) => memo$1(() => [$n(), $n().filter((Sn) => Sn.getIsVisible()).map((Sn) => Sn.id).join("_")], (Sn) => Sn.filter((kn) => kn.getIsVisible == null ? void 0 : kn.getIsVisible()), {
      key: Zt,
      debug: () => {
        var Sn;
        return (Sn = _e.options.debugAll) != null ? Sn : _e.options.debugColumns;
      }
    });
    _e.getVisibleFlatColumns = Qt("getVisibleFlatColumns", () => _e.getAllFlatColumns()), _e.getVisibleLeafColumns = Qt("getVisibleLeafColumns", () => _e.getAllLeafColumns()), _e.getLeftVisibleLeafColumns = Qt("getLeftVisibleLeafColumns", () => _e.getLeftLeafColumns()), _e.getRightVisibleLeafColumns = Qt("getRightVisibleLeafColumns", () => _e.getRightLeafColumns()), _e.getCenterVisibleLeafColumns = Qt("getCenterVisibleLeafColumns", () => _e.getCenterLeafColumns()), _e.setColumnVisibility = (Zt) => _e.options.onColumnVisibilityChange == null ? void 0 : _e.options.onColumnVisibilityChange(Zt), _e.resetColumnVisibility = (Zt) => {
      var $n;
      _e.setColumnVisibility(Zt ? {} : ($n = _e.initialState.columnVisibility) != null ? $n : {});
    }, _e.toggleAllColumnsVisible = (Zt) => {
      var $n;
      Zt = ($n = Zt) != null ? $n : !_e.getIsAllColumnsVisible(), _e.setColumnVisibility(_e.getAllLeafColumns().reduce((Sn, kn) => ({
        ...Sn,
        [kn.id]: Zt || !(kn.getCanHide != null && kn.getCanHide())
      }), {}));
    }, _e.getIsAllColumnsVisible = () => !_e.getAllLeafColumns().some((Zt) => !(Zt.getIsVisible != null && Zt.getIsVisible())), _e.getIsSomeColumnsVisible = () => _e.getAllLeafColumns().some((Zt) => Zt.getIsVisible == null ? void 0 : Zt.getIsVisible()), _e.getToggleAllColumnsVisibilityHandler = () => (Zt) => {
      var $n;
      _e.toggleAllColumnsVisible(($n = Zt.target) == null ? void 0 : $n.checked);
    };
  }
}, features = [Headers$1, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing];
function createTable(_e) {
  var Qt;
  (_e.debugAll || _e.debugTable) && console.info("Creating Table Instance...");
  let Zt = {
    _features: features
  };
  const $n = Zt._features.reduce((Yr, Ms) => Object.assign(Yr, Ms.getDefaultOptions == null ? void 0 : Ms.getDefaultOptions(Zt)), {}), Sn = (Yr) => Zt.options.mergeOptions ? Zt.options.mergeOptions($n, Yr) : {
    ...$n,
    ...Yr
  };
  let Kn = {
    ...{},
    ...(Qt = _e.initialState) != null ? Qt : {}
  };
  Zt._features.forEach((Yr) => {
    var Ms;
    Kn = (Ms = Yr.getInitialState == null ? void 0 : Yr.getInitialState(Kn)) != null ? Ms : Kn;
  });
  const er = [];
  let Cr = !1;
  const kr = {
    _features: features,
    options: {
      ...$n,
      ..._e
    },
    initialState: Kn,
    _queue: (Yr) => {
      er.push(Yr), Cr || (Cr = !0, Promise.resolve().then(() => {
        for (; er.length; )
          er.shift()();
        Cr = !1;
      }).catch((Ms) => setTimeout(() => {
        throw Ms;
      })));
    },
    reset: () => {
      Zt.setState(Zt.initialState);
    },
    setOptions: (Yr) => {
      const Ms = functionalUpdate(Yr, Zt.options);
      Zt.options = Sn(Ms);
    },
    getState: () => Zt.options.state,
    setState: (Yr) => {
      Zt.options.onStateChange == null || Zt.options.onStateChange(Yr);
    },
    _getRowId: (Yr, Ms, Ds) => {
      var Ls;
      return (Ls = Zt.options.getRowId == null ? void 0 : Zt.options.getRowId(Yr, Ms, Ds)) != null ? Ls : `${Ds ? [Ds.id, Ms].join(".") : Ms}`;
    },
    getCoreRowModel: () => (Zt._getCoreRowModel || (Zt._getCoreRowModel = Zt.options.getCoreRowModel(Zt)), Zt._getCoreRowModel()),
    // The final calls start at the bottom of the model,
    // expanded rows, which then work their way up
    getRowModel: () => Zt.getPaginationRowModel(),
    getRow: (Yr, Ms) => {
      const Ds = (Ms ? Zt.getCoreRowModel() : Zt.getRowModel()).rowsById[Yr];
      if (!Ds)
        throw new Error();
      return Ds;
    },
    _getDefaultColumnDef: memo$1(() => [Zt.options.defaultColumn], (Yr) => {
      var Ms;
      return Yr = (Ms = Yr) != null ? Ms : {}, {
        header: (Ds) => {
          const Ls = Ds.header.column.columnDef;
          return Ls.accessorKey ? Ls.accessorKey : Ls.accessorFn ? Ls.id : null;
        },
        // footer: props => props.header.column.id,
        cell: (Ds) => {
          var Ls, js;
          return (Ls = (js = Ds.renderValue()) == null || js.toString == null ? void 0 : js.toString()) != null ? Ls : null;
        },
        ...Zt._features.reduce((Ds, Ls) => Object.assign(Ds, Ls.getDefaultColumnDef == null ? void 0 : Ls.getDefaultColumnDef()), {}),
        ...Yr
      };
    }, {
      debug: () => {
        var Yr;
        return (Yr = Zt.options.debugAll) != null ? Yr : Zt.options.debugColumns;
      },
      key: !1
    }),
    _getColumnDefs: () => Zt.options.columns,
    getAllColumns: memo$1(() => [Zt._getColumnDefs()], (Yr) => {
      const Ms = function(Ds, Ls, js) {
        return js === void 0 && (js = 0), Ds.map((zs) => {
          const Fs = createColumn(Zt, zs, js, Ls), Bs = zs;
          return Fs.columns = Bs.columns ? Ms(Bs.columns, Fs, js + 1) : [], Fs;
        });
      };
      return Ms(Yr);
    }, {
      key: !1,
      debug: () => {
        var Yr;
        return (Yr = Zt.options.debugAll) != null ? Yr : Zt.options.debugColumns;
      }
    }),
    getAllFlatColumns: memo$1(() => [Zt.getAllColumns()], (Yr) => Yr.flatMap((Ms) => Ms.getFlatColumns()), {
      key: !1,
      debug: () => {
        var Yr;
        return (Yr = Zt.options.debugAll) != null ? Yr : Zt.options.debugColumns;
      }
    }),
    _getAllFlatColumnsById: memo$1(() => [Zt.getAllFlatColumns()], (Yr) => Yr.reduce((Ms, Ds) => (Ms[Ds.id] = Ds, Ms), {}), {
      key: !1,
      debug: () => {
        var Yr;
        return (Yr = Zt.options.debugAll) != null ? Yr : Zt.options.debugColumns;
      }
    }),
    getAllLeafColumns: memo$1(() => [Zt.getAllColumns(), Zt._getOrderColumnsFn()], (Yr, Ms) => {
      let Ds = Yr.flatMap((Ls) => Ls.getLeafColumns());
      return Ms(Ds);
    }, {
      key: !1,
      debug: () => {
        var Yr;
        return (Yr = Zt.options.debugAll) != null ? Yr : Zt.options.debugColumns;
      }
    }),
    getColumn: (Yr) => Zt._getAllFlatColumnsById()[Yr]
  };
  Object.assign(Zt, kr);
  for (let Yr = 0; Yr < Zt._features.length; Yr++) {
    const Ms = Zt._features[Yr];
    Ms == null || Ms.createTable == null || Ms.createTable(Zt);
  }
  return Zt;
}
function createCell(_e, Qt, Zt, $n) {
  const Sn = () => {
    var Kn;
    return (Kn = kn.getValue()) != null ? Kn : _e.options.renderFallbackValue;
  }, kn = {
    id: `${Qt.id}_${Zt.id}`,
    row: Qt,
    column: Zt,
    getValue: () => Qt.getValue($n),
    renderValue: Sn,
    getContext: memo$1(() => [_e, Zt, Qt, kn], (Kn, er, Cr, kr) => ({
      table: Kn,
      column: er,
      row: Cr,
      cell: kr,
      getValue: kr.getValue,
      renderValue: kr.renderValue
    }), {
      key: !1,
      debug: () => _e.options.debugAll
    })
  };
  return _e._features.forEach((Kn) => {
    Kn.createCell == null || Kn.createCell(kn, Zt, Qt, _e);
  }, {}), kn;
}
const createRow$1 = (_e, Qt, Zt, $n, Sn, kn, Kn) => {
  let er = {
    id: Qt,
    index: $n,
    original: Zt,
    depth: Sn,
    parentId: Kn,
    _valuesCache: {},
    _uniqueValuesCache: {},
    getValue: (Cr) => {
      if (er._valuesCache.hasOwnProperty(Cr))
        return er._valuesCache[Cr];
      const kr = _e.getColumn(Cr);
      if (kr != null && kr.accessorFn)
        return er._valuesCache[Cr] = kr.accessorFn(er.original, $n), er._valuesCache[Cr];
    },
    getUniqueValues: (Cr) => {
      if (er._uniqueValuesCache.hasOwnProperty(Cr))
        return er._uniqueValuesCache[Cr];
      const kr = _e.getColumn(Cr);
      if (kr != null && kr.accessorFn)
        return kr.columnDef.getUniqueValues ? (er._uniqueValuesCache[Cr] = kr.columnDef.getUniqueValues(er.original, $n), er._uniqueValuesCache[Cr]) : (er._uniqueValuesCache[Cr] = [er.getValue(Cr)], er._uniqueValuesCache[Cr]);
    },
    renderValue: (Cr) => {
      var kr;
      return (kr = er.getValue(Cr)) != null ? kr : _e.options.renderFallbackValue;
    },
    subRows: kn ?? [],
    getLeafRows: () => flattenBy(er.subRows, (Cr) => Cr.subRows),
    getParentRow: () => er.parentId ? _e.getRow(er.parentId, !0) : void 0,
    getParentRows: () => {
      let Cr = [], kr = er;
      for (; ; ) {
        const Yr = kr.getParentRow();
        if (!Yr)
          break;
        Cr.push(Yr), kr = Yr;
      }
      return Cr.reverse();
    },
    getAllCells: memo$1(() => [_e.getAllLeafColumns()], (Cr) => Cr.map((kr) => createCell(_e, er, kr, kr.id)), {
      key: !1,
      debug: () => {
        var Cr;
        return (Cr = _e.options.debugAll) != null ? Cr : _e.options.debugRows;
      }
    }),
    _getAllCellsByColumnId: memo$1(() => [er.getAllCells()], (Cr) => Cr.reduce((kr, Yr) => (kr[Yr.column.id] = Yr, kr), {}), {
      key: "row.getAllCellsByColumnId",
      debug: () => {
        var Cr;
        return (Cr = _e.options.debugAll) != null ? Cr : _e.options.debugRows;
      }
    })
  };
  for (let Cr = 0; Cr < _e._features.length; Cr++) {
    const kr = _e._features[Cr];
    kr == null || kr.createRow == null || kr.createRow(er, _e);
  }
  return er;
};
function getCoreRowModel() {
  return (_e) => memo$1(() => [_e.options.data], (Qt) => {
    const Zt = {
      rows: [],
      flatRows: [],
      rowsById: {}
    }, $n = function(Sn, kn, Kn) {
      kn === void 0 && (kn = 0);
      const er = [];
      for (let kr = 0; kr < Sn.length; kr++) {
        const Yr = createRow$1(_e, _e._getRowId(Sn[kr], kr, Kn), Sn[kr], kr, kn, void 0, Kn == null ? void 0 : Kn.id);
        if (Zt.flatRows.push(Yr), Zt.rowsById[Yr.id] = Yr, er.push(Yr), _e.options.getSubRows) {
          var Cr;
          Yr.originalSubRows = _e.options.getSubRows(Sn[kr], kr), (Cr = Yr.originalSubRows) != null && Cr.length && (Yr.subRows = $n(Yr.originalSubRows, kn + 1, Yr));
        }
      }
      return er;
    };
    return Zt.rows = $n(Qt), Zt;
  }, {
    key: !1,
    debug: () => {
      var Qt;
      return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugTable;
    },
    onChange: () => {
      _e._autoResetPageIndex();
    }
  });
}
function filterRows(_e, Qt, Zt) {
  return Zt.options.filterFromLeafRows ? filterRowModelFromLeafs(_e, Qt, Zt) : filterRowModelFromRoot(_e, Qt, Zt);
}
function filterRowModelFromLeafs(_e, Qt, Zt) {
  var $n;
  const Sn = [], kn = {}, Kn = ($n = Zt.options.maxLeafRowFilterDepth) != null ? $n : 100, er = function(Cr, kr) {
    kr === void 0 && (kr = 0);
    const Yr = [];
    for (let Ds = 0; Ds < Cr.length; Ds++) {
      var Ms;
      let Ls = Cr[Ds];
      const js = createRow$1(Zt, Ls.id, Ls.original, Ls.index, Ls.depth, void 0, Ls.parentId);
      if (js.columnFilters = Ls.columnFilters, (Ms = Ls.subRows) != null && Ms.length && kr < Kn) {
        if (js.subRows = er(Ls.subRows, kr + 1), Ls = js, Qt(Ls) && !js.subRows.length) {
          Yr.push(Ls), kn[Ls.id] = Ls, Sn.push(Ls);
          continue;
        }
        if (Qt(Ls) || js.subRows.length) {
          Yr.push(Ls), kn[Ls.id] = Ls, Sn.push(Ls);
          continue;
        }
      } else
        Ls = js, Qt(Ls) && (Yr.push(Ls), kn[Ls.id] = Ls, Sn.push(Ls));
    }
    return Yr;
  };
  return {
    rows: er(_e),
    flatRows: Sn,
    rowsById: kn
  };
}
function filterRowModelFromRoot(_e, Qt, Zt) {
  var $n;
  const Sn = [], kn = {}, Kn = ($n = Zt.options.maxLeafRowFilterDepth) != null ? $n : 100, er = function(Cr, kr) {
    kr === void 0 && (kr = 0);
    const Yr = [];
    for (let Ds = 0; Ds < Cr.length; Ds++) {
      let Ls = Cr[Ds];
      if (Qt(Ls)) {
        var Ms;
        if ((Ms = Ls.subRows) != null && Ms.length && kr < Kn) {
          const zs = createRow$1(Zt, Ls.id, Ls.original, Ls.index, Ls.depth, void 0, Ls.parentId);
          zs.subRows = er(Ls.subRows, kr + 1), Ls = zs;
        }
        Yr.push(Ls), Sn.push(Ls), kn[Ls.id] = Ls;
      }
    }
    return Yr;
  };
  return {
    rows: er(_e),
    flatRows: Sn,
    rowsById: kn
  };
}
function getFilteredRowModel() {
  return (_e) => memo$1(() => [_e.getPreFilteredRowModel(), _e.getState().columnFilters, _e.getState().globalFilter], (Qt, Zt, $n) => {
    if (!Qt.rows.length || !(Zt != null && Zt.length) && !$n) {
      for (let Ds = 0; Ds < Qt.flatRows.length; Ds++)
        Qt.flatRows[Ds].columnFilters = {}, Qt.flatRows[Ds].columnFiltersMeta = {};
      return Qt;
    }
    const Sn = [], kn = [];
    (Zt ?? []).forEach((Ds) => {
      var Ls;
      const js = _e.getColumn(Ds.id);
      if (!js)
        return;
      const zs = js.getFilterFn();
      zs && Sn.push({
        id: Ds.id,
        filterFn: zs,
        resolvedValue: (Ls = zs.resolveFilterValue == null ? void 0 : zs.resolveFilterValue(Ds.value)) != null ? Ls : Ds.value
      });
    });
    const Kn = Zt.map((Ds) => Ds.id), er = _e.getGlobalFilterFn(), Cr = _e.getAllLeafColumns().filter((Ds) => Ds.getCanGlobalFilter());
    $n && er && Cr.length && (Kn.push("__global__"), Cr.forEach((Ds) => {
      var Ls;
      kn.push({
        id: Ds.id,
        filterFn: er,
        resolvedValue: (Ls = er.resolveFilterValue == null ? void 0 : er.resolveFilterValue($n)) != null ? Ls : $n
      });
    }));
    let kr, Yr;
    for (let Ds = 0; Ds < Qt.flatRows.length; Ds++) {
      const Ls = Qt.flatRows[Ds];
      if (Ls.columnFilters = {}, Sn.length)
        for (let js = 0; js < Sn.length; js++) {
          kr = Sn[js];
          const zs = kr.id;
          Ls.columnFilters[zs] = kr.filterFn(Ls, zs, kr.resolvedValue, (Fs) => {
            Ls.columnFiltersMeta[zs] = Fs;
          });
        }
      if (kn.length) {
        for (let js = 0; js < kn.length; js++) {
          Yr = kn[js];
          const zs = Yr.id;
          if (Yr.filterFn(Ls, zs, Yr.resolvedValue, (Fs) => {
            Ls.columnFiltersMeta[zs] = Fs;
          })) {
            Ls.columnFilters.__global__ = !0;
            break;
          }
        }
        Ls.columnFilters.__global__ !== !0 && (Ls.columnFilters.__global__ = !1);
      }
    }
    const Ms = (Ds) => {
      for (let Ls = 0; Ls < Kn.length; Ls++)
        if (Ds.columnFilters[Kn[Ls]] === !1)
          return !1;
      return !0;
    };
    return filterRows(Qt.rows, Ms, _e);
  }, {
    key: !1,
    debug: () => {
      var Qt;
      return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugTable;
    },
    onChange: () => {
      _e._autoResetPageIndex();
    }
  });
}
function getFacetedRowModel() {
  return (_e, Qt) => memo$1(() => [_e.getPreFilteredRowModel(), _e.getState().columnFilters, _e.getState().globalFilter, _e.getFilteredRowModel()], (Zt, $n, Sn) => {
    if (!Zt.rows.length || !($n != null && $n.length) && !Sn)
      return Zt;
    const kn = [...$n.map((er) => er.id).filter((er) => er !== Qt), Sn ? "__global__" : void 0].filter(Boolean), Kn = (er) => {
      for (let Cr = 0; Cr < kn.length; Cr++)
        if (er.columnFilters[kn[Cr]] === !1)
          return !1;
      return !0;
    };
    return filterRows(Zt.rows, Kn, _e);
  }, {
    key: !1,
    debug: () => {
      var Zt;
      return (Zt = _e.options.debugAll) != null ? Zt : _e.options.debugTable;
    },
    onChange: () => {
    }
  });
}
function getFacetedUniqueValues() {
  return (_e, Qt) => memo$1(() => {
    var Zt;
    return [(Zt = _e.getColumn(Qt)) == null ? void 0 : Zt.getFacetedRowModel()];
  }, (Zt) => {
    if (!Zt)
      return /* @__PURE__ */ new Map();
    let $n = /* @__PURE__ */ new Map();
    for (let kn = 0; kn < Zt.flatRows.length; kn++) {
      const Kn = Zt.flatRows[kn].getUniqueValues(Qt);
      for (let er = 0; er < Kn.length; er++) {
        const Cr = Kn[er];
        if ($n.has(Cr)) {
          var Sn;
          $n.set(Cr, ((Sn = $n.get(Cr)) != null ? Sn : 0) + 1);
        } else
          $n.set(Cr, 1);
      }
    }
    return $n;
  }, {
    key: !1,
    debug: () => {
      var Zt;
      return (Zt = _e.options.debugAll) != null ? Zt : _e.options.debugTable;
    },
    onChange: () => {
    }
  });
}
function getFacetedMinMaxValues() {
  return (_e, Qt) => memo$1(() => {
    var Zt;
    return [(Zt = _e.getColumn(Qt)) == null ? void 0 : Zt.getFacetedRowModel()];
  }, (Zt) => {
    var $n;
    if (!Zt)
      return;
    const Sn = ($n = Zt.flatRows[0]) == null ? void 0 : $n.getUniqueValues(Qt);
    if (typeof Sn > "u")
      return;
    let kn = [Sn, Sn];
    for (let Kn = 0; Kn < Zt.flatRows.length; Kn++) {
      const er = Zt.flatRows[Kn].getUniqueValues(Qt);
      for (let Cr = 0; Cr < er.length; Cr++) {
        const kr = er[Cr];
        kr < kn[0] ? kn[0] = kr : kr > kn[1] && (kn[1] = kr);
      }
    }
    return kn;
  }, {
    key: !1,
    debug: () => {
      var Zt;
      return (Zt = _e.options.debugAll) != null ? Zt : _e.options.debugTable;
    },
    onChange: () => {
    }
  });
}
function getSortedRowModel() {
  return (_e) => memo$1(() => [_e.getState().sorting, _e.getPreSortedRowModel()], (Qt, Zt) => {
    if (!Zt.rows.length || !(Qt != null && Qt.length))
      return Zt;
    const $n = _e.getState().sorting, Sn = [], kn = $n.filter((Cr) => {
      var kr;
      return (kr = _e.getColumn(Cr.id)) == null ? void 0 : kr.getCanSort();
    }), Kn = {};
    kn.forEach((Cr) => {
      const kr = _e.getColumn(Cr.id);
      kr && (Kn[Cr.id] = {
        sortUndefined: kr.columnDef.sortUndefined,
        invertSorting: kr.columnDef.invertSorting,
        sortingFn: kr.getSortingFn()
      });
    });
    const er = (Cr) => {
      const kr = Cr.map((Yr) => ({
        ...Yr
      }));
      return kr.sort((Yr, Ms) => {
        for (let Ls = 0; Ls < kn.length; Ls += 1) {
          var Ds;
          const js = kn[Ls], zs = Kn[js.id], Fs = (Ds = js == null ? void 0 : js.desc) != null ? Ds : !1;
          let Bs = 0;
          if (zs.sortUndefined) {
            const Hs = Yr.getValue(js.id), Ws = Ms.getValue(js.id), Ys = Hs === void 0, El = Ws === void 0;
            (Ys || El) && (Bs = Ys && El ? 0 : Ys ? zs.sortUndefined : -zs.sortUndefined);
          }
          if (Bs === 0 && (Bs = zs.sortingFn(Yr, Ms, js.id)), Bs !== 0)
            return Fs && (Bs *= -1), zs.invertSorting && (Bs *= -1), Bs;
        }
        return Yr.index - Ms.index;
      }), kr.forEach((Yr) => {
        var Ms;
        Sn.push(Yr), (Ms = Yr.subRows) != null && Ms.length && (Yr.subRows = er(Yr.subRows));
      }), kr;
    };
    return {
      rows: er(Zt.rows),
      flatRows: Sn,
      rowsById: Zt.rowsById
    };
  }, {
    key: !1,
    debug: () => {
      var Qt;
      return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugTable;
    },
    onChange: () => {
      _e._autoResetPageIndex();
    }
  });
}
function getGroupedRowModel() {
  return (_e) => memo$1(() => [_e.getState().grouping, _e.getPreGroupedRowModel()], (Qt, Zt) => {
    if (!Zt.rows.length || !Qt.length)
      return Zt;
    const $n = Qt.filter((Cr) => _e.getColumn(Cr)), Sn = [], kn = {}, Kn = function(Cr, kr, Yr) {
      if (kr === void 0 && (kr = 0), kr >= $n.length)
        return Cr.map((js) => (js.depth = kr, Sn.push(js), kn[js.id] = js, js.subRows && (js.subRows = Kn(js.subRows, kr + 1, js.id)), js));
      const Ms = $n[kr], Ds = groupBy(Cr, Ms);
      return Array.from(Ds.entries()).map((js, zs) => {
        let [Fs, Bs] = js, Hs = `${Ms}:${Fs}`;
        Hs = Yr ? `${Yr}>${Hs}` : Hs;
        const Ws = Kn(Bs, kr + 1, Hs), Ys = kr ? flattenBy(Bs, (Mu) => Mu.subRows) : Bs, El = createRow$1(_e, Hs, Ys[0].original, zs, kr, void 0, Yr);
        return Object.assign(El, {
          groupingColumnId: Ms,
          groupingValue: Fs,
          subRows: Ws,
          leafRows: Ys,
          getValue: (Mu) => {
            if ($n.includes(Mu)) {
              if (El._valuesCache.hasOwnProperty(Mu))
                return El._valuesCache[Mu];
              if (Bs[0]) {
                var Pl;
                El._valuesCache[Mu] = (Pl = Bs[0].getValue(Mu)) != null ? Pl : void 0;
              }
              return El._valuesCache[Mu];
            }
            if (El._groupingValuesCache.hasOwnProperty(Mu))
              return El._groupingValuesCache[Mu];
            const Iu = _e.getColumn(Mu), Tu = Iu == null ? void 0 : Iu.getAggregationFn();
            if (Tu)
              return El._groupingValuesCache[Mu] = Tu(Mu, Ys, Bs), El._groupingValuesCache[Mu];
          }
        }), Ws.forEach((Mu) => {
          Sn.push(Mu), kn[Mu.id] = Mu;
        }), El;
      });
    }, er = Kn(Zt.rows, 0);
    return er.forEach((Cr) => {
      Sn.push(Cr), kn[Cr.id] = Cr;
    }), {
      rows: er,
      flatRows: Sn,
      rowsById: kn
    };
  }, {
    key: !1,
    debug: () => {
      var Qt;
      return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugTable;
    },
    onChange: () => {
      _e._queue(() => {
        _e._autoResetExpanded(), _e._autoResetPageIndex();
      });
    }
  });
}
function groupBy(_e, Qt) {
  const Zt = /* @__PURE__ */ new Map();
  return _e.reduce(($n, Sn) => {
    const kn = `${Sn.getGroupingValue(Qt)}`, Kn = $n.get(kn);
    return Kn ? Kn.push(Sn) : $n.set(kn, [Sn]), $n;
  }, Zt);
}
function getExpandedRowModel() {
  return (_e) => memo$1(() => [_e.getState().expanded, _e.getPreExpandedRowModel(), _e.options.paginateExpandedRows], (Qt, Zt, $n) => !Zt.rows.length || Qt !== !0 && !Object.keys(Qt ?? {}).length || !$n ? Zt : expandRows(Zt), {
    key: !1,
    debug: () => {
      var Qt;
      return (Qt = _e.options.debugAll) != null ? Qt : _e.options.debugTable;
    }
  });
}
function expandRows(_e) {
  const Qt = [], Zt = ($n) => {
    var Sn;
    Qt.push($n), (Sn = $n.subRows) != null && Sn.length && $n.getIsExpanded() && $n.subRows.forEach(Zt);
  };
  return _e.rows.forEach(Zt), {
    rows: Qt,
    flatRows: _e.flatRows,
    rowsById: _e.rowsById
  };
}
function getPaginationRowModel(_e) {
  return (Qt) => memo$1(() => [Qt.getState().pagination, Qt.getPrePaginationRowModel(), Qt.options.paginateExpandedRows ? void 0 : Qt.getState().expanded], (Zt, $n) => {
    if (!$n.rows.length)
      return $n;
    const {
      pageSize: Sn,
      pageIndex: kn
    } = Zt;
    let {
      rows: Kn,
      flatRows: er,
      rowsById: Cr
    } = $n;
    const kr = Sn * kn, Yr = kr + Sn;
    Kn = Kn.slice(kr, Yr);
    let Ms;
    Qt.options.paginateExpandedRows ? Ms = {
      rows: Kn,
      flatRows: er,
      rowsById: Cr
    } : Ms = expandRows({
      rows: Kn,
      flatRows: er,
      rowsById: Cr
    }), Ms.flatRows = [];
    const Ds = (Ls) => {
      Ms.flatRows.push(Ls), Ls.subRows.length && Ls.subRows.forEach(Ds);
    };
    return Ms.rows.forEach(Ds), Ms;
  }, {
    key: !1,
    debug: () => {
      var Zt;
      return (Zt = Qt.options.debugAll) != null ? Zt : Qt.options.debugTable;
    }
  });
}
/**
 * react-table
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
function useReactTable(_e) {
  const Qt = {
    state: {},
    // Dummy state
    onStateChange: () => {
    },
    // noop
    renderFallbackValue: null,
    ..._e
  }, [Zt] = reactExports.useState(() => ({
    current: createTable(Qt)
  })), [$n, Sn] = reactExports.useState(() => Zt.current.initialState);
  return Zt.current.setOptions((kn) => ({
    ...kn,
    ..._e,
    state: {
      ...$n,
      ..._e.state
    },
    // Similarly, we'll maintain both our internal state and any user-provided
    // state.
    onStateChange: (Kn) => {
      Sn(Kn), _e.onStateChange == null || _e.onStateChange(Kn);
    }
  })), Zt.current;
}
/**
 * match-sorter-utils
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
const characterMap = {
  À: "A",
  Á: "A",
  Â: "A",
  Ã: "A",
  Ä: "A",
  Å: "A",
  Ấ: "A",
  Ắ: "A",
  Ẳ: "A",
  Ẵ: "A",
  Ặ: "A",
  Æ: "AE",
  Ầ: "A",
  Ằ: "A",
  Ȃ: "A",
  Ç: "C",
  Ḉ: "C",
  È: "E",
  É: "E",
  Ê: "E",
  Ë: "E",
  Ế: "E",
  Ḗ: "E",
  Ề: "E",
  Ḕ: "E",
  Ḝ: "E",
  Ȇ: "E",
  Ì: "I",
  Í: "I",
  Î: "I",
  Ï: "I",
  Ḯ: "I",
  Ȋ: "I",
  Ð: "D",
  Ñ: "N",
  Ò: "O",
  Ó: "O",
  Ô: "O",
  Õ: "O",
  Ö: "O",
  Ø: "O",
  Ố: "O",
  Ṍ: "O",
  Ṓ: "O",
  Ȏ: "O",
  Ù: "U",
  Ú: "U",
  Û: "U",
  Ü: "U",
  Ý: "Y",
  à: "a",
  á: "a",
  â: "a",
  ã: "a",
  ä: "a",
  å: "a",
  ấ: "a",
  ắ: "a",
  ẳ: "a",
  ẵ: "a",
  ặ: "a",
  æ: "ae",
  ầ: "a",
  ằ: "a",
  ȃ: "a",
  ç: "c",
  ḉ: "c",
  è: "e",
  é: "e",
  ê: "e",
  ë: "e",
  ế: "e",
  ḗ: "e",
  ề: "e",
  ḕ: "e",
  ḝ: "e",
  ȇ: "e",
  ì: "i",
  í: "i",
  î: "i",
  ï: "i",
  ḯ: "i",
  ȋ: "i",
  ð: "d",
  ñ: "n",
  ò: "o",
  ó: "o",
  ô: "o",
  õ: "o",
  ö: "o",
  ø: "o",
  ố: "o",
  ṍ: "o",
  ṓ: "o",
  ȏ: "o",
  ù: "u",
  ú: "u",
  û: "u",
  ü: "u",
  ý: "y",
  ÿ: "y",
  Ā: "A",
  ā: "a",
  Ă: "A",
  ă: "a",
  Ą: "A",
  ą: "a",
  Ć: "C",
  ć: "c",
  Ĉ: "C",
  ĉ: "c",
  Ċ: "C",
  ċ: "c",
  Č: "C",
  č: "c",
  C̆: "C",
  c̆: "c",
  Ď: "D",
  ď: "d",
  Đ: "D",
  đ: "d",
  Ē: "E",
  ē: "e",
  Ĕ: "E",
  ĕ: "e",
  Ė: "E",
  ė: "e",
  Ę: "E",
  ę: "e",
  Ě: "E",
  ě: "e",
  Ĝ: "G",
  Ǵ: "G",
  ĝ: "g",
  ǵ: "g",
  Ğ: "G",
  ğ: "g",
  Ġ: "G",
  ġ: "g",
  Ģ: "G",
  ģ: "g",
  Ĥ: "H",
  ĥ: "h",
  Ħ: "H",
  ħ: "h",
  Ḫ: "H",
  ḫ: "h",
  Ĩ: "I",
  ĩ: "i",
  Ī: "I",
  ī: "i",
  Ĭ: "I",
  ĭ: "i",
  Į: "I",
  į: "i",
  İ: "I",
  ı: "i",
  Ĳ: "IJ",
  ĳ: "ij",
  Ĵ: "J",
  ĵ: "j",
  Ķ: "K",
  ķ: "k",
  Ḱ: "K",
  ḱ: "k",
  K̆: "K",
  k̆: "k",
  Ĺ: "L",
  ĺ: "l",
  Ļ: "L",
  ļ: "l",
  Ľ: "L",
  ľ: "l",
  Ŀ: "L",
  ŀ: "l",
  Ł: "l",
  ł: "l",
  Ḿ: "M",
  ḿ: "m",
  M̆: "M",
  m̆: "m",
  Ń: "N",
  ń: "n",
  Ņ: "N",
  ņ: "n",
  Ň: "N",
  ň: "n",
  ŉ: "n",
  N̆: "N",
  n̆: "n",
  Ō: "O",
  ō: "o",
  Ŏ: "O",
  ŏ: "o",
  Ő: "O",
  ő: "o",
  Œ: "OE",
  œ: "oe",
  P̆: "P",
  p̆: "p",
  Ŕ: "R",
  ŕ: "r",
  Ŗ: "R",
  ŗ: "r",
  Ř: "R",
  ř: "r",
  R̆: "R",
  r̆: "r",
  Ȓ: "R",
  ȓ: "r",
  Ś: "S",
  ś: "s",
  Ŝ: "S",
  ŝ: "s",
  Ş: "S",
  Ș: "S",
  ș: "s",
  ş: "s",
  Š: "S",
  š: "s",
  Ţ: "T",
  ţ: "t",
  ț: "t",
  Ț: "T",
  Ť: "T",
  ť: "t",
  Ŧ: "T",
  ŧ: "t",
  T̆: "T",
  t̆: "t",
  Ũ: "U",
  ũ: "u",
  Ū: "U",
  ū: "u",
  Ŭ: "U",
  ŭ: "u",
  Ů: "U",
  ů: "u",
  Ű: "U",
  ű: "u",
  Ų: "U",
  ų: "u",
  Ȗ: "U",
  ȗ: "u",
  V̆: "V",
  v̆: "v",
  Ŵ: "W",
  ŵ: "w",
  Ẃ: "W",
  ẃ: "w",
  X̆: "X",
  x̆: "x",
  Ŷ: "Y",
  ŷ: "y",
  Ÿ: "Y",
  Y̆: "Y",
  y̆: "y",
  Ź: "Z",
  ź: "z",
  Ż: "Z",
  ż: "z",
  Ž: "Z",
  ž: "z",
  ſ: "s",
  ƒ: "f",
  Ơ: "O",
  ơ: "o",
  Ư: "U",
  ư: "u",
  Ǎ: "A",
  ǎ: "a",
  Ǐ: "I",
  ǐ: "i",
  Ǒ: "O",
  ǒ: "o",
  Ǔ: "U",
  ǔ: "u",
  Ǖ: "U",
  ǖ: "u",
  Ǘ: "U",
  ǘ: "u",
  Ǚ: "U",
  ǚ: "u",
  Ǜ: "U",
  ǜ: "u",
  Ứ: "U",
  ứ: "u",
  Ṹ: "U",
  ṹ: "u",
  Ǻ: "A",
  ǻ: "a",
  Ǽ: "AE",
  ǽ: "ae",
  Ǿ: "O",
  ǿ: "o",
  Þ: "TH",
  þ: "th",
  Ṕ: "P",
  ṕ: "p",
  Ṥ: "S",
  ṥ: "s",
  X́: "X",
  x́: "x",
  Ѓ: "Г",
  ѓ: "г",
  Ќ: "К",
  ќ: "к",
  A̋: "A",
  a̋: "a",
  E̋: "E",
  e̋: "e",
  I̋: "I",
  i̋: "i",
  Ǹ: "N",
  ǹ: "n",
  Ồ: "O",
  ồ: "o",
  Ṑ: "O",
  ṑ: "o",
  Ừ: "U",
  ừ: "u",
  Ẁ: "W",
  ẁ: "w",
  Ỳ: "Y",
  ỳ: "y",
  Ȁ: "A",
  ȁ: "a",
  Ȅ: "E",
  ȅ: "e",
  Ȉ: "I",
  ȉ: "i",
  Ȍ: "O",
  ȍ: "o",
  Ȑ: "R",
  ȑ: "r",
  Ȕ: "U",
  ȕ: "u",
  B̌: "B",
  b̌: "b",
  Č̣: "C",
  č̣: "c",
  Ê̌: "E",
  ê̌: "e",
  F̌: "F",
  f̌: "f",
  Ǧ: "G",
  ǧ: "g",
  Ȟ: "H",
  ȟ: "h",
  J̌: "J",
  ǰ: "j",
  Ǩ: "K",
  ǩ: "k",
  M̌: "M",
  m̌: "m",
  P̌: "P",
  p̌: "p",
  Q̌: "Q",
  q̌: "q",
  Ř̩: "R",
  ř̩: "r",
  Ṧ: "S",
  ṧ: "s",
  V̌: "V",
  v̌: "v",
  W̌: "W",
  w̌: "w",
  X̌: "X",
  x̌: "x",
  Y̌: "Y",
  y̌: "y",
  A̧: "A",
  a̧: "a",
  B̧: "B",
  b̧: "b",
  Ḑ: "D",
  ḑ: "d",
  Ȩ: "E",
  ȩ: "e",
  Ɛ̧: "E",
  ɛ̧: "e",
  Ḩ: "H",
  ḩ: "h",
  I̧: "I",
  i̧: "i",
  Ɨ̧: "I",
  ɨ̧: "i",
  M̧: "M",
  m̧: "m",
  O̧: "O",
  o̧: "o",
  Q̧: "Q",
  q̧: "q",
  U̧: "U",
  u̧: "u",
  X̧: "X",
  x̧: "x",
  Z̧: "Z",
  z̧: "z"
}, chars = Object.keys(characterMap).join("|"), allAccents = new RegExp(chars, "g");
function removeAccents(_e) {
  return _e.replace(allAccents, (Qt) => characterMap[Qt]);
}
/**
 * @name match-sorter
 * @license MIT license.
 * @copyright (c) 2099 Kent C. Dodds
 * @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
 */
const rankings = {
  CASE_SENSITIVE_EQUAL: 7,
  EQUAL: 6,
  STARTS_WITH: 5,
  WORD_STARTS_WITH: 4,
  CONTAINS: 3,
  ACRONYM: 2,
  MATCHES: 1,
  NO_MATCH: 0
};
function rankItem(_e, Qt, Zt) {
  var $n;
  if (Zt = Zt || {}, Zt.threshold = ($n = Zt.threshold) != null ? $n : rankings.MATCHES, !Zt.accessors) {
    const Kn = getMatchRanking(_e, Qt, Zt);
    return {
      // ends up being duplicate of 'item' in matches but consistent
      rankedValue: _e,
      rank: Kn,
      accessorIndex: -1,
      accessorThreshold: Zt.threshold,
      passed: Kn >= Zt.threshold
    };
  }
  const Sn = getAllValuesToRank(_e, Zt.accessors), kn = {
    rankedValue: _e,
    rank: rankings.NO_MATCH,
    accessorIndex: -1,
    accessorThreshold: Zt.threshold,
    passed: !1
  };
  for (let Kn = 0; Kn < Sn.length; Kn++) {
    const er = Sn[Kn];
    let Cr = getMatchRanking(er.itemValue, Qt, Zt);
    const {
      minRanking: kr,
      maxRanking: Yr,
      threshold: Ms = Zt.threshold
    } = er.attributes;
    Cr < kr && Cr >= rankings.MATCHES ? Cr = kr : Cr > Yr && (Cr = Yr), Cr = Math.min(Cr, Yr), Cr >= Ms && Cr > kn.rank && (kn.rank = Cr, kn.passed = !0, kn.accessorIndex = Kn, kn.accessorThreshold = Ms, kn.rankedValue = er.itemValue);
  }
  return kn;
}
function getMatchRanking(_e, Qt, Zt) {
  return _e = prepareValueForComparison(_e, Zt), Qt = prepareValueForComparison(Qt, Zt), Qt.length > _e.length ? rankings.NO_MATCH : _e === Qt ? rankings.CASE_SENSITIVE_EQUAL : (_e = _e.toLowerCase(), Qt = Qt.toLowerCase(), _e === Qt ? rankings.EQUAL : _e.startsWith(Qt) ? rankings.STARTS_WITH : _e.includes(` ${Qt}`) ? rankings.WORD_STARTS_WITH : _e.includes(Qt) ? rankings.CONTAINS : Qt.length === 1 ? rankings.NO_MATCH : getAcronym(_e).includes(Qt) ? rankings.ACRONYM : getClosenessRanking(_e, Qt));
}
function getAcronym(_e) {
  let Qt = "";
  return _e.split(" ").forEach(($n) => {
    $n.split("-").forEach((kn) => {
      Qt += kn.substr(0, 1);
    });
  }), Qt;
}
function getClosenessRanking(_e, Qt) {
  let Zt = 0, $n = 0;
  function Sn(Cr, kr, Yr) {
    for (let Ms = Yr, Ds = kr.length; Ms < Ds; Ms++)
      if (kr[Ms] === Cr)
        return Zt += 1, Ms + 1;
    return -1;
  }
  function kn(Cr) {
    const kr = 1 / Cr, Yr = Zt / Qt.length;
    return rankings.MATCHES + Yr * kr;
  }
  const Kn = Sn(Qt[0], _e, 0);
  if (Kn < 0)
    return rankings.NO_MATCH;
  $n = Kn;
  for (let Cr = 1, kr = Qt.length; Cr < kr; Cr++) {
    const Yr = Qt[Cr];
    if ($n = Sn(Yr, _e, $n), !($n > -1))
      return rankings.NO_MATCH;
  }
  const er = $n - Kn;
  return kn(er);
}
function compareItems(_e, Qt) {
  return _e.rank === Qt.rank ? 0 : _e.rank > Qt.rank ? -1 : 1;
}
function prepareValueForComparison(_e, Qt) {
  let {
    keepDiacritics: Zt
  } = Qt;
  return _e = `${_e}`, Zt || (_e = removeAccents(_e)), _e;
}
function getItemValues(_e, Qt) {
  let Zt = Qt;
  typeof Qt == "object" && (Zt = Qt.accessor);
  const $n = Zt(_e);
  return $n == null ? [] : Array.isArray($n) ? $n : [String($n)];
}
function getAllValuesToRank(_e, Qt) {
  const Zt = [];
  for (let $n = 0, Sn = Qt.length; $n < Sn; $n++) {
    const kn = Qt[$n], Kn = getAccessorAttributes(kn), er = getItemValues(_e, kn);
    for (let Cr = 0, kr = er.length; Cr < kr; Cr++)
      Zt.push({
        itemValue: er[Cr],
        attributes: Kn
      });
  }
  return Zt;
}
const defaultKeyAttributes = {
  maxRanking: 1 / 0,
  minRanking: -1 / 0
};
function getAccessorAttributes(_e) {
  return typeof _e == "function" ? defaultKeyAttributes : {
    ...defaultKeyAttributes,
    ..._e
  };
}
var propTypes = { exports: {} }, ReactPropTypesSecret$1 = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED", ReactPropTypesSecret_1 = ReactPropTypesSecret$1, ReactPropTypesSecret = ReactPropTypesSecret_1;
function emptyFunction() {
}
function emptyFunctionWithReset() {
}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
var factoryWithThrowingShims = function() {
  function _e($n, Sn, kn, Kn, er, Cr) {
    if (Cr !== ReactPropTypesSecret) {
      var kr = new Error(
        "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
      );
      throw kr.name = "Invariant Violation", kr;
    }
  }
  _e.isRequired = _e;
  function Qt() {
    return _e;
  }
  var Zt = {
    array: _e,
    bigint: _e,
    bool: _e,
    func: _e,
    number: _e,
    object: _e,
    string: _e,
    symbol: _e,
    any: _e,
    arrayOf: Qt,
    element: _e,
    elementType: _e,
    instanceOf: Qt,
    node: _e,
    objectOf: Qt,
    oneOf: Qt,
    oneOfType: Qt,
    shape: Qt,
    exact: Qt,
    checkPropTypes: emptyFunctionWithReset,
    resetWarningCache: emptyFunction
  };
  return Zt.PropTypes = Zt, Zt;
};
propTypes.exports = factoryWithThrowingShims();
var propTypesExports = propTypes.exports;
const _pt = /* @__PURE__ */ getDefaultExportFromCjs$1(propTypesExports);
var defaultAttributes = {
  xmlns: "http://www.w3.org/2000/svg",
  width: 24,
  height: 24,
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  strokeWidth: 2,
  strokeLinecap: "round",
  strokeLinejoin: "round"
}, __defProp$l = Object.defineProperty, __defProps$a = Object.defineProperties, __getOwnPropDescs$a = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$m = Object.getOwnPropertySymbols, __hasOwnProp$m = Object.prototype.hasOwnProperty, __propIsEnum$m = Object.prototype.propertyIsEnumerable, __defNormalProp$l = (_e, Qt, Zt) => Qt in _e ? __defProp$l(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$l = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$m.call(Qt, Zt) && __defNormalProp$l(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$m)
    for (var Zt of __getOwnPropSymbols$m(Qt))
      __propIsEnum$m.call(Qt, Zt) && __defNormalProp$l(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$a = (_e, Qt) => __defProps$a(_e, __getOwnPropDescs$a(Qt)), __objRest$h = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$m.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$m)
    for (var $n of __getOwnPropSymbols$m(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$m.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
}, createReactComponent = (_e, Qt, Zt) => {
  const $n = reactExports.forwardRef(
    (Sn, kn) => {
      var Kn = Sn, { color: er = "currentColor", size: Cr = 24, stroke: kr = 2, children: Yr } = Kn, Ms = __objRest$h(Kn, ["color", "size", "stroke", "children"]);
      return reactExports.createElement(
        "svg",
        __spreadValues$l(__spreadProps$a(__spreadValues$l({
          ref: kn
        }, defaultAttributes), {
          width: Cr,
          height: Cr,
          stroke: er,
          strokeWidth: kr,
          className: `tabler-icon tabler-icon-${_e}`
        }), Ms),
        [...Zt.map(([Ds, Ls]) => reactExports.createElement(Ds, Ls)), ...Yr || []]
      );
    }
  );
  return $n.propTypes = {
    color: _pt.string,
    size: _pt.oneOfType([_pt.string, _pt.number]),
    stroke: _pt.oneOfType([_pt.string, _pt.number])
  }, $n.displayName = `${Qt}`, $n;
}, IconArrowAutofitContent = createReactComponent(
  "arrow-autofit-content",
  "IconArrowAutofitContent",
  [
    ["path", { d: "M6 4l-3 3l3 3", key: "svg-0" }],
    ["path", { d: "M18 4l3 3l-3 3", key: "svg-1" }],
    [
      "path",
      {
        d: "M4 14m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z",
        key: "svg-2"
      }
    ],
    ["path", { d: "M10 7h-7", key: "svg-3" }],
    ["path", { d: "M21 7h-7", key: "svg-4" }]
  ]
), IconArrowsSort = createReactComponent("arrows-sort", "IconArrowsSort", [
  ["path", { d: "M3 9l4 -4l4 4m-4 -4v14", key: "svg-0" }],
  ["path", { d: "M21 15l-4 4l-4 -4m4 4v-14", key: "svg-1" }]
]), IconBaselineDensityLarge = createReactComponent(
  "baseline-density-large",
  "IconBaselineDensityLarge",
  [
    ["path", { d: "M4 4h16", key: "svg-0" }],
    ["path", { d: "M4 20h16", key: "svg-1" }]
  ]
), IconBaselineDensityMedium = createReactComponent(
  "baseline-density-medium",
  "IconBaselineDensityMedium",
  [
    ["path", { d: "M4 20h16", key: "svg-0" }],
    ["path", { d: "M4 12h16", key: "svg-1" }],
    ["path", { d: "M4 4h16", key: "svg-2" }]
  ]
), IconBaselineDensitySmall = createReactComponent(
  "baseline-density-small",
  "IconBaselineDensitySmall",
  [
    ["path", { d: "M4 3h16", key: "svg-0" }],
    ["path", { d: "M4 9h16", key: "svg-1" }],
    ["path", { d: "M4 15h16", key: "svg-2" }],
    ["path", { d: "M4 21h16", key: "svg-3" }]
  ]
), IconBoxMultiple = createReactComponent("box-multiple", "IconBoxMultiple", [
  [
    "path",
    {
      d: "M7 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",
      key: "svg-0"
    }
  ],
  [
    "path",
    {
      d: "M17 17v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h2",
      key: "svg-1"
    }
  ]
]), IconCategoryPlus = createReactComponent("category-plus", "IconCategoryPlus", [
  [
    "path",
    {
      d: "M4 4h6v6h-6zm10 0h6v6h-6zm-10 10h6v6h-6zm10 3h6m-3 -3v6",
      key: "svg-0"
    }
  ]
]), IconCategory = createReactComponent("category", "IconCategory", [
  ["path", { d: "M4 4h6v6h-6z", key: "svg-0" }],
  ["path", { d: "M14 4h6v6h-6z", key: "svg-1" }],
  ["path", { d: "M4 14h6v6h-6z", key: "svg-2" }],
  ["path", { d: "M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0", key: "svg-3" }]
]), IconCheck = createReactComponent("check", "IconCheck", [
  ["path", { d: "M5 12l5 5l10 -10", key: "svg-0" }]
]), IconChevronDown = createReactComponent("chevron-down", "IconChevronDown", [
  ["path", { d: "M6 9l6 6l6 -6", key: "svg-0" }]
]), IconChevronLeftPipe = createReactComponent(
  "chevron-left-pipe",
  "IconChevronLeftPipe",
  [
    ["path", { d: "M7 6v12", key: "svg-0" }],
    ["path", { d: "M18 6l-6 6l6 6", key: "svg-1" }]
  ]
), IconChevronLeft = createReactComponent("chevron-left", "IconChevronLeft", [
  ["path", { d: "M15 6l-6 6l6 6", key: "svg-0" }]
]), IconChevronRightPipe = createReactComponent(
  "chevron-right-pipe",
  "IconChevronRightPipe",
  [
    ["path", { d: "M6 6l6 6l-6 6", key: "svg-0" }],
    ["path", { d: "M17 5v13", key: "svg-1" }]
  ]
), IconChevronRight = createReactComponent("chevron-right", "IconChevronRight", [
  ["path", { d: "M9 6l6 6l-6 6", key: "svg-0" }]
]), IconChevronsDown = createReactComponent("chevrons-down", "IconChevronsDown", [
  ["path", { d: "M7 7l5 5l5 -5", key: "svg-0" }],
  ["path", { d: "M7 13l5 5l5 -5", key: "svg-1" }]
]), IconCircleX = createReactComponent("circle-x", "IconCircleX", [
  ["path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0", key: "svg-0" }],
  ["path", { d: "M10 10l4 4m0 -4l-4 4", key: "svg-1" }]
]), IconClearAll = createReactComponent("clear-all", "IconClearAll", [
  ["path", { d: "M8 6h12", key: "svg-0" }],
  ["path", { d: "M6 12h12", key: "svg-1" }],
  ["path", { d: "M4 18h12", key: "svg-2" }]
]), IconColumnRemove = createReactComponent("column-remove", "IconColumnRemove", [
  [
    "path",
    {
      d: "M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z",
      key: "svg-0"
    }
  ],
  ["path", { d: "M16 10l4 4", key: "svg-1" }],
  ["path", { d: "M16 14l4 -4", key: "svg-2" }]
]), IconColumns = createReactComponent("columns", "IconColumns", [
  ["path", { d: "M4 6l5.5 0", key: "svg-0" }],
  ["path", { d: "M4 10l5.5 0", key: "svg-1" }],
  ["path", { d: "M4 14l5.5 0", key: "svg-2" }],
  ["path", { d: "M4 18l5.5 0", key: "svg-3" }],
  ["path", { d: "M14.5 6l5.5 0", key: "svg-4" }],
  ["path", { d: "M14.5 10l5.5 0", key: "svg-5" }],
  ["path", { d: "M14.5 14l5.5 0", key: "svg-6" }],
  ["path", { d: "M14.5 18l5.5 0", key: "svg-7" }]
]), IconCopy = createReactComponent("copy", "IconCopy", [
  [
    "path",
    {
      d: "M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z",
      key: "svg-0"
    }
  ],
  [
    "path",
    {
      d: "M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2",
      key: "svg-1"
    }
  ]
]), IconDatabase = createReactComponent("database", "IconDatabase", [
  ["path", { d: "M12 6m-8 0a8 3 0 1 0 16 0a8 3 0 1 0 -16 0", key: "svg-0" }],
  ["path", { d: "M4 6v6a8 3 0 0 0 16 0v-6", key: "svg-1" }],
  ["path", { d: "M4 12v6a8 3 0 0 0 16 0v-6", key: "svg-2" }]
]), IconDeviceFloppy = createReactComponent("device-floppy", "IconDeviceFloppy", [
  [
    "path",
    {
      d: "M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2",
      key: "svg-0"
    }
  ],
  ["path", { d: "M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0", key: "svg-1" }],
  ["path", { d: "M14 4l0 4l-6 0l0 -4", key: "svg-2" }]
]), IconDotsVertical = createReactComponent("dots-vertical", "IconDotsVertical", [
  ["path", { d: "M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-0" }],
  ["path", { d: "M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-1" }],
  ["path", { d: "M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-2" }]
]), IconDots = createReactComponent("dots", "IconDots", [
  ["path", { d: "M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-0" }],
  ["path", { d: "M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-1" }],
  ["path", { d: "M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-2" }]
]), IconEdit = createReactComponent("edit", "IconEdit", [
  [
    "path",
    {
      d: "M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",
      key: "svg-0"
    }
  ],
  [
    "path",
    {
      d: "M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z",
      key: "svg-1"
    }
  ],
  ["path", { d: "M16 5l3 3", key: "svg-2" }]
]), IconExternalLink = createReactComponent("external-link", "IconExternalLink", [
  [
    "path",
    {
      d: "M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6",
      key: "svg-0"
    }
  ],
  ["path", { d: "M11 13l9 -9", key: "svg-1" }],
  ["path", { d: "M15 4h5v5", key: "svg-2" }]
]), IconEyeOff = createReactComponent("eye-off", "IconEyeOff", [
  ["path", { d: "M10.585 10.587a2 2 0 0 0 2.829 2.828", key: "svg-0" }],
  [
    "path",
    {
      d: "M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87",
      key: "svg-1"
    }
  ],
  ["path", { d: "M3 3l18 18", key: "svg-2" }]
]), IconFilterCog = createReactComponent("filter-cog", "IconFilterCog", [
  [
    "path",
    {
      d: "M12 20l-3 1v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v1.5",
      key: "svg-0"
    }
  ],
  ["path", { d: "M19.001 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0", key: "svg-1" }],
  ["path", { d: "M19.001 15.5v1.5", key: "svg-2" }],
  ["path", { d: "M19.001 21v1.5", key: "svg-3" }],
  ["path", { d: "M22.032 17.25l-1.299 .75", key: "svg-4" }],
  ["path", { d: "M17.27 20l-1.3 .75", key: "svg-5" }],
  ["path", { d: "M15.97 17.25l1.3 .75", key: "svg-6" }],
  ["path", { d: "M20.733 20l1.3 .75", key: "svg-7" }]
]), IconFilterMinus = createReactComponent("filter-minus", "IconFilterMinus", [
  [
    "path",
    {
      d: "M12 20l-3 1v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v3",
      key: "svg-0"
    }
  ],
  ["path", { d: "M16 19h6", key: "svg-1" }]
]), IconFilterOff = createReactComponent("filter-off", "IconFilterOff", [
  [
    "path",
    {
      d: "M8 4h12v2.172a2 2 0 0 1 -.586 1.414l-3.914 3.914m-.5 3.5v4l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227",
      key: "svg-0"
    }
  ],
  ["path", { d: "M3 3l18 18", key: "svg-1" }]
]), IconFilterPlus = createReactComponent("filter-plus", "IconFilterPlus", [
  [
    "path",
    {
      d: "M12 20l-3 1v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v3",
      key: "svg-0"
    }
  ],
  ["path", { d: "M16 19h6", key: "svg-1" }],
  ["path", { d: "M19 16v6", key: "svg-2" }]
]), IconFilter = createReactComponent("filter", "IconFilter", [
  [
    "path",
    {
      d: "M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z",
      key: "svg-0"
    }
  ]
]), IconGitMerge = createReactComponent("git-merge", "IconGitMerge", [
  ["path", { d: "M7 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0", key: "svg-0" }],
  ["path", { d: "M7 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0", key: "svg-1" }],
  ["path", { d: "M17 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0", key: "svg-2" }],
  ["path", { d: "M7 8l0 8", key: "svg-3" }],
  ["path", { d: "M7 8a4 4 0 0 0 4 4h4", key: "svg-4" }]
]), IconGripHorizontal = createReactComponent("grip-horizontal", "IconGripHorizontal", [
  ["path", { d: "M5 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-0" }],
  ["path", { d: "M5 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-1" }],
  ["path", { d: "M12 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-2" }],
  ["path", { d: "M12 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-3" }],
  ["path", { d: "M19 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-4" }],
  ["path", { d: "M19 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-5" }]
]), IconGripVertical = createReactComponent("grip-vertical", "IconGripVertical", [
  ["path", { d: "M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-0" }],
  ["path", { d: "M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-1" }],
  ["path", { d: "M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-2" }],
  ["path", { d: "M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-3" }],
  ["path", { d: "M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-4" }],
  ["path", { d: "M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", key: "svg-5" }]
]), IconHelp = createReactComponent("help", "IconHelp", [
  ["path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0", key: "svg-0" }],
  ["path", { d: "M12 17l0 .01", key: "svg-1" }],
  [
    "path",
    { d: "M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4", key: "svg-2" }
  ]
]), IconListDetails = createReactComponent("list-details", "IconListDetails", [
  ["path", { d: "M13 5h8", key: "svg-0" }],
  ["path", { d: "M13 9h5", key: "svg-1" }],
  ["path", { d: "M13 15h8", key: "svg-2" }],
  ["path", { d: "M13 19h5", key: "svg-3" }],
  [
    "path",
    {
      d: "M3 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z",
      key: "svg-4"
    }
  ],
  [
    "path",
    {
      d: "M3 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z",
      key: "svg-5"
    }
  ]
]), IconMaximize = createReactComponent("maximize", "IconMaximize", [
  ["path", { d: "M4 8v-2a2 2 0 0 1 2 -2h2", key: "svg-0" }],
  ["path", { d: "M4 16v2a2 2 0 0 0 2 2h2", key: "svg-1" }],
  ["path", { d: "M16 4h2a2 2 0 0 1 2 2v2", key: "svg-2" }],
  ["path", { d: "M16 20h2a2 2 0 0 0 2 -2v-2", key: "svg-3" }]
]), IconMinimize = createReactComponent("minimize", "IconMinimize", [
  ["path", { d: "M15 19v-2a2 2 0 0 1 2 -2h2", key: "svg-0" }],
  ["path", { d: "M15 5v2a2 2 0 0 0 2 2h2", key: "svg-1" }],
  ["path", { d: "M5 15h2a2 2 0 0 1 2 2v2", key: "svg-2" }],
  ["path", { d: "M5 9h2a2 2 0 0 0 2 -2v-2", key: "svg-3" }]
]), IconMinus = createReactComponent("minus", "IconMinus", [
  ["path", { d: "M5 12l14 0", key: "svg-0" }]
]), IconNotes = createReactComponent("notes", "IconNotes", [
  [
    "path",
    {
      d: "M5 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",
      key: "svg-0"
    }
  ],
  ["path", { d: "M9 7l6 0", key: "svg-1" }],
  ["path", { d: "M9 11l6 0", key: "svg-2" }],
  ["path", { d: "M9 15l4 0", key: "svg-3" }]
]), IconPinFilled = createReactComponent("pin-filled", "IconPinFilled", [
  [
    "path",
    {
      d: "M15.113 3.21l.094 .083l5.5 5.5a1 1 0 0 1 -1.175 1.59l-3.172 3.171l-1.424 3.797a1 1 0 0 1 -.158 .277l-.07 .08l-1.5 1.5a1 1 0 0 1 -1.32 .082l-.095 -.083l-2.793 -2.792l-3.793 3.792a1 1 0 0 1 -1.497 -1.32l.083 -.094l3.792 -3.793l-2.792 -2.793a1 1 0 0 1 -.083 -1.32l.083 -.094l1.5 -1.5a1 1 0 0 1 .258 -.187l.098 -.042l3.796 -1.425l3.171 -3.17a1 1 0 0 1 1.497 -1.26z",
      fill: "currentColor",
      key: "svg-0",
      strokeWidth: "0"
    }
  ]
]), IconPinnedOff = createReactComponent("pinned-off", "IconPinnedOff", [
  ["path", { d: "M3 3l18 18", key: "svg-0" }],
  [
    "path",
    {
      d: "M15 4.5l-3.249 3.249m-2.57 1.433l-2.181 .818l-1.5 1.5l7 7l1.5 -1.5l.82 -2.186m1.43 -2.563l3.25 -3.251",
      key: "svg-1"
    }
  ],
  ["path", { d: "M9 15l-4.5 4.5", key: "svg-2" }],
  ["path", { d: "M14.5 4l5.5 5.5", key: "svg-3" }]
]), IconPinned = createReactComponent("pinned", "IconPinned", [
  ["path", { d: "M9 4v6l-2 4v2h10v-2l-2 -4v-6", key: "svg-0" }],
  ["path", { d: "M12 16l0 5", key: "svg-1" }],
  ["path", { d: "M8 4l8 0", key: "svg-2" }]
]), IconPlayerPlayFilled = createReactComponent(
  "player-play-filled",
  "IconPlayerPlayFilled",
  [
    [
      "path",
      {
        d: "M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z",
        fill: "currentColor",
        key: "svg-0",
        strokeWidth: "0"
      }
    ]
  ]
), IconPlus = createReactComponent("plus", "IconPlus", [
  ["path", { d: "M12 5l0 14", key: "svg-0" }],
  ["path", { d: "M5 12l14 0", key: "svg-1" }]
]), IconRowInsertTop = createReactComponent("row-insert-top", "IconRowInsertTop", [
  [
    "path",
    {
      d: "M4 18v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1z",
      key: "svg-0"
    }
  ],
  ["path", { d: "M12 9v-4", key: "svg-1" }],
  ["path", { d: "M10 7l4 0", key: "svg-2" }]
]), IconSearchOff = createReactComponent("search-off", "IconSearchOff", [
  [
    "path",
    {
      d: "M5.039 5.062a7 7 0 0 0 9.91 9.89m1.584 -2.434a7 7 0 0 0 -9.038 -9.057",
      key: "svg-0"
    }
  ],
  ["path", { d: "M3 3l18 18", key: "svg-1" }]
]), IconSearch = createReactComponent("search", "IconSearch", [
  ["path", { d: "M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0", key: "svg-0" }],
  ["path", { d: "M21 21l-6 -6", key: "svg-1" }]
]), IconSortAscending = createReactComponent("sort-ascending", "IconSortAscending", [
  ["path", { d: "M4 6l7 0", key: "svg-0" }],
  ["path", { d: "M4 12l7 0", key: "svg-1" }],
  ["path", { d: "M4 18l9 0", key: "svg-2" }],
  ["path", { d: "M15 9l3 -3l3 3", key: "svg-3" }],
  ["path", { d: "M18 6l0 12", key: "svg-4" }]
]), IconSortDescending = createReactComponent("sort-descending", "IconSortDescending", [
  ["path", { d: "M4 6l9 0", key: "svg-0" }],
  ["path", { d: "M4 12l7 0", key: "svg-1" }],
  ["path", { d: "M4 18l7 0", key: "svg-2" }],
  ["path", { d: "M15 15l3 3l3 -3", key: "svg-3" }],
  ["path", { d: "M18 6l0 12", key: "svg-4" }]
]), IconTrash = createReactComponent("trash", "IconTrash", [
  ["path", { d: "M4 7l16 0", key: "svg-0" }],
  ["path", { d: "M10 11l0 6", key: "svg-1" }],
  ["path", { d: "M14 11l0 6", key: "svg-2" }],
  [
    "path",
    { d: "M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12", key: "svg-3" }
  ],
  ["path", { d: "M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3", key: "svg-4" }]
]), IconX = createReactComponent("x", "IconX", [
  ["path", { d: "M18 6l-12 12", key: "svg-0" }],
  ["path", { d: "M6 6l12 12", key: "svg-1" }]
]);
/**
 * react-virtual
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
function _extends$5() {
  return _extends$5 = Object.assign ? Object.assign.bind() : function(_e) {
    for (var Qt = 1; Qt < arguments.length; Qt++) {
      var Zt = arguments[Qt];
      for (var $n in Zt)
        Object.prototype.hasOwnProperty.call(Zt, $n) && (_e[$n] = Zt[$n]);
    }
    return _e;
  }, _extends$5.apply(this, arguments);
}
/**
 * virtual-core
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
function _extends$4() {
  return _extends$4 = Object.assign ? Object.assign.bind() : function(_e) {
    for (var Qt = 1; Qt < arguments.length; Qt++) {
      var Zt = arguments[Qt];
      for (var $n in Zt)
        Object.prototype.hasOwnProperty.call(Zt, $n) && (_e[$n] = Zt[$n]);
    }
    return _e;
  }, _extends$4.apply(this, arguments);
}
/**
 * virtual-core
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
function memo(_e, Qt, Zt) {
  var $n, Sn = ($n = Zt.initialDeps) != null ? $n : [], kn;
  return function() {
    var Kn;
    Zt.key && Zt.debug != null && Zt.debug() && (Kn = Date.now());
    var er = _e(), Cr = er.length !== Sn.length || er.some(function(js, zs) {
      return Sn[zs] !== js;
    });
    if (!Cr)
      return kn;
    Sn = er;
    var kr;
    if (Zt.key && Zt.debug != null && Zt.debug() && (kr = Date.now()), kn = Qt.apply(void 0, er), Zt.key && Zt.debug != null && Zt.debug()) {
      var Yr = Math.round((Date.now() - Kn) * 100) / 100, Ms = Math.round((Date.now() - kr) * 100) / 100, Ds = Ms / 16, Ls = function(zs, Fs) {
        for (zs = String(zs); zs.length < Fs; )
          zs = " " + zs;
        return zs;
      };
      console.info("%c⏱ " + Ls(Ms, 5) + " /" + Ls(Yr, 5) + " ms", `
            font-size: .6rem;
            font-weight: bold;
            color: hsl(` + Math.max(0, Math.min(120 - 120 * Ds, 120)) + "deg 100% 31%);", Zt == null ? void 0 : Zt.key);
    }
    return Zt == null || Zt.onChange == null || Zt.onChange(kn), kn;
  };
}
function notUndefined(_e, Qt) {
  if (_e === void 0)
    throw new Error("Unexpected undefined" + (Qt ? ": " + Qt : ""));
  return _e;
}
var approxEqual = function _e(Qt, Zt) {
  return Math.abs(Qt - Zt) < 1;
};
/**
 * virtual-core
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
var defaultKeyExtractor = function _e(Qt) {
  return Qt;
}, defaultRangeExtractor = function _e(Qt) {
  for (var Zt = Math.max(Qt.startIndex - Qt.overscan, 0), $n = Math.min(Qt.endIndex + Qt.overscan, Qt.count - 1), Sn = [], kn = Zt; kn <= $n; kn++)
    Sn.push(kn);
  return Sn;
}, observeElementRect = function _e(Qt, Zt) {
  var $n = Qt.scrollElement;
  if ($n) {
    var Sn = function(er) {
      var Cr = er.width, kr = er.height;
      Zt({
        width: Math.round(Cr),
        height: Math.round(kr)
      });
    };
    Sn($n.getBoundingClientRect());
    var kn = new ResizeObserver(function(Kn) {
      var er = Kn[0];
      if (er != null && er.borderBoxSize) {
        var Cr = er.borderBoxSize[0];
        if (Cr) {
          Sn({
            width: Cr.inlineSize,
            height: Cr.blockSize
          });
          return;
        }
      }
      Sn($n.getBoundingClientRect());
    });
    return kn.observe($n, {
      box: "border-box"
    }), function() {
      kn.unobserve($n);
    };
  }
}, observeElementOffset = function _e(Qt, Zt) {
  var $n = Qt.scrollElement;
  if ($n) {
    var Sn = function() {
      Zt($n[Qt.options.horizontal ? "scrollLeft" : "scrollTop"]);
    };
    return Sn(), $n.addEventListener("scroll", Sn, {
      passive: !0
    }), function() {
      $n.removeEventListener("scroll", Sn);
    };
  }
}, measureElement = function _e(Qt, Zt, $n) {
  if (Zt != null && Zt.borderBoxSize) {
    var Sn = Zt.borderBoxSize[0];
    if (Sn) {
      var kn = Math.round(Sn[$n.options.horizontal ? "inlineSize" : "blockSize"]);
      return kn;
    }
  }
  return Math.round(Qt.getBoundingClientRect()[$n.options.horizontal ? "width" : "height"]);
}, elementScroll = function _e(Qt, Zt, $n) {
  var Sn, kn, Kn = Zt.adjustments, er = Kn === void 0 ? 0 : Kn, Cr = Zt.behavior, kr = Qt + er;
  (Sn = $n.scrollElement) == null || Sn.scrollTo == null || Sn.scrollTo((kn = {}, kn[$n.options.horizontal ? "left" : "top"] = kr, kn.behavior = Cr, kn));
}, Virtualizer = function _e(Qt) {
  var Zt = this;
  this.unsubs = [], this.scrollElement = null, this.isScrolling = !1, this.isScrollingTimeoutId = null, this.scrollToIndexTimeoutId = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.scrollDirection = null, this.scrollAdjustments = 0, this.measureElementCache = /* @__PURE__ */ new Map(), this.observer = function() {
    var $n = null, Sn = function() {
      return $n || (typeof ResizeObserver < "u" ? $n = new ResizeObserver(function(Kn) {
        Kn.forEach(function(er) {
          Zt._measureElement(er.target, er);
        });
      }) : null);
    };
    return {
      disconnect: function() {
        var Kn;
        return (Kn = Sn()) == null ? void 0 : Kn.disconnect();
      },
      observe: function(Kn) {
        var er;
        return (er = Sn()) == null ? void 0 : er.observe(Kn, {
          box: "border-box"
        });
      },
      unobserve: function(Kn) {
        var er;
        return (er = Sn()) == null ? void 0 : er.unobserve(Kn);
      }
    };
  }(), this.range = {
    startIndex: 0,
    endIndex: 0
  }, this.setOptions = function($n) {
    Object.entries($n).forEach(function(Sn) {
      var kn = Sn[0], Kn = Sn[1];
      typeof Kn > "u" && delete $n[kn];
    }), Zt.options = _extends$4({
      debug: !1,
      initialOffset: 0,
      overscan: 1,
      paddingStart: 0,
      paddingEnd: 0,
      scrollPaddingStart: 0,
      scrollPaddingEnd: 0,
      horizontal: !1,
      getItemKey: defaultKeyExtractor,
      rangeExtractor: defaultRangeExtractor,
      onChange: function() {
      },
      measureElement,
      initialRect: {
        width: 0,
        height: 0
      },
      scrollMargin: 0,
      scrollingDelay: 150,
      indexAttribute: "data-index",
      initialMeasurementsCache: [],
      lanes: 1
    }, $n);
  }, this.notify = function() {
    Zt.options.onChange == null || Zt.options.onChange(Zt);
  }, this.cleanup = function() {
    Zt.unsubs.filter(Boolean).forEach(function($n) {
      return $n();
    }), Zt.unsubs = [], Zt.scrollElement = null;
  }, this._didMount = function() {
    return Zt.measureElementCache.forEach(Zt.observer.observe), function() {
      Zt.observer.disconnect(), Zt.cleanup();
    };
  }, this._willUpdate = function() {
    var $n = Zt.options.getScrollElement();
    Zt.scrollElement !== $n && (Zt.cleanup(), Zt.scrollElement = $n, Zt._scrollToOffset(Zt.scrollOffset, {
      adjustments: void 0,
      behavior: void 0
    }), Zt.unsubs.push(Zt.options.observeElementRect(Zt, function(Sn) {
      var kn = Zt.scrollRect;
      Zt.scrollRect = Sn, (Zt.options.horizontal ? Sn.width !== kn.width : Sn.height !== kn.height) && Zt.maybeNotify();
    })), Zt.unsubs.push(Zt.options.observeElementOffset(Zt, function(Sn) {
      Zt.scrollAdjustments = 0, Zt.scrollOffset !== Sn && (Zt.isScrollingTimeoutId !== null && (clearTimeout(Zt.isScrollingTimeoutId), Zt.isScrollingTimeoutId = null), Zt.isScrolling = !0, Zt.scrollDirection = Zt.scrollOffset < Sn ? "forward" : "backward", Zt.scrollOffset = Sn, Zt.maybeNotify(), Zt.isScrollingTimeoutId = setTimeout(function() {
        Zt.isScrollingTimeoutId = null, Zt.isScrolling = !1, Zt.scrollDirection = null, Zt.maybeNotify();
      }, Zt.options.scrollingDelay));
    })));
  }, this.getSize = function() {
    return Zt.scrollRect[Zt.options.horizontal ? "width" : "height"];
  }, this.memoOptions = memo(function() {
    return [Zt.options.count, Zt.options.paddingStart, Zt.options.scrollMargin, Zt.options.getItemKey];
  }, function($n, Sn, kn, Kn) {
    return Zt.pendingMeasuredCacheIndexes = [], {
      count: $n,
      paddingStart: Sn,
      scrollMargin: kn,
      getItemKey: Kn
    };
  }, {
    key: !1
  }), this.getFurthestMeasurement = function($n, Sn) {
    for (var kn = /* @__PURE__ */ new Map(), Kn = /* @__PURE__ */ new Map(), er = Sn - 1; er >= 0; er--) {
      var Cr = $n[er];
      if (!kn.has(Cr.lane)) {
        var kr = Kn.get(Cr.lane);
        if (kr == null || Cr.end > kr.end ? Kn.set(Cr.lane, Cr) : Cr.end < kr.end && kn.set(Cr.lane, !0), kn.size === Zt.options.lanes)
          break;
      }
    }
    return Kn.size === Zt.options.lanes ? Array.from(Kn.values()).sort(function(Yr, Ms) {
      return Yr.end - Ms.end;
    })[0] : void 0;
  }, this.getMeasurements = memo(function() {
    return [Zt.memoOptions(), Zt.itemSizeCache];
  }, function($n, Sn) {
    var kn = $n.count, Kn = $n.paddingStart, er = $n.scrollMargin, Cr = $n.getItemKey, kr = Zt.pendingMeasuredCacheIndexes.length > 0 ? Math.min.apply(Math, Zt.pendingMeasuredCacheIndexes) : 0;
    Zt.pendingMeasuredCacheIndexes = [];
    for (var Yr = Zt.measurementsCache.slice(0, kr), Ms = kr; Ms < kn; Ms++) {
      var Ds = Cr(Ms), Ls = Zt.options.lanes === 1 ? Yr[Ms - 1] : Zt.getFurthestMeasurement(Yr, Ms), js = Ls ? Ls.end : Kn + er, zs = Sn.get(Ds), Fs = typeof zs == "number" ? zs : Zt.options.estimateSize(Ms), Bs = js + Fs, Hs = Ls ? Ls.lane : Ms % Zt.options.lanes;
      Yr[Ms] = {
        index: Ms,
        start: js,
        size: Fs,
        end: Bs,
        key: Ds,
        lane: Hs
      };
    }
    return Zt.measurementsCache = Yr, Yr;
  }, {
    key: !1,
    debug: function() {
      return Zt.options.debug;
    }
  }), this.calculateRange = memo(function() {
    return [Zt.getMeasurements(), Zt.getSize(), Zt.scrollOffset];
  }, function($n, Sn, kn) {
    return Zt.range = calculateRange({
      measurements: $n,
      outerSize: Sn,
      scrollOffset: kn
    });
  }, {
    key: !1,
    debug: function() {
      return Zt.options.debug;
    }
  }), this.maybeNotify = memo(function() {
    var $n = Zt.calculateRange();
    return [$n.startIndex, $n.endIndex, Zt.isScrolling];
  }, function() {
    Zt.notify();
  }, {
    key: !1,
    debug: function() {
      return Zt.options.debug;
    },
    initialDeps: [this.range.startIndex, this.range.endIndex, this.isScrolling]
  }), this.getIndexes = memo(function() {
    return [Zt.options.rangeExtractor, Zt.calculateRange(), Zt.options.overscan, Zt.options.count, Zt.getSize()];
  }, function($n, Sn, kn, Kn, er) {
    return er === 0 ? [] : $n(_extends$4({}, Sn, {
      overscan: kn,
      count: Kn
    }));
  }, {
    key: !1,
    debug: function() {
      return Zt.options.debug;
    }
  }), this.indexFromElement = function($n) {
    var Sn = Zt.options.indexAttribute, kn = $n.getAttribute(Sn);
    return kn ? parseInt(kn, 10) : (console.warn("Missing attribute name '" + Sn + "={index}' on measured element."), -1);
  }, this._measureElement = function($n, Sn) {
    var kn = Zt.measurementsCache[Zt.indexFromElement($n)];
    if (!kn || !$n.isConnected) {
      Zt.measureElementCache.forEach(function(Cr, kr) {
        Cr === $n && (Zt.observer.unobserve($n), Zt.measureElementCache.delete(kr));
      });
      return;
    }
    var Kn = Zt.measureElementCache.get(kn.key);
    Kn !== $n && (Kn && Zt.observer.unobserve(Kn), Zt.observer.observe($n), Zt.measureElementCache.set(kn.key, $n));
    var er = Zt.options.measureElement($n, Sn, Zt);
    Zt.resizeItem(kn, er);
  }, this.resizeItem = function($n, Sn) {
    var kn, Kn = (kn = Zt.itemSizeCache.get($n.key)) != null ? kn : $n.size, er = Sn - Kn;
    er !== 0 && ($n.start < Zt.scrollOffset && Zt._scrollToOffset(Zt.scrollOffset, {
      adjustments: Zt.scrollAdjustments += er,
      behavior: void 0
    }), Zt.pendingMeasuredCacheIndexes.push($n.index), Zt.itemSizeCache = new Map(Zt.itemSizeCache.set($n.key, Sn)), Zt.notify());
  }, this.measureElement = function($n) {
    $n && Zt._measureElement($n, void 0);
  }, this.getVirtualItems = memo(function() {
    return [Zt.getIndexes(), Zt.getMeasurements()];
  }, function($n, Sn) {
    for (var kn = [], Kn = 0, er = $n.length; Kn < er; Kn++) {
      var Cr = $n[Kn], kr = Sn[Cr];
      kn.push(kr);
    }
    return kn;
  }, {
    key: !1,
    debug: function() {
      return Zt.options.debug;
    }
  }), this.getVirtualItemForOffset = function($n) {
    var Sn = Zt.getMeasurements();
    return notUndefined(Sn[findNearestBinarySearch(0, Sn.length - 1, function(kn) {
      return notUndefined(Sn[kn]).start;
    }, $n)]);
  }, this.getOffsetForAlignment = function($n, Sn) {
    var kn = Zt.getSize();
    Sn === "auto" && ($n <= Zt.scrollOffset ? Sn = "start" : $n >= Zt.scrollOffset + kn ? Sn = "end" : Sn = "start"), Sn === "start" ? $n = $n : Sn === "end" ? $n = $n - kn : Sn === "center" && ($n = $n - kn / 2);
    var Kn = Zt.options.horizontal ? "scrollWidth" : "scrollHeight", er = Zt.scrollElement ? "document" in Zt.scrollElement ? Zt.scrollElement.document.documentElement[Kn] : Zt.scrollElement[Kn] : 0, Cr = er - Zt.getSize();
    return Math.max(Math.min(Cr, $n), 0);
  }, this.getOffsetForIndex = function($n, Sn) {
    Sn === void 0 && (Sn = "auto"), $n = Math.max(0, Math.min($n, Zt.options.count - 1));
    var kn = notUndefined(Zt.getMeasurements()[$n]);
    if (Sn === "auto")
      if (kn.end >= Zt.scrollOffset + Zt.getSize() - Zt.options.scrollPaddingEnd)
        Sn = "end";
      else if (kn.start <= Zt.scrollOffset + Zt.options.scrollPaddingStart)
        Sn = "start";
      else
        return [Zt.scrollOffset, Sn];
    var Kn = Sn === "end" ? kn.end + Zt.options.scrollPaddingEnd : kn.start - Zt.options.scrollPaddingStart;
    return [Zt.getOffsetForAlignment(Kn, Sn), Sn];
  }, this.isDynamicMode = function() {
    return Zt.measureElementCache.size > 0;
  }, this.cancelScrollToIndex = function() {
    Zt.scrollToIndexTimeoutId !== null && (clearTimeout(Zt.scrollToIndexTimeoutId), Zt.scrollToIndexTimeoutId = null);
  }, this.scrollToOffset = function($n, Sn) {
    var kn = Sn === void 0 ? {} : Sn, Kn = kn.align, er = Kn === void 0 ? "start" : Kn, Cr = kn.behavior;
    Zt.cancelScrollToIndex(), Cr === "smooth" && Zt.isDynamicMode() && console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."), Zt._scrollToOffset(Zt.getOffsetForAlignment($n, er), {
      adjustments: void 0,
      behavior: Cr
    });
  }, this.scrollToIndex = function($n, Sn) {
    var kn = Sn === void 0 ? {} : Sn, Kn = kn.align, er = Kn === void 0 ? "auto" : Kn, Cr = kn.behavior;
    $n = Math.max(0, Math.min($n, Zt.options.count - 1)), Zt.cancelScrollToIndex(), Cr === "smooth" && Zt.isDynamicMode() && console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");
    var kr = Zt.getOffsetForIndex($n, er), Yr = kr[0], Ms = kr[1];
    Zt._scrollToOffset(Yr, {
      adjustments: void 0,
      behavior: Cr
    }), Cr !== "smooth" && Zt.isDynamicMode() && (Zt.scrollToIndexTimeoutId = setTimeout(function() {
      Zt.scrollToIndexTimeoutId = null;
      var Ds = Zt.measureElementCache.has(Zt.options.getItemKey($n));
      if (Ds) {
        var Ls = Zt.getOffsetForIndex($n, Ms), js = Ls[0];
        approxEqual(js, Zt.scrollOffset) || Zt.scrollToIndex($n, {
          align: Ms,
          behavior: Cr
        });
      } else
        Zt.scrollToIndex($n, {
          align: Ms,
          behavior: Cr
        });
    }));
  }, this.scrollBy = function($n, Sn) {
    var kn = Sn === void 0 ? {} : Sn, Kn = kn.behavior;
    Zt.cancelScrollToIndex(), Kn === "smooth" && Zt.isDynamicMode() && console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."), Zt._scrollToOffset(Zt.scrollOffset + $n, {
      adjustments: void 0,
      behavior: Kn
    });
  }, this.getTotalSize = function() {
    var $n;
    return ((($n = Zt.getMeasurements()[Zt.options.count - 1]) == null ? void 0 : $n.end) || Zt.options.paddingStart) - Zt.options.scrollMargin + Zt.options.paddingEnd;
  }, this._scrollToOffset = function($n, Sn) {
    var kn = Sn.adjustments, Kn = Sn.behavior;
    Zt.options.scrollToFn($n, {
      behavior: Kn,
      adjustments: kn
    }, Zt);
  }, this.measure = function() {
    Zt.itemSizeCache = /* @__PURE__ */ new Map(), Zt.notify();
  }, this.setOptions(Qt), this.scrollRect = this.options.initialRect, this.scrollOffset = this.options.initialOffset, this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach(function($n) {
    Zt.itemSizeCache.set($n.key, $n.size);
  }), this.maybeNotify();
}, findNearestBinarySearch = function _e(Qt, Zt, $n, Sn) {
  for (; Qt <= Zt; ) {
    var kn = (Qt + Zt) / 2 | 0, Kn = $n(kn);
    if (Kn < Sn)
      Qt = kn + 1;
    else if (Kn > Sn)
      Zt = kn - 1;
    else
      return kn;
  }
  return Qt > 0 ? Qt - 1 : 0;
};
function calculateRange(_e) {
  for (var Qt = _e.measurements, Zt = _e.outerSize, $n = _e.scrollOffset, Sn = Qt.length - 1, kn = function(kr) {
    return Qt[kr].start;
  }, Kn = findNearestBinarySearch(0, Sn, kn, $n), er = Kn; er < Sn && Qt[er].end < $n + Zt; )
    er++;
  return {
    startIndex: Kn,
    endIndex: er
  };
}
/**
 * react-virtual
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
var useIsomorphicLayoutEffect$3 = typeof document < "u" ? reactExports.useLayoutEffect : reactExports.useEffect;
function useVirtualizerBase(_e) {
  var Qt = reactExports.useReducer(function() {
    return {};
  }, {})[1], Zt = _extends$5({}, _e, {
    onChange: function(Kn) {
      Qt(), _e.onChange == null || _e.onChange(Kn);
    }
  }), $n = reactExports.useState(function() {
    return new Virtualizer(Zt);
  }), Sn = $n[0];
  return Sn.setOptions(Zt), reactExports.useEffect(function() {
    return Sn._didMount();
  }, []), useIsomorphicLayoutEffect$3(function() {
    return Sn._willUpdate();
  }), Sn;
}
function useVirtualizer(_e) {
  return useVirtualizerBase(_extends$5({
    observeElementRect,
    observeElementOffset,
    scrollToFn: elementScroll
  }, _e));
}
var __defProp$k = Object.defineProperty, __defProps$9 = Object.defineProperties, __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$l = Object.getOwnPropertySymbols, __hasOwnProp$l = Object.prototype.hasOwnProperty, __propIsEnum$l = Object.prototype.propertyIsEnumerable, __defNormalProp$k = (_e, Qt, Zt) => Qt in _e ? __defProp$k(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$k = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$l.call(Qt, Zt) && __defNormalProp$k(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$l)
    for (var Zt of __getOwnPropSymbols$l(Qt))
      __propIsEnum$l.call(Qt, Zt) && __defNormalProp$k(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$9 = (_e, Qt) => __defProps$9(_e, __getOwnPropDescs$9(Qt)), __objRest$g = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$l.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$l)
    for (var $n of __getOwnPropSymbols$l(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$l.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function Chevron(_e) {
  var Qt = _e, { direction: Zt, style: $n } = Qt, Sn = __objRest$g(Qt, ["direction", "style"]);
  const kn = useMantineTheme();
  return /* @__PURE__ */ React.createElement(ChevronIcon$1, __spreadProps$9(__spreadValues$k({}, Sn), {
    style: __spreadProps$9(__spreadValues$k({}, $n), {
      transform: Zt === "next" && kn.dir === "ltr" || Zt === "previous" && kn.dir === "rtl" ? "rotate(270deg)" : "rotate(90deg)"
    })
  }));
}
Chevron.displayName = "@mantine/dates/Chevron";
var __defProp$j = Object.defineProperty, __defProps$8 = Object.defineProperties, __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$k = Object.getOwnPropertySymbols, __hasOwnProp$k = Object.prototype.hasOwnProperty, __propIsEnum$k = Object.prototype.propertyIsEnumerable, __defNormalProp$j = (_e, Qt, Zt) => Qt in _e ? __defProp$j(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$j = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$k.call(Qt, Zt) && __defNormalProp$j(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$k)
    for (var Zt of __getOwnPropSymbols$k(Qt))
      __propIsEnum$k.call(Qt, Zt) && __defNormalProp$j(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$8 = (_e, Qt) => __defProps$8(_e, __getOwnPropDescs$8(Qt));
const sizes$1 = {
  xs: rem$1(30),
  sm: rem$1(36),
  md: rem$1(42),
  lg: rem$1(48),
  xl: rem$1(54)
};
var useStyles$u = createStyles((_e, { radius: Qt, isStatic: Zt }, { size: $n }) => {
  const Sn = _e.fn.variant({ variant: "filled" }), kn = _e.fn.variant({ variant: "light" });
  return {
    day: __spreadProps$8(__spreadValues$j({
      width: getSize$1({ size: $n, sizes: sizes$1 }),
      height: getSize$1({ size: $n, sizes: sizes$1 }),
      fontSize: getSize$1({ size: $n, sizes: _e.fontSizes }),
      display: "inline-flex",
      justifyContent: "center",
      alignItems: "center",
      userSelect: Zt ? void 0 : "none",
      cursor: Zt ? "default" : "pointer",
      borderRadius: _e.fn.radius(Qt)
    }, Zt ? null : _e.fn.hover({
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[0]
    })), {
      "&:active": Zt ? void 0 : _e.activeStyles,
      "&[data-disabled]": __spreadProps$8(__spreadValues$j({
        color: _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[4],
        cursor: "not-allowed"
      }, _e.fn.hover({ backgroundColor: "transparent" })), {
        "&:active": {
          transform: "none"
        }
      }),
      "&[data-weekend]": {
        color: _e.colors.red[_e.fn.primaryShade()]
      },
      "&[data-outside]": {
        color: _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[4]
      },
      "&[data-in-range]": __spreadValues$j({
        backgroundColor: kn.background,
        borderRadius: 0
      }, Zt ? null : _e.fn.hover({ backgroundColor: kn.hover })),
      "&[data-first-in-range]": {
        borderTopLeftRadius: _e.radius.sm,
        borderBottomLeftRadius: _e.radius.sm
      },
      "&[data-last-in-range]": {
        borderTopRightRadius: _e.radius.sm,
        borderBottomRightRadius: _e.radius.sm
      },
      "&[data-selected]": __spreadValues$j({
        color: Sn.color,
        backgroundColor: Sn.background
      }, Zt ? null : _e.fn.hover({ backgroundColor: Sn.hover })),
      "&[data-hidden]": {
        display: "none"
      }
    })
  };
});
const useStyles$v = useStyles$u;
var __defProp$i = Object.defineProperty, __defProps$7 = Object.defineProperties, __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$j = Object.getOwnPropertySymbols, __hasOwnProp$j = Object.prototype.hasOwnProperty, __propIsEnum$j = Object.prototype.propertyIsEnumerable, __defNormalProp$i = (_e, Qt, Zt) => Qt in _e ? __defProp$i(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$i = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$j.call(Qt, Zt) && __defNormalProp$i(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$j)
    for (var Zt of __getOwnPropSymbols$j(Qt))
      __propIsEnum$j.call(Qt, Zt) && __defNormalProp$i(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$7 = (_e, Qt) => __defProps$7(_e, __getOwnPropDescs$7(Qt)), useStyles$s = createStyles((_e, Qt, { size: Zt }) => {
  const $n = getSize$1({ size: Zt, sizes: sizes$1 });
  return {
    calendarHeaderControlIcon: {},
    calendarHeader: {
      display: "flex",
      maxWidth: `calc(${$n} * 7 + ${rem$1(7)})`
    },
    calendarHeaderControl: __spreadProps$7(__spreadValues$i({
      width: $n,
      height: $n,
      borderRadius: _e.fn.radius(),
      display: "flex",
      justifyContent: "center",
      alignItems: "center",
      userSelect: "none"
    }, _e.fn.hover({
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[0]
    })), {
      "&:active": _e.activeStyles,
      "&[data-disabled]": __spreadProps$7(__spreadValues$i({
        opacity: 0.2,
        cursor: "not-allowed"
      }, _e.fn.hover({ backgroundColor: "transparent" })), {
        "&:active": {
          transform: "none"
        }
      })
    }),
    calendarHeaderLevel: __spreadProps$7(__spreadValues$i({
      height: $n,
      borderRadius: _e.fn.radius(),
      display: "flex",
      justifyContent: "center",
      alignItems: "center",
      userSelect: "none",
      flex: 1,
      fontSize: getSize$1({ size: Zt, sizes: _e.fontSizes }),
      fontWeight: 500,
      textTransform: "capitalize"
    }, _e.fn.hover({
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[0]
    })), {
      "&:active": _e.activeStyles,
      "&[data-static]": __spreadProps$7(__spreadValues$i({
        cursor: "default",
        userSelect: "unset"
      }, _e.fn.hover({ backgroundColor: "transparent" })), {
        "&:active": {
          transform: "none"
        }
      })
    })
  };
});
const useStyles$t = useStyles$s;
var __defProp$h = Object.defineProperty, __getOwnPropSymbols$i = Object.getOwnPropertySymbols, __hasOwnProp$i = Object.prototype.hasOwnProperty, __propIsEnum$i = Object.prototype.propertyIsEnumerable, __defNormalProp$h = (_e, Qt, Zt) => Qt in _e ? __defProp$h(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$h = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$i.call(Qt, Zt) && __defNormalProp$h(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$i)
    for (var Zt of __getOwnPropSymbols$i(Qt))
      __propIsEnum$i.call(Qt, Zt) && __defNormalProp$h(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$f = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$i.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$i)
    for (var $n of __getOwnPropSymbols$i(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$i.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$f = {
  nextDisabled: !1,
  previousDisabled: !1,
  hasNextLevel: !0,
  withNext: !0,
  withPrevious: !0,
  size: "sm"
}, CalendarHeader = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("CalendarHeader", defaultProps$f, _e), {
    className: $n,
    nextIcon: Sn,
    previousIcon: kn,
    nextLabel: Kn,
    previousLabel: er,
    onNext: Cr,
    onPrevious: kr,
    onLevelClick: Yr,
    label: Ms,
    classNames: Ds,
    styles: Ls,
    unstyled: js,
    nextDisabled: zs,
    previousDisabled: Fs,
    hasNextLevel: Bs,
    levelControlAriaLabel: Hs,
    withNext: Ws,
    withPrevious: Ys,
    __staticSelector: El,
    __preventFocus: Mu,
    __stopPropagation: Pl,
    size: Iu,
    variant: Tu
  } = Zt, Au = __objRest$f(Zt, [
    "className",
    "nextIcon",
    "previousIcon",
    "nextLabel",
    "previousLabel",
    "onNext",
    "onPrevious",
    "onLevelClick",
    "label",
    "classNames",
    "styles",
    "unstyled",
    "nextDisabled",
    "previousDisabled",
    "hasNextLevel",
    "levelControlAriaLabel",
    "withNext",
    "withPrevious",
    "__staticSelector",
    "__preventFocus",
    "__stopPropagation",
    "size",
    "variant"
  ]), { classes: Nu, cx: gm } = useStyles$t(null, {
    name: ["CalendarHeader", El],
    classNames: Ds,
    styles: Ls,
    unstyled: js,
    size: Iu,
    variant: Tu
  }), pm = Mu ? (zu) => zu.preventDefault() : void 0;
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$h({
    className: gm(Nu.calendarHeader, $n),
    ref: Qt
  }, Au), Ys && /* @__PURE__ */ React.createElement(UnstyledButton, {
    className: Nu.calendarHeaderControl,
    "data-previous": !0,
    "aria-label": er,
    onClick: kr,
    unstyled: js,
    onMouseDown: pm,
    disabled: Fs,
    "data-disabled": Fs || void 0,
    tabIndex: Mu ? -1 : 0,
    "data-mantine-stop-propagation": Pl || void 0
  }, kn || /* @__PURE__ */ React.createElement(Chevron, {
    className: Nu.calendarHeaderControlIcon,
    direction: "previous",
    "data-previous": !0
  })), /* @__PURE__ */ React.createElement(UnstyledButton, {
    component: Bs ? "button" : "div",
    className: Nu.calendarHeaderLevel,
    onClick: Bs ? Yr : void 0,
    unstyled: js,
    onMouseDown: Bs ? pm : void 0,
    disabled: !Bs,
    "data-static": !Bs || void 0,
    "aria-label": Hs,
    tabIndex: Mu || !Bs ? -1 : 0,
    "data-mantine-stop-propagation": Pl || void 0
  }, Ms), Ws && /* @__PURE__ */ React.createElement(UnstyledButton, {
    className: Nu.calendarHeaderControl,
    "data-next": !0,
    "aria-label": Kn,
    onClick: Cr,
    unstyled: js,
    onMouseDown: pm,
    disabled: zs,
    "data-disabled": zs || void 0,
    tabIndex: Mu ? -1 : 0,
    "data-mantine-stop-propagation": Pl || void 0
  }, Sn || /* @__PURE__ */ React.createElement(Chevron, {
    className: Nu.calendarHeaderControlIcon,
    direction: "next",
    "data-next": !0
  })));
});
CalendarHeader.displayName = "@mantine/dates/CalendarHeader";
var dayjs_min = { exports: {} };
(function(_e, Qt) {
  (function(Zt, $n) {
    _e.exports = $n();
  })(commonjsGlobal, function() {
    var Zt = 1e3, $n = 6e4, Sn = 36e5, kn = "millisecond", Kn = "second", er = "minute", Cr = "hour", kr = "day", Yr = "week", Ms = "month", Ds = "quarter", Ls = "year", js = "date", zs = "Invalid Date", Fs = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, Bs = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, Hs = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(zu) {
      var Yu = ["th", "st", "nd", "rd"], sm = zu % 100;
      return "[" + zu + (Yu[(sm - 20) % 10] || Yu[sm] || Yu[0]) + "]";
    } }, Ws = function(zu, Yu, sm) {
      var mm = String(zu);
      return !mm || mm.length >= Yu ? zu : "" + Array(Yu + 1 - mm.length).join(sm) + zu;
    }, Ys = { s: Ws, z: function(zu) {
      var Yu = -zu.utcOffset(), sm = Math.abs(Yu), mm = Math.floor(sm / 60), hm = sm % 60;
      return (Yu <= 0 ? "+" : "-") + Ws(mm, 2, "0") + ":" + Ws(hm, 2, "0");
    }, m: function zu(Yu, sm) {
      if (Yu.date() < sm.date())
        return -zu(sm, Yu);
      var mm = 12 * (sm.year() - Yu.year()) + (sm.month() - Yu.month()), hm = Yu.clone().add(mm, Ms), ym = sm - hm < 0, _m = Yu.clone().add(mm + (ym ? -1 : 1), Ms);
      return +(-(mm + (sm - hm) / (ym ? hm - _m : _m - hm)) || 0);
    }, a: function(zu) {
      return zu < 0 ? Math.ceil(zu) || 0 : Math.floor(zu);
    }, p: function(zu) {
      return { M: Ms, y: Ls, w: Yr, d: kr, D: js, h: Cr, m: er, s: Kn, ms: kn, Q: Ds }[zu] || String(zu || "").toLowerCase().replace(/s$/, "");
    }, u: function(zu) {
      return zu === void 0;
    } }, El = "en", Mu = {};
    Mu[El] = Hs;
    var Pl = "$isDayjsObject", Iu = function(zu) {
      return zu instanceof gm || !(!zu || !zu[Pl]);
    }, Tu = function zu(Yu, sm, mm) {
      var hm;
      if (!Yu)
        return El;
      if (typeof Yu == "string") {
        var ym = Yu.toLowerCase();
        Mu[ym] && (hm = ym), sm && (Mu[ym] = sm, hm = ym);
        var _m = Yu.split("-");
        if (!hm && _m.length > 1)
          return zu(_m[0]);
      } else {
        var Sm = Yu.name;
        Mu[Sm] = Yu, hm = Sm;
      }
      return !mm && hm && (El = hm), hm || !mm && El;
    }, Au = function(zu, Yu) {
      if (Iu(zu))
        return zu.clone();
      var sm = typeof Yu == "object" ? Yu : {};
      return sm.date = zu, sm.args = arguments, new gm(sm);
    }, Nu = Ys;
    Nu.l = Tu, Nu.i = Iu, Nu.w = function(zu, Yu) {
      return Au(zu, { locale: Yu.$L, utc: Yu.$u, x: Yu.$x, $offset: Yu.$offset });
    };
    var gm = function() {
      function zu(sm) {
        this.$L = Tu(sm.locale, null, !0), this.parse(sm), this.$x = this.$x || sm.x || {}, this[Pl] = !0;
      }
      var Yu = zu.prototype;
      return Yu.parse = function(sm) {
        this.$d = function(mm) {
          var hm = mm.date, ym = mm.utc;
          if (hm === null)
            return /* @__PURE__ */ new Date(NaN);
          if (Nu.u(hm))
            return /* @__PURE__ */ new Date();
          if (hm instanceof Date)
            return new Date(hm);
          if (typeof hm == "string" && !/Z$/i.test(hm)) {
            var _m = hm.match(Fs);
            if (_m) {
              var Sm = _m[2] - 1 || 0, wm = (_m[7] || "0").substring(0, 3);
              return ym ? new Date(Date.UTC(_m[1], Sm, _m[3] || 1, _m[4] || 0, _m[5] || 0, _m[6] || 0, wm)) : new Date(_m[1], Sm, _m[3] || 1, _m[4] || 0, _m[5] || 0, _m[6] || 0, wm);
            }
          }
          return new Date(hm);
        }(sm), this.init();
      }, Yu.init = function() {
        var sm = this.$d;
        this.$y = sm.getFullYear(), this.$M = sm.getMonth(), this.$D = sm.getDate(), this.$W = sm.getDay(), this.$H = sm.getHours(), this.$m = sm.getMinutes(), this.$s = sm.getSeconds(), this.$ms = sm.getMilliseconds();
      }, Yu.$utils = function() {
        return Nu;
      }, Yu.isValid = function() {
        return this.$d.toString() !== zs;
      }, Yu.isSame = function(sm, mm) {
        var hm = Au(sm);
        return this.startOf(mm) <= hm && hm <= this.endOf(mm);
      }, Yu.isAfter = function(sm, mm) {
        return Au(sm) < this.startOf(mm);
      }, Yu.isBefore = function(sm, mm) {
        return this.endOf(mm) < Au(sm);
      }, Yu.$g = function(sm, mm, hm) {
        return Nu.u(sm) ? this[mm] : this.set(hm, sm);
      }, Yu.unix = function() {
        return Math.floor(this.valueOf() / 1e3);
      }, Yu.valueOf = function() {
        return this.$d.getTime();
      }, Yu.startOf = function(sm, mm) {
        var hm = this, ym = !!Nu.u(mm) || mm, _m = Nu.p(sm), Sm = function(Dm, km) {
          var zm = Nu.w(hm.$u ? Date.UTC(hm.$y, km, Dm) : new Date(hm.$y, km, Dm), hm);
          return ym ? zm : zm.endOf(kr);
        }, wm = function(Dm, km) {
          return Nu.w(hm.toDate()[Dm].apply(hm.toDate("s"), (ym ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(km)), hm);
        }, Nm = this.$W, Cm = this.$M, Im = this.$D, Am = "set" + (this.$u ? "UTC" : "");
        switch (_m) {
          case Ls:
            return ym ? Sm(1, 0) : Sm(31, 11);
          case Ms:
            return ym ? Sm(1, Cm) : Sm(0, Cm + 1);
          case Yr:
            var Vm = this.$locale().weekStart || 0, Rm = (Nm < Vm ? Nm + 7 : Nm) - Vm;
            return Sm(ym ? Im - Rm : Im + (6 - Rm), Cm);
          case kr:
          case js:
            return wm(Am + "Hours", 0);
          case Cr:
            return wm(Am + "Minutes", 1);
          case er:
            return wm(Am + "Seconds", 2);
          case Kn:
            return wm(Am + "Milliseconds", 3);
          default:
            return this.clone();
        }
      }, Yu.endOf = function(sm) {
        return this.startOf(sm, !1);
      }, Yu.$set = function(sm, mm) {
        var hm, ym = Nu.p(sm), _m = "set" + (this.$u ? "UTC" : ""), Sm = (hm = {}, hm[kr] = _m + "Date", hm[js] = _m + "Date", hm[Ms] = _m + "Month", hm[Ls] = _m + "FullYear", hm[Cr] = _m + "Hours", hm[er] = _m + "Minutes", hm[Kn] = _m + "Seconds", hm[kn] = _m + "Milliseconds", hm)[ym], wm = ym === kr ? this.$D + (mm - this.$W) : mm;
        if (ym === Ms || ym === Ls) {
          var Nm = this.clone().set(js, 1);
          Nm.$d[Sm](wm), Nm.init(), this.$d = Nm.set(js, Math.min(this.$D, Nm.daysInMonth())).$d;
        } else
          Sm && this.$d[Sm](wm);
        return this.init(), this;
      }, Yu.set = function(sm, mm) {
        return this.clone().$set(sm, mm);
      }, Yu.get = function(sm) {
        return this[Nu.p(sm)]();
      }, Yu.add = function(sm, mm) {
        var hm, ym = this;
        sm = Number(sm);
        var _m = Nu.p(mm), Sm = function(Cm) {
          var Im = Au(ym);
          return Nu.w(Im.date(Im.date() + Math.round(Cm * sm)), ym);
        };
        if (_m === Ms)
          return this.set(Ms, this.$M + sm);
        if (_m === Ls)
          return this.set(Ls, this.$y + sm);
        if (_m === kr)
          return Sm(1);
        if (_m === Yr)
          return Sm(7);
        var wm = (hm = {}, hm[er] = $n, hm[Cr] = Sn, hm[Kn] = Zt, hm)[_m] || 1, Nm = this.$d.getTime() + sm * wm;
        return Nu.w(Nm, this);
      }, Yu.subtract = function(sm, mm) {
        return this.add(-1 * sm, mm);
      }, Yu.format = function(sm) {
        var mm = this, hm = this.$locale();
        if (!this.isValid())
          return hm.invalidDate || zs;
        var ym = sm || "YYYY-MM-DDTHH:mm:ssZ", _m = Nu.z(this), Sm = this.$H, wm = this.$m, Nm = this.$M, Cm = hm.weekdays, Im = hm.months, Am = hm.meridiem, Vm = function(km, zm, Pm, i$) {
          return km && (km[zm] || km(mm, ym)) || Pm[zm].slice(0, i$);
        }, Rm = function(km) {
          return Nu.s(Sm % 12 || 12, km, "0");
        }, Dm = Am || function(km, zm, Pm) {
          var i$ = km < 12 ? "AM" : "PM";
          return Pm ? i$.toLowerCase() : i$;
        };
        return ym.replace(Bs, function(km, zm) {
          return zm || function(Pm) {
            switch (Pm) {
              case "YY":
                return String(mm.$y).slice(-2);
              case "YYYY":
                return Nu.s(mm.$y, 4, "0");
              case "M":
                return Nm + 1;
              case "MM":
                return Nu.s(Nm + 1, 2, "0");
              case "MMM":
                return Vm(hm.monthsShort, Nm, Im, 3);
              case "MMMM":
                return Vm(Im, Nm);
              case "D":
                return mm.$D;
              case "DD":
                return Nu.s(mm.$D, 2, "0");
              case "d":
                return String(mm.$W);
              case "dd":
                return Vm(hm.weekdaysMin, mm.$W, Cm, 2);
              case "ddd":
                return Vm(hm.weekdaysShort, mm.$W, Cm, 3);
              case "dddd":
                return Cm[mm.$W];
              case "H":
                return String(Sm);
              case "HH":
                return Nu.s(Sm, 2, "0");
              case "h":
                return Rm(1);
              case "hh":
                return Rm(2);
              case "a":
                return Dm(Sm, wm, !0);
              case "A":
                return Dm(Sm, wm, !1);
              case "m":
                return String(wm);
              case "mm":
                return Nu.s(wm, 2, "0");
              case "s":
                return String(mm.$s);
              case "ss":
                return Nu.s(mm.$s, 2, "0");
              case "SSS":
                return Nu.s(mm.$ms, 3, "0");
              case "Z":
                return _m;
            }
            return null;
          }(km) || _m.replace(":", "");
        });
      }, Yu.utcOffset = function() {
        return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
      }, Yu.diff = function(sm, mm, hm) {
        var ym, _m = this, Sm = Nu.p(mm), wm = Au(sm), Nm = (wm.utcOffset() - this.utcOffset()) * $n, Cm = this - wm, Im = function() {
          return Nu.m(_m, wm);
        };
        switch (Sm) {
          case Ls:
            ym = Im() / 12;
            break;
          case Ms:
            ym = Im();
            break;
          case Ds:
            ym = Im() / 3;
            break;
          case Yr:
            ym = (Cm - Nm) / 6048e5;
            break;
          case kr:
            ym = (Cm - Nm) / 864e5;
            break;
          case Cr:
            ym = Cm / Sn;
            break;
          case er:
            ym = Cm / $n;
            break;
          case Kn:
            ym = Cm / Zt;
            break;
          default:
            ym = Cm;
        }
        return hm ? ym : Nu.a(ym);
      }, Yu.daysInMonth = function() {
        return this.endOf(Ms).$D;
      }, Yu.$locale = function() {
        return Mu[this.$L];
      }, Yu.locale = function(sm, mm) {
        if (!sm)
          return this.$L;
        var hm = this.clone(), ym = Tu(sm, mm, !0);
        return ym && (hm.$L = ym), hm;
      }, Yu.clone = function() {
        return Nu.w(this.$d, this);
      }, Yu.toDate = function() {
        return new Date(this.valueOf());
      }, Yu.toJSON = function() {
        return this.isValid() ? this.toISOString() : null;
      }, Yu.toISOString = function() {
        return this.$d.toISOString();
      }, Yu.toString = function() {
        return this.$d.toUTCString();
      }, zu;
    }(), pm = gm.prototype;
    return Au.prototype = pm, [["$ms", kn], ["$s", Kn], ["$m", er], ["$H", Cr], ["$W", kr], ["$M", Ms], ["$y", Ls], ["$D", js]].forEach(function(zu) {
      pm[zu[1]] = function(Yu) {
        return this.$g(Yu, zu[0], zu[1]);
      };
    }), Au.extend = function(zu, Yu) {
      return zu.$i || (zu(Yu, gm, Au), zu.$i = !0), Au;
    }, Au.locale = Tu, Au.isDayjs = Iu, Au.unix = function(zu) {
      return Au(1e3 * zu);
    }, Au.en = Mu[El], Au.Ls = Mu, Au.p = {}, Au;
  });
})(dayjs_min);
var dayjs_minExports = dayjs_min.exports;
const dayjs = /* @__PURE__ */ getDefaultExportFromCjs$1(dayjs_minExports);
function levelToNumber(_e, Qt) {
  return _e ? _e === "month" ? 0 : _e === "year" ? 1 : 2 : Qt;
}
function levelNumberToLevel(_e) {
  return _e === 0 ? "month" : _e === 1 ? "year" : "decade";
}
function clampLevel(_e, Qt, Zt) {
  return levelNumberToLevel(clamp$2(levelToNumber(_e, 0), levelToNumber(Qt, 0), levelToNumber(Zt, 2)));
}
var useStyles$q = createStyles(() => ({
  calendar: {}
}));
const useStyles$r = useStyles$q;
var useStyles$o = createStyles((_e, Qt, { size: Zt }) => ({
  monthLevelGroup: {
    display: "flex",
    "& [data-month-level]:not(:last-of-type)": {
      marginRight: getSize$1({ size: Zt, sizes: _e.spacing })
    }
  }
}));
const useStyles$p = useStyles$o;
var useStyles$m = createStyles((_e) => ({
  monthLevel: {},
  calendarHeader: {
    marginBottom: _e.spacing.xs
  }
}));
const useStyles$n = useStyles$m, DATES_PROVIDER_DEFAULT_SETTINGS = {
  locale: "en",
  firstDayOfWeek: 1,
  weekendDays: [0, 6],
  labelSeparator: "–"
}, DatesProviderContext = reactExports.createContext(DATES_PROVIDER_DEFAULT_SETTINGS);
var __defProp$g = Object.defineProperty, __defProps$6 = Object.defineProperties, __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$h = Object.getOwnPropertySymbols, __hasOwnProp$h = Object.prototype.hasOwnProperty, __propIsEnum$h = Object.prototype.propertyIsEnumerable, __defNormalProp$g = (_e, Qt, Zt) => Qt in _e ? __defProp$g(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$g = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$h.call(Qt, Zt) && __defNormalProp$g(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$h)
    for (var Zt of __getOwnPropSymbols$h(Qt))
      __propIsEnum$h.call(Qt, Zt) && __defNormalProp$g(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$6 = (_e, Qt) => __defProps$6(_e, __getOwnPropDescs$6(Qt));
function useDatesContext() {
  const _e = reactExports.useContext(DatesProviderContext), Qt = reactExports.useCallback((kn) => kn || _e.locale, [_e.locale]), Zt = reactExports.useCallback((kn) => typeof kn == "number" ? kn : _e.firstDayOfWeek, [_e.firstDayOfWeek]), $n = reactExports.useCallback((kn) => Array.isArray(kn) ? kn : _e.weekendDays, [_e.weekendDays]), Sn = reactExports.useCallback((kn) => typeof kn == "string" ? kn : _e.labelSeparator, [_e.labelSeparator]);
  return __spreadProps$6(__spreadValues$g({}, _e), {
    getLocale: Qt,
    getFirstDayOfWeek: Zt,
    getWeekendDays: $n,
    getLabelSeparator: Sn
  });
}
function getStartOfWeek(_e, Qt = 1) {
  const Zt = new Date(_e);
  for (; Zt.getDay() !== Qt; )
    Zt.setDate(Zt.getDate() - 1);
  return Zt;
}
function getEndOfWeek(_e, Qt = 1) {
  const Zt = new Date(_e), $n = Qt === 0 ? 6 : Qt - 1;
  for (; Zt.getDay() !== $n; )
    Zt.setDate(Zt.getDate() + 1);
  return Zt;
}
function getMonthDays(_e, Qt = 1) {
  const Zt = _e.getMonth(), $n = new Date(_e.getFullYear(), Zt, 1), Sn = new Date(_e.getFullYear(), _e.getMonth() + 1, 0), kn = getEndOfWeek(Sn, Qt), Kn = getStartOfWeek($n, Qt), er = [];
  for (; Kn <= kn; ) {
    const Cr = [];
    for (let kr = 0; kr < 7; kr += 1)
      Cr.push(new Date(Kn)), Kn.setDate(Kn.getDate() + 1);
    er.push(Cr);
  }
  return er;
}
function isSameMonth(_e, Qt) {
  return _e.getFullYear() === Qt.getFullYear() && _e.getMonth() === Qt.getMonth();
}
function isBeforeMaxDate(_e, Qt) {
  return Qt instanceof Date ? dayjs(_e).isBefore(dayjs(Qt).add(1, "day"), "day") : !0;
}
function isAfterMinDate(_e, Qt) {
  return Qt instanceof Date ? dayjs(_e).isAfter(dayjs(Qt).subtract(1, "day"), "day") : !0;
}
var __defProp$f = Object.defineProperty, __defProps$5 = Object.defineProperties, __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$g = Object.getOwnPropertySymbols, __hasOwnProp$g = Object.prototype.hasOwnProperty, __propIsEnum$g = Object.prototype.propertyIsEnumerable, __defNormalProp$f = (_e, Qt, Zt) => Qt in _e ? __defProp$f(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$f = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$g.call(Qt, Zt) && __defNormalProp$f(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$g)
    for (var Zt of __getOwnPropSymbols$g(Qt))
      __propIsEnum$g.call(Qt, Zt) && __defNormalProp$f(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$5 = (_e, Qt) => __defProps$5(_e, __getOwnPropDescs$5(Qt)), useStyles$k = createStyles((_e) => ({
  monthThead: {},
  monthRow: {},
  monthTbody: {},
  monthCell: {
    padding: 0,
    "&[data-with-spacing]": {
      padding: rem$1(0.5)
    }
  },
  month: __spreadProps$5(__spreadValues$f({}, _e.fn.fontStyles()), {
    borderCollapse: "collapse",
    tableLayout: "fixed",
    "& *": {
      boxSizing: "border-box"
    }
  })
}));
const useStyles$l = useStyles$k;
function getDateInTabOrder(_e, Qt, Zt, $n, Sn, kn, Kn) {
  const er = _e.flat().filter((Yr) => {
    var Ms;
    return isBeforeMaxDate(Yr, Zt) && isAfterMinDate(Yr, Qt) && !(Sn != null && Sn(Yr)) && !((Ms = $n == null ? void 0 : $n(Yr)) != null && Ms.disabled) && (!kn || isSameMonth(Yr, Kn));
  }), Cr = er.find((Yr) => {
    var Ms;
    return (Ms = $n == null ? void 0 : $n(Yr)) == null ? void 0 : Ms.selected;
  });
  if (Cr)
    return Cr;
  const kr = er.find((Yr) => dayjs().isSame(Yr, "date"));
  return kr || er[0];
}
var __defProp$e = Object.defineProperty, __getOwnPropSymbols$f = Object.getOwnPropertySymbols, __hasOwnProp$f = Object.prototype.hasOwnProperty, __propIsEnum$f = Object.prototype.propertyIsEnumerable, __defNormalProp$e = (_e, Qt, Zt) => Qt in _e ? __defProp$e(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$e = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$f.call(Qt, Zt) && __defNormalProp$e(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$f)
    for (var Zt of __getOwnPropSymbols$f(Qt))
      __propIsEnum$f.call(Qt, Zt) && __defNormalProp$e(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$e = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$f.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$f)
    for (var $n of __getOwnPropSymbols$f(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$f.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$e = {
  tabIndex: 0,
  size: "sm"
}, Day$1 = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Day", defaultProps$e, _e), {
    className: $n,
    date: Sn,
    radius: kn,
    disabled: Kn,
    styles: er,
    classNames: Cr,
    unstyled: kr,
    __staticSelector: Yr,
    weekend: Ms,
    outside: Ds,
    selected: Ls,
    renderDay: js,
    inRange: zs,
    firstInRange: Fs,
    lastInRange: Bs,
    hidden: Hs,
    static: Ws,
    variant: Ys,
    size: El
  } = Zt, Mu = __objRest$e(Zt, [
    "className",
    "date",
    "radius",
    "disabled",
    "styles",
    "classNames",
    "unstyled",
    "__staticSelector",
    "weekend",
    "outside",
    "selected",
    "renderDay",
    "inRange",
    "firstInRange",
    "lastInRange",
    "hidden",
    "static",
    "variant",
    "size"
  ]), { classes: Pl, cx: Iu } = useStyles$v({ radius: kn, isStatic: Ws }, { name: ["Day", Yr], classNames: Cr, styles: er, unstyled: kr, variant: Ys, size: El });
  return /* @__PURE__ */ React.createElement(UnstyledButton, __spreadValues$e({
    component: Ws ? "div" : "button",
    ref: Qt,
    className: Iu(Pl.day, $n),
    disabled: Kn,
    "data-today": dayjs(Sn).isSame(/* @__PURE__ */ new Date(), "day") || void 0,
    "data-hidden": Hs || void 0,
    "data-disabled": Kn || void 0,
    "data-weekend": !Kn && !Ds && Ms || void 0,
    "data-outside": !Kn && Ds || void 0,
    "data-selected": !Kn && Ls || void 0,
    "data-in-range": zs && !Kn || void 0,
    "data-first-in-range": Fs && !Kn || void 0,
    "data-last-in-range": Bs && !Kn || void 0,
    unstyled: kr
  }, Mu), (js == null ? void 0 : js(Sn)) || Sn.getDate());
});
Day$1.displayName = "@mantine/dates/Day";
function getWeekdayNames({
  locale: _e,
  format: Qt = "dd",
  firstDayOfWeek: Zt = 1
}) {
  const $n = dayjs().day(Zt), Sn = [];
  for (let kn = 0; kn < 7; kn += 1)
    typeof Qt == "string" ? Sn.push(dayjs($n).add(kn, "days").locale(_e).format(Qt)) : Sn.push(Qt(dayjs($n).add(kn, "days").toDate()));
  return Sn;
}
var useStyles$i = createStyles((_e, Qt, { size: Zt }) => ({
  weekdaysRow: {},
  weekday: {
    color: _e.colorScheme === "dark" ? _e.colors.dark[1] : _e.colors.gray[5],
    fontWeight: 400,
    fontSize: getSize$1({ size: Zt, sizes: _e.fontSizes }),
    textTransform: "capitalize",
    paddingBottom: `calc(${getSize$1({ size: Zt, sizes: _e.spacing })} / 2)`
  }
}));
const useStyles$j = useStyles$i;
var __defProp$d = Object.defineProperty, __getOwnPropSymbols$e = Object.getOwnPropertySymbols, __hasOwnProp$e = Object.prototype.hasOwnProperty, __propIsEnum$e = Object.prototype.propertyIsEnumerable, __defNormalProp$d = (_e, Qt, Zt) => Qt in _e ? __defProp$d(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$d = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$e.call(Qt, Zt) && __defNormalProp$d(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$e)
    for (var Zt of __getOwnPropSymbols$e(Qt))
      __propIsEnum$e.call(Qt, Zt) && __defNormalProp$d(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$d = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$e.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$e)
    for (var $n of __getOwnPropSymbols$e(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$e.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$d = {
  weekdayFormat: "dd",
  cellComponent: "th",
  size: "sm"
}, WeekdaysRow = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("WeekdaysRow", defaultProps$d, _e), {
    className: $n,
    locale: Sn,
    firstDayOfWeek: kn,
    weekdayFormat: Kn,
    cellComponent: er,
    __staticSelector: Cr,
    classNames: kr,
    styles: Yr,
    unstyled: Ms,
    variant: Ds,
    size: Ls
  } = Zt, js = __objRest$d(Zt, [
    "className",
    "locale",
    "firstDayOfWeek",
    "weekdayFormat",
    "cellComponent",
    "__staticSelector",
    "classNames",
    "styles",
    "unstyled",
    "variant",
    "size"
  ]), zs = useDatesContext(), { classes: Fs, cx: Bs } = useStyles$j(null, {
    name: ["WeekdaysRow", Cr],
    classNames: kr,
    styles: Yr,
    unstyled: Ms,
    variant: Ds,
    size: Ls
  }), Hs = getWeekdayNames({
    locale: zs.getLocale(Sn),
    format: Kn,
    firstDayOfWeek: zs.getFirstDayOfWeek(kn)
  }).map((Ws, Ys) => /* @__PURE__ */ React.createElement(er, {
    key: Ys,
    className: Fs.weekday
  }, Ws));
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$d({
    component: "tr",
    ref: Qt,
    className: Bs(Fs.weekdaysRow, $n)
  }, js), Hs);
});
WeekdaysRow.displayName = "@mantine/dates/WeekdaysRow";
var __defProp$c = Object.defineProperty, __defProps$4 = Object.defineProperties, __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$d = Object.getOwnPropertySymbols, __hasOwnProp$d = Object.prototype.hasOwnProperty, __propIsEnum$d = Object.prototype.propertyIsEnumerable, __defNormalProp$c = (_e, Qt, Zt) => Qt in _e ? __defProp$c(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$c = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$d.call(Qt, Zt) && __defNormalProp$c(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$d)
    for (var Zt of __getOwnPropSymbols$d(Qt))
      __propIsEnum$d.call(Qt, Zt) && __defNormalProp$c(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$4 = (_e, Qt) => __defProps$4(_e, __getOwnPropDescs$4(Qt)), __objRest$c = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$d.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$d)
    for (var $n of __getOwnPropSymbols$d(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$d.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$c = {
  size: "sm",
  withCellSpacing: !0
}, Month$1 = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Month", defaultProps$c, _e), {
    className: $n,
    classNames: Sn,
    styles: kn,
    unstyled: Kn,
    __staticSelector: er,
    locale: Cr,
    firstDayOfWeek: kr,
    weekdayFormat: Yr,
    month: Ms,
    weekendDays: Ds,
    getDayProps: Ls,
    excludeDate: js,
    minDate: zs,
    maxDate: Fs,
    renderDay: Bs,
    hideOutsideDates: Hs,
    hideWeekdays: Ws,
    getDayAriaLabel: Ys,
    static: El,
    __getDayRef: Mu,
    __onDayKeyDown: Pl,
    __onDayClick: Iu,
    __onDayMouseEnter: Tu,
    __preventFocus: Au,
    __stopPropagation: Nu,
    withCellSpacing: gm,
    size: pm,
    variant: zu
  } = Zt, Yu = __objRest$c(Zt, [
    "className",
    "classNames",
    "styles",
    "unstyled",
    "__staticSelector",
    "locale",
    "firstDayOfWeek",
    "weekdayFormat",
    "month",
    "weekendDays",
    "getDayProps",
    "excludeDate",
    "minDate",
    "maxDate",
    "renderDay",
    "hideOutsideDates",
    "hideWeekdays",
    "getDayAriaLabel",
    "static",
    "__getDayRef",
    "__onDayKeyDown",
    "__onDayClick",
    "__onDayMouseEnter",
    "__preventFocus",
    "__stopPropagation",
    "withCellSpacing",
    "size",
    "variant"
  ]), sm = useDatesContext(), { classes: mm, cx: hm } = useStyles$l(null, {
    name: ["Month", er],
    classNames: Sn,
    styles: kn,
    unstyled: Kn,
    variant: zu,
    size: pm
  }), ym = {
    __staticSelector: er || "Month",
    classNames: Sn,
    styles: kn,
    unstyled: Kn,
    variant: zu,
    size: pm
  }, _m = getMonthDays(Ms, sm.getFirstDayOfWeek(kr)), Sm = getDateInTabOrder(_m, zs, Fs, Ls, js, Hs, Ms), wm = _m.map((Nm, Cm) => {
    const Im = Nm.map((Am, Vm) => {
      const Rm = !isSameMonth(Am, Ms), Dm = (Ys == null ? void 0 : Ys(Am)) || dayjs(Am).locale(Cr || sm.locale).format("D MMMM YYYY"), km = Ls == null ? void 0 : Ls(Am), zm = dayjs(Am).isSame(Sm, "date");
      return /* @__PURE__ */ React.createElement("td", {
        key: Am.toString(),
        className: mm.monthCell,
        "data-with-spacing": gm || void 0
      }, /* @__PURE__ */ React.createElement(Day$1, __spreadProps$4(__spreadValues$c(__spreadProps$4(__spreadValues$c({}, ym), {
        "data-mantine-stop-propagation": Nu || void 0,
        renderDay: Bs,
        date: Am,
        weekend: sm.getWeekendDays(Ds).includes(Am.getDay()),
        outside: Rm,
        hidden: Hs ? Rm : !1,
        "aria-label": Dm,
        static: El,
        disabled: (js == null ? void 0 : js(Am)) || !isBeforeMaxDate(Am, Fs) || !isAfterMinDate(Am, zs),
        ref: (Pm) => Mu == null ? void 0 : Mu(Cm, Vm, Pm)
      }), km), {
        onKeyDown: (Pm) => {
          var i$;
          (i$ = km == null ? void 0 : km.onKeyDown) == null || i$.call(km, Pm), Pl == null || Pl(Pm, { rowIndex: Cm, cellIndex: Vm, date: Am });
        },
        onMouseEnter: (Pm) => {
          var i$;
          (i$ = km == null ? void 0 : km.onMouseEnter) == null || i$.call(km, Pm), Tu == null || Tu(Pm, Am);
        },
        onClick: (Pm) => {
          var i$;
          (i$ = km == null ? void 0 : km.onClick) == null || i$.call(km, Pm), Iu == null || Iu(Pm, Am);
        },
        onMouseDown: (Pm) => {
          var i$;
          (i$ = km == null ? void 0 : km.onMouseDown) == null || i$.call(km, Pm), Au && Pm.preventDefault();
        },
        tabIndex: Au || !zm ? -1 : 0
      })));
    });
    return /* @__PURE__ */ React.createElement("tr", {
      key: Cm,
      className: mm.monthRow
    }, Im);
  });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$c({
    component: "table",
    className: hm(mm.month, $n),
    ref: Qt
  }, Yu), !Ws && /* @__PURE__ */ React.createElement("thead", {
    className: mm.monthThead
  }, /* @__PURE__ */ React.createElement(WeekdaysRow, __spreadProps$4(__spreadValues$c({}, ym), {
    locale: Cr,
    firstDayOfWeek: kr,
    weekdayFormat: Yr
  }))), /* @__PURE__ */ React.createElement("tbody", {
    className: mm.monthTbody
  }, wm));
});
Month$1.displayName = "@mantine/dates/Month";
var __defProp$b = Object.defineProperty, __getOwnPropSymbols$c = Object.getOwnPropertySymbols, __hasOwnProp$c = Object.prototype.hasOwnProperty, __propIsEnum$c = Object.prototype.propertyIsEnumerable, __defNormalProp$b = (_e, Qt, Zt) => Qt in _e ? __defProp$b(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$b = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$c.call(Qt, Zt) && __defNormalProp$b(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$c)
    for (var Zt of __getOwnPropSymbols$c(Qt))
      __propIsEnum$c.call(Qt, Zt) && __defNormalProp$b(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$b = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$c.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$c)
    for (var $n of __getOwnPropSymbols$c(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$c.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$b = {
  monthLabelFormat: "MMMM YYYY"
}, MonthLevel = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("MonthLevel", defaultProps$b, _e), {
    month: $n,
    locale: Sn,
    firstDayOfWeek: kn,
    weekdayFormat: Kn,
    weekendDays: er,
    getDayProps: Cr,
    excludeDate: kr,
    minDate: Yr,
    maxDate: Ms,
    renderDay: Ds,
    hideOutsideDates: Ls,
    hideWeekdays: js,
    getDayAriaLabel: zs,
    __getDayRef: Fs,
    __onDayKeyDown: Bs,
    __onDayClick: Hs,
    __onDayMouseEnter: Ws,
    withCellSpacing: Ys,
    __preventFocus: El,
    __stopPropagation: Mu,
    nextIcon: Pl,
    previousIcon: Iu,
    nextLabel: Tu,
    previousLabel: Au,
    onNext: Nu,
    onPrevious: gm,
    onLevelClick: pm,
    nextDisabled: zu,
    previousDisabled: Yu,
    hasNextLevel: sm,
    levelControlAriaLabel: mm,
    withNext: hm,
    withPrevious: ym,
    className: _m,
    monthLabelFormat: Sm,
    classNames: wm,
    styles: Nm,
    unstyled: Cm,
    __staticSelector: Im,
    size: Am,
    variant: Vm,
    static: Rm
  } = Zt, Dm = __objRest$b(Zt, [
    "month",
    "locale",
    "firstDayOfWeek",
    "weekdayFormat",
    "weekendDays",
    "getDayProps",
    "excludeDate",
    "minDate",
    "maxDate",
    "renderDay",
    "hideOutsideDates",
    "hideWeekdays",
    "getDayAriaLabel",
    "__getDayRef",
    "__onDayKeyDown",
    "__onDayClick",
    "__onDayMouseEnter",
    "withCellSpacing",
    "__preventFocus",
    "__stopPropagation",
    "nextIcon",
    "previousIcon",
    "nextLabel",
    "previousLabel",
    "onNext",
    "onPrevious",
    "onLevelClick",
    "nextDisabled",
    "previousDisabled",
    "hasNextLevel",
    "levelControlAriaLabel",
    "withNext",
    "withPrevious",
    "className",
    "monthLabelFormat",
    "classNames",
    "styles",
    "unstyled",
    "__staticSelector",
    "size",
    "variant",
    "static"
  ]), { classes: km, cx: zm } = useStyles$n(null, {
    name: ["MonthLevel", Im],
    classNames: wm,
    styles: Nm,
    unstyled: Cm,
    variant: Vm,
    size: Am
  }), Pm = useDatesContext(), i$ = {
    __staticSelector: Im || "MonthLevel",
    classNames: wm,
    styles: Nm,
    unstyled: Cm,
    variant: Vm,
    size: Am
  }, o$ = typeof zu == "boolean" ? zu : Ms ? !dayjs($n).endOf("month").isBefore(Ms) : !1, u$ = typeof Yu == "boolean" ? Yu : Yr ? !dayjs($n).startOf("month").isAfter(Yr) : !1;
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$b({
    className: zm(km.monthLevel, _m),
    "data-month-level": !0,
    ref: Qt
  }, Dm), /* @__PURE__ */ React.createElement(CalendarHeader, __spreadValues$b({
    label: typeof Sm == "function" ? Sm($n) : dayjs($n).locale(Sn || Pm.locale).format(Sm),
    className: km.calendarHeader,
    __preventFocus: El,
    __stopPropagation: Mu,
    nextIcon: Pl,
    previousIcon: Iu,
    nextLabel: Tu,
    previousLabel: Au,
    onNext: Nu,
    onPrevious: gm,
    onLevelClick: pm,
    nextDisabled: o$,
    previousDisabled: u$,
    hasNextLevel: sm,
    levelControlAriaLabel: mm,
    withNext: hm,
    withPrevious: ym
  }, i$)), /* @__PURE__ */ React.createElement(Month$1, __spreadValues$b({
    month: $n,
    locale: Sn,
    firstDayOfWeek: kn,
    weekdayFormat: Kn,
    weekendDays: er,
    getDayProps: Cr,
    excludeDate: kr,
    minDate: Yr,
    maxDate: Ms,
    renderDay: Ds,
    hideOutsideDates: Ls,
    hideWeekdays: js,
    getDayAriaLabel: zs,
    __getDayRef: Fs,
    __onDayKeyDown: Bs,
    __onDayClick: Hs,
    __onDayMouseEnter: Ws,
    __preventFocus: El,
    __stopPropagation: Mu,
    static: Rm,
    withCellSpacing: Ys
  }, i$)));
});
MonthLevel.displayName = "@mantine/dates/MonthLevel";
function getNextIndex({ direction: _e, levelIndex: Qt, rowIndex: Zt, cellIndex: $n, size: Sn }) {
  switch (_e) {
    case "up":
      return Qt === 0 && Zt === 0 ? null : Zt === 0 ? {
        levelIndex: Qt - 1,
        rowIndex: $n <= Sn[Qt - 1][Sn[Qt - 1].length - 1] - 1 ? Sn[Qt - 1].length - 1 : Sn[Qt - 1].length - 2,
        cellIndex: $n
      } : {
        levelIndex: Qt,
        rowIndex: Zt - 1,
        cellIndex: $n
      };
    case "down":
      return Zt === Sn[Qt].length - 1 ? {
        levelIndex: Qt + 1,
        rowIndex: 0,
        cellIndex: $n
      } : Zt === Sn[Qt].length - 2 && $n >= Sn[Qt][Sn[Qt].length - 1] ? {
        levelIndex: Qt + 1,
        rowIndex: 0,
        cellIndex: $n
      } : {
        levelIndex: Qt,
        rowIndex: Zt + 1,
        cellIndex: $n
      };
    case "left":
      return Qt === 0 && Zt === 0 && $n === 0 ? null : Zt === 0 && $n === 0 ? {
        levelIndex: Qt - 1,
        rowIndex: Sn[Qt - 1].length - 1,
        cellIndex: Sn[Qt - 1][Sn[Qt - 1].length - 1] - 1
      } : $n === 0 ? {
        levelIndex: Qt,
        rowIndex: Zt - 1,
        cellIndex: Sn[Qt][Zt - 1] - 1
      } : {
        levelIndex: Qt,
        rowIndex: Zt,
        cellIndex: $n - 1
      };
    case "right":
      return Zt === Sn[Qt].length - 1 && $n === Sn[Qt][Zt] - 1 ? {
        levelIndex: Qt + 1,
        rowIndex: 0,
        cellIndex: 0
      } : $n === Sn[Qt][Zt] - 1 ? {
        levelIndex: Qt,
        rowIndex: Zt + 1,
        cellIndex: 0
      } : {
        levelIndex: Qt,
        rowIndex: Zt,
        cellIndex: $n + 1
      };
    default:
      return { levelIndex: Qt, rowIndex: Zt, cellIndex: $n };
  }
}
function focusOnNextFocusableControl({
  controlsRef: _e,
  direction: Qt,
  levelIndex: Zt,
  rowIndex: $n,
  cellIndex: Sn,
  size: kn
}) {
  var Kn, er;
  const Cr = getNextIndex({ direction: Qt, size: kn, rowIndex: $n, cellIndex: Sn, levelIndex: Zt });
  if (!Cr)
    return;
  const kr = (er = (Kn = _e.current[Cr.levelIndex]) == null ? void 0 : Kn[Cr.rowIndex]) == null ? void 0 : er[Cr.cellIndex];
  kr && (kr.disabled || kr.getAttribute("data-hidden") || kr.getAttribute("data-outside") ? focusOnNextFocusableControl({
    controlsRef: _e,
    direction: Qt,
    levelIndex: Cr.levelIndex,
    cellIndex: Cr.cellIndex,
    rowIndex: Cr.rowIndex,
    size: kn
  }) : kr.focus());
}
function getDirection$1(_e) {
  switch (_e) {
    case "ArrowDown":
      return "down";
    case "ArrowUp":
      return "up";
    case "ArrowRight":
      return "right";
    case "ArrowLeft":
      return "left";
    default:
      return null;
  }
}
function getControlsSize(_e) {
  return _e.current.map((Qt) => Qt.map((Zt) => Zt.length));
}
function handleControlKeyDown({
  controlsRef: _e,
  levelIndex: Qt,
  rowIndex: Zt,
  cellIndex: $n,
  event: Sn
}) {
  const kn = getDirection$1(Sn.key);
  if (kn) {
    Sn.preventDefault();
    const Kn = getControlsSize(_e);
    focusOnNextFocusableControl({
      controlsRef: _e,
      direction: kn,
      levelIndex: Qt,
      rowIndex: Zt,
      cellIndex: $n,
      size: Kn
    });
  }
}
var __defProp$a = Object.defineProperty, __getOwnPropSymbols$b = Object.getOwnPropertySymbols, __hasOwnProp$b = Object.prototype.hasOwnProperty, __propIsEnum$b = Object.prototype.propertyIsEnumerable, __defNormalProp$a = (_e, Qt, Zt) => Qt in _e ? __defProp$a(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$a = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$b.call(Qt, Zt) && __defNormalProp$a(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$b)
    for (var Zt of __getOwnPropSymbols$b(Qt))
      __propIsEnum$b.call(Qt, Zt) && __defNormalProp$a(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$a = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$b.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$b)
    for (var $n of __getOwnPropSymbols$b(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$b.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$a = {
  numberOfColumns: 1
}, MonthLevelGroup = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("MonthLevelGroup", defaultProps$a, _e), {
    month: $n,
    locale: Sn,
    firstDayOfWeek: kn,
    weekdayFormat: Kn,
    weekendDays: er,
    getDayProps: Cr,
    excludeDate: kr,
    minDate: Yr,
    maxDate: Ms,
    renderDay: Ds,
    hideOutsideDates: Ls,
    hideWeekdays: js,
    getDayAriaLabel: zs,
    __onDayClick: Fs,
    __onDayMouseEnter: Bs,
    withCellSpacing: Hs,
    __preventFocus: Ws,
    nextIcon: Ys,
    previousIcon: El,
    nextLabel: Mu,
    previousLabel: Pl,
    onNext: Iu,
    onPrevious: Tu,
    onLevelClick: Au,
    nextDisabled: Nu,
    previousDisabled: gm,
    hasNextLevel: pm,
    className: zu,
    classNames: Yu,
    styles: sm,
    unstyled: mm,
    numberOfColumns: hm,
    levelControlAriaLabel: ym,
    monthLabelFormat: _m,
    __staticSelector: Sm,
    __stopPropagation: wm,
    size: Nm,
    variant: Cm,
    static: Im
  } = Zt, Am = __objRest$a(Zt, [
    "month",
    "locale",
    "firstDayOfWeek",
    "weekdayFormat",
    "weekendDays",
    "getDayProps",
    "excludeDate",
    "minDate",
    "maxDate",
    "renderDay",
    "hideOutsideDates",
    "hideWeekdays",
    "getDayAriaLabel",
    "__onDayClick",
    "__onDayMouseEnter",
    "withCellSpacing",
    "__preventFocus",
    "nextIcon",
    "previousIcon",
    "nextLabel",
    "previousLabel",
    "onNext",
    "onPrevious",
    "onLevelClick",
    "nextDisabled",
    "previousDisabled",
    "hasNextLevel",
    "className",
    "classNames",
    "styles",
    "unstyled",
    "numberOfColumns",
    "levelControlAriaLabel",
    "monthLabelFormat",
    "__staticSelector",
    "__stopPropagation",
    "size",
    "variant",
    "static"
  ]), { classes: Vm, cx: Rm } = useStyles$p(null, {
    name: ["MonthLevelGroup", Sm],
    classNames: Yu,
    styles: sm,
    unstyled: mm,
    variant: Cm,
    size: Nm
  }), Dm = reactExports.useRef([]), km = Array(hm).fill(0).map((zm, Pm) => {
    const i$ = dayjs($n).add(Pm, "months").toDate();
    return /* @__PURE__ */ React.createElement(MonthLevel, {
      key: Pm,
      month: i$,
      withNext: Pm === hm - 1,
      withPrevious: Pm === 0,
      monthLabelFormat: _m,
      __stopPropagation: wm,
      __onDayClick: Fs,
      __onDayMouseEnter: Bs,
      __onDayKeyDown: (o$, u$) => handleControlKeyDown({
        levelIndex: Pm,
        rowIndex: u$.rowIndex,
        cellIndex: u$.cellIndex,
        event: o$,
        controlsRef: Dm
      }),
      __getDayRef: (o$, u$, h$) => {
        Array.isArray(Dm.current[Pm]) || (Dm.current[Pm] = []), Array.isArray(Dm.current[Pm][o$]) || (Dm.current[Pm][o$] = []), Dm.current[Pm][o$][u$] = h$;
      },
      levelControlAriaLabel: typeof ym == "function" ? ym(i$) : ym,
      locale: Sn,
      firstDayOfWeek: kn,
      weekdayFormat: Kn,
      weekendDays: er,
      getDayProps: Cr,
      excludeDate: kr,
      minDate: Yr,
      maxDate: Ms,
      renderDay: Ds,
      hideOutsideDates: Ls,
      hideWeekdays: js,
      getDayAriaLabel: zs,
      __preventFocus: Ws,
      nextIcon: Ys,
      previousIcon: El,
      nextLabel: Mu,
      previousLabel: Pl,
      onNext: Iu,
      onPrevious: Tu,
      onLevelClick: Au,
      nextDisabled: Nu,
      previousDisabled: gm,
      hasNextLevel: pm,
      classNames: Yu,
      styles: sm,
      unstyled: mm,
      __staticSelector: Sm || "MonthLevelGroup",
      size: Nm,
      variant: Cm,
      static: Im,
      withCellSpacing: Hs
    });
  });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$a({
    className: Rm(Vm.monthLevelGroup, zu),
    ref: Qt
  }, Am), km);
});
MonthLevelGroup.displayName = "@mantine/dates/MonthLevelGroup";
var useStyles$g = createStyles((_e, Qt, { size: Zt }) => ({
  yearLevelGroup: {
    display: "flex",
    "& [data-year-level]:not(:last-of-type)": {
      marginRight: getSize$1({ size: Zt, sizes: _e.spacing })
    }
  }
}));
const useStyles$h = useStyles$g;
var useStyles$e = createStyles((_e) => ({
  yearLevel: {},
  calendarHeader: {
    marginBottom: _e.spacing.xs
  }
}));
const useStyles$f = useStyles$e;
function getMonthsData(_e) {
  const Qt = dayjs(_e).startOf("year").toDate(), Zt = [[], [], [], []];
  let $n = 0;
  for (let Sn = 0; Sn < 4; Sn += 1)
    for (let kn = 0; kn < 3; kn += 1)
      Zt[Sn].push(dayjs(Qt).add($n, "months").toDate()), $n += 1;
  return Zt;
}
function isMonthDisabled(_e, Qt, Zt) {
  return !Qt && !Zt ? !1 : !!(Qt && dayjs(_e).isBefore(Qt, "month") || Zt && dayjs(_e).isAfter(Zt, "month"));
}
var useStyles$c = createStyles(() => ({
  monthsList: {
    borderCollapse: "collapse",
    borderWidth: 0,
    cursor: "pointer"
  },
  monthsListCell: {
    padding: 0,
    "&[data-with-spacing]": {
      padding: rem$1(0.5)
    }
  },
  monthsListRow: {}
}));
const useStyles$d = useStyles$c;
function getMonthInTabOrder(_e, Qt, Zt, $n) {
  const Sn = _e.flat().filter((er) => {
    var Cr;
    return !isMonthDisabled(er, Qt, Zt) && !((Cr = $n == null ? void 0 : $n(er)) != null && Cr.disabled);
  }), kn = Sn.find((er) => {
    var Cr;
    return (Cr = $n == null ? void 0 : $n(er)) == null ? void 0 : Cr.selected;
  });
  if (kn)
    return kn;
  const Kn = Sn.find((er) => dayjs().isSame(er, "month"));
  return Kn || Sn[0];
}
var __defProp$9 = Object.defineProperty, __defProps$3 = Object.defineProperties, __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$a = Object.getOwnPropertySymbols, __hasOwnProp$a = Object.prototype.hasOwnProperty, __propIsEnum$a = Object.prototype.propertyIsEnumerable, __defNormalProp$9 = (_e, Qt, Zt) => Qt in _e ? __defProp$9(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$9 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$a.call(Qt, Zt) && __defNormalProp$9(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$a)
    for (var Zt of __getOwnPropSymbols$a(Qt))
      __propIsEnum$a.call(Qt, Zt) && __defNormalProp$9(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$3 = (_e, Qt) => __defProps$3(_e, __getOwnPropDescs$3(Qt)), useStyles$a = createStyles((_e, Qt, { size: Zt }) => {
  const $n = _e.fn.variant({ variant: "filled" }), Sn = _e.fn.variant({ variant: "light" });
  return {
    pickerControl: __spreadProps$3(__spreadValues$9({
      fontSize: getSize$1({ size: Zt, sizes: _e.fontSizes }),
      height: getSize$1({ size: Zt, sizes: sizes$1 }),
      width: `calc((${getSize$1({ size: Zt, sizes: sizes$1 })} * 7) / 3 + ${rem$1(1.5)})`,
      display: "flex",
      justifyContent: "center",
      alignItems: "center",
      userSelect: "none",
      borderRadius: _e.fn.radius()
    }, _e.fn.hover({
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[0]
    })), {
      "&:active": _e.activeStyles,
      "&[data-in-range]": __spreadValues$9({
        backgroundColor: Sn.background,
        borderRadius: 0
      }, _e.fn.hover({ backgroundColor: Sn.hover })),
      "&[data-first-in-range]": {
        borderRadius: 0,
        borderTopLeftRadius: _e.radius.sm,
        borderBottomLeftRadius: _e.radius.sm
      },
      "&[data-last-in-range]": {
        borderRadius: 0,
        borderTopRightRadius: _e.radius.sm,
        borderBottomRightRadius: _e.radius.sm
      },
      "&[data-last-in-range][data-first-in-range]": {
        borderRadius: _e.radius.sm
      },
      "&[data-selected]": __spreadValues$9({
        color: $n.color,
        backgroundColor: $n.background
      }, _e.fn.hover({ backgroundColor: $n.hover })),
      "&[data-disabled]": __spreadProps$3(__spreadValues$9({
        color: _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[4],
        cursor: "not-allowed"
      }, _e.fn.hover({ backgroundColor: "transparent" })), {
        "&:active": {
          transform: "none"
        }
      })
    })
  };
});
const useStyles$b = useStyles$a;
var __defProp$8 = Object.defineProperty, __getOwnPropSymbols$9 = Object.getOwnPropertySymbols, __hasOwnProp$9 = Object.prototype.hasOwnProperty, __propIsEnum$9 = Object.prototype.propertyIsEnumerable, __defNormalProp$8 = (_e, Qt, Zt) => Qt in _e ? __defProp$8(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$8 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$9.call(Qt, Zt) && __defNormalProp$8(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$9)
    for (var Zt of __getOwnPropSymbols$9(Qt))
      __propIsEnum$9.call(Qt, Zt) && __defNormalProp$8(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$9 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$9.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$9)
    for (var $n of __getOwnPropSymbols$9(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$9.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$9 = {
  size: "sm"
}, PickerControl = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("PickerControl", defaultProps$9, _e), {
    className: $n,
    children: Sn,
    disabled: kn,
    selected: Kn,
    classNames: er,
    styles: Cr,
    unstyled: kr,
    firstInRange: Yr,
    lastInRange: Ms,
    inRange: Ds,
    __staticSelector: Ls,
    size: js,
    variant: zs
  } = Zt, Fs = __objRest$9(Zt, [
    "className",
    "children",
    "disabled",
    "selected",
    "classNames",
    "styles",
    "unstyled",
    "firstInRange",
    "lastInRange",
    "inRange",
    "__staticSelector",
    "size",
    "variant"
  ]), { classes: Bs, cx: Hs } = useStyles$b(null, {
    name: ["PickerControl", Ls],
    classNames: er,
    styles: Cr,
    unstyled: kr,
    variant: zs,
    size: js
  });
  return /* @__PURE__ */ React.createElement(UnstyledButton, __spreadValues$8({
    className: Hs(Bs.pickerControl, $n),
    ref: Qt,
    unstyled: kr,
    "data-picker-control": !0,
    "data-selected": Kn && !kn || void 0,
    "data-disabled": kn || void 0,
    "data-in-range": Ds && !kn && !Kn || void 0,
    "data-first-in-range": Yr && !kn || void 0,
    "data-last-in-range": Ms && !kn || void 0,
    disabled: kn
  }, Fs), Sn);
});
PickerControl.displayName = "@mantine/dates/PickerControl";
var __defProp$7 = Object.defineProperty, __defProps$2 = Object.defineProperties, __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$8 = Object.getOwnPropertySymbols, __hasOwnProp$8 = Object.prototype.hasOwnProperty, __propIsEnum$8 = Object.prototype.propertyIsEnumerable, __defNormalProp$7 = (_e, Qt, Zt) => Qt in _e ? __defProp$7(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$7 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$8.call(Qt, Zt) && __defNormalProp$7(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$8)
    for (var Zt of __getOwnPropSymbols$8(Qt))
      __propIsEnum$8.call(Qt, Zt) && __defNormalProp$7(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$2 = (_e, Qt) => __defProps$2(_e, __getOwnPropDescs$2(Qt)), __objRest$8 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$8.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$8)
    for (var $n of __getOwnPropSymbols$8(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$8.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$8 = {
  monthsListFormat: "MMM",
  size: "sm",
  withCellSpacing: !0
}, MonthsList = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("MonthsList", defaultProps$8, _e), {
    year: $n,
    className: Sn,
    monthsListFormat: kn,
    locale: Kn,
    minDate: er,
    maxDate: Cr,
    getMonthControlProps: kr,
    classNames: Yr,
    styles: Ms,
    unstyled: Ds,
    __staticSelector: Ls,
    __getControlRef: js,
    __onControlKeyDown: zs,
    __onControlClick: Fs,
    __onControlMouseEnter: Bs,
    __preventFocus: Hs,
    size: Ws,
    variant: Ys,
    __stopPropagation: El,
    withCellSpacing: Mu
  } = Zt, Pl = __objRest$8(Zt, [
    "year",
    "className",
    "monthsListFormat",
    "locale",
    "minDate",
    "maxDate",
    "getMonthControlProps",
    "classNames",
    "styles",
    "unstyled",
    "__staticSelector",
    "__getControlRef",
    "__onControlKeyDown",
    "__onControlClick",
    "__onControlMouseEnter",
    "__preventFocus",
    "size",
    "variant",
    "__stopPropagation",
    "withCellSpacing"
  ]), { classes: Iu, cx: Tu } = useStyles$d(null, {
    name: ["MonthsList", Ls],
    classNames: Yr,
    styles: Ms,
    unstyled: Ds,
    variant: Ys,
    size: Ws
  }), Au = useDatesContext(), Nu = getMonthsData($n), gm = getMonthInTabOrder(Nu, er, Cr, kr), pm = Nu.map((zu, Yu) => {
    const sm = zu.map((mm, hm) => {
      const ym = kr == null ? void 0 : kr(mm), _m = dayjs(mm).isSame(gm, "month");
      return /* @__PURE__ */ React.createElement("td", {
        key: hm,
        className: Iu.monthsListCell,
        "data-with-spacing": Mu || void 0
      }, /* @__PURE__ */ React.createElement(PickerControl, __spreadProps$2(__spreadValues$7({
        variant: Ys,
        size: Ws,
        classNames: Yr,
        styles: Ms,
        unstyled: Ds,
        __staticSelector: Ls || "MonthsList",
        "data-mantine-stop-propagation": El || void 0,
        disabled: isMonthDisabled(mm, er, Cr),
        ref: (Sm) => js == null ? void 0 : js(Yu, hm, Sm)
      }, ym), {
        onKeyDown: (Sm) => {
          var wm;
          (wm = ym == null ? void 0 : ym.onKeyDown) == null || wm.call(ym, Sm), zs == null || zs(Sm, { rowIndex: Yu, cellIndex: hm, date: mm });
        },
        onClick: (Sm) => {
          var wm;
          (wm = ym == null ? void 0 : ym.onClick) == null || wm.call(ym, Sm), Fs == null || Fs(Sm, mm);
        },
        onMouseEnter: (Sm) => {
          var wm;
          (wm = ym == null ? void 0 : ym.onMouseEnter) == null || wm.call(ym, Sm), Bs == null || Bs(Sm, mm);
        },
        onMouseDown: (Sm) => {
          var wm;
          (wm = ym == null ? void 0 : ym.onMouseDown) == null || wm.call(ym, Sm), Hs && Sm.preventDefault();
        },
        tabIndex: Hs || !_m ? -1 : 0
      }), dayjs(mm).locale(Au.getLocale(Kn)).format(kn)));
    });
    return /* @__PURE__ */ React.createElement("tr", {
      key: Yu,
      className: Iu.monthsListRow
    }, sm);
  });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$7({
    component: "table",
    ref: Qt,
    className: Tu(Iu.monthsList, Sn)
  }, Pl), /* @__PURE__ */ React.createElement("tbody", null, pm));
});
MonthsList.displayName = "@mantine/dates/MonthsList";
var __defProp$6 = Object.defineProperty, __getOwnPropSymbols$7 = Object.getOwnPropertySymbols, __hasOwnProp$7 = Object.prototype.hasOwnProperty, __propIsEnum$7 = Object.prototype.propertyIsEnumerable, __defNormalProp$6 = (_e, Qt, Zt) => Qt in _e ? __defProp$6(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$6 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$7.call(Qt, Zt) && __defNormalProp$6(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$7)
    for (var Zt of __getOwnPropSymbols$7(Qt))
      __propIsEnum$7.call(Qt, Zt) && __defNormalProp$6(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$7 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$7.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$7)
    for (var $n of __getOwnPropSymbols$7(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$7.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$7 = {
  yearLabelFormat: "YYYY",
  size: "sm"
}, YearLevel = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("YearLevel", defaultProps$7, _e), {
    year: $n,
    locale: Sn,
    minDate: kn,
    maxDate: Kn,
    monthsListFormat: er,
    getMonthControlProps: Cr,
    __getControlRef: kr,
    __onControlKeyDown: Yr,
    __onControlClick: Ms,
    __onControlMouseEnter: Ds,
    withCellSpacing: Ls,
    __preventFocus: js,
    nextIcon: zs,
    previousIcon: Fs,
    nextLabel: Bs,
    previousLabel: Hs,
    onNext: Ws,
    onPrevious: Ys,
    onLevelClick: El,
    nextDisabled: Mu,
    previousDisabled: Pl,
    hasNextLevel: Iu,
    levelControlAriaLabel: Tu,
    withNext: Au,
    withPrevious: Nu,
    className: gm,
    yearLabelFormat: pm,
    classNames: zu,
    styles: Yu,
    unstyled: sm,
    __staticSelector: mm,
    __stopPropagation: hm,
    size: ym,
    variant: _m
  } = Zt, Sm = __objRest$7(Zt, [
    "year",
    "locale",
    "minDate",
    "maxDate",
    "monthsListFormat",
    "getMonthControlProps",
    "__getControlRef",
    "__onControlKeyDown",
    "__onControlClick",
    "__onControlMouseEnter",
    "withCellSpacing",
    "__preventFocus",
    "nextIcon",
    "previousIcon",
    "nextLabel",
    "previousLabel",
    "onNext",
    "onPrevious",
    "onLevelClick",
    "nextDisabled",
    "previousDisabled",
    "hasNextLevel",
    "levelControlAriaLabel",
    "withNext",
    "withPrevious",
    "className",
    "yearLabelFormat",
    "classNames",
    "styles",
    "unstyled",
    "__staticSelector",
    "__stopPropagation",
    "size",
    "variant"
  ]), { classes: wm, cx: Nm } = useStyles$f(null, {
    name: ["YearLevel", mm],
    classNames: zu,
    styles: Yu,
    unstyled: sm,
    size: ym,
    variant: _m
  }), Cm = useDatesContext(), Im = {
    __staticSelector: mm || "YearLevel",
    classNames: zu,
    styles: Yu,
    unstyled: sm,
    size: ym,
    variant: _m
  }, Am = typeof Mu == "boolean" ? Mu : Kn ? !dayjs($n).endOf("year").isBefore(Kn) : !1, Vm = typeof Pl == "boolean" ? Pl : kn ? !dayjs($n).startOf("year").isAfter(kn) : !1;
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$6({
    className: Nm(wm.yearLevel, gm),
    "data-year-level": !0,
    ref: Qt
  }, Sm), /* @__PURE__ */ React.createElement(CalendarHeader, __spreadValues$6({
    label: typeof pm == "function" ? pm($n) : dayjs($n).locale(Sn || Cm.locale).format(pm),
    className: wm.calendarHeader,
    __preventFocus: js,
    __stopPropagation: hm,
    nextIcon: zs,
    previousIcon: Fs,
    nextLabel: Bs,
    previousLabel: Hs,
    onNext: Ws,
    onPrevious: Ys,
    onLevelClick: El,
    nextDisabled: Am,
    previousDisabled: Vm,
    hasNextLevel: Iu,
    levelControlAriaLabel: Tu,
    withNext: Au,
    withPrevious: Nu
  }, Im)), /* @__PURE__ */ React.createElement(MonthsList, __spreadValues$6({
    year: $n,
    locale: Sn,
    minDate: kn,
    maxDate: Kn,
    monthsListFormat: er,
    getMonthControlProps: Cr,
    __getControlRef: kr,
    __onControlKeyDown: Yr,
    __onControlClick: Ms,
    __onControlMouseEnter: Ds,
    __preventFocus: js,
    __stopPropagation: hm,
    withCellSpacing: Ls
  }, Im)));
});
YearLevel.displayName = "@mantine/dates/YearLevel";
var __defProp$5 = Object.defineProperty, __getOwnPropSymbols$6 = Object.getOwnPropertySymbols, __hasOwnProp$6 = Object.prototype.hasOwnProperty, __propIsEnum$6 = Object.prototype.propertyIsEnumerable, __defNormalProp$5 = (_e, Qt, Zt) => Qt in _e ? __defProp$5(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$5 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$6.call(Qt, Zt) && __defNormalProp$5(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$6)
    for (var Zt of __getOwnPropSymbols$6(Qt))
      __propIsEnum$6.call(Qt, Zt) && __defNormalProp$5(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$6 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$6.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$6)
    for (var $n of __getOwnPropSymbols$6(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$6.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$6 = {
  numberOfColumns: 1,
  size: "sm"
}, YearLevelGroup = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("YearLevelGroup", defaultProps$6, _e), {
    year: $n,
    locale: Sn,
    minDate: kn,
    maxDate: Kn,
    monthsListFormat: er,
    getMonthControlProps: Cr,
    __onControlClick: kr,
    __onControlMouseEnter: Yr,
    withCellSpacing: Ms,
    __preventFocus: Ds,
    nextIcon: Ls,
    previousIcon: js,
    nextLabel: zs,
    previousLabel: Fs,
    onNext: Bs,
    onPrevious: Hs,
    onLevelClick: Ws,
    nextDisabled: Ys,
    previousDisabled: El,
    hasNextLevel: Mu,
    className: Pl,
    classNames: Iu,
    styles: Tu,
    unstyled: Au,
    __staticSelector: Nu,
    __stopPropagation: gm,
    numberOfColumns: pm,
    levelControlAriaLabel: zu,
    yearLabelFormat: Yu,
    variant: sm,
    size: mm
  } = Zt, hm = __objRest$6(Zt, [
    "year",
    "locale",
    "minDate",
    "maxDate",
    "monthsListFormat",
    "getMonthControlProps",
    "__onControlClick",
    "__onControlMouseEnter",
    "withCellSpacing",
    "__preventFocus",
    "nextIcon",
    "previousIcon",
    "nextLabel",
    "previousLabel",
    "onNext",
    "onPrevious",
    "onLevelClick",
    "nextDisabled",
    "previousDisabled",
    "hasNextLevel",
    "className",
    "classNames",
    "styles",
    "unstyled",
    "__staticSelector",
    "__stopPropagation",
    "numberOfColumns",
    "levelControlAriaLabel",
    "yearLabelFormat",
    "variant",
    "size"
  ]), { classes: ym, cx: _m } = useStyles$h(null, {
    name: ["YearLevelGroup", Nu],
    styles: Tu,
    classNames: Iu,
    unstyled: Au,
    variant: sm,
    size: mm
  }), Sm = reactExports.useRef([]), wm = Array(pm).fill(0).map((Nm, Cm) => {
    const Im = dayjs($n).add(Cm, "years").toDate();
    return /* @__PURE__ */ React.createElement(YearLevel, {
      key: Cm,
      variant: sm,
      size: mm,
      monthsListFormat: er,
      year: Im,
      withNext: Cm === pm - 1,
      withPrevious: Cm === 0,
      yearLabelFormat: Yu,
      __stopPropagation: gm,
      __onControlClick: kr,
      __onControlMouseEnter: Yr,
      __onControlKeyDown: (Am, Vm) => handleControlKeyDown({
        levelIndex: Cm,
        rowIndex: Vm.rowIndex,
        cellIndex: Vm.cellIndex,
        event: Am,
        controlsRef: Sm
      }),
      __getControlRef: (Am, Vm, Rm) => {
        Array.isArray(Sm.current[Cm]) || (Sm.current[Cm] = []), Array.isArray(Sm.current[Cm][Am]) || (Sm.current[Cm][Am] = []), Sm.current[Cm][Am][Vm] = Rm;
      },
      levelControlAriaLabel: typeof zu == "function" ? zu(Im) : zu,
      locale: Sn,
      minDate: kn,
      maxDate: Kn,
      __preventFocus: Ds,
      nextIcon: Ls,
      previousIcon: js,
      nextLabel: zs,
      previousLabel: Fs,
      onNext: Bs,
      onPrevious: Hs,
      onLevelClick: Ws,
      nextDisabled: Ys,
      previousDisabled: El,
      hasNextLevel: Mu,
      getMonthControlProps: Cr,
      classNames: Iu,
      styles: Tu,
      unstyled: Au,
      __staticSelector: Nu || "YearLevelGroup",
      withCellSpacing: Ms
    });
  });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$5({
    className: _m(ym.yearLevelGroup, Pl),
    ref: Qt
  }, hm), wm);
});
YearLevelGroup.displayName = "@mantine/dates/YearLevelGroup";
var useStyles$8 = createStyles((_e) => ({
  decadeLevelGroup: {
    display: "flex",
    gap: _e.spacing.md
  }
}));
const useStyles$9 = useStyles$8;
function getYearsData(_e) {
  const Qt = _e.getFullYear(), Zt = Qt - Qt % 10;
  let $n = 0;
  const Sn = [[], [], [], []];
  for (let kn = 0; kn < 4; kn += 1) {
    const Kn = kn === 3 ? 1 : 3;
    for (let er = 0; er < Kn; er += 1)
      Sn[kn].push(new Date(Zt + $n, 0)), $n += 1;
  }
  return Sn;
}
function getDecadeRange(_e) {
  const Qt = getYearsData(_e);
  return [Qt[0][0], Qt[3][0]];
}
var useStyles$6 = createStyles((_e) => ({
  decadeLevel: {},
  calendarHeader: {
    marginBottom: _e.spacing.xs
  }
}));
const useStyles$7 = useStyles$6;
function isYearDisabled(_e, Qt, Zt) {
  return !Qt && !Zt ? !1 : !!(Qt && dayjs(_e).isBefore(Qt, "year") || Zt && dayjs(_e).isAfter(Zt, "year"));
}
var useStyles$4 = createStyles(() => ({
  yearsList: {
    borderCollapse: "collapse",
    borderWidth: 0
  },
  yearsListCell: {
    padding: 0,
    "&[data-with-spacing]": {
      padding: rem$1(0.5)
    }
  },
  yearsListRow: {}
}));
const useStyles$5 = useStyles$4;
function getYearInTabOrder(_e, Qt, Zt, $n) {
  const Sn = _e.flat().filter((er) => {
    var Cr;
    return !isYearDisabled(er, Qt, Zt) && !((Cr = $n == null ? void 0 : $n(er)) != null && Cr.disabled);
  }), kn = Sn.find((er) => {
    var Cr;
    return (Cr = $n == null ? void 0 : $n(er)) == null ? void 0 : Cr.selected;
  });
  if (kn)
    return kn;
  const Kn = Sn.find((er) => dayjs().isSame(er, "year"));
  return Kn || Sn[0];
}
var __defProp$4 = Object.defineProperty, __defProps$1 = Object.defineProperties, __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$5 = Object.getOwnPropertySymbols, __hasOwnProp$5 = Object.prototype.hasOwnProperty, __propIsEnum$5 = Object.prototype.propertyIsEnumerable, __defNormalProp$4 = (_e, Qt, Zt) => Qt in _e ? __defProp$4(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$4 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$5.call(Qt, Zt) && __defNormalProp$4(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$5)
    for (var Zt of __getOwnPropSymbols$5(Qt))
      __propIsEnum$5.call(Qt, Zt) && __defNormalProp$4(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps$1 = (_e, Qt) => __defProps$1(_e, __getOwnPropDescs$1(Qt)), __objRest$5 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$5.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$5)
    for (var $n of __getOwnPropSymbols$5(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$5.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$5 = {
  yearsListFormat: "YYYY",
  size: "sm",
  withCellSpacing: !0
}, YearsList = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("YearsList", defaultProps$5, _e), {
    decade: $n,
    className: Sn,
    yearsListFormat: kn,
    locale: Kn,
    minDate: er,
    maxDate: Cr,
    getYearControlProps: kr,
    classNames: Yr,
    styles: Ms,
    unstyled: Ds,
    __staticSelector: Ls,
    __getControlRef: js,
    __onControlKeyDown: zs,
    __onControlClick: Fs,
    __onControlMouseEnter: Bs,
    __preventFocus: Hs,
    __stopPropagation: Ws,
    size: Ys,
    variant: El,
    withCellSpacing: Mu
  } = Zt, Pl = __objRest$5(Zt, [
    "decade",
    "className",
    "yearsListFormat",
    "locale",
    "minDate",
    "maxDate",
    "getYearControlProps",
    "classNames",
    "styles",
    "unstyled",
    "__staticSelector",
    "__getControlRef",
    "__onControlKeyDown",
    "__onControlClick",
    "__onControlMouseEnter",
    "__preventFocus",
    "__stopPropagation",
    "size",
    "variant",
    "withCellSpacing"
  ]), { classes: Iu, cx: Tu } = useStyles$5(null, {
    name: ["YearsList", Ls],
    classNames: Yr,
    styles: Ms,
    unstyled: Ds,
    variant: El,
    size: Ys
  }), Au = useDatesContext(), Nu = getYearsData($n), gm = getYearInTabOrder(Nu, er, Cr, kr), pm = Nu.map((zu, Yu) => {
    const sm = zu.map((mm, hm) => {
      const ym = kr == null ? void 0 : kr(mm), _m = dayjs(mm).isSame(gm, "year");
      return /* @__PURE__ */ React.createElement("td", {
        key: hm,
        className: Iu.yearsListCell,
        "data-with-spacing": Mu || void 0
      }, /* @__PURE__ */ React.createElement(PickerControl, __spreadProps$1(__spreadValues$4({
        size: Ys,
        variant: El,
        classNames: Yr,
        styles: Ms,
        unstyled: Ds,
        __staticSelector: Ls || "YearsList",
        "data-mantine-stop-propagation": Ws || void 0,
        disabled: isYearDisabled(mm, er, Cr),
        ref: (Sm) => js == null ? void 0 : js(Yu, hm, Sm)
      }, ym), {
        onKeyDown: (Sm) => {
          var wm;
          (wm = ym == null ? void 0 : ym.onKeyDown) == null || wm.call(ym, Sm), zs == null || zs(Sm, { rowIndex: Yu, cellIndex: hm, date: mm });
        },
        onClick: (Sm) => {
          var wm;
          (wm = ym == null ? void 0 : ym.onClick) == null || wm.call(ym, Sm), Fs == null || Fs(Sm, mm);
        },
        onMouseEnter: (Sm) => {
          var wm;
          (wm = ym == null ? void 0 : ym.onMouseEnter) == null || wm.call(ym, Sm), Bs == null || Bs(Sm, mm);
        },
        onMouseDown: (Sm) => {
          var wm;
          (wm = ym == null ? void 0 : ym.onMouseDown) == null || wm.call(ym, Sm), Hs && Sm.preventDefault();
        },
        tabIndex: Hs || !_m ? -1 : 0
      }), dayjs(mm).locale(Au.getLocale(Kn)).format(kn)));
    });
    return /* @__PURE__ */ React.createElement("tr", {
      key: Yu,
      className: Iu.yearsListRow
    }, sm);
  });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$4({
    component: "table",
    ref: Qt,
    className: Tu(Iu.yearsList, Sn)
  }, Pl), /* @__PURE__ */ React.createElement("tbody", null, pm));
});
YearsList.displayName = "@mantine/dates/YearsList";
var __defProp$3 = Object.defineProperty, __getOwnPropSymbols$4 = Object.getOwnPropertySymbols, __hasOwnProp$4 = Object.prototype.hasOwnProperty, __propIsEnum$4 = Object.prototype.propertyIsEnumerable, __defNormalProp$3 = (_e, Qt, Zt) => Qt in _e ? __defProp$3(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$3 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$4.call(Qt, Zt) && __defNormalProp$3(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$4)
    for (var Zt of __getOwnPropSymbols$4(Qt))
      __propIsEnum$4.call(Qt, Zt) && __defNormalProp$3(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$4 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$4.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$4)
    for (var $n of __getOwnPropSymbols$4(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$4.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$4 = {
  decadeLabelFormat: "YYYY"
}, DecadeLevel = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("DecadeLevel", defaultProps$4, _e), {
    decade: $n,
    locale: Sn,
    minDate: kn,
    maxDate: Kn,
    yearsListFormat: er,
    getYearControlProps: Cr,
    __getControlRef: kr,
    __onControlKeyDown: Yr,
    __onControlClick: Ms,
    __onControlMouseEnter: Ds,
    withCellSpacing: Ls,
    __preventFocus: js,
    nextIcon: zs,
    previousIcon: Fs,
    nextLabel: Bs,
    previousLabel: Hs,
    onNext: Ws,
    onPrevious: Ys,
    nextDisabled: El,
    previousDisabled: Mu,
    levelControlAriaLabel: Pl,
    withNext: Iu,
    withPrevious: Tu,
    className: Au,
    decadeLabelFormat: Nu,
    classNames: gm,
    styles: pm,
    unstyled: zu,
    __staticSelector: Yu,
    __stopPropagation: sm,
    variant: mm,
    size: hm
  } = Zt, ym = __objRest$4(Zt, [
    "decade",
    "locale",
    "minDate",
    "maxDate",
    "yearsListFormat",
    "getYearControlProps",
    "__getControlRef",
    "__onControlKeyDown",
    "__onControlClick",
    "__onControlMouseEnter",
    "withCellSpacing",
    "__preventFocus",
    "nextIcon",
    "previousIcon",
    "nextLabel",
    "previousLabel",
    "onNext",
    "onPrevious",
    "nextDisabled",
    "previousDisabled",
    "levelControlAriaLabel",
    "withNext",
    "withPrevious",
    "className",
    "decadeLabelFormat",
    "classNames",
    "styles",
    "unstyled",
    "__staticSelector",
    "__stopPropagation",
    "variant",
    "size"
  ]), { classes: _m, cx: Sm } = useStyles$7(null, {
    name: ["DecadeLevel", Yu],
    classNames: gm,
    styles: pm,
    unstyled: zu,
    variant: mm,
    size: hm
  }), wm = useDatesContext(), [Nm, Cm] = getDecadeRange($n), Im = {
    __staticSelector: Yu || "DecadeLevel",
    classNames: gm,
    styles: pm,
    unstyled: zu,
    variant: mm,
    size: hm
  }, Am = typeof El == "boolean" ? El : Kn ? !dayjs(Cm).endOf("year").isBefore(Kn) : !1, Vm = typeof Mu == "boolean" ? Mu : kn ? !dayjs(Nm).startOf("year").isAfter(kn) : !1, Rm = (Dm, km) => dayjs(Dm).locale(Sn || wm.locale).format(km);
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$3({
    className: Sm(_m.decadeLevel, Au),
    "data-decade-level": !0,
    ref: Qt
  }, ym), /* @__PURE__ */ React.createElement(CalendarHeader, __spreadValues$3({
    label: typeof Nu == "function" ? Nu(Nm, Cm) : `${Rm(Nm, Nu)} – ${Rm(Cm, Nu)}`,
    className: _m.calendarHeader,
    __preventFocus: js,
    __stopPropagation: sm,
    nextIcon: zs,
    previousIcon: Fs,
    nextLabel: Bs,
    previousLabel: Hs,
    onNext: Ws,
    onPrevious: Ys,
    nextDisabled: Am,
    previousDisabled: Vm,
    hasNextLevel: !1,
    levelControlAriaLabel: Pl,
    withNext: Iu,
    withPrevious: Tu
  }, Im)), /* @__PURE__ */ React.createElement(YearsList, __spreadValues$3({
    decade: $n,
    locale: Sn,
    minDate: kn,
    maxDate: Kn,
    yearsListFormat: er,
    getYearControlProps: Cr,
    __getControlRef: kr,
    __onControlKeyDown: Yr,
    __onControlClick: Ms,
    __onControlMouseEnter: Ds,
    __preventFocus: js,
    __stopPropagation: sm,
    withCellSpacing: Ls
  }, Im)));
});
DecadeLevel.displayName = "@mantine/dates/DecadeLevel";
var __defProp$2 = Object.defineProperty, __getOwnPropSymbols$3 = Object.getOwnPropertySymbols, __hasOwnProp$3 = Object.prototype.hasOwnProperty, __propIsEnum$3 = Object.prototype.propertyIsEnumerable, __defNormalProp$2 = (_e, Qt, Zt) => Qt in _e ? __defProp$2(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$2 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$3.call(Qt, Zt) && __defNormalProp$2(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$3)
    for (var Zt of __getOwnPropSymbols$3(Qt))
      __propIsEnum$3.call(Qt, Zt) && __defNormalProp$2(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$3 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$3.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$3)
    for (var $n of __getOwnPropSymbols$3(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$3.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$3 = {
  numberOfColumns: 1
}, DecadeLevelGroup = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("DecadeLevelGroup", defaultProps$3, _e), {
    decade: $n,
    locale: Sn,
    minDate: kn,
    maxDate: Kn,
    yearsListFormat: er,
    getYearControlProps: Cr,
    __onControlClick: kr,
    __onControlMouseEnter: Yr,
    withCellSpacing: Ms,
    __preventFocus: Ds,
    nextIcon: Ls,
    previousIcon: js,
    nextLabel: zs,
    previousLabel: Fs,
    onNext: Bs,
    onPrevious: Hs,
    nextDisabled: Ws,
    previousDisabled: Ys,
    className: El,
    classNames: Mu,
    styles: Pl,
    unstyled: Iu,
    __staticSelector: Tu,
    __stopPropagation: Au,
    numberOfColumns: Nu,
    levelControlAriaLabel: gm,
    decadeLabelFormat: pm,
    variant: zu,
    size: Yu
  } = Zt, sm = __objRest$3(Zt, [
    "decade",
    "locale",
    "minDate",
    "maxDate",
    "yearsListFormat",
    "getYearControlProps",
    "__onControlClick",
    "__onControlMouseEnter",
    "withCellSpacing",
    "__preventFocus",
    "nextIcon",
    "previousIcon",
    "nextLabel",
    "previousLabel",
    "onNext",
    "onPrevious",
    "nextDisabled",
    "previousDisabled",
    "className",
    "classNames",
    "styles",
    "unstyled",
    "__staticSelector",
    "__stopPropagation",
    "numberOfColumns",
    "levelControlAriaLabel",
    "decadeLabelFormat",
    "variant",
    "size"
  ]), { classes: mm, cx: hm } = useStyles$9(null, {
    name: ["DecadeLevelGroup", Tu],
    styles: Pl,
    classNames: Mu,
    unstyled: Iu,
    variant: zu,
    size: Yu
  }), ym = reactExports.useRef([]), _m = Array(Nu).fill(0).map((Sm, wm) => {
    const Nm = dayjs($n).add(wm * 10, "years").toDate();
    return /* @__PURE__ */ React.createElement(DecadeLevel, {
      key: wm,
      variant: zu,
      size: Yu,
      yearsListFormat: er,
      decade: Nm,
      withNext: wm === Nu - 1,
      withPrevious: wm === 0,
      decadeLabelFormat: pm,
      __onControlClick: kr,
      __onControlMouseEnter: Yr,
      __onControlKeyDown: (Cm, Im) => handleControlKeyDown({
        levelIndex: wm,
        rowIndex: Im.rowIndex,
        cellIndex: Im.cellIndex,
        event: Cm,
        controlsRef: ym
      }),
      __getControlRef: (Cm, Im, Am) => {
        Array.isArray(ym.current[wm]) || (ym.current[wm] = []), Array.isArray(ym.current[wm][Cm]) || (ym.current[wm][Cm] = []), ym.current[wm][Cm][Im] = Am;
      },
      levelControlAriaLabel: typeof gm == "function" ? gm(Nm) : gm,
      locale: Sn,
      minDate: kn,
      maxDate: Kn,
      __preventFocus: Ds,
      __stopPropagation: Au,
      nextIcon: Ls,
      previousIcon: js,
      nextLabel: zs,
      previousLabel: Fs,
      onNext: Bs,
      onPrevious: Hs,
      nextDisabled: Ws,
      previousDisabled: Ys,
      getYearControlProps: Cr,
      __staticSelector: Tu || "DecadeLevelGroup",
      classNames: Mu,
      styles: Pl,
      unstyled: Iu,
      withCellSpacing: Ms
    });
  });
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$2({
    className: hm(mm.decadeLevelGroup, El),
    ref: Qt
  }, sm), _m);
});
DecadeLevelGroup.displayName = "@mantine/dates/DecadeLevelGroup";
var __defProp$1 = Object.defineProperty, __getOwnPropSymbols$2 = Object.getOwnPropertySymbols, __hasOwnProp$2 = Object.prototype.hasOwnProperty, __propIsEnum$2 = Object.prototype.propertyIsEnumerable, __defNormalProp$1 = (_e, Qt, Zt) => Qt in _e ? __defProp$1(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues$1 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp$2.call(Qt, Zt) && __defNormalProp$1(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols$2)
    for (var Zt of __getOwnPropSymbols$2(Qt))
      __propIsEnum$2.call(Qt, Zt) && __defNormalProp$1(_e, Zt, Qt[Zt]);
  return _e;
}, __objRest$2 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$2.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$2)
    for (var $n of __getOwnPropSymbols$2(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$2.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$2 = {
  maxLevel: "decade",
  minLevel: "month",
  __updateDateOnYearSelect: !0,
  __updateDateOnMonthSelect: !0
}, Calendar = reactExports.forwardRef((_e, Qt) => {
  const Zt = useComponentDefaultProps("Calendar", defaultProps$2, _e), {
    maxLevel: $n,
    minLevel: Sn,
    defaultLevel: kn,
    level: Kn,
    onLevelChange: er,
    date: Cr,
    defaultDate: kr,
    onDateChange: Yr,
    numberOfColumns: Ms,
    columnsToScroll: Ds,
    ariaLabels: Ls,
    onYearSelect: js,
    onMonthSelect: zs,
    onYearMouseEnter: Fs,
    onMonthMouseEnter: Bs,
    __updateDateOnYearSelect: Hs,
    __updateDateOnMonthSelect: Ws,
    firstDayOfWeek: Ys,
    weekdayFormat: El,
    weekendDays: Mu,
    getDayProps: Pl,
    excludeDate: Iu,
    renderDay: Tu,
    hideOutsideDates: Au,
    hideWeekdays: Nu,
    getDayAriaLabel: gm,
    monthLabelFormat: pm,
    nextIcon: zu,
    previousIcon: Yu,
    __onDayClick: sm,
    __onDayMouseEnter: mm,
    withCellSpacing: hm,
    monthsListFormat: ym,
    getMonthControlProps: _m,
    yearLabelFormat: Sm,
    yearsListFormat: wm,
    getYearControlProps: Nm,
    decadeLabelFormat: Cm,
    minDate: Im,
    maxDate: Am,
    locale: Vm,
    className: Rm,
    classNames: Dm,
    styles: km,
    __staticSelector: zm,
    unstyled: Pm,
    variant: i$,
    size: o$,
    __preventFocus: u$,
    __stopPropagation: h$,
    onNextDecade: d$,
    onPreviousDecade: v$,
    onNextYear: $$,
    onPreviousYear: s$,
    onNextMonth: l$,
    onPreviousMonth: _$,
    static: a$
  } = Zt, n$ = __objRest$2(Zt, [
    "maxLevel",
    "minLevel",
    "defaultLevel",
    "level",
    "onLevelChange",
    "date",
    "defaultDate",
    "onDateChange",
    "numberOfColumns",
    "columnsToScroll",
    "ariaLabels",
    "onYearSelect",
    "onMonthSelect",
    "onYearMouseEnter",
    "onMonthMouseEnter",
    "__updateDateOnYearSelect",
    "__updateDateOnMonthSelect",
    "firstDayOfWeek",
    "weekdayFormat",
    "weekendDays",
    "getDayProps",
    "excludeDate",
    "renderDay",
    "hideOutsideDates",
    "hideWeekdays",
    "getDayAriaLabel",
    "monthLabelFormat",
    "nextIcon",
    "previousIcon",
    "__onDayClick",
    "__onDayMouseEnter",
    "withCellSpacing",
    "monthsListFormat",
    "getMonthControlProps",
    "yearLabelFormat",
    "yearsListFormat",
    "getYearControlProps",
    "decadeLabelFormat",
    "minDate",
    "maxDate",
    "locale",
    "className",
    "classNames",
    "styles",
    "__staticSelector",
    "unstyled",
    "variant",
    "size",
    "__preventFocus",
    "__stopPropagation",
    "onNextDecade",
    "onPreviousDecade",
    "onNextYear",
    "onPreviousYear",
    "onNextMonth",
    "onPreviousMonth",
    "static"
  ]), { classes: m$, cx: j$ } = useStyles$r(null, {
    name: ["Calendar", zm],
    classNames: Dm,
    styles: km,
    unstyled: Pm,
    variant: i$,
    size: o$
  }), [Q$, z$] = useUncontrolled({
    value: Kn ? clampLevel(Kn, Sn, $n) : void 0,
    defaultValue: kn ? clampLevel(kn, Sn, $n) : void 0,
    finalValue: clampLevel(void 0, Sn, $n),
    onChange: er
  }), [wS, aS] = useUncontrolled({
    value: Cr,
    defaultValue: kr,
    finalValue: null,
    onChange: Yr
  }), cS = {
    __staticSelector: zm || "Calendar",
    styles: km,
    classNames: Dm,
    unstyled: Pm,
    variant: i$,
    size: o$
  }, $S = Ds || Ms || 1, B$ = wS || /* @__PURE__ */ new Date(), IS = () => {
    const G$ = dayjs(B$).add($S, "month").toDate();
    l$ == null || l$(G$), aS(G$);
  }, RS = () => {
    const G$ = dayjs(B$).subtract($S, "month").toDate();
    _$ == null || _$(G$), aS(G$);
  }, eE = () => {
    const G$ = dayjs(B$).add($S, "year").toDate();
    $$ == null || $$(G$), aS(G$);
  }, rS = () => {
    const G$ = dayjs(B$).subtract($S, "year").toDate();
    s$ == null || s$(G$), aS(G$);
  }, sS = () => {
    const G$ = dayjs(B$).add(10 * $S, "year").toDate();
    d$ == null || d$(G$), aS(G$);
  }, PS = () => {
    const G$ = dayjs(B$).subtract(10 * $S, "year").toDate();
    v$ == null || v$(G$), aS(G$);
  };
  return /* @__PURE__ */ React.createElement(Box, __spreadValues$1({
    className: j$(m$.calendar, Rm),
    ref: Qt
  }, n$), Q$ === "month" && /* @__PURE__ */ React.createElement(MonthLevelGroup, __spreadValues$1({
    month: B$,
    minDate: Im,
    maxDate: Am,
    firstDayOfWeek: Ys,
    weekdayFormat: El,
    weekendDays: Mu,
    getDayProps: Pl,
    excludeDate: Iu,
    renderDay: Tu,
    hideOutsideDates: Au,
    hideWeekdays: Nu,
    getDayAriaLabel: gm,
    onNext: IS,
    onPrevious: RS,
    hasNextLevel: $n !== "month",
    onLevelClick: () => z$("year"),
    numberOfColumns: Ms,
    locale: Vm,
    levelControlAriaLabel: Ls == null ? void 0 : Ls.monthLevelControl,
    nextLabel: Ls == null ? void 0 : Ls.nextMonth,
    nextIcon: zu,
    previousLabel: Ls == null ? void 0 : Ls.previousMonth,
    previousIcon: Yu,
    monthLabelFormat: pm,
    __onDayClick: sm,
    __onDayMouseEnter: mm,
    __preventFocus: u$,
    __stopPropagation: h$,
    static: a$,
    withCellSpacing: hm
  }, cS)), Q$ === "year" && /* @__PURE__ */ React.createElement(YearLevelGroup, __spreadValues$1({
    year: B$,
    numberOfColumns: Ms,
    minDate: Im,
    maxDate: Am,
    monthsListFormat: ym,
    getMonthControlProps: _m,
    locale: Vm,
    onNext: eE,
    onPrevious: rS,
    hasNextLevel: $n !== "month" && $n !== "year",
    onLevelClick: () => z$("decade"),
    levelControlAriaLabel: Ls == null ? void 0 : Ls.yearLevelControl,
    nextLabel: Ls == null ? void 0 : Ls.nextYear,
    nextIcon: zu,
    previousLabel: Ls == null ? void 0 : Ls.previousYear,
    previousIcon: Yu,
    yearLabelFormat: Sm,
    __onControlMouseEnter: Bs,
    __onControlClick: (G$, tS) => {
      Ws && aS(tS), z$(clampLevel("month", Sn, $n)), zs == null || zs(tS);
    },
    __preventFocus: u$,
    __stopPropagation: h$,
    withCellSpacing: hm
  }, cS)), Q$ === "decade" && /* @__PURE__ */ React.createElement(DecadeLevelGroup, __spreadValues$1({
    decade: B$,
    minDate: Im,
    maxDate: Am,
    yearsListFormat: wm,
    getYearControlProps: Nm,
    locale: Vm,
    onNext: sS,
    onPrevious: PS,
    numberOfColumns: Ms,
    nextLabel: Ls == null ? void 0 : Ls.nextDecade,
    nextIcon: zu,
    previousLabel: Ls == null ? void 0 : Ls.previousDecade,
    previousIcon: Yu,
    decadeLabelFormat: Cm,
    __onControlMouseEnter: Fs,
    __onControlClick: (G$, tS) => {
      Hs && aS(tS), z$(clampLevel("year", Sn, $n)), js == null || js(tS);
    },
    __preventFocus: u$,
    __stopPropagation: h$,
    withCellSpacing: hm
  }, cS)));
});
Calendar.displayName = "@mantine/dates/Calendar";
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols, __hasOwnProp$1 = Object.prototype.hasOwnProperty, __propIsEnum$1 = Object.prototype.propertyIsEnumerable, __objRest$1 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp$1.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols$1)
    for (var $n of __getOwnPropSymbols$1(_e))
      Qt.indexOf($n) < 0 && __propIsEnum$1.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function pickCalendarProps(_e) {
  const Qt = _e, {
    maxLevel: Zt,
    minLevel: $n,
    defaultLevel: Sn,
    level: kn,
    onLevelChange: Kn,
    nextIcon: er,
    previousIcon: Cr,
    date: kr,
    defaultDate: Yr,
    onDateChange: Ms,
    numberOfColumns: Ds,
    columnsToScroll: Ls,
    ariaLabels: js,
    onYearSelect: zs,
    onMonthSelect: Fs,
    onYearMouseEnter: Bs,
    onMonthMouseEnter: Hs,
    onNextMonth: Ws,
    onPreviousMonth: Ys,
    onNextYear: El,
    onPreviousYear: Mu,
    onNextDecade: Pl,
    onPreviousDecade: Iu,
    withCellSpacing: Tu,
    __updateDateOnYearSelect: Au,
    __updateDateOnMonthSelect: Nu,
    firstDayOfWeek: gm,
    weekdayFormat: pm,
    weekendDays: zu,
    getDayProps: Yu,
    excludeDate: sm,
    renderDay: mm,
    hideOutsideDates: hm,
    hideWeekdays: ym,
    getDayAriaLabel: _m,
    monthLabelFormat: Sm,
    monthsListFormat: wm,
    getMonthControlProps: Nm,
    yearLabelFormat: Cm,
    yearsListFormat: Im,
    getYearControlProps: Am,
    decadeLabelFormat: Vm,
    allowSingleDateInRange: Rm,
    allowDeselect: Dm,
    minDate: km,
    maxDate: zm,
    locale: Pm
  } = Qt, i$ = __objRest$1(Qt, [
    "maxLevel",
    "minLevel",
    "defaultLevel",
    "level",
    "onLevelChange",
    "nextIcon",
    "previousIcon",
    "date",
    "defaultDate",
    "onDateChange",
    "numberOfColumns",
    "columnsToScroll",
    "ariaLabels",
    "onYearSelect",
    "onMonthSelect",
    "onYearMouseEnter",
    "onMonthMouseEnter",
    "onNextMonth",
    "onPreviousMonth",
    "onNextYear",
    "onPreviousYear",
    "onNextDecade",
    "onPreviousDecade",
    "withCellSpacing",
    "__updateDateOnYearSelect",
    "__updateDateOnMonthSelect",
    "firstDayOfWeek",
    "weekdayFormat",
    "weekendDays",
    "getDayProps",
    "excludeDate",
    "renderDay",
    "hideOutsideDates",
    "hideWeekdays",
    "getDayAriaLabel",
    "monthLabelFormat",
    "monthsListFormat",
    "getMonthControlProps",
    "yearLabelFormat",
    "yearsListFormat",
    "getYearControlProps",
    "decadeLabelFormat",
    "allowSingleDateInRange",
    "allowDeselect",
    "minDate",
    "maxDate",
    "locale"
  ]);
  return {
    calendarProps: {
      maxLevel: Zt,
      minLevel: $n,
      defaultLevel: Sn,
      level: kn,
      onLevelChange: Kn,
      nextIcon: er,
      previousIcon: Cr,
      date: kr,
      defaultDate: Yr,
      onDateChange: Ms,
      numberOfColumns: Ds,
      columnsToScroll: Ls,
      ariaLabels: js,
      onYearSelect: zs,
      onMonthSelect: Fs,
      onYearMouseEnter: Bs,
      onMonthMouseEnter: Hs,
      onNextMonth: Ws,
      onPreviousMonth: Ys,
      onNextYear: El,
      onPreviousYear: Mu,
      onNextDecade: Pl,
      onPreviousDecade: Iu,
      withCellSpacing: Tu,
      __updateDateOnYearSelect: Au,
      __updateDateOnMonthSelect: Nu,
      firstDayOfWeek: gm,
      weekdayFormat: pm,
      weekendDays: zu,
      getDayProps: Yu,
      excludeDate: sm,
      renderDay: mm,
      hideOutsideDates: hm,
      hideWeekdays: ym,
      getDayAriaLabel: _m,
      monthLabelFormat: Sm,
      monthsListFormat: wm,
      getMonthControlProps: Nm,
      yearLabelFormat: Cm,
      yearsListFormat: Im,
      getYearControlProps: Am,
      decadeLabelFormat: Vm,
      allowSingleDateInRange: Rm,
      allowDeselect: Dm,
      minDate: km,
      maxDate: zm,
      locale: Pm
    },
    others: i$
  };
}
function isDateValid({ date: _e, maxDate: Qt, minDate: Zt }) {
  return !(_e == null || Number.isNaN(_e.getTime()) || Qt && dayjs(_e).isAfter(Qt, "date") || Zt && dayjs(_e).isBefore(Zt, "date"));
}
function dateStringParser(_e) {
  const Qt = new Date(_e);
  return Number.isNaN(Qt.getTime()) || !_e ? null : Qt;
}
function formatValue$3(_e, Qt) {
  if (Qt === "range" && Array.isArray(_e)) {
    const [Zt, $n] = _e;
    return Zt ? $n ? `${Zt.toISOString()} – ${$n.toISOString()}` : `${Zt.toISOString()} –` : "";
  }
  return Qt === "multiple" && Array.isArray(_e) ? _e.map((Zt) => Zt.toISOString()).join(", ") : !Array.isArray(_e) && _e ? _e.toISOString() : "";
}
function HiddenDatesInput({ value: _e, type: Qt, name: Zt, form: $n }) {
  return /* @__PURE__ */ React.createElement("input", {
    type: "hidden",
    value: formatValue$3(_e, Qt),
    name: Zt,
    form: $n
  });
}
HiddenDatesInput.displayName = "@mantine/dates/HiddenDatesInput";
function assignTime(_e, Qt) {
  if (!_e || !Qt)
    return Qt;
  const Zt = _e.getHours(), $n = _e.getMinutes(), Sn = _e.getSeconds(), kn = _e.getMilliseconds(), Kn = new Date(Qt);
  return Kn.setHours(Zt), Kn.setMinutes($n), Kn.setSeconds(Sn), Kn.setMilliseconds(kn), Kn;
}
var __defProp = Object.defineProperty, __defProps = Object.defineProperties, __getOwnPropDescs = Object.getOwnPropertyDescriptors, __getOwnPropSymbols = Object.getOwnPropertySymbols, __hasOwnProp = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable, __defNormalProp = (_e, Qt, Zt) => Qt in _e ? __defProp(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, __spreadValues = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    __hasOwnProp.call(Qt, Zt) && __defNormalProp(_e, Zt, Qt[Zt]);
  if (__getOwnPropSymbols)
    for (var Zt of __getOwnPropSymbols(Qt))
      __propIsEnum.call(Qt, Zt) && __defNormalProp(_e, Zt, Qt[Zt]);
  return _e;
}, __spreadProps = (_e, Qt) => __defProps(_e, __getOwnPropDescs(Qt)), __objRest = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    __hasOwnProp.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && __getOwnPropSymbols)
    for (var $n of __getOwnPropSymbols(_e))
      Qt.indexOf($n) < 0 && __propIsEnum.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const defaultProps$1 = {
  valueFormat: "MMMM D, YYYY",
  fixOnBlur: !0,
  preserveTime: !0,
  size: "sm"
}, DateInput = reactExports.forwardRef((_e, Qt) => {
  const Zt = useInputProps("DateInput", defaultProps$1, _e), {
    inputProps: $n,
    wrapperProps: Sn,
    value: kn,
    defaultValue: Kn,
    onChange: er,
    clearable: Cr,
    clearButtonProps: kr,
    popoverProps: Yr,
    getDayProps: Ms,
    locale: Ds,
    valueFormat: Ls,
    dateParser: js,
    minDate: zs,
    maxDate: Fs,
    fixOnBlur: Bs,
    onFocus: Hs,
    onBlur: Ws,
    onClick: Ys,
    readOnly: El,
    name: Mu,
    form: Pl,
    rightSection: Iu,
    unstyled: Tu,
    classNames: Au,
    styles: Nu,
    allowDeselect: gm,
    preserveTime: pm,
    date: zu,
    defaultDate: Yu,
    onDateChange: sm
  } = Zt, mm = __objRest(Zt, [
    "inputProps",
    "wrapperProps",
    "value",
    "defaultValue",
    "onChange",
    "clearable",
    "clearButtonProps",
    "popoverProps",
    "getDayProps",
    "locale",
    "valueFormat",
    "dateParser",
    "minDate",
    "maxDate",
    "fixOnBlur",
    "onFocus",
    "onBlur",
    "onClick",
    "readOnly",
    "name",
    "form",
    "rightSection",
    "unstyled",
    "classNames",
    "styles",
    "allowDeselect",
    "preserveTime",
    "date",
    "defaultDate",
    "onDateChange"
  ]), { calendarProps: hm, others: ym } = pickCalendarProps(mm), _m = useDatesContext(), wm = js || ((s$) => {
    const l$ = dayjs(s$, Ls, _m.getLocale(Ds)).toDate();
    return Number.isNaN(l$.getTime()) ? dateStringParser(s$) : l$;
  }), Nm = gm !== void 0 ? gm : Cr, Cm = (s$) => s$ ? dayjs(s$).locale(_m.getLocale(Ds)).format(Ls) : "", [Im, Am, Vm] = useUncontrolled({
    value: kn,
    defaultValue: Kn,
    finalValue: null,
    onChange: er
  }), [Rm, Dm] = useUncontrolled({
    value: zu,
    defaultValue: Kn || Yu,
    finalValue: null,
    onChange: sm
  });
  reactExports.useEffect(() => {
    Vm && Dm(kn);
  }, [Vm, kn]);
  const [km, zm] = reactExports.useState(Cm(Im));
  reactExports.useEffect(() => {
    zm(Cm(Im));
  }, [_m.getLocale(Ds)]);
  const [Pm, i$] = reactExports.useState(!1), o$ = (s$) => {
    const l$ = s$.currentTarget.value;
    if (zm(l$), l$.trim() === "" && Cr)
      Am(null);
    else {
      const _$ = wm(l$);
      isDateValid({ date: _$, minDate: zs, maxDate: Fs }) && (Am(_$), Dm(_$));
    }
  }, u$ = (s$) => {
    Ws == null || Ws(s$), i$(!1), Bs && zm(Cm(Im));
  }, h$ = (s$) => {
    Hs == null || Hs(s$), i$(!0);
  }, d$ = (s$) => {
    Ys == null || Ys(s$), i$(!0);
  }, v$ = (s$) => __spreadProps(__spreadValues({}, Ms == null ? void 0 : Ms(s$)), {
    selected: dayjs(Im).isSame(s$, "day"),
    onClick: () => {
      const l$ = pm ? assignTime(Im, s$) : s$, _$ = Cr && Nm && dayjs(Im).isSame(s$, "day") ? null : l$;
      Am(_$), !Vm && zm(Cm(_$)), i$(!1);
    }
  }), $$ = Iu || (Cr && Im && !El ? /* @__PURE__ */ React.createElement(CloseButton, __spreadValues({
    variant: "transparent",
    onMouseDown: (s$) => s$.preventDefault(),
    tabIndex: -1,
    onClick: () => {
      Am(null), !Vm && zm(""), i$(!1);
    },
    unstyled: Tu
  }, kr)) : null);
  return useDidUpdate(() => {
    kn !== void 0 && !Pm && zm(Cm(kn));
  }, [kn]), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Input.Wrapper, __spreadProps(__spreadValues({}, Sn), {
    __staticSelector: "DateInput"
  }), /* @__PURE__ */ React.createElement(Popover, __spreadValues({
    opened: Pm,
    trapFocus: !1,
    position: "bottom-start",
    disabled: El,
    withRoles: !1
  }, Yr), /* @__PURE__ */ React.createElement(Popover.Target, null, /* @__PURE__ */ React.createElement(Input, __spreadProps(__spreadValues(__spreadValues({
    "data-dates-input": !0,
    "data-read-only": El || void 0,
    autoComplete: "off",
    ref: Qt,
    value: km,
    onChange: o$,
    onBlur: u$,
    onFocus: h$,
    onClick: d$,
    readOnly: El,
    rightSection: $$
  }, $n), ym), {
    __staticSelector: "DateInput"
  }))), /* @__PURE__ */ React.createElement(Popover.Dropdown, {
    onMouseDown: (s$) => s$.preventDefault(),
    "data-dates-dropdown": !0
  }, /* @__PURE__ */ React.createElement(Calendar, __spreadProps(__spreadValues({
    __staticSelector: "DateInput"
  }, hm), {
    classNames: Au,
    styles: Nu,
    unstyled: Tu,
    __preventFocus: !0,
    minDate: zs,
    maxDate: Fs,
    locale: Ds,
    getDayProps: v$,
    size: $n.size,
    date: Rm,
    onDateChange: Dm
  }))))), /* @__PURE__ */ React.createElement(HiddenDatesInput, {
    name: Mu,
    form: Pl,
    value: Im,
    type: "default"
  }));
});
DateInput.displayName = "@mantine/dates/DateInput";
function __rest(_e, Qt) {
  var Zt = {};
  for (var $n in _e)
    Object.prototype.hasOwnProperty.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var Sn = 0, $n = Object.getOwnPropertySymbols(_e); Sn < $n.length; Sn++)
      Qt.indexOf($n[Sn]) < 0 && Object.prototype.propertyIsEnumerable.call(_e, $n[Sn]) && (Zt[$n[Sn]] = _e[$n[Sn]]);
  return Zt;
}
typeof SuppressedError == "function" && SuppressedError;
const MRT_AggregationFns = Object.assign({}, aggregationFns), fuzzy$1 = (_e, Qt, Zt, $n) => {
  const Sn = rankItem(_e.getValue(Qt), Zt, {
    threshold: rankings.MATCHES
  });
  return $n(Sn), Sn.passed;
};
fuzzy$1.autoRemove = (_e) => !_e;
const contains$2 = (_e, Qt, Zt) => _e.getValue(Qt).toString().toLowerCase().trim().includes(Zt.toString().toLowerCase().trim());
contains$2.autoRemove = (_e) => !_e;
const startsWith = (_e, Qt, Zt) => _e.getValue(Qt).toString().toLowerCase().trim().startsWith(Zt.toString().toLowerCase().trim());
startsWith.autoRemove = (_e) => !_e;
const endsWith = (_e, Qt, Zt) => _e.getValue(Qt).toString().toLowerCase().trim().endsWith(Zt.toString().toLowerCase().trim());
endsWith.autoRemove = (_e) => !_e;
const equals = (_e, Qt, Zt) => Zt === null ? !0 : _e.getValue(Qt).toString().toLowerCase().trim() === Zt.toString().toLowerCase().trim();
equals.autoRemove = (_e) => !_e;
const notEquals = (_e, Qt, Zt) => _e.getValue(Qt).toString().toLowerCase().trim() !== Zt.toString().toLowerCase().trim();
notEquals.autoRemove = (_e) => !_e;
const greaterThan = (_e, Qt, Zt) => Zt === null ? !0 : !isNaN(+Zt) && !isNaN(+_e.getValue(Qt)) ? +_e.getValue(Qt) > +Zt : _e.getValue(Qt).toString().toLowerCase().trim() > Zt.toString().toLowerCase().trim();
greaterThan.autoRemove = (_e) => !_e;
const greaterThanOrEqualTo = (_e, Qt, Zt) => equals(_e, Qt, Zt) || greaterThan(_e, Qt, Zt);
greaterThanOrEqualTo.autoRemove = (_e) => !_e;
const lessThan = (_e, Qt, Zt) => Zt === null ? !0 : !isNaN(+Zt) && !isNaN(+_e.getValue(Qt)) ? +_e.getValue(Qt) < +Zt : _e.getValue(Qt).toString().toLowerCase().trim() < Zt.toString().toLowerCase().trim();
lessThan.autoRemove = (_e) => !_e;
const lessThanOrEqualTo = (_e, Qt, Zt) => equals(_e, Qt, Zt) || lessThan(_e, Qt, Zt);
lessThanOrEqualTo.autoRemove = (_e) => !_e;
const between = (_e, Qt, Zt) => (["", void 0].includes(Zt[0]) || greaterThan(_e, Qt, Zt[0])) && (!isNaN(+Zt[0]) && !isNaN(+Zt[1]) && +Zt[0] > +Zt[1] || ["", void 0].includes(Zt[1]) || lessThan(_e, Qt, Zt[1]));
between.autoRemove = (_e) => !_e;
const betweenInclusive = (_e, Qt, Zt) => (["", void 0].includes(Zt[0]) || greaterThanOrEqualTo(_e, Qt, Zt[0])) && (!isNaN(+Zt[0]) && !isNaN(+Zt[1]) && +Zt[0] > +Zt[1] || ["", void 0].includes(Zt[1]) || lessThanOrEqualTo(_e, Qt, Zt[1]));
betweenInclusive.autoRemove = (_e) => !_e;
const empty$2 = (_e, Qt, Zt) => !_e.getValue(Qt).toString().trim();
empty$2.autoRemove = (_e) => !_e;
const notEmpty = (_e, Qt, Zt) => !!_e.getValue(Qt).toString().trim();
notEmpty.autoRemove = (_e) => !_e;
const MRT_FilterFns = Object.assign(Object.assign({}, filterFns), {
  between,
  betweenInclusive,
  contains: contains$2,
  empty: empty$2,
  endsWith,
  equals,
  fuzzy: fuzzy$1,
  greaterThan,
  greaterThanOrEqualTo,
  lessThan,
  lessThanOrEqualTo,
  notEmpty,
  notEquals,
  startsWith
}), fuzzy = (_e, Qt, Zt) => {
  let $n = 0;
  return _e.columnFiltersMeta[Zt] && ($n = compareItems(_e.columnFiltersMeta[Zt], Qt.columnFiltersMeta[Zt])), $n === 0 ? sortingFns.alphanumeric(_e, Qt, Zt) : $n;
}, MRT_SortingFns = Object.assign(Object.assign({}, sortingFns), { fuzzy }), rankGlobalFuzzy = (_e, Qt) => Math.max(...Object.values(Qt.columnFiltersMeta).map((Zt) => Zt.rank)) - Math.max(...Object.values(_e.columnFiltersMeta).map((Zt) => Zt.rank)), getColumnId = (_e) => {
  var Qt, Zt, $n, Sn;
  return (Sn = (Qt = _e.id) !== null && Qt !== void 0 ? Qt : ($n = (Zt = _e.accessorKey) === null || Zt === void 0 ? void 0 : Zt.toString) === null || $n === void 0 ? void 0 : $n.call(Zt)) !== null && Sn !== void 0 ? Sn : _e.header;
}, getAllLeafColumnDefs = (_e) => {
  const Qt = [], Zt = ($n) => {
    $n.forEach((Sn) => {
      Sn.columns ? Zt(Sn.columns) : Qt.push(Sn);
    });
  };
  return Zt(_e), Qt;
}, prepareColumns = ({ aggregationFns: _e, columnDefs: Qt, columnFilterFns: Zt, defaultDisplayColumn: $n, filterFns: Sn, sortingFns: kn }) => Qt.map((Kn) => {
  var er, Cr;
  if (Kn.id || (Kn.id = getColumnId(Kn)), Kn.columnDefType || (Kn.columnDefType = "data"), !((er = Kn.columns) === null || er === void 0) && er.length)
    Kn.columnDefType = "group", Kn.columns = prepareColumns({
      aggregationFns: _e,
      columnDefs: Kn.columns,
      columnFilterFns: Zt,
      defaultDisplayColumn: $n,
      filterFns: Sn,
      sortingFns: kn
    });
  else if (Kn.columnDefType === "data") {
    if (Array.isArray(Kn.aggregationFn)) {
      const kr = Kn.aggregationFn;
      Kn.aggregationFn = (Yr, Ms, Ds) => kr.map((Ls) => {
        var js;
        return (js = _e[Ls]) === null || js === void 0 ? void 0 : js.call(_e, Yr, Ms, Ds);
      });
    }
    Object.keys(Sn).includes(Zt[Kn.id]) && (Kn.filterFn = (Cr = Sn[Zt[Kn.id]]) !== null && Cr !== void 0 ? Cr : Sn.fuzzy, Kn._filterFn = Zt[Kn.id]), Object.keys(kn).includes(Kn.sortingFn) && (Kn.sortingFn = kn[Kn.sortingFn]);
  } else
    Kn.columnDefType === "display" && (Kn = Object.assign(Object.assign({}, $n), Kn));
  return Kn;
}), reorderColumn = (_e, Qt, Zt) => (_e.getCanPin() && _e.pin(Qt.getIsPinned()), Zt.splice(Zt.indexOf(Qt.id), 0, Zt.splice(Zt.indexOf(_e.id), 1)[0]), [...Zt]), showExpandColumn = (_e, Qt) => !!(_e.enableExpanding || _e.enableGrouping && (Qt === void 0 || Qt != null && Qt.length) || _e.renderDetailPanel), getLeadingDisplayColumnIds = (_e) => {
  var Qt;
  return [
    (_e.enableRowDragging || _e.enableRowOrdering) && "mrt-row-drag",
    _e.positionActionsColumn === "first" && (_e.enableRowActions || _e.enableEditing && ["row", "modal", "custom"].includes((Qt = _e.editDisplayMode) !== null && Qt !== void 0 ? Qt : "")) && "mrt-row-actions",
    _e.positionExpandColumn === "first" && showExpandColumn(_e) && "mrt-row-expand",
    _e.enableRowSelection && "mrt-row-select",
    _e.enableRowNumbers && "mrt-row-numbers"
  ].filter(Boolean);
}, getTrailingDisplayColumnIds = (_e) => {
  var Qt;
  return [
    _e.positionActionsColumn === "last" && (_e.enableRowActions || _e.enableEditing && ["row", "modal"].includes((Qt = _e.editDisplayMode) !== null && Qt !== void 0 ? Qt : "")) && "mrt-row-actions",
    _e.positionExpandColumn === "last" && showExpandColumn(_e) && "mrt-row-expand"
  ].filter(Boolean);
}, getDefaultColumnOrderIds = (_e) => {
  const Qt = getLeadingDisplayColumnIds(_e), Zt = getTrailingDisplayColumnIds(_e), $n = getAllLeafColumnDefs(_e.columns).map((Sn) => getColumnId(Sn)).filter((Sn) => !Qt.includes(Sn) && !Zt.includes(Sn));
  return [...Qt, ...$n, ...Zt];
}, getDefaultColumnFilterFn = (_e) => {
  const { filterVariant: Qt } = _e;
  return Qt === "multi-select" ? "arrIncludesSome" : ["range", "date-range", "range-slider"].includes(Qt || "") ? "betweenInclusive" : ["select", "checkbox", "date"].includes(Qt || "") ? "equals" : "fuzzy";
}, getIsFirstColumn = (_e, Qt) => Qt.getVisibleLeafColumns()[0].id === _e.id, getIsLastColumn = (_e, Qt) => {
  const Zt = Qt.getVisibleLeafColumns();
  return Zt[Zt.length - 1].id === _e.id;
}, getIsLastLeftPinnedColumn = (_e, Qt) => Qt.getIsPinned() === "left" && _e.getLeftLeafHeaders().length - 1 === Qt.getPinnedIndex(), getIsFirstRightPinnedColumn = (_e) => _e.getIsPinned() === "right" && _e.getPinnedIndex() === 0, getTotalRight = (_e, Qt) => _e.getRightLeafHeaders().slice(Qt.getPinnedIndex() + 1).reduce((Zt, $n) => Zt + $n.getSize(), 0), getCanRankRows = (_e) => {
  const { options: Qt, getState: Zt } = _e, { manualExpanding: $n, manualFiltering: Sn, manualGrouping: kn, manualSorting: Kn, enableGlobalFilterRankedResults: er } = Qt, { globalFilterFn: Cr, expanded: kr } = Zt();
  return !$n && !Sn && !kn && !Kn && er && Cr === "fuzzy" && kr !== !0 && !Object.values(kr).some(Boolean);
}, getCommonCellStyles = ({ column: _e, header: Qt, isStriped: Zt, row: $n, table: Sn, tableCellProps: kn, theme: Kn }) => {
  var er, Cr, kr, Yr, Ms, Ds, Ls, js, zs, Fs;
  const Bs = {
    minWidth: `max(calc(var(--${Qt ? "header" : "col"}-${parseCSSVarId((er = Qt == null ? void 0 : Qt.id) !== null && er !== void 0 ? er : _e.id)}-size) * 1px), ${(Cr = _e.columnDef.minSize) !== null && Cr !== void 0 ? Cr : 30}px)`,
    width: `calc(var(--${Qt ? "header" : "col"}-${parseCSSVarId((kr = Qt == null ? void 0 : Qt.id) !== null && kr !== void 0 ? kr : _e.id)}-size) * 1px)`
  };
  return Object.assign(Object.assign(Object.assign({ backgroundColor: $n ? $n != null && $n.getIsSelected() ? Kn.fn.rgba(getPrimaryColor(Kn), 0.1) : _e.getIsPinned() && _e.columnDef.columnDefType !== "group" ? Kn.fn.rgba(Kn.colorScheme === "dark" ? Kn.fn.darken(Kn.colors.dark[7], 0.02) : Kn.white, 0.97) : Zt ? "inherit" : Kn.colorScheme === "dark" ? Kn.fn.lighten(Kn.colors.dark[7], 0.02) : Kn.white : "inherit", backgroundClip: "padding-box", boxShadow: getIsLastLeftPinnedColumn(Sn, _e) ? `-4px 0 8px -6px ${Kn.fn.rgba(Kn.black, 0.2)} inset` : getIsFirstRightPinnedColumn(_e) ? `4px 0 8px -6px ${Kn.fn.rgba(Kn.black, 0.2)} inset` : void 0, display: Sn.options.layoutMode === "grid" ? "flex" : "table-cell", flex: Sn.options.layoutMode === "grid" ? `var(--${Qt ? "header" : "col"}-${parseCSSVarId((Yr = Qt == null ? void 0 : Qt.id) !== null && Yr !== void 0 ? Yr : _e.id)}-size) 0 auto` : void 0, left: _e.getIsPinned() === "left" ? `${_e.getStart("left")}px` : void 0, ml: Sn.options.enableColumnVirtualization && _e.getIsPinned() === "left" && _e.getPinnedIndex() === 0 ? `-${_e.getSize() * ((Ds = (Ms = Sn.getState().columnPinning.left) === null || Ms === void 0 ? void 0 : Ms.length) !== null && Ds !== void 0 ? Ds : 1)}px` : void 0, mr: Sn.options.enableColumnVirtualization && _e.getIsPinned() === "right" && _e.getPinnedIndex() === Sn.getVisibleLeafColumns().length - 1 ? `-${_e.getSize() * ((js = (Ls = Sn.getState().columnPinning.right) === null || Ls === void 0 ? void 0 : Ls.length) !== null && js !== void 0 ? js : 1) * 1.2}px` : void 0, opacity: ((zs = Sn.getState().draggingColumn) === null || zs === void 0 ? void 0 : zs.id) === _e.id || ((Fs = Sn.getState().hoveredColumn) === null || Fs === void 0 ? void 0 : Fs.id) === _e.id ? 0.5 : 1, position: _e.getIsPinned() && _e.columnDef.columnDefType !== "group" ? "sticky" : void 0, right: _e.getIsPinned() === "right" ? `${getTotalRight(Sn, _e)}px` : void 0, transition: Sn.options.enableColumnVirtualization ? "none" : "padding 100ms ease-in-out" }, !Sn.options.enableColumnResizing && Bs), (kn == null ? void 0 : kn.sx) instanceof Function ? kn.sx(Kn) : kn == null ? void 0 : kn.sx), Sn.options.enableColumnResizing && Bs);
}, MRT_DefaultColumn = {
  filterVariant: "text",
  minSize: 40,
  maxSize: 1e3,
  size: 180
}, MRT_DefaultDisplayColumn = {
  columnDefType: "display",
  enableClickToCopy: !1,
  enableColumnActions: !1,
  enableColumnDragging: !1,
  enableColumnFilter: !1,
  enableColumnOrdering: !1,
  enableEditing: !1,
  enableGlobalFilter: !1,
  enableGrouping: !1,
  enableHiding: !1,
  enableResizing: !1,
  enableSorting: !1
}, getPrimaryShade = (_e) => {
  var Qt, Zt, $n, Sn, kn;
  return (kn = _e.colorScheme === "dark" ? (
    // @ts-ignore
    (Zt = (Qt = _e.primaryShade) === null || Qt === void 0 ? void 0 : Qt.dark) !== null && Zt !== void 0 ? Zt : _e.primaryShade
  ) : (
    // @ts-ignore
    (Sn = ($n = _e.primaryShade) === null || $n === void 0 ? void 0 : $n.light) !== null && Sn !== void 0 ? Sn : _e.primaryShade
  )) !== null && kn !== void 0 ? kn : 7;
}, getPrimaryColor = (_e, Qt) => _e.colors[_e.primaryColor][Qt ?? getPrimaryShade(_e)], parseCSSVarId = (_e) => _e.replace(/[^a-zA-Z0-9]/g, "_"), createRow = (_e, Qt) => createRow$1(_e, "mrt-row-create", Qt ?? Object.assign({}, ...getAllLeafColumnDefs(_e.options.columns).filter((Zt) => Zt.columnDefType === "data").map((Zt) => ({
  [getColumnId(Zt)]: ""
}))), -1, 0), MRT_Localization_EN = {
  actions: "Actions",
  and: "and",
  cancel: "Cancel",
  changeFilterMode: "Change filter mode",
  changeSearchMode: "Change search mode",
  clearFilter: "Clear filter",
  clearSearch: "Clear search",
  clearSort: "Clear sort",
  clickToCopy: "Click to copy",
  collapse: "Collapse",
  collapseAll: "Collapse all",
  columnActions: "Column Actions",
  copiedToClipboard: "Copied to clipboard",
  dropToGroupBy: "Drop to group by {column}",
  edit: "Edit",
  expand: "Expand",
  expandAll: "Expand all",
  filterArrIncludes: "Includes",
  filterArrIncludesAll: "Includes all",
  filterArrIncludesSome: "Includes",
  filterBetween: "Between",
  filterBetweenInclusive: "Between Inclusive",
  filterByColumn: "Filter by {column}",
  filterContains: "Contains",
  filterEmpty: "Empty",
  filterEndsWith: "Ends With",
  filterEquals: "Equals",
  filterEqualsString: "Equals",
  filterFuzzy: "Fuzzy",
  filterGreaterThan: "Greater Than",
  filterGreaterThanOrEqualTo: "Greater Than Or Equal To",
  filterInNumberRange: "Between",
  filterIncludesString: "Contains",
  filterIncludesStringSensitive: "Contains",
  filterLessThan: "Less Than",
  filterLessThanOrEqualTo: "Less Than Or Equal To",
  filterMode: "Filter Mode: {filterType}",
  filterNotEmpty: "Not Empty",
  filterNotEquals: "Not Equals",
  filterStartsWith: "Starts With",
  filterWeakEquals: "Equals",
  filteringByColumn: "Filtering by {column} - {filterType} {filterValue}",
  goToFirstPage: "Go to first page",
  goToLastPage: "Go to last page",
  goToNextPage: "Go to next page",
  goToPreviousPage: "Go to previous page",
  grab: "Grab",
  groupByColumn: "Group by {column}",
  groupedBy: "Grouped by ",
  hideAll: "Hide all",
  hideColumn: "Hide {column} column",
  max: "Max",
  min: "Min",
  move: "Move",
  noRecordsToDisplay: "No records to display",
  noResultsFound: "No results found",
  of: "of",
  or: "or",
  pinToLeft: "Pin to left",
  pinToRight: "Pin to right",
  resetColumnSize: "Reset column size",
  resetOrder: "Reset order",
  rowActions: "Row Actions",
  rowNumber: "#",
  rowNumbers: "Row Numbers",
  rowsPerPage: "Rows per page",
  save: "Save",
  search: "Search",
  selectedCountOfRowCountRowsSelected: "{selectedCount} of {rowCount} row(s) selected",
  select: "Select",
  showAll: "Show all",
  showAllColumns: "Show all columns",
  showHideColumns: "Show/Hide columns",
  showHideFilters: "Show/Hide filters",
  showHideSearch: "Show/Hide search",
  sortByColumnAsc: "Sort by {column} ascending",
  sortByColumnDesc: "Sort by {column} descending",
  sortedByColumnAsc: "Sorted by {column} ascending",
  sortedByColumnDesc: "Sorted by {column} descending",
  thenBy: ", then by ",
  toggleDensity: "Toggle density",
  toggleFullScreen: "Toggle full screen",
  toggleSelectAll: "Toggle select all",
  toggleSelectRow: "Toggle select row",
  toggleVisibility: "Toggle visibility",
  ungroupByColumn: "Ungroup by {column}",
  unpin: "Unpin",
  unpinAll: "Unpin all"
}, MRT_Default_Icons = {
  IconArrowAutofitContent,
  IconArrowsSort,
  IconBaselineDensityLarge,
  IconBaselineDensityMedium,
  IconBaselineDensitySmall,
  IconBoxMultiple,
  IconChevronDown,
  IconChevronLeft,
  IconChevronLeftPipe,
  IconChevronRight,
  IconChevronRightPipe,
  IconChevronsDown,
  IconCircleX,
  IconClearAll,
  IconColumns,
  IconDeviceFloppy,
  IconDots,
  IconDotsVertical,
  IconEdit,
  IconEyeOff,
  IconFilter,
  IconFilterCog,
  IconFilterOff,
  IconGripHorizontal,
  IconMaximize,
  IconMinimize,
  IconPinned,
  IconPinnedOff,
  IconSearch,
  IconSearchOff,
  IconSortAscending,
  IconSortDescending,
  IconX
}, useMRT_TableOptions = (_e) => {
  var Qt, { aggregationFns: Zt, autoResetExpanded: $n = !1, columnFilterDisplayMode: Sn = "subheader", columnResizeMode: kn = "onChange", createDisplayMode: Kn = "modal", defaultColumn: er, defaultDisplayColumn: Cr, editDisplayMode: kr = "modal", enableBottomToolbar: Yr = !0, enableColumnActions: Ms = !0, enableColumnFilters: Ds = !0, enableColumnOrdering: Ls = !1, enableColumnResizing: js = !1, enableDensityToggle: zs = !0, enableExpandAll: Fs = !0, enableExpanding: Bs, enableFilterMatchHighlighting: Hs = !0, enableFilters: Ws = !0, enableFullScreenToggle: Ys = !0, enableGlobalFilter: El = !0, enableGlobalFilterRankedResults: Mu = !0, enableGrouping: Pl = !1, enableHiding: Iu = !0, enableMultiRowSelection: Tu = !0, enableMultiSort: Au = !0, enablePagination: Nu = !0, enablePinning: gm = !1, enableRowSelection: pm = !1, enableSelectAll: zu = !0, enableSorting: Yu = !0, enableStickyHeader: sm = !1, enableTableFooter: mm = !0, enableTableHead: hm = !0, enableToolbarInternalActions: ym = !0, enableTopToolbar: _m = !0, filterFns: Sm, icons: wm, layoutMode: Nm = "semantic", localization: Cm, manualFiltering: Im, manualGrouping: Am, manualPagination: Vm, manualSorting: Rm, paginationDisplayMode: Dm = "default", positionActionsColumn: km = "first", positionExpandColumn: zm = "first", positionGlobalFilter: Pm = "right", positionPagination: i$ = "bottom", positionToolbarAlertBanner: o$ = "top", positionToolbarDropZone: u$ = "top", rowNumberMode: h$ = "static", selectAllMode: d$ = "page", sortingFns: v$ } = _e, $$ = __rest(_e, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enablePinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "selectAllMode", "sortingFns"]);
  const s$ = reactExports.useMemo(() => Object.assign(Object.assign({}, MRT_Default_Icons), wm), [wm]), l$ = reactExports.useMemo(() => Object.assign(Object.assign({}, MRT_Localization_EN), Cm), [Cm]), _$ = reactExports.useMemo(() => Object.assign(Object.assign({}, MRT_AggregationFns), Zt), []), a$ = reactExports.useMemo(() => Object.assign(Object.assign({}, MRT_FilterFns), Sm), []), n$ = reactExports.useMemo(() => Object.assign(Object.assign({}, MRT_SortingFns), v$), []), m$ = reactExports.useMemo(() => Object.assign(Object.assign({}, MRT_DefaultColumn), er), [er]), j$ = reactExports.useMemo(() => Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), Cr), [Cr]);
  return ($$.enableRowVirtualization || $$.enableColumnVirtualization) && (Nm = "grid"), $$.enableRowVirtualization && (sm = !0), Nu === !1 && Vm === void 0 && (Vm = !0), !((Qt = $$.data) === null || Qt === void 0) && Qt.length || (Im = !0, Am = !0, Vm = !0, Rm = !0), Object.assign({
    aggregationFns: _$,
    autoResetExpanded: $n,
    columnFilterDisplayMode: Sn,
    columnResizeMode: kn,
    createDisplayMode: Kn,
    defaultColumn: m$,
    defaultDisplayColumn: j$,
    editDisplayMode: kr,
    enableBottomToolbar: Yr,
    enableColumnActions: Ms,
    enableColumnFilters: Ds,
    enableColumnOrdering: Ls,
    enableColumnResizing: js,
    enableDensityToggle: zs,
    enableExpandAll: Fs,
    enableExpanding: Bs,
    enableFilterMatchHighlighting: Hs,
    enableFilters: Ws,
    enableFullScreenToggle: Ys,
    enableGlobalFilter: El,
    enableGlobalFilterRankedResults: Mu,
    enableGrouping: Pl,
    enableHiding: Iu,
    enableMultiRowSelection: Tu,
    enableMultiSort: Au,
    enablePagination: Nu,
    enablePinning: gm,
    enableRowSelection: pm,
    enableSelectAll: zu,
    enableSorting: Yu,
    enableStickyHeader: sm,
    enableTableFooter: mm,
    enableTableHead: hm,
    enableToolbarInternalActions: ym,
    enableTopToolbar: _m,
    filterFns: a$,
    icons: s$,
    layoutMode: Nm,
    localization: l$,
    manualFiltering: Im,
    manualGrouping: Am,
    manualPagination: Vm,
    manualSorting: Rm,
    paginationDisplayMode: Dm,
    positionActionsColumn: km,
    positionExpandColumn: zm,
    positionGlobalFilter: Pm,
    positionPagination: i$,
    positionToolbarAlertBanner: o$,
    positionToolbarDropZone: u$,
    rowNumberMode: h$,
    selectAllMode: d$,
    sortingFns: n$
  }, $$);
}, MRT_EditCellTextInput = ({ cell: _e, table: Qt }) => {
  var Zt;
  const { getState: $n, options: { createDisplayMode: Sn, editDisplayMode: kn, mantineEditTextInputProps: Kn, mantineEditSelectProps: er }, refs: { editInputRefs: Cr }, setEditingCell: kr, setEditingRow: Yr, setCreatingRow: Ms } = Qt, { column: Ds, row: Ls } = _e, { columnDef: js } = Ds, { creatingRow: zs, editingRow: Fs } = $n(), Bs = (zs == null ? void 0 : zs.id) === Ls.id, Hs = (Fs == null ? void 0 : Fs.id) === Ls.id, Ws = js.editVariant === "select", [Ys, El] = reactExports.useState(() => _e.getValue()), Mu = Kn instanceof Function ? Kn({ cell: _e, column: Ds, row: Ls, table: Qt }) : Kn, Pl = js.mantineEditTextInputProps instanceof Function ? js.mantineEditTextInputProps({
    cell: _e,
    column: Ds,
    row: Ls,
    table: Qt
  }) : js.mantineEditTextInputProps, Iu = Object.assign(Object.assign({}, Mu), Pl), Tu = er instanceof Function ? er({ cell: _e, column: Ds, row: Ls, table: Qt }) : er, Au = js.mantineEditSelectProps instanceof Function ? js.mantineEditSelectProps({
    cell: _e,
    column: Ds,
    row: Ls,
    table: Qt
  }) : js.mantineEditSelectProps, Nu = Object.assign(Object.assign({}, Tu), Au), gm = (sm) => {
    Ls._valuesCache[Ds.id] = sm, Bs ? Ms(Ls) : Hs && Yr(Ls);
  }, pm = (sm) => {
    var mm;
    (mm = Iu.onBlur) === null || mm === void 0 || mm.call(Iu, sm), gm(Ys), kr(null);
  }, zu = (sm) => {
    var mm, hm;
    (mm = Iu.onKeyDown) === null || mm === void 0 || mm.call(Iu, sm), sm.key === "Enter" && ((hm = Cr.current[_e.id]) === null || hm === void 0 || hm.blur());
  };
  if (js.Edit)
    return (Zt = js.Edit) === null || Zt === void 0 ? void 0 : Zt.call(js, { cell: _e, column: Ds, row: Ls, table: Qt });
  const Yu = {
    disabled: (js.enableEditing instanceof Function ? js.enableEditing(Ls) : js.enableEditing) === !1,
    label: ["modal", "custom"].includes(Bs ? Sn : kn) ? Ds.columnDef.header : void 0,
    name: _e.id,
    placeholder: ["modal", "custom"].includes(Bs ? Sn : kn) ? void 0 : js.header,
    value: Ys,
    variant: kn === "table" ? "unstyled" : "default",
    onClick: (sm) => {
      var mm;
      sm.stopPropagation(), (mm = Iu == null ? void 0 : Iu.onClick) === null || mm === void 0 || mm.call(Iu, sm);
    }
  };
  return Ws ? (
    // @ts-ignore
    jsxRuntimeExports.jsx(Select, Object.assign({}, Yu, { searchable: !0, value: Ys, withinPortal: !0 }, Nu, { onBlur: pm, onChange: (sm) => {
      var mm;
      (mm = Nu.onChange) === null || mm === void 0 || mm.call(Nu, sm), El(sm);
    }, onClick: (sm) => {
      var mm;
      sm.stopPropagation(), (mm = Nu == null ? void 0 : Nu.onClick) === null || mm === void 0 || mm.call(Nu, sm);
    }, ref: (sm) => {
      sm && (Cr.current[_e.id] = sm, Nu.ref && (Nu.ref.current = sm));
    } }))
  ) : jsxRuntimeExports.jsx(TextInput, Object.assign({}, Yu, { onKeyDown: zu, value: Ys ?? "" }, Iu, { onBlur: pm, onChange: (sm) => {
    var mm;
    (mm = Iu.onChange) === null || mm === void 0 || mm.call(Iu, sm), El(sm.target.value);
  }, onClick: (sm) => {
    var mm;
    sm.stopPropagation(), (mm = Iu == null ? void 0 : Iu.onClick) === null || mm === void 0 || mm.call(Iu, sm);
  }, ref: (sm) => {
    sm && (Cr.current[_e.id] = sm, Iu.ref && (Iu.ref.current = sm));
  } }));
}, MRT_CopyButton = ({ cell: _e, children: Qt, table: Zt }) => {
  const { options: { localization: $n, mantineCopyButtonProps: Sn } } = Zt, { column: kn, row: Kn } = _e, { columnDef: er } = kn, Cr = Sn instanceof Function ? Sn({ cell: _e, column: kn, row: Kn, table: Zt }) : Sn, kr = er.mantineCopyButtonProps instanceof Function ? er.mantineCopyButtonProps({
    cell: _e,
    column: kn,
    row: Kn,
    table: Zt
  }) : er.mantineCopyButtonProps, Yr = Object.assign(Object.assign({}, Cr), kr);
  return jsxRuntimeExports.jsx(CopyButton, { value: _e.getValue(), children: ({ copied: Ms, copy: Ds }) => {
    var Ls;
    return jsxRuntimeExports.jsx(Tooltip, { color: Ms ? "green" : void 0, withinPortal: !0, openDelay: 1e3, label: (Ls = Yr == null ? void 0 : Yr.title) !== null && Ls !== void 0 ? Ls : Ms ? $n.copiedToClipboard : $n.clickToCopy, children: jsxRuntimeExports.jsx(UnstyledButton, Object.assign({}, Yr, { onClick: (js) => {
      js.stopPropagation(), Ds();
    }, sx: (js) => Object.assign({ backgroundColor: "transparent", border: "none", borderRadius: "4px", color: "inherit", cursor: "copy", fontFamily: "inherit", fontSize: "inherit", fontWeight: "inherit", justifyContent: "inherit", letterSpacing: "inherit", margin: "-4px", minWidth: "unset", padding: "4px", textAlign: "inherit", textTransform: "inherit", "&:active": {
      transform: "translateY(1px)"
    }, "&:hover": {
      backgroundColor: js.fn.rgba(getPrimaryColor(js), 0.1)
    } }, (Yr == null ? void 0 : Yr.sx) instanceof Function ? Yr.sx(js) : Yr == null ? void 0 : Yr.sx), title: void 0, children: Qt })) });
  } });
}, allowedTypes = ["string", "number"], allowedFilterVariants = ["text", "autocomplete"], MRT_TableBodyCellValue = ({ cell: _e, table: Qt }) => {
  var Zt, $n;
  const { getState: Sn, options: { enableFilterMatchHighlighting: kn, mantineHighlightProps: Kn } } = Qt, { column: er, row: Cr } = _e, { columnDef: kr } = er, { globalFilter: Yr, globalFilterFn: Ms } = Sn(), Ds = er.getFilterValue(), Ls = Kn instanceof Function ? Kn({ cell: _e, column: er, row: Cr, table: Qt }) : Kn;
  let js = _e.getIsAggregated() && kr.AggregatedCell ? kr.AggregatedCell({
    cell: _e,
    column: er,
    row: Cr,
    table: Qt
  }) : Cr.getIsGrouped() && !_e.getIsGrouped() ? null : _e.getIsGrouped() && kr.GroupedCell ? kr.GroupedCell({
    cell: _e,
    column: er,
    row: Cr,
    table: Qt
  }) : void 0;
  const zs = js !== void 0;
  if (zs || (js = _e.renderValue()), kn && kr.enableFilterMatchHighlighting !== !1 && js && allowedTypes.includes(typeof js) && (Ds && allowedTypes.includes(typeof Ds) && allowedFilterVariants.includes(kr.filterVariant) || Yr && allowedTypes.includes(typeof Yr) && er.getCanGlobalFilter())) {
    let Fs = (($n = (Zt = er.getFilterValue()) !== null && Zt !== void 0 ? Zt : Yr) !== null && $n !== void 0 ? $n : "").toString();
    (Ds ? kr._filterFn : Ms) === "fuzzy" && (Fs = Fs.split(" ")), js = jsxRuntimeExports.jsx(Highlight, Object.assign({ highlightColor: "yellow.3", highlight: Fs }, Ls, { children: js == null ? void 0 : js.toString() }));
  }
  return kr.Cell && !zs && (js = kr.Cell({
    cell: _e,
    renderedCellValue: js,
    column: er,
    row: Cr,
    table: Qt
  })), js;
}, MRT_TableBodyCell = ({ cell: _e, isStriped: Qt, measureElement: Zt, numRows: $n, rowIndex: Sn, rowRef: kn, table: Kn, virtualCell: er }) => {
  var Cr, kr, Yr, Ms;
  const Ds = useMantineTheme(), { getState: Ls, options: { createDisplayMode: js, editDisplayMode: zs, enableClickToCopy: Fs, enableColumnOrdering: Bs, enableEditing: Hs, enableGrouping: Ws, enableRowNumbers: Ys, layoutMode: El, mantineTableBodyCellProps: Mu, mantineSkeletonProps: Pl, rowNumberMode: Iu }, refs: { editInputRefs: Tu }, setEditingCell: Au, setHoveredColumn: Nu } = Kn, { creatingRow: gm, density: pm, draggingColumn: zu, draggingRow: Yu, editingCell: sm, editingRow: mm, hoveredColumn: hm, hoveredRow: ym, isLoading: _m, showSkeletons: Sm } = Ls(), { column: wm, row: Nm } = _e, { columnDef: Cm } = wm, { columnDefType: Im } = Cm, Am = Mu instanceof Function ? Mu({ cell: _e, column: wm, row: Nm, table: Kn }) : Mu, Vm = Cm.mantineTableBodyCellProps instanceof Function ? Cm.mantineTableBodyCellProps({ cell: _e, column: wm, row: Nm, table: Kn }) : Cm.mantineTableBodyCellProps, Rm = Object.assign(Object.assign({}, Am), Vm), Dm = Pl instanceof Function ? Pl({ cell: _e, column: wm, row: Nm, table: Kn }) : Pl, [km, zm] = reactExports.useState(100);
  reactExports.useEffect(() => {
    if (!_m && !Sm || km !== 100)
      return;
    const v$ = wm.getSize();
    zm(Im === "display" ? v$ / 2 : Math.round(Math.random() * (v$ - v$ / 3) + v$ / 3));
  }, [_m, Sm]);
  const Pm = reactExports.useMemo(() => {
    const v$ = (zu == null ? void 0 : zu.id) === wm.id, $$ = (hm == null ? void 0 : hm.id) === wm.id, s$ = (Yu == null ? void 0 : Yu.id) === Nm.id, l$ = (ym == null ? void 0 : ym.id) === Nm.id, _$ = getIsFirstColumn(wm, Kn), a$ = getIsLastColumn(wm, Kn), n$ = Sn === $n && $n - 1, m$ = v$ || s$ ? `1px dashed ${Ds.colors.gray[7]} !important` : $$ || l$ ? `2px dashed ${getPrimaryColor(Ds)} !important` : void 0;
    return m$ ? {
      borderLeft: v$ || $$ || (s$ || l$) && _$ ? m$ : void 0,
      borderRight: v$ || $$ || (s$ || l$) && a$ ? m$ : void 0,
      borderBottom: s$ || l$ || n$ ? m$ : void 0,
      borderTop: s$ || l$ ? m$ : void 0
    } : void 0;
  }, [zu, Yu, hm, ym, Sn]), i$ = (Hs instanceof Function ? Hs(Nm) : Hs) && (Cm.enableEditing instanceof Function ? Cm.enableEditing(Nm) : Cm.enableEditing) !== !1, o$ = i$ && !["modal", "custom"].includes(zs) && (zs === "table" || (mm == null ? void 0 : mm.id) === Nm.id || (sm == null ? void 0 : sm.id) === _e.id) && !Nm.getIsGrouped(), u$ = i$ && js === "row" && (gm == null ? void 0 : gm.id) === Nm.id, h$ = (v$) => {
    var $$;
    ($$ = Rm == null ? void 0 : Rm.onDoubleClick) === null || $$ === void 0 || $$.call(Rm, v$), i$ && zs === "cell" && (Au(_e), setTimeout(() => {
      var s$;
      const l$ = Tu.current[_e.id];
      l$ && (l$.focus(), (s$ = l$.select) === null || s$ === void 0 || s$.call(l$));
    }, 100));
  }, d$ = (v$) => {
    var $$;
    ($$ = Rm == null ? void 0 : Rm.onDragEnter) === null || $$ === void 0 || $$.call(Rm, v$), Ws && (hm == null ? void 0 : hm.id) === "drop-zone" && Nu(null), Bs && zu && Nu(Cm.enableColumnOrdering !== !1 ? wm : null);
  };
  return jsxRuntimeExports.jsxs(Box, Object.assign({ component: "td", "data-index": er == null ? void 0 : er.index, ref: (v$) => {
    v$ && (Zt == null || Zt(v$));
  } }, Rm, { onDragEnter: d$, onDoubleClick: h$, sx: (v$) => Object.assign(Object.assign({ alignItems: El === "grid" ? "center" : void 0, cursor: i$ && zs === "cell" ? "pointer" : "inherit", justifyContent: El === "grid" ? Rm.align : void 0, overflow: "hidden", paddingLeft: wm.id === "mrt-row-expand" ? `${Nm.depth + 1}rem !important` : void 0, textOverflow: Im !== "display" ? "ellipsis" : void 0, whiteSpace: pm === "xs" ? "nowrap" : "normal", zIndex: (zu == null ? void 0 : zu.id) === wm.id ? 2 : wm.getIsPinned() ? 1 : 0, "&:hover": {
    outline: o$ && ["table", "cell"].includes(zs ?? "") && Im !== "display" ? `1px solid ${v$.colors.gray[7]}` : void 0,
    outlineOffset: "-1px",
    textOverflow: "clip"
  } }, getCommonCellStyles({
    column: wm,
    isStriped: Qt,
    row: Nm,
    table: Kn,
    theme: v$,
    tableCellProps: Rm
  })), Pm), children: [jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: _e.getIsPlaceholder() ? (kr = (Cr = Cm.PlaceholderCell) === null || Cr === void 0 ? void 0 : Cr.call(Cm, { cell: _e, column: wm, row: Nm, table: Kn })) !== null && kr !== void 0 ? kr : null : (_m || Sm) && [void 0, null].includes(_e.getValue()) ? jsxRuntimeExports.jsx(Skeleton, Object.assign({ height: 20, width: km }, Dm)) : Ys && Iu === "static" && wm.id === "mrt-row-numbers" ? Sn + 1 : Im === "display" && (["mrt-row-drag", "mrt-row-expand", "mrt-row-select"].includes(wm.id) || !Nm.getIsGrouped()) ? (Yr = Cm.Cell) === null || Yr === void 0 ? void 0 : Yr.call(Cm, {
    cell: _e,
    column: wm,
    row: Nm,
    rowRef: kn,
    renderedCellValue: jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: _e.getValue() }),
    table: Kn
  }) : u$ || o$ ? jsxRuntimeExports.jsx(MRT_EditCellTextInput, { cell: _e, table: Kn }) : (Fs || Cm.enableClickToCopy) && Cm.enableClickToCopy !== !1 ? jsxRuntimeExports.jsx(MRT_CopyButton, { cell: _e, table: Kn, children: jsxRuntimeExports.jsx(MRT_TableBodyCellValue, { cell: _e, table: Kn }) }) : jsxRuntimeExports.jsx(MRT_TableBodyCellValue, { cell: _e, table: Kn }) }), _e.getIsGrouped() && !Cm.GroupedCell && jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [" (", (Ms = Nm.subRows) === null || Ms === void 0 ? void 0 : Ms.length, ")"] })] }));
}, Memo_MRT_TableBodyCell = reactExports.memo(MRT_TableBodyCell, (_e, Qt) => Qt.cell === _e.cell), MRT_TableDetailPanel = ({ parentRowRef: _e, row: Qt, rowIndex: Zt, table: $n, virtualRow: Sn }) => {
  const { getVisibleLeafColumns: kn, getState: Kn, options: { layoutMode: er, mantineTableBodyRowProps: Cr, mantineDetailPanelProps: kr, renderDetailPanel: Yr } } = $n, { isLoading: Ms } = Kn(), Ds = Cr instanceof Function ? Cr({
    isDetailPanel: !0,
    row: Qt,
    staticRowIndex: Zt,
    table: $n
  }) : Cr, Ls = kr instanceof Function ? kr({ row: Qt, table: $n }) : kr;
  return jsxRuntimeExports.jsx(Box, Object.assign({ component: "tr", className: "mantine-TableBodyCell-DetailPanel" }, Ds, { sx: (js) => {
    var zs, Fs;
    return Object.assign({ display: er === "grid" ? "flex" : "table-row", position: Sn ? "absolute" : void 0, top: Sn ? `${(Fs = (zs = _e.current) === null || zs === void 0 ? void 0 : zs.getBoundingClientRect()) === null || Fs === void 0 ? void 0 : Fs.height}px` : void 0, transform: Sn ? `translateY(${Sn == null ? void 0 : Sn.start}px)` : void 0, width: "100%", zIndex: Sn ? 2 : void 0 }, (Ds == null ? void 0 : Ds.sx) instanceof Function ? Ds.sx(js) : Ds == null ? void 0 : Ds.sx);
  }, children: jsxRuntimeExports.jsx(Box, Object.assign({ component: "td", className: "mantine-TableBodyCell-DetailPanel", colSpan: kn().length }, Ls, { sx: (js) => Object.assign({ backgroundColor: Sn ? js.fn.lighten(js.colors.dark[7], 0.06) : void 0, borderBottom: Qt.getIsExpanded() ? void 0 : "none", display: er === "grid" ? "flex" : "table-cell", paddingBottom: Qt.getIsExpanded() ? "16px !important" : "0 !important", paddingTop: Qt.getIsExpanded() ? "16px !important" : "0 !important", transition: "all 100ms ease-in-out", width: `${$n.getTotalSize()}px` }, (Ls == null ? void 0 : Ls.sx) instanceof Function ? Ls.sx(js) : Ls == null ? void 0 : Ls.sx), children: Yr && jsxRuntimeExports.jsx(Collapse, { in: Qt.getIsExpanded(), children: !Ms && Yr({ row: Qt, table: $n }) }) })) }));
}, MRT_TableBodyRow = ({ columnVirtualizer: _e, enableHover: Qt, isStriped: Zt, measureElement: $n, numRows: Sn, row: kn, rowIndex: Kn, table: er, virtualColumns: Cr, virtualPaddingLeft: kr, virtualPaddingRight: Yr, virtualRow: Ms }) => {
  const { getState: Ds, options: { enableRowOrdering: Ls, layoutMode: js, memoMode: zs, mantineTableBodyRowProps: Fs, renderDetailPanel: Bs }, setHoveredRow: Hs } = er, { draggingColumn: Ws, draggingRow: Ys, editingCell: El, editingRow: Mu, hoveredRow: Pl } = Ds(), Iu = Fs instanceof Function ? Fs({ row: kn, staticRowIndex: Kn, table: er }) : Fs, Tu = (Nu) => {
    Ls && Ys && Hs(kn);
  }, Au = reactExports.useRef(null);
  return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(Box, Object.assign({ component: "tr", "data-index": Ms == null ? void 0 : Ms.index, onDragEnter: Tu, ref: (Nu) => {
    Nu && (Au.current = Nu, $n == null || $n(Nu));
  } }, Iu, { sx: (Nu) => Object.assign({ boxSizing: "border-box", display: js === "grid" ? "flex" : "table-row", opacity: (Ys == null ? void 0 : Ys.id) === kn.id || (Pl == null ? void 0 : Pl.id) === kn.id ? 0.5 : 1, position: Ms ? "absolute" : void 0, top: Ms ? 0 : void 0, transition: Ms ? "none" : "all 100ms ease-in-out", width: "100%", "&:hover td": {
    backgroundColor: Qt !== !1 ? kn.getIsSelected() ? Nu.fn.rgba(getPrimaryColor(Nu), 0.2) : Nu.colorScheme === "dark" ? `${Nu.fn.lighten(Nu.colors.dark[7], 0.12)}` : `${Nu.fn.darken(Nu.white, 0.05)}` : void 0
  } }, (Iu == null ? void 0 : Iu.sx) instanceof Function ? Iu.sx(Nu) : Iu == null ? void 0 : Iu.sx), style: Object.assign({ transform: Ms ? `translateY(${Ms == null ? void 0 : Ms.start}px)` : void 0 }, Iu == null ? void 0 : Iu.style), children: [kr ? jsxRuntimeExports.jsx("td", { style: { display: "flex", width: kr } }) : null, (Cr ?? kn.getVisibleCells()).map((Nu) => {
    var gm, pm;
    const zu = _e ? kn.getVisibleCells()[Nu.index] : Nu, Yu = {
      cell: zu,
      isStriped: Zt,
      measureElement: _e == null ? void 0 : _e.measureElement,
      numRows: Sn,
      rowIndex: Kn,
      rowRef: Au,
      table: er,
      virtualCell: _e ? Nu : void 0
    };
    return zs === "cells" && zu.column.columnDef.columnDefType === "data" && !Ws && !Ys && (El == null ? void 0 : El.id) !== zu.id && (Mu == null ? void 0 : Mu.id) !== kn.id ? jsxRuntimeExports.jsx(Memo_MRT_TableBodyCell, Object.assign({}, Yu), zu.id + ((gm = zu.getValue()) === null || gm === void 0 ? void 0 : gm.toString())) : jsxRuntimeExports.jsx(MRT_TableBodyCell, Object.assign({}, Yu), zu.id + ((pm = zu.getValue) === null || pm === void 0 ? void 0 : pm.toString()));
  }), Yr ? jsxRuntimeExports.jsx("td", { style: { display: "flex", width: Yr } }) : null] })), Bs && !kn.getIsGrouped() && jsxRuntimeExports.jsx(MRT_TableDetailPanel, { parentRowRef: Au, row: kn, rowIndex: Kn, table: er, virtualRow: Ms })] });
}, Memo_MRT_TableBodyRow = reactExports.memo(MRT_TableBodyRow, (_e, Qt) => _e.row === Qt.row && _e.rowIndex === Qt.rowIndex), MRT_TableBody = ({ columnVirtualizer: _e, enableHover: Qt, isStriped: Zt, table: $n, virtualColumns: Sn, virtualPaddingLeft: kn, virtualPaddingRight: Kn }) => {
  var er, Cr, kr;
  const { getRowModel: Yr, getPrePaginationRowModel: Ms, getState: Ds, options: { createDisplayMode: Ls, enableGlobalFilterRankedResults: js, enablePagination: zs, enableRowVirtualization: Fs, layoutMode: Bs, localization: Hs, mantineTableBodyProps: Ws, manualExpanding: Ys, manualFiltering: El, manualGrouping: Mu, manualPagination: Pl, manualSorting: Iu, memoMode: Tu, renderEmptyRowsFallback: Au, rowVirtualizerInstanceRef: Nu, rowVirtualizerProps: gm }, refs: { tableContainerRef: pm, tablePaperRef: zu } } = $n, { creatingRow: Yu, columnFilters: sm, density: mm, expanded: hm, globalFilter: ym, pagination: _m, sorting: Sm } = Ds(), wm = Ws instanceof Function ? Ws({ table: $n }) : Ws, Nm = gm instanceof Function ? gm({ table: $n }) : gm, Cm = reactExports.useMemo(() => getCanRankRows($n) && !Object.values(Sm).some(Boolean) && ym, [
    js,
    hm,
    ym,
    Ys,
    El,
    Mu,
    Iu,
    Sm
  ]), Im = reactExports.useMemo(() => {
    if (!Cm)
      return Yr().rows;
    const Rm = Ms().rows.sort((Dm, km) => rankGlobalFuzzy(Dm, km));
    if (zs && !Pl) {
      const Dm = _m.pageIndex * _m.pageSize;
      return Rm.slice(Dm, Dm + _m.pageSize);
    }
    return Rm;
  }, [
    Cm,
    Cm ? Ms().rows : Yr().rows,
    _m.pageIndex,
    _m.pageSize
  ]), Am = Fs ? useVirtualizer(Object.assign({ count: Im.length, estimateSize: () => mm === "xs" ? 42.7 : mm === "md" ? 54.7 : 70.7, getScrollElement: () => pm.current, measureElement: typeof window < "u" && navigator.userAgent.indexOf("Firefox") === -1 ? (Rm) => Rm == null ? void 0 : Rm.getBoundingClientRect().height : void 0, overscan: 4 }, Nm)) : void 0;
  Nu && Am && (Nu.current = Am);
  const Vm = Am ? Am.getVirtualItems() : void 0;
  return jsxRuntimeExports.jsxs(Box, Object.assign({ component: "tbody" }, wm, { sx: (Rm) => Object.assign({ display: Bs === "grid" ? "grid" : "table-row-group", height: Am ? `${Am.getTotalSize()}px` : "inherit", minHeight: Im.length ? void 0 : "100px", position: "relative" }, (wm == null ? void 0 : wm.sx) instanceof Function ? wm == null ? void 0 : wm.sx(Rm) : wm == null ? void 0 : wm.sx), children: [Yu && Ls === "row" && jsxRuntimeExports.jsx(MRT_TableBodyRow, { table: $n, row: Yu, rowIndex: -1 }), Im.length ? jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (Vm ?? Im).map((Rm, Dm) => {
    const km = Am ? Im[Rm.index] : Rm, zm = {
      columnVirtualizer: _e,
      enableHover: Qt,
      isStriped: Zt,
      measureElement: Am == null ? void 0 : Am.measureElement,
      numRows: Im.length,
      row: km,
      rowIndex: Am ? Rm.index : Dm,
      table: $n,
      virtualColumns: Sn,
      virtualPaddingLeft: kn,
      virtualPaddingRight: Kn,
      virtualRow: Am ? Rm : void 0
    };
    return Tu === "rows" ? jsxRuntimeExports.jsx(Memo_MRT_TableBodyRow, Object.assign({}, zm), km.id || `mrt-${km.index}`) : jsxRuntimeExports.jsx(MRT_TableBodyRow, Object.assign({}, zm), km.id || `mrt-${km.index}`);
  }) }) : jsxRuntimeExports.jsx("tr", { style: { display: Bs === "grid" ? "grid" : "table-row" }, children: jsxRuntimeExports.jsx("td", { colSpan: $n.getVisibleLeafColumns().length, style: { display: Bs === "grid" ? "grid" : "table-cell" }, children: (er = Au == null ? void 0 : Au({ table: $n })) !== null && er !== void 0 ? er : jsxRuntimeExports.jsx(Text, { sx: {
    color: "gray",
    fontStyle: "italic",
    maxWidth: `min(100vw, ${(kr = (Cr = zu.current) === null || Cr === void 0 ? void 0 : Cr.clientWidth) !== null && kr !== void 0 ? kr : 360}px)`,
    paddingTop: "2rem",
    paddingBottom: "2rem",
    textAlign: "center",
    width: "100%"
  }, children: ym || sm.length ? Hs.noResultsFound : Hs.noRecordsToDisplay }) }) })] }));
}, Memo_MRT_TableBody = reactExports.memo(MRT_TableBody, (_e, Qt) => _e.table.options.data === Qt.table.options.data), MRT_GrabHandleButton = ({ actionIconProps: _e, onDragEnd: Qt, onDragStart: Zt, table: $n }) => {
  var Sn;
  const { options: { icons: { IconGripHorizontal: kn }, localization: Kn } } = $n;
  return jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, openDelay: 1e3, label: (Sn = _e == null ? void 0 : _e.title) !== null && Sn !== void 0 ? Sn : Kn.move, children: jsxRuntimeExports.jsx(ActionIcon, Object.assign({ draggable: "true", size: "sm" }, _e, { onClick: (er) => {
    var Cr;
    er.stopPropagation(), (Cr = _e == null ? void 0 : _e.onClick) === null || Cr === void 0 || Cr.call(_e, er);
  }, onDragStart: Zt, onDragEnd: Qt, sx: (er) => Object.assign({ cursor: "grab", margin: "0 -0.16px", opacity: 0.5, padding: "2px", transition: "opacity 100ms ease-in-out", "&:hover": {
    backgroundColor: "transparent",
    opacity: 1
  }, "&:active": {
    cursor: "grabbing"
  } }, (_e == null ? void 0 : _e.sx) instanceof Function ? _e == null ? void 0 : _e.sx(er) : _e == null ? void 0 : _e.sx), title: void 0, children: jsxRuntimeExports.jsx(kn, {}) })) });
}, MRT_TableBodyRowGrabHandle = ({ row: _e, rowRef: Qt, table: Zt }) => {
  const { options: { mantineRowDragHandleProps: $n } } = Zt, Sn = $n instanceof Function ? $n({ row: _e, table: Zt }) : $n, kn = (er) => {
    var Cr;
    (Cr = Sn == null ? void 0 : Sn.onDragStart) === null || Cr === void 0 || Cr.call(Sn, er), er.dataTransfer.setDragImage(Qt.current, 0, 0), Zt.setDraggingRow(_e);
  }, Kn = (er) => {
    var Cr;
    (Cr = Sn == null ? void 0 : Sn.onDragEnd) === null || Cr === void 0 || Cr.call(Sn, er), Zt.setDraggingRow(null), Zt.setHoveredRow(null);
  };
  return jsxRuntimeExports.jsx(MRT_GrabHandleButton, { actionIconProps: Sn, onDragStart: kn, onDragEnd: Kn, table: Zt });
}, MRT_ExpandAllButton = ({ table: _e }) => {
  var Qt, Zt;
  const { getIsAllRowsExpanded: $n, getIsSomeRowsExpanded: Sn, getCanSomeRowsExpand: kn, getState: Kn, options: { icons: { IconChevronsDown: er }, localization: Cr, mantineExpandAllButtonProps: kr, renderDetailPanel: Yr }, toggleAllRowsExpanded: Ms } = _e, { density: Ds, isLoading: Ls } = Kn(), js = kr instanceof Function ? kr({ table: _e }) : kr, zs = $n();
  return jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, openDelay: 1e3, label: ((Qt = js == null ? void 0 : js.title) !== null && Qt !== void 0 ? Qt : zs) ? Cr.collapseAll : Cr.expandAll, children: jsxRuntimeExports.jsx(ActionIcon, Object.assign({ "aria-label": Cr.expandAll, disabled: Ls || !Yr && !kn(), onClick: () => Ms(!zs) }, js, { sx: (Fs) => Object.assign({ marginLeft: Ds === "xl" ? "-6px" : Ds === "md" ? "0" : "6px", opacity: 0.8, "&:disabled": {
    backgroundColor: "transparent",
    border: "none"
  }, "&:hover": {
    opacity: 1
  } }, (js == null ? void 0 : js.sx) instanceof Function ? js == null ? void 0 : js.sx(Fs) : js == null ? void 0 : js.sx), title: void 0, children: (Zt = js == null ? void 0 : js.children) !== null && Zt !== void 0 ? Zt : jsxRuntimeExports.jsx(er, { style: {
    transform: `rotate(${zs ? -180 : Sn() ? -90 : 0}deg)`,
    transition: "transform 100ms"
  } }) })) });
}, MRT_ExpandButton = ({ row: _e, table: Qt }) => {
  var Zt, $n;
  const { options: { icons: { IconChevronDown: Sn }, localization: kn, mantineExpandButtonProps: Kn, renderDetailPanel: er } } = Qt, Cr = Kn instanceof Function ? Kn({ table: Qt, row: _e }) : Kn, kr = _e.getCanExpand(), Yr = _e.getIsExpanded(), Ms = (Ds) => {
    var Ls;
    Ds.stopPropagation(), _e.toggleExpanded(), (Ls = Cr == null ? void 0 : Cr.onClick) === null || Ls === void 0 || Ls.call(Cr, Ds);
  };
  return jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, disabled: !kr && !er, openDelay: 1e3, label: ((Zt = Cr == null ? void 0 : Cr.title) !== null && Zt !== void 0 ? Zt : Yr) ? kn.collapse : kn.expand, children: jsxRuntimeExports.jsx(ActionIcon, Object.assign({ "aria-label": kn.expand, disabled: !kr && !er }, Cr, { onClick: Ms, sx: (Ds) => Object.assign({ opacity: 0.8, "&:disabled": {
    backgroundColor: "transparent",
    border: "none"
  }, "&:hover": {
    opacity: 1
  } }, (Cr == null ? void 0 : Cr.sx) instanceof Function ? Cr.sx(Ds) : Cr == null ? void 0 : Cr.sx), title: void 0, children: ($n = Cr == null ? void 0 : Cr.children) !== null && $n !== void 0 ? $n : jsxRuntimeExports.jsx(Sn, { style: {
    transform: `rotate(${!kr && !er ? -90 : Yr ? -180 : 0}deg)`,
    transition: "transform 100ms"
  } }) })) });
}, MRT_RowActionMenu = ({ handleEdit: _e, row: Qt, table: Zt }) => {
  const { options: { editDisplayMode: $n, enableEditing: Sn, icons: { IconEdit: kn, IconDots: Kn }, localization: er, positionActionsColumn: Cr, renderRowActionMenuItems: kr } } = Zt;
  return jsxRuntimeExports.jsxs(Menu, { position: Cr === "first" ? "bottom-start" : Cr === "last" ? "bottom-end" : void 0, closeOnItemClick: !0, withinPortal: !0, children: [jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, openDelay: 1e3, label: er.rowActions, children: jsxRuntimeExports.jsx(Menu.Target, { children: jsxRuntimeExports.jsx(ActionIcon, { "aria-label": er.rowActions, onClick: (Yr) => Yr.stopPropagation(), size: "sm", children: jsxRuntimeExports.jsx(Kn, {}) }) }) }), jsxRuntimeExports.jsxs(Menu.Dropdown, { onClick: (Yr) => Yr.stopPropagation(), children: [Sn && $n !== "table" && jsxRuntimeExports.jsx(Menu.Item, { icon: jsxRuntimeExports.jsx(kn, {}), onClick: _e, children: er.edit }), kr == null ? void 0 : kr({
    row: Qt,
    table: Zt
  })] })] });
}, MRT_EditActionButtons = ({ row: _e, table: Qt, variant: Zt = "icon" }) => {
  const { getState: $n, options: { icons: { IconCircleX: Sn, IconDeviceFloppy: kn }, localization: Kn, onCreatingRowCancel: er, onCreatingRowSave: Cr, onEditingRowSave: kr, onEditingRowCancel: Yr }, refs: { editInputRefs: Ms }, setCreatingRow: Ds, setEditingRow: Ls } = Qt, { creatingRow: js, editingRow: zs, isSaving: Fs } = $n(), Bs = (js == null ? void 0 : js.id) === _e.id, Hs = (zs == null ? void 0 : zs.id) === _e.id, Ws = () => {
    Bs ? (er == null || er({ row: _e, table: Qt }), Ds(null)) : Hs && (Yr == null || Yr({ row: _e, table: Qt }), Ls(null)), _e._valuesCache = {};
  }, Ys = () => {
    var El;
    (El = Object.values(Ms == null ? void 0 : Ms.current).filter((Mu) => {
      var Pl, Iu;
      return _e.id === ((Iu = (Pl = Mu == null ? void 0 : Mu.name) === null || Pl === void 0 ? void 0 : Pl.split("_")) === null || Iu === void 0 ? void 0 : Iu[0]);
    })) === null || El === void 0 || El.forEach((Mu) => {
      Mu.value !== void 0 && Object.hasOwn(_e == null ? void 0 : _e._valuesCache, Mu.name) && (_e._valuesCache[Mu.name] = Mu.value);
    }), Bs ? Cr == null || Cr({
      exitCreatingMode: () => Ds(null),
      row: _e,
      table: Qt,
      values: _e._valuesCache
    }) : Hs && (kr == null || kr({
      exitEditingMode: () => Ls(null),
      row: _e,
      table: Qt,
      values: _e == null ? void 0 : _e._valuesCache
    }));
  };
  return jsxRuntimeExports.jsx(Box, { onClick: (El) => El.stopPropagation(), sx: { display: "flex", gap: "12px" }, children: Zt === "icon" ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, label: Kn.cancel, children: jsxRuntimeExports.jsx(ActionIcon, { "aria-label": Kn.cancel, onClick: Ws, children: jsxRuntimeExports.jsx(Sn, {}) }) }), jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, label: Kn.save, children: jsxRuntimeExports.jsx(ActionIcon, { "aria-label": Kn.save, color: "blue", onClick: Ys, loading: Fs, children: jsxRuntimeExports.jsx(kn, {}) }) })] }) : jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Button, { onClick: Ws, variant: "subtle", children: Kn.cancel }), jsxRuntimeExports.jsx(Button, { onClick: Ys, variant: "filled", loading: Fs, children: Kn.save })] }) });
}, MRT_ToggleRowActionMenuButton = ({ cell: _e, row: Qt, table: Zt }) => {
  const { getState: $n, options: { createDisplayMode: Sn, editDisplayMode: kn, enableEditing: Kn, icons: { IconEdit: er }, localization: Cr, renderRowActionMenuItems: kr, renderRowActions: Yr }, setEditingRow: Ms } = Zt, { creatingRow: Ds, editingRow: Ls } = $n(), js = (Ds == null ? void 0 : Ds.id) === Qt.id, zs = (Ls == null ? void 0 : Ls.id) === Qt.id, Fs = (Hs) => {
    Hs.stopPropagation(), Ms(Object.assign({}, Qt));
  }, Bs = js && Sn === "row" || zs && kn === "row";
  return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: Yr && !Bs ? Yr({ cell: _e, row: Qt, table: Zt }) : Bs ? jsxRuntimeExports.jsx(MRT_EditActionButtons, { row: Qt, table: Zt }) : !kr && (Kn instanceof Function ? Kn(Qt) : Kn) ? jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, position: "right", label: Cr.edit, children: jsxRuntimeExports.jsx(ActionIcon, { "aria-label": Cr.edit, disabled: !!Ls && Ls.id !== Qt.id, onClick: Fs, sx: {
    opacity: 0.8,
    "&:hover": {
      opacity: 1
    },
    "&:disabled": {
      backgroundColor: "transparent",
      border: "none"
    }
  }, children: jsxRuntimeExports.jsx(er, {}) }) }) : kr ? jsxRuntimeExports.jsx(MRT_RowActionMenu, { handleEdit: Fs, row: Qt, table: Zt }) : null });
}, MRT_SelectCheckbox = ({ row: _e, selectAll: Qt, table: Zt }) => {
  var $n;
  const { getState: Sn, options: { enableMultiRowSelection: kn, localization: Kn, mantineSelectAllCheckboxProps: er, mantineSelectCheckboxProps: Cr, selectAllMode: kr, selectDisplayMode: Yr } } = Zt, { density: Ms, isLoading: Ds } = Sn(), Ls = _e ? Cr instanceof Function ? Cr({ row: _e, table: Zt }) : Cr : er instanceof Function ? er({ table: Zt }) : er, js = Qt ? kr === "page" ? Zt.getIsAllPageRowsSelected() : Zt.getIsAllRowsSelected() : void 0, zs = Object.assign(Object.assign({ "aria-label": Qt ? Kn.toggleSelectAll : Kn.toggleSelectRow, checked: Qt ? js : _e == null ? void 0 : _e.getIsSelected(), disabled: Ds || _e && !_e.getCanSelect(), onChange: _e ? _e.getToggleSelectedHandler() : kr === "all" ? Zt.getToggleAllRowsSelectedHandler() : Zt.getToggleAllPageRowsSelectedHandler(), size: Ms === "xs" ? "sm" : "md" }, Ls), { onClick: (Fs) => {
    var Bs;
    Fs.stopPropagation(), (Bs = Ls == null ? void 0 : Ls.onClick) === null || Bs === void 0 || Bs.call(Ls, Fs);
  }, title: void 0 });
  return jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, openDelay: 1e3, label: ($n = Ls == null ? void 0 : Ls.title) !== null && $n !== void 0 ? $n : Qt ? Kn.toggleSelectAll : Kn.toggleSelectRow, children: jsxRuntimeExports.jsx("span", { children: Yr === "switch" ? jsxRuntimeExports.jsx(Switch, Object.assign({}, zs)) : Yr === "radio" || kn === !1 ? jsxRuntimeExports.jsx(Radio, Object.assign({}, zs)) : jsxRuntimeExports.jsx(Checkbox, Object.assign({ indeterminate: Qt ? Zt.getIsSomeRowsSelected() && !js : _e == null ? void 0 : _e.getIsSomeSelected() }, zs)) }) });
}, useMRT_DisplayColumns = ({ creatingRow: _e, columnOrder: Qt, grouping: Zt, tableOptions: $n }) => {
  var Sn, kn;
  return reactExports.useMemo(() => {
    var Kn, er, Cr, kr, Yr, Ms, Ds, Ls, js, zs, Fs, Bs, Hs, Ws, Ys, El, Mu;
    return [
      ((er = (Kn = $n.state) === null || Kn === void 0 ? void 0 : Kn.columnOrder) !== null && er !== void 0 ? er : Qt).includes("mrt-row-drag") && Object.assign(Object.assign(Object.assign({ Cell: ({ row: Pl, rowRef: Iu, table: Tu }) => jsxRuntimeExports.jsx(MRT_TableBodyRowGrabHandle, { row: Pl, rowRef: Iu, table: Tu }), header: $n.localization.move, size: 60 }, $n.defaultDisplayColumn), (Cr = $n.displayColumnDefOptions) === null || Cr === void 0 ? void 0 : Cr["mrt-row-drag"]), { id: "mrt-row-drag" }),
      (((Yr = (kr = $n.state) === null || kr === void 0 ? void 0 : kr.columnOrder) !== null && Yr !== void 0 ? Yr : Qt).includes("mrt-row-actions") || _e && $n.createDisplayMode === "row") && Object.assign(Object.assign(Object.assign({ Cell: ({ cell: Pl, row: Iu, table: Tu }) => jsxRuntimeExports.jsx(MRT_ToggleRowActionMenuButton, { cell: Pl, row: Iu, table: Tu }), header: $n.localization.actions, size: 70 }, $n.defaultDisplayColumn), (Ms = $n.displayColumnDefOptions) === null || Ms === void 0 ? void 0 : Ms["mrt-row-actions"]), { id: "mrt-row-actions" }),
      ((Ls = (Ds = $n.state) === null || Ds === void 0 ? void 0 : Ds.columnOrder) !== null && Ls !== void 0 ? Ls : Qt).includes("mrt-row-expand") && showExpandColumn($n, (zs = (js = $n.state) === null || js === void 0 ? void 0 : js.grouping) !== null && zs !== void 0 ? zs : Zt) && Object.assign(Object.assign(Object.assign({ Cell: ({ row: Pl, table: Iu }) => jsxRuntimeExports.jsx(MRT_ExpandButton, { row: Pl, table: Iu }), Header: $n.enableExpandAll ? ({ table: Pl }) => jsxRuntimeExports.jsx(MRT_ExpandAllButton, { table: Pl }) : null, header: $n.localization.expand, size: 60 }, $n.defaultDisplayColumn), (Fs = $n.displayColumnDefOptions) === null || Fs === void 0 ? void 0 : Fs["mrt-row-expand"]), { id: "mrt-row-expand" }),
      ((Hs = (Bs = $n.state) === null || Bs === void 0 ? void 0 : Bs.columnOrder) !== null && Hs !== void 0 ? Hs : Qt).includes("mrt-row-select") && Object.assign(Object.assign(Object.assign({ Cell: ({ row: Pl, table: Iu }) => jsxRuntimeExports.jsx(MRT_SelectCheckbox, { row: Pl, table: Iu }), Header: $n.enableSelectAll && $n.enableMultiRowSelection ? ({ table: Pl }) => jsxRuntimeExports.jsx(MRT_SelectCheckbox, { selectAll: !0, table: Pl }) : null, header: $n.localization.select, size: 60 }, $n.defaultDisplayColumn), (Ws = $n.displayColumnDefOptions) === null || Ws === void 0 ? void 0 : Ws["mrt-row-select"]), { id: "mrt-row-select" }),
      ((El = (Ys = $n.state) === null || Ys === void 0 ? void 0 : Ys.columnOrder) !== null && El !== void 0 ? El : Qt).includes("mrt-row-numbers") && Object.assign(Object.assign(Object.assign({ Cell: ({ row: Pl }) => Pl.index + 1, Header: () => $n.localization.rowNumber, header: $n.localization.rowNumbers, size: 60 }, $n.defaultDisplayColumn), (Mu = $n.displayColumnDefOptions) === null || Mu === void 0 ? void 0 : Mu["mrt-row-numbers"]), { id: "mrt-row-numbers" })
    ].filter(Boolean);
  }, [
    Qt,
    Zt,
    $n.displayColumnDefOptions,
    $n.editDisplayMode,
    $n.enableColumnDragging,
    $n.enableColumnFilterModes,
    $n.enableColumnOrdering,
    $n.enableEditing,
    $n.enableExpandAll,
    $n.enableExpanding,
    $n.enableGrouping,
    $n.enableRowActions,
    $n.enableRowDragging,
    $n.enableRowNumbers,
    $n.enableRowOrdering,
    $n.enableRowSelection,
    $n.enableSelectAll,
    $n.localization,
    $n.positionActionsColumn,
    $n.renderDetailPanel,
    $n.renderRowActionMenuItems,
    $n.renderRowActions,
    (Sn = $n.state) === null || Sn === void 0 ? void 0 : Sn.columnOrder,
    (kn = $n.state) === null || kn === void 0 ? void 0 : kn.grouping
  ]);
}, useMRT_Effects = (_e) => {
  const { getState: Qt, options: { enablePagination: Zt, rowCount: $n } } = _e, { globalFilter: Sn, isFullScreen: kn, pagination: Kn, sorting: er, isLoading: Cr, showSkeletons: kr } = Qt(), Yr = reactExports.useRef(!1), Ms = reactExports.useRef(), Ds = reactExports.useRef();
  reactExports.useEffect(() => {
    typeof window < "u" && (Ms.current = document.body.style.height);
  }, []), reactExports.useEffect(() => {
    if (Yr && typeof window < "u")
      if (kn)
        Ds.current = document.body.getBoundingClientRect().top, document.body.style.height = "100vh";
      else {
        if (document.body.style.height = Ms.current, !Ds.current)
          return;
        window.scrollTo({
          top: -1 * Ds.current,
          behavior: "instant"
        });
      }
    Yr.current = !0;
  }, [kn]), reactExports.useEffect(() => {
    if (!Zt || Cr || kr)
      return;
    const { pageIndex: js, pageSize: zs } = Kn, Fs = $n ?? _e.getPrePaginationRowModel().rows.length;
    js * zs > Fs && _e.setPageIndex(Math.floor(Fs / zs));
  }, [$n, _e.getPrePaginationRowModel().rows.length]);
  const Ls = reactExports.useRef(er);
  reactExports.useEffect(() => {
    er.length && (Ls.current = er);
  }, [er]), reactExports.useEffect(() => {
    getCanRankRows(_e) && (Sn ? _e.setSorting([]) : _e.setSorting(() => Ls.current || []));
  }, [Sn]);
}, useMRT_TableInstance = (_e) => {
  var Qt, Zt, $n, Sn, kn, Kn, er, Cr, kr, Yr, Ms, Ds, Ls, js, zs, Fs, Bs, Hs, Ws, Ys, El, Mu, Pl, Iu, Tu, Au, Nu, gm, pm, zu, Yu, sm, mm, hm, ym;
  const _m = reactExports.useRef(null), Sm = reactExports.useRef({}), wm = reactExports.useRef({}), Nm = reactExports.useRef(null), Cm = reactExports.useRef(null), Im = reactExports.useRef({}), Am = reactExports.useRef(null), Vm = reactExports.useRef(null), Rm = reactExports.useMemo(() => {
    var O$, U$, R$;
    const k$ = (O$ = _e.initialState) !== null && O$ !== void 0 ? O$ : {};
    return k$.columnOrder = (U$ = k$.columnOrder) !== null && U$ !== void 0 ? U$ : getDefaultColumnOrderIds(_e), k$.globalFilterFn = (R$ = _e.globalFilterFn) !== null && R$ !== void 0 ? R$ : "fuzzy", k$;
  }, []), [Dm, km] = reactExports.useState((Qt = Rm.creatingRow) !== null && Qt !== void 0 ? Qt : null), [zm, Pm] = reactExports.useState(() => Object.assign({}, ...getAllLeafColumnDefs(_e.columns).map((O$) => {
    var U$, R$, k$, yS;
    return {
      [getColumnId(O$)]: O$.filterFn instanceof Function ? (U$ = O$.filterFn.name) !== null && U$ !== void 0 ? U$ : "custom" : (yS = (R$ = O$.filterFn) !== null && R$ !== void 0 ? R$ : (k$ = Rm == null ? void 0 : Rm.columnFilterFns) === null || k$ === void 0 ? void 0 : k$[getColumnId(O$)]) !== null && yS !== void 0 ? yS : getDefaultColumnFilterFn(O$)
    };
  }))), [i$, o$] = reactExports.useState((Zt = Rm.columnOrder) !== null && Zt !== void 0 ? Zt : []), [u$, h$] = reactExports.useState(($n = Rm == null ? void 0 : Rm.density) !== null && $n !== void 0 ? $n : "md"), [d$, v$] = reactExports.useState((Sn = Rm.draggingColumn) !== null && Sn !== void 0 ? Sn : null), [$$, s$] = reactExports.useState((kn = Rm.draggingRow) !== null && kn !== void 0 ? kn : null), [l$, _$] = reactExports.useState((Kn = Rm.editingCell) !== null && Kn !== void 0 ? Kn : null), [a$, n$] = reactExports.useState((er = Rm.editingRow) !== null && er !== void 0 ? er : null), [m$, j$] = reactExports.useState((Cr = Rm.globalFilterFn) !== null && Cr !== void 0 ? Cr : "fuzzy"), [Q$, z$] = reactExports.useState((kr = Rm.grouping) !== null && kr !== void 0 ? kr : []), [wS, aS] = reactExports.useState((Yr = Rm.hoveredColumn) !== null && Yr !== void 0 ? Yr : null), [cS, $S] = reactExports.useState((Ms = Rm.hoveredRow) !== null && Ms !== void 0 ? Ms : null), [B$, IS] = reactExports.useState((Ds = Rm == null ? void 0 : Rm.isFullScreen) !== null && Ds !== void 0 ? Ds : !1), [RS, eE] = reactExports.useState((js = (Ls = _e.initialState) === null || Ls === void 0 ? void 0 : Ls.showAlertBanner) !== null && js !== void 0 ? js : !1), [rS, sS] = reactExports.useState((zs = Rm == null ? void 0 : Rm.showColumnFilters) !== null && zs !== void 0 ? zs : !1), [PS, G$] = reactExports.useState((Fs = Rm == null ? void 0 : Rm.showGlobalFilter) !== null && Fs !== void 0 ? Fs : !1), [tS, hS] = reactExports.useState((Bs = Rm == null ? void 0 : Rm.showToolbarDropZone) !== null && Bs !== void 0 ? Bs : !1), aE = useMRT_DisplayColumns({
    columnOrder: i$,
    creatingRow: Dm,
    grouping: Q$,
    tableOptions: _e
  }), gS = reactExports.useMemo(() => {
    var O$, U$, R$;
    return prepareColumns({
      aggregationFns: _e.aggregationFns,
      columnDefs: [...aE, ..._e.columns],
      columnFilterFns: (U$ = (O$ = _e.state) === null || O$ === void 0 ? void 0 : O$.columnFilterFns) !== null && U$ !== void 0 ? U$ : zm,
      defaultDisplayColumn: (R$ = _e.defaultDisplayColumn) !== null && R$ !== void 0 ? R$ : {},
      filterFns: _e.filterFns,
      sortingFns: _e.sortingFns
    });
  }, [
    zm,
    aE,
    _e.columns,
    (Hs = _e.state) === null || Hs === void 0 ? void 0 : Hs.columnFilterFns
  ]), lS = reactExports.useMemo(() => {
    var O$, U$, R$, k$, yS;
    return (!((O$ = _e.state) === null || O$ === void 0) && O$.isLoading || !((U$ = _e.state) === null || U$ === void 0) && U$.showSkeletons) && !_e.data.length ? [
      ...Array(((k$ = (R$ = _e.state) === null || R$ === void 0 ? void 0 : R$.pagination) === null || k$ === void 0 ? void 0 : k$.pageSize) || ((yS = Rm == null ? void 0 : Rm.pagination) === null || yS === void 0 ? void 0 : yS.pageSize) || 10).fill(null)
    ].map(() => Object.assign({}, ...getAllLeafColumnDefs(_e.columns).map((HS) => ({
      [getColumnId(HS)]: null
    })))) : _e.data;
  }, [
    _e.data,
    (Ws = _e.state) === null || Ws === void 0 ? void 0 : Ws.isLoading,
    (Ys = _e.state) === null || Ys === void 0 ? void 0 : Ys.showSkeletons
  ]), M$ = useReactTable(Object.assign(Object.assign({ getCoreRowModel: getCoreRowModel(), getExpandedRowModel: _e.enableExpanding || _e.enableGrouping ? getExpandedRowModel() : void 0, getFacetedMinMaxValues: _e.enableFacetedValues ? getFacetedMinMaxValues() : void 0, getFacetedRowModel: _e.enableFacetedValues ? getFacetedRowModel() : void 0, getFacetedUniqueValues: _e.enableFacetedValues ? getFacetedUniqueValues() : void 0, getFilteredRowModel: _e.enableColumnFilters || _e.enableGlobalFilter || _e.enableFilters ? getFilteredRowModel() : void 0, getGroupedRowModel: _e.enableGrouping ? getGroupedRowModel() : void 0, getPaginationRowModel: _e.enablePagination ? getPaginationRowModel() : void 0, getSortedRowModel: _e.enableSorting ? getSortedRowModel() : void 0, onColumnOrderChange: o$, onGroupingChange: z$, getSubRows: (O$) => O$ == null ? void 0 : O$.subRows }, _e), {
    //@ts-ignore
    columns: gS,
    data: lS,
    globalFilterFn: (El = _e.filterFns) === null || El === void 0 ? void 0 : El[m$ ?? "fuzzy"],
    initialState: Rm,
    state: Object.assign({
      creatingRow: Dm,
      columnFilterFns: zm,
      columnOrder: i$,
      density: u$,
      draggingColumn: d$,
      draggingRow: $$,
      editingCell: l$,
      editingRow: a$,
      globalFilterFn: m$,
      grouping: Q$,
      hoveredColumn: wS,
      hoveredRow: cS,
      isFullScreen: B$,
      showAlertBanner: RS,
      showColumnFilters: rS,
      showGlobalFilter: PS,
      showToolbarDropZone: tS
    }, _e.state)
  }));
  M$.refs = {
    // @ts-ignore
    bottomToolbarRef: _m,
    editInputRefs: Sm,
    filterInputRefs: wm,
    // @ts-ignore
    searchInputRef: Nm,
    // @ts-ignore
    tableContainerRef: Cm,
    tableHeadCellRefs: Im,
    // @ts-ignore
    tablePaperRef: Am,
    // @ts-ignore
    topToolbarRef: Vm
  };
  const Z$ = (O$) => {
    var U$, R$;
    let k$ = O$;
    O$ === !0 && (k$ = createRow(M$)), (R$ = (U$ = _e == null ? void 0 : _e.onCreatingRowChange) === null || U$ === void 0 ? void 0 : U$.call(_e, k$)) !== null && R$ !== void 0 || km(k$);
  };
  return M$.setCreatingRow = Z$, M$.setColumnFilterFns = (Mu = _e.onColumnFilterFnsChange) !== null && Mu !== void 0 ? Mu : Pm, M$.setDensity = (Pl = _e.onDensityChange) !== null && Pl !== void 0 ? Pl : h$, M$.setDraggingColumn = (Iu = _e.onDraggingColumnChange) !== null && Iu !== void 0 ? Iu : v$, M$.setDraggingRow = (Tu = _e.onDraggingRowChange) !== null && Tu !== void 0 ? Tu : s$, M$.setEditingCell = (Au = _e.onEditingCellChange) !== null && Au !== void 0 ? Au : _$, M$.setEditingRow = (Nu = _e.onEditingRowChange) !== null && Nu !== void 0 ? Nu : n$, M$.setGlobalFilterFn = (gm = _e.onGlobalFilterFnChange) !== null && gm !== void 0 ? gm : j$, M$.setHoveredColumn = (pm = _e.onHoveredColumnChange) !== null && pm !== void 0 ? pm : aS, M$.setHoveredRow = (zu = _e.onHoveredRowChange) !== null && zu !== void 0 ? zu : $S, M$.setIsFullScreen = (Yu = _e.onIsFullScreenChange) !== null && Yu !== void 0 ? Yu : IS, M$.setShowAlertBanner = (sm = _e.onShowAlertBannerChange) !== null && sm !== void 0 ? sm : eE, M$.setShowColumnFilters = (mm = _e.onShowColumnFiltersChange) !== null && mm !== void 0 ? mm : sS, M$.setShowGlobalFilter = (hm = _e.onShowGlobalFilterChange) !== null && hm !== void 0 ? hm : G$, M$.setShowToolbarDropZone = (ym = _e.onShowToolbarDropZoneChange) !== null && ym !== void 0 ? ym : hS, useMRT_Effects(M$), M$;
}, useMantineReactTable = (_e) => {
  const Qt = useMRT_TableOptions(_e);
  return useMRT_TableInstance(Qt);
}, mrtFilterOptions = (_e) => [
  {
    option: "fuzzy",
    symbol: "≈",
    label: _e.filterFuzzy,
    divider: !1
  },
  {
    option: "contains",
    symbol: "*",
    label: _e.filterContains,
    divider: !1
  },
  {
    option: "startsWith",
    symbol: "a",
    label: _e.filterStartsWith,
    divider: !1
  },
  {
    option: "endsWith",
    symbol: "z",
    label: _e.filterEndsWith,
    divider: !0
  },
  {
    option: "equals",
    symbol: "=",
    label: _e.filterEquals,
    divider: !1
  },
  {
    option: "notEquals",
    symbol: "≠",
    label: _e.filterNotEquals,
    divider: !0
  },
  {
    option: "between",
    symbol: "⇿",
    label: _e.filterBetween,
    divider: !1
  },
  {
    option: "betweenInclusive",
    symbol: "⬌",
    label: _e.filterBetweenInclusive,
    divider: !0
  },
  {
    option: "greaterThan",
    symbol: ">",
    label: _e.filterGreaterThan,
    divider: !1
  },
  {
    option: "greaterThanOrEqualTo",
    symbol: "≥",
    label: _e.filterGreaterThanOrEqualTo,
    divider: !1
  },
  {
    option: "lessThan",
    symbol: "<",
    label: _e.filterLessThan,
    divider: !1
  },
  {
    option: "lessThanOrEqualTo",
    symbol: "≤",
    label: _e.filterLessThanOrEqualTo,
    divider: !0
  },
  {
    option: "empty",
    symbol: "∅",
    label: _e.filterEmpty,
    divider: !1
  },
  {
    option: "notEmpty",
    symbol: "!∅",
    label: _e.filterNotEmpty,
    divider: !1
  }
], rangeModes = ["between", "betweenInclusive", "inNumberRange"], emptyModes = ["empty", "notEmpty"], arrModes = ["arrIncludesSome", "arrIncludesAll", "arrIncludes"], rangeVariants = ["range-slider", "date-range", "range"], MRT_FilterOptionMenu = ({ header: _e, onSelect: Qt, table: Zt }) => {
  var $n, Sn, kn, Kn;
  const { getState: er, options: { columnFilterModeOptions: Cr, globalFilterModeOptions: kr, localization: Yr, renderColumnFilterModeMenuItems: Ms, renderGlobalFilterModeMenuItems: Ds }, setColumnFilterFns: Ls, setGlobalFilterFn: js } = Zt, { globalFilterFn: zs } = er(), { column: Fs } = _e ?? {}, { columnDef: Bs } = Fs ?? {}, Hs = Fs == null ? void 0 : Fs.getFilterValue();
  let Ws = ($n = Bs == null ? void 0 : Bs.columnFilterModeOptions) !== null && $n !== void 0 ? $n : Cr;
  rangeVariants.includes(Bs == null ? void 0 : Bs.filterVariant) && (Ws = [
    ...rangeModes,
    ...Ws ?? []
  ].filter((Pl) => rangeModes.includes(Pl)));
  const Ys = reactExports.useMemo(() => mrtFilterOptions(Yr).filter((Pl) => Bs ? Ws === void 0 || (Ws == null ? void 0 : Ws.includes(Pl.option)) : (!kr || kr.includes(Pl.option)) && ["fuzzy", "contains", "startsWith"].includes(Pl.option)), []), El = (Pl) => {
    var Iu;
    const Tu = (Iu = Bs == null ? void 0 : Bs._filterFn) !== null && Iu !== void 0 ? Iu : "";
    !_e || !Fs ? js(Pl) : Pl !== Tu && (Ls((Au) => Object.assign(Object.assign({}, Au), { [_e.id]: Pl })), emptyModes.includes(Pl) ? Hs !== " " && !emptyModes.includes(Tu) ? Fs.setFilterValue(" ") : Hs && Fs.setFilterValue(Hs) : (Bs == null ? void 0 : Bs.filterVariant) === "multi-select" || arrModes.includes(Pl) ? Hs instanceof String || Hs != null && Hs.length ? Fs.setFilterValue([]) : Hs && Fs.setFilterValue(Hs) : rangeVariants.includes(Bs == null ? void 0 : Bs.filterVariant) || rangeModes.includes(Pl) ? !Array.isArray(Hs) || !(Hs != null && Hs.every((Au) => Au === "")) && !rangeModes.includes(Tu) ? Fs.setFilterValue(["", ""]) : Fs.setFilterValue(Hs) : Array.isArray(Hs) ? Fs.setFilterValue("") : Fs.setFilterValue(Hs)), Qt == null || Qt();
  }, Mu = _e && Bs ? Bs._filterFn : zs;
  return jsxRuntimeExports.jsx(Menu.Dropdown, { children: (Kn = _e && Fs && Bs ? (kn = (Sn = Bs.renderColumnFilterModeMenuItems) === null || Sn === void 0 ? void 0 : Sn.call(Bs, {
    column: Fs,
    internalFilterOptions: Ys,
    onSelectFilterMode: El,
    table: Zt
  })) !== null && kn !== void 0 ? kn : Ms == null ? void 0 : Ms({
    column: Fs,
    internalFilterOptions: Ys,
    onSelectFilterMode: El,
    table: Zt
  }) : Ds == null ? void 0 : Ds({
    internalFilterOptions: Ys,
    onSelectFilterMode: El,
    table: Zt
  })) !== null && Kn !== void 0 ? Kn : Ys.map(({ option: Pl, label: Iu, divider: Tu, symbol: Au }, Nu) => jsxRuntimeExports.jsxs(reactExports.Fragment, { children: [jsxRuntimeExports.jsxs(Menu.Item, { onClick: () => El(Pl), color: Pl === Mu ? "blue" : void 0, sx: {
    "& > .mantine-Menu-itemLabel": {
      display: "flex",
      flexWrap: "nowrap",
      gap: "1ch"
    }
  }, value: Pl, children: [jsxRuntimeExports.jsx(Flex, { sx: {
    fontSize: "20px",
    transform: "translateY(-2px)",
    width: "2ch"
  }, children: Au }), jsxRuntimeExports.jsx(Flex, { align: "center", children: Iu })] }), Tu && jsxRuntimeExports.jsx(Menu.Divider, {})] }, Nu)) });
}, MRT_GlobalFilterTextInput = ({ table: _e }) => {
  const { getState: Qt, setGlobalFilter: Zt, options: { enableGlobalFilterModes: $n, icons: { IconSearch: Sn, IconX: kn }, localization: Kn, manualFiltering: er, mantineSearchTextInputProps: Cr }, refs: { searchInputRef: kr } } = _e, { globalFilter: Yr, showGlobalFilter: Ms } = Qt(), Ds = Cr instanceof Function ? Cr({ table: _e }) : Cr, Ls = reactExports.useRef(!1), [js, zs] = reactExports.useState(Yr ?? ""), [Fs] = useDebouncedValue(js, er ? 500 : 250);
  reactExports.useEffect(() => {
    Zt(Fs || void 0);
  }, [Fs]);
  const Bs = () => {
    zs(""), Zt(void 0);
  };
  return reactExports.useEffect(() => {
    Ls.current && (Yr === void 0 ? Bs() : zs(Yr)), Ls.current = !0;
  }, [Yr]), jsxRuntimeExports.jsxs(Collapse, { in: Ms, sx: {
    "& > div": {
      display: "flex",
      alignItems: "center",
      gap: "16px",
      flexWrap: "nowrap"
    }
  }, children: [$n && jsxRuntimeExports.jsxs(Menu, { withinPortal: !0, children: [jsxRuntimeExports.jsx(Menu.Target, { children: jsxRuntimeExports.jsx(ActionIcon, { "aria-label": Kn.changeSearchMode, size: "sm", children: jsxRuntimeExports.jsx(Sn, {}) }) }), jsxRuntimeExports.jsx(MRT_FilterOptionMenu, { table: _e, onSelect: Bs })] }), jsxRuntimeExports.jsx(TextInput, Object.assign({ placeholder: Kn.search, onChange: (Hs) => zs(Hs.target.value), value: js ?? "", variant: "filled", icon: !$n && jsxRuntimeExports.jsx(Sn, {}), rightSection: js ? jsxRuntimeExports.jsx(ActionIcon, { "aria-label": Kn.clearSearch, disabled: !(js != null && js.length), onClick: Bs, size: "sm", children: jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, label: Kn.clearSearch, children: jsxRuntimeExports.jsx(kn, {}) }) }) : null }, Ds, { ref: (Hs) => {
    Hs && (kr.current = Hs, Ds != null && Ds.ref && (Ds.ref = Hs));
  }, sx: (Hs) => Object.assign({ minWidth: "250px" }, (Ds == null ? void 0 : Ds.sx) instanceof Function ? Ds.sx(Hs) : Ds == null ? void 0 : Ds.sx) }))] });
}, MRT_ProgressBar = ({ isTopToolbar: _e, table: Qt }) => {
  const { options: { mantineProgressProps: Zt }, getState: $n } = Qt, { isSaving: Sn, showProgressBars: kn } = $n(), Kn = Zt instanceof Function ? Zt({ isTopToolbar: _e, table: Qt }) : Zt;
  return jsxRuntimeExports.jsx(Collapse, { in: Sn || kn, sx: {
    bottom: _e ? 0 : void 0,
    position: "absolute",
    top: _e ? void 0 : 0,
    width: "100%"
  }, children: jsxRuntimeExports.jsx(Progress, Object.assign({ animate: !0, "aria-busy": "true", "aria-label": "Loading", radius: 0, value: 100 }, Kn)) });
}, commonActionButtonStyles = {
  userSelect: "none",
  "&:disabled": {
    backgroundColor: "transparent",
    border: "none"
  }
}, MRT_TablePagination = ({ table: _e, position: Qt = "bottom" }) => {
  var Zt;
  const { getPrePaginationRowModel: $n, getState: Sn, setPageIndex: kn, setPageSize: Kn, options: { enableToolbarInternalActions: er, icons: { IconChevronLeftPipe: Cr, IconChevronRightPipe: kr, IconChevronLeft: Yr, IconChevronRight: Ms }, localization: Ds, mantinePaginationProps: Ls, paginationDisplayMode: js, rowCount: zs } } = _e, { pagination: { pageSize: Fs = 10, pageIndex: Bs = 0 }, showGlobalFilter: Hs } = Sn(), Ws = Ls instanceof Function ? Ls({ table: _e }) : Ls, Ys = zs ?? $n().rows.length, El = Math.ceil(Ys / Fs), Mu = El > 2 && (Ws == null ? void 0 : Ws.withEdges) !== !1, Pl = Bs * Fs, Iu = Math.min(Bs * Fs + Fs, Ys);
  return jsxRuntimeExports.jsxs(Flex, { align: "center", justify: "space-between", gap: "lg", py: "xs", px: "sm", mt: Qt === "top" && er && !Hs ? "3rem" : void 0, p: "relative", sx: { zIndex: 2 }, children: [(Ws == null ? void 0 : Ws.showRowsPerPage) !== !1 && jsxRuntimeExports.jsx(Select, { data: (Zt = Ws == null ? void 0 : Ws.rowsPerPageOptions) !== null && Zt !== void 0 ? Zt : [
    "5",
    "10",
    "15",
    "20",
    "25",
    "30",
    "50",
    "100"
  ], label: Ds.rowsPerPage, onChange: (Tu) => Kn(+Tu), value: Fs.toString(), sx: {
    "@media (min-width: 720px)": {
      display: "flex",
      alignItems: "center",
      gap: "8px"
    },
    "& .mantine-Select-input": {
      width: "80px"
    }
  }, withinPortal: !0 }), js === "pages" ? jsxRuntimeExports.jsx(Pagination$1, Object.assign({ onChange: (Tu) => kn(Tu - 1), total: El, value: Bs + 1, withEdges: Mu, nextIcon: Ms, previousIcon: Yr, firstIcon: Cr, lastIcon: kr }, Ws)) : js === "default" ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Text, { children: `${Iu === 0 ? 0 : (Pl + 1).toLocaleString()}-${Iu.toLocaleString()} ${Ds.of} ${Ys.toLocaleString()}` }), jsxRuntimeExports.jsxs(Flex, { gap: "xs", children: [Mu && jsxRuntimeExports.jsx(ActionIcon, { "aria-label": Ds.goToFirstPage, disabled: Bs <= 0, onClick: () => kn(0), sx: commonActionButtonStyles, children: jsxRuntimeExports.jsx(Cr, {}) }), jsxRuntimeExports.jsx(ActionIcon, { "aria-label": Ds.goToPreviousPage, disabled: Bs <= 0, onClick: () => kn(Bs - 1), sx: commonActionButtonStyles, children: jsxRuntimeExports.jsx(Yr, {}) }), jsxRuntimeExports.jsx(ActionIcon, { "aria-label": Ds.goToNextPage, disabled: Iu >= Ys, onClick: () => kn(Bs + 1), sx: commonActionButtonStyles, children: jsxRuntimeExports.jsx(Ms, {}) }), Mu && jsxRuntimeExports.jsx(ActionIcon, { "aria-label": Ds.goToLastPage, disabled: Iu >= Ys, onClick: () => kn(El - 1), sx: commonActionButtonStyles, children: jsxRuntimeExports.jsx(kr, {}) })] })] }) : null] });
}, MRT_FilterCheckbox = ({ column: _e, table: Qt }) => {
  var Zt, $n, Sn;
  const { getState: kn, options: { localization: Kn, mantineFilterCheckboxProps: er } } = Qt, { density: Cr } = kn(), { columnDef: kr } = _e, Yr = er instanceof Function ? er({
    column: _e,
    table: Qt
  }) : er, Ms = kr.mantineFilterCheckboxProps instanceof Function ? kr.mantineFilterCheckboxProps({
    column: _e,
    table: Qt
  }) : kr.mantineFilterCheckboxProps, Ds = Object.assign(Object.assign({}, Yr), Ms), Ls = (Zt = Kn.filterByColumn) === null || Zt === void 0 ? void 0 : Zt.replace("{column}", kr.header);
  return jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, openDelay: 1e3, label: ($n = Ds == null ? void 0 : Ds.title) !== null && $n !== void 0 ? $n : Ls, children: jsxRuntimeExports.jsx(Checkbox, Object.assign({ checked: _e.getFilterValue() === "true", indeterminate: _e.getFilterValue() === void 0, color: _e.getFilterValue() === void 0 ? "default" : "primary", size: Cr === "xs" ? "sm" : "md", label: (Sn = Ds.title) !== null && Sn !== void 0 ? Sn : Ls }, Ds, { onClick: (js) => {
    var zs;
    js.stopPropagation(), (zs = Ds == null ? void 0 : Ds.onClick) === null || zs === void 0 || zs.call(Ds, js);
  }, onChange: (js) => {
    var zs;
    _e.setFilterValue(_e.getFilterValue() === void 0 ? "true" : _e.getFilterValue() === "true" ? "false" : void 0), (zs = Ds == null ? void 0 : Ds.onChange) === null || zs === void 0 || zs.call(Ds, js);
  }, sx: (js) => Object.assign({ fontWeight: "normal", marginTop: "8px" }, (Ds == null ? void 0 : Ds.sx) instanceof Function ? Ds.sx(js) : Ds == null ? void 0 : Ds.sx), title: void 0 })) });
}, MRT_FilterTextInput = ({ header: _e, rangeFilterIndex: Qt, table: Zt }) => {
  var $n, Sn, kn, Kn, er, Cr, kr, Yr, Ms;
  const { options: { columnFilterDisplayMode: Ds, columnFilterModeOptions: Ls, icons: { IconX: js }, localization: zs, mantineFilterAutocompleteProps: Fs, mantineFilterDateInputProps: Bs, mantineFilterMultiSelectProps: Hs, mantineFilterSelectProps: Ws, mantineFilterTextInputProps: Ys, manualFiltering: El }, refs: { filterInputRefs: Mu }, setColumnFilterFns: Pl } = Zt, { column: Iu } = _e, { columnDef: Tu } = Iu, Au = Ys instanceof Function ? Ys({
    column: Iu,
    table: Zt,
    rangeFilterIndex: Qt
  }) : Ys, Nu = Tu.mantineFilterTextInputProps instanceof Function ? Tu.mantineFilterTextInputProps({
    column: Iu,
    table: Zt,
    rangeFilterIndex: Qt
  }) : Tu.mantineFilterTextInputProps, gm = Object.assign(Object.assign({}, Au), Nu), pm = Ws instanceof Function ? Ws({ column: Iu, table: Zt, rangeFilterIndex: Qt }) : Ws, zu = Tu.mantineFilterSelectProps instanceof Function ? Tu.mantineFilterSelectProps({ column: Iu, table: Zt, rangeFilterIndex: Qt }) : Tu.mantineFilterSelectProps, Yu = Object.assign(Object.assign({}, pm), zu), sm = Hs instanceof Function ? Hs({ column: Iu, table: Zt, rangeFilterIndex: Qt }) : Hs, mm = Tu.mantineFilterMultiSelectProps instanceof Function ? Tu.mantineFilterMultiSelectProps({
    column: Iu,
    table: Zt,
    rangeFilterIndex: Qt
  }) : Tu.mantineFilterMultiSelectProps, hm = Object.assign(Object.assign({}, sm), mm), ym = Bs instanceof Function ? Bs({ column: Iu, table: Zt, rangeFilterIndex: Qt }) : Bs, _m = Tu.mantineFilterDateInputProps instanceof Function ? Tu.mantineFilterDateInputProps({
    column: Iu,
    table: Zt,
    rangeFilterIndex: Qt
  }) : Tu.mantineFilterDateInputProps, Sm = Object.assign(Object.assign({}, ym), _m), wm = Fs instanceof Function ? Fs({ column: Iu, table: Zt, rangeFilterIndex: Qt }) : Fs, Nm = Tu.mantineFilterAutocompleteProps instanceof Function ? Tu.mantineFilterAutocompleteProps({
    column: Iu,
    table: Zt,
    rangeFilterIndex: Qt
  }) : Tu.mantineFilterAutocompleteProps, Cm = Object.assign(Object.assign({}, wm), Nm), Im = Tu.filterVariant === "range" || Tu.filterVariant === "date-range" || Qt !== void 0, Am = Tu.filterVariant === "select", Vm = Tu.filterVariant === "multi-select", Rm = Tu.filterVariant === "date" || Tu.filterVariant === "date-range", Dm = Tu.filterVariant === "autocomplete", km = ($n = Tu == null ? void 0 : Tu.columnFilterModeOptions) !== null && $n !== void 0 ? $n : Ls, zm = Tu._filterFn, Pm = ["empty", "notEmpty"].includes(zm) ? (
    //@ts-ignore
    zs[`filter${((kn = (Sn = zm == null ? void 0 : zm.charAt) === null || Sn === void 0 ? void 0 : Sn.call(zm, 0)) === null || kn === void 0 ? void 0 : kn.toUpperCase()) + (zm == null ? void 0 : zm.slice(1))}`]
  ) : "", i$ = Im ? Qt === 0 ? zs.min : Qt === 1 ? zs.max : "" : (Kn = gm == null ? void 0 : gm.placeholder) !== null && Kn !== void 0 ? Kn : (er = zs.filterByColumn) === null || er === void 0 ? void 0 : er.replace("{column}", String(Tu.header)), o$ = Iu.getFacetedUniqueValues(), u$ = reactExports.useMemo(() => {
    var n$, m$, j$;
    return ((j$ = (m$ = (n$ = Cm == null ? void 0 : Cm.data) !== null && n$ !== void 0 ? n$ : Yu == null ? void 0 : Yu.data) !== null && m$ !== void 0 ? m$ : hm == null ? void 0 : hm.data) !== null && j$ !== void 0 ? j$ : (Dm || Am || Vm) && o$ ? Array.from(o$.keys()).sort((Q$, z$) => Q$.localeCompare(z$)) : []).filter((Q$) => Q$ != null);
  }, [
    Cm == null ? void 0 : Cm.data,
    o$,
    Dm,
    Vm,
    Am,
    hm == null ? void 0 : hm.data,
    Yu == null ? void 0 : Yu.data
  ]), h$ = reactExports.useRef(!1), [d$, v$] = reactExports.useState(() => {
    var n$, m$;
    return Vm ? Iu.getFilterValue() || [] : Im ? ((n$ = Iu.getFilterValue()) === null || n$ === void 0 ? void 0 : n$[Qt]) || "" : (m$ = Iu.getFilterValue()) !== null && m$ !== void 0 ? m$ : "";
  }), [$$] = useDebouncedValue(d$, El ? 400 : 200);
  reactExports.useEffect(() => {
    h$.current && (Im ? Iu.setFilterValue((n$) => {
      const m$ = Array.isArray(n$) ? n$ : ["", ""];
      return m$[Qt] = $$, m$;
    }) : Iu.setFilterValue($$ ?? void 0));
  }, [$$]), reactExports.useEffect(() => {
    if (!h$.current) {
      h$.current = !0;
      return;
    }
    const n$ = Iu.getFilterValue();
    n$ === void 0 ? s$() : v$(Im && Qt !== void 0 ? (n$ ?? ["", ""])[Qt] : n$ ?? "");
  }, [Iu.getFilterValue()]);
  const s$ = () => {
    Vm ? (v$([]), Iu.setFilterValue([])) : Im ? (v$(""), Iu.setFilterValue((n$) => {
      const m$ = Array.isArray(n$) ? n$ : ["", ""];
      return m$[Qt] = void 0, m$;
    })) : (v$(""), Iu.setFilterValue(void 0));
  };
  if (Tu.Filter)
    return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (Cr = Tu.Filter) === null || Cr === void 0 ? void 0 : Cr.call(Tu, { column: Iu, header: _e, rangeFilterIndex: Qt, table: Zt }) });
  const l$ = () => {
    v$(""), Iu.setFilterValue(void 0), Pl((n$) => {
      var m$;
      return Object.assign(Object.assign({}, n$), { [_e.id]: (m$ = km == null ? void 0 : km[0]) !== null && m$ !== void 0 ? m$ : "fuzzy" });
    });
  }, _$ = {
    disabled: !!Pm,
    placeholder: i$,
    title: i$,
    onClick: (n$) => n$.stopPropagation(),
    onChange: v$,
    value: d$,
    variant: "unstyled",
    sx: (n$) => Object.assign({ borderBottom: `2px solid ${n$.colors.gray[n$.colorScheme === "dark" ? 7 : 3]}`, minWidth: Rm ? "125px" : Im ? "80px" : Pm ? "auto" : "100px", width: "100%", "& .mantine-TextInput-input": {
      overflow: "hidden",
      textOverflow: "ellipsis"
    }, "& .mantine-DateInput-input": {
      height: "2.1rem"
    } }, packSx(Vm ? hm.sx : Am ? Yu.sx : Rm ? Sm.sx : gm == null ? void 0 : gm.sx))
  }, a$ = d$ ? jsxRuntimeExports.jsx(ActionIcon, { "aria-label": zs.clearFilter, onClick: s$, size: "sm", title: (kr = zs.clearFilter) !== null && kr !== void 0 ? kr : "", children: jsxRuntimeExports.jsx(js, {}) }) : null;
  return Pm ? jsxRuntimeExports.jsx(Box, { sx: _$.sx, children: jsxRuntimeExports.jsx(Badge, { size: "lg", onClick: l$, sx: { margin: "5px" }, rightSection: a$, children: Pm }) }) : Vm ? jsxRuntimeExports.jsx(MultiSelect, Object.assign({}, _$, { clearable: !0, searchable: !0, withinPortal: !0 }, hm, { data: u$, ref: (n$) => {
    n$ && (Mu.current[`${Iu.id}-${Qt ?? 0}`] = n$, hm.ref && (hm.ref.current = n$));
  }, sx: _$.sx })) : Am ? jsxRuntimeExports.jsx(Select, Object.assign({}, _$, { clearable: !0, searchable: !0, withinPortal: !0 }, Yu, { data: u$, ref: (n$) => {
    n$ && (Mu.current[`${Iu.id}-${Qt ?? 0}`] = n$, Yu.ref && (Yu.ref.current = n$));
  }, sx: _$.sx })) : Rm ? jsxRuntimeExports.jsx(DateInput, Object.assign({}, _$, { allowDeselect: !0, clearable: !0, popoverProps: { withinPortal: Ds !== "popover" } }, Sm, { ref: (n$) => {
    n$ && (Mu.current[`${Iu.id}-${Qt ?? 0}`] = n$, Sm.ref && (Sm.ref.current = n$));
  }, sx: _$.sx })) : Dm ? jsxRuntimeExports.jsx(Autocomplete, Object.assign({}, _$, { rightSection: !((Yr = d$ == null ? void 0 : d$.toString()) === null || Yr === void 0) && Yr.length ? a$ : void 0, onChange: (n$) => v$(n$), withinPortal: !0 }, Cm, { data: u$, ref: (n$) => {
    n$ && (Mu.current[`${Iu.id}-${Qt ?? 0}`] = n$, Cm.ref && (Cm.ref.current = n$));
  }, sx: _$.sx })) : jsxRuntimeExports.jsx(TextInput, Object.assign({}, _$, { rightSection: !((Ms = d$ == null ? void 0 : d$.toString()) === null || Ms === void 0) && Ms.length ? a$ : void 0, onChange: (n$) => v$(n$.target.value) }, gm, { ref: (n$) => {
    n$ && (Mu.current[`${Iu.id}-${Qt ?? 0}`] = n$, gm.ref && (gm.ref.current = n$));
  }, sx: _$.sx }));
}, MRT_FilterRangeFields = ({ header: _e, table: Qt }) => jsxRuntimeExports.jsxs(Box, { sx: { display: "grid", gridTemplateColumns: "6fr 6fr", gap: "16px" }, children: [jsxRuntimeExports.jsx(MRT_FilterTextInput, { header: _e, rangeFilterIndex: 0, table: Qt }), jsxRuntimeExports.jsx(MRT_FilterTextInput, { header: _e, rangeFilterIndex: 1, table: Qt })] }), MRT_ToolbarAlertBanner = ({ stackAlertBanner: _e, table: Qt }) => {
  var Zt, $n, Sn;
  const { getPrePaginationRowModel: kn, getSelectedRowModel: Kn, getState: er, options: { enableRowSelection: Cr, enableSelectAll: kr, icons: { IconX: Yr }, localization: Ms, mantineToolbarAlertBannerBadgeProps: Ds, mantineToolbarAlertBannerProps: Ls, positionToolbarAlertBanner: js, renderToolbarAlertBannerContent: zs, rowCount: Fs } } = Qt, { grouping: Bs, showAlertBanner: Hs, density: Ws } = er(), Ys = Ls instanceof Function ? Ls({ table: Qt }) : Ls, El = Ds instanceof Function ? Ds({ table: Qt }) : Ds, Mu = Kn().rows.length > 0 ? ($n = (Zt = Ms.selectedCountOfRowCountRowsSelected) === null || Zt === void 0 ? void 0 : Zt.replace("{selectedCount}", Kn().rows.length.toString())) === null || $n === void 0 ? void 0 : $n.replace("{rowCount}", (Fs ?? kn().rows.length).toString()) : null, Pl = Bs.length > 0 ? jsxRuntimeExports.jsxs(Flex, { children: [Ms.groupedBy, " ", Bs.map((Iu, Tu) => jsxRuntimeExports.jsxs(reactExports.Fragment, { children: [Tu > 0 ? Ms.thenBy : "", jsxRuntimeExports.jsxs(Badge, Object.assign({ rightSection: jsxRuntimeExports.jsx(ActionIcon, { onClick: () => Qt.getColumn(Iu).toggleGrouping(), size: "xs", children: jsxRuntimeExports.jsx(Yr, {}) }), sx: { marginLeft: "1ch" }, variant: "filled" }, El, { children: [Qt.getColumn(Iu).columnDef.header, " "] }))] }, `${Tu}-${Iu}`))] }) : null;
  return jsxRuntimeExports.jsx(Collapse, { in: Hs || !!Mu || !!Pl, transitionDuration: _e ? 200 : 0, children: jsxRuntimeExports.jsx(Alert, Object.assign({ color: "blue", icon: !1 }, Ys, { sx: (Iu) => Object.assign({ borderRadius: 0, fontSize: "16px", left: 0, position: "relative", marginBottom: _e ? 0 : js === "bottom" ? "-16px" : void 0, padding: "8px", right: 0, top: 0, width: "100%", zIndex: 2 }, (Ys == null ? void 0 : Ys.sx) instanceof Function ? Ys.sx(Iu) : Ys == null ? void 0 : Ys.sx), children: (Sn = zs == null ? void 0 : zs({
    groupedAlert: Pl,
    selectedAlert: Mu,
    table: Qt
  })) !== null && Sn !== void 0 ? Sn : jsxRuntimeExports.jsxs(Flex, { sx: {
    gap: "12px",
    padding: js === "head-overlay" ? Ws === "xl" ? "16px" : Ws === "md" ? "8px" : "2px" : "8px 16px"
  }, children: [Cr && kr && js === "head-overlay" && jsxRuntimeExports.jsx(MRT_SelectCheckbox, { selectAll: !0, table: Qt }), jsxRuntimeExports.jsxs(Stack$1, { children: [Ys == null ? void 0 : Ys.children, (Ys == null ? void 0 : Ys.children) && (Mu || Pl) && jsxRuntimeExports.jsx("br", {}), Mu, Mu && Pl && jsxRuntimeExports.jsx("br", {}), Pl] })] }) })) });
}, MRT_ToggleFullScreenButton = (_e) => {
  var Qt, { table: Zt } = _e, $n = __rest(_e, ["table"]);
  const { getState: Sn, options: { icons: { IconMinimize: kn, IconMaximize: Kn }, localization: er }, setIsFullScreen: Cr } = Zt, { isFullScreen: kr } = Sn(), [Yr, Ms] = reactExports.useState(!1), Ds = () => {
    Ms(!1), Cr(!kr);
  };
  return jsxRuntimeExports.jsx(Tooltip, { opened: Yr, withinPortal: !0, label: (Qt = $n == null ? void 0 : $n.title) !== null && Qt !== void 0 ? Qt : er.toggleFullScreen, children: jsxRuntimeExports.jsx(ActionIcon, Object.assign({ "aria-label": er.toggleFullScreen, onClick: Ds, onMouseEnter: () => Ms(!0), onMouseLeave: () => Ms(!1), size: "lg" }, $n, { title: void 0, children: kr ? jsxRuntimeExports.jsx(kn, {}) : jsxRuntimeExports.jsx(Kn, {}) })) });
}, MRT_ColumnPinningButtons = ({ column: _e, table: Qt }) => {
  const { options: { icons: { IconPinned: Zt, IconPinnedOff: $n }, localization: Sn } } = Qt, kn = (Kn) => {
    _e.pin(Kn);
  };
  return jsxRuntimeExports.jsx(Flex, { sx: {
    minWidth: "70px",
    alignContent: "center",
    justifyContent: "center"
  }, children: _e.getIsPinned() ? jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, label: Sn.unpin, children: jsxRuntimeExports.jsx(ActionIcon, { onClick: () => kn(!1), size: "md", children: jsxRuntimeExports.jsx($n, {}) }) }) : jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, label: Sn.pinToLeft, children: jsxRuntimeExports.jsx(ActionIcon, { onClick: () => kn("left"), size: "md", children: jsxRuntimeExports.jsx(Zt, { style: {
    transform: "rotate(90deg)"
  } }) }) }), jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, label: Sn.pinToRight, children: jsxRuntimeExports.jsx(ActionIcon, { onClick: () => kn("right"), size: "md", children: jsxRuntimeExports.jsx(Zt, { style: {
    transform: "rotate(-90deg)"
  } }) }) })] }) });
}, MRT_ShowHideColumnsMenuItems = ({ allColumns: _e, hoveredColumn: Qt, setHoveredColumn: Zt, column: $n, isSubMenu: Sn, table: kn }) => {
  var Kn;
  const { getState: er, options: { enableColumnOrdering: Cr, enableHiding: kr, enablePinning: Yr, localization: Ms }, setColumnOrder: Ds } = kn, { columnOrder: Ls } = er(), { columnDef: js } = $n, { columnDefType: zs } = js, Fs = zs !== "group" && $n.getIsVisible() || zs === "group" && $n.getLeafColumns().some((Iu) => Iu.getIsVisible()), Bs = (Iu) => {
    var Tu, Au;
    zs === "group" ? (Au = (Tu = Iu == null ? void 0 : Iu.columns) === null || Tu === void 0 ? void 0 : Tu.forEach) === null || Au === void 0 || Au.call(Tu, (Nu) => {
      Nu.toggleVisibility(!Fs);
    }) : Iu.toggleVisibility();
  }, Hs = reactExports.useRef(null), [Ws, Ys] = reactExports.useState(!1), El = (Iu) => {
    Ys(!0), Iu.dataTransfer.setDragImage(Hs.current, 0, 0);
  }, Mu = (Iu) => {
    Ys(!1), Zt(null), Qt && Ds(reorderColumn($n, Qt, Ls));
  }, Pl = (Iu) => {
    !Ws && js.enableColumnOrdering !== !1 && Zt($n);
  };
  return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Menu.Item, { component: "span", ref: Hs, onDragEnter: Pl, sx: (Iu) => ({
    alignItems: "center",
    cursor: "default",
    justifyContent: "flex-start",
    opacity: Ws ? 0.5 : 1,
    outline: Ws ? `1px dashed ${Iu.colors.gray[7]}` : (Qt == null ? void 0 : Qt.id) === $n.id ? `2px dashed ${getPrimaryColor(Iu)}` : "none",
    paddingLeft: `${($n.depth + 0.5) * 2}rem`,
    paddingTop: "6px",
    paddingBottom: "6px"
  }), children: jsxRuntimeExports.jsxs(Box, { sx: {
    display: "flex",
    flexWrap: "nowrap",
    gap: "8px"
  }, children: [!Sn && zs !== "group" && Cr && !_e.some((Iu) => Iu.columnDef.columnDefType === "group") && (js.enableColumnOrdering !== !1 ? jsxRuntimeExports.jsx(MRT_GrabHandleButton, { onDragEnd: Mu, onDragStart: El, table: kn }) : jsxRuntimeExports.jsx(Box, { sx: { width: "22px" } })), !Sn && Yr && ($n.getCanPin() ? jsxRuntimeExports.jsx(MRT_ColumnPinningButtons, { column: $n, table: kn }) : jsxRuntimeExports.jsx(Box, { sx: { width: "70px" } })), kr ? jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, openDelay: 1e3, label: Ms.toggleVisibility, children: jsxRuntimeExports.jsx(Switch, { checked: Fs, disabled: Sn && Fs || !$n.getCanHide(), label: js.header, onChange: () => Bs($n), sx: {
    cursor: "pointer !important"
  } }) }) : jsxRuntimeExports.jsx(Text, { sx: { alignSelf: "center" }, children: js.header })] }) }), (Kn = $n.columns) === null || Kn === void 0 ? void 0 : Kn.map((Iu, Tu) => jsxRuntimeExports.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: _e, column: Iu, hoveredColumn: Qt, isSubMenu: Sn, setHoveredColumn: Zt, table: kn }, `${Tu}-${Iu.id}`))] });
}, MRT_ShowHideColumnsMenu = ({ isSubMenu: _e, table: Qt }) => {
  const { getAllColumns: Zt, getAllLeafColumns: $n, getCenterLeafColumns: Sn, getIsAllColumnsVisible: kn, getIsSomeColumnsPinned: Kn, getIsSomeColumnsVisible: er, getLeftLeafColumns: Cr, getRightLeafColumns: kr, getState: Yr, toggleAllColumnsVisible: Ms, options: { enableColumnOrdering: Ds, enableHiding: Ls, enablePinning: js, localization: zs } } = Qt, { columnOrder: Fs, columnPinning: Bs } = Yr(), Hs = () => {
    $n().filter((Mu) => Mu.columnDef.enableHiding !== !1).forEach((Mu) => Mu.toggleVisibility(!1));
  }, Ws = reactExports.useMemo(() => {
    const Mu = Zt();
    return Fs.length > 0 && !Mu.some((Pl) => Pl.columnDef.columnDefType === "group") ? [
      ...Cr(),
      ...Array.from(new Set(Fs)).map((Pl) => Sn().find((Iu) => (Iu == null ? void 0 : Iu.id) === Pl)),
      ...kr()
    ].filter(Boolean) : Mu;
  }, [
    Fs,
    Bs,
    Zt(),
    Sn(),
    Cr(),
    kr()
  ]), [Ys, El] = reactExports.useState(null);
  return jsxRuntimeExports.jsxs(Menu.Dropdown, { sx: {
    maxHeight: "calc(80vh - 100px)",
    overflowY: "auto"
  }, children: [jsxRuntimeExports.jsxs(Flex, { sx: {
    justifyContent: _e ? "center" : "space-between",
    padding: "8px",
    gap: "8px"
  }, children: [!_e && Ls && jsxRuntimeExports.jsx(Button, { disabled: !er(), onClick: Hs, variant: "subtle", children: zs.hideAll }), !_e && Ds && jsxRuntimeExports.jsx(Button, { onClick: () => Qt.setColumnOrder(getDefaultColumnOrderIds(Qt.options)), variant: "subtle", children: zs.resetOrder }), !_e && js && jsxRuntimeExports.jsx(Button, { disabled: !Kn(), onClick: () => Qt.resetColumnPinning(!0), variant: "subtle", children: zs.unpinAll }), Ls && jsxRuntimeExports.jsx(Button, { disabled: kn(), onClick: () => Ms(!0), variant: "subtle", children: zs.showAll })] }), jsxRuntimeExports.jsx(Divider, {}), Ws.map((Mu, Pl) => jsxRuntimeExports.jsx(MRT_ShowHideColumnsMenuItems, { allColumns: Ws, column: Mu, hoveredColumn: Ys, isSubMenu: _e, setHoveredColumn: El, table: Qt }, `${Pl}-${Mu.id}`))] });
}, MRT_ShowHideColumnsButton = (_e) => {
  var Qt, { table: Zt } = _e, $n = __rest(_e, ["table"]);
  const { options: { icons: { IconColumns: Sn }, localization: kn } } = Zt;
  return jsxRuntimeExports.jsxs(Menu, { closeOnItemClick: !1, withinPortal: !0, children: [jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, label: (Qt = $n == null ? void 0 : $n.title) !== null && Qt !== void 0 ? Qt : kn.showHideColumns, children: jsxRuntimeExports.jsx(Menu.Target, { children: jsxRuntimeExports.jsx(ActionIcon, Object.assign({ "aria-label": kn.showHideColumns, size: "lg" }, $n, { title: void 0, children: jsxRuntimeExports.jsx(Sn, {}) })) }) }), jsxRuntimeExports.jsx(MRT_ShowHideColumnsMenu, { table: Zt })] });
}, sizes = ["xs", "md", "xl"], MRT_ToggleDensePaddingButton = (_e) => {
  var Qt, { table: Zt } = _e, $n = __rest(_e, ["table"]);
  const { getState: Sn, options: { icons: { IconBaselineDensityLarge: kn, IconBaselineDensityMedium: Kn, IconBaselineDensitySmall: er }, localization: Cr }, setDensity: kr } = Zt, { density: Yr } = Sn(), Ms = () => {
    var Ds;
    kr((Ds = sizes[(sizes.indexOf(Yr) - 1) % sizes.length]) !== null && Ds !== void 0 ? Ds : "xl");
  };
  return jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, label: (Qt = $n == null ? void 0 : $n.title) !== null && Qt !== void 0 ? Qt : Cr.toggleDensity, children: jsxRuntimeExports.jsx(ActionIcon, Object.assign({ "aria-label": Cr.toggleDensity, onClick: Ms, size: "lg" }, $n, { title: void 0, children: Yr === "xs" ? jsxRuntimeExports.jsx(er, {}) : Yr === "md" ? jsxRuntimeExports.jsx(Kn, {}) : jsxRuntimeExports.jsx(kn, {}) })) });
}, MRT_ToggleFiltersButton = (_e) => {
  var Qt, { table: Zt } = _e, $n = __rest(_e, ["table"]);
  const { getState: Sn, options: { icons: { IconFilter: kn, IconFilterOff: Kn }, localization: er }, setShowColumnFilters: Cr } = Zt, { showColumnFilters: kr } = Sn(), Yr = () => {
    Cr(!kr);
  };
  return jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, label: (Qt = $n == null ? void 0 : $n.title) !== null && Qt !== void 0 ? Qt : er.showHideFilters, children: jsxRuntimeExports.jsx(ActionIcon, Object.assign({ "aria-label": er.showHideFilters, onClick: Yr, size: "lg" }, $n, { title: void 0, children: kr ? jsxRuntimeExports.jsx(Kn, {}) : jsxRuntimeExports.jsx(kn, {}) })) });
}, MRT_ToggleGlobalFilterButton = (_e) => {
  var Qt, Zt, { table: $n } = _e, Sn = __rest(_e, ["table"]);
  const { getState: kn, options: { icons: { IconSearch: Kn, IconSearchOff: er }, localization: Cr }, refs: { searchInputRef: kr }, setShowGlobalFilter: Yr } = $n, { globalFilter: Ms, showGlobalFilter: Ds } = kn(), Ls = () => {
    Yr(!Ds), setTimeout(() => {
      var js;
      return (js = kr.current) === null || js === void 0 ? void 0 : js.focus();
    }, 100);
  };
  return jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, label: (Qt = Sn == null ? void 0 : Sn.title) !== null && Qt !== void 0 ? Qt : Cr.showHideSearch, children: jsxRuntimeExports.jsx(ActionIcon, Object.assign({ "aria-label": (Zt = Sn == null ? void 0 : Sn.title) !== null && Zt !== void 0 ? Zt : Cr.showHideSearch, disabled: !!Ms, onClick: Ls, size: "lg" }, Sn, { title: void 0, children: Ds ? jsxRuntimeExports.jsx(er, {}) : jsxRuntimeExports.jsx(Kn, {}) })) });
}, MRT_ToolbarInternalButtons = ({ table: _e }) => {
  var Qt;
  const { options: { columnFilterDisplayMode: Zt, enableColumnFilters: $n, enableColumnOrdering: Sn, enableDensityToggle: kn, enableFilters: Kn, enableFullScreenToggle: er, enableGlobalFilter: Cr, enableHiding: kr, enablePinning: Yr, initialState: Ms, renderToolbarInternalActions: Ds } } = _e;
  return jsxRuntimeExports.jsx(Flex, { sx: {
    alignItems: "center",
    gap: "2px",
    zIndex: 3
  }, children: (Qt = Ds == null ? void 0 : Ds({
    table: _e
  })) !== null && Qt !== void 0 ? Qt : jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [Kn && Cr && !(Ms != null && Ms.showGlobalFilter) && jsxRuntimeExports.jsx(MRT_ToggleGlobalFilterButton, { table: _e }), Kn && $n && Zt !== "popover" && jsxRuntimeExports.jsx(MRT_ToggleFiltersButton, { table: _e }), (kr || Sn || Yr) && jsxRuntimeExports.jsx(MRT_ShowHideColumnsButton, { table: _e }), kn && jsxRuntimeExports.jsx(MRT_ToggleDensePaddingButton, { table: _e }), er && jsxRuntimeExports.jsx(MRT_ToggleFullScreenButton, { table: _e })] }) });
}, MRT_ToolbarDropZone = ({ table: _e }) => {
  const { getState: Qt, options: { enableGrouping: Zt, localization: $n }, setHoveredColumn: Sn, setShowToolbarDropZone: kn } = _e, { draggingColumn: Kn, hoveredColumn: er, grouping: Cr, showToolbarDropZone: kr } = Qt(), Yr = (Ms) => {
    Sn({ id: "drop-zone" });
  };
  return reactExports.useEffect(() => {
    var Ms;
    ((Ms = _e.options.state) === null || Ms === void 0 ? void 0 : Ms.showToolbarDropZone) !== void 0 && kn(!!Zt && !!Kn && Kn.columnDef.enableGrouping !== !1 && !Cr.includes(Kn.id));
  }, [Zt, Kn, Cr]), jsxRuntimeExports.jsx(Transition$1, { mounted: kr, transition: "fade", children: (Ms) => {
    var Ds, Ls;
    return jsxRuntimeExports.jsx(Flex, { className: "mantine-ToolbarDropZone", sx: (js) => ({
      alignItems: "center",
      backgroundColor: js.fn.rgba(getPrimaryColor(js), (er == null ? void 0 : er.id) === "drop-zone" ? 0.2 : 0.1),
      border: `dashed ${getPrimaryColor(js)} 2px`,
      justifyContent: "center",
      height: "calc(100%)",
      position: "absolute",
      width: "calc(100%)",
      zIndex: 2
    }), onDragEnter: Yr, style: Ms, children: jsxRuntimeExports.jsx(Text, { children: $n.dropToGroupBy.replace("{column}", (Ls = (Ds = Kn == null ? void 0 : Kn.columnDef) === null || Ds === void 0 ? void 0 : Ds.header) !== null && Ls !== void 0 ? Ls : "") }) });
  } });
}, commonToolbarStyles = ({ theme: _e }) => ({
  alignItems: "flex-start",
  backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[7] : _e.white,
  backgroundImage: "none",
  display: "grid",
  flexWrap: "wrap-reverse",
  minHeight: "3.5rem",
  overflow: "visible",
  padding: "0",
  transition: "all 100ms ease-in-out",
  zIndex: 3
}), MRT_TopToolbar = ({ table: _e }) => {
  var Qt;
  const { getState: Zt, options: { enableGlobalFilter: $n, enablePagination: Sn, enableToolbarInternalActions: kn, mantineTopToolbarProps: Kn, positionGlobalFilter: er, positionPagination: Cr, positionToolbarAlertBanner: kr, positionToolbarDropZone: Yr, renderTopToolbarCustomActions: Ms }, refs: { topToolbarRef: Ds } } = _e, { isFullScreen: Ls, showGlobalFilter: js } = Zt(), zs = useMediaQuery("(max-width: 720px)"), Fs = Kn instanceof Function ? Kn({ table: _e }) : Kn, Bs = zs || !!Ms || js;
  return jsxRuntimeExports.jsxs(Box, Object.assign({}, Fs, { ref: (Hs) => {
    Hs && (Ds.current = Hs, Fs != null && Fs.ref && (Fs.ref.current = Hs));
  }, sx: (Hs) => Object.assign(Object.assign({ position: Ls ? "sticky" : "relative", top: Ls ? "0" : void 0 }, commonToolbarStyles({ theme: Hs })), (Fs == null ? void 0 : Fs.sx) instanceof Function ? Fs.sx(Hs) : Fs == null ? void 0 : Fs.sx), children: [kr === "top" && jsxRuntimeExports.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: Bs, table: _e }), ["both", "top"].includes(Yr ?? "") && jsxRuntimeExports.jsx(MRT_ToolbarDropZone, { table: _e }), jsxRuntimeExports.jsxs(Flex, { sx: {
    alignItems: "flex-start",
    boxSizing: "border-box",
    justifyContent: "space-between",
    padding: "8px",
    position: Bs ? "relative" : "absolute",
    right: 0,
    top: 0,
    width: "100%"
  }, children: [$n && er === "left" && jsxRuntimeExports.jsx(MRT_GlobalFilterTextInput, { table: _e }), (Qt = Ms == null ? void 0 : Ms({ table: _e })) !== null && Qt !== void 0 ? Qt : jsxRuntimeExports.jsx("span", {}), kn ? jsxRuntimeExports.jsxs(Flex, { sx: {
    flexWrap: "wrap-reverse",
    justifyContent: "flex-end"
  }, children: [$n && er === "right" && jsxRuntimeExports.jsx(MRT_GlobalFilterTextInput, { table: _e }), jsxRuntimeExports.jsx(MRT_ToolbarInternalButtons, { table: _e })] }) : $n && er === "right" && jsxRuntimeExports.jsx(MRT_GlobalFilterTextInput, { table: _e })] }), Sn && ["top", "both"].includes(Cr ?? "") && jsxRuntimeExports.jsx(Flex, { justify: "end", children: jsxRuntimeExports.jsx(MRT_TablePagination, { table: _e, position: "top" }) }), jsxRuntimeExports.jsx(MRT_ProgressBar, { isTopToolbar: !0, table: _e })] }));
}, MRT_BottomToolbar = ({ table: _e }) => {
  const { getState: Qt, options: { enablePagination: Zt, mantineBottomToolbarProps: $n, positionPagination: Sn, positionToolbarAlertBanner: kn, positionToolbarDropZone: Kn, renderBottomToolbarCustomActions: er }, refs: { bottomToolbarRef: Cr } } = _e, { isFullScreen: kr } = Qt(), Yr = useMediaQuery("(max-width: 720px)"), Ms = $n instanceof Function ? $n({ table: _e }) : $n, Ds = Yr || !!er;
  return jsxRuntimeExports.jsxs(Box, Object.assign({}, Ms, { ref: (Ls) => {
    Ls && (Cr.current = Ls, Ms != null && Ms.ref && (Ms.ref.current = Ls));
  }, sx: (Ls) => Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme: Ls })), { bottom: kr ? "0" : void 0, boxShadow: `0 1px 2px -1px ${Ls.fn.rgba(Ls.black, 0.1)} inset`, left: 0, position: kr ? "fixed" : "relative", right: 0 }), (Ms == null ? void 0 : Ms.sx) instanceof Function ? Ms.sx(Ls) : Ms == null ? void 0 : Ms.sx), children: [jsxRuntimeExports.jsx(MRT_ProgressBar, { isTopToolbar: !1, table: _e }), kn === "bottom" && jsxRuntimeExports.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: Ds, table: _e }), ["both", "bottom"].includes(Kn ?? "") && jsxRuntimeExports.jsx(MRT_ToolbarDropZone, { table: _e }), jsxRuntimeExports.jsxs(Box, { sx: {
    alignItems: "center",
    boxSizing: "border-box",
    display: "flex",
    justifyContent: "space-between",
    padding: "8px",
    width: "100%"
  }, children: [er ? er({ table: _e }) : jsxRuntimeExports.jsx("span", {}), jsxRuntimeExports.jsx(Box, { sx: {
    display: "flex",
    justifyContent: "flex-end",
    position: Ds ? "relative" : "absolute",
    right: 0,
    top: 0
  }, children: Zt && ["bottom", "both"].includes(Sn ?? "") && jsxRuntimeExports.jsx(MRT_TablePagination, { table: _e, position: "bottom" }) })] })] }));
}, MRT_ColumnActionMenu = ({ header: _e, table: Qt }) => {
  var Zt, $n, Sn, kn, Kn, er, Cr, kr, Yr, Ms;
  const { getState: Ds, toggleAllColumnsVisible: Ls, setColumnOrder: js, options: { columnFilterDisplayMode: zs, enableColumnFilters: Fs, enableColumnResizing: Bs, enableGrouping: Hs, enableHiding: Ws, enablePinning: Ys, enableSorting: El, enableSortingRemoval: Mu, icons: { IconArrowAutofitContent: Pl, IconBoxMultiple: Iu, IconClearAll: Tu, IconColumns: Au, IconDotsVertical: Nu, IconEyeOff: gm, IconFilter: pm, IconFilterOff: zu, IconPinned: Yu, IconPinnedOff: sm, IconSortAscending: mm, IconSortDescending: hm }, localization: ym, mantineColumnActionsButtonProps: _m, renderColumnActionsMenuItems: Sm }, refs: { filterInputRefs: wm }, setColumnSizingInfo: Nm, setShowColumnFilters: Cm } = Qt, { column: Im } = _e, { columnDef: Am } = Im, { columnSizing: Vm, columnVisibility: Rm } = Ds(), Dm = _m instanceof Function ? _m({ column: Im, table: Qt }) : _m, km = Am.mantineColumnActionsButtonProps instanceof Function ? Am.mantineColumnActionsButtonProps({
    column: Im,
    table: Qt
  }) : Am.mantineColumnActionsButtonProps, zm = Object.assign(Object.assign({}, Dm), km), Pm = () => {
    Im.clearSorting();
  }, i$ = () => {
    Im.toggleSorting(!1);
  }, o$ = () => {
    Im.toggleSorting(!0);
  }, u$ = () => {
    Nm((a$) => Object.assign(Object.assign({}, a$), { isResizingColumn: !1 })), Im.resetSize();
  }, h$ = () => {
    Im.toggleVisibility(!1);
  }, d$ = (a$) => {
    Im.pin(a$);
  }, v$ = () => {
    Im.toggleGrouping(), js((a$) => ["mrt-row-expand", ...a$]);
  }, $$ = () => {
    Im.setFilterValue("");
  }, s$ = () => {
    Cm(!0), setTimeout(() => {
      var a$;
      return (a$ = wm.current[`${Im.id}-0`]) === null || a$ === void 0 ? void 0 : a$.focus();
    }, 100);
  }, l$ = () => {
    Ls(!0);
  }, _$ = jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [El && Im.getCanSort() && jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [Mu !== !1 && jsxRuntimeExports.jsx(Menu.Item, { disabled: !Im.getIsSorted(), icon: jsxRuntimeExports.jsx(Tu, {}), onClick: Pm, children: ym.clearSort }), jsxRuntimeExports.jsx(Menu.Item, { disabled: Im.getIsSorted() === "asc", icon: jsxRuntimeExports.jsx(mm, {}), onClick: i$, children: (Zt = ym.sortByColumnAsc) === null || Zt === void 0 ? void 0 : Zt.replace("{column}", String(Am.header)) }), jsxRuntimeExports.jsx(Menu.Item, { icon: jsxRuntimeExports.jsx(hm, {}), disabled: Im.getIsSorted() === "desc", onClick: o$, children: ($n = ym.sortByColumnDesc) === null || $n === void 0 ? void 0 : $n.replace("{column}", String(Am.header)) }), (Fs || Hs || Ws) && jsxRuntimeExports.jsx(Menu.Divider, {}, 3)] }), Fs && zs !== "popover" && Im.getCanFilter() && jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Menu.Item, { disabled: !Im.getFilterValue(), icon: jsxRuntimeExports.jsx(zu, {}), onClick: $$, children: ym.clearFilter }), jsxRuntimeExports.jsx(Menu.Item, { icon: jsxRuntimeExports.jsx(pm, {}), onClick: s$, children: (Sn = ym.filterByColumn) === null || Sn === void 0 ? void 0 : Sn.replace("{column}", String(Am.header)) }), (Hs || Ws) && jsxRuntimeExports.jsx(Menu.Divider, {}, 2)] }), Hs && Im.getCanGroup() && jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Menu.Item, { icon: jsxRuntimeExports.jsx(Iu, {}), onClick: v$, children: (kn = ym[Im.getIsGrouped() ? "ungroupByColumn" : "groupByColumn"]) === null || kn === void 0 ? void 0 : kn.replace("{column}", String(Am.header)) }), Ys && jsxRuntimeExports.jsx(Menu.Divider, {})] }), Ys && Im.getCanPin() && jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Menu.Item, { disabled: Im.getIsPinned() === "left" || !Im.getCanPin(), icon: jsxRuntimeExports.jsx(Yu, { style: { transform: "rotate(90deg)" } }), onClick: () => d$("left"), children: ym.pinToLeft }), jsxRuntimeExports.jsx(Menu.Item, { disabled: Im.getIsPinned() === "right" || !Im.getCanPin(), icon: jsxRuntimeExports.jsx(Yu, { style: { transform: "rotate(-90deg)" } }), onClick: () => d$("right"), children: ym.pinToRight }), jsxRuntimeExports.jsx(Menu.Item, { disabled: !Im.getIsPinned(), icon: jsxRuntimeExports.jsx(sm, {}), onClick: () => d$(!1), children: ym.unpin }), Ws && jsxRuntimeExports.jsx(Menu.Divider, {})] }), Bs && Im.getCanResize() && jsxRuntimeExports.jsx(Menu.Item, { disabled: !Vm[Im.id], icon: jsxRuntimeExports.jsx(Pl, {}), onClick: u$, children: ym.resetColumnSize }, 0), Ws && jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Menu.Item, { disabled: !Im.getCanHide(), icon: jsxRuntimeExports.jsx(gm, {}), onClick: h$, children: (Kn = ym.hideColumn) === null || Kn === void 0 ? void 0 : Kn.replace("{column}", String(Am.header)) }, 0), jsxRuntimeExports.jsx(Menu.Item, { disabled: !Object.values(Rm).filter((a$) => !a$).length, icon: jsxRuntimeExports.jsx(Au, {}), onClick: l$, children: (er = ym.showAllColumns) === null || er === void 0 ? void 0 : er.replace("{column}", String(Am.header)) }, 1)] })] });
  return jsxRuntimeExports.jsxs(Menu, { closeOnItemClick: !0, withinPortal: !0, position: "bottom-start", children: [jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, openDelay: 1e3, label: (Cr = zm == null ? void 0 : zm.title) !== null && Cr !== void 0 ? Cr : ym.columnActions, children: jsxRuntimeExports.jsx(Menu.Target, { children: jsxRuntimeExports.jsx(ActionIcon, Object.assign({ "aria-label": ym.columnActions, size: "sm" }, zm, { sx: (a$) => Object.assign({ opacity: 0.5, transition: "opacity 100ms", "&:hover": {
    opacity: 1
  } }, (zm == null ? void 0 : zm.sx) instanceof Function ? zm.sx(a$) : zm == null ? void 0 : zm.sx), children: jsxRuntimeExports.jsx(Nu, {}) })) }) }), jsxRuntimeExports.jsx(Menu.Dropdown, { children: (Ms = (Yr = (kr = Am.renderColumnActionsMenuItems) === null || kr === void 0 ? void 0 : kr.call(Am, {
    column: Im,
    table: Qt,
    internalColumnMenuItems: _$
  })) !== null && Yr !== void 0 ? Yr : Sm == null ? void 0 : Sm({
    column: Im,
    table: Qt,
    internalColumnMenuItems: _$
  })) !== null && Ms !== void 0 ? Ms : _$ })] });
}, MRT_FilterRangeSlider = ({ header: _e, table: Qt }) => {
  var Zt;
  const { options: { mantineFilterRangeSliderProps: $n }, refs: { filterInputRefs: Sn } } = Qt, { column: kn } = _e, { columnDef: Kn } = kn, er = $n instanceof Function ? $n({
    column: kn,
    table: Qt
  }) : $n, Cr = Kn.mantineFilterRangeSliderProps instanceof Function ? Kn.mantineFilterRangeSliderProps({
    column: kn,
    table: Qt
  }) : Kn.mantineFilterRangeSliderProps, kr = Object.assign(Object.assign({}, er), Cr);
  let [Yr, Ms] = kr.min !== void 0 && kr.max !== void 0 ? [kr.min, kr.max] : (Zt = kn.getFacetedMinMaxValues()) !== null && Zt !== void 0 ? Zt : [0, 1];
  Array.isArray(Yr) && (Yr = Yr[0]), Array.isArray(Ms) && (Ms = Ms[0]), Yr === null && (Yr = 0), Ms === null && (Ms = 1);
  const [Ds, Ls] = reactExports.useState([
    Yr,
    Ms
  ]), js = kn.getFilterValue(), zs = reactExports.useRef(!1);
  return reactExports.useEffect(() => {
    zs.current && (js === void 0 ? Ls([Yr, Ms]) : Array.isArray(js) && Ls(js)), zs.current = !0;
  }, [js, Yr, Ms]), jsxRuntimeExports.jsx(RangeSlider, Object.assign({ min: Yr, max: Ms, onChange: (Fs) => {
    Ls(Fs);
  }, onChangeEnd: (Fs) => {
    Array.isArray(Fs) && (Fs[0] <= Yr && Fs[1] >= Ms ? kn.setFilterValue(void 0) : kn.setFilterValue(Fs));
  }, value: Ds }, kr, { ref: (Fs) => {
    Fs && (Sn.current[`${kn.id}-0`] = Fs, kr != null && kr.ref && (kr.ref = Fs));
  }, sx: (Fs) => Object.assign({ margin: "auto", marginTop: "16px", marginBottom: "6px", width: "calc(100% - 8px)" }, (kr == null ? void 0 : kr.sx) instanceof Function ? kr.sx(Fs) : kr == null ? void 0 : kr.sx) }));
}, MRT_TableHeadCellFilterContainer = ({ header: _e, table: Qt }) => {
  var Zt, $n, Sn;
  const { getState: kn, options: { columnFilterDisplayMode: Kn, enableColumnFilterModes: er, columnFilterModeOptions: Cr, icons: { IconFilterCog: kr }, localization: Yr }, refs: { filterInputRefs: Ms } } = Qt, { showColumnFilters: Ds } = kn(), { column: Ls } = _e, { columnDef: js } = Ls, zs = js._filterFn, Fs = (Zt = js == null ? void 0 : js.columnFilterModeOptions) !== null && Zt !== void 0 ? Zt : Cr, Bs = er && js.enableColumnFilterModes !== !1 && (Fs === void 0 || !!(Fs != null && Fs.length));
  return jsxRuntimeExports.jsx(Collapse, { in: Ds || Kn === "popover", children: jsxRuntimeExports.jsxs(Flex, { direction: "column", children: [jsxRuntimeExports.jsxs(Flex, { align: "flex-end", children: [js.filterVariant === "checkbox" ? jsxRuntimeExports.jsx(MRT_FilterCheckbox, { column: Ls, table: Qt }) : js.filterVariant === "range-slider" ? jsxRuntimeExports.jsx(MRT_FilterRangeSlider, { header: _e, table: Qt }) : ["range", "date-range"].includes(($n = js.filterVariant) !== null && $n !== void 0 ? $n : "") || ["between", "betweenInclusive", "inNumberRange"].includes(js._filterFn) ? jsxRuntimeExports.jsx(MRT_FilterRangeFields, { header: _e, table: Qt }) : jsxRuntimeExports.jsx(MRT_FilterTextInput, { header: _e, table: Qt }), Bs && jsxRuntimeExports.jsxs(Menu, { withinPortal: Kn !== "popover", children: [jsxRuntimeExports.jsx(Tooltip, { label: Yr.changeFilterMode, position: "bottom-start", withinPortal: !0, children: jsxRuntimeExports.jsx(Menu.Target, { children: jsxRuntimeExports.jsx(ActionIcon, { "aria-label": Yr.changeFilterMode, size: "md", sx: { transform: "translateY(-2px)" }, children: jsxRuntimeExports.jsx(kr, {}) }) }) }), jsxRuntimeExports.jsx(MRT_FilterOptionMenu, { header: _e, table: Qt, onSelect: () => setTimeout(() => {
    var Hs;
    return (Hs = Ms.current[`${Ls.id}-0`]) === null || Hs === void 0 ? void 0 : Hs.focus();
  }, 100) })] })] }), Bs ? jsxRuntimeExports.jsx(Text, { component: "label", color: "dimmed", sx: { whiteSpace: "nowrap", marginTop: "4px", fontSize: "10px" }, children: Yr.filterMode.replace(
    "{filterType}",
    // @ts-ignore
    Yr[`filter${((Sn = zs == null ? void 0 : zs.charAt(0)) === null || Sn === void 0 ? void 0 : Sn.toUpperCase()) + (zs == null ? void 0 : zs.slice(1))}`]
  ) }) : null] }) });
}, MRT_TableHeadCellFilterLabel = ({ header: _e, table: Qt }) => {
  var Zt, $n, Sn, kn;
  const { options: { columnFilterDisplayMode: Kn, icons: { IconFilter: er }, localization: Cr }, refs: { filterInputRefs: kr }, setShowColumnFilters: Yr } = Qt, { column: Ms } = _e, { columnDef: Ds } = Ms, Ls = useMantineTheme(), js = Ms.getFilterValue(), [zs, Fs] = reactExports.useState(!1), Bs = Array.isArray(js) && js.some(Boolean) || !!js && !Array.isArray(js), Hs = Ds.filterVariant === "range" || ["between", "betweenInclusive", "inNumberRange"].includes(Ds._filterFn), Ws = Ds._filterFn, Ys = Kn === "popover" && !Bs ? (Zt = Cr.filterByColumn) === null || Zt === void 0 ? void 0 : Zt.replace("{column}", String(Ds.header)) : Cr.filteringByColumn.replace("{column}", String(Ds.header)).replace(
    "{filterType}",
    // @ts-ignore
    Cr[`filter${(($n = Ws == null ? void 0 : Ws.charAt(0)) === null || $n === void 0 ? void 0 : $n.toUpperCase()) + (Ws == null ? void 0 : Ws.slice(1))}`]
  ).replace("{filterValue}", `"${Array.isArray(Ms.getFilterValue()) ? Ms.getFilterValue().join(`" ${Hs ? Cr.and : Cr.or} "`) : Ms.getFilterValue()}"`).replace('" "', "");
  return jsxRuntimeExports.jsxs(Popover, { onClose: () => Fs(!1), opened: zs, position: "top", keepMounted: Ds.filterVariant === "range-slider", shadow: "xl", width: 360, withinPortal: !0, children: [jsxRuntimeExports.jsx(Transition$1, { transition: "scale", mounted: Kn === "popover" || !!Ms.getFilterValue() && !Hs || Hs && // @ts-ignore
  (!!(!((Sn = Ms.getFilterValue()) === null || Sn === void 0) && Sn[0]) || !!(!((kn = Ms.getFilterValue()) === null || kn === void 0) && kn[1])), children: (El) => jsxRuntimeExports.jsx(Box, { component: "span", sx: { flex: "0 0" }, style: El, children: jsxRuntimeExports.jsx(Popover.Target, { children: jsxRuntimeExports.jsx(Tooltip, { disabled: zs, label: Ys, multiline: !0, width: Ys.length > 40 ? 300 : void 0, withinPortal: !0, children: jsxRuntimeExports.jsx(ActionIcon, { color: Bs ? getPrimaryColor(Ls) : void 0, onClick: (Mu) => {
    Mu.stopPropagation(), Kn === "popover" ? Fs((Pl) => !Pl) : Yr(!0), setTimeout(() => {
      var Pl, Iu;
      (Pl = kr.current[`${Ms.id}-0`]) === null || Pl === void 0 || Pl.focus(), (Iu = kr.current[`${Ms.id}-0`]) === null || Iu === void 0 || Iu.select();
    }, 100);
  }, size: "sm", sx: {
    opacity: Bs ? 1 : 0.5,
    padding: "2px",
    "&:hover": {
      opacity: 1
    }
  }, children: jsxRuntimeExports.jsx(er, {}) }) }) }) }) }), Kn === "popover" && jsxRuntimeExports.jsx(Popover.Dropdown, { onClick: (El) => El.stopPropagation(), onKeyDown: (El) => El.key === "Enter" && Fs(!1), children: jsxRuntimeExports.jsx(MRT_TableHeadCellFilterContainer, { header: _e, table: Qt }) })] });
}, MRT_TableHeadCellGrabHandle = ({ column: _e, table: Qt, tableHeadCellRef: Zt }) => {
  const { getState: $n, options: { enableColumnOrdering: Sn, mantineColumnDragHandleProps: kn }, setColumnOrder: Kn, setDraggingColumn: er, setHoveredColumn: Cr } = Qt, { columnDef: kr } = _e, { hoveredColumn: Yr, draggingColumn: Ms, columnOrder: Ds } = $n(), Ls = kn instanceof Function ? kn({ column: _e, table: Qt }) : kn, js = kr.mantineColumnDragHandleProps instanceof Function ? kr.mantineColumnDragHandleProps({ column: _e, table: Qt }) : kr.mantineColumnDragHandleProps, zs = Object.assign(Object.assign({}, Ls), js), Fs = (Hs) => {
    var Ws;
    (Ws = zs == null ? void 0 : zs.onDragStart) === null || Ws === void 0 || Ws.call(zs, Hs), er(_e), Hs.dataTransfer.setDragImage(Zt.current, 0, 0);
  }, Bs = (Hs) => {
    var Ws;
    (Ws = zs == null ? void 0 : zs.onDragEnd) === null || Ws === void 0 || Ws.call(zs, Hs), (Yr == null ? void 0 : Yr.id) === "drop-zone" ? _e.toggleGrouping() : Sn && Yr && (Yr == null ? void 0 : Yr.id) !== (Ms == null ? void 0 : Ms.id) && Kn(reorderColumn(_e, Yr, Ds)), er(null), Cr(null);
  };
  return jsxRuntimeExports.jsx(MRT_GrabHandleButton, { actionIconProps: zs, onDragStart: Fs, onDragEnd: Bs, table: Qt });
}, MRT_TableHeadCellResizeHandle = ({ header: _e, table: Qt }) => {
  var Zt;
  const { getState: $n, options: { columnResizeMode: Sn }, setColumnSizingInfo: kn } = Qt, { density: Kn } = $n(), { column: er } = _e;
  return jsxRuntimeExports.jsx(Box, { onDoubleClick: () => {
    kn((Cr) => Object.assign(Object.assign({}, Cr), { isResizingColumn: !1 })), er.resetSize();
  }, onMouseDown: _e.getResizeHandler(), onTouchStart: _e.getResizeHandler(), sx: (Cr) => ({
    cursor: "col-resize",
    marginRight: Kn === "xl" ? "-24px" : Kn === "md" ? "-20px" : "-14px",
    position: "absolute",
    right: "4px",
    paddingLeft: "1px",
    paddingRight: "1px",
    "&:active > .mantine-Divider-vertical": {
      borderLeftColor: getPrimaryColor(Cr)
    }
  }), style: {
    transform: er.getIsResizing() && Sn === "onEnd" ? `translateX(${(Zt = $n().columnSizingInfo.deltaOffset) !== null && Zt !== void 0 ? Zt : 0}px)` : void 0
  }, children: jsxRuntimeExports.jsx(Divider, { orientation: "vertical", size: "lg", sx: {
    borderRadius: "2px",
    borderWidth: "4px",
    height: "24px",
    touchAction: "none",
    transition: er.getIsResizing() ? void 0 : "all 100ms ease-in-out",
    userSelect: "none",
    zIndex: 4
  } }) });
}, MRT_TableHeadCellSortLabel = ({ header: _e, table: Qt }) => {
  const { getState: Zt, options: { icons: { IconSortDescending: $n, IconSortAscending: Sn, IconArrowsSort: kn }, localization: Kn } } = Qt, { column: er } = _e, { columnDef: Cr } = er, { sorting: kr } = Zt(), Yr = useMantineTheme(), Ms = er.getIsSorted() ? er.getIsSorted() === "desc" ? Kn.sortedByColumnDesc.replace("{column}", Cr.header) : Kn.sortedByColumnAsc.replace("{column}", Cr.header) : er.getNextSortingOrder() === "desc" ? Kn.sortByColumnDesc.replace("{column}", Cr.header) : Kn.sortByColumnAsc.replace("{column}", Cr.header), Ds = kr.length >= 2 && er.getSortIndex() !== -1;
  return jsxRuntimeExports.jsx(Tooltip, { withinPortal: !0, label: Ms, children: jsxRuntimeExports.jsx(Indicator, { color: "transparent", disabled: !Ds, inline: !0, label: er.getSortIndex() + 1, offset: 3, children: jsxRuntimeExports.jsx(ActionIcon, { "aria-label": Ms, color: er.getIsSorted() ? getPrimaryColor(Yr) : void 0, size: "xs", sx: {
    opacity: er.getIsSorted() ? 1 : 0.5,
    transform: Ds ? "translate(-2px, 2px) scale(0.9)" : void 0,
    transition: "opacity 100ms ease-in-out",
    "&:hover": {
      opacity: 1
    }
  }, children: er.getIsSorted() === "desc" ? jsxRuntimeExports.jsx($n, {}) : er.getIsSorted() === "asc" ? jsxRuntimeExports.jsx(Sn, {}) : jsxRuntimeExports.jsx(kn, {}) }) }) });
}, MRT_TableHeadCell = ({ header: _e, table: Qt }) => {
  var Zt, $n, Sn, kn;
  const Kn = useMantineTheme(), { getState: er, options: { columnFilterDisplayMode: Cr, enableColumnActions: kr, enableColumnDragging: Yr, enableColumnOrdering: Ms, enableGrouping: Ds, enableMultiSort: Ls, layoutMode: js, mantineTableHeadCellProps: zs }, refs: { tableHeadCellRefs: Fs }, setHoveredColumn: Bs } = Qt, { density: Hs, draggingColumn: Ws, grouping: Ys, hoveredColumn: El } = er(), { column: Mu } = _e, { columnDef: Pl } = Mu, { columnDefType: Iu } = Pl, Tu = zs instanceof Function ? zs({ column: Mu, table: Qt }) : zs, Au = Pl.mantineTableHeadCellProps instanceof Function ? Pl.mantineTableHeadCellProps({ column: Mu, table: Qt }) : Pl.mantineTableHeadCellProps, Nu = Object.assign(Object.assign({}, Tu), Au), gm = (kr || Pl.enableColumnActions) && Pl.enableColumnActions !== !1, pm = Yr !== !1 && Pl.enableColumnDragging !== !1 && (Yr || Ms && Pl.enableColumnOrdering !== !1 || Ds && Pl.enableGrouping !== !1 && !Ys.includes(Mu.id)), zu = reactExports.useMemo(() => {
    let ym = 0;
    return Mu.getCanSort() && ym++, gm && (ym += 1.75), pm && (ym += 1.25), ym;
  }, [gm, pm]), Yu = reactExports.useMemo(() => (Ws == null ? void 0 : Ws.id) === Mu.id ? `1px dashed ${Kn.colors.gray[7]} !important` : (El == null ? void 0 : El.id) === Mu.id ? `2px dashed ${getPrimaryColor(Kn)} !important` : void 0, [Ws, El]), sm = Yu ? {
    borderLeft: Yu,
    borderRight: Yu,
    borderTop: Yu
  } : void 0, mm = (ym) => {
    Ds && (El == null ? void 0 : El.id) === "drop-zone" && Bs(null), Ms && Ws && Iu !== "group" && Bs(Pl.enableColumnOrdering !== !1 ? Mu : null);
  }, hm = (Pl == null ? void 0 : Pl.Header) instanceof Function ? (Zt = Pl == null ? void 0 : Pl.Header) === null || Zt === void 0 ? void 0 : Zt.call(Pl, {
    column: Mu,
    header: _e,
    table: Qt
  }) : ($n = Pl == null ? void 0 : Pl.Header) !== null && $n !== void 0 ? $n : Pl.header;
  return jsxRuntimeExports.jsxs(Box, Object.assign({ component: "th", align: Iu === "group" ? "center" : "left", colSpan: _e.colSpan, onDragEnter: mm, ref: (ym) => {
    ym && (Fs.current[Mu.id] = ym);
  } }, Nu, { sx: (ym) => Object.assign(Object.assign({ flexDirection: js === "grid" ? "column" : void 0, fontWeight: "bold", overflow: "visible", padding: Hs === "xl" ? "23px" : Hs === "md" ? "16px" : "10px", userSelect: Ls && Mu.getCanSort() ? "none" : void 0, verticalAlign: "top", zIndex: Mu.getIsResizing() || (Ws == null ? void 0 : Ws.id) === Mu.id ? 3 : Mu.getIsPinned() && Iu !== "group" ? 2 : 1, "&:hover .mantine-ActionIcon-root": {
    opacity: 1
  } }, getCommonCellStyles({
    column: Mu,
    header: _e,
    table: Qt,
    tableCellProps: Nu,
    theme: ym
  })), sm), children: [_e.isPlaceholder ? null : jsxRuntimeExports.jsxs(Flex, { className: "mantine-TableHeadCell-Content", sx: {
    alignItems: "flex-start",
    flexDirection: (Nu == null ? void 0 : Nu.align) === "right" ? "row-reverse" : "row",
    justifyContent: Iu === "group" || (Nu == null ? void 0 : Nu.align) === "center" ? "center" : Mu.getCanResize() ? "space-between" : "flex-start",
    position: "relative",
    width: "100%"
  }, children: [jsxRuntimeExports.jsxs(Flex, { className: "mantine-TableHeadCell-Content-Labels", onClick: Mu.getToggleSortingHandler(), sx: {
    alignItems: "center",
    cursor: Mu.getCanSort() && Iu !== "group" ? "pointer" : void 0,
    flexDirection: (Nu == null ? void 0 : Nu.align) === "right" ? "row-reverse" : "row",
    overflow: Iu === "data" ? "hidden" : void 0,
    paddingLeft: (Nu == null ? void 0 : Nu.align) === "center" ? `${zu}rem` : void 0
  }, children: [jsxRuntimeExports.jsx(Flex, { className: "mantine-TableHeadCell-Content-Wrapper", sx: {
    overflow: Iu === "data" ? "hidden" : void 0,
    textOverflow: "ellipsis",
    whiteSpace: ((kn = (Sn = Pl.header) === null || Sn === void 0 ? void 0 : Sn.length) !== null && kn !== void 0 ? kn : 0) < 20 ? "nowrap" : "normal"
  }, title: Iu === "data" ? Pl.header : void 0, children: hm }), Mu.getCanSort() && jsxRuntimeExports.jsx(MRT_TableHeadCellSortLabel, { header: _e, table: Qt }), Mu.getCanFilter() && jsxRuntimeExports.jsx(MRT_TableHeadCellFilterLabel, { header: _e, table: Qt })] }), Iu !== "group" && jsxRuntimeExports.jsxs(Flex, { className: "mantine-TableHeadCell-Content-Actions", sx: {
    alignItems: "center",
    alignSelf: "center",
    whiteSpace: "nowrap"
  }, children: [pm && jsxRuntimeExports.jsx(MRT_TableHeadCellGrabHandle, { column: Mu, table: Qt, tableHeadCellRef: {
    current: Fs.current[Mu.id]
  } }), gm && jsxRuntimeExports.jsx(MRT_ColumnActionMenu, { header: _e, table: Qt })] }), Mu.getCanResize() && jsxRuntimeExports.jsx(MRT_TableHeadCellResizeHandle, { header: _e, table: Qt })] }), Cr === "subheader" && Mu.getCanFilter() && jsxRuntimeExports.jsx(MRT_TableHeadCellFilterContainer, { header: _e, table: Qt })] }));
}, MRT_TableHeadRow = ({ headerGroup: _e, table: Qt, virtualColumns: Zt, virtualPaddingLeft: $n, virtualPaddingRight: Sn }) => {
  const { getState: kn, options: { enableStickyHeader: Kn, layoutMode: er, mantineTableHeadRowProps: Cr } } = Qt, { isFullScreen: kr } = kn(), Yr = Cr instanceof Function ? Cr({ headerGroup: _e, table: Qt }) : Cr, Ms = Kn || kr;
  return jsxRuntimeExports.jsxs(Box, Object.assign({ component: "tr" }, Yr, { sx: (Ds) => Object.assign(Object.assign({ backgroundColor: Ds.colorScheme === "dark" ? Ds.colors.dark[7] : Ds.white, boxShadow: `0 4px 8px ${Ds.fn.rgba(Ds.black, 0.1)}`, display: er === "grid" ? "flex" : "table-row", top: Ms ? 0 : void 0 }, (Yr == null ? void 0 : Yr.sx) instanceof Function ? Yr == null ? void 0 : Yr.sx(Ds) : Yr == null ? void 0 : Yr.sx), { position: Ms ? "sticky" : void 0 }), children: [$n ? jsxRuntimeExports.jsx("th", { style: { display: "flex", width: $n } }) : null, (Zt ?? _e.headers).map((Ds) => {
    const Ls = Zt ? _e.headers[Ds.index] : Ds;
    return jsxRuntimeExports.jsx(MRT_TableHeadCell, { header: Ls, table: Qt }, Ls.id);
  }), Sn ? jsxRuntimeExports.jsx("th", { style: { display: "flex", width: Sn } }) : null] }));
}, MRT_TableHead = ({ table: _e, virtualColumns: Qt, virtualPaddingLeft: Zt, virtualPaddingRight: $n }) => {
  const { getHeaderGroups: Sn, getSelectedRowModel: kn, getState: Kn, options: { enableStickyHeader: er, layoutMode: Cr, mantineTableHeadProps: kr, positionToolbarAlertBanner: Yr } } = _e, { isFullScreen: Ms, showAlertBanner: Ds } = Kn(), Ls = kr instanceof Function ? kr({ table: _e }) : kr, js = er || Ms;
  return jsxRuntimeExports.jsx(Box, Object.assign({ component: "thead" }, Ls, { sx: (zs) => Object.assign({ display: Cr === "grid" ? "grid" : "table-row-group", position: js && Cr === "grid" ? "sticky" : "relative", opacity: 0.97, top: js ? 0 : void 0, zIndex: js ? 2 : void 0 }, (Ls == null ? void 0 : Ls.sx) instanceof Function ? Ls == null ? void 0 : Ls.sx(zs) : Ls == null ? void 0 : Ls.sx), children: Yr === "head-overlay" && (Ds || kn().rows.length > 0) ? jsxRuntimeExports.jsx("tr", { style: { display: Cr === "grid" ? "grid" : "table-row" }, children: jsxRuntimeExports.jsx("th", { colSpan: _e.getVisibleLeafColumns().length, style: {
    display: Cr === "grid" ? "grid" : "table-cell",
    padding: 0
  }, children: jsxRuntimeExports.jsx(MRT_ToolbarAlertBanner, { table: _e }) }) }) : Sn().map((zs) => jsxRuntimeExports.jsx(MRT_TableHeadRow, { headerGroup: zs, table: _e, virtualColumns: Qt, virtualPaddingLeft: Zt, virtualPaddingRight: $n }, zs.id)) }));
}, MRT_TableFooterCell = ({ footer: _e, table: Qt }) => {
  var Zt, $n, Sn;
  const { options: { layoutMode: kn, mantineTableFooterCellProps: Kn } } = Qt, { column: er } = _e, { columnDef: Cr } = er, { columnDefType: kr } = Cr, Yr = Kn instanceof Function ? Kn({ column: er, table: Qt }) : Kn, Ms = Cr.mantineTableFooterCellProps instanceof Function ? Cr.mantineTableFooterCellProps({ column: er, table: Qt }) : Cr.mantineTableFooterCellProps, Ds = Object.assign(Object.assign({}, Yr), Ms);
  return jsxRuntimeExports.jsx(Box, Object.assign({ component: "th", align: kr === "group" ? "center" : "left", colSpan: _e.colSpan }, Ds, { sx: (Ls) => Object.assign({ display: kn === "grid" ? "grid" : "table-cell", fontWeight: "bold", justifyContent: kr === "group" ? "center" : void 0, padding: "8px", verticalAlign: "top", zIndex: er.getIsPinned() && kr !== "group" ? 2 : 1 }, getCommonCellStyles({
    column: er,
    table: Qt,
    theme: Ls,
    tableCellProps: Ds
  })), children: jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: _e.isPlaceholder ? null : (Sn = ($n = Cr.Footer instanceof Function ? (Zt = Cr.Footer) === null || Zt === void 0 ? void 0 : Zt.call(Cr, {
    column: er,
    footer: _e,
    table: Qt
  }) : Cr.Footer) !== null && $n !== void 0 ? $n : Cr.footer) !== null && Sn !== void 0 ? Sn : null }) }));
}, MRT_TableFooterRow = ({ footerGroup: _e, table: Qt, virtualColumns: Zt, virtualPaddingLeft: $n, virtualPaddingRight: Sn }) => {
  var kn;
  const { options: { layoutMode: Kn, mantineTableFooterRowProps: er } } = Qt;
  if (!(!((kn = _e.headers) === null || kn === void 0) && kn.some((kr) => typeof kr.column.columnDef.footer == "string" && !!kr.column.columnDef.footer || kr.column.columnDef.Footer)))
    return null;
  const Cr = er instanceof Function ? er({ footerGroup: _e, table: Qt }) : er;
  return jsxRuntimeExports.jsxs(Box, Object.assign({ component: "tr" }, Cr, { sx: (kr) => Object.assign({ backgroundColor: kr.fn.lighten(kr.colorScheme === "dark" ? kr.colors.dark[7] : kr.white, 0.06), display: Kn === "grid" ? "flex" : "table-row", width: "100%" }, (Cr == null ? void 0 : Cr.sx) instanceof Function ? Cr == null ? void 0 : Cr.sx(kr) : Cr == null ? void 0 : Cr.sx), children: [$n ? jsxRuntimeExports.jsx("th", { style: { display: "flex", width: $n } }) : null, (Zt ?? _e.headers).map((kr) => {
    const Yr = Zt ? _e.headers[kr.index] : kr;
    return jsxRuntimeExports.jsx(MRT_TableFooterCell, { footer: Yr, table: Qt }, Yr.id);
  }), Sn ? jsxRuntimeExports.jsx("th", { style: { display: "flex", width: Sn } }) : null] }));
}, MRT_TableFooter = ({ table: _e, virtualColumns: Qt, virtualPaddingLeft: Zt, virtualPaddingRight: $n }) => {
  const { getFooterGroups: Sn, getState: kn, options: { enableStickyFooter: Kn, layoutMode: er, mantineTableFooterProps: Cr } } = _e, { isFullScreen: kr } = kn(), Yr = Cr instanceof Function ? Cr({ table: _e }) : Cr, Ms = (kr || Kn) && Kn !== !1;
  return jsxRuntimeExports.jsx(Box, Object.assign({ component: "tfoot" }, Yr, { sx: (Ds) => Object.assign({ bottom: Ms ? 0 : void 0, display: er === "grid" ? "grid" : "table-row-group", opacity: Ms ? 0.97 : void 0, outline: Ms ? Ds.colorScheme === "light" ? `1px solid ${Ds.colors.gray[3]}` : `1px solid ${Ds.colors.gray[7]}` : void 0, position: Ms ? "sticky" : void 0, zIndex: Ms ? 1 : void 0 }, (Yr == null ? void 0 : Yr.sx) instanceof Function ? Yr == null ? void 0 : Yr.sx(Ds) : Yr == null ? void 0 : Yr.sx), children: Sn().map((Ds) => jsxRuntimeExports.jsx(MRT_TableFooterRow, { footerGroup: Ds, table: _e, virtualColumns: Qt, virtualPaddingLeft: Zt, virtualPaddingRight: $n }, Ds.id)) }));
}, MRT_Table = ({ table: _e }) => {
  var Qt, Zt, $n, Sn;
  const { getFlatHeaders: kn, getState: Kn, options: { columnVirtualizerInstanceRef: er, columnVirtualizerProps: Cr, columns: kr, enableColumnResizing: Yr, enableColumnVirtualization: Ms, enablePinning: Ds, enableTableFooter: Ls, enableTableHead: js, layoutMode: zs, mantineTableProps: Fs, memoMode: Bs }, refs: { tableContainerRef: Hs } } = _e, { columnPinning: Ws, columnSizing: Ys, columnSizingInfo: El, columnVisibility: Mu, density: Pl } = Kn(), Iu = Fs instanceof Function ? Fs({ table: _e }) : Fs, Tu = Cr instanceof Function ? Cr({ table: _e }) : Cr, Au = reactExports.useMemo(() => {
    const ym = kn(), _m = {};
    for (let Sm = 0; Sm < ym.length; Sm++) {
      const wm = ym[Sm], Nm = wm.getSize();
      _m[`--header-${parseCSSVarId(wm.id)}-size`] = Nm, _m[`--col-${parseCSSVarId(wm.column.id)}-size`] = Nm;
    }
    return _m;
  }, [kr, Ys, El, Mu]), Nu = reactExports.useMemo(() => {
    var ym, _m, Sm, wm;
    if (!Ms)
      return 0;
    const Nm = (wm = (Sm = (_m = (ym = _e.getRowModel().rows[0]) === null || ym === void 0 ? void 0 : ym.getCenterVisibleCells()) === null || _m === void 0 ? void 0 : _m.slice(0, 16)) === null || Sm === void 0 ? void 0 : Sm.map((Cm) => Cm.column.getSize() * 1.2)) !== null && wm !== void 0 ? wm : [];
    return Nm.reduce((Cm, Im) => Cm + Im, 0) / Nm.length;
  }, [_e.getRowModel().rows, Ws, Mu]), [gm, pm] = reactExports.useMemo(() => Ms && Ds ? [
    _e.getLeftLeafColumns().map((ym) => ym.getPinnedIndex()),
    _e.getRightLeafColumns().map((ym) => _e.getVisibleLeafColumns().length - ym.getPinnedIndex() - 1)
  ] : [[], []], [Ws, Ms, Ds]), zu = Ms ? useVirtualizer(Object.assign({ count: _e.getVisibleLeafColumns().length, estimateSize: () => Nu, getScrollElement: () => Hs.current, horizontal: !0, overscan: 3, rangeExtractor: reactExports.useCallback((ym) => [
    .../* @__PURE__ */ new Set([
      ...gm,
      ...defaultRangeExtractor(ym),
      ...pm
    ])
  ], [gm, pm]) }, Tu)) : void 0;
  er && zu && (er.current = zu);
  const Yu = zu ? zu.getVirtualItems() : void 0;
  let sm, mm;
  zu && (Yu != null && Yu.length) && (sm = (Zt = (Qt = Yu[gm.length]) === null || Qt === void 0 ? void 0 : Qt.start) !== null && Zt !== void 0 ? Zt : 0, mm = zu.getTotalSize() - ((Sn = ($n = Yu[Yu.length - 1 - pm.length]) === null || $n === void 0 ? void 0 : $n.end) !== null && Sn !== void 0 ? Sn : 0));
  const hm = {
    columnVirtualizer: zu,
    enableHover: Iu == null ? void 0 : Iu.highlightOnHover,
    isStriped: Iu == null ? void 0 : Iu.striped,
    table: _e,
    virtualColumns: Yu,
    virtualPaddingLeft: sm,
    virtualPaddingRight: mm
  };
  return jsxRuntimeExports.jsxs(Table, Object.assign({ highlightOnHover: !0, horizontalSpacing: Pl, verticalSpacing: Pl }, Iu, { sx: (ym) => Object.assign({ display: zs === "grid" ? "grid" : "table", tableLayout: zs !== "grid" && Yr ? "fixed" : void 0, "& tr:first-of-type td": {
    borderTop: `1px solid ${ym.colors.gray[ym.colorScheme === "dark" ? 8 : 3]}`
  }, "& tr:last-of-type td": {
    borderBottom: `1px solid ${ym.colors.gray[ym.colorScheme === "dark" ? 8 : 3]}`
  } }, (Iu == null ? void 0 : Iu.sx) instanceof Function ? Iu.sx(ym) : Iu == null ? void 0 : Iu.sx), style: Object.assign(Object.assign({}, Au), Iu == null ? void 0 : Iu.style), children: [js && jsxRuntimeExports.jsx(MRT_TableHead, Object.assign({}, hm)), Bs === "table-body" || El.isResizingColumn ? jsxRuntimeExports.jsx(Memo_MRT_TableBody, Object.assign({}, hm)) : jsxRuntimeExports.jsx(MRT_TableBody, Object.assign({}, hm)), Ls && jsxRuntimeExports.jsx(MRT_TableFooter, Object.assign({}, hm))] }));
}, MRT_EditRowModal = ({ open: _e, table: Qt }) => {
  var Zt;
  const { getState: $n, options: { onEditingRowCancel: Sn, onCreatingRowCancel: kn, renderEditRowModalContent: Kn, renderCreateRowModalContent: er, mantineCreateRowModalProps: Cr, mantineEditRowModalProps: kr }, setEditingRow: Yr, setCreatingRow: Ms } = Qt, { creatingRow: Ds, editingRow: Ls } = $n(), js = Ds ?? Ls, zs = Cr instanceof Function ? Cr({ row: js, table: Qt }) : Cr, Fs = kr instanceof Function ? kr({ row: js, table: Qt }) : kr, Bs = Object.assign(Object.assign({}, Fs), Ds && zs), Hs = js.getAllCells().filter((Ys) => Ys.column.columnDef.columnDefType === "data").map((Ys) => jsxRuntimeExports.jsx(MRT_EditCellTextInput, { cell: Ys, table: Qt }, Ys.id)), Ws = () => {
    var Ys;
    Ds ? (kn == null || kn({ row: js, table: Qt }), Ms(null)) : (Sn == null || Sn({ row: js, table: Qt }), Yr(null)), js._valuesCache = {}, (Ys = Bs.onClose) === null || Ys === void 0 || Ys.call(Bs);
  };
  return reactExports.createElement(Modal, Object.assign({ opened: _e, withCloseButton: !1 }, Bs, { onClose: Ws, key: js.id }), (Zt = Ds && (er == null ? void 0 : er({
    row: js,
    table: Qt,
    internalEditComponents: Hs
  })) || (Kn == null ? void 0 : Kn({
    row: js,
    table: Qt,
    internalEditComponents: Hs
  }))) !== null && Zt !== void 0 ? Zt : jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("form", { onSubmit: (Ys) => Ys.preventDefault(), children: jsxRuntimeExports.jsx(Stack$1, { sx: {
    gap: "24px",
    paddingTop: "16px",
    width: "100%"
  }, children: Hs }) }), jsxRuntimeExports.jsx(Flex, { sx: { paddingTop: "24px", justifyContent: "flex-end" }, children: jsxRuntimeExports.jsx(MRT_EditActionButtons, { row: js, table: Qt, variant: "text" }) })] }));
}, useIsomorphicLayoutEffect$2 = typeof window < "u" ? reactExports.useLayoutEffect : reactExports.useEffect, MRT_TableContainer = ({ table: _e }) => {
  const { getState: Qt, options: { createDisplayMode: Zt, editDisplayMode: $n, enableStickyHeader: Sn, mantineLoadingOverlayProps: kn, mantineTableContainerProps: Kn }, refs: { tableContainerRef: er, bottomToolbarRef: Cr, topToolbarRef: kr } } = _e, { isFullScreen: Yr, isLoading: Ms, showLoadingOverlay: Ds, creatingRow: Ls, editingRow: js } = Qt(), [zs, Fs] = reactExports.useState(0), Bs = Kn instanceof Function ? Kn({ table: _e }) : Kn, Hs = kn instanceof Function ? kn({ table: _e }) : kn;
  useIsomorphicLayoutEffect$2(() => {
    var El, Mu, Pl, Iu;
    const Tu = typeof document < "u" && (Mu = (El = kr.current) === null || El === void 0 ? void 0 : El.offsetHeight) !== null && Mu !== void 0 ? Mu : 0, Au = typeof document < "u" && (Iu = (Pl = Cr == null ? void 0 : Cr.current) === null || Pl === void 0 ? void 0 : Pl.offsetHeight) !== null && Iu !== void 0 ? Iu : 0;
    Fs(Tu + Au);
  });
  const Ws = Zt === "modal" && Ls, Ys = $n === "modal" && js;
  return jsxRuntimeExports.jsxs(Box, Object.assign({}, Bs, { ref: (El) => {
    El && (er.current = El, Bs != null && Bs.ref && (Bs.ref.current = El));
  }, sx: (El) => Object.assign({ maxWidth: "100%", maxHeight: Sn ? `clamp(350px, calc(100vh - ${zs}px), 9999px)` : void 0, overflow: "auto", position: "relative" }, (Bs == null ? void 0 : Bs.sx) instanceof Function ? Bs.sx(El) : Bs == null ? void 0 : Bs.sx), style: Object.assign({ maxHeight: Yr ? `calc(100vh - ${zs}px)` : void 0 }, Bs == null ? void 0 : Bs.style), children: [jsxRuntimeExports.jsx(LoadingOverlay, Object.assign({ visible: Ms || Ds }, Hs)), jsxRuntimeExports.jsx(MRT_Table, { table: _e }), (Ws || Ys) && jsxRuntimeExports.jsx(MRT_EditRowModal, { open: !0, table: _e })] }));
}, MRT_TablePaper = ({ table: _e }) => {
  const { getState: Qt, options: { enableBottomToolbar: Zt, enableTopToolbar: $n, mantinePaperProps: Sn, renderBottomToolbar: kn, renderTopToolbar: Kn }, refs: { tablePaperRef: er } } = _e, { isFullScreen: Cr } = Qt(), kr = Sn instanceof Function ? Sn({ table: _e }) : Sn;
  return jsxRuntimeExports.jsxs(Paper, Object.assign({ shadow: "xs", withBorder: !0 }, kr, { ref: (Yr) => {
    er.current = Yr, kr != null && kr.ref && (kr.ref.current = Yr);
  }, sx: (Yr) => Object.assign({ overflow: "hidden", transition: "all 100ms ease-in-out" }, (kr == null ? void 0 : kr.sx) instanceof Function ? kr == null ? void 0 : kr.sx(Yr) : kr == null ? void 0 : kr.sx), style: Object.assign(Object.assign({}, Cr ? {
    bottom: 0,
    height: "100vh",
    left: 0,
    margin: 0,
    maxHeight: "100vh",
    maxWidth: "100vw",
    padding: 0,
    position: "fixed",
    right: 0,
    top: 0,
    width: "100vw",
    zIndex: 100
  } : {}), kr == null ? void 0 : kr.style), children: [$n && (Kn instanceof Function ? Kn({ table: _e }) : Kn ?? jsxRuntimeExports.jsx(MRT_TopToolbar, { table: _e })), jsxRuntimeExports.jsx(MRT_TableContainer, { table: _e }), Zt && (kn instanceof Function ? kn({ table: _e }) : kn ?? jsxRuntimeExports.jsx(MRT_BottomToolbar, { table: _e }))] }));
}, isTableInstanceProp = (_e) => _e.table !== void 0, MantineReactTable = (_e) => {
  let Qt;
  return isTableInstanceProp(_e) ? Qt = _e.table : Qt = useMantineReactTable(_e), jsxRuntimeExports.jsx(MRT_TablePaper, { table: Qt });
};
function applyDTypeToValue(_e, Qt) {
  switch (Qt) {
    case "Int64":
      try {
        return parseInt(_e, 10);
      } catch {
        return _e;
      }
    case "Float64":
      try {
        return parseFloat(_e);
      } catch {
        return _e;
      }
    case "boolean":
      return _e.toLowerCase() === "true";
    case "datetime64[ns]":
      return new Date(_e).getTime();
    default:
      return _e;
  }
}
function getDType(_e, Qt) {
  return Qt[_e] ?? "string";
}
const useStyles$3 = createStyles(() => ({
  cellHover: {
    "&:hover": {
      transform: "scale(1.1)",
      transfromOrigin: "left"
    }
  }
}));
function process_value(_e, Qt, Zt = !1) {
  let $n = _e;
  return Qt === "boolean" && (_e && _e === !0 ? $n = "True" : $n = "False"), Qt.includes("datetime64") && typeof _e == "number" && ($n = new Date(_e), Zt ? $n = $n.toISOString().substring(0, 10) : $n = $n.toLocaleDateString().replace(/\//g, "-")), !$n && ["Int64", "Float64"].includes(Qt) && ($n = "NaN"), !$n && Qt === "datetime64[ns]" && ($n = "NaT"), $n;
}
function useColumnDefs(_e, Qt, Zt, $n = [], Sn = {}) {
  const { classes: kn } = useStyles$3();
  return reactExports.useMemo(() => _e.filter((Kn) => !$n.includes(Kn)).map((Kn) => ({
    id: Kn,
    accessorFn: (er) => er[Kn],
    meta: {
      dType: Sn[Kn],
      values: Zt.map((er) => er[Kn])
    },
    header: Kn === Qt ? "ID_" : Kn,
    size: Kn === Qt ? 100 : void 0,
    enableEditing: Kn !== Qt,
    Cell: ({ renderedCellValue: er }) => {
      const Cr = Sn[Kn], kr = process_value(er, Cr);
      return kr === null && console.log(Kn, kr, Cr), /* @__PURE__ */ React.createElement(Tooltip, { label: kr, openDelay: 200, position: "left" }, /* @__PURE__ */ React.createElement(Text, { className: kn.cellHover }, kr));
    },
    mantineEditTextInputProps: ({ row: er, column: Cr }) => ({
      type: getInputType(getDType(Kn, Sn)),
      dateTime: process_value(
        er.getValue(Cr.id),
        Sn[Cr.id],
        !0
      ),
      defaultValue: /* @__PURE__ */ new Date()
    })
  })), [_e, $n]);
}
function getInputType(_e) {
  switch (_e) {
    case "Int64":
    case "Float64":
      return "number";
    case "boolean":
      return "checkbox";
    case "datetime64[ns]":
    case "datetime64[ms, UTC]":
      return "date";
    default:
      return "text";
  }
}
const name$1 = "vega-lite", author$1 = 'Dominik Moritz, Kanit "Ham" Wongsuphasawat, Arvind Satyanarayan, Jeffrey Heer', version$4 = "5.14.1", collaborators = [
  "Kanit Wongsuphasawat (http://kanitw.yellowpigz.com)",
  "Dominik Moritz (https://www.domoritz.de)",
  "Arvind Satyanarayan (https://arvindsatya.com)",
  "Jeffrey Heer (https://jheer.org)"
], homepage = "https://vega.github.io/vega-lite/", description$2 = "Vega-Lite is a concise high-level language for interactive visualization.", keywords$2 = [
  "vega",
  "chart",
  "visualization"
], main$2 = "build/vega-lite.js", unpkg$1 = "build/vega-lite.min.js", jsdelivr$1 = "build/vega-lite.min.js", module$1 = "build/src/index", types$1 = "build/src/index.d.ts", bin$2 = {
  vl2pdf: "./bin/vl2pdf",
  vl2png: "./bin/vl2png",
  vl2svg: "./bin/vl2svg",
  vl2vg: "./bin/vl2vg"
}, files$1 = [
  "bin",
  "build",
  "src",
  "vega-lite*",
  "tsconfig.json"
], scripts$1 = {
  changelog: "conventional-changelog -p angular -r 2",
  prebuild: "yarn clean:build",
  build: "yarn build:only",
  "build:only": "tsc -p tsconfig.build.json && rollup -c",
  "prebuild:examples": "yarn build:only",
  "build:examples": "yarn data && TZ=America/Los_Angeles scripts/build-examples.sh",
  "prebuild:examples-full": "yarn build:only",
  "build:examples-full": "TZ=America/Los_Angeles scripts/build-examples.sh 1",
  "build:example": "TZ=America/Los_Angeles scripts/build-example.sh",
  "build:toc": "yarn build:jekyll && scripts/generate-toc",
  "build:site": "rollup -c site/rollup.config.mjs",
  "build:jekyll": "pushd site && bundle exec jekyll build -q && popd",
  "build:versions": "scripts/update-version.sh",
  clean: "yarn clean:build && del-cli 'site/data/*' 'examples/compiled/*.png' && find site/examples ! -name 'index.md' ! -name 'data' -type f -delete",
  "clean:build": "del-cli 'build/*' !build/vega-lite-schema.json",
  data: "rsync -r node_modules/vega-datasets/data/* site/data",
  schema: "mkdir -p build && ts-json-schema-generator -f tsconfig.json -p src/index.ts -t TopLevelSpec --no-type-check --no-ref-encode > build/vega-lite-schema.json && yarn renameschema && cp build/vega-lite-schema.json site/_data/",
  renameschema: "scripts/rename-schema.sh",
  presite: "yarn data && yarn schema && yarn build:site && yarn build:versions && scripts/create-example-pages.sh",
  site: "yarn site:only",
  "site:only": "pushd site && bundle exec jekyll serve -I -l && popd",
  prettierbase: "prettier '**/*.{md,css,yml}'",
  format: "eslint . --fix && yarn prettierbase --write",
  lint: "eslint . && yarn prettierbase --check",
  jest: "NODE_OPTIONS=--experimental-vm-modules npx jest",
  test: "yarn jest test/ && yarn lint && yarn schema && yarn jest examples/ && yarn test:runtime",
  "test:cover": "yarn jest --collectCoverage test/",
  "test:inspect": "node --inspect-brk --experimental-vm-modules ./node_modules/.bin/jest --runInBand test",
  "test:runtime": "NODE_OPTIONS=--experimental-vm-modules TZ=America/Los_Angeles npx jest test-runtime/ --config test-runtime/jest-config.json",
  "test:runtime:generate": "yarn build:only && del-cli test-runtime/resources && VL_GENERATE_TESTS=true yarn test:runtime",
  watch: "tsc -p tsconfig.build.json -w",
  "watch:site": "yarn build:site -w",
  "watch:test": "yarn jest --watch test/",
  "watch:test:runtime": "NODE_OPTIONS=--experimental-vm-modules TZ=America/Los_Angeles npx jest --watch test-runtime/ --config test-runtime/jest-config.json",
  release: "release-it"
}, repository$1 = {
  type: "git",
  url: "https://github.com/vega/vega-lite.git"
}, license$1 = "BSD-3-Clause", bugs = {
  url: "https://github.com/vega/vega-lite/issues"
}, devDependencies$1 = {
  "@babel/core": "^7.21.8",
  "@babel/plugin-proposal-class-properties": "^7.18.6",
  "@babel/preset-env": "^7.21.5",
  "@babel/preset-typescript": "^7.21.5",
  "@release-it/conventional-changelog": "^7.0.0",
  "@rollup/plugin-alias": "^5.0.0",
  "@rollup/plugin-babel": "^6.0.3",
  "@rollup/plugin-commonjs": "^25.0.0",
  "@rollup/plugin-json": "^6.0.0",
  "@rollup/plugin-node-resolve": "^15.0.2",
  "@rollup/plugin-terser": "^0.4.1",
  "@types/chai": "^4.3.5",
  "@types/d3": "^7.4.0",
  "@types/jest": "^27.4.1",
  "@types/pako": "^2.0.0",
  "@typescript-eslint/eslint-plugin": "^5.59.5",
  "@typescript-eslint/parser": "^5.59.5",
  ajv: "^8.12.0",
  "ajv-formats": "^2.1.1",
  chai: "^4.3.7",
  cheerio: "^1.0.0-rc.12",
  "conventional-changelog-cli": "^3.0.0",
  d3: "^7.8.4",
  "del-cli": "^5.0.0",
  eslint: "^8.40.0",
  "eslint-config-prettier": "^8.8.0",
  "eslint-plugin-jest": "^27.2.1",
  "eslint-plugin-prettier": "^4.2.1",
  "highlight.js": "^11.8.0",
  jest: "^27.5.1",
  "jest-dev-server": "^6.1.1",
  mkdirp: "^3.0.1",
  pako: "^2.1.0",
  prettier: "^2.8.8",
  puppeteer: "^15.0.0",
  "release-it": "^16.1.2",
  rollup: "^3.21.6",
  "rollup-plugin-bundle-size": "^1.0.3",
  "rollup-plugin-sourcemaps": "^0.6.3",
  serve: "^14.2.0",
  terser: "^5.17.3",
  "ts-jest": "^29.1.0",
  "ts-json-schema-generator": "^1.2.0",
  typescript: "~4.9.5",
  "vega-cli": "^5.25.0",
  "vega-datasets": "^2.7.0",
  "vega-embed": "^6.22.1",
  "vega-tooltip": "^0.32.0",
  "yaml-front-matter": "^4.1.1"
}, dependencies$1 = {
  "@types/clone": "~2.1.1",
  clone: "~2.1.2",
  "fast-deep-equal": "~3.1.3",
  "fast-json-stable-stringify": "~2.1.0",
  "json-stringify-pretty-compact": "~3.0.0",
  tslib: "~2.5.0",
  "vega-event-selector": "~3.0.1",
  "vega-expression": "~5.1.0",
  "vega-util": "~1.17.2",
  yargs: "~17.7.2"
}, peerDependencies$1 = {
  vega: "^5.24.0"
}, engines = {
  node: ">=16"
}, pkg$1 = {
  name: name$1,
  author: author$1,
  version: version$4,
  collaborators,
  homepage,
  description: description$2,
  keywords: keywords$2,
  main: main$2,
  unpkg: unpkg$1,
  jsdelivr: jsdelivr$1,
  module: module$1,
  types: types$1,
  bin: bin$2,
  files: files$1,
  scripts: scripts$1,
  repository: repository$1,
  license: license$1,
  bugs,
  devDependencies: devDependencies$1,
  dependencies: dependencies$1,
  peerDependencies: peerDependencies$1,
  engines
};
function accessor(_e, Qt, Zt) {
  return _e.fields = Qt || [], _e.fname = Zt, _e;
}
function accessorName(_e) {
  return _e == null ? null : _e.fname;
}
function accessorFields(_e) {
  return _e == null ? null : _e.fields;
}
function getter(_e) {
  return _e.length === 1 ? get1(_e[0]) : getN(_e);
}
const get1 = (_e) => function(Qt) {
  return Qt[_e];
}, getN = (_e) => {
  const Qt = _e.length;
  return function(Zt) {
    for (let $n = 0; $n < Qt; ++$n)
      Zt = Zt[_e[$n]];
    return Zt;
  };
};
function error(_e) {
  throw Error(_e);
}
function splitAccessPath(_e) {
  const Qt = [], Zt = _e.length;
  let $n = null, Sn = 0, kn = "", Kn, er, Cr;
  _e = _e + "";
  function kr() {
    Qt.push(kn + _e.substring(Kn, er)), kn = "", Kn = er + 1;
  }
  for (Kn = er = 0; er < Zt; ++er)
    if (Cr = _e[er], Cr === "\\")
      kn += _e.substring(Kn, er++), Kn = er;
    else if (Cr === $n)
      kr(), $n = null, Sn = -1;
    else {
      if ($n)
        continue;
      Kn === Sn && Cr === '"' || Kn === Sn && Cr === "'" ? (Kn = er + 1, $n = Cr) : Cr === "." && !Sn ? er > Kn ? kr() : Kn = er + 1 : Cr === "[" ? (er > Kn && kr(), Sn = Kn = er + 1) : Cr === "]" && (Sn || error("Access path missing open bracket: " + _e), Sn > 0 && kr(), Sn = 0, Kn = er + 1);
    }
  return Sn && error("Access path missing closing bracket: " + _e), $n && error("Access path missing closing quote: " + _e), er > Kn && (er++, kr()), Qt;
}
function field$1(_e, Qt, Zt) {
  const $n = splitAccessPath(_e);
  return _e = $n.length === 1 ? $n[0] : _e, accessor((Zt && Zt.get || getter)($n), [_e], Qt || _e);
}
const id$2 = field$1("id"), identity$7 = accessor((_e) => _e, [], "identity"), zero$5 = accessor(() => 0, [], "zero"), one$2 = accessor(() => 1, [], "one"), truthy = accessor(() => !0, [], "true"), falsy = accessor(() => !1, [], "false");
function log$1$1(_e, Qt, Zt) {
  const $n = [Qt].concat([].slice.call(Zt));
  console[_e].apply(console, $n);
}
const None$2 = 0, Error$1 = 1, Warn = 2, Info = 3, Debug = 4;
function logger(_e, Qt) {
  let Zt = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : log$1$1, $n = _e || None$2;
  return {
    level(Sn) {
      return arguments.length ? ($n = +Sn, this) : $n;
    },
    error() {
      return $n >= Error$1 && Zt(Qt || "error", "ERROR", arguments), this;
    },
    warn() {
      return $n >= Warn && Zt(Qt || "warn", "WARN", arguments), this;
    },
    info() {
      return $n >= Info && Zt(Qt || "log", "INFO", arguments), this;
    },
    debug() {
      return $n >= Debug && Zt(Qt || "log", "DEBUG", arguments), this;
    }
  };
}
var isArray = Array.isArray;
function isObject(_e) {
  return _e === Object(_e);
}
const isLegalKey = (_e) => _e !== "__proto__";
function mergeConfig() {
  for (var _e = arguments.length, Qt = new Array(_e), Zt = 0; Zt < _e; Zt++)
    Qt[Zt] = arguments[Zt];
  return Qt.reduce(($n, Sn) => {
    for (const kn in Sn)
      if (kn === "signals")
        $n.signals = mergeNamed($n.signals, Sn.signals);
      else {
        const Kn = kn === "legend" ? {
          layout: 1
        } : kn === "style" ? !0 : null;
        writeConfig($n, kn, Sn[kn], Kn);
      }
    return $n;
  }, {});
}
function writeConfig(_e, Qt, Zt, $n) {
  if (!isLegalKey(Qt))
    return;
  let Sn, kn;
  if (isObject(Zt) && !isArray(Zt)) {
    kn = isObject(_e[Qt]) ? _e[Qt] : _e[Qt] = {};
    for (Sn in Zt)
      $n && ($n === !0 || $n[Sn]) ? writeConfig(kn, Sn, Zt[Sn]) : isLegalKey(Sn) && (kn[Sn] = Zt[Sn]);
  } else
    _e[Qt] = Zt;
}
function mergeNamed(_e, Qt) {
  if (_e == null)
    return Qt;
  const Zt = {}, $n = [];
  function Sn(kn) {
    Zt[kn.name] || (Zt[kn.name] = 1, $n.push(kn));
  }
  return Qt.forEach(Sn), _e.forEach(Sn), $n;
}
function peek$1(_e) {
  return _e[_e.length - 1];
}
function toNumber(_e) {
  return _e == null || _e === "" ? null : +_e;
}
const exp$2 = (_e) => (Qt) => _e * Math.exp(Qt), log$5 = (_e) => (Qt) => Math.log(_e * Qt), symlog$1 = (_e) => (Qt) => Math.sign(Qt) * Math.log1p(Math.abs(Qt / _e)), symexp = (_e) => (Qt) => Math.sign(Qt) * Math.expm1(Math.abs(Qt)) * _e, pow$4 = (_e) => (Qt) => Qt < 0 ? -Math.pow(-Qt, _e) : Math.pow(Qt, _e);
function pan(_e, Qt, Zt, $n) {
  const Sn = Zt(_e[0]), kn = Zt(peek$1(_e)), Kn = (kn - Sn) * Qt;
  return [$n(Sn - Kn), $n(kn - Kn)];
}
function panLinear(_e, Qt) {
  return pan(_e, Qt, toNumber, identity$7);
}
function panLog(_e, Qt) {
  var Zt = Math.sign(_e[0]);
  return pan(_e, Qt, log$5(Zt), exp$2(Zt));
}
function panPow(_e, Qt, Zt) {
  return pan(_e, Qt, pow$4(Zt), pow$4(1 / Zt));
}
function panSymlog(_e, Qt, Zt) {
  return pan(_e, Qt, symlog$1(Zt), symexp(Zt));
}
function zoom$2(_e, Qt, Zt, $n, Sn) {
  const kn = $n(_e[0]), Kn = $n(peek$1(_e)), er = Qt != null ? $n(Qt) : (kn + Kn) / 2;
  return [Sn(er + (kn - er) * Zt), Sn(er + (Kn - er) * Zt)];
}
function zoomLinear(_e, Qt, Zt) {
  return zoom$2(_e, Qt, Zt, toNumber, identity$7);
}
function zoomLog(_e, Qt, Zt) {
  const $n = Math.sign(_e[0]);
  return zoom$2(_e, Qt, Zt, log$5($n), exp$2($n));
}
function zoomPow(_e, Qt, Zt, $n) {
  return zoom$2(_e, Qt, Zt, pow$4($n), pow$4(1 / $n));
}
function zoomSymlog(_e, Qt, Zt, $n) {
  return zoom$2(_e, Qt, Zt, symlog$1($n), symexp($n));
}
function quarter(_e) {
  return 1 + ~~(new Date(_e).getMonth() / 3);
}
function utcquarter(_e) {
  return 1 + ~~(new Date(_e).getUTCMonth() / 3);
}
function array$6(_e) {
  return _e != null ? isArray(_e) ? _e : [_e] : [];
}
function clampRange(_e, Qt, Zt) {
  let $n = _e[0], Sn = _e[1], kn;
  return Sn < $n && (kn = Sn, Sn = $n, $n = kn), kn = Sn - $n, kn >= Zt - Qt ? [Qt, Zt] : [$n = Math.min(Math.max($n, Qt), Zt - kn), $n + kn];
}
function isFunction$1(_e) {
  return typeof _e == "function";
}
const DESCENDING = "descending";
function compare$9(_e, Qt, Zt) {
  Zt = Zt || {}, Qt = array$6(Qt) || [];
  const $n = [], Sn = [], kn = {}, Kn = Zt.comparator || comparator$1;
  return array$6(_e).forEach((er, Cr) => {
    er != null && ($n.push(Qt[Cr] === DESCENDING ? -1 : 1), Sn.push(er = isFunction$1(er) ? er : field$1(er, null, Zt)), (accessorFields(er) || []).forEach((kr) => kn[kr] = 1));
  }), Sn.length === 0 ? null : accessor(Kn(Sn, $n), Object.keys(kn));
}
const ascending$4 = (_e, Qt) => (_e < Qt || _e == null) && Qt != null ? -1 : (_e > Qt || Qt == null) && _e != null ? 1 : (Qt = Qt instanceof Date ? +Qt : Qt, (_e = _e instanceof Date ? +_e : _e) !== _e && Qt === Qt ? -1 : Qt !== Qt && _e === _e ? 1 : 0), comparator$1 = (_e, Qt) => _e.length === 1 ? compare1(_e[0], Qt[0]) : compareN(_e, Qt, _e.length), compare1 = (_e, Qt) => function(Zt, $n) {
  return ascending$4(_e(Zt), _e($n)) * Qt;
}, compareN = (_e, Qt, Zt) => (Qt.push(0), function($n, Sn) {
  let kn, Kn = 0, er = -1;
  for (; Kn === 0 && ++er < Zt; )
    kn = _e[er], Kn = ascending$4(kn($n), kn(Sn));
  return Kn * Qt[er];
});
function constant$7(_e) {
  return isFunction$1(_e) ? _e : () => _e;
}
function debounce(_e, Qt) {
  let Zt;
  return ($n) => {
    Zt && clearTimeout(Zt), Zt = setTimeout(() => (Qt($n), Zt = null), _e);
  };
}
function extend$1(_e) {
  for (let Qt, Zt, $n = 1, Sn = arguments.length; $n < Sn; ++$n) {
    Qt = arguments[$n];
    for (Zt in Qt)
      _e[Zt] = Qt[Zt];
  }
  return _e;
}
function extent(_e, Qt) {
  let Zt = 0, $n, Sn, kn, Kn;
  if (_e && ($n = _e.length))
    if (Qt == null) {
      for (Sn = _e[Zt]; Zt < $n && (Sn == null || Sn !== Sn); Sn = _e[++Zt])
        ;
      for (kn = Kn = Sn; Zt < $n; ++Zt)
        Sn = _e[Zt], Sn != null && (Sn < kn && (kn = Sn), Sn > Kn && (Kn = Sn));
    } else {
      for (Sn = Qt(_e[Zt]); Zt < $n && (Sn == null || Sn !== Sn); Sn = Qt(_e[++Zt]))
        ;
      for (kn = Kn = Sn; Zt < $n; ++Zt)
        Sn = Qt(_e[Zt]), Sn != null && (Sn < kn && (kn = Sn), Sn > Kn && (Kn = Sn));
    }
  return [kn, Kn];
}
function extentIndex(_e, Qt) {
  const Zt = _e.length;
  let $n = -1, Sn, kn, Kn, er, Cr;
  if (Qt == null) {
    for (; ++$n < Zt; )
      if (kn = _e[$n], kn != null && kn >= kn) {
        Sn = Kn = kn;
        break;
      }
    if ($n === Zt)
      return [-1, -1];
    for (er = Cr = $n; ++$n < Zt; )
      kn = _e[$n], kn != null && (Sn > kn && (Sn = kn, er = $n), Kn < kn && (Kn = kn, Cr = $n));
  } else {
    for (; ++$n < Zt; )
      if (kn = Qt(_e[$n], $n, _e), kn != null && kn >= kn) {
        Sn = Kn = kn;
        break;
      }
    if ($n === Zt)
      return [-1, -1];
    for (er = Cr = $n; ++$n < Zt; )
      kn = Qt(_e[$n], $n, _e), kn != null && (Sn > kn && (Sn = kn, er = $n), Kn < kn && (Kn = kn, Cr = $n));
  }
  return [er, Cr];
}
const hop = Object.prototype.hasOwnProperty;
function has$1(_e, Qt) {
  return hop.call(_e, Qt);
}
const NULL = {};
function fastmap(_e) {
  let Qt = {}, Zt;
  function $n(kn) {
    return has$1(Qt, kn) && Qt[kn] !== NULL;
  }
  const Sn = {
    size: 0,
    empty: 0,
    object: Qt,
    has: $n,
    get(kn) {
      return $n(kn) ? Qt[kn] : void 0;
    },
    set(kn, Kn) {
      return $n(kn) || (++Sn.size, Qt[kn] === NULL && --Sn.empty), Qt[kn] = Kn, this;
    },
    delete(kn) {
      return $n(kn) && (--Sn.size, ++Sn.empty, Qt[kn] = NULL), this;
    },
    clear() {
      Sn.size = Sn.empty = 0, Sn.object = Qt = {};
    },
    test(kn) {
      return arguments.length ? (Zt = kn, Sn) : Zt;
    },
    clean() {
      const kn = {};
      let Kn = 0;
      for (const er in Qt) {
        const Cr = Qt[er];
        Cr !== NULL && (!Zt || !Zt(Cr)) && (kn[er] = Cr, ++Kn);
      }
      Sn.size = Kn, Sn.empty = 0, Sn.object = Qt = kn;
    }
  };
  return _e && Object.keys(_e).forEach((kn) => {
    Sn.set(kn, _e[kn]);
  }), Sn;
}
function flush$1(_e, Qt, Zt, $n, Sn, kn) {
  if (!Zt && Zt !== 0)
    return kn;
  const Kn = +Zt;
  let er = _e[0], Cr = peek$1(_e), kr;
  Cr < er && (kr = er, er = Cr, Cr = kr), kr = Math.abs(Qt - er);
  const Yr = Math.abs(Cr - Qt);
  return kr < Yr && kr <= Kn ? $n : Yr <= Kn ? Sn : kn;
}
function inherits(_e, Qt, Zt) {
  const $n = _e.prototype = Object.create(Qt.prototype);
  return Object.defineProperty($n, "constructor", {
    value: _e,
    writable: !0,
    enumerable: !0,
    configurable: !0
  }), extend$1($n, Zt);
}
function inrange(_e, Qt, Zt, $n) {
  let Sn = Qt[0], kn = Qt[Qt.length - 1], Kn;
  return Sn > kn && (Kn = Sn, Sn = kn, kn = Kn), Zt = Zt === void 0 || Zt, $n = $n === void 0 || $n, (Zt ? Sn <= _e : Sn < _e) && ($n ? _e <= kn : _e < kn);
}
function isBoolean$2(_e) {
  return typeof _e == "boolean";
}
function isDate$1(_e) {
  return Object.prototype.toString.call(_e) === "[object Date]";
}
function isIterable(_e) {
  return _e && isFunction$1(_e[Symbol.iterator]);
}
function isNumber$1(_e) {
  return typeof _e == "number";
}
function isRegExp(_e) {
  return Object.prototype.toString.call(_e) === "[object RegExp]";
}
function isString(_e) {
  return typeof _e == "string";
}
function key(_e, Qt, Zt) {
  _e && (_e = Qt ? array$6(_e).map((er) => er.replace(/\\(.)/g, "$1")) : array$6(_e));
  const $n = _e && _e.length, Sn = Zt && Zt.get || getter, kn = (er) => Sn(Qt ? [er] : splitAccessPath(er));
  let Kn;
  if (!$n)
    Kn = function() {
      return "";
    };
  else if ($n === 1) {
    const er = kn(_e[0]);
    Kn = function(Cr) {
      return "" + er(Cr);
    };
  } else {
    const er = _e.map(kn);
    Kn = function(Cr) {
      let kr = "" + er[0](Cr), Yr = 0;
      for (; ++Yr < $n; )
        kr += "|" + er[Yr](Cr);
      return kr;
    };
  }
  return accessor(Kn, _e, "key");
}
function lerp(_e, Qt) {
  const Zt = _e[0], $n = peek$1(_e), Sn = +Qt;
  return Sn ? Sn === 1 ? $n : Zt + Sn * ($n - Zt) : Zt;
}
const DEFAULT_MAX_SIZE = 1e4;
function lruCache$1(_e) {
  _e = +_e || DEFAULT_MAX_SIZE;
  let Qt, Zt, $n;
  const Sn = () => {
    Qt = {}, Zt = {}, $n = 0;
  }, kn = (Kn, er) => (++$n > _e && (Zt = Qt, Qt = {}, $n = 1), Qt[Kn] = er);
  return Sn(), {
    clear: Sn,
    has: (Kn) => has$1(Qt, Kn) || has$1(Zt, Kn),
    get: (Kn) => has$1(Qt, Kn) ? Qt[Kn] : has$1(Zt, Kn) ? kn(Kn, Zt[Kn]) : void 0,
    set: (Kn, er) => has$1(Qt, Kn) ? Qt[Kn] = er : kn(Kn, er)
  };
}
function merge$3(_e, Qt, Zt, $n) {
  const Sn = Qt.length, kn = Zt.length;
  if (!kn)
    return Qt;
  if (!Sn)
    return Zt;
  const Kn = $n || new Qt.constructor(Sn + kn);
  let er = 0, Cr = 0, kr = 0;
  for (; er < Sn && Cr < kn; ++kr)
    Kn[kr] = _e(Qt[er], Zt[Cr]) > 0 ? Zt[Cr++] : Qt[er++];
  for (; er < Sn; ++er, ++kr)
    Kn[kr] = Qt[er];
  for (; Cr < kn; ++Cr, ++kr)
    Kn[kr] = Zt[Cr];
  return Kn;
}
function repeat(_e, Qt) {
  let Zt = "";
  for (; --Qt >= 0; )
    Zt += _e;
  return Zt;
}
function pad$2(_e, Qt, Zt, $n) {
  const Sn = Zt || " ", kn = _e + "", Kn = Qt - kn.length;
  return Kn <= 0 ? kn : $n === "left" ? repeat(Sn, Kn) + kn : $n === "center" ? repeat(Sn, ~~(Kn / 2)) + kn + repeat(Sn, Math.ceil(Kn / 2)) : kn + repeat(Sn, Kn);
}
function span(_e) {
  return _e && peek$1(_e) - _e[0] || 0;
}
function $(_e) {
  return isArray(_e) ? "[" + _e.map($) + "]" : isObject(_e) || isString(_e) ? (
    // Output valid JSON and JS source strings.
    // See http://timelessrepo.com/json-isnt-a-javascript-subset
    JSON.stringify(_e).replace("\u2028", "\\u2028").replace("\u2029", "\\u2029")
  ) : _e;
}
function toBoolean(_e) {
  return _e == null || _e === "" ? null : !_e || _e === "false" || _e === "0" ? !1 : !!_e;
}
const defaultParser = (_e) => isNumber$1(_e) || isDate$1(_e) ? _e : Date.parse(_e);
function toDate(_e, Qt) {
  return Qt = Qt || defaultParser, _e == null || _e === "" ? null : Qt(_e);
}
function toString(_e) {
  return _e == null || _e === "" ? null : _e + "";
}
function toSet(_e) {
  const Qt = {}, Zt = _e.length;
  for (let $n = 0; $n < Zt; ++$n)
    Qt[_e[$n]] = !0;
  return Qt;
}
function truncate$1(_e, Qt, Zt, $n) {
  const Sn = $n ?? "…", kn = _e + "", Kn = kn.length, er = Math.max(0, Qt - Sn.length);
  return Kn <= Qt ? kn : Zt === "left" ? Sn + kn.slice(Kn - er) : Zt === "center" ? kn.slice(0, Math.ceil(er / 2)) + Sn + kn.slice(Kn - ~~(er / 2)) : kn.slice(0, er) + Sn;
}
function visitArray(_e, Qt, Zt) {
  if (_e)
    if (Qt) {
      const $n = _e.length;
      for (let Sn = 0; Sn < $n; ++Sn) {
        const kn = Qt(_e[Sn]);
        kn && Zt(kn, Sn, _e);
      }
    } else
      _e.forEach(Zt);
}
var clone = { exports: {} };
(function(_e) {
  var Qt = function() {
    function Zt(Ds, Ls) {
      return Ls != null && Ds instanceof Ls;
    }
    var $n;
    try {
      $n = Map;
    } catch {
      $n = function() {
      };
    }
    var Sn;
    try {
      Sn = Set;
    } catch {
      Sn = function() {
      };
    }
    var kn;
    try {
      kn = Promise;
    } catch {
      kn = function() {
      };
    }
    function Kn(Ds, Ls, js, zs, Fs) {
      typeof Ls == "object" && (js = Ls.depth, zs = Ls.prototype, Fs = Ls.includeNonEnumerable, Ls = Ls.circular);
      var Bs = [], Hs = [], Ws = typeof Buffer < "u";
      typeof Ls > "u" && (Ls = !0), typeof js > "u" && (js = 1 / 0);
      function Ys(El, Mu) {
        if (El === null)
          return null;
        if (Mu === 0)
          return El;
        var Pl, Iu;
        if (typeof El != "object")
          return El;
        if (Zt(El, $n))
          Pl = new $n();
        else if (Zt(El, Sn))
          Pl = new Sn();
        else if (Zt(El, kn))
          Pl = new kn(function(mm, hm) {
            El.then(function(ym) {
              mm(Ys(ym, Mu - 1));
            }, function(ym) {
              hm(Ys(ym, Mu - 1));
            });
          });
        else if (Kn.__isArray(El))
          Pl = [];
        else if (Kn.__isRegExp(El))
          Pl = new RegExp(El.source, Ms(El)), El.lastIndex && (Pl.lastIndex = El.lastIndex);
        else if (Kn.__isDate(El))
          Pl = new Date(El.getTime());
        else {
          if (Ws && Buffer.isBuffer(El))
            return Buffer.allocUnsafe ? Pl = Buffer.allocUnsafe(El.length) : Pl = new Buffer(El.length), El.copy(Pl), Pl;
          Zt(El, Error) ? Pl = Object.create(El) : typeof zs > "u" ? (Iu = Object.getPrototypeOf(El), Pl = Object.create(Iu)) : (Pl = Object.create(zs), Iu = zs);
        }
        if (Ls) {
          var Tu = Bs.indexOf(El);
          if (Tu != -1)
            return Hs[Tu];
          Bs.push(El), Hs.push(Pl);
        }
        Zt(El, $n) && El.forEach(function(mm, hm) {
          var ym = Ys(hm, Mu - 1), _m = Ys(mm, Mu - 1);
          Pl.set(ym, _m);
        }), Zt(El, Sn) && El.forEach(function(mm) {
          var hm = Ys(mm, Mu - 1);
          Pl.add(hm);
        });
        for (var Au in El) {
          var Nu;
          Iu && (Nu = Object.getOwnPropertyDescriptor(Iu, Au)), !(Nu && Nu.set == null) && (Pl[Au] = Ys(El[Au], Mu - 1));
        }
        if (Object.getOwnPropertySymbols)
          for (var gm = Object.getOwnPropertySymbols(El), Au = 0; Au < gm.length; Au++) {
            var pm = gm[Au], zu = Object.getOwnPropertyDescriptor(El, pm);
            zu && !zu.enumerable && !Fs || (Pl[pm] = Ys(El[pm], Mu - 1), zu.enumerable || Object.defineProperty(Pl, pm, {
              enumerable: !1
            }));
          }
        if (Fs)
          for (var Yu = Object.getOwnPropertyNames(El), Au = 0; Au < Yu.length; Au++) {
            var sm = Yu[Au], zu = Object.getOwnPropertyDescriptor(El, sm);
            zu && zu.enumerable || (Pl[sm] = Ys(El[sm], Mu - 1), Object.defineProperty(Pl, sm, {
              enumerable: !1
            }));
          }
        return Pl;
      }
      return Ys(Ds, js);
    }
    Kn.clonePrototype = function(Ls) {
      if (Ls === null)
        return null;
      var js = function() {
      };
      return js.prototype = Ls, new js();
    };
    function er(Ds) {
      return Object.prototype.toString.call(Ds);
    }
    Kn.__objToStr = er;
    function Cr(Ds) {
      return typeof Ds == "object" && er(Ds) === "[object Date]";
    }
    Kn.__isDate = Cr;
    function kr(Ds) {
      return typeof Ds == "object" && er(Ds) === "[object Array]";
    }
    Kn.__isArray = kr;
    function Yr(Ds) {
      return typeof Ds == "object" && er(Ds) === "[object RegExp]";
    }
    Kn.__isRegExp = Yr;
    function Ms(Ds) {
      var Ls = "";
      return Ds.global && (Ls += "g"), Ds.ignoreCase && (Ls += "i"), Ds.multiline && (Ls += "m"), Ls;
    }
    return Kn.__getRegExpFlags = Ms, Kn;
  }();
  _e.exports && (_e.exports = Qt);
})(clone);
var cloneExports = clone.exports;
const clone_ = /* @__PURE__ */ getDefaultExportFromCjs$1(cloneExports);
var fastJsonStableStringify = function(_e, Qt) {
  Qt || (Qt = {}), typeof Qt == "function" && (Qt = { cmp: Qt });
  var Zt = typeof Qt.cycles == "boolean" ? Qt.cycles : !1, $n = Qt.cmp && function(kn) {
    return function(Kn) {
      return function(er, Cr) {
        var kr = { key: er, value: Kn[er] }, Yr = { key: Cr, value: Kn[Cr] };
        return kn(kr, Yr);
      };
    };
  }(Qt.cmp), Sn = [];
  return function kn(Kn) {
    if (Kn && Kn.toJSON && typeof Kn.toJSON == "function" && (Kn = Kn.toJSON()), Kn !== void 0) {
      if (typeof Kn == "number")
        return isFinite(Kn) ? "" + Kn : "null";
      if (typeof Kn != "object")
        return JSON.stringify(Kn);
      var er, Cr;
      if (Array.isArray(Kn)) {
        for (Cr = "[", er = 0; er < Kn.length; er++)
          er && (Cr += ","), Cr += kn(Kn[er]) || "null";
        return Cr + "]";
      }
      if (Kn === null)
        return "null";
      if (Sn.indexOf(Kn) !== -1) {
        if (Zt)
          return JSON.stringify("__cycle__");
        throw new TypeError("Converting circular structure to JSON");
      }
      var kr = Sn.push(Kn) - 1, Yr = Object.keys(Kn).sort($n && $n(Kn));
      for (Cr = "", er = 0; er < Yr.length; er++) {
        var Ms = Yr[er], Ds = kn(Kn[Ms]);
        Ds && (Cr && (Cr += ","), Cr += JSON.stringify(Ms) + ":" + Ds);
      }
      return Sn.splice(kr, 1), "{" + Cr + "}";
    }
  }(_e);
};
const stableStringify = /* @__PURE__ */ getDefaultExportFromCjs$1(fastJsonStableStringify);
function isLogicalOr(_e) {
  return !!_e.or;
}
function isLogicalAnd(_e) {
  return !!_e.and;
}
function isLogicalNot(_e) {
  return !!_e.not;
}
function forEachLeaf(_e, Qt) {
  if (isLogicalNot(_e))
    forEachLeaf(_e.not, Qt);
  else if (isLogicalAnd(_e))
    for (const Zt of _e.and)
      forEachLeaf(Zt, Qt);
  else if (isLogicalOr(_e))
    for (const Zt of _e.or)
      forEachLeaf(Zt, Qt);
  else
    Qt(_e);
}
function normalizeLogicalComposition(_e, Qt) {
  return isLogicalNot(_e) ? { not: normalizeLogicalComposition(_e.not, Qt) } : isLogicalAnd(_e) ? { and: _e.and.map((Zt) => normalizeLogicalComposition(Zt, Qt)) } : isLogicalOr(_e) ? { or: _e.or.map((Zt) => normalizeLogicalComposition(Zt, Qt)) } : Qt(_e);
}
const deepEqual = equal$1, duplicate = clone_;
function never(_e) {
  throw new Error(_e);
}
function pick$2(_e, Qt) {
  const Zt = {};
  for (const $n of Qt)
    has$1(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
}
function omit(_e, Qt) {
  const Zt = { ..._e };
  for (const $n of Qt)
    delete Zt[$n];
  return Zt;
}
Set.prototype.toJSON = function() {
  return `Set(${[...this].map((_e) => stableStringify(_e)).join(",")})`;
};
const stringify$2 = stableStringify;
function hash(_e) {
  if (isNumber$1(_e))
    return _e;
  const Qt = isString(_e) ? _e : stableStringify(_e);
  if (Qt.length < 250)
    return Qt;
  let Zt = 0;
  for (let $n = 0; $n < Qt.length; $n++) {
    const Sn = Qt.charCodeAt($n);
    Zt = (Zt << 5) - Zt + Sn, Zt = Zt & Zt;
  }
  return Zt;
}
function isNullOrFalse(_e) {
  return _e === !1 || _e === null;
}
function contains$1(_e, Qt) {
  return _e.includes(Qt);
}
function some(_e, Qt) {
  let Zt = 0;
  for (const [$n, Sn] of _e.entries())
    if (Qt(Sn, $n, Zt++))
      return !0;
  return !1;
}
function every(_e, Qt) {
  let Zt = 0;
  for (const [$n, Sn] of _e.entries())
    if (!Qt(Sn, $n, Zt++))
      return !1;
  return !0;
}
function mergeDeep$1(_e, ...Qt) {
  for (const Zt of Qt)
    deepMerge_$1(_e, Zt ?? {});
  return _e;
}
function deepMerge_$1(_e, Qt) {
  for (const Zt of keys$2(Qt))
    writeConfig(_e, Zt, Qt[Zt], !0);
}
function unique(_e, Qt) {
  const Zt = [], $n = {};
  let Sn;
  for (const kn of _e)
    Sn = Qt(kn), !(Sn in $n) && ($n[Sn] = 1, Zt.push(kn));
  return Zt;
}
function isEqual$3(_e, Qt) {
  const Zt = keys$2(_e), $n = keys$2(Qt);
  if (Zt.length !== $n.length)
    return !1;
  for (const Sn of Zt)
    if (_e[Sn] !== Qt[Sn])
      return !1;
  return !0;
}
function setEqual(_e, Qt) {
  if (_e.size !== Qt.size)
    return !1;
  for (const Zt of _e)
    if (!Qt.has(Zt))
      return !1;
  return !0;
}
function hasIntersection(_e, Qt) {
  for (const Zt of _e)
    if (Qt.has(Zt))
      return !0;
  return !1;
}
function prefixGenerator(_e) {
  const Qt = /* @__PURE__ */ new Set();
  for (const Zt of _e) {
    const Sn = splitAccessPath(Zt).map((Kn, er) => er === 0 ? Kn : `[${Kn}]`), kn = Sn.map((Kn, er) => Sn.slice(0, er + 1).join(""));
    for (const Kn of kn)
      Qt.add(Kn);
  }
  return Qt;
}
function fieldIntersection(_e, Qt) {
  return _e === void 0 || Qt === void 0 ? !0 : hasIntersection(prefixGenerator(_e), prefixGenerator(Qt));
}
function isEmpty(_e) {
  return keys$2(_e).length === 0;
}
const keys$2 = Object.keys, vals = Object.values, entries$1 = Object.entries;
function isBoolean$1(_e) {
  return _e === !0 || _e === !1;
}
function varName(_e) {
  const Qt = _e.replace(/\W/g, "_");
  return (_e.match(/^\d+/) ? "_" : "") + Qt;
}
function logicalExpr(_e, Qt) {
  return isLogicalNot(_e) ? `!(${logicalExpr(_e.not, Qt)})` : isLogicalAnd(_e) ? `(${_e.and.map((Zt) => logicalExpr(Zt, Qt)).join(") && (")})` : isLogicalOr(_e) ? `(${_e.or.map((Zt) => logicalExpr(Zt, Qt)).join(") || (")})` : Qt(_e);
}
function deleteNestedProperty(_e, Qt) {
  if (Qt.length === 0)
    return !0;
  const Zt = Qt.shift();
  return Zt in _e && deleteNestedProperty(_e[Zt], Qt) && delete _e[Zt], isEmpty(_e);
}
function titleCase(_e) {
  return _e.charAt(0).toUpperCase() + _e.substr(1);
}
function accessPathWithDatum(_e, Qt = "datum") {
  const Zt = splitAccessPath(_e), $n = [];
  for (let Sn = 1; Sn <= Zt.length; Sn++) {
    const kn = `[${Zt.slice(0, Sn).map($).join("][")}]`;
    $n.push(`${Qt}${kn}`);
  }
  return $n.join(" && ");
}
function flatAccessWithDatum(_e, Qt = "datum") {
  return `${Qt}[${$(splitAccessPath(_e).join("."))}]`;
}
function escapePathAccess(_e) {
  return _e.replace(/(\[|\]|\.|'|")/g, "\\$1");
}
function replacePathInField(_e) {
  return `${splitAccessPath(_e).map(escapePathAccess).join("\\.")}`;
}
function replaceAll(_e, Qt, Zt) {
  return _e.replace(new RegExp(Qt.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"), "g"), Zt);
}
function removePathFromField(_e) {
  return `${splitAccessPath(_e).join(".")}`;
}
function accessPathDepth(_e) {
  return _e ? splitAccessPath(_e).length : 0;
}
function getFirstDefined(..._e) {
  for (const Qt of _e)
    if (Qt !== void 0)
      return Qt;
}
let idCounter = 42;
function uniqueId(_e) {
  const Qt = ++idCounter;
  return _e ? String(_e) + Qt : Qt;
}
function resetIdCounter() {
  idCounter = 42;
}
function internalField(_e) {
  return isInternalField(_e) ? _e : `__${_e}`;
}
function isInternalField(_e) {
  return _e.startsWith("__");
}
function normalizeAngle(_e) {
  if (_e !== void 0)
    return (_e % 360 + 360) % 360;
}
function isNumeric(_e) {
  return isNumber$1(_e) ? !0 : !isNaN(_e) && !isNaN(parseFloat(_e));
}
const ROW = "row", COLUMN = "column", FACET = "facet", X$1 = "x", Y$1 = "y", X2$2 = "x2", Y2$2 = "y2", XOFFSET = "xOffset", YOFFSET = "yOffset", RADIUS = "radius", RADIUS2 = "radius2", THETA = "theta", THETA2 = "theta2", LATITUDE = "latitude", LONGITUDE = "longitude", LATITUDE2 = "latitude2", LONGITUDE2 = "longitude2", COLOR = "color", FILL = "fill", STROKE = "stroke", SHAPE = "shape", SIZE$1 = "size", ANGLE = "angle", OPACITY = "opacity", FILLOPACITY = "fillOpacity", STROKEOPACITY = "strokeOpacity", STROKEWIDTH = "strokeWidth", STROKEDASH = "strokeDash", TEXT$1 = "text", ORDER = "order", DETAIL = "detail", KEY = "key", TOOLTIP = "tooltip", HREF = "href", URL$1 = "url", DESCRIPTION = "description", POSITION_CHANNEL_INDEX = {
  x: 1,
  y: 1,
  x2: 1,
  y2: 1
}, POLAR_POSITION_CHANNEL_INDEX = {
  theta: 1,
  theta2: 1,
  radius: 1,
  radius2: 1
};
function isPolarPositionChannel(_e) {
  return _e in POLAR_POSITION_CHANNEL_INDEX;
}
const GEO_POSIITON_CHANNEL_INDEX = {
  longitude: 1,
  longitude2: 1,
  latitude: 1,
  latitude2: 1
};
function getPositionChannelFromLatLong(_e) {
  switch (_e) {
    case LATITUDE:
      return "y";
    case LATITUDE2:
      return "y2";
    case LONGITUDE:
      return "x";
    case LONGITUDE2:
      return "x2";
  }
}
function isGeoPositionChannel(_e) {
  return _e in GEO_POSIITON_CHANNEL_INDEX;
}
const GEOPOSITION_CHANNELS = keys$2(GEO_POSIITON_CHANNEL_INDEX), UNIT_CHANNEL_INDEX = {
  ...POSITION_CHANNEL_INDEX,
  ...POLAR_POSITION_CHANNEL_INDEX,
  ...GEO_POSIITON_CHANNEL_INDEX,
  xOffset: 1,
  yOffset: 1,
  // color
  color: 1,
  fill: 1,
  stroke: 1,
  // other non-position with scale
  opacity: 1,
  fillOpacity: 1,
  strokeOpacity: 1,
  strokeWidth: 1,
  strokeDash: 1,
  size: 1,
  angle: 1,
  shape: 1,
  // channels without scales
  order: 1,
  text: 1,
  detail: 1,
  key: 1,
  tooltip: 1,
  href: 1,
  url: 1,
  description: 1
};
function isColorChannel(_e) {
  return _e === COLOR || _e === FILL || _e === STROKE;
}
const FACET_CHANNEL_INDEX = {
  row: 1,
  column: 1,
  facet: 1
}, FACET_CHANNELS = keys$2(FACET_CHANNEL_INDEX), CHANNEL_INDEX = {
  ...UNIT_CHANNEL_INDEX,
  ...FACET_CHANNEL_INDEX
}, CHANNELS = keys$2(CHANNEL_INDEX), { order: _o$1, detail: _d$1, tooltip: _tt1, ...SINGLE_DEF_CHANNEL_INDEX } = CHANNEL_INDEX, { row: _r$1, column: _c$1, facet: _f$1, ...SINGLE_DEF_UNIT_CHANNEL_INDEX } = SINGLE_DEF_CHANNEL_INDEX;
function isSingleDefUnitChannel(_e) {
  return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[_e];
}
function isChannel(_e) {
  return !!CHANNEL_INDEX[_e];
}
const SECONDARY_RANGE_CHANNEL = [X2$2, Y2$2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2];
function isSecondaryRangeChannel(_e) {
  return getMainRangeChannel(_e) !== _e;
}
function getMainRangeChannel(_e) {
  switch (_e) {
    case X2$2:
      return X$1;
    case Y2$2:
      return Y$1;
    case LATITUDE2:
      return LATITUDE;
    case LONGITUDE2:
      return LONGITUDE;
    case THETA2:
      return THETA;
    case RADIUS2:
      return RADIUS;
  }
  return _e;
}
function getVgPositionChannel(_e) {
  if (isPolarPositionChannel(_e))
    switch (_e) {
      case THETA:
        return "startAngle";
      case THETA2:
        return "endAngle";
      case RADIUS:
        return "outerRadius";
      case RADIUS2:
        return "innerRadius";
    }
  return _e;
}
function getSecondaryRangeChannel(_e) {
  switch (_e) {
    case X$1:
      return X2$2;
    case Y$1:
      return Y2$2;
    case LATITUDE:
      return LATITUDE2;
    case LONGITUDE:
      return LONGITUDE2;
    case THETA:
      return THETA2;
    case RADIUS:
      return RADIUS2;
  }
}
function getSizeChannel(_e) {
  switch (_e) {
    case X$1:
    case X2$2:
      return "width";
    case Y$1:
    case Y2$2:
      return "height";
  }
}
function getOffsetChannel(_e) {
  switch (_e) {
    case X$1:
      return "xOffset";
    case Y$1:
      return "yOffset";
    case X2$2:
      return "x2Offset";
    case Y2$2:
      return "y2Offset";
    case THETA:
      return "thetaOffset";
    case RADIUS:
      return "radiusOffset";
    case THETA2:
      return "theta2Offset";
    case RADIUS2:
      return "radius2Offset";
  }
}
function getOffsetScaleChannel(_e) {
  switch (_e) {
    case X$1:
      return "xOffset";
    case Y$1:
      return "yOffset";
  }
}
function getMainChannelFromOffsetChannel(_e) {
  switch (_e) {
    case "xOffset":
      return "x";
    case "yOffset":
      return "y";
  }
}
const UNIT_CHANNELS = keys$2(UNIT_CHANNEL_INDEX), {
  x: _x$1,
  y: _y$1,
  // x2 and y2 share the same scale as x and y
  x2: _x2,
  y2: _y2,
  //
  xOffset: _xo,
  yOffset: _yo,
  latitude: _latitude,
  longitude: _longitude,
  latitude2: _latitude2,
  longitude2: _longitude2,
  theta: _theta,
  theta2: _theta2,
  radius: _radius,
  radius2: _radius2,
  // The rest of unit channels then have scale
  ...NONPOSITION_CHANNEL_INDEX
} = UNIT_CHANNEL_INDEX, NONPOSITION_CHANNELS = keys$2(NONPOSITION_CHANNEL_INDEX), POSITION_SCALE_CHANNEL_INDEX = {
  x: 1,
  y: 1
}, POSITION_SCALE_CHANNELS = keys$2(POSITION_SCALE_CHANNEL_INDEX);
function isXorY(_e) {
  return _e in POSITION_SCALE_CHANNEL_INDEX;
}
const POLAR_POSITION_SCALE_CHANNEL_INDEX = {
  theta: 1,
  radius: 1
}, POLAR_POSITION_SCALE_CHANNELS = keys$2(POLAR_POSITION_SCALE_CHANNEL_INDEX);
function getPositionScaleChannel(_e) {
  return _e === "width" ? X$1 : Y$1;
}
const OFFSET_SCALE_CHANNEL_INDEX = { xOffset: 1, yOffset: 1 };
function isXorYOffset(_e) {
  return _e in OFFSET_SCALE_CHANNEL_INDEX;
}
const {
  // x2 and y2 share the same scale as x and y
  // text and tooltip have format instead of scale,
  // href has neither format, nor scale
  text: _t$1,
  tooltip: _tt,
  href: _hr,
  url: _u$1,
  description: _al,
  // detail and order have no scale
  detail: _dd,
  key: _k,
  order: _oo,
  ...NONPOSITION_SCALE_CHANNEL_INDEX
} = NONPOSITION_CHANNEL_INDEX, NONPOSITION_SCALE_CHANNELS = keys$2(NONPOSITION_SCALE_CHANNEL_INDEX);
function isNonPositionScaleChannel(_e) {
  return !!NONPOSITION_CHANNEL_INDEX[_e];
}
function supportLegend(_e) {
  switch (_e) {
    case COLOR:
    case FILL:
    case STROKE:
    case SIZE$1:
    case SHAPE:
    case OPACITY:
    case STROKEWIDTH:
    case STROKEDASH:
      return !0;
    case FILLOPACITY:
    case STROKEOPACITY:
    case ANGLE:
      return !1;
  }
}
const SCALE_CHANNEL_INDEX = {
  ...POSITION_SCALE_CHANNEL_INDEX,
  ...POLAR_POSITION_SCALE_CHANNEL_INDEX,
  ...OFFSET_SCALE_CHANNEL_INDEX,
  ...NONPOSITION_SCALE_CHANNEL_INDEX
}, SCALE_CHANNELS = keys$2(SCALE_CHANNEL_INDEX);
function isScaleChannel(_e) {
  return !!SCALE_CHANNEL_INDEX[_e];
}
function supportMark(_e, Qt) {
  return getSupportedMark(_e)[Qt];
}
const ALL_MARKS = {
  // all marks
  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"
}, { geoshape: _g$1, ...ALL_MARKS_EXCEPT_GEOSHAPE } = ALL_MARKS;
function getSupportedMark(_e) {
  switch (_e) {
    case COLOR:
    case FILL:
    case STROKE:
    case DESCRIPTION:
    case DETAIL:
    case KEY:
    case TOOLTIP:
    case HREF:
    case ORDER:
    case OPACITY:
    case FILLOPACITY:
    case STROKEOPACITY:
    case STROKEWIDTH:
    case FACET:
    case ROW:
    case COLUMN:
      return ALL_MARKS;
    case X$1:
    case Y$1:
    case XOFFSET:
    case YOFFSET:
    case LATITUDE:
    case LONGITUDE:
      return ALL_MARKS_EXCEPT_GEOSHAPE;
    case X2$2:
    case Y2$2:
    case LATITUDE2:
    case LONGITUDE2:
      return {
        area: "always",
        bar: "always",
        image: "always",
        rect: "always",
        rule: "always",
        circle: "binned",
        point: "binned",
        square: "binned",
        tick: "binned",
        line: "binned",
        trail: "binned"
      };
    case SIZE$1:
      return {
        point: "always",
        tick: "always",
        rule: "always",
        circle: "always",
        square: "always",
        bar: "always",
        text: "always",
        line: "always",
        trail: "always"
      };
    case STROKEDASH:
      return {
        line: "always",
        point: "always",
        tick: "always",
        rule: "always",
        circle: "always",
        square: "always",
        bar: "always",
        geoshape: "always"
      };
    case SHAPE:
      return { point: "always", geoshape: "always" };
    case TEXT$1:
      return { text: "always" };
    case ANGLE:
      return { point: "always", square: "always", text: "always" };
    case URL$1:
      return { image: "always" };
    case THETA:
      return { text: "always", arc: "always" };
    case RADIUS:
      return { text: "always", arc: "always" };
    case THETA2:
    case RADIUS2:
      return { arc: "always" };
  }
}
function rangeType(_e) {
  switch (_e) {
    case X$1:
    case Y$1:
    case THETA:
    case RADIUS:
    case XOFFSET:
    case YOFFSET:
    case SIZE$1:
    case ANGLE:
    case STROKEWIDTH:
    case OPACITY:
    case FILLOPACITY:
    case STROKEOPACITY:
    case X2$2:
    case Y2$2:
    case THETA2:
    case RADIUS2:
      return;
    case FACET:
    case ROW:
    case COLUMN:
    case SHAPE:
    case STROKEDASH:
    case TEXT$1:
    case TOOLTIP:
    case HREF:
    case URL$1:
    case DESCRIPTION:
      return "discrete";
    case COLOR:
    case FILL:
    case STROKE:
      return "flexible";
    case LATITUDE:
    case LONGITUDE:
    case LATITUDE2:
    case LONGITUDE2:
    case DETAIL:
    case KEY:
    case ORDER:
      return;
  }
}
const AGGREGATE_OP_INDEX = {
  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
}, MULTIDOMAIN_SORT_OP_INDEX = {
  count: 1,
  min: 1,
  max: 1
};
function isArgminDef(_e) {
  return !!_e && !!_e.argmin;
}
function isArgmaxDef(_e) {
  return !!_e && !!_e.argmax;
}
function isAggregateOp(_e) {
  return isString(_e) && !!AGGREGATE_OP_INDEX[_e];
}
const COUNTING_OPS = /* @__PURE__ */ new Set([
  "count",
  "valid",
  "missing",
  "distinct"
]);
function isCountingAggregateOp(_e) {
  return isString(_e) && COUNTING_OPS.has(_e);
}
function isMinMaxOp(_e) {
  return isString(_e) && contains$1(["min", "max"], _e);
}
const SUM_OPS = /* @__PURE__ */ new Set([
  "count",
  "sum",
  "distinct",
  "valid",
  "missing"
]), SHARED_DOMAIN_OPS = /* @__PURE__ */ new Set([
  "mean",
  "average",
  "median",
  "q1",
  "q3",
  "min",
  "max"
]);
function binToString(_e) {
  return isBoolean$2(_e) && (_e = normalizeBin(_e, void 0)), "bin" + keys$2(_e).map((Qt) => isParameterExtent(_e[Qt]) ? varName(`_${Qt}_${entries$1(_e[Qt])}`) : varName(`_${Qt}_${_e[Qt]}`)).join("");
}
function isBinning(_e) {
  return _e === !0 || isBinParams(_e) && !_e.binned;
}
function isBinned(_e) {
  return _e === "binned" || isBinParams(_e) && _e.binned === !0;
}
function isBinParams(_e) {
  return isObject(_e);
}
function isParameterExtent(_e) {
  return _e == null ? void 0 : _e.param;
}
function autoMaxBins(_e) {
  switch (_e) {
    case ROW:
    case COLUMN:
    case SIZE$1:
    case COLOR:
    case FILL:
    case STROKE:
    case STROKEWIDTH:
    case OPACITY:
    case FILLOPACITY:
    case STROKEOPACITY:
    case SHAPE:
      return 6;
    case STROKEDASH:
      return 4;
    default:
      return 10;
  }
}
function isExprRef(_e) {
  return !!(_e != null && _e.expr);
}
function replaceExprRef(_e) {
  const Qt = keys$2(_e || {}), Zt = {};
  for (const $n of Qt)
    Zt[$n] = signalRefOrValue(_e[$n]);
  return Zt;
}
function extractTitleConfig(_e) {
  const {
    // These are non-mark title config that need to be hardcoded
    anchor: Qt,
    frame: Zt,
    offset: $n,
    orient: Sn,
    angle: kn,
    limit: Kn,
    // color needs to be redirect to fill
    color: er,
    // subtitle properties
    subtitleColor: Cr,
    subtitleFont: kr,
    subtitleFontSize: Yr,
    subtitleFontStyle: Ms,
    subtitleFontWeight: Ds,
    subtitleLineHeight: Ls,
    subtitlePadding: js,
    // The rest are mark config.
    ...zs
  } = _e, Fs = {
    ...zs,
    ...er ? { fill: er } : {}
  }, Bs = {
    ...Qt ? { anchor: Qt } : {},
    ...Zt ? { frame: Zt } : {},
    ...$n ? { offset: $n } : {},
    ...Sn ? { orient: Sn } : {},
    ...kn !== void 0 ? { angle: kn } : {},
    ...Kn !== void 0 ? { limit: Kn } : {}
  }, Hs = {
    ...Cr ? { subtitleColor: Cr } : {},
    ...kr ? { subtitleFont: kr } : {},
    ...Yr ? { subtitleFontSize: Yr } : {},
    ...Ms ? { subtitleFontStyle: Ms } : {},
    ...Ds ? { subtitleFontWeight: Ds } : {},
    ...Ls ? { subtitleLineHeight: Ls } : {},
    ...js ? { subtitlePadding: js } : {}
  }, Ws = pick$2(_e, ["align", "baseline", "dx", "dy", "limit"]);
  return { titleMarkConfig: Fs, subtitleMarkConfig: Ws, nonMarkTitleProperties: Bs, subtitle: Hs };
}
function isText(_e) {
  return isString(_e) || isArray(_e) && isString(_e[0]);
}
function isSignalRef(_e) {
  return !!(_e != null && _e.signal);
}
function isVgRangeStep(_e) {
  return !!_e.step;
}
function isDataRefUnionedDomain(_e) {
  return isArray(_e) ? !1 : "fields" in _e && !("data" in _e);
}
function isFieldRefUnionDomain(_e) {
  return isArray(_e) ? !1 : "fields" in _e && "data" in _e;
}
function isDataRefDomain(_e) {
  return isArray(_e) ? !1 : "field" in _e && "data" in _e;
}
const VG_MARK_CONFIG_INDEX = {
  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
  // commented below are vg channel that do not have mark config.
  // x: 1,
  // y: 1,
  // x2: 1,
  // y2: 1,
  // xc'|'yc'
  // clip: 1,
  // path: 1,
  // url: 1,
}, VG_MARK_CONFIGS = keys$2(VG_MARK_CONFIG_INDEX), VG_MARK_INDEX = {
  arc: 1,
  area: 1,
  group: 1,
  image: 1,
  line: 1,
  path: 1,
  rect: 1,
  rule: 1,
  shape: 1,
  symbol: 1,
  text: 1,
  trail: 1
}, VG_CORNERRADIUS_CHANNELS = [
  "cornerRadius",
  "cornerRadiusTopLeft",
  "cornerRadiusTopRight",
  "cornerRadiusBottomLeft",
  "cornerRadiusBottomRight"
];
function signalOrValueRefWithCondition(_e) {
  const Qt = isArray(_e.condition) ? _e.condition.map(conditionalSignalRefOrValue) : conditionalSignalRefOrValue(_e.condition);
  return {
    ...signalRefOrValue(_e),
    condition: Qt
  };
}
function signalRefOrValue(_e) {
  if (isExprRef(_e)) {
    const { expr: Qt, ...Zt } = _e;
    return { signal: Qt, ...Zt };
  }
  return _e;
}
function conditionalSignalRefOrValue(_e) {
  if (isExprRef(_e)) {
    const { expr: Qt, ...Zt } = _e;
    return { signal: Qt, ...Zt };
  }
  return _e;
}
function signalOrValueRef(_e) {
  if (isExprRef(_e)) {
    const { expr: Qt, ...Zt } = _e;
    return { signal: Qt, ...Zt };
  }
  return isSignalRef(_e) ? _e : _e !== void 0 ? { value: _e } : void 0;
}
function exprFromSignalRefOrValue(_e) {
  return isSignalRef(_e) ? _e.signal : $(_e);
}
function exprFromValueRefOrSignalRef(_e) {
  return isSignalRef(_e) ? _e.signal : $(_e.value);
}
function signalOrStringValue(_e) {
  return isSignalRef(_e) ? _e.signal : _e == null ? null : $(_e);
}
function applyMarkConfig(_e, Qt, Zt) {
  for (const $n of Zt) {
    const Sn = getMarkConfig($n, Qt.markDef, Qt.config);
    Sn !== void 0 && (_e[$n] = signalOrValueRef(Sn));
  }
  return _e;
}
function getStyles$2(_e) {
  return [].concat(_e.type, _e.style ?? []);
}
function getMarkPropOrConfig(_e, Qt, Zt, $n = {}) {
  const { vgChannel: Sn, ignoreVgConfig: kn } = $n;
  return Sn && Qt[Sn] !== void 0 ? Qt[Sn] : Qt[_e] !== void 0 ? Qt[_e] : kn && (!Sn || Sn === _e) ? void 0 : getMarkConfig(_e, Qt, Zt, $n);
}
function getMarkConfig(_e, Qt, Zt, { vgChannel: $n } = {}) {
  return getFirstDefined(
    // style config has highest precedence
    $n ? getMarkStyleConfig(_e, Qt, Zt.style) : void 0,
    getMarkStyleConfig(_e, Qt, Zt.style),
    // then mark-specific config
    $n ? Zt[Qt.type][$n] : void 0,
    Zt[Qt.type][_e],
    // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine
    // If there is vgChannel, skip vl channel.
    // For example, vl size for text is vg fontSize, but config.mark.size is only for point size.
    $n ? Zt.mark[$n] : Zt.mark[_e]
    // Need to cast for the same reason as above
  );
}
function getMarkStyleConfig(_e, Qt, Zt) {
  return getStyleConfig(_e, getStyles$2(Qt), Zt);
}
function getStyleConfig(_e, Qt, Zt) {
  Qt = array$6(Qt);
  let $n;
  for (const Sn of Qt) {
    const kn = Zt[Sn];
    kn && kn[_e] !== void 0 && ($n = kn[_e]);
  }
  return $n;
}
function sortParams(_e, Qt) {
  return array$6(_e).reduce((Zt, $n) => (Zt.field.push(vgField($n, Qt)), Zt.order.push($n.sort ?? "ascending"), Zt), { field: [], order: [] });
}
function mergeTitleFieldDefs(_e, Qt) {
  const Zt = [..._e];
  return Qt.forEach(($n) => {
    for (const Sn of Zt)
      if (deepEqual(Sn, $n))
        return;
    Zt.push($n);
  }), Zt;
}
function mergeTitle(_e, Qt) {
  return deepEqual(_e, Qt) || !Qt ? _e : _e ? [...array$6(_e), ...array$6(Qt)].join(", ") : Qt;
}
function mergeTitleComponent(_e, Qt) {
  const Zt = _e.value, $n = Qt.value;
  if (Zt == null || $n === null)
    return {
      explicit: _e.explicit,
      value: null
    };
  if ((isText(Zt) || isSignalRef(Zt)) && (isText($n) || isSignalRef($n)))
    return {
      explicit: _e.explicit,
      value: mergeTitle(Zt, $n)
    };
  if (isText(Zt) || isSignalRef(Zt))
    return {
      explicit: _e.explicit,
      value: Zt
    };
  if (isText($n) || isSignalRef($n))
    return {
      explicit: _e.explicit,
      value: $n
    };
  if (!isText(Zt) && !isSignalRef(Zt) && !isText($n) && !isSignalRef($n))
    return {
      explicit: _e.explicit,
      value: mergeTitleFieldDefs(Zt, $n)
    };
  throw new Error("It should never reach here");
}
function invalidSpec(_e) {
  return `Invalid specification ${stringify$2(_e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`;
}
const FIT_NON_SINGLE = 'Autosize "fit" only works for single views and layered views.';
function containerSizeNonSingle(_e) {
  return `${_e == "width" ? "Width" : "Height"} "container" only works for single views and layered views.`;
}
function containerSizeNotCompatibleWithAutosize(_e) {
  const Qt = _e == "width" ? "Width" : "Height", Zt = _e == "width" ? "x" : "y";
  return `${Qt} "container" only works well with autosize "fit" or "fit-${Zt}".`;
}
function droppingFit(_e) {
  return _e ? `Dropping "fit-${_e}" because spec has discrete ${getSizeChannel(_e)}.` : 'Dropping "fit" because spec has discrete size.';
}
function unknownField(_e) {
  return `Unknown field for ${_e}. Cannot calculate view size.`;
}
function cannotProjectOnChannelWithoutField(_e) {
  return `Cannot project a selection on encoding channel "${_e}", which has no field.`;
}
function cannotProjectAggregate(_e, Qt) {
  return `Cannot project a selection on encoding channel "${_e}" as it uses an aggregate function ("${Qt}").`;
}
function nearestNotSupportForContinuous(_e) {
  return `The "nearest" transform is not supported for ${_e} marks.`;
}
function selectionNotSupported(_e) {
  return `Selection not supported for ${_e} yet.`;
}
function selectionNotFound(_e) {
  return `Cannot find a selection named "${_e}".`;
}
const SCALE_BINDINGS_CONTINUOUS = "Scale bindings are currently only supported for scales with unbinned, continuous domains.", LEGEND_BINDINGS_MUST_HAVE_PROJECTION = "Legend bindings are only supported for selections over an individual field or encoding channel.";
function cannotLookupVariableParameter(_e) {
  return `Lookups can only be performed on selection parameters. "${_e}" is a variable parameter.`;
}
function noSameUnitLookup(_e) {
  return `Cannot define and lookup the "${_e}" selection in the same view. Try moving the lookup into a second, layered view?`;
}
const NEEDS_SAME_SELECTION = "The same selection must be used to override scale domains in a layered view.", INTERVAL_INITIALIZED_WITH_POS = 'Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.';
function noSuchRepeatedValue(_e) {
  return `Unknown repeated value "${_e}".`;
}
function columnsNotSupportByRowCol(_e) {
  return `The "columns" property cannot be used when "${_e}" has nested row/column.`;
}
const CONCAT_CANNOT_SHARE_AXIS = "Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).";
function unrecognizedParse(_e) {
  return `Unrecognized parse "${_e}".`;
}
function differentParse(_e, Qt, Zt) {
  return `An ancestor parsed field "${_e}" as ${Zt} but a child wants to parse the field as ${Qt}.`;
}
const ADD_SAME_CHILD_TWICE = "Attempt to add the same child twice.";
function invalidTransformIgnored(_e) {
  return `Ignoring an invalid transform: ${stringify$2(_e)}.`;
}
const NO_FIELDS_NEEDS_AS = '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 customFormatTypeNotAllowed(_e) {
  return `Config.customFormatTypes is not true, thus custom format type and format for channel ${_e} are dropped.`;
}
function projectionOverridden(_e) {
  const { parentProjection: Qt, projection: Zt } = _e;
  return `Layer's shared projection ${stringify$2(Qt)} is overridden by a child projection ${stringify$2(Zt)}.`;
}
const REPLACE_ANGLE_WITH_THETA = "Arc marks uses theta channel rather than angle, replacing angle with theta.";
function offsetNestedInsideContinuousPositionScaleDropped(_e) {
  return `${_e}Offset dropped because ${_e} is continuous`;
}
function replaceOffsetWithMainChannel(_e) {
  return `There is no ${_e} encoding. Replacing ${_e}Offset encoding as ${_e}.`;
}
function primitiveChannelDef(_e, Qt, Zt) {
  return `Channel ${_e} is a ${Qt}. Converted to {value: ${stringify$2(Zt)}}.`;
}
function invalidFieldType(_e) {
  return `Invalid field type "${_e}".`;
}
function invalidFieldTypeForCountAggregate(_e, Qt) {
  return `Invalid field type "${_e}" for aggregate: "${Qt}", using "quantitative" instead.`;
}
function invalidAggregate(_e) {
  return `Invalid aggregation operator "${_e}".`;
}
function droppingColor(_e, Qt) {
  const { fill: Zt, stroke: $n } = Qt;
  return `Dropping color ${_e} as the plot also has ${Zt && $n ? "fill and stroke" : Zt ? "fill" : "stroke"}.`;
}
function relativeBandSizeNotSupported(_e) {
  return `Position range does not support relative band size for ${_e}.`;
}
function emptyFieldDef(_e, Qt) {
  return `Dropping ${stringify$2(_e)} from channel "${Qt}" since it does not contain any data field, datum, value, or signal.`;
}
const LINE_WITH_VARYING_SIZE = "Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.";
function incompatibleChannel(_e, Qt, Zt) {
  return `${_e} dropped as it is incompatible with "${Qt}"${Zt ? ` when ${Zt}` : ""}.`;
}
function offsetEncodingScaleIgnored(_e) {
  return `${_e} encoding has no scale, so specified scale is ignored.`;
}
function invalidEncodingChannel(_e) {
  return `${_e}-encoding is dropped as ${_e} is not a valid encoding channel.`;
}
function channelShouldBeDiscrete(_e) {
  return `${_e} encoding should be discrete (ordinal / nominal / binned).`;
}
function channelShouldBeDiscreteOrDiscretizing(_e) {
  return `${_e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`;
}
function facetChannelDropped(_e) {
  return `Facet encoding dropped as ${_e.join(" and ")} ${_e.length > 1 ? "are" : "is"} also specified.`;
}
function discreteChannelCannotEncode(_e, Qt) {
  return `Using discrete channel "${_e}" to encode "${Qt}" field can be misleading as it does not encode ${Qt === "ordinal" ? "order" : "magnitude"}.`;
}
function rangeMarkAlignmentCannotBeExpression(_e) {
  return `The ${_e} for range marks cannot be an expression`;
}
function lineWithRange(_e, Qt) {
  return `Line mark is for continuous lines and thus cannot be used with ${_e && Qt ? "x2 and y2" : _e ? "x2" : "y2"}. We will use the rule mark (line segments) instead.`;
}
function orientOverridden(_e, Qt) {
  return `Specified orient "${_e}" overridden with "${Qt}".`;
}
function cannotUseScalePropertyWithNonColor(_e) {
  return `Cannot use the scale property "${_e}" with non-color channel.`;
}
function cannotUseRelativeBandSizeWithNonBandScale(_e) {
  return `Cannot use the relative band size with ${_e} scale.`;
}
function unaggregateDomainHasNoEffectForRawField(_e) {
  return `Using unaggregated domain with raw field has no effect (${stringify$2(_e)}).`;
}
function unaggregateDomainWithNonSharedDomainOp(_e) {
  return `Unaggregated domain not applicable for "${_e}" since it produces values outside the origin domain of the source data.`;
}
function unaggregatedDomainWithLogScale(_e) {
  return `Unaggregated domain is currently unsupported for log scale (${stringify$2(_e)}).`;
}
function cannotApplySizeToNonOrientedMark(_e) {
  return `Cannot apply size to non-oriented mark "${_e}".`;
}
function scaleTypeNotWorkWithChannel(_e, Qt, Zt) {
  return `Channel "${_e}" does not work with "${Qt}" scale. We are using "${Zt}" scale instead.`;
}
function scaleTypeNotWorkWithFieldDef(_e, Qt) {
  return `FieldDef does not work with "${_e}" scale. We are using "${Qt}" scale instead.`;
}
function scalePropertyNotWorkWithScaleType(_e, Qt, Zt) {
  return `${Zt}-scale's "${Qt}" is dropped as it does not work with ${_e} scale.`;
}
function stepDropped(_e) {
  return `The step for "${_e}" is dropped because the ${_e === "width" ? "x" : "y"} is continuous.`;
}
function mergeConflictingProperty(_e, Qt, Zt, $n) {
  return `Conflicting ${Qt.toString()} property "${_e.toString()}" (${stringify$2(Zt)} and ${stringify$2($n)}). Using ${stringify$2(Zt)}.`;
}
function mergeConflictingDomainProperty(_e, Qt, Zt, $n) {
  return `Conflicting ${Qt.toString()} property "${_e.toString()}" (${stringify$2(Zt)} and ${stringify$2($n)}). Using the union of the two domains.`;
}
function independentScaleMeansIndependentGuide(_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 domainSortDropped(_e) {
  return `Dropping sort property ${stringify$2(_e)} as unioned domains only support boolean or op "count", "min", and "max".`;
}
const MORE_THAN_ONE_SORT = "Domains that should be unioned has conflicting sort properties. Sort will be set to true.", FACETED_INDEPENDENT_DIFFERENT_SOURCES = "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.", FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES = "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.", FACETED_INDEPENDENT_SAME_SOURCE = "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 cannotStackRangedMark(_e) {
  return `Cannot stack "${_e}" if there is already "${_e}2".`;
}
function cannotStackNonLinearScale(_e) {
  return `Cannot stack non-linear scale (${_e}).`;
}
function stackNonSummativeAggregate(_e) {
  return `Stacking is applied even though the aggregate function is non-summative ("${_e}").`;
}
function invalidTimeUnit(_e, Qt) {
  return `Invalid ${_e}: ${stringify$2(Qt)}.`;
}
function droppedDay(_e) {
  return `Dropping day from datetime ${stringify$2(_e)} as day cannot be combined with other units.`;
}
function errorBarCenterAndExtentAreNotNeeded(_e, Qt) {
  return `${Qt ? "extent " : ""}${Qt && _e ? "and " : ""}${_e ? "center " : ""}${Qt && _e ? "are " : "is "}not needed when data are aggregated.`;
}
function errorBarCenterIsUsedWithWrongExtent(_e, Qt, Zt) {
  return `${_e} is not usually used with ${Qt} for ${Zt}.`;
}
function errorBarContinuousAxisHasCustomizedAggregate(_e, Qt) {
  return `Continuous axis should not have customized aggregation function ${_e}; ${Qt} already agregates the axis.`;
}
function errorBand1DNotSupport(_e) {
  return `1D error band does not support ${_e}.`;
}
function channelRequiredForBinned(_e) {
  return `Channel ${_e} is required for "binned" bin.`;
}
function channelShouldNotBeUsedForBinned(_e) {
  return `Channel ${_e} should not be used with "binned" bin.`;
}
function domainRequiredForThresholdScale(_e) {
  return `Domain for ${_e} is required for threshold scale.`;
}
globalThis && globalThis.__classPrivateFieldSet;
globalThis && globalThis.__classPrivateFieldGet;
const main$1 = logger(Warn);
let current = main$1;
function set$6(_e) {
  return current = _e, current;
}
function reset$1() {
  return current = main$1, current;
}
function warn$1(..._e) {
  current.warn(..._e);
}
function debug$3(..._e) {
  current.debug(..._e);
}
function isDateTime(_e) {
  if (_e && isObject(_e)) {
    for (const Qt of TIMEUNIT_PARTS)
      if (Qt in _e)
        return !0;
  }
  return !1;
}
const MONTHS = [
  "january",
  "february",
  "march",
  "april",
  "may",
  "june",
  "july",
  "august",
  "september",
  "october",
  "november",
  "december"
], SHORT_MONTHS = MONTHS.map((_e) => _e.substr(0, 3)), DAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"], SHORT_DAYS = DAYS.map((_e) => _e.substr(0, 3));
function normalizeQuarter(_e) {
  if (isNumeric(_e) && (_e = +_e), isNumber$1(_e))
    return _e > 4 && warn$1(invalidTimeUnit("quarter", _e)), _e - 1;
  throw new Error(invalidTimeUnit("quarter", _e));
}
function normalizeMonth(_e) {
  if (isNumeric(_e) && (_e = +_e), isNumber$1(_e))
    return _e - 1;
  {
    const Qt = _e.toLowerCase(), Zt = MONTHS.indexOf(Qt);
    if (Zt !== -1)
      return Zt;
    const $n = Qt.substr(0, 3), Sn = SHORT_MONTHS.indexOf($n);
    if (Sn !== -1)
      return Sn;
    throw new Error(invalidTimeUnit("month", _e));
  }
}
function normalizeDay(_e) {
  if (isNumeric(_e) && (_e = +_e), isNumber$1(_e))
    return _e % 7;
  {
    const Qt = _e.toLowerCase(), Zt = DAYS.indexOf(Qt);
    if (Zt !== -1)
      return Zt;
    const $n = Qt.substr(0, 3), Sn = SHORT_DAYS.indexOf($n);
    if (Sn !== -1)
      return Sn;
    throw new Error(invalidTimeUnit("day", _e));
  }
}
function dateTimeParts(_e, Qt) {
  const Zt = [];
  if (Qt && _e.day !== void 0 && keys$2(_e).length > 1 && (warn$1(droppedDay(_e)), _e = duplicate(_e), delete _e.day), _e.year !== void 0 ? Zt.push(_e.year) : Zt.push(2012), _e.month !== void 0) {
    const $n = Qt ? normalizeMonth(_e.month) : _e.month;
    Zt.push($n);
  } else if (_e.quarter !== void 0) {
    const $n = Qt ? normalizeQuarter(_e.quarter) : _e.quarter;
    Zt.push(isNumber$1($n) ? $n * 3 : `${$n}*3`);
  } else
    Zt.push(0);
  if (_e.date !== void 0)
    Zt.push(_e.date);
  else if (_e.day !== void 0) {
    const $n = Qt ? normalizeDay(_e.day) : _e.day;
    Zt.push(isNumber$1($n) ? $n + 1 : `${$n}+1`);
  } else
    Zt.push(1);
  for (const $n of ["hours", "minutes", "seconds", "milliseconds"]) {
    const Sn = _e[$n];
    Zt.push(typeof Sn > "u" ? 0 : Sn);
  }
  return Zt;
}
function dateTimeToExpr(_e) {
  const Zt = dateTimeParts(_e, !0).join(", ");
  return _e.utc ? `utc(${Zt})` : `datetime(${Zt})`;
}
function dateTimeExprToExpr(_e) {
  const Zt = dateTimeParts(_e, !1).join(", ");
  return _e.utc ? `utc(${Zt})` : `datetime(${Zt})`;
}
function dateTimeToTimestamp(_e) {
  const Qt = dateTimeParts(_e, !0);
  return _e.utc ? +new Date(Date.UTC(...Qt)) : +new Date(...Qt);
}
const LOCAL_SINGLE_TIMEUNIT_INDEX = {
  year: 1,
  quarter: 1,
  month: 1,
  week: 1,
  day: 1,
  dayofyear: 1,
  date: 1,
  hours: 1,
  minutes: 1,
  seconds: 1,
  milliseconds: 1
}, TIMEUNIT_PARTS = keys$2(LOCAL_SINGLE_TIMEUNIT_INDEX);
function isLocalSingleTimeUnit(_e) {
  return !!LOCAL_SINGLE_TIMEUNIT_INDEX[_e];
}
function isBinnedTimeUnit(_e) {
  return isObject(_e) ? _e.binned : isBinnedTimeUnitString(_e);
}
function isBinnedTimeUnitString(_e) {
  return _e && _e.startsWith("binned");
}
function isUTCTimeUnit(_e) {
  return _e.startsWith("utc");
}
function getLocalTimeUnitFromUTCTimeUnit(_e) {
  return _e.substring(3);
}
const VEGALITE_TIMEFORMAT = {
  "year-month": "%b %Y ",
  "year-month-date": "%b %d, %Y "
};
function getTimeUnitParts(_e) {
  return TIMEUNIT_PARTS.filter((Qt) => containsTimeUnit(_e, Qt));
}
function getSmallestTimeUnitPart(_e) {
  const Qt = getTimeUnitParts(_e);
  return Qt[Qt.length - 1];
}
function containsTimeUnit(_e, Qt) {
  const Zt = _e.indexOf(Qt);
  return !(Zt < 0 || Zt > 0 && Qt === "seconds" && _e.charAt(Zt - 1) === "i" || _e.length > Zt + 3 && Qt === "day" && _e.charAt(Zt + 3) === "o" || Zt > 0 && Qt === "year" && _e.charAt(Zt - 1) === "f");
}
function fieldExpr(_e, Qt, { end: Zt } = { end: !1 }) {
  const $n = accessPathWithDatum(Qt), Sn = isUTCTimeUnit(_e) ? "utc" : "";
  function kn(Cr) {
    return Cr === "quarter" ? `(${Sn}quarter(${$n})-1)` : `${Sn}${Cr}(${$n})`;
  }
  let Kn;
  const er = {};
  for (const Cr of TIMEUNIT_PARTS)
    containsTimeUnit(_e, Cr) && (er[Cr] = kn(Cr), Kn = Cr);
  return Zt && (er[Kn] += "+1"), dateTimeExprToExpr(er);
}
function timeUnitSpecifierExpression(_e) {
  if (!_e)
    return;
  const Qt = getTimeUnitParts(_e);
  return `timeUnitSpecifier(${stringify$2(Qt)}, ${stringify$2(VEGALITE_TIMEFORMAT)})`;
}
function formatExpression(_e, Qt, Zt) {
  if (!_e)
    return;
  const $n = timeUnitSpecifierExpression(_e);
  return `${Zt || isUTCTimeUnit(_e) ? "utc" : "time"}Format(${Qt}, ${$n})`;
}
function normalizeTimeUnit(_e) {
  if (!_e)
    return;
  let Qt;
  return isString(_e) ? isBinnedTimeUnitString(_e) ? Qt = {
    unit: _e.substring(6),
    binned: !0
  } : Qt = {
    unit: _e
  } : isObject(_e) && (Qt = {
    ..._e,
    ..._e.unit ? { unit: _e.unit } : {}
  }), isUTCTimeUnit(Qt.unit) && (Qt.utc = !0, Qt.unit = getLocalTimeUnitFromUTCTimeUnit(Qt.unit)), Qt;
}
function timeUnitToString(_e) {
  const { utc: Qt, ...Zt } = normalizeTimeUnit(_e);
  return Zt.unit ? (Qt ? "utc" : "") + keys$2(Zt).map(($n) => varName(`${$n === "unit" ? "" : `_${$n}_`}${Zt[$n]}`)).join("") : (Qt ? "utc" : "") + "timeunit" + keys$2(Zt).map(($n) => varName(`_${$n}_${Zt[$n]}`)).join("");
}
function durationExpr(_e, Qt = (Zt) => Zt) {
  const Zt = normalizeTimeUnit(_e), $n = getSmallestTimeUnitPart(Zt.unit);
  if ($n && $n !== "day") {
    const Sn = {
      year: 2001,
      month: 1,
      date: 1,
      hours: 0,
      minutes: 0,
      seconds: 0,
      milliseconds: 0
    }, { step: kn, part: Kn } = getDateTimePartAndStep($n, Zt.step), er = {
      ...Sn,
      [Kn]: +Sn[Kn] + kn
    };
    return `${Qt(dateTimeToExpr(er))} - ${Qt(dateTimeToExpr(Sn))}`;
  }
}
const DATE_PARTS = {
  year: 1,
  month: 1,
  date: 1,
  hours: 1,
  minutes: 1,
  seconds: 1,
  milliseconds: 1
};
function isDatePart(_e) {
  return !!DATE_PARTS[_e];
}
function getDateTimePartAndStep(_e, Qt = 1) {
  if (isDatePart(_e))
    return { part: _e, step: Qt };
  switch (_e) {
    case "day":
    case "dayofyear":
      return { part: "date", step: Qt };
    case "quarter":
      return { part: "month", step: Qt * 3 };
    case "week":
      return { part: "date", step: Qt * 7 };
  }
}
function isSelectionPredicate(_e) {
  return _e == null ? void 0 : _e.param;
}
function isFieldEqualPredicate(_e) {
  return !!(_e != null && _e.field) && _e.equal !== void 0;
}
function isFieldLTPredicate(_e) {
  return !!(_e != null && _e.field) && _e.lt !== void 0;
}
function isFieldLTEPredicate(_e) {
  return !!(_e != null && _e.field) && _e.lte !== void 0;
}
function isFieldGTPredicate(_e) {
  return !!(_e != null && _e.field) && _e.gt !== void 0;
}
function isFieldGTEPredicate(_e) {
  return !!(_e != null && _e.field) && _e.gte !== void 0;
}
function isFieldRangePredicate(_e) {
  if (_e != null && _e.field) {
    if (isArray(_e.range) && _e.range.length === 2)
      return !0;
    if (isSignalRef(_e.range))
      return !0;
  }
  return !1;
}
function isFieldOneOfPredicate(_e) {
  return !!(_e != null && _e.field) && (isArray(_e.oneOf) || isArray(_e.in));
}
function isFieldValidPredicate(_e) {
  return !!(_e != null && _e.field) && _e.valid !== void 0;
}
function isFieldPredicate(_e) {
  return isFieldOneOfPredicate(_e) || isFieldEqualPredicate(_e) || isFieldRangePredicate(_e) || isFieldLTPredicate(_e) || isFieldGTPredicate(_e) || isFieldLTEPredicate(_e) || isFieldGTEPredicate(_e);
}
function predicateValueExpr(_e, Qt) {
  return valueExpr(_e, { timeUnit: Qt, wrapTime: !0 });
}
function predicateValuesExpr(_e, Qt) {
  return _e.map((Zt) => predicateValueExpr(Zt, Qt));
}
function fieldFilterExpression(_e, Qt = !0) {
  const { field: Zt } = _e, $n = normalizeTimeUnit(_e.timeUnit), { unit: Sn, binned: kn } = $n || {}, Kn = vgField(_e, { expr: "datum" }), er = Sn ? (
    // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly.
    // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline
    // TODO: support utc
    `time(${kn ? Kn : fieldExpr(Sn, Zt)})`
  ) : Kn;
  if (isFieldEqualPredicate(_e))
    return `${er}===${predicateValueExpr(_e.equal, Sn)}`;
  if (isFieldLTPredicate(_e)) {
    const Cr = _e.lt;
    return `${er}<${predicateValueExpr(Cr, Sn)}`;
  } else if (isFieldGTPredicate(_e)) {
    const Cr = _e.gt;
    return `${er}>${predicateValueExpr(Cr, Sn)}`;
  } else if (isFieldLTEPredicate(_e)) {
    const Cr = _e.lte;
    return `${er}<=${predicateValueExpr(Cr, Sn)}`;
  } else if (isFieldGTEPredicate(_e)) {
    const Cr = _e.gte;
    return `${er}>=${predicateValueExpr(Cr, Sn)}`;
  } else {
    if (isFieldOneOfPredicate(_e))
      return `indexof([${predicateValuesExpr(_e.oneOf, Sn).join(",")}], ${er}) !== -1`;
    if (isFieldValidPredicate(_e))
      return fieldValidPredicate(er, _e.valid);
    if (isFieldRangePredicate(_e)) {
      const { range: Cr } = _e, kr = isSignalRef(Cr) ? { signal: `${Cr.signal}[0]` } : Cr[0], Yr = isSignalRef(Cr) ? { signal: `${Cr.signal}[1]` } : Cr[1];
      if (kr !== null && Yr !== null && Qt)
        return "inrange(" + er + ", [" + predicateValueExpr(kr, Sn) + ", " + predicateValueExpr(Yr, Sn) + "])";
      const Ms = [];
      return kr !== null && Ms.push(`${er} >= ${predicateValueExpr(kr, Sn)}`), Yr !== null && Ms.push(`${er} <= ${predicateValueExpr(Yr, Sn)}`), Ms.length > 0 ? Ms.join(" && ") : "true";
    }
  }
  throw new Error(`Invalid field predicate: ${stringify$2(_e)}`);
}
function fieldValidPredicate(_e, Qt = !0) {
  return Qt ? `isValid(${_e}) && isFinite(+${_e})` : `!isValid(${_e}) || !isFinite(+${_e})`;
}
function normalizePredicate$1(_e) {
  return isFieldPredicate(_e) && _e.timeUnit ? {
    ..._e,
    timeUnit: normalizeTimeUnit(_e.timeUnit)
  } : _e;
}
var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13;
function objectConverter(_e) {
  return new Function("d", "return {" + _e.map(function(Qt, Zt) {
    return JSON.stringify(Qt) + ": d[" + Zt + '] || ""';
  }).join(",") + "}");
}
function customConverter(_e, Qt) {
  var Zt = objectConverter(_e);
  return function($n, Sn) {
    return Qt(Zt($n), Sn, _e);
  };
}
function inferColumns(_e) {
  var Qt = /* @__PURE__ */ Object.create(null), Zt = [];
  return _e.forEach(function($n) {
    for (var Sn in $n)
      Sn in Qt || Zt.push(Qt[Sn] = Sn);
  }), Zt;
}
function pad$1(_e, Qt) {
  var Zt = _e + "", $n = Zt.length;
  return $n < Qt ? new Array(Qt - $n + 1).join(0) + Zt : Zt;
}
function formatYear$1(_e) {
  return _e < 0 ? "-" + pad$1(-_e, 6) : _e > 9999 ? "+" + pad$1(_e, 6) : pad$1(_e, 4);
}
function formatDate(_e) {
  var Qt = _e.getUTCHours(), Zt = _e.getUTCMinutes(), $n = _e.getUTCSeconds(), Sn = _e.getUTCMilliseconds();
  return isNaN(_e) ? "Invalid Date" : formatYear$1(_e.getUTCFullYear()) + "-" + pad$1(_e.getUTCMonth() + 1, 2) + "-" + pad$1(_e.getUTCDate(), 2) + (Sn ? "T" + pad$1(Qt, 2) + ":" + pad$1(Zt, 2) + ":" + pad$1($n, 2) + "." + pad$1(Sn, 3) + "Z" : $n ? "T" + pad$1(Qt, 2) + ":" + pad$1(Zt, 2) + ":" + pad$1($n, 2) + "Z" : Zt || Qt ? "T" + pad$1(Qt, 2) + ":" + pad$1(Zt, 2) + "Z" : "");
}
function dsvFormat(_e) {
  var Qt = new RegExp('["' + _e + `
\r]`), Zt = _e.charCodeAt(0);
  function $n(Ms, Ds) {
    var Ls, js, zs = Sn(Ms, function(Fs, Bs) {
      if (Ls)
        return Ls(Fs, Bs - 1);
      js = Fs, Ls = Ds ? customConverter(Fs, Ds) : objectConverter(Fs);
    });
    return zs.columns = js || [], zs;
  }
  function Sn(Ms, Ds) {
    var Ls = [], js = Ms.length, zs = 0, Fs = 0, Bs, Hs = js <= 0, Ws = !1;
    Ms.charCodeAt(js - 1) === NEWLINE && --js, Ms.charCodeAt(js - 1) === RETURN && --js;
    function Ys() {
      if (Hs)
        return EOF;
      if (Ws)
        return Ws = !1, EOL;
      var Mu, Pl = zs, Iu;
      if (Ms.charCodeAt(Pl) === QUOTE) {
        for (; zs++ < js && Ms.charCodeAt(zs) !== QUOTE || Ms.charCodeAt(++zs) === QUOTE; )
          ;
        return (Mu = zs) >= js ? Hs = !0 : (Iu = Ms.charCodeAt(zs++)) === NEWLINE ? Ws = !0 : Iu === RETURN && (Ws = !0, Ms.charCodeAt(zs) === NEWLINE && ++zs), Ms.slice(Pl + 1, Mu - 1).replace(/""/g, '"');
      }
      for (; zs < js; ) {
        if ((Iu = Ms.charCodeAt(Mu = zs++)) === NEWLINE)
          Ws = !0;
        else if (Iu === RETURN)
          Ws = !0, Ms.charCodeAt(zs) === NEWLINE && ++zs;
        else if (Iu !== Zt)
          continue;
        return Ms.slice(Pl, Mu);
      }
      return Hs = !0, Ms.slice(Pl, js);
    }
    for (; (Bs = Ys()) !== EOF; ) {
      for (var El = []; Bs !== EOL && Bs !== EOF; )
        El.push(Bs), Bs = Ys();
      Ds && (El = Ds(El, Fs++)) == null || Ls.push(El);
    }
    return Ls;
  }
  function kn(Ms, Ds) {
    return Ms.map(function(Ls) {
      return Ds.map(function(js) {
        return Yr(Ls[js]);
      }).join(_e);
    });
  }
  function Kn(Ms, Ds) {
    return Ds == null && (Ds = inferColumns(Ms)), [Ds.map(Yr).join(_e)].concat(kn(Ms, Ds)).join(`
`);
  }
  function er(Ms, Ds) {
    return Ds == null && (Ds = inferColumns(Ms)), kn(Ms, Ds).join(`
`);
  }
  function Cr(Ms) {
    return Ms.map(kr).join(`
`);
  }
  function kr(Ms) {
    return Ms.map(Yr).join(_e);
  }
  function Yr(Ms) {
    return Ms == null ? "" : Ms instanceof Date ? formatDate(Ms) : Qt.test(Ms += "") ? '"' + Ms.replace(/"/g, '""') + '"' : Ms;
  }
  return {
    parse: $n,
    parseRows: Sn,
    format: Kn,
    formatBody: er,
    formatRows: Cr,
    formatRow: kr,
    formatValue: Yr
  };
}
function identity$6(_e) {
  return _e;
}
function transform$3(_e) {
  if (_e == null)
    return identity$6;
  var Qt, Zt, $n = _e.scale[0], Sn = _e.scale[1], kn = _e.translate[0], Kn = _e.translate[1];
  return function(er, Cr) {
    Cr || (Qt = Zt = 0);
    var kr = 2, Yr = er.length, Ms = new Array(Yr);
    for (Ms[0] = (Qt += er[0]) * $n + kn, Ms[1] = (Zt += er[1]) * Sn + Kn; kr < Yr; )
      Ms[kr] = er[kr], ++kr;
    return Ms;
  };
}
function reverse$2(_e, Qt) {
  for (var Zt, $n = _e.length, Sn = $n - Qt; Sn < --$n; )
    Zt = _e[Sn], _e[Sn++] = _e[$n], _e[$n] = Zt;
}
function feature(_e, Qt) {
  return typeof Qt == "string" && (Qt = _e.objects[Qt]), Qt.type === "GeometryCollection" ? { type: "FeatureCollection", features: Qt.geometries.map(function(Zt) {
    return feature$1(_e, Zt);
  }) } : feature$1(_e, Qt);
}
function feature$1(_e, Qt) {
  var Zt = Qt.id, $n = Qt.bbox, Sn = Qt.properties == null ? {} : Qt.properties, kn = object$1(_e, Qt);
  return Zt == null && $n == null ? { type: "Feature", properties: Sn, geometry: kn } : $n == null ? { type: "Feature", id: Zt, properties: Sn, geometry: kn } : { type: "Feature", id: Zt, bbox: $n, properties: Sn, geometry: kn };
}
function object$1(_e, Qt) {
  var Zt = transform$3(_e.transform), $n = _e.arcs;
  function Sn(Yr, Ms) {
    Ms.length && Ms.pop();
    for (var Ds = $n[Yr < 0 ? ~Yr : Yr], Ls = 0, js = Ds.length; Ls < js; ++Ls)
      Ms.push(Zt(Ds[Ls], Ls));
    Yr < 0 && reverse$2(Ms, js);
  }
  function kn(Yr) {
    return Zt(Yr);
  }
  function Kn(Yr) {
    for (var Ms = [], Ds = 0, Ls = Yr.length; Ds < Ls; ++Ds)
      Sn(Yr[Ds], Ms);
    return Ms.length < 2 && Ms.push(Ms[0]), Ms;
  }
  function er(Yr) {
    for (var Ms = Kn(Yr); Ms.length < 4; )
      Ms.push(Ms[0]);
    return Ms;
  }
  function Cr(Yr) {
    return Yr.map(er);
  }
  function kr(Yr) {
    var Ms = Yr.type, Ds;
    switch (Ms) {
      case "GeometryCollection":
        return { type: Ms, geometries: Yr.geometries.map(kr) };
      case "Point":
        Ds = kn(Yr.coordinates);
        break;
      case "MultiPoint":
        Ds = Yr.coordinates.map(kn);
        break;
      case "LineString":
        Ds = Kn(Yr.arcs);
        break;
      case "MultiLineString":
        Ds = Yr.arcs.map(Kn);
        break;
      case "Polygon":
        Ds = Cr(Yr.arcs);
        break;
      case "MultiPolygon":
        Ds = Yr.arcs.map(Cr);
        break;
      default:
        return null;
    }
    return { type: Ms, coordinates: Ds };
  }
  return kr(Qt);
}
function stitch(_e, Qt) {
  var Zt = {}, $n = {}, Sn = {}, kn = [], Kn = -1;
  Qt.forEach(function(kr, Yr) {
    var Ms = _e.arcs[kr < 0 ? ~kr : kr], Ds;
    Ms.length < 3 && !Ms[1][0] && !Ms[1][1] && (Ds = Qt[++Kn], Qt[Kn] = kr, Qt[Yr] = Ds);
  }), Qt.forEach(function(kr) {
    var Yr = er(kr), Ms = Yr[0], Ds = Yr[1], Ls, js;
    if (Ls = Sn[Ms])
      if (delete Sn[Ls.end], Ls.push(kr), Ls.end = Ds, js = $n[Ds]) {
        delete $n[js.start];
        var zs = js === Ls ? Ls : Ls.concat(js);
        $n[zs.start = Ls.start] = Sn[zs.end = js.end] = zs;
      } else
        $n[Ls.start] = Sn[Ls.end] = Ls;
    else if (Ls = $n[Ds])
      if (delete $n[Ls.start], Ls.unshift(kr), Ls.start = Ms, js = Sn[Ms]) {
        delete Sn[js.end];
        var Fs = js === Ls ? Ls : js.concat(Ls);
        $n[Fs.start = js.start] = Sn[Fs.end = Ls.end] = Fs;
      } else
        $n[Ls.start] = Sn[Ls.end] = Ls;
    else
      Ls = [kr], $n[Ls.start = Ms] = Sn[Ls.end = Ds] = Ls;
  });
  function er(kr) {
    var Yr = _e.arcs[kr < 0 ? ~kr : kr], Ms = Yr[0], Ds;
    return _e.transform ? (Ds = [0, 0], Yr.forEach(function(Ls) {
      Ds[0] += Ls[0], Ds[1] += Ls[1];
    })) : Ds = Yr[Yr.length - 1], kr < 0 ? [Ds, Ms] : [Ms, Ds];
  }
  function Cr(kr, Yr) {
    for (var Ms in kr) {
      var Ds = kr[Ms];
      delete Yr[Ds.start], delete Ds.start, delete Ds.end, Ds.forEach(function(Ls) {
        Zt[Ls < 0 ? ~Ls : Ls] = 1;
      }), kn.push(Ds);
    }
  }
  return Cr(Sn, $n), Cr($n, Sn), Qt.forEach(function(kr) {
    Zt[kr < 0 ? ~kr : kr] || kn.push([kr]);
  }), kn;
}
function mesh(_e) {
  return object$1(_e, meshArcs.apply(this, arguments));
}
function meshArcs(_e, Qt, Zt) {
  var $n, Sn, kn;
  if (arguments.length > 1)
    $n = extractArcs(_e, Qt, Zt);
  else
    for (Sn = 0, $n = new Array(kn = _e.arcs.length); Sn < kn; ++Sn)
      $n[Sn] = Sn;
  return { type: "MultiLineString", arcs: stitch(_e, $n) };
}
function extractArcs(_e, Qt, Zt) {
  var $n = [], Sn = [], kn;
  function Kn(Ms) {
    var Ds = Ms < 0 ? ~Ms : Ms;
    (Sn[Ds] || (Sn[Ds] = [])).push({ i: Ms, g: kn });
  }
  function er(Ms) {
    Ms.forEach(Kn);
  }
  function Cr(Ms) {
    Ms.forEach(er);
  }
  function kr(Ms) {
    Ms.forEach(Cr);
  }
  function Yr(Ms) {
    switch (kn = Ms, Ms.type) {
      case "GeometryCollection":
        Ms.geometries.forEach(Yr);
        break;
      case "LineString":
        er(Ms.arcs);
        break;
      case "MultiLineString":
      case "Polygon":
        Cr(Ms.arcs);
        break;
      case "MultiPolygon":
        kr(Ms.arcs);
        break;
    }
  }
  return Yr(Qt), Sn.forEach(Zt == null ? function(Ms) {
    $n.push(Ms[0].i);
  } : function(Ms) {
    Zt(Ms[0].g, Ms[Ms.length - 1].g) && $n.push(Ms[0].i);
  }), $n;
}
function ascending$3(_e, Qt) {
  return _e == null || Qt == null ? NaN : _e < Qt ? -1 : _e > Qt ? 1 : _e >= Qt ? 0 : NaN;
}
function descending$2(_e, Qt) {
  return _e == null || Qt == null ? NaN : Qt < _e ? -1 : Qt > _e ? 1 : Qt >= _e ? 0 : NaN;
}
function bisector$1(_e) {
  let Qt, Zt, $n;
  _e.length !== 2 ? (Qt = ascending$3, Zt = (er, Cr) => ascending$3(_e(er), Cr), $n = (er, Cr) => _e(er) - Cr) : (Qt = _e === ascending$3 || _e === descending$2 ? _e : zero$4, Zt = _e, $n = _e);
  function Sn(er, Cr, kr = 0, Yr = er.length) {
    if (kr < Yr) {
      if (Qt(Cr, Cr) !== 0)
        return Yr;
      do {
        const Ms = kr + Yr >>> 1;
        Zt(er[Ms], Cr) < 0 ? kr = Ms + 1 : Yr = Ms;
      } while (kr < Yr);
    }
    return kr;
  }
  function kn(er, Cr, kr = 0, Yr = er.length) {
    if (kr < Yr) {
      if (Qt(Cr, Cr) !== 0)
        return Yr;
      do {
        const Ms = kr + Yr >>> 1;
        Zt(er[Ms], Cr) <= 0 ? kr = Ms + 1 : Yr = Ms;
      } while (kr < Yr);
    }
    return kr;
  }
  function Kn(er, Cr, kr = 0, Yr = er.length) {
    const Ms = Sn(er, Cr, kr, Yr - 1);
    return Ms > kr && $n(er[Ms - 1], Cr) > -$n(er[Ms], Cr) ? Ms - 1 : Ms;
  }
  return { left: Sn, center: Kn, right: kn };
}
function zero$4() {
  return 0;
}
function number$6(_e) {
  return _e === null ? NaN : +_e;
}
function* numbers$2(_e, Qt) {
  if (Qt === void 0)
    for (let Zt of _e)
      Zt != null && (Zt = +Zt) >= Zt && (yield Zt);
  else {
    let Zt = -1;
    for (let $n of _e)
      ($n = Qt($n, ++Zt, _e)) != null && ($n = +$n) >= $n && (yield $n);
  }
}
const ascendingBisect = bisector$1(ascending$3), bisectRight$1 = ascendingBisect.right, bisectLeft$1 = ascendingBisect.left;
bisector$1(number$6).center;
const bisect$1 = bisectRight$1;
function variance(_e, Qt) {
  let Zt = 0, $n, Sn = 0, kn = 0;
  if (Qt === void 0)
    for (let Kn of _e)
      Kn != null && (Kn = +Kn) >= Kn && ($n = Kn - Sn, Sn += $n / ++Zt, kn += $n * (Kn - Sn));
  else {
    let Kn = -1;
    for (let er of _e)
      (er = Qt(er, ++Kn, _e)) != null && (er = +er) >= er && ($n = er - Sn, Sn += $n / ++Zt, kn += $n * (er - Sn));
  }
  if (Zt > 1)
    return kn / (Zt - 1);
}
function deviation(_e, Qt) {
  const Zt = variance(_e, Qt);
  return Zt && Math.sqrt(Zt);
}
class Adder {
  constructor() {
    this._partials = new Float64Array(32), this._n = 0;
  }
  add(Qt) {
    const Zt = this._partials;
    let $n = 0;
    for (let Sn = 0; Sn < this._n && Sn < 32; Sn++) {
      const kn = Zt[Sn], Kn = Qt + kn, er = Math.abs(Qt) < Math.abs(kn) ? Qt - (Kn - kn) : kn - (Kn - Qt);
      er && (Zt[$n++] = er), Qt = Kn;
    }
    return Zt[$n] = Qt, this._n = $n + 1, this;
  }
  valueOf() {
    const Qt = this._partials;
    let Zt = this._n, $n, Sn, kn, Kn = 0;
    if (Zt > 0) {
      for (Kn = Qt[--Zt]; Zt > 0 && ($n = Kn, Sn = Qt[--Zt], Kn = $n + Sn, kn = Sn - (Kn - $n), !kn); )
        ;
      Zt > 0 && (kn < 0 && Qt[Zt - 1] < 0 || kn > 0 && Qt[Zt - 1] > 0) && (Sn = kn * 2, $n = Kn + Sn, Sn == $n - Kn && (Kn = $n));
    }
    return Kn;
  }
}
class InternMap extends Map {
  constructor(Qt, Zt = keyof) {
    if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: Zt } }), Qt != null)
      for (const [$n, Sn] of Qt)
        this.set($n, Sn);
  }
  get(Qt) {
    return super.get(intern_get(this, Qt));
  }
  has(Qt) {
    return super.has(intern_get(this, Qt));
  }
  set(Qt, Zt) {
    return super.set(intern_set(this, Qt), Zt);
  }
  delete(Qt) {
    return super.delete(intern_delete(this, Qt));
  }
}
class InternSet extends Set {
  constructor(Qt, Zt = keyof) {
    if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: Zt } }), Qt != null)
      for (const $n of Qt)
        this.add($n);
  }
  has(Qt) {
    return super.has(intern_get(this, Qt));
  }
  add(Qt) {
    return super.add(intern_set(this, Qt));
  }
  delete(Qt) {
    return super.delete(intern_delete(this, Qt));
  }
}
function intern_get({ _intern: _e, _key: Qt }, Zt) {
  const $n = Qt(Zt);
  return _e.has($n) ? _e.get($n) : Zt;
}
function intern_set({ _intern: _e, _key: Qt }, Zt) {
  const $n = Qt(Zt);
  return _e.has($n) ? _e.get($n) : (_e.set($n, Zt), Zt);
}
function intern_delete({ _intern: _e, _key: Qt }, Zt) {
  const $n = Qt(Zt);
  return _e.has($n) && (Zt = _e.get($n), _e.delete($n)), Zt;
}
function keyof(_e) {
  return _e !== null && typeof _e == "object" ? _e.valueOf() : _e;
}
function permute(_e, Qt) {
  return Array.from(Qt, (Zt) => _e[Zt]);
}
function compareDefined(_e = ascending$3) {
  if (_e === ascending$3)
    return ascendingDefined;
  if (typeof _e != "function")
    throw new TypeError("compare is not a function");
  return (Qt, Zt) => {
    const $n = _e(Qt, Zt);
    return $n || $n === 0 ? $n : (_e(Zt, Zt) === 0) - (_e(Qt, Qt) === 0);
  };
}
function ascendingDefined(_e, Qt) {
  return (_e == null || !(_e >= _e)) - (Qt == null || !(Qt >= Qt)) || (_e < Qt ? -1 : _e > Qt ? 1 : 0);
}
const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2);
function tickSpec(_e, Qt, Zt) {
  const $n = (Qt - _e) / Math.max(0, Zt), Sn = Math.floor(Math.log10($n)), kn = $n / Math.pow(10, Sn), Kn = kn >= e10 ? 10 : kn >= e5 ? 5 : kn >= e2 ? 2 : 1;
  let er, Cr, kr;
  return Sn < 0 ? (kr = Math.pow(10, -Sn) / Kn, er = Math.round(_e * kr), Cr = Math.round(Qt * kr), er / kr < _e && ++er, Cr / kr > Qt && --Cr, kr = -kr) : (kr = Math.pow(10, Sn) * Kn, er = Math.round(_e / kr), Cr = Math.round(Qt / kr), er * kr < _e && ++er, Cr * kr > Qt && --Cr), Cr < er && 0.5 <= Zt && Zt < 2 ? tickSpec(_e, Qt, Zt * 2) : [er, Cr, kr];
}
function ticks(_e, Qt, Zt) {
  if (Qt = +Qt, _e = +_e, Zt = +Zt, !(Zt > 0))
    return [];
  if (_e === Qt)
    return [_e];
  const $n = Qt < _e, [Sn, kn, Kn] = $n ? tickSpec(Qt, _e, Zt) : tickSpec(_e, Qt, Zt);
  if (!(kn >= Sn))
    return [];
  const er = kn - Sn + 1, Cr = new Array(er);
  if ($n)
    if (Kn < 0)
      for (let kr = 0; kr < er; ++kr)
        Cr[kr] = (kn - kr) / -Kn;
    else
      for (let kr = 0; kr < er; ++kr)
        Cr[kr] = (kn - kr) * Kn;
  else if (Kn < 0)
    for (let kr = 0; kr < er; ++kr)
      Cr[kr] = (Sn + kr) / -Kn;
  else
    for (let kr = 0; kr < er; ++kr)
      Cr[kr] = (Sn + kr) * Kn;
  return Cr;
}
function tickIncrement(_e, Qt, Zt) {
  return Qt = +Qt, _e = +_e, Zt = +Zt, tickSpec(_e, Qt, Zt)[2];
}
function tickStep(_e, Qt, Zt) {
  Qt = +Qt, _e = +_e, Zt = +Zt;
  const $n = Qt < _e, Sn = $n ? tickIncrement(Qt, _e, Zt) : tickIncrement(_e, Qt, Zt);
  return ($n ? -1 : 1) * (Sn < 0 ? 1 / -Sn : Sn);
}
function max$2(_e, Qt) {
  let Zt;
  if (Qt === void 0)
    for (const $n of _e)
      $n != null && (Zt < $n || Zt === void 0 && $n >= $n) && (Zt = $n);
  else {
    let $n = -1;
    for (let Sn of _e)
      (Sn = Qt(Sn, ++$n, _e)) != null && (Zt < Sn || Zt === void 0 && Sn >= Sn) && (Zt = Sn);
  }
  return Zt;
}
function min$2(_e, Qt) {
  let Zt;
  if (Qt === void 0)
    for (const $n of _e)
      $n != null && (Zt > $n || Zt === void 0 && $n >= $n) && (Zt = $n);
  else {
    let $n = -1;
    for (let Sn of _e)
      (Sn = Qt(Sn, ++$n, _e)) != null && (Zt > Sn || Zt === void 0 && Sn >= Sn) && (Zt = Sn);
  }
  return Zt;
}
function quickselect(_e, Qt, Zt = 0, $n = 1 / 0, Sn) {
  if (Qt = Math.floor(Qt), Zt = Math.floor(Math.max(0, Zt)), $n = Math.floor(Math.min(_e.length - 1, $n)), !(Zt <= Qt && Qt <= $n))
    return _e;
  for (Sn = Sn === void 0 ? ascendingDefined : compareDefined(Sn); $n > Zt; ) {
    if ($n - Zt > 600) {
      const Cr = $n - Zt + 1, kr = Qt - Zt + 1, Yr = Math.log(Cr), Ms = 0.5 * Math.exp(2 * Yr / 3), Ds = 0.5 * Math.sqrt(Yr * Ms * (Cr - Ms) / Cr) * (kr - Cr / 2 < 0 ? -1 : 1), Ls = Math.max(Zt, Math.floor(Qt - kr * Ms / Cr + Ds)), js = Math.min($n, Math.floor(Qt + (Cr - kr) * Ms / Cr + Ds));
      quickselect(_e, Qt, Ls, js, Sn);
    }
    const kn = _e[Qt];
    let Kn = Zt, er = $n;
    for (swap$1(_e, Zt, Qt), Sn(_e[$n], kn) > 0 && swap$1(_e, Zt, $n); Kn < er; ) {
      for (swap$1(_e, Kn, er), ++Kn, --er; Sn(_e[Kn], kn) < 0; )
        ++Kn;
      for (; Sn(_e[er], kn) > 0; )
        --er;
    }
    Sn(_e[Zt], kn) === 0 ? swap$1(_e, Zt, er) : (++er, swap$1(_e, er, $n)), er <= Qt && (Zt = er + 1), Qt <= er && ($n = er - 1);
  }
  return _e;
}
function swap$1(_e, Qt, Zt) {
  const $n = _e[Qt];
  _e[Qt] = _e[Zt], _e[Zt] = $n;
}
function quantile$1(_e, Qt, Zt) {
  if (_e = Float64Array.from(numbers$2(_e, Zt)), !(!($n = _e.length) || isNaN(Qt = +Qt))) {
    if (Qt <= 0 || $n < 2)
      return min$2(_e);
    if (Qt >= 1)
      return max$2(_e);
    var $n, Sn = ($n - 1) * Qt, kn = Math.floor(Sn), Kn = max$2(quickselect(_e, kn).subarray(0, kn + 1)), er = min$2(_e.subarray(kn + 1));
    return Kn + (er - Kn) * (Sn - kn);
  }
}
function quantileSorted(_e, Qt, Zt = number$6) {
  if (!(!($n = _e.length) || isNaN(Qt = +Qt))) {
    if (Qt <= 0 || $n < 2)
      return +Zt(_e[0], 0, _e);
    if (Qt >= 1)
      return +Zt(_e[$n - 1], $n - 1, _e);
    var $n, Sn = ($n - 1) * Qt, kn = Math.floor(Sn), Kn = +Zt(_e[kn], kn, _e), er = +Zt(_e[kn + 1], kn + 1, _e);
    return Kn + (er - Kn) * (Sn - kn);
  }
}
function mean(_e, Qt) {
  let Zt = 0, $n = 0;
  if (Qt === void 0)
    for (let Sn of _e)
      Sn != null && (Sn = +Sn) >= Sn && (++Zt, $n += Sn);
  else {
    let Sn = -1;
    for (let kn of _e)
      (kn = Qt(kn, ++Sn, _e)) != null && (kn = +kn) >= kn && (++Zt, $n += kn);
  }
  if (Zt)
    return $n / Zt;
}
function median(_e, Qt) {
  return quantile$1(_e, 0.5, Qt);
}
function* flatten(_e) {
  for (const Qt of _e)
    yield* Qt;
}
function merge$2(_e) {
  return Array.from(flatten(_e));
}
function range$5(_e, Qt, Zt) {
  _e = +_e, Qt = +Qt, Zt = (Sn = arguments.length) < 2 ? (Qt = _e, _e = 0, 1) : Sn < 3 ? 1 : +Zt;
  for (var $n = -1, Sn = Math.max(0, Math.ceil((Qt - _e) / Zt)) | 0, kn = new Array(Sn); ++$n < Sn; )
    kn[$n] = _e + $n * Zt;
  return kn;
}
function sum$1(_e, Qt) {
  let Zt = 0;
  if (Qt === void 0)
    for (let $n of _e)
      ($n = +$n) && (Zt += $n);
  else {
    let $n = -1;
    for (let Sn of _e)
      (Sn = +Qt(Sn, ++$n, _e)) && (Zt += Sn);
  }
  return Zt;
}
function formatDecimal(_e) {
  return Math.abs(_e = Math.round(_e)) >= 1e21 ? _e.toLocaleString("en").replace(/,/g, "") : _e.toString(10);
}
function formatDecimalParts(_e, Qt) {
  if ((Zt = (_e = Qt ? _e.toExponential(Qt - 1) : _e.toExponential()).indexOf("e")) < 0)
    return null;
  var Zt, $n = _e.slice(0, Zt);
  return [
    $n.length > 1 ? $n[0] + $n.slice(2) : $n,
    +_e.slice(Zt + 1)
  ];
}
function exponent(_e) {
  return _e = formatDecimalParts(Math.abs(_e)), _e ? _e[1] : NaN;
}
function formatGroup(_e, Qt) {
  return function(Zt, $n) {
    for (var Sn = Zt.length, kn = [], Kn = 0, er = _e[0], Cr = 0; Sn > 0 && er > 0 && (Cr + er + 1 > $n && (er = Math.max(1, $n - Cr)), kn.push(Zt.substring(Sn -= er, Sn + er)), !((Cr += er + 1) > $n)); )
      er = _e[Kn = (Kn + 1) % _e.length];
    return kn.reverse().join(Qt);
  };
}
function formatNumerals(_e) {
  return function(Qt) {
    return Qt.replace(/[0-9]/g, function(Zt) {
      return _e[+Zt];
    });
  };
}
var re$2 = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function formatSpecifier(_e) {
  if (!(Qt = re$2.exec(_e)))
    throw new Error("invalid format: " + _e);
  var Qt;
  return new FormatSpecifier({
    fill: Qt[1],
    align: Qt[2],
    sign: Qt[3],
    symbol: Qt[4],
    zero: Qt[5],
    width: Qt[6],
    comma: Qt[7],
    precision: Qt[8] && Qt[8].slice(1),
    trim: Qt[9],
    type: Qt[10]
  });
}
formatSpecifier.prototype = FormatSpecifier.prototype;
function FormatSpecifier(_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 + "";
}
FormatSpecifier.prototype.toString = function() {
  return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
};
function formatTrim(_e) {
  e:
    for (var Qt = _e.length, Zt = 1, $n = -1, Sn; Zt < Qt; ++Zt)
      switch (_e[Zt]) {
        case ".":
          $n = Sn = Zt;
          break;
        case "0":
          $n === 0 && ($n = Zt), Sn = Zt;
          break;
        default:
          if (!+_e[Zt])
            break e;
          $n > 0 && ($n = 0);
          break;
      }
  return $n > 0 ? _e.slice(0, $n) + _e.slice(Sn + 1) : _e;
}
var prefixExponent;
function formatPrefixAuto(_e, Qt) {
  var Zt = formatDecimalParts(_e, Qt);
  if (!Zt)
    return _e + "";
  var $n = Zt[0], Sn = Zt[1], kn = Sn - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(Sn / 3))) * 3) + 1, Kn = $n.length;
  return kn === Kn ? $n : kn > Kn ? $n + new Array(kn - Kn + 1).join("0") : kn > 0 ? $n.slice(0, kn) + "." + $n.slice(kn) : "0." + new Array(1 - kn).join("0") + formatDecimalParts(_e, Math.max(0, Qt + kn - 1))[0];
}
function formatRounded(_e, Qt) {
  var Zt = formatDecimalParts(_e, Qt);
  if (!Zt)
    return _e + "";
  var $n = Zt[0], Sn = Zt[1];
  return Sn < 0 ? "0." + new Array(-Sn).join("0") + $n : $n.length > Sn + 1 ? $n.slice(0, Sn + 1) + "." + $n.slice(Sn + 1) : $n + new Array(Sn - $n.length + 2).join("0");
}
const formatTypes = {
  "%": (_e, Qt) => (_e * 100).toFixed(Qt),
  b: (_e) => Math.round(_e).toString(2),
  c: (_e) => _e + "",
  d: formatDecimal,
  e: (_e, Qt) => _e.toExponential(Qt),
  f: (_e, Qt) => _e.toFixed(Qt),
  g: (_e, Qt) => _e.toPrecision(Qt),
  o: (_e) => Math.round(_e).toString(8),
  p: (_e, Qt) => formatRounded(_e * 100, Qt),
  r: formatRounded,
  s: formatPrefixAuto,
  X: (_e) => Math.round(_e).toString(16).toUpperCase(),
  x: (_e) => Math.round(_e).toString(16)
};
function identity$5(_e) {
  return _e;
}
var map$1 = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
function formatLocale$1(_e) {
  var Qt = _e.grouping === void 0 || _e.thousands === void 0 ? identity$5 : formatGroup(map$1.call(_e.grouping, Number), _e.thousands + ""), Zt = _e.currency === void 0 ? "" : _e.currency[0] + "", $n = _e.currency === void 0 ? "" : _e.currency[1] + "", Sn = _e.decimal === void 0 ? "." : _e.decimal + "", kn = _e.numerals === void 0 ? identity$5 : formatNumerals(map$1.call(_e.numerals, String)), Kn = _e.percent === void 0 ? "%" : _e.percent + "", er = _e.minus === void 0 ? "−" : _e.minus + "", Cr = _e.nan === void 0 ? "NaN" : _e.nan + "";
  function kr(Ms) {
    Ms = formatSpecifier(Ms);
    var Ds = Ms.fill, Ls = Ms.align, js = Ms.sign, zs = Ms.symbol, Fs = Ms.zero, Bs = Ms.width, Hs = Ms.comma, Ws = Ms.precision, Ys = Ms.trim, El = Ms.type;
    El === "n" ? (Hs = !0, El = "g") : formatTypes[El] || (Ws === void 0 && (Ws = 12), Ys = !0, El = "g"), (Fs || Ds === "0" && Ls === "=") && (Fs = !0, Ds = "0", Ls = "=");
    var Mu = zs === "$" ? Zt : zs === "#" && /[boxX]/.test(El) ? "0" + El.toLowerCase() : "", Pl = zs === "$" ? $n : /[%p]/.test(El) ? Kn : "", Iu = formatTypes[El], Tu = /[defgprs%]/.test(El);
    Ws = Ws === void 0 ? 6 : /[gprs]/.test(El) ? Math.max(1, Math.min(21, Ws)) : Math.max(0, Math.min(20, Ws));
    function Au(Nu) {
      var gm = Mu, pm = Pl, zu, Yu, sm;
      if (El === "c")
        pm = Iu(Nu) + pm, Nu = "";
      else {
        Nu = +Nu;
        var mm = Nu < 0 || 1 / Nu < 0;
        if (Nu = isNaN(Nu) ? Cr : Iu(Math.abs(Nu), Ws), Ys && (Nu = formatTrim(Nu)), mm && +Nu == 0 && js !== "+" && (mm = !1), gm = (mm ? js === "(" ? js : er : js === "-" || js === "(" ? "" : js) + gm, pm = (El === "s" ? prefixes[8 + prefixExponent / 3] : "") + pm + (mm && js === "(" ? ")" : ""), Tu) {
          for (zu = -1, Yu = Nu.length; ++zu < Yu; )
            if (sm = Nu.charCodeAt(zu), 48 > sm || sm > 57) {
              pm = (sm === 46 ? Sn + Nu.slice(zu + 1) : Nu.slice(zu)) + pm, Nu = Nu.slice(0, zu);
              break;
            }
        }
      }
      Hs && !Fs && (Nu = Qt(Nu, 1 / 0));
      var hm = gm.length + Nu.length + pm.length, ym = hm < Bs ? new Array(Bs - hm + 1).join(Ds) : "";
      switch (Hs && Fs && (Nu = Qt(ym + Nu, ym.length ? Bs - pm.length : 1 / 0), ym = ""), Ls) {
        case "<":
          Nu = gm + Nu + pm + ym;
          break;
        case "=":
          Nu = gm + ym + Nu + pm;
          break;
        case "^":
          Nu = ym.slice(0, hm = ym.length >> 1) + gm + Nu + pm + ym.slice(hm);
          break;
        default:
          Nu = ym + gm + Nu + pm;
          break;
      }
      return kn(Nu);
    }
    return Au.toString = function() {
      return Ms + "";
    }, Au;
  }
  function Yr(Ms, Ds) {
    var Ls = kr((Ms = formatSpecifier(Ms), Ms.type = "f", Ms)), js = Math.max(-8, Math.min(8, Math.floor(exponent(Ds) / 3))) * 3, zs = Math.pow(10, -js), Fs = prefixes[8 + js / 3];
    return function(Bs) {
      return Ls(zs * Bs) + Fs;
    };
  }
  return {
    format: kr,
    formatPrefix: Yr
  };
}
var locale$2, format$3, formatPrefix;
defaultLocale$2({
  thousands: ",",
  grouping: [3],
  currency: ["$", ""]
});
function defaultLocale$2(_e) {
  return locale$2 = formatLocale$1(_e), format$3 = locale$2.format, formatPrefix = locale$2.formatPrefix, locale$2;
}
function precisionFixed(_e) {
  return Math.max(0, -exponent(Math.abs(_e)));
}
function precisionPrefix(_e, Qt) {
  return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(Qt) / 3))) * 3 - exponent(Math.abs(_e)));
}
function precisionRound(_e, Qt) {
  return _e = Math.abs(_e), Qt = Math.abs(Qt) - _e, Math.max(0, exponent(Qt) - exponent(_e)) + 1;
}
const t0$3 = /* @__PURE__ */ new Date(), t1$2 = /* @__PURE__ */ new Date();
function timeInterval$1(_e, Qt, Zt, $n) {
  function Sn(kn) {
    return _e(kn = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+kn)), kn;
  }
  return Sn.floor = (kn) => (_e(kn = /* @__PURE__ */ new Date(+kn)), kn), Sn.ceil = (kn) => (_e(kn = new Date(kn - 1)), Qt(kn, 1), _e(kn), kn), Sn.round = (kn) => {
    const Kn = Sn(kn), er = Sn.ceil(kn);
    return kn - Kn < er - kn ? Kn : er;
  }, Sn.offset = (kn, Kn) => (Qt(kn = /* @__PURE__ */ new Date(+kn), Kn == null ? 1 : Math.floor(Kn)), kn), Sn.range = (kn, Kn, er) => {
    const Cr = [];
    if (kn = Sn.ceil(kn), er = er == null ? 1 : Math.floor(er), !(kn < Kn) || !(er > 0))
      return Cr;
    let kr;
    do
      Cr.push(kr = /* @__PURE__ */ new Date(+kn)), Qt(kn, er), _e(kn);
    while (kr < kn && kn < Kn);
    return Cr;
  }, Sn.filter = (kn) => timeInterval$1((Kn) => {
    if (Kn >= Kn)
      for (; _e(Kn), !kn(Kn); )
        Kn.setTime(Kn - 1);
  }, (Kn, er) => {
    if (Kn >= Kn)
      if (er < 0)
        for (; ++er <= 0; )
          for (; Qt(Kn, -1), !kn(Kn); )
            ;
      else
        for (; --er >= 0; )
          for (; Qt(Kn, 1), !kn(Kn); )
            ;
  }), Zt && (Sn.count = (kn, Kn) => (t0$3.setTime(+kn), t1$2.setTime(+Kn), _e(t0$3), _e(t1$2), Math.floor(Zt(t0$3, t1$2))), Sn.every = (kn) => (kn = Math.floor(kn), !isFinite(kn) || !(kn > 0) ? null : kn > 1 ? Sn.filter($n ? (Kn) => $n(Kn) % kn === 0 : (Kn) => Sn.count(0, Kn) % kn === 0) : Sn)), Sn;
}
const millisecond = timeInterval$1(() => {
}, (_e, Qt) => {
  _e.setTime(+_e + Qt);
}, (_e, Qt) => Qt - _e);
millisecond.every = (_e) => (_e = Math.floor(_e), !isFinite(_e) || !(_e > 0) ? null : _e > 1 ? timeInterval$1((Qt) => {
  Qt.setTime(Math.floor(Qt / _e) * _e);
}, (Qt, Zt) => {
  Qt.setTime(+Qt + Zt * _e);
}, (Qt, Zt) => (Zt - Qt) / _e) : millisecond);
millisecond.range;
const durationSecond$1 = 1e3, durationMinute$1 = durationSecond$1 * 60, durationHour$1 = durationMinute$1 * 60, durationDay$1 = durationHour$1 * 24, durationWeek$1 = durationDay$1 * 7, durationMonth$1 = durationDay$1 * 30, durationYear$1 = durationDay$1 * 365, second = timeInterval$1((_e) => {
  _e.setTime(_e - _e.getMilliseconds());
}, (_e, Qt) => {
  _e.setTime(+_e + Qt * durationSecond$1);
}, (_e, Qt) => (Qt - _e) / durationSecond$1, (_e) => _e.getUTCSeconds());
second.range;
const timeMinute = timeInterval$1((_e) => {
  _e.setTime(_e - _e.getMilliseconds() - _e.getSeconds() * durationSecond$1);
}, (_e, Qt) => {
  _e.setTime(+_e + Qt * durationMinute$1);
}, (_e, Qt) => (Qt - _e) / durationMinute$1, (_e) => _e.getMinutes());
timeMinute.range;
const utcMinute = timeInterval$1((_e) => {
  _e.setUTCSeconds(0, 0);
}, (_e, Qt) => {
  _e.setTime(+_e + Qt * durationMinute$1);
}, (_e, Qt) => (Qt - _e) / durationMinute$1, (_e) => _e.getUTCMinutes());
utcMinute.range;
const timeHour = timeInterval$1((_e) => {
  _e.setTime(_e - _e.getMilliseconds() - _e.getSeconds() * durationSecond$1 - _e.getMinutes() * durationMinute$1);
}, (_e, Qt) => {
  _e.setTime(+_e + Qt * durationHour$1);
}, (_e, Qt) => (Qt - _e) / durationHour$1, (_e) => _e.getHours());
timeHour.range;
const utcHour = timeInterval$1((_e) => {
  _e.setUTCMinutes(0, 0, 0);
}, (_e, Qt) => {
  _e.setTime(+_e + Qt * durationHour$1);
}, (_e, Qt) => (Qt - _e) / durationHour$1, (_e) => _e.getUTCHours());
utcHour.range;
const timeDay = timeInterval$1(
  (_e) => _e.setHours(0, 0, 0, 0),
  (_e, Qt) => _e.setDate(_e.getDate() + Qt),
  (_e, Qt) => (Qt - _e - (Qt.getTimezoneOffset() - _e.getTimezoneOffset()) * durationMinute$1) / durationDay$1,
  (_e) => _e.getDate() - 1
);
timeDay.range;
const utcDay = timeInterval$1((_e) => {
  _e.setUTCHours(0, 0, 0, 0);
}, (_e, Qt) => {
  _e.setUTCDate(_e.getUTCDate() + Qt);
}, (_e, Qt) => (Qt - _e) / durationDay$1, (_e) => _e.getUTCDate() - 1);
utcDay.range;
const unixDay = timeInterval$1((_e) => {
  _e.setUTCHours(0, 0, 0, 0);
}, (_e, Qt) => {
  _e.setUTCDate(_e.getUTCDate() + Qt);
}, (_e, Qt) => (Qt - _e) / durationDay$1, (_e) => Math.floor(_e / durationDay$1));
unixDay.range;
function timeWeekday(_e) {
  return timeInterval$1((Qt) => {
    Qt.setDate(Qt.getDate() - (Qt.getDay() + 7 - _e) % 7), Qt.setHours(0, 0, 0, 0);
  }, (Qt, Zt) => {
    Qt.setDate(Qt.getDate() + Zt * 7);
  }, (Qt, Zt) => (Zt - Qt - (Zt.getTimezoneOffset() - Qt.getTimezoneOffset()) * durationMinute$1) / durationWeek$1);
}
const timeSunday = timeWeekday(0), timeMonday = timeWeekday(1), timeTuesday = timeWeekday(2), timeWednesday = timeWeekday(3), timeThursday = timeWeekday(4), timeFriday = timeWeekday(5), timeSaturday = timeWeekday(6);
timeSunday.range;
timeMonday.range;
timeTuesday.range;
timeWednesday.range;
timeThursday.range;
timeFriday.range;
timeSaturday.range;
function utcWeekday(_e) {
  return timeInterval$1((Qt) => {
    Qt.setUTCDate(Qt.getUTCDate() - (Qt.getUTCDay() + 7 - _e) % 7), Qt.setUTCHours(0, 0, 0, 0);
  }, (Qt, Zt) => {
    Qt.setUTCDate(Qt.getUTCDate() + Zt * 7);
  }, (Qt, Zt) => (Zt - Qt) / durationWeek$1);
}
const utcSunday = utcWeekday(0), utcMonday = utcWeekday(1), utcTuesday = utcWeekday(2), utcWednesday = utcWeekday(3), utcThursday = utcWeekday(4), utcFriday = utcWeekday(5), utcSaturday = utcWeekday(6);
utcSunday.range;
utcMonday.range;
utcTuesday.range;
utcWednesday.range;
utcThursday.range;
utcFriday.range;
utcSaturday.range;
const timeMonth = timeInterval$1((_e) => {
  _e.setDate(1), _e.setHours(0, 0, 0, 0);
}, (_e, Qt) => {
  _e.setMonth(_e.getMonth() + Qt);
}, (_e, Qt) => Qt.getMonth() - _e.getMonth() + (Qt.getFullYear() - _e.getFullYear()) * 12, (_e) => _e.getMonth());
timeMonth.range;
const utcMonth = timeInterval$1((_e) => {
  _e.setUTCDate(1), _e.setUTCHours(0, 0, 0, 0);
}, (_e, Qt) => {
  _e.setUTCMonth(_e.getUTCMonth() + Qt);
}, (_e, Qt) => Qt.getUTCMonth() - _e.getUTCMonth() + (Qt.getUTCFullYear() - _e.getUTCFullYear()) * 12, (_e) => _e.getUTCMonth());
utcMonth.range;
const timeYear = timeInterval$1((_e) => {
  _e.setMonth(0, 1), _e.setHours(0, 0, 0, 0);
}, (_e, Qt) => {
  _e.setFullYear(_e.getFullYear() + Qt);
}, (_e, Qt) => Qt.getFullYear() - _e.getFullYear(), (_e) => _e.getFullYear());
timeYear.every = (_e) => !isFinite(_e = Math.floor(_e)) || !(_e > 0) ? null : timeInterval$1((Qt) => {
  Qt.setFullYear(Math.floor(Qt.getFullYear() / _e) * _e), Qt.setMonth(0, 1), Qt.setHours(0, 0, 0, 0);
}, (Qt, Zt) => {
  Qt.setFullYear(Qt.getFullYear() + Zt * _e);
});
timeYear.range;
const utcYear = timeInterval$1((_e) => {
  _e.setUTCMonth(0, 1), _e.setUTCHours(0, 0, 0, 0);
}, (_e, Qt) => {
  _e.setUTCFullYear(_e.getUTCFullYear() + Qt);
}, (_e, Qt) => Qt.getUTCFullYear() - _e.getUTCFullYear(), (_e) => _e.getUTCFullYear());
utcYear.every = (_e) => !isFinite(_e = Math.floor(_e)) || !(_e > 0) ? null : timeInterval$1((Qt) => {
  Qt.setUTCFullYear(Math.floor(Qt.getUTCFullYear() / _e) * _e), Qt.setUTCMonth(0, 1), Qt.setUTCHours(0, 0, 0, 0);
}, (Qt, Zt) => {
  Qt.setUTCFullYear(Qt.getUTCFullYear() + Zt * _e);
});
utcYear.range;
function ticker(_e, Qt, Zt, $n, Sn, kn) {
  const Kn = [
    [second, 1, durationSecond$1],
    [second, 5, 5 * durationSecond$1],
    [second, 15, 15 * durationSecond$1],
    [second, 30, 30 * durationSecond$1],
    [kn, 1, durationMinute$1],
    [kn, 5, 5 * durationMinute$1],
    [kn, 15, 15 * durationMinute$1],
    [kn, 30, 30 * durationMinute$1],
    [Sn, 1, durationHour$1],
    [Sn, 3, 3 * durationHour$1],
    [Sn, 6, 6 * durationHour$1],
    [Sn, 12, 12 * durationHour$1],
    [$n, 1, durationDay$1],
    [$n, 2, 2 * durationDay$1],
    [Zt, 1, durationWeek$1],
    [Qt, 1, durationMonth$1],
    [Qt, 3, 3 * durationMonth$1],
    [_e, 1, durationYear$1]
  ];
  function er(kr, Yr, Ms) {
    const Ds = Yr < kr;
    Ds && ([kr, Yr] = [Yr, kr]);
    const Ls = Ms && typeof Ms.range == "function" ? Ms : Cr(kr, Yr, Ms), js = Ls ? Ls.range(kr, +Yr + 1) : [];
    return Ds ? js.reverse() : js;
  }
  function Cr(kr, Yr, Ms) {
    const Ds = Math.abs(Yr - kr) / Ms, Ls = bisector$1(([, , Fs]) => Fs).right(Kn, Ds);
    if (Ls === Kn.length)
      return _e.every(tickStep(kr / durationYear$1, Yr / durationYear$1, Ms));
    if (Ls === 0)
      return millisecond.every(Math.max(tickStep(kr, Yr, Ms), 1));
    const [js, zs] = Kn[Ds / Kn[Ls - 1][2] < Kn[Ls][2] / Ds ? Ls - 1 : Ls];
    return js.every(zs);
  }
  return [er, Cr];
}
const [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute), [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute), YEAR = "year", QUARTER = "quarter", MONTH = "month", WEEK = "week", DATE = "date", DAY = "day", DAYOFYEAR = "dayofyear", HOURS = "hours", MINUTES = "minutes", SECONDS = "seconds", MILLISECONDS = "milliseconds", TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS], UNITS = TIME_UNITS.reduce((_e, Qt, Zt) => (_e[Qt] = 1 + Zt, _e), {});
function timeUnits(_e) {
  const Qt = array$6(_e).slice(), Zt = {};
  return Qt.length || error("Missing time unit."), Qt.forEach((Sn) => {
    has$1(UNITS, Sn) ? Zt[Sn] = 1 : error(`Invalid time unit: ${Sn}.`);
  }), (Zt[WEEK] || Zt[DAY] ? 1 : 0) + (Zt[QUARTER] || Zt[MONTH] || Zt[DATE] ? 1 : 0) + (Zt[DAYOFYEAR] ? 1 : 0) > 1 && error(`Incompatible time units: ${_e}`), Qt.sort((Sn, kn) => UNITS[Sn] - UNITS[kn]), Qt;
}
const defaultSpecifiers = {
  [YEAR]: "%Y ",
  [QUARTER]: "Q%q ",
  [MONTH]: "%b ",
  [DATE]: "%d ",
  [WEEK]: "W%U ",
  [DAY]: "%a ",
  [DAYOFYEAR]: "%j ",
  [HOURS]: "%H:00",
  [MINUTES]: "00:%M",
  [SECONDS]: ":%S",
  [MILLISECONDS]: ".%L",
  [`${YEAR}-${MONTH}`]: "%Y-%m ",
  [`${YEAR}-${MONTH}-${DATE}`]: "%Y-%m-%d ",
  [`${HOURS}-${MINUTES}`]: "%H:%M"
};
function timeUnitSpecifier(_e, Qt) {
  const Zt = extend$1({}, defaultSpecifiers, Qt), $n = timeUnits(_e), Sn = $n.length;
  let kn = "", Kn = 0, er, Cr;
  for (Kn = 0; Kn < Sn; )
    for (er = $n.length; er > Kn; --er)
      if (Cr = $n.slice(Kn, er).join("-"), Zt[Cr] != null) {
        kn += Zt[Cr], Kn = er;
        break;
      }
  return kn.trim();
}
const t0$2 = /* @__PURE__ */ new Date();
function localYear(_e) {
  return t0$2.setFullYear(_e), t0$2.setMonth(0), t0$2.setDate(1), t0$2.setHours(0, 0, 0, 0), t0$2;
}
function dayofyear(_e) {
  return localDayOfYear(new Date(_e));
}
function week(_e) {
  return localWeekNum(new Date(_e));
}
function localDayOfYear(_e) {
  return timeDay.count(localYear(_e.getFullYear()) - 1, _e);
}
function localWeekNum(_e) {
  return timeSunday.count(localYear(_e.getFullYear()) - 1, _e);
}
function localFirst(_e) {
  return localYear(_e).getDay();
}
function localDate$1(_e, Qt, Zt, $n, Sn, kn, Kn) {
  if (0 <= _e && _e < 100) {
    const er = new Date(-1, Qt, Zt, $n, Sn, kn, Kn);
    return er.setFullYear(_e), er;
  }
  return new Date(_e, Qt, Zt, $n, Sn, kn, Kn);
}
function utcdayofyear(_e) {
  return utcDayOfYear(new Date(_e));
}
function utcweek(_e) {
  return utcWeekNum(new Date(_e));
}
function utcDayOfYear(_e) {
  const Qt = Date.UTC(_e.getUTCFullYear(), 0, 1);
  return utcDay.count(Qt - 1, _e);
}
function utcWeekNum(_e) {
  const Qt = Date.UTC(_e.getUTCFullYear(), 0, 1);
  return utcSunday.count(Qt - 1, _e);
}
function utcFirst(_e) {
  return t0$2.setTime(Date.UTC(_e, 0, 1)), t0$2.getUTCDay();
}
function utcDate$1(_e, Qt, Zt, $n, Sn, kn, Kn) {
  if (0 <= _e && _e < 100) {
    const er = new Date(Date.UTC(-1, Qt, Zt, $n, Sn, kn, Kn));
    return er.setUTCFullYear(Zt.y), er;
  }
  return new Date(Date.UTC(_e, Qt, Zt, $n, Sn, kn, Kn));
}
function floor(_e, Qt, Zt, $n, Sn) {
  const kn = Qt || 1, Kn = peek$1(_e), er = (Bs, Hs, Ws) => (Ws = Ws || Bs, getUnit(Zt[Ws], $n[Ws], Bs === Kn && kn, Hs)), Cr = /* @__PURE__ */ new Date(), kr = toSet(_e), Yr = kr[YEAR] ? er(YEAR) : constant$7(2012), Ms = kr[MONTH] ? er(MONTH) : kr[QUARTER] ? er(QUARTER) : zero$5, Ds = kr[WEEK] && kr[DAY] ? er(DAY, 1, WEEK + DAY) : kr[WEEK] ? er(WEEK, 1) : kr[DAY] ? er(DAY, 1) : kr[DATE] ? er(DATE, 1) : kr[DAYOFYEAR] ? er(DAYOFYEAR, 1) : one$2, Ls = kr[HOURS] ? er(HOURS) : zero$5, js = kr[MINUTES] ? er(MINUTES) : zero$5, zs = kr[SECONDS] ? er(SECONDS) : zero$5, Fs = kr[MILLISECONDS] ? er(MILLISECONDS) : zero$5;
  return function(Bs) {
    Cr.setTime(+Bs);
    const Hs = Yr(Cr);
    return Sn(Hs, Ms(Cr), Ds(Cr, Hs), Ls(Cr), js(Cr), zs(Cr), Fs(Cr));
  };
}
function getUnit(_e, Qt, Zt, $n) {
  const Sn = Zt <= 1 ? _e : $n ? (kn, Kn) => $n + Zt * Math.floor((_e(kn, Kn) - $n) / Zt) : (kn, Kn) => Zt * Math.floor(_e(kn, Kn) / Zt);
  return Qt ? (kn, Kn) => Qt(Sn(kn, Kn), Kn) : Sn;
}
function weekday(_e, Qt, Zt) {
  return Qt + _e * 7 - (Zt + 6) % 7;
}
const localGet = {
  [YEAR]: (_e) => _e.getFullYear(),
  [QUARTER]: (_e) => Math.floor(_e.getMonth() / 3),
  [MONTH]: (_e) => _e.getMonth(),
  [DATE]: (_e) => _e.getDate(),
  [HOURS]: (_e) => _e.getHours(),
  [MINUTES]: (_e) => _e.getMinutes(),
  [SECONDS]: (_e) => _e.getSeconds(),
  [MILLISECONDS]: (_e) => _e.getMilliseconds(),
  [DAYOFYEAR]: (_e) => localDayOfYear(_e),
  [WEEK]: (_e) => localWeekNum(_e),
  [WEEK + DAY]: (_e, Qt) => weekday(localWeekNum(_e), _e.getDay(), localFirst(Qt)),
  [DAY]: (_e, Qt) => weekday(1, _e.getDay(), localFirst(Qt))
}, localInv = {
  [QUARTER]: (_e) => 3 * _e,
  [WEEK]: (_e, Qt) => weekday(_e, 0, localFirst(Qt))
};
function timeFloor(_e, Qt) {
  return floor(_e, Qt || 1, localGet, localInv, localDate$1);
}
const utcGet = {
  [YEAR]: (_e) => _e.getUTCFullYear(),
  [QUARTER]: (_e) => Math.floor(_e.getUTCMonth() / 3),
  [MONTH]: (_e) => _e.getUTCMonth(),
  [DATE]: (_e) => _e.getUTCDate(),
  [HOURS]: (_e) => _e.getUTCHours(),
  [MINUTES]: (_e) => _e.getUTCMinutes(),
  [SECONDS]: (_e) => _e.getUTCSeconds(),
  [MILLISECONDS]: (_e) => _e.getUTCMilliseconds(),
  [DAYOFYEAR]: (_e) => utcDayOfYear(_e),
  [WEEK]: (_e) => utcWeekNum(_e),
  [DAY]: (_e, Qt) => weekday(1, _e.getUTCDay(), utcFirst(Qt)),
  [WEEK + DAY]: (_e, Qt) => weekday(utcWeekNum(_e), _e.getUTCDay(), utcFirst(Qt))
}, utcInv = {
  [QUARTER]: (_e) => 3 * _e,
  [WEEK]: (_e, Qt) => weekday(_e, 0, utcFirst(Qt))
};
function utcFloor(_e, Qt) {
  return floor(_e, Qt || 1, utcGet, utcInv, utcDate$1);
}
const timeIntervals = {
  [YEAR]: timeYear,
  [QUARTER]: timeMonth.every(3),
  [MONTH]: timeMonth,
  [WEEK]: timeSunday,
  [DATE]: timeDay,
  [DAY]: timeDay,
  [DAYOFYEAR]: timeDay,
  [HOURS]: timeHour,
  [MINUTES]: timeMinute,
  [SECONDS]: second,
  [MILLISECONDS]: millisecond
}, utcIntervals = {
  [YEAR]: utcYear,
  [QUARTER]: utcMonth.every(3),
  [MONTH]: utcMonth,
  [WEEK]: utcSunday,
  [DATE]: utcDay,
  [DAY]: utcDay,
  [DAYOFYEAR]: utcDay,
  [HOURS]: utcHour,
  [MINUTES]: utcMinute,
  [SECONDS]: second,
  [MILLISECONDS]: millisecond
};
function timeInterval(_e) {
  return timeIntervals[_e];
}
function utcInterval(_e) {
  return utcIntervals[_e];
}
function offset$3(_e, Qt, Zt) {
  return _e ? _e.offset(Qt, Zt) : void 0;
}
function timeOffset(_e, Qt, Zt) {
  return offset$3(timeInterval(_e), Qt, Zt);
}
function utcOffset(_e, Qt, Zt) {
  return offset$3(utcInterval(_e), Qt, Zt);
}
function sequence$1(_e, Qt, Zt, $n) {
  return _e ? _e.range(Qt, Zt, $n) : void 0;
}
function timeSequence(_e, Qt, Zt, $n) {
  return sequence$1(timeInterval(_e), Qt, Zt, $n);
}
function utcSequence(_e, Qt, Zt, $n) {
  return sequence$1(utcInterval(_e), Qt, Zt, $n);
}
const durationSecond = 1e3, durationMinute = durationSecond * 60, durationHour = durationMinute * 60, durationDay = durationHour * 24, durationWeek = durationDay * 7, durationMonth = durationDay * 30, durationYear = durationDay * 365, Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], Seconds = Milli.slice(0, -1), Minutes = Seconds.slice(0, -1), Hours = Minutes.slice(0, -1), Day = Hours.slice(0, -1), Week = [YEAR, WEEK], Month = [YEAR, MONTH], Year = [YEAR], intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]];
function bin$1(_e) {
  const Qt = _e.extent, Zt = _e.maxbins || 40, $n = Math.abs(span(Qt)) / Zt;
  let Sn = bisector$1((er) => er[2]).right(intervals, $n), kn, Kn;
  return Sn === intervals.length ? (kn = Year, Kn = tickStep(Qt[0] / durationYear, Qt[1] / durationYear, Zt)) : Sn ? (Sn = intervals[$n / intervals[Sn - 1][2] < intervals[Sn][2] / $n ? Sn - 1 : Sn], kn = Sn[0], Kn = Sn[1]) : (kn = Milli, Kn = Math.max(tickStep(Qt[0], Qt[1], Zt), 1)), {
    units: kn,
    step: Kn
  };
}
function localDate(_e) {
  if (0 <= _e.y && _e.y < 100) {
    var Qt = new Date(-1, _e.m, _e.d, _e.H, _e.M, _e.S, _e.L);
    return Qt.setFullYear(_e.y), Qt;
  }
  return new Date(_e.y, _e.m, _e.d, _e.H, _e.M, _e.S, _e.L);
}
function utcDate(_e) {
  if (0 <= _e.y && _e.y < 100) {
    var Qt = new Date(Date.UTC(-1, _e.m, _e.d, _e.H, _e.M, _e.S, _e.L));
    return Qt.setUTCFullYear(_e.y), Qt;
  }
  return new Date(Date.UTC(_e.y, _e.m, _e.d, _e.H, _e.M, _e.S, _e.L));
}
function newDate(_e, Qt, Zt) {
  return { y: _e, m: Qt, d: Zt, H: 0, M: 0, S: 0, L: 0 };
}
function formatLocale(_e) {
  var Qt = _e.dateTime, Zt = _e.date, $n = _e.time, Sn = _e.periods, kn = _e.days, Kn = _e.shortDays, er = _e.months, Cr = _e.shortMonths, kr = formatRe(Sn), Yr = formatLookup(Sn), Ms = formatRe(kn), Ds = formatLookup(kn), Ls = formatRe(Kn), js = formatLookup(Kn), zs = formatRe(er), Fs = formatLookup(er), Bs = formatRe(Cr), Hs = formatLookup(Cr), Ws = {
    a: mm,
    A: hm,
    b: ym,
    B: _m,
    c: null,
    d: formatDayOfMonth,
    e: formatDayOfMonth,
    f: formatMicroseconds,
    g: formatYearISO,
    G: formatFullYearISO,
    H: formatHour24,
    I: formatHour12,
    j: formatDayOfYear,
    L: formatMilliseconds,
    m: formatMonthNumber,
    M: formatMinutes,
    p: Sm,
    q: wm,
    Q: formatUnixTimestamp,
    s: formatUnixTimestampSeconds,
    S: formatSeconds,
    u: formatWeekdayNumberMonday,
    U: formatWeekNumberSunday,
    V: formatWeekNumberISO,
    w: formatWeekdayNumberSunday,
    W: formatWeekNumberMonday,
    x: null,
    X: null,
    y: formatYear,
    Y: formatFullYear,
    Z: formatZone,
    "%": formatLiteralPercent
  }, Ys = {
    a: Nm,
    A: Cm,
    b: Im,
    B: Am,
    c: null,
    d: formatUTCDayOfMonth,
    e: formatUTCDayOfMonth,
    f: formatUTCMicroseconds,
    g: formatUTCYearISO,
    G: formatUTCFullYearISO,
    H: formatUTCHour24,
    I: formatUTCHour12,
    j: formatUTCDayOfYear,
    L: formatUTCMilliseconds,
    m: formatUTCMonthNumber,
    M: formatUTCMinutes,
    p: Vm,
    q: Rm,
    Q: formatUnixTimestamp,
    s: formatUnixTimestampSeconds,
    S: formatUTCSeconds,
    u: formatUTCWeekdayNumberMonday,
    U: formatUTCWeekNumberSunday,
    V: formatUTCWeekNumberISO,
    w: formatUTCWeekdayNumberSunday,
    W: formatUTCWeekNumberMonday,
    x: null,
    X: null,
    y: formatUTCYear,
    Y: formatUTCFullYear,
    Z: formatUTCZone,
    "%": formatLiteralPercent
  }, El = {
    a: Au,
    A: Nu,
    b: gm,
    B: pm,
    c: zu,
    d: parseDayOfMonth,
    e: parseDayOfMonth,
    f: parseMicroseconds,
    g: parseYear,
    G: parseFullYear,
    H: parseHour24,
    I: parseHour24,
    j: parseDayOfYear,
    L: parseMilliseconds,
    m: parseMonthNumber,
    M: parseMinutes,
    p: Tu,
    q: parseQuarter,
    Q: parseUnixTimestamp,
    s: parseUnixTimestampSeconds,
    S: parseSeconds,
    u: parseWeekdayNumberMonday,
    U: parseWeekNumberSunday,
    V: parseWeekNumberISO,
    w: parseWeekdayNumberSunday,
    W: parseWeekNumberMonday,
    x: Yu,
    X: sm,
    y: parseYear,
    Y: parseFullYear,
    Z: parseZone,
    "%": parseLiteralPercent
  };
  Ws.x = Mu(Zt, Ws), Ws.X = Mu($n, Ws), Ws.c = Mu(Qt, Ws), Ys.x = Mu(Zt, Ys), Ys.X = Mu($n, Ys), Ys.c = Mu(Qt, Ys);
  function Mu(Dm, km) {
    return function(zm) {
      var Pm = [], i$ = -1, o$ = 0, u$ = Dm.length, h$, d$, v$;
      for (zm instanceof Date || (zm = /* @__PURE__ */ new Date(+zm)); ++i$ < u$; )
        Dm.charCodeAt(i$) === 37 && (Pm.push(Dm.slice(o$, i$)), (d$ = pads[h$ = Dm.charAt(++i$)]) != null ? h$ = Dm.charAt(++i$) : d$ = h$ === "e" ? " " : "0", (v$ = km[h$]) && (h$ = v$(zm, d$)), Pm.push(h$), o$ = i$ + 1);
      return Pm.push(Dm.slice(o$, i$)), Pm.join("");
    };
  }
  function Pl(Dm, km) {
    return function(zm) {
      var Pm = newDate(1900, void 0, 1), i$ = Iu(Pm, Dm, zm += "", 0), o$, u$;
      if (i$ != zm.length)
        return null;
      if ("Q" in Pm)
        return new Date(Pm.Q);
      if ("s" in Pm)
        return new Date(Pm.s * 1e3 + ("L" in Pm ? Pm.L : 0));
      if (km && !("Z" in Pm) && (Pm.Z = 0), "p" in Pm && (Pm.H = Pm.H % 12 + Pm.p * 12), Pm.m === void 0 && (Pm.m = "q" in Pm ? Pm.q : 0), "V" in Pm) {
        if (Pm.V < 1 || Pm.V > 53)
          return null;
        "w" in Pm || (Pm.w = 1), "Z" in Pm ? (o$ = utcDate(newDate(Pm.y, 0, 1)), u$ = o$.getUTCDay(), o$ = u$ > 4 || u$ === 0 ? utcMonday.ceil(o$) : utcMonday(o$), o$ = utcDay.offset(o$, (Pm.V - 1) * 7), Pm.y = o$.getUTCFullYear(), Pm.m = o$.getUTCMonth(), Pm.d = o$.getUTCDate() + (Pm.w + 6) % 7) : (o$ = localDate(newDate(Pm.y, 0, 1)), u$ = o$.getDay(), o$ = u$ > 4 || u$ === 0 ? timeMonday.ceil(o$) : timeMonday(o$), o$ = timeDay.offset(o$, (Pm.V - 1) * 7), Pm.y = o$.getFullYear(), Pm.m = o$.getMonth(), Pm.d = o$.getDate() + (Pm.w + 6) % 7);
      } else
        ("W" in Pm || "U" in Pm) && ("w" in Pm || (Pm.w = "u" in Pm ? Pm.u % 7 : "W" in Pm ? 1 : 0), u$ = "Z" in Pm ? utcDate(newDate(Pm.y, 0, 1)).getUTCDay() : localDate(newDate(Pm.y, 0, 1)).getDay(), Pm.m = 0, Pm.d = "W" in Pm ? (Pm.w + 6) % 7 + Pm.W * 7 - (u$ + 5) % 7 : Pm.w + Pm.U * 7 - (u$ + 6) % 7);
      return "Z" in Pm ? (Pm.H += Pm.Z / 100 | 0, Pm.M += Pm.Z % 100, utcDate(Pm)) : localDate(Pm);
    };
  }
  function Iu(Dm, km, zm, Pm) {
    for (var i$ = 0, o$ = km.length, u$ = zm.length, h$, d$; i$ < o$; ) {
      if (Pm >= u$)
        return -1;
      if (h$ = km.charCodeAt(i$++), h$ === 37) {
        if (h$ = km.charAt(i$++), d$ = El[h$ in pads ? km.charAt(i$++) : h$], !d$ || (Pm = d$(Dm, zm, Pm)) < 0)
          return -1;
      } else if (h$ != zm.charCodeAt(Pm++))
        return -1;
    }
    return Pm;
  }
  function Tu(Dm, km, zm) {
    var Pm = kr.exec(km.slice(zm));
    return Pm ? (Dm.p = Yr.get(Pm[0].toLowerCase()), zm + Pm[0].length) : -1;
  }
  function Au(Dm, km, zm) {
    var Pm = Ls.exec(km.slice(zm));
    return Pm ? (Dm.w = js.get(Pm[0].toLowerCase()), zm + Pm[0].length) : -1;
  }
  function Nu(Dm, km, zm) {
    var Pm = Ms.exec(km.slice(zm));
    return Pm ? (Dm.w = Ds.get(Pm[0].toLowerCase()), zm + Pm[0].length) : -1;
  }
  function gm(Dm, km, zm) {
    var Pm = Bs.exec(km.slice(zm));
    return Pm ? (Dm.m = Hs.get(Pm[0].toLowerCase()), zm + Pm[0].length) : -1;
  }
  function pm(Dm, km, zm) {
    var Pm = zs.exec(km.slice(zm));
    return Pm ? (Dm.m = Fs.get(Pm[0].toLowerCase()), zm + Pm[0].length) : -1;
  }
  function zu(Dm, km, zm) {
    return Iu(Dm, Qt, km, zm);
  }
  function Yu(Dm, km, zm) {
    return Iu(Dm, Zt, km, zm);
  }
  function sm(Dm, km, zm) {
    return Iu(Dm, $n, km, zm);
  }
  function mm(Dm) {
    return Kn[Dm.getDay()];
  }
  function hm(Dm) {
    return kn[Dm.getDay()];
  }
  function ym(Dm) {
    return Cr[Dm.getMonth()];
  }
  function _m(Dm) {
    return er[Dm.getMonth()];
  }
  function Sm(Dm) {
    return Sn[+(Dm.getHours() >= 12)];
  }
  function wm(Dm) {
    return 1 + ~~(Dm.getMonth() / 3);
  }
  function Nm(Dm) {
    return Kn[Dm.getUTCDay()];
  }
  function Cm(Dm) {
    return kn[Dm.getUTCDay()];
  }
  function Im(Dm) {
    return Cr[Dm.getUTCMonth()];
  }
  function Am(Dm) {
    return er[Dm.getUTCMonth()];
  }
  function Vm(Dm) {
    return Sn[+(Dm.getUTCHours() >= 12)];
  }
  function Rm(Dm) {
    return 1 + ~~(Dm.getUTCMonth() / 3);
  }
  return {
    format: function(Dm) {
      var km = Mu(Dm += "", Ws);
      return km.toString = function() {
        return Dm;
      }, km;
    },
    parse: function(Dm) {
      var km = Pl(Dm += "", !1);
      return km.toString = function() {
        return Dm;
      }, km;
    },
    utcFormat: function(Dm) {
      var km = Mu(Dm += "", Ys);
      return km.toString = function() {
        return Dm;
      }, km;
    },
    utcParse: function(Dm) {
      var km = Pl(Dm += "", !0);
      return km.toString = function() {
        return Dm;
      }, km;
    }
  };
}
var pads = { "-": "", _: " ", 0: "0" }, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g;
function pad(_e, Qt, Zt) {
  var $n = _e < 0 ? "-" : "", Sn = ($n ? -_e : _e) + "", kn = Sn.length;
  return $n + (kn < Zt ? new Array(Zt - kn + 1).join(Qt) + Sn : Sn);
}
function requote(_e) {
  return _e.replace(requoteRe, "\\$&");
}
function formatRe(_e) {
  return new RegExp("^(?:" + _e.map(requote).join("|") + ")", "i");
}
function formatLookup(_e) {
  return new Map(_e.map((Qt, Zt) => [Qt.toLowerCase(), Zt]));
}
function parseWeekdayNumberSunday(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 1));
  return $n ? (_e.w = +$n[0], Zt + $n[0].length) : -1;
}
function parseWeekdayNumberMonday(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 1));
  return $n ? (_e.u = +$n[0], Zt + $n[0].length) : -1;
}
function parseWeekNumberSunday(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 2));
  return $n ? (_e.U = +$n[0], Zt + $n[0].length) : -1;
}
function parseWeekNumberISO(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 2));
  return $n ? (_e.V = +$n[0], Zt + $n[0].length) : -1;
}
function parseWeekNumberMonday(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 2));
  return $n ? (_e.W = +$n[0], Zt + $n[0].length) : -1;
}
function parseFullYear(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 4));
  return $n ? (_e.y = +$n[0], Zt + $n[0].length) : -1;
}
function parseYear(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 2));
  return $n ? (_e.y = +$n[0] + (+$n[0] > 68 ? 1900 : 2e3), Zt + $n[0].length) : -1;
}
function parseZone(_e, Qt, Zt) {
  var $n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(Qt.slice(Zt, Zt + 6));
  return $n ? (_e.Z = $n[1] ? 0 : -($n[2] + ($n[3] || "00")), Zt + $n[0].length) : -1;
}
function parseQuarter(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 1));
  return $n ? (_e.q = $n[0] * 3 - 3, Zt + $n[0].length) : -1;
}
function parseMonthNumber(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 2));
  return $n ? (_e.m = $n[0] - 1, Zt + $n[0].length) : -1;
}
function parseDayOfMonth(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 2));
  return $n ? (_e.d = +$n[0], Zt + $n[0].length) : -1;
}
function parseDayOfYear(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 3));
  return $n ? (_e.m = 0, _e.d = +$n[0], Zt + $n[0].length) : -1;
}
function parseHour24(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 2));
  return $n ? (_e.H = +$n[0], Zt + $n[0].length) : -1;
}
function parseMinutes(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 2));
  return $n ? (_e.M = +$n[0], Zt + $n[0].length) : -1;
}
function parseSeconds(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 2));
  return $n ? (_e.S = +$n[0], Zt + $n[0].length) : -1;
}
function parseMilliseconds(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 3));
  return $n ? (_e.L = +$n[0], Zt + $n[0].length) : -1;
}
function parseMicroseconds(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt, Zt + 6));
  return $n ? (_e.L = Math.floor($n[0] / 1e3), Zt + $n[0].length) : -1;
}
function parseLiteralPercent(_e, Qt, Zt) {
  var $n = percentRe.exec(Qt.slice(Zt, Zt + 1));
  return $n ? Zt + $n[0].length : -1;
}
function parseUnixTimestamp(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt));
  return $n ? (_e.Q = +$n[0], Zt + $n[0].length) : -1;
}
function parseUnixTimestampSeconds(_e, Qt, Zt) {
  var $n = numberRe.exec(Qt.slice(Zt));
  return $n ? (_e.s = +$n[0], Zt + $n[0].length) : -1;
}
function formatDayOfMonth(_e, Qt) {
  return pad(_e.getDate(), Qt, 2);
}
function formatHour24(_e, Qt) {
  return pad(_e.getHours(), Qt, 2);
}
function formatHour12(_e, Qt) {
  return pad(_e.getHours() % 12 || 12, Qt, 2);
}
function formatDayOfYear(_e, Qt) {
  return pad(1 + timeDay.count(timeYear(_e), _e), Qt, 3);
}
function formatMilliseconds(_e, Qt) {
  return pad(_e.getMilliseconds(), Qt, 3);
}
function formatMicroseconds(_e, Qt) {
  return formatMilliseconds(_e, Qt) + "000";
}
function formatMonthNumber(_e, Qt) {
  return pad(_e.getMonth() + 1, Qt, 2);
}
function formatMinutes(_e, Qt) {
  return pad(_e.getMinutes(), Qt, 2);
}
function formatSeconds(_e, Qt) {
  return pad(_e.getSeconds(), Qt, 2);
}
function formatWeekdayNumberMonday(_e) {
  var Qt = _e.getDay();
  return Qt === 0 ? 7 : Qt;
}
function formatWeekNumberSunday(_e, Qt) {
  return pad(timeSunday.count(timeYear(_e) - 1, _e), Qt, 2);
}
function dISO(_e) {
  var Qt = _e.getDay();
  return Qt >= 4 || Qt === 0 ? timeThursday(_e) : timeThursday.ceil(_e);
}
function formatWeekNumberISO(_e, Qt) {
  return _e = dISO(_e), pad(timeThursday.count(timeYear(_e), _e) + (timeYear(_e).getDay() === 4), Qt, 2);
}
function formatWeekdayNumberSunday(_e) {
  return _e.getDay();
}
function formatWeekNumberMonday(_e, Qt) {
  return pad(timeMonday.count(timeYear(_e) - 1, _e), Qt, 2);
}
function formatYear(_e, Qt) {
  return pad(_e.getFullYear() % 100, Qt, 2);
}
function formatYearISO(_e, Qt) {
  return _e = dISO(_e), pad(_e.getFullYear() % 100, Qt, 2);
}
function formatFullYear(_e, Qt) {
  return pad(_e.getFullYear() % 1e4, Qt, 4);
}
function formatFullYearISO(_e, Qt) {
  var Zt = _e.getDay();
  return _e = Zt >= 4 || Zt === 0 ? timeThursday(_e) : timeThursday.ceil(_e), pad(_e.getFullYear() % 1e4, Qt, 4);
}
function formatZone(_e) {
  var Qt = _e.getTimezoneOffset();
  return (Qt > 0 ? "-" : (Qt *= -1, "+")) + pad(Qt / 60 | 0, "0", 2) + pad(Qt % 60, "0", 2);
}
function formatUTCDayOfMonth(_e, Qt) {
  return pad(_e.getUTCDate(), Qt, 2);
}
function formatUTCHour24(_e, Qt) {
  return pad(_e.getUTCHours(), Qt, 2);
}
function formatUTCHour12(_e, Qt) {
  return pad(_e.getUTCHours() % 12 || 12, Qt, 2);
}
function formatUTCDayOfYear(_e, Qt) {
  return pad(1 + utcDay.count(utcYear(_e), _e), Qt, 3);
}
function formatUTCMilliseconds(_e, Qt) {
  return pad(_e.getUTCMilliseconds(), Qt, 3);
}
function formatUTCMicroseconds(_e, Qt) {
  return formatUTCMilliseconds(_e, Qt) + "000";
}
function formatUTCMonthNumber(_e, Qt) {
  return pad(_e.getUTCMonth() + 1, Qt, 2);
}
function formatUTCMinutes(_e, Qt) {
  return pad(_e.getUTCMinutes(), Qt, 2);
}
function formatUTCSeconds(_e, Qt) {
  return pad(_e.getUTCSeconds(), Qt, 2);
}
function formatUTCWeekdayNumberMonday(_e) {
  var Qt = _e.getUTCDay();
  return Qt === 0 ? 7 : Qt;
}
function formatUTCWeekNumberSunday(_e, Qt) {
  return pad(utcSunday.count(utcYear(_e) - 1, _e), Qt, 2);
}
function UTCdISO(_e) {
  var Qt = _e.getUTCDay();
  return Qt >= 4 || Qt === 0 ? utcThursday(_e) : utcThursday.ceil(_e);
}
function formatUTCWeekNumberISO(_e, Qt) {
  return _e = UTCdISO(_e), pad(utcThursday.count(utcYear(_e), _e) + (utcYear(_e).getUTCDay() === 4), Qt, 2);
}
function formatUTCWeekdayNumberSunday(_e) {
  return _e.getUTCDay();
}
function formatUTCWeekNumberMonday(_e, Qt) {
  return pad(utcMonday.count(utcYear(_e) - 1, _e), Qt, 2);
}
function formatUTCYear(_e, Qt) {
  return pad(_e.getUTCFullYear() % 100, Qt, 2);
}
function formatUTCYearISO(_e, Qt) {
  return _e = UTCdISO(_e), pad(_e.getUTCFullYear() % 100, Qt, 2);
}
function formatUTCFullYear(_e, Qt) {
  return pad(_e.getUTCFullYear() % 1e4, Qt, 4);
}
function formatUTCFullYearISO(_e, Qt) {
  var Zt = _e.getUTCDay();
  return _e = Zt >= 4 || Zt === 0 ? utcThursday(_e) : utcThursday.ceil(_e), pad(_e.getUTCFullYear() % 1e4, Qt, 4);
}
function formatUTCZone() {
  return "+0000";
}
function formatLiteralPercent() {
  return "%";
}
function formatUnixTimestamp(_e) {
  return +_e;
}
function formatUnixTimestampSeconds(_e) {
  return Math.floor(+_e / 1e3);
}
var locale$1, timeFormat$2, timeParse$1, utcFormat$1, utcParse$1;
defaultLocale$1({
  dateTime: "%x, %X",
  date: "%-m/%-d/%Y",
  time: "%-I:%M:%S %p",
  periods: ["AM", "PM"],
  days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
  shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
});
function defaultLocale$1(_e) {
  return locale$1 = formatLocale(_e), timeFormat$2 = locale$1.format, timeParse$1 = locale$1.parse, utcFormat$1 = locale$1.utcFormat, utcParse$1 = locale$1.utcParse, locale$1;
}
function memoize(_e) {
  const Qt = {};
  return (Zt) => Qt[Zt] || (Qt[Zt] = _e(Zt));
}
function trimZeroes(_e, Qt) {
  return (Zt) => {
    const $n = _e(Zt), Sn = $n.indexOf(Qt);
    if (Sn < 0)
      return $n;
    let kn = rightmostDigit($n, Sn);
    const Kn = kn < $n.length ? $n.slice(kn) : "";
    for (; --kn > Sn; )
      if ($n[kn] !== "0") {
        ++kn;
        break;
      }
    return $n.slice(0, kn) + Kn;
  };
}
function rightmostDigit(_e, Qt) {
  let Zt = _e.lastIndexOf("e"), $n;
  if (Zt > 0)
    return Zt;
  for (Zt = _e.length; --Zt > Qt; )
    if ($n = _e.charCodeAt(Zt), $n >= 48 && $n <= 57)
      return Zt + 1;
}
function numberLocale(_e) {
  const Qt = memoize(_e.format), Zt = _e.formatPrefix;
  return {
    format: Qt,
    formatPrefix: Zt,
    formatFloat($n) {
      const Sn = formatSpecifier($n || ",");
      if (Sn.precision == null) {
        switch (Sn.precision = 12, Sn.type) {
          case "%":
            Sn.precision -= 2;
            break;
          case "e":
            Sn.precision -= 1;
            break;
        }
        return trimZeroes(
          Qt(Sn),
          // number format
          Qt(".1f")(1)[1]
          // decimal point character
        );
      } else
        return Qt(Sn);
    },
    formatSpan($n, Sn, kn, Kn) {
      Kn = formatSpecifier(Kn ?? ",f");
      const er = tickStep($n, Sn, kn), Cr = Math.max(Math.abs($n), Math.abs(Sn));
      let kr;
      if (Kn.precision == null)
        switch (Kn.type) {
          case "s":
            return isNaN(kr = precisionPrefix(er, Cr)) || (Kn.precision = kr), Zt(Kn, Cr);
          case "":
          case "e":
          case "g":
          case "p":
          case "r": {
            isNaN(kr = precisionRound(er, Cr)) || (Kn.precision = kr - (Kn.type === "e"));
            break;
          }
          case "f":
          case "%": {
            isNaN(kr = precisionFixed(er)) || (Kn.precision = kr - (Kn.type === "%") * 2);
            break;
          }
        }
      return Qt(Kn);
    }
  };
}
let defaultNumberLocale;
resetNumberFormatDefaultLocale();
function resetNumberFormatDefaultLocale() {
  return defaultNumberLocale = numberLocale({
    format: format$3,
    formatPrefix
  });
}
function numberFormatLocale(_e) {
  return numberLocale(formatLocale$1(_e));
}
function numberFormatDefaultLocale(_e) {
  return arguments.length ? defaultNumberLocale = numberFormatLocale(_e) : defaultNumberLocale;
}
function timeMultiFormat(_e, Qt, Zt) {
  Zt = Zt || {}, isObject(Zt) || error(`Invalid time multi-format specifier: ${Zt}`);
  const $n = Qt(SECONDS), Sn = Qt(MINUTES), kn = Qt(HOURS), Kn = Qt(DATE), er = Qt(WEEK), Cr = Qt(MONTH), kr = Qt(QUARTER), Yr = Qt(YEAR), Ms = _e(Zt[MILLISECONDS] || ".%L"), Ds = _e(Zt[SECONDS] || ":%S"), Ls = _e(Zt[MINUTES] || "%I:%M"), js = _e(Zt[HOURS] || "%I %p"), zs = _e(Zt[DATE] || Zt[DAY] || "%a %d"), Fs = _e(Zt[WEEK] || "%b %d"), Bs = _e(Zt[MONTH] || "%B"), Hs = _e(Zt[QUARTER] || "%B"), Ws = _e(Zt[YEAR] || "%Y");
  return (Ys) => ($n(Ys) < Ys ? Ms : Sn(Ys) < Ys ? Ds : kn(Ys) < Ys ? Ls : Kn(Ys) < Ys ? js : Cr(Ys) < Ys ? er(Ys) < Ys ? zs : Fs : Yr(Ys) < Ys ? kr(Ys) < Ys ? Bs : Hs : Ws)(Ys);
}
function timeLocale(_e) {
  const Qt = memoize(_e.format), Zt = memoize(_e.utcFormat);
  return {
    timeFormat: ($n) => isString($n) ? Qt($n) : timeMultiFormat(Qt, timeInterval, $n),
    utcFormat: ($n) => isString($n) ? Zt($n) : timeMultiFormat(Zt, utcInterval, $n),
    timeParse: memoize(_e.parse),
    utcParse: memoize(_e.utcParse)
  };
}
let defaultTimeLocale;
resetTimeFormatDefaultLocale();
function resetTimeFormatDefaultLocale() {
  return defaultTimeLocale = timeLocale({
    format: timeFormat$2,
    parse: timeParse$1,
    utcFormat: utcFormat$1,
    utcParse: utcParse$1
  });
}
function timeFormatLocale(_e) {
  return timeLocale(formatLocale(_e));
}
function timeFormatDefaultLocale(_e) {
  return arguments.length ? defaultTimeLocale = timeFormatLocale(_e) : defaultTimeLocale;
}
const createLocale = (_e, Qt) => extend$1({}, _e, Qt);
function locale(_e, Qt) {
  const Zt = _e ? numberFormatLocale(_e) : numberFormatDefaultLocale(), $n = Qt ? timeFormatLocale(Qt) : timeFormatDefaultLocale();
  return createLocale(Zt, $n);
}
function defaultLocale(_e, Qt) {
  const Zt = arguments.length;
  return Zt && Zt !== 2 && error("defaultLocale expects either zero or two arguments."), Zt ? createLocale(numberFormatDefaultLocale(_e), timeFormatDefaultLocale(Qt)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale());
}
function resetDefaultLocale() {
  return resetNumberFormatDefaultLocale(), resetTimeFormatDefaultLocale(), defaultLocale();
}
const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/, allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i, whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g, fileProtocol = "file://";
function loaderFactory(_e, Qt) {
  return (Zt) => ({
    options: Zt || {},
    sanitize,
    load: load$1,
    fileAccess: !!Qt,
    file: fileLoader(Qt),
    http: httpLoader(_e)
  });
}
async function load$1(_e, Qt) {
  const Zt = await this.sanitize(_e, Qt), $n = Zt.href;
  return Zt.localFile ? this.file($n) : this.http($n, Qt);
}
async function sanitize(_e, Qt) {
  Qt = extend$1({}, this.options, Qt);
  const Zt = this.fileAccess, $n = {
    href: null
  };
  let Sn, kn, Kn;
  const er = allowed_re.test(_e.replace(whitespace_re, ""));
  (_e == null || typeof _e != "string" || !er) && error("Sanitize failure, invalid URI: " + $(_e));
  const Cr = protocol_re.test(_e);
  return (Kn = Qt.baseURL) && !Cr && (!_e.startsWith("/") && !Kn.endsWith("/") && (_e = "/" + _e), _e = Kn + _e), kn = (Sn = _e.startsWith(fileProtocol)) || Qt.mode === "file" || Qt.mode !== "http" && !Cr && Zt, Sn ? _e = _e.slice(fileProtocol.length) : _e.startsWith("//") && (Qt.defaultProtocol === "file" ? (_e = _e.slice(2), kn = !0) : _e = (Qt.defaultProtocol || "http") + ":" + _e), Object.defineProperty($n, "localFile", {
    value: !!kn
  }), $n.href = _e, Qt.target && ($n.target = Qt.target + ""), Qt.rel && ($n.rel = Qt.rel + ""), Qt.context === "image" && Qt.crossOrigin && ($n.crossOrigin = Qt.crossOrigin + ""), $n;
}
function fileLoader(_e) {
  return _e ? (Qt) => new Promise((Zt, $n) => {
    _e.readFile(Qt, (Sn, kn) => {
      Sn ? $n(Sn) : Zt(kn);
    });
  }) : fileReject;
}
async function fileReject() {
  error("No file system access.");
}
function httpLoader(_e) {
  return _e ? async function(Qt, Zt) {
    const $n = extend$1({}, this.options.http, Zt), Sn = Zt && Zt.response, kn = await _e(Qt, $n);
    return kn.ok ? isFunction$1(kn[Sn]) ? kn[Sn]() : kn.text() : error(kn.status + "" + kn.statusText);
  } : httpReject;
}
async function httpReject() {
  error("No HTTP fetch method available.");
}
const isValid = (_e) => _e != null && _e === _e, isBoolean = (_e) => _e === "true" || _e === "false" || _e === !0 || _e === !1, isDate = (_e) => !Number.isNaN(Date.parse(_e)), isNumber = (_e) => !Number.isNaN(+_e) && !(_e instanceof Date), isInteger$1 = (_e) => isNumber(_e) && Number.isInteger(+_e), typeParsers = {
  boolean: toBoolean,
  integer: toNumber,
  number: toNumber,
  date: toDate,
  string: toString,
  unknown: identity$7
}, typeTests = [isBoolean, isInteger$1, isNumber, isDate], typeList = ["boolean", "integer", "number", "date"];
function inferType(_e, Qt) {
  if (!_e || !_e.length)
    return "unknown";
  const Zt = _e.length, $n = typeTests.length, Sn = typeTests.map((kn, Kn) => Kn + 1);
  for (let kn = 0, Kn = 0, er, Cr; kn < Zt; ++kn)
    for (Cr = Qt ? _e[kn][Qt] : _e[kn], er = 0; er < $n; ++er)
      if (Sn[er] && isValid(Cr) && !typeTests[er](Cr) && (Sn[er] = 0, ++Kn, Kn === typeTests.length))
        return "string";
  return typeList[Sn.reduce((kn, Kn) => kn === 0 ? Kn : kn, 0) - 1];
}
function inferTypes(_e, Qt) {
  return Qt.reduce((Zt, $n) => (Zt[$n] = inferType(_e, $n), Zt), {});
}
function delimitedFormat(_e) {
  const Qt = function(Zt, $n) {
    const Sn = {
      delimiter: _e
    };
    return dsv(Zt, $n ? extend$1($n, Sn) : Sn);
  };
  return Qt.responseType = "text", Qt;
}
function dsv(_e, Qt) {
  return Qt.header && (_e = Qt.header.map($).join(Qt.delimiter) + `
` + _e), dsvFormat(Qt.delimiter).parse(_e + "");
}
dsv.responseType = "text";
function isBuffer(_e) {
  return typeof Buffer == "function" && isFunction$1(Buffer.isBuffer) ? Buffer.isBuffer(_e) : !1;
}
function json(_e, Qt) {
  const Zt = Qt && Qt.property ? field$1(Qt.property) : identity$7;
  return isObject(_e) && !isBuffer(_e) ? parseJSON(Zt(_e), Qt) : Zt(JSON.parse(_e));
}
json.responseType = "json";
function parseJSON(_e, Qt) {
  return !isArray(_e) && isIterable(_e) && (_e = [..._e]), Qt && Qt.copy ? JSON.parse(JSON.stringify(_e)) : _e;
}
const filters = {
  interior: (_e, Qt) => _e !== Qt,
  exterior: (_e, Qt) => _e === Qt
};
function topojson(_e, Qt) {
  let Zt, $n, Sn, kn;
  return _e = json(_e, Qt), Qt && Qt.feature ? (Zt = feature, Sn = Qt.feature) : Qt && Qt.mesh ? (Zt = mesh, Sn = Qt.mesh, kn = filters[Qt.filter]) : error("Missing TopoJSON feature or mesh parameter."), $n = ($n = _e.objects[Sn]) ? Zt(_e, $n, kn) : error("Invalid TopoJSON object: " + Sn), $n && $n.features || [$n];
}
topojson.responseType = "json";
const format$2 = {
  dsv,
  csv: delimitedFormat(","),
  tsv: delimitedFormat("	"),
  json,
  topojson
};
function formats$1(_e, Qt) {
  return arguments.length > 1 ? (format$2[_e] = Qt, this) : has$1(format$2, _e) ? format$2[_e] : null;
}
function responseType(_e) {
  const Qt = formats$1(_e);
  return Qt && Qt.responseType || "text";
}
function read(_e, Qt, Zt, $n) {
  Qt = Qt || {};
  const Sn = formats$1(Qt.type || "json");
  return Sn || error("Unknown data format type: " + Qt.type), _e = Sn(_e, Qt), Qt.parse && parse$7(_e, Qt.parse, Zt, $n), has$1(_e, "columns") && delete _e.columns, _e;
}
function parse$7(_e, Qt, Zt, $n) {
  if (!_e.length)
    return;
  const Sn = timeFormatDefaultLocale();
  Zt = Zt || Sn.timeParse, $n = $n || Sn.utcParse;
  let kn = _e.columns || Object.keys(_e[0]), Kn, er, Cr, kr, Yr, Ms;
  Qt === "auto" && (Qt = inferTypes(_e, kn)), kn = Object.keys(Qt);
  const Ds = kn.map((Ls) => {
    const js = Qt[Ls];
    let zs, Fs;
    if (js && (js.startsWith("date:") || js.startsWith("utc:")))
      return zs = js.split(/:(.+)?/, 2), Fs = zs[1], (Fs[0] === "'" && Fs[Fs.length - 1] === "'" || Fs[0] === '"' && Fs[Fs.length - 1] === '"') && (Fs = Fs.slice(1, -1)), (zs[0] === "utc" ? $n : Zt)(Fs);
    if (!typeParsers[js])
      throw Error("Illegal format pattern: " + Ls + ":" + js);
    return typeParsers[js];
  });
  for (Cr = 0, Yr = _e.length, Ms = kn.length; Cr < Yr; ++Cr)
    for (Kn = _e[Cr], kr = 0; kr < Ms; ++kr)
      er = kn[kr], Kn[er] = Ds[kr](Kn[er]);
}
const loader = loaderFactory(
  typeof fetch < "u" && fetch,
  // use built-in fetch API
  null
  // no file system access
);
function UniqueList(_e) {
  const Qt = _e || identity$7, Zt = [], $n = {};
  return Zt.add = (Sn) => {
    const kn = Qt(Sn);
    return $n[kn] || ($n[kn] = 1, Zt.push(Sn)), Zt;
  }, Zt.remove = (Sn) => {
    const kn = Qt(Sn);
    if ($n[kn]) {
      $n[kn] = 0;
      const Kn = Zt.indexOf(Sn);
      Kn >= 0 && Zt.splice(Kn, 1);
    }
    return Zt;
  }, Zt;
}
async function asyncCallback(_e, Qt) {
  try {
    await Qt(_e);
  } catch (Zt) {
    _e.error(Zt);
  }
}
const TUPLE_ID_KEY = Symbol("vega_id");
let TUPLE_ID = 1;
function isTuple(_e) {
  return !!(_e && tupleid(_e));
}
function tupleid(_e) {
  return _e[TUPLE_ID_KEY];
}
function setid(_e, Qt) {
  return _e[TUPLE_ID_KEY] = Qt, _e;
}
function ingest$1(_e) {
  const Qt = _e === Object(_e) ? _e : {
    data: _e
  };
  return tupleid(Qt) ? Qt : setid(Qt, TUPLE_ID++);
}
function derive(_e) {
  return rederive(_e, ingest$1({}));
}
function rederive(_e, Qt) {
  for (const Zt in _e)
    Qt[Zt] = _e[Zt];
  return Qt;
}
function replace$1(_e, Qt) {
  return setid(Qt, tupleid(_e));
}
function stableCompare(_e, Qt) {
  return _e ? Qt ? (Zt, $n) => _e(Zt, $n) || tupleid(Qt(Zt)) - tupleid(Qt($n)) : (Zt, $n) => _e(Zt, $n) || tupleid(Zt) - tupleid($n) : null;
}
function isChangeSet(_e) {
  return _e && _e.constructor === changeset;
}
function changeset() {
  const _e = [], Qt = [], Zt = [], $n = [], Sn = [];
  let kn = null, Kn = !1;
  return {
    constructor: changeset,
    insert(er) {
      const Cr = array$6(er), kr = Cr.length;
      for (let Yr = 0; Yr < kr; ++Yr)
        _e.push(Cr[Yr]);
      return this;
    },
    remove(er) {
      const Cr = isFunction$1(er) ? $n : Qt, kr = array$6(er), Yr = kr.length;
      for (let Ms = 0; Ms < Yr; ++Ms)
        Cr.push(kr[Ms]);
      return this;
    },
    modify(er, Cr, kr) {
      const Yr = {
        field: Cr,
        value: constant$7(kr)
      };
      return isFunction$1(er) ? (Yr.filter = er, Sn.push(Yr)) : (Yr.tuple = er, Zt.push(Yr)), this;
    },
    encode(er, Cr) {
      return isFunction$1(er) ? Sn.push({
        filter: er,
        field: Cr
      }) : Zt.push({
        tuple: er,
        field: Cr
      }), this;
    },
    clean(er) {
      return kn = er, this;
    },
    reflow() {
      return Kn = !0, this;
    },
    pulse(er, Cr) {
      const kr = {}, Yr = {};
      let Ms, Ds, Ls, js, zs, Fs;
      for (Ms = 0, Ds = Cr.length; Ms < Ds; ++Ms)
        kr[tupleid(Cr[Ms])] = 1;
      for (Ms = 0, Ds = Qt.length; Ms < Ds; ++Ms)
        zs = Qt[Ms], kr[tupleid(zs)] = -1;
      for (Ms = 0, Ds = $n.length; Ms < Ds; ++Ms)
        js = $n[Ms], Cr.forEach((Hs) => {
          js(Hs) && (kr[tupleid(Hs)] = -1);
        });
      for (Ms = 0, Ds = _e.length; Ms < Ds; ++Ms)
        zs = _e[Ms], Fs = tupleid(zs), kr[Fs] ? kr[Fs] = 1 : er.add.push(ingest$1(_e[Ms]));
      for (Ms = 0, Ds = Cr.length; Ms < Ds; ++Ms)
        zs = Cr[Ms], kr[tupleid(zs)] < 0 && er.rem.push(zs);
      function Bs(Hs, Ws, Ys) {
        Ys ? Hs[Ws] = Ys(Hs) : er.encode = Ws, Kn || (Yr[tupleid(Hs)] = Hs);
      }
      for (Ms = 0, Ds = Zt.length; Ms < Ds; ++Ms)
        Ls = Zt[Ms], zs = Ls.tuple, js = Ls.field, Fs = kr[tupleid(zs)], Fs > 0 && (Bs(zs, js, Ls.value), er.modifies(js));
      for (Ms = 0, Ds = Sn.length; Ms < Ds; ++Ms)
        Ls = Sn[Ms], js = Ls.filter, Cr.forEach((Hs) => {
          js(Hs) && kr[tupleid(Hs)] > 0 && Bs(Hs, Ls.field, Ls.value);
        }), er.modifies(Ls.field);
      if (Kn)
        er.mod = Qt.length || $n.length ? Cr.filter((Hs) => kr[tupleid(Hs)] > 0) : Cr.slice();
      else
        for (Fs in Yr)
          er.mod.push(Yr[Fs]);
      return (kn || kn == null && (Qt.length || $n.length)) && er.clean(!0), er;
    }
  };
}
const CACHE$1 = "_:mod:_";
function Parameters() {
  Object.defineProperty(this, CACHE$1, {
    writable: !0,
    value: {}
  });
}
Parameters.prototype = {
  /**
   * Set a parameter value. If the parameter value changes, the parameter
   * will be recorded as modified.
   * @param {string} name - The parameter name.
   * @param {number} index - The index into an array-value parameter. Ignored if
   *   the argument is undefined, null or less than zero.
   * @param {*} value - The parameter value to set.
   * @param {boolean} [force=false] - If true, records the parameter as modified
   *   even if the value is unchanged.
   * @return {Parameters} - This parameter object.
   */
  set(_e, Qt, Zt, $n) {
    const Sn = this, kn = Sn[_e], Kn = Sn[CACHE$1];
    return Qt != null && Qt >= 0 ? (kn[Qt] !== Zt || $n) && (kn[Qt] = Zt, Kn[Qt + ":" + _e] = -1, Kn[_e] = -1) : (kn !== Zt || $n) && (Sn[_e] = Zt, Kn[_e] = isArray(Zt) ? 1 + Zt.length : -1), Sn;
  },
  /**
   * Tests if one or more parameters has been modified. If invoked with no
   * arguments, returns true if any parameter value has changed. If the first
   * argument is array, returns trues if any parameter name in the array has
   * changed. Otherwise, tests if the given name and optional array index has
   * changed.
   * @param {string} name - The parameter name to test.
   * @param {number} [index=undefined] - The parameter array index to test.
   * @return {boolean} - Returns true if a queried parameter was modified.
   */
  modified(_e, Qt) {
    const Zt = this[CACHE$1];
    if (arguments.length) {
      if (isArray(_e)) {
        for (let $n = 0; $n < _e.length; ++$n)
          if (Zt[_e[$n]])
            return !0;
        return !1;
      }
    } else {
      for (const $n in Zt)
        if (Zt[$n])
          return !0;
      return !1;
    }
    return Qt != null && Qt >= 0 ? Qt + 1 < Zt[_e] || !!Zt[Qt + ":" + _e] : !!Zt[_e];
  },
  /**
   * Clears the modification records. After calling this method,
   * all parameters are considered unmodified.
   */
  clear() {
    return this[CACHE$1] = {}, this;
  }
};
let OP_ID = 0;
const PULSE = "pulse", NO_PARAMS = new Parameters(), SKIP$1$1 = 1, MODIFIED = 2;
function Operator(_e, Qt, Zt, $n) {
  this.id = ++OP_ID, this.value = _e, this.stamp = -1, this.rank = -1, this.qrank = -1, this.flags = 0, Qt && (this._update = Qt), Zt && this.parameters(Zt, $n);
}
function flag(_e) {
  return function(Qt) {
    const Zt = this.flags;
    return arguments.length === 0 ? !!(Zt & _e) : (this.flags = Qt ? Zt | _e : Zt & ~_e, this);
  };
}
Operator.prototype = {
  /**
   * Returns a list of target operators dependent on this operator.
   * If this list does not exist, it is created and then returned.
   * @return {UniqueList}
   */
  targets() {
    return this._targets || (this._targets = UniqueList(id$2));
  },
  /**
   * Sets the value of this operator.
   * @param {*} value - the value to set.
   * @return {Number} Returns 1 if the operator value has changed
   *   according to strict equality, returns 0 otherwise.
   */
  set(_e) {
    return this.value !== _e ? (this.value = _e, 1) : 0;
  },
  /**
   * Indicates that operator evaluation should be skipped on the next pulse.
   * This operator will still propagate incoming pulses, but its update function
   * will not be invoked. The skip flag is reset after every pulse, so calling
   * this method will affect processing of the next pulse only.
   */
  skip: flag(SKIP$1$1),
  /**
   * Indicates that this operator's value has been modified on its most recent
   * pulse. Normally modification is checked via strict equality; however, in
   * some cases it is more efficient to update the internal state of an object.
   * In those cases, the modified flag can be used to trigger propagation. Once
   * set, the modification flag persists across pulses until unset. The flag can
   * be used with the last timestamp to test if a modification is recent.
   */
  modified: flag(MODIFIED),
  /**
   * Sets the parameters for this operator. The parameter values are analyzed for
   * operator instances. If found, this operator will be added as a dependency
   * of the parameterizing operator. Operator values are dynamically marshalled
   * from each operator parameter prior to evaluation. If a parameter value is
   * an array, the array will also be searched for Operator instances. However,
   * the search does not recurse into sub-arrays or object properties.
   * @param {object} params - A hash of operator parameters.
   * @param {boolean} [react=true] - A flag indicating if this operator should
   *   automatically update (react) when parameter values change. In other words,
   *   this flag determines if the operator registers itself as a listener on
   *   any upstream operators included in the parameters.
   * @param {boolean} [initonly=false] - A flag indicating if this operator
   *   should calculate an update only upon its initial evaluation, then
   *   deregister dependencies and suppress all future update invocations.
   * @return {Operator[]} - An array of upstream dependencies.
   */
  parameters(_e, Qt, Zt) {
    Qt = Qt !== !1;
    const $n = this._argval = this._argval || new Parameters(), Sn = this._argops = this._argops || [], kn = [];
    let Kn, er, Cr, kr;
    const Yr = (Ms, Ds, Ls) => {
      Ls instanceof Operator ? (Ls !== this && (Qt && Ls.targets().add(this), kn.push(Ls)), Sn.push({
        op: Ls,
        name: Ms,
        index: Ds
      })) : $n.set(Ms, Ds, Ls);
    };
    for (Kn in _e)
      if (er = _e[Kn], Kn === PULSE)
        array$6(er).forEach((Ms) => {
          Ms instanceof Operator ? Ms !== this && (Ms.targets().add(this), kn.push(Ms)) : error("Pulse parameters must be operator instances.");
        }), this.source = er;
      else if (isArray(er))
        for ($n.set(Kn, -1, Array(Cr = er.length)), kr = 0; kr < Cr; ++kr)
          Yr(Kn, kr, er[kr]);
      else
        Yr(Kn, -1, er);
    return this.marshall().clear(), Zt && (Sn.initonly = !0), kn;
  },
  /**
   * Internal method for marshalling parameter values.
   * Visits each operator dependency to pull the latest value.
   * @return {Parameters} A Parameters object to pass to the update function.
   */
  marshall(_e) {
    const Qt = this._argval || NO_PARAMS, Zt = this._argops;
    let $n, Sn, kn, Kn;
    if (Zt) {
      const er = Zt.length;
      for (Sn = 0; Sn < er; ++Sn)
        $n = Zt[Sn], kn = $n.op, Kn = kn.modified() && kn.stamp === _e, Qt.set($n.name, $n.index, kn.value, Kn);
      if (Zt.initonly) {
        for (Sn = 0; Sn < er; ++Sn)
          $n = Zt[Sn], $n.op.targets().remove(this);
        this._argops = null, this._update = null;
      }
    }
    return Qt;
  },
  /**
   * Detach this operator from the dataflow.
   * Unregisters listeners on upstream dependencies.
   */
  detach() {
    const _e = this._argops;
    let Qt, Zt, $n, Sn;
    if (_e)
      for (Qt = 0, Zt = _e.length; Qt < Zt; ++Qt)
        $n = _e[Qt], Sn = $n.op, Sn._targets && Sn._targets.remove(this);
    this.pulse = null, this.source = null;
  },
  /**
   * Delegate method to perform operator processing.
   * Subclasses can override this method to perform custom processing.
   * By default, it marshalls parameters and calls the update function
   * if that function is defined. If the update function does not
   * change the operator value then StopPropagation is returned.
   * If no update function is defined, this method does nothing.
   * @param {Pulse} pulse - the current dataflow pulse.
   * @return The output pulse or StopPropagation. A falsy return value
   *   (including undefined) will let the input pulse pass through.
   */
  evaluate(_e) {
    const Qt = this._update;
    if (Qt) {
      const Zt = this.marshall(_e.stamp), $n = Qt.call(this, Zt, _e);
      if (Zt.clear(), $n !== this.value)
        this.value = $n;
      else if (!this.modified())
        return _e.StopPropagation;
    }
  },
  /**
   * Run this operator for the current pulse. If this operator has already
   * been run at (or after) the pulse timestamp, returns StopPropagation.
   * Internally, this method calls {@link evaluate} to perform processing.
   * If {@link evaluate} returns a falsy value, the input pulse is returned.
   * This method should NOT be overridden, instead overrride {@link evaluate}.
   * @param {Pulse} pulse - the current dataflow pulse.
   * @return the output pulse for this operator (or StopPropagation)
   */
  run(_e) {
    if (_e.stamp < this.stamp)
      return _e.StopPropagation;
    let Qt;
    return this.skip() ? (this.skip(!1), Qt = 0) : Qt = this.evaluate(_e), this.pulse = Qt || _e;
  }
};
function add$5(_e, Qt, Zt, $n) {
  let Sn = 1, kn;
  return _e instanceof Operator ? kn = _e : _e && _e.prototype instanceof Operator ? kn = new _e() : isFunction$1(_e) ? kn = new Operator(null, _e) : (Sn = 0, kn = new Operator(_e, Qt)), this.rank(kn), Sn && ($n = Zt, Zt = Qt), Zt && this.connect(kn, kn.parameters(Zt, $n)), this.touch(kn), kn;
}
function connect$1(_e, Qt) {
  const Zt = _e.rank, $n = Qt.length;
  for (let Sn = 0; Sn < $n; ++Sn)
    if (Zt < Qt[Sn].rank) {
      this.rerank(_e);
      return;
    }
}
let STREAM_ID = 0;
function EventStream(_e, Qt, Zt) {
  this.id = ++STREAM_ID, this.value = null, Zt && (this.receive = Zt), _e && (this._filter = _e), Qt && (this._apply = Qt);
}
function stream(_e, Qt, Zt) {
  return new EventStream(_e, Qt, Zt);
}
EventStream.prototype = {
  _filter: truthy,
  _apply: identity$7,
  targets() {
    return this._targets || (this._targets = UniqueList(id$2));
  },
  consume(_e) {
    return arguments.length ? (this._consume = !!_e, this) : !!this._consume;
  },
  receive(_e) {
    if (this._filter(_e)) {
      const Qt = this.value = this._apply(_e), Zt = this._targets, $n = Zt ? Zt.length : 0;
      for (let Sn = 0; Sn < $n; ++Sn)
        Zt[Sn].receive(Qt);
      this._consume && (_e.preventDefault(), _e.stopPropagation());
    }
  },
  filter(_e) {
    const Qt = stream(_e);
    return this.targets().add(Qt), Qt;
  },
  apply(_e) {
    const Qt = stream(null, _e);
    return this.targets().add(Qt), Qt;
  },
  merge() {
    const _e = stream();
    this.targets().add(_e);
    for (let Qt = 0, Zt = arguments.length; Qt < Zt; ++Qt)
      arguments[Qt].targets().add(_e);
    return _e;
  },
  throttle(_e) {
    let Qt = -1;
    return this.filter(() => {
      const Zt = Date.now();
      return Zt - Qt > _e ? (Qt = Zt, 1) : 0;
    });
  },
  debounce(_e) {
    const Qt = stream();
    return this.targets().add(stream(null, null, debounce(_e, (Zt) => {
      const $n = Zt.dataflow;
      Qt.receive(Zt), $n && $n.run && $n.run();
    }))), Qt;
  },
  between(_e, Qt) {
    let Zt = !1;
    return _e.targets().add(stream(null, null, () => Zt = !0)), Qt.targets().add(stream(null, null, () => Zt = !1)), this.filter(() => Zt);
  },
  detach() {
    this._filter = truthy, this._targets = null;
  }
};
function events$1(_e, Qt, Zt, $n) {
  const Sn = this, kn = stream(Zt, $n), Kn = function(kr) {
    kr.dataflow = Sn;
    try {
      kn.receive(kr);
    } catch (Yr) {
      Sn.error(Yr);
    } finally {
      Sn.run();
    }
  };
  let er;
  typeof _e == "string" && typeof document < "u" ? er = document.querySelectorAll(_e) : er = array$6(_e);
  const Cr = er.length;
  for (let kr = 0; kr < Cr; ++kr)
    er[kr].addEventListener(Qt, Kn);
  return kn;
}
function parse$6(_e, Qt) {
  const Zt = this.locale();
  return read(_e, Qt, Zt.timeParse, Zt.utcParse);
}
function ingest(_e, Qt, Zt) {
  return Qt = this.parse(Qt, Zt), this.pulse(_e, this.changeset().insert(Qt));
}
async function request(_e, Qt) {
  const Zt = this;
  let $n = 0, Sn;
  try {
    Sn = await Zt.loader().load(_e, {
      context: "dataflow",
      response: responseType(Qt && Qt.type)
    });
    try {
      Sn = Zt.parse(Sn, Qt);
    } catch (kn) {
      $n = -2, Zt.warn("Data ingestion failed", _e, kn);
    }
  } catch (kn) {
    $n = -1, Zt.warn("Loading failed", _e, kn);
  }
  return {
    data: Sn,
    status: $n
  };
}
async function preload(_e, Qt, Zt) {
  const $n = this, Sn = $n._pending || loadPending($n);
  Sn.requests += 1;
  const kn = await $n.request(Qt, Zt);
  return $n.pulse(_e, $n.changeset().remove(truthy).insert(kn.data || [])), Sn.done(), kn;
}
function loadPending(_e) {
  let Qt;
  const Zt = new Promise(($n) => Qt = $n);
  return Zt.requests = 0, Zt.done = () => {
    --Zt.requests === 0 && (_e._pending = null, Qt(_e));
  }, _e._pending = Zt;
}
const SKIP$2 = {
  skip: !0
};
function on$1(_e, Qt, Zt, $n, Sn) {
  return (_e instanceof Operator ? onOperator : onStream)(this, _e, Qt, Zt, $n, Sn), this;
}
function onStream(_e, Qt, Zt, $n, Sn, kn) {
  const Kn = extend$1({}, kn, SKIP$2);
  let er, Cr;
  isFunction$1(Zt) || (Zt = constant$7(Zt)), $n === void 0 ? er = (kr) => _e.touch(Zt(kr)) : isFunction$1($n) ? (Cr = new Operator(null, $n, Sn, !1), er = (kr) => {
    Cr.evaluate(kr);
    const Yr = Zt(kr), Ms = Cr.value;
    isChangeSet(Ms) ? _e.pulse(Yr, Ms, kn) : _e.update(Yr, Ms, Kn);
  }) : er = (kr) => _e.update(Zt(kr), $n, Kn), Qt.apply(er);
}
function onOperator(_e, Qt, Zt, $n, Sn, kn) {
  if ($n === void 0)
    Qt.targets().add(Zt);
  else {
    const Kn = kn || {}, er = new Operator(null, updater(Zt, $n), Sn, !1);
    er.modified(Kn.force), er.rank = Qt.rank, Qt.targets().add(er), Zt && (er.skip(!0), er.value = Zt.value, er.targets().add(Zt), _e.connect(Zt, [er]));
  }
}
function updater(_e, Qt) {
  return Qt = isFunction$1(Qt) ? Qt : constant$7(Qt), _e ? function(Zt, $n) {
    const Sn = Qt(Zt, $n);
    return _e.skip() || (_e.skip(Sn !== this.value).value = Sn), Sn;
  } : Qt;
}
function rank(_e) {
  _e.rank = ++this._rank;
}
function rerank(_e) {
  const Qt = [_e];
  let Zt, $n, Sn;
  for (; Qt.length; )
    if (this.rank(Zt = Qt.pop()), $n = Zt._targets)
      for (Sn = $n.length; --Sn >= 0; )
        Qt.push(Zt = $n[Sn]), Zt === _e && error("Cycle detected in dataflow graph.");
}
const StopPropagation = {}, ADD = 1, REM = 2, MOD$1 = 4, ADD_REM = ADD | REM, ADD_MOD = ADD | MOD$1, ALL = ADD | REM | MOD$1, REFLOW = 8, SOURCE = 16, NO_SOURCE = 32, NO_FIELDS = 64;
function Pulse(_e, Qt, Zt) {
  this.dataflow = _e, this.stamp = Qt ?? -1, this.add = [], this.rem = [], this.mod = [], this.fields = null, this.encode = Zt || null;
}
function materialize(_e, Qt) {
  const Zt = [];
  return visitArray(_e, Qt, ($n) => Zt.push($n)), Zt;
}
function filter$2(_e, Qt) {
  const Zt = {};
  return _e.visit(Qt, ($n) => {
    Zt[tupleid($n)] = 1;
  }), ($n) => Zt[tupleid($n)] ? null : $n;
}
function addFilter(_e, Qt) {
  return _e ? (Zt, $n) => _e(Zt, $n) && Qt(Zt, $n) : Qt;
}
Pulse.prototype = {
  /**
   * Sentinel value indicating pulse propagation should stop.
   */
  StopPropagation,
  /**
   * Boolean flag indicating ADD (added) tuples.
   */
  ADD,
  /**
   * Boolean flag indicating REM (removed) tuples.
   */
  REM,
  /**
   * Boolean flag indicating MOD (modified) tuples.
   */
  MOD: MOD$1,
  /**
   * Boolean flag indicating ADD (added) and REM (removed) tuples.
   */
  ADD_REM,
  /**
   * Boolean flag indicating ADD (added) and MOD (modified) tuples.
   */
  ADD_MOD,
  /**
   * Boolean flag indicating ADD, REM and MOD tuples.
   */
  ALL,
  /**
   * Boolean flag indicating all tuples in a data source
   * except for the ADD, REM and MOD tuples.
   */
  REFLOW,
  /**
   * Boolean flag indicating a 'pass-through' to a
   * backing data source, ignoring ADD, REM and MOD tuples.
   */
  SOURCE,
  /**
   * Boolean flag indicating that source data should be
   * suppressed when creating a forked pulse.
   */
  NO_SOURCE,
  /**
   * Boolean flag indicating that field modifications should be
   * suppressed when creating a forked pulse.
   */
  NO_FIELDS,
  /**
   * Creates a new pulse based on the values of this pulse.
   * The dataflow, time stamp and field modification values are copied over.
   * By default, new empty ADD, REM and MOD arrays are created.
   * @param {number} flags - Integer of boolean flags indicating which (if any)
   *   tuple arrays should be copied to the new pulse. The supported flag values
   *   are ADD, REM and MOD. Array references are copied directly: new array
   *   instances are not created.
   * @return {Pulse} - The forked pulse instance.
   * @see init
   */
  fork(_e) {
    return new Pulse(this.dataflow).init(this, _e);
  },
  /**
   * Creates a copy of this pulse with new materialized array
   * instances for the ADD, REM, MOD, and SOURCE arrays.
   * The dataflow, time stamp and field modification values are copied over.
   * @return {Pulse} - The cloned pulse instance.
   * @see init
   */
  clone() {
    const _e = this.fork(ALL);
    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(ALL | SOURCE);
  },
  /**
   * Returns a pulse that adds all tuples from a backing source. This is
   * useful for cases where operators are added to a dataflow after an
   * upstream data pipeline has already been processed, ensuring that
   * new operators can observe all tuples within a stream.
   * @return {Pulse} - A pulse instance with all source tuples included
   *   in the add array. If the current pulse already has all source
   *   tuples in its add array, it is returned directly. If the current
   *   pulse does not have a backing source, it is returned directly.
   */
  addAll() {
    let _e = this;
    return !_e.source || _e.add === _e.rem || !_e.rem.length && _e.source.length === _e.add.length || (_e = new Pulse(this.dataflow).init(this), _e.add = _e.source, _e.rem = []), _e;
  },
  /**
   * Initialize this pulse based on the values of another pulse. This method
   * is used internally by {@link fork} to initialize a new forked tuple.
   * The dataflow, time stamp and field modification values are copied over.
   * By default, new empty ADD, REM and MOD arrays are created.
   * @param {Pulse} src - The source pulse to copy from.
   * @param {number} flags - Integer of boolean flags indicating which (if any)
   *   tuple arrays should be copied to the new pulse. The supported flag values
   *   are ADD, REM and MOD. Array references are copied directly: new array
   *   instances are not created. By default, source data arrays are copied
   *   to the new pulse. Use the NO_SOURCE flag to enforce a null source.
   * @return {Pulse} - Returns this Pulse instance.
   */
  init(_e, Qt) {
    const Zt = this;
    return Zt.stamp = _e.stamp, Zt.encode = _e.encode, _e.fields && !(Qt & NO_FIELDS) && (Zt.fields = _e.fields), Qt & ADD ? (Zt.addF = _e.addF, Zt.add = _e.add) : (Zt.addF = null, Zt.add = []), Qt & REM ? (Zt.remF = _e.remF, Zt.rem = _e.rem) : (Zt.remF = null, Zt.rem = []), Qt & MOD$1 ? (Zt.modF = _e.modF, Zt.mod = _e.mod) : (Zt.modF = null, Zt.mod = []), Qt & NO_SOURCE ? (Zt.srcF = null, Zt.source = null) : (Zt.srcF = _e.srcF, Zt.source = _e.source, _e.cleans && (Zt.cleans = _e.cleans)), Zt;
  },
  /**
   * Schedules a function to run after pulse propagation completes.
   * @param {function} func - The function to run.
   */
  runAfter(_e) {
    this.dataflow.runAfter(_e);
  },
  /**
   * Indicates if tuples have been added, removed or modified.
   * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query.
   *   Defaults to ALL, returning true if any tuple type has changed.
   * @return {boolean} - Returns true if one or more queried tuple types have
   *   changed, false otherwise.
   */
  changed(_e) {
    const Qt = _e || ALL;
    return Qt & ADD && this.add.length || Qt & REM && this.rem.length || Qt & MOD$1 && this.mod.length;
  },
  /**
   * Forces a "reflow" of tuple values, such that all tuples in the backing
   * source are added to the MOD set, unless already present in the ADD set.
   * @param {boolean} [fork=false] - If true, returns a forked copy of this
   *   pulse, and invokes reflow on that derived pulse.
   * @return {Pulse} - The reflowed pulse instance.
   */
  reflow(_e) {
    if (_e)
      return this.fork(ALL).reflow();
    const Qt = this.add.length, Zt = this.source && this.source.length;
    return Zt && Zt !== Qt && (this.mod = this.source, Qt && this.filter(MOD$1, filter$2(this, ADD))), this;
  },
  /**
   * Get/set metadata to pulse requesting garbage collection
   * to reclaim currently unused resources.
   */
  clean(_e) {
    return arguments.length ? (this.cleans = !!_e, this) : this.cleans;
  },
  /**
   * Marks one or more data field names as modified to assist dependency
   * tracking and incremental processing by transform operators.
   * @param {string|Array<string>} _ - The field(s) to mark as modified.
   * @return {Pulse} - This pulse instance.
   */
  modifies(_e) {
    const Qt = this.fields || (this.fields = {});
    return isArray(_e) ? _e.forEach((Zt) => Qt[Zt] = !0) : Qt[_e] = !0, this;
  },
  /**
   * Checks if one or more data fields have been modified during this pulse
   * propagation timestamp.
   * @param {string|Array<string>} _ - The field(s) to check for modified.
   * @param {boolean} nomod - If true, will check the modified flag even if
   *   no mod tuples exist. If false (default), mod tuples must be present.
   * @return {boolean} - Returns true if any of the provided fields has been
   *   marked as modified, false otherwise.
   */
  modified(_e, Qt) {
    const Zt = this.fields;
    return (Qt || this.mod.length) && Zt ? arguments.length ? isArray(_e) ? _e.some(($n) => Zt[$n]) : Zt[_e] : !!Zt : !1;
  },
  /**
   * Adds a filter function to one more tuple sets. Filters are applied to
   * backing tuple arrays, to determine the actual set of tuples considered
   * added, removed or modified. They can be used to delay materialization of
   * a tuple set in order to avoid expensive array copies. In addition, the
   * filter functions can serve as value transformers: unlike standard predicate
   * function (which return boolean values), Pulse filters should return the
   * actual tuple value to process. If a tuple set is already filtered, the
   * new filter function will be appended into a conjuntive ('and') query.
   * @param {number} flags - Flags indicating the tuple set(s) to filter.
   * @param {function(*):object} filter - Filter function that will be applied
   *   to the tuple set array, and should return a data tuple if the value
   *   should be included in the tuple set, and falsy (or null) otherwise.
   * @return {Pulse} - Returns this pulse instance.
   */
  filter(_e, Qt) {
    const Zt = this;
    return _e & ADD && (Zt.addF = addFilter(Zt.addF, Qt)), _e & REM && (Zt.remF = addFilter(Zt.remF, Qt)), _e & MOD$1 && (Zt.modF = addFilter(Zt.modF, Qt)), _e & SOURCE && (Zt.srcF = addFilter(Zt.srcF, Qt)), Zt;
  },
  /**
   * Materialize one or more tuple sets in this pulse. If the tuple set(s) have
   * a registered filter function, it will be applied and the tuple set(s) will
   * be replaced with materialized tuple arrays.
   * @param {number} flags - Flags indicating the tuple set(s) to materialize.
   * @return {Pulse} - Returns this pulse instance.
   */
  materialize(_e) {
    _e = _e || ALL;
    const Qt = this;
    return _e & ADD && Qt.addF && (Qt.add = materialize(Qt.add, Qt.addF), Qt.addF = null), _e & REM && Qt.remF && (Qt.rem = materialize(Qt.rem, Qt.remF), Qt.remF = null), _e & MOD$1 && Qt.modF && (Qt.mod = materialize(Qt.mod, Qt.modF), Qt.modF = null), _e & SOURCE && Qt.srcF && (Qt.source = Qt.source.filter(Qt.srcF), Qt.srcF = null), Qt;
  },
  /**
   * Visit one or more tuple sets in this pulse.
   * @param {number} flags - Flags indicating the tuple set(s) to visit.
   *   Legal values are ADD, REM, MOD and SOURCE (if a backing data source
   *   has been set).
   * @param {function(object):*} - Visitor function invoked per-tuple.
   * @return {Pulse} - Returns this pulse instance.
   */
  visit(_e, Qt) {
    const Zt = this, $n = Qt;
    if (_e & SOURCE)
      return visitArray(Zt.source, Zt.srcF, $n), Zt;
    _e & ADD && visitArray(Zt.add, Zt.addF, $n), _e & REM && visitArray(Zt.rem, Zt.remF, $n), _e & MOD$1 && visitArray(Zt.mod, Zt.modF, $n);
    const Sn = Zt.source;
    if (_e & REFLOW && Sn) {
      const kn = Zt.add.length + Zt.mod.length;
      kn === Sn.length || (kn ? visitArray(Sn, filter$2(Zt, ADD_MOD), $n) : visitArray(Sn, Zt.srcF, $n));
    }
    return Zt;
  }
};
function MultiPulse(_e, Qt, Zt, $n) {
  const Sn = this;
  let kn = 0;
  this.dataflow = _e, this.stamp = Qt, this.fields = null, this.encode = $n || null, this.pulses = Zt;
  for (const Kn of Zt)
    if (Kn.stamp === Qt) {
      if (Kn.fields) {
        const er = Sn.fields || (Sn.fields = {});
        for (const Cr in Kn.fields)
          er[Cr] = 1;
      }
      Kn.changed(Sn.ADD) && (kn |= Sn.ADD), Kn.changed(Sn.REM) && (kn |= Sn.REM), Kn.changed(Sn.MOD) && (kn |= Sn.MOD);
    }
  this.changes = kn;
}
inherits(MultiPulse, Pulse, {
  /**
   * Creates a new pulse based on the values of this pulse.
   * The dataflow, time stamp and field modification values are copied over.
   * @return {Pulse}
   */
  fork(_e) {
    const Qt = new Pulse(this.dataflow).init(this, _e & this.NO_FIELDS);
    return _e !== void 0 && (_e & Qt.ADD && this.visit(Qt.ADD, (Zt) => Qt.add.push(Zt)), _e & Qt.REM && this.visit(Qt.REM, (Zt) => Qt.rem.push(Zt)), _e & Qt.MOD && this.visit(Qt.MOD, (Zt) => Qt.mod.push(Zt))), Qt;
  },
  changed(_e) {
    return this.changes & _e;
  },
  modified(_e) {
    const Qt = this, Zt = Qt.fields;
    return Zt && Qt.changes & Qt.MOD ? isArray(_e) ? _e.some(($n) => Zt[$n]) : Zt[_e] : 0;
  },
  filter() {
    error("MultiPulse does not support filtering.");
  },
  materialize() {
    error("MultiPulse does not support materialization.");
  },
  visit(_e, Qt) {
    const Zt = this, $n = Zt.pulses, Sn = $n.length;
    let kn = 0;
    if (_e & Zt.SOURCE)
      for (; kn < Sn; ++kn)
        $n[kn].visit(_e, Qt);
    else
      for (; kn < Sn; ++kn)
        $n[kn].stamp === Zt.stamp && $n[kn].visit(_e, Qt);
    return Zt;
  }
});
async function evaluate(_e, Qt, Zt) {
  const $n = this, Sn = [];
  if ($n._pulse)
    return reentrant($n);
  if ($n._pending && await $n._pending, Qt && await asyncCallback($n, Qt), !$n._touched.length)
    return $n.debug("Dataflow invoked, but nothing to do."), $n;
  const kn = ++$n._clock;
  $n._pulse = new Pulse($n, kn, _e), $n._touched.forEach((Yr) => $n._enqueue(Yr, !0)), $n._touched = UniqueList(id$2);
  let Kn = 0, er, Cr, kr;
  try {
    for (; $n._heap.size() > 0; ) {
      if (er = $n._heap.pop(), er.rank !== er.qrank) {
        $n._enqueue(er, !0);
        continue;
      }
      Cr = er.run($n._getPulse(er, _e)), Cr.then ? Cr = await Cr : Cr.async && (Sn.push(Cr.async), Cr = StopPropagation), Cr !== StopPropagation && er._targets && er._targets.forEach((Yr) => $n._enqueue(Yr)), ++Kn;
    }
  } catch (Yr) {
    $n._heap.clear(), kr = Yr;
  }
  if ($n._input = {}, $n._pulse = null, $n.debug(`Pulse ${kn}: ${Kn} operators`), kr && ($n._postrun = [], $n.error(kr)), $n._postrun.length) {
    const Yr = $n._postrun.sort((Ms, Ds) => Ds.priority - Ms.priority);
    $n._postrun = [];
    for (let Ms = 0; Ms < Yr.length; ++Ms)
      await asyncCallback($n, Yr[Ms].callback);
  }
  return Zt && await asyncCallback($n, Zt), Sn.length && Promise.all(Sn).then((Yr) => $n.runAsync(null, () => {
    Yr.forEach((Ms) => {
      try {
        Ms($n);
      } catch (Ds) {
        $n.error(Ds);
      }
    });
  })), $n;
}
async function runAsync(_e, Qt, Zt) {
  for (; this._running; )
    await this._running;
  const $n = () => this._running = null;
  return (this._running = this.evaluate(_e, Qt, Zt)).then($n, $n), this._running;
}
function run(_e, Qt, Zt) {
  return this._pulse ? reentrant(this) : (this.evaluate(_e, Qt, Zt), this);
}
function runAfter(_e, Qt, Zt) {
  if (this._pulse || Qt)
    this._postrun.push({
      priority: Zt || 0,
      callback: _e
    });
  else
    try {
      _e(this);
    } catch ($n) {
      this.error($n);
    }
}
function reentrant(_e) {
  return _e.error("Dataflow already running. Use runAsync() to chain invocations."), _e;
}
function enqueue(_e, Qt) {
  const Zt = _e.stamp < this._clock;
  Zt && (_e.stamp = this._clock), (Zt || Qt) && (_e.qrank = _e.rank, this._heap.push(_e));
}
function getPulse(_e, Qt) {
  const Zt = _e.source, $n = this._clock;
  return Zt && isArray(Zt) ? new MultiPulse(this, $n, Zt.map((Sn) => Sn.pulse), Qt) : this._input[_e.id] || singlePulse(this._pulse, Zt && Zt.pulse);
}
function singlePulse(_e, Qt) {
  return Qt && Qt.stamp === _e.stamp ? Qt : (_e = _e.fork(), Qt && Qt !== StopPropagation && (_e.source = Qt.source), _e);
}
const NO_OPT = {
  skip: !1,
  force: !1
};
function touch(_e, Qt) {
  const Zt = Qt || NO_OPT;
  return this._pulse ? this._enqueue(_e) : this._touched.add(_e), Zt.skip && _e.skip(!0), this;
}
function update$7(_e, Qt, Zt) {
  const $n = Zt || NO_OPT;
  return (_e.set(Qt) || $n.force) && this.touch(_e, $n), this;
}
function pulse(_e, Qt, Zt) {
  this.touch(_e, Zt || NO_OPT);
  const $n = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), Sn = _e.pulse && _e.pulse.source || [];
  return $n.target = _e, this._input[_e.id] = Qt.pulse($n, Sn), this;
}
function Heap(_e) {
  let Qt = [];
  return {
    clear: () => Qt = [],
    size: () => Qt.length,
    peek: () => Qt[0],
    push: (Zt) => (Qt.push(Zt), siftdown(Qt, 0, Qt.length - 1, _e)),
    pop: () => {
      const Zt = Qt.pop();
      let $n;
      return Qt.length ? ($n = Qt[0], Qt[0] = Zt, siftup(Qt, 0, _e)) : $n = Zt, $n;
    }
  };
}
function siftdown(_e, Qt, Zt, $n) {
  let Sn, kn;
  const Kn = _e[Zt];
  for (; Zt > Qt; ) {
    if (kn = Zt - 1 >> 1, Sn = _e[kn], $n(Kn, Sn) < 0) {
      _e[Zt] = Sn, Zt = kn;
      continue;
    }
    break;
  }
  return _e[Zt] = Kn;
}
function siftup(_e, Qt, Zt) {
  const $n = Qt, Sn = _e.length, kn = _e[Qt];
  let Kn = (Qt << 1) + 1, er;
  for (; Kn < Sn; )
    er = Kn + 1, er < Sn && Zt(_e[Kn], _e[er]) >= 0 && (Kn = er), _e[Qt] = _e[Kn], Qt = Kn, Kn = (Qt << 1) + 1;
  return _e[Qt] = kn, siftdown(_e, $n, Qt, Zt);
}
function Dataflow() {
  this.logger(logger()), this.logLevel(Error$1), this._clock = 0, this._rank = 0, this._locale = defaultLocale();
  try {
    this._loader = loader();
  } catch {
  }
  this._touched = UniqueList(id$2), this._input = {}, this._pulse = null, this._heap = Heap((_e, Qt) => _e.qrank - Qt.qrank), this._postrun = [];
}
function logMethod(_e) {
  return function() {
    return this._log[_e].apply(this, arguments);
  };
}
Dataflow.prototype = {
  /**
   * The current timestamp of this dataflow. This value reflects the
   * timestamp of the previous dataflow run. The dataflow is initialized
   * with a stamp value of 0. The initial run of the dataflow will have
   * a timestap of 1, and so on. This value will match the
   * {@link Pulse.stamp} property.
   * @return {number} - The current timestamp value.
   */
  stamp() {
    return this._clock;
  },
  /**
   * Gets or sets the loader instance to use for data file loading. A
   * loader object must provide a "load" method for loading files and a
   * "sanitize" method for checking URL/filename validity. Both methods
   * should accept a URI and options hash as arguments, and return a Promise
   * that resolves to the loaded file contents (load) or a hash containing
   * sanitized URI data with the sanitized url assigned to the "href" property
   * (sanitize).
   * @param {object} _ - The loader instance to use.
   * @return {object|Dataflow} - If no arguments are provided, returns
   *   the current loader instance. Otherwise returns this Dataflow instance.
   */
  loader(_e) {
    return arguments.length ? (this._loader = _e, this) : this._loader;
  },
  /**
   * Gets or sets the locale instance to use for formatting and parsing
   * string values. The locale object should be provided by the
   * vega-format library, and include methods such as format, timeFormat,
   * utcFormat, timeParse, and utcParse.
   * @param {object} _ - The locale instance to use.
   * @return {object|Dataflow} - If no arguments are provided, returns
   *   the current locale instance. Otherwise returns this Dataflow instance.
   */
  locale(_e) {
    return arguments.length ? (this._locale = _e, this) : this._locale;
  },
  /**
   * Get or set the logger instance used to log messages. If no arguments are
   * provided, returns the current logger instance. Otherwise, sets the logger
   * and return this Dataflow instance. Provided loggers must support the full
   * API of logger objects generated by the vega-util logger method. Note that
   * by default the log level of the new logger will be used; use the logLevel
   * method to adjust the log level as needed.
   */
  logger(_e) {
    return arguments.length ? (this._log = _e, this) : this._log;
  },
  /**
   * Logs an error message. By default, logged messages are written to console
   * output. The message will only be logged if the current log level is high
   * enough to permit error messages.
   */
  error: logMethod("error"),
  /**
   * Logs a warning message. By default, logged messages are written to console
   * output. The message will only be logged if the current log level is high
   * enough to permit warning messages.
   */
  warn: logMethod("warn"),
  /**
   * Logs a information message. By default, logged messages are written to
   * console output. The message will only be logged if the current log level is
   * high enough to permit information messages.
   */
  info: logMethod("info"),
  /**
   * Logs a debug message. By default, logged messages are written to console
   * output. The message will only be logged if the current log level is high
   * enough to permit debug messages.
   */
  debug: logMethod("debug"),
  /**
   * Get or set the current log level. If an argument is provided, it
   * will be used as the new log level.
   * @param {number} [level] - Should be one of None, Warn, Info
   * @return {number} - The current log level.
   */
  logLevel: logMethod("level"),
  /**
   * Empty entry threshold for garbage cleaning. Map data structures will
   * perform cleaning once the number of empty entries exceeds this value.
   */
  cleanThreshold: 1e4,
  // OPERATOR REGISTRATION
  add: add$5,
  connect: connect$1,
  rank,
  rerank,
  // OPERATOR UPDATES
  pulse,
  touch,
  update: update$7,
  changeset,
  // DATA LOADING
  ingest,
  parse: parse$6,
  preload,
  request,
  // EVENT HANDLING
  events: events$1,
  on: on$1,
  // PULSE PROPAGATION
  evaluate,
  run,
  runAsync,
  runAfter,
  _enqueue: enqueue,
  _getPulse: getPulse
};
function Transform$1(_e, Qt) {
  Operator.call(this, _e, null, Qt);
}
inherits(Transform$1, Operator, {
  /**
   * Overrides {@link Operator.evaluate} for transform operators.
   * Internally, this method calls {@link evaluate} to perform processing.
   * If {@link evaluate} returns a falsy value, the input pulse is returned.
   * This method should NOT be overridden, instead overrride {@link evaluate}.
   * @param {Pulse} pulse - the current dataflow pulse.
   * @return the output pulse for this operator (or StopPropagation)
   */
  run(_e) {
    if (_e.stamp < this.stamp)
      return _e.StopPropagation;
    let Qt;
    return this.skip() ? this.skip(!1) : Qt = this.evaluate(_e), Qt = Qt || _e, Qt.then ? Qt = Qt.then((Zt) => this.pulse = Zt) : Qt !== _e.StopPropagation && (this.pulse = Qt), Qt;
  },
  /**
   * Overrides {@link Operator.evaluate} for transform operators.
   * Marshalls parameter values and then invokes {@link transform}.
   * @param {Pulse} pulse - the current dataflow pulse.
   * @return {Pulse} The output pulse (or StopPropagation). A falsy return
       value (including undefined) will let the input pulse pass through.
  */
  evaluate(_e) {
    const Qt = this.marshall(_e.stamp), Zt = this.transform(Qt, _e);
    return Qt.clear(), Zt;
  },
  /**
   * Process incoming pulses.
   * Subclasses should override this method to implement transforms.
   * @param {Parameters} _ - The operator parameter values.
   * @param {Pulse} pulse - The current dataflow pulse.
   * @return {Pulse} The output pulse (or StopPropagation). A falsy return
   *   value (including undefined) will let the input pulse pass through.
   */
  transform() {
  }
});
const transforms$1 = {};
function definition$1(_e) {
  const Qt = transform$2(_e);
  return Qt && Qt.Definition || null;
}
function transform$2(_e) {
  return _e = _e && _e.toLowerCase(), has$1(transforms$1, _e) ? transforms$1[_e] : null;
}
function* numbers$1(_e, Qt) {
  if (Qt == null)
    for (let Zt of _e)
      Zt != null && Zt !== "" && (Zt = +Zt) >= Zt && (yield Zt);
  else {
    let Zt = -1;
    for (let $n of _e)
      $n = Qt($n, ++Zt, _e), $n != null && $n !== "" && ($n = +$n) >= $n && (yield $n);
  }
}
function quantiles(_e, Qt, Zt) {
  const $n = Float64Array.from(numbers$1(_e, Zt));
  return $n.sort(ascending$3), Qt.map((Sn) => quantileSorted($n, Sn));
}
function quartiles(_e, Qt) {
  return quantiles(_e, [0.25, 0.5, 0.75], Qt);
}
function estimateBandwidth(_e, Qt) {
  const Zt = _e.length, $n = deviation(_e, Qt), Sn = quartiles(_e, Qt), kn = (Sn[2] - Sn[0]) / 1.34;
  return 1.06 * (Math.min($n, kn) || $n || Math.abs(Sn[0]) || 1) * Math.pow(Zt, -0.2);
}
function bin(_e) {
  const Qt = _e.maxbins || 20, Zt = _e.base || 10, $n = Math.log(Zt), Sn = _e.divide || [5, 2];
  let kn = _e.extent[0], Kn = _e.extent[1], er, Cr, kr, Yr, Ms, Ds;
  const Ls = _e.span || Kn - kn || Math.abs(kn) || 1;
  if (_e.step)
    er = _e.step;
  else if (_e.steps) {
    for (Yr = Ls / Qt, Ms = 0, Ds = _e.steps.length; Ms < Ds && _e.steps[Ms] < Yr; ++Ms)
      ;
    er = _e.steps[Math.max(0, Ms - 1)];
  } else {
    for (Cr = Math.ceil(Math.log(Qt) / $n), kr = _e.minstep || 0, er = Math.max(kr, Math.pow(Zt, Math.round(Math.log(Ls) / $n) - Cr)); Math.ceil(Ls / er) > Qt; )
      er *= Zt;
    for (Ms = 0, Ds = Sn.length; Ms < Ds; ++Ms)
      Yr = er / Sn[Ms], Yr >= kr && Ls / Yr <= Qt && (er = Yr);
  }
  Yr = Math.log(er);
  const js = Yr >= 0 ? 0 : ~~(-Yr / $n) + 1, zs = Math.pow(Zt, -js - 1);
  return (_e.nice || _e.nice === void 0) && (Yr = Math.floor(kn / er + zs) * er, kn = kn < Yr ? Yr - er : Yr, Kn = Math.ceil(Kn / er) * er), {
    start: kn,
    stop: Kn === kn ? kn + er : Kn,
    step: er
  };
}
var random = Math.random;
function setRandom(_e) {
  random = _e;
}
function bootstrapCI(_e, Qt, Zt, $n) {
  if (!_e.length)
    return [void 0, void 0];
  const Sn = Float64Array.from(numbers$1(_e, $n)), kn = Sn.length, Kn = Qt;
  let er, Cr, kr, Yr;
  for (kr = 0, Yr = Array(Kn); kr < Kn; ++kr) {
    for (er = 0, Cr = 0; Cr < kn; ++Cr)
      er += Sn[~~(random() * kn)];
    Yr[kr] = er / kn;
  }
  return Yr.sort(ascending$3), [quantile$1(Yr, Zt / 2), quantile$1(Yr, 1 - Zt / 2)];
}
function dotbin(_e, Qt, Zt, $n) {
  $n = $n || ((Ds) => Ds);
  const Sn = _e.length, kn = new Float64Array(Sn);
  let Kn = 0, er = 1, Cr = $n(_e[0]), kr = Cr, Yr = Cr + Qt, Ms;
  for (; er < Sn; ++er) {
    if (Ms = $n(_e[er]), Ms >= Yr) {
      for (kr = (Cr + kr) / 2; Kn < er; ++Kn)
        kn[Kn] = kr;
      Yr = Ms + Qt, Cr = Ms;
    }
    kr = Ms;
  }
  for (kr = (Cr + kr) / 2; Kn < er; ++Kn)
    kn[Kn] = kr;
  return Zt ? smoothing(kn, Qt + Qt / 4) : kn;
}
function smoothing(_e, Qt) {
  const Zt = _e.length;
  let $n = 0, Sn = 1, kn, Kn;
  for (; _e[$n] === _e[Sn]; )
    ++Sn;
  for (; Sn < Zt; ) {
    for (kn = Sn + 1; _e[Sn] === _e[kn]; )
      ++kn;
    if (_e[Sn] - _e[Sn - 1] < Qt) {
      for (Kn = Sn + ($n + kn - Sn - Sn >> 1); Kn < Sn; )
        _e[Kn++] = _e[Sn];
      for (; Kn > Sn; )
        _e[Kn--] = _e[$n];
    }
    $n = Sn, Sn = kn;
  }
  return _e;
}
function lcg$2(_e) {
  return function() {
    return _e = (1103515245 * _e + 12345) % 2147483647, _e / 2147483647;
  };
}
function integer(_e, Qt) {
  Qt == null && (Qt = _e, _e = 0);
  let Zt, $n, Sn;
  const kn = {
    min(Kn) {
      return arguments.length ? (Zt = Kn || 0, Sn = $n - Zt, kn) : Zt;
    },
    max(Kn) {
      return arguments.length ? ($n = Kn || 0, Sn = $n - Zt, kn) : $n;
    },
    sample() {
      return Zt + Math.floor(Sn * random());
    },
    pdf(Kn) {
      return Kn === Math.floor(Kn) && Kn >= Zt && Kn < $n ? 1 / Sn : 0;
    },
    cdf(Kn) {
      const er = Math.floor(Kn);
      return er < Zt ? 0 : er >= $n ? 1 : (er - Zt + 1) / Sn;
    },
    icdf(Kn) {
      return Kn >= 0 && Kn <= 1 ? Zt - 1 + Math.floor(Kn * Sn) : NaN;
    }
  };
  return kn.min(_e).max(Qt);
}
const SQRT2PI = Math.sqrt(2 * Math.PI), SQRT2 = Math.SQRT2;
let nextSample = NaN;
function sampleNormal(_e, Qt) {
  _e = _e || 0, Qt = Qt ?? 1;
  let Zt = 0, $n = 0, Sn, kn;
  if (nextSample === nextSample)
    Zt = nextSample, nextSample = NaN;
  else {
    do
      Zt = random() * 2 - 1, $n = random() * 2 - 1, Sn = Zt * Zt + $n * $n;
    while (Sn === 0 || Sn > 1);
    kn = Math.sqrt(-2 * Math.log(Sn) / Sn), Zt *= kn, nextSample = $n * kn;
  }
  return _e + Zt * Qt;
}
function densityNormal(_e, Qt, Zt) {
  Zt = Zt ?? 1;
  const $n = (_e - (Qt || 0)) / Zt;
  return Math.exp(-0.5 * $n * $n) / (Zt * SQRT2PI);
}
function cumulativeNormal(_e, Qt, Zt) {
  Qt = Qt || 0, Zt = Zt ?? 1;
  const $n = (_e - Qt) / Zt, Sn = Math.abs($n);
  let kn;
  if (Sn > 37)
    kn = 0;
  else {
    const Kn = Math.exp(-Sn * Sn / 2);
    let er;
    Sn < 7.07106781186547 ? (er = 0.0352624965998911 * Sn + 0.700383064443688, er = er * Sn + 6.37396220353165, er = er * Sn + 33.912866078383, er = er * Sn + 112.079291497871, er = er * Sn + 221.213596169931, er = er * Sn + 220.206867912376, kn = Kn * er, er = 0.0883883476483184 * Sn + 1.75566716318264, er = er * Sn + 16.064177579207, er = er * Sn + 86.7807322029461, er = er * Sn + 296.564248779674, er = er * Sn + 637.333633378831, er = er * Sn + 793.826512519948, er = er * Sn + 440.413735824752, kn = kn / er) : (er = Sn + 0.65, er = Sn + 4 / er, er = Sn + 3 / er, er = Sn + 2 / er, er = Sn + 1 / er, kn = Kn / er / 2.506628274631);
  }
  return $n > 0 ? 1 - kn : kn;
}
function quantileNormal(_e, Qt, Zt) {
  return _e < 0 || _e > 1 ? NaN : (Qt || 0) + (Zt ?? 1) * SQRT2 * erfinv(2 * _e - 1);
}
function erfinv(_e) {
  let Qt = -Math.log((1 - _e) * (1 + _e)), Zt;
  return Qt < 6.25 ? (Qt -= 3.125, Zt = -364441206401782e-35, Zt = -16850591381820166e-35 + Zt * Qt, Zt = 128584807152564e-32 + Zt * Qt, Zt = 11157877678025181e-33 + Zt * Qt, Zt = -1333171662854621e-31 + Zt * Qt, Zt = 20972767875968562e-33 + Zt * Qt, Zt = 6637638134358324e-30 + Zt * Qt, Zt = -4054566272975207e-29 + Zt * Qt, Zt = -8151934197605472e-29 + Zt * Qt, Zt = 26335093153082323e-28 + Zt * Qt, Zt = -12975133253453532e-27 + Zt * Qt, Zt = -5415412054294628e-26 + Zt * Qt, Zt = 10512122733215323e-25 + Zt * Qt, Zt = -4112633980346984e-24 + Zt * Qt, Zt = -29070369957882005e-24 + Zt * Qt, Zt = 42347877827932404e-23 + Zt * Qt, Zt = -13654692000834679e-22 + Zt * Qt, Zt = -13882523362786469e-21 + Zt * Qt, Zt = 18673420803405714e-20 + Zt * Qt, Zt = -740702534166267e-18 + Zt * Qt, Zt = -0.006033670871430149 + Zt * Qt, Zt = 0.24015818242558962 + Zt * Qt, Zt = 1.6536545626831027 + Zt * Qt) : Qt < 16 ? (Qt = Math.sqrt(Qt) - 3.25, Zt = 22137376921775787e-25, Zt = 9075656193888539e-23 + Zt * Qt, Zt = -27517406297064545e-23 + Zt * Qt, Zt = 18239629214389228e-24 + Zt * Qt, Zt = 15027403968909828e-22 + Zt * Qt, Zt = -4013867526981546e-21 + Zt * Qt, Zt = 29234449089955446e-22 + Zt * Qt, Zt = 12475304481671779e-21 + Zt * Qt, Zt = -47318229009055734e-21 + Zt * Qt, Zt = 6828485145957318e-20 + Zt * Qt, Zt = 24031110387097894e-21 + Zt * Qt, Zt = -3550375203628475e-19 + Zt * Qt, Zt = 9532893797373805e-19 + Zt * Qt, Zt = -0.0016882755560235047 + Zt * Qt, Zt = 0.002491442096107851 + Zt * Qt, Zt = -0.003751208507569241 + Zt * Qt, Zt = 0.005370914553590064 + Zt * Qt, Zt = 1.0052589676941592 + Zt * Qt, Zt = 3.0838856104922208 + Zt * Qt) : Number.isFinite(Qt) ? (Qt = Math.sqrt(Qt) - 5, Zt = -27109920616438573e-27, Zt = -2555641816996525e-25 + Zt * Qt, Zt = 15076572693500548e-25 + Zt * Qt, Zt = -3789465440126737e-24 + Zt * Qt, Zt = 761570120807834e-23 + Zt * Qt, Zt = -1496002662714924e-23 + Zt * Qt, Zt = 2914795345090108e-23 + Zt * Qt, Zt = -6771199775845234e-23 + Zt * Qt, Zt = 22900482228026655e-23 + Zt * Qt, Zt = -99298272942317e-20 + Zt * Qt, Zt = 4526062597223154e-21 + Zt * Qt, Zt = -1968177810553167e-20 + Zt * Qt, Zt = 7599527703001776e-20 + Zt * Qt, Zt = -21503011930044477e-20 + Zt * Qt, Zt = -13871931833623122e-20 + Zt * Qt, Zt = 1.0103004648645344 + Zt * Qt, Zt = 4.849906401408584 + Zt * Qt) : Zt = 1 / 0, Zt * _e;
}
function gaussian(_e, Qt) {
  let Zt, $n;
  const Sn = {
    mean(kn) {
      return arguments.length ? (Zt = kn || 0, Sn) : Zt;
    },
    stdev(kn) {
      return arguments.length ? ($n = kn ?? 1, Sn) : $n;
    },
    sample: () => sampleNormal(Zt, $n),
    pdf: (kn) => densityNormal(kn, Zt, $n),
    cdf: (kn) => cumulativeNormal(kn, Zt, $n),
    icdf: (kn) => quantileNormal(kn, Zt, $n)
  };
  return Sn.mean(_e).stdev(Qt);
}
function kde(_e, Qt) {
  const Zt = gaussian();
  let $n = 0;
  const Sn = {
    data(kn) {
      return arguments.length ? (_e = kn, $n = kn ? kn.length : 0, Sn.bandwidth(Qt)) : _e;
    },
    bandwidth(kn) {
      return arguments.length ? (Qt = kn, !Qt && _e && (Qt = estimateBandwidth(_e)), Sn) : Qt;
    },
    sample() {
      return _e[~~(random() * $n)] + Qt * Zt.sample();
    },
    pdf(kn) {
      let Kn = 0, er = 0;
      for (; er < $n; ++er)
        Kn += Zt.pdf((kn - _e[er]) / Qt);
      return Kn / Qt / $n;
    },
    cdf(kn) {
      let Kn = 0, er = 0;
      for (; er < $n; ++er)
        Kn += Zt.cdf((kn - _e[er]) / Qt);
      return Kn / $n;
    },
    icdf() {
      throw Error("KDE icdf not supported.");
    }
  };
  return Sn.data(_e);
}
function sampleLogNormal(_e, Qt) {
  return _e = _e || 0, Qt = Qt ?? 1, Math.exp(_e + sampleNormal() * Qt);
}
function densityLogNormal(_e, Qt, Zt) {
  if (_e <= 0)
    return 0;
  Qt = Qt || 0, Zt = Zt ?? 1;
  const $n = (Math.log(_e) - Qt) / Zt;
  return Math.exp(-0.5 * $n * $n) / (Zt * SQRT2PI * _e);
}
function cumulativeLogNormal(_e, Qt, Zt) {
  return cumulativeNormal(Math.log(_e), Qt, Zt);
}
function quantileLogNormal(_e, Qt, Zt) {
  return Math.exp(quantileNormal(_e, Qt, Zt));
}
function lognormal(_e, Qt) {
  let Zt, $n;
  const Sn = {
    mean(kn) {
      return arguments.length ? (Zt = kn || 0, Sn) : Zt;
    },
    stdev(kn) {
      return arguments.length ? ($n = kn ?? 1, Sn) : $n;
    },
    sample: () => sampleLogNormal(Zt, $n),
    pdf: (kn) => densityLogNormal(kn, Zt, $n),
    cdf: (kn) => cumulativeLogNormal(kn, Zt, $n),
    icdf: (kn) => quantileLogNormal(kn, Zt, $n)
  };
  return Sn.mean(_e).stdev(Qt);
}
function mixture$1(_e, Qt) {
  let Zt = 0, $n;
  function Sn(Kn) {
    const er = [];
    let Cr = 0, kr;
    for (kr = 0; kr < Zt; ++kr)
      Cr += er[kr] = Kn[kr] == null ? 1 : +Kn[kr];
    for (kr = 0; kr < Zt; ++kr)
      er[kr] /= Cr;
    return er;
  }
  const kn = {
    weights(Kn) {
      return arguments.length ? ($n = Sn(Qt = Kn || []), kn) : Qt;
    },
    distributions(Kn) {
      return arguments.length ? (Kn ? (Zt = Kn.length, _e = Kn) : (Zt = 0, _e = []), kn.weights(Qt)) : _e;
    },
    sample() {
      const Kn = random();
      let er = _e[Zt - 1], Cr = $n[0], kr = 0;
      for (; kr < Zt - 1; Cr += $n[++kr])
        if (Kn < Cr) {
          er = _e[kr];
          break;
        }
      return er.sample();
    },
    pdf(Kn) {
      let er = 0, Cr = 0;
      for (; Cr < Zt; ++Cr)
        er += $n[Cr] * _e[Cr].pdf(Kn);
      return er;
    },
    cdf(Kn) {
      let er = 0, Cr = 0;
      for (; Cr < Zt; ++Cr)
        er += $n[Cr] * _e[Cr].cdf(Kn);
      return er;
    },
    icdf() {
      throw Error("Mixture icdf not supported.");
    }
  };
  return kn.distributions(_e).weights(Qt);
}
function sampleUniform(_e, Qt) {
  return Qt == null && (Qt = _e ?? 1, _e = 0), _e + (Qt - _e) * random();
}
function densityUniform(_e, Qt, Zt) {
  return Zt == null && (Zt = Qt ?? 1, Qt = 0), _e >= Qt && _e <= Zt ? 1 / (Zt - Qt) : 0;
}
function cumulativeUniform(_e, Qt, Zt) {
  return Zt == null && (Zt = Qt ?? 1, Qt = 0), _e < Qt ? 0 : _e > Zt ? 1 : (_e - Qt) / (Zt - Qt);
}
function quantileUniform(_e, Qt, Zt) {
  return Zt == null && (Zt = Qt ?? 1, Qt = 0), _e >= 0 && _e <= 1 ? Qt + _e * (Zt - Qt) : NaN;
}
function uniform(_e, Qt) {
  let Zt, $n;
  const Sn = {
    min(kn) {
      return arguments.length ? (Zt = kn || 0, Sn) : Zt;
    },
    max(kn) {
      return arguments.length ? ($n = kn ?? 1, Sn) : $n;
    },
    sample: () => sampleUniform(Zt, $n),
    pdf: (kn) => densityUniform(kn, Zt, $n),
    cdf: (kn) => cumulativeUniform(kn, Zt, $n),
    icdf: (kn) => quantileUniform(kn, Zt, $n)
  };
  return Qt == null && (Qt = _e ?? 1, _e = 0), Sn.min(_e).max(Qt);
}
function constant$6(_e, Qt, Zt) {
  let $n = 0, Sn = 0;
  for (const kn of _e) {
    const Kn = Zt(kn);
    Qt(kn) == null || Kn == null || isNaN(Kn) || ($n += (Kn - $n) / ++Sn);
  }
  return {
    coef: [$n],
    predict: () => $n,
    rSquared: 0
  };
}
function ols(_e, Qt, Zt, $n) {
  const Sn = $n - _e * _e, kn = Math.abs(Sn) < 1e-24 ? 0 : (Zt - _e * Qt) / Sn;
  return [Qt - kn * _e, kn];
}
function points(_e, Qt, Zt, $n) {
  _e = _e.filter((Ls) => {
    let js = Qt(Ls), zs = Zt(Ls);
    return js != null && (js = +js) >= js && zs != null && (zs = +zs) >= zs;
  }), $n && _e.sort((Ls, js) => Qt(Ls) - Qt(js));
  const Sn = _e.length, kn = new Float64Array(Sn), Kn = new Float64Array(Sn);
  let er = 0, Cr = 0, kr = 0, Yr, Ms, Ds;
  for (Ds of _e)
    kn[er] = Yr = +Qt(Ds), Kn[er] = Ms = +Zt(Ds), ++er, Cr += (Yr - Cr) / er, kr += (Ms - kr) / er;
  for (er = 0; er < Sn; ++er)
    kn[er] -= Cr, Kn[er] -= kr;
  return [kn, Kn, Cr, kr];
}
function visitPoints(_e, Qt, Zt, $n) {
  let Sn = -1, kn, Kn;
  for (const er of _e)
    kn = Qt(er), Kn = Zt(er), kn != null && (kn = +kn) >= kn && Kn != null && (Kn = +Kn) >= Kn && $n(kn, Kn, ++Sn);
}
function rSquared(_e, Qt, Zt, $n, Sn) {
  let kn = 0, Kn = 0;
  return visitPoints(_e, Qt, Zt, (er, Cr) => {
    const kr = Cr - Sn(er), Yr = Cr - $n;
    kn += kr * kr, Kn += Yr * Yr;
  }), 1 - kn / Kn;
}
function linear$2(_e, Qt, Zt) {
  let $n = 0, Sn = 0, kn = 0, Kn = 0, er = 0;
  visitPoints(_e, Qt, Zt, (Yr, Ms) => {
    ++er, $n += (Yr - $n) / er, Sn += (Ms - Sn) / er, kn += (Yr * Ms - kn) / er, Kn += (Yr * Yr - Kn) / er;
  });
  const Cr = ols($n, Sn, kn, Kn), kr = (Yr) => Cr[0] + Cr[1] * Yr;
  return {
    coef: Cr,
    predict: kr,
    rSquared: rSquared(_e, Qt, Zt, Sn, kr)
  };
}
function log$4(_e, Qt, Zt) {
  let $n = 0, Sn = 0, kn = 0, Kn = 0, er = 0;
  visitPoints(_e, Qt, Zt, (Yr, Ms) => {
    ++er, Yr = Math.log(Yr), $n += (Yr - $n) / er, Sn += (Ms - Sn) / er, kn += (Yr * Ms - kn) / er, Kn += (Yr * Yr - Kn) / er;
  });
  const Cr = ols($n, Sn, kn, Kn), kr = (Yr) => Cr[0] + Cr[1] * Math.log(Yr);
  return {
    coef: Cr,
    predict: kr,
    rSquared: rSquared(_e, Qt, Zt, Sn, kr)
  };
}
function exp$1(_e, Qt, Zt) {
  const [$n, Sn, kn, Kn] = points(_e, Qt, Zt);
  let er = 0, Cr = 0, kr = 0, Yr = 0, Ms = 0, Ds, Ls, js;
  visitPoints(_e, Qt, Zt, (Hs, Ws) => {
    Ds = $n[Ms++], Ls = Math.log(Ws), js = Ds * Ws, er += (Ws * Ls - er) / Ms, Cr += (js - Cr) / Ms, kr += (js * Ls - kr) / Ms, Yr += (Ds * js - Yr) / Ms;
  });
  const [zs, Fs] = ols(Cr / Kn, er / Kn, kr / Kn, Yr / Kn), Bs = (Hs) => Math.exp(zs + Fs * (Hs - kn));
  return {
    coef: [Math.exp(zs - Fs * kn), Fs],
    predict: Bs,
    rSquared: rSquared(_e, Qt, Zt, Kn, Bs)
  };
}
function pow$3(_e, Qt, Zt) {
  let $n = 0, Sn = 0, kn = 0, Kn = 0, er = 0, Cr = 0;
  visitPoints(_e, Qt, Zt, (Ms, Ds) => {
    const Ls = Math.log(Ms), js = Math.log(Ds);
    ++Cr, $n += (Ls - $n) / Cr, Sn += (js - Sn) / Cr, kn += (Ls * js - kn) / Cr, Kn += (Ls * Ls - Kn) / Cr, er += (Ds - er) / Cr;
  });
  const kr = ols($n, Sn, kn, Kn), Yr = (Ms) => kr[0] * Math.pow(Ms, kr[1]);
  return kr[0] = Math.exp(kr[0]), {
    coef: kr,
    predict: Yr,
    rSquared: rSquared(_e, Qt, Zt, er, Yr)
  };
}
function quad(_e, Qt, Zt) {
  const [$n, Sn, kn, Kn] = points(_e, Qt, Zt), er = $n.length;
  let Cr = 0, kr = 0, Yr = 0, Ms = 0, Ds = 0, Ls, js, zs, Fs;
  for (Ls = 0; Ls < er; )
    js = $n[Ls], zs = Sn[Ls++], Fs = js * js, Cr += (Fs - Cr) / Ls, kr += (Fs * js - kr) / Ls, Yr += (Fs * Fs - Yr) / Ls, Ms += (js * zs - Ms) / Ls, Ds += (Fs * zs - Ds) / Ls;
  const Bs = Yr - Cr * Cr, Hs = Cr * Bs - kr * kr, Ws = (Ds * Cr - Ms * kr) / Hs, Ys = (Ms * Bs - Ds * kr) / Hs, El = -Ws * Cr, Mu = (Pl) => (Pl = Pl - kn, Ws * Pl * Pl + Ys * Pl + El + Kn);
  return {
    coef: [El - Ys * kn + Ws * kn * kn + Kn, Ys - 2 * Ws * kn, Ws],
    predict: Mu,
    rSquared: rSquared(_e, Qt, Zt, Kn, Mu)
  };
}
function poly(_e, Qt, Zt, $n) {
  if ($n === 0)
    return constant$6(_e, Qt, Zt);
  if ($n === 1)
    return linear$2(_e, Qt, Zt);
  if ($n === 2)
    return quad(_e, Qt, Zt);
  const [Sn, kn, Kn, er] = points(_e, Qt, Zt), Cr = Sn.length, kr = [], Yr = [], Ms = $n + 1;
  let Ds, Ls, js, zs, Fs;
  for (Ds = 0; Ds < Ms; ++Ds) {
    for (js = 0, zs = 0; js < Cr; ++js)
      zs += Math.pow(Sn[js], Ds) * kn[js];
    for (kr.push(zs), Fs = new Float64Array(Ms), Ls = 0; Ls < Ms; ++Ls) {
      for (js = 0, zs = 0; js < Cr; ++js)
        zs += Math.pow(Sn[js], Ds + Ls);
      Fs[Ls] = zs;
    }
    Yr.push(Fs);
  }
  Yr.push(kr);
  const Bs = gaussianElimination(Yr), Hs = (Ws) => {
    Ws -= Kn;
    let Ys = er + Bs[0] + Bs[1] * Ws + Bs[2] * Ws * Ws;
    for (Ds = 3; Ds < Ms; ++Ds)
      Ys += Bs[Ds] * Math.pow(Ws, Ds);
    return Ys;
  };
  return {
    coef: uncenter(Ms, Bs, -Kn, er),
    predict: Hs,
    rSquared: rSquared(_e, Qt, Zt, er, Hs)
  };
}
function uncenter(_e, Qt, Zt, $n) {
  const Sn = Array(_e);
  let kn, Kn, er, Cr;
  for (kn = 0; kn < _e; ++kn)
    Sn[kn] = 0;
  for (kn = _e - 1; kn >= 0; --kn)
    for (er = Qt[kn], Cr = 1, Sn[kn] += er, Kn = 1; Kn <= kn; ++Kn)
      Cr *= (kn + 1 - Kn) / Kn, Sn[kn - Kn] += er * Math.pow(Zt, Kn) * Cr;
  return Sn[0] += $n, Sn;
}
function gaussianElimination(_e) {
  const Qt = _e.length - 1, Zt = [];
  let $n, Sn, kn, Kn, er;
  for ($n = 0; $n < Qt; ++$n) {
    for (Kn = $n, Sn = $n + 1; Sn < Qt; ++Sn)
      Math.abs(_e[$n][Sn]) > Math.abs(_e[$n][Kn]) && (Kn = Sn);
    for (kn = $n; kn < Qt + 1; ++kn)
      er = _e[kn][$n], _e[kn][$n] = _e[kn][Kn], _e[kn][Kn] = er;
    for (Sn = $n + 1; Sn < Qt; ++Sn)
      for (kn = Qt; kn >= $n; kn--)
        _e[kn][Sn] -= _e[kn][$n] * _e[$n][Sn] / _e[$n][$n];
  }
  for (Sn = Qt - 1; Sn >= 0; --Sn) {
    for (er = 0, kn = Sn + 1; kn < Qt; ++kn)
      er += _e[kn][Sn] * Zt[kn];
    Zt[Sn] = (_e[Qt][Sn] - er) / _e[Sn][Sn];
  }
  return Zt;
}
const maxiters = 2, epsilon$6 = 1e-12;
function loess(_e, Qt, Zt, $n) {
  const [Sn, kn, Kn, er] = points(_e, Qt, Zt, !0), Cr = Sn.length, kr = Math.max(2, ~~($n * Cr)), Yr = new Float64Array(Cr), Ms = new Float64Array(Cr), Ds = new Float64Array(Cr).fill(1);
  for (let Ls = -1; ++Ls <= maxiters; ) {
    const js = [0, kr - 1];
    for (let Fs = 0; Fs < Cr; ++Fs) {
      const Bs = Sn[Fs], Hs = js[0], Ws = js[1], Ys = Bs - Sn[Hs] > Sn[Ws] - Bs ? Hs : Ws;
      let El = 0, Mu = 0, Pl = 0, Iu = 0, Tu = 0;
      const Au = 1 / Math.abs(Sn[Ys] - Bs || 1);
      for (let pm = Hs; pm <= Ws; ++pm) {
        const zu = Sn[pm], Yu = kn[pm], sm = tricube(Math.abs(Bs - zu) * Au) * Ds[pm], mm = zu * sm;
        El += sm, Mu += mm, Pl += Yu * sm, Iu += Yu * mm, Tu += zu * mm;
      }
      const [Nu, gm] = ols(Mu / El, Pl / El, Iu / El, Tu / El);
      Yr[Fs] = Nu + gm * Bs, Ms[Fs] = Math.abs(kn[Fs] - Yr[Fs]), updateInterval(Sn, Fs + 1, js);
    }
    if (Ls === maxiters)
      break;
    const zs = median(Ms);
    if (Math.abs(zs) < epsilon$6)
      break;
    for (let Fs = 0, Bs, Hs; Fs < Cr; ++Fs)
      Bs = Ms[Fs] / (6 * zs), Ds[Fs] = Bs >= 1 ? epsilon$6 : (Hs = 1 - Bs * Bs) * Hs;
  }
  return output$1(Sn, Yr, Kn, er);
}
function tricube(_e) {
  return (_e = 1 - _e * _e * _e) * _e * _e;
}
function updateInterval(_e, Qt, Zt) {
  const $n = _e[Qt];
  let Sn = Zt[0], kn = Zt[1] + 1;
  if (!(kn >= _e.length))
    for (; Qt > Sn && _e[kn] - $n <= $n - _e[Sn]; )
      Zt[0] = ++Sn, Zt[1] = kn, ++kn;
}
function output$1(_e, Qt, Zt, $n) {
  const Sn = _e.length, kn = [];
  let Kn = 0, er = 0, Cr = [], kr;
  for (; Kn < Sn; ++Kn)
    kr = _e[Kn] + Zt, Cr[0] === kr ? Cr[1] += (Qt[Kn] - Cr[1]) / ++er : (er = 0, Cr[1] += $n, Cr = [kr, Qt[Kn]], kn.push(Cr));
  return Cr[1] += $n, kn;
}
const MIN_RADIANS = 0.5 * Math.PI / 180;
function sampleCurve(_e, Qt, Zt, $n) {
  Zt = Zt || 25, $n = Math.max(Zt, $n || 200);
  const Sn = (zs) => [zs, _e(zs)], kn = Qt[0], Kn = Qt[1], er = Kn - kn, Cr = er / $n, kr = [Sn(kn)], Yr = [];
  if (Zt === $n) {
    for (let zs = 1; zs < $n; ++zs)
      kr.push(Sn(kn + zs / Zt * er));
    return kr.push(Sn(Kn)), kr;
  } else {
    Yr.push(Sn(Kn));
    for (let zs = Zt; --zs > 0; )
      Yr.push(Sn(kn + zs / Zt * er));
  }
  let Ms = kr[0], Ds = Yr[Yr.length - 1];
  const Ls = 1 / er, js = scaleY(Ms[1], Yr);
  for (; Ds; ) {
    const zs = Sn((Ms[0] + Ds[0]) / 2);
    zs[0] - Ms[0] >= Cr && angleDelta(Ms, zs, Ds, Ls, js) > MIN_RADIANS ? Yr.push(zs) : (Ms = Ds, kr.push(Ds), Yr.pop()), Ds = Yr[Yr.length - 1];
  }
  return kr;
}
function scaleY(_e, Qt) {
  let Zt = _e, $n = _e;
  const Sn = Qt.length;
  for (let kn = 0; kn < Sn; ++kn) {
    const Kn = Qt[kn][1];
    Kn < Zt && (Zt = Kn), Kn > $n && ($n = Kn);
  }
  return 1 / ($n - Zt);
}
function angleDelta(_e, Qt, Zt, $n, Sn) {
  const kn = Math.atan2(Sn * (Zt[1] - _e[1]), $n * (Zt[0] - _e[0])), Kn = Math.atan2(Sn * (Qt[1] - _e[1]), $n * (Qt[0] - _e[0]));
  return Math.abs(kn - Kn);
}
function multikey(_e) {
  return (Qt) => {
    const Zt = _e.length;
    let $n = 1, Sn = String(_e[0](Qt));
    for (; $n < Zt; ++$n)
      Sn += "|" + _e[$n](Qt);
    return Sn;
  };
}
function groupkey(_e) {
  return !_e || !_e.length ? function() {
    return "";
  } : _e.length === 1 ? _e[0] : multikey(_e);
}
function measureName(_e, Qt, Zt) {
  return Zt || _e + (Qt ? "_" + Qt : "");
}
const noop$7 = () => {
}, base_op = {
  init: noop$7,
  add: noop$7,
  rem: noop$7,
  idx: 0
}, AggregateOps = {
  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, Qt) => _e.sum += +Qt,
    rem: (_e, Qt) => _e.sum -= Qt
  },
  product: {
    init: (_e) => _e.product = 1,
    value: (_e) => _e.valid ? _e.product : void 0,
    add: (_e, Qt) => _e.product *= Qt,
    rem: (_e, Qt) => _e.product /= Qt
  },
  mean: {
    init: (_e) => _e.mean = 0,
    value: (_e) => _e.valid ? _e.mean : void 0,
    add: (_e, Qt) => (_e.mean_d = Qt - _e.mean, _e.mean += _e.mean_d / _e.valid),
    rem: (_e, Qt) => (_e.mean_d = Qt - _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, Qt) => _e.dev += _e.mean_d * (Qt - _e.mean),
    rem: (_e, Qt) => _e.dev -= _e.mean_d * (Qt - _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, Qt) => {
      (Qt < _e.min || _e.min === void 0) && (_e.min = Qt);
    },
    rem: (_e, Qt) => {
      Qt <= _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, Qt) => {
      (Qt > _e.max || _e.max === void 0) && (_e.max = Qt);
    },
    rem: (_e, Qt) => {
      Qt >= _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, Qt, Zt) => {
      Qt < _e.min && (_e.argmin = Zt);
    },
    rem: (_e, Qt) => {
      Qt <= _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, Qt, Zt) => {
      Qt > _e.max && (_e.argmax = Zt);
    },
    rem: (_e, Qt) => {
      Qt >= _e.max && (_e.argmax = void 0);
    },
    req: ["max", "values"],
    idx: 3
  }
}, ValidAggregateOps = Object.keys(AggregateOps).filter((_e) => _e !== "__count__");
function measure(_e, Qt) {
  return (Zt) => extend$1({
    name: _e,
    out: Zt || _e
  }, base_op, Qt);
}
[...ValidAggregateOps, "__count__"].forEach((_e) => {
  AggregateOps[_e] = measure(_e, AggregateOps[_e]);
});
function createMeasure(_e, Qt) {
  return AggregateOps[_e](Qt);
}
function compareIndex(_e, Qt) {
  return _e.idx - Qt.idx;
}
function resolve(_e) {
  const Qt = {};
  _e.forEach(($n) => Qt[$n.name] = $n);
  const Zt = ($n) => {
    $n.req && $n.req.forEach((Sn) => {
      Qt[Sn] || Zt(Qt[Sn] = AggregateOps[Sn]());
    });
  };
  return _e.forEach(Zt), Object.values(Qt).sort(compareIndex);
}
function init$1() {
  this.valid = 0, this.missing = 0, this._ops.forEach((_e) => _e.init(this));
}
function add$4(_e, Qt) {
  if (_e == null || _e === "") {
    ++this.missing;
    return;
  }
  _e === _e && (++this.valid, this._ops.forEach((Zt) => Zt.add(this, _e, Qt)));
}
function rem(_e, Qt) {
  if (_e == null || _e === "") {
    --this.missing;
    return;
  }
  _e === _e && (--this.valid, this._ops.forEach((Zt) => Zt.rem(this, _e, Qt)));
}
function set$5(_e) {
  return this._out.forEach((Qt) => _e[Qt.out] = Qt.value(this)), _e;
}
function compileMeasures(_e, Qt) {
  const Zt = Qt || identity$7, $n = resolve(_e), Sn = _e.slice().sort(compareIndex);
  function kn(Kn) {
    this._ops = $n, this._out = Sn, this.cell = Kn, this.init();
  }
  return kn.prototype.init = init$1, kn.prototype.add = add$4, kn.prototype.rem = rem, kn.prototype.set = set$5, kn.prototype.get = Zt, kn.fields = _e.map((Kn) => Kn.out), kn;
}
function TupleStore(_e) {
  this._key = _e ? field$1(_e) : tupleid, this.reset();
}
const prototype$1 = TupleStore.prototype;
prototype$1.reset = function() {
  this._add = [], this._rem = [], this._ext = null, this._get = null, this._q = null;
};
prototype$1.add = function(_e) {
  this._add.push(_e);
};
prototype$1.rem = function(_e) {
  this._rem.push(_e);
};
prototype$1.values = function() {
  if (this._get = null, this._rem.length === 0)
    return this._add;
  const _e = this._add, Qt = this._rem, Zt = this._key, $n = _e.length, Sn = Qt.length, kn = Array($n - Sn), Kn = {};
  let er, Cr, kr;
  for (er = 0; er < Sn; ++er)
    Kn[Zt(Qt[er])] = 1;
  for (er = 0, Cr = 0; er < $n; ++er)
    Kn[Zt(kr = _e[er])] ? Kn[Zt(kr)] = 0 : kn[Cr++] = kr;
  return this._rem = [], this._add = kn;
};
prototype$1.distinct = function(_e) {
  const Qt = this.values(), Zt = {};
  let $n = Qt.length, Sn = 0, kn;
  for (; --$n >= 0; )
    kn = _e(Qt[$n]) + "", has$1(Zt, kn) || (Zt[kn] = 1, ++Sn);
  return Sn;
};
prototype$1.extent = function(_e) {
  if (this._get !== _e || !this._ext) {
    const Qt = this.values(), Zt = extentIndex(Qt, _e);
    this._ext = [Qt[Zt[0]], Qt[Zt[1]]], this._get = _e;
  }
  return this._ext;
};
prototype$1.argmin = function(_e) {
  return this.extent(_e)[0] || {};
};
prototype$1.argmax = function(_e) {
  return this.extent(_e)[1] || {};
};
prototype$1.min = function(_e) {
  const Qt = this.extent(_e)[0];
  return Qt != null ? _e(Qt) : void 0;
};
prototype$1.max = function(_e) {
  const Qt = this.extent(_e)[1];
  return Qt != null ? _e(Qt) : void 0;
};
prototype$1.quartile = function(_e) {
  return (this._get !== _e || !this._q) && (this._q = quartiles(this.values(), _e), this._get = _e), this._q;
};
prototype$1.q1 = function(_e) {
  return this.quartile(_e)[0];
};
prototype$1.q2 = function(_e) {
  return this.quartile(_e)[1];
};
prototype$1.q3 = function(_e) {
  return this.quartile(_e)[2];
};
prototype$1.ci = function(_e) {
  return (this._get !== _e || !this._ci) && (this._ci = bootstrapCI(this.values(), 1e3, 0.05, _e), this._get = _e), this._ci;
};
prototype$1.ci0 = function(_e) {
  return this.ci(_e)[0];
};
prototype$1.ci1 = function(_e) {
  return this.ci(_e)[1];
};
function Aggregate$1(_e) {
  Transform$1.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;
}
Aggregate$1.Definition = {
  type: "Aggregate",
  metadata: {
    generates: !0,
    changes: !0
  },
  params: [{
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "ops",
    type: "enum",
    array: !0,
    values: ValidAggregateOps
  }, {
    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"
  }]
};
inherits(Aggregate$1, Transform$1, {
  transform(_e, Qt) {
    const Zt = this, $n = Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS), Sn = _e.modified();
    return Zt.stamp = $n.stamp, Zt.value && (Sn || Qt.modified(Zt._inputs, !0)) ? (Zt._prev = Zt.value, Zt.value = Sn ? Zt.init(_e) : /* @__PURE__ */ Object.create(null), Qt.visit(Qt.SOURCE, (kn) => Zt.add(kn))) : (Zt.value = Zt.value || Zt.init(_e), Qt.visit(Qt.REM, (kn) => Zt.rem(kn)), Qt.visit(Qt.ADD, (kn) => Zt.add(kn))), $n.modifies(Zt._outputs), Zt._drop = _e.drop !== !1, _e.cross && Zt._dims.length > 1 && (Zt._drop = !1, Zt.cross()), Qt.clean() && Zt._drop && $n.clean(!0).runAfter(() => this.clean()), Zt.changes($n);
  },
  cross() {
    const _e = this, Qt = _e.value, Zt = _e._dnames, $n = Zt.map(() => ({})), Sn = Zt.length;
    function kn(er) {
      let Cr, kr, Yr, Ms;
      for (Cr in er)
        for (Yr = er[Cr].tuple, kr = 0; kr < Sn; ++kr)
          $n[kr][Ms = Yr[Zt[kr]]] = Ms;
    }
    kn(_e._prev), kn(Qt);
    function Kn(er, Cr, kr) {
      const Yr = Zt[kr], Ms = $n[kr++];
      for (const Ds in Ms) {
        const Ls = er ? er + "|" + Ds : Ds;
        Cr[Yr] = Ms[Ds], kr < Sn ? Kn(Ls, Cr, kr) : Qt[Ls] || _e.cell(Ls, Cr);
      }
    }
    Kn("", {}, 0);
  },
  init(_e) {
    const Qt = this._inputs = [], Zt = this._outputs = [], $n = {};
    function Sn(Fs) {
      const Bs = array$6(accessorFields(Fs)), Hs = Bs.length;
      let Ws = 0, Ys;
      for (; Ws < Hs; ++Ws)
        $n[Ys = Bs[Ws]] || ($n[Ys] = 1, Qt.push(Ys));
    }
    this._dims = array$6(_e.groupby), this._dnames = this._dims.map((Fs) => {
      const Bs = accessorName(Fs);
      return Sn(Fs), Zt.push(Bs), Bs;
    }), this.cellkey = _e.key ? _e.key : groupkey(this._dims), this._countOnly = !0, this._counts = [], this._measures = [];
    const kn = _e.fields || [null], Kn = _e.ops || ["count"], er = _e.as || [], Cr = kn.length, kr = {};
    let Yr, Ms, Ds, Ls, js, zs;
    for (Cr !== Kn.length && error("Unmatched number of fields and aggregate ops."), zs = 0; zs < Cr; ++zs) {
      if (Yr = kn[zs], Ms = Kn[zs], Yr == null && Ms !== "count" && error("Null aggregate field specified."), Ls = accessorName(Yr), js = measureName(Ms, Ls, er[zs]), Zt.push(js), Ms === "count") {
        this._counts.push(js);
        continue;
      }
      Ds = kr[Ls], Ds || (Sn(Yr), Ds = kr[Ls] = [], Ds.field = Yr, this._measures.push(Ds)), Ms !== "count" && (this._countOnly = !1), Ds.push(createMeasure(Ms, js));
    }
    return this._measures = this._measures.map((Fs) => compileMeasures(Fs, Fs.field)), /* @__PURE__ */ Object.create(null);
  },
  // -- Cell Management -----
  cellkey: groupkey(),
  cell(_e, Qt) {
    let Zt = this.value[_e];
    return Zt ? Zt.num === 0 && this._drop && Zt.stamp < this.stamp ? (Zt.stamp = this.stamp, this._adds[this._alen++] = Zt) : Zt.stamp < this.stamp && (Zt.stamp = this.stamp, this._mods[this._mlen++] = Zt) : (Zt = this.value[_e] = this.newcell(_e, Qt), this._adds[this._alen++] = Zt), Zt;
  },
  newcell(_e, Qt) {
    const Zt = {
      key: _e,
      num: 0,
      agg: null,
      tuple: this.newtuple(Qt, this._prev && this._prev[_e]),
      stamp: this.stamp,
      store: !1
    };
    if (!this._countOnly) {
      const $n = this._measures, Sn = $n.length;
      Zt.agg = Array(Sn);
      for (let kn = 0; kn < Sn; ++kn)
        Zt.agg[kn] = new $n[kn](Zt);
    }
    return Zt.store && (Zt.data = new TupleStore()), Zt;
  },
  newtuple(_e, Qt) {
    const Zt = this._dnames, $n = this._dims, Sn = $n.length, kn = {};
    for (let Kn = 0; Kn < Sn; ++Kn)
      kn[Zt[Kn]] = $n[Kn](_e);
    return Qt ? replace$1(Qt.tuple, kn) : ingest$1(kn);
  },
  clean() {
    const _e = this.value;
    for (const Qt in _e)
      _e[Qt].num === 0 && delete _e[Qt];
  },
  // -- Process Tuples -----
  add(_e) {
    const Qt = this.cellkey(_e), Zt = this.cell(Qt, _e);
    if (Zt.num += 1, this._countOnly)
      return;
    Zt.store && Zt.data.add(_e);
    const $n = Zt.agg;
    for (let Sn = 0, kn = $n.length; Sn < kn; ++Sn)
      $n[Sn].add($n[Sn].get(_e), _e);
  },
  rem(_e) {
    const Qt = this.cellkey(_e), Zt = this.cell(Qt, _e);
    if (Zt.num -= 1, this._countOnly)
      return;
    Zt.store && Zt.data.rem(_e);
    const $n = Zt.agg;
    for (let Sn = 0, kn = $n.length; Sn < kn; ++Sn)
      $n[Sn].rem($n[Sn].get(_e), _e);
  },
  celltuple(_e) {
    const Qt = _e.tuple, Zt = this._counts;
    _e.store && _e.data.values();
    for (let $n = 0, Sn = Zt.length; $n < Sn; ++$n)
      Qt[Zt[$n]] = _e.num;
    if (!this._countOnly) {
      const $n = _e.agg;
      for (let Sn = 0, kn = $n.length; Sn < kn; ++Sn)
        $n[Sn].set(Qt);
    }
    return Qt;
  },
  changes(_e) {
    const Qt = this._adds, Zt = this._mods, $n = this._prev, Sn = this._drop, kn = _e.add, Kn = _e.rem, er = _e.mod;
    let Cr, kr, Yr, Ms;
    if ($n)
      for (kr in $n)
        Cr = $n[kr], (!Sn || Cr.num) && Kn.push(Cr.tuple);
    for (Yr = 0, Ms = this._alen; Yr < Ms; ++Yr)
      kn.push(this.celltuple(Qt[Yr])), Qt[Yr] = null;
    for (Yr = 0, Ms = this._mlen; Yr < Ms; ++Yr)
      Cr = Zt[Yr], (Cr.num === 0 && Sn ? Kn : er).push(this.celltuple(Cr)), Zt[Yr] = null;
    return this._alen = this._mlen = 0, this._prev = null, _e;
  }
});
const EPSILON$1 = 1e-14;
function Bin(_e) {
  Transform$1.call(this, null, _e);
}
Bin.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"]
  }]
};
inherits(Bin, Transform$1, {
  transform(_e, Qt) {
    const Zt = _e.interval !== !1, $n = this._bins(_e), Sn = $n.start, kn = $n.step, Kn = _e.as || ["bin0", "bin1"], er = Kn[0], Cr = Kn[1];
    let kr;
    return _e.modified() ? (Qt = Qt.reflow(!0), kr = Qt.SOURCE) : kr = Qt.modified(accessorFields(_e.field)) ? Qt.ADD_MOD : Qt.ADD, Qt.visit(kr, Zt ? (Yr) => {
      const Ms = $n(Yr);
      Yr[er] = Ms, Yr[Cr] = Ms == null ? null : Sn + kn * (1 + (Ms - Sn) / kn);
    } : (Yr) => Yr[er] = $n(Yr)), Qt.modifies(Zt ? Kn : er);
  },
  _bins(_e) {
    if (this.value && !_e.modified())
      return this.value;
    const Qt = _e.field, Zt = bin(_e), $n = Zt.step;
    let Sn = Zt.start, kn = Sn + Math.ceil((Zt.stop - Sn) / $n) * $n, Kn, er;
    (Kn = _e.anchor) != null && (er = Kn - (Sn + $n * Math.floor((Kn - Sn) / $n)), Sn += er, kn += er);
    const Cr = function(kr) {
      let Yr = toNumber(Qt(kr));
      return Yr == null ? null : Yr < Sn ? -1 / 0 : Yr > kn ? 1 / 0 : (Yr = Math.max(Sn, Math.min(Yr, kn - $n)), Sn + $n * Math.floor(EPSILON$1 + (Yr - Sn) / $n));
    };
    return Cr.start = Sn, Cr.stop = Zt.stop, Cr.step = $n, this.value = accessor(Cr, accessorFields(Qt), _e.name || "bin_" + accessorName(Qt));
  }
});
function SortedList(_e, Qt, Zt) {
  const $n = _e;
  let Sn = Qt || [], kn = Zt || [], Kn = {}, er = 0;
  return {
    add: (Cr) => kn.push(Cr),
    remove: (Cr) => Kn[$n(Cr)] = ++er,
    size: () => Sn.length,
    data: (Cr, kr) => (er && (Sn = Sn.filter((Yr) => !Kn[$n(Yr)]), Kn = {}, er = 0), kr && Cr && Sn.sort(Cr), kn.length && (Sn = Cr ? merge$3(Cr, Sn, kn.sort(Cr)) : Sn.concat(kn), kn = []), Sn)
  };
}
function Collect$1(_e) {
  Transform$1.call(this, [], _e);
}
Collect$1.Definition = {
  type: "Collect",
  metadata: {
    source: !0
  },
  params: [{
    name: "sort",
    type: "compare"
  }]
};
inherits(Collect$1, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.fork(Qt.ALL), $n = SortedList(tupleid, this.value, Zt.materialize(Zt.ADD).add), Sn = _e.sort, kn = Qt.changed() || Sn && (_e.modified("sort") || Qt.modified(Sn.fields));
    return Zt.visit(Zt.REM, $n.remove), this.modified(kn), this.value = Zt.source = $n.data(stableCompare(Sn), kn), Qt.source && Qt.source.root && (this.value.root = Qt.source.root), Zt;
  }
});
function Compare$1(_e) {
  Operator.call(this, null, update$5, _e);
}
inherits(Compare$1, Operator);
function update$5(_e) {
  return this.value && !_e.modified() ? this.value : compare$9(_e.fields, _e.orders);
}
function CountPattern(_e) {
  Transform$1.call(this, null, _e);
}
CountPattern.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 tokenize(_e, Qt, Zt) {
  switch (Qt) {
    case "upper":
      _e = _e.toUpperCase();
      break;
    case "lower":
      _e = _e.toLowerCase();
      break;
  }
  return _e.match(Zt);
}
inherits(CountPattern, Transform$1, {
  transform(_e, Qt) {
    const Zt = (Ms) => (Ds) => {
      for (var Ls = tokenize(er(Ds), _e.case, kn) || [], js, zs = 0, Fs = Ls.length; zs < Fs; ++zs)
        Kn.test(js = Ls[zs]) || Ms(js);
    }, $n = this._parameterCheck(_e, Qt), Sn = this._counts, kn = this._match, Kn = this._stop, er = _e.field, Cr = _e.as || ["text", "count"], kr = Zt((Ms) => Sn[Ms] = 1 + (Sn[Ms] || 0)), Yr = Zt((Ms) => Sn[Ms] -= 1);
    return $n ? Qt.visit(Qt.SOURCE, kr) : (Qt.visit(Qt.ADD, kr), Qt.visit(Qt.REM, Yr)), this._finish(Qt, Cr);
  },
  _parameterCheck(_e, Qt) {
    let Zt = !1;
    return (_e.modified("stopwords") || !this._stop) && (this._stop = new RegExp("^" + (_e.stopwords || "") + "$", "i"), Zt = !0), (_e.modified("pattern") || !this._match) && (this._match = new RegExp(_e.pattern || "[\\w']+", "g"), Zt = !0), (_e.modified("field") || Qt.modified(_e.field.fields)) && (Zt = !0), Zt && (this._counts = {}), Zt;
  },
  _finish(_e, Qt) {
    const Zt = this._counts, $n = this._tuples || (this._tuples = {}), Sn = Qt[0], kn = Qt[1], Kn = _e.fork(_e.NO_SOURCE | _e.NO_FIELDS);
    let er, Cr, kr;
    for (er in Zt)
      Cr = $n[er], kr = Zt[er] || 0, !Cr && kr ? ($n[er] = Cr = ingest$1({}), Cr[Sn] = er, Cr[kn] = kr, Kn.add.push(Cr)) : kr === 0 ? (Cr && Kn.rem.push(Cr), Zt[er] = null, $n[er] = null) : Cr[kn] !== kr && (Cr[kn] = kr, Kn.mod.push(Cr));
    return Kn.modifies(Qt);
  }
});
function Cross(_e) {
  Transform$1.call(this, null, _e);
}
Cross.Definition = {
  type: "Cross",
  metadata: {
    generates: !0
  },
  params: [{
    name: "filter",
    type: "expr"
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: 2,
    default: ["a", "b"]
  }]
};
inherits(Cross, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.fork(Qt.NO_SOURCE), $n = _e.as || ["a", "b"], Sn = $n[0], kn = $n[1], Kn = !this.value || Qt.changed(Qt.ADD_REM) || _e.modified("as") || _e.modified("filter");
    let er = this.value;
    return Kn ? (er && (Zt.rem = er), er = Qt.materialize(Qt.SOURCE).source, Zt.add = this.value = cross(er, Sn, kn, _e.filter || truthy)) : Zt.mod = er, Zt.source = this.value, Zt.modifies($n);
  }
});
function cross(_e, Qt, Zt, $n) {
  for (var Sn = [], kn = {}, Kn = _e.length, er = 0, Cr, kr; er < Kn; ++er)
    for (kn[Qt] = kr = _e[er], Cr = 0; Cr < Kn; ++Cr)
      kn[Zt] = _e[Cr], $n(kn) && (Sn.push(ingest$1(kn)), kn = {}, kn[Qt] = kr);
  return Sn;
}
const Distributions = {
  kde,
  mixture: mixture$1,
  normal: gaussian,
  lognormal,
  uniform
}, DISTRIBUTIONS = "distributions", FUNCTION = "function", FIELD = "field";
function parse$5(_e, Qt) {
  const Zt = _e[FUNCTION];
  has$1(Distributions, Zt) || error("Unknown distribution function: " + Zt);
  const $n = Distributions[Zt]();
  for (const Sn in _e)
    Sn === FIELD ? $n.data((_e.from || Qt()).map(_e[Sn])) : Sn === DISTRIBUTIONS ? $n[Sn](_e[Sn].map((kn) => parse$5(kn, Qt))) : typeof $n[Sn] === FUNCTION && $n[Sn](_e[Sn]);
  return $n;
}
function Density(_e) {
  Transform$1.call(this, null, _e);
}
const distributions = [{
  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
  }]
}], mixture = {
  key: {
    function: "mixture"
  },
  params: [{
    name: "distributions",
    type: "param",
    array: !0,
    params: distributions
  }, {
    name: "weights",
    type: "number",
    array: !0
  }]
};
Density.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: distributions.concat(mixture)
  }, {
    name: "as",
    type: "string",
    array: !0,
    default: ["value", "density"]
  }]
};
inherits(Density, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS);
    if (!this.value || Qt.changed() || _e.modified()) {
      const $n = parse$5(_e.distribution, source$1(Qt)), Sn = _e.steps || _e.minsteps || 25, kn = _e.steps || _e.maxsteps || 200;
      let Kn = _e.method || "pdf";
      Kn !== "pdf" && Kn !== "cdf" && error("Invalid density method: " + Kn), !_e.extent && !$n.data && error("Missing density extent parameter."), Kn = $n[Kn];
      const er = _e.as || ["value", "density"], Cr = _e.extent || extent($n.data()), kr = sampleCurve(Kn, Cr, Sn, kn).map((Yr) => {
        const Ms = {};
        return Ms[er[0]] = Yr[0], Ms[er[1]] = Yr[1], ingest$1(Ms);
      });
      this.value && (Zt.rem = this.value), this.value = Zt.add = Zt.source = kr;
    }
    return Zt;
  }
});
function source$1(_e) {
  return () => _e.materialize(_e.SOURCE).source;
}
function fieldNames(_e, Qt) {
  return _e ? _e.map((Zt, $n) => Qt[$n] || accessorName(Zt)) : null;
}
function partition$1$1(_e, Qt, Zt) {
  const $n = [], Sn = (Ms) => Ms(Cr);
  let kn, Kn, er, Cr, kr, Yr;
  if (Qt == null)
    $n.push(_e.map(Zt));
  else
    for (kn = {}, Kn = 0, er = _e.length; Kn < er; ++Kn)
      Cr = _e[Kn], kr = Qt.map(Sn), Yr = kn[kr], Yr || (kn[kr] = Yr = [], Yr.dims = kr, $n.push(Yr)), Yr.push(Zt(Cr));
  return $n;
}
const Output$5 = "bin";
function DotBin(_e) {
  Transform$1.call(this, null, _e);
}
DotBin.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: Output$5
  }]
};
const autostep = (_e, Qt) => span(extent(_e, Qt)) / 30;
inherits(DotBin, Transform$1, {
  transform(_e, Qt) {
    if (this.value && !(_e.modified() || Qt.changed()))
      return Qt;
    const Zt = Qt.materialize(Qt.SOURCE).source, $n = partition$1$1(Qt.source, _e.groupby, identity$7), Sn = _e.smooth || !1, kn = _e.field, Kn = _e.step || autostep(Zt, kn), er = stableCompare((js, zs) => kn(js) - kn(zs)), Cr = _e.as || Output$5, kr = $n.length;
    let Yr = 1 / 0, Ms = -1 / 0, Ds = 0, Ls;
    for (; Ds < kr; ++Ds) {
      const js = $n[Ds].sort(er);
      Ls = -1;
      for (const zs of dotbin(js, Kn, Sn, kn))
        zs < Yr && (Yr = zs), zs > Ms && (Ms = zs), js[++Ls][Cr] = zs;
    }
    return this.value = {
      start: Yr,
      stop: Ms,
      step: Kn
    }, Qt.reflow(!0).modifies(Cr);
  }
});
function Expression$1(_e) {
  Operator.call(this, null, update$4, _e), this.modified(!0);
}
inherits(Expression$1, Operator);
function update$4(_e) {
  const Qt = _e.expr;
  return this.value && !_e.modified("expr") ? this.value : accessor((Zt) => Qt(Zt, _e), accessorFields(Qt), accessorName(Qt));
}
function Extent(_e) {
  Transform$1.call(this, [void 0, void 0], _e);
}
Extent.Definition = {
  type: "Extent",
  metadata: {},
  params: [{
    name: "field",
    type: "field",
    required: !0
  }]
};
inherits(Extent, Transform$1, {
  transform(_e, Qt) {
    const Zt = this.value, $n = _e.field, Sn = Qt.changed() || Qt.modified($n.fields) || _e.modified("field");
    let kn = Zt[0], Kn = Zt[1];
    if ((Sn || kn == null) && (kn = 1 / 0, Kn = -1 / 0), Qt.visit(Sn ? Qt.SOURCE : Qt.ADD, (er) => {
      const Cr = toNumber($n(er));
      Cr != null && (Cr < kn && (kn = Cr), Cr > Kn && (Kn = Cr));
    }), !Number.isFinite(kn) || !Number.isFinite(Kn)) {
      let er = accessorName($n);
      er && (er = ` for field "${er}"`), Qt.dataflow.warn(`Infinite extent${er}: [${kn}, ${Kn}]`), kn = Kn = void 0;
    }
    this.value = [kn, Kn];
  }
});
function Subflow(_e, Qt) {
  Operator.call(this, _e), this.parent = Qt, this.count = 0;
}
inherits(Subflow, Operator, {
  /**
   * Routes pulses from this subflow to a target transform.
   * @param {Transform} target - A transform that receives the subflow of tuples.
   */
  connect(_e) {
    return this.detachSubflow = _e.detachSubflow, this.targets().add(_e), _e.source = this;
  },
  /**
   * Add an 'add' tuple to the subflow pulse.
   * @param {Tuple} t - The tuple being added.
   */
  add(_e) {
    this.count += 1, this.value.add.push(_e);
  },
  /**
   * Add a 'rem' tuple to the subflow pulse.
   * @param {Tuple} t - The tuple being removed.
   */
  rem(_e) {
    this.count -= 1, this.value.rem.push(_e);
  },
  /**
   * Add a 'mod' tuple to the subflow pulse.
   * @param {Tuple} t - The tuple being modified.
   */
  mod(_e) {
    this.value.mod.push(_e);
  },
  /**
   * Re-initialize this operator's pulse value.
   * @param {Pulse} pulse - The pulse to copy from.
   * @see Pulse.init
   */
  init(_e) {
    this.value.init(_e, _e.NO_SOURCE);
  },
  /**
   * Evaluate this operator. This method overrides the
   * default behavior to simply return the contained pulse value.
   * @return {Pulse}
   */
  evaluate() {
    return this.value;
  }
});
function Facet$1(_e) {
  Transform$1.call(this, {}, _e), this._keys = fastmap();
  const Qt = this._targets = [];
  Qt.active = 0, Qt.forEach = (Zt) => {
    for (let $n = 0, Sn = Qt.active; $n < Sn; ++$n)
      Zt(Qt[$n], $n, Qt);
  };
}
inherits(Facet$1, Transform$1, {
  activate(_e) {
    this._targets[this._targets.active++] = _e;
  },
  // parent argument provided by PreFacet subclass
  subflow(_e, Qt, Zt, $n) {
    const Sn = this.value;
    let kn = has$1(Sn, _e) && Sn[_e], Kn, er;
    return kn ? kn.value.stamp < Zt.stamp && (kn.init(Zt), this.activate(kn)) : (er = $n || (er = this._group[_e]) && er.tuple, Kn = Zt.dataflow, kn = new Subflow(Zt.fork(Zt.NO_SOURCE), this), Kn.add(kn).connect(Qt(Kn, _e, er)), Sn[_e] = kn, this.activate(kn)), kn;
  },
  clean() {
    const _e = this.value;
    let Qt = 0;
    for (const Zt in _e)
      if (_e[Zt].count === 0) {
        const $n = _e[Zt].detachSubflow;
        $n && $n(), delete _e[Zt], ++Qt;
      }
    if (Qt) {
      const Zt = this._targets.filter(($n) => $n && $n.count > 0);
      this.initTargets(Zt);
    }
  },
  initTargets(_e) {
    const Qt = this._targets, Zt = Qt.length, $n = _e ? _e.length : 0;
    let Sn = 0;
    for (; Sn < $n; ++Sn)
      Qt[Sn] = _e[Sn];
    for (; Sn < Zt && Qt[Sn] != null; ++Sn)
      Qt[Sn] = null;
    Qt.active = $n;
  },
  transform(_e, Qt) {
    const Zt = Qt.dataflow, $n = _e.key, Sn = _e.subflow, kn = this._keys, Kn = _e.modified("key"), er = (Cr) => this.subflow(Cr, Sn, Qt);
    return this._group = _e.group || {}, this.initTargets(), Qt.visit(Qt.REM, (Cr) => {
      const kr = tupleid(Cr), Yr = kn.get(kr);
      Yr !== void 0 && (kn.delete(kr), er(Yr).rem(Cr));
    }), Qt.visit(Qt.ADD, (Cr) => {
      const kr = $n(Cr);
      kn.set(tupleid(Cr), kr), er(kr).add(Cr);
    }), Kn || Qt.modified($n.fields) ? Qt.visit(Qt.MOD, (Cr) => {
      const kr = tupleid(Cr), Yr = kn.get(kr), Ms = $n(Cr);
      Yr === Ms ? er(Ms).mod(Cr) : (kn.set(kr, Ms), er(Yr).rem(Cr), er(Ms).add(Cr));
    }) : Qt.changed(Qt.MOD) && Qt.visit(Qt.MOD, (Cr) => {
      er(kn.get(tupleid(Cr))).mod(Cr);
    }), Kn && Qt.visit(Qt.REFLOW, (Cr) => {
      const kr = tupleid(Cr), Yr = kn.get(kr), Ms = $n(Cr);
      Yr !== Ms && (kn.set(kr, Ms), er(Yr).rem(Cr), er(Ms).add(Cr));
    }), Qt.clean() ? Zt.runAfter(() => {
      this.clean(), kn.clean();
    }) : kn.empty > Zt.cleanThreshold && Zt.runAfter(kn.clean), Qt;
  }
});
function Field$1(_e) {
  Operator.call(this, null, update$3, _e);
}
inherits(Field$1, Operator);
function update$3(_e) {
  return this.value && !_e.modified() ? this.value : isArray(_e.name) ? array$6(_e.name).map((Qt) => field$1(Qt)) : field$1(_e.name, _e.as);
}
function Filter(_e) {
  Transform$1.call(this, fastmap(), _e);
}
Filter.Definition = {
  type: "Filter",
  metadata: {
    changes: !0
  },
  params: [{
    name: "expr",
    type: "expr",
    required: !0
  }]
};
inherits(Filter, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.dataflow, $n = this.value, Sn = Qt.fork(), kn = Sn.add, Kn = Sn.rem, er = Sn.mod, Cr = _e.expr;
    let kr = !0;
    Qt.visit(Qt.REM, (Ms) => {
      const Ds = tupleid(Ms);
      $n.has(Ds) ? $n.delete(Ds) : Kn.push(Ms);
    }), Qt.visit(Qt.ADD, (Ms) => {
      Cr(Ms, _e) ? kn.push(Ms) : $n.set(tupleid(Ms), 1);
    });
    function Yr(Ms) {
      const Ds = tupleid(Ms), Ls = Cr(Ms, _e), js = $n.get(Ds);
      Ls && js ? ($n.delete(Ds), kn.push(Ms)) : !Ls && !js ? ($n.set(Ds, 1), Kn.push(Ms)) : kr && Ls && !js && er.push(Ms);
    }
    return Qt.visit(Qt.MOD, Yr), _e.modified() && (kr = !1, Qt.visit(Qt.REFLOW, Yr)), $n.empty > Zt.cleanThreshold && Zt.runAfter($n.clean), Sn;
  }
});
function Flatten(_e) {
  Transform$1.call(this, [], _e);
}
Flatten.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
  }]
};
inherits(Flatten, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.fork(Qt.NO_SOURCE), $n = _e.fields, Sn = fieldNames($n, _e.as || []), kn = _e.index || null, Kn = Sn.length;
    return Zt.rem = this.value, Qt.visit(Qt.SOURCE, (er) => {
      const Cr = $n.map((js) => js(er)), kr = Cr.reduce((js, zs) => Math.max(js, zs.length), 0);
      let Yr = 0, Ms, Ds, Ls;
      for (; Yr < kr; ++Yr) {
        for (Ds = derive(er), Ms = 0; Ms < Kn; ++Ms)
          Ds[Sn[Ms]] = (Ls = Cr[Ms][Yr]) == null ? null : Ls;
        kn && (Ds[kn] = Yr), Zt.add.push(Ds);
      }
    }), this.value = Zt.source = Zt.add, kn && Zt.modifies(kn), Zt.modifies(Sn);
  }
});
function Fold(_e) {
  Transform$1.call(this, [], _e);
}
Fold.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"]
  }]
};
inherits(Fold, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.fork(Qt.NO_SOURCE), $n = _e.fields, Sn = $n.map(accessorName), kn = _e.as || ["key", "value"], Kn = kn[0], er = kn[1], Cr = $n.length;
    return Zt.rem = this.value, Qt.visit(Qt.SOURCE, (kr) => {
      for (let Yr = 0, Ms; Yr < Cr; ++Yr)
        Ms = derive(kr), Ms[Kn] = Sn[Yr], Ms[er] = $n[Yr](kr), Zt.add.push(Ms);
    }), this.value = Zt.source = Zt.add, Zt.modifies(kn);
  }
});
function Formula(_e) {
  Transform$1.call(this, null, _e);
}
Formula.Definition = {
  type: "Formula",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "expr",
    type: "expr",
    required: !0
  }, {
    name: "as",
    type: "string",
    required: !0
  }, {
    name: "initonly",
    type: "boolean"
  }]
};
inherits(Formula, Transform$1, {
  transform(_e, Qt) {
    const Zt = _e.expr, $n = _e.as, Sn = _e.modified(), kn = _e.initonly ? Qt.ADD : Sn ? Qt.SOURCE : Qt.modified(Zt.fields) || Qt.modified($n) ? Qt.ADD_MOD : Qt.ADD;
    return Sn && (Qt = Qt.materialize().reflow(!0)), _e.initonly || Qt.modifies($n), Qt.visit(kn, (Kn) => Kn[$n] = Zt(Kn, _e));
  }
});
function Generate(_e) {
  Transform$1.call(this, [], _e);
}
inherits(Generate, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.fork(Qt.ALL), $n = _e.generator;
    let Sn = this.value, kn = _e.size - Sn.length, Kn, er, Cr;
    if (kn > 0) {
      for (Kn = []; --kn >= 0; )
        Kn.push(Cr = ingest$1($n(_e))), Sn.push(Cr);
      Zt.add = Zt.add.length ? Zt.materialize(Zt.ADD).add.concat(Kn) : Kn;
    } else
      er = Sn.slice(0, -kn), Zt.rem = Zt.rem.length ? Zt.materialize(Zt.REM).rem.concat(er) : er, Sn = Sn.slice(-kn);
    return Zt.source = this.value = Sn, Zt;
  }
});
const Methods$1 = {
  value: "value",
  median,
  mean,
  min: min$2,
  max: max$2
}, Empty$1 = [];
function Impute(_e) {
  Transform$1.call(this, [], _e);
}
Impute.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 getValue$1(_e) {
  var Qt = _e.method || Methods$1.value, Zt;
  if (Methods$1[Qt] == null)
    error("Unrecognized imputation method: " + Qt);
  else
    return Qt === Methods$1.value ? (Zt = _e.value !== void 0 ? _e.value : 0, () => Zt) : Methods$1[Qt];
}
function getField$1(_e) {
  const Qt = _e.field;
  return (Zt) => Zt ? Qt(Zt) : NaN;
}
inherits(Impute, Transform$1, {
  transform(_e, Qt) {
    var Zt = Qt.fork(Qt.ALL), $n = getValue$1(_e), Sn = getField$1(_e), kn = accessorName(_e.field), Kn = accessorName(_e.key), er = (_e.groupby || []).map(accessorName), Cr = partition$4(Qt.source, _e.groupby, _e.key, _e.keyvals), kr = [], Yr = this.value, Ms = Cr.domain.length, Ds, Ls, js, zs, Fs, Bs, Hs, Ws, Ys, El;
    for (Fs = 0, Ws = Cr.length; Fs < Ws; ++Fs)
      for (Ds = Cr[Fs], js = Ds.values, Ls = NaN, Hs = 0; Hs < Ms; ++Hs)
        if (Ds[Hs] == null) {
          for (zs = Cr.domain[Hs], El = {
            _impute: !0
          }, Bs = 0, Ys = js.length; Bs < Ys; ++Bs)
            El[er[Bs]] = js[Bs];
          El[Kn] = zs, El[kn] = Number.isNaN(Ls) ? Ls = $n(Ds, Sn) : Ls, kr.push(ingest$1(El));
        }
    return kr.length && (Zt.add = Zt.materialize(Zt.ADD).add.concat(kr)), Yr.length && (Zt.rem = Zt.materialize(Zt.REM).rem.concat(Yr)), this.value = kr, Zt;
  }
});
function partition$4(_e, Qt, Zt, $n) {
  var Sn = (Bs) => Bs(Fs), kn = [], Kn = $n ? $n.slice() : [], er = {}, Cr = {}, kr, Yr, Ms, Ds, Ls, js, zs, Fs;
  for (Kn.forEach((Bs, Hs) => er[Bs] = Hs + 1), Ds = 0, zs = _e.length; Ds < zs; ++Ds)
    Fs = _e[Ds], js = Zt(Fs), Ls = er[js] || (er[js] = Kn.push(js)), Yr = (kr = Qt ? Qt.map(Sn) : Empty$1) + "", (Ms = Cr[Yr]) || (Ms = Cr[Yr] = [], kn.push(Ms), Ms.values = kr), Ms[Ls - 1] = Fs;
  return kn.domain = Kn, kn;
}
function JoinAggregate(_e) {
  Aggregate$1.call(this, _e);
}
JoinAggregate.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: ValidAggregateOps
  }, {
    name: "as",
    type: "string",
    null: !0,
    array: !0
  }, {
    name: "key",
    type: "field"
  }]
};
inherits(JoinAggregate, Aggregate$1, {
  transform(_e, Qt) {
    const Zt = this, $n = _e.modified();
    let Sn;
    return Zt.value && ($n || Qt.modified(Zt._inputs, !0)) ? (Sn = Zt.value = $n ? Zt.init(_e) : {}, Qt.visit(Qt.SOURCE, (kn) => Zt.add(kn))) : (Sn = Zt.value = Zt.value || this.init(_e), Qt.visit(Qt.REM, (kn) => Zt.rem(kn)), Qt.visit(Qt.ADD, (kn) => Zt.add(kn))), Zt.changes(), Qt.visit(Qt.SOURCE, (kn) => {
      extend$1(kn, Sn[Zt.cellkey(kn)].tuple);
    }), Qt.reflow($n).modifies(this._outputs);
  },
  changes() {
    const _e = this._adds, Qt = this._mods;
    let Zt, $n;
    for (Zt = 0, $n = this._alen; Zt < $n; ++Zt)
      this.celltuple(_e[Zt]), _e[Zt] = null;
    for (Zt = 0, $n = this._mlen; Zt < $n; ++Zt)
      this.celltuple(Qt[Zt]), Qt[Zt] = null;
    this._alen = this._mlen = 0;
  }
});
function KDE(_e) {
  Transform$1.call(this, null, _e);
}
KDE.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"]
  }]
};
inherits(KDE, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS);
    if (!this.value || Qt.changed() || _e.modified()) {
      const $n = Qt.materialize(Qt.SOURCE).source, Sn = partition$1$1($n, _e.groupby, _e.field), kn = (_e.groupby || []).map(accessorName), Kn = _e.bandwidth, er = _e.cumulative ? "cdf" : "pdf", Cr = _e.as || ["value", "density"], kr = [];
      let Yr = _e.extent, Ms = _e.steps || _e.minsteps || 25, Ds = _e.steps || _e.maxsteps || 200;
      er !== "pdf" && er !== "cdf" && error("Invalid density method: " + er), _e.resolve === "shared" && (Yr || (Yr = extent($n, _e.field)), Ms = Ds = _e.steps || Ds), Sn.forEach((Ls) => {
        const js = kde(Ls, Kn)[er], zs = _e.counts ? Ls.length : 1, Fs = Yr || extent(Ls);
        sampleCurve(js, Fs, Ms, Ds).forEach((Bs) => {
          const Hs = {};
          for (let Ws = 0; Ws < kn.length; ++Ws)
            Hs[kn[Ws]] = Ls.dims[Ws];
          Hs[Cr[0]] = Bs[0], Hs[Cr[1]] = Bs[1] * zs, kr.push(ingest$1(Hs));
        });
      }), this.value && (Zt.rem = this.value), this.value = Zt.add = Zt.source = kr;
    }
    return Zt;
  }
});
function Key$1(_e) {
  Operator.call(this, null, update$2, _e);
}
inherits(Key$1, Operator);
function update$2(_e) {
  return this.value && !_e.modified() ? this.value : key(_e.fields, _e.flat);
}
function Load$1(_e) {
  Transform$1.call(this, [], _e), this._pending = null;
}
inherits(Load$1, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.dataflow;
    return this._pending ? output(this, Qt, this._pending) : stop(_e) ? Qt.StopPropagation : _e.values ? output(this, Qt, Zt.parse(_e.values, _e.format)) : _e.async ? {
      async: Zt.request(_e.url, _e.format).then((Sn) => (this._pending = array$6(Sn.data), (kn) => kn.touch(this)))
    } : Zt.request(_e.url, _e.format).then(($n) => output(this, Qt, array$6($n.data)));
  }
});
function stop(_e) {
  return _e.modified("async") && !(_e.modified("values") || _e.modified("url") || _e.modified("format"));
}
function output(_e, Qt, Zt) {
  Zt.forEach(ingest$1);
  const $n = Qt.fork(Qt.NO_FIELDS & Qt.NO_SOURCE);
  return $n.rem = _e.value, _e.value = $n.source = $n.add = Zt, _e._pending = null, $n.rem.length && $n.clean(!0), $n;
}
function Lookup(_e) {
  Transform$1.call(this, {}, _e);
}
Lookup.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
  }]
};
inherits(Lookup, Transform$1, {
  transform(_e, Qt) {
    const Zt = _e.fields, $n = _e.index, Sn = _e.values, kn = _e.default == null ? null : _e.default, Kn = _e.modified(), er = Zt.length;
    let Cr = Kn ? Qt.SOURCE : Qt.ADD, kr = Qt, Yr = _e.as, Ms, Ds, Ls;
    return Sn ? (Ds = Sn.length, er > 1 && !Yr && error('Multi-field lookup requires explicit "as" parameter.'), Yr && Yr.length !== er * Ds && error('The "as" parameter has too few output field names.'), Yr = Yr || Sn.map(accessorName), Ms = function(js) {
      for (var zs = 0, Fs = 0, Bs, Hs; zs < er; ++zs)
        if (Hs = $n.get(Zt[zs](js)), Hs == null)
          for (Bs = 0; Bs < Ds; ++Bs, ++Fs)
            js[Yr[Fs]] = kn;
        else
          for (Bs = 0; Bs < Ds; ++Bs, ++Fs)
            js[Yr[Fs]] = Sn[Bs](Hs);
    }) : (Yr || error("Missing output field names."), Ms = function(js) {
      for (var zs = 0, Fs; zs < er; ++zs)
        Fs = $n.get(Zt[zs](js)), js[Yr[zs]] = Fs ?? kn;
    }), Kn ? kr = Qt.reflow(!0) : (Ls = Zt.some((js) => Qt.modified(js.fields)), Cr |= Ls ? Qt.MOD : 0), Qt.visit(Cr, Ms), kr.modifies(Yr);
  }
});
function MultiExtent$1(_e) {
  Operator.call(this, null, update$1, _e);
}
inherits(MultiExtent$1, Operator);
function update$1(_e) {
  if (this.value && !_e.modified())
    return this.value;
  const Qt = _e.extents, Zt = Qt.length;
  let $n = 1 / 0, Sn = -1 / 0, kn, Kn;
  for (kn = 0; kn < Zt; ++kn)
    Kn = Qt[kn], Kn[0] < $n && ($n = Kn[0]), Kn[1] > Sn && (Sn = Kn[1]);
  return [$n, Sn];
}
function MultiValues$1(_e) {
  Operator.call(this, null, update$6, _e);
}
inherits(MultiValues$1, Operator);
function update$6(_e) {
  return this.value && !_e.modified() ? this.value : _e.values.reduce((Qt, Zt) => Qt.concat(Zt), []);
}
function Params$2(_e) {
  Transform$1.call(this, null, _e);
}
inherits(Params$2, Transform$1, {
  transform(_e, Qt) {
    return this.modified(_e.modified()), this.value = _e, Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS);
  }
});
function Pivot(_e) {
  Aggregate$1.call(this, _e);
}
Pivot.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: ValidAggregateOps,
    default: "sum"
  }, {
    name: "limit",
    type: "number",
    default: 0
  }, {
    name: "key",
    type: "field"
  }]
};
inherits(Pivot, Aggregate$1, {
  _transform: Aggregate$1.prototype.transform,
  transform(_e, Qt) {
    return this._transform(aggregateParams(_e, Qt), Qt);
  }
});
function aggregateParams(_e, Qt) {
  const Zt = _e.field, $n = _e.value, Sn = (_e.op === "count" ? "__count__" : _e.op) || "sum", kn = accessorFields(Zt).concat(accessorFields($n)), Kn = pivotKeys(Zt, _e.limit || 0, Qt);
  return Qt.changed() && _e.set("__pivot__", null, null, !0), {
    key: _e.key,
    groupby: _e.groupby,
    ops: Kn.map(() => Sn),
    fields: Kn.map((er) => get$6(er, Zt, $n, kn)),
    as: Kn.map((er) => er + ""),
    modified: _e.modified.bind(_e)
  };
}
function get$6(_e, Qt, Zt, $n) {
  return accessor((Sn) => Qt(Sn) === _e ? Zt(Sn) : NaN, $n, _e + "");
}
function pivotKeys(_e, Qt, Zt) {
  const $n = {}, Sn = [];
  return Zt.visit(Zt.SOURCE, (kn) => {
    const Kn = _e(kn);
    $n[Kn] || ($n[Kn] = 1, Sn.push(Kn));
  }), Sn.sort(ascending$4), Qt ? Sn.slice(0, Qt) : Sn;
}
function PreFacet$1(_e) {
  Facet$1.call(this, _e);
}
inherits(PreFacet$1, Facet$1, {
  transform(_e, Qt) {
    const Zt = _e.subflow, $n = _e.field, Sn = (kn) => this.subflow(tupleid(kn), Zt, Qt, kn);
    return (_e.modified("field") || $n && Qt.modified(accessorFields($n))) && error("PreFacet does not support field modification."), this.initTargets(), $n ? (Qt.visit(Qt.MOD, (kn) => {
      const Kn = Sn(kn);
      $n(kn).forEach((er) => Kn.mod(er));
    }), Qt.visit(Qt.ADD, (kn) => {
      const Kn = Sn(kn);
      $n(kn).forEach((er) => Kn.add(ingest$1(er)));
    }), Qt.visit(Qt.REM, (kn) => {
      const Kn = Sn(kn);
      $n(kn).forEach((er) => Kn.rem(er));
    })) : (Qt.visit(Qt.MOD, (kn) => Sn(kn).mod(kn)), Qt.visit(Qt.ADD, (kn) => Sn(kn).add(kn)), Qt.visit(Qt.REM, (kn) => Sn(kn).rem(kn))), Qt.clean() && Qt.runAfter(() => this.clean()), Qt;
  }
});
function Project(_e) {
  Transform$1.call(this, null, _e);
}
Project.Definition = {
  type: "Project",
  metadata: {
    generates: !0,
    changes: !0
  },
  params: [{
    name: "fields",
    type: "field",
    array: !0
  }, {
    name: "as",
    type: "string",
    null: !0,
    array: !0
  }]
};
inherits(Project, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.fork(Qt.NO_SOURCE), $n = _e.fields, Sn = fieldNames(_e.fields, _e.as || []), kn = $n ? (er, Cr) => project$1(er, Cr, $n, Sn) : rederive;
    let Kn;
    return this.value ? Kn = this.value : (Qt = Qt.addAll(), Kn = this.value = {}), Qt.visit(Qt.REM, (er) => {
      const Cr = tupleid(er);
      Zt.rem.push(Kn[Cr]), Kn[Cr] = null;
    }), Qt.visit(Qt.ADD, (er) => {
      const Cr = kn(er, ingest$1({}));
      Kn[tupleid(er)] = Cr, Zt.add.push(Cr);
    }), Qt.visit(Qt.MOD, (er) => {
      Zt.mod.push(kn(er, Kn[tupleid(er)]));
    }), Zt;
  }
});
function project$1(_e, Qt, Zt, $n) {
  for (let Sn = 0, kn = Zt.length; Sn < kn; ++Sn)
    Qt[$n[Sn]] = Zt[Sn](_e);
  return Qt;
}
function Proxy$2(_e) {
  Transform$1.call(this, null, _e);
}
inherits(Proxy$2, Transform$1, {
  transform(_e, Qt) {
    return this.value = _e.value, _e.modified("value") ? Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS) : Qt.StopPropagation;
  }
});
function Quantile$1(_e) {
  Transform$1.call(this, null, _e);
}
Quantile$1.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 EPSILON$2 = 1e-14;
inherits(Quantile$1, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS), $n = _e.as || ["prob", "value"];
    if (this.value && !_e.modified() && !Qt.changed())
      return Zt.source = this.value, Zt;
    const Sn = Qt.materialize(Qt.SOURCE).source, kn = partition$1$1(Sn, _e.groupby, _e.field), Kn = (_e.groupby || []).map(accessorName), er = [], Cr = _e.step || 0.01, kr = _e.probs || range$5(Cr / 2, 1 - EPSILON$2, Cr), Yr = kr.length;
    return kn.forEach((Ms) => {
      const Ds = quantiles(Ms, kr);
      for (let Ls = 0; Ls < Yr; ++Ls) {
        const js = {};
        for (let zs = 0; zs < Kn.length; ++zs)
          js[Kn[zs]] = Ms.dims[zs];
        js[$n[0]] = kr[Ls], js[$n[1]] = Ds[Ls], er.push(ingest$1(js));
      }
    }), this.value && (Zt.rem = this.value), this.value = Zt.add = Zt.source = er, Zt;
  }
});
function Relay$1(_e) {
  Transform$1.call(this, null, _e);
}
inherits(Relay$1, Transform$1, {
  transform(_e, Qt) {
    let Zt, $n;
    return this.value ? $n = this.value : (Zt = Qt = Qt.addAll(), $n = this.value = {}), _e.derive && (Zt = Qt.fork(Qt.NO_SOURCE), Qt.visit(Qt.REM, (Sn) => {
      const kn = tupleid(Sn);
      Zt.rem.push($n[kn]), $n[kn] = null;
    }), Qt.visit(Qt.ADD, (Sn) => {
      const kn = derive(Sn);
      $n[tupleid(Sn)] = kn, Zt.add.push(kn);
    }), Qt.visit(Qt.MOD, (Sn) => {
      const kn = $n[tupleid(Sn)];
      for (const Kn in Sn)
        kn[Kn] = Sn[Kn], Zt.modifies(Kn);
      Zt.mod.push(kn);
    })), Zt;
  }
});
function Sample(_e) {
  Transform$1.call(this, [], _e), this.count = 0;
}
Sample.Definition = {
  type: "Sample",
  metadata: {},
  params: [{
    name: "size",
    type: "number",
    default: 1e3
  }]
};
inherits(Sample, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.fork(Qt.NO_SOURCE), $n = _e.modified("size"), Sn = _e.size, kn = this.value.reduce((Yr, Ms) => (Yr[tupleid(Ms)] = 1, Yr), {});
    let Kn = this.value, er = this.count, Cr = 0;
    function kr(Yr) {
      let Ms, Ds;
      Kn.length < Sn ? Kn.push(Yr) : (Ds = ~~((er + 1) * random()), Ds < Kn.length && Ds >= Cr && (Ms = Kn[Ds], kn[tupleid(Ms)] && Zt.rem.push(Ms), Kn[Ds] = Yr)), ++er;
    }
    if (Qt.rem.length && (Qt.visit(Qt.REM, (Yr) => {
      const Ms = tupleid(Yr);
      kn[Ms] && (kn[Ms] = -1, Zt.rem.push(Yr)), --er;
    }), Kn = Kn.filter((Yr) => kn[tupleid(Yr)] !== -1)), (Qt.rem.length || $n) && Kn.length < Sn && Qt.source && (Cr = er = Kn.length, Qt.visit(Qt.SOURCE, (Yr) => {
      kn[tupleid(Yr)] || kr(Yr);
    }), Cr = -1), $n && Kn.length > Sn) {
      const Yr = Kn.length - Sn;
      for (let Ms = 0; Ms < Yr; ++Ms)
        kn[tupleid(Kn[Ms])] = -1, Zt.rem.push(Kn[Ms]);
      Kn = Kn.slice(Yr);
    }
    return Qt.mod.length && Qt.visit(Qt.MOD, (Yr) => {
      kn[tupleid(Yr)] && Zt.mod.push(Yr);
    }), Qt.add.length && Qt.visit(Qt.ADD, kr), (Qt.add.length || Cr < 0) && (Zt.add = Kn.filter((Yr) => !kn[tupleid(Yr)])), this.count = er, this.value = Zt.source = Kn, Zt;
  }
});
function Sequence(_e) {
  Transform$1.call(this, null, _e);
}
Sequence.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"
  }]
};
inherits(Sequence, Transform$1, {
  transform(_e, Qt) {
    if (this.value && !_e.modified())
      return;
    const Zt = Qt.materialize().fork(Qt.MOD), $n = _e.as || "data";
    return Zt.rem = this.value ? Qt.rem.concat(this.value) : Qt.rem, this.value = range$5(_e.start, _e.stop, _e.step || 1).map((Sn) => {
      const kn = {};
      return kn[$n] = Sn, ingest$1(kn);
    }), Zt.add = Qt.add.concat(this.value), Zt;
  }
});
function Sieve$1(_e) {
  Transform$1.call(this, null, _e), this.modified(!0);
}
inherits(Sieve$1, Transform$1, {
  transform(_e, Qt) {
    return this.value = Qt.source, Qt.changed() ? Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS) : Qt.StopPropagation;
  }
});
function TimeUnit(_e) {
  Transform$1.call(this, null, _e);
}
const OUTPUT = ["unit0", "unit1"];
TimeUnit.Definition = {
  type: "TimeUnit",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "field",
    type: "field",
    required: !0
  }, {
    name: "interval",
    type: "boolean",
    default: !0
  }, {
    name: "units",
    type: "enum",
    values: TIME_UNITS,
    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: OUTPUT
  }]
};
inherits(TimeUnit, Transform$1, {
  transform(_e, Qt) {
    const Zt = _e.field, $n = _e.interval !== !1, Sn = _e.timezone === "utc", kn = this._floor(_e, Qt), Kn = (Sn ? utcInterval : timeInterval)(kn.unit).offset, er = _e.as || OUTPUT, Cr = er[0], kr = er[1], Yr = kn.step;
    let Ms = kn.start || 1 / 0, Ds = kn.stop || -1 / 0, Ls = Qt.ADD;
    return (_e.modified() || Qt.changed(Qt.REM) || Qt.modified(accessorFields(Zt))) && (Qt = Qt.reflow(!0), Ls = Qt.SOURCE, Ms = 1 / 0, Ds = -1 / 0), Qt.visit(Ls, (js) => {
      const zs = Zt(js);
      let Fs, Bs;
      zs == null ? (js[Cr] = null, $n && (js[kr] = null)) : (js[Cr] = Fs = Bs = kn(zs), $n && (js[kr] = Bs = Kn(Fs, Yr)), Fs < Ms && (Ms = Fs), Bs > Ds && (Ds = Bs));
    }), kn.start = Ms, kn.stop = Ds, Qt.modifies($n ? er : Cr);
  },
  _floor(_e, Qt) {
    const Zt = _e.timezone === "utc", {
      units: $n,
      step: Sn
    } = _e.units ? {
      units: _e.units,
      step: _e.step || 1
    } : bin$1({
      extent: _e.extent || extent(Qt.materialize(Qt.SOURCE).source, _e.field),
      maxbins: _e.maxbins
    }), kn = timeUnits($n), Kn = this.value || {}, er = (Zt ? utcFloor : timeFloor)(kn, Sn);
    return er.unit = peek$1(kn), er.units = kn, er.step = Sn, er.start = Kn.start, er.stop = Kn.stop, this.value = er;
  }
});
function TupleIndex(_e) {
  Transform$1.call(this, fastmap(), _e);
}
inherits(TupleIndex, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.dataflow, $n = _e.field, Sn = this.value, kn = (er) => Sn.set($n(er), er);
    let Kn = !0;
    return _e.modified("field") || Qt.modified($n.fields) ? (Sn.clear(), Qt.visit(Qt.SOURCE, kn)) : Qt.changed() ? (Qt.visit(Qt.REM, (er) => Sn.delete($n(er))), Qt.visit(Qt.ADD, kn)) : Kn = !1, this.modified(Kn), Sn.empty > Zt.cleanThreshold && Zt.runAfter(Sn.clean), Qt.fork();
  }
});
function Values$1(_e) {
  Transform$1.call(this, null, _e);
}
inherits(Values$1, Transform$1, {
  transform(_e, Qt) {
    (!this.value || _e.modified("field") || _e.modified("sort") || Qt.changed() || _e.sort && Qt.modified(_e.sort.fields)) && (this.value = (_e.sort ? Qt.source.slice().sort(stableCompare(_e.sort)) : Qt.source).map(_e.field));
  }
});
function WindowOp(_e, Qt, Zt, $n) {
  const Sn = WindowOps[_e](Qt, Zt);
  return {
    init: Sn.init || zero$5,
    update: function(kn, Kn) {
      Kn[$n] = Sn.next(kn);
    }
  };
}
const WindowOps = {
  row_number: function() {
    return {
      next: (_e) => _e.index + 1
    };
  },
  rank: function() {
    let _e;
    return {
      init: () => _e = 1,
      next: (Qt) => {
        const Zt = Qt.index, $n = Qt.data;
        return Zt && Qt.compare($n[Zt - 1], $n[Zt]) ? _e = Zt + 1 : _e;
      }
    };
  },
  dense_rank: function() {
    let _e;
    return {
      init: () => _e = 1,
      next: (Qt) => {
        const Zt = Qt.index, $n = Qt.data;
        return Zt && Qt.compare($n[Zt - 1], $n[Zt]) ? ++_e : _e;
      }
    };
  },
  percent_rank: function() {
    const _e = WindowOps.rank(), Qt = _e.next;
    return {
      init: _e.init,
      next: (Zt) => (Qt(Zt) - 1) / (Zt.data.length - 1)
    };
  },
  cume_dist: function() {
    let _e;
    return {
      init: () => _e = 0,
      next: (Qt) => {
        const Zt = Qt.data, $n = Qt.compare;
        let Sn = Qt.index;
        if (_e < Sn) {
          for (; Sn + 1 < Zt.length && !$n(Zt[Sn], Zt[Sn + 1]); )
            ++Sn;
          _e = Sn;
        }
        return (1 + _e) / Zt.length;
      }
    };
  },
  ntile: function(_e, Qt) {
    Qt = +Qt, Qt > 0 || error("ntile num must be greater than zero.");
    const Zt = WindowOps.cume_dist(), $n = Zt.next;
    return {
      init: Zt.init,
      next: (Sn) => Math.ceil(Qt * $n(Sn))
    };
  },
  lag: function(_e, Qt) {
    return Qt = +Qt || 1, {
      next: (Zt) => {
        const $n = Zt.index - Qt;
        return $n >= 0 ? _e(Zt.data[$n]) : null;
      }
    };
  },
  lead: function(_e, Qt) {
    return Qt = +Qt || 1, {
      next: (Zt) => {
        const $n = Zt.index + Qt, Sn = Zt.data;
        return $n < Sn.length ? _e(Sn[$n]) : null;
      }
    };
  },
  first_value: function(_e) {
    return {
      next: (Qt) => _e(Qt.data[Qt.i0])
    };
  },
  last_value: function(_e) {
    return {
      next: (Qt) => _e(Qt.data[Qt.i1 - 1])
    };
  },
  nth_value: function(_e, Qt) {
    return Qt = +Qt, Qt > 0 || error("nth_value nth must be greater than zero."), {
      next: (Zt) => {
        const $n = Zt.i0 + (Qt - 1);
        return $n < Zt.i1 ? _e(Zt.data[$n]) : null;
      }
    };
  },
  prev_value: function(_e) {
    let Qt;
    return {
      init: () => Qt = null,
      next: (Zt) => {
        const $n = _e(Zt.data[Zt.index]);
        return $n != null ? Qt = $n : Qt;
      }
    };
  },
  next_value: function(_e) {
    let Qt, Zt;
    return {
      init: () => (Qt = null, Zt = -1),
      next: ($n) => {
        const Sn = $n.data;
        return $n.index <= Zt ? Qt : (Zt = find$3(_e, Sn, $n.index)) < 0 ? (Zt = Sn.length, Qt = null) : Qt = _e(Sn[Zt]);
      }
    };
  }
};
function find$3(_e, Qt, Zt) {
  for (let $n = Qt.length; Zt < $n; ++Zt)
    if (_e(Qt[Zt]) != null)
      return Zt;
  return -1;
}
const ValidWindowOps = Object.keys(WindowOps);
function WindowState(_e) {
  const Qt = array$6(_e.ops), Zt = array$6(_e.fields), $n = array$6(_e.params), Sn = array$6(_e.as), kn = this.outputs = [], Kn = this.windows = [], er = {}, Cr = {}, kr = [], Yr = [];
  let Ms = !0;
  function Ds(Ls) {
    array$6(accessorFields(Ls)).forEach((js) => er[js] = 1);
  }
  Ds(_e.sort), Qt.forEach((Ls, js) => {
    const zs = Zt[js], Fs = accessorName(zs), Bs = measureName(Ls, Fs, Sn[js]);
    if (Ds(zs), kn.push(Bs), has$1(WindowOps, Ls))
      Kn.push(WindowOp(Ls, Zt[js], $n[js], Bs));
    else {
      if (zs == null && Ls !== "count" && error("Null aggregate field specified."), Ls === "count") {
        kr.push(Bs);
        return;
      }
      Ms = !1;
      let Hs = Cr[Fs];
      Hs || (Hs = Cr[Fs] = [], Hs.field = zs, Yr.push(Hs)), Hs.push(createMeasure(Ls, Bs));
    }
  }), (kr.length || Yr.length) && (this.cell = cell(Yr, kr, Ms)), this.inputs = Object.keys(er);
}
const prototype = WindowState.prototype;
prototype.init = function() {
  this.windows.forEach((_e) => _e.init()), this.cell && this.cell.init();
};
prototype.update = function(_e, Qt) {
  const Zt = this.cell, $n = this.windows, Sn = _e.data, kn = $n && $n.length;
  let Kn;
  if (Zt) {
    for (Kn = _e.p0; Kn < _e.i0; ++Kn)
      Zt.rem(Sn[Kn]);
    for (Kn = _e.p1; Kn < _e.i1; ++Kn)
      Zt.add(Sn[Kn]);
    Zt.set(Qt);
  }
  for (Kn = 0; Kn < kn; ++Kn)
    $n[Kn].update(_e, Qt);
};
function cell(_e, Qt, Zt) {
  _e = _e.map((Cr) => compileMeasures(Cr, Cr.field));
  const $n = {
    num: 0,
    agg: null,
    store: !1,
    count: Qt
  };
  if (!Zt)
    for (var Sn = _e.length, kn = $n.agg = Array(Sn), Kn = 0; Kn < Sn; ++Kn)
      kn[Kn] = new _e[Kn]($n);
  if ($n.store)
    var er = $n.data = new TupleStore();
  return $n.add = function(Cr) {
    if ($n.num += 1, !Zt) {
      er && er.add(Cr);
      for (let kr = 0; kr < Sn; ++kr)
        kn[kr].add(kn[kr].get(Cr), Cr);
    }
  }, $n.rem = function(Cr) {
    if ($n.num -= 1, !Zt) {
      er && er.rem(Cr);
      for (let kr = 0; kr < Sn; ++kr)
        kn[kr].rem(kn[kr].get(Cr), Cr);
    }
  }, $n.set = function(Cr) {
    let kr, Yr;
    for (er && er.values(), kr = 0, Yr = Qt.length; kr < Yr; ++kr)
      Cr[Qt[kr]] = $n.num;
    if (!Zt)
      for (kr = 0, Yr = kn.length; kr < Yr; ++kr)
        kn[kr].set(Cr);
  }, $n.init = function() {
    $n.num = 0, er && er.reset();
    for (let Cr = 0; Cr < Sn; ++Cr)
      kn[Cr].init();
  }, $n;
}
function Window(_e) {
  Transform$1.call(this, {}, _e), this._mlen = 0, this._mods = [];
}
Window.Definition = {
  type: "Window",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "sort",
    type: "compare"
  }, {
    name: "groupby",
    type: "field",
    array: !0
  }, {
    name: "ops",
    type: "enum",
    array: !0,
    values: ValidWindowOps.concat(ValidAggregateOps)
  }, {
    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
  }]
};
inherits(Window, Transform$1, {
  transform(_e, Qt) {
    this.stamp = Qt.stamp;
    const Zt = _e.modified(), $n = stableCompare(_e.sort), Sn = groupkey(_e.groupby), kn = (er) => this.group(Sn(er));
    let Kn = this.state;
    (!Kn || Zt) && (Kn = this.state = new WindowState(_e)), Zt || Qt.modified(Kn.inputs) ? (this.value = {}, Qt.visit(Qt.SOURCE, (er) => kn(er).add(er))) : (Qt.visit(Qt.REM, (er) => kn(er).remove(er)), Qt.visit(Qt.ADD, (er) => kn(er).add(er)));
    for (let er = 0, Cr = this._mlen; er < Cr; ++er)
      processPartition(this._mods[er], Kn, $n, _e);
    return this._mlen = 0, this._mods = [], Qt.reflow(Zt).modifies(Kn.outputs);
  },
  group(_e) {
    let Qt = this.value[_e];
    return Qt || (Qt = this.value[_e] = SortedList(tupleid), Qt.stamp = -1), Qt.stamp < this.stamp && (Qt.stamp = this.stamp, this._mods[this._mlen++] = Qt), Qt;
  }
});
function processPartition(_e, Qt, Zt, $n) {
  const Sn = $n.sort, kn = Sn && !$n.ignorePeers, Kn = $n.frame || [null, 0], er = _e.data(Zt), Cr = er.length, kr = kn ? bisector$1(Sn) : null, Yr = {
    i0: 0,
    i1: 0,
    p0: 0,
    p1: 0,
    index: 0,
    data: er,
    compare: Sn || constant$7(-1)
  };
  Qt.init();
  for (let Ms = 0; Ms < Cr; ++Ms)
    setWindow(Yr, Kn, Ms, Cr), kn && adjustRange(Yr, kr), Qt.update(Yr, er[Ms]);
}
function setWindow(_e, Qt, Zt, $n) {
  _e.p0 = _e.i0, _e.p1 = _e.i1, _e.i0 = Qt[0] == null ? 0 : Math.max(0, Zt - Math.abs(Qt[0])), _e.i1 = Qt[1] == null ? $n : Math.min($n, Zt + Math.abs(Qt[1]) + 1), _e.index = Zt;
}
function adjustRange(_e, Qt) {
  const Zt = _e.i0, $n = _e.i1 - 1, Sn = _e.compare, kn = _e.data, Kn = kn.length - 1;
  Zt > 0 && !Sn(kn[Zt], kn[Zt - 1]) && (_e.i0 = Qt.left(kn, kn[Zt])), $n < Kn && !Sn(kn[$n], kn[$n + 1]) && (_e.i1 = Qt.right(kn, kn[$n]));
}
const tx$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  aggregate: Aggregate$1,
  bin: Bin,
  collect: Collect$1,
  compare: Compare$1,
  countpattern: CountPattern,
  cross: Cross,
  density: Density,
  dotbin: DotBin,
  expression: Expression$1,
  extent: Extent,
  facet: Facet$1,
  field: Field$1,
  filter: Filter,
  flatten: Flatten,
  fold: Fold,
  formula: Formula,
  generate: Generate,
  impute: Impute,
  joinaggregate: JoinAggregate,
  kde: KDE,
  key: Key$1,
  load: Load$1,
  lookup: Lookup,
  multiextent: MultiExtent$1,
  multivalues: MultiValues$1,
  params: Params$2,
  pivot: Pivot,
  prefacet: PreFacet$1,
  project: Project,
  proxy: Proxy$2,
  quantile: Quantile$1,
  relay: Relay$1,
  sample: Sample,
  sequence: Sequence,
  sieve: Sieve$1,
  subflow: Subflow,
  timeunit: TimeUnit,
  tupleindex: TupleIndex,
  values: Values$1,
  window: Window
}, Symbol.toStringTag, { value: "Module" }));
function constant$5(_e) {
  return function() {
    return _e;
  };
}
const abs$2 = Math.abs, atan2$1 = Math.atan2, cos$2 = Math.cos, max$1 = Math.max, min$1 = Math.min, sin$2 = Math.sin, sqrt$3 = Math.sqrt, epsilon$5 = 1e-12, pi$4 = Math.PI, halfPi$2 = pi$4 / 2, tau$3 = 2 * pi$4;
function acos$1(_e) {
  return _e > 1 ? 0 : _e < -1 ? pi$4 : Math.acos(_e);
}
function asin$2(_e) {
  return _e >= 1 ? halfPi$2 : _e <= -1 ? -halfPi$2 : Math.asin(_e);
}
const pi$3 = Math.PI, tau$2 = 2 * pi$3, epsilon$4 = 1e-6, tauEpsilon = tau$2 - epsilon$4;
function append$1(_e) {
  this._ += _e[0];
  for (let Qt = 1, Zt = _e.length; Qt < Zt; ++Qt)
    this._ += arguments[Qt] + _e[Qt];
}
function appendRound$1(_e) {
  let Qt = Math.floor(_e);
  if (!(Qt >= 0))
    throw new Error(`invalid digits: ${_e}`);
  if (Qt > 15)
    return append$1;
  const Zt = 10 ** Qt;
  return function($n) {
    this._ += $n[0];
    for (let Sn = 1, kn = $n.length; Sn < kn; ++Sn)
      this._ += Math.round(arguments[Sn] * Zt) / Zt + $n[Sn];
  };
}
let Path$1 = class {
  constructor(Qt) {
    this._x0 = this._y0 = // start of current subpath
    this._x1 = this._y1 = null, this._ = "", this._append = Qt == null ? append$1 : appendRound$1(Qt);
  }
  moveTo(Qt, Zt) {
    this._append`M${this._x0 = this._x1 = +Qt},${this._y0 = this._y1 = +Zt}`;
  }
  closePath() {
    this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
  }
  lineTo(Qt, Zt) {
    this._append`L${this._x1 = +Qt},${this._y1 = +Zt}`;
  }
  quadraticCurveTo(Qt, Zt, $n, Sn) {
    this._append`Q${+Qt},${+Zt},${this._x1 = +$n},${this._y1 = +Sn}`;
  }
  bezierCurveTo(Qt, Zt, $n, Sn, kn, Kn) {
    this._append`C${+Qt},${+Zt},${+$n},${+Sn},${this._x1 = +kn},${this._y1 = +Kn}`;
  }
  arcTo(Qt, Zt, $n, Sn, kn) {
    if (Qt = +Qt, Zt = +Zt, $n = +$n, Sn = +Sn, kn = +kn, kn < 0)
      throw new Error(`negative radius: ${kn}`);
    let Kn = this._x1, er = this._y1, Cr = $n - Qt, kr = Sn - Zt, Yr = Kn - Qt, Ms = er - Zt, Ds = Yr * Yr + Ms * Ms;
    if (this._x1 === null)
      this._append`M${this._x1 = Qt},${this._y1 = Zt}`;
    else if (Ds > epsilon$4)
      if (!(Math.abs(Ms * Cr - kr * Yr) > epsilon$4) || !kn)
        this._append`L${this._x1 = Qt},${this._y1 = Zt}`;
      else {
        let Ls = $n - Kn, js = Sn - er, zs = Cr * Cr + kr * kr, Fs = Ls * Ls + js * js, Bs = Math.sqrt(zs), Hs = Math.sqrt(Ds), Ws = kn * Math.tan((pi$3 - Math.acos((zs + Ds - Fs) / (2 * Bs * Hs))) / 2), Ys = Ws / Hs, El = Ws / Bs;
        Math.abs(Ys - 1) > epsilon$4 && this._append`L${Qt + Ys * Yr},${Zt + Ys * Ms}`, this._append`A${kn},${kn},0,0,${+(Ms * Ls > Yr * js)},${this._x1 = Qt + El * Cr},${this._y1 = Zt + El * kr}`;
      }
  }
  arc(Qt, Zt, $n, Sn, kn, Kn) {
    if (Qt = +Qt, Zt = +Zt, $n = +$n, Kn = !!Kn, $n < 0)
      throw new Error(`negative radius: ${$n}`);
    let er = $n * Math.cos(Sn), Cr = $n * Math.sin(Sn), kr = Qt + er, Yr = Zt + Cr, Ms = 1 ^ Kn, Ds = Kn ? Sn - kn : kn - Sn;
    this._x1 === null ? this._append`M${kr},${Yr}` : (Math.abs(this._x1 - kr) > epsilon$4 || Math.abs(this._y1 - Yr) > epsilon$4) && this._append`L${kr},${Yr}`, $n && (Ds < 0 && (Ds = Ds % tau$2 + tau$2), Ds > tauEpsilon ? this._append`A${$n},${$n},0,1,${Ms},${Qt - er},${Zt - Cr}A${$n},${$n},0,1,${Ms},${this._x1 = kr},${this._y1 = Yr}` : Ds > epsilon$4 && this._append`A${$n},${$n},0,${+(Ds >= pi$3)},${Ms},${this._x1 = Qt + $n * Math.cos(kn)},${this._y1 = Zt + $n * Math.sin(kn)}`);
  }
  rect(Qt, Zt, $n, Sn) {
    this._append`M${this._x0 = this._x1 = +Qt},${this._y0 = this._y1 = +Zt}h${$n = +$n}v${+Sn}h${-$n}Z`;
  }
  toString() {
    return this._;
  }
};
function path$3() {
  return new Path$1();
}
path$3.prototype = Path$1.prototype;
function withPath(_e) {
  let Qt = 3;
  return _e.digits = function(Zt) {
    if (!arguments.length)
      return Qt;
    if (Zt == null)
      Qt = null;
    else {
      const $n = Math.floor(Zt);
      if (!($n >= 0))
        throw new RangeError(`invalid digits: ${Zt}`);
      Qt = $n;
    }
    return _e;
  }, () => new Path$1(Qt);
}
function arcInnerRadius(_e) {
  return _e.innerRadius;
}
function arcOuterRadius(_e) {
  return _e.outerRadius;
}
function arcStartAngle(_e) {
  return _e.startAngle;
}
function arcEndAngle(_e) {
  return _e.endAngle;
}
function arcPadAngle(_e) {
  return _e && _e.padAngle;
}
function intersect$3(_e, Qt, Zt, $n, Sn, kn, Kn, er) {
  var Cr = Zt - _e, kr = $n - Qt, Yr = Kn - Sn, Ms = er - kn, Ds = Ms * Cr - Yr * kr;
  if (!(Ds * Ds < epsilon$5))
    return Ds = (Yr * (Qt - kn) - Ms * (_e - Sn)) / Ds, [_e + Ds * Cr, Qt + Ds * kr];
}
function cornerTangents(_e, Qt, Zt, $n, Sn, kn, Kn) {
  var er = _e - Zt, Cr = Qt - $n, kr = (Kn ? kn : -kn) / sqrt$3(er * er + Cr * Cr), Yr = kr * Cr, Ms = -kr * er, Ds = _e + Yr, Ls = Qt + Ms, js = Zt + Yr, zs = $n + Ms, Fs = (Ds + js) / 2, Bs = (Ls + zs) / 2, Hs = js - Ds, Ws = zs - Ls, Ys = Hs * Hs + Ws * Ws, El = Sn - kn, Mu = Ds * zs - js * Ls, Pl = (Ws < 0 ? -1 : 1) * sqrt$3(max$1(0, El * El * Ys - Mu * Mu)), Iu = (Mu * Ws - Hs * Pl) / Ys, Tu = (-Mu * Hs - Ws * Pl) / Ys, Au = (Mu * Ws + Hs * Pl) / Ys, Nu = (-Mu * Hs + Ws * Pl) / Ys, gm = Iu - Fs, pm = Tu - Bs, zu = Au - Fs, Yu = Nu - Bs;
  return gm * gm + pm * pm > zu * zu + Yu * Yu && (Iu = Au, Tu = Nu), {
    cx: Iu,
    cy: Tu,
    x01: -Yr,
    y01: -Ms,
    x11: Iu * (Sn / El - 1),
    y11: Tu * (Sn / El - 1)
  };
}
function arc$2$1() {
  var _e = arcInnerRadius, Qt = arcOuterRadius, Zt = constant$5(0), $n = null, Sn = arcStartAngle, kn = arcEndAngle, Kn = arcPadAngle, er = null, Cr = withPath(kr);
  function kr() {
    var Yr, Ms, Ds = +_e.apply(this, arguments), Ls = +Qt.apply(this, arguments), js = Sn.apply(this, arguments) - halfPi$2, zs = kn.apply(this, arguments) - halfPi$2, Fs = abs$2(zs - js), Bs = zs > js;
    if (er || (er = Yr = Cr()), Ls < Ds && (Ms = Ls, Ls = Ds, Ds = Ms), !(Ls > epsilon$5))
      er.moveTo(0, 0);
    else if (Fs > tau$3 - epsilon$5)
      er.moveTo(Ls * cos$2(js), Ls * sin$2(js)), er.arc(0, 0, Ls, js, zs, !Bs), Ds > epsilon$5 && (er.moveTo(Ds * cos$2(zs), Ds * sin$2(zs)), er.arc(0, 0, Ds, zs, js, Bs));
    else {
      var Hs = js, Ws = zs, Ys = js, El = zs, Mu = Fs, Pl = Fs, Iu = Kn.apply(this, arguments) / 2, Tu = Iu > epsilon$5 && ($n ? +$n.apply(this, arguments) : sqrt$3(Ds * Ds + Ls * Ls)), Au = min$1(abs$2(Ls - Ds) / 2, +Zt.apply(this, arguments)), Nu = Au, gm = Au, pm, zu;
      if (Tu > epsilon$5) {
        var Yu = asin$2(Tu / Ds * sin$2(Iu)), sm = asin$2(Tu / Ls * sin$2(Iu));
        (Mu -= Yu * 2) > epsilon$5 ? (Yu *= Bs ? 1 : -1, Ys += Yu, El -= Yu) : (Mu = 0, Ys = El = (js + zs) / 2), (Pl -= sm * 2) > epsilon$5 ? (sm *= Bs ? 1 : -1, Hs += sm, Ws -= sm) : (Pl = 0, Hs = Ws = (js + zs) / 2);
      }
      var mm = Ls * cos$2(Hs), hm = Ls * sin$2(Hs), ym = Ds * cos$2(El), _m = Ds * sin$2(El);
      if (Au > epsilon$5) {
        var Sm = Ls * cos$2(Ws), wm = Ls * sin$2(Ws), Nm = Ds * cos$2(Ys), Cm = Ds * sin$2(Ys), Im;
        if (Fs < pi$4)
          if (Im = intersect$3(mm, hm, Nm, Cm, Sm, wm, ym, _m)) {
            var Am = mm - Im[0], Vm = hm - Im[1], Rm = Sm - Im[0], Dm = wm - Im[1], km = 1 / sin$2(acos$1((Am * Rm + Vm * Dm) / (sqrt$3(Am * Am + Vm * Vm) * sqrt$3(Rm * Rm + Dm * Dm))) / 2), zm = sqrt$3(Im[0] * Im[0] + Im[1] * Im[1]);
            Nu = min$1(Au, (Ds - zm) / (km - 1)), gm = min$1(Au, (Ls - zm) / (km + 1));
          } else
            Nu = gm = 0;
      }
      Pl > epsilon$5 ? gm > epsilon$5 ? (pm = cornerTangents(Nm, Cm, mm, hm, Ls, gm, Bs), zu = cornerTangents(Sm, wm, ym, _m, Ls, gm, Bs), er.moveTo(pm.cx + pm.x01, pm.cy + pm.y01), gm < Au ? er.arc(pm.cx, pm.cy, gm, atan2$1(pm.y01, pm.x01), atan2$1(zu.y01, zu.x01), !Bs) : (er.arc(pm.cx, pm.cy, gm, atan2$1(pm.y01, pm.x01), atan2$1(pm.y11, pm.x11), !Bs), er.arc(0, 0, Ls, atan2$1(pm.cy + pm.y11, pm.cx + pm.x11), atan2$1(zu.cy + zu.y11, zu.cx + zu.x11), !Bs), er.arc(zu.cx, zu.cy, gm, atan2$1(zu.y11, zu.x11), atan2$1(zu.y01, zu.x01), !Bs))) : (er.moveTo(mm, hm), er.arc(0, 0, Ls, Hs, Ws, !Bs)) : er.moveTo(mm, hm), !(Ds > epsilon$5) || !(Mu > epsilon$5) ? er.lineTo(ym, _m) : Nu > epsilon$5 ? (pm = cornerTangents(ym, _m, Sm, wm, Ds, -Nu, Bs), zu = cornerTangents(mm, hm, Nm, Cm, Ds, -Nu, Bs), er.lineTo(pm.cx + pm.x01, pm.cy + pm.y01), Nu < Au ? er.arc(pm.cx, pm.cy, Nu, atan2$1(pm.y01, pm.x01), atan2$1(zu.y01, zu.x01), !Bs) : (er.arc(pm.cx, pm.cy, Nu, atan2$1(pm.y01, pm.x01), atan2$1(pm.y11, pm.x11), !Bs), er.arc(0, 0, Ds, atan2$1(pm.cy + pm.y11, pm.cx + pm.x11), atan2$1(zu.cy + zu.y11, zu.cx + zu.x11), Bs), er.arc(zu.cx, zu.cy, Nu, atan2$1(zu.y11, zu.x11), atan2$1(zu.y01, zu.x01), !Bs))) : er.arc(0, 0, Ds, El, Ys, Bs);
    }
    if (er.closePath(), Yr)
      return er = null, Yr + "" || null;
  }
  return kr.centroid = function() {
    var Yr = (+_e.apply(this, arguments) + +Qt.apply(this, arguments)) / 2, Ms = (+Sn.apply(this, arguments) + +kn.apply(this, arguments)) / 2 - pi$4 / 2;
    return [cos$2(Ms) * Yr, sin$2(Ms) * Yr];
  }, kr.innerRadius = function(Yr) {
    return arguments.length ? (_e = typeof Yr == "function" ? Yr : constant$5(+Yr), kr) : _e;
  }, kr.outerRadius = function(Yr) {
    return arguments.length ? (Qt = typeof Yr == "function" ? Yr : constant$5(+Yr), kr) : Qt;
  }, kr.cornerRadius = function(Yr) {
    return arguments.length ? (Zt = typeof Yr == "function" ? Yr : constant$5(+Yr), kr) : Zt;
  }, kr.padRadius = function(Yr) {
    return arguments.length ? ($n = Yr == null ? null : typeof Yr == "function" ? Yr : constant$5(+Yr), kr) : $n;
  }, kr.startAngle = function(Yr) {
    return arguments.length ? (Sn = typeof Yr == "function" ? Yr : constant$5(+Yr), kr) : Sn;
  }, kr.endAngle = function(Yr) {
    return arguments.length ? (kn = typeof Yr == "function" ? Yr : constant$5(+Yr), kr) : kn;
  }, kr.padAngle = function(Yr) {
    return arguments.length ? (Kn = typeof Yr == "function" ? Yr : constant$5(+Yr), kr) : Kn;
  }, kr.context = function(Yr) {
    return arguments.length ? (er = Yr ?? null, kr) : er;
  }, kr;
}
function array$5(_e) {
  return typeof _e == "object" && "length" in _e ? _e : Array.from(_e);
}
function Linear$1(_e) {
  this._context = _e;
}
Linear$1.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, Qt) {
    switch (_e = +_e, Qt = +Qt, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(_e, Qt) : this._context.moveTo(_e, Qt);
        break;
      case 1:
        this._point = 2;
      default:
        this._context.lineTo(_e, Qt);
        break;
    }
  }
};
function curveLinear(_e) {
  return new Linear$1(_e);
}
function x$3(_e) {
  return _e[0];
}
function y$3(_e) {
  return _e[1];
}
function line$2$1(_e, Qt) {
  var Zt = constant$5(!0), $n = null, Sn = curveLinear, kn = null, Kn = withPath(er);
  _e = typeof _e == "function" ? _e : _e === void 0 ? x$3 : constant$5(_e), Qt = typeof Qt == "function" ? Qt : Qt === void 0 ? y$3 : constant$5(Qt);
  function er(Cr) {
    var kr, Yr = (Cr = array$5(Cr)).length, Ms, Ds = !1, Ls;
    for ($n == null && (kn = Sn(Ls = Kn())), kr = 0; kr <= Yr; ++kr)
      !(kr < Yr && Zt(Ms = Cr[kr], kr, Cr)) === Ds && ((Ds = !Ds) ? kn.lineStart() : kn.lineEnd()), Ds && kn.point(+_e(Ms, kr, Cr), +Qt(Ms, kr, Cr));
    if (Ls)
      return kn = null, Ls + "" || null;
  }
  return er.x = function(Cr) {
    return arguments.length ? (_e = typeof Cr == "function" ? Cr : constant$5(+Cr), er) : _e;
  }, er.y = function(Cr) {
    return arguments.length ? (Qt = typeof Cr == "function" ? Cr : constant$5(+Cr), er) : Qt;
  }, er.defined = function(Cr) {
    return arguments.length ? (Zt = typeof Cr == "function" ? Cr : constant$5(!!Cr), er) : Zt;
  }, er.curve = function(Cr) {
    return arguments.length ? (Sn = Cr, $n != null && (kn = Sn($n)), er) : Sn;
  }, er.context = function(Cr) {
    return arguments.length ? (Cr == null ? $n = kn = null : kn = Sn($n = Cr), er) : $n;
  }, er;
}
function area$2$1(_e, Qt, Zt) {
  var $n = null, Sn = constant$5(!0), kn = null, Kn = curveLinear, er = null, Cr = withPath(kr);
  _e = typeof _e == "function" ? _e : _e === void 0 ? x$3 : constant$5(+_e), Qt = typeof Qt == "function" ? Qt : constant$5(Qt === void 0 ? 0 : +Qt), Zt = typeof Zt == "function" ? Zt : Zt === void 0 ? y$3 : constant$5(+Zt);
  function kr(Ms) {
    var Ds, Ls, js, zs = (Ms = array$5(Ms)).length, Fs, Bs = !1, Hs, Ws = new Array(zs), Ys = new Array(zs);
    for (kn == null && (er = Kn(Hs = Cr())), Ds = 0; Ds <= zs; ++Ds) {
      if (!(Ds < zs && Sn(Fs = Ms[Ds], Ds, Ms)) === Bs)
        if (Bs = !Bs)
          Ls = Ds, er.areaStart(), er.lineStart();
        else {
          for (er.lineEnd(), er.lineStart(), js = Ds - 1; js >= Ls; --js)
            er.point(Ws[js], Ys[js]);
          er.lineEnd(), er.areaEnd();
        }
      Bs && (Ws[Ds] = +_e(Fs, Ds, Ms), Ys[Ds] = +Qt(Fs, Ds, Ms), er.point($n ? +$n(Fs, Ds, Ms) : Ws[Ds], Zt ? +Zt(Fs, Ds, Ms) : Ys[Ds]));
    }
    if (Hs)
      return er = null, Hs + "" || null;
  }
  function Yr() {
    return line$2$1().defined(Sn).curve(Kn).context(kn);
  }
  return kr.x = function(Ms) {
    return arguments.length ? (_e = typeof Ms == "function" ? Ms : constant$5(+Ms), $n = null, kr) : _e;
  }, kr.x0 = function(Ms) {
    return arguments.length ? (_e = typeof Ms == "function" ? Ms : constant$5(+Ms), kr) : _e;
  }, kr.x1 = function(Ms) {
    return arguments.length ? ($n = Ms == null ? null : typeof Ms == "function" ? Ms : constant$5(+Ms), kr) : $n;
  }, kr.y = function(Ms) {
    return arguments.length ? (Qt = typeof Ms == "function" ? Ms : constant$5(+Ms), Zt = null, kr) : Qt;
  }, kr.y0 = function(Ms) {
    return arguments.length ? (Qt = typeof Ms == "function" ? Ms : constant$5(+Ms), kr) : Qt;
  }, kr.y1 = function(Ms) {
    return arguments.length ? (Zt = Ms == null ? null : typeof Ms == "function" ? Ms : constant$5(+Ms), kr) : Zt;
  }, kr.lineX0 = kr.lineY0 = function() {
    return Yr().x(_e).y(Qt);
  }, kr.lineY1 = function() {
    return Yr().x(_e).y(Zt);
  }, kr.lineX1 = function() {
    return Yr().x($n).y(Qt);
  }, kr.defined = function(Ms) {
    return arguments.length ? (Sn = typeof Ms == "function" ? Ms : constant$5(!!Ms), kr) : Sn;
  }, kr.curve = function(Ms) {
    return arguments.length ? (Kn = Ms, kn != null && (er = Kn(kn)), kr) : Kn;
  }, kr.context = function(Ms) {
    return arguments.length ? (Ms == null ? kn = er = null : er = Kn(kn = Ms), kr) : kn;
  }, kr;
}
const circle$1 = {
  draw(_e, Qt) {
    const Zt = sqrt$3(Qt / pi$4);
    _e.moveTo(Zt, 0), _e.arc(0, 0, Zt, 0, tau$3);
  }
};
function Symbol$1(_e, Qt) {
  let Zt = null, $n = withPath(Sn);
  _e = typeof _e == "function" ? _e : constant$5(_e || circle$1), Qt = typeof Qt == "function" ? Qt : constant$5(Qt === void 0 ? 64 : +Qt);
  function Sn() {
    let kn;
    if (Zt || (Zt = kn = $n()), _e.apply(this, arguments).draw(Zt, +Qt.apply(this, arguments)), kn)
      return Zt = null, kn + "" || null;
  }
  return Sn.type = function(kn) {
    return arguments.length ? (_e = typeof kn == "function" ? kn : constant$5(kn), Sn) : _e;
  }, Sn.size = function(kn) {
    return arguments.length ? (Qt = typeof kn == "function" ? kn : constant$5(+kn), Sn) : Qt;
  }, Sn.context = function(kn) {
    return arguments.length ? (Zt = kn ?? null, Sn) : Zt;
  }, Sn;
}
function noop$6() {
}
function point$7(_e, Qt, Zt) {
  _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 + Qt) / 6,
    (_e._y0 + 4 * _e._y1 + Zt) / 6
  );
}
function Basis(_e) {
  this._context = _e;
}
Basis.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 3:
        point$7(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, Qt) {
    switch (_e = +_e, Qt = +Qt, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(_e, Qt) : this._context.moveTo(_e, Qt);
        break;
      case 1:
        this._point = 2;
        break;
      case 2:
        this._point = 3, this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
      default:
        point$7(this, _e, Qt);
        break;
    }
    this._x0 = this._x1, this._x1 = _e, this._y0 = this._y1, this._y1 = Qt;
  }
};
function curveBasis(_e) {
  return new Basis(_e);
}
function BasisClosed(_e) {
  this._context = _e;
}
BasisClosed.prototype = {
  areaStart: noop$6,
  areaEnd: noop$6,
  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, Qt) {
    switch (_e = +_e, Qt = +Qt, this._point) {
      case 0:
        this._point = 1, this._x2 = _e, this._y2 = Qt;
        break;
      case 1:
        this._point = 2, this._x3 = _e, this._y3 = Qt;
        break;
      case 2:
        this._point = 3, this._x4 = _e, this._y4 = Qt, this._context.moveTo((this._x0 + 4 * this._x1 + _e) / 6, (this._y0 + 4 * this._y1 + Qt) / 6);
        break;
      default:
        point$7(this, _e, Qt);
        break;
    }
    this._x0 = this._x1, this._x1 = _e, this._y0 = this._y1, this._y1 = Qt;
  }
};
function curveBasisClosed(_e) {
  return new BasisClosed(_e);
}
function BasisOpen(_e) {
  this._context = _e;
}
BasisOpen.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
  },
  lineEnd: function() {
    (this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(_e, Qt) {
    switch (_e = +_e, Qt = +Qt, this._point) {
      case 0:
        this._point = 1;
        break;
      case 1:
        this._point = 2;
        break;
      case 2:
        this._point = 3;
        var Zt = (this._x0 + 4 * this._x1 + _e) / 6, $n = (this._y0 + 4 * this._y1 + Qt) / 6;
        this._line ? this._context.lineTo(Zt, $n) : this._context.moveTo(Zt, $n);
        break;
      case 3:
        this._point = 4;
      default:
        point$7(this, _e, Qt);
        break;
    }
    this._x0 = this._x1, this._x1 = _e, this._y0 = this._y1, this._y1 = Qt;
  }
};
function curveBasisOpen(_e) {
  return new BasisOpen(_e);
}
function Bundle(_e, Qt) {
  this._basis = new Basis(_e), this._beta = Qt;
}
Bundle.prototype = {
  lineStart: function() {
    this._x = [], this._y = [], this._basis.lineStart();
  },
  lineEnd: function() {
    var _e = this._x, Qt = this._y, Zt = _e.length - 1;
    if (Zt > 0)
      for (var $n = _e[0], Sn = Qt[0], kn = _e[Zt] - $n, Kn = Qt[Zt] - Sn, er = -1, Cr; ++er <= Zt; )
        Cr = er / Zt, this._basis.point(
          this._beta * _e[er] + (1 - this._beta) * ($n + Cr * kn),
          this._beta * Qt[er] + (1 - this._beta) * (Sn + Cr * Kn)
        );
    this._x = this._y = null, this._basis.lineEnd();
  },
  point: function(_e, Qt) {
    this._x.push(+_e), this._y.push(+Qt);
  }
};
const curveBundle = function _e(Qt) {
  function Zt($n) {
    return Qt === 1 ? new Basis($n) : new Bundle($n, Qt);
  }
  return Zt.beta = function($n) {
    return _e(+$n);
  }, Zt;
}(0.85);
function point$6(_e, Qt, Zt) {
  _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 - Qt),
    _e._y2 + _e._k * (_e._y1 - Zt),
    _e._x2,
    _e._y2
  );
}
function Cardinal(_e, Qt) {
  this._context = _e, this._k = (1 - Qt) / 6;
}
Cardinal.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 2:
        this._context.lineTo(this._x2, this._y2);
        break;
      case 3:
        point$6(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, Qt) {
    switch (_e = +_e, Qt = +Qt, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(_e, Qt) : this._context.moveTo(_e, Qt);
        break;
      case 1:
        this._point = 2, this._x1 = _e, this._y1 = Qt;
        break;
      case 2:
        this._point = 3;
      default:
        point$6(this, _e, Qt);
        break;
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = _e, this._y0 = this._y1, this._y1 = this._y2, this._y2 = Qt;
  }
};
const curveCardinal = function _e(Qt) {
  function Zt($n) {
    return new Cardinal($n, Qt);
  }
  return Zt.tension = function($n) {
    return _e(+$n);
  }, Zt;
}(0);
function CardinalClosed(_e, Qt) {
  this._context = _e, this._k = (1 - Qt) / 6;
}
CardinalClosed.prototype = {
  areaStart: noop$6,
  areaEnd: noop$6,
  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, Qt) {
    switch (_e = +_e, Qt = +Qt, this._point) {
      case 0:
        this._point = 1, this._x3 = _e, this._y3 = Qt;
        break;
      case 1:
        this._point = 2, this._context.moveTo(this._x4 = _e, this._y4 = Qt);
        break;
      case 2:
        this._point = 3, this._x5 = _e, this._y5 = Qt;
        break;
      default:
        point$6(this, _e, Qt);
        break;
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = _e, this._y0 = this._y1, this._y1 = this._y2, this._y2 = Qt;
  }
};
const curveCardinalClosed = function _e(Qt) {
  function Zt($n) {
    return new CardinalClosed($n, Qt);
  }
  return Zt.tension = function($n) {
    return _e(+$n);
  }, Zt;
}(0);
function CardinalOpen(_e, Qt) {
  this._context = _e, this._k = (1 - Qt) / 6;
}
CardinalOpen.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
  },
  lineEnd: function() {
    (this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(_e, Qt) {
    switch (_e = +_e, Qt = +Qt, this._point) {
      case 0:
        this._point = 1;
        break;
      case 1:
        this._point = 2;
        break;
      case 2:
        this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
        break;
      case 3:
        this._point = 4;
      default:
        point$6(this, _e, Qt);
        break;
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = _e, this._y0 = this._y1, this._y1 = this._y2, this._y2 = Qt;
  }
};
const curveCardinalOpen = function _e(Qt) {
  function Zt($n) {
    return new CardinalOpen($n, Qt);
  }
  return Zt.tension = function($n) {
    return _e(+$n);
  }, Zt;
}(0);
function point$5(_e, Qt, Zt) {
  var $n = _e._x1, Sn = _e._y1, kn = _e._x2, Kn = _e._y2;
  if (_e._l01_a > epsilon$5) {
    var er = 2 * _e._l01_2a + 3 * _e._l01_a * _e._l12_a + _e._l12_2a, Cr = 3 * _e._l01_a * (_e._l01_a + _e._l12_a);
    $n = ($n * er - _e._x0 * _e._l12_2a + _e._x2 * _e._l01_2a) / Cr, Sn = (Sn * er - _e._y0 * _e._l12_2a + _e._y2 * _e._l01_2a) / Cr;
  }
  if (_e._l23_a > epsilon$5) {
    var kr = 2 * _e._l23_2a + 3 * _e._l23_a * _e._l12_a + _e._l12_2a, Yr = 3 * _e._l23_a * (_e._l23_a + _e._l12_a);
    kn = (kn * kr + _e._x1 * _e._l23_2a - Qt * _e._l12_2a) / Yr, Kn = (Kn * kr + _e._y1 * _e._l23_2a - Zt * _e._l12_2a) / Yr;
  }
  _e._context.bezierCurveTo($n, Sn, kn, Kn, _e._x2, _e._y2);
}
function CatmullRom(_e, Qt) {
  this._context = _e, this._alpha = Qt;
}
CatmullRom.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 2:
        this._context.lineTo(this._x2, this._y2);
        break;
      case 3:
        this.point(this._x2, this._y2);
        break;
    }
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(_e, Qt) {
    if (_e = +_e, Qt = +Qt, this._point) {
      var Zt = this._x2 - _e, $n = this._y2 - Qt;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(Zt * Zt + $n * $n, this._alpha));
    }
    switch (this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(_e, Qt) : this._context.moveTo(_e, Qt);
        break;
      case 1:
        this._point = 2;
        break;
      case 2:
        this._point = 3;
      default:
        point$5(this, _e, Qt);
        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 = Qt;
  }
};
const curveCatmullRom = function _e(Qt) {
  function Zt($n) {
    return Qt ? new CatmullRom($n, Qt) : new Cardinal($n, 0);
  }
  return Zt.alpha = function($n) {
    return _e(+$n);
  }, Zt;
}(0.5);
function CatmullRomClosed(_e, Qt) {
  this._context = _e, this._alpha = Qt;
}
CatmullRomClosed.prototype = {
  areaStart: noop$6,
  areaEnd: noop$6,
  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, Qt) {
    if (_e = +_e, Qt = +Qt, this._point) {
      var Zt = this._x2 - _e, $n = this._y2 - Qt;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(Zt * Zt + $n * $n, this._alpha));
    }
    switch (this._point) {
      case 0:
        this._point = 1, this._x3 = _e, this._y3 = Qt;
        break;
      case 1:
        this._point = 2, this._context.moveTo(this._x4 = _e, this._y4 = Qt);
        break;
      case 2:
        this._point = 3, this._x5 = _e, this._y5 = Qt;
        break;
      default:
        point$5(this, _e, Qt);
        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 = Qt;
  }
};
const curveCatmullRomClosed = function _e(Qt) {
  function Zt($n) {
    return Qt ? new CatmullRomClosed($n, Qt) : new CardinalClosed($n, 0);
  }
  return Zt.alpha = function($n) {
    return _e(+$n);
  }, Zt;
}(0.5);
function CatmullRomOpen(_e, Qt) {
  this._context = _e, this._alpha = Qt;
}
CatmullRomOpen.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
  },
  lineEnd: function() {
    (this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(_e, Qt) {
    if (_e = +_e, Qt = +Qt, this._point) {
      var Zt = this._x2 - _e, $n = this._y2 - Qt;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(Zt * Zt + $n * $n, this._alpha));
    }
    switch (this._point) {
      case 0:
        this._point = 1;
        break;
      case 1:
        this._point = 2;
        break;
      case 2:
        this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
        break;
      case 3:
        this._point = 4;
      default:
        point$5(this, _e, Qt);
        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 = Qt;
  }
};
const curveCatmullRomOpen = function _e(Qt) {
  function Zt($n) {
    return Qt ? new CatmullRomOpen($n, Qt) : new CardinalOpen($n, 0);
  }
  return Zt.alpha = function($n) {
    return _e(+$n);
  }, Zt;
}(0.5);
function LinearClosed(_e) {
  this._context = _e;
}
LinearClosed.prototype = {
  areaStart: noop$6,
  areaEnd: noop$6,
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    this._point && this._context.closePath();
  },
  point: function(_e, Qt) {
    _e = +_e, Qt = +Qt, this._point ? this._context.lineTo(_e, Qt) : (this._point = 1, this._context.moveTo(_e, Qt));
  }
};
function curveLinearClosed(_e) {
  return new LinearClosed(_e);
}
function sign$1(_e) {
  return _e < 0 ? -1 : 1;
}
function slope3(_e, Qt, Zt) {
  var $n = _e._x1 - _e._x0, Sn = Qt - _e._x1, kn = (_e._y1 - _e._y0) / ($n || Sn < 0 && -0), Kn = (Zt - _e._y1) / (Sn || $n < 0 && -0), er = (kn * Sn + Kn * $n) / ($n + Sn);
  return (sign$1(kn) + sign$1(Kn)) * Math.min(Math.abs(kn), Math.abs(Kn), 0.5 * Math.abs(er)) || 0;
}
function slope2(_e, Qt) {
  var Zt = _e._x1 - _e._x0;
  return Zt ? (3 * (_e._y1 - _e._y0) / Zt - Qt) / 2 : Qt;
}
function point$4(_e, Qt, Zt) {
  var $n = _e._x0, Sn = _e._y0, kn = _e._x1, Kn = _e._y1, er = (kn - $n) / 3;
  _e._context.bezierCurveTo($n + er, Sn + er * Qt, kn - er, Kn - er * Zt, kn, Kn);
}
function MonotoneX(_e) {
  this._context = _e;
}
MonotoneX.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN, this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 2:
        this._context.lineTo(this._x1, this._y1);
        break;
      case 3:
        point$4(this, this._t0, slope2(this, this._t0));
        break;
    }
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(_e, Qt) {
    var Zt = NaN;
    if (_e = +_e, Qt = +Qt, !(_e === this._x1 && Qt === this._y1)) {
      switch (this._point) {
        case 0:
          this._point = 1, this._line ? this._context.lineTo(_e, Qt) : this._context.moveTo(_e, Qt);
          break;
        case 1:
          this._point = 2;
          break;
        case 2:
          this._point = 3, point$4(this, slope2(this, Zt = slope3(this, _e, Qt)), Zt);
          break;
        default:
          point$4(this, this._t0, Zt = slope3(this, _e, Qt));
          break;
      }
      this._x0 = this._x1, this._x1 = _e, this._y0 = this._y1, this._y1 = Qt, this._t0 = Zt;
    }
  }
};
function MonotoneY(_e) {
  this._context = new ReflectContext(_e);
}
(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(_e, Qt) {
  MonotoneX.prototype.point.call(this, Qt, _e);
};
function ReflectContext(_e) {
  this._context = _e;
}
ReflectContext.prototype = {
  moveTo: function(_e, Qt) {
    this._context.moveTo(Qt, _e);
  },
  closePath: function() {
    this._context.closePath();
  },
  lineTo: function(_e, Qt) {
    this._context.lineTo(Qt, _e);
  },
  bezierCurveTo: function(_e, Qt, Zt, $n, Sn, kn) {
    this._context.bezierCurveTo(Qt, _e, $n, Zt, kn, Sn);
  }
};
function monotoneX(_e) {
  return new MonotoneX(_e);
}
function monotoneY(_e) {
  return new MonotoneY(_e);
}
function Natural(_e) {
  this._context = _e;
}
Natural.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x = [], this._y = [];
  },
  lineEnd: function() {
    var _e = this._x, Qt = this._y, Zt = _e.length;
    if (Zt)
      if (this._line ? this._context.lineTo(_e[0], Qt[0]) : this._context.moveTo(_e[0], Qt[0]), Zt === 2)
        this._context.lineTo(_e[1], Qt[1]);
      else
        for (var $n = controlPoints(_e), Sn = controlPoints(Qt), kn = 0, Kn = 1; Kn < Zt; ++kn, ++Kn)
          this._context.bezierCurveTo($n[0][kn], Sn[0][kn], $n[1][kn], Sn[1][kn], _e[Kn], Qt[Kn]);
    (this._line || this._line !== 0 && Zt === 1) && this._context.closePath(), this._line = 1 - this._line, this._x = this._y = null;
  },
  point: function(_e, Qt) {
    this._x.push(+_e), this._y.push(+Qt);
  }
};
function controlPoints(_e) {
  var Qt, Zt = _e.length - 1, $n, Sn = new Array(Zt), kn = new Array(Zt), Kn = new Array(Zt);
  for (Sn[0] = 0, kn[0] = 2, Kn[0] = _e[0] + 2 * _e[1], Qt = 1; Qt < Zt - 1; ++Qt)
    Sn[Qt] = 1, kn[Qt] = 4, Kn[Qt] = 4 * _e[Qt] + 2 * _e[Qt + 1];
  for (Sn[Zt - 1] = 2, kn[Zt - 1] = 7, Kn[Zt - 1] = 8 * _e[Zt - 1] + _e[Zt], Qt = 1; Qt < Zt; ++Qt)
    $n = Sn[Qt] / kn[Qt - 1], kn[Qt] -= $n, Kn[Qt] -= $n * Kn[Qt - 1];
  for (Sn[Zt - 1] = Kn[Zt - 1] / kn[Zt - 1], Qt = Zt - 2; Qt >= 0; --Qt)
    Sn[Qt] = (Kn[Qt] - Sn[Qt + 1]) / kn[Qt];
  for (kn[Zt - 1] = (_e[Zt] + Sn[Zt - 1]) / 2, Qt = 0; Qt < Zt - 1; ++Qt)
    kn[Qt] = 2 * _e[Qt + 1] - Sn[Qt + 1];
  return [Sn, kn];
}
function curveNatural(_e) {
  return new Natural(_e);
}
function Step(_e, Qt) {
  this._context = _e, this._t = Qt;
}
Step.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, Qt) {
    switch (_e = +_e, Qt = +Qt, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(_e, Qt) : this._context.moveTo(_e, Qt);
        break;
      case 1:
        this._point = 2;
      default: {
        if (this._t <= 0)
          this._context.lineTo(this._x, Qt), this._context.lineTo(_e, Qt);
        else {
          var Zt = this._x * (1 - this._t) + _e * this._t;
          this._context.lineTo(Zt, this._y), this._context.lineTo(Zt, Qt);
        }
        break;
      }
    }
    this._x = _e, this._y = Qt;
  }
};
function curveStep(_e) {
  return new Step(_e, 0.5);
}
function stepBefore(_e) {
  return new Step(_e, 0);
}
function stepAfter(_e) {
  return new Step(_e, 1);
}
function domCanvas(_e, Qt) {
  if (typeof document < "u" && document.createElement) {
    const Zt = document.createElement("canvas");
    if (Zt && Zt.getContext)
      return Zt.width = _e, Zt.height = Qt, Zt;
  }
  return null;
}
const domImage = () => typeof Image < "u" ? Image : null;
function initRange(_e, Qt) {
  switch (arguments.length) {
    case 0:
      break;
    case 1:
      this.range(_e);
      break;
    default:
      this.range(Qt).domain(_e);
      break;
  }
  return this;
}
function initInterpolator(_e, Qt) {
  switch (arguments.length) {
    case 0:
      break;
    case 1: {
      typeof _e == "function" ? this.interpolator(_e) : this.range(_e);
      break;
    }
    default: {
      this.domain(_e), typeof Qt == "function" ? this.interpolator(Qt) : this.range(Qt);
      break;
    }
  }
  return this;
}
const implicit = Symbol("implicit");
function ordinal() {
  var _e = new InternMap(), Qt = [], Zt = [], $n = implicit;
  function Sn(kn) {
    let Kn = _e.get(kn);
    if (Kn === void 0) {
      if ($n !== implicit)
        return $n;
      _e.set(kn, Kn = Qt.push(kn) - 1);
    }
    return Zt[Kn % Zt.length];
  }
  return Sn.domain = function(kn) {
    if (!arguments.length)
      return Qt.slice();
    Qt = [], _e = new InternMap();
    for (const Kn of kn)
      _e.has(Kn) || _e.set(Kn, Qt.push(Kn) - 1);
    return Sn;
  }, Sn.range = function(kn) {
    return arguments.length ? (Zt = Array.from(kn), Sn) : Zt.slice();
  }, Sn.unknown = function(kn) {
    return arguments.length ? ($n = kn, Sn) : $n;
  }, Sn.copy = function() {
    return ordinal(Qt, Zt).unknown($n);
  }, initRange.apply(Sn, arguments), Sn;
}
function define(_e, Qt, Zt) {
  _e.prototype = Qt.prototype = Zt, Zt.constructor = _e;
}
function extend(_e, Qt) {
  var Zt = Object.create(_e.prototype);
  for (var $n in Qt)
    Zt[$n] = Qt[$n];
  return Zt;
}
function Color() {
}
var darker = 0.7, brighter = 1 / darker, reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`), named = {
  aliceblue: 15792383,
  antiquewhite: 16444375,
  aqua: 65535,
  aquamarine: 8388564,
  azure: 15794175,
  beige: 16119260,
  bisque: 16770244,
  black: 0,
  blanchedalmond: 16772045,
  blue: 255,
  blueviolet: 9055202,
  brown: 10824234,
  burlywood: 14596231,
  cadetblue: 6266528,
  chartreuse: 8388352,
  chocolate: 13789470,
  coral: 16744272,
  cornflowerblue: 6591981,
  cornsilk: 16775388,
  crimson: 14423100,
  cyan: 65535,
  darkblue: 139,
  darkcyan: 35723,
  darkgoldenrod: 12092939,
  darkgray: 11119017,
  darkgreen: 25600,
  darkgrey: 11119017,
  darkkhaki: 12433259,
  darkmagenta: 9109643,
  darkolivegreen: 5597999,
  darkorange: 16747520,
  darkorchid: 10040012,
  darkred: 9109504,
  darksalmon: 15308410,
  darkseagreen: 9419919,
  darkslateblue: 4734347,
  darkslategray: 3100495,
  darkslategrey: 3100495,
  darkturquoise: 52945,
  darkviolet: 9699539,
  deeppink: 16716947,
  deepskyblue: 49151,
  dimgray: 6908265,
  dimgrey: 6908265,
  dodgerblue: 2003199,
  firebrick: 11674146,
  floralwhite: 16775920,
  forestgreen: 2263842,
  fuchsia: 16711935,
  gainsboro: 14474460,
  ghostwhite: 16316671,
  gold: 16766720,
  goldenrod: 14329120,
  gray: 8421504,
  green: 32768,
  greenyellow: 11403055,
  grey: 8421504,
  honeydew: 15794160,
  hotpink: 16738740,
  indianred: 13458524,
  indigo: 4915330,
  ivory: 16777200,
  khaki: 15787660,
  lavender: 15132410,
  lavenderblush: 16773365,
  lawngreen: 8190976,
  lemonchiffon: 16775885,
  lightblue: 11393254,
  lightcoral: 15761536,
  lightcyan: 14745599,
  lightgoldenrodyellow: 16448210,
  lightgray: 13882323,
  lightgreen: 9498256,
  lightgrey: 13882323,
  lightpink: 16758465,
  lightsalmon: 16752762,
  lightseagreen: 2142890,
  lightskyblue: 8900346,
  lightslategray: 7833753,
  lightslategrey: 7833753,
  lightsteelblue: 11584734,
  lightyellow: 16777184,
  lime: 65280,
  limegreen: 3329330,
  linen: 16445670,
  magenta: 16711935,
  maroon: 8388608,
  mediumaquamarine: 6737322,
  mediumblue: 205,
  mediumorchid: 12211667,
  mediumpurple: 9662683,
  mediumseagreen: 3978097,
  mediumslateblue: 8087790,
  mediumspringgreen: 64154,
  mediumturquoise: 4772300,
  mediumvioletred: 13047173,
  midnightblue: 1644912,
  mintcream: 16121850,
  mistyrose: 16770273,
  moccasin: 16770229,
  navajowhite: 16768685,
  navy: 128,
  oldlace: 16643558,
  olive: 8421376,
  olivedrab: 7048739,
  orange: 16753920,
  orangered: 16729344,
  orchid: 14315734,
  palegoldenrod: 15657130,
  palegreen: 10025880,
  paleturquoise: 11529966,
  palevioletred: 14381203,
  papayawhip: 16773077,
  peachpuff: 16767673,
  peru: 13468991,
  pink: 16761035,
  plum: 14524637,
  powderblue: 11591910,
  purple: 8388736,
  rebeccapurple: 6697881,
  red: 16711680,
  rosybrown: 12357519,
  royalblue: 4286945,
  saddlebrown: 9127187,
  salmon: 16416882,
  sandybrown: 16032864,
  seagreen: 3050327,
  seashell: 16774638,
  sienna: 10506797,
  silver: 12632256,
  skyblue: 8900331,
  slateblue: 6970061,
  slategray: 7372944,
  slategrey: 7372944,
  snow: 16775930,
  springgreen: 65407,
  steelblue: 4620980,
  tan: 13808780,
  teal: 32896,
  thistle: 14204888,
  tomato: 16737095,
  turquoise: 4251856,
  violet: 15631086,
  wheat: 16113331,
  white: 16777215,
  whitesmoke: 16119285,
  yellow: 16776960,
  yellowgreen: 10145074
};
define(Color, color$3, {
  copy(_e) {
    return Object.assign(new this.constructor(), this, _e);
  },
  displayable() {
    return this.rgb().displayable();
  },
  hex: color_formatHex,
  // Deprecated! Use color.formatHex.
  formatHex: color_formatHex,
  formatHex8: color_formatHex8,
  formatHsl: color_formatHsl,
  formatRgb: color_formatRgb,
  toString: color_formatRgb
});
function color_formatHex() {
  return this.rgb().formatHex();
}
function color_formatHex8() {
  return this.rgb().formatHex8();
}
function color_formatHsl() {
  return hslConvert(this).formatHsl();
}
function color_formatRgb() {
  return this.rgb().formatRgb();
}
function color$3(_e) {
  var Qt, Zt;
  return _e = (_e + "").trim().toLowerCase(), (Qt = reHex.exec(_e)) ? (Zt = Qt[1].length, Qt = parseInt(Qt[1], 16), Zt === 6 ? rgbn(Qt) : Zt === 3 ? new Rgb(Qt >> 8 & 15 | Qt >> 4 & 240, Qt >> 4 & 15 | Qt & 240, (Qt & 15) << 4 | Qt & 15, 1) : Zt === 8 ? rgba(Qt >> 24 & 255, Qt >> 16 & 255, Qt >> 8 & 255, (Qt & 255) / 255) : Zt === 4 ? rgba(Qt >> 12 & 15 | Qt >> 8 & 240, Qt >> 8 & 15 | Qt >> 4 & 240, Qt >> 4 & 15 | Qt & 240, ((Qt & 15) << 4 | Qt & 15) / 255) : null) : (Qt = reRgbInteger.exec(_e)) ? new Rgb(Qt[1], Qt[2], Qt[3], 1) : (Qt = reRgbPercent.exec(_e)) ? new Rgb(Qt[1] * 255 / 100, Qt[2] * 255 / 100, Qt[3] * 255 / 100, 1) : (Qt = reRgbaInteger.exec(_e)) ? rgba(Qt[1], Qt[2], Qt[3], Qt[4]) : (Qt = reRgbaPercent.exec(_e)) ? rgba(Qt[1] * 255 / 100, Qt[2] * 255 / 100, Qt[3] * 255 / 100, Qt[4]) : (Qt = reHslPercent.exec(_e)) ? hsla(Qt[1], Qt[2] / 100, Qt[3] / 100, 1) : (Qt = reHslaPercent.exec(_e)) ? hsla(Qt[1], Qt[2] / 100, Qt[3] / 100, Qt[4]) : named.hasOwnProperty(_e) ? rgbn(named[_e]) : _e === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
}
function rgbn(_e) {
  return new Rgb(_e >> 16 & 255, _e >> 8 & 255, _e & 255, 1);
}
function rgba(_e, Qt, Zt, $n) {
  return $n <= 0 && (_e = Qt = Zt = NaN), new Rgb(_e, Qt, Zt, $n);
}
function rgbConvert(_e) {
  return _e instanceof Color || (_e = color$3(_e)), _e ? (_e = _e.rgb(), new Rgb(_e.r, _e.g, _e.b, _e.opacity)) : new Rgb();
}
function rgb(_e, Qt, Zt, $n) {
  return arguments.length === 1 ? rgbConvert(_e) : new Rgb(_e, Qt, Zt, $n ?? 1);
}
function Rgb(_e, Qt, Zt, $n) {
  this.r = +_e, this.g = +Qt, this.b = +Zt, this.opacity = +$n;
}
define(Rgb, rgb, extend(Color, {
  brighter(_e) {
    return _e = _e == null ? brighter : Math.pow(brighter, _e), new Rgb(this.r * _e, this.g * _e, this.b * _e, this.opacity);
  },
  darker(_e) {
    return _e = _e == null ? darker : Math.pow(darker, _e), new Rgb(this.r * _e, this.g * _e, this.b * _e, this.opacity);
  },
  rgb() {
    return this;
  },
  clamp() {
    return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
  },
  displayable() {
    return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
  },
  hex: rgb_formatHex,
  // Deprecated! Use color.formatHex.
  formatHex: rgb_formatHex,
  formatHex8: rgb_formatHex8,
  formatRgb: rgb_formatRgb,
  toString: rgb_formatRgb
}));
function rgb_formatHex() {
  return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
}
function rgb_formatHex8() {
  return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function rgb_formatRgb() {
  const _e = clampa(this.opacity);
  return `${_e === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${_e === 1 ? ")" : `, ${_e})`}`;
}
function clampa(_e) {
  return isNaN(_e) ? 1 : Math.max(0, Math.min(1, _e));
}
function clampi(_e) {
  return Math.max(0, Math.min(255, Math.round(_e) || 0));
}
function hex(_e) {
  return _e = clampi(_e), (_e < 16 ? "0" : "") + _e.toString(16);
}
function hsla(_e, Qt, Zt, $n) {
  return $n <= 0 ? _e = Qt = Zt = NaN : Zt <= 0 || Zt >= 1 ? _e = Qt = NaN : Qt <= 0 && (_e = NaN), new Hsl(_e, Qt, Zt, $n);
}
function hslConvert(_e) {
  if (_e instanceof Hsl)
    return new Hsl(_e.h, _e.s, _e.l, _e.opacity);
  if (_e instanceof Color || (_e = color$3(_e)), !_e)
    return new Hsl();
  if (_e instanceof Hsl)
    return _e;
  _e = _e.rgb();
  var Qt = _e.r / 255, Zt = _e.g / 255, $n = _e.b / 255, Sn = Math.min(Qt, Zt, $n), kn = Math.max(Qt, Zt, $n), Kn = NaN, er = kn - Sn, Cr = (kn + Sn) / 2;
  return er ? (Qt === kn ? Kn = (Zt - $n) / er + (Zt < $n) * 6 : Zt === kn ? Kn = ($n - Qt) / er + 2 : Kn = (Qt - Zt) / er + 4, er /= Cr < 0.5 ? kn + Sn : 2 - kn - Sn, Kn *= 60) : er = Cr > 0 && Cr < 1 ? 0 : Kn, new Hsl(Kn, er, Cr, _e.opacity);
}
function hsl$2(_e, Qt, Zt, $n) {
  return arguments.length === 1 ? hslConvert(_e) : new Hsl(_e, Qt, Zt, $n ?? 1);
}
function Hsl(_e, Qt, Zt, $n) {
  this.h = +_e, this.s = +Qt, this.l = +Zt, this.opacity = +$n;
}
define(Hsl, hsl$2, extend(Color, {
  brighter(_e) {
    return _e = _e == null ? brighter : Math.pow(brighter, _e), new Hsl(this.h, this.s, this.l * _e, this.opacity);
  },
  darker(_e) {
    return _e = _e == null ? darker : Math.pow(darker, _e), new Hsl(this.h, this.s, this.l * _e, this.opacity);
  },
  rgb() {
    var _e = this.h % 360 + (this.h < 0) * 360, Qt = isNaN(_e) || isNaN(this.s) ? 0 : this.s, Zt = this.l, $n = Zt + (Zt < 0.5 ? Zt : 1 - Zt) * Qt, Sn = 2 * Zt - $n;
    return new Rgb(
      hsl2rgb(_e >= 240 ? _e - 240 : _e + 120, Sn, $n),
      hsl2rgb(_e, Sn, $n),
      hsl2rgb(_e < 120 ? _e + 240 : _e - 120, Sn, $n),
      this.opacity
    );
  },
  clamp() {
    return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
  },
  displayable() {
    return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
  },
  formatHsl() {
    const _e = clampa(this.opacity);
    return `${_e === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${_e === 1 ? ")" : `, ${_e})`}`;
  }
}));
function clamph(_e) {
  return _e = (_e || 0) % 360, _e < 0 ? _e + 360 : _e;
}
function clampt(_e) {
  return Math.max(0, Math.min(1, _e || 0));
}
function hsl2rgb(_e, Qt, Zt) {
  return (_e < 60 ? Qt + (Zt - Qt) * _e / 60 : _e < 180 ? Zt : _e < 240 ? Qt + (Zt - Qt) * (240 - _e) / 60 : Qt) * 255;
}
const radians$1 = Math.PI / 180, degrees$2 = 180 / Math.PI, K = 18, Xn = 0.96422, Yn$1 = 1, Zn$1 = 0.82521, t0$1 = 4 / 29, t1$1 = 6 / 29, t2 = 3 * t1$1 * t1$1, t3 = t1$1 * t1$1 * t1$1;
function labConvert(_e) {
  if (_e instanceof Lab)
    return new Lab(_e.l, _e.a, _e.b, _e.opacity);
  if (_e instanceof Hcl)
    return hcl2lab(_e);
  _e instanceof Rgb || (_e = rgbConvert(_e));
  var Qt = rgb2lrgb(_e.r), Zt = rgb2lrgb(_e.g), $n = rgb2lrgb(_e.b), Sn = xyz2lab((0.2225045 * Qt + 0.7168786 * Zt + 0.0606169 * $n) / Yn$1), kn, Kn;
  return Qt === Zt && Zt === $n ? kn = Kn = Sn : (kn = xyz2lab((0.4360747 * Qt + 0.3850649 * Zt + 0.1430804 * $n) / Xn), Kn = xyz2lab((0.0139322 * Qt + 0.0971045 * Zt + 0.7141733 * $n) / Zn$1)), new Lab(116 * Sn - 16, 500 * (kn - Sn), 200 * (Sn - Kn), _e.opacity);
}
function lab$1(_e, Qt, Zt, $n) {
  return arguments.length === 1 ? labConvert(_e) : new Lab(_e, Qt, Zt, $n ?? 1);
}
function Lab(_e, Qt, Zt, $n) {
  this.l = +_e, this.a = +Qt, this.b = +Zt, this.opacity = +$n;
}
define(Lab, lab$1, extend(Color, {
  brighter(_e) {
    return new Lab(this.l + K * (_e ?? 1), this.a, this.b, this.opacity);
  },
  darker(_e) {
    return new Lab(this.l - K * (_e ?? 1), this.a, this.b, this.opacity);
  },
  rgb() {
    var _e = (this.l + 16) / 116, Qt = isNaN(this.a) ? _e : _e + this.a / 500, Zt = isNaN(this.b) ? _e : _e - this.b / 200;
    return Qt = Xn * lab2xyz(Qt), _e = Yn$1 * lab2xyz(_e), Zt = Zn$1 * lab2xyz(Zt), new Rgb(
      lrgb2rgb(3.1338561 * Qt - 1.6168667 * _e - 0.4906146 * Zt),
      lrgb2rgb(-0.9787684 * Qt + 1.9161415 * _e + 0.033454 * Zt),
      lrgb2rgb(0.0719453 * Qt - 0.2289914 * _e + 1.4052427 * Zt),
      this.opacity
    );
  }
}));
function xyz2lab(_e) {
  return _e > t3 ? Math.pow(_e, 1 / 3) : _e / t2 + t0$1;
}
function lab2xyz(_e) {
  return _e > t1$1 ? _e * _e * _e : t2 * (_e - t0$1);
}
function lrgb2rgb(_e) {
  return 255 * (_e <= 31308e-7 ? 12.92 * _e : 1.055 * Math.pow(_e, 1 / 2.4) - 0.055);
}
function rgb2lrgb(_e) {
  return (_e /= 255) <= 0.04045 ? _e / 12.92 : Math.pow((_e + 0.055) / 1.055, 2.4);
}
function hclConvert(_e) {
  if (_e instanceof Hcl)
    return new Hcl(_e.h, _e.c, _e.l, _e.opacity);
  if (_e instanceof Lab || (_e = labConvert(_e)), _e.a === 0 && _e.b === 0)
    return new Hcl(NaN, 0 < _e.l && _e.l < 100 ? 0 : NaN, _e.l, _e.opacity);
  var Qt = Math.atan2(_e.b, _e.a) * degrees$2;
  return new Hcl(Qt < 0 ? Qt + 360 : Qt, Math.sqrt(_e.a * _e.a + _e.b * _e.b), _e.l, _e.opacity);
}
function hcl$2(_e, Qt, Zt, $n) {
  return arguments.length === 1 ? hclConvert(_e) : new Hcl(_e, Qt, Zt, $n ?? 1);
}
function Hcl(_e, Qt, Zt, $n) {
  this.h = +_e, this.c = +Qt, this.l = +Zt, this.opacity = +$n;
}
function hcl2lab(_e) {
  if (isNaN(_e.h))
    return new Lab(_e.l, 0, 0, _e.opacity);
  var Qt = _e.h * radians$1;
  return new Lab(_e.l, Math.cos(Qt) * _e.c, Math.sin(Qt) * _e.c, _e.opacity);
}
define(Hcl, hcl$2, extend(Color, {
  brighter(_e) {
    return new Hcl(this.h, this.c, this.l + K * (_e ?? 1), this.opacity);
  },
  darker(_e) {
    return new Hcl(this.h, this.c, this.l - K * (_e ?? 1), this.opacity);
  },
  rgb() {
    return hcl2lab(this).rgb();
  }
}));
var A = -0.14861, B$1 = 1.78277, C$2 = -0.29227, D$1 = -0.90649, E = 1.97294, ED = E * D$1, EB = E * B$1, BC_DA = B$1 * C$2 - D$1 * A;
function cubehelixConvert(_e) {
  if (_e instanceof Cubehelix)
    return new Cubehelix(_e.h, _e.s, _e.l, _e.opacity);
  _e instanceof Rgb || (_e = rgbConvert(_e));
  var Qt = _e.r / 255, Zt = _e.g / 255, $n = _e.b / 255, Sn = (BC_DA * $n + ED * Qt - EB * Zt) / (BC_DA + ED - EB), kn = $n - Sn, Kn = (E * (Zt - Sn) - C$2 * kn) / D$1, er = Math.sqrt(Kn * Kn + kn * kn) / (E * Sn * (1 - Sn)), Cr = er ? Math.atan2(Kn, kn) * degrees$2 - 120 : NaN;
  return new Cubehelix(Cr < 0 ? Cr + 360 : Cr, er, Sn, _e.opacity);
}
function cubehelix$2(_e, Qt, Zt, $n) {
  return arguments.length === 1 ? cubehelixConvert(_e) : new Cubehelix(_e, Qt, Zt, $n ?? 1);
}
function Cubehelix(_e, Qt, Zt, $n) {
  this.h = +_e, this.s = +Qt, this.l = +Zt, this.opacity = +$n;
}
define(Cubehelix, cubehelix$2, extend(Color, {
  brighter(_e) {
    return _e = _e == null ? brighter : Math.pow(brighter, _e), new Cubehelix(this.h, this.s, this.l * _e, this.opacity);
  },
  darker(_e) {
    return _e = _e == null ? darker : Math.pow(darker, _e), new Cubehelix(this.h, this.s, this.l * _e, this.opacity);
  },
  rgb() {
    var _e = isNaN(this.h) ? 0 : (this.h + 120) * radians$1, Qt = +this.l, Zt = isNaN(this.s) ? 0 : this.s * Qt * (1 - Qt), $n = Math.cos(_e), Sn = Math.sin(_e);
    return new Rgb(
      255 * (Qt + Zt * (A * $n + B$1 * Sn)),
      255 * (Qt + Zt * (C$2 * $n + D$1 * Sn)),
      255 * (Qt + Zt * (E * $n)),
      this.opacity
    );
  }
}));
function basis(_e, Qt, Zt, $n, Sn) {
  var kn = _e * _e, Kn = kn * _e;
  return ((1 - 3 * _e + 3 * kn - Kn) * Qt + (4 - 6 * kn + 3 * Kn) * Zt + (1 + 3 * _e + 3 * kn - 3 * Kn) * $n + Kn * Sn) / 6;
}
function basis$1(_e) {
  var Qt = _e.length - 1;
  return function(Zt) {
    var $n = Zt <= 0 ? Zt = 0 : Zt >= 1 ? (Zt = 1, Qt - 1) : Math.floor(Zt * Qt), Sn = _e[$n], kn = _e[$n + 1], Kn = $n > 0 ? _e[$n - 1] : 2 * Sn - kn, er = $n < Qt - 1 ? _e[$n + 2] : 2 * kn - Sn;
    return basis((Zt - $n / Qt) * Qt, Kn, Sn, kn, er);
  };
}
function basisClosed(_e) {
  var Qt = _e.length;
  return function(Zt) {
    var $n = Math.floor(((Zt %= 1) < 0 ? ++Zt : Zt) * Qt), Sn = _e[($n + Qt - 1) % Qt], kn = _e[$n % Qt], Kn = _e[($n + 1) % Qt], er = _e[($n + 2) % Qt];
    return basis((Zt - $n / Qt) * Qt, Sn, kn, Kn, er);
  };
}
const constant$4 = (_e) => () => _e;
function linear$1(_e, Qt) {
  return function(Zt) {
    return _e + Zt * Qt;
  };
}
function exponential(_e, Qt, Zt) {
  return _e = Math.pow(_e, Zt), Qt = Math.pow(Qt, Zt) - _e, Zt = 1 / Zt, function($n) {
    return Math.pow(_e + $n * Qt, Zt);
  };
}
function hue$1(_e, Qt) {
  var Zt = Qt - _e;
  return Zt ? linear$1(_e, Zt > 180 || Zt < -180 ? Zt - 360 * Math.round(Zt / 360) : Zt) : constant$4(isNaN(_e) ? Qt : _e);
}
function gamma(_e) {
  return (_e = +_e) == 1 ? nogamma : function(Qt, Zt) {
    return Zt - Qt ? exponential(Qt, Zt, _e) : constant$4(isNaN(Qt) ? Zt : Qt);
  };
}
function nogamma(_e, Qt) {
  var Zt = Qt - _e;
  return Zt ? linear$1(_e, Zt) : constant$4(isNaN(_e) ? Qt : _e);
}
const interpolateRgb = function _e(Qt) {
  var Zt = gamma(Qt);
  function $n(Sn, kn) {
    var Kn = Zt((Sn = rgb(Sn)).r, (kn = rgb(kn)).r), er = Zt(Sn.g, kn.g), Cr = Zt(Sn.b, kn.b), kr = nogamma(Sn.opacity, kn.opacity);
    return function(Yr) {
      return Sn.r = Kn(Yr), Sn.g = er(Yr), Sn.b = Cr(Yr), Sn.opacity = kr(Yr), Sn + "";
    };
  }
  return $n.gamma = _e, $n;
}(1);
function rgbSpline(_e) {
  return function(Qt) {
    var Zt = Qt.length, $n = new Array(Zt), Sn = new Array(Zt), kn = new Array(Zt), Kn, er;
    for (Kn = 0; Kn < Zt; ++Kn)
      er = rgb(Qt[Kn]), $n[Kn] = er.r || 0, Sn[Kn] = er.g || 0, kn[Kn] = er.b || 0;
    return $n = _e($n), Sn = _e(Sn), kn = _e(kn), er.opacity = 1, function(Cr) {
      return er.r = $n(Cr), er.g = Sn(Cr), er.b = kn(Cr), er + "";
    };
  };
}
var rgbBasis = rgbSpline(basis$1), rgbBasisClosed = rgbSpline(basisClosed);
function numberArray(_e, Qt) {
  Qt || (Qt = []);
  var Zt = _e ? Math.min(Qt.length, _e.length) : 0, $n = Qt.slice(), Sn;
  return function(kn) {
    for (Sn = 0; Sn < Zt; ++Sn)
      $n[Sn] = _e[Sn] * (1 - kn) + Qt[Sn] * kn;
    return $n;
  };
}
function isNumberArray(_e) {
  return ArrayBuffer.isView(_e) && !(_e instanceof DataView);
}
function array$4(_e, Qt) {
  return (isNumberArray(Qt) ? numberArray : genericArray)(_e, Qt);
}
function genericArray(_e, Qt) {
  var Zt = Qt ? Qt.length : 0, $n = _e ? Math.min(Zt, _e.length) : 0, Sn = new Array($n), kn = new Array(Zt), Kn;
  for (Kn = 0; Kn < $n; ++Kn)
    Sn[Kn] = interpolate$3(_e[Kn], Qt[Kn]);
  for (; Kn < Zt; ++Kn)
    kn[Kn] = Qt[Kn];
  return function(er) {
    for (Kn = 0; Kn < $n; ++Kn)
      kn[Kn] = Sn[Kn](er);
    return kn;
  };
}
function date$1(_e, Qt) {
  var Zt = /* @__PURE__ */ new Date();
  return _e = +_e, Qt = +Qt, function($n) {
    return Zt.setTime(_e * (1 - $n) + Qt * $n), Zt;
  };
}
function interpolateNumber(_e, Qt) {
  return _e = +_e, Qt = +Qt, function(Zt) {
    return _e * (1 - Zt) + Qt * Zt;
  };
}
function object(_e, Qt) {
  var Zt = {}, $n = {}, Sn;
  (_e === null || typeof _e != "object") && (_e = {}), (Qt === null || typeof Qt != "object") && (Qt = {});
  for (Sn in Qt)
    Sn in _e ? Zt[Sn] = interpolate$3(_e[Sn], Qt[Sn]) : $n[Sn] = Qt[Sn];
  return function(kn) {
    for (Sn in Zt)
      $n[Sn] = Zt[Sn](kn);
    return $n;
  };
}
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g");
function zero$3(_e) {
  return function() {
    return _e;
  };
}
function one$1(_e) {
  return function(Qt) {
    return _e(Qt) + "";
  };
}
function interpolateString(_e, Qt) {
  var Zt = reA.lastIndex = reB.lastIndex = 0, $n, Sn, kn, Kn = -1, er = [], Cr = [];
  for (_e = _e + "", Qt = Qt + ""; ($n = reA.exec(_e)) && (Sn = reB.exec(Qt)); )
    (kn = Sn.index) > Zt && (kn = Qt.slice(Zt, kn), er[Kn] ? er[Kn] += kn : er[++Kn] = kn), ($n = $n[0]) === (Sn = Sn[0]) ? er[Kn] ? er[Kn] += Sn : er[++Kn] = Sn : (er[++Kn] = null, Cr.push({ i: Kn, x: interpolateNumber($n, Sn) })), Zt = reB.lastIndex;
  return Zt < Qt.length && (kn = Qt.slice(Zt), er[Kn] ? er[Kn] += kn : er[++Kn] = kn), er.length < 2 ? Cr[0] ? one$1(Cr[0].x) : zero$3(Qt) : (Qt = Cr.length, function(kr) {
    for (var Yr = 0, Ms; Yr < Qt; ++Yr)
      er[(Ms = Cr[Yr]).i] = Ms.x(kr);
    return er.join("");
  });
}
function interpolate$3(_e, Qt) {
  var Zt = typeof Qt, $n;
  return Qt == null || Zt === "boolean" ? constant$4(Qt) : (Zt === "number" ? interpolateNumber : Zt === "string" ? ($n = color$3(Qt)) ? (Qt = $n, interpolateRgb) : interpolateString : Qt instanceof color$3 ? interpolateRgb : Qt instanceof Date ? date$1 : isNumberArray(Qt) ? numberArray : Array.isArray(Qt) ? genericArray : typeof Qt.valueOf != "function" && typeof Qt.toString != "function" || isNaN(Qt) ? object : interpolateNumber)(_e, Qt);
}
function discrete$1(_e) {
  var Qt = _e.length;
  return function(Zt) {
    return _e[Math.max(0, Math.min(Qt - 1, Math.floor(Zt * Qt)))];
  };
}
function hue(_e, Qt) {
  var Zt = hue$1(+_e, +Qt);
  return function($n) {
    var Sn = Zt($n);
    return Sn - 360 * Math.floor(Sn / 360);
  };
}
function interpolateRound(_e, Qt) {
  return _e = +_e, Qt = +Qt, function(Zt) {
    return Math.round(_e * (1 - Zt) + Qt * Zt);
  };
}
var degrees$1 = 180 / Math.PI, identity$4 = {
  translateX: 0,
  translateY: 0,
  rotate: 0,
  skewX: 0,
  scaleX: 1,
  scaleY: 1
};
function decompose(_e, Qt, Zt, $n, Sn, kn) {
  var Kn, er, Cr;
  return (Kn = Math.sqrt(_e * _e + Qt * Qt)) && (_e /= Kn, Qt /= Kn), (Cr = _e * Zt + Qt * $n) && (Zt -= _e * Cr, $n -= Qt * Cr), (er = Math.sqrt(Zt * Zt + $n * $n)) && (Zt /= er, $n /= er, Cr /= er), _e * $n < Qt * Zt && (_e = -_e, Qt = -Qt, Cr = -Cr, Kn = -Kn), {
    translateX: Sn,
    translateY: kn,
    rotate: Math.atan2(Qt, _e) * degrees$1,
    skewX: Math.atan(Cr) * degrees$1,
    scaleX: Kn,
    scaleY: er
  };
}
var svgNode;
function parseCss(_e) {
  const Qt = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(_e + "");
  return Qt.isIdentity ? identity$4 : decompose(Qt.a, Qt.b, Qt.c, Qt.d, Qt.e, Qt.f);
}
function parseSvg(_e) {
  return _e == null || (svgNode || (svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g")), svgNode.setAttribute("transform", _e), !(_e = svgNode.transform.baseVal.consolidate())) ? identity$4 : (_e = _e.matrix, decompose(_e.a, _e.b, _e.c, _e.d, _e.e, _e.f));
}
function interpolateTransform(_e, Qt, Zt, $n) {
  function Sn(kr) {
    return kr.length ? kr.pop() + " " : "";
  }
  function kn(kr, Yr, Ms, Ds, Ls, js) {
    if (kr !== Ms || Yr !== Ds) {
      var zs = Ls.push("translate(", null, Qt, null, Zt);
      js.push({ i: zs - 4, x: interpolateNumber(kr, Ms) }, { i: zs - 2, x: interpolateNumber(Yr, Ds) });
    } else
      (Ms || Ds) && Ls.push("translate(" + Ms + Qt + Ds + Zt);
  }
  function Kn(kr, Yr, Ms, Ds) {
    kr !== Yr ? (kr - Yr > 180 ? Yr += 360 : Yr - kr > 180 && (kr += 360), Ds.push({ i: Ms.push(Sn(Ms) + "rotate(", null, $n) - 2, x: interpolateNumber(kr, Yr) })) : Yr && Ms.push(Sn(Ms) + "rotate(" + Yr + $n);
  }
  function er(kr, Yr, Ms, Ds) {
    kr !== Yr ? Ds.push({ i: Ms.push(Sn(Ms) + "skewX(", null, $n) - 2, x: interpolateNumber(kr, Yr) }) : Yr && Ms.push(Sn(Ms) + "skewX(" + Yr + $n);
  }
  function Cr(kr, Yr, Ms, Ds, Ls, js) {
    if (kr !== Ms || Yr !== Ds) {
      var zs = Ls.push(Sn(Ls) + "scale(", null, ",", null, ")");
      js.push({ i: zs - 4, x: interpolateNumber(kr, Ms) }, { i: zs - 2, x: interpolateNumber(Yr, Ds) });
    } else
      (Ms !== 1 || Ds !== 1) && Ls.push(Sn(Ls) + "scale(" + Ms + "," + Ds + ")");
  }
  return function(kr, Yr) {
    var Ms = [], Ds = [];
    return kr = _e(kr), Yr = _e(Yr), kn(kr.translateX, kr.translateY, Yr.translateX, Yr.translateY, Ms, Ds), Kn(kr.rotate, Yr.rotate, Ms, Ds), er(kr.skewX, Yr.skewX, Ms, Ds), Cr(kr.scaleX, kr.scaleY, Yr.scaleX, Yr.scaleY, Ms, Ds), kr = Yr = null, function(Ls) {
      for (var js = -1, zs = Ds.length, Fs; ++js < zs; )
        Ms[(Fs = Ds[js]).i] = Fs.x(Ls);
      return Ms.join("");
    };
  };
}
var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"), interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"), epsilon2$1 = 1e-12;
function cosh(_e) {
  return ((_e = Math.exp(_e)) + 1 / _e) / 2;
}
function sinh(_e) {
  return ((_e = Math.exp(_e)) - 1 / _e) / 2;
}
function tanh(_e) {
  return ((_e = Math.exp(2 * _e)) - 1) / (_e + 1);
}
const interpolateZoom = function _e(Qt, Zt, $n) {
  function Sn(kn, Kn) {
    var er = kn[0], Cr = kn[1], kr = kn[2], Yr = Kn[0], Ms = Kn[1], Ds = Kn[2], Ls = Yr - er, js = Ms - Cr, zs = Ls * Ls + js * js, Fs, Bs;
    if (zs < epsilon2$1)
      Bs = Math.log(Ds / kr) / Qt, Fs = function(Pl) {
        return [
          er + Pl * Ls,
          Cr + Pl * js,
          kr * Math.exp(Qt * Pl * Bs)
        ];
      };
    else {
      var Hs = Math.sqrt(zs), Ws = (Ds * Ds - kr * kr + $n * zs) / (2 * kr * Zt * Hs), Ys = (Ds * Ds - kr * kr - $n * zs) / (2 * Ds * Zt * Hs), El = Math.log(Math.sqrt(Ws * Ws + 1) - Ws), Mu = Math.log(Math.sqrt(Ys * Ys + 1) - Ys);
      Bs = (Mu - El) / Qt, Fs = function(Pl) {
        var Iu = Pl * Bs, Tu = cosh(El), Au = kr / (Zt * Hs) * (Tu * tanh(Qt * Iu + El) - sinh(El));
        return [
          er + Au * Ls,
          Cr + Au * js,
          kr * Tu / cosh(Qt * Iu + El)
        ];
      };
    }
    return Fs.duration = Bs * 1e3 * Qt / Math.SQRT2, Fs;
  }
  return Sn.rho = function(kn) {
    var Kn = Math.max(1e-3, +kn), er = Kn * Kn, Cr = er * er;
    return _e(Kn, er, Cr);
  }, Sn;
}(Math.SQRT2, 2, 4);
function hsl(_e) {
  return function(Qt, Zt) {
    var $n = _e((Qt = hsl$2(Qt)).h, (Zt = hsl$2(Zt)).h), Sn = nogamma(Qt.s, Zt.s), kn = nogamma(Qt.l, Zt.l), Kn = nogamma(Qt.opacity, Zt.opacity);
    return function(er) {
      return Qt.h = $n(er), Qt.s = Sn(er), Qt.l = kn(er), Qt.opacity = Kn(er), Qt + "";
    };
  };
}
const hsl$1 = hsl(hue$1);
var hslLong = hsl(nogamma);
function lab(_e, Qt) {
  var Zt = nogamma((_e = lab$1(_e)).l, (Qt = lab$1(Qt)).l), $n = nogamma(_e.a, Qt.a), Sn = nogamma(_e.b, Qt.b), kn = nogamma(_e.opacity, Qt.opacity);
  return function(Kn) {
    return _e.l = Zt(Kn), _e.a = $n(Kn), _e.b = Sn(Kn), _e.opacity = kn(Kn), _e + "";
  };
}
function hcl(_e) {
  return function(Qt, Zt) {
    var $n = _e((Qt = hcl$2(Qt)).h, (Zt = hcl$2(Zt)).h), Sn = nogamma(Qt.c, Zt.c), kn = nogamma(Qt.l, Zt.l), Kn = nogamma(Qt.opacity, Zt.opacity);
    return function(er) {
      return Qt.h = $n(er), Qt.c = Sn(er), Qt.l = kn(er), Qt.opacity = Kn(er), Qt + "";
    };
  };
}
const hcl$1 = hcl(hue$1);
var hclLong = hcl(nogamma);
function cubehelix(_e) {
  return function Qt(Zt) {
    Zt = +Zt;
    function $n(Sn, kn) {
      var Kn = _e((Sn = cubehelix$2(Sn)).h, (kn = cubehelix$2(kn)).h), er = nogamma(Sn.s, kn.s), Cr = nogamma(Sn.l, kn.l), kr = nogamma(Sn.opacity, kn.opacity);
      return function(Yr) {
        return Sn.h = Kn(Yr), Sn.s = er(Yr), Sn.l = Cr(Math.pow(Yr, Zt)), Sn.opacity = kr(Yr), Sn + "";
      };
    }
    return $n.gamma = Qt, $n;
  }(1);
}
const cubehelix$1 = cubehelix(hue$1);
var cubehelixLong = cubehelix(nogamma);
function piecewise(_e, Qt) {
  Qt === void 0 && (Qt = _e, _e = interpolate$3);
  for (var Zt = 0, $n = Qt.length - 1, Sn = Qt[0], kn = new Array($n < 0 ? 0 : $n); Zt < $n; )
    kn[Zt] = _e(Sn, Sn = Qt[++Zt]);
  return function(Kn) {
    var er = Math.max(0, Math.min($n - 1, Math.floor(Kn *= $n)));
    return kn[er](Kn - er);
  };
}
function quantize$2(_e, Qt) {
  for (var Zt = new Array(Qt), $n = 0; $n < Qt; ++$n)
    Zt[$n] = _e($n / (Qt - 1));
  return Zt;
}
const $$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  interpolate: interpolate$3,
  interpolateArray: array$4,
  interpolateBasis: basis$1,
  interpolateBasisClosed: basisClosed,
  interpolateCubehelix: cubehelix$1,
  interpolateCubehelixLong: cubehelixLong,
  interpolateDate: date$1,
  interpolateDiscrete: discrete$1,
  interpolateHcl: hcl$1,
  interpolateHclLong: hclLong,
  interpolateHsl: hsl$1,
  interpolateHslLong: hslLong,
  interpolateHue: hue,
  interpolateLab: lab,
  interpolateNumber,
  interpolateNumberArray: numberArray,
  interpolateObject: object,
  interpolateRgb,
  interpolateRgbBasis: rgbBasis,
  interpolateRgbBasisClosed: rgbBasisClosed,
  interpolateRound,
  interpolateString,
  interpolateTransformCss,
  interpolateTransformSvg,
  interpolateZoom,
  piecewise,
  quantize: quantize$2
}, Symbol.toStringTag, { value: "Module" }));
function constants$1(_e) {
  return function() {
    return _e;
  };
}
function number$5(_e) {
  return +_e;
}
var unit = [0, 1];
function identity$3(_e) {
  return _e;
}
function normalize$2(_e, Qt) {
  return (Qt -= _e = +_e) ? function(Zt) {
    return (Zt - _e) / Qt;
  } : constants$1(isNaN(Qt) ? NaN : 0.5);
}
function clamper(_e, Qt) {
  var Zt;
  return _e > Qt && (Zt = _e, _e = Qt, Qt = Zt), function($n) {
    return Math.max(_e, Math.min(Qt, $n));
  };
}
function bimap(_e, Qt, Zt) {
  var $n = _e[0], Sn = _e[1], kn = Qt[0], Kn = Qt[1];
  return Sn < $n ? ($n = normalize$2(Sn, $n), kn = Zt(Kn, kn)) : ($n = normalize$2($n, Sn), kn = Zt(kn, Kn)), function(er) {
    return kn($n(er));
  };
}
function polymap(_e, Qt, Zt) {
  var $n = Math.min(_e.length, Qt.length) - 1, Sn = new Array($n), kn = new Array($n), Kn = -1;
  for (_e[$n] < _e[0] && (_e = _e.slice().reverse(), Qt = Qt.slice().reverse()); ++Kn < $n; )
    Sn[Kn] = normalize$2(_e[Kn], _e[Kn + 1]), kn[Kn] = Zt(Qt[Kn], Qt[Kn + 1]);
  return function(er) {
    var Cr = bisect$1(_e, er, 1, $n) - 1;
    return kn[Cr](Sn[Cr](er));
  };
}
function copy$2(_e, Qt) {
  return Qt.domain(_e.domain()).range(_e.range()).interpolate(_e.interpolate()).clamp(_e.clamp()).unknown(_e.unknown());
}
function transformer$3() {
  var _e = unit, Qt = unit, Zt = interpolate$3, $n, Sn, kn, Kn = identity$3, er, Cr, kr;
  function Yr() {
    var Ds = Math.min(_e.length, Qt.length);
    return Kn !== identity$3 && (Kn = clamper(_e[0], _e[Ds - 1])), er = Ds > 2 ? polymap : bimap, Cr = kr = null, Ms;
  }
  function Ms(Ds) {
    return Ds == null || isNaN(Ds = +Ds) ? kn : (Cr || (Cr = er(_e.map($n), Qt, Zt)))($n(Kn(Ds)));
  }
  return Ms.invert = function(Ds) {
    return Kn(Sn((kr || (kr = er(Qt, _e.map($n), interpolateNumber)))(Ds)));
  }, Ms.domain = function(Ds) {
    return arguments.length ? (_e = Array.from(Ds, number$5), Yr()) : _e.slice();
  }, Ms.range = function(Ds) {
    return arguments.length ? (Qt = Array.from(Ds), Yr()) : Qt.slice();
  }, Ms.rangeRound = function(Ds) {
    return Qt = Array.from(Ds), Zt = interpolateRound, Yr();
  }, Ms.clamp = function(Ds) {
    return arguments.length ? (Kn = Ds ? !0 : identity$3, Yr()) : Kn !== identity$3;
  }, Ms.interpolate = function(Ds) {
    return arguments.length ? (Zt = Ds, Yr()) : Zt;
  }, Ms.unknown = function(Ds) {
    return arguments.length ? (kn = Ds, Ms) : kn;
  }, function(Ds, Ls) {
    return $n = Ds, Sn = Ls, Yr();
  };
}
function continuous$1() {
  return transformer$3()(identity$3, identity$3);
}
function tickFormat$1(_e, Qt, Zt, $n) {
  var Sn = tickStep(_e, Qt, Zt), kn;
  switch ($n = formatSpecifier($n ?? ",f"), $n.type) {
    case "s": {
      var Kn = Math.max(Math.abs(_e), Math.abs(Qt));
      return $n.precision == null && !isNaN(kn = precisionPrefix(Sn, Kn)) && ($n.precision = kn), formatPrefix($n, Kn);
    }
    case "":
    case "e":
    case "g":
    case "p":
    case "r": {
      $n.precision == null && !isNaN(kn = precisionRound(Sn, Math.max(Math.abs(_e), Math.abs(Qt)))) && ($n.precision = kn - ($n.type === "e"));
      break;
    }
    case "f":
    case "%": {
      $n.precision == null && !isNaN(kn = precisionFixed(Sn)) && ($n.precision = kn - ($n.type === "%") * 2);
      break;
    }
  }
  return format$3($n);
}
function linearish(_e) {
  var Qt = _e.domain;
  return _e.ticks = function(Zt) {
    var $n = Qt();
    return ticks($n[0], $n[$n.length - 1], Zt ?? 10);
  }, _e.tickFormat = function(Zt, $n) {
    var Sn = Qt();
    return tickFormat$1(Sn[0], Sn[Sn.length - 1], Zt ?? 10, $n);
  }, _e.nice = function(Zt) {
    Zt == null && (Zt = 10);
    var $n = Qt(), Sn = 0, kn = $n.length - 1, Kn = $n[Sn], er = $n[kn], Cr, kr, Yr = 10;
    for (er < Kn && (kr = Kn, Kn = er, er = kr, kr = Sn, Sn = kn, kn = kr); Yr-- > 0; ) {
      if (kr = tickIncrement(Kn, er, Zt), kr === Cr)
        return $n[Sn] = Kn, $n[kn] = er, Qt($n);
      if (kr > 0)
        Kn = Math.floor(Kn / kr) * kr, er = Math.ceil(er / kr) * kr;
      else if (kr < 0)
        Kn = Math.ceil(Kn * kr) / kr, er = Math.floor(er * kr) / kr;
      else
        break;
      Cr = kr;
    }
    return _e;
  }, _e;
}
function linear() {
  var _e = continuous$1();
  return _e.copy = function() {
    return copy$2(_e, linear());
  }, initRange.apply(_e, arguments), linearish(_e);
}
function identity$2(_e) {
  var Qt;
  function Zt($n) {
    return $n == null || isNaN($n = +$n) ? Qt : $n;
  }
  return Zt.invert = Zt, Zt.domain = Zt.range = function($n) {
    return arguments.length ? (_e = Array.from($n, number$5), Zt) : _e.slice();
  }, Zt.unknown = function($n) {
    return arguments.length ? (Qt = $n, Zt) : Qt;
  }, Zt.copy = function() {
    return identity$2(_e).unknown(Qt);
  }, _e = arguments.length ? Array.from(_e, number$5) : [0, 1], linearish(Zt);
}
function nice$1(_e, Qt) {
  _e = _e.slice();
  var Zt = 0, $n = _e.length - 1, Sn = _e[Zt], kn = _e[$n], Kn;
  return kn < Sn && (Kn = Zt, Zt = $n, $n = Kn, Kn = Sn, Sn = kn, kn = Kn), _e[Zt] = Qt.floor(Sn), _e[$n] = Qt.ceil(kn), _e;
}
function transformLog(_e) {
  return Math.log(_e);
}
function transformExp(_e) {
  return Math.exp(_e);
}
function transformLogn(_e) {
  return -Math.log(-_e);
}
function transformExpn(_e) {
  return -Math.exp(-_e);
}
function pow10(_e) {
  return isFinite(_e) ? +("1e" + _e) : _e < 0 ? 0 : _e;
}
function powp(_e) {
  return _e === 10 ? pow10 : _e === Math.E ? Math.exp : (Qt) => Math.pow(_e, Qt);
}
function logp(_e) {
  return _e === Math.E ? Math.log : _e === 10 && Math.log10 || _e === 2 && Math.log2 || (_e = Math.log(_e), (Qt) => Math.log(Qt) / _e);
}
function reflect(_e) {
  return (Qt, Zt) => -_e(-Qt, Zt);
}
function loggish(_e) {
  const Qt = _e(transformLog, transformExp), Zt = Qt.domain;
  let $n = 10, Sn, kn;
  function Kn() {
    return Sn = logp($n), kn = powp($n), Zt()[0] < 0 ? (Sn = reflect(Sn), kn = reflect(kn), _e(transformLogn, transformExpn)) : _e(transformLog, transformExp), Qt;
  }
  return Qt.base = function(er) {
    return arguments.length ? ($n = +er, Kn()) : $n;
  }, Qt.domain = function(er) {
    return arguments.length ? (Zt(er), Kn()) : Zt();
  }, Qt.ticks = (er) => {
    const Cr = Zt();
    let kr = Cr[0], Yr = Cr[Cr.length - 1];
    const Ms = Yr < kr;
    Ms && ([kr, Yr] = [Yr, kr]);
    let Ds = Sn(kr), Ls = Sn(Yr), js, zs;
    const Fs = er == null ? 10 : +er;
    let Bs = [];
    if (!($n % 1) && Ls - Ds < Fs) {
      if (Ds = Math.floor(Ds), Ls = Math.ceil(Ls), kr > 0) {
        for (; Ds <= Ls; ++Ds)
          for (js = 1; js < $n; ++js)
            if (zs = Ds < 0 ? js / kn(-Ds) : js * kn(Ds), !(zs < kr)) {
              if (zs > Yr)
                break;
              Bs.push(zs);
            }
      } else
        for (; Ds <= Ls; ++Ds)
          for (js = $n - 1; js >= 1; --js)
            if (zs = Ds > 0 ? js / kn(-Ds) : js * kn(Ds), !(zs < kr)) {
              if (zs > Yr)
                break;
              Bs.push(zs);
            }
      Bs.length * 2 < Fs && (Bs = ticks(kr, Yr, Fs));
    } else
      Bs = ticks(Ds, Ls, Math.min(Ls - Ds, Fs)).map(kn);
    return Ms ? Bs.reverse() : Bs;
  }, Qt.tickFormat = (er, Cr) => {
    if (er == null && (er = 10), Cr == null && (Cr = $n === 10 ? "s" : ","), typeof Cr != "function" && (!($n % 1) && (Cr = formatSpecifier(Cr)).precision == null && (Cr.trim = !0), Cr = format$3(Cr)), er === 1 / 0)
      return Cr;
    const kr = Math.max(1, $n * er / Qt.ticks().length);
    return (Yr) => {
      let Ms = Yr / kn(Math.round(Sn(Yr)));
      return Ms * $n < $n - 0.5 && (Ms *= $n), Ms <= kr ? Cr(Yr) : "";
    };
  }, Qt.nice = () => Zt(nice$1(Zt(), {
    floor: (er) => kn(Math.floor(Sn(er))),
    ceil: (er) => kn(Math.ceil(Sn(er)))
  })), Qt;
}
function log$3() {
  const _e = loggish(transformer$3()).domain([1, 10]);
  return _e.copy = () => copy$2(_e, log$3()).base(_e.base()), initRange.apply(_e, arguments), _e;
}
function transformSymlog(_e) {
  return function(Qt) {
    return Math.sign(Qt) * Math.log1p(Math.abs(Qt / _e));
  };
}
function transformSymexp(_e) {
  return function(Qt) {
    return Math.sign(Qt) * Math.expm1(Math.abs(Qt)) * _e;
  };
}
function symlogish(_e) {
  var Qt = 1, Zt = _e(transformSymlog(Qt), transformSymexp(Qt));
  return Zt.constant = function($n) {
    return arguments.length ? _e(transformSymlog(Qt = +$n), transformSymexp(Qt)) : Qt;
  }, linearish(Zt);
}
function symlog() {
  var _e = symlogish(transformer$3());
  return _e.copy = function() {
    return copy$2(_e, symlog()).constant(_e.constant());
  }, initRange.apply(_e, arguments);
}
function transformPow(_e) {
  return function(Qt) {
    return Qt < 0 ? -Math.pow(-Qt, _e) : Math.pow(Qt, _e);
  };
}
function transformSqrt(_e) {
  return _e < 0 ? -Math.sqrt(-_e) : Math.sqrt(_e);
}
function transformSquare(_e) {
  return _e < 0 ? -_e * _e : _e * _e;
}
function powish(_e) {
  var Qt = _e(identity$3, identity$3), Zt = 1;
  function $n() {
    return Zt === 1 ? _e(identity$3, identity$3) : Zt === 0.5 ? _e(transformSqrt, transformSquare) : _e(transformPow(Zt), transformPow(1 / Zt));
  }
  return Qt.exponent = function(Sn) {
    return arguments.length ? (Zt = +Sn, $n()) : Zt;
  }, linearish(Qt);
}
function pow$2() {
  var _e = powish(transformer$3());
  return _e.copy = function() {
    return copy$2(_e, pow$2()).exponent(_e.exponent());
  }, initRange.apply(_e, arguments), _e;
}
function sqrt$2() {
  return pow$2.apply(null, arguments).exponent(0.5);
}
function quantile() {
  var _e = [], Qt = [], Zt = [], $n;
  function Sn() {
    var Kn = 0, er = Math.max(1, Qt.length);
    for (Zt = new Array(er - 1); ++Kn < er; )
      Zt[Kn - 1] = quantileSorted(_e, Kn / er);
    return kn;
  }
  function kn(Kn) {
    return Kn == null || isNaN(Kn = +Kn) ? $n : Qt[bisect$1(Zt, Kn)];
  }
  return kn.invertExtent = function(Kn) {
    var er = Qt.indexOf(Kn);
    return er < 0 ? [NaN, NaN] : [
      er > 0 ? Zt[er - 1] : _e[0],
      er < Zt.length ? Zt[er] : _e[_e.length - 1]
    ];
  }, kn.domain = function(Kn) {
    if (!arguments.length)
      return _e.slice();
    _e = [];
    for (let er of Kn)
      er != null && !isNaN(er = +er) && _e.push(er);
    return _e.sort(ascending$3), Sn();
  }, kn.range = function(Kn) {
    return arguments.length ? (Qt = Array.from(Kn), Sn()) : Qt.slice();
  }, kn.unknown = function(Kn) {
    return arguments.length ? ($n = Kn, kn) : $n;
  }, kn.quantiles = function() {
    return Zt.slice();
  }, kn.copy = function() {
    return quantile().domain(_e).range(Qt).unknown($n);
  }, initRange.apply(kn, arguments);
}
function quantize$1() {
  var _e = 0, Qt = 1, Zt = 1, $n = [0.5], Sn = [0, 1], kn;
  function Kn(Cr) {
    return Cr != null && Cr <= Cr ? Sn[bisect$1($n, Cr, 0, Zt)] : kn;
  }
  function er() {
    var Cr = -1;
    for ($n = new Array(Zt); ++Cr < Zt; )
      $n[Cr] = ((Cr + 1) * Qt - (Cr - Zt) * _e) / (Zt + 1);
    return Kn;
  }
  return Kn.domain = function(Cr) {
    return arguments.length ? ([_e, Qt] = Cr, _e = +_e, Qt = +Qt, er()) : [_e, Qt];
  }, Kn.range = function(Cr) {
    return arguments.length ? (Zt = (Sn = Array.from(Cr)).length - 1, er()) : Sn.slice();
  }, Kn.invertExtent = function(Cr) {
    var kr = Sn.indexOf(Cr);
    return kr < 0 ? [NaN, NaN] : kr < 1 ? [_e, $n[0]] : kr >= Zt ? [$n[Zt - 1], Qt] : [$n[kr - 1], $n[kr]];
  }, Kn.unknown = function(Cr) {
    return arguments.length && (kn = Cr), Kn;
  }, Kn.thresholds = function() {
    return $n.slice();
  }, Kn.copy = function() {
    return quantize$1().domain([_e, Qt]).range(Sn).unknown(kn);
  }, initRange.apply(linearish(Kn), arguments);
}
function threshold() {
  var _e = [0.5], Qt = [0, 1], Zt, $n = 1;
  function Sn(kn) {
    return kn != null && kn <= kn ? Qt[bisect$1(_e, kn, 0, $n)] : Zt;
  }
  return Sn.domain = function(kn) {
    return arguments.length ? (_e = Array.from(kn), $n = Math.min(_e.length, Qt.length - 1), Sn) : _e.slice();
  }, Sn.range = function(kn) {
    return arguments.length ? (Qt = Array.from(kn), $n = Math.min(_e.length, Qt.length - 1), Sn) : Qt.slice();
  }, Sn.invertExtent = function(kn) {
    var Kn = Qt.indexOf(kn);
    return [_e[Kn - 1], _e[Kn]];
  }, Sn.unknown = function(kn) {
    return arguments.length ? (Zt = kn, Sn) : Zt;
  }, Sn.copy = function() {
    return threshold().domain(_e).range(Qt).unknown(Zt);
  }, initRange.apply(Sn, arguments);
}
function date(_e) {
  return new Date(_e);
}
function number$4(_e) {
  return _e instanceof Date ? +_e : +/* @__PURE__ */ new Date(+_e);
}
function calendar(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr, kr) {
  var Yr = continuous$1(), Ms = Yr.invert, Ds = Yr.domain, Ls = kr(".%L"), js = kr(":%S"), zs = kr("%I:%M"), Fs = kr("%I %p"), Bs = kr("%a %d"), Hs = kr("%b %d"), Ws = kr("%B"), Ys = kr("%Y");
  function El(Mu) {
    return (Cr(Mu) < Mu ? Ls : er(Mu) < Mu ? js : Kn(Mu) < Mu ? zs : kn(Mu) < Mu ? Fs : $n(Mu) < Mu ? Sn(Mu) < Mu ? Bs : Hs : Zt(Mu) < Mu ? Ws : Ys)(Mu);
  }
  return Yr.invert = function(Mu) {
    return new Date(Ms(Mu));
  }, Yr.domain = function(Mu) {
    return arguments.length ? Ds(Array.from(Mu, number$4)) : Ds().map(date);
  }, Yr.ticks = function(Mu) {
    var Pl = Ds();
    return _e(Pl[0], Pl[Pl.length - 1], Mu ?? 10);
  }, Yr.tickFormat = function(Mu, Pl) {
    return Pl == null ? El : kr(Pl);
  }, Yr.nice = function(Mu) {
    var Pl = Ds();
    return (!Mu || typeof Mu.range != "function") && (Mu = Qt(Pl[0], Pl[Pl.length - 1], Mu ?? 10)), Mu ? Ds(nice$1(Pl, Mu)) : Yr;
  }, Yr.copy = function() {
    return copy$2(Yr, calendar(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr, kr));
  }, Yr;
}
function time$1() {
  return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, timeFormat$2).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments);
}
function utcTime() {
  return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, utcFormat$1).domain([Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2)]), arguments);
}
function transformer$2() {
  var _e = 0, Qt = 1, Zt, $n, Sn, kn, Kn = identity$3, er = !1, Cr;
  function kr(Ms) {
    return Ms == null || isNaN(Ms = +Ms) ? Cr : Kn(Sn === 0 ? 0.5 : (Ms = (kn(Ms) - Zt) * Sn, er ? Math.max(0, Math.min(1, Ms)) : Ms));
  }
  kr.domain = function(Ms) {
    return arguments.length ? ([_e, Qt] = Ms, Zt = kn(_e = +_e), $n = kn(Qt = +Qt), Sn = Zt === $n ? 0 : 1 / ($n - Zt), kr) : [_e, Qt];
  }, kr.clamp = function(Ms) {
    return arguments.length ? (er = !!Ms, kr) : er;
  }, kr.interpolator = function(Ms) {
    return arguments.length ? (Kn = Ms, kr) : Kn;
  };
  function Yr(Ms) {
    return function(Ds) {
      var Ls, js;
      return arguments.length ? ([Ls, js] = Ds, Kn = Ms(Ls, js), kr) : [Kn(0), Kn(1)];
    };
  }
  return kr.range = Yr(interpolate$3), kr.rangeRound = Yr(interpolateRound), kr.unknown = function(Ms) {
    return arguments.length ? (Cr = Ms, kr) : Cr;
  }, function(Ms) {
    return kn = Ms, Zt = Ms(_e), $n = Ms(Qt), Sn = Zt === $n ? 0 : 1 / ($n - Zt), kr;
  };
}
function copy$1(_e, Qt) {
  return Qt.domain(_e.domain()).interpolator(_e.interpolator()).clamp(_e.clamp()).unknown(_e.unknown());
}
function sequential() {
  var _e = linearish(transformer$2()(identity$3));
  return _e.copy = function() {
    return copy$1(_e, sequential());
  }, initInterpolator.apply(_e, arguments);
}
function sequentialLog() {
  var _e = loggish(transformer$2()).domain([1, 10]);
  return _e.copy = function() {
    return copy$1(_e, sequentialLog()).base(_e.base());
  }, initInterpolator.apply(_e, arguments);
}
function sequentialSymlog() {
  var _e = symlogish(transformer$2());
  return _e.copy = function() {
    return copy$1(_e, sequentialSymlog()).constant(_e.constant());
  }, initInterpolator.apply(_e, arguments);
}
function sequentialPow() {
  var _e = powish(transformer$2());
  return _e.copy = function() {
    return copy$1(_e, sequentialPow()).exponent(_e.exponent());
  }, initInterpolator.apply(_e, arguments);
}
function sequentialSqrt() {
  return sequentialPow.apply(null, arguments).exponent(0.5);
}
function transformer$1() {
  var _e = 0, Qt = 0.5, Zt = 1, $n = 1, Sn, kn, Kn, er, Cr, kr = identity$3, Yr, Ms = !1, Ds;
  function Ls(zs) {
    return isNaN(zs = +zs) ? Ds : (zs = 0.5 + ((zs = +Yr(zs)) - kn) * ($n * zs < $n * kn ? er : Cr), kr(Ms ? Math.max(0, Math.min(1, zs)) : zs));
  }
  Ls.domain = function(zs) {
    return arguments.length ? ([_e, Qt, Zt] = zs, Sn = Yr(_e = +_e), kn = Yr(Qt = +Qt), Kn = Yr(Zt = +Zt), er = Sn === kn ? 0 : 0.5 / (kn - Sn), Cr = kn === Kn ? 0 : 0.5 / (Kn - kn), $n = kn < Sn ? -1 : 1, Ls) : [_e, Qt, Zt];
  }, Ls.clamp = function(zs) {
    return arguments.length ? (Ms = !!zs, Ls) : Ms;
  }, Ls.interpolator = function(zs) {
    return arguments.length ? (kr = zs, Ls) : kr;
  };
  function js(zs) {
    return function(Fs) {
      var Bs, Hs, Ws;
      return arguments.length ? ([Bs, Hs, Ws] = Fs, kr = piecewise(zs, [Bs, Hs, Ws]), Ls) : [kr(0), kr(0.5), kr(1)];
    };
  }
  return Ls.range = js(interpolate$3), Ls.rangeRound = js(interpolateRound), Ls.unknown = function(zs) {
    return arguments.length ? (Ds = zs, Ls) : Ds;
  }, function(zs) {
    return Yr = zs, Sn = zs(_e), kn = zs(Qt), Kn = zs(Zt), er = Sn === kn ? 0 : 0.5 / (kn - Sn), Cr = kn === Kn ? 0 : 0.5 / (Kn - kn), $n = kn < Sn ? -1 : 1, Ls;
  };
}
function diverging() {
  var _e = linearish(transformer$1()(identity$3));
  return _e.copy = function() {
    return copy$1(_e, diverging());
  }, initInterpolator.apply(_e, arguments);
}
function divergingLog() {
  var _e = loggish(transformer$1()).domain([0.1, 1, 10]);
  return _e.copy = function() {
    return copy$1(_e, divergingLog()).base(_e.base());
  }, initInterpolator.apply(_e, arguments);
}
function divergingSymlog() {
  var _e = symlogish(transformer$1());
  return _e.copy = function() {
    return copy$1(_e, divergingSymlog()).constant(_e.constant());
  }, initInterpolator.apply(_e, arguments);
}
function divergingPow() {
  var _e = powish(transformer$1());
  return _e.copy = function() {
    return copy$1(_e, divergingPow()).exponent(_e.exponent());
  }, initInterpolator.apply(_e, arguments);
}
function divergingSqrt() {
  return divergingPow.apply(null, arguments).exponent(0.5);
}
function bandSpace(_e, Qt, Zt) {
  const $n = _e - Qt + Zt * 2;
  return _e ? $n > 0 ? $n : 1 : 0;
}
const Identity = "identity", Linear = "linear", Log = "log", Pow = "pow", Sqrt = "sqrt", Symlog = "symlog", Time = "time", UTC = "utc", Sequential = "sequential", Diverging = "diverging", Quantile = "quantile", Quantize = "quantize", Threshold = "threshold", Ordinal = "ordinal", Point = "point", Band = "band", BinOrdinal = "bin-ordinal", Continuous = "continuous", Discrete$1 = "discrete", Discretizing = "discretizing", Interpolating = "interpolating", Temporal = "temporal";
function invertRange(_e) {
  return function(Qt) {
    let Zt = Qt[0], $n = Qt[1], Sn;
    return $n < Zt && (Sn = Zt, Zt = $n, $n = Sn), [_e.invert(Zt), _e.invert($n)];
  };
}
function invertRangeExtent(_e) {
  return function(Qt) {
    const Zt = _e.range();
    let $n = Qt[0], Sn = Qt[1], kn = -1, Kn, er, Cr, kr;
    for (Sn < $n && (er = $n, $n = Sn, Sn = er), Cr = 0, kr = Zt.length; Cr < kr; ++Cr)
      Zt[Cr] >= $n && Zt[Cr] <= Sn && (kn < 0 && (kn = Cr), Kn = Cr);
    if (!(kn < 0))
      return $n = _e.invertExtent(Zt[kn]), Sn = _e.invertExtent(Zt[Kn]), [$n[0] === void 0 ? $n[1] : $n[0], Sn[1] === void 0 ? Sn[0] : Sn[1]];
  };
}
function band() {
  const _e = ordinal().unknown(void 0), Qt = _e.domain, Zt = _e.range;
  let $n = [0, 1], Sn, kn, Kn = !1, er = 0, Cr = 0, kr = 0.5;
  delete _e.unknown;
  function Yr() {
    const Ms = Qt().length, Ds = $n[1] < $n[0], Ls = $n[1 - Ds], js = bandSpace(Ms, er, Cr);
    let zs = $n[Ds - 0];
    Sn = (Ls - zs) / (js || 1), Kn && (Sn = Math.floor(Sn)), zs += (Ls - zs - Sn * (Ms - er)) * kr, kn = Sn * (1 - er), Kn && (zs = Math.round(zs), kn = Math.round(kn));
    const Fs = range$5(Ms).map((Bs) => zs + Sn * Bs);
    return Zt(Ds ? Fs.reverse() : Fs);
  }
  return _e.domain = function(Ms) {
    return arguments.length ? (Qt(Ms), Yr()) : Qt();
  }, _e.range = function(Ms) {
    return arguments.length ? ($n = [+Ms[0], +Ms[1]], Yr()) : $n.slice();
  }, _e.rangeRound = function(Ms) {
    return $n = [+Ms[0], +Ms[1]], Kn = !0, Yr();
  }, _e.bandwidth = function() {
    return kn;
  }, _e.step = function() {
    return Sn;
  }, _e.round = function(Ms) {
    return arguments.length ? (Kn = !!Ms, Yr()) : Kn;
  }, _e.padding = function(Ms) {
    return arguments.length ? (Cr = Math.max(0, Math.min(1, Ms)), er = Cr, Yr()) : er;
  }, _e.paddingInner = function(Ms) {
    return arguments.length ? (er = Math.max(0, Math.min(1, Ms)), Yr()) : er;
  }, _e.paddingOuter = function(Ms) {
    return arguments.length ? (Cr = Math.max(0, Math.min(1, Ms)), Yr()) : Cr;
  }, _e.align = function(Ms) {
    return arguments.length ? (kr = Math.max(0, Math.min(1, Ms)), Yr()) : kr;
  }, _e.invertRange = function(Ms) {
    if (Ms[0] == null || Ms[1] == null)
      return;
    const Ds = $n[1] < $n[0], Ls = Ds ? Zt().reverse() : Zt(), js = Ls.length - 1;
    let zs = +Ms[0], Fs = +Ms[1], Bs, Hs, Ws;
    if (!(zs !== zs || Fs !== Fs) && (Fs < zs && (Ws = zs, zs = Fs, Fs = Ws), !(Fs < Ls[0] || zs > $n[1 - Ds])))
      return Bs = Math.max(0, bisectRight$1(Ls, zs) - 1), Hs = zs === Fs ? Bs : bisectRight$1(Ls, Fs) - 1, zs - Ls[Bs] > kn + 1e-10 && ++Bs, Ds && (Ws = Bs, Bs = js - Hs, Hs = js - Ws), Bs > Hs ? void 0 : Qt().slice(Bs, Hs + 1);
  }, _e.invert = function(Ms) {
    const Ds = _e.invertRange([Ms, Ms]);
    return Ds && Ds[0];
  }, _e.copy = function() {
    return band().domain(Qt()).range($n).round(Kn).paddingInner(er).paddingOuter(Cr).align(kr);
  }, Yr();
}
function pointish(_e) {
  const Qt = _e.copy;
  return _e.padding = _e.paddingOuter, delete _e.paddingInner, _e.copy = function() {
    return pointish(Qt());
  }, _e;
}
function point$3() {
  return pointish(band().paddingInner(1));
}
var map = Array.prototype.map;
function numbers(_e) {
  return map.call(_e, toNumber);
}
const slice$2 = Array.prototype.slice;
function scaleBinOrdinal() {
  let _e = [], Qt = [];
  function Zt($n) {
    return $n == null || $n !== $n ? void 0 : Qt[(bisect$1(_e, $n) - 1) % Qt.length];
  }
  return Zt.domain = function($n) {
    return arguments.length ? (_e = numbers($n), Zt) : _e.slice();
  }, Zt.range = function($n) {
    return arguments.length ? (Qt = slice$2.call($n), Zt) : Qt.slice();
  }, Zt.tickFormat = function($n, Sn) {
    return tickFormat$1(_e[0], peek$1(_e), $n ?? 10, Sn);
  }, Zt.copy = function() {
    return scaleBinOrdinal().domain(Zt.domain()).range(Zt.range());
  }, Zt;
}
const scales = /* @__PURE__ */ new Map(), VEGA_SCALE = Symbol("vega_scale");
function registerScale(_e) {
  return _e[VEGA_SCALE] = !0, _e;
}
function isRegisteredScale(_e) {
  return _e && _e[VEGA_SCALE] === !0;
}
function create$4(_e, Qt, Zt) {
  const $n = function() {
    const kn = Qt();
    return kn.invertRange || (kn.invertRange = kn.invert ? invertRange(kn) : kn.invertExtent ? invertRangeExtent(kn) : void 0), kn.type = _e, registerScale(kn);
  };
  return $n.metadata = toSet(array$6(Zt)), $n;
}
function scale$4(_e, Qt, Zt) {
  return arguments.length > 1 ? (scales.set(_e, create$4(_e, Qt, Zt)), this) : isValidScaleType(_e) ? scales.get(_e) : void 0;
}
scale$4(Identity, identity$2);
scale$4(Linear, linear, Continuous);
scale$4(Log, log$3, [Continuous, Log]);
scale$4(Pow, pow$2, Continuous);
scale$4(Sqrt, sqrt$2, Continuous);
scale$4(Symlog, symlog, Continuous);
scale$4(Time, time$1, [Continuous, Temporal]);
scale$4(UTC, utcTime, [Continuous, Temporal]);
scale$4(Sequential, sequential, [Continuous, Interpolating]);
scale$4(`${Sequential}-${Linear}`, sequential, [Continuous, Interpolating]);
scale$4(`${Sequential}-${Log}`, sequentialLog, [Continuous, Interpolating, Log]);
scale$4(`${Sequential}-${Pow}`, sequentialPow, [Continuous, Interpolating]);
scale$4(`${Sequential}-${Sqrt}`, sequentialSqrt, [Continuous, Interpolating]);
scale$4(`${Sequential}-${Symlog}`, sequentialSymlog, [Continuous, Interpolating]);
scale$4(`${Diverging}-${Linear}`, diverging, [Continuous, Interpolating]);
scale$4(`${Diverging}-${Log}`, divergingLog, [Continuous, Interpolating, Log]);
scale$4(`${Diverging}-${Pow}`, divergingPow, [Continuous, Interpolating]);
scale$4(`${Diverging}-${Sqrt}`, divergingSqrt, [Continuous, Interpolating]);
scale$4(`${Diverging}-${Symlog}`, divergingSymlog, [Continuous, Interpolating]);
scale$4(Quantile, quantile, [Discretizing, Quantile]);
scale$4(Quantize, quantize$1, Discretizing);
scale$4(Threshold, threshold, Discretizing);
scale$4(BinOrdinal, scaleBinOrdinal, [Discrete$1, Discretizing]);
scale$4(Ordinal, ordinal, Discrete$1);
scale$4(Band, band, Discrete$1);
scale$4(Point, point$3, Discrete$1);
function isValidScaleType(_e) {
  return scales.has(_e);
}
function hasType(_e, Qt) {
  const Zt = scales.get(_e);
  return Zt && Zt.metadata[Qt];
}
function isContinuous$1(_e) {
  return hasType(_e, Continuous);
}
function isDiscrete$2(_e) {
  return hasType(_e, Discrete$1);
}
function isDiscretizing$1(_e) {
  return hasType(_e, Discretizing);
}
function isLogarithmic(_e) {
  return hasType(_e, Log);
}
function isTemporal(_e) {
  return hasType(_e, Temporal);
}
function isInterpolating(_e) {
  return hasType(_e, Interpolating);
}
function isQuantile$1(_e) {
  return hasType(_e, Quantile);
}
const scaleProps = ["clamp", "base", "constant", "exponent"];
function interpolateRange$1(_e, Qt) {
  const Zt = Qt[0], $n = peek$1(Qt) - Zt;
  return function(Sn) {
    return _e(Zt + Sn * $n);
  };
}
function interpolateColors(_e, Qt, Zt) {
  return piecewise(interpolate$2(Qt || "rgb", Zt), _e);
}
function quantizeInterpolator(_e, Qt) {
  const Zt = new Array(Qt), $n = Qt + 1;
  for (let Sn = 0; Sn < Qt; )
    Zt[Sn] = _e(++Sn / $n);
  return Zt;
}
function scaleFraction(_e, Qt, Zt) {
  const $n = Zt - Qt;
  let Sn, kn, Kn;
  return !$n || !Number.isFinite($n) ? constant$7(0.5) : (Sn = (kn = _e.type).indexOf("-"), kn = Sn < 0 ? kn : kn.slice(Sn + 1), Kn = scale$4(kn)().domain([Qt, Zt]).range([0, 1]), scaleProps.forEach((er) => _e[er] ? Kn[er](_e[er]()) : 0), Kn);
}
function interpolate$2(_e, Qt) {
  const Zt = $$1[method(_e)];
  return Qt != null && Zt && Zt.gamma ? Zt.gamma(Qt) : Zt;
}
function method(_e) {
  return "interpolate" + _e.toLowerCase().split("-").map((Qt) => Qt[0].toUpperCase() + Qt.slice(1)).join("");
}
const continuous = {
  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"
}, discrete = {
  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 colors(_e) {
  const Qt = _e.length / 6 | 0, Zt = new Array(Qt);
  for (let $n = 0; $n < Qt; )
    Zt[$n] = "#" + _e.slice($n * 6, ++$n * 6);
  return Zt;
}
function apply$2(_e, Qt) {
  for (const Zt in _e)
    scheme$1(Zt, Qt(_e[Zt]));
}
const schemes = {};
apply$2(discrete, colors);
apply$2(continuous, (_e) => interpolateColors(colors(_e)));
function scheme$1(_e, Qt) {
  return _e = _e && _e.toLowerCase(), arguments.length > 1 ? (schemes[_e] = Qt, this) : schemes[_e];
}
const SymbolLegend = "symbol", DiscreteLegend = "discrete", GradientLegend = "gradient", defaultFormatter = (_e) => isArray(_e) ? _e.map((Qt) => String(Qt)) : String(_e), ascending$2 = (_e, Qt) => _e[1] - Qt[1], descending$1 = (_e, Qt) => Qt[1] - _e[1];
function tickCount(_e, Qt, Zt) {
  let $n;
  return isNumber$1(Qt) && (_e.bins && (Qt = Math.max(Qt, _e.bins.length)), Zt != null && (Qt = Math.min(Qt, Math.floor(span(_e.domain()) / Zt || 1)))), isObject(Qt) && ($n = Qt.step, Qt = Qt.interval), isString(Qt) && (Qt = _e.type === Time ? timeInterval(Qt) : _e.type == UTC ? utcInterval(Qt) : error("Only time and utc scales accept interval strings."), $n && (Qt = Qt.every($n))), Qt;
}
function validTicks(_e, Qt, Zt) {
  let $n = _e.range(), Sn = $n[0], kn = peek$1($n), Kn = ascending$2;
  if (Sn > kn && ($n = kn, kn = Sn, Sn = $n, Kn = descending$1), Sn = Math.floor(Sn), kn = Math.ceil(kn), Qt = Qt.map((er) => [er, _e(er)]).filter((er) => Sn <= er[1] && er[1] <= kn).sort(Kn).map((er) => er[0]), Zt > 0 && Qt.length > 1) {
    const er = [Qt[0], peek$1(Qt)];
    for (; Qt.length > Zt && Qt.length >= 3; )
      Qt = Qt.filter((Cr, kr) => !(kr % 2));
    Qt.length < 3 && (Qt = er);
  }
  return Qt;
}
function tickValues(_e, Qt) {
  return _e.bins ? validTicks(_e, _e.bins) : _e.ticks ? _e.ticks(Qt) : _e.domain();
}
function tickFormat(_e, Qt, Zt, $n, Sn, kn) {
  const Kn = Qt.type;
  let er = defaultFormatter;
  if (Kn === Time || Sn === Time)
    er = _e.timeFormat($n);
  else if (Kn === UTC || Sn === UTC)
    er = _e.utcFormat($n);
  else if (isLogarithmic(Kn)) {
    const Cr = _e.formatFloat($n);
    if (kn || Qt.bins)
      er = Cr;
    else {
      const kr = tickLog(Qt, Zt, !1);
      er = (Yr) => kr(Yr) ? Cr(Yr) : "";
    }
  } else if (Qt.tickFormat) {
    const Cr = Qt.domain();
    er = _e.formatSpan(Cr[0], Cr[Cr.length - 1], Zt, $n);
  } else
    $n && (er = _e.format($n));
  return er;
}
function tickLog(_e, Qt, Zt) {
  const $n = tickValues(_e, Qt), Sn = _e.base(), kn = Math.log(Sn), Kn = Math.max(1, Sn * Qt / $n.length), er = (Cr) => {
    let kr = Cr / Math.pow(Sn, Math.round(Math.log(Cr) / kn));
    return kr * Sn < Sn - 0.5 && (kr *= Sn), kr <= Kn;
  };
  return Zt ? $n.filter(er) : er;
}
const symbols$2 = {
  [Quantile]: "quantiles",
  [Quantize]: "thresholds",
  [Threshold]: "domain"
}, formats = {
  [Quantile]: "quantiles",
  [Quantize]: "domain"
};
function labelValues(_e, Qt) {
  return _e.bins ? binValues(_e.bins) : _e.type === Log ? tickLog(_e, Qt, !0) : symbols$2[_e.type] ? thresholdValues(_e[symbols$2[_e.type]]()) : tickValues(_e, Qt);
}
function thresholdFormat(_e, Qt, Zt) {
  const $n = Qt[formats[Qt.type]](), Sn = $n.length;
  let kn = Sn > 1 ? $n[1] - $n[0] : $n[0], Kn;
  for (Kn = 1; Kn < Sn; ++Kn)
    kn = Math.min(kn, $n[Kn] - $n[Kn - 1]);
  return _e.formatSpan(0, kn, 3 * 10, Zt);
}
function thresholdValues(_e) {
  const Qt = [-1 / 0].concat(_e);
  return Qt.max = 1 / 0, Qt;
}
function binValues(_e) {
  const Qt = _e.slice(0, -1);
  return Qt.max = peek$1(_e), Qt;
}
const isDiscreteRange = (_e) => symbols$2[_e.type] || _e.bins;
function labelFormat(_e, Qt, Zt, $n, Sn, kn, Kn) {
  const er = formats[Qt.type] && kn !== Time && kn !== UTC ? thresholdFormat(_e, Qt, Sn) : tickFormat(_e, Qt, Zt, Sn, kn, Kn);
  return $n === SymbolLegend && isDiscreteRange(Qt) ? formatRange(er) : $n === DiscreteLegend ? formatDiscrete(er) : formatPoint(er);
}
const formatRange = (_e) => (Qt, Zt, $n) => {
  const Sn = get$5($n[Zt + 1], get$5($n.max, 1 / 0)), kn = formatValue$2(Qt, _e), Kn = formatValue$2(Sn, _e);
  return kn && Kn ? kn + " – " + Kn : Kn ? "< " + Kn : "≥ " + kn;
}, get$5 = (_e, Qt) => _e ?? Qt, formatDiscrete = (_e) => (Qt, Zt) => Zt ? _e(Qt) : null, formatPoint = (_e) => (Qt) => _e(Qt), formatValue$2 = (_e, Qt) => Number.isFinite(_e) ? Qt(_e) : null;
function labelFraction(_e) {
  const Qt = _e.domain(), Zt = Qt.length - 1;
  let $n = +Qt[0], Sn = +peek$1(Qt), kn = Sn - $n;
  if (_e.type === Threshold) {
    const Kn = Zt ? kn / Zt : 0.1;
    $n -= Kn, Sn += Kn, kn = Sn - $n;
  }
  return (Kn) => (Kn - $n) / kn;
}
function format$1(_e, Qt, Zt, $n) {
  const Sn = $n || Qt.type;
  return isString(Zt) && isTemporal(Sn) && (Zt = Zt.replace(/%a/g, "%A").replace(/%b/g, "%B")), !Zt && Sn === Time ? _e.timeFormat("%A, %d %B %Y, %X") : !Zt && Sn === UTC ? _e.utcFormat("%A, %d %B %Y, %X UTC") : labelFormat(_e, Qt, 5, null, Zt, $n, !0);
}
function domainCaption(_e, Qt, Zt) {
  Zt = Zt || {};
  const $n = Math.max(3, Zt.maxlen || 7), Sn = format$1(_e, Qt, Zt.format, Zt.formatType);
  if (isDiscretizing$1(Qt.type)) {
    const kn = labelValues(Qt).slice(1).map(Sn), Kn = kn.length;
    return `${Kn} boundar${Kn === 1 ? "y" : "ies"}: ${kn.join(", ")}`;
  } else if (isDiscrete$2(Qt.type)) {
    const kn = Qt.domain(), Kn = kn.length, er = Kn > $n ? kn.slice(0, $n - 2).map(Sn).join(", ") + ", ending with " + kn.slice(-1).map(Sn) : kn.map(Sn).join(", ");
    return `${Kn} value${Kn === 1 ? "" : "s"}: ${er}`;
  } else {
    const kn = Qt.domain();
    return `values from ${Sn(kn[0])} to ${Sn(peek$1(kn))}`;
  }
}
let gradient_id = 0;
function resetSVGGradientId() {
  gradient_id = 0;
}
const patternPrefix = "p_";
function isGradient(_e) {
  return _e && _e.gradient;
}
function gradientRef(_e, Qt, Zt) {
  const $n = _e.gradient;
  let Sn = _e.id, kn = $n === "radial" ? patternPrefix : "";
  return Sn || (Sn = _e.id = "gradient_" + gradient_id++, $n === "radial" ? (_e.x1 = get$4(_e.x1, 0.5), _e.y1 = get$4(_e.y1, 0.5), _e.r1 = get$4(_e.r1, 0), _e.x2 = get$4(_e.x2, 0.5), _e.y2 = get$4(_e.y2, 0.5), _e.r2 = get$4(_e.r2, 0.5), kn = patternPrefix) : (_e.x1 = get$4(_e.x1, 0), _e.y1 = get$4(_e.y1, 0), _e.x2 = get$4(_e.x2, 1), _e.y2 = get$4(_e.y2, 0))), Qt[Sn] = _e, "url(" + (Zt || "") + "#" + kn + Sn + ")";
}
function get$4(_e, Qt) {
  return _e ?? Qt;
}
function Gradient$1(_e, Qt) {
  var Zt = [], $n;
  return $n = {
    gradient: "linear",
    x1: _e ? _e[0] : 0,
    y1: _e ? _e[1] : 0,
    x2: Qt ? Qt[0] : 1,
    y2: Qt ? Qt[1] : 0,
    stops: Zt,
    stop: function(Sn, kn) {
      return Zt.push({
        offset: Sn,
        color: kn
      }), $n;
    }
  };
}
const lookup$4 = {
  basis: {
    curve: curveBasis
  },
  "basis-closed": {
    curve: curveBasisClosed
  },
  "basis-open": {
    curve: curveBasisOpen
  },
  bundle: {
    curve: curveBundle,
    tension: "beta",
    value: 0.85
  },
  cardinal: {
    curve: curveCardinal,
    tension: "tension",
    value: 0
  },
  "cardinal-open": {
    curve: curveCardinalOpen,
    tension: "tension",
    value: 0
  },
  "cardinal-closed": {
    curve: curveCardinalClosed,
    tension: "tension",
    value: 0
  },
  "catmull-rom": {
    curve: curveCatmullRom,
    tension: "alpha",
    value: 0.5
  },
  "catmull-rom-closed": {
    curve: curveCatmullRomClosed,
    tension: "alpha",
    value: 0.5
  },
  "catmull-rom-open": {
    curve: curveCatmullRomOpen,
    tension: "alpha",
    value: 0.5
  },
  linear: {
    curve: curveLinear
  },
  "linear-closed": {
    curve: curveLinearClosed
  },
  monotone: {
    horizontal: monotoneY,
    vertical: monotoneX
  },
  natural: {
    curve: curveNatural
  },
  step: {
    curve: curveStep
  },
  "step-after": {
    curve: stepAfter
  },
  "step-before": {
    curve: stepBefore
  }
};
function curves$1(_e, Qt, Zt) {
  var $n = has$1(lookup$4, _e) && lookup$4[_e], Sn = null;
  return $n && (Sn = $n.curve || $n[Qt || "vertical"], $n.tension && Zt != null && (Sn = Sn[$n.tension](Zt))), Sn;
}
const paramCounts = {
  m: 2,
  l: 2,
  h: 1,
  v: 1,
  z: 0,
  c: 6,
  s: 4,
  q: 4,
  t: 2,
  a: 7
}, commandPattern = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi, numberPattern = /^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/, spacePattern = /^((\s+,?\s*)|(,\s*))/, flagPattern = /^[01]/;
function parse$4(_e) {
  const Qt = [];
  return (_e.match(commandPattern) || []).forEach(($n) => {
    let Sn = $n[0];
    const kn = Sn.toLowerCase(), Kn = paramCounts[kn], er = parseParams(kn, Kn, $n.slice(1).trim()), Cr = er.length;
    if (Cr < Kn || Cr && Cr % Kn !== 0)
      throw Error("Invalid SVG path, incorrect parameter count");
    if (Qt.push([Sn, ...er.slice(0, Kn)]), Cr !== Kn) {
      kn === "m" && (Sn = Sn === "M" ? "L" : "l");
      for (let kr = Kn; kr < Cr; kr += Kn)
        Qt.push([Sn, ...er.slice(kr, kr + Kn)]);
    }
  }), Qt;
}
function parseParams(_e, Qt, Zt) {
  const $n = [];
  for (let Sn = 0; Qt && Sn < Zt.length; )
    for (let kn = 0; kn < Qt; ++kn) {
      const Kn = _e === "a" && (kn === 3 || kn === 4) ? flagPattern : numberPattern, er = Zt.slice(Sn).match(Kn);
      if (er === null)
        throw Error("Invalid SVG path, incorrect parameter type");
      Sn += er[0].length, $n.push(+er[0]);
      const Cr = Zt.slice(Sn).match(spacePattern);
      Cr !== null && (Sn += Cr[0].length);
    }
  return $n;
}
const DegToRad = Math.PI / 180, Epsilon = 1e-14, HalfPi = Math.PI / 2, Tau = Math.PI * 2, HalfSqrt3 = Math.sqrt(3) / 2;
var segmentCache = {}, bezierCache = {}, join$1 = [].join;
function segments(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr) {
  const kr = join$1.call(arguments);
  if (segmentCache[kr])
    return segmentCache[kr];
  const Yr = Kn * DegToRad, Ms = Math.sin(Yr), Ds = Math.cos(Yr);
  Zt = Math.abs(Zt), $n = Math.abs($n);
  const Ls = Ds * (er - _e) * 0.5 + Ms * (Cr - Qt) * 0.5, js = Ds * (Cr - Qt) * 0.5 - Ms * (er - _e) * 0.5;
  let zs = Ls * Ls / (Zt * Zt) + js * js / ($n * $n);
  zs > 1 && (zs = Math.sqrt(zs), Zt *= zs, $n *= zs);
  const Fs = Ds / Zt, Bs = Ms / Zt, Hs = -Ms / $n, Ws = Ds / $n, Ys = Fs * er + Bs * Cr, El = Hs * er + Ws * Cr, Mu = Fs * _e + Bs * Qt, Pl = Hs * _e + Ws * Qt;
  let Tu = 1 / ((Mu - Ys) * (Mu - Ys) + (Pl - El) * (Pl - El)) - 0.25;
  Tu < 0 && (Tu = 0);
  let Au = Math.sqrt(Tu);
  kn == Sn && (Au = -Au);
  const Nu = 0.5 * (Ys + Mu) - Au * (Pl - El), gm = 0.5 * (El + Pl) + Au * (Mu - Ys), pm = Math.atan2(El - gm, Ys - Nu);
  let Yu = Math.atan2(Pl - gm, Mu - Nu) - pm;
  Yu < 0 && kn === 1 ? Yu += Tau : Yu > 0 && kn === 0 && (Yu -= Tau);
  const sm = Math.ceil(Math.abs(Yu / (HalfPi + 1e-3))), mm = [];
  for (let hm = 0; hm < sm; ++hm) {
    const ym = pm + hm * Yu / sm, _m = pm + (hm + 1) * Yu / sm;
    mm[hm] = [Nu, gm, ym, _m, Zt, $n, Ms, Ds];
  }
  return segmentCache[kr] = mm;
}
function bezier(_e) {
  const Qt = join$1.call(_e);
  if (bezierCache[Qt])
    return bezierCache[Qt];
  var Zt = _e[0], $n = _e[1], Sn = _e[2], kn = _e[3], Kn = _e[4], er = _e[5], Cr = _e[6], kr = _e[7];
  const Yr = kr * Kn, Ms = -Cr * er, Ds = Cr * Kn, Ls = kr * er, js = Math.cos(Sn), zs = Math.sin(Sn), Fs = Math.cos(kn), Bs = Math.sin(kn), Hs = 0.5 * (kn - Sn), Ws = Math.sin(Hs * 0.5), Ys = 8 / 3 * Ws * Ws / Math.sin(Hs), El = Zt + js - Ys * zs, Mu = $n + zs + Ys * js, Pl = Zt + Fs, Iu = $n + Bs, Tu = Pl + Ys * Bs, Au = Iu - Ys * Fs;
  return bezierCache[Qt] = [Yr * El + Ms * Mu, Ds * El + Ls * Mu, Yr * Tu + Ms * Au, Ds * Tu + Ls * Au, Yr * Pl + Ms * Iu, Ds * Pl + Ls * Iu];
}
const temp = ["l", 0, 0, 0, 0, 0, 0, 0];
function scale$1$1(_e, Qt, Zt) {
  const $n = temp[0] = _e[0];
  if ($n === "a" || $n === "A")
    temp[1] = Qt * _e[1], temp[2] = Zt * _e[2], temp[3] = _e[3], temp[4] = _e[4], temp[5] = _e[5], temp[6] = Qt * _e[6], temp[7] = Zt * _e[7];
  else if ($n === "h" || $n === "H")
    temp[1] = Qt * _e[1];
  else if ($n === "v" || $n === "V")
    temp[1] = Zt * _e[1];
  else
    for (var Sn = 1, kn = _e.length; Sn < kn; ++Sn)
      temp[Sn] = (Sn % 2 == 1 ? Qt : Zt) * _e[Sn];
  return temp;
}
function pathRender(_e, Qt, Zt, $n, Sn, kn) {
  var Kn, er = null, Cr = 0, kr = 0, Yr = 0, Ms = 0, Ds, Ls, js, zs, Fs = 0, Bs = 0;
  Zt == null && (Zt = 0), $n == null && ($n = 0), Sn == null && (Sn = 1), kn == null && (kn = Sn), _e.beginPath && _e.beginPath();
  for (var Hs = 0, Ws = Qt.length; Hs < Ws; ++Hs) {
    switch (Kn = Qt[Hs], (Sn !== 1 || kn !== 1) && (Kn = scale$1$1(Kn, Sn, kn)), Kn[0]) {
      case "l":
        Cr += Kn[1], kr += Kn[2], _e.lineTo(Cr + Zt, kr + $n);
        break;
      case "L":
        Cr = Kn[1], kr = Kn[2], _e.lineTo(Cr + Zt, kr + $n);
        break;
      case "h":
        Cr += Kn[1], _e.lineTo(Cr + Zt, kr + $n);
        break;
      case "H":
        Cr = Kn[1], _e.lineTo(Cr + Zt, kr + $n);
        break;
      case "v":
        kr += Kn[1], _e.lineTo(Cr + Zt, kr + $n);
        break;
      case "V":
        kr = Kn[1], _e.lineTo(Cr + Zt, kr + $n);
        break;
      case "m":
        Cr += Kn[1], kr += Kn[2], Fs = Cr, Bs = kr, _e.moveTo(Cr + Zt, kr + $n);
        break;
      case "M":
        Cr = Kn[1], kr = Kn[2], Fs = Cr, Bs = kr, _e.moveTo(Cr + Zt, kr + $n);
        break;
      case "c":
        Ds = Cr + Kn[5], Ls = kr + Kn[6], Yr = Cr + Kn[3], Ms = kr + Kn[4], _e.bezierCurveTo(
          Cr + Kn[1] + Zt,
          // x1
          kr + Kn[2] + $n,
          // y1
          Yr + Zt,
          // x2
          Ms + $n,
          // y2
          Ds + Zt,
          Ls + $n
        ), Cr = Ds, kr = Ls;
        break;
      case "C":
        Cr = Kn[5], kr = Kn[6], Yr = Kn[3], Ms = Kn[4], _e.bezierCurveTo(Kn[1] + Zt, Kn[2] + $n, Yr + Zt, Ms + $n, Cr + Zt, kr + $n);
        break;
      case "s":
        Ds = Cr + Kn[3], Ls = kr + Kn[4], Yr = 2 * Cr - Yr, Ms = 2 * kr - Ms, _e.bezierCurveTo(Yr + Zt, Ms + $n, Cr + Kn[1] + Zt, kr + Kn[2] + $n, Ds + Zt, Ls + $n), Yr = Cr + Kn[1], Ms = kr + Kn[2], Cr = Ds, kr = Ls;
        break;
      case "S":
        Ds = Kn[3], Ls = Kn[4], Yr = 2 * Cr - Yr, Ms = 2 * kr - Ms, _e.bezierCurveTo(Yr + Zt, Ms + $n, Kn[1] + Zt, Kn[2] + $n, Ds + Zt, Ls + $n), Cr = Ds, kr = Ls, Yr = Kn[1], Ms = Kn[2];
        break;
      case "q":
        Ds = Cr + Kn[3], Ls = kr + Kn[4], Yr = Cr + Kn[1], Ms = kr + Kn[2], _e.quadraticCurveTo(Yr + Zt, Ms + $n, Ds + Zt, Ls + $n), Cr = Ds, kr = Ls;
        break;
      case "Q":
        Ds = Kn[3], Ls = Kn[4], _e.quadraticCurveTo(Kn[1] + Zt, Kn[2] + $n, Ds + Zt, Ls + $n), Cr = Ds, kr = Ls, Yr = Kn[1], Ms = Kn[2];
        break;
      case "t":
        Ds = Cr + Kn[1], Ls = kr + Kn[2], er[0].match(/[QqTt]/) === null ? (Yr = Cr, Ms = kr) : er[0] === "t" ? (Yr = 2 * Cr - js, Ms = 2 * kr - zs) : er[0] === "q" && (Yr = 2 * Cr - Yr, Ms = 2 * kr - Ms), js = Yr, zs = Ms, _e.quadraticCurveTo(Yr + Zt, Ms + $n, Ds + Zt, Ls + $n), Cr = Ds, kr = Ls, Yr = Cr + Kn[1], Ms = kr + Kn[2];
        break;
      case "T":
        Ds = Kn[1], Ls = Kn[2], Yr = 2 * Cr - Yr, Ms = 2 * kr - Ms, _e.quadraticCurveTo(Yr + Zt, Ms + $n, Ds + Zt, Ls + $n), Cr = Ds, kr = Ls;
        break;
      case "a":
        drawArc(_e, Cr + Zt, kr + $n, [Kn[1], Kn[2], Kn[3], Kn[4], Kn[5], Kn[6] + Cr + Zt, Kn[7] + kr + $n]), Cr += Kn[6], kr += Kn[7];
        break;
      case "A":
        drawArc(_e, Cr + Zt, kr + $n, [Kn[1], Kn[2], Kn[3], Kn[4], Kn[5], Kn[6] + Zt, Kn[7] + $n]), Cr = Kn[6], kr = Kn[7];
        break;
      case "z":
      case "Z":
        Cr = Fs, kr = Bs, _e.closePath();
        break;
    }
    er = Kn;
  }
}
function drawArc(_e, Qt, Zt, $n) {
  const Sn = segments(
    $n[5],
    // end x
    $n[6],
    // end y
    $n[0],
    // radius x
    $n[1],
    // radius y
    $n[3],
    // large flag
    $n[4],
    // sweep flag
    $n[2],
    // rotation
    Qt,
    Zt
  );
  for (let kn = 0; kn < Sn.length; ++kn) {
    const Kn = bezier(Sn[kn]);
    _e.bezierCurveTo(Kn[0], Kn[1], Kn[2], Kn[3], Kn[4], Kn[5]);
  }
}
const Tan30 = 0.5773502691896257, builtins = {
  circle: {
    draw: function(_e, Qt) {
      const Zt = Math.sqrt(Qt) / 2;
      _e.moveTo(Zt, 0), _e.arc(0, 0, Zt, 0, Tau);
    }
  },
  cross: {
    draw: function(_e, Qt) {
      var Zt = Math.sqrt(Qt) / 2, $n = Zt / 2.5;
      _e.moveTo(-Zt, -$n), _e.lineTo(-Zt, $n), _e.lineTo(-$n, $n), _e.lineTo(-$n, Zt), _e.lineTo($n, Zt), _e.lineTo($n, $n), _e.lineTo(Zt, $n), _e.lineTo(Zt, -$n), _e.lineTo($n, -$n), _e.lineTo($n, -Zt), _e.lineTo(-$n, -Zt), _e.lineTo(-$n, -$n), _e.closePath();
    }
  },
  diamond: {
    draw: function(_e, Qt) {
      const Zt = Math.sqrt(Qt) / 2;
      _e.moveTo(-Zt, 0), _e.lineTo(0, -Zt), _e.lineTo(Zt, 0), _e.lineTo(0, Zt), _e.closePath();
    }
  },
  square: {
    draw: function(_e, Qt) {
      var Zt = Math.sqrt(Qt), $n = -Zt / 2;
      _e.rect($n, $n, Zt, Zt);
    }
  },
  arrow: {
    draw: function(_e, Qt) {
      var Zt = Math.sqrt(Qt) / 2, $n = Zt / 7, Sn = Zt / 2.5, kn = Zt / 8;
      _e.moveTo(-$n, Zt), _e.lineTo($n, Zt), _e.lineTo($n, -kn), _e.lineTo(Sn, -kn), _e.lineTo(0, -Zt), _e.lineTo(-Sn, -kn), _e.lineTo(-$n, -kn), _e.closePath();
    }
  },
  wedge: {
    draw: function(_e, Qt) {
      var Zt = Math.sqrt(Qt) / 2, $n = HalfSqrt3 * Zt, Sn = $n - Zt * Tan30, kn = Zt / 4;
      _e.moveTo(0, -$n - Sn), _e.lineTo(-kn, $n - Sn), _e.lineTo(kn, $n - Sn), _e.closePath();
    }
  },
  triangle: {
    draw: function(_e, Qt) {
      var Zt = Math.sqrt(Qt) / 2, $n = HalfSqrt3 * Zt, Sn = $n - Zt * Tan30;
      _e.moveTo(0, -$n - Sn), _e.lineTo(-Zt, $n - Sn), _e.lineTo(Zt, $n - Sn), _e.closePath();
    }
  },
  "triangle-up": {
    draw: function(_e, Qt) {
      var Zt = Math.sqrt(Qt) / 2, $n = HalfSqrt3 * Zt;
      _e.moveTo(0, -$n), _e.lineTo(-Zt, $n), _e.lineTo(Zt, $n), _e.closePath();
    }
  },
  "triangle-down": {
    draw: function(_e, Qt) {
      var Zt = Math.sqrt(Qt) / 2, $n = HalfSqrt3 * Zt;
      _e.moveTo(0, $n), _e.lineTo(-Zt, -$n), _e.lineTo(Zt, -$n), _e.closePath();
    }
  },
  "triangle-right": {
    draw: function(_e, Qt) {
      var Zt = Math.sqrt(Qt) / 2, $n = HalfSqrt3 * Zt;
      _e.moveTo($n, 0), _e.lineTo(-$n, -Zt), _e.lineTo(-$n, Zt), _e.closePath();
    }
  },
  "triangle-left": {
    draw: function(_e, Qt) {
      var Zt = Math.sqrt(Qt) / 2, $n = HalfSqrt3 * Zt;
      _e.moveTo(-$n, 0), _e.lineTo($n, -Zt), _e.lineTo($n, Zt), _e.closePath();
    }
  },
  stroke: {
    draw: function(_e, Qt) {
      const Zt = Math.sqrt(Qt) / 2;
      _e.moveTo(-Zt, 0), _e.lineTo(Zt, 0);
    }
  }
};
function symbols$1(_e) {
  return has$1(builtins, _e) ? builtins[_e] : customSymbol(_e);
}
var custom = {};
function customSymbol(_e) {
  if (!has$1(custom, _e)) {
    const Qt = parse$4(_e);
    custom[_e] = {
      draw: function(Zt, $n) {
        pathRender(Zt, Qt, 0, 0, Math.sqrt($n) / 2);
      }
    };
  }
  return custom[_e];
}
const C$1 = 0.448084975506;
function rectangleX(_e) {
  return _e.x;
}
function rectangleY(_e) {
  return _e.y;
}
function rectangleWidth(_e) {
  return _e.width;
}
function rectangleHeight(_e) {
  return _e.height;
}
function number$3(_e) {
  return typeof _e == "function" ? _e : () => +_e;
}
function clamp(_e, Qt, Zt) {
  return Math.max(Qt, Math.min(_e, Zt));
}
function vg_rect() {
  var _e = rectangleX, Qt = rectangleY, Zt = rectangleWidth, $n = rectangleHeight, Sn = number$3(0), kn = Sn, Kn = Sn, er = Sn, Cr = null;
  function kr(Yr, Ms, Ds) {
    var Ls, js = Ms ?? +_e.call(this, Yr), zs = Ds ?? +Qt.call(this, Yr), Fs = +Zt.call(this, Yr), Bs = +$n.call(this, Yr), Hs = Math.min(Fs, Bs) / 2, Ws = clamp(+Sn.call(this, Yr), 0, Hs), Ys = clamp(+kn.call(this, Yr), 0, Hs), El = clamp(+Kn.call(this, Yr), 0, Hs), Mu = clamp(+er.call(this, Yr), 0, Hs);
    if (Cr || (Cr = Ls = path$3()), Ws <= 0 && Ys <= 0 && El <= 0 && Mu <= 0)
      Cr.rect(js, zs, Fs, Bs);
    else {
      var Pl = js + Fs, Iu = zs + Bs;
      Cr.moveTo(js + Ws, zs), Cr.lineTo(Pl - Ys, zs), Cr.bezierCurveTo(Pl - C$1 * Ys, zs, Pl, zs + C$1 * Ys, Pl, zs + Ys), Cr.lineTo(Pl, Iu - Mu), Cr.bezierCurveTo(Pl, Iu - C$1 * Mu, Pl - C$1 * Mu, Iu, Pl - Mu, Iu), Cr.lineTo(js + El, Iu), Cr.bezierCurveTo(js + C$1 * El, Iu, js, Iu - C$1 * El, js, Iu - El), Cr.lineTo(js, zs + Ws), Cr.bezierCurveTo(js, zs + C$1 * Ws, js + C$1 * Ws, zs, js + Ws, zs), Cr.closePath();
    }
    if (Ls)
      return Cr = null, Ls + "" || null;
  }
  return kr.x = function(Yr) {
    return arguments.length ? (_e = number$3(Yr), kr) : _e;
  }, kr.y = function(Yr) {
    return arguments.length ? (Qt = number$3(Yr), kr) : Qt;
  }, kr.width = function(Yr) {
    return arguments.length ? (Zt = number$3(Yr), kr) : Zt;
  }, kr.height = function(Yr) {
    return arguments.length ? ($n = number$3(Yr), kr) : $n;
  }, kr.cornerRadius = function(Yr, Ms, Ds, Ls) {
    return arguments.length ? (Sn = number$3(Yr), kn = Ms != null ? number$3(Ms) : Sn, er = Ds != null ? number$3(Ds) : Sn, Kn = Ls != null ? number$3(Ls) : kn, kr) : Sn;
  }, kr.context = function(Yr) {
    return arguments.length ? (Cr = Yr ?? null, kr) : Cr;
  }, kr;
}
function vg_trail() {
  var _e, Qt, Zt, $n, Sn = null, kn, Kn, er, Cr;
  function kr(Ms, Ds, Ls) {
    const js = Ls / 2;
    if (kn) {
      var zs = er - Ds, Fs = Ms - Kn;
      if (zs || Fs) {
        var Bs = Math.sqrt(zs * zs + Fs * Fs), Hs = (zs /= Bs) * Cr, Ws = (Fs /= Bs) * Cr, Ys = Math.atan2(Fs, zs);
        Sn.moveTo(Kn - Hs, er - Ws), Sn.lineTo(Ms - zs * js, Ds - Fs * js), Sn.arc(Ms, Ds, js, Ys - Math.PI, Ys), Sn.lineTo(Kn + Hs, er + Ws), Sn.arc(Kn, er, Cr, Ys, Ys + Math.PI);
      } else
        Sn.arc(Ms, Ds, js, 0, Tau);
      Sn.closePath();
    } else
      kn = 1;
    Kn = Ms, er = Ds, Cr = js;
  }
  function Yr(Ms) {
    var Ds, Ls = Ms.length, js, zs = !1, Fs;
    for (Sn == null && (Sn = Fs = path$3()), Ds = 0; Ds <= Ls; ++Ds)
      !(Ds < Ls && $n(js = Ms[Ds], Ds, Ms)) === zs && (zs = !zs) && (kn = 0), zs && kr(+_e(js, Ds, Ms), +Qt(js, Ds, Ms), +Zt(js, Ds, Ms));
    if (Fs)
      return Sn = null, Fs + "" || null;
  }
  return Yr.x = function(Ms) {
    return arguments.length ? (_e = Ms, Yr) : _e;
  }, Yr.y = function(Ms) {
    return arguments.length ? (Qt = Ms, Yr) : Qt;
  }, Yr.size = function(Ms) {
    return arguments.length ? (Zt = Ms, Yr) : Zt;
  }, Yr.defined = function(Ms) {
    return arguments.length ? ($n = Ms, Yr) : $n;
  }, Yr.context = function(Ms) {
    return arguments.length ? (Ms == null ? Sn = null : Sn = Ms, Yr) : Sn;
  }, Yr;
}
function value$1(_e, Qt) {
  return _e ?? Qt;
}
const x$2 = (_e) => _e.x || 0, y$2 = (_e) => _e.y || 0, w$2 = (_e) => _e.width || 0, h$2 = (_e) => _e.height || 0, xw$1 = (_e) => (_e.x || 0) + (_e.width || 0), yh$1 = (_e) => (_e.y || 0) + (_e.height || 0), sa$1 = (_e) => _e.startAngle || 0, ea$1 = (_e) => _e.endAngle || 0, pa$1 = (_e) => _e.padAngle || 0, ir$1 = (_e) => _e.innerRadius || 0, or$1 = (_e) => _e.outerRadius || 0, cr$1 = (_e) => _e.cornerRadius || 0, tl$1 = (_e) => value$1(_e.cornerRadiusTopLeft, _e.cornerRadius) || 0, tr$1 = (_e) => value$1(_e.cornerRadiusTopRight, _e.cornerRadius) || 0, br$1 = (_e) => value$1(_e.cornerRadiusBottomRight, _e.cornerRadius) || 0, bl$1 = (_e) => value$1(_e.cornerRadiusBottomLeft, _e.cornerRadius) || 0, sz = (_e) => value$1(_e.size, 64), ts$1 = (_e) => _e.size || 1, def = (_e) => _e.defined !== !1, type$1 = (_e) => symbols$1(_e.shape || "circle"), arcShape = arc$2$1().startAngle(sa$1).endAngle(ea$1).padAngle(pa$1).innerRadius(ir$1).outerRadius(or$1).cornerRadius(cr$1), areavShape = area$2$1().x(x$2).y1(y$2).y0(yh$1).defined(def), areahShape = area$2$1().y(y$2).x1(x$2).x0(xw$1).defined(def), lineShape = line$2$1().x(x$2).y(y$2).defined(def), rectShape = vg_rect().x(x$2).y(y$2).width(w$2).height(h$2).cornerRadius(tl$1, tr$1, br$1, bl$1), symbolShape = Symbol$1().type(type$1).size(sz), trailShape = vg_trail().x(x$2).y(y$2).defined(def).size(ts$1);
function hasCornerRadius(_e) {
  return _e.cornerRadius || _e.cornerRadiusTopLeft || _e.cornerRadiusTopRight || _e.cornerRadiusBottomRight || _e.cornerRadiusBottomLeft;
}
function arc$1$1(_e, Qt) {
  return arcShape.context(_e)(Qt);
}
function area$1$1(_e, Qt) {
  const Zt = Qt[0], $n = Zt.interpolate || "linear";
  return (Zt.orient === "horizontal" ? areahShape : areavShape).curve(curves$1($n, Zt.orient, Zt.tension)).context(_e)(Qt);
}
function line$1$1(_e, Qt) {
  const Zt = Qt[0], $n = Zt.interpolate || "linear";
  return lineShape.curve(curves$1($n, Zt.orient, Zt.tension)).context(_e)(Qt);
}
function rectangle(_e, Qt, Zt, $n) {
  return rectShape.context(_e)(Qt, Zt, $n);
}
function shape$1(_e, Qt) {
  return (Qt.mark.shape || Qt.shape).context(_e)(Qt);
}
function symbol$1(_e, Qt) {
  return symbolShape.context(_e)(Qt);
}
function trail$1(_e, Qt) {
  return trailShape.context(_e)(Qt);
}
var clip_id = 1;
function resetSVGClipId() {
  clip_id = 1;
}
function clip$1$1(_e, Qt, Zt) {
  var $n = Qt.clip, Sn = _e._defs, kn = Qt.clip_id || (Qt.clip_id = "clip" + clip_id++), Kn = Sn.clipping[kn] || (Sn.clipping[kn] = {
    id: kn
  });
  return isFunction$1($n) ? Kn.path = $n(null) : hasCornerRadius(Zt) ? Kn.path = rectangle(null, Zt, 0, 0) : (Kn.width = Zt.width || 0, Kn.height = Zt.height || 0), "url(#" + kn + ")";
}
function Bounds(_e) {
  this.clear(), _e && this.union(_e);
}
Bounds.prototype = {
  clone() {
    return new Bounds(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, Qt, Zt, $n) {
    return Zt < _e ? (this.x2 = _e, this.x1 = Zt) : (this.x1 = _e, this.x2 = Zt), $n < Qt ? (this.y2 = Qt, this.y1 = $n) : (this.y1 = Qt, this.y2 = $n), this;
  },
  add(_e, Qt) {
    return _e < this.x1 && (this.x1 = _e), Qt < this.y1 && (this.y1 = Qt), _e > this.x2 && (this.x2 = _e), Qt > this.y2 && (this.y2 = Qt), 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, Qt) {
    return this.x1 += _e, this.x2 += _e, this.y1 += Qt, this.y2 += Qt, this;
  },
  rotate(_e, Qt, Zt) {
    const $n = this.rotatedPoints(_e, Qt, Zt);
    return this.clear().add($n[0], $n[1]).add($n[2], $n[3]).add($n[4], $n[5]).add($n[6], $n[7]);
  },
  rotatedPoints(_e, Qt, Zt) {
    var {
      x1: $n,
      y1: Sn,
      x2: kn,
      y2: Kn
    } = this, er = Math.cos(_e), Cr = Math.sin(_e), kr = Qt - Qt * er + Zt * Cr, Yr = Zt - Qt * Cr - Zt * er;
    return [er * $n - Cr * Sn + kr, Cr * $n + er * Sn + Yr, er * $n - Cr * Kn + kr, Cr * $n + er * Kn + Yr, er * kn - Cr * Sn + kr, Cr * kn + er * Sn + Yr, er * kn - Cr * Kn + kr, Cr * kn + er * Kn + Yr];
  },
  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, Qt) {
    return !(_e < this.x1 || _e > this.x2 || Qt < this.y1 || Qt > this.y2);
  },
  width() {
    return this.x2 - this.x1;
  },
  height() {
    return this.y2 - this.y1;
  }
};
function Item(_e) {
  this.mark = _e, this.bounds = this.bounds || new Bounds();
}
function GroupItem(_e) {
  Item.call(this, _e), this.items = this.items || [];
}
inherits(GroupItem, Item);
function ResourceLoader(_e) {
  this._pending = 0, this._loader = _e || loader();
}
function increment(_e) {
  _e._pending += 1;
}
function decrement(_e) {
  _e._pending -= 1;
}
ResourceLoader.prototype = {
  pending() {
    return this._pending;
  },
  sanitizeURL(_e) {
    const Qt = this;
    return increment(Qt), Qt._loader.sanitize(_e, {
      context: "href"
    }).then((Zt) => (decrement(Qt), Zt)).catch(() => (decrement(Qt), null));
  },
  loadImage(_e) {
    const Qt = this, Zt = domImage();
    return increment(Qt), Qt._loader.sanitize(_e, {
      context: "image"
    }).then(($n) => {
      const Sn = $n.href;
      if (!Sn || !Zt)
        throw {
          url: Sn
        };
      const kn = new Zt(), Kn = has$1($n, "crossOrigin") ? $n.crossOrigin : "anonymous";
      return Kn != null && (kn.crossOrigin = Kn), kn.onload = () => decrement(Qt), kn.onerror = () => decrement(Qt), kn.src = Sn, kn;
    }).catch(($n) => (decrement(Qt), {
      complete: !1,
      width: 0,
      height: 0,
      src: $n && $n.url || ""
    }));
  },
  ready() {
    const _e = this;
    return new Promise((Qt) => {
      function Zt($n) {
        _e.pending() ? setTimeout(() => {
          Zt(!0);
        }, 10) : Qt($n);
      }
      Zt(!1);
    });
  }
};
function boundStroke(_e, Qt, Zt) {
  if (Qt.stroke && Qt.opacity !== 0 && Qt.strokeOpacity !== 0) {
    const $n = Qt.strokeWidth != null ? +Qt.strokeWidth : 1;
    _e.expand($n + (Zt ? miterAdjustment(Qt, $n) : 0));
  }
  return _e;
}
function miterAdjustment(_e, Qt) {
  return _e.strokeJoin && _e.strokeJoin !== "miter" ? 0 : Qt;
}
const circleThreshold = Tau - 1e-8;
let bounds, lx$1, ly$1, rot, ma$1, mb$1, mc$1, md$1;
const add$3 = (_e, Qt) => bounds.add(_e, Qt), addL = (_e, Qt) => add$3(lx$1 = _e, ly$1 = Qt), addX = (_e) => add$3(_e, bounds.y1), addY = (_e) => add$3(bounds.x1, _e), px$1 = (_e, Qt) => ma$1 * _e + mc$1 * Qt, py$1 = (_e, Qt) => mb$1 * _e + md$1 * Qt, addp = (_e, Qt) => add$3(px$1(_e, Qt), py$1(_e, Qt)), addpL = (_e, Qt) => addL(px$1(_e, Qt), py$1(_e, Qt));
function boundContext(_e, Qt) {
  return bounds = _e, Qt ? (rot = Qt * DegToRad, ma$1 = md$1 = Math.cos(rot), mb$1 = Math.sin(rot), mc$1 = -mb$1) : (ma$1 = md$1 = 1, rot = mb$1 = mc$1 = 0), context$1;
}
const context$1 = {
  beginPath() {
  },
  closePath() {
  },
  moveTo: addpL,
  lineTo: addpL,
  rect(_e, Qt, Zt, $n) {
    rot ? (addp(_e + Zt, Qt), addp(_e + Zt, Qt + $n), addp(_e, Qt + $n), addpL(_e, Qt)) : (add$3(_e + Zt, Qt + $n), addL(_e, Qt));
  },
  quadraticCurveTo(_e, Qt, Zt, $n) {
    const Sn = px$1(_e, Qt), kn = py$1(_e, Qt), Kn = px$1(Zt, $n), er = py$1(Zt, $n);
    quadExtrema(lx$1, Sn, Kn, addX), quadExtrema(ly$1, kn, er, addY), addL(Kn, er);
  },
  bezierCurveTo(_e, Qt, Zt, $n, Sn, kn) {
    const Kn = px$1(_e, Qt), er = py$1(_e, Qt), Cr = px$1(Zt, $n), kr = py$1(Zt, $n), Yr = px$1(Sn, kn), Ms = py$1(Sn, kn);
    cubicExtrema(lx$1, Kn, Cr, Yr, addX), cubicExtrema(ly$1, er, kr, Ms, addY), addL(Yr, Ms);
  },
  arc(_e, Qt, Zt, $n, Sn, kn) {
    if ($n += rot, Sn += rot, lx$1 = Zt * Math.cos(Sn) + _e, ly$1 = Zt * Math.sin(Sn) + Qt, Math.abs(Sn - $n) > circleThreshold)
      add$3(_e - Zt, Qt - Zt), add$3(_e + Zt, Qt + Zt);
    else {
      const Kn = (kr) => add$3(Zt * Math.cos(kr) + _e, Zt * Math.sin(kr) + Qt);
      let er, Cr;
      if (Kn($n), Kn(Sn), Sn !== $n)
        if ($n = $n % Tau, $n < 0 && ($n += Tau), Sn = Sn % Tau, Sn < 0 && (Sn += Tau), Sn < $n && (kn = !kn, er = $n, $n = Sn, Sn = er), kn)
          for (Sn -= Tau, er = $n - $n % HalfPi, Cr = 0; Cr < 4 && er > Sn; ++Cr, er -= HalfPi)
            Kn(er);
        else
          for (er = $n - $n % HalfPi + HalfPi, Cr = 0; Cr < 4 && er < Sn; ++Cr, er = er + HalfPi)
            Kn(er);
    }
  }
};
function quadExtrema(_e, Qt, Zt, $n) {
  const Sn = (_e - Qt) / (_e + Zt - 2 * Qt);
  0 < Sn && Sn < 1 && $n(_e + (Qt - _e) * Sn);
}
function cubicExtrema(_e, Qt, Zt, $n, Sn) {
  const kn = $n - _e + 3 * Qt - 3 * Zt, Kn = _e + Zt - 2 * Qt, er = _e - Qt;
  let Cr = 0, kr = 0, Yr;
  Math.abs(kn) > Epsilon ? (Yr = Kn * Kn + er * kn, Yr >= 0 && (Yr = Math.sqrt(Yr), Cr = (-Kn + Yr) / kn, kr = (-Kn - Yr) / kn)) : Cr = 0.5 * er / Kn, 0 < Cr && Cr < 1 && Sn(cubic(Cr, _e, Qt, Zt, $n)), 0 < kr && kr < 1 && Sn(cubic(kr, _e, Qt, Zt, $n));
}
function cubic(_e, Qt, Zt, $n, Sn) {
  const kn = 1 - _e, Kn = kn * kn, er = _e * _e;
  return Kn * kn * Qt + 3 * Kn * _e * Zt + 3 * kn * er * $n + er * _e * Sn;
}
var context$2 = (context$2 = domCanvas(1, 1)) ? context$2.getContext("2d") : null;
const b = new Bounds();
function intersectPath(_e) {
  return function(Qt, Zt) {
    if (!context$2)
      return !0;
    _e(context$2, Qt), b.clear().union(Qt.bounds).intersect(Zt).round();
    const {
      x1: $n,
      y1: Sn,
      x2: kn,
      y2: Kn
    } = b;
    for (let er = Sn; er <= Kn; ++er)
      for (let Cr = $n; Cr <= kn; ++Cr)
        if (context$2.isPointInPath(Cr, er))
          return !0;
    return !1;
  };
}
function intersectPoint(_e, Qt) {
  return Qt.contains(_e.x || 0, _e.y || 0);
}
function intersectRect(_e, Qt) {
  const Zt = _e.x || 0, $n = _e.y || 0, Sn = _e.width || 0, kn = _e.height || 0;
  return Qt.intersects(b.set(Zt, $n, Zt + Sn, $n + kn));
}
function intersectRule(_e, Qt) {
  const Zt = _e.x || 0, $n = _e.y || 0, Sn = _e.x2 != null ? _e.x2 : Zt, kn = _e.y2 != null ? _e.y2 : $n;
  return intersectBoxLine(Qt, Zt, $n, Sn, kn);
}
function intersectBoxLine(_e, Qt, Zt, $n, Sn) {
  const {
    x1: kn,
    y1: Kn,
    x2: er,
    y2: Cr
  } = _e, kr = $n - Qt, Yr = Sn - Zt;
  let Ms = 0, Ds = 1, Ls, js, zs, Fs;
  for (Fs = 0; Fs < 4; ++Fs) {
    if (Fs === 0 && (Ls = -kr, js = -(kn - Qt)), Fs === 1 && (Ls = kr, js = er - Qt), Fs === 2 && (Ls = -Yr, js = -(Kn - Zt)), Fs === 3 && (Ls = Yr, js = Cr - Zt), Math.abs(Ls) < 1e-10 && js < 0)
      return !1;
    if (zs = js / Ls, Ls < 0) {
      if (zs > Ds)
        return !1;
      zs > Ms && (Ms = zs);
    } else if (Ls > 0) {
      if (zs < Ms)
        return !1;
      zs < Ds && (Ds = zs);
    }
  }
  return !0;
}
function blend(_e, Qt) {
  _e.globalCompositeOperation = Qt.blend || "source-over";
}
function value$2(_e, Qt) {
  return _e ?? Qt;
}
function addStops(_e, Qt) {
  const Zt = Qt.length;
  for (let $n = 0; $n < Zt; ++$n)
    _e.addColorStop(Qt[$n].offset, Qt[$n].color);
  return _e;
}
function gradient$2(_e, Qt, Zt) {
  const $n = Zt.width(), Sn = Zt.height();
  let kn;
  if (Qt.gradient === "radial")
    kn = _e.createRadialGradient(Zt.x1 + value$2(Qt.x1, 0.5) * $n, Zt.y1 + value$2(Qt.y1, 0.5) * Sn, Math.max($n, Sn) * value$2(Qt.r1, 0), Zt.x1 + value$2(Qt.x2, 0.5) * $n, Zt.y1 + value$2(Qt.y2, 0.5) * Sn, Math.max($n, Sn) * value$2(Qt.r2, 0.5));
  else {
    const Kn = value$2(Qt.x1, 0), er = value$2(Qt.y1, 0), Cr = value$2(Qt.x2, 1), kr = value$2(Qt.y2, 0);
    if (Kn === Cr || er === kr || $n === Sn)
      kn = _e.createLinearGradient(Zt.x1 + Kn * $n, Zt.y1 + er * Sn, Zt.x1 + Cr * $n, Zt.y1 + kr * Sn);
    else {
      const Yr = domCanvas(Math.ceil($n), Math.ceil(Sn)), Ms = Yr.getContext("2d");
      return Ms.scale($n, Sn), Ms.fillStyle = addStops(Ms.createLinearGradient(Kn, er, Cr, kr), Qt.stops), Ms.fillRect(0, 0, $n, Sn), _e.createPattern(Yr, "no-repeat");
    }
  }
  return addStops(kn, Qt.stops);
}
function color$2(_e, Qt, Zt) {
  return isGradient(Zt) ? gradient$2(_e, Zt, Qt.bounds) : Zt;
}
function fill(_e, Qt, Zt) {
  return Zt *= Qt.fillOpacity == null ? 1 : Qt.fillOpacity, Zt > 0 ? (_e.globalAlpha = Zt, _e.fillStyle = color$2(_e, Qt, Qt.fill), !0) : !1;
}
var Empty = [];
function stroke(_e, Qt, Zt) {
  var $n = ($n = Qt.strokeWidth) != null ? $n : 1;
  return $n <= 0 ? !1 : (Zt *= Qt.strokeOpacity == null ? 1 : Qt.strokeOpacity, Zt > 0 ? (_e.globalAlpha = Zt, _e.strokeStyle = color$2(_e, Qt, Qt.stroke), _e.lineWidth = $n, _e.lineCap = Qt.strokeCap || "butt", _e.lineJoin = Qt.strokeJoin || "miter", _e.miterLimit = Qt.strokeMiterLimit || 10, _e.setLineDash && (_e.setLineDash(Qt.strokeDash || Empty), _e.lineDashOffset = Qt.strokeDashOffset || 0), !0) : !1);
}
function compare$8(_e, Qt) {
  return _e.zindex - Qt.zindex || _e.index - Qt.index;
}
function zorder(_e) {
  if (!_e.zdirty)
    return _e.zitems;
  var Qt = _e.items, Zt = [], $n, Sn, kn;
  for (Sn = 0, kn = Qt.length; Sn < kn; ++Sn)
    $n = Qt[Sn], $n.index = Sn, $n.zindex && Zt.push($n);
  return _e.zdirty = !1, _e.zitems = Zt.sort(compare$8);
}
function visit(_e, Qt) {
  var Zt = _e.items, $n, Sn;
  if (!Zt || !Zt.length)
    return;
  const kn = zorder(_e);
  if (kn && kn.length) {
    for ($n = 0, Sn = Zt.length; $n < Sn; ++$n)
      Zt[$n].zindex || Qt(Zt[$n]);
    Zt = kn;
  }
  for ($n = 0, Sn = Zt.length; $n < Sn; ++$n)
    Qt(Zt[$n]);
}
function pickVisit(_e, Qt) {
  var Zt = _e.items, $n, Sn;
  if (!Zt || !Zt.length)
    return null;
  const kn = zorder(_e);
  for (kn && kn.length && (Zt = kn), Sn = Zt.length; --Sn >= 0; )
    if ($n = Qt(Zt[Sn]))
      return $n;
  if (Zt === kn) {
    for (Zt = _e.items, Sn = Zt.length; --Sn >= 0; )
      if (!Zt[Sn].zindex && ($n = Qt(Zt[Sn])))
        return $n;
  }
  return null;
}
function drawAll(_e) {
  return function(Qt, Zt, $n) {
    visit(Zt, (Sn) => {
      (!$n || $n.intersects(Sn.bounds)) && drawPath(_e, Qt, Sn, Sn);
    });
  };
}
function drawOne(_e) {
  return function(Qt, Zt, $n) {
    Zt.items.length && (!$n || $n.intersects(Zt.bounds)) && drawPath(_e, Qt, Zt.items[0], Zt.items);
  };
}
function drawPath(_e, Qt, Zt, $n) {
  var Sn = Zt.opacity == null ? 1 : Zt.opacity;
  Sn !== 0 && (_e(Qt, $n) || (blend(Qt, Zt), Zt.fill && fill(Qt, Zt, Sn) && Qt.fill(), Zt.stroke && stroke(Qt, Zt, Sn) && Qt.stroke()));
}
function pick$1(_e) {
  return _e = _e || truthy, function(Qt, Zt, $n, Sn, kn, Kn) {
    return $n *= Qt.pixelRatio, Sn *= Qt.pixelRatio, pickVisit(Zt, (er) => {
      const Cr = er.bounds;
      if (!(Cr && !Cr.contains(kn, Kn) || !Cr) && _e(Qt, er, $n, Sn, kn, Kn))
        return er;
    });
  };
}
function hitPath(_e, Qt) {
  return function(Zt, $n, Sn, kn) {
    var Kn = Array.isArray($n) ? $n[0] : $n, er = Qt ?? Kn.fill, Cr = Kn.stroke && Zt.isPointInStroke, kr, Yr;
    return Cr && (kr = Kn.strokeWidth, Yr = Kn.strokeCap, Zt.lineWidth = kr ?? 1, Zt.lineCap = Yr ?? "butt"), _e(Zt, $n) ? !1 : er && Zt.isPointInPath(Sn, kn) || Cr && Zt.isPointInStroke(Sn, kn);
  };
}
function pickPath(_e) {
  return pick$1(hitPath(_e));
}
function translate$2(_e, Qt) {
  return "translate(" + _e + "," + Qt + ")";
}
function rotate(_e) {
  return "rotate(" + _e + ")";
}
function scale$3(_e, Qt) {
  return "scale(" + _e + "," + Qt + ")";
}
function translateItem(_e) {
  return translate$2(_e.x || 0, _e.y || 0);
}
function rotateItem(_e) {
  return translate$2(_e.x || 0, _e.y || 0) + (_e.angle ? " " + rotate(_e.angle) : "");
}
function transformItem(_e) {
  return translate$2(_e.x || 0, _e.y || 0) + (_e.angle ? " " + rotate(_e.angle) : "") + (_e.scaleX || _e.scaleY ? " " + scale$3(_e.scaleX || 1, _e.scaleY || 1) : "");
}
function markItemPath(_e, Qt, Zt) {
  function $n(Kn, er) {
    Kn("transform", rotateItem(er)), Kn("d", Qt(null, er));
  }
  function Sn(Kn, er) {
    return Qt(boundContext(Kn, er.angle), er), boundStroke(Kn, er).translate(er.x || 0, er.y || 0);
  }
  function kn(Kn, er) {
    var Cr = er.x || 0, kr = er.y || 0, Yr = er.angle || 0;
    Kn.translate(Cr, kr), Yr && Kn.rotate(Yr *= DegToRad), Kn.beginPath(), Qt(Kn, er), Yr && Kn.rotate(-Yr), Kn.translate(-Cr, -kr);
  }
  return {
    type: _e,
    tag: "path",
    nested: !1,
    attr: $n,
    bound: Sn,
    draw: drawAll(kn),
    pick: pickPath(kn),
    isect: Zt || intersectPath(kn)
  };
}
var arc$2 = markItemPath("arc", arc$1$1);
function pickArea(_e, Qt) {
  for (var Zt = _e[0].orient === "horizontal" ? Qt[1] : Qt[0], $n = _e[0].orient === "horizontal" ? "y" : "x", Sn = _e.length, kn = 1 / 0, Kn, er; --Sn >= 0; )
    _e[Sn].defined !== !1 && (er = Math.abs(_e[Sn][$n] - Zt), er < kn && (kn = er, Kn = _e[Sn]));
  return Kn;
}
function pickLine(_e, Qt) {
  for (var Zt = Math.pow(_e[0].strokeWidth || 1, 2), $n = _e.length, Sn, kn, Kn; --$n >= 0; )
    if (_e[$n].defined !== !1 && (Sn = _e[$n].x - Qt[0], kn = _e[$n].y - Qt[1], Kn = Sn * Sn + kn * kn, Kn < Zt))
      return _e[$n];
  return null;
}
function pickTrail(_e, Qt) {
  for (var Zt = _e.length, $n, Sn, kn; --Zt >= 0; )
    if (_e[Zt].defined !== !1 && ($n = _e[Zt].x - Qt[0], Sn = _e[Zt].y - Qt[1], kn = $n * $n + Sn * Sn, $n = _e[Zt].size || 1, kn < $n * $n))
      return _e[Zt];
  return null;
}
function markMultiItemPath(_e, Qt, Zt) {
  function $n(Cr, kr) {
    var Yr = kr.mark.items;
    Yr.length && Cr("d", Qt(null, Yr));
  }
  function Sn(Cr, kr) {
    var Yr = kr.items;
    return Yr.length === 0 ? Cr : (Qt(boundContext(Cr), Yr), boundStroke(Cr, Yr[0]));
  }
  function kn(Cr, kr) {
    Cr.beginPath(), Qt(Cr, kr);
  }
  const Kn = hitPath(kn);
  function er(Cr, kr, Yr, Ms, Ds, Ls) {
    var js = kr.items, zs = kr.bounds;
    return !js || !js.length || zs && !zs.contains(Ds, Ls) ? null : (Yr *= Cr.pixelRatio, Ms *= Cr.pixelRatio, Kn(Cr, js, Yr, Ms) ? js[0] : null);
  }
  return {
    type: _e,
    tag: "path",
    nested: !0,
    attr: $n,
    bound: Sn,
    draw: drawOne(kn),
    pick: er,
    isect: intersectPoint,
    tip: Zt
  };
}
var area$2 = markMultiItemPath("area", area$1$1, pickArea);
function clip$3(_e, Qt) {
  var Zt = Qt.clip;
  _e.save(), isFunction$1(Zt) ? (_e.beginPath(), Zt(_e), _e.clip()) : clipGroup(_e, Qt.group);
}
function clipGroup(_e, Qt) {
  _e.beginPath(), hasCornerRadius(Qt) ? rectangle(_e, Qt, 0, 0) : _e.rect(0, 0, Qt.width || 0, Qt.height || 0), _e.clip();
}
function offset$1$1(_e) {
  const Qt = value$2(_e.strokeWidth, 1);
  return _e.strokeOffset != null ? _e.strokeOffset : _e.stroke && Qt > 0.5 && Qt < 1.5 ? 0.5 - Math.abs(Qt - 1) : 0;
}
function attr$5(_e, Qt) {
  _e("transform", translateItem(Qt));
}
function emitRectangle(_e, Qt) {
  const Zt = offset$1$1(Qt);
  _e("d", rectangle(null, Qt, Zt, Zt));
}
function background$1(_e, Qt) {
  _e("class", "background"), _e("aria-hidden", !0), emitRectangle(_e, Qt);
}
function foreground(_e, Qt) {
  _e("class", "foreground"), _e("aria-hidden", !0), Qt.strokeForeground ? emitRectangle(_e, Qt) : _e("d", "");
}
function content(_e, Qt, Zt) {
  const $n = Qt.clip ? clip$1$1(Zt, Qt, Qt) : null;
  _e("clip-path", $n);
}
function bound$5(_e, Qt) {
  if (!Qt.clip && Qt.items) {
    const Zt = Qt.items, $n = Zt.length;
    for (let Sn = 0; Sn < $n; ++Sn)
      _e.union(Zt[Sn].bounds);
  }
  return (Qt.clip || Qt.width || Qt.height) && !Qt.noBound && _e.add(0, 0).add(Qt.width || 0, Qt.height || 0), boundStroke(_e, Qt), _e.translate(Qt.x || 0, Qt.y || 0);
}
function rectanglePath(_e, Qt, Zt, $n) {
  const Sn = offset$1$1(Qt);
  _e.beginPath(), rectangle(_e, Qt, (Zt || 0) + Sn, ($n || 0) + Sn);
}
const hitBackground = hitPath(rectanglePath), hitForeground = hitPath(rectanglePath, !1), hitCorner = hitPath(rectanglePath, !0);
function draw$4(_e, Qt, Zt) {
  visit(Qt, ($n) => {
    const Sn = $n.x || 0, kn = $n.y || 0, Kn = $n.strokeForeground, er = $n.opacity == null ? 1 : $n.opacity;
    ($n.stroke || $n.fill) && er && (rectanglePath(_e, $n, Sn, kn), blend(_e, $n), $n.fill && fill(_e, $n, er) && _e.fill(), $n.stroke && !Kn && stroke(_e, $n, er) && _e.stroke()), _e.save(), _e.translate(Sn, kn), $n.clip && clipGroup(_e, $n), Zt && Zt.translate(-Sn, -kn), visit($n, (Cr) => {
      this.draw(_e, Cr, Zt);
    }), Zt && Zt.translate(Sn, kn), _e.restore(), Kn && $n.stroke && er && (rectanglePath(_e, $n, Sn, kn), blend(_e, $n), stroke(_e, $n, er) && _e.stroke());
  });
}
function pick(_e, Qt, Zt, $n, Sn, kn) {
  if (Qt.bounds && !Qt.bounds.contains(Sn, kn) || !Qt.items)
    return null;
  const Kn = Zt * _e.pixelRatio, er = $n * _e.pixelRatio;
  return pickVisit(Qt, (Cr) => {
    let kr, Yr, Ms;
    const Ds = Cr.bounds;
    if (Ds && !Ds.contains(Sn, kn))
      return;
    Yr = Cr.x || 0, Ms = Cr.y || 0;
    const Ls = Yr + (Cr.width || 0), js = Ms + (Cr.height || 0), zs = Cr.clip;
    if (zs && (Sn < Yr || Sn > Ls || kn < Ms || kn > js))
      return;
    if (_e.save(), _e.translate(Yr, Ms), Yr = Sn - Yr, Ms = kn - Ms, zs && hasCornerRadius(Cr) && !hitCorner(_e, Cr, Kn, er))
      return _e.restore(), null;
    const Fs = Cr.strokeForeground, Bs = Qt.interactive !== !1;
    return Bs && Fs && Cr.stroke && hitForeground(_e, Cr, Kn, er) ? (_e.restore(), Cr) : (kr = pickVisit(Cr, (Hs) => pickMark(Hs, Yr, Ms) ? this.pick(Hs, Zt, $n, Yr, Ms) : null), !kr && Bs && (Cr.fill || !Fs && Cr.stroke) && hitBackground(_e, Cr, Kn, er) && (kr = Cr), _e.restore(), kr || null);
  });
}
function pickMark(_e, Qt, Zt) {
  return (_e.interactive !== !1 || _e.marktype === "group") && _e.bounds && _e.bounds.contains(Qt, Zt);
}
var group = {
  type: "group",
  tag: "g",
  nested: !1,
  attr: attr$5,
  bound: bound$5,
  draw: draw$4,
  pick,
  isect: intersectRect,
  content,
  background: background$1,
  foreground
}, metadata = {
  xmlns: "http://www.w3.org/2000/svg",
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
  version: "1.1"
};
function getImage(_e, Qt) {
  var Zt = _e.image;
  return (!Zt || _e.url && _e.url !== Zt.url) && (Zt = {
    complete: !1,
    width: 0,
    height: 0
  }, Qt.loadImage(_e.url).then(($n) => {
    _e.image = $n, _e.image.url = _e.url;
  })), Zt;
}
function imageWidth(_e, Qt) {
  return _e.width != null ? _e.width : !Qt || !Qt.width ? 0 : _e.aspect !== !1 && _e.height ? _e.height * Qt.width / Qt.height : Qt.width;
}
function imageHeight(_e, Qt) {
  return _e.height != null ? _e.height : !Qt || !Qt.height ? 0 : _e.aspect !== !1 && _e.width ? _e.width * Qt.height / Qt.width : Qt.height;
}
function imageXOffset(_e, Qt) {
  return _e === "center" ? Qt / 2 : _e === "right" ? Qt : 0;
}
function imageYOffset(_e, Qt) {
  return _e === "middle" ? Qt / 2 : _e === "bottom" ? Qt : 0;
}
function attr$4(_e, Qt, Zt) {
  const $n = getImage(Qt, Zt), Sn = imageWidth(Qt, $n), kn = imageHeight(Qt, $n), Kn = (Qt.x || 0) - imageXOffset(Qt.align, Sn), er = (Qt.y || 0) - imageYOffset(Qt.baseline, kn), Cr = !$n.src && $n.toDataURL ? $n.toDataURL() : $n.src || "";
  _e("href", Cr, metadata["xmlns:xlink"], "xlink:href"), _e("transform", translate$2(Kn, er)), _e("width", Sn), _e("height", kn), _e("preserveAspectRatio", Qt.aspect === !1 ? "none" : "xMidYMid");
}
function bound$4(_e, Qt) {
  const Zt = Qt.image, $n = imageWidth(Qt, Zt), Sn = imageHeight(Qt, Zt), kn = (Qt.x || 0) - imageXOffset(Qt.align, $n), Kn = (Qt.y || 0) - imageYOffset(Qt.baseline, Sn);
  return _e.set(kn, Kn, kn + $n, Kn + Sn);
}
function draw$3(_e, Qt, Zt) {
  visit(Qt, ($n) => {
    if (Zt && !Zt.intersects($n.bounds))
      return;
    const Sn = getImage($n, this);
    let kn = imageWidth($n, Sn), Kn = imageHeight($n, Sn);
    if (kn === 0 || Kn === 0)
      return;
    let er = ($n.x || 0) - imageXOffset($n.align, kn), Cr = ($n.y || 0) - imageYOffset($n.baseline, Kn), kr, Yr, Ms, Ds;
    $n.aspect !== !1 && (Yr = Sn.width / Sn.height, Ms = $n.width / $n.height, Yr === Yr && Ms === Ms && Yr !== Ms && (Ms < Yr ? (Ds = kn / Yr, Cr += (Kn - Ds) / 2, Kn = Ds) : (Ds = Kn * Yr, er += (kn - Ds) / 2, kn = Ds))), (Sn.complete || Sn.toDataURL) && (blend(_e, $n), _e.globalAlpha = (kr = $n.opacity) != null ? kr : 1, _e.imageSmoothingEnabled = $n.smooth !== !1, _e.drawImage(Sn, er, Cr, kn, Kn));
  });
}
var image$1 = {
  type: "image",
  tag: "image",
  nested: !1,
  attr: attr$4,
  bound: bound$4,
  draw: draw$3,
  pick: pick$1(),
  isect: truthy,
  // bounds check is sufficient
  get: getImage,
  xOffset: imageXOffset,
  yOffset: imageYOffset
}, line$2 = markMultiItemPath("line", line$1$1, pickLine);
function attr$3(_e, Qt) {
  var Zt = Qt.scaleX || 1, $n = Qt.scaleY || 1;
  (Zt !== 1 || $n !== 1) && _e("vector-effect", "non-scaling-stroke"), _e("transform", transformItem(Qt)), _e("d", Qt.path);
}
function path$1(_e, Qt) {
  var Zt = Qt.path;
  if (Zt == null)
    return !0;
  var $n = Qt.x || 0, Sn = Qt.y || 0, kn = Qt.scaleX || 1, Kn = Qt.scaleY || 1, er = (Qt.angle || 0) * DegToRad, Cr = Qt.pathCache;
  (!Cr || Cr.path !== Zt) && ((Qt.pathCache = Cr = parse$4(Zt)).path = Zt), er && _e.rotate && _e.translate ? (_e.translate($n, Sn), _e.rotate(er), pathRender(_e, Cr, 0, 0, kn, Kn), _e.rotate(-er), _e.translate(-$n, -Sn)) : pathRender(_e, Cr, $n, Sn, kn, Kn);
}
function bound$3(_e, Qt) {
  return path$1(boundContext(_e, Qt.angle), Qt) ? _e.set(0, 0, 0, 0) : boundStroke(_e, Qt, !0);
}
var path$2 = {
  type: "path",
  tag: "path",
  nested: !1,
  attr: attr$3,
  bound: bound$3,
  draw: drawAll(path$1),
  pick: pickPath(path$1),
  isect: intersectPath(path$1)
};
function attr$2(_e, Qt) {
  _e("d", rectangle(null, Qt));
}
function bound$2(_e, Qt) {
  var Zt, $n;
  return boundStroke(_e.set(Zt = Qt.x || 0, $n = Qt.y || 0, Zt + Qt.width || 0, $n + Qt.height || 0), Qt);
}
function draw$2(_e, Qt) {
  _e.beginPath(), rectangle(_e, Qt);
}
var rect$1 = {
  type: "rect",
  tag: "path",
  nested: !1,
  attr: attr$2,
  bound: bound$2,
  draw: drawAll(draw$2),
  pick: pickPath(draw$2),
  isect: intersectRect
};
function attr$1(_e, Qt) {
  _e("transform", translateItem(Qt)), _e("x2", Qt.x2 != null ? Qt.x2 - (Qt.x || 0) : 0), _e("y2", Qt.y2 != null ? Qt.y2 - (Qt.y || 0) : 0);
}
function bound$1(_e, Qt) {
  var Zt, $n;
  return boundStroke(_e.set(Zt = Qt.x || 0, $n = Qt.y || 0, Qt.x2 != null ? Qt.x2 : Zt, Qt.y2 != null ? Qt.y2 : $n), Qt);
}
function path(_e, Qt, Zt) {
  var $n, Sn, kn, Kn;
  return Qt.stroke && stroke(_e, Qt, Zt) ? ($n = Qt.x || 0, Sn = Qt.y || 0, kn = Qt.x2 != null ? Qt.x2 : $n, Kn = Qt.y2 != null ? Qt.y2 : Sn, _e.beginPath(), _e.moveTo($n, Sn), _e.lineTo(kn, Kn), !0) : !1;
}
function draw$1(_e, Qt, Zt) {
  visit(Qt, ($n) => {
    if (!(Zt && !Zt.intersects($n.bounds))) {
      var Sn = $n.opacity == null ? 1 : $n.opacity;
      Sn && path(_e, $n, Sn) && (blend(_e, $n), _e.stroke());
    }
  });
}
function hit$1(_e, Qt, Zt, $n) {
  return _e.isPointInStroke ? path(_e, Qt, 1) && _e.isPointInStroke(Zt, $n) : !1;
}
var rule$2 = {
  type: "rule",
  tag: "line",
  nested: !1,
  attr: attr$1,
  bound: bound$1,
  draw: draw$1,
  pick: pick$1(hit$1),
  isect: intersectRule
}, shape = markItemPath("shape", shape$1), symbol = markItemPath("symbol", symbol$1, intersectPoint);
const widthCache = lruCache$1();
var textMetrics = {
  height: fontSize,
  measureWidth,
  estimateWidth,
  width: estimateWidth,
  canvas: useCanvas
};
useCanvas(!0);
function useCanvas(_e) {
  textMetrics.width = _e && context$2 ? measureWidth : estimateWidth;
}
function estimateWidth(_e, Qt) {
  return _estimateWidth(textValue(_e, Qt), fontSize(_e));
}
function _estimateWidth(_e, Qt) {
  return ~~(0.8 * _e.length * Qt);
}
function measureWidth(_e, Qt) {
  return fontSize(_e) <= 0 || !(Qt = textValue(_e, Qt)) ? 0 : _measureWidth(Qt, font$1(_e));
}
function _measureWidth(_e, Qt) {
  const Zt = `(${Qt}) ${_e}`;
  let $n = widthCache.get(Zt);
  return $n === void 0 && (context$2.font = Qt, $n = context$2.measureText(_e).width, widthCache.set(Zt, $n)), $n;
}
function fontSize(_e) {
  return _e.fontSize != null ? +_e.fontSize || 0 : 11;
}
function lineHeight(_e) {
  return _e.lineHeight != null ? _e.lineHeight : fontSize(_e) + 2;
}
function lineArray(_e) {
  return isArray(_e) ? _e.length > 1 ? _e : _e[0] : _e;
}
function textLines(_e) {
  return lineArray(_e.lineBreak && _e.text && !isArray(_e.text) ? _e.text.split(_e.lineBreak) : _e.text);
}
function multiLineOffset(_e) {
  const Qt = textLines(_e);
  return (isArray(Qt) ? Qt.length - 1 : 0) * lineHeight(_e);
}
function textValue(_e, Qt) {
  const Zt = Qt == null ? "" : (Qt + "").trim();
  return _e.limit > 0 && Zt.length ? truncate(_e, Zt) : Zt;
}
function widthGetter(_e) {
  if (textMetrics.width === measureWidth) {
    const Qt = font$1(_e);
    return (Zt) => _measureWidth(Zt, Qt);
  } else {
    const Qt = fontSize(_e);
    return (Zt) => _estimateWidth(Zt, Qt);
  }
}
function truncate(_e, Qt) {
  var Zt = +_e.limit, $n = widthGetter(_e);
  if ($n(Qt) < Zt)
    return Qt;
  var Sn = _e.ellipsis || "…", kn = _e.dir === "rtl", Kn = 0, er = Qt.length, Cr;
  if (Zt -= $n(Sn), kn) {
    for (; Kn < er; )
      Cr = Kn + er >>> 1, $n(Qt.slice(Cr)) > Zt ? Kn = Cr + 1 : er = Cr;
    return Sn + Qt.slice(Kn);
  } else {
    for (; Kn < er; )
      Cr = 1 + (Kn + er >>> 1), $n(Qt.slice(0, Cr)) < Zt ? Kn = Cr : er = Cr - 1;
    return Qt.slice(0, Kn) + Sn;
  }
}
function fontFamily(_e, Qt) {
  var Zt = _e.font;
  return (Qt && Zt ? String(Zt).replace(/"/g, "'") : Zt) || "sans-serif";
}
function font$1(_e, Qt) {
  return (_e.fontStyle ? _e.fontStyle + " " : "") + (_e.fontVariant ? _e.fontVariant + " " : "") + (_e.fontWeight ? _e.fontWeight + " " : "") + fontSize(_e) + "px " + fontFamily(_e, Qt);
}
function offset$2(_e) {
  var Qt = _e.baseline, Zt = fontSize(_e);
  return Math.round(Qt === "top" ? 0.79 * Zt : Qt === "middle" ? 0.3 * Zt : Qt === "bottom" ? -0.21 * Zt : Qt === "line-top" ? 0.29 * Zt + 0.5 * lineHeight(_e) : Qt === "line-bottom" ? 0.29 * Zt - 0.5 * lineHeight(_e) : 0);
}
const textAlign = {
  left: "start",
  center: "middle",
  right: "end"
}, tempBounds$1 = new Bounds();
function anchorPoint(_e) {
  var Qt = _e.x || 0, Zt = _e.y || 0, $n = _e.radius || 0, Sn;
  return $n && (Sn = (_e.theta || 0) - HalfPi, Qt += $n * Math.cos(Sn), Zt += $n * Math.sin(Sn)), tempBounds$1.x1 = Qt, tempBounds$1.y1 = Zt, tempBounds$1;
}
function attr(_e, Qt) {
  var Zt = Qt.dx || 0, $n = (Qt.dy || 0) + offset$2(Qt), Sn = anchorPoint(Qt), kn = Sn.x1, Kn = Sn.y1, er = Qt.angle || 0, Cr;
  _e("text-anchor", textAlign[Qt.align] || "start"), er ? (Cr = translate$2(kn, Kn) + " " + rotate(er), (Zt || $n) && (Cr += " " + translate$2(Zt, $n))) : Cr = translate$2(kn + Zt, Kn + $n), _e("transform", Cr);
}
function bound(_e, Qt, Zt) {
  var $n = textMetrics.height(Qt), Sn = Qt.align, kn = anchorPoint(Qt), Kn = kn.x1, er = kn.y1, Cr = Qt.dx || 0, kr = (Qt.dy || 0) + offset$2(Qt) - Math.round(0.8 * $n), Yr = textLines(Qt), Ms;
  if (isArray(Yr) ? ($n += lineHeight(Qt) * (Yr.length - 1), Ms = Yr.reduce((Ds, Ls) => Math.max(Ds, textMetrics.width(Qt, Ls)), 0)) : Ms = textMetrics.width(Qt, Yr), Sn === "center" ? Cr -= Ms / 2 : Sn === "right" && (Cr -= Ms), _e.set(Cr += Kn, kr += er, Cr + Ms, kr + $n), Qt.angle && !Zt)
    _e.rotate(Qt.angle * DegToRad, Kn, er);
  else if (Zt === 2)
    return _e.rotatedPoints(Qt.angle * DegToRad, Kn, er);
  return _e;
}
function draw$5(_e, Qt, Zt) {
  visit(Qt, ($n) => {
    var Sn = $n.opacity == null ? 1 : $n.opacity, kn, Kn, er, Cr, kr, Yr, Ms;
    if (!(Zt && !Zt.intersects($n.bounds) || // bounds check
    Sn === 0 || $n.fontSize <= 0 || $n.text == null || $n.text.length === 0)) {
      if (_e.font = font$1($n), _e.textAlign = $n.align || "left", kn = anchorPoint($n), Kn = kn.x1, er = kn.y1, $n.angle && (_e.save(), _e.translate(Kn, er), _e.rotate($n.angle * DegToRad), Kn = er = 0), Kn += $n.dx || 0, er += ($n.dy || 0) + offset$2($n), Yr = textLines($n), blend(_e, $n), isArray(Yr))
        for (kr = lineHeight($n), Cr = 0; Cr < Yr.length; ++Cr)
          Ms = textValue($n, Yr[Cr]), $n.fill && fill(_e, $n, Sn) && _e.fillText(Ms, Kn, er), $n.stroke && stroke(_e, $n, Sn) && _e.strokeText(Ms, Kn, er), er += kr;
      else
        Ms = textValue($n, Yr), $n.fill && fill(_e, $n, Sn) && _e.fillText(Ms, Kn, er), $n.stroke && stroke(_e, $n, Sn) && _e.strokeText(Ms, Kn, er);
      $n.angle && _e.restore();
    }
  });
}
function hit(_e, Qt, Zt, $n, Sn, kn) {
  if (Qt.fontSize <= 0)
    return !1;
  if (!Qt.angle)
    return !0;
  var Kn = anchorPoint(Qt), er = Kn.x1, Cr = Kn.y1, kr = bound(tempBounds$1, Qt, 1), Yr = -Qt.angle * DegToRad, Ms = Math.cos(Yr), Ds = Math.sin(Yr), Ls = Ms * Sn - Ds * kn + (er - Ms * er + Ds * Cr), js = Ds * Sn + Ms * kn + (Cr - Ds * er - Ms * Cr);
  return kr.contains(Ls, js);
}
function intersectText(_e, Qt) {
  const Zt = bound(tempBounds$1, _e, 2);
  return intersectBoxLine(Qt, Zt[0], Zt[1], Zt[2], Zt[3]) || intersectBoxLine(Qt, Zt[0], Zt[1], Zt[4], Zt[5]) || intersectBoxLine(Qt, Zt[4], Zt[5], Zt[6], Zt[7]) || intersectBoxLine(Qt, Zt[2], Zt[3], Zt[6], Zt[7]);
}
var text$2 = {
  type: "text",
  tag: "text",
  nested: !1,
  attr,
  bound,
  draw: draw$5,
  pick: pick$1(hit),
  isect: intersectText
}, trail$2 = markMultiItemPath("trail", trail$1, pickTrail), Marks = {
  arc: arc$2,
  area: area$2,
  group,
  image: image$1,
  line: line$2,
  path: path$2,
  rect: rect$1,
  rule: rule$2,
  shape,
  symbol,
  text: text$2,
  trail: trail$2
};
function boundItem$1(_e, Qt, Zt) {
  var $n = Marks[_e.mark.marktype], Sn = Qt || $n.bound;
  return $n.nested && (_e = _e.mark), Sn(_e.bounds || (_e.bounds = new Bounds()), _e, Zt);
}
var DUMMY = {
  mark: null
};
function boundMark(_e, Qt, Zt) {
  var $n = Marks[_e.marktype], Sn = $n.bound, kn = _e.items, Kn = kn && kn.length, er, Cr, kr, Yr;
  if ($n.nested)
    return Kn ? kr = kn[0] : (DUMMY.mark = _e, kr = DUMMY), Yr = boundItem$1(kr, Sn, Zt), Qt = Qt && Qt.union(Yr) || Yr, Qt;
  if (Qt = Qt || _e.bounds && _e.bounds.clear() || new Bounds(), Kn)
    for (er = 0, Cr = kn.length; er < Cr; ++er)
      Qt.union(boundItem$1(kn[er], Sn, Zt));
  return _e.bounds = Qt;
}
const keys$1 = [
  "marktype",
  "name",
  "role",
  "interactive",
  "clip",
  "items",
  "zindex",
  "x",
  "y",
  "width",
  "height",
  "align",
  "baseline",
  // layout
  "fill",
  "fillOpacity",
  "opacity",
  "blend",
  // fill
  "stroke",
  "strokeOpacity",
  "strokeWidth",
  "strokeCap",
  // stroke
  "strokeDash",
  "strokeDashOffset",
  // stroke dash
  "strokeForeground",
  "strokeOffset",
  // group
  "startAngle",
  "endAngle",
  "innerRadius",
  "outerRadius",
  // arc
  "cornerRadius",
  "padAngle",
  // arc, rect
  "cornerRadiusTopLeft",
  "cornerRadiusTopRight",
  // rect, group
  "cornerRadiusBottomLeft",
  "cornerRadiusBottomRight",
  "interpolate",
  "tension",
  "orient",
  "defined",
  // area, line
  "url",
  "aspect",
  "smooth",
  // image
  "path",
  "scaleX",
  "scaleY",
  // path
  "x2",
  "y2",
  // rule
  "size",
  "shape",
  // symbol
  "text",
  "angle",
  "theta",
  "radius",
  "dir",
  "dx",
  "dy",
  // text
  "ellipsis",
  "limit",
  "lineBreak",
  "lineHeight",
  "font",
  "fontSize",
  "fontWeight",
  "fontStyle",
  "fontVariant",
  // font
  "description",
  "aria",
  "ariaRole",
  "ariaRoleDescription"
  // aria
];
function sceneToJSON(_e, Qt) {
  return JSON.stringify(_e, keys$1, Qt);
}
function sceneFromJSON(_e) {
  const Qt = typeof _e == "string" ? JSON.parse(_e) : _e;
  return initialize$1(Qt);
}
function initialize$1(_e) {
  var Qt = _e.marktype, Zt = _e.items, $n, Sn, kn;
  if (Zt)
    for (Sn = 0, kn = Zt.length; Sn < kn; ++Sn)
      $n = Qt ? "mark" : "group", Zt[Sn][$n] = _e, Zt[Sn].zindex && (Zt[Sn][$n].zdirty = !0), (Qt || $n) === "group" && initialize$1(Zt[Sn]);
  return Qt && boundMark(_e), _e;
}
function Scenegraph(_e) {
  arguments.length ? this.root = sceneFromJSON(_e) : (this.root = createMark({
    marktype: "group",
    name: "root",
    role: "frame"
  }), this.root.items = [new GroupItem(this.root)]);
}
Scenegraph.prototype = {
  toJSON(_e) {
    return sceneToJSON(this.root, _e || 0);
  },
  mark(_e, Qt, Zt) {
    Qt = Qt || this.root.items[0];
    const $n = createMark(_e, Qt);
    return Qt.items[Zt] = $n, $n.zindex && ($n.group.zdirty = !0), $n;
  }
};
function createMark(_e, Qt) {
  const Zt = {
    bounds: new Bounds(),
    clip: !!_e.clip,
    group: Qt,
    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 && (Zt.aria = _e.aria), _e.description && (Zt.description = _e.description), Zt;
}
function domCreate(_e, Qt, Zt) {
  return !_e && typeof document < "u" && document.createElement && (_e = document), _e ? Zt ? _e.createElementNS(Zt, Qt) : _e.createElement(Qt) : null;
}
function domFind(_e, Qt) {
  Qt = Qt.toLowerCase();
  for (var Zt = _e.childNodes, $n = 0, Sn = Zt.length; $n < Sn; ++$n)
    if (Zt[$n].tagName.toLowerCase() === Qt)
      return Zt[$n];
}
function domChild(_e, Qt, Zt, $n) {
  var Sn = _e.childNodes[Qt], kn;
  return (!Sn || Sn.tagName.toLowerCase() !== Zt.toLowerCase()) && (kn = Sn || null, Sn = domCreate(_e.ownerDocument, Zt, $n), _e.insertBefore(Sn, kn)), Sn;
}
function domClear(_e, Qt) {
  for (var Zt = _e.childNodes, $n = Zt.length; $n > Qt; )
    _e.removeChild(Zt[--$n]);
  return _e;
}
function cssClass(_e) {
  return "mark-" + _e.marktype + (_e.role ? " role-" + _e.role : "") + (_e.name ? " " + _e.name : "");
}
function point$2(_e, Qt) {
  const Zt = Qt.getBoundingClientRect();
  return [_e.clientX - Zt.left - (Qt.clientLeft || 0), _e.clientY - Zt.top - (Qt.clientTop || 0)];
}
function resolveItem(_e, Qt, Zt, $n) {
  var Sn = _e && _e.mark, kn, Kn;
  if (Sn && (kn = Marks[Sn.marktype]).tip) {
    for (Kn = point$2(Qt, Zt), Kn[0] -= $n[0], Kn[1] -= $n[1]; _e = _e.mark.group; )
      Kn[0] -= _e.x || 0, Kn[1] -= _e.y || 0;
    _e = kn.tip(Sn.items, Kn);
  }
  return _e;
}
function Handler$1(_e, Qt) {
  this._active = null, this._handlers = {}, this._loader = _e || loader(), this._tooltip = Qt || defaultTooltip$1;
}
function defaultTooltip$1(_e, Qt, Zt, $n) {
  _e.element().setAttribute("title", $n || "");
}
Handler$1.prototype = {
  /**
   * Initialize a new Handler instance.
   * @param {DOMElement} el - The containing DOM element for the display.
   * @param {Array<number>} origin - The origin of the display, in pixels.
   *   The coordinate system will be translated to this point.
   * @param {object} [obj] - Optional context object that should serve as
   *   the "this" context for event callbacks.
   * @return {Handler} - This handler instance.
   */
  initialize(_e, Qt, Zt) {
    return this._el = _e, this._obj = Zt || null, this.origin(Qt);
  },
  /**
   * Returns the parent container element for a visualization.
   * @return {DOMElement} - The containing DOM element.
   */
  element() {
    return this._el;
  },
  /**
   * Returns the scene element (e.g., canvas or SVG) of the visualization
   * Subclasses must override if the first child is not the scene element.
   * @return {DOMElement} - The scene (e.g., canvas or SVG) element.
   */
  canvas() {
    return this._el && this._el.firstChild;
  },
  /**
   * Get / set the origin coordinates of the visualization.
   */
  origin(_e) {
    return arguments.length ? (this._origin = _e || [0, 0], this) : this._origin.slice();
  },
  /**
   * Get / set the scenegraph root.
   */
  scene(_e) {
    return arguments.length ? (this._scene = _e, this) : this._scene;
  },
  /**
   * Add an event handler. Subclasses should override this method.
   */
  on() {
  },
  /**
   * Remove an event handler. Subclasses should override this method.
   */
  off() {
  },
  /**
   * Utility method for finding the array index of an event handler.
   * @param {Array} h - An array of registered event handlers.
   * @param {string} type - The event type.
   * @param {function} handler - The event handler instance to find.
   * @return {number} - The handler's array index or -1 if not registered.
   */
  _handlerIndex(_e, Qt, Zt) {
    for (let $n = _e ? _e.length : 0; --$n >= 0; )
      if (_e[$n].type === Qt && (!Zt || _e[$n].handler === Zt))
        return $n;
    return -1;
  },
  /**
   * Returns an array with registered event handlers.
   * @param {string} [type] - The event type to query. Any annotations
   *   are ignored; for example, for the argument "click.foo", ".foo" will
   *   be ignored and the method returns all "click" handlers. If type is
   *   null or unspecified, this method returns handlers for all types.
   * @return {Array} - A new array containing all registered event handlers.
   */
  handlers(_e) {
    const Qt = this._handlers, Zt = [];
    if (_e)
      Zt.push(...Qt[this.eventName(_e)]);
    else
      for (const $n in Qt)
        Zt.push(...Qt[$n]);
    return Zt;
  },
  /**
   * Parses an event name string to return the specific event type.
   * For example, given "click.foo" returns "click"
   * @param {string} name - The input event type string.
   * @return {string} - A string with the event type only.
   */
  eventName(_e) {
    const Qt = _e.indexOf(".");
    return Qt < 0 ? _e : _e.slice(0, Qt);
  },
  /**
   * Handle hyperlink navigation in response to an item.href value.
   * @param {Event} event - The event triggering hyperlink navigation.
   * @param {Item} item - The scenegraph item.
   * @param {string} href - The URL to navigate to.
   */
  handleHref(_e, Qt, Zt) {
    this._loader.sanitize(Zt, {
      context: "href"
    }).then(($n) => {
      const Sn = new MouseEvent(_e.type, _e), kn = domCreate(null, "a");
      for (const Kn in $n)
        kn.setAttribute(Kn, $n[Kn]);
      kn.dispatchEvent(Sn);
    }).catch(() => {
    });
  },
  /**
   * Handle tooltip display in response to an item.tooltip value.
   * @param {Event} event - The event triggering tooltip display.
   * @param {Item} item - The scenegraph item.
   * @param {boolean} show - A boolean flag indicating whether
   *   to show or hide a tooltip for the given item.
   */
  handleTooltip(_e, Qt, Zt) {
    if (Qt && Qt.tooltip != null) {
      Qt = resolveItem(Qt, _e, this.canvas(), this._origin);
      const $n = Zt && Qt && Qt.tooltip || null;
      this._tooltip.call(this._obj, this, _e, Qt, $n);
    }
  },
  /**
   * Returns the size of a scenegraph item and its position relative
   * to the viewport.
   * @param {Item} item - The scenegraph item.
   * @return {object} - A bounding box object (compatible with the
   *   DOMRect type) consisting of x, y, width, heigh, top, left,
   *   right, and bottom properties.
   */
  getItemBoundingClientRect(_e) {
    const Qt = this.canvas();
    if (!Qt)
      return;
    const Zt = Qt.getBoundingClientRect(), $n = this._origin, Sn = _e.bounds, kn = Sn.width(), Kn = Sn.height();
    let er = Sn.x1 + $n[0] + Zt.left, Cr = Sn.y1 + $n[1] + Zt.top;
    for (; _e.mark && (_e = _e.mark.group); )
      er += _e.x || 0, Cr += _e.y || 0;
    return {
      x: er,
      y: Cr,
      width: kn,
      height: Kn,
      left: er,
      top: Cr,
      right: er + kn,
      bottom: Cr + Kn
    };
  }
};
function Renderer(_e) {
  this._el = null, this._bgcolor = null, this._loader = new ResourceLoader(_e);
}
Renderer.prototype = {
  /**
   * Initialize a new Renderer instance.
   * @param {DOMElement} el - The containing DOM element for the display.
   * @param {number} width - The coordinate width of the display, in pixels.
   * @param {number} height - The coordinate height of the display, in pixels.
   * @param {Array<number>} origin - The origin of the display, in pixels.
   *   The coordinate system will be translated to this point.
   * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply
   *   the width and height to determine the final pixel size.
   * @return {Renderer} - This renderer instance.
   */
  initialize(_e, Qt, Zt, $n, Sn) {
    return this._el = _e, this.resize(Qt, Zt, $n, Sn);
  },
  /**
   * Returns the parent container element for a visualization.
   * @return {DOMElement} - The containing DOM element.
   */
  element() {
    return this._el;
  },
  /**
   * Returns the scene element (e.g., canvas or SVG) of the visualization
   * Subclasses must override if the first child is not the scene element.
   * @return {DOMElement} - The scene (e.g., canvas or SVG) element.
   */
  canvas() {
    return this._el && this._el.firstChild;
  },
  /**
   * Get / set the background color.
   */
  background(_e) {
    return arguments.length === 0 ? this._bgcolor : (this._bgcolor = _e, this);
  },
  /**
   * Resize the display.
   * @param {number} width - The new coordinate width of the display, in pixels.
   * @param {number} height - The new coordinate height of the display, in pixels.
   * @param {Array<number>} origin - The new origin of the display, in pixels.
   *   The coordinate system will be translated to this point.
   * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply
   *   the width and height to determine the final pixel size.
   * @return {Renderer} - This renderer instance;
   */
  resize(_e, Qt, Zt, $n) {
    return this._width = _e, this._height = Qt, this._origin = Zt || [0, 0], this._scale = $n || 1, this;
  },
  /**
   * Report a dirty item whose bounds should be redrawn.
   * This base class method does nothing. Subclasses that perform
   * incremental should implement this method.
   * @param {Item} item - The dirty item whose bounds should be redrawn.
   */
  dirty() {
  },
  /**
   * Render an input scenegraph, potentially with a set of dirty items.
   * This method will perform an immediate rendering with available resources.
   * The renderer may also need to perform image loading to perform a complete
   * render. This process can lead to asynchronous re-rendering of the scene
   * after this method returns. To receive notification when rendering is
   * complete, use the renderAsync method instead.
   * @param {object} scene - The root mark of a scenegraph to render.
   * @return {Renderer} - This renderer instance.
   */
  render(_e) {
    const Qt = this;
    return Qt._call = function() {
      Qt._render(_e);
    }, Qt._call(), Qt._call = null, Qt;
  },
  /**
   * Internal rendering method. Renderer subclasses should override this
   * method to actually perform rendering.
   * @param {object} scene - The root mark of a scenegraph to render.
   */
  _render() {
  },
  /**
   * Asynchronous rendering method. Similar to render, but returns a Promise
   * that resolves when all rendering is completed. Sometimes a renderer must
   * perform image loading to get a complete rendering. The returned
   * Promise will not resolve until this process completes.
   * @param {object} scene - The root mark of a scenegraph to render.
   * @return {Promise} - A Promise that resolves when rendering is complete.
   */
  renderAsync(_e) {
    const Qt = this.render(_e);
    return this._ready ? this._ready.then(() => Qt) : Promise.resolve(Qt);
  },
  /**
   * Internal method for asynchronous resource loading.
   * Proxies method calls to the ImageLoader, and tracks loading
   * progress to invoke a re-render once complete.
   * @param {string} method - The method name to invoke on the ImageLoader.
   * @param {string} uri - The URI for the requested resource.
   * @return {Promise} - A Promise that resolves to the requested resource.
   */
  _load(_e, Qt) {
    var Zt = this, $n = Zt._loader[_e](Qt);
    if (!Zt._ready) {
      const Sn = Zt._call;
      Zt._ready = Zt._loader.ready().then((kn) => {
        kn && Sn(), Zt._ready = null;
      });
    }
    return $n;
  },
  /**
   * Sanitize a URL to include as a hyperlink in the rendered scene.
   * This method proxies a call to ImageLoader.sanitizeURL, but also tracks
   * image loading progress and invokes a re-render once complete.
   * @param {string} uri - The URI string to sanitize.
   * @return {Promise} - A Promise that resolves to the sanitized URL.
   */
  sanitizeURL(_e) {
    return this._load("sanitizeURL", _e);
  },
  /**
   * Requests an image to include in the rendered scene.
   * This method proxies a call to ImageLoader.loadImage, but also tracks
   * image loading progress and invokes a re-render once complete.
   * @param {string} uri - The URI string of the image.
   * @return {Promise} - A Promise that resolves to the loaded Image.
   */
  loadImage(_e) {
    return this._load("loadImage", _e);
  }
};
const KeyDownEvent = "keydown", KeyPressEvent = "keypress", KeyUpEvent = "keyup", DragEnterEvent = "dragenter", DragLeaveEvent = "dragleave", DragOverEvent = "dragover", MouseDownEvent = "mousedown", MouseUpEvent = "mouseup", MouseMoveEvent = "mousemove", MouseOutEvent = "mouseout", MouseOverEvent = "mouseover", ClickEvent = "click", DoubleClickEvent = "dblclick", WheelEvent = "wheel", MouseWheelEvent = "mousewheel", TouchStartEvent = "touchstart", TouchMoveEvent = "touchmove", TouchEndEvent = "touchend", Events = [KeyDownEvent, KeyPressEvent, KeyUpEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, MouseDownEvent, MouseUpEvent, MouseMoveEvent, MouseOutEvent, MouseOverEvent, ClickEvent, DoubleClickEvent, WheelEvent, MouseWheelEvent, TouchStartEvent, TouchMoveEvent, TouchEndEvent], TooltipShowEvent = MouseMoveEvent, TooltipHideEvent = MouseOutEvent, HrefEvent = ClickEvent;
function CanvasHandler(_e, Qt) {
  Handler$1.call(this, _e, Qt), this._down = null, this._touch = null, this._first = !0, this._events = {};
}
const eventBundle = (_e) => _e === TouchStartEvent || _e === TouchMoveEvent || _e === TouchEndEvent ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] : [_e];
function eventListenerCheck(_e, Qt) {
  eventBundle(Qt).forEach((Zt) => addEventListener(_e, Zt));
}
function addEventListener(_e, Qt) {
  const Zt = _e.canvas();
  Zt && !_e._events[Qt] && (_e._events[Qt] = 1, Zt.addEventListener(Qt, _e[Qt] ? ($n) => _e[Qt]($n) : ($n) => _e.fire(Qt, $n)));
}
function move$1(_e, Qt, Zt) {
  return function($n) {
    const Sn = this._active, kn = this.pickEvent($n);
    kn === Sn ? this.fire(_e, $n) : ((!Sn || !Sn.exit) && this.fire(Zt, $n), this._active = kn, this.fire(Qt, $n), this.fire(_e, $n));
  };
}
function inactive(_e) {
  return function(Qt) {
    this.fire(_e, Qt), this._active = null;
  };
}
inherits(CanvasHandler, Handler$1, {
  initialize(_e, Qt, Zt) {
    return this._canvas = _e && domFind(_e, "canvas"), [ClickEvent, MouseDownEvent, MouseMoveEvent, MouseOutEvent, DragLeaveEvent].forEach(($n) => eventListenerCheck(this, $n)), Handler$1.prototype.initialize.call(this, _e, Qt, Zt);
  },
  // return the backing canvas instance
  canvas() {
    return this._canvas;
  },
  // retrieve the current canvas context
  context() {
    return this._canvas.getContext("2d");
  },
  // supported events
  events: Events,
  // to keep old versions of firefox happy
  DOMMouseScroll(_e) {
    this.fire(MouseWheelEvent, _e);
  },
  mousemove: move$1(MouseMoveEvent, MouseOverEvent, MouseOutEvent),
  dragover: move$1(DragOverEvent, DragEnterEvent, DragLeaveEvent),
  mouseout: inactive(MouseOutEvent),
  dragleave: inactive(DragLeaveEvent),
  mousedown(_e) {
    this._down = this._active, this.fire(MouseDownEvent, _e);
  },
  click(_e) {
    this._down === this._active && (this.fire(ClickEvent, _e), this._down = null);
  },
  touchstart(_e) {
    this._touch = this.pickEvent(_e.changedTouches[0]), this._first && (this._active = this._touch, this._first = !1), this.fire(TouchStartEvent, _e, !0);
  },
  touchmove(_e) {
    this.fire(TouchMoveEvent, _e, !0);
  },
  touchend(_e) {
    this.fire(TouchEndEvent, _e, !0), this._touch = null;
  },
  // fire an event
  fire(_e, Qt, Zt) {
    const $n = Zt ? this._touch : this._active, Sn = this._handlers[_e];
    if (Qt.vegaType = _e, _e === HrefEvent && $n && $n.href ? this.handleHref(Qt, $n, $n.href) : (_e === TooltipShowEvent || _e === TooltipHideEvent) && this.handleTooltip(Qt, $n, _e !== TooltipHideEvent), Sn)
      for (let kn = 0, Kn = Sn.length; kn < Kn; ++kn)
        Sn[kn].handler.call(this._obj, Qt, $n);
  },
  // add an event handler
  on(_e, Qt) {
    const Zt = this.eventName(_e), $n = this._handlers;
    return this._handlerIndex($n[Zt], _e, Qt) < 0 && (eventListenerCheck(this, _e), ($n[Zt] || ($n[Zt] = [])).push({
      type: _e,
      handler: Qt
    })), this;
  },
  // remove an event handler
  off(_e, Qt) {
    const Zt = this.eventName(_e), $n = this._handlers[Zt], Sn = this._handlerIndex($n, _e, Qt);
    return Sn >= 0 && $n.splice(Sn, 1), this;
  },
  pickEvent(_e) {
    const Qt = point$2(_e, this._canvas), Zt = this._origin;
    return this.pick(this._scene, Qt[0], Qt[1], Qt[0] - Zt[0], Qt[1] - Zt[1]);
  },
  // find the scenegraph item at the current mouse position
  // x, y -- the absolute x, y mouse coordinates on the canvas element
  // gx, gy -- the relative coordinates within the current group
  pick(_e, Qt, Zt, $n, Sn) {
    const kn = this.context();
    return Marks[_e.marktype].pick.call(this, kn, _e, Qt, Zt, $n, Sn);
  }
});
function devicePixelRatio() {
  return typeof window < "u" && window.devicePixelRatio || 1;
}
var pixelRatio = devicePixelRatio();
function resize(_e, Qt, Zt, $n, Sn, kn) {
  const Kn = typeof HTMLElement < "u" && _e instanceof HTMLElement && _e.parentNode != null, er = _e.getContext("2d"), Cr = Kn ? pixelRatio : Sn;
  _e.width = Qt * Cr, _e.height = Zt * Cr;
  for (const kr in kn)
    er[kr] = kn[kr];
  return Kn && Cr !== 1 && (_e.style.width = Qt + "px", _e.style.height = Zt + "px"), er.pixelRatio = Cr, er.setTransform(Cr, 0, 0, Cr, Cr * $n[0], Cr * $n[1]), _e;
}
function CanvasRenderer(_e) {
  Renderer.call(this, _e), this._options = {}, this._redraw = !1, this._dirty = new Bounds(), this._tempb = new Bounds();
}
const base$1 = Renderer.prototype, viewBounds = (_e, Qt, Zt) => new Bounds().set(0, 0, Qt, Zt).translate(-_e[0], -_e[1]);
function clipToBounds(_e, Qt, Zt) {
  return Qt.expand(1).round(), _e.pixelRatio % 1 && Qt.scale(_e.pixelRatio).round().scale(1 / _e.pixelRatio), Qt.translate(-(Zt[0] % 1), -(Zt[1] % 1)), _e.beginPath(), _e.rect(Qt.x1, Qt.y1, Qt.width(), Qt.height()), _e.clip(), Qt;
}
inherits(CanvasRenderer, Renderer, {
  initialize(_e, Qt, Zt, $n, Sn, kn) {
    return this._options = kn || {}, this._canvas = this._options.externalContext ? null : domCanvas(1, 1, this._options.type), _e && this._canvas && (domClear(_e, 0).appendChild(this._canvas), this._canvas.setAttribute("class", "marks")), base$1.initialize.call(this, _e, Qt, Zt, $n, Sn);
  },
  resize(_e, Qt, Zt, $n) {
    if (base$1.resize.call(this, _e, Qt, Zt, $n), this._canvas)
      resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context);
    else {
      const Sn = this._options.externalContext;
      Sn || error("CanvasRenderer is missing a valid canvas or context"), Sn.scale(this._scale, this._scale), Sn.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 Qt = this._tempb.clear().union(_e.bounds);
    let Zt = _e.mark.group;
    for (; Zt; )
      Qt.translate(Zt.x || 0, Zt.y || 0), Zt = Zt.mark.group;
    this._dirty.union(Qt);
  },
  _render(_e) {
    const Qt = this.context(), Zt = this._origin, $n = this._width, Sn = this._height, kn = this._dirty, Kn = viewBounds(Zt, $n, Sn);
    Qt.save();
    const er = this._redraw || kn.empty() ? (this._redraw = !1, Kn.expand(1)) : clipToBounds(Qt, Kn.intersect(kn), Zt);
    return this.clear(-Zt[0], -Zt[1], $n, Sn), this.draw(Qt, _e, er), Qt.restore(), kn.clear(), this;
  },
  draw(_e, Qt, Zt) {
    const $n = Marks[Qt.marktype];
    Qt.clip && clip$3(_e, Qt), $n.draw.call(this, _e, Qt, Zt), Qt.clip && _e.restore();
  },
  clear(_e, Qt, Zt, $n) {
    const Sn = this._options, kn = this.context();
    Sn.type !== "pdf" && !Sn.externalContext && kn.clearRect(_e, Qt, Zt, $n), this._bgcolor != null && (kn.fillStyle = this._bgcolor, kn.fillRect(_e, Qt, Zt, $n));
  }
});
function SVGHandler(_e, Qt) {
  Handler$1.call(this, _e, Qt);
  const Zt = this;
  Zt._hrefHandler = listener(Zt, ($n, Sn) => {
    Sn && Sn.href && Zt.handleHref($n, Sn, Sn.href);
  }), Zt._tooltipHandler = listener(Zt, ($n, Sn) => {
    Zt.handleTooltip($n, Sn, $n.type !== TooltipHideEvent);
  });
}
const listener = (_e, Qt) => (Zt) => {
  let $n = Zt.target.__data__;
  $n = Array.isArray($n) ? $n[0] : $n, Zt.vegaType = Zt.type, Qt.call(_e._obj, Zt, $n);
};
inherits(SVGHandler, Handler$1, {
  initialize(_e, Qt, Zt) {
    let $n = this._svg;
    return $n && ($n.removeEventListener(HrefEvent, this._hrefHandler), $n.removeEventListener(TooltipShowEvent, this._tooltipHandler), $n.removeEventListener(TooltipHideEvent, this._tooltipHandler)), this._svg = $n = _e && domFind(_e, "svg"), $n && ($n.addEventListener(HrefEvent, this._hrefHandler), $n.addEventListener(TooltipShowEvent, this._tooltipHandler), $n.addEventListener(TooltipHideEvent, this._tooltipHandler)), Handler$1.prototype.initialize.call(this, _e, Qt, Zt);
  },
  canvas() {
    return this._svg;
  },
  // add an event handler
  on(_e, Qt) {
    const Zt = this.eventName(_e), $n = this._handlers;
    if (this._handlerIndex($n[Zt], _e, Qt) < 0) {
      const kn = {
        type: _e,
        handler: Qt,
        listener: listener(this, Qt)
      };
      ($n[Zt] || ($n[Zt] = [])).push(kn), this._svg && this._svg.addEventListener(Zt, kn.listener);
    }
    return this;
  },
  // remove an event handler
  off(_e, Qt) {
    const Zt = this.eventName(_e), $n = this._handlers[Zt], Sn = this._handlerIndex($n, _e, Qt);
    return Sn >= 0 && (this._svg && this._svg.removeEventListener(Zt, $n[Sn].listener), $n.splice(Sn, 1)), this;
  }
});
const ARIA_HIDDEN = "aria-hidden", ARIA_LABEL = "aria-label", ARIA_ROLE = "role", ARIA_ROLEDESCRIPTION = "aria-roledescription", GRAPHICS_OBJECT = "graphics-object", GRAPHICS_SYMBOL = "graphics-symbol", bundle = (_e, Qt, Zt) => ({
  [ARIA_ROLE]: _e,
  [ARIA_ROLEDESCRIPTION]: Qt,
  [ARIA_LABEL]: Zt || void 0
}), AriaIgnore = toSet(["axis-domain", "axis-grid", "axis-label", "axis-tick", "axis-title", "legend-band", "legend-entry", "legend-gradient", "legend-label", "legend-title", "legend-symbol", "title"]), AriaGuides = {
  axis: {
    desc: "axis",
    caption: axisCaption
  },
  legend: {
    desc: "legend",
    caption: legendCaption
  },
  "title-text": {
    desc: "title",
    caption: (_e) => `Title text '${titleCaption(_e)}'`
  },
  "title-subtitle": {
    desc: "subtitle",
    caption: (_e) => `Subtitle text '${titleCaption(_e)}'`
  }
}, AriaEncode = {
  ariaRole: ARIA_ROLE,
  ariaRoleDescription: ARIA_ROLEDESCRIPTION,
  description: ARIA_LABEL
};
function ariaItemAttributes(_e, Qt) {
  const Zt = Qt.aria === !1;
  if (_e(ARIA_HIDDEN, Zt || void 0), Zt || Qt.description == null)
    for (const $n in AriaEncode)
      _e(AriaEncode[$n], void 0);
  else {
    const $n = Qt.mark.marktype;
    _e(ARIA_LABEL, Qt.description), _e(ARIA_ROLE, Qt.ariaRole || ($n === "group" ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL)), _e(ARIA_ROLEDESCRIPTION, Qt.ariaRoleDescription || `${$n} mark`);
  }
}
function ariaMarkAttributes(_e) {
  return _e.aria === !1 ? {
    [ARIA_HIDDEN]: !0
  } : AriaIgnore[_e.role] ? null : AriaGuides[_e.role] ? ariaGuide(_e, AriaGuides[_e.role]) : ariaMark(_e);
}
function ariaMark(_e) {
  const Qt = _e.marktype, Zt = Qt === "group" || Qt === "text" || _e.items.some(($n) => $n.description != null && $n.aria !== !1);
  return bundle(Zt ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${Qt} mark container`, _e.description);
}
function ariaGuide(_e, Qt) {
  try {
    const Zt = _e.items[0], $n = Qt.caption || (() => "");
    return bundle(Qt.role || GRAPHICS_SYMBOL, Qt.desc, Zt.description || $n(Zt));
  } catch {
    return null;
  }
}
function titleCaption(_e) {
  return array$6(_e.text).join(" ");
}
function axisCaption(_e) {
  const Qt = _e.datum, Zt = _e.orient, $n = Qt.title ? extractTitle(_e) : null, Sn = _e.context, kn = Sn.scales[Qt.scale].value, Kn = Sn.dataflow.locale(), er = kn.type;
  return `${Zt === "left" || Zt === "right" ? "Y" : "X"}-axis` + ($n ? ` titled '${$n}'` : "") + ` for a ${isDiscrete$2(er) ? "discrete" : er} scale with ${domainCaption(Kn, kn, _e)}`;
}
function legendCaption(_e) {
  const Qt = _e.datum, Zt = Qt.title ? extractTitle(_e) : null, $n = `${Qt.type || ""} legend`.trim(), Sn = Qt.scales, kn = Object.keys(Sn), Kn = _e.context, er = Kn.scales[Sn[kn[0]]].value, Cr = Kn.dataflow.locale();
  return capitalize($n) + (Zt ? ` titled '${Zt}'` : "") + ` for ${channelCaption(kn)} with ${domainCaption(Cr, er, _e)}`;
}
function extractTitle(_e) {
  try {
    return array$6(peek$1(_e.items).items[0].text).join(" ");
  } catch {
    return null;
  }
}
function channelCaption(_e) {
  return _e = _e.map((Qt) => Qt + (Qt === "fill" || Qt === "stroke" ? " color" : "")), _e.length < 2 ? _e[0] : _e.slice(0, -1).join(", ") + " and " + peek$1(_e);
}
function capitalize(_e) {
  return _e.length ? _e[0].toUpperCase() + _e.slice(1) : _e;
}
const innerText = (_e) => (_e + "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), attrText = (_e) => innerText(_e).replace(/"/g, "&quot;").replace(/\t/g, "&#x9;").replace(/\n/g, "&#xA;").replace(/\r/g, "&#xD;");
function markup() {
  let _e = "", Qt = "", Zt = "";
  const $n = [], Sn = () => Qt = Zt = "", kn = (Cr) => {
    Qt && (_e += `${Qt}>${Zt}`, Sn()), $n.push(Cr);
  }, Kn = (Cr, kr) => (kr != null && (Qt += ` ${Cr}="${attrText(kr)}"`), er), er = {
    open(Cr) {
      kn(Cr), Qt = "<" + Cr;
      for (var kr = arguments.length, Yr = new Array(kr > 1 ? kr - 1 : 0), Ms = 1; Ms < kr; Ms++)
        Yr[Ms - 1] = arguments[Ms];
      for (const Ds of Yr)
        for (const Ls in Ds)
          Kn(Ls, Ds[Ls]);
      return er;
    },
    close() {
      const Cr = $n.pop();
      return Qt ? _e += Qt + (Zt ? `>${Zt}</${Cr}>` : "/>") : _e += `</${Cr}>`, Sn(), er;
    },
    attr: Kn,
    text: (Cr) => (Zt += innerText(Cr), er),
    toString: () => _e
  };
  return er;
}
const serializeXML = (_e) => _serialize(markup(), _e) + "";
function _serialize(_e, Qt) {
  if (_e.open(Qt.tagName), Qt.hasAttributes()) {
    const Zt = Qt.attributes, $n = Zt.length;
    for (let Sn = 0; Sn < $n; ++Sn)
      _e.attr(Zt[Sn].name, Zt[Sn].value);
  }
  if (Qt.hasChildNodes()) {
    const Zt = Qt.childNodes;
    for (const $n of Zt)
      $n.nodeType === 3 ? _e.text($n.nodeValue) : _serialize(_e, $n);
  }
  return _e.close();
}
const stylesAttr = {
  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"
}, stylesCss = {
  blend: "mix-blend-mode"
}, rootAttributes = {
  fill: "none",
  "stroke-miterlimit": 10
}, RootIndex = 0, xmlns = "http://www.w3.org/2000/xmlns/", svgns = metadata.xmlns;
function SVGRenderer(_e) {
  Renderer.call(this, _e), this._dirtyID = 0, this._dirty = [], this._svg = null, this._root = null, this._defs = null;
}
const base = Renderer.prototype;
inherits(SVGRenderer, Renderer, {
  /**
   * Initialize a new SVGRenderer instance.
   * @param {DOMElement} el - The containing DOM element for the display.
   * @param {number} width - The coordinate width of the display, in pixels.
   * @param {number} height - The coordinate height of the display, in pixels.
   * @param {Array<number>} origin - The origin of the display, in pixels.
   *   The coordinate system will be translated to this point.
   * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply
   *   the width and height to determine the final pixel size.
   * @return {SVGRenderer} - This renderer instance.
   */
  initialize(_e, Qt, Zt, $n, Sn) {
    return this._defs = {}, this._clearDefs(), _e && (this._svg = domChild(_e, 0, "svg", svgns), this._svg.setAttributeNS(xmlns, "xmlns", svgns), this._svg.setAttributeNS(xmlns, "xmlns:xlink", metadata["xmlns:xlink"]), this._svg.setAttribute("version", metadata.version), this._svg.setAttribute("class", "marks"), domClear(_e, 1), this._root = domChild(this._svg, RootIndex, "g", svgns), setAttributes(this._root, rootAttributes), domClear(this._svg, RootIndex + 1)), this.background(this._bgcolor), base.initialize.call(this, _e, Qt, Zt, $n, Sn);
  },
  /**
   * Get / set the background color.
   */
  background(_e) {
    return arguments.length && this._svg && this._svg.style.setProperty("background-color", _e), base.background.apply(this, arguments);
  },
  /**
   * Resize the display.
   * @param {number} width - The new coordinate width of the display, in pixels.
   * @param {number} height - The new coordinate height of the display, in pixels.
   * @param {Array<number>} origin - The new origin of the display, in pixels.
   *   The coordinate system will be translated to this point.
   * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply
   *   the width and height to determine the final pixel size.
   * @return {SVGRenderer} - This renderer instance;
   */
  resize(_e, Qt, Zt, $n) {
    return base.resize.call(this, _e, Qt, Zt, $n), this._svg && (setAttributes(this._svg, {
      width: this._width * this._scale,
      height: this._height * this._scale,
      viewBox: `0 0 ${this._width} ${this._height}`
    }), this._root.setAttribute("transform", `translate(${this._origin})`)), this._dirty = [], this;
  },
  /**
   * Returns the SVG element of the visualization.
   * @return {DOMElement} - The SVG element.
   */
  canvas() {
    return this._svg;
  },
  /**
   * Returns an SVG text string for the rendered content,
   * or null if this renderer is currently headless.
   */
  svg() {
    const _e = this._svg, Qt = this._bgcolor;
    if (!_e)
      return null;
    let Zt;
    Qt && (_e.removeAttribute("style"), Zt = domChild(_e, RootIndex, "rect", svgns), setAttributes(Zt, {
      width: this._width,
      height: this._height,
      fill: Qt
    }));
    const $n = serializeXML(_e);
    return Qt && (_e.removeChild(Zt), this._svg.style.setProperty("background-color", Qt)), $n;
  },
  /**
   * Internal rendering method.
   * @param {object} scene - The root mark of a scenegraph to render.
   */
  _render(_e) {
    return this._dirtyCheck() && (this._dirtyAll && this._clearDefs(), this.mark(this._root, _e), domClear(this._root, 1)), this.defs(), this._dirty = [], ++this._dirtyID, this;
  },
  // -- Manage rendering of items marked as dirty --
  /**
   * Flag a mark item as dirty.
   * @param {Item} item - The mark item.
   */
  dirty(_e) {
    _e.dirty !== this._dirtyID && (_e.dirty = this._dirtyID, this._dirty.push(_e));
  },
  /**
   * Check if a mark item is considered dirty.
   * @param {Item} item - The mark item.
   */
  isDirty(_e) {
    return this._dirtyAll || !_e._svg || !_e._svg.ownerSVGElement || _e.dirty === this._dirtyID;
  },
  /**
   * Internal method to check dirty status and, if possible,
   * make targetted updates without a full rendering pass.
   */
  _dirtyCheck() {
    this._dirtyAll = !0;
    const _e = this._dirty;
    if (!_e.length || !this._dirtyID)
      return !0;
    const Qt = ++this._dirtyID;
    let Zt, $n, Sn, kn, Kn, er, Cr;
    for (Kn = 0, er = _e.length; Kn < er; ++Kn)
      if (Zt = _e[Kn], $n = Zt.mark, $n.marktype !== Sn && (Sn = $n.marktype, kn = Marks[Sn]), $n.zdirty && $n.dirty !== Qt && (this._dirtyAll = !1, dirtyParents(Zt, Qt), $n.items.forEach((kr) => {
        kr.dirty = Qt;
      })), !$n.zdirty) {
        if (Zt.exit) {
          kn.nested && $n.items.length ? (Cr = $n.items[0], Cr._svg && this._update(kn, Cr._svg, Cr)) : Zt._svg && (Cr = Zt._svg.parentNode, Cr && Cr.removeChild(Zt._svg)), Zt._svg = null;
          continue;
        }
        Zt = kn.nested ? $n.items[0] : Zt, Zt._update !== Qt && (!Zt._svg || !Zt._svg.ownerSVGElement ? (this._dirtyAll = !1, dirtyParents(Zt, Qt)) : this._update(kn, Zt._svg, Zt), Zt._update = Qt);
      }
    return !this._dirtyAll;
  },
  // -- Construct & maintain scenegraph to SVG mapping ---
  /**
   * Render a set of mark items.
   * @param {SVGElement} el - The parent element in the SVG tree.
   * @param {object} scene - The mark parent to render.
   * @param {SVGElement} prev - The previous sibling in the SVG tree.
   */
  mark(_e, Qt, Zt) {
    if (!this.isDirty(Qt))
      return Qt._svg;
    const $n = this._svg, Sn = Marks[Qt.marktype], kn = Qt.interactive === !1 ? "none" : null, Kn = Sn.tag === "g", er = bind$1(Qt, _e, Zt, "g", $n);
    er.setAttribute("class", cssClass(Qt));
    const Cr = ariaMarkAttributes(Qt);
    for (const Ds in Cr)
      setAttribute(er, Ds, Cr[Ds]);
    Kn || setAttribute(er, "pointer-events", kn), setAttribute(er, "clip-path", Qt.clip ? clip$1$1(this, Qt, Qt.group) : null);
    let kr = null, Yr = 0;
    const Ms = (Ds) => {
      const Ls = this.isDirty(Ds), js = bind$1(Ds, er, kr, Sn.tag, $n);
      Ls && (this._update(Sn, js, Ds), Kn && recurse(this, js, Ds)), kr = js, ++Yr;
    };
    return Sn.nested ? Qt.items.length && Ms(Qt.items[0]) : visit(Qt, Ms), domClear(er, Yr), er;
  },
  /**
   * Update the attributes of an SVG element for a mark item.
   * @param {object} mdef - The mark definition object
   * @param {SVGElement} el - The SVG element.
   * @param {Item} item - The mark item.
   */
  _update(_e, Qt, Zt) {
    element$1 = Qt, values$2 = Qt.__values__, ariaItemAttributes(emit, Zt), _e.attr(emit, Zt, this);
    const $n = mark_extras[_e.type];
    $n && $n.call(this, _e, Qt, Zt), element$1 && this.style(element$1, Zt);
  },
  /**
   * Update the presentation attributes of an SVG element for a mark item.
   * @param {SVGElement} el - The SVG element.
   * @param {Item} item - The mark item.
   */
  style(_e, Qt) {
    if (Qt != null) {
      for (const Zt in stylesAttr) {
        let $n = Zt === "font" ? fontFamily(Qt) : Qt[Zt];
        if ($n === values$2[Zt])
          continue;
        const Sn = stylesAttr[Zt];
        $n == null ? _e.removeAttribute(Sn) : (isGradient($n) && ($n = gradientRef($n, this._defs.gradient, href())), _e.setAttribute(Sn, $n + "")), values$2[Zt] = $n;
      }
      for (const Zt in stylesCss)
        setStyle(_e, stylesCss[Zt], Qt[Zt]);
    }
  },
  /**
   * Render SVG defs, as needed.
   * Must be called *after* marks have been processed to ensure the
   * collected state is current and accurate.
   */
  defs() {
    const _e = this._svg, Qt = this._defs;
    let Zt = Qt.el, $n = 0;
    for (const Sn in Qt.gradient)
      Zt || (Qt.el = Zt = domChild(_e, RootIndex + 1, "defs", svgns)), $n = updateGradient(Zt, Qt.gradient[Sn], $n);
    for (const Sn in Qt.clipping)
      Zt || (Qt.el = Zt = domChild(_e, RootIndex + 1, "defs", svgns)), $n = updateClipping(Zt, Qt.clipping[Sn], $n);
    Zt && ($n === 0 ? (_e.removeChild(Zt), Qt.el = null) : domClear(Zt, $n));
  },
  /**
   * Clear defs caches.
   */
  _clearDefs() {
    const _e = this._defs;
    _e.gradient = {}, _e.clipping = {};
  }
});
function dirtyParents(_e, Qt) {
  for (; _e && _e.dirty !== Qt; _e = _e.mark.group)
    if (_e.dirty = Qt, _e.mark && _e.mark.dirty !== Qt)
      _e.mark.dirty = Qt;
    else
      return;
}
function updateGradient(_e, Qt, Zt) {
  let $n, Sn, kn;
  if (Qt.gradient === "radial") {
    let Kn = domChild(_e, Zt++, "pattern", svgns);
    setAttributes(Kn, {
      id: patternPrefix + Qt.id,
      viewBox: "0,0,1,1",
      width: "100%",
      height: "100%",
      preserveAspectRatio: "xMidYMid slice"
    }), Kn = domChild(Kn, 0, "rect", svgns), setAttributes(Kn, {
      width: 1,
      height: 1,
      fill: `url(${href()}#${Qt.id})`
    }), _e = domChild(_e, Zt++, "radialGradient", svgns), setAttributes(_e, {
      id: Qt.id,
      fx: Qt.x1,
      fy: Qt.y1,
      fr: Qt.r1,
      cx: Qt.x2,
      cy: Qt.y2,
      r: Qt.r2
    });
  } else
    _e = domChild(_e, Zt++, "linearGradient", svgns), setAttributes(_e, {
      id: Qt.id,
      x1: Qt.x1,
      x2: Qt.x2,
      y1: Qt.y1,
      y2: Qt.y2
    });
  for ($n = 0, Sn = Qt.stops.length; $n < Sn; ++$n)
    kn = domChild(_e, $n, "stop", svgns), kn.setAttribute("offset", Qt.stops[$n].offset), kn.setAttribute("stop-color", Qt.stops[$n].color);
  return domClear(_e, $n), Zt;
}
function updateClipping(_e, Qt, Zt) {
  let $n;
  return _e = domChild(_e, Zt, "clipPath", svgns), _e.setAttribute("id", Qt.id), Qt.path ? ($n = domChild(_e, 0, "path", svgns), $n.setAttribute("d", Qt.path)) : ($n = domChild(_e, 0, "rect", svgns), setAttributes($n, {
    x: 0,
    y: 0,
    width: Qt.width,
    height: Qt.height
  })), domClear(_e, 1), Zt + 1;
}
function recurse(_e, Qt, Zt) {
  Qt = Qt.lastChild.previousSibling;
  let $n, Sn = 0;
  visit(Zt, (kn) => {
    $n = _e.mark(Qt, kn, $n), ++Sn;
  }), domClear(Qt, 1 + Sn);
}
function bind$1(_e, Qt, Zt, $n, Sn) {
  let kn = _e._svg, Kn;
  if (!kn && (Kn = Qt.ownerDocument, kn = domCreate(Kn, $n, svgns), _e._svg = kn, _e.mark && (kn.__data__ = _e, kn.__values__ = {
    fill: "default"
  }, $n === "g"))) {
    const er = domCreate(Kn, "path", svgns);
    kn.appendChild(er), er.__data__ = _e;
    const Cr = domCreate(Kn, "g", svgns);
    kn.appendChild(Cr), Cr.__data__ = _e;
    const kr = domCreate(Kn, "path", svgns);
    kn.appendChild(kr), kr.__data__ = _e, kr.__values__ = {
      fill: "default"
    };
  }
  return (kn.ownerSVGElement !== Sn || siblingCheck(kn, Zt)) && Qt.insertBefore(kn, Zt ? Zt.nextSibling : Qt.firstChild), kn;
}
function siblingCheck(_e, Qt) {
  return _e.parentNode && _e.parentNode.childNodes.length > 1 && _e.previousSibling != Qt;
}
let element$1 = null, values$2 = null;
const mark_extras = {
  group(_e, Qt, Zt) {
    const $n = element$1 = Qt.childNodes[2];
    values$2 = $n.__values__, _e.foreground(emit, Zt, this), values$2 = Qt.__values__, element$1 = Qt.childNodes[1], _e.content(emit, Zt, this);
    const Sn = element$1 = Qt.childNodes[0];
    _e.background(emit, Zt, this);
    const kn = Zt.mark.interactive === !1 ? "none" : null;
    if (kn !== values$2.events && (setAttribute($n, "pointer-events", kn), setAttribute(Sn, "pointer-events", kn), values$2.events = kn), Zt.strokeForeground && Zt.stroke) {
      const Kn = Zt.fill;
      setAttribute($n, "display", null), this.style(Sn, Zt), setAttribute(Sn, "stroke", null), Kn && (Zt.fill = null), values$2 = $n.__values__, this.style($n, Zt), Kn && (Zt.fill = Kn), element$1 = null;
    } else
      setAttribute($n, "display", "none");
  },
  image(_e, Qt, Zt) {
    Zt.smooth === !1 ? (setStyle(Qt, "image-rendering", "optimizeSpeed"), setStyle(Qt, "image-rendering", "pixelated")) : setStyle(Qt, "image-rendering", null);
  },
  text(_e, Qt, Zt) {
    const $n = textLines(Zt);
    let Sn, kn, Kn, er;
    isArray($n) ? (kn = $n.map((Cr) => textValue(Zt, Cr)), Sn = kn.join(`
`), Sn !== values$2.text && (domClear(Qt, 0), Kn = Qt.ownerDocument, er = lineHeight(Zt), kn.forEach((Cr, kr) => {
      const Yr = domCreate(Kn, "tspan", svgns);
      Yr.__data__ = Zt, Yr.textContent = Cr, kr && (Yr.setAttribute("x", 0), Yr.setAttribute("dy", er)), Qt.appendChild(Yr);
    }), values$2.text = Sn)) : (kn = textValue(Zt, $n), kn !== values$2.text && (Qt.textContent = kn, values$2.text = kn)), setAttribute(Qt, "font-family", fontFamily(Zt)), setAttribute(Qt, "font-size", fontSize(Zt) + "px"), setAttribute(Qt, "font-style", Zt.fontStyle), setAttribute(Qt, "font-variant", Zt.fontVariant), setAttribute(Qt, "font-weight", Zt.fontWeight);
  }
};
function emit(_e, Qt, Zt) {
  Qt !== values$2[_e] && (Zt ? setAttributeNS(element$1, _e, Qt, Zt) : setAttribute(element$1, _e, Qt), values$2[_e] = Qt);
}
function setStyle(_e, Qt, Zt) {
  Zt !== values$2[Qt] && (Zt == null ? _e.style.removeProperty(Qt) : _e.style.setProperty(Qt, Zt + ""), values$2[Qt] = Zt);
}
function setAttributes(_e, Qt) {
  for (const Zt in Qt)
    setAttribute(_e, Zt, Qt[Zt]);
}
function setAttribute(_e, Qt, Zt) {
  Zt != null ? _e.setAttribute(Qt, Zt) : _e.removeAttribute(Qt);
}
function setAttributeNS(_e, Qt, Zt, $n) {
  Zt != null ? _e.setAttributeNS($n, Qt, Zt) : _e.removeAttributeNS($n, Qt);
}
function href() {
  let _e;
  return typeof window > "u" ? "" : (_e = window.location).hash ? _e.href.slice(0, -_e.hash.length) : _e.href;
}
function SVGStringRenderer(_e) {
  Renderer.call(this, _e), this._text = null, this._defs = {
    gradient: {},
    clipping: {}
  };
}
inherits(SVGStringRenderer, Renderer, {
  /**
   * Returns the rendered SVG text string,
   * or null if rendering has not yet occurred.
   */
  svg() {
    return this._text;
  },
  /**
   * Internal rendering method.
   * @param {object} scene - The root mark of a scenegraph to render.
   */
  _render(_e) {
    const Qt = markup();
    Qt.open("svg", extend$1({}, metadata, {
      class: "marks",
      width: this._width * this._scale,
      height: this._height * this._scale,
      viewBox: `0 0 ${this._width} ${this._height}`
    }));
    const Zt = this._bgcolor;
    return Zt && Zt !== "transparent" && Zt !== "none" && Qt.open("rect", {
      width: this._width,
      height: this._height,
      fill: Zt
    }).close(), Qt.open("g", rootAttributes, {
      transform: "translate(" + this._origin + ")"
    }), this.mark(Qt, _e), Qt.close(), this.defs(Qt), this._text = Qt.close() + "", this;
  },
  /**
   * Render a set of mark items.
   * @param {object} m - The markup context.
   * @param {object} scene - The mark parent to render.
   */
  mark(_e, Qt) {
    const Zt = Marks[Qt.marktype], $n = Zt.tag, Sn = [ariaItemAttributes, Zt.attr];
    _e.open("g", {
      class: cssClass(Qt),
      "clip-path": Qt.clip ? clip$1$1(this, Qt, Qt.group) : null
    }, ariaMarkAttributes(Qt), {
      "pointer-events": $n !== "g" && Qt.interactive === !1 ? "none" : null
    });
    const kn = (Kn) => {
      const er = this.href(Kn);
      if (er && _e.open("a", er), _e.open($n, this.attr(Qt, Kn, Sn, $n !== "g" ? $n : null)), $n === "text") {
        const Cr = textLines(Kn);
        if (isArray(Cr)) {
          const kr = {
            x: 0,
            dy: lineHeight(Kn)
          };
          for (let Yr = 0; Yr < Cr.length; ++Yr)
            _e.open("tspan", Yr ? kr : null).text(textValue(Kn, Cr[Yr])).close();
        } else
          _e.text(textValue(Kn, Cr));
      } else if ($n === "g") {
        const Cr = Kn.strokeForeground, kr = Kn.fill, Yr = Kn.stroke;
        Cr && Yr && (Kn.stroke = null), _e.open("path", this.attr(Qt, Kn, Zt.background, "bgrect")).close(), _e.open("g", this.attr(Qt, Kn, Zt.content)), visit(Kn, (Ms) => this.mark(_e, Ms)), _e.close(), Cr && Yr ? (kr && (Kn.fill = null), Kn.stroke = Yr, _e.open("path", this.attr(Qt, Kn, Zt.foreground, "bgrect")).close(), kr && (Kn.fill = kr)) : _e.open("path", this.attr(Qt, Kn, Zt.foreground, "bgfore")).close();
      }
      _e.close(), er && _e.close();
    };
    return Zt.nested ? Qt.items && Qt.items.length && kn(Qt.items[0]) : visit(Qt, kn), _e.close();
  },
  /**
   * Get href attributes for a hyperlinked mark item.
   * @param {Item} item - The mark item.
   */
  href(_e) {
    const Qt = _e.href;
    let Zt;
    if (Qt) {
      if (Zt = this._hrefs && this._hrefs[Qt])
        return Zt;
      this.sanitizeURL(Qt).then(($n) => {
        $n["xlink:href"] = $n.href, $n.href = null, (this._hrefs || (this._hrefs = {}))[Qt] = $n;
      });
    }
    return null;
  },
  /**
   * Get an object of SVG attributes for a mark item.
   * @param {object} scene - The mark parent.
   * @param {Item} item - The mark item.
   * @param {array|function} attrs - One or more attribute emitters.
   * @param {string} tag - The tag being rendered.
   */
  attr(_e, Qt, Zt, $n) {
    const Sn = {}, kn = (Kn, er, Cr, kr) => {
      Sn[kr || Kn] = er;
    };
    return Array.isArray(Zt) ? Zt.forEach((Kn) => Kn(kn, Qt, this)) : Zt(kn, Qt, this), $n && style$1(Sn, Qt, _e, $n, this._defs), Sn;
  },
  /**
   * Render SVG defs, as needed.
   * Must be called *after* marks have been processed to ensure the
   * collected state is current and accurate.
   * @param {object} m - The markup context.
   */
  defs(_e) {
    const Qt = this._defs.gradient, Zt = this._defs.clipping;
    if (Object.keys(Qt).length + Object.keys(Zt).length !== 0) {
      _e.open("defs");
      for (const Sn in Qt) {
        const kn = Qt[Sn], Kn = kn.stops;
        kn.gradient === "radial" ? (_e.open("pattern", {
          id: patternPrefix + Sn,
          viewBox: "0,0,1,1",
          width: "100%",
          height: "100%",
          preserveAspectRatio: "xMidYMid slice"
        }), _e.open("rect", {
          width: "1",
          height: "1",
          fill: "url(#" + Sn + ")"
        }).close(), _e.close(), _e.open("radialGradient", {
          id: Sn,
          fx: kn.x1,
          fy: kn.y1,
          fr: kn.r1,
          cx: kn.x2,
          cy: kn.y2,
          r: kn.r2
        })) : _e.open("linearGradient", {
          id: Sn,
          x1: kn.x1,
          x2: kn.x2,
          y1: kn.y1,
          y2: kn.y2
        });
        for (let er = 0; er < Kn.length; ++er)
          _e.open("stop", {
            offset: Kn[er].offset,
            "stop-color": Kn[er].color
          }).close();
        _e.close();
      }
      for (const Sn in Zt) {
        const kn = Zt[Sn];
        _e.open("clipPath", {
          id: Sn
        }), kn.path ? _e.open("path", {
          d: kn.path
        }).close() : _e.open("rect", {
          x: 0,
          y: 0,
          width: kn.width,
          height: kn.height
        }).close(), _e.close();
      }
      _e.close();
    }
  }
});
function style$1(_e, Qt, Zt, $n, Sn) {
  let kn;
  if (Qt == null || ($n === "bgrect" && Zt.interactive === !1 && (_e["pointer-events"] = "none"), $n === "bgfore" && (Zt.interactive === !1 && (_e["pointer-events"] = "none"), _e.display = "none", Qt.fill !== null)))
    return _e;
  $n === "image" && Qt.smooth === !1 && (kn = ["image-rendering: optimizeSpeed;", "image-rendering: pixelated;"]), $n === "text" && (_e["font-family"] = fontFamily(Qt), _e["font-size"] = fontSize(Qt) + "px", _e["font-style"] = Qt.fontStyle, _e["font-variant"] = Qt.fontVariant, _e["font-weight"] = Qt.fontWeight);
  for (const Kn in stylesAttr) {
    let er = Qt[Kn];
    const Cr = stylesAttr[Kn];
    er === "transparent" && (Cr === "fill" || Cr === "stroke") || er != null && (isGradient(er) && (er = gradientRef(er, Sn.gradient, "")), _e[Cr] = er);
  }
  for (const Kn in stylesCss) {
    const er = Qt[Kn];
    er != null && (kn = kn || [], kn.push(`${stylesCss[Kn]}: ${er};`));
  }
  return kn && (_e.style = kn.join(" ")), _e;
}
const Canvas = "canvas", PNG = "png", SVG = "svg", None$1 = "none", RenderType = {
  Canvas,
  PNG,
  SVG,
  None: None$1
}, modules = {};
modules[Canvas] = modules[PNG] = {
  renderer: CanvasRenderer,
  headless: CanvasRenderer,
  handler: CanvasHandler
};
modules[SVG] = {
  renderer: SVGRenderer,
  headless: SVGStringRenderer,
  handler: SVGHandler
};
modules[None$1] = {};
function renderModule(_e, Qt) {
  return _e = String(_e || "").toLowerCase(), arguments.length > 1 ? (modules[_e] = Qt, this) : modules[_e];
}
function intersect$2(_e, Qt, Zt) {
  const $n = [], Sn = new Bounds().union(Qt), kn = _e.marktype;
  return kn ? intersectMark(_e, Sn, Zt, $n) : kn === "group" ? intersectGroup(_e, Sn, Zt, $n) : error("Intersect scene must be mark node or group item.");
}
function intersectMark(_e, Qt, Zt, $n) {
  if (visitMark(_e, Qt, Zt)) {
    const Sn = _e.items, kn = _e.marktype, Kn = Sn.length;
    let er = 0;
    if (kn === "group")
      for (; er < Kn; ++er)
        intersectGroup(Sn[er], Qt, Zt, $n);
    else
      for (const Cr = Marks[kn].isect; er < Kn; ++er) {
        const kr = Sn[er];
        intersectItem(kr, Qt, Cr) && $n.push(kr);
      }
  }
  return $n;
}
function visitMark(_e, Qt, Zt) {
  return _e.bounds && Qt.intersects(_e.bounds) && (_e.marktype === "group" || _e.interactive !== !1 && (!Zt || Zt(_e)));
}
function intersectGroup(_e, Qt, Zt, $n) {
  Zt && Zt(_e.mark) && intersectItem(_e, Qt, Marks.group.isect) && $n.push(_e);
  const Sn = _e.items, kn = Sn && Sn.length;
  if (kn) {
    const Kn = _e.x || 0, er = _e.y || 0;
    Qt.translate(-Kn, -er);
    for (let Cr = 0; Cr < kn; ++Cr)
      intersectMark(Sn[Cr], Qt, Zt, $n);
    Qt.translate(Kn, er);
  }
  return $n;
}
function intersectItem(_e, Qt, Zt) {
  const $n = _e.bounds;
  return Qt.encloses($n) || Qt.intersects($n) && Zt(_e, Qt);
}
const clipBounds = new Bounds();
function boundClip(_e) {
  const Qt = _e.clip;
  if (isFunction$1(Qt))
    Qt(boundContext(clipBounds.clear()));
  else if (Qt)
    clipBounds.set(0, 0, _e.group.width, _e.group.height);
  else
    return;
  _e.bounds.intersect(clipBounds);
}
const TOLERANCE = 1e-9;
function sceneEqual(_e, Qt, Zt) {
  return _e === Qt ? !0 : Zt === "path" ? pathEqual(_e, Qt) : _e instanceof Date && Qt instanceof Date ? +_e == +Qt : isNumber$1(_e) && isNumber$1(Qt) ? Math.abs(_e - Qt) <= TOLERANCE : !_e || !Qt || !isObject(_e) && !isObject(Qt) ? _e == Qt : objectEqual(_e, Qt);
}
function pathEqual(_e, Qt) {
  return sceneEqual(parse$4(_e), parse$4(Qt));
}
function objectEqual(_e, Qt) {
  var Zt = Object.keys(_e), $n = Object.keys(Qt), Sn, kn;
  if (Zt.length !== $n.length)
    return !1;
  for (Zt.sort(), $n.sort(), kn = Zt.length - 1; kn >= 0; kn--)
    if (Zt[kn] != $n[kn])
      return !1;
  for (kn = Zt.length - 1; kn >= 0; kn--)
    if (Sn = Zt[kn], !sceneEqual(_e[Sn], Qt[Sn], Sn))
      return !1;
  return typeof _e == typeof Qt;
}
function resetSVGDefIds() {
  resetSVGClipId(), resetSVGGradientId();
}
const Top$1 = "top", Left$1 = "left", Right$1 = "right", Bottom$1 = "bottom", TopLeft = "top-left", TopRight = "top-right", BottomLeft = "bottom-left", BottomRight = "bottom-right", Start$1 = "start", Middle$1 = "middle", End$1 = "end", X = "x", Y = "y", Group = "group", AxisRole$1 = "axis", TitleRole$1 = "title", FrameRole$1 = "frame", ScopeRole$1 = "scope", LegendRole$1 = "legend", RowHeader = "row-header", RowFooter = "row-footer", RowTitle = "row-title", ColHeader = "column-header", ColFooter = "column-footer", ColTitle = "column-title", Padding$1 = "padding", Symbols$1 = "symbol", Fit = "fit", FitX = "fit-x", FitY = "fit-y", Pad = "pad", None = "none", All = "all", Each = "each", Flush = "flush", Column = "column", Row = "row";
function Bound$1(_e) {
  Transform$1.call(this, null, _e);
}
inherits(Bound$1, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.dataflow, $n = _e.mark, Sn = $n.marktype, kn = Marks[Sn], Kn = kn.bound;
    let er = $n.bounds, Cr;
    if (kn.nested)
      $n.items.length && Zt.dirty($n.items[0]), er = boundItem($n, Kn), $n.items.forEach((kr) => {
        kr.bounds.clear().union(er);
      });
    else if (Sn === Group || _e.modified())
      switch (Qt.visit(Qt.MOD, (kr) => Zt.dirty(kr)), er.clear(), $n.items.forEach((kr) => er.union(boundItem(kr, Kn))), $n.role) {
        case AxisRole$1:
        case LegendRole$1:
        case TitleRole$1:
          Qt.reflow();
      }
    else
      Cr = Qt.changed(Qt.REM), Qt.visit(Qt.ADD, (kr) => {
        er.union(boundItem(kr, Kn));
      }), Qt.visit(Qt.MOD, (kr) => {
        Cr = Cr || er.alignsWith(kr.bounds), Zt.dirty(kr), er.union(boundItem(kr, Kn));
      }), Cr && (er.clear(), $n.items.forEach((kr) => er.union(kr.bounds)));
    return boundClip($n), Qt.modifies("bounds");
  }
});
function boundItem(_e, Qt, Zt) {
  return Qt(_e.bounds.clear(), _e, Zt);
}
const COUNTER_NAME = ":vega_identifier:";
function Identifier$1(_e) {
  Transform$1.call(this, 0, _e);
}
Identifier$1.Definition = {
  type: "Identifier",
  metadata: {
    modifies: !0
  },
  params: [{
    name: "as",
    type: "string",
    required: !0
  }]
};
inherits(Identifier$1, Transform$1, {
  transform(_e, Qt) {
    const Zt = getCounter(Qt.dataflow), $n = _e.as;
    let Sn = Zt.value;
    return Qt.visit(Qt.ADD, (kn) => kn[$n] = kn[$n] || ++Sn), Zt.set(this.value = Sn), Qt;
  }
});
function getCounter(_e) {
  return _e._signals[COUNTER_NAME] || (_e._signals[COUNTER_NAME] = _e.add(0));
}
function Mark$2(_e) {
  Transform$1.call(this, null, _e);
}
inherits(Mark$2, Transform$1, {
  transform(_e, Qt) {
    let Zt = this.value;
    Zt || (Zt = Qt.dataflow.scenegraph().mark(_e.markdef, lookup$1$1(_e), _e.index), Zt.group.context = _e.context, _e.context.group || (_e.context.group = Zt.group), Zt.source = this.source, Zt.clip = _e.clip, Zt.interactive = _e.interactive, this.value = Zt);
    const $n = Zt.marktype === Group ? GroupItem : Item;
    return Qt.visit(Qt.ADD, (Sn) => $n.call(Sn, Zt)), (_e.modified("clip") || _e.modified("interactive")) && (Zt.clip = _e.clip, Zt.interactive = !!_e.interactive, Zt.zdirty = !0, Qt.reflow()), Zt.items = Qt.source, Qt;
  }
});
function lookup$1$1(_e) {
  const Qt = _e.groups, Zt = _e.parent;
  return Qt && Qt.size === 1 ? Qt.get(Object.keys(Qt.object)[0]) : Qt && Zt ? Qt.lookup(Zt) : null;
}
function Overlap$1(_e) {
  Transform$1.call(this, null, _e);
}
const methods = {
  parity: (_e) => _e.filter((Qt, Zt) => Zt % 2 ? Qt.opacity = 0 : 1),
  greedy: (_e, Qt) => {
    let Zt;
    return _e.filter(($n, Sn) => !Sn || !intersect$1(Zt.bounds, $n.bounds, Qt) ? (Zt = $n, 1) : $n.opacity = 0);
  }
}, intersect$1 = (_e, Qt, Zt) => Zt > Math.max(Qt.x1 - _e.x2, _e.x1 - Qt.x2, Qt.y1 - _e.y2, _e.y1 - Qt.y2), hasOverlap = (_e, Qt) => {
  for (var Zt = 1, $n = _e.length, Sn = _e[0].bounds, kn; Zt < $n; Sn = kn, ++Zt)
    if (intersect$1(Sn, kn = _e[Zt].bounds, Qt))
      return !0;
}, hasBounds = (_e) => {
  const Qt = _e.bounds;
  return Qt.width() > 1 && Qt.height() > 1;
}, boundTest = (_e, Qt, Zt) => {
  var $n = _e.range(), Sn = new Bounds();
  return Qt === Top$1 || Qt === Bottom$1 ? Sn.set($n[0], -1 / 0, $n[1], 1 / 0) : Sn.set(-1 / 0, $n[0], 1 / 0, $n[1]), Sn.expand(Zt || 1), (kn) => Sn.encloses(kn.bounds);
}, reset = (_e) => (_e.forEach((Qt) => Qt.opacity = 1), _e), reflow = (_e, Qt) => _e.reflow(Qt.modified()).modifies("opacity");
inherits(Overlap$1, Transform$1, {
  transform(_e, Qt) {
    const Zt = methods[_e.method] || methods.parity, $n = _e.separation || 0;
    let Sn = Qt.materialize(Qt.SOURCE).source, kn, Kn;
    if (!Sn || !Sn.length)
      return;
    if (!_e.method)
      return _e.modified("method") && (reset(Sn), Qt = reflow(Qt, _e)), Qt;
    if (Sn = Sn.filter(hasBounds), !Sn.length)
      return;
    if (_e.sort && (Sn = Sn.slice().sort(_e.sort)), kn = reset(Sn), Qt = reflow(Qt, _e), kn.length >= 3 && hasOverlap(kn, $n)) {
      do
        kn = Zt(kn, $n);
      while (kn.length >= 3 && hasOverlap(kn, $n));
      kn.length < 3 && !peek$1(Sn).opacity && (kn.length > 1 && (peek$1(kn).opacity = 0), peek$1(Sn).opacity = 1);
    }
    _e.boundScale && _e.boundTolerance >= 0 && (Kn = boundTest(_e.boundScale, _e.boundOrient, +_e.boundTolerance), Sn.forEach((Cr) => {
      Kn(Cr) || (Cr.opacity = 0);
    }));
    const er = kn[0].mark.bounds.clear();
    return Sn.forEach((Cr) => {
      Cr.opacity && er.union(Cr.bounds);
    }), Qt;
  }
});
function Render$1(_e) {
  Transform$1.call(this, null, _e);
}
inherits(Render$1, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.dataflow;
    if (Qt.visit(Qt.ALL, ($n) => Zt.dirty($n)), Qt.fields && Qt.fields.zindex) {
      const $n = Qt.source && Qt.source[0];
      $n && ($n.mark.zdirty = !0);
    }
  }
});
const tempBounds = new Bounds();
function set$4(_e, Qt, Zt) {
  return _e[Qt] === Zt ? 0 : (_e[Qt] = Zt, 1);
}
function isYAxis(_e) {
  var Qt = _e.items[0].orient;
  return Qt === Left$1 || Qt === Right$1;
}
function axisIndices(_e) {
  let Qt = +_e.grid;
  return [
    _e.ticks ? Qt++ : -1,
    // ticks index
    _e.labels ? Qt++ : -1,
    // labels index
    Qt + +_e.domain
    // title index
  ];
}
function axisLayout(_e, Qt, Zt, $n) {
  var Sn = Qt.items[0], kn = Sn.datum, Kn = Sn.translate != null ? Sn.translate : 0.5, er = Sn.orient, Cr = axisIndices(kn), kr = Sn.range, Yr = Sn.offset, Ms = Sn.position, Ds = Sn.minExtent, Ls = Sn.maxExtent, js = kn.title && Sn.items[Cr[2]].items[0], zs = Sn.titlePadding, Fs = Sn.bounds, Bs = js && multiLineOffset(js), Hs = 0, Ws = 0, Ys, El;
  switch (tempBounds.clear().union(Fs), Fs.clear(), (Ys = Cr[0]) > -1 && Fs.union(Sn.items[Ys].bounds), (Ys = Cr[1]) > -1 && Fs.union(Sn.items[Ys].bounds), er) {
    case Top$1:
      Hs = Ms || 0, Ws = -Yr, El = Math.max(Ds, Math.min(Ls, -Fs.y1)), Fs.add(0, -El).add(kr, 0), js && axisTitleLayout(_e, js, El, zs, Bs, 0, -1, Fs);
      break;
    case Left$1:
      Hs = -Yr, Ws = Ms || 0, El = Math.max(Ds, Math.min(Ls, -Fs.x1)), Fs.add(-El, 0).add(0, kr), js && axisTitleLayout(_e, js, El, zs, Bs, 1, -1, Fs);
      break;
    case Right$1:
      Hs = Zt + Yr, Ws = Ms || 0, El = Math.max(Ds, Math.min(Ls, Fs.x2)), Fs.add(0, 0).add(El, kr), js && axisTitleLayout(_e, js, El, zs, Bs, 1, 1, Fs);
      break;
    case Bottom$1:
      Hs = Ms || 0, Ws = $n + Yr, El = Math.max(Ds, Math.min(Ls, Fs.y2)), Fs.add(0, 0).add(kr, El), js && axisTitleLayout(_e, js, El, zs, 0, 0, 1, Fs);
      break;
    default:
      Hs = Sn.x, Ws = Sn.y;
  }
  return boundStroke(Fs.translate(Hs, Ws), Sn), set$4(Sn, "x", Hs + Kn) | set$4(Sn, "y", Ws + Kn) && (Sn.bounds = tempBounds, _e.dirty(Sn), Sn.bounds = Fs, _e.dirty(Sn)), Sn.mark.bounds.clear().union(Fs);
}
function axisTitleLayout(_e, Qt, Zt, $n, Sn, kn, Kn, er) {
  const Cr = Qt.bounds;
  if (Qt.auto) {
    const kr = Kn * (Zt + Sn + $n);
    let Yr = 0, Ms = 0;
    _e.dirty(Qt), kn ? Yr = (Qt.x || 0) - (Qt.x = kr) : Ms = (Qt.y || 0) - (Qt.y = kr), Qt.mark.bounds.clear().union(Cr.translate(-Yr, -Ms)), _e.dirty(Qt);
  }
  er.union(Cr);
}
const min = (_e, Qt) => Math.floor(Math.min(_e, Qt)), max = (_e, Qt) => Math.ceil(Math.max(_e, Qt));
function gridLayoutGroups(_e) {
  var Qt = _e.items, Zt = Qt.length, $n = 0, Sn, kn;
  const Kn = {
    marks: [],
    rowheaders: [],
    rowfooters: [],
    colheaders: [],
    colfooters: [],
    rowtitle: null,
    coltitle: null
  };
  for (; $n < Zt; ++$n)
    if (Sn = Qt[$n], kn = Sn.items, Sn.marktype === Group)
      switch (Sn.role) {
        case AxisRole$1:
        case LegendRole$1:
        case TitleRole$1:
          break;
        case RowHeader:
          Kn.rowheaders.push(...kn);
          break;
        case RowFooter:
          Kn.rowfooters.push(...kn);
          break;
        case ColHeader:
          Kn.colheaders.push(...kn);
          break;
        case ColFooter:
          Kn.colfooters.push(...kn);
          break;
        case RowTitle:
          Kn.rowtitle = kn[0];
          break;
        case ColTitle:
          Kn.coltitle = kn[0];
          break;
        default:
          Kn.marks.push(...kn);
      }
  return Kn;
}
function bboxFlush(_e) {
  return new Bounds().set(0, 0, _e.width || 0, _e.height || 0);
}
function bboxFull(_e) {
  const Qt = _e.bounds.clone();
  return Qt.empty() ? Qt.set(0, 0, 0, 0) : Qt.translate(-(_e.x || 0), -(_e.y || 0));
}
function get$3(_e, Qt, Zt) {
  const $n = isObject(_e) ? _e[Qt] : _e;
  return $n ?? (Zt !== void 0 ? Zt : 0);
}
function offsetValue$1(_e) {
  return _e < 0 ? Math.ceil(-_e) : 0;
}
function gridLayout(_e, Qt, Zt) {
  var $n = !Zt.nodirty, Sn = Zt.bounds === Flush ? bboxFlush : bboxFull, kn = tempBounds.set(0, 0, 0, 0), Kn = get$3(Zt.align, Column), er = get$3(Zt.align, Row), Cr = get$3(Zt.padding, Column), kr = get$3(Zt.padding, Row), Yr = Zt.columns || Qt.length, Ms = Yr <= 0 ? 1 : Math.ceil(Qt.length / Yr), Ds = Qt.length, Ls = Array(Ds), js = Array(Yr), zs = 0, Fs = Array(Ds), Bs = Array(Ms), Hs = 0, Ws = Array(Ds), Ys = Array(Ds), El = Array(Ds), Mu, Pl, Iu, Tu, Au, Nu, gm, pm, zu, Yu, sm;
  for (Pl = 0; Pl < Yr; ++Pl)
    js[Pl] = 0;
  for (Pl = 0; Pl < Ms; ++Pl)
    Bs[Pl] = 0;
  for (Pl = 0; Pl < Ds; ++Pl)
    Nu = Qt[Pl], Au = El[Pl] = Sn(Nu), Nu.x = Nu.x || 0, Ws[Pl] = 0, Nu.y = Nu.y || 0, Ys[Pl] = 0, Iu = Pl % Yr, Tu = ~~(Pl / Yr), zs = Math.max(zs, gm = Math.ceil(Au.x2)), Hs = Math.max(Hs, pm = Math.ceil(Au.y2)), js[Iu] = Math.max(js[Iu], gm), Bs[Tu] = Math.max(Bs[Tu], pm), Ls[Pl] = Cr + offsetValue$1(Au.x1), Fs[Pl] = kr + offsetValue$1(Au.y1), $n && _e.dirty(Qt[Pl]);
  for (Pl = 0; Pl < Ds; ++Pl)
    Pl % Yr === 0 && (Ls[Pl] = 0), Pl < Yr && (Fs[Pl] = 0);
  if (Kn === Each)
    for (Iu = 1; Iu < Yr; ++Iu) {
      for (sm = 0, Pl = Iu; Pl < Ds; Pl += Yr)
        sm < Ls[Pl] && (sm = Ls[Pl]);
      for (Pl = Iu; Pl < Ds; Pl += Yr)
        Ls[Pl] = sm + js[Iu - 1];
    }
  else if (Kn === All) {
    for (sm = 0, Pl = 0; Pl < Ds; ++Pl)
      Pl % Yr && sm < Ls[Pl] && (sm = Ls[Pl]);
    for (Pl = 0; Pl < Ds; ++Pl)
      Pl % Yr && (Ls[Pl] = sm + zs);
  } else
    for (Kn = !1, Iu = 1; Iu < Yr; ++Iu)
      for (Pl = Iu; Pl < Ds; Pl += Yr)
        Ls[Pl] += js[Iu - 1];
  if (er === Each)
    for (Tu = 1; Tu < Ms; ++Tu) {
      for (sm = 0, Pl = Tu * Yr, Mu = Pl + Yr; Pl < Mu; ++Pl)
        sm < Fs[Pl] && (sm = Fs[Pl]);
      for (Pl = Tu * Yr; Pl < Mu; ++Pl)
        Fs[Pl] = sm + Bs[Tu - 1];
    }
  else if (er === All) {
    for (sm = 0, Pl = Yr; Pl < Ds; ++Pl)
      sm < Fs[Pl] && (sm = Fs[Pl]);
    for (Pl = Yr; Pl < Ds; ++Pl)
      Fs[Pl] = sm + Hs;
  } else
    for (er = !1, Tu = 1; Tu < Ms; ++Tu)
      for (Pl = Tu * Yr, Mu = Pl + Yr; Pl < Mu; ++Pl)
        Fs[Pl] += Bs[Tu - 1];
  for (zu = 0, Pl = 0; Pl < Ds; ++Pl)
    zu = Ls[Pl] + (Pl % Yr ? zu : 0), Ws[Pl] += zu - Qt[Pl].x;
  for (Iu = 0; Iu < Yr; ++Iu)
    for (Yu = 0, Pl = Iu; Pl < Ds; Pl += Yr)
      Yu += Fs[Pl], Ys[Pl] += Yu - Qt[Pl].y;
  if (Kn && get$3(Zt.center, Column) && Ms > 1)
    for (Pl = 0; Pl < Ds; ++Pl)
      Au = Kn === All ? zs : js[Pl % Yr], zu = Au - El[Pl].x2 - Qt[Pl].x - Ws[Pl], zu > 0 && (Ws[Pl] += zu / 2);
  if (er && get$3(Zt.center, Row) && Yr !== 1)
    for (Pl = 0; Pl < Ds; ++Pl)
      Au = er === All ? Hs : Bs[~~(Pl / Yr)], Yu = Au - El[Pl].y2 - Qt[Pl].y - Ys[Pl], Yu > 0 && (Ys[Pl] += Yu / 2);
  for (Pl = 0; Pl < Ds; ++Pl)
    kn.union(El[Pl].translate(Ws[Pl], Ys[Pl]));
  switch (zu = get$3(Zt.anchor, X), Yu = get$3(Zt.anchor, Y), get$3(Zt.anchor, Column)) {
    case End$1:
      zu -= kn.width();
      break;
    case Middle$1:
      zu -= kn.width() / 2;
  }
  switch (get$3(Zt.anchor, Row)) {
    case End$1:
      Yu -= kn.height();
      break;
    case Middle$1:
      Yu -= kn.height() / 2;
  }
  for (zu = Math.round(zu), Yu = Math.round(Yu), kn.clear(), Pl = 0; Pl < Ds; ++Pl)
    Qt[Pl].mark.bounds.clear();
  for (Pl = 0; Pl < Ds; ++Pl)
    Nu = Qt[Pl], Nu.x += Ws[Pl] += zu, Nu.y += Ys[Pl] += Yu, kn.union(Nu.mark.bounds.union(Nu.bounds.translate(Ws[Pl], Ys[Pl]))), $n && _e.dirty(Nu);
  return kn;
}
function trellisLayout(_e, Qt, Zt) {
  var $n = gridLayoutGroups(Qt), Sn = $n.marks, kn = Zt.bounds === Flush ? boundFlush : boundFull, Kn = Zt.offset, er = Zt.columns || Sn.length, Cr = er <= 0 ? 1 : Math.ceil(Sn.length / er), kr = Cr * er, Yr, Ms, Ds, Ls, js, zs, Fs;
  const Bs = gridLayout(_e, Sn, Zt);
  Bs.empty() && Bs.set(0, 0, 0, 0), $n.rowheaders && (zs = get$3(Zt.headerBand, Row, null), Yr = layoutHeaders(_e, $n.rowheaders, Sn, er, Cr, -get$3(Kn, "rowHeader"), min, 0, kn, "x1", 0, er, 1, zs)), $n.colheaders && (zs = get$3(Zt.headerBand, Column, null), Ms = layoutHeaders(_e, $n.colheaders, Sn, er, er, -get$3(Kn, "columnHeader"), min, 1, kn, "y1", 0, 1, er, zs)), $n.rowfooters && (zs = get$3(Zt.footerBand, Row, null), Ds = layoutHeaders(_e, $n.rowfooters, Sn, er, Cr, get$3(Kn, "rowFooter"), max, 0, kn, "x2", er - 1, er, 1, zs)), $n.colfooters && (zs = get$3(Zt.footerBand, Column, null), Ls = layoutHeaders(_e, $n.colfooters, Sn, er, er, get$3(Kn, "columnFooter"), max, 1, kn, "y2", kr - er, 1, er, zs)), $n.rowtitle && (js = get$3(Zt.titleAnchor, Row), Fs = get$3(Kn, "rowTitle"), Fs = js === End$1 ? Ds + Fs : Yr - Fs, zs = get$3(Zt.titleBand, Row, 0.5), layoutTitle(_e, $n.rowtitle, Fs, 0, Bs, zs)), $n.coltitle && (js = get$3(Zt.titleAnchor, Column), Fs = get$3(Kn, "columnTitle"), Fs = js === End$1 ? Ls + Fs : Ms - Fs, zs = get$3(Zt.titleBand, Column, 0.5), layoutTitle(_e, $n.coltitle, Fs, 1, Bs, zs));
}
function boundFlush(_e, Qt) {
  return Qt === "x1" ? _e.x || 0 : Qt === "y1" ? _e.y || 0 : Qt === "x2" ? (_e.x || 0) + (_e.width || 0) : Qt === "y2" ? (_e.y || 0) + (_e.height || 0) : void 0;
}
function boundFull(_e, Qt) {
  return _e.bounds[Qt];
}
function layoutHeaders(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr, kr, Yr, Ms, Ds, Ls) {
  var js = Zt.length, zs = 0, Fs = 0, Bs, Hs, Ws, Ys, El, Mu, Pl, Iu, Tu;
  if (!js)
    return zs;
  for (Bs = Yr; Bs < js; Bs += Ms)
    Zt[Bs] && (zs = Kn(zs, Cr(Zt[Bs], kr)));
  if (!Qt.length)
    return zs;
  for (Qt.length > Sn && (_e.warn("Grid headers exceed limit: " + Sn), Qt = Qt.slice(0, Sn)), zs += kn, Hs = 0, Ys = Qt.length; Hs < Ys; ++Hs)
    _e.dirty(Qt[Hs]), Qt[Hs].mark.bounds.clear();
  for (Bs = Yr, Hs = 0, Ys = Qt.length; Hs < Ys; ++Hs, Bs += Ms) {
    for (Mu = Qt[Hs], El = Mu.mark.bounds, Ws = Bs; Ws >= 0 && (Pl = Zt[Ws]) == null; Ws -= Ds)
      ;
    er ? (Iu = Ls == null ? Pl.x : Math.round(Pl.bounds.x1 + Ls * Pl.bounds.width()), Tu = zs) : (Iu = zs, Tu = Ls == null ? Pl.y : Math.round(Pl.bounds.y1 + Ls * Pl.bounds.height())), El.union(Mu.bounds.translate(Iu - (Mu.x || 0), Tu - (Mu.y || 0))), Mu.x = Iu, Mu.y = Tu, _e.dirty(Mu), Fs = Kn(Fs, El[kr]);
  }
  return Fs;
}
function layoutTitle(_e, Qt, Zt, $n, Sn, kn) {
  if (Qt) {
    _e.dirty(Qt);
    var Kn = Zt, er = Zt;
    $n ? Kn = Math.round(Sn.x1 + kn * Sn.width()) : er = Math.round(Sn.y1 + kn * Sn.height()), Qt.bounds.translate(Kn - (Qt.x || 0), er - (Qt.y || 0)), Qt.mark.bounds.clear().union(Qt.bounds), Qt.x = Kn, Qt.y = er, _e.dirty(Qt);
  }
}
function lookup$3(_e, Qt) {
  const Zt = _e[Qt] || {};
  return ($n, Sn) => Zt[$n] != null ? Zt[$n] : _e[$n] != null ? _e[$n] : Sn;
}
function offsets(_e, Qt) {
  let Zt = -1 / 0;
  return _e.forEach(($n) => {
    $n.offset != null && (Zt = Math.max(Zt, $n.offset));
  }), Zt > -1 / 0 ? Zt : Qt;
}
function legendParams(_e, Qt, Zt, $n, Sn, kn, Kn) {
  const er = lookup$3(Zt, Qt), Cr = offsets(_e, er("offset", 0)), kr = er("anchor", Start$1), Yr = kr === End$1 ? 1 : kr === Middle$1 ? 0.5 : 0, Ms = {
    align: Each,
    bounds: er("bounds", Flush),
    columns: er("direction") === "vertical" ? 1 : _e.length,
    padding: er("margin", 8),
    center: er("center"),
    nodirty: !0
  };
  switch (Qt) {
    case Left$1:
      Ms.anchor = {
        x: Math.floor($n.x1) - Cr,
        column: End$1,
        y: Yr * (Kn || $n.height() + 2 * $n.y1),
        row: kr
      };
      break;
    case Right$1:
      Ms.anchor = {
        x: Math.ceil($n.x2) + Cr,
        y: Yr * (Kn || $n.height() + 2 * $n.y1),
        row: kr
      };
      break;
    case Top$1:
      Ms.anchor = {
        y: Math.floor(Sn.y1) - Cr,
        row: End$1,
        x: Yr * (kn || Sn.width() + 2 * Sn.x1),
        column: kr
      };
      break;
    case Bottom$1:
      Ms.anchor = {
        y: Math.ceil(Sn.y2) + Cr,
        x: Yr * (kn || Sn.width() + 2 * Sn.x1),
        column: kr
      };
      break;
    case TopLeft:
      Ms.anchor = {
        x: Cr,
        y: Cr
      };
      break;
    case TopRight:
      Ms.anchor = {
        x: kn - Cr,
        y: Cr,
        column: End$1
      };
      break;
    case BottomLeft:
      Ms.anchor = {
        x: Cr,
        y: Kn - Cr,
        row: End$1
      };
      break;
    case BottomRight:
      Ms.anchor = {
        x: kn - Cr,
        y: Kn - Cr,
        column: End$1,
        row: End$1
      };
      break;
  }
  return Ms;
}
function legendLayout(_e, Qt) {
  var Zt = Qt.items[0], $n = Zt.datum, Sn = Zt.orient, kn = Zt.bounds, Kn = Zt.x, er = Zt.y, Cr, kr;
  return Zt._bounds ? Zt._bounds.clear().union(kn) : Zt._bounds = kn.clone(), kn.clear(), legendGroupLayout(_e, Zt, Zt.items[0].items[0]), kn = legendBounds(Zt, kn), Cr = 2 * Zt.padding, kr = 2 * Zt.padding, kn.empty() || (Cr = Math.ceil(kn.width() + Cr), kr = Math.ceil(kn.height() + kr)), $n.type === Symbols$1 && legendEntryLayout(Zt.items[0].items[0].items[0].items), Sn !== None && (Zt.x = Kn = 0, Zt.y = er = 0), Zt.width = Cr, Zt.height = kr, boundStroke(kn.set(Kn, er, Kn + Cr, er + kr), Zt), Zt.mark.bounds.clear().union(kn), Zt;
}
function legendBounds(_e, Qt) {
  return _e.items.forEach((Zt) => Qt.union(Zt.bounds)), Qt.x1 = _e.padding, Qt.y1 = _e.padding, Qt;
}
function legendGroupLayout(_e, Qt, Zt) {
  var $n = Qt.padding, Sn = $n - Zt.x, kn = $n - Zt.y;
  if (!Qt.datum.title)
    (Sn || kn) && translate$1(_e, Zt, Sn, kn);
  else {
    var Kn = Qt.items[1].items[0], er = Kn.anchor, Cr = Qt.titlePadding || 0, kr = $n - Kn.x, Yr = $n - Kn.y;
    switch (Kn.orient) {
      case Left$1:
        Sn += Math.ceil(Kn.bounds.width()) + Cr;
        break;
      case Right$1:
      case Bottom$1:
        break;
      default:
        kn += Kn.bounds.height() + Cr;
    }
    switch ((Sn || kn) && translate$1(_e, Zt, Sn, kn), Kn.orient) {
      case Left$1:
        Yr += legendTitleOffset(Qt, Zt, Kn, er, 1, 1);
        break;
      case Right$1:
        kr += legendTitleOffset(Qt, Zt, Kn, End$1, 0, 0) + Cr, Yr += legendTitleOffset(Qt, Zt, Kn, er, 1, 1);
        break;
      case Bottom$1:
        kr += legendTitleOffset(Qt, Zt, Kn, er, 0, 0), Yr += legendTitleOffset(Qt, Zt, Kn, End$1, -1, 0, 1) + Cr;
        break;
      default:
        kr += legendTitleOffset(Qt, Zt, Kn, er, 0, 0);
    }
    (kr || Yr) && translate$1(_e, Kn, kr, Yr), (kr = Math.round(Kn.bounds.x1 - $n)) < 0 && (translate$1(_e, Zt, -kr, 0), translate$1(_e, Kn, -kr, 0));
  }
}
function legendTitleOffset(_e, Qt, Zt, $n, Sn, kn, Kn) {
  const er = _e.datum.type !== "symbol", Cr = Zt.datum.vgrad, kr = er && (kn || !Cr) && !Kn ? Qt.items[0] : Qt, Yr = kr.bounds[Sn ? "y2" : "x2"] - _e.padding, Ms = Cr && kn ? Yr : 0, Ds = Cr && kn ? 0 : Yr, Ls = Sn <= 0 ? 0 : multiLineOffset(Zt);
  return Math.round($n === Start$1 ? Ms : $n === End$1 ? Ds - Ls : 0.5 * (Yr - Ls));
}
function translate$1(_e, Qt, Zt, $n) {
  Qt.x += Zt, Qt.y += $n, Qt.bounds.translate(Zt, $n), Qt.mark.bounds.translate(Zt, $n), _e.dirty(Qt);
}
function legendEntryLayout(_e) {
  const Qt = _e.reduce((Zt, $n) => (Zt[$n.column] = Math.max($n.bounds.x2 - $n.x, Zt[$n.column] || 0), Zt), {});
  _e.forEach((Zt) => {
    Zt.width = Qt[Zt.column], Zt.height = Zt.bounds.y2 - Zt.y;
  });
}
function titleLayout(_e, Qt, Zt, $n, Sn) {
  var kn = Qt.items[0], Kn = kn.frame, er = kn.orient, Cr = kn.anchor, kr = kn.offset, Yr = kn.padding, Ms = kn.items[0].items[0], Ds = kn.items[1] && kn.items[1].items[0], Ls = er === Left$1 || er === Right$1 ? $n : Zt, js = 0, zs = 0, Fs = 0, Bs = 0, Hs = 0, Ws;
  if (Kn !== Group ? er === Left$1 ? (js = Sn.y2, Ls = Sn.y1) : er === Right$1 ? (js = Sn.y1, Ls = Sn.y2) : (js = Sn.x1, Ls = Sn.x2) : er === Left$1 && (js = $n, Ls = 0), Ws = Cr === Start$1 ? js : Cr === End$1 ? Ls : (js + Ls) / 2, Ds && Ds.text) {
    switch (er) {
      case Top$1:
      case Bottom$1:
        Hs = Ms.bounds.height() + Yr;
        break;
      case Left$1:
        Bs = Ms.bounds.width() + Yr;
        break;
      case Right$1:
        Bs = -Ms.bounds.width() - Yr;
        break;
    }
    tempBounds.clear().union(Ds.bounds), tempBounds.translate(Bs - (Ds.x || 0), Hs - (Ds.y || 0)), set$4(Ds, "x", Bs) | set$4(Ds, "y", Hs) && (_e.dirty(Ds), Ds.bounds.clear().union(tempBounds), Ds.mark.bounds.clear().union(tempBounds), _e.dirty(Ds)), tempBounds.clear().union(Ds.bounds);
  } else
    tempBounds.clear();
  switch (tempBounds.union(Ms.bounds), er) {
    case Top$1:
      zs = Ws, Fs = Sn.y1 - tempBounds.height() - kr;
      break;
    case Left$1:
      zs = Sn.x1 - tempBounds.width() - kr, Fs = Ws;
      break;
    case Right$1:
      zs = Sn.x2 + tempBounds.width() + kr, Fs = Ws;
      break;
    case Bottom$1:
      zs = Ws, Fs = Sn.y2 + kr;
      break;
    default:
      zs = kn.x, Fs = kn.y;
  }
  return set$4(kn, "x", zs) | set$4(kn, "y", Fs) && (tempBounds.translate(zs, Fs), _e.dirty(kn), kn.bounds.clear().union(tempBounds), Qt.bounds.clear().union(tempBounds), _e.dirty(kn)), kn.bounds;
}
function ViewLayout$1(_e) {
  Transform$1.call(this, null, _e);
}
inherits(ViewLayout$1, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.dataflow;
    return _e.mark.items.forEach(($n) => {
      _e.layout && trellisLayout(Zt, $n, _e.layout), layoutGroup(Zt, $n, _e);
    }), shouldReflow(_e.mark.group) ? Qt.reflow() : Qt;
  }
});
function shouldReflow(_e) {
  return _e && _e.mark.role !== "legend-entry";
}
function layoutGroup(_e, Qt, Zt) {
  var $n = Qt.items, Sn = Math.max(0, Qt.width || 0), kn = Math.max(0, Qt.height || 0), Kn = new Bounds().set(0, 0, Sn, kn), er = Kn.clone(), Cr = Kn.clone(), kr = [], Yr, Ms, Ds, Ls, js, zs;
  for (js = 0, zs = $n.length; js < zs; ++js)
    switch (Ms = $n[js], Ms.role) {
      case AxisRole$1:
        Ls = isYAxis(Ms) ? er : Cr, Ls.union(axisLayout(_e, Ms, Sn, kn));
        break;
      case TitleRole$1:
        Yr = Ms;
        break;
      case LegendRole$1:
        kr.push(legendLayout(_e, Ms));
        break;
      case FrameRole$1:
      case ScopeRole$1:
      case RowHeader:
      case RowFooter:
      case RowTitle:
      case ColHeader:
      case ColFooter:
      case ColTitle:
        er.union(Ms.bounds), Cr.union(Ms.bounds);
        break;
      default:
        Kn.union(Ms.bounds);
    }
  if (kr.length) {
    const Fs = {};
    kr.forEach((Bs) => {
      Ds = Bs.orient || Right$1, Ds !== None && (Fs[Ds] || (Fs[Ds] = [])).push(Bs);
    });
    for (const Bs in Fs) {
      const Hs = Fs[Bs];
      gridLayout(_e, Hs, legendParams(Hs, Bs, Zt.legends, er, Cr, Sn, kn));
    }
    kr.forEach((Bs) => {
      const Hs = Bs.bounds;
      if (Hs.equals(Bs._bounds) || (Bs.bounds = Bs._bounds, _e.dirty(Bs), Bs.bounds = Hs, _e.dirty(Bs)), Zt.autosize && (Zt.autosize.type === Fit || Zt.autosize.type === FitX || Zt.autosize.type === FitY))
        switch (Bs.orient) {
          case Left$1:
          case Right$1:
            Kn.add(Hs.x1, 0).add(Hs.x2, 0);
            break;
          case Top$1:
          case Bottom$1:
            Kn.add(0, Hs.y1).add(0, Hs.y2);
        }
      else
        Kn.union(Hs);
    });
  }
  Kn.union(er).union(Cr), Yr && Kn.union(titleLayout(_e, Yr, Sn, kn, Kn)), Qt.clip && Kn.set(0, 0, Qt.width || 0, Qt.height || 0), viewSizeLayout(_e, Qt, Kn, Zt);
}
function viewSizeLayout(_e, Qt, Zt, $n) {
  const Sn = $n.autosize || {}, kn = Sn.type;
  if (_e._autosize < 1 || !kn)
    return;
  let Kn = _e._width, er = _e._height, Cr = Math.max(0, Qt.width || 0), kr = Math.max(0, Math.ceil(-Zt.x1)), Yr = Math.max(0, Qt.height || 0), Ms = Math.max(0, Math.ceil(-Zt.y1));
  const Ds = Math.max(0, Math.ceil(Zt.x2 - Cr)), Ls = Math.max(0, Math.ceil(Zt.y2 - Yr));
  if (Sn.contains === Padding$1) {
    const js = _e.padding();
    Kn -= js.left + js.right, er -= js.top + js.bottom;
  }
  kn === None ? (kr = 0, Ms = 0, Cr = Kn, Yr = er) : kn === Fit ? (Cr = Math.max(0, Kn - kr - Ds), Yr = Math.max(0, er - Ms - Ls)) : kn === FitX ? (Cr = Math.max(0, Kn - kr - Ds), er = Yr + Ms + Ls) : kn === FitY ? (Kn = Cr + kr + Ds, Yr = Math.max(0, er - Ms - Ls)) : kn === Pad && (Kn = Cr + kr + Ds, er = Yr + Ms + Ls), _e._resizeView(Kn, er, Cr, Yr, [kr, Ms], Sn.resize);
}
const vtx = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  bound: Bound$1,
  identifier: Identifier$1,
  mark: Mark$2,
  overlap: Overlap$1,
  render: Render$1,
  viewlayout: ViewLayout$1
}, Symbol.toStringTag, { value: "Module" }));
function AxisTicks$1(_e) {
  Transform$1.call(this, null, _e);
}
inherits(AxisTicks$1, Transform$1, {
  transform(_e, Qt) {
    if (this.value && !_e.modified())
      return Qt.StopPropagation;
    var Zt = Qt.dataflow.locale(), $n = Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS), Sn = this.value, kn = _e.scale, Kn = _e.count == null ? _e.values ? _e.values.length : 10 : _e.count, er = tickCount(kn, Kn, _e.minstep), Cr = _e.format || tickFormat(Zt, kn, er, _e.formatSpecifier, _e.formatType, !!_e.values), kr = _e.values ? validTicks(kn, _e.values, er) : tickValues(kn, er);
    return Sn && ($n.rem = Sn), Sn = kr.map((Yr, Ms) => ingest$1({
      index: Ms / (kr.length - 1 || 1),
      value: Yr,
      label: Cr(Yr)
    })), _e.extra && Sn.length && Sn.push(ingest$1({
      index: -1,
      extra: {
        value: Sn[0].value
      },
      label: ""
    })), $n.source = Sn, $n.add = Sn, this.value = Sn, $n;
  }
});
function DataJoin$1(_e) {
  Transform$1.call(this, null, _e);
}
function defaultItemCreate() {
  return ingest$1({});
}
function newMap(_e) {
  const Qt = fastmap().test((Zt) => Zt.exit);
  return Qt.lookup = (Zt) => Qt.get(_e(Zt)), Qt;
}
inherits(DataJoin$1, Transform$1, {
  transform(_e, Qt) {
    var Zt = Qt.dataflow, $n = Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS), Sn = _e.item || defaultItemCreate, kn = _e.key || tupleid, Kn = this.value;
    return isArray($n.encode) && ($n.encode = null), Kn && (_e.modified("key") || Qt.modified(kn)) && error("DataJoin does not support modified key function or fields."), Kn || (Qt = Qt.addAll(), this.value = Kn = newMap(kn)), Qt.visit(Qt.ADD, (er) => {
      const Cr = kn(er);
      let kr = Kn.get(Cr);
      kr ? kr.exit ? (Kn.empty--, $n.add.push(kr)) : $n.mod.push(kr) : (kr = Sn(er), Kn.set(Cr, kr), $n.add.push(kr)), kr.datum = er, kr.exit = !1;
    }), Qt.visit(Qt.MOD, (er) => {
      const Cr = kn(er), kr = Kn.get(Cr);
      kr && (kr.datum = er, $n.mod.push(kr));
    }), Qt.visit(Qt.REM, (er) => {
      const Cr = kn(er), kr = Kn.get(Cr);
      er === kr.datum && !kr.exit && ($n.rem.push(kr), kr.exit = !0, ++Kn.empty);
    }), Qt.changed(Qt.ADD_MOD) && $n.modifies("datum"), (Qt.clean() || _e.clean && Kn.empty > Zt.cleanThreshold) && Zt.runAfter(Kn.clean), $n;
  }
});
function Encode$1(_e) {
  Transform$1.call(this, null, _e);
}
inherits(Encode$1, Transform$1, {
  transform(_e, Qt) {
    var Zt = Qt.fork(Qt.ADD_REM), $n = _e.mod || !1, Sn = _e.encoders, kn = Qt.encode;
    if (isArray(kn))
      if (Zt.changed() || kn.every((Ms) => Sn[Ms]))
        kn = kn[0], Zt.encode = null;
      else
        return Qt.StopPropagation;
    var Kn = kn === "enter", er = Sn.update || falsy, Cr = Sn.enter || falsy, kr = Sn.exit || falsy, Yr = (kn && !Kn ? Sn[kn] : er) || falsy;
    if (Qt.changed(Qt.ADD) && (Qt.visit(Qt.ADD, (Ms) => {
      Cr(Ms, _e), er(Ms, _e);
    }), Zt.modifies(Cr.output), Zt.modifies(er.output), Yr !== falsy && Yr !== er && (Qt.visit(Qt.ADD, (Ms) => {
      Yr(Ms, _e);
    }), Zt.modifies(Yr.output))), Qt.changed(Qt.REM) && kr !== falsy && (Qt.visit(Qt.REM, (Ms) => {
      kr(Ms, _e);
    }), Zt.modifies(kr.output)), Kn || Yr !== falsy) {
      const Ms = Qt.MOD | (_e.modified() ? Qt.REFLOW : 0);
      Kn ? (Qt.visit(Ms, (Ds) => {
        const Ls = Cr(Ds, _e) || $n;
        (Yr(Ds, _e) || Ls) && Zt.mod.push(Ds);
      }), Zt.mod.length && Zt.modifies(Cr.output)) : Qt.visit(Ms, (Ds) => {
        (Yr(Ds, _e) || $n) && Zt.mod.push(Ds);
      }), Zt.mod.length && Zt.modifies(Yr.output);
    }
    return Zt.changed() ? Zt : Qt.StopPropagation;
  }
});
function LegendEntries$1(_e) {
  Transform$1.call(this, [], _e);
}
inherits(LegendEntries$1, Transform$1, {
  transform(_e, Qt) {
    if (this.value != null && !_e.modified())
      return Qt.StopPropagation;
    var Zt = Qt.dataflow.locale(), $n = Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS), Sn = this.value, kn = _e.type || SymbolLegend, Kn = _e.scale, er = +_e.limit, Cr = tickCount(Kn, _e.count == null ? 5 : _e.count, _e.minstep), kr = !!_e.values || kn === SymbolLegend, Yr = _e.format || labelFormat(Zt, Kn, Cr, kn, _e.formatSpecifier, _e.formatType, kr), Ms = _e.values || labelValues(Kn, Cr), Ds, Ls, js, zs, Fs;
    return Sn && ($n.rem = Sn), kn === SymbolLegend ? (er && Ms.length > er ? (Qt.dataflow.warn("Symbol legend count exceeds limit, filtering items."), Sn = Ms.slice(0, er - 1), Fs = !0) : Sn = Ms, isFunction$1(js = _e.size) ? (!_e.values && Kn(Sn[0]) === 0 && (Sn = Sn.slice(1)), zs = Sn.reduce((Bs, Hs) => Math.max(Bs, js(Hs, _e)), 0)) : js = constant$7(zs = js || 8), Sn = Sn.map((Bs, Hs) => ingest$1({
      index: Hs,
      label: Yr(Bs, Hs, Sn),
      value: Bs,
      offset: zs,
      size: js(Bs, _e)
    })), Fs && (Fs = Ms[Sn.length], Sn.push(ingest$1({
      index: Sn.length,
      label: `…${Ms.length - Sn.length} entries`,
      value: Fs,
      offset: zs,
      size: js(Fs, _e)
    })))) : kn === GradientLegend ? (Ds = Kn.domain(), Ls = scaleFraction(Kn, Ds[0], peek$1(Ds)), Ms.length < 3 && !_e.values && Ds[0] !== peek$1(Ds) && (Ms = [Ds[0], peek$1(Ds)]), Sn = Ms.map((Bs, Hs) => ingest$1({
      index: Hs,
      label: Yr(Bs, Hs, Ms),
      value: Bs,
      perc: Ls(Bs)
    }))) : (js = Ms.length - 1, Ls = labelFraction(Kn), Sn = Ms.map((Bs, Hs) => ingest$1({
      index: Hs,
      label: Yr(Bs, Hs, Ms),
      value: Bs,
      perc: Hs ? Ls(Bs) : 0,
      perc2: Hs === js ? 1 : Ls(Ms[Hs + 1])
    }))), $n.source = Sn, $n.add = Sn, this.value = Sn, $n;
  }
});
const sourceX = (_e) => _e.source.x, sourceY = (_e) => _e.source.y, targetX = (_e) => _e.target.x, targetY = (_e) => _e.target.y;
function LinkPath(_e) {
  Transform$1.call(this, {}, _e);
}
LinkPath.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"
  }]
};
inherits(LinkPath, Transform$1, {
  transform(_e, Qt) {
    var Zt = _e.sourceX || sourceX, $n = _e.sourceY || sourceY, Sn = _e.targetX || targetX, kn = _e.targetY || targetY, Kn = _e.as || "path", er = _e.orient || "vertical", Cr = _e.shape || "line", kr = Paths.get(Cr + "-" + er) || Paths.get(Cr);
    return kr || error("LinkPath unsupported type: " + _e.shape + (_e.orient ? "-" + _e.orient : "")), Qt.visit(Qt.SOURCE, (Yr) => {
      Yr[Kn] = kr(Zt(Yr), $n(Yr), Sn(Yr), kn(Yr));
    }), Qt.reflow(_e.modified()).modifies(Kn);
  }
});
const line$1 = (_e, Qt, Zt, $n) => "M" + _e + "," + Qt + "L" + Zt + "," + $n, lineR = (_e, Qt, Zt, $n) => line$1(Qt * Math.cos(_e), Qt * Math.sin(_e), $n * Math.cos(Zt), $n * Math.sin(Zt)), arc$1 = (_e, Qt, Zt, $n) => {
  var Sn = Zt - _e, kn = $n - Qt, Kn = Math.hypot(Sn, kn) / 2, er = 180 * Math.atan2(kn, Sn) / Math.PI;
  return "M" + _e + "," + Qt + "A" + Kn + "," + Kn + " " + er + " 0 1 " + Zt + "," + $n;
}, arcR = (_e, Qt, Zt, $n) => arc$1(Qt * Math.cos(_e), Qt * Math.sin(_e), $n * Math.cos(Zt), $n * Math.sin(Zt)), curve = (_e, Qt, Zt, $n) => {
  const Sn = Zt - _e, kn = $n - Qt, Kn = 0.2 * (Sn + kn), er = 0.2 * (kn - Sn);
  return "M" + _e + "," + Qt + "C" + (_e + Kn) + "," + (Qt + er) + " " + (Zt + er) + "," + ($n - Kn) + " " + Zt + "," + $n;
}, curveR = (_e, Qt, Zt, $n) => curve(Qt * Math.cos(_e), Qt * Math.sin(_e), $n * Math.cos(Zt), $n * Math.sin(Zt)), orthoX = (_e, Qt, Zt, $n) => "M" + _e + "," + Qt + "V" + $n + "H" + Zt, orthoY = (_e, Qt, Zt, $n) => "M" + _e + "," + Qt + "H" + Zt + "V" + $n, orthoR = (_e, Qt, Zt, $n) => {
  const Sn = Math.cos(_e), kn = Math.sin(_e), Kn = Math.cos(Zt), er = Math.sin(Zt), Cr = Math.abs(Zt - _e) > Math.PI ? Zt <= _e : Zt > _e;
  return "M" + Qt * Sn + "," + Qt * kn + "A" + Qt + "," + Qt + " 0 0," + (Cr ? 1 : 0) + " " + Qt * Kn + "," + Qt * er + "L" + $n * Kn + "," + $n * er;
}, diagonalX = (_e, Qt, Zt, $n) => {
  const Sn = (_e + Zt) / 2;
  return "M" + _e + "," + Qt + "C" + Sn + "," + Qt + " " + Sn + "," + $n + " " + Zt + "," + $n;
}, diagonalY = (_e, Qt, Zt, $n) => {
  const Sn = (Qt + $n) / 2;
  return "M" + _e + "," + Qt + "C" + _e + "," + Sn + " " + Zt + "," + Sn + " " + Zt + "," + $n;
}, diagonalR = (_e, Qt, Zt, $n) => {
  const Sn = Math.cos(_e), kn = Math.sin(_e), Kn = Math.cos(Zt), er = Math.sin(Zt), Cr = (Qt + $n) / 2;
  return "M" + Qt * Sn + "," + Qt * kn + "C" + Cr * Sn + "," + Cr * kn + " " + Cr * Kn + "," + Cr * er + " " + $n * Kn + "," + $n * er;
}, Paths = fastmap({
  line: line$1,
  "line-radial": lineR,
  arc: arc$1,
  "arc-radial": arcR,
  curve,
  "curve-radial": curveR,
  "orthogonal-horizontal": orthoX,
  "orthogonal-vertical": orthoY,
  "orthogonal-radial": orthoR,
  "diagonal-horizontal": diagonalX,
  "diagonal-vertical": diagonalY,
  "diagonal-radial": diagonalR
});
function Pie(_e) {
  Transform$1.call(this, null, _e);
}
Pie.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"]
  }]
};
inherits(Pie, Transform$1, {
  transform(_e, Qt) {
    var Zt = _e.as || ["startAngle", "endAngle"], $n = Zt[0], Sn = Zt[1], kn = _e.field || one$2, Kn = _e.startAngle || 0, er = _e.endAngle != null ? _e.endAngle : 2 * Math.PI, Cr = Qt.source, kr = Cr.map(kn), Yr = kr.length, Ms = Kn, Ds = (er - Kn) / sum$1(kr), Ls = range$5(Yr), js, zs, Fs;
    for (_e.sort && Ls.sort((Bs, Hs) => kr[Bs] - kr[Hs]), js = 0; js < Yr; ++js)
      Fs = kr[Ls[js]], zs = Cr[Ls[js]], zs[$n] = Ms, zs[Sn] = Ms += Fs * Ds;
    return this.value = kr, Qt.reflow(_e.modified()).modifies(Zt);
  }
});
const DEFAULT_COUNT = 5;
function includeZero(_e) {
  const Qt = _e.type;
  return !_e.bins && (Qt === Linear || Qt === Pow || Qt === Sqrt);
}
function includePad(_e) {
  return isContinuous$1(_e) && _e !== Sequential;
}
const SKIP$1 = toSet(["set", "modified", "clear", "type", "scheme", "schemeExtent", "schemeCount", "domain", "domainMin", "domainMid", "domainMax", "domainRaw", "domainImplicit", "nice", "zero", "bins", "range", "rangeStep", "round", "reverse", "interpolate", "interpolateGamma"]);
function Scale$1(_e) {
  Transform$1.call(this, null, _e), this.modified(!0);
}
inherits(Scale$1, Transform$1, {
  transform(_e, Qt) {
    var Zt = Qt.dataflow, $n = this.value, Sn = scaleKey(_e);
    (!$n || Sn !== $n.type) && (this.value = $n = scale$4(Sn)());
    for (Sn in _e)
      if (!SKIP$1[Sn]) {
        if (Sn === "padding" && includePad($n.type))
          continue;
        isFunction$1($n[Sn]) ? $n[Sn](_e[Sn]) : Zt.warn("Unsupported scale property: " + Sn);
      }
    return configureRange($n, _e, configureBins($n, _e, configureDomain($n, _e, Zt))), Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS);
  }
});
function scaleKey(_e) {
  var Qt = _e.type, Zt = "", $n;
  return Qt === Sequential ? Sequential + "-" + Linear : (isContinuousColor(_e) && ($n = _e.rawDomain ? _e.rawDomain.length : _e.domain ? _e.domain.length + +(_e.domainMid != null) : 0, Zt = $n === 2 ? Sequential + "-" : $n === 3 ? Diverging + "-" : ""), (Zt + Qt || Linear).toLowerCase());
}
function isContinuousColor(_e) {
  const Qt = _e.type;
  return isContinuous$1(Qt) && Qt !== Time && Qt !== UTC && (_e.scheme || _e.range && _e.range.length && _e.range.every(isString));
}
function configureDomain(_e, Qt, Zt) {
  const $n = rawDomain(_e, Qt.domainRaw, Zt);
  if ($n > -1)
    return $n;
  var Sn = Qt.domain, kn = _e.type, Kn = Qt.zero || Qt.zero === void 0 && includeZero(_e), er, Cr;
  if (!Sn)
    return 0;
  if (includePad(kn) && Qt.padding && Sn[0] !== peek$1(Sn) && (Sn = padDomain(kn, Sn, Qt.range, Qt.padding, Qt.exponent, Qt.constant)), (Kn || Qt.domainMin != null || Qt.domainMax != null || Qt.domainMid != null) && (er = (Sn = Sn.slice()).length - 1 || 1, Kn && (Sn[0] > 0 && (Sn[0] = 0), Sn[er] < 0 && (Sn[er] = 0)), Qt.domainMin != null && (Sn[0] = Qt.domainMin), Qt.domainMax != null && (Sn[er] = Qt.domainMax), Qt.domainMid != null)) {
    Cr = Qt.domainMid;
    const kr = Cr > Sn[er] ? er + 1 : Cr < Sn[0] ? 0 : er;
    kr !== er && Zt.warn("Scale domainMid exceeds domain min or max.", Cr), Sn.splice(kr, 0, Cr);
  }
  return _e.domain(domainCheck(kn, Sn, Zt)), kn === Ordinal && _e.unknown(Qt.domainImplicit ? implicit : void 0), Qt.nice && _e.nice && _e.nice(Qt.nice !== !0 && tickCount(_e, Qt.nice) || null), Sn.length;
}
function rawDomain(_e, Qt, Zt) {
  return Qt ? (_e.domain(domainCheck(_e.type, Qt, Zt)), Qt.length) : -1;
}
function padDomain(_e, Qt, Zt, $n, Sn, kn) {
  var Kn = Math.abs(peek$1(Zt) - Zt[0]), er = Kn / (Kn - 2 * $n), Cr = _e === Log ? zoomLog(Qt, null, er) : _e === Sqrt ? zoomPow(Qt, null, er, 0.5) : _e === Pow ? zoomPow(Qt, null, er, Sn || 1) : _e === Symlog ? zoomSymlog(Qt, null, er, kn || 1) : zoomLinear(Qt, null, er);
  return Qt = Qt.slice(), Qt[0] = Cr[0], Qt[Qt.length - 1] = Cr[1], Qt;
}
function domainCheck(_e, Qt, Zt) {
  if (isLogarithmic(_e)) {
    var $n = Math.abs(Qt.reduce((Sn, kn) => Sn + (kn < 0 ? -1 : kn > 0 ? 1 : 0), 0));
    $n !== Qt.length && Zt.warn("Log scale domain includes zero: " + $(Qt));
  }
  return Qt;
}
function configureBins(_e, Qt, Zt) {
  let $n = Qt.bins;
  if ($n && !isArray($n)) {
    const Sn = _e.domain(), kn = Sn[0], Kn = peek$1(Sn), er = $n.step;
    let Cr = $n.start == null ? kn : $n.start, kr = $n.stop == null ? Kn : $n.stop;
    er || error("Scale bins parameter missing step property."), Cr < kn && (Cr = er * Math.ceil(kn / er)), kr > Kn && (kr = er * Math.floor(Kn / er)), $n = range$5(Cr, kr + er / 2, er);
  }
  return $n ? _e.bins = $n : _e.bins && delete _e.bins, _e.type === BinOrdinal && ($n ? !Qt.domain && !Qt.domainRaw && (_e.domain($n), Zt = $n.length) : _e.bins = _e.domain()), Zt;
}
function configureRange(_e, Qt, Zt) {
  var $n = _e.type, Sn = Qt.round || !1, kn = Qt.range;
  if (Qt.rangeStep != null)
    kn = configureRangeStep($n, Qt, Zt);
  else if (Qt.scheme && (kn = configureScheme($n, Qt, Zt), isFunction$1(kn))) {
    if (_e.interpolator)
      return _e.interpolator(kn);
    error(`Scale type ${$n} does not support interpolating color schemes.`);
  }
  if (kn && isInterpolating($n))
    return _e.interpolator(interpolateColors(flip(kn, Qt.reverse), Qt.interpolate, Qt.interpolateGamma));
  kn && Qt.interpolate && _e.interpolate ? _e.interpolate(interpolate$2(Qt.interpolate, Qt.interpolateGamma)) : isFunction$1(_e.round) ? _e.round(Sn) : isFunction$1(_e.rangeRound) && _e.interpolate(Sn ? interpolateRound : interpolate$3), kn && _e.range(flip(kn, Qt.reverse));
}
function configureRangeStep(_e, Qt, Zt) {
  _e !== Band && _e !== Point && error("Only band and point scales support rangeStep.");
  var $n = (Qt.paddingOuter != null ? Qt.paddingOuter : Qt.padding) || 0, Sn = _e === Point ? 1 : (Qt.paddingInner != null ? Qt.paddingInner : Qt.padding) || 0;
  return [0, Qt.rangeStep * bandSpace(Zt, Sn, $n)];
}
function configureScheme(_e, Qt, Zt) {
  var $n = Qt.schemeExtent, Sn, kn;
  return isArray(Qt.scheme) ? kn = interpolateColors(Qt.scheme, Qt.interpolate, Qt.interpolateGamma) : (Sn = Qt.scheme.toLowerCase(), kn = scheme$1(Sn), kn || error(`Unrecognized scheme name: ${Qt.scheme}`)), Zt = _e === Threshold ? Zt + 1 : _e === BinOrdinal ? Zt - 1 : _e === Quantile || _e === Quantize ? +Qt.schemeCount || DEFAULT_COUNT : Zt, isInterpolating(_e) ? adjustScheme(kn, $n, Qt.reverse) : isFunction$1(kn) ? quantizeInterpolator(adjustScheme(kn, $n), Zt) : _e === Ordinal ? kn : kn.slice(0, Zt);
}
function adjustScheme(_e, Qt, Zt) {
  return isFunction$1(_e) && (Qt || Zt) ? interpolateRange$1(_e, flip(Qt || [0, 1], Zt)) : _e;
}
function flip(_e, Qt) {
  return Qt ? _e.slice().reverse() : _e;
}
function SortItems$1(_e) {
  Transform$1.call(this, null, _e);
}
inherits(SortItems$1, Transform$1, {
  transform(_e, Qt) {
    const Zt = _e.modified("sort") || Qt.changed(Qt.ADD) || Qt.modified(_e.sort.fields) || Qt.modified("datum");
    return Zt && Qt.source.sort(stableCompare(_e.sort)), this.modified(Zt), Qt;
  }
});
const Zero = "zero", Center$1 = "center", Normalize = "normalize", DefOutput = ["y0", "y1"];
function Stack(_e) {
  Transform$1.call(this, null, _e);
}
Stack.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: Zero,
    values: [Zero, Center$1, Normalize]
  }, {
    name: "as",
    type: "string",
    array: !0,
    length: 2,
    default: DefOutput
  }]
};
inherits(Stack, Transform$1, {
  transform(_e, Qt) {
    var Zt = _e.as || DefOutput, $n = Zt[0], Sn = Zt[1], kn = stableCompare(_e.sort), Kn = _e.field || one$2, er = _e.offset === Center$1 ? stackCenter : _e.offset === Normalize ? stackNormalize : stackZero, Cr, kr, Yr, Ms;
    for (Cr = partition$3(Qt.source, _e.groupby, kn, Kn), kr = 0, Yr = Cr.length, Ms = Cr.max; kr < Yr; ++kr)
      er(Cr[kr], Ms, Kn, $n, Sn);
    return Qt.reflow(_e.modified()).modifies(Zt);
  }
});
function stackCenter(_e, Qt, Zt, $n, Sn) {
  for (var kn = (Qt - _e.sum) / 2, Kn = _e.length, er = 0, Cr; er < Kn; ++er)
    Cr = _e[er], Cr[$n] = kn, Cr[Sn] = kn += Math.abs(Zt(Cr));
}
function stackNormalize(_e, Qt, Zt, $n, Sn) {
  for (var kn = 1 / _e.sum, Kn = 0, er = _e.length, Cr = 0, kr = 0, Yr; Cr < er; ++Cr)
    Yr = _e[Cr], Yr[$n] = Kn, Yr[Sn] = Kn = kn * (kr += Math.abs(Zt(Yr)));
}
function stackZero(_e, Qt, Zt, $n, Sn) {
  for (var kn = 0, Kn = 0, er = _e.length, Cr = 0, kr, Yr; Cr < er; ++Cr)
    Yr = _e[Cr], kr = +Zt(Yr), kr < 0 ? (Yr[$n] = Kn, Yr[Sn] = Kn += kr) : (Yr[$n] = kn, Yr[Sn] = kn += kr);
}
function partition$3(_e, Qt, Zt, $n) {
  var Sn = [], kn = (zs) => zs(Yr), Kn, er, Cr, kr, Yr, Ms, Ds, Ls, js;
  if (Qt == null)
    Sn.push(_e.slice());
  else
    for (Kn = {}, er = 0, Cr = _e.length; er < Cr; ++er)
      Yr = _e[er], Ms = Qt.map(kn), Ds = Kn[Ms], Ds || (Kn[Ms] = Ds = [], Sn.push(Ds)), Ds.push(Yr);
  for (Ms = 0, js = 0, kr = Sn.length; Ms < kr; ++Ms) {
    for (Ds = Sn[Ms], er = 0, Ls = 0, Cr = Ds.length; er < Cr; ++er)
      Ls += Math.abs($n(Ds[er]));
    Ds.sum = Ls, Ls > js && (js = Ls), Zt && Ds.sort(Zt);
  }
  return Sn.max = js, Sn;
}
const encode$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  axisticks: AxisTicks$1,
  datajoin: DataJoin$1,
  encode: Encode$1,
  legendentries: LegendEntries$1,
  linkpath: LinkPath,
  pie: Pie,
  scale: Scale$1,
  sortitems: SortItems$1,
  stack: Stack
}, Symbol.toStringTag, { value: "Module" }));
var epsilon$3 = 1e-6, epsilon2 = 1e-12, pi$2 = Math.PI, halfPi$1 = pi$2 / 2, quarterPi = pi$2 / 4, tau$1 = pi$2 * 2, degrees = 180 / pi$2, radians = pi$2 / 180, abs$1 = Math.abs, atan = Math.atan, atan2 = Math.atan2, cos$1 = Math.cos, ceil = Math.ceil, exp = Math.exp, hypot = Math.hypot, log$2 = Math.log, pow$1 = Math.pow, sin$1 = Math.sin, sign = Math.sign || function(_e) {
  return _e > 0 ? 1 : _e < 0 ? -1 : 0;
}, sqrt$1 = Math.sqrt, tan = Math.tan;
function acos(_e) {
  return _e > 1 ? 0 : _e < -1 ? pi$2 : Math.acos(_e);
}
function asin$1(_e) {
  return _e > 1 ? halfPi$1 : _e < -1 ? -halfPi$1 : Math.asin(_e);
}
function noop$5() {
}
function streamGeometry(_e, Qt) {
  _e && streamGeometryType.hasOwnProperty(_e.type) && streamGeometryType[_e.type](_e, Qt);
}
var streamObjectType = {
  Feature: function(_e, Qt) {
    streamGeometry(_e.geometry, Qt);
  },
  FeatureCollection: function(_e, Qt) {
    for (var Zt = _e.features, $n = -1, Sn = Zt.length; ++$n < Sn; )
      streamGeometry(Zt[$n].geometry, Qt);
  }
}, streamGeometryType = {
  Sphere: function(_e, Qt) {
    Qt.sphere();
  },
  Point: function(_e, Qt) {
    _e = _e.coordinates, Qt.point(_e[0], _e[1], _e[2]);
  },
  MultiPoint: function(_e, Qt) {
    for (var Zt = _e.coordinates, $n = -1, Sn = Zt.length; ++$n < Sn; )
      _e = Zt[$n], Qt.point(_e[0], _e[1], _e[2]);
  },
  LineString: function(_e, Qt) {
    streamLine(_e.coordinates, Qt, 0);
  },
  MultiLineString: function(_e, Qt) {
    for (var Zt = _e.coordinates, $n = -1, Sn = Zt.length; ++$n < Sn; )
      streamLine(Zt[$n], Qt, 0);
  },
  Polygon: function(_e, Qt) {
    streamPolygon(_e.coordinates, Qt);
  },
  MultiPolygon: function(_e, Qt) {
    for (var Zt = _e.coordinates, $n = -1, Sn = Zt.length; ++$n < Sn; )
      streamPolygon(Zt[$n], Qt);
  },
  GeometryCollection: function(_e, Qt) {
    for (var Zt = _e.geometries, $n = -1, Sn = Zt.length; ++$n < Sn; )
      streamGeometry(Zt[$n], Qt);
  }
};
function streamLine(_e, Qt, Zt) {
  var $n = -1, Sn = _e.length - Zt, kn;
  for (Qt.lineStart(); ++$n < Sn; )
    kn = _e[$n], Qt.point(kn[0], kn[1], kn[2]);
  Qt.lineEnd();
}
function streamPolygon(_e, Qt) {
  var Zt = -1, $n = _e.length;
  for (Qt.polygonStart(); ++Zt < $n; )
    streamLine(_e[Zt], Qt, 1);
  Qt.polygonEnd();
}
function geoStream(_e, Qt) {
  _e && streamObjectType.hasOwnProperty(_e.type) ? streamObjectType[_e.type](_e, Qt) : streamGeometry(_e, Qt);
}
var areaRingSum$1 = new Adder(), areaSum$1 = new Adder(), lambda00$2, phi00$2, lambda0$1, cosPhi0, sinPhi0, areaStream$1 = {
  point: noop$5,
  lineStart: noop$5,
  lineEnd: noop$5,
  polygonStart: function() {
    areaRingSum$1 = new Adder(), areaStream$1.lineStart = areaRingStart$1, areaStream$1.lineEnd = areaRingEnd$1;
  },
  polygonEnd: function() {
    var _e = +areaRingSum$1;
    areaSum$1.add(_e < 0 ? tau$1 + _e : _e), this.lineStart = this.lineEnd = this.point = noop$5;
  },
  sphere: function() {
    areaSum$1.add(tau$1);
  }
};
function areaRingStart$1() {
  areaStream$1.point = areaPointFirst$1;
}
function areaRingEnd$1() {
  areaPoint$1(lambda00$2, phi00$2);
}
function areaPointFirst$1(_e, Qt) {
  areaStream$1.point = areaPoint$1, lambda00$2 = _e, phi00$2 = Qt, _e *= radians, Qt *= radians, lambda0$1 = _e, cosPhi0 = cos$1(Qt = Qt / 2 + quarterPi), sinPhi0 = sin$1(Qt);
}
function areaPoint$1(_e, Qt) {
  _e *= radians, Qt *= radians, Qt = Qt / 2 + quarterPi;
  var Zt = _e - lambda0$1, $n = Zt >= 0 ? 1 : -1, Sn = $n * Zt, kn = cos$1(Qt), Kn = sin$1(Qt), er = sinPhi0 * Kn, Cr = cosPhi0 * kn + er * cos$1(Sn), kr = er * $n * sin$1(Sn);
  areaRingSum$1.add(atan2(kr, Cr)), lambda0$1 = _e, cosPhi0 = kn, sinPhi0 = Kn;
}
function geoArea$1(_e) {
  return areaSum$1 = new Adder(), geoStream(_e, areaStream$1), areaSum$1 * 2;
}
function spherical(_e) {
  return [atan2(_e[1], _e[0]), asin$1(_e[2])];
}
function cartesian(_e) {
  var Qt = _e[0], Zt = _e[1], $n = cos$1(Zt);
  return [$n * cos$1(Qt), $n * sin$1(Qt), sin$1(Zt)];
}
function cartesianDot(_e, Qt) {
  return _e[0] * Qt[0] + _e[1] * Qt[1] + _e[2] * Qt[2];
}
function cartesianCross(_e, Qt) {
  return [_e[1] * Qt[2] - _e[2] * Qt[1], _e[2] * Qt[0] - _e[0] * Qt[2], _e[0] * Qt[1] - _e[1] * Qt[0]];
}
function cartesianAddInPlace(_e, Qt) {
  _e[0] += Qt[0], _e[1] += Qt[1], _e[2] += Qt[2];
}
function cartesianScale(_e, Qt) {
  return [_e[0] * Qt, _e[1] * Qt, _e[2] * Qt];
}
function cartesianNormalizeInPlace(_e) {
  var Qt = sqrt$1(_e[0] * _e[0] + _e[1] * _e[1] + _e[2] * _e[2]);
  _e[0] /= Qt, _e[1] /= Qt, _e[2] /= Qt;
}
var lambda0, phi0, lambda1, phi1, lambda2, lambda00$1, phi00$1, p0$1, deltaSum, ranges, range$4, boundsStream$2 = {
  point: boundsPoint$1,
  lineStart: boundsLineStart,
  lineEnd: boundsLineEnd,
  polygonStart: function() {
    boundsStream$2.point = boundsRingPoint, boundsStream$2.lineStart = boundsRingStart, boundsStream$2.lineEnd = boundsRingEnd, deltaSum = new Adder(), areaStream$1.polygonStart();
  },
  polygonEnd: function() {
    areaStream$1.polygonEnd(), boundsStream$2.point = boundsPoint$1, boundsStream$2.lineStart = boundsLineStart, boundsStream$2.lineEnd = boundsLineEnd, areaRingSum$1 < 0 ? (lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90)) : deltaSum > epsilon$3 ? phi1 = 90 : deltaSum < -epsilon$3 && (phi0 = -90), range$4[0] = lambda0, range$4[1] = lambda1;
  },
  sphere: function() {
    lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);
  }
};
function boundsPoint$1(_e, Qt) {
  ranges.push(range$4 = [lambda0 = _e, lambda1 = _e]), Qt < phi0 && (phi0 = Qt), Qt > phi1 && (phi1 = Qt);
}
function linePoint(_e, Qt) {
  var Zt = cartesian([_e * radians, Qt * radians]);
  if (p0$1) {
    var $n = cartesianCross(p0$1, Zt), Sn = [$n[1], -$n[0], 0], kn = cartesianCross(Sn, $n);
    cartesianNormalizeInPlace(kn), kn = spherical(kn);
    var Kn = _e - lambda2, er = Kn > 0 ? 1 : -1, Cr = kn[0] * degrees * er, kr, Yr = abs$1(Kn) > 180;
    Yr ^ (er * lambda2 < Cr && Cr < er * _e) ? (kr = kn[1] * degrees, kr > phi1 && (phi1 = kr)) : (Cr = (Cr + 360) % 360 - 180, Yr ^ (er * lambda2 < Cr && Cr < er * _e) ? (kr = -kn[1] * degrees, kr < phi0 && (phi0 = kr)) : (Qt < phi0 && (phi0 = Qt), Qt > phi1 && (phi1 = Qt))), Yr ? _e < lambda2 ? angle(lambda0, _e) > angle(lambda0, lambda1) && (lambda1 = _e) : angle(_e, lambda1) > angle(lambda0, lambda1) && (lambda0 = _e) : lambda1 >= lambda0 ? (_e < lambda0 && (lambda0 = _e), _e > lambda1 && (lambda1 = _e)) : _e > lambda2 ? angle(lambda0, _e) > angle(lambda0, lambda1) && (lambda1 = _e) : angle(_e, lambda1) > angle(lambda0, lambda1) && (lambda0 = _e);
  } else
    ranges.push(range$4 = [lambda0 = _e, lambda1 = _e]);
  Qt < phi0 && (phi0 = Qt), Qt > phi1 && (phi1 = Qt), p0$1 = Zt, lambda2 = _e;
}
function boundsLineStart() {
  boundsStream$2.point = linePoint;
}
function boundsLineEnd() {
  range$4[0] = lambda0, range$4[1] = lambda1, boundsStream$2.point = boundsPoint$1, p0$1 = null;
}
function boundsRingPoint(_e, Qt) {
  if (p0$1) {
    var Zt = _e - lambda2;
    deltaSum.add(abs$1(Zt) > 180 ? Zt + (Zt > 0 ? 360 : -360) : Zt);
  } else
    lambda00$1 = _e, phi00$1 = Qt;
  areaStream$1.point(_e, Qt), linePoint(_e, Qt);
}
function boundsRingStart() {
  areaStream$1.lineStart();
}
function boundsRingEnd() {
  boundsRingPoint(lambda00$1, phi00$1), areaStream$1.lineEnd(), abs$1(deltaSum) > epsilon$3 && (lambda0 = -(lambda1 = 180)), range$4[0] = lambda0, range$4[1] = lambda1, p0$1 = null;
}
function angle(_e, Qt) {
  return (Qt -= _e) < 0 ? Qt + 360 : Qt;
}
function rangeCompare(_e, Qt) {
  return _e[0] - Qt[0];
}
function rangeContains(_e, Qt) {
  return _e[0] <= _e[1] ? _e[0] <= Qt && Qt <= _e[1] : Qt < _e[0] || _e[1] < Qt;
}
function geoBounds$1(_e) {
  var Qt, Zt, $n, Sn, kn, Kn, er;
  if (phi1 = lambda1 = -(lambda0 = phi0 = 1 / 0), ranges = [], geoStream(_e, boundsStream$2), Zt = ranges.length) {
    for (ranges.sort(rangeCompare), Qt = 1, $n = ranges[0], kn = [$n]; Qt < Zt; ++Qt)
      Sn = ranges[Qt], rangeContains($n, Sn[0]) || rangeContains($n, Sn[1]) ? (angle($n[0], Sn[1]) > angle($n[0], $n[1]) && ($n[1] = Sn[1]), angle(Sn[0], $n[1]) > angle($n[0], $n[1]) && ($n[0] = Sn[0])) : kn.push($n = Sn);
    for (Kn = -1 / 0, Zt = kn.length - 1, Qt = 0, $n = kn[Zt]; Qt <= Zt; $n = Sn, ++Qt)
      Sn = kn[Qt], (er = angle($n[1], Sn[0])) > Kn && (Kn = er, lambda0 = Sn[0], lambda1 = $n[1]);
  }
  return ranges = range$4 = null, lambda0 === 1 / 0 || phi0 === 1 / 0 ? [[NaN, NaN], [NaN, NaN]] : [[lambda0, phi0], [lambda1, phi1]];
}
var W0$1, W1$1, X0$2, Y0$2, Z0$2, X1$2, Y1$2, Z1$2, X2$1, Y2$1, Z2$1, lambda00, phi00, x0$5, y0$5, z0$1, centroidStream$1 = {
  sphere: noop$5,
  point: centroidPoint$1,
  lineStart: centroidLineStart$1,
  lineEnd: centroidLineEnd$1,
  polygonStart: function() {
    centroidStream$1.lineStart = centroidRingStart$1, centroidStream$1.lineEnd = centroidRingEnd$1;
  },
  polygonEnd: function() {
    centroidStream$1.lineStart = centroidLineStart$1, centroidStream$1.lineEnd = centroidLineEnd$1;
  }
};
function centroidPoint$1(_e, Qt) {
  _e *= radians, Qt *= radians;
  var Zt = cos$1(Qt);
  centroidPointCartesian(Zt * cos$1(_e), Zt * sin$1(_e), sin$1(Qt));
}
function centroidPointCartesian(_e, Qt, Zt) {
  ++W0$1, X0$2 += (_e - X0$2) / W0$1, Y0$2 += (Qt - Y0$2) / W0$1, Z0$2 += (Zt - Z0$2) / W0$1;
}
function centroidLineStart$1() {
  centroidStream$1.point = centroidLinePointFirst;
}
function centroidLinePointFirst(_e, Qt) {
  _e *= radians, Qt *= radians;
  var Zt = cos$1(Qt);
  x0$5 = Zt * cos$1(_e), y0$5 = Zt * sin$1(_e), z0$1 = sin$1(Qt), centroidStream$1.point = centroidLinePoint, centroidPointCartesian(x0$5, y0$5, z0$1);
}
function centroidLinePoint(_e, Qt) {
  _e *= radians, Qt *= radians;
  var Zt = cos$1(Qt), $n = Zt * cos$1(_e), Sn = Zt * sin$1(_e), kn = sin$1(Qt), Kn = atan2(sqrt$1((Kn = y0$5 * kn - z0$1 * Sn) * Kn + (Kn = z0$1 * $n - x0$5 * kn) * Kn + (Kn = x0$5 * Sn - y0$5 * $n) * Kn), x0$5 * $n + y0$5 * Sn + z0$1 * kn);
  W1$1 += Kn, X1$2 += Kn * (x0$5 + (x0$5 = $n)), Y1$2 += Kn * (y0$5 + (y0$5 = Sn)), Z1$2 += Kn * (z0$1 + (z0$1 = kn)), centroidPointCartesian(x0$5, y0$5, z0$1);
}
function centroidLineEnd$1() {
  centroidStream$1.point = centroidPoint$1;
}
function centroidRingStart$1() {
  centroidStream$1.point = centroidRingPointFirst;
}
function centroidRingEnd$1() {
  centroidRingPoint(lambda00, phi00), centroidStream$1.point = centroidPoint$1;
}
function centroidRingPointFirst(_e, Qt) {
  lambda00 = _e, phi00 = Qt, _e *= radians, Qt *= radians, centroidStream$1.point = centroidRingPoint;
  var Zt = cos$1(Qt);
  x0$5 = Zt * cos$1(_e), y0$5 = Zt * sin$1(_e), z0$1 = sin$1(Qt), centroidPointCartesian(x0$5, y0$5, z0$1);
}
function centroidRingPoint(_e, Qt) {
  _e *= radians, Qt *= radians;
  var Zt = cos$1(Qt), $n = Zt * cos$1(_e), Sn = Zt * sin$1(_e), kn = sin$1(Qt), Kn = y0$5 * kn - z0$1 * Sn, er = z0$1 * $n - x0$5 * kn, Cr = x0$5 * Sn - y0$5 * $n, kr = hypot(Kn, er, Cr), Yr = asin$1(kr), Ms = kr && -Yr / kr;
  X2$1.add(Ms * Kn), Y2$1.add(Ms * er), Z2$1.add(Ms * Cr), W1$1 += Yr, X1$2 += Yr * (x0$5 + (x0$5 = $n)), Y1$2 += Yr * (y0$5 + (y0$5 = Sn)), Z1$2 += Yr * (z0$1 + (z0$1 = kn)), centroidPointCartesian(x0$5, y0$5, z0$1);
}
function geoCentroid$1(_e) {
  W0$1 = W1$1 = X0$2 = Y0$2 = Z0$2 = X1$2 = Y1$2 = Z1$2 = 0, X2$1 = new Adder(), Y2$1 = new Adder(), Z2$1 = new Adder(), geoStream(_e, centroidStream$1);
  var Qt = +X2$1, Zt = +Y2$1, $n = +Z2$1, Sn = hypot(Qt, Zt, $n);
  return Sn < epsilon2 && (Qt = X1$2, Zt = Y1$2, $n = Z1$2, W1$1 < epsilon$3 && (Qt = X0$2, Zt = Y0$2, $n = Z0$2), Sn = hypot(Qt, Zt, $n), Sn < epsilon2) ? [NaN, NaN] : [atan2(Zt, Qt) * degrees, asin$1($n / Sn) * degrees];
}
function compose(_e, Qt) {
  function Zt($n, Sn) {
    return $n = _e($n, Sn), Qt($n[0], $n[1]);
  }
  return _e.invert && Qt.invert && (Zt.invert = function($n, Sn) {
    return $n = Qt.invert($n, Sn), $n && _e.invert($n[0], $n[1]);
  }), Zt;
}
function rotationIdentity(_e, Qt) {
  return abs$1(_e) > pi$2 && (_e -= Math.round(_e / tau$1) * tau$1), [_e, Qt];
}
rotationIdentity.invert = rotationIdentity;
function rotateRadians(_e, Qt, Zt) {
  return (_e %= tau$1) ? Qt || Zt ? compose(rotationLambda(_e), rotationPhiGamma(Qt, Zt)) : rotationLambda(_e) : Qt || Zt ? rotationPhiGamma(Qt, Zt) : rotationIdentity;
}
function forwardRotationLambda(_e) {
  return function(Qt, Zt) {
    return Qt += _e, abs$1(Qt) > pi$2 && (Qt -= Math.round(Qt / tau$1) * tau$1), [Qt, Zt];
  };
}
function rotationLambda(_e) {
  var Qt = forwardRotationLambda(_e);
  return Qt.invert = forwardRotationLambda(-_e), Qt;
}
function rotationPhiGamma(_e, Qt) {
  var Zt = cos$1(_e), $n = sin$1(_e), Sn = cos$1(Qt), kn = sin$1(Qt);
  function Kn(er, Cr) {
    var kr = cos$1(Cr), Yr = cos$1(er) * kr, Ms = sin$1(er) * kr, Ds = sin$1(Cr), Ls = Ds * Zt + Yr * $n;
    return [
      atan2(Ms * Sn - Ls * kn, Yr * Zt - Ds * $n),
      asin$1(Ls * Sn + Ms * kn)
    ];
  }
  return Kn.invert = function(er, Cr) {
    var kr = cos$1(Cr), Yr = cos$1(er) * kr, Ms = sin$1(er) * kr, Ds = sin$1(Cr), Ls = Ds * Sn - Ms * kn;
    return [
      atan2(Ms * Sn + Ds * kn, Yr * Zt + Ls * $n),
      asin$1(Ls * Zt - Yr * $n)
    ];
  }, Kn;
}
function rotation(_e) {
  _e = rotateRadians(_e[0] * radians, _e[1] * radians, _e.length > 2 ? _e[2] * radians : 0);
  function Qt(Zt) {
    return Zt = _e(Zt[0] * radians, Zt[1] * radians), Zt[0] *= degrees, Zt[1] *= degrees, Zt;
  }
  return Qt.invert = function(Zt) {
    return Zt = _e.invert(Zt[0] * radians, Zt[1] * radians), Zt[0] *= degrees, Zt[1] *= degrees, Zt;
  }, Qt;
}
function circleStream(_e, Qt, Zt, $n, Sn, kn) {
  if (Zt) {
    var Kn = cos$1(Qt), er = sin$1(Qt), Cr = $n * Zt;
    Sn == null ? (Sn = Qt + $n * tau$1, kn = Qt - Cr / 2) : (Sn = circleRadius(Kn, Sn), kn = circleRadius(Kn, kn), ($n > 0 ? Sn < kn : Sn > kn) && (Sn += $n * tau$1));
    for (var kr, Yr = Sn; $n > 0 ? Yr > kn : Yr < kn; Yr -= Cr)
      kr = spherical([Kn, -er * cos$1(Yr), -er * sin$1(Yr)]), _e.point(kr[0], kr[1]);
  }
}
function circleRadius(_e, Qt) {
  Qt = cartesian(Qt), Qt[0] -= _e, cartesianNormalizeInPlace(Qt);
  var Zt = acos(-Qt[1]);
  return ((-Qt[2] < 0 ? -Zt : Zt) + tau$1 - epsilon$3) % tau$1;
}
function clipBuffer() {
  var _e = [], Qt;
  return {
    point: function(Zt, $n, Sn) {
      Qt.push([Zt, $n, Sn]);
    },
    lineStart: function() {
      _e.push(Qt = []);
    },
    lineEnd: noop$5,
    rejoin: function() {
      _e.length > 1 && _e.push(_e.pop().concat(_e.shift()));
    },
    result: function() {
      var Zt = _e;
      return _e = [], Qt = null, Zt;
    }
  };
}
function pointEqual(_e, Qt) {
  return abs$1(_e[0] - Qt[0]) < epsilon$3 && abs$1(_e[1] - Qt[1]) < epsilon$3;
}
function Intersection(_e, Qt, Zt, $n) {
  this.x = _e, this.z = Qt, this.o = Zt, this.e = $n, this.v = !1, this.n = this.p = null;
}
function clipRejoin(_e, Qt, Zt, $n, Sn) {
  var kn = [], Kn = [], er, Cr;
  if (_e.forEach(function(js) {
    if (!((zs = js.length - 1) <= 0)) {
      var zs, Fs = js[0], Bs = js[zs], Hs;
      if (pointEqual(Fs, Bs)) {
        if (!Fs[2] && !Bs[2]) {
          for (Sn.lineStart(), er = 0; er < zs; ++er)
            Sn.point((Fs = js[er])[0], Fs[1]);
          Sn.lineEnd();
          return;
        }
        Bs[0] += 2 * epsilon$3;
      }
      kn.push(Hs = new Intersection(Fs, js, null, !0)), Kn.push(Hs.o = new Intersection(Fs, null, Hs, !1)), kn.push(Hs = new Intersection(Bs, js, null, !1)), Kn.push(Hs.o = new Intersection(Bs, null, Hs, !0));
    }
  }), !!kn.length) {
    for (Kn.sort(Qt), link(kn), link(Kn), er = 0, Cr = Kn.length; er < Cr; ++er)
      Kn[er].e = Zt = !Zt;
    for (var kr = kn[0], Yr, Ms; ; ) {
      for (var Ds = kr, Ls = !0; Ds.v; )
        if ((Ds = Ds.n) === kr)
          return;
      Yr = Ds.z, Sn.lineStart();
      do {
        if (Ds.v = Ds.o.v = !0, Ds.e) {
          if (Ls)
            for (er = 0, Cr = Yr.length; er < Cr; ++er)
              Sn.point((Ms = Yr[er])[0], Ms[1]);
          else
            $n(Ds.x, Ds.n.x, 1, Sn);
          Ds = Ds.n;
        } else {
          if (Ls)
            for (Yr = Ds.p.z, er = Yr.length - 1; er >= 0; --er)
              Sn.point((Ms = Yr[er])[0], Ms[1]);
          else
            $n(Ds.x, Ds.p.x, -1, Sn);
          Ds = Ds.p;
        }
        Ds = Ds.o, Yr = Ds.z, Ls = !Ls;
      } while (!Ds.v);
      Sn.lineEnd();
    }
  }
}
function link(_e) {
  if (Qt = _e.length) {
    for (var Qt, Zt = 0, $n = _e[0], Sn; ++Zt < Qt; )
      $n.n = Sn = _e[Zt], Sn.p = $n, $n = Sn;
    $n.n = Sn = _e[0], Sn.p = $n;
  }
}
function longitude(_e) {
  return abs$1(_e[0]) <= pi$2 ? _e[0] : sign(_e[0]) * ((abs$1(_e[0]) + pi$2) % tau$1 - pi$2);
}
function polygonContains(_e, Qt) {
  var Zt = longitude(Qt), $n = Qt[1], Sn = sin$1($n), kn = [sin$1(Zt), -cos$1(Zt), 0], Kn = 0, er = 0, Cr = new Adder();
  Sn === 1 ? $n = halfPi$1 + epsilon$3 : Sn === -1 && ($n = -halfPi$1 - epsilon$3);
  for (var kr = 0, Yr = _e.length; kr < Yr; ++kr)
    if (Ds = (Ms = _e[kr]).length)
      for (var Ms, Ds, Ls = Ms[Ds - 1], js = longitude(Ls), zs = Ls[1] / 2 + quarterPi, Fs = sin$1(zs), Bs = cos$1(zs), Hs = 0; Hs < Ds; ++Hs, js = Ys, Fs = Mu, Bs = Pl, Ls = Ws) {
        var Ws = Ms[Hs], Ys = longitude(Ws), El = Ws[1] / 2 + quarterPi, Mu = sin$1(El), Pl = cos$1(El), Iu = Ys - js, Tu = Iu >= 0 ? 1 : -1, Au = Tu * Iu, Nu = Au > pi$2, gm = Fs * Mu;
        if (Cr.add(atan2(gm * Tu * sin$1(Au), Bs * Pl + gm * cos$1(Au))), Kn += Nu ? Iu + Tu * tau$1 : Iu, Nu ^ js >= Zt ^ Ys >= Zt) {
          var pm = cartesianCross(cartesian(Ls), cartesian(Ws));
          cartesianNormalizeInPlace(pm);
          var zu = cartesianCross(kn, pm);
          cartesianNormalizeInPlace(zu);
          var Yu = (Nu ^ Iu >= 0 ? -1 : 1) * asin$1(zu[2]);
          ($n > Yu || $n === Yu && (pm[0] || pm[1])) && (er += Nu ^ Iu >= 0 ? 1 : -1);
        }
      }
  return (Kn < -epsilon$3 || Kn < epsilon$3 && Cr < -epsilon2) ^ er & 1;
}
function clip$2(_e, Qt, Zt, $n) {
  return function(Sn) {
    var kn = Qt(Sn), Kn = clipBuffer(), er = Qt(Kn), Cr = !1, kr, Yr, Ms, Ds = {
      point: Ls,
      lineStart: zs,
      lineEnd: Fs,
      polygonStart: function() {
        Ds.point = Bs, Ds.lineStart = Hs, Ds.lineEnd = Ws, Yr = [], kr = [];
      },
      polygonEnd: function() {
        Ds.point = Ls, Ds.lineStart = zs, Ds.lineEnd = Fs, Yr = merge$2(Yr);
        var Ys = polygonContains(kr, $n);
        Yr.length ? (Cr || (Sn.polygonStart(), Cr = !0), clipRejoin(Yr, compareIntersection, Ys, Zt, Sn)) : Ys && (Cr || (Sn.polygonStart(), Cr = !0), Sn.lineStart(), Zt(null, null, 1, Sn), Sn.lineEnd()), Cr && (Sn.polygonEnd(), Cr = !1), Yr = kr = null;
      },
      sphere: function() {
        Sn.polygonStart(), Sn.lineStart(), Zt(null, null, 1, Sn), Sn.lineEnd(), Sn.polygonEnd();
      }
    };
    function Ls(Ys, El) {
      _e(Ys, El) && Sn.point(Ys, El);
    }
    function js(Ys, El) {
      kn.point(Ys, El);
    }
    function zs() {
      Ds.point = js, kn.lineStart();
    }
    function Fs() {
      Ds.point = Ls, kn.lineEnd();
    }
    function Bs(Ys, El) {
      Ms.push([Ys, El]), er.point(Ys, El);
    }
    function Hs() {
      er.lineStart(), Ms = [];
    }
    function Ws() {
      Bs(Ms[0][0], Ms[0][1]), er.lineEnd();
      var Ys = er.clean(), El = Kn.result(), Mu, Pl = El.length, Iu, Tu, Au;
      if (Ms.pop(), kr.push(Ms), Ms = null, !!Pl) {
        if (Ys & 1) {
          if (Tu = El[0], (Iu = Tu.length - 1) > 0) {
            for (Cr || (Sn.polygonStart(), Cr = !0), Sn.lineStart(), Mu = 0; Mu < Iu; ++Mu)
              Sn.point((Au = Tu[Mu])[0], Au[1]);
            Sn.lineEnd();
          }
          return;
        }
        Pl > 1 && Ys & 2 && El.push(El.pop().concat(El.shift())), Yr.push(El.filter(validSegment));
      }
    }
    return Ds;
  };
}
function validSegment(_e) {
  return _e.length > 1;
}
function compareIntersection(_e, Qt) {
  return ((_e = _e.x)[0] < 0 ? _e[1] - halfPi$1 - epsilon$3 : halfPi$1 - _e[1]) - ((Qt = Qt.x)[0] < 0 ? Qt[1] - halfPi$1 - epsilon$3 : halfPi$1 - Qt[1]);
}
const clipAntimeridian = clip$2(
  function() {
    return !0;
  },
  clipAntimeridianLine,
  clipAntimeridianInterpolate,
  [-pi$2, -halfPi$1]
);
function clipAntimeridianLine(_e) {
  var Qt = NaN, Zt = NaN, $n = NaN, Sn;
  return {
    lineStart: function() {
      _e.lineStart(), Sn = 1;
    },
    point: function(kn, Kn) {
      var er = kn > 0 ? pi$2 : -pi$2, Cr = abs$1(kn - Qt);
      abs$1(Cr - pi$2) < epsilon$3 ? (_e.point(Qt, Zt = (Zt + Kn) / 2 > 0 ? halfPi$1 : -halfPi$1), _e.point($n, Zt), _e.lineEnd(), _e.lineStart(), _e.point(er, Zt), _e.point(kn, Zt), Sn = 0) : $n !== er && Cr >= pi$2 && (abs$1(Qt - $n) < epsilon$3 && (Qt -= $n * epsilon$3), abs$1(kn - er) < epsilon$3 && (kn -= er * epsilon$3), Zt = clipAntimeridianIntersect(Qt, Zt, kn, Kn), _e.point($n, Zt), _e.lineEnd(), _e.lineStart(), _e.point(er, Zt), Sn = 0), _e.point(Qt = kn, Zt = Kn), $n = er;
    },
    lineEnd: function() {
      _e.lineEnd(), Qt = Zt = NaN;
    },
    clean: function() {
      return 2 - Sn;
    }
  };
}
function clipAntimeridianIntersect(_e, Qt, Zt, $n) {
  var Sn, kn, Kn = sin$1(_e - Zt);
  return abs$1(Kn) > epsilon$3 ? atan((sin$1(Qt) * (kn = cos$1($n)) * sin$1(Zt) - sin$1($n) * (Sn = cos$1(Qt)) * sin$1(_e)) / (Sn * kn * Kn)) : (Qt + $n) / 2;
}
function clipAntimeridianInterpolate(_e, Qt, Zt, $n) {
  var Sn;
  if (_e == null)
    Sn = Zt * halfPi$1, $n.point(-pi$2, Sn), $n.point(0, Sn), $n.point(pi$2, Sn), $n.point(pi$2, 0), $n.point(pi$2, -Sn), $n.point(0, -Sn), $n.point(-pi$2, -Sn), $n.point(-pi$2, 0), $n.point(-pi$2, Sn);
  else if (abs$1(_e[0] - Qt[0]) > epsilon$3) {
    var kn = _e[0] < Qt[0] ? pi$2 : -pi$2;
    Sn = Zt * kn / 2, $n.point(-kn, Sn), $n.point(0, Sn), $n.point(kn, Sn);
  } else
    $n.point(Qt[0], Qt[1]);
}
function clipCircle(_e) {
  var Qt = cos$1(_e), Zt = 6 * radians, $n = Qt > 0, Sn = abs$1(Qt) > epsilon$3;
  function kn(Yr, Ms, Ds, Ls) {
    circleStream(Ls, _e, Zt, Ds, Yr, Ms);
  }
  function Kn(Yr, Ms) {
    return cos$1(Yr) * cos$1(Ms) > Qt;
  }
  function er(Yr) {
    var Ms, Ds, Ls, js, zs;
    return {
      lineStart: function() {
        js = Ls = !1, zs = 1;
      },
      point: function(Fs, Bs) {
        var Hs = [Fs, Bs], Ws, Ys = Kn(Fs, Bs), El = $n ? Ys ? 0 : kr(Fs, Bs) : Ys ? kr(Fs + (Fs < 0 ? pi$2 : -pi$2), Bs) : 0;
        if (!Ms && (js = Ls = Ys) && Yr.lineStart(), Ys !== Ls && (Ws = Cr(Ms, Hs), (!Ws || pointEqual(Ms, Ws) || pointEqual(Hs, Ws)) && (Hs[2] = 1)), Ys !== Ls)
          zs = 0, Ys ? (Yr.lineStart(), Ws = Cr(Hs, Ms), Yr.point(Ws[0], Ws[1])) : (Ws = Cr(Ms, Hs), Yr.point(Ws[0], Ws[1], 2), Yr.lineEnd()), Ms = Ws;
        else if (Sn && Ms && $n ^ Ys) {
          var Mu;
          !(El & Ds) && (Mu = Cr(Hs, Ms, !0)) && (zs = 0, $n ? (Yr.lineStart(), Yr.point(Mu[0][0], Mu[0][1]), Yr.point(Mu[1][0], Mu[1][1]), Yr.lineEnd()) : (Yr.point(Mu[1][0], Mu[1][1]), Yr.lineEnd(), Yr.lineStart(), Yr.point(Mu[0][0], Mu[0][1], 3)));
        }
        Ys && (!Ms || !pointEqual(Ms, Hs)) && Yr.point(Hs[0], Hs[1]), Ms = Hs, Ls = Ys, Ds = El;
      },
      lineEnd: function() {
        Ls && Yr.lineEnd(), Ms = null;
      },
      // Rejoin first and last segments if there were intersections and the first
      // and last points were visible.
      clean: function() {
        return zs | (js && Ls) << 1;
      }
    };
  }
  function Cr(Yr, Ms, Ds) {
    var Ls = cartesian(Yr), js = cartesian(Ms), zs = [1, 0, 0], Fs = cartesianCross(Ls, js), Bs = cartesianDot(Fs, Fs), Hs = Fs[0], Ws = Bs - Hs * Hs;
    if (!Ws)
      return !Ds && Yr;
    var Ys = Qt * Bs / Ws, El = -Qt * Hs / Ws, Mu = cartesianCross(zs, Fs), Pl = cartesianScale(zs, Ys), Iu = cartesianScale(Fs, El);
    cartesianAddInPlace(Pl, Iu);
    var Tu = Mu, Au = cartesianDot(Pl, Tu), Nu = cartesianDot(Tu, Tu), gm = Au * Au - Nu * (cartesianDot(Pl, Pl) - 1);
    if (!(gm < 0)) {
      var pm = sqrt$1(gm), zu = cartesianScale(Tu, (-Au - pm) / Nu);
      if (cartesianAddInPlace(zu, Pl), zu = spherical(zu), !Ds)
        return zu;
      var Yu = Yr[0], sm = Ms[0], mm = Yr[1], hm = Ms[1], ym;
      sm < Yu && (ym = Yu, Yu = sm, sm = ym);
      var _m = sm - Yu, Sm = abs$1(_m - pi$2) < epsilon$3, wm = Sm || _m < epsilon$3;
      if (!Sm && hm < mm && (ym = mm, mm = hm, hm = ym), wm ? Sm ? mm + hm > 0 ^ zu[1] < (abs$1(zu[0] - Yu) < epsilon$3 ? mm : hm) : mm <= zu[1] && zu[1] <= hm : _m > pi$2 ^ (Yu <= zu[0] && zu[0] <= sm)) {
        var Nm = cartesianScale(Tu, (-Au + pm) / Nu);
        return cartesianAddInPlace(Nm, Pl), [zu, spherical(Nm)];
      }
    }
  }
  function kr(Yr, Ms) {
    var Ds = $n ? _e : pi$2 - _e, Ls = 0;
    return Yr < -Ds ? Ls |= 1 : Yr > Ds && (Ls |= 2), Ms < -Ds ? Ls |= 4 : Ms > Ds && (Ls |= 8), Ls;
  }
  return clip$2(Kn, er, kn, $n ? [0, -_e] : [-pi$2, _e - pi$2]);
}
function clipLine(_e, Qt, Zt, $n, Sn, kn) {
  var Kn = _e[0], er = _e[1], Cr = Qt[0], kr = Qt[1], Yr = 0, Ms = 1, Ds = Cr - Kn, Ls = kr - er, js;
  if (js = Zt - Kn, !(!Ds && js > 0)) {
    if (js /= Ds, Ds < 0) {
      if (js < Yr)
        return;
      js < Ms && (Ms = js);
    } else if (Ds > 0) {
      if (js > Ms)
        return;
      js > Yr && (Yr = js);
    }
    if (js = Sn - Kn, !(!Ds && js < 0)) {
      if (js /= Ds, Ds < 0) {
        if (js > Ms)
          return;
        js > Yr && (Yr = js);
      } else if (Ds > 0) {
        if (js < Yr)
          return;
        js < Ms && (Ms = js);
      }
      if (js = $n - er, !(!Ls && js > 0)) {
        if (js /= Ls, Ls < 0) {
          if (js < Yr)
            return;
          js < Ms && (Ms = js);
        } else if (Ls > 0) {
          if (js > Ms)
            return;
          js > Yr && (Yr = js);
        }
        if (js = kn - er, !(!Ls && js < 0)) {
          if (js /= Ls, Ls < 0) {
            if (js > Ms)
              return;
            js > Yr && (Yr = js);
          } else if (Ls > 0) {
            if (js < Yr)
              return;
            js < Ms && (Ms = js);
          }
          return Yr > 0 && (_e[0] = Kn + Yr * Ds, _e[1] = er + Yr * Ls), Ms < 1 && (Qt[0] = Kn + Ms * Ds, Qt[1] = er + Ms * Ls), !0;
        }
      }
    }
  }
}
var clipMax = 1e9, clipMin = -clipMax;
function clipRectangle(_e, Qt, Zt, $n) {
  function Sn(kr, Yr) {
    return _e <= kr && kr <= Zt && Qt <= Yr && Yr <= $n;
  }
  function kn(kr, Yr, Ms, Ds) {
    var Ls = 0, js = 0;
    if (kr == null || (Ls = Kn(kr, Ms)) !== (js = Kn(Yr, Ms)) || Cr(kr, Yr) < 0 ^ Ms > 0)
      do
        Ds.point(Ls === 0 || Ls === 3 ? _e : Zt, Ls > 1 ? $n : Qt);
      while ((Ls = (Ls + Ms + 4) % 4) !== js);
    else
      Ds.point(Yr[0], Yr[1]);
  }
  function Kn(kr, Yr) {
    return abs$1(kr[0] - _e) < epsilon$3 ? Yr > 0 ? 0 : 3 : abs$1(kr[0] - Zt) < epsilon$3 ? Yr > 0 ? 2 : 1 : abs$1(kr[1] - Qt) < epsilon$3 ? Yr > 0 ? 1 : 0 : Yr > 0 ? 3 : 2;
  }
  function er(kr, Yr) {
    return Cr(kr.x, Yr.x);
  }
  function Cr(kr, Yr) {
    var Ms = Kn(kr, 1), Ds = Kn(Yr, 1);
    return Ms !== Ds ? Ms - Ds : Ms === 0 ? Yr[1] - kr[1] : Ms === 1 ? kr[0] - Yr[0] : Ms === 2 ? kr[1] - Yr[1] : Yr[0] - kr[0];
  }
  return function(kr) {
    var Yr = kr, Ms = clipBuffer(), Ds, Ls, js, zs, Fs, Bs, Hs, Ws, Ys, El, Mu, Pl = {
      point: Iu,
      lineStart: gm,
      lineEnd: pm,
      polygonStart: Au,
      polygonEnd: Nu
    };
    function Iu(Yu, sm) {
      Sn(Yu, sm) && Yr.point(Yu, sm);
    }
    function Tu() {
      for (var Yu = 0, sm = 0, mm = Ls.length; sm < mm; ++sm)
        for (var hm = Ls[sm], ym = 1, _m = hm.length, Sm = hm[0], wm, Nm, Cm = Sm[0], Im = Sm[1]; ym < _m; ++ym)
          wm = Cm, Nm = Im, Sm = hm[ym], Cm = Sm[0], Im = Sm[1], Nm <= $n ? Im > $n && (Cm - wm) * ($n - Nm) > (Im - Nm) * (_e - wm) && ++Yu : Im <= $n && (Cm - wm) * ($n - Nm) < (Im - Nm) * (_e - wm) && --Yu;
      return Yu;
    }
    function Au() {
      Yr = Ms, Ds = [], Ls = [], Mu = !0;
    }
    function Nu() {
      var Yu = Tu(), sm = Mu && Yu, mm = (Ds = merge$2(Ds)).length;
      (sm || mm) && (kr.polygonStart(), sm && (kr.lineStart(), kn(null, null, 1, kr), kr.lineEnd()), mm && clipRejoin(Ds, er, Yu, kn, kr), kr.polygonEnd()), Yr = kr, Ds = Ls = js = null;
    }
    function gm() {
      Pl.point = zu, Ls && Ls.push(js = []), El = !0, Ys = !1, Hs = Ws = NaN;
    }
    function pm() {
      Ds && (zu(zs, Fs), Bs && Ys && Ms.rejoin(), Ds.push(Ms.result())), Pl.point = Iu, Ys && Yr.lineEnd();
    }
    function zu(Yu, sm) {
      var mm = Sn(Yu, sm);
      if (Ls && js.push([Yu, sm]), El)
        zs = Yu, Fs = sm, Bs = mm, El = !1, mm && (Yr.lineStart(), Yr.point(Yu, sm));
      else if (mm && Ys)
        Yr.point(Yu, sm);
      else {
        var hm = [Hs = Math.max(clipMin, Math.min(clipMax, Hs)), Ws = Math.max(clipMin, Math.min(clipMax, Ws))], ym = [Yu = Math.max(clipMin, Math.min(clipMax, Yu)), sm = Math.max(clipMin, Math.min(clipMax, sm))];
        clipLine(hm, ym, _e, Qt, Zt, $n) ? (Ys || (Yr.lineStart(), Yr.point(hm[0], hm[1])), Yr.point(ym[0], ym[1]), mm || Yr.lineEnd(), Mu = !1) : mm && (Yr.lineStart(), Yr.point(Yu, sm), Mu = !1);
      }
      Hs = Yu, Ws = sm, Ys = mm;
    }
    return Pl;
  };
}
function graticuleX(_e, Qt, Zt) {
  var $n = range$5(_e, Qt - epsilon$3, Zt).concat(Qt);
  return function(Sn) {
    return $n.map(function(kn) {
      return [Sn, kn];
    });
  };
}
function graticuleY(_e, Qt, Zt) {
  var $n = range$5(_e, Qt - epsilon$3, Zt).concat(Qt);
  return function(Sn) {
    return $n.map(function(kn) {
      return [kn, Sn];
    });
  };
}
function graticule() {
  var _e, Qt, Zt, $n, Sn, kn, Kn, er, Cr = 10, kr = Cr, Yr = 90, Ms = 360, Ds, Ls, js, zs, Fs = 2.5;
  function Bs() {
    return { type: "MultiLineString", coordinates: Hs() };
  }
  function Hs() {
    return range$5(ceil($n / Yr) * Yr, Zt, Yr).map(js).concat(range$5(ceil(er / Ms) * Ms, Kn, Ms).map(zs)).concat(range$5(ceil(Qt / Cr) * Cr, _e, Cr).filter(function(Ws) {
      return abs$1(Ws % Yr) > epsilon$3;
    }).map(Ds)).concat(range$5(ceil(kn / kr) * kr, Sn, kr).filter(function(Ws) {
      return abs$1(Ws % Ms) > epsilon$3;
    }).map(Ls));
  }
  return Bs.lines = function() {
    return Hs().map(function(Ws) {
      return { type: "LineString", coordinates: Ws };
    });
  }, Bs.outline = function() {
    return {
      type: "Polygon",
      coordinates: [
        js($n).concat(
          zs(Kn).slice(1),
          js(Zt).reverse().slice(1),
          zs(er).reverse().slice(1)
        )
      ]
    };
  }, Bs.extent = function(Ws) {
    return arguments.length ? Bs.extentMajor(Ws).extentMinor(Ws) : Bs.extentMinor();
  }, Bs.extentMajor = function(Ws) {
    return arguments.length ? ($n = +Ws[0][0], Zt = +Ws[1][0], er = +Ws[0][1], Kn = +Ws[1][1], $n > Zt && (Ws = $n, $n = Zt, Zt = Ws), er > Kn && (Ws = er, er = Kn, Kn = Ws), Bs.precision(Fs)) : [[$n, er], [Zt, Kn]];
  }, Bs.extentMinor = function(Ws) {
    return arguments.length ? (Qt = +Ws[0][0], _e = +Ws[1][0], kn = +Ws[0][1], Sn = +Ws[1][1], Qt > _e && (Ws = Qt, Qt = _e, _e = Ws), kn > Sn && (Ws = kn, kn = Sn, Sn = Ws), Bs.precision(Fs)) : [[Qt, kn], [_e, Sn]];
  }, Bs.step = function(Ws) {
    return arguments.length ? Bs.stepMajor(Ws).stepMinor(Ws) : Bs.stepMinor();
  }, Bs.stepMajor = function(Ws) {
    return arguments.length ? (Yr = +Ws[0], Ms = +Ws[1], Bs) : [Yr, Ms];
  }, Bs.stepMinor = function(Ws) {
    return arguments.length ? (Cr = +Ws[0], kr = +Ws[1], Bs) : [Cr, kr];
  }, Bs.precision = function(Ws) {
    return arguments.length ? (Fs = +Ws, Ds = graticuleX(kn, Sn, 90), Ls = graticuleY(Qt, _e, Fs), js = graticuleX(er, Kn, 90), zs = graticuleY($n, Zt, Fs), Bs) : Fs;
  }, Bs.extentMajor([[-180, -90 + epsilon$3], [180, 90 - epsilon$3]]).extentMinor([[-180, -80 - epsilon$3], [180, 80 + epsilon$3]]);
}
const identity$1 = (_e) => _e;
var areaSum = new Adder(), areaRingSum = new Adder(), x00$2, y00$2, x0$4, y0$4, areaStream = {
  point: noop$5,
  lineStart: noop$5,
  lineEnd: noop$5,
  polygonStart: function() {
    areaStream.lineStart = areaRingStart, areaStream.lineEnd = areaRingEnd;
  },
  polygonEnd: function() {
    areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop$5, areaSum.add(abs$1(areaRingSum)), areaRingSum = new Adder();
  },
  result: function() {
    var _e = areaSum / 2;
    return areaSum = new Adder(), _e;
  }
};
function areaRingStart() {
  areaStream.point = areaPointFirst;
}
function areaPointFirst(_e, Qt) {
  areaStream.point = areaPoint, x00$2 = x0$4 = _e, y00$2 = y0$4 = Qt;
}
function areaPoint(_e, Qt) {
  areaRingSum.add(y0$4 * _e - x0$4 * Qt), x0$4 = _e, y0$4 = Qt;
}
function areaRingEnd() {
  areaPoint(x00$2, y00$2);
}
const pathArea = areaStream;
var x0$3 = 1 / 0, y0$3 = x0$3, x1$1 = -x0$3, y1$1 = x1$1, boundsStream = {
  point: boundsPoint,
  lineStart: noop$5,
  lineEnd: noop$5,
  polygonStart: noop$5,
  polygonEnd: noop$5,
  result: function() {
    var _e = [[x0$3, y0$3], [x1$1, y1$1]];
    return x1$1 = y1$1 = -(y0$3 = x0$3 = 1 / 0), _e;
  }
};
function boundsPoint(_e, Qt) {
  _e < x0$3 && (x0$3 = _e), _e > x1$1 && (x1$1 = _e), Qt < y0$3 && (y0$3 = Qt), Qt > y1$1 && (y1$1 = Qt);
}
const boundsStream$1 = boundsStream;
var X0$1 = 0, Y0$1 = 0, Z0$1 = 0, X1$1 = 0, Y1$1 = 0, Z1$1 = 0, X2 = 0, Y2 = 0, Z2 = 0, x00$1, y00$1, x0$2, y0$2, centroidStream = {
  point: centroidPoint,
  lineStart: centroidLineStart,
  lineEnd: centroidLineEnd,
  polygonStart: function() {
    centroidStream.lineStart = centroidRingStart, centroidStream.lineEnd = centroidRingEnd;
  },
  polygonEnd: function() {
    centroidStream.point = centroidPoint, centroidStream.lineStart = centroidLineStart, centroidStream.lineEnd = centroidLineEnd;
  },
  result: function() {
    var _e = Z2 ? [X2 / Z2, Y2 / Z2] : Z1$1 ? [X1$1 / Z1$1, Y1$1 / Z1$1] : Z0$1 ? [X0$1 / Z0$1, Y0$1 / Z0$1] : [NaN, NaN];
    return X0$1 = Y0$1 = Z0$1 = X1$1 = Y1$1 = Z1$1 = X2 = Y2 = Z2 = 0, _e;
  }
};
function centroidPoint(_e, Qt) {
  X0$1 += _e, Y0$1 += Qt, ++Z0$1;
}
function centroidLineStart() {
  centroidStream.point = centroidPointFirstLine;
}
function centroidPointFirstLine(_e, Qt) {
  centroidStream.point = centroidPointLine, centroidPoint(x0$2 = _e, y0$2 = Qt);
}
function centroidPointLine(_e, Qt) {
  var Zt = _e - x0$2, $n = Qt - y0$2, Sn = sqrt$1(Zt * Zt + $n * $n);
  X1$1 += Sn * (x0$2 + _e) / 2, Y1$1 += Sn * (y0$2 + Qt) / 2, Z1$1 += Sn, centroidPoint(x0$2 = _e, y0$2 = Qt);
}
function centroidLineEnd() {
  centroidStream.point = centroidPoint;
}
function centroidRingStart() {
  centroidStream.point = centroidPointFirstRing;
}
function centroidRingEnd() {
  centroidPointRing(x00$1, y00$1);
}
function centroidPointFirstRing(_e, Qt) {
  centroidStream.point = centroidPointRing, centroidPoint(x00$1 = x0$2 = _e, y00$1 = y0$2 = Qt);
}
function centroidPointRing(_e, Qt) {
  var Zt = _e - x0$2, $n = Qt - y0$2, Sn = sqrt$1(Zt * Zt + $n * $n);
  X1$1 += Sn * (x0$2 + _e) / 2, Y1$1 += Sn * (y0$2 + Qt) / 2, Z1$1 += Sn, Sn = y0$2 * _e - x0$2 * Qt, X2 += Sn * (x0$2 + _e), Y2 += Sn * (y0$2 + Qt), Z2 += Sn * 3, centroidPoint(x0$2 = _e, y0$2 = Qt);
}
const pathCentroid = centroidStream;
function PathContext(_e) {
  this._context = _e;
}
PathContext.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, Qt) {
    switch (this._point) {
      case 0: {
        this._context.moveTo(_e, Qt), this._point = 1;
        break;
      }
      case 1: {
        this._context.lineTo(_e, Qt);
        break;
      }
      default: {
        this._context.moveTo(_e + this._radius, Qt), this._context.arc(_e, Qt, this._radius, 0, tau$1);
        break;
      }
    }
  },
  result: noop$5
};
var lengthSum = new Adder(), lengthRing, x00, y00, x0$1, y0$1, lengthStream = {
  point: noop$5,
  lineStart: function() {
    lengthStream.point = lengthPointFirst;
  },
  lineEnd: function() {
    lengthRing && lengthPoint(x00, y00), lengthStream.point = noop$5;
  },
  polygonStart: function() {
    lengthRing = !0;
  },
  polygonEnd: function() {
    lengthRing = null;
  },
  result: function() {
    var _e = +lengthSum;
    return lengthSum = new Adder(), _e;
  }
};
function lengthPointFirst(_e, Qt) {
  lengthStream.point = lengthPoint, x00 = x0$1 = _e, y00 = y0$1 = Qt;
}
function lengthPoint(_e, Qt) {
  x0$1 -= _e, y0$1 -= Qt, lengthSum.add(sqrt$1(x0$1 * x0$1 + y0$1 * y0$1)), x0$1 = _e, y0$1 = Qt;
}
const pathMeasure = lengthStream;
let cacheDigits, cacheAppend, cacheRadius, cacheCircle;
class PathString {
  constructor(Qt) {
    this._append = Qt == null ? append : appendRound(Qt), this._radius = 4.5, this._ = "";
  }
  pointRadius(Qt) {
    return this._radius = +Qt, this;
  }
  polygonStart() {
    this._line = 0;
  }
  polygonEnd() {
    this._line = NaN;
  }
  lineStart() {
    this._point = 0;
  }
  lineEnd() {
    this._line === 0 && (this._ += "Z"), this._point = NaN;
  }
  point(Qt, Zt) {
    switch (this._point) {
      case 0: {
        this._append`M${Qt},${Zt}`, this._point = 1;
        break;
      }
      case 1: {
        this._append`L${Qt},${Zt}`;
        break;
      }
      default: {
        if (this._append`M${Qt},${Zt}`, this._radius !== cacheRadius || this._append !== cacheAppend) {
          const $n = this._radius, Sn = this._;
          this._ = "", this._append`m0,${$n}a${$n},${$n} 0 1,1 0,${-2 * $n}a${$n},${$n} 0 1,1 0,${2 * $n}z`, cacheRadius = $n, cacheAppend = this._append, cacheCircle = this._, this._ = Sn;
        }
        this._ += cacheCircle;
        break;
      }
    }
  }
  result() {
    const Qt = this._;
    return this._ = "", Qt.length ? Qt : null;
  }
}
function append(_e) {
  let Qt = 1;
  this._ += _e[0];
  for (const Zt = _e.length; Qt < Zt; ++Qt)
    this._ += arguments[Qt] + _e[Qt];
}
function appendRound(_e) {
  const Qt = Math.floor(_e);
  if (!(Qt >= 0))
    throw new RangeError(`invalid digits: ${_e}`);
  if (Qt > 15)
    return append;
  if (Qt !== cacheDigits) {
    const Zt = 10 ** Qt;
    cacheDigits = Qt, cacheAppend = function(Sn) {
      let kn = 1;
      this._ += Sn[0];
      for (const Kn = Sn.length; kn < Kn; ++kn)
        this._ += Math.round(arguments[kn] * Zt) / Zt + Sn[kn];
    };
  }
  return cacheAppend;
}
function geoPath(_e, Qt) {
  let Zt = 3, $n = 4.5, Sn, kn;
  function Kn(er) {
    return er && (typeof $n == "function" && kn.pointRadius(+$n.apply(this, arguments)), geoStream(er, Sn(kn))), kn.result();
  }
  return Kn.area = function(er) {
    return geoStream(er, Sn(pathArea)), pathArea.result();
  }, Kn.measure = function(er) {
    return geoStream(er, Sn(pathMeasure)), pathMeasure.result();
  }, Kn.bounds = function(er) {
    return geoStream(er, Sn(boundsStream$1)), boundsStream$1.result();
  }, Kn.centroid = function(er) {
    return geoStream(er, Sn(pathCentroid)), pathCentroid.result();
  }, Kn.projection = function(er) {
    return arguments.length ? (Sn = er == null ? (_e = null, identity$1) : (_e = er).stream, Kn) : _e;
  }, Kn.context = function(er) {
    return arguments.length ? (kn = er == null ? (Qt = null, new PathString(Zt)) : new PathContext(Qt = er), typeof $n != "function" && kn.pointRadius($n), Kn) : Qt;
  }, Kn.pointRadius = function(er) {
    return arguments.length ? ($n = typeof er == "function" ? er : (kn.pointRadius(+er), +er), Kn) : $n;
  }, Kn.digits = function(er) {
    if (!arguments.length)
      return Zt;
    if (er == null)
      Zt = null;
    else {
      const Cr = Math.floor(er);
      if (!(Cr >= 0))
        throw new RangeError(`invalid digits: ${er}`);
      Zt = Cr;
    }
    return Qt === null && (kn = new PathString(Zt)), Kn;
  }, Kn.projection(_e).digits(Zt).context(Qt);
}
function transformer(_e) {
  return function(Qt) {
    var Zt = new TransformStream();
    for (var $n in _e)
      Zt[$n] = _e[$n];
    return Zt.stream = Qt, Zt;
  };
}
function TransformStream() {
}
TransformStream.prototype = {
  constructor: TransformStream,
  point: function(_e, Qt) {
    this.stream.point(_e, Qt);
  },
  sphere: function() {
    this.stream.sphere();
  },
  lineStart: function() {
    this.stream.lineStart();
  },
  lineEnd: function() {
    this.stream.lineEnd();
  },
  polygonStart: function() {
    this.stream.polygonStart();
  },
  polygonEnd: function() {
    this.stream.polygonEnd();
  }
};
function fit$1(_e, Qt, Zt) {
  var $n = _e.clipExtent && _e.clipExtent();
  return _e.scale(150).translate([0, 0]), $n != null && _e.clipExtent(null), geoStream(Zt, _e.stream(boundsStream$1)), Qt(boundsStream$1.result()), $n != null && _e.clipExtent($n), _e;
}
function fitExtent(_e, Qt, Zt) {
  return fit$1(_e, function($n) {
    var Sn = Qt[1][0] - Qt[0][0], kn = Qt[1][1] - Qt[0][1], Kn = Math.min(Sn / ($n[1][0] - $n[0][0]), kn / ($n[1][1] - $n[0][1])), er = +Qt[0][0] + (Sn - Kn * ($n[1][0] + $n[0][0])) / 2, Cr = +Qt[0][1] + (kn - Kn * ($n[1][1] + $n[0][1])) / 2;
    _e.scale(150 * Kn).translate([er, Cr]);
  }, Zt);
}
function fitSize(_e, Qt, Zt) {
  return fitExtent(_e, [[0, 0], Qt], Zt);
}
function fitWidth(_e, Qt, Zt) {
  return fit$1(_e, function($n) {
    var Sn = +Qt, kn = Sn / ($n[1][0] - $n[0][0]), Kn = (Sn - kn * ($n[1][0] + $n[0][0])) / 2, er = -kn * $n[0][1];
    _e.scale(150 * kn).translate([Kn, er]);
  }, Zt);
}
function fitHeight(_e, Qt, Zt) {
  return fit$1(_e, function($n) {
    var Sn = +Qt, kn = Sn / ($n[1][1] - $n[0][1]), Kn = -kn * $n[0][0], er = (Sn - kn * ($n[1][1] + $n[0][1])) / 2;
    _e.scale(150 * kn).translate([Kn, er]);
  }, Zt);
}
var maxDepth = 16, cosMinDistance = cos$1(30 * radians);
function resample(_e, Qt) {
  return +Qt ? resample$1(_e, Qt) : resampleNone(_e);
}
function resampleNone(_e) {
  return transformer({
    point: function(Qt, Zt) {
      Qt = _e(Qt, Zt), this.stream.point(Qt[0], Qt[1]);
    }
  });
}
function resample$1(_e, Qt) {
  function Zt($n, Sn, kn, Kn, er, Cr, kr, Yr, Ms, Ds, Ls, js, zs, Fs) {
    var Bs = kr - $n, Hs = Yr - Sn, Ws = Bs * Bs + Hs * Hs;
    if (Ws > 4 * Qt && zs--) {
      var Ys = Kn + Ds, El = er + Ls, Mu = Cr + js, Pl = sqrt$1(Ys * Ys + El * El + Mu * Mu), Iu = asin$1(Mu /= Pl), Tu = abs$1(abs$1(Mu) - 1) < epsilon$3 || abs$1(kn - Ms) < epsilon$3 ? (kn + Ms) / 2 : atan2(El, Ys), Au = _e(Tu, Iu), Nu = Au[0], gm = Au[1], pm = Nu - $n, zu = gm - Sn, Yu = Hs * pm - Bs * zu;
      (Yu * Yu / Ws > Qt || abs$1((Bs * pm + Hs * zu) / Ws - 0.5) > 0.3 || Kn * Ds + er * Ls + Cr * js < cosMinDistance) && (Zt($n, Sn, kn, Kn, er, Cr, Nu, gm, Tu, Ys /= Pl, El /= Pl, Mu, zs, Fs), Fs.point(Nu, gm), Zt(Nu, gm, Tu, Ys, El, Mu, kr, Yr, Ms, Ds, Ls, js, zs, Fs));
    }
  }
  return function($n) {
    var Sn, kn, Kn, er, Cr, kr, Yr, Ms, Ds, Ls, js, zs, Fs = {
      point: Bs,
      lineStart: Hs,
      lineEnd: Ys,
      polygonStart: function() {
        $n.polygonStart(), Fs.lineStart = El;
      },
      polygonEnd: function() {
        $n.polygonEnd(), Fs.lineStart = Hs;
      }
    };
    function Bs(Iu, Tu) {
      Iu = _e(Iu, Tu), $n.point(Iu[0], Iu[1]);
    }
    function Hs() {
      Ms = NaN, Fs.point = Ws, $n.lineStart();
    }
    function Ws(Iu, Tu) {
      var Au = cartesian([Iu, Tu]), Nu = _e(Iu, Tu);
      Zt(Ms, Ds, Yr, Ls, js, zs, Ms = Nu[0], Ds = Nu[1], Yr = Iu, Ls = Au[0], js = Au[1], zs = Au[2], maxDepth, $n), $n.point(Ms, Ds);
    }
    function Ys() {
      Fs.point = Bs, $n.lineEnd();
    }
    function El() {
      Hs(), Fs.point = Mu, Fs.lineEnd = Pl;
    }
    function Mu(Iu, Tu) {
      Ws(Sn = Iu, Tu), kn = Ms, Kn = Ds, er = Ls, Cr = js, kr = zs, Fs.point = Ws;
    }
    function Pl() {
      Zt(Ms, Ds, Yr, Ls, js, zs, kn, Kn, Sn, er, Cr, kr, maxDepth, $n), Fs.lineEnd = Ys, Ys();
    }
    return Fs;
  };
}
var transformRadians = transformer({
  point: function(_e, Qt) {
    this.stream.point(_e * radians, Qt * radians);
  }
});
function transformRotate(_e) {
  return transformer({
    point: function(Qt, Zt) {
      var $n = _e(Qt, Zt);
      return this.stream.point($n[0], $n[1]);
    }
  });
}
function scaleTranslate(_e, Qt, Zt, $n, Sn) {
  function kn(Kn, er) {
    return Kn *= $n, er *= Sn, [Qt + _e * Kn, Zt - _e * er];
  }
  return kn.invert = function(Kn, er) {
    return [(Kn - Qt) / _e * $n, (Zt - er) / _e * Sn];
  }, kn;
}
function scaleTranslateRotate(_e, Qt, Zt, $n, Sn, kn) {
  if (!kn)
    return scaleTranslate(_e, Qt, Zt, $n, Sn);
  var Kn = cos$1(kn), er = sin$1(kn), Cr = Kn * _e, kr = er * _e, Yr = Kn / _e, Ms = er / _e, Ds = (er * Zt - Kn * Qt) / _e, Ls = (er * Qt + Kn * Zt) / _e;
  function js(zs, Fs) {
    return zs *= $n, Fs *= Sn, [Cr * zs - kr * Fs + Qt, Zt - kr * zs - Cr * Fs];
  }
  return js.invert = function(zs, Fs) {
    return [$n * (Yr * zs - Ms * Fs + Ds), Sn * (Ls - Ms * zs - Yr * Fs)];
  }, js;
}
function projection$1(_e) {
  return projectionMutator(function() {
    return _e;
  })();
}
function projectionMutator(_e) {
  var Qt, Zt = 150, $n = 480, Sn = 250, kn = 0, Kn = 0, er = 0, Cr = 0, kr = 0, Yr, Ms = 0, Ds = 1, Ls = 1, js = null, zs = clipAntimeridian, Fs = null, Bs, Hs, Ws, Ys = identity$1, El = 0.5, Mu, Pl, Iu, Tu, Au;
  function Nu(Yu) {
    return Iu(Yu[0] * radians, Yu[1] * radians);
  }
  function gm(Yu) {
    return Yu = Iu.invert(Yu[0], Yu[1]), Yu && [Yu[0] * degrees, Yu[1] * degrees];
  }
  Nu.stream = function(Yu) {
    return Tu && Au === Yu ? Tu : Tu = transformRadians(transformRotate(Yr)(zs(Mu(Ys(Au = Yu)))));
  }, Nu.preclip = function(Yu) {
    return arguments.length ? (zs = Yu, js = void 0, zu()) : zs;
  }, Nu.postclip = function(Yu) {
    return arguments.length ? (Ys = Yu, Fs = Bs = Hs = Ws = null, zu()) : Ys;
  }, Nu.clipAngle = function(Yu) {
    return arguments.length ? (zs = +Yu ? clipCircle(js = Yu * radians) : (js = null, clipAntimeridian), zu()) : js * degrees;
  }, Nu.clipExtent = function(Yu) {
    return arguments.length ? (Ys = Yu == null ? (Fs = Bs = Hs = Ws = null, identity$1) : clipRectangle(Fs = +Yu[0][0], Bs = +Yu[0][1], Hs = +Yu[1][0], Ws = +Yu[1][1]), zu()) : Fs == null ? null : [[Fs, Bs], [Hs, Ws]];
  }, Nu.scale = function(Yu) {
    return arguments.length ? (Zt = +Yu, pm()) : Zt;
  }, Nu.translate = function(Yu) {
    return arguments.length ? ($n = +Yu[0], Sn = +Yu[1], pm()) : [$n, Sn];
  }, Nu.center = function(Yu) {
    return arguments.length ? (kn = Yu[0] % 360 * radians, Kn = Yu[1] % 360 * radians, pm()) : [kn * degrees, Kn * degrees];
  }, Nu.rotate = function(Yu) {
    return arguments.length ? (er = Yu[0] % 360 * radians, Cr = Yu[1] % 360 * radians, kr = Yu.length > 2 ? Yu[2] % 360 * radians : 0, pm()) : [er * degrees, Cr * degrees, kr * degrees];
  }, Nu.angle = function(Yu) {
    return arguments.length ? (Ms = Yu % 360 * radians, pm()) : Ms * degrees;
  }, Nu.reflectX = function(Yu) {
    return arguments.length ? (Ds = Yu ? -1 : 1, pm()) : Ds < 0;
  }, Nu.reflectY = function(Yu) {
    return arguments.length ? (Ls = Yu ? -1 : 1, pm()) : Ls < 0;
  }, Nu.precision = function(Yu) {
    return arguments.length ? (Mu = resample(Pl, El = Yu * Yu), zu()) : sqrt$1(El);
  }, Nu.fitExtent = function(Yu, sm) {
    return fitExtent(Nu, Yu, sm);
  }, Nu.fitSize = function(Yu, sm) {
    return fitSize(Nu, Yu, sm);
  }, Nu.fitWidth = function(Yu, sm) {
    return fitWidth(Nu, Yu, sm);
  }, Nu.fitHeight = function(Yu, sm) {
    return fitHeight(Nu, Yu, sm);
  };
  function pm() {
    var Yu = scaleTranslateRotate(Zt, 0, 0, Ds, Ls, Ms).apply(null, Qt(kn, Kn)), sm = scaleTranslateRotate(Zt, $n - Yu[0], Sn - Yu[1], Ds, Ls, Ms);
    return Yr = rotateRadians(er, Cr, kr), Pl = compose(Qt, sm), Iu = compose(Yr, Pl), Mu = resample(Pl, El), zu();
  }
  function zu() {
    return Tu = Au = null, Nu;
  }
  return function() {
    return Qt = _e.apply(this, arguments), Nu.invert = Qt.invert && gm, pm();
  };
}
function conicProjection(_e) {
  var Qt = 0, Zt = pi$2 / 3, $n = projectionMutator(_e), Sn = $n(Qt, Zt);
  return Sn.parallels = function(kn) {
    return arguments.length ? $n(Qt = kn[0] * radians, Zt = kn[1] * radians) : [Qt * degrees, Zt * degrees];
  }, Sn;
}
function cylindricalEqualAreaRaw(_e) {
  var Qt = cos$1(_e);
  function Zt($n, Sn) {
    return [$n * Qt, sin$1(Sn) / Qt];
  }
  return Zt.invert = function($n, Sn) {
    return [$n / Qt, asin$1(Sn * Qt)];
  }, Zt;
}
function conicEqualAreaRaw(_e, Qt) {
  var Zt = sin$1(_e), $n = (Zt + sin$1(Qt)) / 2;
  if (abs$1($n) < epsilon$3)
    return cylindricalEqualAreaRaw(_e);
  var Sn = 1 + Zt * (2 * $n - Zt), kn = sqrt$1(Sn) / $n;
  function Kn(er, Cr) {
    var kr = sqrt$1(Sn - 2 * $n * sin$1(Cr)) / $n;
    return [kr * sin$1(er *= $n), kn - kr * cos$1(er)];
  }
  return Kn.invert = function(er, Cr) {
    var kr = kn - Cr, Yr = atan2(er, abs$1(kr)) * sign(kr);
    return kr * $n < 0 && (Yr -= pi$2 * sign(er) * sign(kr)), [Yr / $n, asin$1((Sn - (er * er + kr * kr) * $n * $n) / (2 * $n))];
  }, Kn;
}
function geoConicEqualArea() {
  return conicProjection(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]);
}
function geoAlbers() {
  return geoConicEqualArea().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]);
}
function multiplex(_e) {
  var Qt = _e.length;
  return {
    point: function(Zt, $n) {
      for (var Sn = -1; ++Sn < Qt; )
        _e[Sn].point(Zt, $n);
    },
    sphere: function() {
      for (var Zt = -1; ++Zt < Qt; )
        _e[Zt].sphere();
    },
    lineStart: function() {
      for (var Zt = -1; ++Zt < Qt; )
        _e[Zt].lineStart();
    },
    lineEnd: function() {
      for (var Zt = -1; ++Zt < Qt; )
        _e[Zt].lineEnd();
    },
    polygonStart: function() {
      for (var Zt = -1; ++Zt < Qt; )
        _e[Zt].polygonStart();
    },
    polygonEnd: function() {
      for (var Zt = -1; ++Zt < Qt; )
        _e[Zt].polygonEnd();
    }
  };
}
function geoAlbersUsa() {
  var _e, Qt, Zt = geoAlbers(), $n, Sn = geoConicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), kn, Kn = geoConicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), er, Cr, kr = { point: function(Ds, Ls) {
    Cr = [Ds, Ls];
  } };
  function Yr(Ds) {
    var Ls = Ds[0], js = Ds[1];
    return Cr = null, $n.point(Ls, js), Cr || (kn.point(Ls, js), Cr) || (er.point(Ls, js), Cr);
  }
  Yr.invert = function(Ds) {
    var Ls = Zt.scale(), js = Zt.translate(), zs = (Ds[0] - js[0]) / Ls, Fs = (Ds[1] - js[1]) / Ls;
    return (Fs >= 0.12 && Fs < 0.234 && zs >= -0.425 && zs < -0.214 ? Sn : Fs >= 0.166 && Fs < 0.234 && zs >= -0.214 && zs < -0.115 ? Kn : Zt).invert(Ds);
  }, Yr.stream = function(Ds) {
    return _e && Qt === Ds ? _e : _e = multiplex([Zt.stream(Qt = Ds), Sn.stream(Ds), Kn.stream(Ds)]);
  }, Yr.precision = function(Ds) {
    return arguments.length ? (Zt.precision(Ds), Sn.precision(Ds), Kn.precision(Ds), Ms()) : Zt.precision();
  }, Yr.scale = function(Ds) {
    return arguments.length ? (Zt.scale(Ds), Sn.scale(Ds * 0.35), Kn.scale(Ds), Yr.translate(Zt.translate())) : Zt.scale();
  }, Yr.translate = function(Ds) {
    if (!arguments.length)
      return Zt.translate();
    var Ls = Zt.scale(), js = +Ds[0], zs = +Ds[1];
    return $n = Zt.translate(Ds).clipExtent([[js - 0.455 * Ls, zs - 0.238 * Ls], [js + 0.455 * Ls, zs + 0.238 * Ls]]).stream(kr), kn = Sn.translate([js - 0.307 * Ls, zs + 0.201 * Ls]).clipExtent([[js - 0.425 * Ls + epsilon$3, zs + 0.12 * Ls + epsilon$3], [js - 0.214 * Ls - epsilon$3, zs + 0.234 * Ls - epsilon$3]]).stream(kr), er = Kn.translate([js - 0.205 * Ls, zs + 0.212 * Ls]).clipExtent([[js - 0.214 * Ls + epsilon$3, zs + 0.166 * Ls + epsilon$3], [js - 0.115 * Ls - epsilon$3, zs + 0.234 * Ls - epsilon$3]]).stream(kr), Ms();
  }, Yr.fitExtent = function(Ds, Ls) {
    return fitExtent(Yr, Ds, Ls);
  }, Yr.fitSize = function(Ds, Ls) {
    return fitSize(Yr, Ds, Ls);
  }, Yr.fitWidth = function(Ds, Ls) {
    return fitWidth(Yr, Ds, Ls);
  }, Yr.fitHeight = function(Ds, Ls) {
    return fitHeight(Yr, Ds, Ls);
  };
  function Ms() {
    return _e = Qt = null, Yr;
  }
  return Yr.scale(1070);
}
function azimuthalRaw(_e) {
  return function(Qt, Zt) {
    var $n = cos$1(Qt), Sn = cos$1(Zt), kn = _e($n * Sn);
    return kn === 1 / 0 ? [2, 0] : [
      kn * Sn * sin$1(Qt),
      kn * sin$1(Zt)
    ];
  };
}
function azimuthalInvert(_e) {
  return function(Qt, Zt) {
    var $n = sqrt$1(Qt * Qt + Zt * Zt), Sn = _e($n), kn = sin$1(Sn), Kn = cos$1(Sn);
    return [
      atan2(Qt * kn, $n * Kn),
      asin$1($n && Zt * kn / $n)
    ];
  };
}
var azimuthalEqualAreaRaw = azimuthalRaw(function(_e) {
  return sqrt$1(2 / (1 + _e));
});
azimuthalEqualAreaRaw.invert = azimuthalInvert(function(_e) {
  return 2 * asin$1(_e / 2);
});
function geoAzimuthalEqualArea() {
  return projection$1(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3);
}
var azimuthalEquidistantRaw = azimuthalRaw(function(_e) {
  return (_e = acos(_e)) && _e / sin$1(_e);
});
azimuthalEquidistantRaw.invert = azimuthalInvert(function(_e) {
  return _e;
});
function geoAzimuthalEquidistant() {
  return projection$1(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3);
}
function mercatorRaw(_e, Qt) {
  return [_e, log$2(tan((halfPi$1 + Qt) / 2))];
}
mercatorRaw.invert = function(_e, Qt) {
  return [_e, 2 * atan(exp(Qt)) - halfPi$1];
};
function geoMercator() {
  return mercatorProjection(mercatorRaw).scale(961 / tau$1);
}
function mercatorProjection(_e) {
  var Qt = projection$1(_e), Zt = Qt.center, $n = Qt.scale, Sn = Qt.translate, kn = Qt.clipExtent, Kn = null, er, Cr, kr;
  Qt.scale = function(Ms) {
    return arguments.length ? ($n(Ms), Yr()) : $n();
  }, Qt.translate = function(Ms) {
    return arguments.length ? (Sn(Ms), Yr()) : Sn();
  }, Qt.center = function(Ms) {
    return arguments.length ? (Zt(Ms), Yr()) : Zt();
  }, Qt.clipExtent = function(Ms) {
    return arguments.length ? (Ms == null ? Kn = er = Cr = kr = null : (Kn = +Ms[0][0], er = +Ms[0][1], Cr = +Ms[1][0], kr = +Ms[1][1]), Yr()) : Kn == null ? null : [[Kn, er], [Cr, kr]];
  };
  function Yr() {
    var Ms = pi$2 * $n(), Ds = Qt(rotation(Qt.rotate()).invert([0, 0]));
    return kn(Kn == null ? [[Ds[0] - Ms, Ds[1] - Ms], [Ds[0] + Ms, Ds[1] + Ms]] : _e === mercatorRaw ? [[Math.max(Ds[0] - Ms, Kn), er], [Math.min(Ds[0] + Ms, Cr), kr]] : [[Kn, Math.max(Ds[1] - Ms, er)], [Cr, Math.min(Ds[1] + Ms, kr)]]);
  }
  return Yr();
}
function tany(_e) {
  return tan((halfPi$1 + _e) / 2);
}
function conicConformalRaw(_e, Qt) {
  var Zt = cos$1(_e), $n = _e === Qt ? sin$1(_e) : log$2(Zt / cos$1(Qt)) / log$2(tany(Qt) / tany(_e)), Sn = Zt * pow$1(tany(_e), $n) / $n;
  if (!$n)
    return mercatorRaw;
  function kn(Kn, er) {
    Sn > 0 ? er < -halfPi$1 + epsilon$3 && (er = -halfPi$1 + epsilon$3) : er > halfPi$1 - epsilon$3 && (er = halfPi$1 - epsilon$3);
    var Cr = Sn / pow$1(tany(er), $n);
    return [Cr * sin$1($n * Kn), Sn - Cr * cos$1($n * Kn)];
  }
  return kn.invert = function(Kn, er) {
    var Cr = Sn - er, kr = sign($n) * sqrt$1(Kn * Kn + Cr * Cr), Yr = atan2(Kn, abs$1(Cr)) * sign(Cr);
    return Cr * $n < 0 && (Yr -= pi$2 * sign(Kn) * sign(Cr)), [Yr / $n, 2 * atan(pow$1(Sn / kr, 1 / $n)) - halfPi$1];
  }, kn;
}
function geoConicConformal() {
  return conicProjection(conicConformalRaw).scale(109.5).parallels([30, 30]);
}
function equirectangularRaw(_e, Qt) {
  return [_e, Qt];
}
equirectangularRaw.invert = equirectangularRaw;
function geoEquirectangular() {
  return projection$1(equirectangularRaw).scale(152.63);
}
function conicEquidistantRaw(_e, Qt) {
  var Zt = cos$1(_e), $n = _e === Qt ? sin$1(_e) : (Zt - cos$1(Qt)) / (Qt - _e), Sn = Zt / $n + _e;
  if (abs$1($n) < epsilon$3)
    return equirectangularRaw;
  function kn(Kn, er) {
    var Cr = Sn - er, kr = $n * Kn;
    return [Cr * sin$1(kr), Sn - Cr * cos$1(kr)];
  }
  return kn.invert = function(Kn, er) {
    var Cr = Sn - er, kr = atan2(Kn, abs$1(Cr)) * sign(Cr);
    return Cr * $n < 0 && (kr -= pi$2 * sign(Kn) * sign(Cr)), [kr / $n, Sn - sign($n) * sqrt$1(Kn * Kn + Cr * Cr)];
  }, kn;
}
function geoConicEquidistant() {
  return conicProjection(conicEquidistantRaw).scale(131.154).center([0, 13.9389]);
}
var A1$1 = 1.340264, A2 = -0.081106, A3 = 893e-6, A4 = 3796e-6, M = sqrt$1(3) / 2, iterations = 12;
function equalEarthRaw(_e, Qt) {
  var Zt = asin$1(M * sin$1(Qt)), $n = Zt * Zt, Sn = $n * $n * $n;
  return [
    _e * cos$1(Zt) / (M * (A1$1 + 3 * A2 * $n + Sn * (7 * A3 + 9 * A4 * $n))),
    Zt * (A1$1 + A2 * $n + Sn * (A3 + A4 * $n))
  ];
}
equalEarthRaw.invert = function(_e, Qt) {
  for (var Zt = Qt, $n = Zt * Zt, Sn = $n * $n * $n, kn = 0, Kn, er, Cr; kn < iterations && (er = Zt * (A1$1 + A2 * $n + Sn * (A3 + A4 * $n)) - Qt, Cr = A1$1 + 3 * A2 * $n + Sn * (7 * A3 + 9 * A4 * $n), Zt -= Kn = er / Cr, $n = Zt * Zt, Sn = $n * $n * $n, !(abs$1(Kn) < epsilon2)); ++kn)
    ;
  return [
    M * _e * (A1$1 + 3 * A2 * $n + Sn * (7 * A3 + 9 * A4 * $n)) / cos$1(Zt),
    asin$1(sin$1(Zt) / M)
  ];
};
function geoEqualEarth() {
  return projection$1(equalEarthRaw).scale(177.158);
}
function gnomonicRaw(_e, Qt) {
  var Zt = cos$1(Qt), $n = cos$1(_e) * Zt;
  return [Zt * sin$1(_e) / $n, sin$1(Qt) / $n];
}
gnomonicRaw.invert = azimuthalInvert(atan);
function geoGnomonic() {
  return projection$1(gnomonicRaw).scale(144.049).clipAngle(60);
}
function geoIdentity() {
  var _e = 1, Qt = 0, Zt = 0, $n = 1, Sn = 1, kn = 0, Kn, er, Cr = null, kr, Yr, Ms, Ds = 1, Ls = 1, js = transformer({
    point: function(Ys, El) {
      var Mu = Ws([Ys, El]);
      this.stream.point(Mu[0], Mu[1]);
    }
  }), zs = identity$1, Fs, Bs;
  function Hs() {
    return Ds = _e * $n, Ls = _e * Sn, Fs = Bs = null, Ws;
  }
  function Ws(Ys) {
    var El = Ys[0] * Ds, Mu = Ys[1] * Ls;
    if (kn) {
      var Pl = Mu * Kn - El * er;
      El = El * Kn + Mu * er, Mu = Pl;
    }
    return [El + Qt, Mu + Zt];
  }
  return Ws.invert = function(Ys) {
    var El = Ys[0] - Qt, Mu = Ys[1] - Zt;
    if (kn) {
      var Pl = Mu * Kn + El * er;
      El = El * Kn - Mu * er, Mu = Pl;
    }
    return [El / Ds, Mu / Ls];
  }, Ws.stream = function(Ys) {
    return Fs && Bs === Ys ? Fs : Fs = js(zs(Bs = Ys));
  }, Ws.postclip = function(Ys) {
    return arguments.length ? (zs = Ys, Cr = kr = Yr = Ms = null, Hs()) : zs;
  }, Ws.clipExtent = function(Ys) {
    return arguments.length ? (zs = Ys == null ? (Cr = kr = Yr = Ms = null, identity$1) : clipRectangle(Cr = +Ys[0][0], kr = +Ys[0][1], Yr = +Ys[1][0], Ms = +Ys[1][1]), Hs()) : Cr == null ? null : [[Cr, kr], [Yr, Ms]];
  }, Ws.scale = function(Ys) {
    return arguments.length ? (_e = +Ys, Hs()) : _e;
  }, Ws.translate = function(Ys) {
    return arguments.length ? (Qt = +Ys[0], Zt = +Ys[1], Hs()) : [Qt, Zt];
  }, Ws.angle = function(Ys) {
    return arguments.length ? (kn = Ys % 360 * radians, er = sin$1(kn), Kn = cos$1(kn), Hs()) : kn * degrees;
  }, Ws.reflectX = function(Ys) {
    return arguments.length ? ($n = Ys ? -1 : 1, Hs()) : $n < 0;
  }, Ws.reflectY = function(Ys) {
    return arguments.length ? (Sn = Ys ? -1 : 1, Hs()) : Sn < 0;
  }, Ws.fitExtent = function(Ys, El) {
    return fitExtent(Ws, Ys, El);
  }, Ws.fitSize = function(Ys, El) {
    return fitSize(Ws, Ys, El);
  }, Ws.fitWidth = function(Ys, El) {
    return fitWidth(Ws, Ys, El);
  }, Ws.fitHeight = function(Ys, El) {
    return fitHeight(Ws, Ys, El);
  }, Ws;
}
function naturalEarth1Raw(_e, Qt) {
  var Zt = Qt * Qt, $n = Zt * Zt;
  return [
    _e * (0.8707 - 0.131979 * Zt + $n * (-0.013791 + $n * (3971e-6 * Zt - 1529e-6 * $n))),
    Qt * (1.007226 + Zt * (0.015085 + $n * (-0.044475 + 0.028874 * Zt - 5916e-6 * $n)))
  ];
}
naturalEarth1Raw.invert = function(_e, Qt) {
  var Zt = Qt, $n = 25, Sn;
  do {
    var kn = Zt * Zt, Kn = kn * kn;
    Zt -= Sn = (Zt * (1.007226 + kn * (0.015085 + Kn * (-0.044475 + 0.028874 * kn - 5916e-6 * Kn))) - Qt) / (1.007226 + kn * (0.015085 * 3 + Kn * (-0.044475 * 7 + 0.028874 * 9 * kn - 5916e-6 * 11 * Kn)));
  } while (abs$1(Sn) > epsilon$3 && --$n > 0);
  return [
    _e / (0.8707 + (kn = Zt * Zt) * (-0.131979 + kn * (-0.013791 + kn * kn * kn * (3971e-6 - 1529e-6 * kn)))),
    Zt
  ];
};
function geoNaturalEarth1() {
  return projection$1(naturalEarth1Raw).scale(175.295);
}
function orthographicRaw(_e, Qt) {
  return [cos$1(Qt) * sin$1(_e), sin$1(Qt)];
}
orthographicRaw.invert = azimuthalInvert(asin$1);
function geoOrthographic() {
  return projection$1(orthographicRaw).scale(249.5).clipAngle(90 + epsilon$3);
}
function stereographicRaw(_e, Qt) {
  var Zt = cos$1(Qt), $n = 1 + cos$1(_e) * Zt;
  return [Zt * sin$1(_e) / $n, sin$1(Qt) / $n];
}
stereographicRaw.invert = azimuthalInvert(function(_e) {
  return 2 * atan(_e);
});
function geoStereographic() {
  return projection$1(stereographicRaw).scale(250).clipAngle(142);
}
function transverseMercatorRaw(_e, Qt) {
  return [log$2(tan((halfPi$1 + Qt) / 2)), -_e];
}
transverseMercatorRaw.invert = function(_e, Qt) {
  return [-Qt, 2 * atan(exp(_e)) - halfPi$1];
};
function geoTransverseMercator() {
  var _e = mercatorProjection(transverseMercatorRaw), Qt = _e.center, Zt = _e.rotate;
  return _e.center = function($n) {
    return arguments.length ? Qt([-$n[1], $n[0]]) : ($n = Qt(), [$n[1], -$n[0]]);
  }, _e.rotate = function($n) {
    return arguments.length ? Zt([$n[0], $n[1], $n.length > 2 ? $n[2] + 90 : 90]) : ($n = Zt(), [$n[0], $n[1], $n[2] - 90]);
  }, Zt([0, 0, 90]).scale(159.155);
}
var abs = Math.abs, cos = Math.cos, sin = Math.sin, epsilon$2 = 1e-6, pi$1 = Math.PI, halfPi = pi$1 / 2, sqrt2 = sqrt(2);
function asin(_e) {
  return _e > 1 ? halfPi : _e < -1 ? -halfPi : Math.asin(_e);
}
function sqrt(_e) {
  return _e > 0 ? Math.sqrt(_e) : 0;
}
function mollweideBromleyTheta(_e, Qt) {
  var Zt = _e * sin(Qt), $n = 30, Sn;
  do
    Qt -= Sn = (Qt + sin(Qt) - Zt) / (1 + cos(Qt));
  while (abs(Sn) > epsilon$2 && --$n > 0);
  return Qt / 2;
}
function mollweideBromleyRaw(_e, Qt, Zt) {
  function $n(Sn, kn) {
    return [_e * Sn * cos(kn = mollweideBromleyTheta(Zt, kn)), Qt * sin(kn)];
  }
  return $n.invert = function(Sn, kn) {
    return kn = asin(kn / Qt), [Sn / (_e * cos(kn)), asin((2 * kn + sin(2 * kn)) / Zt)];
  }, $n;
}
var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi$1);
function geoMollweide() {
  return projection$1(mollweideRaw).scale(169.529);
}
const defaultPath = geoPath(), projectionProperties = [
  // standard properties in d3-geo
  "clipAngle",
  "clipExtent",
  "scale",
  "translate",
  "center",
  "rotate",
  "parallels",
  "precision",
  "reflectX",
  "reflectY",
  // extended properties in d3-geo-projections
  "coefficient",
  "distance",
  "fraction",
  "lobes",
  "parallel",
  "radius",
  "ratio",
  "spacing",
  "tilt"
];
function create$3(_e, Qt) {
  return function Zt() {
    const $n = Qt();
    return $n.type = _e, $n.path = geoPath().projection($n), $n.copy = $n.copy || function() {
      const Sn = Zt();
      return projectionProperties.forEach((kn) => {
        $n[kn] && Sn[kn]($n[kn]());
      }), Sn.path.pointRadius($n.path.pointRadius()), Sn;
    }, registerScale($n);
  };
}
function projection(_e, Qt) {
  if (!_e || typeof _e != "string")
    throw new Error("Projection type must be a name string.");
  return _e = _e.toLowerCase(), arguments.length > 1 ? (projections[_e] = create$3(_e, Qt), this) : projections[_e] || null;
}
function getProjectionPath(_e) {
  return _e && _e.path || defaultPath;
}
const projections = {
  // base d3-geo projection types
  albers: geoAlbers,
  albersusa: geoAlbersUsa,
  azimuthalequalarea: geoAzimuthalEqualArea,
  azimuthalequidistant: geoAzimuthalEquidistant,
  conicconformal: geoConicConformal,
  conicequalarea: geoConicEqualArea,
  conicequidistant: geoConicEquidistant,
  equalEarth: geoEqualEarth,
  equirectangular: geoEquirectangular,
  gnomonic: geoGnomonic,
  identity: geoIdentity,
  mercator: geoMercator,
  mollweide: geoMollweide,
  naturalEarth1: geoNaturalEarth1,
  orthographic: geoOrthographic,
  stereographic: geoStereographic,
  transversemercator: geoTransverseMercator
};
for (const _e in projections)
  projection(_e, projections[_e]);
function noop$4() {
}
const cases = [[], [[[1, 1.5], [0.5, 1]]], [[[1.5, 1], [1, 1.5]]], [[[1.5, 1], [0.5, 1]]], [[[1, 0.5], [1.5, 1]]], [[[1, 1.5], [0.5, 1]], [[1, 0.5], [1.5, 1]]], [[[1, 0.5], [1, 1.5]]], [[[1, 0.5], [0.5, 1]]], [[[0.5, 1], [1, 0.5]]], [[[1, 1.5], [1, 0.5]]], [[[0.5, 1], [1, 0.5]], [[1.5, 1], [1, 1.5]]], [[[1.5, 1], [1, 0.5]]], [[[0.5, 1], [1.5, 1]]], [[[1, 1.5], [1.5, 1]]], [[[0.5, 1], [1, 1.5]]], []];
function contours() {
  var _e = 1, Qt = 1, Zt = er;
  function $n(Cr, kr) {
    return kr.map((Yr) => Sn(Cr, Yr));
  }
  function Sn(Cr, kr) {
    var Yr = [], Ms = [];
    return kn(Cr, kr, (Ds) => {
      Zt(Ds, Cr, kr), area$1(Ds) > 0 ? Yr.push([Ds]) : Ms.push(Ds);
    }), Ms.forEach((Ds) => {
      for (var Ls = 0, js = Yr.length, zs; Ls < js; ++Ls)
        if (contains((zs = Yr[Ls])[0], Ds) !== -1) {
          zs.push(Ds);
          return;
        }
    }), {
      type: "MultiPolygon",
      value: kr,
      coordinates: Yr
    };
  }
  function kn(Cr, kr, Yr) {
    var Ms = new Array(), Ds = new Array(), Ls, js, zs, Fs, Bs, Hs;
    for (Ls = js = -1, Fs = Cr[0] >= kr, cases[Fs << 1].forEach(Ws); ++Ls < _e - 1; )
      zs = Fs, Fs = Cr[Ls + 1] >= kr, cases[zs | Fs << 1].forEach(Ws);
    for (cases[Fs << 0].forEach(Ws); ++js < Qt - 1; ) {
      for (Ls = -1, Fs = Cr[js * _e + _e] >= kr, Bs = Cr[js * _e] >= kr, cases[Fs << 1 | Bs << 2].forEach(Ws); ++Ls < _e - 1; )
        zs = Fs, Fs = Cr[js * _e + _e + Ls + 1] >= kr, Hs = Bs, Bs = Cr[js * _e + Ls + 1] >= kr, cases[zs | Fs << 1 | Bs << 2 | Hs << 3].forEach(Ws);
      cases[Fs | Bs << 3].forEach(Ws);
    }
    for (Ls = -1, Bs = Cr[js * _e] >= kr, cases[Bs << 2].forEach(Ws); ++Ls < _e - 1; )
      Hs = Bs, Bs = Cr[js * _e + Ls + 1] >= kr, cases[Bs << 2 | Hs << 3].forEach(Ws);
    cases[Bs << 3].forEach(Ws);
    function Ws(Ys) {
      var El = [Ys[0][0] + Ls, Ys[0][1] + js], Mu = [Ys[1][0] + Ls, Ys[1][1] + js], Pl = Kn(El), Iu = Kn(Mu), Tu, Au;
      (Tu = Ds[Pl]) ? (Au = Ms[Iu]) ? (delete Ds[Tu.end], delete Ms[Au.start], Tu === Au ? (Tu.ring.push(Mu), Yr(Tu.ring)) : Ms[Tu.start] = Ds[Au.end] = {
        start: Tu.start,
        end: Au.end,
        ring: Tu.ring.concat(Au.ring)
      }) : (delete Ds[Tu.end], Tu.ring.push(Mu), Ds[Tu.end = Iu] = Tu) : (Tu = Ms[Iu]) ? (Au = Ds[Pl]) ? (delete Ms[Tu.start], delete Ds[Au.end], Tu === Au ? (Tu.ring.push(Mu), Yr(Tu.ring)) : Ms[Au.start] = Ds[Tu.end] = {
        start: Au.start,
        end: Tu.end,
        ring: Au.ring.concat(Tu.ring)
      }) : (delete Ms[Tu.start], Tu.ring.unshift(El), Ms[Tu.start = Pl] = Tu) : Ms[Pl] = Ds[Iu] = {
        start: Pl,
        end: Iu,
        ring: [El, Mu]
      };
    }
  }
  function Kn(Cr) {
    return Cr[0] * 2 + Cr[1] * (_e + 1) * 4;
  }
  function er(Cr, kr, Yr) {
    Cr.forEach((Ms) => {
      var Ds = Ms[0], Ls = Ms[1], js = Ds | 0, zs = Ls | 0, Fs, Bs = kr[zs * _e + js];
      Ds > 0 && Ds < _e && js === Ds && (Fs = kr[zs * _e + js - 1], Ms[0] = Ds + (Yr - Fs) / (Bs - Fs) - 0.5), Ls > 0 && Ls < Qt && zs === Ls && (Fs = kr[(zs - 1) * _e + js], Ms[1] = Ls + (Yr - Fs) / (Bs - Fs) - 0.5);
    });
  }
  return $n.contour = Sn, $n.size = function(Cr) {
    if (!arguments.length)
      return [_e, Qt];
    var kr = Math.floor(Cr[0]), Yr = Math.floor(Cr[1]);
    return kr >= 0 && Yr >= 0 || error("invalid size"), _e = kr, Qt = Yr, $n;
  }, $n.smooth = function(Cr) {
    return arguments.length ? (Zt = Cr ? er : noop$4, $n) : Zt === er;
  }, $n;
}
function area$1(_e) {
  for (var Qt = 0, Zt = _e.length, $n = _e[Zt - 1][1] * _e[0][0] - _e[Zt - 1][0] * _e[0][1]; ++Qt < Zt; )
    $n += _e[Qt - 1][1] * _e[Qt][0] - _e[Qt - 1][0] * _e[Qt][1];
  return $n;
}
function contains(_e, Qt) {
  for (var Zt = -1, $n = Qt.length, Sn; ++Zt < $n; )
    if (Sn = ringContains(_e, Qt[Zt]))
      return Sn;
  return 0;
}
function ringContains(_e, Qt) {
  for (var Zt = Qt[0], $n = Qt[1], Sn = -1, kn = 0, Kn = _e.length, er = Kn - 1; kn < Kn; er = kn++) {
    var Cr = _e[kn], kr = Cr[0], Yr = Cr[1], Ms = _e[er], Ds = Ms[0], Ls = Ms[1];
    if (segmentContains(Cr, Ms, Qt))
      return 0;
    Yr > $n != Ls > $n && Zt < (Ds - kr) * ($n - Yr) / (Ls - Yr) + kr && (Sn = -Sn);
  }
  return Sn;
}
function segmentContains(_e, Qt, Zt) {
  var $n;
  return collinear$1(_e, Qt, Zt) && within(_e[$n = +(_e[0] === Qt[0])], Zt[$n], Qt[$n]);
}
function collinear$1(_e, Qt, Zt) {
  return (Qt[0] - _e[0]) * (Zt[1] - _e[1]) === (Zt[0] - _e[0]) * (Qt[1] - _e[1]);
}
function within(_e, Qt, Zt) {
  return _e <= Qt && Qt <= Zt || Zt <= Qt && Qt <= _e;
}
function quantize(_e, Qt, Zt) {
  return function($n) {
    var Sn = extent($n), kn = Zt ? Math.min(Sn[0], 0) : Sn[0], Kn = Sn[1], er = Kn - kn, Cr = Qt ? tickStep(kn, Kn, _e) : er / (_e + 1);
    return range$5(kn + Cr, Kn, Cr);
  };
}
function Isocontour(_e) {
  Transform$1.call(this, null, _e);
}
Isocontour.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"
  }]
};
inherits(Isocontour, Transform$1, {
  transform(_e, Qt) {
    if (this.value && !Qt.changed() && !_e.modified())
      return Qt.StopPropagation;
    var Zt = Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS), $n = Qt.materialize(Qt.SOURCE).source, Sn = _e.field || identity$7, kn = contours().smooth(_e.smooth !== !1), Kn = _e.thresholds || levels($n, Sn, _e), er = _e.as === null ? null : _e.as || "contour", Cr = [];
    return $n.forEach((kr) => {
      const Yr = Sn(kr), Ms = kn.size([Yr.width, Yr.height])(Yr.values, isArray(Kn) ? Kn : Kn(Yr.values));
      transformPaths(Ms, Yr, kr, _e), Ms.forEach((Ds) => {
        Cr.push(rederive(kr, ingest$1(er != null ? {
          [er]: Ds
        } : Ds)));
      });
    }), this.value && (Zt.rem = this.value), this.value = Zt.source = Zt.add = Cr, Zt;
  }
});
function levels(_e, Qt, Zt) {
  const $n = quantize(Zt.levels || 10, Zt.nice, Zt.zero !== !1);
  return Zt.resolve !== "shared" ? $n : $n(_e.map((Sn) => max$2(Qt(Sn).values)));
}
function transformPaths(_e, Qt, Zt, $n) {
  let Sn = $n.scale || Qt.scale, kn = $n.translate || Qt.translate;
  if (isFunction$1(Sn) && (Sn = Sn(Zt, $n)), isFunction$1(kn) && (kn = kn(Zt, $n)), (Sn === 1 || Sn == null) && !kn)
    return;
  const Kn = (isNumber$1(Sn) ? Sn : Sn[0]) || 1, er = (isNumber$1(Sn) ? Sn : Sn[1]) || 1, Cr = kn && kn[0] || 0, kr = kn && kn[1] || 0;
  _e.forEach(transform$1(Qt, Kn, er, Cr, kr));
}
function transform$1(_e, Qt, Zt, $n, Sn) {
  const kn = _e.x1 || 0, Kn = _e.y1 || 0, er = Qt * Zt < 0;
  function Cr(Ms) {
    Ms.forEach(kr);
  }
  function kr(Ms) {
    er && Ms.reverse(), Ms.forEach(Yr);
  }
  function Yr(Ms) {
    Ms[0] = (Ms[0] - kn) * Qt + $n, Ms[1] = (Ms[1] - Kn) * Zt + Sn;
  }
  return function(Ms) {
    return Ms.coordinates.forEach(Cr), Ms;
  };
}
function radius(_e, Qt, Zt) {
  const $n = _e >= 0 ? _e : estimateBandwidth(Qt, Zt);
  return Math.round((Math.sqrt(4 * $n * $n + 1) - 1) / 2);
}
function number$2(_e) {
  return isFunction$1(_e) ? _e : constant$7(+_e);
}
function density2D() {
  var _e = (Cr) => Cr[0], Qt = (Cr) => Cr[1], Zt = one$2, $n = [-1, -1], Sn = 960, kn = 500, Kn = 2;
  function er(Cr, kr) {
    const Yr = radius($n[0], Cr, _e) >> Kn, Ms = radius($n[1], Cr, Qt) >> Kn, Ds = Yr ? Yr + 2 : 0, Ls = Ms ? Ms + 2 : 0, js = 2 * Ds + (Sn >> Kn), zs = 2 * Ls + (kn >> Kn), Fs = new Float32Array(js * zs), Bs = new Float32Array(js * zs);
    let Hs = Fs;
    Cr.forEach((Ys) => {
      const El = Ds + (+_e(Ys) >> Kn), Mu = Ls + (+Qt(Ys) >> Kn);
      El >= 0 && El < js && Mu >= 0 && Mu < zs && (Fs[El + Mu * js] += +Zt(Ys));
    }), Yr > 0 && Ms > 0 ? (blurX(js, zs, Fs, Bs, Yr), blurY(js, zs, Bs, Fs, Ms), blurX(js, zs, Fs, Bs, Yr), blurY(js, zs, Bs, Fs, Ms), blurX(js, zs, Fs, Bs, Yr), blurY(js, zs, Bs, Fs, Ms)) : Yr > 0 ? (blurX(js, zs, Fs, Bs, Yr), blurX(js, zs, Bs, Fs, Yr), blurX(js, zs, Fs, Bs, Yr), Hs = Bs) : Ms > 0 && (blurY(js, zs, Fs, Bs, Ms), blurY(js, zs, Bs, Fs, Ms), blurY(js, zs, Fs, Bs, Ms), Hs = Bs);
    const Ws = kr ? Math.pow(2, -2 * Kn) : 1 / sum$1(Hs);
    for (let Ys = 0, El = js * zs; Ys < El; ++Ys)
      Hs[Ys] *= Ws;
    return {
      values: Hs,
      scale: 1 << Kn,
      width: js,
      height: zs,
      x1: Ds,
      y1: Ls,
      x2: Ds + (Sn >> Kn),
      y2: Ls + (kn >> Kn)
    };
  }
  return er.x = function(Cr) {
    return arguments.length ? (_e = number$2(Cr), er) : _e;
  }, er.y = function(Cr) {
    return arguments.length ? (Qt = number$2(Cr), er) : Qt;
  }, er.weight = function(Cr) {
    return arguments.length ? (Zt = number$2(Cr), er) : Zt;
  }, er.size = function(Cr) {
    if (!arguments.length)
      return [Sn, kn];
    var kr = +Cr[0], Yr = +Cr[1];
    return kr >= 0 && Yr >= 0 || error("invalid size"), Sn = kr, kn = Yr, er;
  }, er.cellSize = function(Cr) {
    return arguments.length ? ((Cr = +Cr) >= 1 || error("invalid cell size"), Kn = Math.floor(Math.log(Cr) / Math.LN2), er) : 1 << Kn;
  }, er.bandwidth = function(Cr) {
    return arguments.length ? (Cr = array$6(Cr), Cr.length === 1 && (Cr = [+Cr[0], +Cr[0]]), Cr.length !== 2 && error("invalid bandwidth"), $n = Cr, er) : $n;
  }, er;
}
function blurX(_e, Qt, Zt, $n, Sn) {
  const kn = (Sn << 1) + 1;
  for (let Kn = 0; Kn < Qt; ++Kn)
    for (let er = 0, Cr = 0; er < _e + Sn; ++er)
      er < _e && (Cr += Zt[er + Kn * _e]), er >= Sn && (er >= kn && (Cr -= Zt[er - kn + Kn * _e]), $n[er - Sn + Kn * _e] = Cr / Math.min(er + 1, _e - 1 + kn - er, kn));
}
function blurY(_e, Qt, Zt, $n, Sn) {
  const kn = (Sn << 1) + 1;
  for (let Kn = 0; Kn < _e; ++Kn)
    for (let er = 0, Cr = 0; er < Qt + Sn; ++er)
      er < Qt && (Cr += Zt[Kn + er * _e]), er >= Sn && (er >= kn && (Cr -= Zt[Kn + (er - kn) * _e]), $n[Kn + (er - Sn) * _e] = Cr / Math.min(er + 1, Qt - 1 + kn - er, kn));
}
function KDE2D(_e) {
  Transform$1.call(this, null, _e);
}
KDE2D.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 PARAMS = ["x", "y", "weight", "size", "cellSize", "bandwidth"];
function params(_e, Qt) {
  return PARAMS.forEach((Zt) => Qt[Zt] != null ? _e[Zt](Qt[Zt]) : 0), _e;
}
inherits(KDE2D, Transform$1, {
  transform(_e, Qt) {
    if (this.value && !Qt.changed() && !_e.modified())
      return Qt.StopPropagation;
    var Zt = Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS), $n = Qt.materialize(Qt.SOURCE).source, Sn = partition$2($n, _e.groupby), kn = (_e.groupby || []).map(accessorName), Kn = params(density2D(), _e), er = _e.as || "grid", Cr = [];
    function kr(Yr, Ms) {
      for (let Ds = 0; Ds < kn.length; ++Ds)
        Yr[kn[Ds]] = Ms[Ds];
      return Yr;
    }
    return Cr = Sn.map((Yr) => ingest$1(kr({
      [er]: Kn(Yr, _e.counts)
    }, Yr.dims))), this.value && (Zt.rem = this.value), this.value = Zt.source = Zt.add = Cr, Zt;
  }
});
function partition$2(_e, Qt) {
  var Zt = [], $n = (Yr) => Yr(er), Sn, kn, Kn, er, Cr, kr;
  if (Qt == null)
    Zt.push(_e);
  else
    for (Sn = {}, kn = 0, Kn = _e.length; kn < Kn; ++kn)
      er = _e[kn], Cr = Qt.map($n), kr = Sn[Cr], kr || (Sn[Cr] = kr = [], kr.dims = Cr, Zt.push(kr)), kr.push(er);
  return Zt;
}
function Contour(_e) {
  Transform$1.call(this, null, _e);
}
Contour.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
  }]
};
inherits(Contour, Transform$1, {
  transform(_e, Qt) {
    if (this.value && !Qt.changed() && !_e.modified())
      return Qt.StopPropagation;
    var Zt = Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS), $n = contours().smooth(_e.smooth !== !1), Sn = _e.values, kn = _e.thresholds || quantize(_e.count || 10, _e.nice, !!Sn), Kn = _e.size, er, Cr;
    return Sn || (Sn = Qt.materialize(Qt.SOURCE).source, er = params(density2D(), _e)(Sn, !0), Cr = transform$1(er, er.scale || 1, er.scale || 1, 0, 0), Kn = [er.width, er.height], Sn = er.values), kn = isArray(kn) ? kn : kn(Sn), Sn = $n.size(Kn)(Sn, kn), Cr && Sn.forEach(Cr), this.value && (Zt.rem = this.value), this.value = Zt.source = Zt.add = (Sn || []).map(ingest$1), Zt;
  }
});
const Feature = "Feature", FeatureCollection = "FeatureCollection", MultiPoint = "MultiPoint";
function GeoJSON(_e) {
  Transform$1.call(this, null, _e);
}
GeoJSON.Definition = {
  type: "GeoJSON",
  metadata: {},
  params: [{
    name: "fields",
    type: "field",
    array: !0,
    length: 2
  }, {
    name: "geojson",
    type: "field"
  }]
};
inherits(GeoJSON, Transform$1, {
  transform(_e, Qt) {
    var Zt = this._features, $n = this._points, Sn = _e.fields, kn = Sn && Sn[0], Kn = Sn && Sn[1], er = _e.geojson || !Sn && identity$7, Cr = Qt.ADD, kr;
    kr = _e.modified() || Qt.changed(Qt.REM) || Qt.modified(accessorFields(er)) || kn && Qt.modified(accessorFields(kn)) || Kn && Qt.modified(accessorFields(Kn)), (!this.value || kr) && (Cr = Qt.SOURCE, this._features = Zt = [], this._points = $n = []), er && Qt.visit(Cr, (Yr) => Zt.push(er(Yr))), kn && Kn && (Qt.visit(Cr, (Yr) => {
      var Ms = kn(Yr), Ds = Kn(Yr);
      Ms != null && Ds != null && (Ms = +Ms) === Ms && (Ds = +Ds) === Ds && $n.push([Ms, Ds]);
    }), Zt = Zt.concat({
      type: Feature,
      geometry: {
        type: MultiPoint,
        coordinates: $n
      }
    })), this.value = {
      type: FeatureCollection,
      features: Zt
    };
  }
});
function GeoPath(_e) {
  Transform$1.call(this, null, _e);
}
GeoPath.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"
  }]
};
inherits(GeoPath, Transform$1, {
  transform(_e, Qt) {
    var Zt = Qt.fork(Qt.ALL), $n = this.value, Sn = _e.field || identity$7, kn = _e.as || "path", Kn = Zt.SOURCE;
    !$n || _e.modified() ? (this.value = $n = getProjectionPath(_e.projection), Zt.materialize().reflow()) : Kn = Sn === identity$7 || Qt.modified(Sn.fields) ? Zt.ADD_MOD : Zt.ADD;
    const er = initPath($n, _e.pointRadius);
    return Zt.visit(Kn, (Cr) => Cr[kn] = $n(Sn(Cr))), $n.pointRadius(er), Zt.modifies(kn);
  }
});
function initPath(_e, Qt) {
  const Zt = _e.pointRadius();
  return _e.context(null), Qt != null && _e.pointRadius(Qt), Zt;
}
function GeoPoint(_e) {
  Transform$1.call(this, null, _e);
}
GeoPoint.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"]
  }]
};
inherits(GeoPoint, Transform$1, {
  transform(_e, Qt) {
    var Zt = _e.projection, $n = _e.fields[0], Sn = _e.fields[1], kn = _e.as || ["x", "y"], Kn = kn[0], er = kn[1], Cr;
    function kr(Yr) {
      const Ms = Zt([$n(Yr), Sn(Yr)]);
      Ms ? (Yr[Kn] = Ms[0], Yr[er] = Ms[1]) : (Yr[Kn] = void 0, Yr[er] = void 0);
    }
    return _e.modified() ? Qt = Qt.materialize().reflow(!0).visit(Qt.SOURCE, kr) : (Cr = Qt.modified($n.fields) || Qt.modified(Sn.fields), Qt.visit(Cr ? Qt.ADD_MOD : Qt.ADD, kr)), Qt.modifies(kn);
  }
});
function GeoShape(_e) {
  Transform$1.call(this, null, _e);
}
GeoShape.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"
  }]
};
inherits(GeoShape, Transform$1, {
  transform(_e, Qt) {
    var Zt = Qt.fork(Qt.ALL), $n = this.value, Sn = _e.as || "shape", kn = Zt.ADD;
    return (!$n || _e.modified()) && (this.value = $n = shapeGenerator(getProjectionPath(_e.projection), _e.field || field$1("datum"), _e.pointRadius), Zt.materialize().reflow(), kn = Zt.SOURCE), Zt.visit(kn, (Kn) => Kn[Sn] = $n), Zt.modifies(Sn);
  }
});
function shapeGenerator(_e, Qt, Zt) {
  const $n = Zt == null ? (Sn) => _e(Qt(Sn)) : (Sn) => {
    var kn = _e.pointRadius(), Kn = _e.pointRadius(Zt)(Qt(Sn));
    return _e.pointRadius(kn), Kn;
  };
  return $n.context = (Sn) => (_e.context(Sn), $n), $n;
}
function Graticule(_e) {
  Transform$1.call(this, [], _e), this.generator = graticule();
}
Graticule.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
  }]
};
inherits(Graticule, Transform$1, {
  transform(_e, Qt) {
    var Zt = this.value, $n = this.generator, Sn;
    if (!Zt.length || _e.modified())
      for (const kn in _e)
        isFunction$1($n[kn]) && $n[kn](_e[kn]);
    return Sn = $n(), Zt.length ? Qt.mod.push(replace$1(Zt[0], Sn)) : Qt.add.push(ingest$1(Sn)), Zt[0] = Sn, Qt;
  }
});
function Heatmap(_e) {
  Transform$1.call(this, null, _e);
}
Heatmap.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"
  }]
};
inherits(Heatmap, Transform$1, {
  transform(_e, Qt) {
    if (!Qt.changed() && !_e.modified())
      return Qt.StopPropagation;
    var Zt = Qt.materialize(Qt.SOURCE).source, $n = _e.resolve === "shared", Sn = _e.field || identity$7, kn = opacity_(_e.opacity, _e), Kn = color_(_e.color, _e), er = _e.as || "image", Cr = {
      $x: 0,
      $y: 0,
      $value: 0,
      $max: $n ? max$2(Zt.map((kr) => max$2(Sn(kr).values))) : 0
    };
    return Zt.forEach((kr) => {
      const Yr = Sn(kr), Ms = extend$1({}, kr, Cr);
      $n || (Ms.$max = max$2(Yr.values || [])), kr[er] = toCanvas(Yr, Ms, Kn.dep ? Kn : constant$7(Kn(Ms)), kn.dep ? kn : constant$7(kn(Ms)));
    }), Qt.reflow(!0).modifies(er);
  }
});
function color_(_e, Qt) {
  let Zt;
  return isFunction$1(_e) ? (Zt = ($n) => rgb(_e($n, Qt)), Zt.dep = dependency(_e)) : Zt = constant$7(rgb(_e || "#888")), Zt;
}
function opacity_(_e, Qt) {
  let Zt;
  return isFunction$1(_e) ? (Zt = ($n) => _e($n, Qt), Zt.dep = dependency(_e)) : _e ? Zt = constant$7(_e) : (Zt = ($n) => $n.$value / $n.$max || 0, Zt.dep = !0), Zt;
}
function dependency(_e) {
  if (!isFunction$1(_e))
    return !1;
  const Qt = toSet(accessorFields(_e));
  return Qt.$x || Qt.$y || Qt.$value || Qt.$max;
}
function toCanvas(_e, Qt, Zt, $n) {
  const Sn = _e.width, kn = _e.height, Kn = _e.x1 || 0, er = _e.y1 || 0, Cr = _e.x2 || Sn, kr = _e.y2 || kn, Yr = _e.values, Ms = Yr ? (Fs) => Yr[Fs] : zero$5, Ds = domCanvas(Cr - Kn, kr - er), Ls = Ds.getContext("2d"), js = Ls.getImageData(0, 0, Cr - Kn, kr - er), zs = js.data;
  for (let Fs = er, Bs = 0; Fs < kr; ++Fs) {
    Qt.$y = Fs - er;
    for (let Hs = Kn, Ws = Fs * Sn; Hs < Cr; ++Hs, Bs += 4) {
      Qt.$x = Hs - Kn, Qt.$value = Ms(Hs + Ws);
      const Ys = Zt(Qt);
      zs[Bs + 0] = Ys.r, zs[Bs + 1] = Ys.g, zs[Bs + 2] = Ys.b, zs[Bs + 3] = ~~(255 * $n(Qt));
    }
  }
  return Ls.putImageData(js, 0, 0), Ds;
}
function Projection$1(_e) {
  Transform$1.call(this, null, _e), this.modified(!0);
}
inherits(Projection$1, Transform$1, {
  transform(_e, Qt) {
    let Zt = this.value;
    return !Zt || _e.modified("type") ? (this.value = Zt = create$2(_e.type), projectionProperties.forEach(($n) => {
      _e[$n] != null && set$3(Zt, $n, _e[$n]);
    })) : projectionProperties.forEach(($n) => {
      _e.modified($n) && set$3(Zt, $n, _e[$n]);
    }), _e.pointRadius != null && Zt.path.pointRadius(_e.pointRadius), _e.fit && fit(Zt, _e), Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS);
  }
});
function fit(_e, Qt) {
  const Zt = collectGeoJSON(Qt.fit);
  Qt.extent ? _e.fitExtent(Qt.extent, Zt) : Qt.size && _e.fitSize(Qt.size, Zt);
}
function create$2(_e) {
  const Qt = projection((_e || "mercator").toLowerCase());
  return Qt || error("Unrecognized projection type: " + _e), Qt();
}
function set$3(_e, Qt, Zt) {
  isFunction$1(_e[Qt]) && _e[Qt](Zt);
}
function collectGeoJSON(_e) {
  return _e = array$6(_e), _e.length === 1 ? _e[0] : {
    type: FeatureCollection,
    features: _e.reduce((Qt, Zt) => Qt.concat(featurize(Zt)), [])
  };
}
function featurize(_e) {
  return _e.type === FeatureCollection ? _e.features : array$6(_e).filter((Qt) => Qt != null).map((Qt) => Qt.type === Feature ? Qt : {
    type: Feature,
    geometry: Qt
  });
}
const geo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  contour: Contour,
  geojson: GeoJSON,
  geopath: GeoPath,
  geopoint: GeoPoint,
  geoshape: GeoShape,
  graticule: Graticule,
  heatmap: Heatmap,
  isocontour: Isocontour,
  kde2d: KDE2D,
  projection: Projection$1
}, Symbol.toStringTag, { value: "Module" }));
function forceCenter(_e, Qt) {
  var Zt, $n = 1;
  _e == null && (_e = 0), Qt == null && (Qt = 0);
  function Sn() {
    var kn, Kn = Zt.length, er, Cr = 0, kr = 0;
    for (kn = 0; kn < Kn; ++kn)
      er = Zt[kn], Cr += er.x, kr += er.y;
    for (Cr = (Cr / Kn - _e) * $n, kr = (kr / Kn - Qt) * $n, kn = 0; kn < Kn; ++kn)
      er = Zt[kn], er.x -= Cr, er.y -= kr;
  }
  return Sn.initialize = function(kn) {
    Zt = kn;
  }, Sn.x = function(kn) {
    return arguments.length ? (_e = +kn, Sn) : _e;
  }, Sn.y = function(kn) {
    return arguments.length ? (Qt = +kn, Sn) : Qt;
  }, Sn.strength = function(kn) {
    return arguments.length ? ($n = +kn, Sn) : $n;
  }, Sn;
}
function tree_add(_e) {
  const Qt = +this._x.call(null, _e), Zt = +this._y.call(null, _e);
  return add$2(this.cover(Qt, Zt), Qt, Zt, _e);
}
function add$2(_e, Qt, Zt, $n) {
  if (isNaN(Qt) || isNaN(Zt))
    return _e;
  var Sn, kn = _e._root, Kn = { data: $n }, er = _e._x0, Cr = _e._y0, kr = _e._x1, Yr = _e._y1, Ms, Ds, Ls, js, zs, Fs, Bs, Hs;
  if (!kn)
    return _e._root = Kn, _e;
  for (; kn.length; )
    if ((zs = Qt >= (Ms = (er + kr) / 2)) ? er = Ms : kr = Ms, (Fs = Zt >= (Ds = (Cr + Yr) / 2)) ? Cr = Ds : Yr = Ds, Sn = kn, !(kn = kn[Bs = Fs << 1 | zs]))
      return Sn[Bs] = Kn, _e;
  if (Ls = +_e._x.call(null, kn.data), js = +_e._y.call(null, kn.data), Qt === Ls && Zt === js)
    return Kn.next = kn, Sn ? Sn[Bs] = Kn : _e._root = Kn, _e;
  do
    Sn = Sn ? Sn[Bs] = new Array(4) : _e._root = new Array(4), (zs = Qt >= (Ms = (er + kr) / 2)) ? er = Ms : kr = Ms, (Fs = Zt >= (Ds = (Cr + Yr) / 2)) ? Cr = Ds : Yr = Ds;
  while ((Bs = Fs << 1 | zs) === (Hs = (js >= Ds) << 1 | Ls >= Ms));
  return Sn[Hs] = kn, Sn[Bs] = Kn, _e;
}
function addAll(_e) {
  var Qt, Zt, $n = _e.length, Sn, kn, Kn = new Array($n), er = new Array($n), Cr = 1 / 0, kr = 1 / 0, Yr = -1 / 0, Ms = -1 / 0;
  for (Zt = 0; Zt < $n; ++Zt)
    isNaN(Sn = +this._x.call(null, Qt = _e[Zt])) || isNaN(kn = +this._y.call(null, Qt)) || (Kn[Zt] = Sn, er[Zt] = kn, Sn < Cr && (Cr = Sn), Sn > Yr && (Yr = Sn), kn < kr && (kr = kn), kn > Ms && (Ms = kn));
  if (Cr > Yr || kr > Ms)
    return this;
  for (this.cover(Cr, kr).cover(Yr, Ms), Zt = 0; Zt < $n; ++Zt)
    add$2(this, Kn[Zt], er[Zt], _e[Zt]);
  return this;
}
function tree_cover(_e, Qt) {
  if (isNaN(_e = +_e) || isNaN(Qt = +Qt))
    return this;
  var Zt = this._x0, $n = this._y0, Sn = this._x1, kn = this._y1;
  if (isNaN(Zt))
    Sn = (Zt = Math.floor(_e)) + 1, kn = ($n = Math.floor(Qt)) + 1;
  else {
    for (var Kn = Sn - Zt || 1, er = this._root, Cr, kr; Zt > _e || _e >= Sn || $n > Qt || Qt >= kn; )
      switch (kr = (Qt < $n) << 1 | _e < Zt, Cr = new Array(4), Cr[kr] = er, er = Cr, Kn *= 2, kr) {
        case 0:
          Sn = Zt + Kn, kn = $n + Kn;
          break;
        case 1:
          Zt = Sn - Kn, kn = $n + Kn;
          break;
        case 2:
          Sn = Zt + Kn, $n = kn - Kn;
          break;
        case 3:
          Zt = Sn - Kn, $n = kn - Kn;
          break;
      }
    this._root && this._root.length && (this._root = er);
  }
  return this._x0 = Zt, this._y0 = $n, this._x1 = Sn, this._y1 = kn, this;
}
function tree_data() {
  var _e = [];
  return this.visit(function(Qt) {
    if (!Qt.length)
      do
        _e.push(Qt.data);
      while (Qt = Qt.next);
  }), _e;
}
function tree_extent(_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 Quad(_e, Qt, Zt, $n, Sn) {
  this.node = _e, this.x0 = Qt, this.y0 = Zt, this.x1 = $n, this.y1 = Sn;
}
function tree_find(_e, Qt, Zt) {
  var $n, Sn = this._x0, kn = this._y0, Kn, er, Cr, kr, Yr = this._x1, Ms = this._y1, Ds = [], Ls = this._root, js, zs;
  for (Ls && Ds.push(new Quad(Ls, Sn, kn, Yr, Ms)), Zt == null ? Zt = 1 / 0 : (Sn = _e - Zt, kn = Qt - Zt, Yr = _e + Zt, Ms = Qt + Zt, Zt *= Zt); js = Ds.pop(); )
    if (!(!(Ls = js.node) || (Kn = js.x0) > Yr || (er = js.y0) > Ms || (Cr = js.x1) < Sn || (kr = js.y1) < kn))
      if (Ls.length) {
        var Fs = (Kn + Cr) / 2, Bs = (er + kr) / 2;
        Ds.push(
          new Quad(Ls[3], Fs, Bs, Cr, kr),
          new Quad(Ls[2], Kn, Bs, Fs, kr),
          new Quad(Ls[1], Fs, er, Cr, Bs),
          new Quad(Ls[0], Kn, er, Fs, Bs)
        ), (zs = (Qt >= Bs) << 1 | _e >= Fs) && (js = Ds[Ds.length - 1], Ds[Ds.length - 1] = Ds[Ds.length - 1 - zs], Ds[Ds.length - 1 - zs] = js);
      } else {
        var Hs = _e - +this._x.call(null, Ls.data), Ws = Qt - +this._y.call(null, Ls.data), Ys = Hs * Hs + Ws * Ws;
        if (Ys < Zt) {
          var El = Math.sqrt(Zt = Ys);
          Sn = _e - El, kn = Qt - El, Yr = _e + El, Ms = Qt + El, $n = Ls.data;
        }
      }
  return $n;
}
function tree_remove(_e) {
  if (isNaN(Yr = +this._x.call(null, _e)) || isNaN(Ms = +this._y.call(null, _e)))
    return this;
  var Qt, Zt = this._root, $n, Sn, kn, Kn = this._x0, er = this._y0, Cr = this._x1, kr = this._y1, Yr, Ms, Ds, Ls, js, zs, Fs, Bs;
  if (!Zt)
    return this;
  if (Zt.length)
    for (; ; ) {
      if ((js = Yr >= (Ds = (Kn + Cr) / 2)) ? Kn = Ds : Cr = Ds, (zs = Ms >= (Ls = (er + kr) / 2)) ? er = Ls : kr = Ls, Qt = Zt, !(Zt = Zt[Fs = zs << 1 | js]))
        return this;
      if (!Zt.length)
        break;
      (Qt[Fs + 1 & 3] || Qt[Fs + 2 & 3] || Qt[Fs + 3 & 3]) && ($n = Qt, Bs = Fs);
    }
  for (; Zt.data !== _e; )
    if (Sn = Zt, !(Zt = Zt.next))
      return this;
  return (kn = Zt.next) && delete Zt.next, Sn ? (kn ? Sn.next = kn : delete Sn.next, this) : Qt ? (kn ? Qt[Fs] = kn : delete Qt[Fs], (Zt = Qt[0] || Qt[1] || Qt[2] || Qt[3]) && Zt === (Qt[3] || Qt[2] || Qt[1] || Qt[0]) && !Zt.length && ($n ? $n[Bs] = Zt : this._root = Zt), this) : (this._root = kn, this);
}
function removeAll(_e) {
  for (var Qt = 0, Zt = _e.length; Qt < Zt; ++Qt)
    this.remove(_e[Qt]);
  return this;
}
function tree_root() {
  return this._root;
}
function tree_size() {
  var _e = 0;
  return this.visit(function(Qt) {
    if (!Qt.length)
      do
        ++_e;
      while (Qt = Qt.next);
  }), _e;
}
function tree_visit(_e) {
  var Qt = [], Zt, $n = this._root, Sn, kn, Kn, er, Cr;
  for ($n && Qt.push(new Quad($n, this._x0, this._y0, this._x1, this._y1)); Zt = Qt.pop(); )
    if (!_e($n = Zt.node, kn = Zt.x0, Kn = Zt.y0, er = Zt.x1, Cr = Zt.y1) && $n.length) {
      var kr = (kn + er) / 2, Yr = (Kn + Cr) / 2;
      (Sn = $n[3]) && Qt.push(new Quad(Sn, kr, Yr, er, Cr)), (Sn = $n[2]) && Qt.push(new Quad(Sn, kn, Yr, kr, Cr)), (Sn = $n[1]) && Qt.push(new Quad(Sn, kr, Kn, er, Yr)), (Sn = $n[0]) && Qt.push(new Quad(Sn, kn, Kn, kr, Yr));
    }
  return this;
}
function tree_visitAfter(_e) {
  var Qt = [], Zt = [], $n;
  for (this._root && Qt.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); $n = Qt.pop(); ) {
    var Sn = $n.node;
    if (Sn.length) {
      var kn, Kn = $n.x0, er = $n.y0, Cr = $n.x1, kr = $n.y1, Yr = (Kn + Cr) / 2, Ms = (er + kr) / 2;
      (kn = Sn[0]) && Qt.push(new Quad(kn, Kn, er, Yr, Ms)), (kn = Sn[1]) && Qt.push(new Quad(kn, Yr, er, Cr, Ms)), (kn = Sn[2]) && Qt.push(new Quad(kn, Kn, Ms, Yr, kr)), (kn = Sn[3]) && Qt.push(new Quad(kn, Yr, Ms, Cr, kr));
    }
    Zt.push($n);
  }
  for (; $n = Zt.pop(); )
    _e($n.node, $n.x0, $n.y0, $n.x1, $n.y1);
  return this;
}
function defaultX(_e) {
  return _e[0];
}
function tree_x(_e) {
  return arguments.length ? (this._x = _e, this) : this._x;
}
function defaultY(_e) {
  return _e[1];
}
function tree_y(_e) {
  return arguments.length ? (this._y = _e, this) : this._y;
}
function quadtree(_e, Qt, Zt) {
  var $n = new Quadtree(Qt ?? defaultX, Zt ?? defaultY, NaN, NaN, NaN, NaN);
  return _e == null ? $n : $n.addAll(_e);
}
function Quadtree(_e, Qt, Zt, $n, Sn, kn) {
  this._x = _e, this._y = Qt, this._x0 = Zt, this._y0 = $n, this._x1 = Sn, this._y1 = kn, this._root = void 0;
}
function leaf_copy(_e) {
  for (var Qt = { data: _e.data }, Zt = Qt; _e = _e.next; )
    Zt = Zt.next = { data: _e.data };
  return Qt;
}
var treeProto = quadtree.prototype = Quadtree.prototype;
treeProto.copy = function() {
  var _e = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), Qt = this._root, Zt, $n;
  if (!Qt)
    return _e;
  if (!Qt.length)
    return _e._root = leaf_copy(Qt), _e;
  for (Zt = [{ source: Qt, target: _e._root = new Array(4) }]; Qt = Zt.pop(); )
    for (var Sn = 0; Sn < 4; ++Sn)
      ($n = Qt.source[Sn]) && ($n.length ? Zt.push({ source: $n, target: Qt.target[Sn] = new Array(4) }) : Qt.target[Sn] = leaf_copy($n));
  return _e;
};
treeProto.add = tree_add;
treeProto.addAll = addAll;
treeProto.cover = tree_cover;
treeProto.data = tree_data;
treeProto.extent = tree_extent;
treeProto.find = tree_find;
treeProto.remove = tree_remove;
treeProto.removeAll = removeAll;
treeProto.root = tree_root;
treeProto.size = tree_size;
treeProto.visit = tree_visit;
treeProto.visitAfter = tree_visitAfter;
treeProto.x = tree_x;
treeProto.y = tree_y;
function constant$3(_e) {
  return function() {
    return _e;
  };
}
function jiggle(_e) {
  return (_e() - 0.5) * 1e-6;
}
function x$1(_e) {
  return _e.x + _e.vx;
}
function y$1(_e) {
  return _e.y + _e.vy;
}
function forceCollide(_e) {
  var Qt, Zt, $n, Sn = 1, kn = 1;
  typeof _e != "function" && (_e = constant$3(_e == null ? 1 : +_e));
  function Kn() {
    for (var kr, Yr = Qt.length, Ms, Ds, Ls, js, zs, Fs, Bs = 0; Bs < kn; ++Bs)
      for (Ms = quadtree(Qt, x$1, y$1).visitAfter(er), kr = 0; kr < Yr; ++kr)
        Ds = Qt[kr], zs = Zt[Ds.index], Fs = zs * zs, Ls = Ds.x + Ds.vx, js = Ds.y + Ds.vy, Ms.visit(Hs);
    function Hs(Ws, Ys, El, Mu, Pl) {
      var Iu = Ws.data, Tu = Ws.r, Au = zs + Tu;
      if (Iu) {
        if (Iu.index > Ds.index) {
          var Nu = Ls - Iu.x - Iu.vx, gm = js - Iu.y - Iu.vy, pm = Nu * Nu + gm * gm;
          pm < Au * Au && (Nu === 0 && (Nu = jiggle($n), pm += Nu * Nu), gm === 0 && (gm = jiggle($n), pm += gm * gm), pm = (Au - (pm = Math.sqrt(pm))) / pm * Sn, Ds.vx += (Nu *= pm) * (Au = (Tu *= Tu) / (Fs + Tu)), Ds.vy += (gm *= pm) * Au, Iu.vx -= Nu * (Au = 1 - Au), Iu.vy -= gm * Au);
        }
        return;
      }
      return Ys > Ls + Au || Mu < Ls - Au || El > js + Au || Pl < js - Au;
    }
  }
  function er(kr) {
    if (kr.data)
      return kr.r = Zt[kr.data.index];
    for (var Yr = kr.r = 0; Yr < 4; ++Yr)
      kr[Yr] && kr[Yr].r > kr.r && (kr.r = kr[Yr].r);
  }
  function Cr() {
    if (Qt) {
      var kr, Yr = Qt.length, Ms;
      for (Zt = new Array(Yr), kr = 0; kr < Yr; ++kr)
        Ms = Qt[kr], Zt[Ms.index] = +_e(Ms, kr, Qt);
    }
  }
  return Kn.initialize = function(kr, Yr) {
    Qt = kr, $n = Yr, Cr();
  }, Kn.iterations = function(kr) {
    return arguments.length ? (kn = +kr, Kn) : kn;
  }, Kn.strength = function(kr) {
    return arguments.length ? (Sn = +kr, Kn) : Sn;
  }, Kn.radius = function(kr) {
    return arguments.length ? (_e = typeof kr == "function" ? kr : constant$3(+kr), Cr(), Kn) : _e;
  }, Kn;
}
function index$1(_e) {
  return _e.index;
}
function find$2(_e, Qt) {
  var Zt = _e.get(Qt);
  if (!Zt)
    throw new Error("node not found: " + Qt);
  return Zt;
}
function forceLink(_e) {
  var Qt = index$1, Zt = Ms, $n, Sn = constant$3(30), kn, Kn, er, Cr, kr, Yr = 1;
  _e == null && (_e = []);
  function Ms(Fs) {
    return 1 / Math.min(er[Fs.source.index], er[Fs.target.index]);
  }
  function Ds(Fs) {
    for (var Bs = 0, Hs = _e.length; Bs < Yr; ++Bs)
      for (var Ws = 0, Ys, El, Mu, Pl, Iu, Tu, Au; Ws < Hs; ++Ws)
        Ys = _e[Ws], El = Ys.source, Mu = Ys.target, Pl = Mu.x + Mu.vx - El.x - El.vx || jiggle(kr), Iu = Mu.y + Mu.vy - El.y - El.vy || jiggle(kr), Tu = Math.sqrt(Pl * Pl + Iu * Iu), Tu = (Tu - kn[Ws]) / Tu * Fs * $n[Ws], Pl *= Tu, Iu *= Tu, Mu.vx -= Pl * (Au = Cr[Ws]), Mu.vy -= Iu * Au, El.vx += Pl * (Au = 1 - Au), El.vy += Iu * Au;
  }
  function Ls() {
    if (Kn) {
      var Fs, Bs = Kn.length, Hs = _e.length, Ws = new Map(Kn.map((El, Mu) => [Qt(El, Mu, Kn), El])), Ys;
      for (Fs = 0, er = new Array(Bs); Fs < Hs; ++Fs)
        Ys = _e[Fs], Ys.index = Fs, typeof Ys.source != "object" && (Ys.source = find$2(Ws, Ys.source)), typeof Ys.target != "object" && (Ys.target = find$2(Ws, Ys.target)), er[Ys.source.index] = (er[Ys.source.index] || 0) + 1, er[Ys.target.index] = (er[Ys.target.index] || 0) + 1;
      for (Fs = 0, Cr = new Array(Hs); Fs < Hs; ++Fs)
        Ys = _e[Fs], Cr[Fs] = er[Ys.source.index] / (er[Ys.source.index] + er[Ys.target.index]);
      $n = new Array(Hs), js(), kn = new Array(Hs), zs();
    }
  }
  function js() {
    if (Kn)
      for (var Fs = 0, Bs = _e.length; Fs < Bs; ++Fs)
        $n[Fs] = +Zt(_e[Fs], Fs, _e);
  }
  function zs() {
    if (Kn)
      for (var Fs = 0, Bs = _e.length; Fs < Bs; ++Fs)
        kn[Fs] = +Sn(_e[Fs], Fs, _e);
  }
  return Ds.initialize = function(Fs, Bs) {
    Kn = Fs, kr = Bs, Ls();
  }, Ds.links = function(Fs) {
    return arguments.length ? (_e = Fs, Ls(), Ds) : _e;
  }, Ds.id = function(Fs) {
    return arguments.length ? (Qt = Fs, Ds) : Qt;
  }, Ds.iterations = function(Fs) {
    return arguments.length ? (Yr = +Fs, Ds) : Yr;
  }, Ds.strength = function(Fs) {
    return arguments.length ? (Zt = typeof Fs == "function" ? Fs : constant$3(+Fs), js(), Ds) : Zt;
  }, Ds.distance = function(Fs) {
    return arguments.length ? (Sn = typeof Fs == "function" ? Fs : constant$3(+Fs), zs(), Ds) : Sn;
  }, Ds;
}
var noop$3 = { value: () => {
} };
function dispatch() {
  for (var _e = 0, Qt = arguments.length, Zt = {}, $n; _e < Qt; ++_e) {
    if (!($n = arguments[_e] + "") || $n in Zt || /[\s.]/.test($n))
      throw new Error("illegal type: " + $n);
    Zt[$n] = [];
  }
  return new Dispatch(Zt);
}
function Dispatch(_e) {
  this._ = _e;
}
function parseTypenames$1(_e, Qt) {
  return _e.trim().split(/^|\s+/).map(function(Zt) {
    var $n = "", Sn = Zt.indexOf(".");
    if (Sn >= 0 && ($n = Zt.slice(Sn + 1), Zt = Zt.slice(0, Sn)), Zt && !Qt.hasOwnProperty(Zt))
      throw new Error("unknown type: " + Zt);
    return { type: Zt, name: $n };
  });
}
Dispatch.prototype = dispatch.prototype = {
  constructor: Dispatch,
  on: function(_e, Qt) {
    var Zt = this._, $n = parseTypenames$1(_e + "", Zt), Sn, kn = -1, Kn = $n.length;
    if (arguments.length < 2) {
      for (; ++kn < Kn; )
        if ((Sn = (_e = $n[kn]).type) && (Sn = get$2(Zt[Sn], _e.name)))
          return Sn;
      return;
    }
    if (Qt != null && typeof Qt != "function")
      throw new Error("invalid callback: " + Qt);
    for (; ++kn < Kn; )
      if (Sn = (_e = $n[kn]).type)
        Zt[Sn] = set$2(Zt[Sn], _e.name, Qt);
      else if (Qt == null)
        for (Sn in Zt)
          Zt[Sn] = set$2(Zt[Sn], _e.name, null);
    return this;
  },
  copy: function() {
    var _e = {}, Qt = this._;
    for (var Zt in Qt)
      _e[Zt] = Qt[Zt].slice();
    return new Dispatch(_e);
  },
  call: function(_e, Qt) {
    if ((Sn = arguments.length - 2) > 0)
      for (var Zt = new Array(Sn), $n = 0, Sn, kn; $n < Sn; ++$n)
        Zt[$n] = arguments[$n + 2];
    if (!this._.hasOwnProperty(_e))
      throw new Error("unknown type: " + _e);
    for (kn = this._[_e], $n = 0, Sn = kn.length; $n < Sn; ++$n)
      kn[$n].value.apply(Qt, Zt);
  },
  apply: function(_e, Qt, Zt) {
    if (!this._.hasOwnProperty(_e))
      throw new Error("unknown type: " + _e);
    for (var $n = this._[_e], Sn = 0, kn = $n.length; Sn < kn; ++Sn)
      $n[Sn].value.apply(Qt, Zt);
  }
};
function get$2(_e, Qt) {
  for (var Zt = 0, $n = _e.length, Sn; Zt < $n; ++Zt)
    if ((Sn = _e[Zt]).name === Qt)
      return Sn.value;
}
function set$2(_e, Qt, Zt) {
  for (var $n = 0, Sn = _e.length; $n < Sn; ++$n)
    if (_e[$n].name === Qt) {
      _e[$n] = noop$3, _e = _e.slice(0, $n).concat(_e.slice($n + 1));
      break;
    }
  return Zt != null && _e.push({ name: Qt, value: Zt }), _e;
}
var frame = 0, timeout$1 = 0, interval$2 = 0, pokeDelay = 1e3, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance == "object" && performance.now ? performance : Date, setFrame = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(_e) {
  setTimeout(_e, 17);
};
function now() {
  return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
}
function clearNow() {
  clockNow = 0;
}
function Timer$1() {
  this._call = this._time = this._next = null;
}
Timer$1.prototype = timer$1.prototype = {
  constructor: Timer$1,
  restart: function(_e, Qt, Zt) {
    if (typeof _e != "function")
      throw new TypeError("callback is not a function");
    Zt = (Zt == null ? now() : +Zt) + (Qt == null ? 0 : +Qt), !this._next && taskTail !== this && (taskTail ? taskTail._next = this : taskHead = this, taskTail = this), this._call = _e, this._time = Zt, sleep();
  },
  stop: function() {
    this._call && (this._call = null, this._time = 1 / 0, sleep());
  }
};
function timer$1(_e, Qt, Zt) {
  var $n = new Timer$1();
  return $n.restart(_e, Qt, Zt), $n;
}
function timerFlush() {
  now(), ++frame;
  for (var _e = taskHead, Qt; _e; )
    (Qt = clockNow - _e._time) >= 0 && _e._call.call(void 0, Qt), _e = _e._next;
  --frame;
}
function wake() {
  clockNow = (clockLast = clock.now()) + clockSkew, frame = timeout$1 = 0;
  try {
    timerFlush();
  } finally {
    frame = 0, nap(), clockNow = 0;
  }
}
function poke() {
  var _e = clock.now(), Qt = _e - clockLast;
  Qt > pokeDelay && (clockSkew -= Qt, clockLast = _e);
}
function nap() {
  for (var _e, Qt = taskHead, Zt, $n = 1 / 0; Qt; )
    Qt._call ? ($n > Qt._time && ($n = Qt._time), _e = Qt, Qt = Qt._next) : (Zt = Qt._next, Qt._next = null, Qt = _e ? _e._next = Zt : taskHead = Zt);
  taskTail = _e, sleep($n);
}
function sleep(_e) {
  if (!frame) {
    timeout$1 && (timeout$1 = clearTimeout(timeout$1));
    var Qt = _e - clockNow;
    Qt > 24 ? (_e < 1 / 0 && (timeout$1 = setTimeout(wake, _e - clock.now() - clockSkew)), interval$2 && (interval$2 = clearInterval(interval$2))) : (interval$2 || (clockLast = clock.now(), interval$2 = setInterval(poke, pokeDelay)), frame = 1, setFrame(wake));
  }
}
function timeout(_e, Qt, Zt) {
  var $n = new Timer$1();
  return Qt = Qt == null ? 0 : +Qt, $n.restart((Sn) => {
    $n.stop(), _e(Sn + Qt);
  }, Qt, Zt), $n;
}
function interval$1(_e, Qt, Zt) {
  var $n = new Timer$1(), Sn = Qt;
  return Qt == null ? ($n.restart(_e, Qt, Zt), $n) : ($n._restart = $n.restart, $n.restart = function(kn, Kn, er) {
    Kn = +Kn, er = er == null ? now() : +er, $n._restart(function Cr(kr) {
      kr += Sn, $n._restart(Cr, Sn += Kn, er), kn(kr);
    }, Kn, er);
  }, $n.restart(_e, Qt, Zt), $n);
}
const a$1 = 1664525, c$1 = 1013904223, m$2 = 4294967296;
function lcg$1() {
  let _e = 1;
  return () => (_e = (a$1 * _e + c$1) % m$2) / m$2;
}
function x(_e) {
  return _e.x;
}
function y(_e) {
  return _e.y;
}
var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5));
function forceSimulation(_e) {
  var Qt, Zt = 1, $n = 1e-3, Sn = 1 - Math.pow($n, 1 / 300), kn = 0, Kn = 0.6, er = /* @__PURE__ */ new Map(), Cr = timer$1(Ms), kr = dispatch("tick", "end"), Yr = lcg$1();
  _e == null && (_e = []);
  function Ms() {
    Ds(), kr.call("tick", Qt), Zt < $n && (Cr.stop(), kr.call("end", Qt));
  }
  function Ds(zs) {
    var Fs, Bs = _e.length, Hs;
    zs === void 0 && (zs = 1);
    for (var Ws = 0; Ws < zs; ++Ws)
      for (Zt += (kn - Zt) * Sn, er.forEach(function(Ys) {
        Ys(Zt);
      }), Fs = 0; Fs < Bs; ++Fs)
        Hs = _e[Fs], Hs.fx == null ? Hs.x += Hs.vx *= Kn : (Hs.x = Hs.fx, Hs.vx = 0), Hs.fy == null ? Hs.y += Hs.vy *= Kn : (Hs.y = Hs.fy, Hs.vy = 0);
    return Qt;
  }
  function Ls() {
    for (var zs = 0, Fs = _e.length, Bs; zs < Fs; ++zs) {
      if (Bs = _e[zs], Bs.index = zs, Bs.fx != null && (Bs.x = Bs.fx), Bs.fy != null && (Bs.y = Bs.fy), isNaN(Bs.x) || isNaN(Bs.y)) {
        var Hs = initialRadius * Math.sqrt(0.5 + zs), Ws = zs * initialAngle;
        Bs.x = Hs * Math.cos(Ws), Bs.y = Hs * Math.sin(Ws);
      }
      (isNaN(Bs.vx) || isNaN(Bs.vy)) && (Bs.vx = Bs.vy = 0);
    }
  }
  function js(zs) {
    return zs.initialize && zs.initialize(_e, Yr), zs;
  }
  return Ls(), Qt = {
    tick: Ds,
    restart: function() {
      return Cr.restart(Ms), Qt;
    },
    stop: function() {
      return Cr.stop(), Qt;
    },
    nodes: function(zs) {
      return arguments.length ? (_e = zs, Ls(), er.forEach(js), Qt) : _e;
    },
    alpha: function(zs) {
      return arguments.length ? (Zt = +zs, Qt) : Zt;
    },
    alphaMin: function(zs) {
      return arguments.length ? ($n = +zs, Qt) : $n;
    },
    alphaDecay: function(zs) {
      return arguments.length ? (Sn = +zs, Qt) : +Sn;
    },
    alphaTarget: function(zs) {
      return arguments.length ? (kn = +zs, Qt) : kn;
    },
    velocityDecay: function(zs) {
      return arguments.length ? (Kn = 1 - zs, Qt) : 1 - Kn;
    },
    randomSource: function(zs) {
      return arguments.length ? (Yr = zs, er.forEach(js), Qt) : Yr;
    },
    force: function(zs, Fs) {
      return arguments.length > 1 ? (Fs == null ? er.delete(zs) : er.set(zs, js(Fs)), Qt) : er.get(zs);
    },
    find: function(zs, Fs, Bs) {
      var Hs = 0, Ws = _e.length, Ys, El, Mu, Pl, Iu;
      for (Bs == null ? Bs = 1 / 0 : Bs *= Bs, Hs = 0; Hs < Ws; ++Hs)
        Pl = _e[Hs], Ys = zs - Pl.x, El = Fs - Pl.y, Mu = Ys * Ys + El * El, Mu < Bs && (Iu = Pl, Bs = Mu);
      return Iu;
    },
    on: function(zs, Fs) {
      return arguments.length > 1 ? (kr.on(zs, Fs), Qt) : kr.on(zs);
    }
  };
}
function forceManyBody() {
  var _e, Qt, Zt, $n, Sn = constant$3(-30), kn, Kn = 1, er = 1 / 0, Cr = 0.81;
  function kr(Ls) {
    var js, zs = _e.length, Fs = quadtree(_e, x, y).visitAfter(Ms);
    for ($n = Ls, js = 0; js < zs; ++js)
      Qt = _e[js], Fs.visit(Ds);
  }
  function Yr() {
    if (_e) {
      var Ls, js = _e.length, zs;
      for (kn = new Array(js), Ls = 0; Ls < js; ++Ls)
        zs = _e[Ls], kn[zs.index] = +Sn(zs, Ls, _e);
    }
  }
  function Ms(Ls) {
    var js = 0, zs, Fs, Bs = 0, Hs, Ws, Ys;
    if (Ls.length) {
      for (Hs = Ws = Ys = 0; Ys < 4; ++Ys)
        (zs = Ls[Ys]) && (Fs = Math.abs(zs.value)) && (js += zs.value, Bs += Fs, Hs += Fs * zs.x, Ws += Fs * zs.y);
      Ls.x = Hs / Bs, Ls.y = Ws / Bs;
    } else {
      zs = Ls, zs.x = zs.data.x, zs.y = zs.data.y;
      do
        js += kn[zs.data.index];
      while (zs = zs.next);
    }
    Ls.value = js;
  }
  function Ds(Ls, js, zs, Fs) {
    if (!Ls.value)
      return !0;
    var Bs = Ls.x - Qt.x, Hs = Ls.y - Qt.y, Ws = Fs - js, Ys = Bs * Bs + Hs * Hs;
    if (Ws * Ws / Cr < Ys)
      return Ys < er && (Bs === 0 && (Bs = jiggle(Zt), Ys += Bs * Bs), Hs === 0 && (Hs = jiggle(Zt), Ys += Hs * Hs), Ys < Kn && (Ys = Math.sqrt(Kn * Ys)), Qt.vx += Bs * Ls.value * $n / Ys, Qt.vy += Hs * Ls.value * $n / Ys), !0;
    if (Ls.length || Ys >= er)
      return;
    (Ls.data !== Qt || Ls.next) && (Bs === 0 && (Bs = jiggle(Zt), Ys += Bs * Bs), Hs === 0 && (Hs = jiggle(Zt), Ys += Hs * Hs), Ys < Kn && (Ys = Math.sqrt(Kn * Ys)));
    do
      Ls.data !== Qt && (Ws = kn[Ls.data.index] * $n / Ys, Qt.vx += Bs * Ws, Qt.vy += Hs * Ws);
    while (Ls = Ls.next);
  }
  return kr.initialize = function(Ls, js) {
    _e = Ls, Zt = js, Yr();
  }, kr.strength = function(Ls) {
    return arguments.length ? (Sn = typeof Ls == "function" ? Ls : constant$3(+Ls), Yr(), kr) : Sn;
  }, kr.distanceMin = function(Ls) {
    return arguments.length ? (Kn = Ls * Ls, kr) : Math.sqrt(Kn);
  }, kr.distanceMax = function(Ls) {
    return arguments.length ? (er = Ls * Ls, kr) : Math.sqrt(er);
  }, kr.theta = function(Ls) {
    return arguments.length ? (Cr = Ls * Ls, kr) : Math.sqrt(Cr);
  }, kr;
}
function forceX(_e) {
  var Qt = constant$3(0.1), Zt, $n, Sn;
  typeof _e != "function" && (_e = constant$3(_e == null ? 0 : +_e));
  function kn(er) {
    for (var Cr = 0, kr = Zt.length, Yr; Cr < kr; ++Cr)
      Yr = Zt[Cr], Yr.vx += (Sn[Cr] - Yr.x) * $n[Cr] * er;
  }
  function Kn() {
    if (Zt) {
      var er, Cr = Zt.length;
      for ($n = new Array(Cr), Sn = new Array(Cr), er = 0; er < Cr; ++er)
        $n[er] = isNaN(Sn[er] = +_e(Zt[er], er, Zt)) ? 0 : +Qt(Zt[er], er, Zt);
    }
  }
  return kn.initialize = function(er) {
    Zt = er, Kn();
  }, kn.strength = function(er) {
    return arguments.length ? (Qt = typeof er == "function" ? er : constant$3(+er), Kn(), kn) : Qt;
  }, kn.x = function(er) {
    return arguments.length ? (_e = typeof er == "function" ? er : constant$3(+er), Kn(), kn) : _e;
  }, kn;
}
function forceY(_e) {
  var Qt = constant$3(0.1), Zt, $n, Sn;
  typeof _e != "function" && (_e = constant$3(_e == null ? 0 : +_e));
  function kn(er) {
    for (var Cr = 0, kr = Zt.length, Yr; Cr < kr; ++Cr)
      Yr = Zt[Cr], Yr.vy += (Sn[Cr] - Yr.y) * $n[Cr] * er;
  }
  function Kn() {
    if (Zt) {
      var er, Cr = Zt.length;
      for ($n = new Array(Cr), Sn = new Array(Cr), er = 0; er < Cr; ++er)
        $n[er] = isNaN(Sn[er] = +_e(Zt[er], er, Zt)) ? 0 : +Qt(Zt[er], er, Zt);
    }
  }
  return kn.initialize = function(er) {
    Zt = er, Kn();
  }, kn.strength = function(er) {
    return arguments.length ? (Qt = typeof er == "function" ? er : constant$3(+er), Kn(), kn) : Qt;
  }, kn.y = function(er) {
    return arguments.length ? (_e = typeof er == "function" ? er : constant$3(+er), Kn(), kn) : _e;
  }, kn;
}
const ForceMap = {
  center: forceCenter,
  collide: forceCollide,
  nbody: forceManyBody,
  link: forceLink,
  x: forceX,
  y: forceY
}, Forces = "forces", ForceParams = ["alpha", "alphaMin", "alphaTarget", "velocityDecay", "forces"], ForceConfig = ["static", "iterations"], ForceOutput = ["x", "y", "vx", "vy"];
function Force(_e) {
  Transform$1.call(this, null, _e);
}
Force.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,
        expr: !0
      }, {
        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: ForceOutput
  }]
};
inherits(Force, Transform$1, {
  transform(_e, Qt) {
    var Zt = this.value, $n = Qt.changed(Qt.ADD_REM), Sn = _e.modified(ForceParams), kn = _e.iterations || 300;
    if (Zt ? ($n && (Qt.modifies("index"), Zt.nodes(Qt.source)), (Sn || Qt.changed(Qt.MOD)) && setup(Zt, _e, 0, Qt)) : (this.value = Zt = simulation(Qt.source, _e), Zt.on("tick", rerun(Qt.dataflow, this)), _e.static || ($n = !0, Zt.tick()), Qt.modifies("index")), Sn || $n || _e.modified(ForceConfig) || Qt.changed() && _e.restart) {
      if (Zt.alpha(Math.max(Zt.alpha(), _e.alpha || 1)).alphaDecay(1 - Math.pow(Zt.alphaMin(), 1 / kn)), _e.static)
        for (Zt.stop(); --kn >= 0; )
          Zt.tick();
      else if (Zt.stopped() && Zt.restart(), !$n)
        return Qt.StopPropagation;
    }
    return this.finish(_e, Qt);
  },
  finish(_e, Qt) {
    const Zt = Qt.dataflow;
    for (let er = this._argops, Cr = 0, kr = er.length, Yr; Cr < kr; ++Cr)
      if (Yr = er[Cr], !(Yr.name !== Forces || Yr.op._argval.force !== "link")) {
        for (var $n = Yr.op._argops, Sn = 0, kn = $n.length, Kn; Sn < kn; ++Sn)
          if ($n[Sn].name === "links" && (Kn = $n[Sn].op.source)) {
            Zt.pulse(Kn, Zt.changeset().reflow());
            break;
          }
      }
    return Qt.reflow(_e.modified()).modifies(ForceOutput);
  }
});
function rerun(_e, Qt) {
  return () => _e.touch(Qt).run();
}
function simulation(_e, Qt) {
  const Zt = forceSimulation(_e), $n = Zt.stop, Sn = Zt.restart;
  let kn = !1;
  return Zt.stopped = () => kn, Zt.restart = () => (kn = !1, Sn()), Zt.stop = () => (kn = !0, $n()), setup(Zt, Qt, !0).on("end", () => kn = !0);
}
function setup(_e, Qt, Zt, $n) {
  var Sn = array$6(Qt.forces), kn, Kn, er, Cr;
  for (kn = 0, Kn = ForceParams.length; kn < Kn; ++kn)
    er = ForceParams[kn], er !== Forces && Qt.modified(er) && _e[er](Qt[er]);
  for (kn = 0, Kn = Sn.length; kn < Kn; ++kn)
    Cr = Forces + kn, er = Zt || Qt.modified(Forces, kn) ? getForce(Sn[kn]) : $n && modified(Sn[kn], $n) ? _e.force(Cr) : null, er && _e.force(Cr, er);
  for (Kn = _e.numForces || 0; kn < Kn; ++kn)
    _e.force(Forces + kn, null);
  return _e.numForces = Sn.length, _e;
}
function modified(_e, Qt) {
  var Zt, $n;
  for (Zt in _e)
    if (isFunction$1($n = _e[Zt]) && Qt.modified(accessorFields($n)))
      return 1;
  return 0;
}
function getForce(_e) {
  var Qt, Zt;
  has$1(ForceMap, _e.force) || error("Unrecognized force: " + _e.force), Qt = ForceMap[_e.force]();
  for (Zt in _e)
    isFunction$1(Qt[Zt]) && setForceParam(Qt[Zt], _e[Zt], _e);
  return Qt;
}
function setForceParam(_e, Qt, Zt) {
  _e(isFunction$1(Qt) ? ($n) => Qt($n, Zt) : Qt);
}
const force = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  force: Force
}, Symbol.toStringTag, { value: "Module" }));
function defaultSeparation$2(_e, Qt) {
  return _e.parent === Qt.parent ? 1 : 2;
}
function meanX(_e) {
  return _e.reduce(meanXReduce, 0) / _e.length;
}
function meanXReduce(_e, Qt) {
  return _e + Qt.x;
}
function maxY(_e) {
  return 1 + _e.reduce(maxYReduce, 0);
}
function maxYReduce(_e, Qt) {
  return Math.max(_e, Qt.y);
}
function leafLeft(_e) {
  for (var Qt; Qt = _e.children; )
    _e = Qt[0];
  return _e;
}
function leafRight(_e) {
  for (var Qt; Qt = _e.children; )
    _e = Qt[Qt.length - 1];
  return _e;
}
function cluster() {
  var _e = defaultSeparation$2, Qt = 1, Zt = 1, $n = !1;
  function Sn(kn) {
    var Kn, er = 0;
    kn.eachAfter(function(Ds) {
      var Ls = Ds.children;
      Ls ? (Ds.x = meanX(Ls), Ds.y = maxY(Ls)) : (Ds.x = Kn ? er += _e(Ds, Kn) : 0, Ds.y = 0, Kn = Ds);
    });
    var Cr = leafLeft(kn), kr = leafRight(kn), Yr = Cr.x - _e(Cr, kr) / 2, Ms = kr.x + _e(kr, Cr) / 2;
    return kn.eachAfter($n ? function(Ds) {
      Ds.x = (Ds.x - kn.x) * Qt, Ds.y = (kn.y - Ds.y) * Zt;
    } : function(Ds) {
      Ds.x = (Ds.x - Yr) / (Ms - Yr) * Qt, Ds.y = (1 - (kn.y ? Ds.y / kn.y : 1)) * Zt;
    });
  }
  return Sn.separation = function(kn) {
    return arguments.length ? (_e = kn, Sn) : _e;
  }, Sn.size = function(kn) {
    return arguments.length ? ($n = !1, Qt = +kn[0], Zt = +kn[1], Sn) : $n ? null : [Qt, Zt];
  }, Sn.nodeSize = function(kn) {
    return arguments.length ? ($n = !0, Qt = +kn[0], Zt = +kn[1], Sn) : $n ? [Qt, Zt] : null;
  }, Sn;
}
function count$2(_e) {
  var Qt = 0, Zt = _e.children, $n = Zt && Zt.length;
  if (!$n)
    Qt = 1;
  else
    for (; --$n >= 0; )
      Qt += Zt[$n].value;
  _e.value = Qt;
}
function node_count() {
  return this.eachAfter(count$2);
}
function node_each(_e, Qt) {
  let Zt = -1;
  for (const $n of this)
    _e.call(Qt, $n, ++Zt, this);
  return this;
}
function node_eachBefore(_e, Qt) {
  for (var Zt = this, $n = [Zt], Sn, kn, Kn = -1; Zt = $n.pop(); )
    if (_e.call(Qt, Zt, ++Kn, this), Sn = Zt.children)
      for (kn = Sn.length - 1; kn >= 0; --kn)
        $n.push(Sn[kn]);
  return this;
}
function node_eachAfter(_e, Qt) {
  for (var Zt = this, $n = [Zt], Sn = [], kn, Kn, er, Cr = -1; Zt = $n.pop(); )
    if (Sn.push(Zt), kn = Zt.children)
      for (Kn = 0, er = kn.length; Kn < er; ++Kn)
        $n.push(kn[Kn]);
  for (; Zt = Sn.pop(); )
    _e.call(Qt, Zt, ++Cr, this);
  return this;
}
function node_find(_e, Qt) {
  let Zt = -1;
  for (const $n of this)
    if (_e.call(Qt, $n, ++Zt, this))
      return $n;
}
function node_sum(_e) {
  return this.eachAfter(function(Qt) {
    for (var Zt = +_e(Qt.data) || 0, $n = Qt.children, Sn = $n && $n.length; --Sn >= 0; )
      Zt += $n[Sn].value;
    Qt.value = Zt;
  });
}
function node_sort(_e) {
  return this.eachBefore(function(Qt) {
    Qt.children && Qt.children.sort(_e);
  });
}
function node_path(_e) {
  for (var Qt = this, Zt = leastCommonAncestor(Qt, _e), $n = [Qt]; Qt !== Zt; )
    Qt = Qt.parent, $n.push(Qt);
  for (var Sn = $n.length; _e !== Zt; )
    $n.splice(Sn, 0, _e), _e = _e.parent;
  return $n;
}
function leastCommonAncestor(_e, Qt) {
  if (_e === Qt)
    return _e;
  var Zt = _e.ancestors(), $n = Qt.ancestors(), Sn = null;
  for (_e = Zt.pop(), Qt = $n.pop(); _e === Qt; )
    Sn = _e, _e = Zt.pop(), Qt = $n.pop();
  return Sn;
}
function node_ancestors() {
  for (var _e = this, Qt = [_e]; _e = _e.parent; )
    Qt.push(_e);
  return Qt;
}
function node_descendants() {
  return Array.from(this);
}
function node_leaves() {
  var _e = [];
  return this.eachBefore(function(Qt) {
    Qt.children || _e.push(Qt);
  }), _e;
}
function node_links() {
  var _e = this, Qt = [];
  return _e.each(function(Zt) {
    Zt !== _e && Qt.push({ source: Zt.parent, target: Zt });
  }), Qt;
}
function* node_iterator() {
  var _e = this, Qt, Zt = [_e], $n, Sn, kn;
  do
    for (Qt = Zt.reverse(), Zt = []; _e = Qt.pop(); )
      if (yield _e, $n = _e.children)
        for (Sn = 0, kn = $n.length; Sn < kn; ++Sn)
          Zt.push($n[Sn]);
  while (Zt.length);
}
function hierarchy(_e, Qt) {
  _e instanceof Map ? (_e = [void 0, _e], Qt === void 0 && (Qt = mapChildren)) : Qt === void 0 && (Qt = objectChildren);
  for (var Zt = new Node$3(_e), $n, Sn = [Zt], kn, Kn, er, Cr; $n = Sn.pop(); )
    if ((Kn = Qt($n.data)) && (Cr = (Kn = Array.from(Kn)).length))
      for ($n.children = Kn, er = Cr - 1; er >= 0; --er)
        Sn.push(kn = Kn[er] = new Node$3(Kn[er])), kn.parent = $n, kn.depth = $n.depth + 1;
  return Zt.eachBefore(computeHeight);
}
function node_copy() {
  return hierarchy(this).eachBefore(copyData);
}
function objectChildren(_e) {
  return _e.children;
}
function mapChildren(_e) {
  return Array.isArray(_e) ? _e[1] : null;
}
function copyData(_e) {
  _e.data.value !== void 0 && (_e.value = _e.data.value), _e.data = _e.data.data;
}
function computeHeight(_e) {
  var Qt = 0;
  do
    _e.height = Qt;
  while ((_e = _e.parent) && _e.height < ++Qt);
}
function Node$3(_e) {
  this.data = _e, this.depth = this.height = 0, this.parent = null;
}
Node$3.prototype = hierarchy.prototype = {
  constructor: Node$3,
  count: node_count,
  each: node_each,
  eachAfter: node_eachAfter,
  eachBefore: node_eachBefore,
  find: node_find,
  sum: node_sum,
  sort: node_sort,
  path: node_path,
  ancestors: node_ancestors,
  descendants: node_descendants,
  leaves: node_leaves,
  links: node_links,
  copy: node_copy,
  [Symbol.iterator]: node_iterator
};
function optional(_e) {
  return _e == null ? null : required(_e);
}
function required(_e) {
  if (typeof _e != "function")
    throw new Error();
  return _e;
}
function constantZero() {
  return 0;
}
function constant$2(_e) {
  return function() {
    return _e;
  };
}
const a = 1664525, c = 1013904223, m$1 = 4294967296;
function lcg() {
  let _e = 1;
  return () => (_e = (a * _e + c) % m$1) / m$1;
}
function array$3(_e) {
  return typeof _e == "object" && "length" in _e ? _e : Array.from(_e);
}
function shuffle(_e, Qt) {
  let Zt = _e.length, $n, Sn;
  for (; Zt; )
    Sn = Qt() * Zt-- | 0, $n = _e[Zt], _e[Zt] = _e[Sn], _e[Sn] = $n;
  return _e;
}
function packEncloseRandom(_e, Qt) {
  for (var Zt = 0, $n = (_e = shuffle(Array.from(_e), Qt)).length, Sn = [], kn, Kn; Zt < $n; )
    kn = _e[Zt], Kn && enclosesWeak(Kn, kn) ? ++Zt : (Kn = encloseBasis(Sn = extendBasis(Sn, kn)), Zt = 0);
  return Kn;
}
function extendBasis(_e, Qt) {
  var Zt, $n;
  if (enclosesWeakAll(Qt, _e))
    return [Qt];
  for (Zt = 0; Zt < _e.length; ++Zt)
    if (enclosesNot(Qt, _e[Zt]) && enclosesWeakAll(encloseBasis2(_e[Zt], Qt), _e))
      return [_e[Zt], Qt];
  for (Zt = 0; Zt < _e.length - 1; ++Zt)
    for ($n = Zt + 1; $n < _e.length; ++$n)
      if (enclosesNot(encloseBasis2(_e[Zt], _e[$n]), Qt) && enclosesNot(encloseBasis2(_e[Zt], Qt), _e[$n]) && enclosesNot(encloseBasis2(_e[$n], Qt), _e[Zt]) && enclosesWeakAll(encloseBasis3(_e[Zt], _e[$n], Qt), _e))
        return [_e[Zt], _e[$n], Qt];
  throw new Error();
}
function enclosesNot(_e, Qt) {
  var Zt = _e.r - Qt.r, $n = Qt.x - _e.x, Sn = Qt.y - _e.y;
  return Zt < 0 || Zt * Zt < $n * $n + Sn * Sn;
}
function enclosesWeak(_e, Qt) {
  var Zt = _e.r - Qt.r + Math.max(_e.r, Qt.r, 1) * 1e-9, $n = Qt.x - _e.x, Sn = Qt.y - _e.y;
  return Zt > 0 && Zt * Zt > $n * $n + Sn * Sn;
}
function enclosesWeakAll(_e, Qt) {
  for (var Zt = 0; Zt < Qt.length; ++Zt)
    if (!enclosesWeak(_e, Qt[Zt]))
      return !1;
  return !0;
}
function encloseBasis(_e) {
  switch (_e.length) {
    case 1:
      return encloseBasis1(_e[0]);
    case 2:
      return encloseBasis2(_e[0], _e[1]);
    case 3:
      return encloseBasis3(_e[0], _e[1], _e[2]);
  }
}
function encloseBasis1(_e) {
  return {
    x: _e.x,
    y: _e.y,
    r: _e.r
  };
}
function encloseBasis2(_e, Qt) {
  var Zt = _e.x, $n = _e.y, Sn = _e.r, kn = Qt.x, Kn = Qt.y, er = Qt.r, Cr = kn - Zt, kr = Kn - $n, Yr = er - Sn, Ms = Math.sqrt(Cr * Cr + kr * kr);
  return {
    x: (Zt + kn + Cr / Ms * Yr) / 2,
    y: ($n + Kn + kr / Ms * Yr) / 2,
    r: (Ms + Sn + er) / 2
  };
}
function encloseBasis3(_e, Qt, Zt) {
  var $n = _e.x, Sn = _e.y, kn = _e.r, Kn = Qt.x, er = Qt.y, Cr = Qt.r, kr = Zt.x, Yr = Zt.y, Ms = Zt.r, Ds = $n - Kn, Ls = $n - kr, js = Sn - er, zs = Sn - Yr, Fs = Cr - kn, Bs = Ms - kn, Hs = $n * $n + Sn * Sn - kn * kn, Ws = Hs - Kn * Kn - er * er + Cr * Cr, Ys = Hs - kr * kr - Yr * Yr + Ms * Ms, El = Ls * js - Ds * zs, Mu = (js * Ys - zs * Ws) / (El * 2) - $n, Pl = (zs * Fs - js * Bs) / El, Iu = (Ls * Ws - Ds * Ys) / (El * 2) - Sn, Tu = (Ds * Bs - Ls * Fs) / El, Au = Pl * Pl + Tu * Tu - 1, Nu = 2 * (kn + Mu * Pl + Iu * Tu), gm = Mu * Mu + Iu * Iu - kn * kn, pm = -(Math.abs(Au) > 1e-6 ? (Nu + Math.sqrt(Nu * Nu - 4 * Au * gm)) / (2 * Au) : gm / Nu);
  return {
    x: $n + Mu + Pl * pm,
    y: Sn + Iu + Tu * pm,
    r: pm
  };
}
function place(_e, Qt, Zt) {
  var $n = _e.x - Qt.x, Sn, kn, Kn = _e.y - Qt.y, er, Cr, kr = $n * $n + Kn * Kn;
  kr ? (kn = Qt.r + Zt.r, kn *= kn, Cr = _e.r + Zt.r, Cr *= Cr, kn > Cr ? (Sn = (kr + Cr - kn) / (2 * kr), er = Math.sqrt(Math.max(0, Cr / kr - Sn * Sn)), Zt.x = _e.x - Sn * $n - er * Kn, Zt.y = _e.y - Sn * Kn + er * $n) : (Sn = (kr + kn - Cr) / (2 * kr), er = Math.sqrt(Math.max(0, kn / kr - Sn * Sn)), Zt.x = Qt.x + Sn * $n - er * Kn, Zt.y = Qt.y + Sn * Kn + er * $n)) : (Zt.x = Qt.x + Zt.r, Zt.y = Qt.y);
}
function intersects(_e, Qt) {
  var Zt = _e.r + Qt.r - 1e-6, $n = Qt.x - _e.x, Sn = Qt.y - _e.y;
  return Zt > 0 && Zt * Zt > $n * $n + Sn * Sn;
}
function score(_e) {
  var Qt = _e._, Zt = _e.next._, $n = Qt.r + Zt.r, Sn = (Qt.x * Zt.r + Zt.x * Qt.r) / $n, kn = (Qt.y * Zt.r + Zt.y * Qt.r) / $n;
  return Sn * Sn + kn * kn;
}
function Node$2(_e) {
  this._ = _e, this.next = null, this.previous = null;
}
function packSiblingsRandom(_e, Qt) {
  if (!(kn = (_e = array$3(_e)).length))
    return 0;
  var Zt, $n, Sn, kn, Kn, er, Cr, kr, Yr, Ms, Ds;
  if (Zt = _e[0], Zt.x = 0, Zt.y = 0, !(kn > 1))
    return Zt.r;
  if ($n = _e[1], Zt.x = -$n.r, $n.x = Zt.r, $n.y = 0, !(kn > 2))
    return Zt.r + $n.r;
  place($n, Zt, Sn = _e[2]), Zt = new Node$2(Zt), $n = new Node$2($n), Sn = new Node$2(Sn), Zt.next = Sn.previous = $n, $n.next = Zt.previous = Sn, Sn.next = $n.previous = Zt;
  e:
    for (Cr = 3; Cr < kn; ++Cr) {
      place(Zt._, $n._, Sn = _e[Cr]), Sn = new Node$2(Sn), kr = $n.next, Yr = Zt.previous, Ms = $n._.r, Ds = Zt._.r;
      do
        if (Ms <= Ds) {
          if (intersects(kr._, Sn._)) {
            $n = kr, Zt.next = $n, $n.previous = Zt, --Cr;
            continue e;
          }
          Ms += kr._.r, kr = kr.next;
        } else {
          if (intersects(Yr._, Sn._)) {
            Zt = Yr, Zt.next = $n, $n.previous = Zt, --Cr;
            continue e;
          }
          Ds += Yr._.r, Yr = Yr.previous;
        }
      while (kr !== Yr.next);
      for (Sn.previous = Zt, Sn.next = $n, Zt.next = $n.previous = $n = Sn, Kn = score(Zt); (Sn = Sn.next) !== $n; )
        (er = score(Sn)) < Kn && (Zt = Sn, Kn = er);
      $n = Zt.next;
    }
  for (Zt = [$n._], Sn = $n; (Sn = Sn.next) !== $n; )
    Zt.push(Sn._);
  for (Sn = packEncloseRandom(Zt, Qt), Cr = 0; Cr < kn; ++Cr)
    Zt = _e[Cr], Zt.x -= Sn.x, Zt.y -= Sn.y;
  return Sn.r;
}
function defaultRadius(_e) {
  return Math.sqrt(_e.value);
}
function pack() {
  var _e = null, Qt = 1, Zt = 1, $n = constantZero;
  function Sn(kn) {
    const Kn = lcg();
    return kn.x = Qt / 2, kn.y = Zt / 2, _e ? kn.eachBefore(radiusLeaf(_e)).eachAfter(packChildrenRandom($n, 0.5, Kn)).eachBefore(translateChild(1)) : kn.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildrenRandom(constantZero, 1, Kn)).eachAfter(packChildrenRandom($n, kn.r / Math.min(Qt, Zt), Kn)).eachBefore(translateChild(Math.min(Qt, Zt) / (2 * kn.r))), kn;
  }
  return Sn.radius = function(kn) {
    return arguments.length ? (_e = optional(kn), Sn) : _e;
  }, Sn.size = function(kn) {
    return arguments.length ? (Qt = +kn[0], Zt = +kn[1], Sn) : [Qt, Zt];
  }, Sn.padding = function(kn) {
    return arguments.length ? ($n = typeof kn == "function" ? kn : constant$2(+kn), Sn) : $n;
  }, Sn;
}
function radiusLeaf(_e) {
  return function(Qt) {
    Qt.children || (Qt.r = Math.max(0, +_e(Qt) || 0));
  };
}
function packChildrenRandom(_e, Qt, Zt) {
  return function($n) {
    if (Sn = $n.children) {
      var Sn, kn, Kn = Sn.length, er = _e($n) * Qt || 0, Cr;
      if (er)
        for (kn = 0; kn < Kn; ++kn)
          Sn[kn].r += er;
      if (Cr = packSiblingsRandom(Sn, Zt), er)
        for (kn = 0; kn < Kn; ++kn)
          Sn[kn].r -= er;
      $n.r = Cr + er;
    }
  };
}
function translateChild(_e) {
  return function(Qt) {
    var Zt = Qt.parent;
    Qt.r *= _e, Zt && (Qt.x = Zt.x + _e * Qt.x, Qt.y = Zt.y + _e * Qt.y);
  };
}
function roundNode(_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 treemapDice(_e, Qt, Zt, $n, Sn) {
  for (var kn = _e.children, Kn, er = -1, Cr = kn.length, kr = _e.value && ($n - Qt) / _e.value; ++er < Cr; )
    Kn = kn[er], Kn.y0 = Zt, Kn.y1 = Sn, Kn.x0 = Qt, Kn.x1 = Qt += Kn.value * kr;
}
function partition$1() {
  var _e = 1, Qt = 1, Zt = 0, $n = !1;
  function Sn(Kn) {
    var er = Kn.height + 1;
    return Kn.x0 = Kn.y0 = Zt, Kn.x1 = _e, Kn.y1 = Qt / er, Kn.eachBefore(kn(Qt, er)), $n && Kn.eachBefore(roundNode), Kn;
  }
  function kn(Kn, er) {
    return function(Cr) {
      Cr.children && treemapDice(Cr, Cr.x0, Kn * (Cr.depth + 1) / er, Cr.x1, Kn * (Cr.depth + 2) / er);
      var kr = Cr.x0, Yr = Cr.y0, Ms = Cr.x1 - Zt, Ds = Cr.y1 - Zt;
      Ms < kr && (kr = Ms = (kr + Ms) / 2), Ds < Yr && (Yr = Ds = (Yr + Ds) / 2), Cr.x0 = kr, Cr.y0 = Yr, Cr.x1 = Ms, Cr.y1 = Ds;
    };
  }
  return Sn.round = function(Kn) {
    return arguments.length ? ($n = !!Kn, Sn) : $n;
  }, Sn.size = function(Kn) {
    return arguments.length ? (_e = +Kn[0], Qt = +Kn[1], Sn) : [_e, Qt];
  }, Sn.padding = function(Kn) {
    return arguments.length ? (Zt = +Kn, Sn) : Zt;
  }, Sn;
}
var preroot = { depth: -1 }, ambiguous = {}, imputed = {};
function defaultId(_e) {
  return _e.id;
}
function defaultParentId(_e) {
  return _e.parentId;
}
function Mm() {
  var _e = defaultId, Qt = defaultParentId, Zt;
  function $n(Sn) {
    var kn = Array.from(Sn), Kn = _e, er = Qt, Cr, kr, Yr, Ms, Ds, Ls, js, zs, Fs = /* @__PURE__ */ new Map();
    if (Zt != null) {
      const Bs = kn.map((Ys, El) => normalize$1(Zt(Ys, El, Sn))), Hs = Bs.map(parentof), Ws = new Set(Bs).add("");
      for (const Ys of Hs)
        Ws.has(Ys) || (Ws.add(Ys), Bs.push(Ys), Hs.push(parentof(Ys)), kn.push(imputed));
      Kn = (Ys, El) => Bs[El], er = (Ys, El) => Hs[El];
    }
    for (Yr = 0, Cr = kn.length; Yr < Cr; ++Yr)
      kr = kn[Yr], Ls = kn[Yr] = new Node$3(kr), (js = Kn(kr, Yr, Sn)) != null && (js += "") && (zs = Ls.id = js, Fs.set(zs, Fs.has(zs) ? ambiguous : Ls)), (js = er(kr, Yr, Sn)) != null && (js += "") && (Ls.parent = js);
    for (Yr = 0; Yr < Cr; ++Yr)
      if (Ls = kn[Yr], js = Ls.parent) {
        if (Ds = Fs.get(js), !Ds)
          throw new Error("missing: " + js);
        if (Ds === ambiguous)
          throw new Error("ambiguous: " + js);
        Ds.children ? Ds.children.push(Ls) : Ds.children = [Ls], Ls.parent = Ds;
      } else {
        if (Ms)
          throw new Error("multiple roots");
        Ms = Ls;
      }
    if (!Ms)
      throw new Error("no root");
    if (Zt != null) {
      for (; Ms.data === imputed && Ms.children.length === 1; )
        Ms = Ms.children[0], --Cr;
      for (let Bs = kn.length - 1; Bs >= 0 && (Ls = kn[Bs], Ls.data === imputed); --Bs)
        Ls.data = null;
    }
    if (Ms.parent = preroot, Ms.eachBefore(function(Bs) {
      Bs.depth = Bs.parent.depth + 1, --Cr;
    }).eachBefore(computeHeight), Ms.parent = null, Cr > 0)
      throw new Error("cycle");
    return Ms;
  }
  return $n.id = function(Sn) {
    return arguments.length ? (_e = optional(Sn), $n) : _e;
  }, $n.parentId = function(Sn) {
    return arguments.length ? (Qt = optional(Sn), $n) : Qt;
  }, $n.path = function(Sn) {
    return arguments.length ? (Zt = optional(Sn), $n) : Zt;
  }, $n;
}
function normalize$1(_e) {
  _e = `${_e}`;
  let Qt = _e.length;
  return slash(_e, Qt - 1) && !slash(_e, Qt - 2) && (_e = _e.slice(0, -1)), _e[0] === "/" ? _e : `/${_e}`;
}
function parentof(_e) {
  let Qt = _e.length;
  if (Qt < 2)
    return "";
  for (; --Qt > 1 && !slash(_e, Qt); )
    ;
  return _e.slice(0, Qt);
}
function slash(_e, Qt) {
  if (_e[Qt] === "/") {
    let Zt = 0;
    for (; Qt > 0 && _e[--Qt] === "\\"; )
      ++Zt;
    if (!(Zt & 1))
      return !0;
  }
  return !1;
}
function defaultSeparation$1(_e, Qt) {
  return _e.parent === Qt.parent ? 1 : 2;
}
function nextLeft(_e) {
  var Qt = _e.children;
  return Qt ? Qt[0] : _e.t;
}
function nextRight(_e) {
  var Qt = _e.children;
  return Qt ? Qt[Qt.length - 1] : _e.t;
}
function moveSubtree(_e, Qt, Zt) {
  var $n = Zt / (Qt.i - _e.i);
  Qt.c -= $n, Qt.s += Zt, _e.c += $n, Qt.z += Zt, Qt.m += Zt;
}
function executeShifts(_e) {
  for (var Qt = 0, Zt = 0, $n = _e.children, Sn = $n.length, kn; --Sn >= 0; )
    kn = $n[Sn], kn.z += Qt, kn.m += Qt, Qt += kn.s + (Zt += kn.c);
}
function nextAncestor(_e, Qt, Zt) {
  return _e.a.parent === Qt.parent ? _e.a : Zt;
}
function TreeNode(_e, Qt) {
  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 = Qt;
}
TreeNode.prototype = Object.create(Node$3.prototype);
function treeRoot(_e) {
  for (var Qt = new TreeNode(_e, 0), Zt, $n = [Qt], Sn, kn, Kn, er; Zt = $n.pop(); )
    if (kn = Zt._.children)
      for (Zt.children = new Array(er = kn.length), Kn = er - 1; Kn >= 0; --Kn)
        $n.push(Sn = Zt.children[Kn] = new TreeNode(kn[Kn], Kn)), Sn.parent = Zt;
  return (Qt.parent = new TreeNode(null, 0)).children = [Qt], Qt;
}
function tree$1() {
  var _e = defaultSeparation$1, Qt = 1, Zt = 1, $n = null;
  function Sn(kr) {
    var Yr = treeRoot(kr);
    if (Yr.eachAfter(kn), Yr.parent.m = -Yr.z, Yr.eachBefore(Kn), $n)
      kr.eachBefore(Cr);
    else {
      var Ms = kr, Ds = kr, Ls = kr;
      kr.eachBefore(function(Hs) {
        Hs.x < Ms.x && (Ms = Hs), Hs.x > Ds.x && (Ds = Hs), Hs.depth > Ls.depth && (Ls = Hs);
      });
      var js = Ms === Ds ? 1 : _e(Ms, Ds) / 2, zs = js - Ms.x, Fs = Qt / (Ds.x + js + zs), Bs = Zt / (Ls.depth || 1);
      kr.eachBefore(function(Hs) {
        Hs.x = (Hs.x + zs) * Fs, Hs.y = Hs.depth * Bs;
      });
    }
    return kr;
  }
  function kn(kr) {
    var Yr = kr.children, Ms = kr.parent.children, Ds = kr.i ? Ms[kr.i - 1] : null;
    if (Yr) {
      executeShifts(kr);
      var Ls = (Yr[0].z + Yr[Yr.length - 1].z) / 2;
      Ds ? (kr.z = Ds.z + _e(kr._, Ds._), kr.m = kr.z - Ls) : kr.z = Ls;
    } else
      Ds && (kr.z = Ds.z + _e(kr._, Ds._));
    kr.parent.A = er(kr, Ds, kr.parent.A || Ms[0]);
  }
  function Kn(kr) {
    kr._.x = kr.z + kr.parent.m, kr.m += kr.parent.m;
  }
  function er(kr, Yr, Ms) {
    if (Yr) {
      for (var Ds = kr, Ls = kr, js = Yr, zs = Ds.parent.children[0], Fs = Ds.m, Bs = Ls.m, Hs = js.m, Ws = zs.m, Ys; js = nextRight(js), Ds = nextLeft(Ds), js && Ds; )
        zs = nextLeft(zs), Ls = nextRight(Ls), Ls.a = kr, Ys = js.z + Hs - Ds.z - Fs + _e(js._, Ds._), Ys > 0 && (moveSubtree(nextAncestor(js, kr, Ms), kr, Ys), Fs += Ys, Bs += Ys), Hs += js.m, Fs += Ds.m, Ws += zs.m, Bs += Ls.m;
      js && !nextRight(Ls) && (Ls.t = js, Ls.m += Hs - Bs), Ds && !nextLeft(zs) && (zs.t = Ds, zs.m += Fs - Ws, Ms = kr);
    }
    return Ms;
  }
  function Cr(kr) {
    kr.x *= Qt, kr.y = kr.depth * Zt;
  }
  return Sn.separation = function(kr) {
    return arguments.length ? (_e = kr, Sn) : _e;
  }, Sn.size = function(kr) {
    return arguments.length ? ($n = !1, Qt = +kr[0], Zt = +kr[1], Sn) : $n ? null : [Qt, Zt];
  }, Sn.nodeSize = function(kr) {
    return arguments.length ? ($n = !0, Qt = +kr[0], Zt = +kr[1], Sn) : $n ? [Qt, Zt] : null;
  }, Sn;
}
function treemapSlice(_e, Qt, Zt, $n, Sn) {
  for (var kn = _e.children, Kn, er = -1, Cr = kn.length, kr = _e.value && (Sn - Zt) / _e.value; ++er < Cr; )
    Kn = kn[er], Kn.x0 = Qt, Kn.x1 = $n, Kn.y0 = Zt, Kn.y1 = Zt += Kn.value * kr;
}
var phi = (1 + Math.sqrt(5)) / 2;
function squarifyRatio(_e, Qt, Zt, $n, Sn, kn) {
  for (var Kn = [], er = Qt.children, Cr, kr, Yr = 0, Ms = 0, Ds = er.length, Ls, js, zs = Qt.value, Fs, Bs, Hs, Ws, Ys, El, Mu; Yr < Ds; ) {
    Ls = Sn - Zt, js = kn - $n;
    do
      Fs = er[Ms++].value;
    while (!Fs && Ms < Ds);
    for (Bs = Hs = Fs, El = Math.max(js / Ls, Ls / js) / (zs * _e), Mu = Fs * Fs * El, Ys = Math.max(Hs / Mu, Mu / Bs); Ms < Ds; ++Ms) {
      if (Fs += kr = er[Ms].value, kr < Bs && (Bs = kr), kr > Hs && (Hs = kr), Mu = Fs * Fs * El, Ws = Math.max(Hs / Mu, Mu / Bs), Ws > Ys) {
        Fs -= kr;
        break;
      }
      Ys = Ws;
    }
    Kn.push(Cr = { value: Fs, dice: Ls < js, children: er.slice(Yr, Ms) }), Cr.dice ? treemapDice(Cr, Zt, $n, Sn, zs ? $n += js * Fs / zs : kn) : treemapSlice(Cr, Zt, $n, zs ? Zt += Ls * Fs / zs : Sn, kn), zs -= Fs, Yr = Ms;
  }
  return Kn;
}
const treemapSquarify = function _e(Qt) {
  function Zt($n, Sn, kn, Kn, er) {
    squarifyRatio(Qt, $n, Sn, kn, Kn, er);
  }
  return Zt.ratio = function($n) {
    return _e(($n = +$n) > 1 ? $n : 1);
  }, Zt;
}(phi);
function treemap() {
  var _e = treemapSquarify, Qt = !1, Zt = 1, $n = 1, Sn = [0], kn = constantZero, Kn = constantZero, er = constantZero, Cr = constantZero, kr = constantZero;
  function Yr(Ds) {
    return Ds.x0 = Ds.y0 = 0, Ds.x1 = Zt, Ds.y1 = $n, Ds.eachBefore(Ms), Sn = [0], Qt && Ds.eachBefore(roundNode), Ds;
  }
  function Ms(Ds) {
    var Ls = Sn[Ds.depth], js = Ds.x0 + Ls, zs = Ds.y0 + Ls, Fs = Ds.x1 - Ls, Bs = Ds.y1 - Ls;
    Fs < js && (js = Fs = (js + Fs) / 2), Bs < zs && (zs = Bs = (zs + Bs) / 2), Ds.x0 = js, Ds.y0 = zs, Ds.x1 = Fs, Ds.y1 = Bs, Ds.children && (Ls = Sn[Ds.depth + 1] = kn(Ds) / 2, js += kr(Ds) - Ls, zs += Kn(Ds) - Ls, Fs -= er(Ds) - Ls, Bs -= Cr(Ds) - Ls, Fs < js && (js = Fs = (js + Fs) / 2), Bs < zs && (zs = Bs = (zs + Bs) / 2), _e(Ds, js, zs, Fs, Bs));
  }
  return Yr.round = function(Ds) {
    return arguments.length ? (Qt = !!Ds, Yr) : Qt;
  }, Yr.size = function(Ds) {
    return arguments.length ? (Zt = +Ds[0], $n = +Ds[1], Yr) : [Zt, $n];
  }, Yr.tile = function(Ds) {
    return arguments.length ? (_e = required(Ds), Yr) : _e;
  }, Yr.padding = function(Ds) {
    return arguments.length ? Yr.paddingInner(Ds).paddingOuter(Ds) : Yr.paddingInner();
  }, Yr.paddingInner = function(Ds) {
    return arguments.length ? (kn = typeof Ds == "function" ? Ds : constant$2(+Ds), Yr) : kn;
  }, Yr.paddingOuter = function(Ds) {
    return arguments.length ? Yr.paddingTop(Ds).paddingRight(Ds).paddingBottom(Ds).paddingLeft(Ds) : Yr.paddingTop();
  }, Yr.paddingTop = function(Ds) {
    return arguments.length ? (Kn = typeof Ds == "function" ? Ds : constant$2(+Ds), Yr) : Kn;
  }, Yr.paddingRight = function(Ds) {
    return arguments.length ? (er = typeof Ds == "function" ? Ds : constant$2(+Ds), Yr) : er;
  }, Yr.paddingBottom = function(Ds) {
    return arguments.length ? (Cr = typeof Ds == "function" ? Ds : constant$2(+Ds), Yr) : Cr;
  }, Yr.paddingLeft = function(Ds) {
    return arguments.length ? (kr = typeof Ds == "function" ? Ds : constant$2(+Ds), Yr) : kr;
  }, Yr;
}
function treemapBinary(_e, Qt, Zt, $n, Sn) {
  var kn = _e.children, Kn, er = kn.length, Cr, kr = new Array(er + 1);
  for (kr[0] = Cr = Kn = 0; Kn < er; ++Kn)
    kr[Kn + 1] = Cr += kn[Kn].value;
  Yr(0, er, _e.value, Qt, Zt, $n, Sn);
  function Yr(Ms, Ds, Ls, js, zs, Fs, Bs) {
    if (Ms >= Ds - 1) {
      var Hs = kn[Ms];
      Hs.x0 = js, Hs.y0 = zs, Hs.x1 = Fs, Hs.y1 = Bs;
      return;
    }
    for (var Ws = kr[Ms], Ys = Ls / 2 + Ws, El = Ms + 1, Mu = Ds - 1; El < Mu; ) {
      var Pl = El + Mu >>> 1;
      kr[Pl] < Ys ? El = Pl + 1 : Mu = Pl;
    }
    Ys - kr[El - 1] < kr[El] - Ys && Ms + 1 < El && --El;
    var Iu = kr[El] - Ws, Tu = Ls - Iu;
    if (Fs - js > Bs - zs) {
      var Au = Ls ? (js * Tu + Fs * Iu) / Ls : Fs;
      Yr(Ms, El, Iu, js, zs, Au, Bs), Yr(El, Ds, Tu, Au, zs, Fs, Bs);
    } else {
      var Nu = Ls ? (zs * Tu + Bs * Iu) / Ls : Bs;
      Yr(Ms, El, Iu, js, zs, Fs, Nu), Yr(El, Ds, Tu, js, Nu, Fs, Bs);
    }
  }
}
function treemapSliceDice(_e, Qt, Zt, $n, Sn) {
  (_e.depth & 1 ? treemapSlice : treemapDice)(_e, Qt, Zt, $n, Sn);
}
const treemapResquarify = function _e(Qt) {
  function Zt($n, Sn, kn, Kn, er) {
    if ((Cr = $n._squarify) && Cr.ratio === Qt)
      for (var Cr, kr, Yr, Ms, Ds = -1, Ls, js = Cr.length, zs = $n.value; ++Ds < js; ) {
        for (kr = Cr[Ds], Yr = kr.children, Ms = kr.value = 0, Ls = Yr.length; Ms < Ls; ++Ms)
          kr.value += Yr[Ms].value;
        kr.dice ? treemapDice(kr, Sn, kn, Kn, zs ? kn += (er - kn) * kr.value / zs : er) : treemapSlice(kr, Sn, kn, zs ? Sn += (Kn - Sn) * kr.value / zs : Kn, er), zs -= kr.value;
      }
    else
      $n._squarify = Cr = squarifyRatio(Qt, $n, Sn, kn, Kn, er), Cr.ratio = Qt;
  }
  return Zt.ratio = function($n) {
    return _e(($n = +$n) > 1 ? $n : 1);
  }, Zt;
}(phi);
function lookup$2(_e, Qt, Zt) {
  const $n = {};
  return _e.each((Sn) => {
    const kn = Sn.data;
    Zt(kn) && ($n[Qt(kn)] = Sn);
  }), _e.lookup = $n, _e;
}
function Nest(_e) {
  Transform$1.call(this, null, _e);
}
Nest.Definition = {
  type: "Nest",
  metadata: {
    treesource: !0,
    changes: !0
  },
  params: [{
    name: "keys",
    type: "field",
    array: !0
  }, {
    name: "generate",
    type: "boolean"
  }]
};
const children$2 = (_e) => _e.values;
inherits(Nest, Transform$1, {
  transform(_e, Qt) {
    Qt.source || error("Nest transform requires an upstream data source.");
    var Zt = _e.generate, $n = _e.modified(), Sn = Qt.clone(), kn = this.value;
    return (!kn || $n || Qt.changed()) && (kn && kn.each((Kn) => {
      Kn.children && isTuple(Kn.data) && Sn.rem.push(Kn.data);
    }), this.value = kn = hierarchy({
      values: array$6(_e.keys).reduce((Kn, er) => (Kn.key(er), Kn), nest()).entries(Sn.source)
    }, children$2), Zt && kn.each((Kn) => {
      Kn.children && (Kn = ingest$1(Kn.data), Sn.add.push(Kn), Sn.source.push(Kn));
    }), lookup$2(kn, tupleid, tupleid)), Sn.source.root = kn, Sn;
  }
});
function nest() {
  const _e = [], Qt = {
    entries: (Sn) => $n(Zt(Sn, 0), 0),
    key: (Sn) => (_e.push(Sn), Qt)
  };
  function Zt(Sn, kn) {
    if (kn >= _e.length)
      return Sn;
    const Kn = Sn.length, er = _e[kn++], Cr = {}, kr = {};
    let Yr = -1, Ms, Ds, Ls;
    for (; ++Yr < Kn; )
      Ms = er(Ds = Sn[Yr]) + "", (Ls = Cr[Ms]) ? Ls.push(Ds) : Cr[Ms] = [Ds];
    for (Ms in Cr)
      kr[Ms] = Zt(Cr[Ms], kn);
    return kr;
  }
  function $n(Sn, kn) {
    if (++kn > _e.length)
      return Sn;
    const Kn = [];
    for (const er in Sn)
      Kn.push({
        key: er,
        values: $n(Sn[er], kn)
      });
    return Kn;
  }
  return Qt;
}
function HierarchyLayout(_e) {
  Transform$1.call(this, null, _e);
}
const defaultSeparation = (_e, Qt) => _e.parent === Qt.parent ? 1 : 2;
inherits(HierarchyLayout, Transform$1, {
  transform(_e, Qt) {
    (!Qt.source || !Qt.source.root) && error(this.constructor.name + " transform requires a backing tree data source.");
    const Zt = this.layout(_e.method), $n = this.fields, Sn = Qt.source.root, kn = _e.as || $n;
    _e.field ? Sn.sum(_e.field) : Sn.count(), _e.sort && Sn.sort(stableCompare(_e.sort, (Kn) => Kn.data)), setParams(Zt, this.params, _e), Zt.separation && Zt.separation(_e.separation !== !1 ? defaultSeparation : one$2);
    try {
      this.value = Zt(Sn);
    } catch (Kn) {
      error(Kn);
    }
    return Sn.each((Kn) => setFields(Kn, $n, kn)), Qt.reflow(_e.modified()).modifies(kn).modifies("leaf");
  }
});
function setParams(_e, Qt, Zt) {
  for (let $n, Sn = 0, kn = Qt.length; Sn < kn; ++Sn)
    $n = Qt[Sn], $n in Zt && _e[$n](Zt[$n]);
}
function setFields(_e, Qt, Zt) {
  const $n = _e.data, Sn = Qt.length - 1;
  for (let kn = 0; kn < Sn; ++kn)
    $n[Zt[kn]] = _e[Qt[kn]];
  $n[Zt[Sn]] = _e.children ? _e.children.length : 0;
}
const Output$3 = ["x", "y", "r", "depth", "children"];
function Pack(_e) {
  HierarchyLayout.call(this, _e);
}
Pack.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: Output$3.length,
    default: Output$3
  }]
};
inherits(Pack, HierarchyLayout, {
  layout: pack,
  params: ["radius", "size", "padding"],
  fields: Output$3
});
const Output$2 = ["x0", "y0", "x1", "y1", "depth", "children"];
function Partition(_e) {
  HierarchyLayout.call(this, _e);
}
Partition.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: Output$2.length,
    default: Output$2
  }]
};
inherits(Partition, HierarchyLayout, {
  layout: partition$1,
  params: ["size", "round", "padding"],
  fields: Output$2
});
function Stratify(_e) {
  Transform$1.call(this, null, _e);
}
Stratify.Definition = {
  type: "Stratify",
  metadata: {
    treesource: !0
  },
  params: [{
    name: "key",
    type: "field",
    required: !0
  }, {
    name: "parentKey",
    type: "field",
    required: !0
  }]
};
inherits(Stratify, Transform$1, {
  transform(_e, Qt) {
    Qt.source || error("Stratify transform requires an upstream data source.");
    let Zt = this.value;
    const $n = _e.modified(), Sn = Qt.fork(Qt.ALL).materialize(Qt.SOURCE), kn = !Zt || $n || Qt.changed(Qt.ADD_REM) || Qt.modified(_e.key.fields) || Qt.modified(_e.parentKey.fields);
    return Sn.source = Sn.source.slice(), kn && (Zt = Sn.source.length ? lookup$2(Mm().id(_e.key).parentId(_e.parentKey)(Sn.source), _e.key, truthy) : lookup$2(Mm()([{}]), _e.key, _e.key)), Sn.source.root = this.value = Zt, Sn;
  }
});
const Layouts = {
  tidy: tree$1,
  cluster
}, Output$1$1 = ["x", "y", "depth", "children"];
function Tree(_e) {
  HierarchyLayout.call(this, _e);
}
Tree.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: Output$1$1.length,
    default: Output$1$1
  }]
};
inherits(Tree, HierarchyLayout, {
  /**
   * Tree layout generator. Supports both 'tidy' and 'cluster' layouts.
   */
  layout(_e) {
    const Qt = _e || "tidy";
    if (has$1(Layouts, Qt))
      return Layouts[Qt]();
    error("Unrecognized Tree layout method: " + Qt);
  },
  params: ["size", "nodeSize"],
  fields: Output$1$1
});
function TreeLinks(_e) {
  Transform$1.call(this, [], _e);
}
TreeLinks.Definition = {
  type: "TreeLinks",
  metadata: {
    tree: !0,
    generates: !0,
    changes: !0
  },
  params: []
};
inherits(TreeLinks, Transform$1, {
  transform(_e, Qt) {
    const Zt = this.value, $n = Qt.source && Qt.source.root, Sn = Qt.fork(Qt.NO_SOURCE), kn = {};
    return $n || error("TreeLinks transform requires a tree data source."), Qt.changed(Qt.ADD_REM) ? (Sn.rem = Zt, Qt.visit(Qt.SOURCE, (Kn) => kn[tupleid(Kn)] = 1), $n.each((Kn) => {
      const er = Kn.data, Cr = Kn.parent && Kn.parent.data;
      Cr && kn[tupleid(er)] && kn[tupleid(Cr)] && Sn.add.push(ingest$1({
        source: Cr,
        target: er
      }));
    }), this.value = Sn.add) : Qt.changed(Qt.MOD) && (Qt.visit(Qt.MOD, (Kn) => kn[tupleid(Kn)] = 1), Zt.forEach((Kn) => {
      (kn[tupleid(Kn.source)] || kn[tupleid(Kn.target)]) && Sn.mod.push(Kn);
    })), Sn;
  }
});
const Tiles = {
  binary: treemapBinary,
  dice: treemapDice,
  slice: treemapSlice,
  slicedice: treemapSliceDice,
  squarify: treemapSquarify,
  resquarify: treemapResquarify
}, Output$4 = ["x0", "y0", "x1", "y1", "depth", "children"];
function Treemap(_e) {
  HierarchyLayout.call(this, _e);
}
Treemap.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: Output$4.length,
    default: Output$4
  }]
};
inherits(Treemap, HierarchyLayout, {
  /**
   * Treemap layout generator. Adds 'method' and 'ratio' parameters
   * to configure the underlying tile method.
   */
  layout() {
    const _e = treemap();
    return _e.ratio = (Qt) => {
      const Zt = _e.tile();
      Zt.ratio && _e.tile(Zt.ratio(Qt));
    }, _e.method = (Qt) => {
      has$1(Tiles, Qt) ? _e.tile(Tiles[Qt]) : error("Unrecognized Treemap layout method: " + Qt);
    }, _e;
  },
  params: ["method", "ratio", "size", "round", "padding", "paddingInner", "paddingOuter", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
  fields: Output$4
});
const tree = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  nest: Nest,
  pack: Pack,
  partition: Partition,
  stratify: Stratify,
  tree: Tree,
  treelinks: TreeLinks,
  treemap: Treemap
}, Symbol.toStringTag, { value: "Module" })), ALPHA_MASK = 4278190080;
function baseBitmaps(_e, Qt) {
  const Zt = _e.bitmap();
  return (Qt || []).forEach(($n) => Zt.set(_e($n.boundary[0]), _e($n.boundary[3]))), [Zt, void 0];
}
function markBitmaps(_e, Qt, Zt, $n, Sn) {
  const kn = _e.width, Kn = _e.height, er = $n || Sn, Cr = domCanvas(kn, Kn).getContext("2d"), kr = domCanvas(kn, Kn).getContext("2d"), Yr = er && domCanvas(kn, Kn).getContext("2d");
  Zt.forEach((Iu) => draw(Cr, Iu, !1)), draw(kr, Qt, !1), er && draw(Yr, Qt, !0);
  const Ms = getBuffer(Cr, kn, Kn), Ds = getBuffer(kr, kn, Kn), Ls = er && getBuffer(Yr, kn, Kn), js = _e.bitmap(), zs = er && _e.bitmap();
  let Fs, Bs, Hs, Ws, Ys, El, Mu, Pl;
  for (Bs = 0; Bs < Kn; ++Bs)
    for (Fs = 0; Fs < kn; ++Fs)
      Ys = Bs * kn + Fs, El = Ms[Ys] & ALPHA_MASK, Pl = Ds[Ys] & ALPHA_MASK, Mu = er && Ls[Ys] & ALPHA_MASK, (El || Mu || Pl) && (Hs = _e(Fs), Ws = _e(Bs), !Sn && (El || Pl) && js.set(Hs, Ws), er && (El || Mu) && zs.set(Hs, Ws));
  return [js, zs];
}
function getBuffer(_e, Qt, Zt) {
  return new Uint32Array(_e.getImageData(0, 0, Qt, Zt).data.buffer);
}
function draw(_e, Qt, Zt) {
  if (!Qt.length)
    return;
  const $n = Qt[0].mark.marktype;
  $n === "group" ? Qt.forEach((Sn) => {
    Sn.items.forEach((kn) => draw(_e, kn.items, Zt));
  }) : Marks[$n].draw(_e, {
    items: Zt ? Qt.map(prepare) : Qt
  });
}
function prepare(_e) {
  const Qt = rederive(_e, {});
  return Qt.stroke && Qt.strokeOpacity !== 0 || Qt.fill && Qt.fillOpacity !== 0 ? {
    ...Qt,
    strokeOpacity: 1,
    stroke: "#000",
    fillOpacity: 0
  } : Qt;
}
const DIV = 5, MOD = 31, SIZE = 32, RIGHT0 = new Uint32Array(SIZE + 1), RIGHT1 = new Uint32Array(SIZE + 1);
RIGHT1[0] = 0;
RIGHT0[0] = ~RIGHT1[0];
for (let _e = 1; _e <= SIZE; ++_e)
  RIGHT1[_e] = RIGHT1[_e - 1] << 1 | 1, RIGHT0[_e] = ~RIGHT1[_e];
function Bitmap(_e, Qt) {
  const Zt = new Uint32Array(~~((_e * Qt + SIZE) / SIZE));
  function $n(kn, Kn) {
    Zt[kn] |= Kn;
  }
  function Sn(kn, Kn) {
    Zt[kn] &= Kn;
  }
  return {
    array: Zt,
    get: (kn, Kn) => {
      const er = Kn * _e + kn;
      return Zt[er >>> DIV] & 1 << (er & MOD);
    },
    set: (kn, Kn) => {
      const er = Kn * _e + kn;
      $n(er >>> DIV, 1 << (er & MOD));
    },
    clear: (kn, Kn) => {
      const er = Kn * _e + kn;
      Sn(er >>> DIV, ~(1 << (er & MOD)));
    },
    getRange: (kn, Kn, er, Cr) => {
      let kr = Cr, Yr, Ms, Ds, Ls;
      for (; kr >= Kn; --kr)
        if (Yr = kr * _e + kn, Ms = kr * _e + er, Ds = Yr >>> DIV, Ls = Ms >>> DIV, Ds === Ls) {
          if (Zt[Ds] & RIGHT0[Yr & MOD] & RIGHT1[(Ms & MOD) + 1])
            return !0;
        } else {
          if (Zt[Ds] & RIGHT0[Yr & MOD] || Zt[Ls] & RIGHT1[(Ms & MOD) + 1])
            return !0;
          for (let js = Ds + 1; js < Ls; ++js)
            if (Zt[js])
              return !0;
        }
      return !1;
    },
    setRange: (kn, Kn, er, Cr) => {
      let kr, Yr, Ms, Ds, Ls;
      for (; Kn <= Cr; ++Kn)
        if (kr = Kn * _e + kn, Yr = Kn * _e + er, Ms = kr >>> DIV, Ds = Yr >>> DIV, Ms === Ds)
          $n(Ms, RIGHT0[kr & MOD] & RIGHT1[(Yr & MOD) + 1]);
        else
          for ($n(Ms, RIGHT0[kr & MOD]), $n(Ds, RIGHT1[(Yr & MOD) + 1]), Ls = Ms + 1; Ls < Ds; ++Ls)
            $n(Ls, 4294967295);
    },
    clearRange: (kn, Kn, er, Cr) => {
      let kr, Yr, Ms, Ds, Ls;
      for (; Kn <= Cr; ++Kn)
        if (kr = Kn * _e + kn, Yr = Kn * _e + er, Ms = kr >>> DIV, Ds = Yr >>> DIV, Ms === Ds)
          Sn(Ms, RIGHT1[kr & MOD] | RIGHT0[(Yr & MOD) + 1]);
        else
          for (Sn(Ms, RIGHT1[kr & MOD]), Sn(Ds, RIGHT0[(Yr & MOD) + 1]), Ls = Ms + 1; Ls < Ds; ++Ls)
            Sn(Ls, 0);
    },
    outOfBounds: (kn, Kn, er, Cr) => kn < 0 || Kn < 0 || Cr >= Qt || er >= _e
  };
}
function scaler(_e, Qt, Zt) {
  const $n = Math.max(1, Math.sqrt(_e * Qt / 1e6)), Sn = ~~((_e + 2 * Zt + $n) / $n), kn = ~~((Qt + 2 * Zt + $n) / $n), Kn = (er) => ~~((er + Zt) / $n);
  return Kn.invert = (er) => er * $n - Zt, Kn.bitmap = () => Bitmap(Sn, kn), Kn.ratio = $n, Kn.padding = Zt, Kn.width = _e, Kn.height = Qt, Kn;
}
function placeAreaLabelNaive(_e, Qt, Zt, $n) {
  const Sn = _e.width, kn = _e.height;
  return function(Kn) {
    const er = Kn.datum.datum.items[$n].items, Cr = er.length, kr = Kn.datum.fontSize, Yr = textMetrics.width(Kn.datum, Kn.datum.text);
    let Ms = 0, Ds, Ls, js, zs, Fs, Bs, Hs;
    for (let Ws = 0; Ws < Cr; ++Ws)
      Ds = er[Ws].x, js = er[Ws].y, Ls = er[Ws].x2 === void 0 ? Ds : er[Ws].x2, zs = er[Ws].y2 === void 0 ? js : er[Ws].y2, Fs = (Ds + Ls) / 2, Bs = (js + zs) / 2, Hs = Math.abs(Ls - Ds + zs - js), Hs >= Ms && (Ms = Hs, Kn.x = Fs, Kn.y = Bs);
    return Fs = Yr / 2, Bs = kr / 2, Ds = Kn.x - Fs, Ls = Kn.x + Fs, js = Kn.y - Bs, zs = Kn.y + Bs, Kn.align = "center", Ds < 0 && Ls <= Sn ? Kn.align = "left" : 0 <= Ds && Sn < Ls && (Kn.align = "right"), Kn.baseline = "middle", js < 0 && zs <= kn ? Kn.baseline = "top" : 0 <= js && kn < zs && (Kn.baseline = "bottom"), !0;
  };
}
function outOfBounds(_e, Qt, Zt, $n, Sn, kn) {
  let Kn = Zt / 2;
  return _e - Kn < 0 || _e + Kn > Sn || Qt - (Kn = $n / 2) < 0 || Qt + Kn > kn;
}
function collision(_e, Qt, Zt, $n, Sn, kn, Kn, er) {
  const Cr = Sn * kn / ($n * 2), kr = _e(Qt - Cr), Yr = _e(Qt + Cr), Ms = _e(Zt - (kn = kn / 2)), Ds = _e(Zt + kn);
  return Kn.outOfBounds(kr, Ms, Yr, Ds) || Kn.getRange(kr, Ms, Yr, Ds) || er && er.getRange(kr, Ms, Yr, Ds);
}
function placeAreaLabelReducedSearch(_e, Qt, Zt, $n) {
  const Sn = _e.width, kn = _e.height, Kn = Qt[0], er = Qt[1];
  function Cr(kr, Yr, Ms, Ds, Ls) {
    const js = _e.invert(kr), zs = _e.invert(Yr);
    let Fs = Ms, Bs = kn, Hs;
    if (!outOfBounds(js, zs, Ds, Ls, Sn, kn) && !collision(_e, js, zs, Ls, Ds, Fs, Kn, er) && !collision(_e, js, zs, Ls, Ds, Ls, Kn, null)) {
      for (; Bs - Fs >= 1; )
        Hs = (Fs + Bs) / 2, collision(_e, js, zs, Ls, Ds, Hs, Kn, er) ? Bs = Hs : Fs = Hs;
      if (Fs > Ms)
        return [js, zs, Fs, !0];
    }
  }
  return function(kr) {
    const Yr = kr.datum.datum.items[$n].items, Ms = Yr.length, Ds = kr.datum.fontSize, Ls = textMetrics.width(kr.datum, kr.datum.text);
    let js = Zt ? Ds : 0, zs = !1, Fs = !1, Bs = 0, Hs, Ws, Ys, El, Mu, Pl, Iu, Tu, Au, Nu, gm, pm, zu, Yu, sm, mm, hm;
    for (let ym = 0; ym < Ms; ++ym) {
      for (Hs = Yr[ym].x, Ys = Yr[ym].y, Ws = Yr[ym].x2 === void 0 ? Hs : Yr[ym].x2, El = Yr[ym].y2 === void 0 ? Ys : Yr[ym].y2, Hs > Ws && (hm = Hs, Hs = Ws, Ws = hm), Ys > El && (hm = Ys, Ys = El, El = hm), Au = _e(Hs), gm = _e(Ws), Nu = ~~((Au + gm) / 2), pm = _e(Ys), Yu = _e(El), zu = ~~((pm + Yu) / 2), Iu = Nu; Iu >= Au; --Iu)
        for (Tu = zu; Tu >= pm; --Tu)
          mm = Cr(Iu, Tu, js, Ls, Ds), mm && ([kr.x, kr.y, js, zs] = mm);
      for (Iu = Nu; Iu <= gm; ++Iu)
        for (Tu = zu; Tu <= Yu; ++Tu)
          mm = Cr(Iu, Tu, js, Ls, Ds), mm && ([kr.x, kr.y, js, zs] = mm);
      !zs && !Zt && (sm = Math.abs(Ws - Hs + El - Ys), Mu = (Hs + Ws) / 2, Pl = (Ys + El) / 2, sm >= Bs && !outOfBounds(Mu, Pl, Ls, Ds, Sn, kn) && !collision(_e, Mu, Pl, Ds, Ls, Ds, Kn, null) && (Bs = sm, kr.x = Mu, kr.y = Pl, Fs = !0));
    }
    return zs || Fs ? (Mu = Ls / 2, Pl = Ds / 2, Kn.setRange(_e(kr.x - Mu), _e(kr.y - Pl), _e(kr.x + Mu), _e(kr.y + Pl)), kr.align = "center", kr.baseline = "middle", !0) : !1;
  };
}
const X_DIR = [-1, -1, 1, 1], Y_DIR = [-1, 1, -1, 1];
function placeAreaLabelFloodFill(_e, Qt, Zt, $n) {
  const Sn = _e.width, kn = _e.height, Kn = Qt[0], er = Qt[1], Cr = _e.bitmap();
  return function(kr) {
    const Yr = kr.datum.datum.items[$n].items, Ms = Yr.length, Ds = kr.datum.fontSize, Ls = textMetrics.width(kr.datum, kr.datum.text), js = [];
    let zs = Zt ? Ds : 0, Fs = !1, Bs = !1, Hs = 0, Ws, Ys, El, Mu, Pl, Iu, Tu, Au, Nu, gm, pm, zu;
    for (let Yu = 0; Yu < Ms; ++Yu) {
      for (Ws = Yr[Yu].x, El = Yr[Yu].y, Ys = Yr[Yu].x2 === void 0 ? Ws : Yr[Yu].x2, Mu = Yr[Yu].y2 === void 0 ? El : Yr[Yu].y2, js.push([_e((Ws + Ys) / 2), _e((El + Mu) / 2)]); js.length; )
        if ([Tu, Au] = js.pop(), !(Kn.get(Tu, Au) || er.get(Tu, Au) || Cr.get(Tu, Au))) {
          Cr.set(Tu, Au);
          for (let sm = 0; sm < 4; ++sm)
            Pl = Tu + X_DIR[sm], Iu = Au + Y_DIR[sm], Cr.outOfBounds(Pl, Iu, Pl, Iu) || js.push([Pl, Iu]);
          if (Pl = _e.invert(Tu), Iu = _e.invert(Au), Nu = zs, gm = kn, !outOfBounds(Pl, Iu, Ls, Ds, Sn, kn) && !collision(_e, Pl, Iu, Ds, Ls, Nu, Kn, er) && !collision(_e, Pl, Iu, Ds, Ls, Ds, Kn, null)) {
            for (; gm - Nu >= 1; )
              pm = (Nu + gm) / 2, collision(_e, Pl, Iu, Ds, Ls, pm, Kn, er) ? gm = pm : Nu = pm;
            Nu > zs && (kr.x = Pl, kr.y = Iu, zs = Nu, Fs = !0);
          }
        }
      !Fs && !Zt && (zu = Math.abs(Ys - Ws + Mu - El), Pl = (Ws + Ys) / 2, Iu = (El + Mu) / 2, zu >= Hs && !outOfBounds(Pl, Iu, Ls, Ds, Sn, kn) && !collision(_e, Pl, Iu, Ds, Ls, Ds, Kn, null) && (Hs = zu, kr.x = Pl, kr.y = Iu, Bs = !0));
    }
    return Fs || Bs ? (Pl = Ls / 2, Iu = Ds / 2, Kn.setRange(_e(kr.x - Pl), _e(kr.y - Iu), _e(kr.x + Pl), _e(kr.y + Iu)), kr.align = "center", kr.baseline = "middle", !0) : !1;
  };
}
const Aligns = ["right", "center", "left"], Baselines = ["bottom", "middle", "top"];
function placeMarkLabel(_e, Qt, Zt, $n) {
  const Sn = _e.width, kn = _e.height, Kn = Qt[0], er = Qt[1], Cr = $n.length;
  return function(kr) {
    const Yr = kr.boundary, Ms = kr.datum.fontSize;
    if (Yr[2] < 0 || Yr[5] < 0 || Yr[0] > Sn || Yr[3] > kn)
      return !1;
    let Ds = kr.textWidth ?? 0, Ls, js, zs, Fs, Bs, Hs, Ws, Ys, El, Mu, Pl, Iu, Tu, Au, Nu;
    for (let gm = 0; gm < Cr; ++gm) {
      if (Ls = (Zt[gm] & 3) - 1, js = (Zt[gm] >>> 2 & 3) - 1, zs = Ls === 0 && js === 0 || $n[gm] < 0, Fs = Ls && js ? Math.SQRT1_2 : 1, Bs = $n[gm] < 0 ? -1 : 1, Hs = Yr[1 + Ls] + $n[gm] * Ls * Fs, Pl = Yr[4 + js] + Bs * Ms * js / 2 + $n[gm] * js * Fs, Ys = Pl - Ms / 2, El = Pl + Ms / 2, Iu = _e(Hs), Au = _e(Ys), Nu = _e(El), !Ds)
        if (test(Iu, Iu, Au, Nu, Kn, er, Hs, Hs, Ys, El, Yr, zs))
          Ds = textMetrics.width(kr.datum, kr.datum.text);
        else
          continue;
      if (Mu = Hs + Bs * Ds * Ls / 2, Hs = Mu - Ds / 2, Ws = Mu + Ds / 2, Iu = _e(Hs), Tu = _e(Ws), test(Iu, Tu, Au, Nu, Kn, er, Hs, Ws, Ys, El, Yr, zs))
        return kr.x = Ls ? Ls * Bs < 0 ? Ws : Hs : Mu, kr.y = js ? js * Bs < 0 ? El : Ys : Pl, kr.align = Aligns[Ls * Bs + 1], kr.baseline = Baselines[js * Bs + 1], Kn.setRange(Iu, Au, Tu, Nu), !0;
    }
    return !1;
  };
}
function test(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr, kr, Yr, Ms) {
  return !(Sn.outOfBounds(_e, Zt, Qt, $n) || (Ms && kn || Sn).getRange(_e, Zt, Qt, $n));
}
const TOP = 0, MIDDLE = 4, BOTTOM = 8, LEFT = 0, CENTER$1 = 1, RIGHT = 2, anchorCode = {
  "top-left": TOP + LEFT,
  top: TOP + CENTER$1,
  "top-right": TOP + RIGHT,
  left: MIDDLE + LEFT,
  middle: MIDDLE + CENTER$1,
  right: MIDDLE + RIGHT,
  "bottom-left": BOTTOM + LEFT,
  bottom: BOTTOM + CENTER$1,
  "bottom-right": BOTTOM + RIGHT
}, placeAreaLabel = {
  naive: placeAreaLabelNaive,
  "reduced-search": placeAreaLabelReducedSearch,
  floodfill: placeAreaLabelFloodFill
};
function labelLayout(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr, kr, Yr) {
  if (!_e.length)
    return _e;
  const Ms = Math.max($n.length, Sn.length), Ds = getOffsets($n, Ms), Ls = getAnchors(Sn, Ms), js = markType(_e[0].datum), zs = js === "group" && _e[0].datum.items[Cr].marktype, Fs = zs === "area", Bs = markBoundary(js, zs, er, Cr), Hs = kr === null || kr === 1 / 0, Ws = Fs && Yr === "naive";
  let Ys = -1, El = -1;
  const Mu = _e.map((Au) => {
    const Nu = Hs ? textMetrics.width(Au, Au.text) : void 0;
    return Ys = Math.max(Ys, Nu), El = Math.max(El, Au.fontSize), {
      datum: Au,
      opacity: 0,
      x: void 0,
      y: void 0,
      align: void 0,
      baseline: void 0,
      boundary: Bs(Au),
      textWidth: Nu
    };
  });
  kr = kr === null || kr === 1 / 0 ? Math.max(Ys, El) + Math.max(...$n) : kr;
  const Pl = scaler(Qt[0], Qt[1], kr);
  let Iu;
  if (!Ws) {
    Zt && Mu.sort((gm, pm) => Zt(gm.datum, pm.datum));
    let Au = !1;
    for (let gm = 0; gm < Ls.length && !Au; ++gm)
      Au = Ls[gm] === 5 || Ds[gm] < 0;
    const Nu = (js && Kn || Fs) && _e.map((gm) => gm.datum);
    Iu = kn.length || Nu ? markBitmaps(Pl, Nu || [], kn, Au, Fs) : baseBitmaps(Pl, Kn && Mu);
  }
  const Tu = Fs ? placeAreaLabel[Yr](Pl, Iu, Kn, Cr) : placeMarkLabel(Pl, Iu, Ls, Ds);
  return Mu.forEach((Au) => Au.opacity = +Tu(Au)), Mu;
}
function getOffsets(_e, Qt) {
  const Zt = new Float64Array(Qt), $n = _e.length;
  for (let Sn = 0; Sn < $n; ++Sn)
    Zt[Sn] = _e[Sn] || 0;
  for (let Sn = $n; Sn < Qt; ++Sn)
    Zt[Sn] = Zt[$n - 1];
  return Zt;
}
function getAnchors(_e, Qt) {
  const Zt = new Int8Array(Qt), $n = _e.length;
  for (let Sn = 0; Sn < $n; ++Sn)
    Zt[Sn] |= anchorCode[_e[Sn]];
  for (let Sn = $n; Sn < Qt; ++Sn)
    Zt[Sn] = Zt[$n - 1];
  return Zt;
}
function markType(_e) {
  return _e && _e.mark && _e.mark.marktype;
}
function markBoundary(_e, Qt, Zt, $n) {
  const Sn = (kn) => [kn.x, kn.x, kn.x, kn.y, kn.y, kn.y];
  return _e ? _e === "line" || _e === "area" ? (kn) => Sn(kn.datum) : Qt === "line" ? (kn) => {
    const Kn = kn.datum.items[$n].items;
    return Sn(Kn.length ? Kn[Zt === "start" ? 0 : Kn.length - 1] : {
      x: NaN,
      y: NaN
    });
  } : (kn) => {
    const Kn = kn.datum.bounds;
    return [Kn.x1, (Kn.x1 + Kn.x2) / 2, Kn.x2, Kn.y1, (Kn.y1 + Kn.y2) / 2, Kn.y2];
  } : Sn;
}
const Output$1 = ["x", "y", "opacity", "align", "baseline"], Anchors = ["top-left", "left", "bottom-left", "top", "bottom", "top-right", "right", "bottom-right"];
function Label$1(_e) {
  Transform$1.call(this, null, _e);
}
Label$1.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: Anchors
  }, {
    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: Output$1.length,
    default: Output$1
  }]
};
inherits(Label$1, Transform$1, {
  transform(_e, Qt) {
    function Zt(kn) {
      const Kn = _e[kn];
      return isFunction$1(Kn) && Qt.modified(Kn.fields);
    }
    const $n = _e.modified();
    if (!($n || Qt.changed(Qt.ADD_REM) || Zt("sort")))
      return;
    (!_e.size || _e.size.length !== 2) && error("Size parameter should be specified as a [width, height] array.");
    const Sn = _e.as || Output$1;
    return labelLayout(Qt.materialize(Qt.SOURCE).source || [], _e.size, _e.sort, array$6(_e.offset == null ? 1 : _e.offset), array$6(_e.anchor || Anchors), _e.avoidMarks || [], _e.avoidBaseMark !== !1, _e.lineAnchor || "end", _e.markIndex || 0, _e.padding === void 0 ? 0 : _e.padding, _e.method || "naive").forEach((kn) => {
      const Kn = kn.datum;
      Kn[Sn[0]] = kn.x, Kn[Sn[1]] = kn.y, Kn[Sn[2]] = kn.opacity, Kn[Sn[3]] = kn.align, Kn[Sn[4]] = kn.baseline;
    }), Qt.reflow($n).modifies(Sn);
  }
});
const label = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  label: Label$1
}, Symbol.toStringTag, { value: "Module" }));
function partition(_e, Qt) {
  var Zt = [], $n = function(Yr) {
    return Yr(er);
  }, Sn, kn, Kn, er, Cr, kr;
  if (Qt == null)
    Zt.push(_e);
  else
    for (Sn = {}, kn = 0, Kn = _e.length; kn < Kn; ++kn)
      er = _e[kn], Cr = Qt.map($n), kr = Sn[Cr], kr || (Sn[Cr] = kr = [], kr.dims = Cr, Zt.push(kr)), kr.push(er);
  return Zt;
}
function Loess(_e) {
  Transform$1.call(this, null, _e);
}
Loess.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
  }]
};
inherits(Loess, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS);
    if (!this.value || Qt.changed() || _e.modified()) {
      const $n = Qt.materialize(Qt.SOURCE).source, Sn = partition($n, _e.groupby), kn = (_e.groupby || []).map(accessorName), Kn = kn.length, er = _e.as || [accessorName(_e.x), accessorName(_e.y)], Cr = [];
      Sn.forEach((kr) => {
        loess(kr, _e.x, _e.y, _e.bandwidth || 0.3).forEach((Yr) => {
          const Ms = {};
          for (let Ds = 0; Ds < Kn; ++Ds)
            Ms[kn[Ds]] = kr.dims[Ds];
          Ms[er[0]] = Yr[0], Ms[er[1]] = Yr[1], Cr.push(ingest$1(Ms));
        });
      }), this.value && (Zt.rem = this.value), this.value = Zt.add = Zt.source = Cr;
    }
    return Zt;
  }
});
const Methods = {
  constant: constant$6,
  linear: linear$2,
  log: log$4,
  exp: exp$1,
  pow: pow$3,
  quad,
  poly
}, degreesOfFreedom = (_e, Qt) => _e === "poly" ? Qt : _e === "quad" ? 2 : 1;
function Regression(_e) {
  Transform$1.call(this, null, _e);
}
Regression.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(Methods)
  }, {
    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
  }]
};
inherits(Regression, Transform$1, {
  transform(_e, Qt) {
    const Zt = Qt.fork(Qt.NO_SOURCE | Qt.NO_FIELDS);
    if (!this.value || Qt.changed() || _e.modified()) {
      const $n = Qt.materialize(Qt.SOURCE).source, Sn = partition($n, _e.groupby), kn = (_e.groupby || []).map(accessorName), Kn = _e.method || "linear", er = _e.order == null ? 3 : _e.order, Cr = degreesOfFreedom(Kn, er), kr = _e.as || [accessorName(_e.x), accessorName(_e.y)], Yr = Methods[Kn], Ms = [];
      let Ds = _e.extent;
      has$1(Methods, Kn) || error("Invalid regression method: " + Kn), Ds != null && Kn === "log" && Ds[0] <= 0 && (Qt.dataflow.warn("Ignoring extent with values <= 0 for log regression."), Ds = null), Sn.forEach((Ls) => {
        if (Ls.length <= Cr) {
          Qt.dataflow.warn("Skipping regression with more parameters than data points.");
          return;
        }
        const zs = Yr(Ls, _e.x, _e.y, er);
        if (_e.params) {
          Ms.push(ingest$1({
            keys: Ls.dims,
            coef: zs.coef,
            rSquared: zs.rSquared
          }));
          return;
        }
        const Fs = Ds || extent(Ls, _e.x), Bs = (Hs) => {
          const Ws = {};
          for (let Ys = 0; Ys < kn.length; ++Ys)
            Ws[kn[Ys]] = Ls.dims[Ys];
          Ws[kr[0]] = Hs[0], Ws[kr[1]] = Hs[1], Ms.push(ingest$1(Ws));
        };
        Kn === "linear" || Kn === "constant" ? Fs.forEach((Hs) => Bs([Hs, zs.predict(Hs)])) : sampleCurve(zs.predict, Fs, 25, 200).forEach(Bs);
      }), this.value && (Zt.rem = this.value), this.value = Zt.add = Zt.source = Ms;
    }
    return Zt;
  }
});
const reg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  loess: Loess,
  regression: Regression
}, Symbol.toStringTag, { value: "Module" })), epsilon$1 = 11102230246251565e-32, splitter = 134217729, resulterrbound = (3 + 8 * epsilon$1) * epsilon$1;
function sum(_e, Qt, Zt, $n, Sn) {
  let kn, Kn, er, Cr, kr = Qt[0], Yr = $n[0], Ms = 0, Ds = 0;
  Yr > kr == Yr > -kr ? (kn = kr, kr = Qt[++Ms]) : (kn = Yr, Yr = $n[++Ds]);
  let Ls = 0;
  if (Ms < _e && Ds < Zt)
    for (Yr > kr == Yr > -kr ? (Kn = kr + kn, er = kn - (Kn - kr), kr = Qt[++Ms]) : (Kn = Yr + kn, er = kn - (Kn - Yr), Yr = $n[++Ds]), kn = Kn, er !== 0 && (Sn[Ls++] = er); Ms < _e && Ds < Zt; )
      Yr > kr == Yr > -kr ? (Kn = kn + kr, Cr = Kn - kn, er = kn - (Kn - Cr) + (kr - Cr), kr = Qt[++Ms]) : (Kn = kn + Yr, Cr = Kn - kn, er = kn - (Kn - Cr) + (Yr - Cr), Yr = $n[++Ds]), kn = Kn, er !== 0 && (Sn[Ls++] = er);
  for (; Ms < _e; )
    Kn = kn + kr, Cr = Kn - kn, er = kn - (Kn - Cr) + (kr - Cr), kr = Qt[++Ms], kn = Kn, er !== 0 && (Sn[Ls++] = er);
  for (; Ds < Zt; )
    Kn = kn + Yr, Cr = Kn - kn, er = kn - (Kn - Cr) + (Yr - Cr), Yr = $n[++Ds], kn = Kn, er !== 0 && (Sn[Ls++] = er);
  return (kn !== 0 || Ls === 0) && (Sn[Ls++] = kn), Ls;
}
function estimate(_e, Qt) {
  let Zt = Qt[0];
  for (let $n = 1; $n < _e; $n++)
    Zt += Qt[$n];
  return Zt;
}
function vec(_e) {
  return new Float64Array(_e);
}
const ccwerrboundA = (3 + 16 * epsilon$1) * epsilon$1, ccwerrboundB = (2 + 12 * epsilon$1) * epsilon$1, ccwerrboundC = (9 + 64 * epsilon$1) * epsilon$1 * epsilon$1, B = vec(4), C1$1 = vec(8), C2 = vec(12), D = vec(16), u$2 = vec(4);
function orient2dadapt(_e, Qt, Zt, $n, Sn, kn, Kn) {
  let er, Cr, kr, Yr, Ms, Ds, Ls, js, zs, Fs, Bs, Hs, Ws, Ys, El, Mu, Pl, Iu;
  const Tu = _e - Sn, Au = Zt - Sn, Nu = Qt - kn, gm = $n - kn;
  Ys = Tu * gm, Ds = splitter * Tu, Ls = Ds - (Ds - Tu), js = Tu - Ls, Ds = splitter * gm, zs = Ds - (Ds - gm), Fs = gm - zs, El = js * Fs - (Ys - Ls * zs - js * zs - Ls * Fs), Mu = Nu * Au, Ds = splitter * Nu, Ls = Ds - (Ds - Nu), js = Nu - Ls, Ds = splitter * Au, zs = Ds - (Ds - Au), Fs = Au - zs, Pl = js * Fs - (Mu - Ls * zs - js * zs - Ls * Fs), Bs = El - Pl, Ms = El - Bs, B[0] = El - (Bs + Ms) + (Ms - Pl), Hs = Ys + Bs, Ms = Hs - Ys, Ws = Ys - (Hs - Ms) + (Bs - Ms), Bs = Ws - Mu, Ms = Ws - Bs, B[1] = Ws - (Bs + Ms) + (Ms - Mu), Iu = Hs + Bs, Ms = Iu - Hs, B[2] = Hs - (Iu - Ms) + (Bs - Ms), B[3] = Iu;
  let pm = estimate(4, B), zu = ccwerrboundB * Kn;
  if (pm >= zu || -pm >= zu || (Ms = _e - Tu, er = _e - (Tu + Ms) + (Ms - Sn), Ms = Zt - Au, kr = Zt - (Au + Ms) + (Ms - Sn), Ms = Qt - Nu, Cr = Qt - (Nu + Ms) + (Ms - kn), Ms = $n - gm, Yr = $n - (gm + Ms) + (Ms - kn), er === 0 && Cr === 0 && kr === 0 && Yr === 0) || (zu = ccwerrboundC * Kn + resulterrbound * Math.abs(pm), pm += Tu * Yr + gm * er - (Nu * kr + Au * Cr), pm >= zu || -pm >= zu))
    return pm;
  Ys = er * gm, Ds = splitter * er, Ls = Ds - (Ds - er), js = er - Ls, Ds = splitter * gm, zs = Ds - (Ds - gm), Fs = gm - zs, El = js * Fs - (Ys - Ls * zs - js * zs - Ls * Fs), Mu = Cr * Au, Ds = splitter * Cr, Ls = Ds - (Ds - Cr), js = Cr - Ls, Ds = splitter * Au, zs = Ds - (Ds - Au), Fs = Au - zs, Pl = js * Fs - (Mu - Ls * zs - js * zs - Ls * Fs), Bs = El - Pl, Ms = El - Bs, u$2[0] = El - (Bs + Ms) + (Ms - Pl), Hs = Ys + Bs, Ms = Hs - Ys, Ws = Ys - (Hs - Ms) + (Bs - Ms), Bs = Ws - Mu, Ms = Ws - Bs, u$2[1] = Ws - (Bs + Ms) + (Ms - Mu), Iu = Hs + Bs, Ms = Iu - Hs, u$2[2] = Hs - (Iu - Ms) + (Bs - Ms), u$2[3] = Iu;
  const Yu = sum(4, B, 4, u$2, C1$1);
  Ys = Tu * Yr, Ds = splitter * Tu, Ls = Ds - (Ds - Tu), js = Tu - Ls, Ds = splitter * Yr, zs = Ds - (Ds - Yr), Fs = Yr - zs, El = js * Fs - (Ys - Ls * zs - js * zs - Ls * Fs), Mu = Nu * kr, Ds = splitter * Nu, Ls = Ds - (Ds - Nu), js = Nu - Ls, Ds = splitter * kr, zs = Ds - (Ds - kr), Fs = kr - zs, Pl = js * Fs - (Mu - Ls * zs - js * zs - Ls * Fs), Bs = El - Pl, Ms = El - Bs, u$2[0] = El - (Bs + Ms) + (Ms - Pl), Hs = Ys + Bs, Ms = Hs - Ys, Ws = Ys - (Hs - Ms) + (Bs - Ms), Bs = Ws - Mu, Ms = Ws - Bs, u$2[1] = Ws - (Bs + Ms) + (Ms - Mu), Iu = Hs + Bs, Ms = Iu - Hs, u$2[2] = Hs - (Iu - Ms) + (Bs - Ms), u$2[3] = Iu;
  const sm = sum(Yu, C1$1, 4, u$2, C2);
  Ys = er * Yr, Ds = splitter * er, Ls = Ds - (Ds - er), js = er - Ls, Ds = splitter * Yr, zs = Ds - (Ds - Yr), Fs = Yr - zs, El = js * Fs - (Ys - Ls * zs - js * zs - Ls * Fs), Mu = Cr * kr, Ds = splitter * Cr, Ls = Ds - (Ds - Cr), js = Cr - Ls, Ds = splitter * kr, zs = Ds - (Ds - kr), Fs = kr - zs, Pl = js * Fs - (Mu - Ls * zs - js * zs - Ls * Fs), Bs = El - Pl, Ms = El - Bs, u$2[0] = El - (Bs + Ms) + (Ms - Pl), Hs = Ys + Bs, Ms = Hs - Ys, Ws = Ys - (Hs - Ms) + (Bs - Ms), Bs = Ws - Mu, Ms = Ws - Bs, u$2[1] = Ws - (Bs + Ms) + (Ms - Mu), Iu = Hs + Bs, Ms = Iu - Hs, u$2[2] = Hs - (Iu - Ms) + (Bs - Ms), u$2[3] = Iu;
  const mm = sum(sm, C2, 4, u$2, D);
  return D[mm - 1];
}
function orient2d(_e, Qt, Zt, $n, Sn, kn) {
  const Kn = (Qt - kn) * (Zt - Sn), er = (_e - Sn) * ($n - kn), Cr = Kn - er, kr = Math.abs(Kn + er);
  return Math.abs(Cr) >= ccwerrboundA * kr ? Cr : -orient2dadapt(_e, Qt, Zt, $n, Sn, kn, kr);
}
const EPSILON = Math.pow(2, -52), EDGE_STACK = new Uint32Array(512);
class Delaunator {
  static from(Qt, Zt = defaultGetX, $n = defaultGetY) {
    const Sn = Qt.length, kn = new Float64Array(Sn * 2);
    for (let Kn = 0; Kn < Sn; Kn++) {
      const er = Qt[Kn];
      kn[2 * Kn] = Zt(er), kn[2 * Kn + 1] = $n(er);
    }
    return new Delaunator(kn);
  }
  constructor(Qt) {
    const Zt = Qt.length >> 1;
    if (Zt > 0 && typeof Qt[0] != "number")
      throw new Error("Expected coords to contain numbers.");
    this.coords = Qt;
    const $n = Math.max(2 * Zt - 5, 0);
    this._triangles = new Uint32Array($n * 3), this._halfedges = new Int32Array($n * 3), this._hashSize = Math.ceil(Math.sqrt(Zt)), this._hullPrev = new Uint32Array(Zt), this._hullNext = new Uint32Array(Zt), this._hullTri = new Uint32Array(Zt), this._hullHash = new Int32Array(this._hashSize).fill(-1), this._ids = new Uint32Array(Zt), this._dists = new Float64Array(Zt), this.update();
  }
  update() {
    const { coords: Qt, _hullPrev: Zt, _hullNext: $n, _hullTri: Sn, _hullHash: kn } = this, Kn = Qt.length >> 1;
    let er = 1 / 0, Cr = 1 / 0, kr = -1 / 0, Yr = -1 / 0;
    for (let Au = 0; Au < Kn; Au++) {
      const Nu = Qt[2 * Au], gm = Qt[2 * Au + 1];
      Nu < er && (er = Nu), gm < Cr && (Cr = gm), Nu > kr && (kr = Nu), gm > Yr && (Yr = gm), this._ids[Au] = Au;
    }
    const Ms = (er + kr) / 2, Ds = (Cr + Yr) / 2;
    let Ls = 1 / 0, js, zs, Fs;
    for (let Au = 0; Au < Kn; Au++) {
      const Nu = dist(Ms, Ds, Qt[2 * Au], Qt[2 * Au + 1]);
      Nu < Ls && (js = Au, Ls = Nu);
    }
    const Bs = Qt[2 * js], Hs = Qt[2 * js + 1];
    Ls = 1 / 0;
    for (let Au = 0; Au < Kn; Au++) {
      if (Au === js)
        continue;
      const Nu = dist(Bs, Hs, Qt[2 * Au], Qt[2 * Au + 1]);
      Nu < Ls && Nu > 0 && (zs = Au, Ls = Nu);
    }
    let Ws = Qt[2 * zs], Ys = Qt[2 * zs + 1], El = 1 / 0;
    for (let Au = 0; Au < Kn; Au++) {
      if (Au === js || Au === zs)
        continue;
      const Nu = circumradius(Bs, Hs, Ws, Ys, Qt[2 * Au], Qt[2 * Au + 1]);
      Nu < El && (Fs = Au, El = Nu);
    }
    let Mu = Qt[2 * Fs], Pl = Qt[2 * Fs + 1];
    if (El === 1 / 0) {
      for (let gm = 0; gm < Kn; gm++)
        this._dists[gm] = Qt[2 * gm] - Qt[0] || Qt[2 * gm + 1] - Qt[1];
      quicksort(this._ids, this._dists, 0, Kn - 1);
      const Au = new Uint32Array(Kn);
      let Nu = 0;
      for (let gm = 0, pm = -1 / 0; gm < Kn; gm++) {
        const zu = this._ids[gm];
        this._dists[zu] > pm && (Au[Nu++] = zu, pm = this._dists[zu]);
      }
      this.hull = Au.subarray(0, Nu), this.triangles = new Uint32Array(0), this.halfedges = new Uint32Array(0);
      return;
    }
    if (orient2d(Bs, Hs, Ws, Ys, Mu, Pl) < 0) {
      const Au = zs, Nu = Ws, gm = Ys;
      zs = Fs, Ws = Mu, Ys = Pl, Fs = Au, Mu = Nu, Pl = gm;
    }
    const Iu = circumcenter(Bs, Hs, Ws, Ys, Mu, Pl);
    this._cx = Iu.x, this._cy = Iu.y;
    for (let Au = 0; Au < Kn; Au++)
      this._dists[Au] = dist(Qt[2 * Au], Qt[2 * Au + 1], Iu.x, Iu.y);
    quicksort(this._ids, this._dists, 0, Kn - 1), this._hullStart = js;
    let Tu = 3;
    $n[js] = Zt[Fs] = zs, $n[zs] = Zt[js] = Fs, $n[Fs] = Zt[zs] = js, Sn[js] = 0, Sn[zs] = 1, Sn[Fs] = 2, kn.fill(-1), kn[this._hashKey(Bs, Hs)] = js, kn[this._hashKey(Ws, Ys)] = zs, kn[this._hashKey(Mu, Pl)] = Fs, this.trianglesLen = 0, this._addTriangle(js, zs, Fs, -1, -1, -1);
    for (let Au = 0, Nu, gm; Au < this._ids.length; Au++) {
      const pm = this._ids[Au], zu = Qt[2 * pm], Yu = Qt[2 * pm + 1];
      if (Au > 0 && Math.abs(zu - Nu) <= EPSILON && Math.abs(Yu - gm) <= EPSILON || (Nu = zu, gm = Yu, pm === js || pm === zs || pm === Fs))
        continue;
      let sm = 0;
      for (let Sm = 0, wm = this._hashKey(zu, Yu); Sm < this._hashSize && (sm = kn[(wm + Sm) % this._hashSize], !(sm !== -1 && sm !== $n[sm])); Sm++)
        ;
      sm = Zt[sm];
      let mm = sm, hm;
      for (; hm = $n[mm], orient2d(zu, Yu, Qt[2 * mm], Qt[2 * mm + 1], Qt[2 * hm], Qt[2 * hm + 1]) >= 0; )
        if (mm = hm, mm === sm) {
          mm = -1;
          break;
        }
      if (mm === -1)
        continue;
      let ym = this._addTriangle(mm, pm, $n[mm], -1, -1, Sn[mm]);
      Sn[pm] = this._legalize(ym + 2), Sn[mm] = ym, Tu++;
      let _m = $n[mm];
      for (; hm = $n[_m], orient2d(zu, Yu, Qt[2 * _m], Qt[2 * _m + 1], Qt[2 * hm], Qt[2 * hm + 1]) < 0; )
        ym = this._addTriangle(_m, pm, hm, Sn[pm], -1, Sn[_m]), Sn[pm] = this._legalize(ym + 2), $n[_m] = _m, Tu--, _m = hm;
      if (mm === sm)
        for (; hm = Zt[mm], orient2d(zu, Yu, Qt[2 * hm], Qt[2 * hm + 1], Qt[2 * mm], Qt[2 * mm + 1]) < 0; )
          ym = this._addTriangle(hm, pm, mm, -1, Sn[mm], Sn[hm]), this._legalize(ym + 2), Sn[hm] = ym, $n[mm] = mm, Tu--, mm = hm;
      this._hullStart = Zt[pm] = mm, $n[mm] = Zt[_m] = pm, $n[pm] = _m, kn[this._hashKey(zu, Yu)] = pm, kn[this._hashKey(Qt[2 * mm], Qt[2 * mm + 1])] = mm;
    }
    this.hull = new Uint32Array(Tu);
    for (let Au = 0, Nu = this._hullStart; Au < Tu; Au++)
      this.hull[Au] = Nu, Nu = $n[Nu];
    this.triangles = this._triangles.subarray(0, this.trianglesLen), this.halfedges = this._halfedges.subarray(0, this.trianglesLen);
  }
  _hashKey(Qt, Zt) {
    return Math.floor(pseudoAngle(Qt - this._cx, Zt - this._cy) * this._hashSize) % this._hashSize;
  }
  _legalize(Qt) {
    const { _triangles: Zt, _halfedges: $n, coords: Sn } = this;
    let kn = 0, Kn = 0;
    for (; ; ) {
      const er = $n[Qt], Cr = Qt - Qt % 3;
      if (Kn = Cr + (Qt + 2) % 3, er === -1) {
        if (kn === 0)
          break;
        Qt = EDGE_STACK[--kn];
        continue;
      }
      const kr = er - er % 3, Yr = Cr + (Qt + 1) % 3, Ms = kr + (er + 2) % 3, Ds = Zt[Kn], Ls = Zt[Qt], js = Zt[Yr], zs = Zt[Ms];
      if (inCircle(
        Sn[2 * Ds],
        Sn[2 * Ds + 1],
        Sn[2 * Ls],
        Sn[2 * Ls + 1],
        Sn[2 * js],
        Sn[2 * js + 1],
        Sn[2 * zs],
        Sn[2 * zs + 1]
      )) {
        Zt[Qt] = zs, Zt[er] = Ds;
        const Bs = $n[Ms];
        if (Bs === -1) {
          let Ws = this._hullStart;
          do {
            if (this._hullTri[Ws] === Ms) {
              this._hullTri[Ws] = Qt;
              break;
            }
            Ws = this._hullPrev[Ws];
          } while (Ws !== this._hullStart);
        }
        this._link(Qt, Bs), this._link(er, $n[Kn]), this._link(Kn, Ms);
        const Hs = kr + (er + 1) % 3;
        kn < EDGE_STACK.length && (EDGE_STACK[kn++] = Hs);
      } else {
        if (kn === 0)
          break;
        Qt = EDGE_STACK[--kn];
      }
    }
    return Kn;
  }
  _link(Qt, Zt) {
    this._halfedges[Qt] = Zt, Zt !== -1 && (this._halfedges[Zt] = Qt);
  }
  // add a new triangle given vertex indices and adjacent half-edge ids
  _addTriangle(Qt, Zt, $n, Sn, kn, Kn) {
    const er = this.trianglesLen;
    return this._triangles[er] = Qt, this._triangles[er + 1] = Zt, this._triangles[er + 2] = $n, this._link(er, Sn), this._link(er + 1, kn), this._link(er + 2, Kn), this.trianglesLen += 3, er;
  }
}
function pseudoAngle(_e, Qt) {
  const Zt = _e / (Math.abs(_e) + Math.abs(Qt));
  return (Qt > 0 ? 3 - Zt : 1 + Zt) / 4;
}
function dist(_e, Qt, Zt, $n) {
  const Sn = _e - Zt, kn = Qt - $n;
  return Sn * Sn + kn * kn;
}
function inCircle(_e, Qt, Zt, $n, Sn, kn, Kn, er) {
  const Cr = _e - Kn, kr = Qt - er, Yr = Zt - Kn, Ms = $n - er, Ds = Sn - Kn, Ls = kn - er, js = Cr * Cr + kr * kr, zs = Yr * Yr + Ms * Ms, Fs = Ds * Ds + Ls * Ls;
  return Cr * (Ms * Fs - zs * Ls) - kr * (Yr * Fs - zs * Ds) + js * (Yr * Ls - Ms * Ds) < 0;
}
function circumradius(_e, Qt, Zt, $n, Sn, kn) {
  const Kn = Zt - _e, er = $n - Qt, Cr = Sn - _e, kr = kn - Qt, Yr = Kn * Kn + er * er, Ms = Cr * Cr + kr * kr, Ds = 0.5 / (Kn * kr - er * Cr), Ls = (kr * Yr - er * Ms) * Ds, js = (Kn * Ms - Cr * Yr) * Ds;
  return Ls * Ls + js * js;
}
function circumcenter(_e, Qt, Zt, $n, Sn, kn) {
  const Kn = Zt - _e, er = $n - Qt, Cr = Sn - _e, kr = kn - Qt, Yr = Kn * Kn + er * er, Ms = Cr * Cr + kr * kr, Ds = 0.5 / (Kn * kr - er * Cr), Ls = _e + (kr * Yr - er * Ms) * Ds, js = Qt + (Kn * Ms - Cr * Yr) * Ds;
  return { x: Ls, y: js };
}
function quicksort(_e, Qt, Zt, $n) {
  if ($n - Zt <= 20)
    for (let Sn = Zt + 1; Sn <= $n; Sn++) {
      const kn = _e[Sn], Kn = Qt[kn];
      let er = Sn - 1;
      for (; er >= Zt && Qt[_e[er]] > Kn; )
        _e[er + 1] = _e[er--];
      _e[er + 1] = kn;
    }
  else {
    const Sn = Zt + $n >> 1;
    let kn = Zt + 1, Kn = $n;
    swap(_e, Sn, kn), Qt[_e[Zt]] > Qt[_e[$n]] && swap(_e, Zt, $n), Qt[_e[kn]] > Qt[_e[$n]] && swap(_e, kn, $n), Qt[_e[Zt]] > Qt[_e[kn]] && swap(_e, Zt, kn);
    const er = _e[kn], Cr = Qt[er];
    for (; ; ) {
      do
        kn++;
      while (Qt[_e[kn]] < Cr);
      do
        Kn--;
      while (Qt[_e[Kn]] > Cr);
      if (Kn < kn)
        break;
      swap(_e, kn, Kn);
    }
    _e[Zt + 1] = _e[Kn], _e[Kn] = er, $n - kn + 1 >= Kn - Zt ? (quicksort(_e, Qt, kn, $n), quicksort(_e, Qt, Zt, Kn - 1)) : (quicksort(_e, Qt, Zt, Kn - 1), quicksort(_e, Qt, kn, $n));
  }
}
function swap(_e, Qt, Zt) {
  const $n = _e[Qt];
  _e[Qt] = _e[Zt], _e[Zt] = $n;
}
function defaultGetX(_e) {
  return _e[0];
}
function defaultGetY(_e) {
  return _e[1];
}
const epsilon = 1e-6;
class Path {
  constructor() {
    this._x0 = this._y0 = // start of current subpath
    this._x1 = this._y1 = null, this._ = "";
  }
  moveTo(Qt, Zt) {
    this._ += `M${this._x0 = this._x1 = +Qt},${this._y0 = this._y1 = +Zt}`;
  }
  closePath() {
    this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
  }
  lineTo(Qt, Zt) {
    this._ += `L${this._x1 = +Qt},${this._y1 = +Zt}`;
  }
  arc(Qt, Zt, $n) {
    Qt = +Qt, Zt = +Zt, $n = +$n;
    const Sn = Qt + $n, kn = Zt;
    if ($n < 0)
      throw new Error("negative radius");
    this._x1 === null ? this._ += `M${Sn},${kn}` : (Math.abs(this._x1 - Sn) > epsilon || Math.abs(this._y1 - kn) > epsilon) && (this._ += "L" + Sn + "," + kn), $n && (this._ += `A${$n},${$n},0,1,1,${Qt - $n},${Zt}A${$n},${$n},0,1,1,${this._x1 = Sn},${this._y1 = kn}`);
  }
  rect(Qt, Zt, $n, Sn) {
    this._ += `M${this._x0 = this._x1 = +Qt},${this._y0 = this._y1 = +Zt}h${+$n}v${+Sn}h${-$n}Z`;
  }
  value() {
    return this._ || null;
  }
}
class Polygon {
  constructor() {
    this._ = [];
  }
  moveTo(Qt, Zt) {
    this._.push([Qt, Zt]);
  }
  closePath() {
    this._.push(this._[0].slice());
  }
  lineTo(Qt, Zt) {
    this._.push([Qt, Zt]);
  }
  value() {
    return this._.length ? this._ : null;
  }
}
let Voronoi$1 = class {
  constructor(Qt, [Zt, $n, Sn, kn] = [0, 0, 960, 500]) {
    if (!((Sn = +Sn) >= (Zt = +Zt)) || !((kn = +kn) >= ($n = +$n)))
      throw new Error("invalid bounds");
    this.delaunay = Qt, this._circumcenters = new Float64Array(Qt.points.length * 2), this.vectors = new Float64Array(Qt.points.length * 2), this.xmax = Sn, this.xmin = Zt, this.ymax = kn, this.ymin = $n, this._init();
  }
  update() {
    return this.delaunay.update(), this._init(), this;
  }
  _init() {
    const { delaunay: { points: Qt, hull: Zt, triangles: $n }, vectors: Sn } = this;
    let kn, Kn;
    const er = this.circumcenters = this._circumcenters.subarray(0, $n.length / 3 * 2);
    for (let zs = 0, Fs = 0, Bs = $n.length, Hs, Ws; zs < Bs; zs += 3, Fs += 2) {
      const Ys = $n[zs] * 2, El = $n[zs + 1] * 2, Mu = $n[zs + 2] * 2, Pl = Qt[Ys], Iu = Qt[Ys + 1], Tu = Qt[El], Au = Qt[El + 1], Nu = Qt[Mu], gm = Qt[Mu + 1], pm = Tu - Pl, zu = Au - Iu, Yu = Nu - Pl, sm = gm - Iu, mm = (pm * sm - zu * Yu) * 2;
      if (Math.abs(mm) < 1e-9) {
        if (kn === void 0) {
          kn = Kn = 0;
          for (const ym of Zt)
            kn += Qt[ym * 2], Kn += Qt[ym * 2 + 1];
          kn /= Zt.length, Kn /= Zt.length;
        }
        const hm = 1e9 * Math.sign((kn - Pl) * sm - (Kn - Iu) * Yu);
        Hs = (Pl + Nu) / 2 - hm * sm, Ws = (Iu + gm) / 2 + hm * Yu;
      } else {
        const hm = 1 / mm, ym = pm * pm + zu * zu, _m = Yu * Yu + sm * sm;
        Hs = Pl + (sm * ym - zu * _m) * hm, Ws = Iu + (pm * _m - Yu * ym) * hm;
      }
      er[Fs] = Hs, er[Fs + 1] = Ws;
    }
    let Cr = Zt[Zt.length - 1], kr, Yr = Cr * 4, Ms, Ds = Qt[2 * Cr], Ls, js = Qt[2 * Cr + 1];
    Sn.fill(0);
    for (let zs = 0; zs < Zt.length; ++zs)
      Cr = Zt[zs], kr = Yr, Ms = Ds, Ls = js, Yr = Cr * 4, Ds = Qt[2 * Cr], js = Qt[2 * Cr + 1], Sn[kr + 2] = Sn[Yr] = Ls - js, Sn[kr + 3] = Sn[Yr + 1] = Ds - Ms;
  }
  render(Qt) {
    const Zt = Qt == null ? Qt = new Path() : void 0, { delaunay: { halfedges: $n, inedges: Sn, hull: kn }, circumcenters: Kn, vectors: er } = this;
    if (kn.length <= 1)
      return null;
    for (let Yr = 0, Ms = $n.length; Yr < Ms; ++Yr) {
      const Ds = $n[Yr];
      if (Ds < Yr)
        continue;
      const Ls = Math.floor(Yr / 3) * 2, js = Math.floor(Ds / 3) * 2, zs = Kn[Ls], Fs = Kn[Ls + 1], Bs = Kn[js], Hs = Kn[js + 1];
      this._renderSegment(zs, Fs, Bs, Hs, Qt);
    }
    let Cr, kr = kn[kn.length - 1];
    for (let Yr = 0; Yr < kn.length; ++Yr) {
      Cr = kr, kr = kn[Yr];
      const Ms = Math.floor(Sn[kr] / 3) * 2, Ds = Kn[Ms], Ls = Kn[Ms + 1], js = Cr * 4, zs = this._project(Ds, Ls, er[js + 2], er[js + 3]);
      zs && this._renderSegment(Ds, Ls, zs[0], zs[1], Qt);
    }
    return Zt && Zt.value();
  }
  renderBounds(Qt) {
    const Zt = Qt == null ? Qt = new Path() : void 0;
    return Qt.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin), Zt && Zt.value();
  }
  renderCell(Qt, Zt) {
    const $n = Zt == null ? Zt = new Path() : void 0, Sn = this._clip(Qt);
    if (Sn === null || !Sn.length)
      return;
    Zt.moveTo(Sn[0], Sn[1]);
    let kn = Sn.length;
    for (; Sn[0] === Sn[kn - 2] && Sn[1] === Sn[kn - 1] && kn > 1; )
      kn -= 2;
    for (let Kn = 2; Kn < kn; Kn += 2)
      (Sn[Kn] !== Sn[Kn - 2] || Sn[Kn + 1] !== Sn[Kn - 1]) && Zt.lineTo(Sn[Kn], Sn[Kn + 1]);
    return Zt.closePath(), $n && $n.value();
  }
  *cellPolygons() {
    const { delaunay: { points: Qt } } = this;
    for (let Zt = 0, $n = Qt.length / 2; Zt < $n; ++Zt) {
      const Sn = this.cellPolygon(Zt);
      Sn && (Sn.index = Zt, yield Sn);
    }
  }
  cellPolygon(Qt) {
    const Zt = new Polygon();
    return this.renderCell(Qt, Zt), Zt.value();
  }
  _renderSegment(Qt, Zt, $n, Sn, kn) {
    let Kn;
    const er = this._regioncode(Qt, Zt), Cr = this._regioncode($n, Sn);
    er === 0 && Cr === 0 ? (kn.moveTo(Qt, Zt), kn.lineTo($n, Sn)) : (Kn = this._clipSegment(Qt, Zt, $n, Sn, er, Cr)) && (kn.moveTo(Kn[0], Kn[1]), kn.lineTo(Kn[2], Kn[3]));
  }
  contains(Qt, Zt, $n) {
    return Zt = +Zt, Zt !== Zt || ($n = +$n, $n !== $n) ? !1 : this.delaunay._step(Qt, Zt, $n) === Qt;
  }
  *neighbors(Qt) {
    const Zt = this._clip(Qt);
    if (Zt)
      for (const $n of this.delaunay.neighbors(Qt)) {
        const Sn = this._clip($n);
        if (Sn) {
          e:
            for (let kn = 0, Kn = Zt.length; kn < Kn; kn += 2)
              for (let er = 0, Cr = Sn.length; er < Cr; er += 2)
                if (Zt[kn] === Sn[er] && Zt[kn + 1] === Sn[er + 1] && Zt[(kn + 2) % Kn] === Sn[(er + Cr - 2) % Cr] && Zt[(kn + 3) % Kn] === Sn[(er + Cr - 1) % Cr]) {
                  yield $n;
                  break e;
                }
        }
      }
  }
  _cell(Qt) {
    const { circumcenters: Zt, delaunay: { inedges: $n, halfedges: Sn, triangles: kn } } = this, Kn = $n[Qt];
    if (Kn === -1)
      return null;
    const er = [];
    let Cr = Kn;
    do {
      const kr = Math.floor(Cr / 3);
      if (er.push(Zt[kr * 2], Zt[kr * 2 + 1]), Cr = Cr % 3 === 2 ? Cr - 2 : Cr + 1, kn[Cr] !== Qt)
        break;
      Cr = Sn[Cr];
    } while (Cr !== Kn && Cr !== -1);
    return er;
  }
  _clip(Qt) {
    if (Qt === 0 && this.delaunay.hull.length === 1)
      return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];
    const Zt = this._cell(Qt);
    if (Zt === null)
      return null;
    const { vectors: $n } = this, Sn = Qt * 4;
    return this._simplify($n[Sn] || $n[Sn + 1] ? this._clipInfinite(Qt, Zt, $n[Sn], $n[Sn + 1], $n[Sn + 2], $n[Sn + 3]) : this._clipFinite(Qt, Zt));
  }
  _clipFinite(Qt, Zt) {
    const $n = Zt.length;
    let Sn = null, kn, Kn, er = Zt[$n - 2], Cr = Zt[$n - 1], kr, Yr = this._regioncode(er, Cr), Ms, Ds = 0;
    for (let Ls = 0; Ls < $n; Ls += 2)
      if (kn = er, Kn = Cr, er = Zt[Ls], Cr = Zt[Ls + 1], kr = Yr, Yr = this._regioncode(er, Cr), kr === 0 && Yr === 0)
        Ms = Ds, Ds = 0, Sn ? Sn.push(er, Cr) : Sn = [er, Cr];
      else {
        let js, zs, Fs, Bs, Hs;
        if (kr === 0) {
          if ((js = this._clipSegment(kn, Kn, er, Cr, kr, Yr)) === null)
            continue;
          [zs, Fs, Bs, Hs] = js;
        } else {
          if ((js = this._clipSegment(er, Cr, kn, Kn, Yr, kr)) === null)
            continue;
          [Bs, Hs, zs, Fs] = js, Ms = Ds, Ds = this._edgecode(zs, Fs), Ms && Ds && this._edge(Qt, Ms, Ds, Sn, Sn.length), Sn ? Sn.push(zs, Fs) : Sn = [zs, Fs];
        }
        Ms = Ds, Ds = this._edgecode(Bs, Hs), Ms && Ds && this._edge(Qt, Ms, Ds, Sn, Sn.length), Sn ? Sn.push(Bs, Hs) : Sn = [Bs, Hs];
      }
    if (Sn)
      Ms = Ds, Ds = this._edgecode(Sn[0], Sn[1]), Ms && Ds && this._edge(Qt, Ms, Ds, Sn, Sn.length);
    else if (this.contains(Qt, (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 Sn;
  }
  _clipSegment(Qt, Zt, $n, Sn, kn, Kn) {
    const er = kn < Kn;
    for (er && ([Qt, Zt, $n, Sn, kn, Kn] = [$n, Sn, Qt, Zt, Kn, kn]); ; ) {
      if (kn === 0 && Kn === 0)
        return er ? [$n, Sn, Qt, Zt] : [Qt, Zt, $n, Sn];
      if (kn & Kn)
        return null;
      let Cr, kr, Yr = kn || Kn;
      Yr & 8 ? (Cr = Qt + ($n - Qt) * (this.ymax - Zt) / (Sn - Zt), kr = this.ymax) : Yr & 4 ? (Cr = Qt + ($n - Qt) * (this.ymin - Zt) / (Sn - Zt), kr = this.ymin) : Yr & 2 ? (kr = Zt + (Sn - Zt) * (this.xmax - Qt) / ($n - Qt), Cr = this.xmax) : (kr = Zt + (Sn - Zt) * (this.xmin - Qt) / ($n - Qt), Cr = this.xmin), kn ? (Qt = Cr, Zt = kr, kn = this._regioncode(Qt, Zt)) : ($n = Cr, Sn = kr, Kn = this._regioncode($n, Sn));
    }
  }
  _clipInfinite(Qt, Zt, $n, Sn, kn, Kn) {
    let er = Array.from(Zt), Cr;
    if ((Cr = this._project(er[0], er[1], $n, Sn)) && er.unshift(Cr[0], Cr[1]), (Cr = this._project(er[er.length - 2], er[er.length - 1], kn, Kn)) && er.push(Cr[0], Cr[1]), er = this._clipFinite(Qt, er))
      for (let kr = 0, Yr = er.length, Ms, Ds = this._edgecode(er[Yr - 2], er[Yr - 1]); kr < Yr; kr += 2)
        Ms = Ds, Ds = this._edgecode(er[kr], er[kr + 1]), Ms && Ds && (kr = this._edge(Qt, Ms, Ds, er, kr), Yr = er.length);
    else
      this.contains(Qt, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2) && (er = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]);
    return er;
  }
  _edge(Qt, Zt, $n, Sn, kn) {
    for (; Zt !== $n; ) {
      let Kn, er;
      switch (Zt) {
        case 5:
          Zt = 4;
          continue;
        case 4:
          Zt = 6, Kn = this.xmax, er = this.ymin;
          break;
        case 6:
          Zt = 2;
          continue;
        case 2:
          Zt = 10, Kn = this.xmax, er = this.ymax;
          break;
        case 10:
          Zt = 8;
          continue;
        case 8:
          Zt = 9, Kn = this.xmin, er = this.ymax;
          break;
        case 9:
          Zt = 1;
          continue;
        case 1:
          Zt = 5, Kn = this.xmin, er = this.ymin;
          break;
      }
      (Sn[kn] !== Kn || Sn[kn + 1] !== er) && this.contains(Qt, Kn, er) && (Sn.splice(kn, 0, Kn, er), kn += 2);
    }
    return kn;
  }
  _project(Qt, Zt, $n, Sn) {
    let kn = 1 / 0, Kn, er, Cr;
    if (Sn < 0) {
      if (Zt <= this.ymin)
        return null;
      (Kn = (this.ymin - Zt) / Sn) < kn && (Cr = this.ymin, er = Qt + (kn = Kn) * $n);
    } else if (Sn > 0) {
      if (Zt >= this.ymax)
        return null;
      (Kn = (this.ymax - Zt) / Sn) < kn && (Cr = this.ymax, er = Qt + (kn = Kn) * $n);
    }
    if ($n > 0) {
      if (Qt >= this.xmax)
        return null;
      (Kn = (this.xmax - Qt) / $n) < kn && (er = this.xmax, Cr = Zt + (kn = Kn) * Sn);
    } else if ($n < 0) {
      if (Qt <= this.xmin)
        return null;
      (Kn = (this.xmin - Qt) / $n) < kn && (er = this.xmin, Cr = Zt + (kn = Kn) * Sn);
    }
    return [er, Cr];
  }
  _edgecode(Qt, Zt) {
    return (Qt === this.xmin ? 1 : Qt === this.xmax ? 2 : 0) | (Zt === this.ymin ? 4 : Zt === this.ymax ? 8 : 0);
  }
  _regioncode(Qt, Zt) {
    return (Qt < this.xmin ? 1 : Qt > this.xmax ? 2 : 0) | (Zt < this.ymin ? 4 : Zt > this.ymax ? 8 : 0);
  }
  _simplify(Qt) {
    if (Qt && Qt.length > 4) {
      for (let Zt = 0; Zt < Qt.length; Zt += 2) {
        const $n = (Zt + 2) % Qt.length, Sn = (Zt + 4) % Qt.length;
        (Qt[Zt] === Qt[$n] && Qt[$n] === Qt[Sn] || Qt[Zt + 1] === Qt[$n + 1] && Qt[$n + 1] === Qt[Sn + 1]) && (Qt.splice($n, 2), Zt -= 2);
      }
      Qt.length || (Qt = null);
    }
    return Qt;
  }
};
const tau = 2 * Math.PI, pow = Math.pow;
function pointX(_e) {
  return _e[0];
}
function pointY(_e) {
  return _e[1];
}
function collinear(_e) {
  const { triangles: Qt, coords: Zt } = _e;
  for (let $n = 0; $n < Qt.length; $n += 3) {
    const Sn = 2 * Qt[$n], kn = 2 * Qt[$n + 1], Kn = 2 * Qt[$n + 2];
    if ((Zt[Kn] - Zt[Sn]) * (Zt[kn + 1] - Zt[Sn + 1]) - (Zt[kn] - Zt[Sn]) * (Zt[Kn + 1] - Zt[Sn + 1]) > 1e-10)
      return !1;
  }
  return !0;
}
function jitter(_e, Qt, Zt) {
  return [_e + Math.sin(_e + Qt) * Zt, Qt + Math.cos(_e - Qt) * Zt];
}
class Delaunay {
  static from(Qt, Zt = pointX, $n = pointY, Sn) {
    return new Delaunay("length" in Qt ? flatArray(Qt, Zt, $n, Sn) : Float64Array.from(flatIterable(Qt, Zt, $n, Sn)));
  }
  constructor(Qt) {
    this._delaunator = new Delaunator(Qt), this.inedges = new Int32Array(Qt.length / 2), this._hullIndex = new Int32Array(Qt.length / 2), this.points = this._delaunator.coords, this._init();
  }
  update() {
    return this._delaunator.update(), this._init(), this;
  }
  _init() {
    const Qt = this._delaunator, Zt = this.points;
    if (Qt.hull && Qt.hull.length > 2 && collinear(Qt)) {
      this.collinear = Int32Array.from({ length: Zt.length / 2 }, (Ds, Ls) => Ls).sort((Ds, Ls) => Zt[2 * Ds] - Zt[2 * Ls] || Zt[2 * Ds + 1] - Zt[2 * Ls + 1]);
      const Cr = this.collinear[0], kr = this.collinear[this.collinear.length - 1], Yr = [Zt[2 * Cr], Zt[2 * Cr + 1], Zt[2 * kr], Zt[2 * kr + 1]], Ms = 1e-8 * Math.hypot(Yr[3] - Yr[1], Yr[2] - Yr[0]);
      for (let Ds = 0, Ls = Zt.length / 2; Ds < Ls; ++Ds) {
        const js = jitter(Zt[2 * Ds], Zt[2 * Ds + 1], Ms);
        Zt[2 * Ds] = js[0], Zt[2 * Ds + 1] = js[1];
      }
      this._delaunator = new Delaunator(Zt);
    } else
      delete this.collinear;
    const $n = this.halfedges = this._delaunator.halfedges, Sn = this.hull = this._delaunator.hull, kn = this.triangles = this._delaunator.triangles, Kn = this.inedges.fill(-1), er = this._hullIndex.fill(-1);
    for (let Cr = 0, kr = $n.length; Cr < kr; ++Cr) {
      const Yr = kn[Cr % 3 === 2 ? Cr - 2 : Cr + 1];
      ($n[Cr] === -1 || Kn[Yr] === -1) && (Kn[Yr] = Cr);
    }
    for (let Cr = 0, kr = Sn.length; Cr < kr; ++Cr)
      er[Sn[Cr]] = Cr;
    Sn.length <= 2 && Sn.length > 0 && (this.triangles = new Int32Array(3).fill(-1), this.halfedges = new Int32Array(3).fill(-1), this.triangles[0] = Sn[0], Kn[Sn[0]] = 1, Sn.length === 2 && (Kn[Sn[1]] = 0, this.triangles[1] = Sn[1], this.triangles[2] = Sn[1]));
  }
  voronoi(Qt) {
    return new Voronoi$1(this, Qt);
  }
  *neighbors(Qt) {
    const { inedges: Zt, hull: $n, _hullIndex: Sn, halfedges: kn, triangles: Kn, collinear: er } = this;
    if (er) {
      const Ms = er.indexOf(Qt);
      Ms > 0 && (yield er[Ms - 1]), Ms < er.length - 1 && (yield er[Ms + 1]);
      return;
    }
    const Cr = Zt[Qt];
    if (Cr === -1)
      return;
    let kr = Cr, Yr = -1;
    do {
      if (yield Yr = Kn[kr], kr = kr % 3 === 2 ? kr - 2 : kr + 1, Kn[kr] !== Qt)
        return;
      if (kr = kn[kr], kr === -1) {
        const Ms = $n[(Sn[Qt] + 1) % $n.length];
        Ms !== Yr && (yield Ms);
        return;
      }
    } while (kr !== Cr);
  }
  find(Qt, Zt, $n = 0) {
    if (Qt = +Qt, Qt !== Qt || (Zt = +Zt, Zt !== Zt))
      return -1;
    const Sn = $n;
    let kn;
    for (; (kn = this._step($n, Qt, Zt)) >= 0 && kn !== $n && kn !== Sn; )
      $n = kn;
    return kn;
  }
  _step(Qt, Zt, $n) {
    const { inedges: Sn, hull: kn, _hullIndex: Kn, halfedges: er, triangles: Cr, points: kr } = this;
    if (Sn[Qt] === -1 || !kr.length)
      return (Qt + 1) % (kr.length >> 1);
    let Yr = Qt, Ms = pow(Zt - kr[Qt * 2], 2) + pow($n - kr[Qt * 2 + 1], 2);
    const Ds = Sn[Qt];
    let Ls = Ds;
    do {
      let js = Cr[Ls];
      const zs = pow(Zt - kr[js * 2], 2) + pow($n - kr[js * 2 + 1], 2);
      if (zs < Ms && (Ms = zs, Yr = js), Ls = Ls % 3 === 2 ? Ls - 2 : Ls + 1, Cr[Ls] !== Qt)
        break;
      if (Ls = er[Ls], Ls === -1) {
        if (Ls = kn[(Kn[Qt] + 1) % kn.length], Ls !== js && pow(Zt - kr[Ls * 2], 2) + pow($n - kr[Ls * 2 + 1], 2) < Ms)
          return Ls;
        break;
      }
    } while (Ls !== Ds);
    return Yr;
  }
  render(Qt) {
    const Zt = Qt == null ? Qt = new Path() : void 0, { points: $n, halfedges: Sn, triangles: kn } = this;
    for (let Kn = 0, er = Sn.length; Kn < er; ++Kn) {
      const Cr = Sn[Kn];
      if (Cr < Kn)
        continue;
      const kr = kn[Kn] * 2, Yr = kn[Cr] * 2;
      Qt.moveTo($n[kr], $n[kr + 1]), Qt.lineTo($n[Yr], $n[Yr + 1]);
    }
    return this.renderHull(Qt), Zt && Zt.value();
  }
  renderPoints(Qt, Zt) {
    Zt === void 0 && (!Qt || typeof Qt.moveTo != "function") && (Zt = Qt, Qt = null), Zt = Zt == null ? 2 : +Zt;
    const $n = Qt == null ? Qt = new Path() : void 0, { points: Sn } = this;
    for (let kn = 0, Kn = Sn.length; kn < Kn; kn += 2) {
      const er = Sn[kn], Cr = Sn[kn + 1];
      Qt.moveTo(er + Zt, Cr), Qt.arc(er, Cr, Zt, 0, tau);
    }
    return $n && $n.value();
  }
  renderHull(Qt) {
    const Zt = Qt == null ? Qt = new Path() : void 0, { hull: $n, points: Sn } = this, kn = $n[0] * 2, Kn = $n.length;
    Qt.moveTo(Sn[kn], Sn[kn + 1]);
    for (let er = 1; er < Kn; ++er) {
      const Cr = 2 * $n[er];
      Qt.lineTo(Sn[Cr], Sn[Cr + 1]);
    }
    return Qt.closePath(), Zt && Zt.value();
  }
  hullPolygon() {
    const Qt = new Polygon();
    return this.renderHull(Qt), Qt.value();
  }
  renderTriangle(Qt, Zt) {
    const $n = Zt == null ? Zt = new Path() : void 0, { points: Sn, triangles: kn } = this, Kn = kn[Qt *= 3] * 2, er = kn[Qt + 1] * 2, Cr = kn[Qt + 2] * 2;
    return Zt.moveTo(Sn[Kn], Sn[Kn + 1]), Zt.lineTo(Sn[er], Sn[er + 1]), Zt.lineTo(Sn[Cr], Sn[Cr + 1]), Zt.closePath(), $n && $n.value();
  }
  *trianglePolygons() {
    const { triangles: Qt } = this;
    for (let Zt = 0, $n = Qt.length / 3; Zt < $n; ++Zt)
      yield this.trianglePolygon(Zt);
  }
  trianglePolygon(Qt) {
    const Zt = new Polygon();
    return this.renderTriangle(Qt, Zt), Zt.value();
  }
}
function flatArray(_e, Qt, Zt, $n) {
  const Sn = _e.length, kn = new Float64Array(Sn * 2);
  for (let Kn = 0; Kn < Sn; ++Kn) {
    const er = _e[Kn];
    kn[Kn * 2] = Qt.call($n, er, Kn, _e), kn[Kn * 2 + 1] = Zt.call($n, er, Kn, _e);
  }
  return kn;
}
function* flatIterable(_e, Qt, Zt, $n) {
  let Sn = 0;
  for (const kn of _e)
    yield Qt.call($n, kn, Sn, _e), yield Zt.call($n, kn, Sn, _e), ++Sn;
}
function Voronoi(_e) {
  Transform$1.call(this, null, _e);
}
Voronoi.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 defaultExtent$1 = [-1e5, -1e5, 1e5, 1e5];
inherits(Voronoi, Transform$1, {
  transform(_e, Qt) {
    const Zt = _e.as || "path", $n = Qt.source;
    if (!$n || !$n.length)
      return Qt;
    let Sn = _e.size;
    Sn = Sn ? [0, 0, Sn[0], Sn[1]] : (Sn = _e.extent) ? [Sn[0][0], Sn[0][1], Sn[1][0], Sn[1][1]] : defaultExtent$1;
    const kn = this.value = Delaunay.from($n, _e.x, _e.y).voronoi(Sn);
    for (let Kn = 0, er = $n.length; Kn < er; ++Kn) {
      const Cr = kn.cellPolygon(Kn);
      $n[Kn][Zt] = Cr ? toPathString(Cr) : null;
    }
    return Qt.reflow(_e.modified()).modifies(Zt);
  }
});
function toPathString(_e) {
  const Qt = _e[0][0], Zt = _e[0][1];
  let $n = _e.length - 1;
  for (; _e[$n][0] === Qt && _e[$n][1] === Zt; --$n)
    ;
  return "M" + _e.slice(0, $n + 1).join("L") + "Z";
}
const voronoi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  voronoi: Voronoi
}, Symbol.toStringTag, { value: "Module" }));
var cloudRadians = Math.PI / 180, cw$1 = 64, ch$1 = 2048;
function cloud() {
  var _e = [256, 256], Qt, Zt, $n, Sn, kn, Kn, er, Cr = archimedeanSpiral, kr = [], Yr = Math.random, Ms = {};
  Ms.layout = function() {
    for (var js = Ds(domCanvas()), zs = zeroArray((_e[0] >> 5) * _e[1]), Fs = null, Bs = kr.length, Hs = -1, Ws = [], Ys = kr.map((Mu) => ({
      text: Qt(Mu),
      font: Zt(Mu),
      style: Sn(Mu),
      weight: kn(Mu),
      rotate: Kn(Mu),
      size: ~~($n(Mu) + 1e-14),
      padding: er(Mu),
      xoff: 0,
      yoff: 0,
      x1: 0,
      y1: 0,
      x0: 0,
      y0: 0,
      hasText: !1,
      sprite: null,
      datum: Mu
    })).sort((Mu, Pl) => Pl.size - Mu.size); ++Hs < Bs; ) {
      var El = Ys[Hs];
      El.x = _e[0] * (Yr() + 0.5) >> 1, El.y = _e[1] * (Yr() + 0.5) >> 1, cloudSprite(js, El, Ys, Hs), El.hasText && Ls(zs, El, Fs) && (Ws.push(El), Fs ? cloudBounds(Fs, El) : Fs = [{
        x: El.x + El.x0,
        y: El.y + El.y0
      }, {
        x: El.x + El.x1,
        y: El.y + El.y1
      }], El.x -= _e[0] >> 1, El.y -= _e[1] >> 1);
    }
    return Ws;
  };
  function Ds(js) {
    js.width = js.height = 1;
    var zs = Math.sqrt(js.getContext("2d").getImageData(0, 0, 1, 1).data.length >> 2);
    js.width = (cw$1 << 5) / zs, js.height = ch$1 / zs;
    var Fs = js.getContext("2d");
    return Fs.fillStyle = Fs.strokeStyle = "red", Fs.textAlign = "center", {
      context: Fs,
      ratio: zs
    };
  }
  function Ls(js, zs, Fs) {
    for (var Bs = zs.x, Hs = zs.y, Ws = Math.sqrt(_e[0] * _e[0] + _e[1] * _e[1]), Ys = Cr(_e), El = Yr() < 0.5 ? 1 : -1, Mu = -El, Pl, Iu, Tu; (Pl = Ys(Mu += El)) && (Iu = ~~Pl[0], Tu = ~~Pl[1], !(Math.min(Math.abs(Iu), Math.abs(Tu)) >= Ws)); )
      if (zs.x = Bs + Iu, zs.y = Hs + Tu, !(zs.x + zs.x0 < 0 || zs.y + zs.y0 < 0 || zs.x + zs.x1 > _e[0] || zs.y + zs.y1 > _e[1]) && (!Fs || !cloudCollide(zs, js, _e[0])) && (!Fs || collideRects(zs, Fs))) {
        for (var Au = zs.sprite, Nu = zs.width >> 5, gm = _e[0] >> 5, pm = zs.x - (Nu << 4), zu = pm & 127, Yu = 32 - zu, sm = zs.y1 - zs.y0, mm = (zs.y + zs.y0) * gm + (pm >> 5), hm, ym = 0; ym < sm; ym++) {
          hm = 0;
          for (var _m = 0; _m <= Nu; _m++)
            js[mm + _m] |= hm << Yu | (_m < Nu ? (hm = Au[ym * Nu + _m]) >>> zu : 0);
          mm += gm;
        }
        return zs.sprite = null, !0;
      }
    return !1;
  }
  return Ms.words = function(js) {
    return arguments.length ? (kr = js, Ms) : kr;
  }, Ms.size = function(js) {
    return arguments.length ? (_e = [+js[0], +js[1]], Ms) : _e;
  }, Ms.font = function(js) {
    return arguments.length ? (Zt = functor(js), Ms) : Zt;
  }, Ms.fontStyle = function(js) {
    return arguments.length ? (Sn = functor(js), Ms) : Sn;
  }, Ms.fontWeight = function(js) {
    return arguments.length ? (kn = functor(js), Ms) : kn;
  }, Ms.rotate = function(js) {
    return arguments.length ? (Kn = functor(js), Ms) : Kn;
  }, Ms.text = function(js) {
    return arguments.length ? (Qt = functor(js), Ms) : Qt;
  }, Ms.spiral = function(js) {
    return arguments.length ? (Cr = spirals[js] || js, Ms) : Cr;
  }, Ms.fontSize = function(js) {
    return arguments.length ? ($n = functor(js), Ms) : $n;
  }, Ms.padding = function(js) {
    return arguments.length ? (er = functor(js), Ms) : er;
  }, Ms.random = function(js) {
    return arguments.length ? (Yr = js, Ms) : Yr;
  }, Ms;
}
function cloudSprite(_e, Qt, Zt, $n) {
  if (!Qt.sprite) {
    var Sn = _e.context, kn = _e.ratio;
    Sn.clearRect(0, 0, (cw$1 << 5) / kn, ch$1 / kn);
    var Kn = 0, er = 0, Cr = 0, kr = Zt.length, Yr, Ms, Ds, Ls, js;
    for (--$n; ++$n < kr; ) {
      if (Qt = Zt[$n], Sn.save(), Sn.font = Qt.style + " " + Qt.weight + " " + ~~((Qt.size + 1) / kn) + "px " + Qt.font, Yr = Sn.measureText(Qt.text + "m").width * kn, Ds = Qt.size << 1, Qt.rotate) {
        var zs = Math.sin(Qt.rotate * cloudRadians), Fs = Math.cos(Qt.rotate * cloudRadians), Bs = Yr * Fs, Hs = Yr * zs, Ws = Ds * Fs, Ys = Ds * zs;
        Yr = Math.max(Math.abs(Bs + Ys), Math.abs(Bs - Ys)) + 31 >> 5 << 5, Ds = ~~Math.max(Math.abs(Hs + Ws), Math.abs(Hs - Ws));
      } else
        Yr = Yr + 31 >> 5 << 5;
      if (Ds > Cr && (Cr = Ds), Kn + Yr >= cw$1 << 5 && (Kn = 0, er += Cr, Cr = 0), er + Ds >= ch$1)
        break;
      Sn.translate((Kn + (Yr >> 1)) / kn, (er + (Ds >> 1)) / kn), Qt.rotate && Sn.rotate(Qt.rotate * cloudRadians), Sn.fillText(Qt.text, 0, 0), Qt.padding && (Sn.lineWidth = 2 * Qt.padding, Sn.strokeText(Qt.text, 0, 0)), Sn.restore(), Qt.width = Yr, Qt.height = Ds, Qt.xoff = Kn, Qt.yoff = er, Qt.x1 = Yr >> 1, Qt.y1 = Ds >> 1, Qt.x0 = -Qt.x1, Qt.y0 = -Qt.y1, Qt.hasText = !0, Kn += Yr;
    }
    for (var El = Sn.getImageData(0, 0, (cw$1 << 5) / kn, ch$1 / kn).data, Mu = []; --$n >= 0; )
      if (Qt = Zt[$n], !!Qt.hasText) {
        for (Yr = Qt.width, Ms = Yr >> 5, Ds = Qt.y1 - Qt.y0, Ls = 0; Ls < Ds * Ms; Ls++)
          Mu[Ls] = 0;
        if (Kn = Qt.xoff, Kn == null)
          return;
        er = Qt.yoff;
        var Pl = 0, Iu = -1;
        for (js = 0; js < Ds; js++) {
          for (Ls = 0; Ls < Yr; Ls++) {
            var Tu = Ms * js + (Ls >> 5), Au = El[(er + js) * (cw$1 << 5) + (Kn + Ls) << 2] ? 1 << 31 - Ls % 32 : 0;
            Mu[Tu] |= Au, Pl |= Au;
          }
          Pl ? Iu = js : (Qt.y0++, Ds--, js--, er++);
        }
        Qt.y1 = Qt.y0 + Iu, Qt.sprite = Mu.slice(0, (Qt.y1 - Qt.y0) * Ms);
      }
  }
}
function cloudCollide(_e, Qt, Zt) {
  Zt >>= 5;
  for (var $n = _e.sprite, Sn = _e.width >> 5, kn = _e.x - (Sn << 4), Kn = kn & 127, er = 32 - Kn, Cr = _e.y1 - _e.y0, kr = (_e.y + _e.y0) * Zt + (kn >> 5), Yr, Ms = 0; Ms < Cr; Ms++) {
    Yr = 0;
    for (var Ds = 0; Ds <= Sn; Ds++)
      if ((Yr << er | (Ds < Sn ? (Yr = $n[Ms * Sn + Ds]) >>> Kn : 0)) & Qt[kr + Ds])
        return !0;
    kr += Zt;
  }
  return !1;
}
function cloudBounds(_e, Qt) {
  var Zt = _e[0], $n = _e[1];
  Qt.x + Qt.x0 < Zt.x && (Zt.x = Qt.x + Qt.x0), Qt.y + Qt.y0 < Zt.y && (Zt.y = Qt.y + Qt.y0), Qt.x + Qt.x1 > $n.x && ($n.x = Qt.x + Qt.x1), Qt.y + Qt.y1 > $n.y && ($n.y = Qt.y + Qt.y1);
}
function collideRects(_e, Qt) {
  return _e.x + _e.x1 > Qt[0].x && _e.x + _e.x0 < Qt[1].x && _e.y + _e.y1 > Qt[0].y && _e.y + _e.y0 < Qt[1].y;
}
function archimedeanSpiral(_e) {
  var Qt = _e[0] / _e[1];
  return function(Zt) {
    return [Qt * (Zt *= 0.1) * Math.cos(Zt), Zt * Math.sin(Zt)];
  };
}
function rectangularSpiral(_e) {
  var Qt = 4, Zt = Qt * _e[0] / _e[1], $n = 0, Sn = 0;
  return function(kn) {
    var Kn = kn < 0 ? -1 : 1;
    switch (Math.sqrt(1 + 4 * Kn * kn) - Kn & 3) {
      case 0:
        $n += Zt;
        break;
      case 1:
        Sn += Qt;
        break;
      case 2:
        $n -= Zt;
        break;
      default:
        Sn -= Qt;
        break;
    }
    return [$n, Sn];
  };
}
function zeroArray(_e) {
  for (var Qt = [], Zt = -1; ++Zt < _e; )
    Qt[Zt] = 0;
  return Qt;
}
function functor(_e) {
  return typeof _e == "function" ? _e : function() {
    return _e;
  };
}
var spirals = {
  archimedean: archimedeanSpiral,
  rectangular: rectangularSpiral
};
const Output = ["x", "y", "font", "fontSize", "fontStyle", "fontWeight", "angle"], Params$1 = ["text", "font", "rotate", "fontSize", "fontStyle", "fontWeight"];
function Wordcloud(_e) {
  Transform$1.call(this, cloud(), _e);
}
Wordcloud.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: Output
  }]
};
inherits(Wordcloud, Transform$1, {
  transform(_e, Qt) {
    _e.size && !(_e.size[0] && _e.size[1]) && error("Wordcloud size dimensions must be non-zero.");
    function Zt(js) {
      const zs = _e[js];
      return isFunction$1(zs) && Qt.modified(zs.fields);
    }
    const $n = _e.modified();
    if (!($n || Qt.changed(Qt.ADD_REM) || Params$1.some(Zt)))
      return;
    const Sn = Qt.materialize(Qt.SOURCE).source, kn = this.value, Kn = _e.as || Output;
    let er = _e.fontSize || 14, Cr;
    if (isFunction$1(er) ? Cr = _e.fontSizeRange : er = constant$7(er), Cr) {
      const js = er, zs = scale$4("sqrt")().domain(extent(Sn, js)).range(Cr);
      er = (Fs) => zs(js(Fs));
    }
    Sn.forEach((js) => {
      js[Kn[0]] = NaN, js[Kn[1]] = NaN, js[Kn[3]] = 0;
    });
    const kr = kn.words(Sn).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(er).random(random).layout(), Yr = kn.size(), Ms = Yr[0] >> 1, Ds = Yr[1] >> 1, Ls = kr.length;
    for (let js = 0, zs, Fs; js < Ls; ++js)
      zs = kr[js], Fs = zs.datum, Fs[Kn[0]] = zs.x + Ms, Fs[Kn[1]] = zs.y + Ds, Fs[Kn[2]] = zs.font, Fs[Kn[3]] = zs.size, Fs[Kn[4]] = zs.style, Fs[Kn[5]] = zs.weight, Fs[Kn[6]] = zs.rotate;
    return Qt.reflow($n).modifies(Kn);
  }
});
const wordcloud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  wordcloud: Wordcloud
}, Symbol.toStringTag, { value: "Module" })), array8 = (_e) => new Uint8Array(_e), array16 = (_e) => new Uint16Array(_e), array32 = (_e) => new Uint32Array(_e);
function Bitmaps() {
  let _e = 8, Qt = [], Zt = array32(0), $n = array$2(0, _e), Sn = array$2(0, _e);
  return {
    data: () => Qt,
    seen: () => Zt = lengthen(Zt, Qt.length),
    add(kn) {
      for (let Kn = 0, er = Qt.length, Cr = kn.length, kr; Kn < Cr; ++Kn)
        kr = kn[Kn], kr._index = er++, Qt.push(kr);
    },
    remove(kn, Kn) {
      const er = Qt.length, Cr = Array(er - kn), kr = Qt;
      let Yr, Ms, Ds;
      for (Ms = 0; !Kn[Ms] && Ms < er; ++Ms)
        Cr[Ms] = Qt[Ms], kr[Ms] = Ms;
      for (Ds = Ms; Ms < er; ++Ms)
        Yr = Qt[Ms], Kn[Ms] ? kr[Ms] = -1 : (kr[Ms] = Ds, $n[Ds] = $n[Ms], Sn[Ds] = Sn[Ms], Cr[Ds] = Yr, Yr._index = Ds++), $n[Ms] = 0;
      return Qt = Cr, kr;
    },
    size: () => Qt.length,
    curr: () => $n,
    prev: () => Sn,
    reset: (kn) => Sn[kn] = $n[kn],
    all: () => _e < 257 ? 255 : _e < 65537 ? 65535 : 4294967295,
    set(kn, Kn) {
      $n[kn] |= Kn;
    },
    clear(kn, Kn) {
      $n[kn] &= ~Kn;
    },
    resize(kn, Kn) {
      const er = $n.length;
      (kn > er || Kn > _e) && (_e = Math.max(Kn, _e), $n = array$2(kn, _e, $n), Sn = array$2(kn, _e));
    }
  };
}
function lengthen(_e, Qt, Zt) {
  return _e.length >= Qt ? _e : (Zt = Zt || new _e.constructor(Qt), Zt.set(_e), Zt);
}
function array$2(_e, Qt, Zt) {
  const $n = (Qt < 257 ? array8 : Qt < 65537 ? array16 : array32)(_e);
  return Zt && $n.set(Zt), $n;
}
function Dimension(_e, Qt, Zt) {
  const $n = 1 << Qt;
  return {
    one: $n,
    zero: ~$n,
    range: Zt.slice(),
    bisect: _e.bisect,
    index: _e.index,
    size: _e.size,
    onAdd(Sn, kn) {
      const Kn = this, er = Kn.bisect(Kn.range, Sn.value), Cr = Sn.index, kr = er[0], Yr = er[1], Ms = Cr.length;
      let Ds;
      for (Ds = 0; Ds < kr; ++Ds)
        kn[Cr[Ds]] |= $n;
      for (Ds = Yr; Ds < Ms; ++Ds)
        kn[Cr[Ds]] |= $n;
      return Kn;
    }
  };
}
function SortedIndex() {
  let _e = array32(0), Qt = [], Zt = 0;
  function $n(er, Cr, kr) {
    if (!Cr.length)
      return [];
    const Yr = Zt, Ms = Cr.length, Ds = array32(Ms);
    let Ls = Array(Ms), js, zs, Fs;
    for (Fs = 0; Fs < Ms; ++Fs)
      Ls[Fs] = er(Cr[Fs]), Ds[Fs] = Fs;
    if (Ls = sort(Ls, Ds), Yr)
      js = Qt, zs = _e, Qt = Array(Yr + Ms), _e = array32(Yr + Ms), merge$1(kr, js, zs, Yr, Ls, Ds, Ms, Qt, _e);
    else {
      if (kr > 0)
        for (Fs = 0; Fs < Ms; ++Fs)
          Ds[Fs] += kr;
      Qt = Ls, _e = Ds;
    }
    return Zt = Yr + Ms, {
      index: Ds,
      value: Ls
    };
  }
  function Sn(er, Cr) {
    const kr = Zt;
    let Yr, Ms, Ds;
    for (Ms = 0; !Cr[_e[Ms]] && Ms < kr; ++Ms)
      ;
    for (Ds = Ms; Ms < kr; ++Ms)
      Cr[Yr = _e[Ms]] || (_e[Ds] = Yr, Qt[Ds] = Qt[Ms], ++Ds);
    Zt = kr - er;
  }
  function kn(er) {
    for (let Cr = 0, kr = Zt; Cr < kr; ++Cr)
      _e[Cr] = er[_e[Cr]];
  }
  function Kn(er, Cr) {
    let kr;
    return Cr ? kr = Cr.length : (Cr = Qt, kr = Zt), [bisectLeft$1(Cr, er[0], 0, kr), bisectRight$1(Cr, er[1], 0, kr)];
  }
  return {
    insert: $n,
    remove: Sn,
    bisect: Kn,
    reindex: kn,
    index: () => _e,
    size: () => Zt
  };
}
function sort(_e, Qt) {
  return _e.sort.call(Qt, (Zt, $n) => {
    const Sn = _e[Zt], kn = _e[$n];
    return Sn < kn ? -1 : Sn > kn ? 1 : 0;
  }), permute(_e, Qt);
}
function merge$1(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr) {
  let kr = 0, Yr = 0, Ms;
  for (Ms = 0; kr < $n && Yr < Kn; ++Ms)
    Qt[kr] < Sn[Yr] ? (er[Ms] = Qt[kr], Cr[Ms] = Zt[kr++]) : (er[Ms] = Sn[Yr], Cr[Ms] = kn[Yr++] + _e);
  for (; kr < $n; ++kr, ++Ms)
    er[Ms] = Qt[kr], Cr[Ms] = Zt[kr];
  for (; Yr < Kn; ++Yr, ++Ms)
    er[Ms] = Sn[Yr], Cr[Ms] = kn[Yr] + _e;
}
function CrossFilter(_e) {
  Transform$1.call(this, Bitmaps(), _e), this._indices = null, this._dims = null;
}
CrossFilter.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
    }
  }]
};
inherits(CrossFilter, Transform$1, {
  transform(_e, Qt) {
    if (this._dims) {
      var Zt = _e.modified("fields") || _e.fields.some(($n) => Qt.modified($n.fields));
      return Zt ? this.reinit(_e, Qt) : this.eval(_e, Qt);
    } else
      return this.init(_e, Qt);
  },
  init(_e, Qt) {
    const Zt = _e.fields, $n = _e.query, Sn = this._indices = {}, kn = this._dims = [], Kn = $n.length;
    let er = 0, Cr, kr;
    for (; er < Kn; ++er)
      Cr = Zt[er].fname, kr = Sn[Cr] || (Sn[Cr] = SortedIndex()), kn.push(Dimension(kr, er, $n[er]));
    return this.eval(_e, Qt);
  },
  reinit(_e, Qt) {
    const Zt = Qt.materialize().fork(), $n = _e.fields, Sn = _e.query, kn = this._indices, Kn = this._dims, er = this.value, Cr = er.curr(), kr = er.prev(), Yr = er.all(), Ms = Zt.rem = Zt.add, Ds = Zt.mod, Ls = Sn.length, js = {};
    let zs, Fs, Bs, Hs, Ws, Ys, El, Mu, Pl;
    if (kr.set(Cr), Qt.rem.length && (Ws = this.remove(_e, Qt, Zt)), Qt.add.length && er.add(Qt.add), Qt.mod.length)
      for (Ys = {}, Hs = Qt.mod, El = 0, Mu = Hs.length; El < Mu; ++El)
        Ys[Hs[El]._index] = 1;
    for (El = 0; El < Ls; ++El)
      Pl = $n[El], (!Kn[El] || _e.modified("fields", El) || Qt.modified(Pl.fields)) && (Bs = Pl.fname, (zs = js[Bs]) || (kn[Bs] = Fs = SortedIndex(), js[Bs] = zs = Fs.insert(Pl, Qt.source, 0)), Kn[El] = Dimension(Fs, El, Sn[El]).onAdd(zs, Cr));
    for (El = 0, Mu = er.data().length; El < Mu; ++El)
      Ws[El] || (kr[El] !== Cr[El] ? Ms.push(El) : Ys[El] && Cr[El] !== Yr && Ds.push(El));
    return er.mask = (1 << Ls) - 1, Zt;
  },
  eval(_e, Qt) {
    const Zt = Qt.materialize().fork(), $n = this._dims.length;
    let Sn = 0;
    return Qt.rem.length && (this.remove(_e, Qt, Zt), Sn |= (1 << $n) - 1), _e.modified("query") && !_e.modified("fields") && (Sn |= this.update(_e, Qt, Zt)), Qt.add.length && (this.insert(_e, Qt, Zt), Sn |= (1 << $n) - 1), Qt.mod.length && (this.modify(Qt, Zt), Sn |= (1 << $n) - 1), this.value.mask = Sn, Zt;
  },
  insert(_e, Qt, Zt) {
    const $n = Qt.add, Sn = this.value, kn = this._dims, Kn = this._indices, er = _e.fields, Cr = {}, kr = Zt.add, Yr = Sn.size() + $n.length, Ms = kn.length;
    let Ds = Sn.size(), Ls, js, zs;
    Sn.resize(Yr, Ms), Sn.add($n);
    const Fs = Sn.curr(), Bs = Sn.prev(), Hs = Sn.all();
    for (Ls = 0; Ls < Ms; ++Ls)
      js = er[Ls].fname, zs = Cr[js] || (Cr[js] = Kn[js].insert(er[Ls], $n, Ds)), kn[Ls].onAdd(zs, Fs);
    for (; Ds < Yr; ++Ds)
      Bs[Ds] = Hs, Fs[Ds] !== Hs && kr.push(Ds);
  },
  modify(_e, Qt) {
    const Zt = Qt.mod, $n = this.value, Sn = $n.curr(), kn = $n.all(), Kn = _e.mod;
    let er, Cr, kr;
    for (er = 0, Cr = Kn.length; er < Cr; ++er)
      kr = Kn[er]._index, Sn[kr] !== kn && Zt.push(kr);
  },
  remove(_e, Qt, Zt) {
    const $n = this._indices, Sn = this.value, kn = Sn.curr(), Kn = Sn.prev(), er = Sn.all(), Cr = {}, kr = Zt.rem, Yr = Qt.rem;
    let Ms, Ds, Ls, js;
    for (Ms = 0, Ds = Yr.length; Ms < Ds; ++Ms)
      Ls = Yr[Ms]._index, Cr[Ls] = 1, Kn[Ls] = js = kn[Ls], kn[Ls] = er, js !== er && kr.push(Ls);
    for (Ls in $n)
      $n[Ls].remove(Ds, Cr);
    return this.reindex(Qt, Ds, Cr), Cr;
  },
  // reindex filters and indices after propagation completes
  reindex(_e, Qt, Zt) {
    const $n = this._indices, Sn = this.value;
    _e.runAfter(() => {
      const kn = Sn.remove(Qt, Zt);
      for (const Kn in $n)
        $n[Kn].reindex(kn);
    });
  },
  update(_e, Qt, Zt) {
    const $n = this._dims, Sn = _e.query, kn = Qt.stamp, Kn = $n.length;
    let er = 0, Cr, kr;
    for (Zt.filters = 0, kr = 0; kr < Kn; ++kr)
      _e.modified("query", kr) && (Cr = kr, ++er);
    if (er === 1)
      er = $n[Cr].one, this.incrementOne($n[Cr], Sn[Cr], Zt.add, Zt.rem);
    else
      for (kr = 0, er = 0; kr < Kn; ++kr)
        _e.modified("query", kr) && (er |= $n[kr].one, this.incrementAll($n[kr], Sn[kr], kn, Zt.add), Zt.rem = Zt.add);
    return er;
  },
  incrementAll(_e, Qt, Zt, $n) {
    const Sn = this.value, kn = Sn.seen(), Kn = Sn.curr(), er = Sn.prev(), Cr = _e.index(), kr = _e.bisect(_e.range), Yr = _e.bisect(Qt), Ms = Yr[0], Ds = Yr[1], Ls = kr[0], js = kr[1], zs = _e.one;
    let Fs, Bs, Hs;
    if (Ms < Ls)
      for (Fs = Ms, Bs = Math.min(Ls, Ds); Fs < Bs; ++Fs)
        Hs = Cr[Fs], kn[Hs] !== Zt && (er[Hs] = Kn[Hs], kn[Hs] = Zt, $n.push(Hs)), Kn[Hs] ^= zs;
    else if (Ms > Ls)
      for (Fs = Ls, Bs = Math.min(Ms, js); Fs < Bs; ++Fs)
        Hs = Cr[Fs], kn[Hs] !== Zt && (er[Hs] = Kn[Hs], kn[Hs] = Zt, $n.push(Hs)), Kn[Hs] ^= zs;
    if (Ds > js)
      for (Fs = Math.max(Ms, js), Bs = Ds; Fs < Bs; ++Fs)
        Hs = Cr[Fs], kn[Hs] !== Zt && (er[Hs] = Kn[Hs], kn[Hs] = Zt, $n.push(Hs)), Kn[Hs] ^= zs;
    else if (Ds < js)
      for (Fs = Math.max(Ls, Ds), Bs = js; Fs < Bs; ++Fs)
        Hs = Cr[Fs], kn[Hs] !== Zt && (er[Hs] = Kn[Hs], kn[Hs] = Zt, $n.push(Hs)), Kn[Hs] ^= zs;
    _e.range = Qt.slice();
  },
  incrementOne(_e, Qt, Zt, $n) {
    const Sn = this.value, kn = Sn.curr(), Kn = _e.index(), er = _e.bisect(_e.range), Cr = _e.bisect(Qt), kr = Cr[0], Yr = Cr[1], Ms = er[0], Ds = er[1], Ls = _e.one;
    let js, zs, Fs;
    if (kr < Ms)
      for (js = kr, zs = Math.min(Ms, Yr); js < zs; ++js)
        Fs = Kn[js], kn[Fs] ^= Ls, Zt.push(Fs);
    else if (kr > Ms)
      for (js = Ms, zs = Math.min(kr, Ds); js < zs; ++js)
        Fs = Kn[js], kn[Fs] ^= Ls, $n.push(Fs);
    if (Yr > Ds)
      for (js = Math.max(kr, Ds), zs = Yr; js < zs; ++js)
        Fs = Kn[js], kn[Fs] ^= Ls, Zt.push(Fs);
    else if (Yr < Ds)
      for (js = Math.max(Ms, Yr), zs = Ds; js < zs; ++js)
        Fs = Kn[js], kn[Fs] ^= Ls, $n.push(Fs);
    _e.range = Qt.slice();
  }
});
function ResolveFilter(_e) {
  Transform$1.call(this, null, _e);
}
ResolveFilter.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."
  }]
};
inherits(ResolveFilter, Transform$1, {
  transform(_e, Qt) {
    const Zt = ~(_e.ignore || 0), $n = _e.filter, Sn = $n.mask;
    if (!(Sn & Zt))
      return Qt.StopPropagation;
    const kn = Qt.fork(Qt.ALL), Kn = $n.data(), er = $n.curr(), Cr = $n.prev(), kr = (Yr) => er[Yr] & Zt ? null : Kn[Yr];
    return kn.filter(kn.MOD, kr), Sn & Sn - 1 ? (kn.filter(kn.ADD, (Yr) => {
      const Ms = er[Yr] & Zt;
      return !Ms && Ms ^ Cr[Yr] & Zt ? Kn[Yr] : null;
    }), kn.filter(kn.REM, (Yr) => {
      const Ms = er[Yr] & Zt;
      return Ms && !(Ms ^ (Ms ^ Cr[Yr] & Zt)) ? Kn[Yr] : null;
    })) : (kn.filter(kn.ADD, kr), kn.filter(kn.REM, (Yr) => (er[Yr] & Zt) === Sn ? Kn[Yr] : null)), kn.filter(kn.SOURCE, (Yr) => kr(Yr._index));
  }
});
const xf$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  crossfilter: CrossFilter,
  resolvefilter: ResolveFilter
}, Symbol.toStringTag, { value: "Module" })), RawCode = "RawCode", Literal = "Literal", Property = "Property", Identifier = "Identifier", ArrayExpression = "ArrayExpression", BinaryExpression = "BinaryExpression", CallExpression = "CallExpression", ConditionalExpression = "ConditionalExpression", LogicalExpression = "LogicalExpression", MemberExpression = "MemberExpression", ObjectExpression = "ObjectExpression", UnaryExpression = "UnaryExpression";
function ASTNode(_e) {
  this.type = _e;
}
ASTNode.prototype.visit = function(_e) {
  let Qt, Zt, $n;
  if (_e(this))
    return 1;
  for (Qt = children$1(this), Zt = 0, $n = Qt.length; Zt < $n; ++Zt)
    if (Qt[Zt].visit(_e))
      return 1;
};
function children$1(_e) {
  switch (_e.type) {
    case ArrayExpression:
      return _e.elements;
    case BinaryExpression:
    case LogicalExpression:
      return [_e.left, _e.right];
    case CallExpression:
      return [_e.callee].concat(_e.arguments);
    case ConditionalExpression:
      return [_e.test, _e.consequent, _e.alternate];
    case MemberExpression:
      return [_e.object, _e.property];
    case ObjectExpression:
      return _e.properties;
    case Property:
      return [_e.key, _e.value];
    case UnaryExpression:
      return [_e.argument];
    case Identifier:
    case Literal:
    case RawCode:
    default:
      return [];
  }
}
var TokenName, source, index, length, lookahead, TokenBooleanLiteral = 1, TokenEOF = 2, TokenIdentifier = 3, TokenKeyword = 4, TokenNullLiteral = 5, TokenNumericLiteral = 6, TokenPunctuator = 7, TokenStringLiteral = 8, TokenRegularExpression = 9;
TokenName = {};
TokenName[TokenBooleanLiteral] = "Boolean";
TokenName[TokenEOF] = "<end>";
TokenName[TokenIdentifier] = "Identifier";
TokenName[TokenKeyword] = "Keyword";
TokenName[TokenNullLiteral] = "Null";
TokenName[TokenNumericLiteral] = "Numeric";
TokenName[TokenPunctuator] = "Punctuator";
TokenName[TokenStringLiteral] = "String";
TokenName[TokenRegularExpression] = "RegularExpression";
var SyntaxArrayExpression = "ArrayExpression", SyntaxBinaryExpression = "BinaryExpression", SyntaxCallExpression = "CallExpression", SyntaxConditionalExpression = "ConditionalExpression", SyntaxIdentifier = "Identifier", SyntaxLiteral = "Literal", SyntaxLogicalExpression = "LogicalExpression", SyntaxMemberExpression = "MemberExpression", SyntaxObjectExpression = "ObjectExpression", SyntaxProperty = "Property", SyntaxUnaryExpression = "UnaryExpression", MessageUnexpectedToken = "Unexpected token %0", MessageUnexpectedNumber = "Unexpected number", MessageUnexpectedString = "Unexpected string", MessageUnexpectedIdentifier = "Unexpected identifier", MessageUnexpectedReserved = "Unexpected reserved word", MessageUnexpectedEOS = "Unexpected end of input", MessageInvalidRegExp = "Invalid regular expression", MessageUnterminatedRegExp = "Invalid regular expression: missing /", MessageStrictOctalLiteral = "Octal literals are not allowed in strict mode.", MessageStrictDuplicateProperty = "Duplicate data property in object literal not allowed in strict mode", ILLEGAL$1 = "ILLEGAL", DISABLED = "Disabled.", RegexNonAsciiIdentifierStart = 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]"), RegexNonAsciiIdentifierPart = 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 assert(_e, Qt) {
  if (!_e)
    throw new Error("ASSERT: " + Qt);
}
function isDecimalDigit(_e) {
  return _e >= 48 && _e <= 57;
}
function isHexDigit(_e) {
  return "0123456789abcdefABCDEF".indexOf(_e) >= 0;
}
function isOctalDigit(_e) {
  return "01234567".indexOf(_e) >= 0;
}
function isWhiteSpace(_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 isLineTerminator(_e) {
  return _e === 10 || _e === 13 || _e === 8232 || _e === 8233;
}
function isIdentifierStart(_e) {
  return _e === 36 || _e === 95 || // $ (dollar) and _ (underscore)
  _e >= 65 && _e <= 90 || // A..Z
  _e >= 97 && _e <= 122 || // a..z
  _e === 92 || // \ (backslash)
  _e >= 128 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(_e));
}
function isIdentifierPart(_e) {
  return _e === 36 || _e === 95 || // $ (dollar) and _ (underscore)
  _e >= 65 && _e <= 90 || // A..Z
  _e >= 97 && _e <= 122 || // a..z
  _e >= 48 && _e <= 57 || // 0..9
  _e === 92 || // \ (backslash)
  _e >= 128 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(_e));
}
const keywords$1 = {
  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 skipComment() {
  for (; index < length; ) {
    const _e = source.charCodeAt(index);
    if (isWhiteSpace(_e) || isLineTerminator(_e))
      ++index;
    else
      break;
  }
}
function scanHexEscape(_e) {
  var Qt, Zt, $n, Sn = 0;
  for (Zt = _e === "u" ? 4 : 2, Qt = 0; Qt < Zt; ++Qt)
    index < length && isHexDigit(source[index]) ? ($n = source[index++], Sn = Sn * 16 + "0123456789abcdef".indexOf($n.toLowerCase())) : throwError({}, MessageUnexpectedToken, ILLEGAL$1);
  return String.fromCharCode(Sn);
}
function scanUnicodeCodePointEscape() {
  var _e, Qt, Zt, $n;
  for (_e = source[index], Qt = 0, _e === "}" && throwError({}, MessageUnexpectedToken, ILLEGAL$1); index < length && (_e = source[index++], !!isHexDigit(_e)); )
    Qt = Qt * 16 + "0123456789abcdef".indexOf(_e.toLowerCase());
  return (Qt > 1114111 || _e !== "}") && throwError({}, MessageUnexpectedToken, ILLEGAL$1), Qt <= 65535 ? String.fromCharCode(Qt) : (Zt = (Qt - 65536 >> 10) + 55296, $n = (Qt - 65536 & 1023) + 56320, String.fromCharCode(Zt, $n));
}
function getEscapedIdentifier() {
  var _e, Qt;
  for (_e = source.charCodeAt(index++), Qt = String.fromCharCode(_e), _e === 92 && (source.charCodeAt(index) !== 117 && throwError({}, MessageUnexpectedToken, ILLEGAL$1), ++index, _e = scanHexEscape("u"), (!_e || _e === "\\" || !isIdentifierStart(_e.charCodeAt(0))) && throwError({}, MessageUnexpectedToken, ILLEGAL$1), Qt = _e); index < length && (_e = source.charCodeAt(index), !!isIdentifierPart(_e)); )
    ++index, Qt += String.fromCharCode(_e), _e === 92 && (Qt = Qt.substr(0, Qt.length - 1), source.charCodeAt(index) !== 117 && throwError({}, MessageUnexpectedToken, ILLEGAL$1), ++index, _e = scanHexEscape("u"), (!_e || _e === "\\" || !isIdentifierPart(_e.charCodeAt(0))) && throwError({}, MessageUnexpectedToken, ILLEGAL$1), Qt += _e);
  return Qt;
}
function getIdentifier() {
  var _e, Qt;
  for (_e = index++; index < length; ) {
    if (Qt = source.charCodeAt(index), Qt === 92)
      return index = _e, getEscapedIdentifier();
    if (isIdentifierPart(Qt))
      ++index;
    else
      break;
  }
  return source.slice(_e, index);
}
function scanIdentifier() {
  var _e, Qt, Zt;
  return _e = index, Qt = source.charCodeAt(index) === 92 ? getEscapedIdentifier() : getIdentifier(), Qt.length === 1 ? Zt = TokenIdentifier : keywords$1.hasOwnProperty(Qt) ? Zt = TokenKeyword : Qt === "null" ? Zt = TokenNullLiteral : Qt === "true" || Qt === "false" ? Zt = TokenBooleanLiteral : Zt = TokenIdentifier, {
    type: Zt,
    value: Qt,
    start: _e,
    end: index
  };
}
function scanPunctuator() {
  var _e = index, Qt = source.charCodeAt(index), Zt, $n = source[index], Sn, kn, Kn;
  switch (Qt) {
    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 ++index, {
        type: TokenPunctuator,
        value: String.fromCharCode(Qt),
        start: _e,
        end: index
      };
    default:
      if (Zt = source.charCodeAt(index + 1), Zt === 61)
        switch (Qt) {
          case 43:
          case 45:
          case 47:
          case 60:
          case 62:
          case 94:
          case 124:
          case 37:
          case 38:
          case 42:
            return index += 2, {
              type: TokenPunctuator,
              value: String.fromCharCode(Qt) + String.fromCharCode(Zt),
              start: _e,
              end: index
            };
          case 33:
          case 61:
            return index += 2, source.charCodeAt(index) === 61 && ++index, {
              type: TokenPunctuator,
              value: source.slice(_e, index),
              start: _e,
              end: index
            };
        }
  }
  if (Kn = source.substr(index, 4), Kn === ">>>=")
    return index += 4, {
      type: TokenPunctuator,
      value: Kn,
      start: _e,
      end: index
    };
  if (kn = Kn.substr(0, 3), kn === ">>>" || kn === "<<=" || kn === ">>=")
    return index += 3, {
      type: TokenPunctuator,
      value: kn,
      start: _e,
      end: index
    };
  if (Sn = kn.substr(0, 2), $n === Sn[1] && "+-<>&|".indexOf($n) >= 0 || Sn === "=>")
    return index += 2, {
      type: TokenPunctuator,
      value: Sn,
      start: _e,
      end: index
    };
  if (Sn === "//" && throwError({}, MessageUnexpectedToken, ILLEGAL$1), "<>=!+-*%&|^/".indexOf($n) >= 0)
    return ++index, {
      type: TokenPunctuator,
      value: $n,
      start: _e,
      end: index
    };
  throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
function scanHexLiteral(_e) {
  let Qt = "";
  for (; index < length && isHexDigit(source[index]); )
    Qt += source[index++];
  return Qt.length === 0 && throwError({}, MessageUnexpectedToken, ILLEGAL$1), isIdentifierStart(source.charCodeAt(index)) && throwError({}, MessageUnexpectedToken, ILLEGAL$1), {
    type: TokenNumericLiteral,
    value: parseInt("0x" + Qt, 16),
    start: _e,
    end: index
  };
}
function scanOctalLiteral(_e) {
  let Qt = "0" + source[index++];
  for (; index < length && isOctalDigit(source[index]); )
    Qt += source[index++];
  return (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) && throwError({}, MessageUnexpectedToken, ILLEGAL$1), {
    type: TokenNumericLiteral,
    value: parseInt(Qt, 8),
    octal: !0,
    start: _e,
    end: index
  };
}
function scanNumericLiteral() {
  var _e, Qt, Zt;
  if (Zt = source[index], assert(isDecimalDigit(Zt.charCodeAt(0)) || Zt === ".", "Numeric literal must start with a decimal digit or a decimal point"), Qt = index, _e = "", Zt !== ".") {
    if (_e = source[index++], Zt = source[index], _e === "0") {
      if (Zt === "x" || Zt === "X")
        return ++index, scanHexLiteral(Qt);
      if (isOctalDigit(Zt))
        return scanOctalLiteral(Qt);
      Zt && isDecimalDigit(Zt.charCodeAt(0)) && throwError({}, MessageUnexpectedToken, ILLEGAL$1);
    }
    for (; isDecimalDigit(source.charCodeAt(index)); )
      _e += source[index++];
    Zt = source[index];
  }
  if (Zt === ".") {
    for (_e += source[index++]; isDecimalDigit(source.charCodeAt(index)); )
      _e += source[index++];
    Zt = source[index];
  }
  if (Zt === "e" || Zt === "E")
    if (_e += source[index++], Zt = source[index], (Zt === "+" || Zt === "-") && (_e += source[index++]), isDecimalDigit(source.charCodeAt(index)))
      for (; isDecimalDigit(source.charCodeAt(index)); )
        _e += source[index++];
    else
      throwError({}, MessageUnexpectedToken, ILLEGAL$1);
  return isIdentifierStart(source.charCodeAt(index)) && throwError({}, MessageUnexpectedToken, ILLEGAL$1), {
    type: TokenNumericLiteral,
    value: parseFloat(_e),
    start: Qt,
    end: index
  };
}
function scanStringLiteral() {
  var _e = "", Qt, Zt, $n, Sn, kn = !1;
  for (Qt = source[index], assert(Qt === "'" || Qt === '"', "String literal must starts with a quote"), Zt = index, ++index; index < length; )
    if ($n = source[index++], $n === Qt) {
      Qt = "";
      break;
    } else if ($n === "\\")
      if ($n = source[index++], !$n || !isLineTerminator($n.charCodeAt(0)))
        switch ($n) {
          case "u":
          case "x":
            source[index] === "{" ? (++index, _e += scanUnicodeCodePointEscape()) : _e += scanHexEscape($n);
            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:
            isOctalDigit($n) ? (Sn = "01234567".indexOf($n), Sn !== 0 && (kn = !0), index < length && isOctalDigit(source[index]) && (kn = !0, Sn = Sn * 8 + "01234567".indexOf(source[index++]), "0123".indexOf($n) >= 0 && index < length && isOctalDigit(source[index]) && (Sn = Sn * 8 + "01234567".indexOf(source[index++]))), _e += String.fromCharCode(Sn)) : _e += $n;
            break;
        }
      else
        $n === "\r" && source[index] === `
` && ++index;
    else {
      if (isLineTerminator($n.charCodeAt(0)))
        break;
      _e += $n;
    }
  return Qt !== "" && throwError({}, MessageUnexpectedToken, ILLEGAL$1), {
    type: TokenStringLiteral,
    value: _e,
    octal: kn,
    start: Zt,
    end: index
  };
}
function testRegExp(_e, Qt) {
  let Zt = _e;
  Qt.indexOf("u") >= 0 && (Zt = Zt.replace(/\\u\{([0-9a-fA-F]+)\}/g, ($n, Sn) => {
    if (parseInt(Sn, 16) <= 1114111)
      return "x";
    throwError({}, MessageInvalidRegExp);
  }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x"));
  try {
    new RegExp(Zt);
  } catch {
    throwError({}, MessageInvalidRegExp);
  }
  try {
    return new RegExp(_e, Qt);
  } catch {
    return null;
  }
}
function scanRegExpBody() {
  var _e, Qt, Zt, $n, Sn;
  for (_e = source[index], assert(_e === "/", "Regular expression literal must start with a slash"), Qt = source[index++], Zt = !1, $n = !1; index < length; )
    if (_e = source[index++], Qt += _e, _e === "\\")
      _e = source[index++], isLineTerminator(_e.charCodeAt(0)) && throwError({}, MessageUnterminatedRegExp), Qt += _e;
    else if (isLineTerminator(_e.charCodeAt(0)))
      throwError({}, MessageUnterminatedRegExp);
    else if (Zt)
      _e === "]" && (Zt = !1);
    else if (_e === "/") {
      $n = !0;
      break;
    } else
      _e === "[" && (Zt = !0);
  return $n || throwError({}, MessageUnterminatedRegExp), Sn = Qt.substr(1, Qt.length - 2), {
    value: Sn,
    literal: Qt
  };
}
function scanRegExpFlags() {
  var _e, Qt, Zt;
  for (Qt = "", Zt = ""; index < length && (_e = source[index], !!isIdentifierPart(_e.charCodeAt(0))); )
    ++index, _e === "\\" && index < length ? throwError({}, MessageUnexpectedToken, ILLEGAL$1) : (Zt += _e, Qt += _e);
  return Zt.search(/[^gimuy]/g) >= 0 && throwError({}, MessageInvalidRegExp, Zt), {
    value: Zt,
    literal: Qt
  };
}
function scanRegExp() {
  var _e, Qt, Zt, $n;
  return lookahead = null, skipComment(), _e = index, Qt = scanRegExpBody(), Zt = scanRegExpFlags(), $n = testRegExp(Qt.value, Zt.value), {
    literal: Qt.literal + Zt.literal,
    value: $n,
    regex: {
      pattern: Qt.value,
      flags: Zt.value
    },
    start: _e,
    end: index
  };
}
function isIdentifierName(_e) {
  return _e.type === TokenIdentifier || _e.type === TokenKeyword || _e.type === TokenBooleanLiteral || _e.type === TokenNullLiteral;
}
function advance() {
  if (skipComment(), index >= length)
    return {
      type: TokenEOF,
      start: index,
      end: index
    };
  const _e = source.charCodeAt(index);
  return isIdentifierStart(_e) ? scanIdentifier() : _e === 40 || _e === 41 || _e === 59 ? scanPunctuator() : _e === 39 || _e === 34 ? scanStringLiteral() : _e === 46 ? isDecimalDigit(source.charCodeAt(index + 1)) ? scanNumericLiteral() : scanPunctuator() : isDecimalDigit(_e) ? scanNumericLiteral() : scanPunctuator();
}
function lex() {
  const _e = lookahead;
  return index = _e.end, lookahead = advance(), index = _e.end, _e;
}
function peek() {
  const _e = index;
  lookahead = advance(), index = _e;
}
function finishArrayExpression(_e) {
  const Qt = new ASTNode(SyntaxArrayExpression);
  return Qt.elements = _e, Qt;
}
function finishBinaryExpression(_e, Qt, Zt) {
  const $n = new ASTNode(_e === "||" || _e === "&&" ? SyntaxLogicalExpression : SyntaxBinaryExpression);
  return $n.operator = _e, $n.left = Qt, $n.right = Zt, $n;
}
function finishCallExpression(_e, Qt) {
  const Zt = new ASTNode(SyntaxCallExpression);
  return Zt.callee = _e, Zt.arguments = Qt, Zt;
}
function finishConditionalExpression(_e, Qt, Zt) {
  const $n = new ASTNode(SyntaxConditionalExpression);
  return $n.test = _e, $n.consequent = Qt, $n.alternate = Zt, $n;
}
function finishIdentifier(_e) {
  const Qt = new ASTNode(SyntaxIdentifier);
  return Qt.name = _e, Qt;
}
function finishLiteral(_e) {
  const Qt = new ASTNode(SyntaxLiteral);
  return Qt.value = _e.value, Qt.raw = source.slice(_e.start, _e.end), _e.regex && (Qt.raw === "//" && (Qt.raw = "/(?:)/"), Qt.regex = _e.regex), Qt;
}
function finishMemberExpression(_e, Qt, Zt) {
  const $n = new ASTNode(SyntaxMemberExpression);
  return $n.computed = _e === "[", $n.object = Qt, $n.property = Zt, $n.computed || (Zt.member = !0), $n;
}
function finishObjectExpression(_e) {
  const Qt = new ASTNode(SyntaxObjectExpression);
  return Qt.properties = _e, Qt;
}
function finishProperty(_e, Qt, Zt) {
  const $n = new ASTNode(SyntaxProperty);
  return $n.key = Qt, $n.value = Zt, $n.kind = _e, $n;
}
function finishUnaryExpression(_e, Qt) {
  const Zt = new ASTNode(SyntaxUnaryExpression);
  return Zt.operator = _e, Zt.argument = Qt, Zt.prefix = !0, Zt;
}
function throwError(_e, Qt) {
  var Zt, $n = Array.prototype.slice.call(arguments, 2), Sn = Qt.replace(/%(\d)/g, (kn, Kn) => (assert(Kn < $n.length, "Message reference must be in range"), $n[Kn]));
  throw Zt = new Error(Sn), Zt.index = index, Zt.description = Sn, Zt;
}
function throwUnexpected(_e) {
  _e.type === TokenEOF && throwError(_e, MessageUnexpectedEOS), _e.type === TokenNumericLiteral && throwError(_e, MessageUnexpectedNumber), _e.type === TokenStringLiteral && throwError(_e, MessageUnexpectedString), _e.type === TokenIdentifier && throwError(_e, MessageUnexpectedIdentifier), _e.type === TokenKeyword && throwError(_e, MessageUnexpectedReserved), throwError(_e, MessageUnexpectedToken, _e.value);
}
function expect(_e) {
  const Qt = lex();
  (Qt.type !== TokenPunctuator || Qt.value !== _e) && throwUnexpected(Qt);
}
function match(_e) {
  return lookahead.type === TokenPunctuator && lookahead.value === _e;
}
function matchKeyword(_e) {
  return lookahead.type === TokenKeyword && lookahead.value === _e;
}
function parseArrayInitialiser() {
  const _e = [];
  for (index = lookahead.start, expect("["); !match("]"); )
    match(",") ? (lex(), _e.push(null)) : (_e.push(parseConditionalExpression()), match("]") || expect(","));
  return lex(), finishArrayExpression(_e);
}
function parseObjectPropertyKey() {
  index = lookahead.start;
  const _e = lex();
  return _e.type === TokenStringLiteral || _e.type === TokenNumericLiteral ? (_e.octal && throwError(_e, MessageStrictOctalLiteral), finishLiteral(_e)) : finishIdentifier(_e.value);
}
function parseObjectProperty() {
  var _e, Qt, Zt, $n;
  if (index = lookahead.start, _e = lookahead, _e.type === TokenIdentifier)
    return Zt = parseObjectPropertyKey(), expect(":"), $n = parseConditionalExpression(), finishProperty("init", Zt, $n);
  if (_e.type === TokenEOF || _e.type === TokenPunctuator)
    throwUnexpected(_e);
  else
    return Qt = parseObjectPropertyKey(), expect(":"), $n = parseConditionalExpression(), finishProperty("init", Qt, $n);
}
function parseObjectInitialiser() {
  var _e = [], Qt, Zt, $n, Sn = {}, kn = String;
  for (index = lookahead.start, expect("{"); !match("}"); )
    Qt = parseObjectProperty(), Qt.key.type === SyntaxIdentifier ? Zt = Qt.key.name : Zt = kn(Qt.key.value), $n = "$" + Zt, Object.prototype.hasOwnProperty.call(Sn, $n) ? throwError({}, MessageStrictDuplicateProperty) : Sn[$n] = !0, _e.push(Qt), match("}") || expect(",");
  return expect("}"), finishObjectExpression(_e);
}
function parseGroupExpression() {
  expect("(");
  const _e = parseExpression$1();
  return expect(")"), _e;
}
const legalKeywords = {
  if: 1
};
function parsePrimaryExpression() {
  var _e, Qt, Zt;
  if (match("("))
    return parseGroupExpression();
  if (match("["))
    return parseArrayInitialiser();
  if (match("{"))
    return parseObjectInitialiser();
  if (_e = lookahead.type, index = lookahead.start, _e === TokenIdentifier || legalKeywords[lookahead.value])
    Zt = finishIdentifier(lex().value);
  else if (_e === TokenStringLiteral || _e === TokenNumericLiteral)
    lookahead.octal && throwError(lookahead, MessageStrictOctalLiteral), Zt = finishLiteral(lex());
  else {
    if (_e === TokenKeyword)
      throw new Error(DISABLED);
    _e === TokenBooleanLiteral ? (Qt = lex(), Qt.value = Qt.value === "true", Zt = finishLiteral(Qt)) : _e === TokenNullLiteral ? (Qt = lex(), Qt.value = null, Zt = finishLiteral(Qt)) : match("/") || match("/=") ? (Zt = finishLiteral(scanRegExp()), peek()) : throwUnexpected(lex());
  }
  return Zt;
}
function parseArguments() {
  const _e = [];
  if (expect("("), !match(")"))
    for (; index < length && (_e.push(parseConditionalExpression()), !match(")")); )
      expect(",");
  return expect(")"), _e;
}
function parseNonComputedProperty() {
  index = lookahead.start;
  const _e = lex();
  return isIdentifierName(_e) || throwUnexpected(_e), finishIdentifier(_e.value);
}
function parseNonComputedMember() {
  return expect("."), parseNonComputedProperty();
}
function parseComputedMember() {
  expect("[");
  const _e = parseExpression$1();
  return expect("]"), _e;
}
function parseLeftHandSideExpressionAllowCall() {
  var _e, Qt, Zt;
  for (_e = parsePrimaryExpression(); ; )
    if (match("."))
      Zt = parseNonComputedMember(), _e = finishMemberExpression(".", _e, Zt);
    else if (match("("))
      Qt = parseArguments(), _e = finishCallExpression(_e, Qt);
    else if (match("["))
      Zt = parseComputedMember(), _e = finishMemberExpression("[", _e, Zt);
    else
      break;
  return _e;
}
function parsePostfixExpression() {
  const _e = parseLeftHandSideExpressionAllowCall();
  if (lookahead.type === TokenPunctuator && (match("++") || match("--")))
    throw new Error(DISABLED);
  return _e;
}
function parseUnaryExpression() {
  var _e, Qt;
  if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword)
    Qt = parsePostfixExpression();
  else {
    if (match("++") || match("--"))
      throw new Error(DISABLED);
    if (match("+") || match("-") || match("~") || match("!"))
      _e = lex(), Qt = parseUnaryExpression(), Qt = finishUnaryExpression(_e.value, Qt);
    else {
      if (matchKeyword("delete") || matchKeyword("void") || matchKeyword("typeof"))
        throw new Error(DISABLED);
      Qt = parsePostfixExpression();
    }
  }
  return Qt;
}
function binaryPrecedence(_e) {
  let Qt = 0;
  if (_e.type !== TokenPunctuator && _e.type !== TokenKeyword)
    return 0;
  switch (_e.value) {
    case "||":
      Qt = 1;
      break;
    case "&&":
      Qt = 2;
      break;
    case "|":
      Qt = 3;
      break;
    case "^":
      Qt = 4;
      break;
    case "&":
      Qt = 5;
      break;
    case "==":
    case "!=":
    case "===":
    case "!==":
      Qt = 6;
      break;
    case "<":
    case ">":
    case "<=":
    case ">=":
    case "instanceof":
    case "in":
      Qt = 7;
      break;
    case "<<":
    case ">>":
    case ">>>":
      Qt = 8;
      break;
    case "+":
    case "-":
      Qt = 9;
      break;
    case "*":
    case "/":
    case "%":
      Qt = 11;
      break;
  }
  return Qt;
}
function parseBinaryExpression() {
  var _e, Qt, Zt, $n, Sn, kn, Kn, er, Cr, kr;
  if (_e = lookahead, Cr = parseUnaryExpression(), $n = lookahead, Sn = binaryPrecedence($n), Sn === 0)
    return Cr;
  for ($n.prec = Sn, lex(), Qt = [_e, lookahead], Kn = parseUnaryExpression(), kn = [Cr, $n, Kn]; (Sn = binaryPrecedence(lookahead)) > 0; ) {
    for (; kn.length > 2 && Sn <= kn[kn.length - 2].prec; )
      Kn = kn.pop(), er = kn.pop().value, Cr = kn.pop(), Qt.pop(), Zt = finishBinaryExpression(er, Cr, Kn), kn.push(Zt);
    $n = lex(), $n.prec = Sn, kn.push($n), Qt.push(lookahead), Zt = parseUnaryExpression(), kn.push(Zt);
  }
  for (kr = kn.length - 1, Zt = kn[kr], Qt.pop(); kr > 1; )
    Qt.pop(), Zt = finishBinaryExpression(kn[kr - 1].value, kn[kr - 2], Zt), kr -= 2;
  return Zt;
}
function parseConditionalExpression() {
  var _e, Qt, Zt;
  return _e = parseBinaryExpression(), match("?") && (lex(), Qt = parseConditionalExpression(), expect(":"), Zt = parseConditionalExpression(), _e = finishConditionalExpression(_e, Qt, Zt)), _e;
}
function parseExpression$1() {
  const _e = parseConditionalExpression();
  if (match(","))
    throw new Error(DISABLED);
  return _e;
}
function parser$1(_e) {
  source = _e, index = 0, length = source.length, lookahead = null, peek();
  const Qt = parseExpression$1();
  if (lookahead.type !== TokenEOF)
    throw new Error("Unexpect token after expression.");
  return Qt;
}
var Constants$1 = {
  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 Functions$1(_e) {
  function Qt(Kn, er, Cr, kr) {
    let Yr = _e(er[0]);
    return Cr && (Yr = Cr + "(" + Yr + ")", Cr.lastIndexOf("new ", 0) === 0 && (Yr = "(" + Yr + ")")), Yr + "." + Kn + (kr < 0 ? "" : kr === 0 ? "()" : "(" + er.slice(1).map(_e).join(",") + ")");
  }
  function Zt(Kn, er, Cr) {
    return (kr) => Qt(Kn, kr, er, Cr);
  }
  const $n = "new Date", Sn = "String", kn = "RegExp";
  return {
    // MATH functions
    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",
    hypot: "Math.hypot",
    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(Kn) {
      Kn.length < 3 && error("Missing arguments to clamp function."), Kn.length > 3 && error("Too many arguments to clamp function.");
      const er = Kn.map(_e);
      return "Math.max(" + er[1] + ", Math.min(" + er[2] + "," + er[0] + "))";
    },
    // DATE functions
    now: "Date.now",
    utc: "Date.UTC",
    datetime: $n,
    date: Zt("getDate", $n, 0),
    day: Zt("getDay", $n, 0),
    year: Zt("getFullYear", $n, 0),
    month: Zt("getMonth", $n, 0),
    hours: Zt("getHours", $n, 0),
    minutes: Zt("getMinutes", $n, 0),
    seconds: Zt("getSeconds", $n, 0),
    milliseconds: Zt("getMilliseconds", $n, 0),
    time: Zt("getTime", $n, 0),
    timezoneoffset: Zt("getTimezoneOffset", $n, 0),
    utcdate: Zt("getUTCDate", $n, 0),
    utcday: Zt("getUTCDay", $n, 0),
    utcyear: Zt("getUTCFullYear", $n, 0),
    utcmonth: Zt("getUTCMonth", $n, 0),
    utchours: Zt("getUTCHours", $n, 0),
    utcminutes: Zt("getUTCMinutes", $n, 0),
    utcseconds: Zt("getUTCSeconds", $n, 0),
    utcmilliseconds: Zt("getUTCMilliseconds", $n, 0),
    // sequence functions
    length: Zt("length", null, -1),
    // STRING functions
    parseFloat: "parseFloat",
    parseInt: "parseInt",
    upper: Zt("toUpperCase", Sn, 0),
    lower: Zt("toLowerCase", Sn, 0),
    substring: Zt("substring", Sn),
    split: Zt("split", Sn),
    trim: Zt("trim", Sn, 0),
    // REGEXP functions
    regexp: kn,
    test: Zt("test", kn),
    // Control Flow functions
    if: function(Kn) {
      Kn.length < 3 && error("Missing arguments to if function."), Kn.length > 3 && error("Too many arguments to if function.");
      const er = Kn.map(_e);
      return "(" + er[0] + "?" + er[1] + ":" + er[2] + ")";
    }
  };
}
function stripQuotes(_e) {
  const Qt = _e && _e.length - 1;
  return Qt && (_e[0] === '"' && _e[Qt] === '"' || _e[0] === "'" && _e[Qt] === "'") ? _e.slice(1, -1) : _e;
}
function codegen(_e) {
  _e = _e || {};
  const Qt = _e.allowed ? toSet(_e.allowed) : {}, Zt = _e.forbidden ? toSet(_e.forbidden) : {}, $n = _e.constants || Constants$1, Sn = (_e.functions || Functions$1)(Ms), kn = _e.globalvar, Kn = _e.fieldvar, er = isFunction$1(kn) ? kn : (js) => `${kn}["${js}"]`;
  let Cr = {}, kr = {}, Yr = 0;
  function Ms(js) {
    if (isString(js))
      return js;
    const zs = Ds[js.type];
    return zs == null && error("Unsupported type: " + js.type), zs(js);
  }
  const Ds = {
    Literal: (js) => js.raw,
    Identifier: (js) => {
      const zs = js.name;
      return Yr > 0 ? zs : has$1(Zt, zs) ? error("Illegal identifier: " + zs) : has$1($n, zs) ? $n[zs] : has$1(Qt, zs) ? zs : (Cr[zs] = 1, er(zs));
    },
    MemberExpression: (js) => {
      const zs = !js.computed, Fs = Ms(js.object);
      zs && (Yr += 1);
      const Bs = Ms(js.property);
      return Fs === Kn && (kr[stripQuotes(Bs)] = 1), zs && (Yr -= 1), Fs + (zs ? "." + Bs : "[" + Bs + "]");
    },
    CallExpression: (js) => {
      js.callee.type !== "Identifier" && error("Illegal callee type: " + js.callee.type);
      const zs = js.callee.name, Fs = js.arguments, Bs = has$1(Sn, zs) && Sn[zs];
      return Bs || error("Unrecognized function: " + zs), isFunction$1(Bs) ? Bs(Fs) : Bs + "(" + Fs.map(Ms).join(",") + ")";
    },
    ArrayExpression: (js) => "[" + js.elements.map(Ms).join(",") + "]",
    BinaryExpression: (js) => "(" + Ms(js.left) + " " + js.operator + " " + Ms(js.right) + ")",
    UnaryExpression: (js) => "(" + js.operator + Ms(js.argument) + ")",
    ConditionalExpression: (js) => "(" + Ms(js.test) + "?" + Ms(js.consequent) + ":" + Ms(js.alternate) + ")",
    LogicalExpression: (js) => "(" + Ms(js.left) + js.operator + Ms(js.right) + ")",
    ObjectExpression: (js) => "{" + js.properties.map(Ms).join(",") + "}",
    Property: (js) => {
      Yr += 1;
      const zs = Ms(js.key);
      return Yr -= 1, zs + ":" + Ms(js.value);
    }
  };
  function Ls(js) {
    const zs = {
      code: Ms(js),
      globals: Object.keys(Cr),
      fields: Object.keys(kr)
    };
    return Cr = {}, kr = {}, zs;
  }
  return Ls.functions = Sn, Ls.constants = $n, Ls;
}
function ascending$1(_e, Qt) {
  return _e == null || Qt == null ? NaN : _e < Qt ? -1 : _e > Qt ? 1 : _e >= Qt ? 0 : NaN;
}
function descending(_e, Qt) {
  return _e == null || Qt == null ? NaN : Qt < _e ? -1 : Qt > _e ? 1 : Qt >= _e ? 0 : NaN;
}
function bisector(_e) {
  let Qt, Zt, $n;
  _e.length !== 2 ? (Qt = ascending$1, Zt = (er, Cr) => ascending$1(_e(er), Cr), $n = (er, Cr) => _e(er) - Cr) : (Qt = _e === ascending$1 || _e === descending ? _e : zero$2, Zt = _e, $n = _e);
  function Sn(er, Cr, kr = 0, Yr = er.length) {
    if (kr < Yr) {
      if (Qt(Cr, Cr) !== 0)
        return Yr;
      do {
        const Ms = kr + Yr >>> 1;
        Zt(er[Ms], Cr) < 0 ? kr = Ms + 1 : Yr = Ms;
      } while (kr < Yr);
    }
    return kr;
  }
  function kn(er, Cr, kr = 0, Yr = er.length) {
    if (kr < Yr) {
      if (Qt(Cr, Cr) !== 0)
        return Yr;
      do {
        const Ms = kr + Yr >>> 1;
        Zt(er[Ms], Cr) <= 0 ? kr = Ms + 1 : Yr = Ms;
      } while (kr < Yr);
    }
    return kr;
  }
  function Kn(er, Cr, kr = 0, Yr = er.length) {
    const Ms = Sn(er, Cr, kr, Yr - 1);
    return Ms > kr && $n(er[Ms - 1], Cr) > -$n(er[Ms], Cr) ? Ms - 1 : Ms;
  }
  return { left: Sn, center: Kn, right: kn };
}
function zero$2() {
  return 0;
}
function intersection(_e, ...Qt) {
  _e = new InternSet(_e), Qt = Qt.map(set$1);
  e:
    for (const Zt of _e)
      for (const $n of Qt)
        if (!$n.has(Zt)) {
          _e.delete(Zt);
          continue e;
        }
  return _e;
}
function set$1(_e) {
  return _e instanceof InternSet ? _e : new InternSet(_e);
}
function union(..._e) {
  const Qt = new InternSet();
  for (const Zt of _e)
    for (const $n of Zt)
      Qt.add($n);
  return Qt;
}
const Intersect = "intersect", Union = "union", VlMulti = "vlMulti", VlPoint = "vlPoint", Or$1 = "or", And = "and", SelectionId = "_vgsid_", $selectionId = field$1(SelectionId), TYPE_ENUM = "E", TYPE_RANGE_INC = "R", TYPE_RANGE_EXC = "R-E", TYPE_RANGE_LE = "R-LE", TYPE_RANGE_RE = "R-RE", UNIT_INDEX = "index:unit";
function testPoint(_e, Qt) {
  for (var Zt = Qt.fields, $n = Qt.values, Sn = Zt.length, kn = 0, Kn, er; kn < Sn; ++kn)
    if (er = Zt[kn], er.getter = field$1.getter || field$1(er.field), Kn = er.getter(_e), isDate$1(Kn) && (Kn = toNumber(Kn)), isDate$1($n[kn]) && ($n[kn] = toNumber($n[kn])), isDate$1($n[kn][0]) && ($n[kn] = $n[kn].map(toNumber)), er.type === TYPE_ENUM) {
      if (isArray($n[kn]) ? $n[kn].indexOf(Kn) < 0 : Kn !== $n[kn])
        return !1;
    } else if (er.type === TYPE_RANGE_INC) {
      if (!inrange(Kn, $n[kn]))
        return !1;
    } else if (er.type === TYPE_RANGE_RE) {
      if (!inrange(Kn, $n[kn], !0, !1))
        return !1;
    } else if (er.type === TYPE_RANGE_EXC) {
      if (!inrange(Kn, $n[kn], !1, !1))
        return !1;
    } else if (er.type === TYPE_RANGE_LE && !inrange(Kn, $n[kn], !1, !0))
      return !1;
  return !0;
}
function selectionTest(_e, Qt, Zt) {
  for (var $n = this.context.data[_e], Sn = $n ? $n.values.value : [], kn = $n ? $n[UNIT_INDEX] && $n[UNIT_INDEX].value : void 0, Kn = Zt === Intersect, er = Sn.length, Cr = 0, kr, Yr, Ms, Ds, Ls; Cr < er; ++Cr)
    if (kr = Sn[Cr], kn && Kn) {
      if (Yr = Yr || {}, Ms = Yr[Ds = kr.unit] || 0, Ms === -1)
        continue;
      if (Ls = testPoint(Qt, kr), Yr[Ds] = Ls ? -1 : ++Ms, Ls && kn.size === 1)
        return !0;
      if (!Ls && Ms === kn.get(Ds).count)
        return !1;
    } else if (Ls = testPoint(Qt, kr), Kn ^ Ls)
      return Ls;
  return er && Kn;
}
const bisect = bisector($selectionId), bisectLeft = bisect.left, bisectRight = bisect.right;
function selectionIdTest(_e, Qt, Zt) {
  const $n = this.context.data[_e], Sn = $n ? $n.values.value : [], kn = $n ? $n[UNIT_INDEX] && $n[UNIT_INDEX].value : void 0, Kn = Zt === Intersect, er = $selectionId(Qt), Cr = bisectLeft(Sn, er);
  if (Cr === Sn.length || $selectionId(Sn[Cr]) !== er)
    return !1;
  if (kn && Kn) {
    if (kn.size === 1)
      return !0;
    if (bisectRight(Sn, er) - Cr < kn.size)
      return !1;
  }
  return !0;
}
function selectionTuples(_e, Qt) {
  return _e.map((Zt) => extend$1(Qt.fields ? {
    values: Qt.fields.map(($n) => ($n.getter || ($n.getter = field$1($n.field)))(Zt.datum))
  } : {
    [SelectionId]: $selectionId(Zt.datum)
  }, Qt));
}
function selectionResolve(_e, Qt, Zt, $n) {
  for (var Sn = this.context.data[_e], kn = Sn ? Sn.values.value : [], Kn = {}, er = {}, Cr = {}, kr, Yr, Ms, Ds, Ls, js, zs, Fs, Bs, Hs, Ws = kn.length, Ys = 0, El, Mu; Ys < Ws; ++Ys)
    if (kr = kn[Ys], Ds = kr.unit, Yr = kr.fields, Ms = kr.values, Yr && Ms) {
      for (El = 0, Mu = Yr.length; El < Mu; ++El)
        Ls = Yr[El], zs = Kn[Ls.field] || (Kn[Ls.field] = {}), Fs = zs[Ds] || (zs[Ds] = []), Cr[Ls.field] = Bs = Ls.type.charAt(0), Hs = ops[`${Bs}_union`], zs[Ds] = Hs(Fs, array$6(Ms[El]));
      Zt && (Fs = er[Ds] || (er[Ds] = []), Fs.push(array$6(Ms).reduce((Pl, Iu, Tu) => (Pl[Yr[Tu].field] = Iu, Pl), {})));
    } else
      Ls = SelectionId, js = $selectionId(kr), zs = Kn[Ls] || (Kn[Ls] = {}), Fs = zs[Ds] || (zs[Ds] = []), Fs.push(js), Zt && (Fs = er[Ds] || (er[Ds] = []), Fs.push({
        [SelectionId]: js
      }));
  if (Qt = Qt || Union, Kn[SelectionId] ? Kn[SelectionId] = ops[`${SelectionId}_${Qt}`](...Object.values(Kn[SelectionId])) : Object.keys(Kn).forEach((Pl) => {
    Kn[Pl] = Object.keys(Kn[Pl]).map((Iu) => Kn[Pl][Iu]).reduce((Iu, Tu) => Iu === void 0 ? Tu : ops[`${Cr[Pl]}_${Qt}`](Iu, Tu));
  }), kn = Object.keys(er), Zt && kn.length) {
    const Pl = $n ? VlPoint : VlMulti;
    Kn[Pl] = Qt === Union ? {
      [Or$1]: kn.reduce((Iu, Tu) => (Iu.push(...er[Tu]), Iu), [])
    } : {
      [And]: kn.map((Iu) => ({
        [Or$1]: er[Iu]
      }))
    };
  }
  return Kn;
}
var ops = {
  [`${SelectionId}_union`]: union,
  [`${SelectionId}_intersect`]: intersection,
  E_union: function(_e, Qt) {
    if (!_e.length)
      return Qt;
    for (var Zt = 0, $n = Qt.length; Zt < $n; ++Zt)
      _e.indexOf(Qt[Zt]) < 0 && _e.push(Qt[Zt]);
    return _e;
  },
  E_intersect: function(_e, Qt) {
    return _e.length ? _e.filter((Zt) => Qt.indexOf(Zt) >= 0) : Qt;
  },
  R_union: function(_e, Qt) {
    var Zt = toNumber(Qt[0]), $n = toNumber(Qt[1]);
    return Zt > $n && (Zt = Qt[1], $n = Qt[0]), _e.length ? (_e[0] > Zt && (_e[0] = Zt), _e[1] < $n && (_e[1] = $n), _e) : [Zt, $n];
  },
  R_intersect: function(_e, Qt) {
    var Zt = toNumber(Qt[0]), $n = toNumber(Qt[1]);
    return Zt > $n && (Zt = Qt[1], $n = Qt[0]), _e.length ? $n < _e[0] || _e[1] < Zt ? [] : (_e[0] < Zt && (_e[0] = Zt), _e[1] > $n && (_e[1] = $n), _e) : [Zt, $n];
  }
};
const DataPrefix$1 = ":", IndexPrefix$1 = "@";
function selectionVisitor(_e, Qt, Zt, $n) {
  Qt[0].type !== Literal && error("First argument to selection functions must be a string literal.");
  const Sn = Qt[0].value, kn = Qt.length >= 2 && peek$1(Qt).value, Kn = "unit", er = IndexPrefix$1 + Kn, Cr = DataPrefix$1 + Sn;
  kn === Intersect && !has$1($n, er) && ($n[er] = Zt.getData(Sn).indataRef(Zt, Kn)), has$1($n, Cr) || ($n[Cr] = Zt.getData(Sn).tuplesRef());
}
function data$1(_e) {
  const Qt = this.context.data[_e];
  return Qt ? Qt.values.value : [];
}
function indata(_e, Qt, Zt) {
  const $n = this.context.data[_e]["index:" + Qt], Sn = $n ? $n.value.get(Zt) : void 0;
  return Sn && Sn.count;
}
function setdata(_e, Qt) {
  const Zt = this.context.dataflow, $n = this.context.data[_e], Sn = $n.input;
  return Zt.pulse(Sn, Zt.changeset().remove(truthy).insert(Qt)), 1;
}
function encode(_e, Qt, Zt) {
  if (_e) {
    const $n = this.context.dataflow, Sn = _e.mark.source;
    $n.pulse(Sn, $n.changeset().encode(_e, Qt));
  }
  return Zt !== void 0 ? Zt : _e;
}
const wrap = (_e) => function(Qt, Zt) {
  return this.context.dataflow.locale()[_e](Zt)(Qt);
}, format = wrap("format"), timeFormat$1 = wrap("timeFormat"), utcFormat = wrap("utcFormat"), timeParse = wrap("timeParse"), utcParse = wrap("utcParse"), dateObj = new Date(2e3, 0, 1);
function time(_e, Qt, Zt) {
  return !Number.isInteger(_e) || !Number.isInteger(Qt) ? "" : (dateObj.setYear(2e3), dateObj.setMonth(_e), dateObj.setDate(Qt), timeFormat$1.call(this, dateObj, Zt));
}
function monthFormat(_e) {
  return time.call(this, _e, 1, "%B");
}
function monthAbbrevFormat(_e) {
  return time.call(this, _e, 1, "%b");
}
function dayFormat(_e) {
  return time.call(this, 0, 2 + _e, "%A");
}
function dayAbbrevFormat(_e) {
  return time.call(this, 0, 2 + _e, "%a");
}
const DataPrefix = ":", IndexPrefix = "@", ScalePrefix = "%", SignalPrefix = "$";
function dataVisitor(_e, Qt, Zt, $n) {
  Qt[0].type !== Literal && error("First argument to data functions must be a string literal.");
  const Sn = Qt[0].value, kn = DataPrefix + Sn;
  if (!has$1(kn, $n))
    try {
      $n[kn] = Zt.getData(Sn).tuplesRef();
    } catch {
    }
}
function indataVisitor(_e, Qt, Zt, $n) {
  Qt[0].type !== Literal && error("First argument to indata must be a string literal."), Qt[1].type !== Literal && error("Second argument to indata must be a string literal.");
  const Sn = Qt[0].value, kn = Qt[1].value, Kn = IndexPrefix + kn;
  has$1(Kn, $n) || ($n[Kn] = Zt.getData(Sn).indataRef(Zt, kn));
}
function scaleVisitor(_e, Qt, Zt, $n) {
  if (Qt[0].type === Literal)
    addScaleDependency(Zt, $n, Qt[0].value);
  else
    for (_e in Zt.scales)
      addScaleDependency(Zt, $n, _e);
}
function addScaleDependency(_e, Qt, Zt) {
  const $n = ScalePrefix + Zt;
  if (!has$1(Qt, $n))
    try {
      Qt[$n] = _e.scaleRef(Zt);
    } catch {
    }
}
function getScale(_e, Qt) {
  if (isFunction$1(_e))
    return _e;
  if (isString(_e)) {
    const Zt = Qt.scales[_e];
    return Zt && isRegisteredScale(Zt.value) ? Zt.value : void 0;
  }
}
function internalScaleFunctions(_e, Qt, Zt) {
  Qt.__bandwidth = (Sn) => Sn && Sn.bandwidth ? Sn.bandwidth() : 0, Zt._bandwidth = scaleVisitor, Zt._range = scaleVisitor, Zt._scale = scaleVisitor;
  const $n = (Sn) => "_[" + (Sn.type === Literal ? $(ScalePrefix + Sn.value) : $(ScalePrefix) + "+" + _e(Sn)) + "]";
  return {
    _bandwidth: (Sn) => `this.__bandwidth(${$n(Sn[0])})`,
    _range: (Sn) => `${$n(Sn[0])}.range()`,
    _scale: (Sn) => `${$n(Sn[0])}(${_e(Sn[1])})`
  };
}
function geoMethod(_e, Qt) {
  return function(Zt, $n, Sn) {
    if (Zt) {
      const kn = getScale(Zt, (Sn || this).context);
      return kn && kn.path[_e]($n);
    } else
      return Qt($n);
  };
}
const geoArea = geoMethod("area", geoArea$1), geoBounds = geoMethod("bounds", geoBounds$1), geoCentroid = geoMethod("centroid", geoCentroid$1);
function inScope(_e) {
  const Qt = this.context.group;
  let Zt = !1;
  if (Qt)
    for (; _e; ) {
      if (_e === Qt) {
        Zt = !0;
        break;
      }
      _e = _e.mark.group;
    }
  return Zt;
}
function log$1(_e, Qt, Zt) {
  try {
    _e[Qt].apply(_e, ["EXPRESSION"].concat([].slice.call(Zt)));
  } catch ($n) {
    _e.warn($n);
  }
  return Zt[Zt.length - 1];
}
function warn() {
  return log$1(this.context.dataflow, "warn", arguments);
}
function info() {
  return log$1(this.context.dataflow, "info", arguments);
}
function debug$2() {
  return log$1(this.context.dataflow, "debug", arguments);
}
function channel_luminance_value(_e) {
  const Qt = _e / 255;
  return Qt <= 0.03928 ? Qt / 12.92 : Math.pow((Qt + 0.055) / 1.055, 2.4);
}
function luminance(_e) {
  const Qt = rgb(_e), Zt = channel_luminance_value(Qt.r), $n = channel_luminance_value(Qt.g), Sn = channel_luminance_value(Qt.b);
  return 0.2126 * Zt + 0.7152 * $n + 0.0722 * Sn;
}
function contrast(_e, Qt) {
  const Zt = luminance(_e), $n = luminance(Qt), Sn = Math.max(Zt, $n), kn = Math.min(Zt, $n);
  return (Sn + 0.05) / (kn + 0.05);
}
function merge() {
  const _e = [].slice.call(arguments);
  return _e.unshift({}), extend$1(..._e);
}
function equal(_e, Qt) {
  return _e === Qt || _e !== _e && Qt !== Qt ? !0 : isArray(_e) ? isArray(Qt) && _e.length === Qt.length ? equalArray(_e, Qt) : !1 : isObject(_e) && isObject(Qt) ? equalObject(_e, Qt) : !1;
}
function equalArray(_e, Qt) {
  for (let Zt = 0, $n = _e.length; Zt < $n; ++Zt)
    if (!equal(_e[Zt], Qt[Zt]))
      return !1;
  return !0;
}
function equalObject(_e, Qt) {
  for (const Zt in _e)
    if (!equal(_e[Zt], Qt[Zt]))
      return !1;
  return !0;
}
function removePredicate(_e) {
  return (Qt) => equalObject(_e, Qt);
}
function modify(_e, Qt, Zt, $n, Sn, kn) {
  const Kn = this.context.dataflow, er = this.context.data[_e], Cr = er.input, kr = Kn.stamp();
  let Yr = er.changes, Ms, Ds;
  if (Kn._trigger === !1 || !(Cr.value.length || Qt || $n))
    return 0;
  if ((!Yr || Yr.stamp < kr) && (er.changes = Yr = Kn.changeset(), Yr.stamp = kr, Kn.runAfter(() => {
    er.modified = !0, Kn.pulse(Cr, Yr).run();
  }, !0, 1)), Zt && (Ms = Zt === !0 ? truthy : isArray(Zt) || isTuple(Zt) ? Zt : removePredicate(Zt), Yr.remove(Ms)), Qt && Yr.insert(Qt), $n && (Ms = removePredicate($n), Cr.value.some(Ms) ? Yr.remove(Ms) : Yr.insert($n)), Sn)
    for (Ds in kn)
      Yr.modify(Sn, Ds, kn[Ds]);
  return 1;
}
function pinchDistance(_e) {
  const Qt = _e.touches, Zt = Qt[0].clientX - Qt[1].clientX, $n = Qt[0].clientY - Qt[1].clientY;
  return Math.hypot(Zt, $n);
}
function pinchAngle(_e) {
  const Qt = _e.touches;
  return Math.atan2(Qt[0].clientY - Qt[1].clientY, Qt[0].clientX - Qt[1].clientX);
}
const accessors = {};
function pluck(_e, Qt) {
  const Zt = accessors[Qt] || (accessors[Qt] = field$1(Qt));
  return isArray(_e) ? _e.map(Zt) : Zt(_e);
}
function array$1(_e) {
  return isArray(_e) || ArrayBuffer.isView(_e) ? _e : null;
}
function sequence(_e) {
  return array$1(_e) || (isString(_e) ? _e : null);
}
function join(_e) {
  for (var Qt = arguments.length, Zt = new Array(Qt > 1 ? Qt - 1 : 0), $n = 1; $n < Qt; $n++)
    Zt[$n - 1] = arguments[$n];
  return array$1(_e).join(...Zt);
}
function indexof(_e) {
  for (var Qt = arguments.length, Zt = new Array(Qt > 1 ? Qt - 1 : 0), $n = 1; $n < Qt; $n++)
    Zt[$n - 1] = arguments[$n];
  return sequence(_e).indexOf(...Zt);
}
function lastindexof(_e) {
  for (var Qt = arguments.length, Zt = new Array(Qt > 1 ? Qt - 1 : 0), $n = 1; $n < Qt; $n++)
    Zt[$n - 1] = arguments[$n];
  return sequence(_e).lastIndexOf(...Zt);
}
function slice$1(_e) {
  for (var Qt = arguments.length, Zt = new Array(Qt > 1 ? Qt - 1 : 0), $n = 1; $n < Qt; $n++)
    Zt[$n - 1] = arguments[$n];
  return sequence(_e).slice(...Zt);
}
function replace(_e, Qt, Zt) {
  return isFunction$1(Zt) && error("Function argument passed to replace."), String(_e).replace(Qt, Zt);
}
function reverse$1(_e) {
  return array$1(_e).slice().reverse();
}
function bandspace(_e, Qt, Zt) {
  return bandSpace(_e || 0, Qt || 0, Zt || 0);
}
function bandwidth(_e, Qt) {
  const Zt = getScale(_e, (Qt || this).context);
  return Zt && Zt.bandwidth ? Zt.bandwidth() : 0;
}
function copy(_e, Qt) {
  const Zt = getScale(_e, (Qt || this).context);
  return Zt ? Zt.copy() : void 0;
}
function domain$2(_e, Qt) {
  const Zt = getScale(_e, (Qt || this).context);
  return Zt ? Zt.domain() : [];
}
function invert(_e, Qt, Zt) {
  const $n = getScale(_e, (Zt || this).context);
  return $n ? isArray(Qt) ? ($n.invertRange || $n.invert)(Qt) : ($n.invert || $n.invertExtent)(Qt) : void 0;
}
function range$3(_e, Qt) {
  const Zt = getScale(_e, (Qt || this).context);
  return Zt && Zt.range ? Zt.range() : [];
}
function scale$2(_e, Qt, Zt) {
  const $n = getScale(_e, (Zt || this).context);
  return $n ? $n(Qt) : void 0;
}
function scaleGradient(_e, Qt, Zt, $n, Sn) {
  _e = getScale(_e, (Sn || this).context);
  const kn = Gradient$1(Qt, Zt);
  let Kn = _e.domain(), er = Kn[0], Cr = peek$1(Kn), kr = identity$7;
  return Cr - er ? kr = scaleFraction(_e, er, Cr) : _e = (_e.interpolator ? scale$4("sequential")().interpolator(_e.interpolator()) : scale$4("linear")().interpolate(_e.interpolate()).range(_e.range())).domain([er = 0, Cr = 1]), _e.ticks && (Kn = _e.ticks(+$n || 15), er !== Kn[0] && Kn.unshift(er), Cr !== peek$1(Kn) && Kn.push(Cr)), Kn.forEach((Yr) => kn.stop(kr(Yr), _e(Yr))), kn;
}
function geoShape(_e, Qt, Zt) {
  const $n = getScale(_e, (Zt || this).context);
  return function(Sn) {
    return $n ? $n.path.context(Sn)(Qt) : "";
  };
}
function pathShape(_e) {
  let Qt = null;
  return function(Zt) {
    return Zt ? pathRender(Zt, Qt = Qt || parse$4(_e)) : _e;
  };
}
const datum$1 = (_e) => _e.data;
function treeNodes(_e, Qt) {
  const Zt = data$1.call(Qt, _e);
  return Zt.root && Zt.root.lookup || {};
}
function treePath(_e, Qt, Zt) {
  const $n = treeNodes(_e, this), Sn = $n[Qt], kn = $n[Zt];
  return Sn && kn ? Sn.path(kn).map(datum$1) : void 0;
}
function treeAncestors(_e, Qt) {
  const Zt = treeNodes(_e, this)[Qt];
  return Zt ? Zt.ancestors().map(datum$1) : void 0;
}
const _window = () => typeof window < "u" && window || null;
function screen() {
  const _e = _window();
  return _e ? _e.screen : {};
}
function windowSize() {
  const _e = _window();
  return _e ? [_e.innerWidth, _e.innerHeight] : [void 0, void 0];
}
function containerSize() {
  const _e = this.context.dataflow, Qt = _e.container && _e.container();
  return Qt ? [Qt.clientWidth, Qt.clientHeight] : [void 0, void 0];
}
function intersect(_e, Qt, Zt) {
  if (!_e)
    return [];
  const [$n, Sn] = _e, kn = new Bounds().set($n[0], $n[1], Sn[0], Sn[1]), Kn = Zt || this.context.dataflow.scenegraph().root;
  return intersect$2(Kn, kn, filter$1(Qt));
}
function filter$1(_e) {
  let Qt = null;
  if (_e) {
    const Zt = array$6(_e.marktype), $n = array$6(_e.markname);
    Qt = (Sn) => (!Zt.length || Zt.some((kn) => Sn.marktype === kn)) && (!$n.length || $n.some((kn) => Sn.name === kn));
  }
  return Qt;
}
function lassoAppend(_e, Qt, Zt) {
  let $n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 5;
  _e = array$6(_e);
  const Sn = _e[_e.length - 1];
  return Sn === void 0 || Math.hypot(Sn[0] - Qt, Sn[1] - Zt) > $n ? [..._e, [Qt, Zt]] : _e;
}
function lassoPath(_e) {
  return array$6(_e).reduce((Qt, Zt, $n) => {
    let [Sn, kn] = Zt;
    return Qt += $n == 0 ? `M ${Sn},${kn} ` : $n === _e.length - 1 ? " Z" : `L ${Sn},${kn} `;
  }, "");
}
function intersectLasso(_e, Qt, Zt) {
  const {
    x: $n,
    y: Sn,
    mark: kn
  } = Zt, Kn = new Bounds().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER);
  for (const [Cr, kr] of Qt)
    Cr < Kn.x1 && (Kn.x1 = Cr), Cr > Kn.x2 && (Kn.x2 = Cr), kr < Kn.y1 && (Kn.y1 = kr), kr > Kn.y2 && (Kn.y2 = kr);
  return Kn.translate($n, Sn), intersect([[Kn.x1, Kn.y1], [Kn.x2, Kn.y2]], _e, kn).filter((Cr) => pointInPolygon(Cr.x, Cr.y, Qt));
}
function pointInPolygon(_e, Qt, Zt) {
  let $n = 0;
  for (let Sn = 0, kn = Zt.length - 1; Sn < Zt.length; kn = Sn++) {
    const [Kn, er] = Zt[kn], [Cr, kr] = Zt[Sn];
    kr > Qt != er > Qt && _e < (Kn - Cr) * (Qt - kr) / (er - kr) + Cr && $n++;
  }
  return $n & 1;
}
const functionContext = {
  random() {
    return random();
  },
  // override default
  cumulativeNormal,
  cumulativeLogNormal,
  cumulativeUniform,
  densityNormal,
  densityLogNormal,
  densityUniform,
  quantileNormal,
  quantileLogNormal,
  quantileUniform,
  sampleNormal,
  sampleLogNormal,
  sampleUniform,
  isArray,
  isBoolean: isBoolean$2,
  isDate: isDate$1,
  isDefined(_e) {
    return _e !== void 0;
  },
  isNumber: isNumber$1,
  isObject,
  isRegExp,
  isString,
  isTuple,
  isValid(_e) {
    return _e != null && _e === _e;
  },
  toBoolean,
  toDate(_e) {
    return toDate(_e);
  },
  // suppress extra arguments
  toNumber,
  toString,
  indexof,
  join,
  lastindexof,
  replace,
  reverse: reverse$1,
  slice: slice$1,
  flush: flush$1,
  lerp,
  merge,
  pad: pad$2,
  peek: peek$1,
  pluck,
  span,
  inrange,
  truncate: truncate$1,
  rgb,
  lab: lab$1,
  hcl: hcl$2,
  hsl: hsl$2,
  luminance,
  contrast,
  sequence: range$5,
  format,
  utcFormat,
  utcParse,
  utcOffset,
  utcSequence,
  timeFormat: timeFormat$1,
  timeParse,
  timeOffset,
  timeSequence,
  timeUnitSpecifier,
  monthFormat,
  monthAbbrevFormat,
  dayFormat,
  dayAbbrevFormat,
  quarter,
  utcquarter,
  week,
  utcweek,
  dayofyear,
  utcdayofyear,
  warn,
  info,
  debug: debug$2,
  extent(_e) {
    return extent(_e);
  },
  // suppress extra arguments
  inScope,
  intersect,
  clampRange,
  pinchDistance,
  pinchAngle,
  screen,
  containerSize,
  windowSize,
  bandspace,
  setdata,
  pathShape,
  panLinear,
  panLog,
  panPow,
  panSymlog,
  zoomLinear,
  zoomLog,
  zoomPow,
  zoomSymlog,
  encode,
  modify,
  lassoAppend,
  lassoPath,
  intersectLasso
}, eventFunctions = ["view", "item", "group", "xy", "x", "y"], eventPrefix = "event.vega.", thisPrefix = "this.", astVisitors = {}, codegenParams = {
  forbidden: ["_"],
  allowed: ["datum", "event", "item"],
  fieldvar: "datum",
  globalvar: (_e) => `_[${$(SignalPrefix + _e)}]`,
  functions: buildFunctions,
  constants: Constants$1,
  visitors: astVisitors
}, codeGenerator = codegen(codegenParams);
function buildFunctions(_e) {
  const Qt = Functions$1(_e);
  eventFunctions.forEach((Zt) => Qt[Zt] = eventPrefix + Zt);
  for (const Zt in functionContext)
    Qt[Zt] = thisPrefix + Zt;
  return extend$1(Qt, internalScaleFunctions(_e, functionContext, astVisitors)), Qt;
}
function expressionFunction(_e, Qt, Zt) {
  return arguments.length === 1 ? functionContext[_e] : (functionContext[_e] = Qt, Zt && (astVisitors[_e] = Zt), codeGenerator && (codeGenerator.functions[_e] = thisPrefix + _e), this);
}
expressionFunction("bandwidth", bandwidth, scaleVisitor);
expressionFunction("copy", copy, scaleVisitor);
expressionFunction("domain", domain$2, scaleVisitor);
expressionFunction("range", range$3, scaleVisitor);
expressionFunction("invert", invert, scaleVisitor);
expressionFunction("scale", scale$2, scaleVisitor);
expressionFunction("gradient", scaleGradient, scaleVisitor);
expressionFunction("geoArea", geoArea, scaleVisitor);
expressionFunction("geoBounds", geoBounds, scaleVisitor);
expressionFunction("geoCentroid", geoCentroid, scaleVisitor);
expressionFunction("geoShape", geoShape, scaleVisitor);
expressionFunction("indata", indata, indataVisitor);
expressionFunction("data", data$1, dataVisitor);
expressionFunction("treePath", treePath, dataVisitor);
expressionFunction("treeAncestors", treeAncestors, dataVisitor);
expressionFunction("vlSelectionTest", selectionTest, selectionVisitor);
expressionFunction("vlSelectionIdTest", selectionIdTest, selectionVisitor);
expressionFunction("vlSelectionResolve", selectionResolve, selectionVisitor);
expressionFunction("vlSelectionTuples", selectionTuples);
function parser(_e, Qt) {
  const Zt = {};
  let $n;
  try {
    _e = isString(_e) ? _e : $(_e) + "", $n = parser$1(_e);
  } catch {
    error("Expression parse error: " + _e);
  }
  $n.visit((kn) => {
    if (kn.type !== CallExpression)
      return;
    const Kn = kn.callee.name, er = codegenParams.visitors[Kn];
    er && er(Kn, kn.arguments, Qt, Zt);
  });
  const Sn = codeGenerator($n);
  return Sn.globals.forEach((kn) => {
    const Kn = SignalPrefix + kn;
    !has$1(Zt, Kn) && Qt.getSignal(kn) && (Zt[Kn] = Qt.signalRef(kn));
  }), {
    $expr: extend$1({
      code: Sn.code
    }, Qt.options.ast ? {
      ast: $n
    } : null),
    $fields: Sn.fields,
    $params: Zt
  };
}
function parse$3(_e) {
  const Qt = this, Zt = _e.operators || [];
  return _e.background && (Qt.background = _e.background), _e.eventConfig && (Qt.eventConfig = _e.eventConfig), _e.locale && (Qt.locale = _e.locale), Zt.forEach(($n) => Qt.parseOperator($n)), Zt.forEach(($n) => Qt.parseOperatorParameters($n)), (_e.streams || []).forEach(($n) => Qt.parseStream($n)), (_e.updates || []).forEach(($n) => Qt.parseUpdate($n)), Qt.resolve();
}
const Skip$2 = toSet(["rule"]), Swap = toSet(["group", "image", "rect"]);
function adjustSpatial$1(_e, Qt) {
  let Zt = "";
  return Skip$2[Qt] || (_e.x2 && (_e.x ? (Swap[Qt] && (Zt += "if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"), Zt += "o.width=o.x2-o.x;") : Zt += "o.x=o.x2-(o.width||0);"), _e.xc && (Zt += "o.x=o.xc-(o.width||0)/2;"), _e.y2 && (_e.y ? (Swap[Qt] && (Zt += "if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"), Zt += "o.height=o.y2-o.y;") : Zt += "o.y=o.y2-(o.height||0);"), _e.yc && (Zt += "o.y=o.yc-(o.height||0)/2;")), Zt;
}
function canonicalType(_e) {
  return (_e + "").toLowerCase();
}
function isOperator(_e) {
  return canonicalType(_e) === "operator";
}
function isCollect(_e) {
  return canonicalType(_e) === "collect";
}
function expression$2(_e, Qt, Zt) {
  Zt.endsWith(";") || (Zt = "return(" + Zt + ");");
  const $n = Function(...Qt.concat(Zt));
  return _e && _e.functions ? $n.bind(_e.functions) : $n;
}
function _compare(_e, Qt, Zt, $n) {
  return `((u = ${_e}) < (v = ${Qt}) || u == null) && v != null ? ${Zt}
  : (u > v || v == null) && u != null ? ${$n}
  : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${Zt}
  : v !== v && u === u ? ${$n} : `;
}
var expressionCodegen = {
  /**
   * Parse an expression used to update an operator value.
   */
  operator: (_e, Qt) => expression$2(_e, ["_"], Qt.code),
  /**
   * Parse an expression provided as an operator parameter value.
   */
  parameter: (_e, Qt) => expression$2(_e, ["datum", "_"], Qt.code),
  /**
   * Parse an expression applied to an event stream.
   */
  event: (_e, Qt) => expression$2(_e, ["event"], Qt.code),
  /**
   * Parse an expression used to handle an event-driven operator update.
   */
  handler: (_e, Qt) => {
    const Zt = `var datum=event.item&&event.item.datum;return ${Qt.code};`;
    return expression$2(_e, ["_", "event"], Zt);
  },
  /**
   * Parse an expression that performs visual encoding.
   */
  encode: (_e, Qt) => {
    const {
      marktype: Zt,
      channels: $n
    } = Qt;
    let Sn = "var o=item,datum=o.datum,m=0,$;";
    for (const kn in $n) {
      const Kn = "o[" + $(kn) + "]";
      Sn += `$=${$n[kn].code};if(${Kn}!==$)${Kn}=$,m=1;`;
    }
    return Sn += adjustSpatial$1($n, Zt), Sn += "return m;", expression$2(_e, ["item", "_"], Sn);
  },
  /**
   * Optimized code generators for access and comparison.
   */
  codegen: {
    get(_e) {
      const Qt = `[${_e.map($).join("][")}]`, Zt = Function("_", `return _${Qt};`);
      return Zt.path = Qt, Zt;
    },
    comparator(_e, Qt) {
      let Zt;
      const $n = (kn, Kn) => {
        const er = Qt[Kn];
        let Cr, kr;
        return kn.path ? (Cr = `a${kn.path}`, kr = `b${kn.path}`) : ((Zt = Zt || {})["f" + Kn] = kn, Cr = `this.f${Kn}(a)`, kr = `this.f${Kn}(b)`), _compare(Cr, kr, -er, er);
      }, Sn = Function("a", "b", "var u, v; return " + _e.map($n).join("") + "0;");
      return Zt ? Sn.bind(Zt) : Sn;
    }
  }
};
function parseOperator(_e) {
  const Qt = this;
  isOperator(_e.type) || !_e.type ? Qt.operator(_e, _e.update ? Qt.operatorExpression(_e.update) : null) : Qt.transform(_e, _e.type);
}
function parseOperatorParameters(_e) {
  const Qt = this;
  if (_e.params) {
    const Zt = Qt.get(_e.id);
    Zt || error("Invalid operator id: " + _e.id), Qt.dataflow.connect(Zt, Zt.parameters(Qt.parseParameters(_e.params), _e.react, _e.initonly));
  }
}
function parseParameters$1(_e, Qt) {
  Qt = Qt || {};
  const Zt = this;
  for (const $n in _e) {
    const Sn = _e[$n];
    Qt[$n] = isArray(Sn) ? Sn.map((kn) => parseParameter$2(kn, Zt, Qt)) : parseParameter$2(Sn, Zt, Qt);
  }
  return Qt;
}
function parseParameter$2(_e, Qt, Zt) {
  if (!_e || !isObject(_e))
    return _e;
  for (let $n = 0, Sn = PARSERS.length, kn; $n < Sn; ++$n)
    if (kn = PARSERS[$n], has$1(_e, kn.key))
      return kn.parse(_e, Qt, Zt);
  return _e;
}
var PARSERS = [{
  key: "$ref",
  parse: getOperator
}, {
  key: "$key",
  parse: getKey
}, {
  key: "$expr",
  parse: getExpression
}, {
  key: "$field",
  parse: getField
}, {
  key: "$encode",
  parse: getEncode
}, {
  key: "$compare",
  parse: getCompare
}, {
  key: "$context",
  parse: getContext$1
}, {
  key: "$subflow",
  parse: getSubflow
}, {
  key: "$tupleid",
  parse: getTupleId
}];
function getOperator(_e, Qt) {
  return Qt.get(_e.$ref) || error("Operator not defined: " + _e.$ref);
}
function getExpression(_e, Qt, Zt) {
  _e.$params && Qt.parseParameters(_e.$params, Zt);
  const $n = "e:" + _e.$expr.code;
  return Qt.fn[$n] || (Qt.fn[$n] = accessor(Qt.parameterExpression(_e.$expr), _e.$fields));
}
function getKey(_e, Qt) {
  const Zt = "k:" + _e.$key + "_" + !!_e.$flat;
  return Qt.fn[Zt] || (Qt.fn[Zt] = key(_e.$key, _e.$flat, Qt.expr.codegen));
}
function getField(_e, Qt) {
  if (!_e.$field)
    return null;
  const Zt = "f:" + _e.$field + "_" + _e.$name;
  return Qt.fn[Zt] || (Qt.fn[Zt] = field$1(_e.$field, _e.$name, Qt.expr.codegen));
}
function getCompare(_e, Qt) {
  const Zt = "c:" + _e.$compare + "_" + _e.$order, $n = array$6(_e.$compare).map((Sn) => Sn && Sn.$tupleid ? tupleid : Sn);
  return Qt.fn[Zt] || (Qt.fn[Zt] = compare$9($n, _e.$order, Qt.expr.codegen));
}
function getEncode(_e, Qt) {
  const Zt = _e.$encode, $n = {};
  for (const Sn in Zt) {
    const kn = Zt[Sn];
    $n[Sn] = accessor(Qt.encodeExpression(kn.$expr), kn.$fields), $n[Sn].output = kn.$output;
  }
  return $n;
}
function getContext$1(_e, Qt) {
  return Qt;
}
function getSubflow(_e, Qt) {
  const Zt = _e.$subflow;
  return function($n, Sn, kn) {
    const Kn = Qt.fork().parse(Zt), er = Kn.get(Zt.operators[0].id), Cr = Kn.signals.parent;
    return Cr && Cr.set(kn), er.detachSubflow = () => Qt.detach(Kn), er;
  };
}
function getTupleId() {
  return tupleid;
}
function parseStream$2(_e) {
  var Qt = this, Zt = _e.filter != null ? Qt.eventExpression(_e.filter) : void 0, $n = _e.stream != null ? Qt.get(_e.stream) : void 0, Sn;
  _e.source ? $n = Qt.events(_e.source, _e.type, Zt) : _e.merge && (Sn = _e.merge.map((kn) => Qt.get(kn)), $n = Sn[0].merge.apply(Sn[0], Sn.slice(1))), _e.between && (Sn = _e.between.map((kn) => Qt.get(kn)), $n = $n.between(Sn[0], Sn[1])), _e.filter && ($n = $n.filter(Zt)), _e.throttle != null && ($n = $n.throttle(+_e.throttle)), _e.debounce != null && ($n = $n.debounce(+_e.debounce)), $n == null && error("Invalid stream definition: " + JSON.stringify(_e)), _e.consume && $n.consume(!0), Qt.stream(_e, $n);
}
function parseUpdate$1(_e) {
  var Qt = this, Zt = isObject(Zt = _e.source) ? Zt.$ref : Zt, $n = Qt.get(Zt), Sn = null, kn = _e.update, Kn = void 0;
  $n || error("Source not defined: " + _e.source), Sn = _e.target && _e.target.$expr ? Qt.eventExpression(_e.target.$expr) : Qt.get(_e.target), kn && kn.$expr && (kn.$params && (Kn = Qt.parseParameters(kn.$params)), kn = Qt.handlerExpression(kn.$expr)), Qt.update(_e, $n, Sn, kn, Kn);
}
const SKIP = {
  skip: !0
};
function getState$1(_e) {
  var Qt = this, Zt = {};
  if (_e.signals) {
    var $n = Zt.signals = {};
    Object.keys(Qt.signals).forEach((kn) => {
      const Kn = Qt.signals[kn];
      _e.signals(kn, Kn) && ($n[kn] = Kn.value);
    });
  }
  if (_e.data) {
    var Sn = Zt.data = {};
    Object.keys(Qt.data).forEach((kn) => {
      const Kn = Qt.data[kn];
      _e.data(kn, Kn) && (Sn[kn] = Kn.input.value);
    });
  }
  return Qt.subcontext && _e.recurse !== !1 && (Zt.subcontext = Qt.subcontext.map((kn) => kn.getState(_e))), Zt;
}
function setState$1(_e) {
  var Qt = this, Zt = Qt.dataflow, $n = _e.data, Sn = _e.signals;
  Object.keys(Sn || {}).forEach((kn) => {
    Zt.update(Qt.signals[kn], Sn[kn], SKIP);
  }), Object.keys($n || {}).forEach((kn) => {
    Zt.pulse(Qt.data[kn].input, Zt.changeset().remove(truthy).insert($n[kn]));
  }), (_e.subcontext || []).forEach((kn, Kn) => {
    const er = Qt.subcontext[Kn];
    er && er.setState(kn);
  });
}
function context(_e, Qt, Zt, $n) {
  return new Context(_e, Qt, Zt, $n);
}
function Context(_e, Qt, Zt, $n) {
  this.dataflow = _e, this.transforms = Qt, this.events = _e.events.bind(_e), this.expr = $n || expressionCodegen, this.signals = {}, this.scales = {}, this.nodes = {}, this.data = {}, this.fn = {}, Zt && (this.functions = Object.create(Zt), this.functions.context = this);
}
function Subcontext(_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);
}
Context.prototype = Subcontext.prototype = {
  fork() {
    const _e = new Subcontext(this);
    return (this.subcontext || (this.subcontext = [])).push(_e), _e;
  },
  detach(_e) {
    this.subcontext = this.subcontext.filter((Zt) => Zt !== _e);
    const Qt = Object.keys(_e.nodes);
    for (const Zt of Qt)
      _e.nodes[Zt]._targets = null;
    for (const Zt of Qt)
      _e.nodes[Zt].detach();
    _e.nodes = null;
  },
  get(_e) {
    return this.nodes[_e];
  },
  set(_e, Qt) {
    return this.nodes[_e] = Qt;
  },
  add(_e, Qt) {
    const Zt = this, $n = Zt.dataflow, Sn = _e.value;
    if (Zt.set(_e.id, Qt), isCollect(_e.type) && Sn && (Sn.$ingest ? $n.ingest(Qt, Sn.$ingest, Sn.$format) : Sn.$request ? $n.preload(Qt, Sn.$request, Sn.$format) : $n.pulse(Qt, $n.changeset().insert(Sn))), _e.root && (Zt.root = Qt), _e.parent) {
      let kn = Zt.get(_e.parent.$ref);
      kn ? ($n.connect(kn, [Qt]), Qt.targets().add(kn)) : (Zt.unresolved = Zt.unresolved || []).push(() => {
        kn = Zt.get(_e.parent.$ref), $n.connect(kn, [Qt]), Qt.targets().add(kn);
      });
    }
    if (_e.signal && (Zt.signals[_e.signal] = Qt), _e.scale && (Zt.scales[_e.scale] = Qt), _e.data)
      for (const kn in _e.data) {
        const Kn = Zt.data[kn] || (Zt.data[kn] = {});
        _e.data[kn].forEach((er) => Kn[er] = Qt);
      }
  },
  resolve() {
    return (this.unresolved || []).forEach((_e) => _e()), delete this.unresolved, this;
  },
  operator(_e, Qt) {
    this.add(_e, this.dataflow.add(_e.value, Qt));
  },
  transform(_e, Qt) {
    this.add(_e, this.dataflow.add(this.transforms[canonicalType(Qt)]));
  },
  stream(_e, Qt) {
    this.set(_e.id, Qt);
  },
  update(_e, Qt, Zt, $n, Sn) {
    this.dataflow.on(Qt, Zt, $n, Sn, _e.options);
  },
  // expression parsing
  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 methods
  parse: parse$3,
  parseOperator,
  parseOperatorParameters,
  parseParameters: parseParameters$1,
  parseStream: parseStream$2,
  parseUpdate: parseUpdate$1,
  // state methods
  getState: getState$1,
  setState: setState$1
};
function initializeAria(_e) {
  const Qt = _e.container();
  Qt && (Qt.setAttribute("role", "graphics-document"), Qt.setAttribute("aria-roleDescription", "visualization"), ariaLabel(Qt, _e.description()));
}
function ariaLabel(_e, Qt) {
  _e && (Qt == null ? _e.removeAttribute("aria-label") : _e.setAttribute("aria-label", Qt));
}
function background(_e) {
  _e.add(null, (Qt) => (_e._background = Qt.bg, _e._resize = 1, Qt.bg), {
    bg: _e._signals.background
  });
}
const Default = "default";
function cursor$1(_e) {
  const Qt = _e._signals.cursor || (_e._signals.cursor = _e.add({
    user: Default,
    item: null
  }));
  _e.on(_e.events("view", "mousemove"), Qt, (Zt, $n) => {
    const Sn = Qt.value, kn = Sn ? isString(Sn) ? Sn : Sn.user : Default, Kn = $n.item && $n.item.cursor || null;
    return Sn && kn === Sn.user && Kn == Sn.item ? Sn : {
      user: kn,
      item: Kn
    };
  }), _e.add(null, function(Zt) {
    let $n = Zt.cursor, Sn = this.value;
    return isString($n) || (Sn = $n.item, $n = $n.user), setCursor(_e, $n && $n !== Default ? $n : Sn || $n), Sn;
  }, {
    cursor: Qt
  });
}
function setCursor(_e, Qt) {
  const Zt = _e.globalCursor() ? typeof document < "u" && document.body : _e.container();
  if (Zt)
    return Qt == null ? Zt.style.removeProperty("cursor") : Zt.style.cursor = Qt;
}
function dataref(_e, Qt) {
  var Zt = _e._runtime.data;
  return has$1(Zt, Qt) || error("Unrecognized data set: " + Qt), Zt[Qt];
}
function data(_e, Qt) {
  return arguments.length < 2 ? dataref(this, _e).values.value : change.call(this, _e, changeset().remove(truthy).insert(Qt));
}
function change(_e, Qt) {
  isChangeSet(Qt) || error("Second argument to changes must be a changeset.");
  const Zt = dataref(this, _e);
  return Zt.modified = !0, this.pulse(Zt.input, Qt);
}
function insert$1(_e, Qt) {
  return change.call(this, _e, changeset().insert(Qt));
}
function remove$1(_e, Qt) {
  return change.call(this, _e, changeset().remove(Qt));
}
function width(_e) {
  var Qt = _e.padding();
  return Math.max(0, _e._viewWidth + Qt.left + Qt.right);
}
function height(_e) {
  var Qt = _e.padding();
  return Math.max(0, _e._viewHeight + Qt.top + Qt.bottom);
}
function offset$1(_e) {
  var Qt = _e.padding(), Zt = _e._origin;
  return [Qt.left + Zt[0], Qt.top + Zt[1]];
}
function resizeRenderer(_e) {
  var Qt = offset$1(_e), Zt = width(_e), $n = height(_e);
  _e._renderer.background(_e.background()), _e._renderer.resize(Zt, $n, Qt), _e._handler.origin(Qt), _e._resizeListeners.forEach((Sn) => {
    try {
      Sn(Zt, $n);
    } catch (kn) {
      _e.error(kn);
    }
  });
}
function eventExtend(_e, Qt, Zt) {
  var $n = _e._renderer, Sn = $n && $n.canvas(), kn, Kn, er;
  return Sn && (er = offset$1(_e), Kn = Qt.changedTouches ? Qt.changedTouches[0] : Qt, kn = point$2(Kn, Sn), kn[0] -= er[0], kn[1] -= er[1]), Qt.dataflow = _e, Qt.item = Zt, Qt.vega = extension(_e, Zt, kn), Qt;
}
function extension(_e, Qt, Zt) {
  const $n = Qt ? Qt.mark.marktype === "group" ? Qt : Qt.mark.group : null;
  function Sn(Kn) {
    var er = $n, Cr;
    if (Kn) {
      for (Cr = Qt; Cr; Cr = Cr.mark.group)
        if (Cr.mark.name === Kn) {
          er = Cr;
          break;
        }
    }
    return er && er.mark && er.mark.interactive ? er : {};
  }
  function kn(Kn) {
    if (!Kn)
      return Zt;
    isString(Kn) && (Kn = Sn(Kn));
    const er = Zt.slice();
    for (; Kn; )
      er[0] -= Kn.x || 0, er[1] -= Kn.y || 0, Kn = Kn.mark && Kn.mark.group;
    return er;
  }
  return {
    view: constant$7(_e),
    item: constant$7(Qt || {}),
    group: Sn,
    xy: kn,
    x: (Kn) => kn(Kn)[0],
    y: (Kn) => kn(Kn)[1]
  };
}
const VIEW$1 = "view", TIMER = "timer", WINDOW = "window", NO_TRAP = {
  trap: !1
};
function initializeEventConfig(_e) {
  const Qt = extend$1({
    defaults: {}
  }, _e), Zt = ($n, Sn) => {
    Sn.forEach((kn) => {
      isArray($n[kn]) && ($n[kn] = toSet($n[kn]));
    });
  };
  return Zt(Qt.defaults, ["prevent", "allow"]), Zt(Qt, ["view", "window", "selector"]), Qt;
}
function trackEventListener(_e, Qt, Zt, $n) {
  _e._eventListeners.push({
    type: Zt,
    sources: array$6(Qt),
    handler: $n
  });
}
function prevent(_e, Qt) {
  var Zt = _e._eventConfig.defaults, $n = Zt.prevent, Sn = Zt.allow;
  return $n === !1 || Sn === !0 ? !1 : $n === !0 || Sn === !1 ? !0 : $n ? $n[Qt] : Sn ? !Sn[Qt] : _e.preventDefault();
}
function permit(_e, Qt, Zt) {
  const $n = _e._eventConfig && _e._eventConfig[Qt];
  return $n === !1 || isObject($n) && !$n[Zt] ? (_e.warn(`Blocked ${Qt} ${Zt} event listener.`), !1) : !0;
}
function events(_e, Qt, Zt) {
  var $n = this, Sn = new EventStream(Zt), kn = function(kr, Yr) {
    $n.runAsync(null, () => {
      _e === VIEW$1 && prevent($n, Qt) && kr.preventDefault(), Sn.receive(eventExtend($n, kr, Yr));
    });
  }, Kn;
  if (_e === TIMER)
    permit($n, "timer", Qt) && $n.timer(kn, Qt);
  else if (_e === VIEW$1)
    permit($n, "view", Qt) && $n.addEventListener(Qt, kn, NO_TRAP);
  else if (_e === WINDOW ? permit($n, "window", Qt) && typeof window < "u" && (Kn = [window]) : typeof document < "u" && permit($n, "selector", Qt) && (Kn = Array.from(document.querySelectorAll(_e))), !Kn)
    $n.warn("Can not resolve event source: " + _e);
  else {
    for (var er = 0, Cr = Kn.length; er < Cr; ++er)
      Kn[er].addEventListener(Qt, kn);
    trackEventListener($n, Kn, Qt, kn);
  }
  return Sn;
}
function itemFilter(_e) {
  return _e.item;
}
function markTarget(_e) {
  return _e.item.mark.source;
}
function invoke(_e) {
  return function(Qt, Zt) {
    return Zt.vega.view().changeset().encode(Zt.item, _e);
  };
}
function hover(_e, Qt) {
  return _e = [_e || "hover"], Qt = [Qt || "update", _e[0]], this.on(this.events("view", "mouseover", itemFilter), markTarget, invoke(_e)), this.on(this.events("view", "mouseout", itemFilter), markTarget, invoke(Qt)), this;
}
function finalize() {
  var _e = this._tooltip, Qt = this._timers, Zt = this._eventListeners, $n, Sn, kn;
  for ($n = Qt.length; --$n >= 0; )
    Qt[$n].stop();
  for ($n = Zt.length; --$n >= 0; )
    for (kn = Zt[$n], Sn = kn.sources.length; --Sn >= 0; )
      kn.sources[Sn].removeEventListener(kn.type, kn.handler);
  return _e && _e.call(this, this._handler, null, null, null), this;
}
function element(_e, Qt, Zt) {
  const $n = document.createElement(_e);
  for (const Sn in Qt)
    $n.setAttribute(Sn, Qt[Sn]);
  return Zt != null && ($n.textContent = Zt), $n;
}
const BindClass = "vega-bind", NameClass = "vega-bind-name", RadioClass = "vega-bind-radio";
function bind(_e, Qt, Zt) {
  if (!Qt)
    return;
  const $n = Zt.param;
  let Sn = Zt.state;
  return Sn || (Sn = Zt.state = {
    elements: null,
    active: !1,
    set: null,
    update: (Kn) => {
      Kn != _e.signal($n.signal) && _e.runAsync(null, () => {
        Sn.source = !0, _e.signal($n.signal, Kn);
      });
    }
  }, $n.debounce && (Sn.update = debounce($n.debounce, Sn.update))), ($n.input == null && $n.element ? target : generate$1)(Sn, Qt, $n, _e), Sn.active || (_e.on(_e._signals[$n.signal], null, () => {
    Sn.source ? Sn.source = !1 : Sn.set(_e.signal($n.signal));
  }), Sn.active = !0), Sn;
}
function target(_e, Qt, Zt, $n) {
  const Sn = Zt.event || "input", kn = () => _e.update(Qt.value);
  $n.signal(Zt.signal, Qt.value), Qt.addEventListener(Sn, kn), trackEventListener($n, Qt, Sn, kn), _e.set = (Kn) => {
    Qt.value = Kn, Qt.dispatchEvent(event(Sn));
  };
}
function event(_e) {
  return typeof Event < "u" ? new Event(_e) : {
    type: _e
  };
}
function generate$1(_e, Qt, Zt, $n) {
  const Sn = $n.signal(Zt.signal), kn = element("div", {
    class: BindClass
  }), Kn = Zt.input === "radio" ? kn : kn.appendChild(element("label"));
  Kn.appendChild(element("span", {
    class: NameClass
  }, Zt.name || Zt.signal)), Qt.appendChild(kn);
  let er = form;
  switch (Zt.input) {
    case "checkbox":
      er = checkbox;
      break;
    case "select":
      er = select$1;
      break;
    case "radio":
      er = radio;
      break;
    case "range":
      er = range$2;
      break;
  }
  er(_e, Kn, Zt, Sn);
}
function form(_e, Qt, Zt, $n) {
  const Sn = element("input");
  for (const kn in Zt)
    kn !== "signal" && kn !== "element" && Sn.setAttribute(kn === "input" ? "type" : kn, Zt[kn]);
  Sn.setAttribute("name", Zt.signal), Sn.value = $n, Qt.appendChild(Sn), Sn.addEventListener("input", () => _e.update(Sn.value)), _e.elements = [Sn], _e.set = (kn) => Sn.value = kn;
}
function checkbox(_e, Qt, Zt, $n) {
  const Sn = {
    type: "checkbox",
    name: Zt.signal
  };
  $n && (Sn.checked = !0);
  const kn = element("input", Sn);
  Qt.appendChild(kn), kn.addEventListener("change", () => _e.update(kn.checked)), _e.elements = [kn], _e.set = (Kn) => kn.checked = !!Kn || null;
}
function select$1(_e, Qt, Zt, $n) {
  const Sn = element("select", {
    name: Zt.signal
  }), kn = Zt.labels || [];
  Zt.options.forEach((Kn, er) => {
    const Cr = {
      value: Kn
    };
    valuesEqual(Kn, $n) && (Cr.selected = !0), Sn.appendChild(element("option", Cr, (kn[er] || Kn) + ""));
  }), Qt.appendChild(Sn), Sn.addEventListener("change", () => {
    _e.update(Zt.options[Sn.selectedIndex]);
  }), _e.elements = [Sn], _e.set = (Kn) => {
    for (let er = 0, Cr = Zt.options.length; er < Cr; ++er)
      if (valuesEqual(Zt.options[er], Kn)) {
        Sn.selectedIndex = er;
        return;
      }
  };
}
function radio(_e, Qt, Zt, $n) {
  const Sn = element("span", {
    class: RadioClass
  }), kn = Zt.labels || [];
  Qt.appendChild(Sn), _e.elements = Zt.options.map((Kn, er) => {
    const Cr = {
      type: "radio",
      name: Zt.signal,
      value: Kn
    };
    valuesEqual(Kn, $n) && (Cr.checked = !0);
    const kr = element("input", Cr);
    kr.addEventListener("change", () => _e.update(Kn));
    const Yr = element("label", {}, (kn[er] || Kn) + "");
    return Yr.prepend(kr), Sn.appendChild(Yr), kr;
  }), _e.set = (Kn) => {
    const er = _e.elements, Cr = er.length;
    for (let kr = 0; kr < Cr; ++kr)
      valuesEqual(er[kr].value, Kn) && (er[kr].checked = !0);
  };
}
function range$2(_e, Qt, Zt, $n) {
  $n = $n !== void 0 ? $n : (+Zt.max + +Zt.min) / 2;
  const Sn = Zt.max != null ? Zt.max : Math.max(100, +$n) || 100, kn = Zt.min || Math.min(0, Sn, +$n) || 0, Kn = Zt.step || tickStep(kn, Sn, 100), er = element("input", {
    type: "range",
    name: Zt.signal,
    min: kn,
    max: Sn,
    step: Kn
  });
  er.value = $n;
  const Cr = element("span", {}, +$n);
  Qt.appendChild(er), Qt.appendChild(Cr);
  const kr = () => {
    Cr.textContent = er.value, _e.update(+er.value);
  };
  er.addEventListener("input", kr), er.addEventListener("change", kr), _e.elements = [er], _e.set = (Yr) => {
    er.value = Yr, Cr.textContent = Yr;
  };
}
function valuesEqual(_e, Qt) {
  return _e === Qt || _e + "" == Qt + "";
}
function initializeRenderer(_e, Qt, Zt, $n, Sn, kn) {
  return Qt = Qt || new $n(_e.loader()), Qt.initialize(Zt, width(_e), height(_e), offset$1(_e), Sn, kn).background(_e.background());
}
function trap(_e, Qt) {
  return Qt ? function() {
    try {
      Qt.apply(this, arguments);
    } catch (Zt) {
      _e.error(Zt);
    }
  } : null;
}
function initializeHandler(_e, Qt, Zt, $n) {
  const Sn = new $n(_e.loader(), trap(_e, _e.tooltip())).scene(_e.scenegraph().root).initialize(Zt, offset$1(_e), _e);
  return Qt && Qt.handlers().forEach((kn) => {
    Sn.on(kn.type, kn.handler);
  }), Sn;
}
function initialize(_e, Qt) {
  const Zt = this, $n = Zt._renderType, Sn = Zt._eventConfig.bind, kn = renderModule($n);
  _e = Zt._el = _e ? lookup$1(Zt, _e, !0) : null, initializeAria(Zt), kn || Zt.error("Unrecognized renderer type: " + $n);
  const Kn = kn.handler || CanvasHandler, er = _e ? kn.renderer : kn.headless;
  return Zt._renderer = er ? initializeRenderer(Zt, Zt._renderer, _e, er) : null, Zt._handler = initializeHandler(Zt, Zt._handler, _e, Kn), Zt._redraw = !0, _e && Sn !== "none" && (Qt = Qt ? Zt._elBind = lookup$1(Zt, Qt, !0) : _e.appendChild(element("form", {
    class: "vega-bindings"
  })), Zt._bind.forEach((Cr) => {
    Cr.param.element && Sn !== "container" && (Cr.element = lookup$1(Zt, Cr.param.element, !!Cr.param.input));
  }), Zt._bind.forEach((Cr) => {
    bind(Zt, Cr.element || Qt, Cr);
  })), Zt;
}
function lookup$1(_e, Qt, Zt) {
  if (typeof Qt == "string")
    if (typeof document < "u") {
      if (Qt = document.querySelector(Qt), !Qt)
        return _e.error("Signal bind element not found: " + Qt), null;
    } else
      return _e.error("DOM document instance not found."), null;
  if (Qt && Zt)
    try {
      Qt.textContent = "";
    } catch ($n) {
      Qt = null, _e.error($n);
    }
  return Qt;
}
const number$1 = (_e) => +_e || 0, paddingObject$1 = (_e) => ({
  top: _e,
  bottom: _e,
  left: _e,
  right: _e
});
function padding$1(_e) {
  return isObject(_e) ? {
    top: number$1(_e.top),
    bottom: number$1(_e.bottom),
    left: number$1(_e.left),
    right: number$1(_e.right)
  } : paddingObject$1(number$1(_e));
}
async function renderHeadless(_e, Qt, Zt, $n) {
  const Sn = renderModule(Qt), kn = Sn && Sn.headless;
  return kn || error("Unrecognized renderer type: " + Qt), await _e.runAsync(), initializeRenderer(_e, null, null, kn, Zt, $n).renderAsync(_e._scenegraph.root);
}
async function renderToImageURL(_e, Qt) {
  _e !== RenderType.Canvas && _e !== RenderType.SVG && _e !== RenderType.PNG && error("Unrecognized image type: " + _e);
  const Zt = await renderHeadless(this, _e, Qt);
  return _e === RenderType.SVG ? toBlobURL(Zt.svg(), "image/svg+xml") : Zt.canvas().toDataURL("image/png");
}
function toBlobURL(_e, Qt) {
  const Zt = new Blob([_e], {
    type: Qt
  });
  return window.URL.createObjectURL(Zt);
}
async function renderToCanvas(_e, Qt) {
  return (await renderHeadless(this, RenderType.Canvas, _e, Qt)).canvas();
}
async function renderToSVG(_e) {
  return (await renderHeadless(this, RenderType.SVG, _e)).svg();
}
function runtime(_e, Qt, Zt) {
  return context(_e, transforms$1, functionContext, Zt).parse(Qt);
}
function scale$1(_e) {
  var Qt = this._runtime.scales;
  return has$1(Qt, _e) || error("Unrecognized scale or projection: " + _e), Qt[_e].value;
}
var Width = "width", Height = "height", Padding = "padding", Skip$1 = {
  skip: !0
};
function viewWidth(_e, Qt) {
  var Zt = _e.autosize(), $n = _e.padding();
  return Qt - (Zt && Zt.contains === Padding ? $n.left + $n.right : 0);
}
function viewHeight(_e, Qt) {
  var Zt = _e.autosize(), $n = _e.padding();
  return Qt - (Zt && Zt.contains === Padding ? $n.top + $n.bottom : 0);
}
function initializeResize(_e) {
  var Qt = _e._signals, Zt = Qt[Width], $n = Qt[Height], Sn = Qt[Padding];
  function kn() {
    _e._autosize = _e._resize = 1;
  }
  _e._resizeWidth = _e.add(null, (er) => {
    _e._width = er.size, _e._viewWidth = viewWidth(_e, er.size), kn();
  }, {
    size: Zt
  }), _e._resizeHeight = _e.add(null, (er) => {
    _e._height = er.size, _e._viewHeight = viewHeight(_e, er.size), kn();
  }, {
    size: $n
  });
  const Kn = _e.add(null, kn, {
    pad: Sn
  });
  _e._resizeWidth.rank = Zt.rank + 1, _e._resizeHeight.rank = $n.rank + 1, Kn.rank = Sn.rank + 1;
}
function resizeView(_e, Qt, Zt, $n, Sn, kn) {
  this.runAfter((Kn) => {
    let er = 0;
    Kn._autosize = 0, Kn.width() !== Zt && (er = 1, Kn.signal(Width, Zt, Skip$1), Kn._resizeWidth.skip(!0)), Kn.height() !== $n && (er = 1, Kn.signal(Height, $n, Skip$1), Kn._resizeHeight.skip(!0)), Kn._viewWidth !== _e && (Kn._resize = 1, Kn._viewWidth = _e), Kn._viewHeight !== Qt && (Kn._resize = 1, Kn._viewHeight = Qt), (Kn._origin[0] !== Sn[0] || Kn._origin[1] !== Sn[1]) && (Kn._resize = 1, Kn._origin = Sn), er && Kn.run("enter"), kn && Kn.runAfter((Cr) => Cr.resize());
  }, !1, 1);
}
function getState(_e) {
  return this._runtime.getState(_e || {
    data: dataTest,
    signals: signalTest,
    recurse: !0
  });
}
function dataTest(_e, Qt) {
  return Qt.modified && isArray(Qt.input.value) && _e.indexOf("_:vega:_");
}
function signalTest(_e, Qt) {
  return !(_e === "parent" || Qt instanceof transforms$1.proxy);
}
function setState(_e) {
  return this.runAsync(null, (Qt) => {
    Qt._trigger = !1, Qt._runtime.setState(_e);
  }, (Qt) => {
    Qt._trigger = !0;
  }), this;
}
function timer(_e, Qt) {
  function Zt($n) {
    _e({
      timestamp: Date.now(),
      elapsed: $n
    });
  }
  this._timers.push(interval$1(Zt, Qt));
}
function defaultTooltip(_e, Qt, Zt, $n) {
  const Sn = _e.element();
  Sn && Sn.setAttribute("title", formatTooltip($n));
}
function formatTooltip(_e) {
  return _e == null ? "" : isArray(_e) ? formatArray(_e) : isObject(_e) && !isDate$1(_e) ? formatObject(_e) : _e + "";
}
function formatObject(_e) {
  return Object.keys(_e).map((Qt) => {
    const Zt = _e[Qt];
    return Qt + ": " + (isArray(Zt) ? formatArray(Zt) : formatValue$1(Zt));
  }).join(`
`);
}
function formatArray(_e) {
  return "[" + _e.map(formatValue$1).join(", ") + "]";
}
function formatValue$1(_e) {
  return isArray(_e) ? "[…]" : isObject(_e) && !isDate$1(_e) ? "{…}" : _e;
}
function View$1(_e, Qt) {
  const Zt = this;
  if (Qt = Qt || {}, Dataflow.call(Zt), Qt.loader && Zt.loader(Qt.loader), Qt.logger && Zt.logger(Qt.logger), Qt.logLevel != null && Zt.logLevel(Qt.logLevel), Qt.locale || _e.locale) {
    const kn = extend$1({}, _e.locale, Qt.locale);
    Zt.locale(locale(kn.number, kn.time));
  }
  Zt._el = null, Zt._elBind = null, Zt._renderType = Qt.renderer || RenderType.Canvas, Zt._scenegraph = new Scenegraph();
  const $n = Zt._scenegraph.root;
  Zt._renderer = null, Zt._tooltip = Qt.tooltip || defaultTooltip, Zt._redraw = !0, Zt._handler = new CanvasHandler().scene($n), Zt._globalCursor = !1, Zt._preventDefault = !1, Zt._timers = [], Zt._eventListeners = [], Zt._resizeListeners = [], Zt._eventConfig = initializeEventConfig(_e.eventConfig), Zt.globalCursor(Zt._eventConfig.globalCursor);
  const Sn = runtime(Zt, _e, Qt.expr);
  Zt._runtime = Sn, Zt._signals = Sn.signals, Zt._bind = (_e.bindings || []).map((kn) => ({
    state: null,
    param: extend$1({}, kn)
  })), Sn.root && Sn.root.set($n), $n.source = Sn.data.root.input, Zt.pulse(Sn.data.root.input, Zt.changeset().insert($n.items)), Zt._width = Zt.width(), Zt._height = Zt.height(), Zt._viewWidth = viewWidth(Zt, Zt._width), Zt._viewHeight = viewHeight(Zt, Zt._height), Zt._origin = [0, 0], Zt._resize = 0, Zt._autosize = 1, initializeResize(Zt), background(Zt), cursor$1(Zt), Zt.description(_e.description), Qt.hover && Zt.hover(), Qt.container && Zt.initialize(Qt.container, Qt.bind);
}
function lookupSignal(_e, Qt) {
  return has$1(_e._signals, Qt) ? _e._signals[Qt] : error("Unrecognized signal name: " + $(Qt));
}
function findOperatorHandler(_e, Qt) {
  const Zt = (_e._targets || []).filter(($n) => $n._update && $n._update.handler === Qt);
  return Zt.length ? Zt[0] : null;
}
function addOperatorListener(_e, Qt, Zt, $n) {
  let Sn = findOperatorHandler(Zt, $n);
  return Sn || (Sn = trap(_e, () => $n(Qt, Zt.value)), Sn.handler = $n, _e.on(Zt, null, Sn)), _e;
}
function removeOperatorListener(_e, Qt, Zt) {
  const $n = findOperatorHandler(Qt, Zt);
  return $n && Qt._targets.remove($n), _e;
}
inherits(View$1, Dataflow, {
  // -- DATAFLOW / RENDERING ----
  async evaluate(_e, Qt, Zt) {
    if (await Dataflow.prototype.evaluate.call(this, _e, Qt), this._redraw || this._resize)
      try {
        this._renderer && (this._resize && (this._resize = 0, resizeRenderer(this)), await this._renderer.renderAsync(this._scenegraph.root)), this._redraw = !1;
      } catch ($n) {
        this.error($n);
      }
    return Zt && asyncCallback(this, Zt), this;
  },
  dirty(_e) {
    this._redraw = !0, this._renderer && this._renderer.dirty(_e);
  },
  // -- GET / SET ----
  description(_e) {
    if (arguments.length) {
      const Qt = _e != null ? _e + "" : null;
      return Qt !== this._desc && ariaLabel(this._el, this._desc = Qt), this;
    }
    return this._desc;
  },
  container() {
    return this._el;
  },
  scenegraph() {
    return this._scenegraph;
  },
  origin() {
    return this._origin.slice();
  },
  signal(_e, Qt, Zt) {
    const $n = lookupSignal(this, _e);
    return arguments.length === 1 ? $n.value : this.update($n, Qt, Zt);
  },
  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", padding$1(_e)) : padding$1(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 ? (renderModule(_e) || error("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 && (Dataflow.prototype.loader.call(this, _e), this._resetRenderer()), this) : this._loader;
  },
  resize() {
    return this._autosize = 1, this.touch(lookupSignal(this, "autosize"));
  },
  _resetRenderer() {
    this._renderer && (this._renderer = null, this.initialize(this._el, this._elBind));
  },
  // -- SIZING ----
  _resizeView: resizeView,
  // -- EVENT HANDLING ----
  addEventListener(_e, Qt, Zt) {
    let $n = Qt;
    return Zt && Zt.trap === !1 || ($n = trap(this, Qt), $n.raw = Qt), this._handler.on(_e, $n), this;
  },
  removeEventListener(_e, Qt) {
    for (var Zt = this._handler.handlers(_e), $n = Zt.length, Sn, kn; --$n >= 0; )
      if (kn = Zt[$n].type, Sn = Zt[$n].handler, _e === kn && (Qt === Sn || Qt === Sn.raw)) {
        this._handler.off(kn, Sn);
        break;
      }
    return this;
  },
  addResizeListener(_e) {
    const Qt = this._resizeListeners;
    return Qt.indexOf(_e) < 0 && Qt.push(_e), this;
  },
  removeResizeListener(_e) {
    var Qt = this._resizeListeners, Zt = Qt.indexOf(_e);
    return Zt >= 0 && Qt.splice(Zt, 1), this;
  },
  addSignalListener(_e, Qt) {
    return addOperatorListener(this, _e, lookupSignal(this, _e), Qt);
  },
  removeSignalListener(_e, Qt) {
    return removeOperatorListener(this, lookupSignal(this, _e), Qt);
  },
  addDataListener(_e, Qt) {
    return addOperatorListener(this, _e, dataref(this, _e).values, Qt);
  },
  removeDataListener(_e, Qt) {
    return removeOperatorListener(this, dataref(this, _e).values, Qt);
  },
  globalCursor(_e) {
    if (arguments.length) {
      if (this._globalCursor !== !!_e) {
        const Qt = setCursor(this, null);
        this._globalCursor = !!_e, Qt && setCursor(this, Qt);
      }
      return this;
    } else
      return this._globalCursor;
  },
  preventDefault(_e) {
    return arguments.length ? (this._preventDefault = _e, this) : this._preventDefault;
  },
  timer,
  events,
  finalize,
  hover,
  // -- DATA ----
  data,
  change,
  insert: insert$1,
  remove: remove$1,
  // -- SCALES --
  scale: scale$1,
  // -- INITIALIZATION ----
  initialize,
  // -- HEADLESS RENDERING ----
  toImageURL: renderToImageURL,
  toCanvas: renderToCanvas,
  toSVG: renderToSVG,
  // -- SAVE / RESTORE STATE ----
  getState,
  setState
});
const VIEW = "view", LBRACK = "[", RBRACK = "]", LBRACE = "{", RBRACE = "}", COLON = ":", COMMA = ",", NAME = "@", GT = ">", ILLEGAL = /[[\]{}]/, DEFAULT_MARKS = {
  "*": 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 DEFAULT_SOURCE, MARKS;
function eventSelector(_e, Qt, Zt) {
  return DEFAULT_SOURCE = Qt || VIEW, MARKS = Zt || DEFAULT_MARKS, parseMerge(_e.trim()).map(parseSelector);
}
function isMarkType(_e) {
  return MARKS[_e];
}
function find$1(_e, Qt, Zt, $n, Sn) {
  const kn = _e.length;
  let Kn = 0, er;
  for (; Qt < kn; ++Qt) {
    if (er = _e[Qt], !Kn && er === Zt)
      return Qt;
    Sn && Sn.indexOf(er) >= 0 ? --Kn : $n && $n.indexOf(er) >= 0 && ++Kn;
  }
  return Qt;
}
function parseMerge(_e) {
  const Qt = [], Zt = _e.length;
  let $n = 0, Sn = 0;
  for (; Sn < Zt; )
    Sn = find$1(_e, Sn, COMMA, LBRACK + LBRACE, RBRACK + RBRACE), Qt.push(_e.substring($n, Sn).trim()), $n = ++Sn;
  if (Qt.length === 0)
    throw "Empty event selector: " + _e;
  return Qt;
}
function parseSelector(_e) {
  return _e[0] === "[" ? parseBetween(_e) : parseStream$1(_e);
}
function parseBetween(_e) {
  const Qt = _e.length;
  let Zt = 1, $n;
  if (Zt = find$1(_e, Zt, RBRACK, LBRACK, RBRACK), Zt === Qt)
    throw "Empty between selector: " + _e;
  if ($n = parseMerge(_e.substring(1, Zt)), $n.length !== 2)
    throw "Between selector must have two elements: " + _e;
  if (_e = _e.slice(Zt + 1).trim(), _e[0] !== GT)
    throw "Expected '>' after between selector: " + _e;
  $n = $n.map(parseSelector);
  const Sn = parseSelector(_e.slice(1).trim());
  return Sn.between ? {
    between: $n,
    stream: Sn
  } : (Sn.between = $n, Sn);
}
function parseStream$1(_e) {
  const Qt = {
    source: DEFAULT_SOURCE
  }, Zt = [];
  let $n = [0, 0], Sn = 0, kn = 0, Kn = _e.length, er = 0, Cr, kr;
  if (_e[Kn - 1] === RBRACE) {
    if (er = _e.lastIndexOf(LBRACE), er >= 0) {
      try {
        $n = parseThrottle(_e.substring(er + 1, Kn - 1));
      } catch {
        throw "Invalid throttle specification: " + _e;
      }
      _e = _e.slice(0, er).trim(), Kn = _e.length;
    } else
      throw "Unmatched right brace: " + _e;
    er = 0;
  }
  if (!Kn)
    throw _e;
  if (_e[0] === NAME && (Sn = ++er), Cr = find$1(_e, er, COLON), Cr < Kn && (Zt.push(_e.substring(kn, Cr).trim()), kn = er = ++Cr), er = find$1(_e, er, LBRACK), er === Kn)
    Zt.push(_e.substring(kn, Kn).trim());
  else if (Zt.push(_e.substring(kn, er).trim()), kr = [], kn = ++er, kn === Kn)
    throw "Unmatched left bracket: " + _e;
  for (; er < Kn; ) {
    if (er = find$1(_e, er, RBRACK), er === Kn)
      throw "Unmatched left bracket: " + _e;
    if (kr.push(_e.substring(kn, er).trim()), er < Kn - 1 && _e[++er] !== LBRACK)
      throw "Expected left bracket: " + _e;
    kn = ++er;
  }
  if (!(Kn = Zt.length) || ILLEGAL.test(Zt[Kn - 1]))
    throw "Invalid event selector: " + _e;
  return Kn > 1 ? (Qt.type = Zt[1], Sn ? Qt.markname = Zt[0].slice(1) : isMarkType(Zt[0]) ? Qt.marktype = Zt[0] : Qt.source = Zt[0]) : Qt.type = Zt[0], Qt.type.slice(-1) === "!" && (Qt.consume = !0, Qt.type = Qt.type.slice(0, -1)), kr != null && (Qt.filter = kr), $n[0] && (Qt.throttle = $n[0]), $n[1] && (Qt.debounce = $n[1]), Qt;
}
function parseThrottle(_e) {
  const Qt = _e.split(COMMA);
  if (!_e.length || Qt.length > 2)
    throw _e;
  return Qt.map((Zt) => {
    const $n = +Zt;
    if ($n !== $n)
      throw _e;
    return $n;
  });
}
function parseAutosize(_e) {
  return isObject(_e) ? _e : {
    type: _e || "pad"
  };
}
const number = (_e) => +_e || 0, paddingObject = (_e) => ({
  top: _e,
  bottom: _e,
  left: _e,
  right: _e
});
function parsePadding(_e) {
  return isObject(_e) ? _e.signal ? _e : {
    top: number(_e.top),
    bottom: number(_e.bottom),
    left: number(_e.left),
    right: number(_e.right)
  } : paddingObject(number(_e));
}
const encoder = (_e) => isObject(_e) && !isArray(_e) ? extend$1({}, _e) : {
  value: _e
};
function addEncode(_e, Qt, Zt, $n) {
  return Zt != null ? (isObject(Zt) && !isArray(Zt) || isArray(Zt) && Zt.length && isObject(Zt[0]) ? _e.update[Qt] = Zt : _e[$n || "enter"][Qt] = {
    value: Zt
  }, 1) : 0;
}
function addEncoders(_e, Qt, Zt) {
  for (const $n in Qt)
    addEncode(_e, $n, Qt[$n]);
  for (const $n in Zt)
    addEncode(_e, $n, Zt[$n], "update");
}
function extendEncode(_e, Qt, Zt) {
  for (const $n in Qt)
    Zt && has$1(Zt, $n) || (_e[$n] = extend$1(_e[$n] || {}, Qt[$n]));
  return _e;
}
function has(_e, Qt) {
  return Qt && (Qt.enter && Qt.enter[_e] || Qt.update && Qt.update[_e]);
}
const MarkRole = "mark", FrameRole = "frame", ScopeRole = "scope", AxisRole = "axis", AxisDomainRole = "axis-domain", AxisGridRole = "axis-grid", AxisLabelRole = "axis-label", AxisTickRole = "axis-tick", AxisTitleRole = "axis-title", LegendRole = "legend", LegendBandRole = "legend-band", LegendEntryRole = "legend-entry", LegendGradientRole = "legend-gradient", LegendLabelRole = "legend-label", LegendSymbolRole = "legend-symbol", LegendTitleRole = "legend-title", TitleRole = "title", TitleTextRole = "title-text", TitleSubtitleRole = "title-subtitle";
function applyDefaults(_e, Qt, Zt, $n, Sn) {
  const kn = {}, Kn = {};
  let er, Cr, kr, Yr;
  Cr = "lineBreak", Qt === "text" && Sn[Cr] != null && !has(Cr, _e) && applyDefault(kn, Cr, Sn[Cr]), (Zt == "legend" || String(Zt).startsWith("axis")) && (Zt = null), Yr = Zt === FrameRole ? Sn.group : Zt === MarkRole ? extend$1({}, Sn.mark, Sn[Qt]) : null;
  for (Cr in Yr)
    kr = has(Cr, _e) || (Cr === "fill" || Cr === "stroke") && (has("fill", _e) || has("stroke", _e)), kr || applyDefault(kn, Cr, Yr[Cr]);
  array$6($n).forEach((Ms) => {
    const Ds = Sn.style && Sn.style[Ms];
    for (const Ls in Ds)
      has(Ls, _e) || applyDefault(kn, Ls, Ds[Ls]);
  }), _e = extend$1({}, _e);
  for (Cr in kn)
    Yr = kn[Cr], Yr.signal ? (er = er || {})[Cr] = Yr : Kn[Cr] = Yr;
  return _e.enter = extend$1(Kn, _e.enter), er && (_e.update = extend$1(er, _e.update)), _e;
}
function applyDefault(_e, Qt, Zt) {
  _e[Qt] = Zt && Zt.signal ? {
    signal: Zt.signal
  } : {
    value: Zt
  };
}
const scaleRef = (_e) => isString(_e) ? $(_e) : _e.signal ? `(${_e.signal})` : field(_e);
function entry$1(_e) {
  if (_e.gradient != null)
    return gradient$1(_e);
  let Qt = _e.signal ? `(${_e.signal})` : _e.color ? color$1(_e.color) : _e.field != null ? field(_e.field) : _e.value !== void 0 ? $(_e.value) : void 0;
  return _e.scale != null && (Qt = scale(_e, Qt)), Qt === void 0 && (Qt = null), _e.exponent != null && (Qt = `pow(${Qt},${property(_e.exponent)})`), _e.mult != null && (Qt += `*${property(_e.mult)}`), _e.offset != null && (Qt += `+${property(_e.offset)}`), _e.round && (Qt = `round(${Qt})`), Qt;
}
const _color = (_e, Qt, Zt, $n) => `(${_e}(${[Qt, Zt, $n].map(entry$1).join(",")})+'')`;
function color$1(_e) {
  return _e.c ? _color("hcl", _e.h, _e.c, _e.l) : _e.h || _e.s ? _color("hsl", _e.h, _e.s, _e.l) : _e.l || _e.a ? _color("lab", _e.l, _e.a, _e.b) : _e.r || _e.g || _e.b ? _color("rgb", _e.r, _e.g, _e.b) : null;
}
function gradient$1(_e) {
  const Qt = [_e.start, _e.stop, _e.count].map((Zt) => Zt == null ? null : $(Zt));
  for (; Qt.length && peek$1(Qt) == null; )
    Qt.pop();
  return Qt.unshift(scaleRef(_e.gradient)), `gradient(${Qt.join(",")})`;
}
function property(_e) {
  return isObject(_e) ? "(" + entry$1(_e) + ")" : _e;
}
function field(_e) {
  return resolveField(isObject(_e) ? _e : {
    datum: _e
  });
}
function resolveField(_e) {
  let Qt, Zt, $n;
  if (_e.signal)
    Qt = "datum", $n = _e.signal;
  else if (_e.group || _e.parent) {
    for (Zt = Math.max(1, _e.level || 1), Qt = "item"; Zt-- > 0; )
      Qt += ".mark.group";
    _e.parent ? ($n = _e.parent, Qt += ".datum") : $n = _e.group;
  } else
    _e.datum ? (Qt = "datum", $n = _e.datum) : error("Invalid field reference: " + $(_e));
  return _e.signal || ($n = isString($n) ? splitAccessPath($n).map($).join("][") : resolveField($n)), Qt + "[" + $n + "]";
}
function scale(_e, Qt) {
  const Zt = scaleRef(_e.scale);
  return _e.range != null ? Qt = `lerp(_range(${Zt}), ${+_e.range})` : (Qt !== void 0 && (Qt = `_scale(${Zt}, ${Qt})`), _e.band && (Qt = (Qt ? Qt + "+" : "") + `_bandwidth(${Zt})` + (+_e.band == 1 ? "" : "*" + property(_e.band)), _e.extra && (Qt = `(datum.extra ? _scale(${Zt}, datum.extra.value) : ${Qt})`)), Qt == null && (Qt = "0")), Qt;
}
function rule$1(_e) {
  let Qt = "";
  return _e.forEach((Zt) => {
    const $n = entry$1(Zt);
    Qt += Zt.test ? `(${Zt.test})?${$n}:` : $n;
  }), peek$1(Qt) === ":" && (Qt += "null"), Qt;
}
function parseEncode(_e, Qt, Zt, $n, Sn, kn) {
  const Kn = {};
  kn = kn || {}, kn.encoders = {
    $encode: Kn
  }, _e = applyDefaults(_e, Qt, Zt, $n, Sn.config);
  for (const er in _e)
    Kn[er] = parseBlock(_e[er], Qt, kn, Sn);
  return kn;
}
function parseBlock(_e, Qt, Zt, $n) {
  const Sn = {}, kn = {};
  for (const Kn in _e)
    _e[Kn] != null && (Sn[Kn] = parse$1(expr(_e[Kn]), $n, Zt, kn));
  return {
    $expr: {
      marktype: Qt,
      channels: Sn
    },
    $fields: Object.keys(kn),
    $output: Object.keys(_e)
  };
}
function expr(_e) {
  return isArray(_e) ? rule$1(_e) : entry$1(_e);
}
function parse$1(_e, Qt, Zt, $n) {
  const Sn = parser(_e, Qt);
  return Sn.$fields.forEach((kn) => $n[kn] = 1), extend$1(Zt, Sn.$params), Sn.$expr;
}
const OUTER = "outer", OUTER_INVALID = ["value", "update", "init", "react", "bind"];
function outerError(_e, Qt) {
  error(_e + ' for "outer" push: ' + $(Qt));
}
function parseSignal(_e, Qt) {
  const Zt = _e.name;
  if (_e.push === OUTER)
    Qt.signals[Zt] || outerError("No prior signal definition", Zt), OUTER_INVALID.forEach(($n) => {
      _e[$n] !== void 0 && outerError("Invalid property ", $n);
    });
  else {
    const $n = Qt.addSignal(Zt, _e.value);
    _e.react === !1 && ($n.react = !1), _e.bind && Qt.addBinding(Zt, _e.bind);
  }
}
function Entry$1(_e, Qt, Zt, $n) {
  this.id = -1, this.type = _e, this.value = Qt, this.params = Zt, $n && (this.parent = $n);
}
function entry(_e, Qt, Zt, $n) {
  return new Entry$1(_e, Qt, Zt, $n);
}
function operator(_e, Qt) {
  return entry("operator", _e, Qt);
}
function ref(_e) {
  const Qt = {
    $ref: _e.id
  };
  return _e.id < 0 && (_e.refs = _e.refs || []).push(Qt), Qt;
}
function fieldRef$1(_e, Qt) {
  return Qt ? {
    $field: _e,
    $name: Qt
  } : {
    $field: _e
  };
}
const keyFieldRef = fieldRef$1("key");
function compareRef(_e, Qt) {
  return {
    $compare: _e,
    $order: Qt
  };
}
function keyRef(_e, Qt) {
  const Zt = {
    $key: _e
  };
  return Qt && (Zt.$flat = !0), Zt;
}
const Ascending = "ascending", Descending = "descending";
function sortKey(_e) {
  return isObject(_e) ? (_e.order === Descending ? "-" : "+") + aggrField(_e.op, _e.field) : "";
}
function aggrField(_e, Qt) {
  return (_e && _e.signal ? "$" + _e.signal : _e || "") + (_e && Qt ? "_" : "") + (Qt && Qt.signal ? "$" + Qt.signal : Qt || "");
}
const Scope$1 = "scope", View = "view";
function isSignal(_e) {
  return _e && _e.signal;
}
function isExpr$1(_e) {
  return _e && _e.expr;
}
function hasSignal(_e) {
  if (isSignal(_e))
    return !0;
  if (isObject(_e)) {
    for (const Qt in _e)
      if (hasSignal(_e[Qt]))
        return !0;
  }
  return !1;
}
function value(_e, Qt) {
  return _e ?? Qt;
}
function deref(_e) {
  return _e && _e.signal || _e;
}
const Timer = "timer";
function parseStream(_e, Qt) {
  return (_e.merge ? mergeStream : _e.stream ? nestedStream : _e.type ? eventStream : error("Invalid stream specification: " + $(_e)))(_e, Qt);
}
function eventSource(_e) {
  return _e === Scope$1 ? View : _e || View;
}
function mergeStream(_e, Qt) {
  const Zt = _e.merge.map((Sn) => parseStream(Sn, Qt)), $n = streamParameters({
    merge: Zt
  }, _e, Qt);
  return Qt.addStream($n).id;
}
function nestedStream(_e, Qt) {
  const Zt = parseStream(_e.stream, Qt), $n = streamParameters({
    stream: Zt
  }, _e, Qt);
  return Qt.addStream($n).id;
}
function eventStream(_e, Qt) {
  let Zt;
  _e.type === Timer ? (Zt = Qt.event(Timer, _e.throttle), _e = {
    between: _e.between,
    filter: _e.filter
  }) : Zt = Qt.event(eventSource(_e.source), _e.type);
  const $n = streamParameters({
    stream: Zt
  }, _e, Qt);
  return Object.keys($n).length === 1 ? Zt : Qt.addStream($n).id;
}
function streamParameters(_e, Qt, Zt) {
  let $n = Qt.between;
  return $n && ($n.length !== 2 && error('Stream "between" parameter must have 2 entries: ' + $(Qt)), _e.between = [parseStream($n[0], Zt), parseStream($n[1], Zt)]), $n = Qt.filter ? [].concat(Qt.filter) : [], (Qt.marktype || Qt.markname || Qt.markrole) && $n.push(filterMark(Qt.marktype, Qt.markname, Qt.markrole)), Qt.source === Scope$1 && $n.push("inScope(event.item)"), $n.length && (_e.filter = parser("(" + $n.join(")&&(") + ")", Zt).$expr), ($n = Qt.throttle) != null && (_e.throttle = +$n), ($n = Qt.debounce) != null && (_e.debounce = +$n), Qt.consume && (_e.consume = !0), _e;
}
function filterMark(_e, Qt, Zt) {
  const $n = "event.item";
  return $n + (_e && _e !== "*" ? "&&" + $n + ".mark.marktype==='" + _e + "'" : "") + (Zt ? "&&" + $n + ".mark.role==='" + Zt + "'" : "") + (Qt ? "&&" + $n + ".mark.name==='" + Qt + "'" : "");
}
const OP_VALUE_EXPR = {
  code: "_.$value",
  ast: {
    type: "Identifier",
    value: "value"
  }
};
function parseUpdate(_e, Qt, Zt) {
  const $n = _e.encode, Sn = {
    target: Zt
  };
  let kn = _e.events, Kn = _e.update, er = [];
  kn || error("Signal update missing events specification."), isString(kn) && (kn = eventSelector(kn, Qt.isSubscope() ? Scope$1 : View)), kn = array$6(kn).filter((Cr) => Cr.signal || Cr.scale ? (er.push(Cr), 0) : 1), er.length > 1 && (er = [mergeSources(er)]), kn.length && er.push(kn.length > 1 ? {
    merge: kn
  } : kn[0]), $n != null && (Kn && error("Signal encode and update are mutually exclusive."), Kn = "encode(item()," + $($n) + ")"), Sn.update = isString(Kn) ? parser(Kn, Qt) : Kn.expr != null ? parser(Kn.expr, Qt) : Kn.value != null ? Kn.value : Kn.signal != null ? {
    $expr: OP_VALUE_EXPR,
    $params: {
      $value: Qt.signalRef(Kn.signal)
    }
  } : error("Invalid signal update specification."), _e.force && (Sn.options = {
    force: !0
  }), er.forEach((Cr) => Qt.addUpdate(extend$1(streamSource(Cr, Qt), Sn)));
}
function streamSource(_e, Qt) {
  return {
    source: _e.signal ? Qt.signalRef(_e.signal) : _e.scale ? Qt.scaleRef(_e.scale) : parseStream(_e, Qt)
  };
}
function mergeSources(_e) {
  return {
    signal: "[" + _e.map((Qt) => Qt.scale ? 'scale("' + Qt.scale + '")' : Qt.signal) + "]"
  };
}
function parseSignalUpdates(_e, Qt) {
  const Zt = Qt.getSignal(_e.name);
  let $n = _e.update;
  _e.init && ($n ? error("Signals can not include both init and update expressions.") : ($n = _e.init, Zt.initonly = !0)), $n && ($n = parser($n, Qt), Zt.update = $n.$expr, Zt.params = $n.$params), _e.on && _e.on.forEach((Sn) => parseUpdate(Sn, Qt, Zt.id));
}
const transform = (_e) => (Qt, Zt, $n) => entry(_e, Zt, Qt || void 0, $n), Aggregate = transform("aggregate"), AxisTicks = transform("axisticks"), Bound = transform("bound"), Collect = transform("collect"), Compare = transform("compare"), DataJoin = transform("datajoin"), Encode = transform("encode"), Expression = transform("expression"), Facet = transform("facet"), Field = transform("field"), Key = transform("key"), LegendEntries = transform("legendentries"), Load = transform("load"), Mark$1 = transform("mark"), MultiExtent = transform("multiextent"), MultiValues = transform("multivalues"), Overlap = transform("overlap"), Params = transform("params"), PreFacet = transform("prefacet"), Projection = transform("projection"), Proxy$1 = transform("proxy"), Relay = transform("relay"), Render = transform("render"), Scale = transform("scale"), Sieve = transform("sieve"), SortItems = transform("sortitems"), ViewLayout = transform("viewlayout"), Values = transform("values");
let FIELD_REF_ID = 0;
const MULTIDOMAIN_SORT_OPS = {
  min: "min",
  max: "max",
  count: "sum"
};
function initScale(_e, Qt) {
  const Zt = _e.type || "linear";
  isValidScaleType(Zt) || error("Unrecognized scale type: " + $(Zt)), Qt.addScale(_e.name, {
    type: Zt,
    domain: void 0
  });
}
function parseScale(_e, Qt) {
  const Zt = Qt.getScale(_e.name).params;
  let $n;
  Zt.domain = parseScaleDomain$1(_e.domain, _e, Qt), _e.range != null && (Zt.range = parseScaleRange$1(_e, Qt, Zt)), _e.interpolate != null && parseScaleInterpolate(_e.interpolate, Zt), _e.nice != null && (Zt.nice = parseScaleNice(_e.nice)), _e.bins != null && (Zt.bins = parseScaleBins(_e.bins, Qt));
  for ($n in _e)
    has$1(Zt, $n) || $n === "name" || (Zt[$n] = parseLiteral(_e[$n], Qt));
}
function parseLiteral(_e, Qt) {
  return isObject(_e) ? _e.signal ? Qt.signalRef(_e.signal) : error("Unsupported object: " + $(_e)) : _e;
}
function parseArray(_e, Qt) {
  return _e.signal ? Qt.signalRef(_e.signal) : _e.map((Zt) => parseLiteral(Zt, Qt));
}
function dataLookupError(_e) {
  error("Can not find data set: " + $(_e));
}
function parseScaleDomain$1(_e, Qt, Zt) {
  if (!_e) {
    (Qt.domainMin != null || Qt.domainMax != null) && error("No scale domain defined for domainMin/domainMax to override.");
    return;
  }
  return _e.signal ? Zt.signalRef(_e.signal) : (isArray(_e) ? explicitDomain : _e.fields ? multipleDomain : singularDomain)(_e, Qt, Zt);
}
function explicitDomain(_e, Qt, Zt) {
  return _e.map(($n) => parseLiteral($n, Zt));
}
function singularDomain(_e, Qt, Zt) {
  const $n = Zt.getData(_e.data);
  return $n || dataLookupError(_e.data), isDiscrete$2(Qt.type) ? $n.valuesRef(Zt, _e.field, parseSort(_e.sort, !1)) : isQuantile$1(Qt.type) ? $n.domainRef(Zt, _e.field) : $n.extentRef(Zt, _e.field);
}
function multipleDomain(_e, Qt, Zt) {
  const $n = _e.data, Sn = _e.fields.reduce((kn, Kn) => (Kn = isString(Kn) ? {
    data: $n,
    field: Kn
  } : isArray(Kn) || Kn.signal ? fieldRef(Kn, Zt) : Kn, kn.push(Kn), kn), []);
  return (isDiscrete$2(Qt.type) ? ordinalMultipleDomain : isQuantile$1(Qt.type) ? quantileMultipleDomain : numericMultipleDomain)(_e, Zt, Sn);
}
function fieldRef(_e, Qt) {
  const Zt = "_:vega:_" + FIELD_REF_ID++, $n = Collect({});
  if (isArray(_e))
    $n.value = {
      $ingest: _e
    };
  else if (_e.signal) {
    const Sn = "setdata(" + $(Zt) + "," + _e.signal + ")";
    $n.params.input = Qt.signalRef(Sn);
  }
  return Qt.addDataPipeline(Zt, [$n, Sieve({})]), {
    data: Zt,
    field: "data"
  };
}
function ordinalMultipleDomain(_e, Qt, Zt) {
  const $n = parseSort(_e.sort, !0);
  let Sn, kn;
  const Kn = Zt.map((kr) => {
    const Yr = Qt.getData(kr.data);
    return Yr || dataLookupError(kr.data), Yr.countsRef(Qt, kr.field, $n);
  }), er = {
    groupby: keyFieldRef,
    pulse: Kn
  };
  $n && (Sn = $n.op || "count", kn = $n.field ? aggrField(Sn, $n.field) : "count", er.ops = [MULTIDOMAIN_SORT_OPS[Sn]], er.fields = [Qt.fieldRef(kn)], er.as = [kn]), Sn = Qt.add(Aggregate(er));
  const Cr = Qt.add(Collect({
    pulse: ref(Sn)
  }));
  return kn = Qt.add(Values({
    field: keyFieldRef,
    sort: Qt.sortRef($n),
    pulse: ref(Cr)
  })), ref(kn);
}
function parseSort(_e, Qt) {
  return _e && (!_e.field && !_e.op ? isObject(_e) ? _e.field = "key" : _e = {
    field: "key"
  } : !_e.field && _e.op !== "count" ? error("No field provided for sort aggregate op: " + _e.op) : Qt && _e.field && _e.op && !MULTIDOMAIN_SORT_OPS[_e.op] && error("Multiple domain scales can not be sorted using " + _e.op)), _e;
}
function quantileMultipleDomain(_e, Qt, Zt) {
  const $n = Zt.map((Sn) => {
    const kn = Qt.getData(Sn.data);
    return kn || dataLookupError(Sn.data), kn.domainRef(Qt, Sn.field);
  });
  return ref(Qt.add(MultiValues({
    values: $n
  })));
}
function numericMultipleDomain(_e, Qt, Zt) {
  const $n = Zt.map((Sn) => {
    const kn = Qt.getData(Sn.data);
    return kn || dataLookupError(Sn.data), kn.extentRef(Qt, Sn.field);
  });
  return ref(Qt.add(MultiExtent({
    extents: $n
  })));
}
function parseScaleBins(_e, Qt) {
  return _e.signal || isArray(_e) ? parseArray(_e, Qt) : Qt.objectProperty(_e);
}
function parseScaleNice(_e) {
  return isObject(_e) ? {
    interval: parseLiteral(_e.interval),
    step: parseLiteral(_e.step)
  } : parseLiteral(_e);
}
function parseScaleInterpolate(_e, Qt) {
  Qt.interpolate = parseLiteral(_e.type || _e), _e.gamma != null && (Qt.interpolateGamma = parseLiteral(_e.gamma));
}
function parseScaleRange$1(_e, Qt, Zt) {
  const $n = Qt.config.range;
  let Sn = _e.range;
  if (Sn.signal)
    return Qt.signalRef(Sn.signal);
  if (isString(Sn)) {
    if ($n && has$1($n, Sn))
      return _e = extend$1({}, _e, {
        range: $n[Sn]
      }), parseScaleRange$1(_e, Qt, Zt);
    Sn === "width" ? Sn = [0, {
      signal: "width"
    }] : Sn === "height" ? Sn = isDiscrete$2(_e.type) ? [0, {
      signal: "height"
    }] : [{
      signal: "height"
    }, 0] : error("Unrecognized scale range value: " + $(Sn));
  } else if (Sn.scheme) {
    Zt.scheme = isArray(Sn.scheme) ? parseArray(Sn.scheme, Qt) : parseLiteral(Sn.scheme, Qt), Sn.extent && (Zt.schemeExtent = parseArray(Sn.extent, Qt)), Sn.count && (Zt.schemeCount = parseLiteral(Sn.count, Qt));
    return;
  } else if (Sn.step) {
    Zt.rangeStep = parseLiteral(Sn.step, Qt);
    return;
  } else {
    if (isDiscrete$2(_e.type) && !isArray(Sn))
      return parseScaleDomain$1(Sn, _e, Qt);
    isArray(Sn) || error("Unsupported range type: " + $(Sn));
  }
  return Sn.map((kn) => (isArray(kn) ? parseArray : parseLiteral)(kn, Qt));
}
function parseProjection$1(_e, Qt) {
  const Zt = Qt.config.projection || {}, $n = {};
  for (const Sn in _e)
    Sn !== "name" && ($n[Sn] = parseParameter$1(_e[Sn], Sn, Qt));
  for (const Sn in Zt)
    $n[Sn] == null && ($n[Sn] = parseParameter$1(Zt[Sn], Sn, Qt));
  Qt.addProjection(_e.name, $n);
}
function parseParameter$1(_e, Qt, Zt) {
  return isArray(_e) ? _e.map(($n) => parseParameter$1($n, Qt, Zt)) : isObject(_e) ? _e.signal ? Zt.signalRef(_e.signal) : Qt === "fit" ? _e : error("Unsupported parameter object: " + $(_e)) : _e;
}
const Top = "top", Left = "left", Right = "right", Bottom = "bottom", Center = "center", Vertical = "vertical", Start = "start", Middle = "middle", End = "end", Index = "index", Label = "label", Offset = "offset", Perc = "perc", Perc2 = "perc2", Value = "value", GuideLabelStyle = "guide-label", GuideTitleStyle = "guide-title", GroupTitleStyle = "group-title", GroupSubtitleStyle = "group-subtitle", Symbols = "symbol", Gradient = "gradient", Discrete = "discrete", Size = "size", Shape = "shape", Fill = "fill", Stroke = "stroke", StrokeWidth = "strokeWidth", StrokeDash = "strokeDash", Opacity = "opacity", LegendScales = [Size, Shape, Fill, Stroke, StrokeWidth, StrokeDash, Opacity], Skip = {
  name: 1,
  style: 1,
  interactive: 1
}, zero$1 = {
  value: 0
}, one = {
  value: 1
}, GroupMark = "group", RectMark = "rect", RuleMark = "rule", SymbolMark = "symbol", TextMark = "text";
function guideGroup(_e) {
  return _e.type = GroupMark, _e.interactive = _e.interactive || !1, _e;
}
function lookup(_e, Qt) {
  const Zt = ($n, Sn) => value(_e[$n], value(Qt[$n], Sn));
  return Zt.isVertical = ($n) => Vertical === value(_e.direction, Qt.direction || ($n ? Qt.symbolDirection : Qt.gradientDirection)), Zt.gradientLength = () => value(_e.gradientLength, Qt.gradientLength || Qt.gradientWidth), Zt.gradientThickness = () => value(_e.gradientThickness, Qt.gradientThickness || Qt.gradientHeight), Zt.entryColumns = () => value(_e.columns, value(Qt.columns, +Zt.isVertical(!0))), Zt;
}
function getEncoding(_e, Qt) {
  const Zt = Qt && (Qt.update && Qt.update[_e] || Qt.enter && Qt.enter[_e]);
  return Zt && Zt.signal ? Zt : Zt ? Zt.value : null;
}
function getStyle$2(_e, Qt, Zt) {
  const $n = Qt.config.style[Zt];
  return $n && $n[_e];
}
function anchorExpr(_e, Qt, Zt) {
  return `item.anchor === '${Start}' ? ${_e} : item.anchor === '${End}' ? ${Qt} : ${Zt}`;
}
const alignExpr$1 = anchorExpr($(Left), $(Right), $(Center));
function tickBand(_e) {
  const Qt = _e("tickBand");
  let Zt = _e("tickOffset"), $n, Sn;
  return Qt ? Qt.signal ? ($n = {
    signal: `(${Qt.signal}) === 'extent' ? 1 : 0.5`
  }, Sn = {
    signal: `(${Qt.signal}) === 'extent'`
  }, isObject(Zt) || (Zt = {
    signal: `(${Qt.signal}) === 'extent' ? 0 : ${Zt}`
  })) : Qt === "extent" ? ($n = 1, Sn = !0, Zt = 0) : ($n = 0.5, Sn = !1) : ($n = _e("bandPosition"), Sn = _e("tickExtra")), {
    extra: Sn,
    band: $n,
    offset: Zt
  };
}
function extendOffset(_e, Qt) {
  return Qt ? _e ? isObject(_e) ? Object.assign({}, _e, {
    offset: extendOffset(_e.offset, Qt)
  }) : {
    value: _e,
    offset: Qt
  } : Qt : _e;
}
function guideMark(_e, Qt) {
  return Qt ? (_e.name = Qt.name, _e.style = Qt.style || _e.style, _e.interactive = !!Qt.interactive, _e.encode = extendEncode(_e.encode, Qt, Skip)) : _e.interactive = !1, _e;
}
function legendGradient(_e, Qt, Zt, $n) {
  const Sn = lookup(_e, Zt), kn = Sn.isVertical(), Kn = Sn.gradientThickness(), er = Sn.gradientLength();
  let Cr, kr, Yr, Ms, Ds;
  kn ? (kr = [0, 1], Yr = [0, 0], Ms = Kn, Ds = er) : (kr = [0, 0], Yr = [1, 0], Ms = er, Ds = Kn);
  const Ls = {
    enter: Cr = {
      opacity: zero$1,
      x: zero$1,
      y: zero$1,
      width: encoder(Ms),
      height: encoder(Ds)
    },
    update: extend$1({}, Cr, {
      opacity: one,
      fill: {
        gradient: Qt,
        start: kr,
        stop: Yr
      }
    }),
    exit: {
      opacity: zero$1
    }
  };
  return addEncoders(Ls, {
    stroke: Sn("gradientStrokeColor"),
    strokeWidth: Sn("gradientStrokeWidth")
  }, {
    // update
    opacity: Sn("gradientOpacity")
  }), guideMark({
    type: RectMark,
    role: LegendGradientRole,
    encode: Ls
  }, $n);
}
function legendGradientDiscrete(_e, Qt, Zt, $n, Sn) {
  const kn = lookup(_e, Zt), Kn = kn.isVertical(), er = kn.gradientThickness(), Cr = kn.gradientLength();
  let kr, Yr, Ms, Ds, Ls = "";
  Kn ? (kr = "y", Ms = "y2", Yr = "x", Ds = "width", Ls = "1-") : (kr = "x", Ms = "x2", Yr = "y", Ds = "height");
  const js = {
    opacity: zero$1,
    fill: {
      scale: Qt,
      field: Value
    }
  };
  js[kr] = {
    signal: Ls + "datum." + Perc,
    mult: Cr
  }, js[Yr] = zero$1, js[Ms] = {
    signal: Ls + "datum." + Perc2,
    mult: Cr
  }, js[Ds] = encoder(er);
  const zs = {
    enter: js,
    update: extend$1({}, js, {
      opacity: one
    }),
    exit: {
      opacity: zero$1
    }
  };
  return addEncoders(zs, {
    stroke: kn("gradientStrokeColor"),
    strokeWidth: kn("gradientStrokeWidth")
  }, {
    // update
    opacity: kn("gradientOpacity")
  }), guideMark({
    type: RectMark,
    role: LegendBandRole,
    key: Value,
    from: Sn,
    encode: zs
  }, $n);
}
const alignExpr = `datum.${Perc}<=0?"${Left}":datum.${Perc}>=1?"${Right}":"${Center}"`, baselineExpr = `datum.${Perc}<=0?"${Bottom}":datum.${Perc}>=1?"${Top}":"${Middle}"`;
function legendGradientLabels(_e, Qt, Zt, $n) {
  const Sn = lookup(_e, Qt), kn = Sn.isVertical(), Kn = encoder(Sn.gradientThickness()), er = Sn.gradientLength();
  let Cr = Sn("labelOverlap"), kr, Yr, Ms, Ds, Ls = "";
  const js = {
    enter: kr = {
      opacity: zero$1
    },
    update: Yr = {
      opacity: one,
      text: {
        field: Label
      }
    },
    exit: {
      opacity: zero$1
    }
  };
  return addEncoders(js, {
    fill: Sn("labelColor"),
    fillOpacity: Sn("labelOpacity"),
    font: Sn("labelFont"),
    fontSize: Sn("labelFontSize"),
    fontStyle: Sn("labelFontStyle"),
    fontWeight: Sn("labelFontWeight"),
    limit: value(_e.labelLimit, Qt.gradientLabelLimit)
  }), kn ? (kr.align = {
    value: "left"
  }, kr.baseline = Yr.baseline = {
    signal: baselineExpr
  }, Ms = "y", Ds = "x", Ls = "1-") : (kr.align = Yr.align = {
    signal: alignExpr
  }, kr.baseline = {
    value: "top"
  }, Ms = "x", Ds = "y"), kr[Ms] = Yr[Ms] = {
    signal: Ls + "datum." + Perc,
    mult: er
  }, kr[Ds] = Yr[Ds] = Kn, Kn.offset = value(_e.labelOffset, Qt.gradientLabelOffset) || 0, Cr = Cr ? {
    separation: Sn("labelSeparation"),
    method: Cr,
    order: "datum." + Index
  } : void 0, guideMark({
    type: TextMark,
    role: LegendLabelRole,
    style: GuideLabelStyle,
    key: Value,
    from: $n,
    encode: js,
    overlap: Cr
  }, Zt);
}
function legendSymbolGroups(_e, Qt, Zt, $n, Sn) {
  const kn = lookup(_e, Qt), Kn = Zt.entries, er = !!(Kn && Kn.interactive), Cr = Kn ? Kn.name : void 0, kr = kn("clipHeight"), Yr = kn("symbolOffset"), Ms = {
    data: "value"
  }, Ds = `(${Sn}) ? datum.${Offset} : datum.${Size}`, Ls = kr ? encoder(kr) : {
    field: Size
  }, js = `datum.${Index}`, zs = `max(1, ${Sn})`;
  let Fs, Bs, Hs, Ws, Ys;
  Ls.mult = 0.5, Fs = {
    enter: Bs = {
      opacity: zero$1,
      x: {
        signal: Ds,
        mult: 0.5,
        offset: Yr
      },
      y: Ls
    },
    update: Hs = {
      opacity: one,
      x: Bs.x,
      y: Bs.y
    },
    exit: {
      opacity: zero$1
    }
  };
  let El = null, Mu = null;
  _e.fill || (El = Qt.symbolBaseFillColor, Mu = Qt.symbolBaseStrokeColor), addEncoders(Fs, {
    fill: kn("symbolFillColor", El),
    shape: kn("symbolType"),
    size: kn("symbolSize"),
    stroke: kn("symbolStrokeColor", Mu),
    strokeDash: kn("symbolDash"),
    strokeDashOffset: kn("symbolDashOffset"),
    strokeWidth: kn("symbolStrokeWidth")
  }, {
    // update
    opacity: kn("symbolOpacity")
  }), LegendScales.forEach((Au) => {
    _e[Au] && (Hs[Au] = Bs[Au] = {
      scale: _e[Au],
      field: Value
    });
  });
  const Pl = guideMark({
    type: SymbolMark,
    role: LegendSymbolRole,
    key: Value,
    from: Ms,
    clip: kr ? !0 : void 0,
    encode: Fs
  }, Zt.symbols), Iu = encoder(Yr);
  Iu.offset = kn("labelOffset"), Fs = {
    enter: Bs = {
      opacity: zero$1,
      x: {
        signal: Ds,
        offset: Iu
      },
      y: Ls
    },
    update: Hs = {
      opacity: one,
      text: {
        field: Label
      },
      x: Bs.x,
      y: Bs.y
    },
    exit: {
      opacity: zero$1
    }
  }, addEncoders(Fs, {
    align: kn("labelAlign"),
    baseline: kn("labelBaseline"),
    fill: kn("labelColor"),
    fillOpacity: kn("labelOpacity"),
    font: kn("labelFont"),
    fontSize: kn("labelFontSize"),
    fontStyle: kn("labelFontStyle"),
    fontWeight: kn("labelFontWeight"),
    limit: kn("labelLimit")
  });
  const Tu = guideMark({
    type: TextMark,
    role: LegendLabelRole,
    style: GuideLabelStyle,
    key: Value,
    from: Ms,
    encode: Fs
  }, Zt.labels);
  return Fs = {
    enter: {
      noBound: {
        value: !kr
      },
      // ignore width/height in bounds calc
      width: zero$1,
      height: kr ? encoder(kr) : zero$1,
      opacity: zero$1
    },
    exit: {
      opacity: zero$1
    },
    update: Hs = {
      opacity: one,
      row: {
        signal: null
      },
      column: {
        signal: null
      }
    }
  }, kn.isVertical(!0) ? (Ws = `ceil(item.mark.items.length / ${zs})`, Hs.row.signal = `${js}%${Ws}`, Hs.column.signal = `floor(${js} / ${Ws})`, Ys = {
    field: ["row", js]
  }) : (Hs.row.signal = `floor(${js} / ${zs})`, Hs.column.signal = `${js} % ${zs}`, Ys = {
    field: js
  }), Hs.column.signal = `(${Sn})?${Hs.column.signal}:${js}`, $n = {
    facet: {
      data: $n,
      name: "value",
      groupby: Index
    }
  }, guideGroup({
    role: ScopeRole,
    from: $n,
    encode: extendEncode(Fs, Kn, Skip),
    marks: [Pl, Tu],
    name: Cr,
    interactive: er,
    sort: Ys
  });
}
function legendSymbolLayout(_e, Qt) {
  const Zt = lookup(_e, Qt);
  return {
    align: Zt("gridAlign"),
    columns: Zt.entryColumns(),
    center: {
      row: !0,
      column: !1
    },
    padding: {
      row: Zt("rowPadding"),
      column: Zt("columnPadding")
    }
  };
}
const isL = 'item.orient === "left"', isR = 'item.orient === "right"', isLR = `(${isL} || ${isR})`, isVG = `datum.vgrad && ${isLR}`, baseline$1 = anchorExpr('"top"', '"bottom"', '"middle"'), alignFlip = anchorExpr('"right"', '"left"', '"center"'), exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr$1}`, exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline$1}) : "top"`;
function legendTitle(_e, Qt, Zt, $n) {
  const Sn = lookup(_e, Qt), kn = {
    enter: {
      opacity: zero$1
    },
    update: {
      opacity: one,
      x: {
        field: {
          group: "padding"
        }
      },
      y: {
        field: {
          group: "padding"
        }
      }
    },
    exit: {
      opacity: zero$1
    }
  };
  return addEncoders(kn, {
    orient: Sn("titleOrient"),
    _anchor: Sn("titleAnchor"),
    anchor: {
      signal: exprAnchor
    },
    angle: {
      signal: exprAngle
    },
    align: {
      signal: exprAlign
    },
    baseline: {
      signal: exprBaseline
    },
    text: _e.title,
    fill: Sn("titleColor"),
    fillOpacity: Sn("titleOpacity"),
    font: Sn("titleFont"),
    fontSize: Sn("titleFontSize"),
    fontStyle: Sn("titleFontStyle"),
    fontWeight: Sn("titleFontWeight"),
    limit: Sn("titleLimit"),
    lineHeight: Sn("titleLineHeight")
  }, {
    // require update
    align: Sn("titleAlign"),
    baseline: Sn("titleBaseline")
  }), guideMark({
    type: TextMark,
    role: LegendTitleRole,
    style: GuideTitleStyle,
    from: $n,
    encode: kn
  }, Zt);
}
function clip$1(_e, Qt) {
  let Zt;
  return isObject(_e) && (_e.signal ? Zt = _e.signal : _e.path ? Zt = "pathShape(" + param(_e.path) + ")" : _e.sphere && (Zt = "geoShape(" + param(_e.sphere) + ', {type: "Sphere"})')), Zt ? Qt.signalRef(Zt) : !!_e;
}
function param(_e) {
  return isObject(_e) && _e.signal ? _e.signal : $(_e);
}
function getRole(_e) {
  const Qt = _e.role || "";
  return !Qt.indexOf("axis") || !Qt.indexOf("legend") || !Qt.indexOf("title") ? Qt : _e.type === GroupMark ? ScopeRole : Qt || MarkRole;
}
function definition(_e) {
  return {
    marktype: _e.type,
    name: _e.name || void 0,
    role: _e.role || getRole(_e),
    zindex: +_e.zindex || void 0,
    aria: _e.aria,
    description: _e.description
  };
}
function interactive(_e, Qt) {
  return _e && _e.signal ? Qt.signalRef(_e.signal) : _e !== !1;
}
function parseTransform(_e, Qt) {
  const Zt = definition$1(_e.type);
  Zt || error("Unrecognized transform type: " + $(_e.type));
  const $n = entry(Zt.type.toLowerCase(), null, parseParameters(Zt, _e, Qt));
  return _e.signal && Qt.addSignal(_e.signal, Qt.proxy($n)), $n.metadata = Zt.metadata || {}, $n;
}
function parseParameters(_e, Qt, Zt) {
  const $n = {}, Sn = _e.params.length;
  for (let kn = 0; kn < Sn; ++kn) {
    const Kn = _e.params[kn];
    $n[Kn.name] = parseParameter(Kn, Qt, Zt);
  }
  return $n;
}
function parseParameter(_e, Qt, Zt) {
  const $n = _e.type, Sn = Qt[_e.name];
  if ($n === "index")
    return parseIndexParameter(_e, Qt, Zt);
  if (Sn === void 0) {
    _e.required && error("Missing required " + $(Qt.type) + " parameter: " + $(_e.name));
    return;
  } else {
    if ($n === "param")
      return parseSubParameters(_e, Qt, Zt);
    if ($n === "projection")
      return Zt.projectionRef(Qt[_e.name]);
  }
  return _e.array && !isSignal(Sn) ? Sn.map((kn) => parameterValue(_e, kn, Zt)) : parameterValue(_e, Sn, Zt);
}
function parameterValue(_e, Qt, Zt) {
  const $n = _e.type;
  if (isSignal(Qt))
    return isExpr($n) ? error("Expression references can not be signals.") : isField($n) ? Zt.fieldRef(Qt) : isCompare($n) ? Zt.compareRef(Qt) : Zt.signalRef(Qt.signal);
  {
    const Sn = _e.expr || isField($n);
    return Sn && outerExpr(Qt) ? Zt.exprRef(Qt.expr, Qt.as) : Sn && outerField(Qt) ? fieldRef$1(Qt.field, Qt.as) : isExpr($n) ? parser(Qt, Zt) : isData($n) ? ref(Zt.getData(Qt).values) : isField($n) ? fieldRef$1(Qt) : isCompare($n) ? Zt.compareRef(Qt) : Qt;
  }
}
function parseIndexParameter(_e, Qt, Zt) {
  return isString(Qt.from) || error('Lookup "from" parameter must be a string literal.'), Zt.getData(Qt.from).lookupRef(Zt, Qt.key);
}
function parseSubParameters(_e, Qt, Zt) {
  const $n = Qt[_e.name];
  return _e.array ? (isArray($n) || error("Expected an array of sub-parameters. Instead: " + $($n)), $n.map((Sn) => parseSubParameter(_e, Sn, Zt))) : parseSubParameter(_e, $n, Zt);
}
function parseSubParameter(_e, Qt, Zt) {
  const $n = _e.params.length;
  let Sn;
  for (let Kn = 0; Kn < $n; ++Kn) {
    Sn = _e.params[Kn];
    for (const er in Sn.key)
      if (Sn.key[er] !== Qt[er]) {
        Sn = null;
        break;
      }
    if (Sn)
      break;
  }
  Sn || error("Unsupported parameter: " + $(Qt));
  const kn = extend$1(parseParameters(Sn, Qt, Zt), Sn.key);
  return ref(Zt.add(Params(kn)));
}
const outerExpr = (_e) => _e && _e.expr, outerField = (_e) => _e && _e.field, isData = (_e) => _e === "data", isExpr = (_e) => _e === "expr", isField = (_e) => _e === "field", isCompare = (_e) => _e === "compare";
function parseData$1(_e, Qt, Zt) {
  let $n, Sn, kn, Kn, er;
  return _e ? ($n = _e.facet) && (Qt || error("Only group marks can be faceted."), $n.field != null ? Kn = er = getDataRef($n, Zt) : (_e.data ? er = ref(Zt.getData(_e.data).aggregate) : (kn = parseTransform(extend$1({
    type: "aggregate",
    groupby: array$6($n.groupby)
  }, $n.aggregate), Zt), kn.params.key = Zt.keyRef($n.groupby), kn.params.pulse = getDataRef($n, Zt), Kn = er = ref(Zt.add(kn))), Sn = Zt.keyRef($n.groupby, !0))) : Kn = ref(Zt.add(Collect(null, [{}]))), Kn || (Kn = getDataRef(_e, Zt)), {
    key: Sn,
    pulse: Kn,
    parent: er
  };
}
function getDataRef(_e, Qt) {
  return _e.$ref ? _e : _e.data && _e.data.$ref ? _e.data : ref(Qt.getData(_e.data).output);
}
function DataScope(_e, Qt, Zt, $n, Sn) {
  this.scope = _e, this.input = Qt, this.output = Zt, this.values = $n, this.aggregate = Sn, this.index = {};
}
DataScope.fromEntries = function(_e, Qt) {
  const Zt = Qt.length, $n = Qt[Zt - 1], Sn = Qt[Zt - 2];
  let kn = Qt[0], Kn = null, er = 1;
  for (kn && kn.type === "load" && (kn = Qt[1]), _e.add(Qt[0]); er < Zt; ++er)
    Qt[er].params.pulse = ref(Qt[er - 1]), _e.add(Qt[er]), Qt[er].type === "aggregate" && (Kn = Qt[er]);
  return new DataScope(_e, kn, Sn, $n, Kn);
};
function fieldKey(_e) {
  return isString(_e) ? _e : null;
}
function addSortField(_e, Qt, Zt) {
  const $n = aggrField(Zt.op, Zt.field);
  let Sn;
  if (Qt.ops) {
    for (let kn = 0, Kn = Qt.as.length; kn < Kn; ++kn)
      if (Qt.as[kn] === $n)
        return;
  } else
    Qt.ops = ["count"], Qt.fields = [null], Qt.as = ["count"];
  Zt.op && (Qt.ops.push((Sn = Zt.op.signal) ? _e.signalRef(Sn) : Zt.op), Qt.fields.push(_e.fieldRef(Zt.field)), Qt.as.push($n));
}
function cache(_e, Qt, Zt, $n, Sn, kn, Kn) {
  const er = Qt[Zt] || (Qt[Zt] = {}), Cr = sortKey(kn);
  let kr = fieldKey(Sn), Yr, Ms;
  if (kr != null && (_e = Qt.scope, kr = kr + (Cr ? "|" + Cr : ""), Yr = er[kr]), !Yr) {
    const Ds = kn ? {
      field: keyFieldRef,
      pulse: Qt.countsRef(_e, Sn, kn)
    } : {
      field: _e.fieldRef(Sn),
      pulse: ref(Qt.output)
    };
    Cr && (Ds.sort = _e.sortRef(kn)), Ms = _e.add(entry($n, void 0, Ds)), Kn && (Qt.index[Sn] = Ms), Yr = ref(Ms), kr != null && (er[kr] = Yr);
  }
  return Yr;
}
DataScope.prototype = {
  countsRef(_e, Qt, Zt) {
    const $n = this, Sn = $n.counts || ($n.counts = {}), kn = fieldKey(Qt);
    let Kn, er, Cr;
    return kn != null && (_e = $n.scope, Kn = Sn[kn]), Kn ? Zt && Zt.field && addSortField(_e, Kn.agg.params, Zt) : (Cr = {
      groupby: _e.fieldRef(Qt, "key"),
      pulse: ref($n.output)
    }, Zt && Zt.field && addSortField(_e, Cr, Zt), er = _e.add(Aggregate(Cr)), Kn = _e.add(Collect({
      pulse: ref(er)
    })), Kn = {
      agg: er,
      ref: ref(Kn)
    }, kn != null && (Sn[kn] = Kn)), Kn.ref;
  },
  tuplesRef() {
    return ref(this.values);
  },
  extentRef(_e, Qt) {
    return cache(_e, this, "extent", "extent", Qt, !1);
  },
  domainRef(_e, Qt) {
    return cache(_e, this, "domain", "values", Qt, !1);
  },
  valuesRef(_e, Qt, Zt) {
    return cache(_e, this, "vals", "values", Qt, Zt || !0);
  },
  lookupRef(_e, Qt) {
    return cache(_e, this, "lookup", "tupleindex", Qt, !1);
  },
  indataRef(_e, Qt) {
    return cache(_e, this, "indata", "tupleindex", Qt, !0, !0);
  }
};
function parseFacet(_e, Qt, Zt) {
  const $n = _e.from.facet, Sn = $n.name, kn = getDataRef($n, Qt);
  let Kn;
  $n.name || error("Facet must have a name: " + $($n)), $n.data || error("Facet must reference a data set: " + $($n)), $n.field ? Kn = Qt.add(PreFacet({
    field: Qt.fieldRef($n.field),
    pulse: kn
  })) : $n.groupby ? Kn = Qt.add(Facet({
    key: Qt.keyRef($n.groupby),
    group: ref(Qt.proxy(Zt.parent)),
    pulse: kn
  })) : error("Facet must specify groupby or field: " + $($n));
  const er = Qt.fork(), Cr = er.add(Collect()), kr = er.add(Sieve({
    pulse: ref(Cr)
  }));
  er.addData(Sn, new DataScope(er, Cr, Cr, kr)), er.addSignal("parent", null), Kn.params.subflow = {
    $subflow: er.parse(_e).toRuntime()
  };
}
function parseSubflow(_e, Qt, Zt) {
  const $n = Qt.add(PreFacet({
    pulse: Zt.pulse
  })), Sn = Qt.fork();
  Sn.add(Sieve()), Sn.addSignal("parent", null), $n.params.subflow = {
    $subflow: Sn.parse(_e).toRuntime()
  };
}
function parseTrigger(_e, Qt, Zt) {
  const $n = _e.remove, Sn = _e.insert, kn = _e.toggle, Kn = _e.modify, er = _e.values, Cr = Qt.add(operator()), kr = "if(" + _e.trigger + ',modify("' + Zt + '",' + [Sn, $n, kn, Kn, er].map((Ms) => Ms ?? "null").join(",") + "),0)", Yr = parser(kr, Qt);
  Cr.update = Yr.$expr, Cr.params = Yr.$params;
}
function parseMark(_e, Qt) {
  const Zt = getRole(_e), $n = _e.type === GroupMark, Sn = _e.from && _e.from.facet, kn = _e.overlap;
  let Kn = _e.layout || Zt === ScopeRole || Zt === FrameRole, er, Cr, kr, Yr, Ms, Ds, Ls;
  const js = Zt === MarkRole || Kn || Sn, zs = parseData$1(_e.from, $n, Qt);
  Cr = Qt.add(DataJoin({
    key: zs.key || (_e.key ? fieldRef$1(_e.key) : void 0),
    pulse: zs.pulse,
    clean: !$n
  }));
  const Fs = ref(Cr);
  Cr = kr = Qt.add(Collect({
    pulse: Fs
  })), Cr = Qt.add(Mark$1({
    markdef: definition(_e),
    interactive: interactive(_e.interactive, Qt),
    clip: clip$1(_e.clip, Qt),
    context: {
      $context: !0
    },
    groups: Qt.lookup(),
    parent: Qt.signals.parent ? Qt.signalRef("parent") : null,
    index: Qt.markpath(),
    pulse: ref(Cr)
  }));
  const Bs = ref(Cr);
  Cr = Yr = Qt.add(Encode(parseEncode(_e.encode, _e.type, Zt, _e.style, Qt, {
    mod: !1,
    pulse: Bs
  }))), Cr.params.parent = Qt.encode(), _e.transform && _e.transform.forEach((Mu) => {
    const Pl = parseTransform(Mu, Qt), Iu = Pl.metadata;
    (Iu.generates || Iu.changes) && error("Mark transforms should not generate new data."), Iu.nomod || (Yr.params.mod = !0), Pl.params.pulse = ref(Cr), Qt.add(Cr = Pl);
  }), _e.sort && (Cr = Qt.add(SortItems({
    sort: Qt.compareRef(_e.sort),
    pulse: ref(Cr)
  })));
  const Hs = ref(Cr);
  (Sn || Kn) && (Kn = Qt.add(ViewLayout({
    layout: Qt.objectProperty(_e.layout),
    legends: Qt.legends,
    mark: Bs,
    pulse: Hs
  })), Ds = ref(Kn));
  const Ws = Qt.add(Bound({
    mark: Bs,
    pulse: Ds || Hs
  }));
  Ls = ref(Ws), $n && (js && (er = Qt.operators, er.pop(), Kn && er.pop()), Qt.pushState(Hs, Ds || Ls, Fs), Sn ? parseFacet(_e, Qt, zs) : js ? parseSubflow(_e, Qt, zs) : Qt.parse(_e), Qt.popState(), js && (Kn && er.push(Kn), er.push(Ws))), kn && (Ls = parseOverlap(kn, Ls, Qt));
  const Ys = Qt.add(Render({
    pulse: Ls
  })), El = Qt.add(Sieve({
    pulse: ref(Ys)
  }, void 0, Qt.parent()));
  _e.name != null && (Ms = _e.name, Qt.addData(Ms, new DataScope(Qt, kr, Ys, El)), _e.on && _e.on.forEach((Mu) => {
    (Mu.insert || Mu.remove || Mu.toggle) && error("Marks only support modify triggers."), parseTrigger(Mu, Qt, Ms);
  }));
}
function parseOverlap(_e, Qt, Zt) {
  const $n = _e.method, Sn = _e.bound, kn = _e.separation, Kn = {
    separation: isSignal(kn) ? Zt.signalRef(kn.signal) : kn,
    method: isSignal($n) ? Zt.signalRef($n.signal) : $n,
    pulse: Qt
  };
  if (_e.order && (Kn.sort = Zt.compareRef({
    field: _e.order
  })), Sn) {
    const er = Sn.tolerance;
    Kn.boundTolerance = isSignal(er) ? Zt.signalRef(er.signal) : +er, Kn.boundScale = Zt.scaleRef(Sn.scale), Kn.boundOrient = Sn.orient;
  }
  return ref(Zt.add(Overlap(Kn)));
}
function parseLegend$1(_e, Qt) {
  const Zt = Qt.config.legend, $n = _e.encode || {}, Sn = lookup(_e, Zt), kn = $n.legend || {}, Kn = kn.name || void 0, er = kn.interactive, Cr = kn.style, kr = {};
  let Yr = 0, Ms, Ds, Ls;
  LegendScales.forEach((Ws) => _e[Ws] ? (kr[Ws] = _e[Ws], Yr = Yr || _e[Ws]) : 0), Yr || error("Missing valid scale for legend.");
  const js = legendType(_e, Qt.scaleType(Yr)), zs = {
    title: _e.title != null,
    scales: kr,
    type: js,
    vgrad: js !== "symbol" && Sn.isVertical()
  }, Fs = ref(Qt.add(Collect(null, [zs]))), Bs = {
    enter: {
      x: {
        value: 0
      },
      y: {
        value: 0
      }
    }
  }, Hs = ref(Qt.add(LegendEntries(Ds = {
    type: js,
    scale: Qt.scaleRef(Yr),
    count: Qt.objectProperty(Sn("tickCount")),
    limit: Qt.property(Sn("symbolLimit")),
    values: Qt.objectProperty(_e.values),
    minstep: Qt.property(_e.tickMinStep),
    formatType: Qt.property(_e.formatType),
    formatSpecifier: Qt.property(_e.format)
  })));
  return js === Gradient ? (Ls = [legendGradient(_e, Yr, Zt, $n.gradient), legendGradientLabels(_e, Zt, $n.labels, Hs)], Ds.count = Ds.count || Qt.signalRef(`max(2,2*floor((${deref(Sn.gradientLength())})/100))`)) : js === Discrete ? Ls = [legendGradientDiscrete(_e, Yr, Zt, $n.gradient, Hs), legendGradientLabels(_e, Zt, $n.labels, Hs)] : (Ms = legendSymbolLayout(_e, Zt), Ls = [legendSymbolGroups(_e, Zt, $n, Hs, deref(Ms.columns))], Ds.size = sizeExpression(_e, Qt, Ls[0].marks)), Ls = [guideGroup({
    role: LegendEntryRole,
    from: Fs,
    encode: Bs,
    marks: Ls,
    layout: Ms,
    interactive: er
  })], zs.title && Ls.push(legendTitle(_e, Zt, $n.title, Fs)), parseMark(guideGroup({
    role: LegendRole,
    from: Fs,
    encode: extendEncode(buildLegendEncode(Sn, _e, Zt), kn, Skip),
    marks: Ls,
    aria: Sn("aria"),
    description: Sn("description"),
    zindex: Sn("zindex"),
    name: Kn,
    interactive: er,
    style: Cr
  }), Qt);
}
function legendType(_e, Qt) {
  let Zt = _e.type || Symbols;
  return !_e.type && scaleCount(_e) === 1 && (_e.fill || _e.stroke) && (Zt = isContinuous$1(Qt) ? Gradient : isDiscretizing$1(Qt) ? Discrete : Symbols), Zt !== Gradient ? Zt : isDiscretizing$1(Qt) ? Discrete : Gradient;
}
function scaleCount(_e) {
  return LegendScales.reduce((Qt, Zt) => Qt + (_e[Zt] ? 1 : 0), 0);
}
function buildLegendEncode(_e, Qt, Zt) {
  const $n = {
    enter: {},
    update: {}
  };
  return addEncoders($n, {
    orient: _e("orient"),
    offset: _e("offset"),
    padding: _e("padding"),
    titlePadding: _e("titlePadding"),
    cornerRadius: _e("cornerRadius"),
    fill: _e("fillColor"),
    stroke: _e("strokeColor"),
    strokeWidth: Zt.strokeWidth,
    strokeDash: Zt.strokeDash,
    x: _e("legendX"),
    y: _e("legendY"),
    // accessibility support
    format: Qt.format,
    formatType: Qt.formatType
  }), $n;
}
function sizeExpression(_e, Qt, Zt) {
  const $n = deref(getChannel("size", _e, Zt)), Sn = deref(getChannel("strokeWidth", _e, Zt)), kn = deref(getFontSize(Zt[1].encode, Qt, GuideLabelStyle));
  return parser(`max(ceil(sqrt(${$n})+${Sn}),${kn})`, Qt);
}
function getChannel(_e, Qt, Zt) {
  return Qt[_e] ? `scale("${Qt[_e]}",datum)` : getEncoding(_e, Zt[0].encode);
}
function getFontSize(_e, Qt, Zt) {
  return getEncoding("fontSize", _e) || getStyle$2("fontSize", Qt, Zt);
}
const angleExpr = `item.orient==="${Left}"?-90:item.orient==="${Right}"?90:0`;
function parseTitle(_e, Qt) {
  _e = isString(_e) ? {
    text: _e
  } : _e;
  const Zt = lookup(_e, Qt.config.title), $n = _e.encode || {}, Sn = $n.group || {}, kn = Sn.name || void 0, Kn = Sn.interactive, er = Sn.style, Cr = [], kr = {}, Yr = ref(Qt.add(Collect(null, [kr])));
  return Cr.push(buildTitle(_e, Zt, titleEncode(_e), Yr)), _e.subtitle && Cr.push(buildSubTitle(_e, Zt, $n.subtitle, Yr)), parseMark(guideGroup({
    role: TitleRole,
    from: Yr,
    encode: groupEncode(Zt, Sn),
    marks: Cr,
    aria: Zt("aria"),
    description: Zt("description"),
    zindex: Zt("zindex"),
    name: kn,
    interactive: Kn,
    style: er
  }), Qt);
}
function titleEncode(_e) {
  const Qt = _e.encode;
  return Qt && Qt.title || extend$1({
    name: _e.name,
    interactive: _e.interactive,
    style: _e.style
  }, Qt);
}
function groupEncode(_e, Qt) {
  const Zt = {
    enter: {},
    update: {}
  };
  return addEncoders(Zt, {
    orient: _e("orient"),
    anchor: _e("anchor"),
    align: {
      signal: alignExpr$1
    },
    angle: {
      signal: angleExpr
    },
    limit: _e("limit"),
    frame: _e("frame"),
    offset: _e("offset") || 0,
    padding: _e("subtitlePadding")
  }), extendEncode(Zt, Qt, Skip);
}
function buildTitle(_e, Qt, Zt, $n) {
  const Sn = {
    value: 0
  }, kn = _e.text, Kn = {
    enter: {
      opacity: Sn
    },
    update: {
      opacity: {
        value: 1
      }
    },
    exit: {
      opacity: Sn
    }
  };
  return addEncoders(Kn, {
    text: kn,
    align: {
      signal: "item.mark.group.align"
    },
    angle: {
      signal: "item.mark.group.angle"
    },
    limit: {
      signal: "item.mark.group.limit"
    },
    baseline: "top",
    dx: Qt("dx"),
    dy: Qt("dy"),
    fill: Qt("color"),
    font: Qt("font"),
    fontSize: Qt("fontSize"),
    fontStyle: Qt("fontStyle"),
    fontWeight: Qt("fontWeight"),
    lineHeight: Qt("lineHeight")
  }, {
    // update
    align: Qt("align"),
    angle: Qt("angle"),
    baseline: Qt("baseline")
  }), guideMark({
    type: TextMark,
    role: TitleTextRole,
    style: GroupTitleStyle,
    from: $n,
    encode: Kn
  }, Zt);
}
function buildSubTitle(_e, Qt, Zt, $n) {
  const Sn = {
    value: 0
  }, kn = _e.subtitle, Kn = {
    enter: {
      opacity: Sn
    },
    update: {
      opacity: {
        value: 1
      }
    },
    exit: {
      opacity: Sn
    }
  };
  return addEncoders(Kn, {
    text: kn,
    align: {
      signal: "item.mark.group.align"
    },
    angle: {
      signal: "item.mark.group.angle"
    },
    limit: {
      signal: "item.mark.group.limit"
    },
    baseline: "top",
    dx: Qt("dx"),
    dy: Qt("dy"),
    fill: Qt("subtitleColor"),
    font: Qt("subtitleFont"),
    fontSize: Qt("subtitleFontSize"),
    fontStyle: Qt("subtitleFontStyle"),
    fontWeight: Qt("subtitleFontWeight"),
    lineHeight: Qt("subtitleLineHeight")
  }, {
    // update
    align: Qt("align"),
    angle: Qt("angle"),
    baseline: Qt("baseline")
  }), guideMark({
    type: TextMark,
    role: TitleSubtitleRole,
    style: GroupSubtitleStyle,
    from: $n,
    encode: Kn
  }, Zt);
}
function parseData$2(_e, Qt) {
  const Zt = [];
  _e.transform && _e.transform.forEach(($n) => {
    Zt.push(parseTransform($n, Qt));
  }), _e.on && _e.on.forEach(($n) => {
    parseTrigger($n, Qt, _e.name);
  }), Qt.addDataPipeline(_e.name, analyze(_e, Qt, Zt));
}
function analyze(_e, Qt, Zt) {
  const $n = [];
  let Sn = null, kn = !1, Kn = !1, er, Cr, kr, Yr, Ms;
  for (_e.values ? isSignal(_e.values) || hasSignal(_e.format) ? ($n.push(load(Qt, _e)), $n.push(Sn = collect())) : $n.push(Sn = collect({
    $ingest: _e.values,
    $format: _e.format
  })) : _e.url ? hasSignal(_e.url) || hasSignal(_e.format) ? ($n.push(load(Qt, _e)), $n.push(Sn = collect())) : $n.push(Sn = collect({
    $request: _e.url,
    $format: _e.format
  })) : _e.source && (Sn = er = array$6(_e.source).map((Ds) => ref(Qt.getData(Ds).output)), $n.push(null)), Cr = 0, kr = Zt.length; Cr < kr; ++Cr)
    Yr = Zt[Cr], Ms = Yr.metadata, !Sn && !Ms.source && $n.push(Sn = collect()), $n.push(Yr), Ms.generates && (Kn = !0), Ms.modifies && !Kn && (kn = !0), Ms.source ? Sn = Yr : Ms.changes && (Sn = null);
  return er && (kr = er.length - 1, $n[0] = Relay({
    derive: kn,
    pulse: kr ? er : er[0]
  }), (kn || kr) && $n.splice(1, 0, collect())), Sn || $n.push(collect()), $n.push(Sieve({})), $n;
}
function collect(_e) {
  const Qt = Collect({}, _e);
  return Qt.metadata = {
    source: !0
  }, Qt;
}
function load(_e, Qt) {
  return Load({
    url: Qt.url ? _e.property(Qt.url) : void 0,
    async: Qt.async ? _e.property(Qt.async) : void 0,
    values: Qt.values ? _e.property(Qt.values) : void 0,
    format: _e.objectProperty(Qt.format)
  });
}
const isX = (_e) => _e === Bottom || _e === Top, getSign = (_e, Qt, Zt) => isSignal(_e) ? ifLeftTopExpr(_e.signal, Qt, Zt) : _e === Left || _e === Top ? Qt : Zt, ifX = (_e, Qt, Zt) => isSignal(_e) ? ifXEnc(_e.signal, Qt, Zt) : isX(_e) ? Qt : Zt, ifY = (_e, Qt, Zt) => isSignal(_e) ? ifYEnc(_e.signal, Qt, Zt) : isX(_e) ? Zt : Qt, ifTop = (_e, Qt, Zt) => isSignal(_e) ? ifTopExpr(_e.signal, Qt, Zt) : _e === Top ? {
  value: Qt
} : {
  value: Zt
}, ifRight = (_e, Qt, Zt) => isSignal(_e) ? ifRightExpr(_e.signal, Qt, Zt) : _e === Right ? {
  value: Qt
} : {
  value: Zt
}, ifXEnc = (_e, Qt, Zt) => ifEnc(`${_e} === '${Top}' || ${_e} === '${Bottom}'`, Qt, Zt), ifYEnc = (_e, Qt, Zt) => ifEnc(`${_e} !== '${Top}' && ${_e} !== '${Bottom}'`, Qt, Zt), ifLeftTopExpr = (_e, Qt, Zt) => ifExpr(`${_e} === '${Left}' || ${_e} === '${Top}'`, Qt, Zt), ifTopExpr = (_e, Qt, Zt) => ifExpr(`${_e} === '${Top}'`, Qt, Zt), ifRightExpr = (_e, Qt, Zt) => ifExpr(`${_e} === '${Right}'`, Qt, Zt), ifEnc = (_e, Qt, Zt) => (Qt = Qt != null ? encoder(Qt) : Qt, Zt = Zt != null ? encoder(Zt) : Zt, isSimple(Qt) && isSimple(Zt) ? (Qt = Qt ? Qt.signal || $(Qt.value) : null, Zt = Zt ? Zt.signal || $(Zt.value) : null, {
  signal: `${_e} ? (${Qt}) : (${Zt})`
}) : [extend$1({
  test: _e
}, Qt)].concat(Zt || [])), isSimple = (_e) => _e == null || Object.keys(_e).length === 1, ifExpr = (_e, Qt, Zt) => ({
  signal: `${_e} ? (${toExpr(Qt)}) : (${toExpr(Zt)})`
}), ifOrient = (_e, Qt, Zt, $n, Sn) => ({
  signal: ($n != null ? `${_e} === '${Left}' ? (${toExpr($n)}) : ` : "") + (Zt != null ? `${_e} === '${Bottom}' ? (${toExpr(Zt)}) : ` : "") + (Sn != null ? `${_e} === '${Right}' ? (${toExpr(Sn)}) : ` : "") + (Qt != null ? `${_e} === '${Top}' ? (${toExpr(Qt)}) : ` : "") + "(null)"
}), toExpr = (_e) => isSignal(_e) ? _e.signal : _e == null ? null : $(_e), mult = (_e, Qt) => Qt === 0 ? 0 : isSignal(_e) ? {
  signal: `(${_e.signal}) * ${Qt}`
} : {
  value: _e * Qt
}, patch$1 = (_e, Qt) => {
  const Zt = _e.signal;
  return Zt && Zt.endsWith("(null)") ? {
    signal: Zt.slice(0, -6) + Qt.signal
  } : _e;
};
function fallback(_e, Qt, Zt, $n) {
  let Sn;
  if (Qt && has$1(Qt, _e))
    return Qt[_e];
  if (has$1(Zt, _e))
    return Zt[_e];
  if (_e.startsWith("title")) {
    switch (_e) {
      case "titleColor":
        Sn = "fill";
        break;
      case "titleFont":
      case "titleFontSize":
      case "titleFontWeight":
        Sn = _e[5].toLowerCase() + _e.slice(6);
    }
    return $n[GuideTitleStyle][Sn];
  } else if (_e.startsWith("label")) {
    switch (_e) {
      case "labelColor":
        Sn = "fill";
        break;
      case "labelFont":
      case "labelFontSize":
        Sn = _e[5].toLowerCase() + _e.slice(6);
    }
    return $n[GuideLabelStyle][Sn];
  }
  return null;
}
function keys(_e) {
  const Qt = {};
  for (const Zt of _e)
    if (Zt)
      for (const $n in Zt)
        Qt[$n] = 1;
  return Object.keys(Qt);
}
function axisConfig(_e, Qt) {
  var Zt = Qt.config, $n = Zt.style, Sn = Zt.axis, kn = Qt.scaleType(_e.scale) === "band" && Zt.axisBand, Kn = _e.orient, er, Cr, kr;
  if (isSignal(Kn)) {
    const Ms = keys([Zt.axisX, Zt.axisY]), Ds = keys([Zt.axisTop, Zt.axisBottom, Zt.axisLeft, Zt.axisRight]);
    er = {};
    for (kr of Ms)
      er[kr] = ifX(Kn, fallback(kr, Zt.axisX, Sn, $n), fallback(kr, Zt.axisY, Sn, $n));
    Cr = {};
    for (kr of Ds)
      Cr[kr] = ifOrient(Kn.signal, fallback(kr, Zt.axisTop, Sn, $n), fallback(kr, Zt.axisBottom, Sn, $n), fallback(kr, Zt.axisLeft, Sn, $n), fallback(kr, Zt.axisRight, Sn, $n));
  } else
    er = Kn === Top || Kn === Bottom ? Zt.axisX : Zt.axisY, Cr = Zt["axis" + Kn[0].toUpperCase() + Kn.slice(1)];
  return er || Cr || kn ? extend$1({}, Sn, er, Cr, kn) : Sn;
}
function axisDomain(_e, Qt, Zt, $n) {
  const Sn = lookup(_e, Qt), kn = _e.orient;
  let Kn, er;
  const Cr = {
    enter: Kn = {
      opacity: zero$1
    },
    update: er = {
      opacity: one
    },
    exit: {
      opacity: zero$1
    }
  };
  addEncoders(Cr, {
    stroke: Sn("domainColor"),
    strokeCap: Sn("domainCap"),
    strokeDash: Sn("domainDash"),
    strokeDashOffset: Sn("domainDashOffset"),
    strokeWidth: Sn("domainWidth"),
    strokeOpacity: Sn("domainOpacity")
  });
  const kr = position$1(_e, 0), Yr = position$1(_e, 1);
  return Kn.x = er.x = ifX(kn, kr, zero$1), Kn.x2 = er.x2 = ifX(kn, Yr), Kn.y = er.y = ifY(kn, kr, zero$1), Kn.y2 = er.y2 = ifY(kn, Yr), guideMark({
    type: RuleMark,
    role: AxisDomainRole,
    from: $n,
    encode: Cr
  }, Zt);
}
function position$1(_e, Qt) {
  return {
    scale: _e.scale,
    range: Qt
  };
}
function axisGrid(_e, Qt, Zt, $n, Sn) {
  const kn = lookup(_e, Qt), Kn = _e.orient, er = _e.gridScale, Cr = getSign(Kn, 1, -1), kr = offsetValue(_e.offset, Cr);
  let Yr, Ms, Ds;
  const Ls = {
    enter: Yr = {
      opacity: zero$1
    },
    update: Ds = {
      opacity: one
    },
    exit: Ms = {
      opacity: zero$1
    }
  };
  addEncoders(Ls, {
    stroke: kn("gridColor"),
    strokeCap: kn("gridCap"),
    strokeDash: kn("gridDash"),
    strokeDashOffset: kn("gridDashOffset"),
    strokeOpacity: kn("gridOpacity"),
    strokeWidth: kn("gridWidth")
  });
  const js = {
    scale: _e.scale,
    field: Value,
    band: Sn.band,
    extra: Sn.extra,
    offset: Sn.offset,
    round: kn("tickRound")
  }, zs = ifX(Kn, {
    signal: "height"
  }, {
    signal: "width"
  }), Fs = er ? {
    scale: er,
    range: 0,
    mult: Cr,
    offset: kr
  } : {
    value: 0,
    offset: kr
  }, Bs = er ? {
    scale: er,
    range: 1,
    mult: Cr,
    offset: kr
  } : extend$1(zs, {
    mult: Cr,
    offset: kr
  });
  return Yr.x = Ds.x = ifX(Kn, js, Fs), Yr.y = Ds.y = ifY(Kn, js, Fs), Yr.x2 = Ds.x2 = ifY(Kn, Bs), Yr.y2 = Ds.y2 = ifX(Kn, Bs), Ms.x = ifX(Kn, js), Ms.y = ifY(Kn, js), guideMark({
    type: RuleMark,
    role: AxisGridRole,
    key: Value,
    from: $n,
    encode: Ls
  }, Zt);
}
function offsetValue(_e, Qt) {
  if (Qt !== 1)
    if (!isObject(_e))
      _e = isSignal(Qt) ? {
        signal: `(${Qt.signal}) * (${_e || 0})`
      } : Qt * (_e || 0);
    else {
      let Zt = _e = extend$1({}, _e);
      for (; Zt.mult != null; )
        if (isObject(Zt.mult))
          Zt = Zt.mult = extend$1({}, Zt.mult);
        else
          return Zt.mult = isSignal(Qt) ? {
            signal: `(${Zt.mult}) * (${Qt.signal})`
          } : Zt.mult * Qt, _e;
      Zt.mult = Qt;
    }
  return _e;
}
function axisTicks(_e, Qt, Zt, $n, Sn, kn) {
  const Kn = lookup(_e, Qt), er = _e.orient, Cr = getSign(er, -1, 1);
  let kr, Yr, Ms;
  const Ds = {
    enter: kr = {
      opacity: zero$1
    },
    update: Ms = {
      opacity: one
    },
    exit: Yr = {
      opacity: zero$1
    }
  };
  addEncoders(Ds, {
    stroke: Kn("tickColor"),
    strokeCap: Kn("tickCap"),
    strokeDash: Kn("tickDash"),
    strokeDashOffset: Kn("tickDashOffset"),
    strokeOpacity: Kn("tickOpacity"),
    strokeWidth: Kn("tickWidth")
  });
  const Ls = encoder(Sn);
  Ls.mult = Cr;
  const js = {
    scale: _e.scale,
    field: Value,
    band: kn.band,
    extra: kn.extra,
    offset: kn.offset,
    round: Kn("tickRound")
  };
  return Ms.y = kr.y = ifX(er, zero$1, js), Ms.y2 = kr.y2 = ifX(er, Ls), Yr.x = ifX(er, js), Ms.x = kr.x = ifY(er, zero$1, js), Ms.x2 = kr.x2 = ifY(er, Ls), Yr.y = ifY(er, js), guideMark({
    type: RuleMark,
    role: AxisTickRole,
    key: Value,
    from: $n,
    encode: Ds
  }, Zt);
}
function flushExpr(_e, Qt, Zt, $n, Sn) {
  return {
    signal: 'flush(range("' + _e + '"), scale("' + _e + '", datum.value), ' + Qt + "," + Zt + "," + $n + "," + Sn + ")"
  };
}
function axisLabels(_e, Qt, Zt, $n, Sn, kn) {
  const Kn = lookup(_e, Qt), er = _e.orient, Cr = _e.scale, kr = getSign(er, -1, 1), Yr = deref(Kn("labelFlush")), Ms = deref(Kn("labelFlushOffset")), Ds = Kn("labelAlign"), Ls = Kn("labelBaseline");
  let js = Yr === 0 || !!Yr, zs;
  const Fs = encoder(Sn);
  Fs.mult = kr, Fs.offset = encoder(Kn("labelPadding") || 0), Fs.offset.mult = kr;
  const Bs = {
    scale: Cr,
    field: Value,
    band: 0.5,
    offset: extendOffset(kn.offset, Kn("labelOffset"))
  }, Hs = ifX(er, js ? flushExpr(Cr, Yr, '"left"', '"right"', '"center"') : {
    value: "center"
  }, ifRight(er, "left", "right")), Ws = ifX(er, ifTop(er, "bottom", "top"), js ? flushExpr(Cr, Yr, '"top"', '"bottom"', '"middle"') : {
    value: "middle"
  }), Ys = flushExpr(Cr, Yr, `-(${Ms})`, Ms, 0);
  js = js && Ms;
  const El = {
    opacity: zero$1,
    x: ifX(er, Bs, Fs),
    y: ifY(er, Bs, Fs)
  }, Mu = {
    enter: El,
    update: zs = {
      opacity: one,
      text: {
        field: Label
      },
      x: El.x,
      y: El.y,
      align: Hs,
      baseline: Ws
    },
    exit: {
      opacity: zero$1,
      x: El.x,
      y: El.y
    }
  };
  addEncoders(Mu, {
    dx: !Ds && js ? ifX(er, Ys) : null,
    dy: !Ls && js ? ifY(er, Ys) : null
  }), addEncoders(Mu, {
    angle: Kn("labelAngle"),
    fill: Kn("labelColor"),
    fillOpacity: Kn("labelOpacity"),
    font: Kn("labelFont"),
    fontSize: Kn("labelFontSize"),
    fontWeight: Kn("labelFontWeight"),
    fontStyle: Kn("labelFontStyle"),
    limit: Kn("labelLimit"),
    lineHeight: Kn("labelLineHeight")
  }, {
    align: Ds,
    baseline: Ls
  });
  const Pl = Kn("labelBound");
  let Iu = Kn("labelOverlap");
  return Iu = Iu || Pl ? {
    separation: Kn("labelSeparation"),
    method: Iu,
    order: "datum.index",
    bound: Pl ? {
      scale: Cr,
      orient: er,
      tolerance: Pl
    } : null
  } : void 0, zs.align !== Hs && (zs.align = patch$1(zs.align, Hs)), zs.baseline !== Ws && (zs.baseline = patch$1(zs.baseline, Ws)), guideMark({
    type: TextMark,
    role: AxisLabelRole,
    style: GuideLabelStyle,
    key: Value,
    from: $n,
    encode: Mu,
    overlap: Iu
  }, Zt);
}
function axisTitle(_e, Qt, Zt, $n) {
  const Sn = lookup(_e, Qt), kn = _e.orient, Kn = getSign(kn, -1, 1);
  let er, Cr;
  const kr = {
    enter: er = {
      opacity: zero$1,
      anchor: encoder(Sn("titleAnchor", null)),
      align: {
        signal: alignExpr$1
      }
    },
    update: Cr = extend$1({}, er, {
      opacity: one,
      text: encoder(_e.title)
    }),
    exit: {
      opacity: zero$1
    }
  }, Yr = {
    signal: `lerp(range("${_e.scale}"), ${anchorExpr(0, 1, 0.5)})`
  };
  return Cr.x = ifX(kn, Yr), Cr.y = ifY(kn, Yr), er.angle = ifX(kn, zero$1, mult(Kn, 90)), er.baseline = ifX(kn, ifTop(kn, Bottom, Top), {
    value: Bottom
  }), Cr.angle = er.angle, Cr.baseline = er.baseline, addEncoders(kr, {
    fill: Sn("titleColor"),
    fillOpacity: Sn("titleOpacity"),
    font: Sn("titleFont"),
    fontSize: Sn("titleFontSize"),
    fontStyle: Sn("titleFontStyle"),
    fontWeight: Sn("titleFontWeight"),
    limit: Sn("titleLimit"),
    lineHeight: Sn("titleLineHeight")
  }, {
    // require update
    align: Sn("titleAlign"),
    angle: Sn("titleAngle"),
    baseline: Sn("titleBaseline")
  }), autoLayout(Sn, kn, kr, Zt), kr.update.align = patch$1(kr.update.align, er.align), kr.update.angle = patch$1(kr.update.angle, er.angle), kr.update.baseline = patch$1(kr.update.baseline, er.baseline), guideMark({
    type: TextMark,
    role: AxisTitleRole,
    style: GuideTitleStyle,
    from: $n,
    encode: kr
  }, Zt);
}
function autoLayout(_e, Qt, Zt, $n) {
  const Sn = (er, Cr) => er != null ? (Zt.update[Cr] = patch$1(encoder(er), Zt.update[Cr]), !1) : !has(Cr, $n), kn = Sn(_e("titleX"), "x"), Kn = Sn(_e("titleY"), "y");
  Zt.enter.auto = Kn === kn ? encoder(Kn) : ifX(Qt, encoder(Kn), encoder(kn));
}
function parseAxis$1(_e, Qt) {
  const Zt = axisConfig(_e, Qt), $n = _e.encode || {}, Sn = $n.axis || {}, kn = Sn.name || void 0, Kn = Sn.interactive, er = Sn.style, Cr = lookup(_e, Zt), kr = tickBand(Cr), Yr = {
    scale: _e.scale,
    ticks: !!Cr("ticks"),
    labels: !!Cr("labels"),
    grid: !!Cr("grid"),
    domain: !!Cr("domain"),
    title: _e.title != null
  }, Ms = ref(Qt.add(Collect({}, [Yr]))), Ds = ref(Qt.add(AxisTicks({
    scale: Qt.scaleRef(_e.scale),
    extra: Qt.property(kr.extra),
    count: Qt.objectProperty(_e.tickCount),
    values: Qt.objectProperty(_e.values),
    minstep: Qt.property(_e.tickMinStep),
    formatType: Qt.property(_e.formatType),
    formatSpecifier: Qt.property(_e.format)
  }))), Ls = [];
  let js;
  return Yr.grid && Ls.push(axisGrid(_e, Zt, $n.grid, Ds, kr)), Yr.ticks && (js = Cr("tickSize"), Ls.push(axisTicks(_e, Zt, $n.ticks, Ds, js, kr))), Yr.labels && (js = Yr.ticks ? js : 0, Ls.push(axisLabels(_e, Zt, $n.labels, Ds, js, kr))), Yr.domain && Ls.push(axisDomain(_e, Zt, $n.domain, Ms)), Yr.title && Ls.push(axisTitle(_e, Zt, $n.title, Ms)), parseMark(guideGroup({
    role: AxisRole,
    from: Ms,
    encode: extendEncode(buildAxisEncode(Cr, _e), Sn, Skip),
    marks: Ls,
    aria: Cr("aria"),
    description: Cr("description"),
    zindex: Cr("zindex"),
    name: kn,
    interactive: Kn,
    style: er
  }), Qt);
}
function buildAxisEncode(_e, Qt) {
  const Zt = {
    enter: {},
    update: {}
  };
  return addEncoders(Zt, {
    orient: _e("orient"),
    offset: _e("offset") || 0,
    position: value(Qt.position, 0),
    titlePadding: _e("titlePadding"),
    minExtent: _e("minExtent"),
    maxExtent: _e("maxExtent"),
    range: {
      signal: `abs(span(range("${Qt.scale}")))`
    },
    translate: _e("translate"),
    // accessibility support
    format: Qt.format,
    formatType: Qt.formatType
  }), Zt;
}
function parseScope(_e, Qt, Zt) {
  const $n = array$6(_e.signals), Sn = array$6(_e.scales);
  return Zt || $n.forEach((kn) => parseSignal(kn, Qt)), array$6(_e.projections).forEach((kn) => parseProjection$1(kn, Qt)), Sn.forEach((kn) => initScale(kn, Qt)), array$6(_e.data).forEach((kn) => parseData$2(kn, Qt)), Sn.forEach((kn) => parseScale(kn, Qt)), (Zt || $n).forEach((kn) => parseSignalUpdates(kn, Qt)), array$6(_e.axes).forEach((kn) => parseAxis$1(kn, Qt)), array$6(_e.marks).forEach((kn) => parseMark(kn, Qt)), array$6(_e.legends).forEach((kn) => parseLegend$1(kn, Qt)), _e.title && parseTitle(_e.title, Qt), Qt.parseLambdas(), Qt;
}
const rootEncode = (_e) => extendEncode({
  enter: {
    x: {
      value: 0
    },
    y: {
      value: 0
    }
  },
  update: {
    width: {
      signal: "width"
    },
    height: {
      signal: "height"
    }
  }
}, _e);
function parseView(_e, Qt) {
  const Zt = Qt.config, $n = ref(Qt.root = Qt.add(operator())), Sn = collectSignals(_e, Zt);
  Sn.forEach((kr) => parseSignal(kr, Qt)), Qt.description = _e.description || Zt.description, Qt.eventConfig = Zt.events, Qt.legends = Qt.objectProperty(Zt.legend && Zt.legend.layout), Qt.locale = Zt.locale;
  const kn = Qt.add(Collect()), Kn = Qt.add(Encode(parseEncode(rootEncode(_e.encode), GroupMark, FrameRole, _e.style, Qt, {
    pulse: ref(kn)
  }))), er = Qt.add(ViewLayout({
    layout: Qt.objectProperty(_e.layout),
    legends: Qt.legends,
    autosize: Qt.signalRef("autosize"),
    mark: $n,
    pulse: ref(Kn)
  }));
  Qt.operators.pop(), Qt.pushState(ref(Kn), ref(er), null), parseScope(_e, Qt, Sn), Qt.operators.push(er);
  let Cr = Qt.add(Bound({
    mark: $n,
    pulse: ref(er)
  }));
  return Cr = Qt.add(Render({
    pulse: ref(Cr)
  })), Cr = Qt.add(Sieve({
    pulse: ref(Cr)
  })), Qt.addData("root", new DataScope(Qt, kn, kn, Cr)), Qt;
}
function signalObject(_e, Qt) {
  return Qt && Qt.signal ? {
    name: _e,
    update: Qt.signal
  } : {
    name: _e,
    value: Qt
  };
}
function collectSignals(_e, Qt) {
  const Zt = (Kn) => value(_e[Kn], Qt[Kn]), $n = [signalObject("background", Zt("background")), signalObject("autosize", parseAutosize(Zt("autosize"))), signalObject("padding", parsePadding(Zt("padding"))), signalObject("width", Zt("width") || 0), signalObject("height", Zt("height") || 0)], Sn = $n.reduce((Kn, er) => (Kn[er.name] = er, Kn), {}), kn = {};
  return array$6(_e.signals).forEach((Kn) => {
    has$1(Sn, Kn.name) ? Kn = extend$1(Sn[Kn.name], Kn) : $n.push(Kn), kn[Kn.name] = Kn;
  }), array$6(Qt.signals).forEach((Kn) => {
    !has$1(kn, Kn.name) && !has$1(Sn, Kn.name) && $n.push(Kn);
  }), $n;
}
function Scope(_e, Qt) {
  this.config = _e || {}, this.options = Qt || {}, 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 Subscope(_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;
}
Scope.prototype = Subscope.prototype = {
  parse(_e) {
    return parseScope(_e, this);
  },
  fork() {
    return new Subscope(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((Qt) => {
      Qt.$ref = _e.id;
    }), _e.refs = null), _e;
  },
  proxy(_e) {
    const Qt = _e instanceof Entry$1 ? ref(_e) : _e;
    return this.add(Proxy$1({
      value: Qt
    }));
  },
  addStream(_e) {
    return this.streams.push(_e), _e.id = this.id(), _e;
  },
  addUpdate(_e) {
    return this.updates.push(_e), _e;
  },
  // Apply metadata
  finish() {
    let _e, Qt;
    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 Zt($n, Sn, kn) {
      let Kn, er;
      $n && (Kn = $n.data || ($n.data = {}), er = Kn[Sn] || (Kn[Sn] = []), er.push(kn));
    }
    for (_e in this.data) {
      Qt = this.data[_e], Zt(Qt.input, _e, "input"), Zt(Qt.output, _e, "output"), Zt(Qt.values, _e, "values");
      for (const $n in Qt.index)
        Zt(Qt.index[$n], _e, "index:" + $n);
    }
    return this;
  },
  // ----
  pushState(_e, Qt, Zt) {
    this._encode.push(ref(this.add(Sieve({
      pulse: _e
    })))), this._parent.push(Qt), this._lookup.push(Zt ? ref(this.proxy(Zt)) : null), this._markpath.push(-1);
  },
  popState() {
    this._encode.pop(), this._parent.pop(), this._lookup.pop(), this._markpath.pop();
  },
  parent() {
    return peek$1(this._parent);
  },
  encode() {
    return peek$1(this._encode);
  },
  lookup() {
    return peek$1(this._lookup);
  },
  markpath() {
    const _e = this._markpath;
    return ++_e[_e.length - 1];
  },
  // ----
  fieldRef(_e, Qt) {
    if (isString(_e))
      return fieldRef$1(_e, Qt);
    _e.signal || error("Unsupported field reference: " + $(_e));
    const Zt = _e.signal;
    let $n = this.field[Zt];
    if (!$n) {
      const Sn = {
        name: this.signalRef(Zt)
      };
      Qt && (Sn.as = Qt), this.field[Zt] = $n = ref(this.add(Field(Sn)));
    }
    return $n;
  },
  compareRef(_e) {
    let Qt = !1;
    const Zt = (kn) => isSignal(kn) ? (Qt = !0, this.signalRef(kn.signal)) : isExpr$1(kn) ? (Qt = !0, this.exprRef(kn.expr)) : kn, $n = array$6(_e.field).map(Zt), Sn = array$6(_e.order).map(Zt);
    return Qt ? ref(this.add(Compare({
      fields: $n,
      orders: Sn
    }))) : compareRef($n, Sn);
  },
  keyRef(_e, Qt) {
    let Zt = !1;
    const $n = (kn) => isSignal(kn) ? (Zt = !0, ref(Sn[kn.signal])) : kn, Sn = this.signals;
    return _e = array$6(_e).map($n), Zt ? ref(this.add(Key({
      fields: _e,
      flat: Qt
    }))) : keyRef(_e, Qt);
  },
  sortRef(_e) {
    if (!_e)
      return _e;
    const Qt = aggrField(_e.op, _e.field), Zt = _e.order || Ascending;
    return Zt.signal ? ref(this.add(Compare({
      fields: Qt,
      orders: this.signalRef(Zt.signal)
    }))) : compareRef(Qt, Zt);
  },
  // ----
  event(_e, Qt) {
    const Zt = _e + ":" + Qt;
    if (!this.events[Zt]) {
      const $n = this.id();
      this.streams.push({
        id: $n,
        source: _e,
        type: Qt
      }), this.events[Zt] = $n;
    }
    return this.events[Zt];
  },
  // ----
  hasOwnSignal(_e) {
    return has$1(this.signals, _e);
  },
  addSignal(_e, Qt) {
    this.hasOwnSignal(_e) && error("Duplicate signal name: " + $(_e));
    const Zt = Qt instanceof Entry$1 ? Qt : this.add(operator(Qt));
    return this.signals[_e] = Zt;
  },
  getSignal(_e) {
    return this.signals[_e] || error("Unrecognized signal name: " + $(_e)), this.signals[_e];
  },
  signalRef(_e) {
    return this.signals[_e] ? ref(this.signals[_e]) : (has$1(this.lambdas, _e) || (this.lambdas[_e] = this.add(operator(null))), ref(this.lambdas[_e]));
  },
  parseLambdas() {
    const _e = Object.keys(this.lambdas);
    for (let Qt = 0, Zt = _e.length; Qt < Zt; ++Qt) {
      const $n = _e[Qt], Sn = parser($n, this), kn = this.lambdas[$n];
      kn.params = Sn.$params, kn.update = Sn.$expr;
    }
  },
  property(_e) {
    return _e && _e.signal ? this.signalRef(_e.signal) : _e;
  },
  objectProperty(_e) {
    return !_e || !isObject(_e) ? _e : this.signalRef(_e.signal || propertyLambda(_e));
  },
  exprRef(_e, Qt) {
    const Zt = {
      expr: parser(_e, this)
    };
    return Qt && (Zt.expr.$name = Qt), ref(this.add(Expression(Zt)));
  },
  addBinding(_e, Qt) {
    this.bindings || error("Nested signals do not support binding: " + $(_e)), this.bindings.push(extend$1({
      signal: _e
    }, Qt));
  },
  // ----
  addScaleProj(_e, Qt) {
    has$1(this.scales, _e) && error("Duplicate scale or projection name: " + $(_e)), this.scales[_e] = this.add(Qt);
  },
  addScale(_e, Qt) {
    this.addScaleProj(_e, Scale(Qt));
  },
  addProjection(_e, Qt) {
    this.addScaleProj(_e, Projection(Qt));
  },
  getScale(_e) {
    return this.scales[_e] || error("Unrecognized scale name: " + $(_e)), this.scales[_e];
  },
  scaleRef(_e) {
    return ref(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, Qt) {
    return has$1(this.data, _e) && error("Duplicate data set name: " + $(_e)), this.data[_e] = Qt;
  },
  getData(_e) {
    return this.data[_e] || error("Undefined data set name: " + $(_e)), this.data[_e];
  },
  addDataPipeline(_e, Qt) {
    return has$1(this.data, _e) && error("Duplicate data set name: " + $(_e)), this.addData(_e, DataScope.fromEntries(this, Qt));
  }
};
function propertyLambda(_e) {
  return (isArray(_e) ? arrayLambda : objectLambda)(_e);
}
function arrayLambda(_e) {
  const Qt = _e.length;
  let Zt = "[";
  for (let $n = 0; $n < Qt; ++$n) {
    const Sn = _e[$n];
    Zt += ($n > 0 ? "," : "") + (isObject(Sn) ? Sn.signal || propertyLambda(Sn) : $(Sn));
  }
  return Zt + "]";
}
function objectLambda(_e) {
  let Qt = "{", Zt = 0, $n, Sn;
  for ($n in _e)
    Sn = _e[$n], Qt += (++Zt > 1 ? "," : "") + $($n) + ":" + (isObject(Sn) ? Sn.signal || propertyLambda(Sn) : $(Sn));
  return Qt + "}";
}
function defaults$1() {
  const _e = "sans-serif", $n = "#4c78a8", Sn = "#000", kn = "#888", Kn = "#ddd";
  return {
    // default visualization description
    description: "Vega visualization",
    // default padding around visualization
    padding: 0,
    // default for automatic sizing; options: 'none', 'pad', 'fit'
    // or provide an object (e.g., {'type': 'pad', 'resize': true})
    autosize: "pad",
    // default view background color
    // covers the entire view component
    background: null,
    // default event handling configuration
    // preventDefault for view-sourced event types except 'wheel'
    events: {
      defaults: {
        allow: ["wheel"]
      }
    },
    // defaults for top-level group marks
    // accepts mark properties (fill, stroke, etc)
    // covers the data rectangle within group width/height
    group: null,
    // defaults for basic mark types
    // each subset accepts mark properties (fill, stroke, etc)
    mark: null,
    arc: {
      fill: $n
    },
    area: {
      fill: $n
    },
    image: null,
    line: {
      stroke: $n,
      strokeWidth: 2
    },
    path: {
      stroke: $n
    },
    rect: {
      fill: $n
    },
    rule: {
      stroke: Sn
    },
    shape: {
      stroke: $n
    },
    symbol: {
      fill: $n,
      size: 64
    },
    text: {
      fill: Sn,
      font: _e,
      fontSize: 11
    },
    trail: {
      fill: $n,
      size: 2
    },
    // style definitions
    style: {
      // axis & legend labels
      "guide-label": {
        fill: Sn,
        font: _e,
        fontSize: 10
      },
      // axis & legend titles
      "guide-title": {
        fill: Sn,
        font: _e,
        fontSize: 11,
        fontWeight: "bold"
      },
      // headers, including chart title
      "group-title": {
        fill: Sn,
        font: _e,
        fontSize: 13,
        fontWeight: "bold"
      },
      // chart subtitle
      "group-subtitle": {
        fill: Sn,
        font: _e,
        fontSize: 12
      },
      // defaults for styled point marks in Vega-Lite
      point: {
        size: 30,
        strokeWidth: 2,
        shape: "circle"
      },
      circle: {
        size: 30,
        strokeWidth: 2
      },
      square: {
        size: 30,
        strokeWidth: 2,
        shape: "square"
      },
      // defaults for styled group marks in Vega-Lite
      cell: {
        fill: "transparent",
        stroke: Kn
      },
      view: {
        fill: "transparent"
      }
    },
    // defaults for title
    title: {
      orient: "top",
      anchor: "middle",
      offset: 4,
      subtitlePadding: 3
    },
    // defaults for axes
    axis: {
      minExtent: 0,
      maxExtent: 200,
      bandPosition: 0.5,
      domain: !0,
      domainWidth: 1,
      domainColor: kn,
      grid: !1,
      gridWidth: 1,
      gridColor: Kn,
      labels: !0,
      labelAngle: 0,
      labelLimit: 180,
      labelOffset: 0,
      labelPadding: 2,
      ticks: !0,
      tickColor: kn,
      tickOffset: 0,
      tickRound: !0,
      tickSize: 5,
      tickWidth: 1,
      titlePadding: 4
    },
    // correction for centering bias
    axisBand: {
      tickOffset: -0.5
    },
    // defaults for cartographic projection
    projection: {
      type: "mercator"
    },
    // defaults for legends
    legend: {
      orient: "right",
      padding: 0,
      gridAlign: "each",
      columnPadding: 10,
      rowPadding: 2,
      symbolDirection: "vertical",
      gradientDirection: "vertical",
      gradientLength: 200,
      gradientThickness: 16,
      gradientStrokeColor: Kn,
      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: kn,
      titleLimit: 180,
      titleOrient: "top",
      titlePadding: 5,
      layout: {
        offset: 18,
        direction: "horizontal",
        left: {
          direction: "vertical"
        },
        right: {
          direction: "vertical"
        }
      }
    },
    // defaults for scale ranges
    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 parse$2(_e, Qt, Zt) {
  return isObject(_e) || error("Input Vega specification must be an object."), Qt = mergeConfig(defaults$1(), Qt, _e.config), parseView(_e, new Scope(Qt, Zt)).toRuntime();
}
var version$3 = "5.25.0";
extend$1(transforms$1, tx$1, vtx, encode$1, geo, force, label, tree, reg, voronoi, wordcloud, xf$1);
const vegaImport = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  Bounds,
  CanvasHandler,
  CanvasRenderer,
  DATE,
  DAY,
  DAYOFYEAR,
  Dataflow,
  Debug,
  Error: Error$1,
  EventStream,
  Gradient: Gradient$1,
  GroupItem,
  HOURS,
  Handler: Handler$1,
  Info,
  Item,
  MILLISECONDS,
  MINUTES,
  MONTH,
  Marks,
  MultiPulse,
  None: None$2,
  Operator,
  Parameters,
  Pulse,
  QUARTER,
  RenderType,
  Renderer,
  ResourceLoader,
  SECONDS,
  SVGHandler,
  SVGRenderer,
  SVGStringRenderer,
  Scenegraph,
  TIME_UNITS,
  Transform: Transform$1,
  View: View$1,
  WEEK,
  Warn,
  YEAR,
  accessor,
  accessorFields,
  accessorName,
  array: array$6,
  ascending: ascending$4,
  bandwidthNRD: estimateBandwidth,
  bin,
  bootstrapCI,
  boundClip,
  boundContext,
  boundItem: boundItem$1,
  boundMark,
  boundStroke,
  changeset,
  clampRange,
  codegenExpression: codegen,
  compare: compare$9,
  constant: constant$7,
  cumulativeLogNormal,
  cumulativeNormal,
  cumulativeUniform,
  dayofyear,
  debounce,
  defaultLocale,
  definition: definition$1,
  densityLogNormal,
  densityNormal,
  densityUniform,
  domChild,
  domClear,
  domCreate,
  domFind,
  dotbin,
  error,
  expressionFunction,
  extend: extend$1,
  extent,
  extentIndex,
  falsy,
  fastmap,
  field: field$1,
  flush: flush$1,
  font: font$1,
  fontFamily,
  fontSize,
  format: format$2,
  formatLocale: numberFormatDefaultLocale,
  formats: formats$1,
  hasOwnProperty: has$1,
  id: id$2,
  identity: identity$7,
  inferType,
  inferTypes,
  ingest: ingest$1,
  inherits,
  inrange,
  interpolate: interpolate$2,
  interpolateColors,
  interpolateRange: interpolateRange$1,
  intersect: intersect$2,
  intersectBoxLine,
  intersectPath,
  intersectPoint,
  intersectRule,
  isArray,
  isBoolean: isBoolean$2,
  isDate: isDate$1,
  isFunction: isFunction$1,
  isIterable,
  isNumber: isNumber$1,
  isObject,
  isRegExp,
  isString,
  isTuple,
  key,
  lerp,
  lineHeight,
  loader,
  locale,
  logger,
  lruCache: lruCache$1,
  markup,
  merge: merge$3,
  mergeConfig,
  multiLineOffset,
  one: one$2,
  pad: pad$2,
  panLinear,
  panLog,
  panPow,
  panSymlog,
  parse: parse$2,
  parseExpression: parser$1,
  parseSelector: eventSelector,
  path: path$3,
  pathCurves: curves$1,
  pathEqual,
  pathParse: parse$4,
  pathRectangle: vg_rect,
  pathRender,
  pathSymbols: symbols$1,
  pathTrail: vg_trail,
  peek: peek$1,
  point: point$2,
  projection,
  quantileLogNormal,
  quantileNormal,
  quantileUniform,
  quantiles,
  quantizeInterpolator,
  quarter,
  quartiles,
  get random() {
    return random;
  },
  randomInteger: integer,
  randomKDE: kde,
  randomLCG: lcg$2,
  randomLogNormal: lognormal,
  randomMixture: mixture$1,
  randomNormal: gaussian,
  randomUniform: uniform,
  read,
  regressionConstant: constant$6,
  regressionExp: exp$1,
  regressionLinear: linear$2,
  regressionLoess: loess,
  regressionLog: log$4,
  regressionPoly: poly,
  regressionPow: pow$3,
  regressionQuad: quad,
  renderModule,
  repeat,
  resetDefaultLocale,
  resetSVGClipId,
  resetSVGDefIds,
  responseType,
  runtimeContext: context,
  sampleCurve,
  sampleLogNormal,
  sampleNormal,
  sampleUniform,
  scale: scale$4,
  sceneEqual,
  sceneFromJSON,
  scenePickVisit: pickVisit,
  sceneToJSON,
  sceneVisit: visit,
  sceneZOrder: zorder,
  scheme: scheme$1,
  serializeXML,
  setRandom,
  span,
  splitAccessPath,
  stringValue: $,
  textMetrics,
  timeBin: bin$1,
  timeFloor,
  timeFormatLocale: timeFormatDefaultLocale,
  timeInterval,
  timeOffset,
  timeSequence,
  timeUnitSpecifier,
  timeUnits,
  toBoolean,
  toDate,
  toNumber,
  toSet,
  toString,
  transform: transform$2,
  transforms: transforms$1,
  truncate: truncate$1,
  truthy,
  tupleid,
  typeParsers,
  utcFloor,
  utcInterval,
  utcOffset,
  utcSequence,
  utcdayofyear,
  utcquarter,
  utcweek,
  version: version$3,
  visitArray,
  week,
  writeConfig,
  zero: zero$5,
  zoomLinear,
  zoomLog,
  zoomPow,
  zoomSymlog
}, Symbol.toStringTag, { value: "Module" })), Type = {
  quantitative: "quantitative",
  ordinal: "ordinal",
  temporal: "temporal",
  nominal: "nominal",
  geojson: "geojson"
};
function isContinuous(_e) {
  return _e === "quantitative" || _e === "temporal";
}
function isDiscrete$1(_e) {
  return _e === "ordinal" || _e === "nominal";
}
const QUANTITATIVE = Type.quantitative, ORDINAL = Type.ordinal, TEMPORAL = Type.temporal, NOMINAL = Type.nominal, GEOJSON = Type.geojson;
function getFullName(_e) {
  if (_e)
    switch (_e = _e.toLowerCase(), _e) {
      case "q":
      case QUANTITATIVE:
        return "quantitative";
      case "t":
      case TEMPORAL:
        return "temporal";
      case "o":
      case ORDINAL:
        return "ordinal";
      case "n":
      case NOMINAL:
        return "nominal";
      case GEOJSON:
        return "geojson";
    }
}
const ScaleType = {
  // Continuous - Quantitative
  LINEAR: "linear",
  LOG: "log",
  POW: "pow",
  SQRT: "sqrt",
  SYMLOG: "symlog",
  IDENTITY: "identity",
  SEQUENTIAL: "sequential",
  // Continuous - Time
  TIME: "time",
  UTC: "utc",
  // Discretizing scales
  QUANTILE: "quantile",
  QUANTIZE: "quantize",
  THRESHOLD: "threshold",
  BIN_ORDINAL: "bin-ordinal",
  // Discrete scales
  ORDINAL: "ordinal",
  POINT: "point",
  BAND: "band"
}, SCALE_CATEGORY_INDEX = {
  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 scaleCompatible(_e, Qt) {
  const Zt = SCALE_CATEGORY_INDEX[_e], $n = SCALE_CATEGORY_INDEX[Qt];
  return Zt === $n || Zt === "ordinal-position" && $n === "time" || $n === "ordinal-position" && Zt === "time";
}
const SCALE_PRECEDENCE_INDEX = {
  // numeric
  linear: 0,
  log: 1,
  pow: 1,
  sqrt: 1,
  symlog: 1,
  identity: 1,
  sequential: 1,
  // time
  time: 0,
  utc: 0,
  // ordinal-position -- these have higher precedence than continuous scales as they support more types of data
  point: 10,
  band: 11,
  // non grouped types
  ordinal: 0,
  "bin-ordinal": 0,
  quantile: 0,
  quantize: 0,
  threshold: 0
};
function scaleTypePrecedence(_e) {
  return SCALE_PRECEDENCE_INDEX[_e];
}
const QUANTITATIVE_SCALES = /* @__PURE__ */ new Set([
  "linear",
  "log",
  "pow",
  "sqrt",
  "symlog"
]), CONTINUOUS_TO_CONTINUOUS_SCALES = /* @__PURE__ */ new Set([
  ...QUANTITATIVE_SCALES,
  "time",
  "utc"
]);
function isQuantitative(_e) {
  return QUANTITATIVE_SCALES.has(_e);
}
const CONTINUOUS_TO_DISCRETE_SCALES = /* @__PURE__ */ new Set([
  "quantile",
  "quantize",
  "threshold"
]), CONTINUOUS_DOMAIN_SCALES = /* @__PURE__ */ new Set([
  ...CONTINUOUS_TO_CONTINUOUS_SCALES,
  ...CONTINUOUS_TO_DISCRETE_SCALES,
  "sequential",
  "identity"
]), DISCRETE_DOMAIN_SCALES = /* @__PURE__ */ new Set([
  "ordinal",
  "bin-ordinal",
  "point",
  "band"
]);
function hasDiscreteDomain(_e) {
  return DISCRETE_DOMAIN_SCALES.has(_e);
}
function hasContinuousDomain(_e) {
  return CONTINUOUS_DOMAIN_SCALES.has(_e);
}
function isContinuousToContinuous(_e) {
  return CONTINUOUS_TO_CONTINUOUS_SCALES.has(_e);
}
function isContinuousToDiscrete(_e) {
  return CONTINUOUS_TO_DISCRETE_SCALES.has(_e);
}
const defaultScaleConfig = {
  pointPadding: 0.5,
  barBandPaddingInner: 0.1,
  rectBandPaddingInner: 0,
  bandWithNestedOffsetPaddingInner: 0.2,
  bandWithNestedOffsetPaddingOuter: 0.2,
  minBandSize: 2,
  minFontSize: 8,
  maxFontSize: 40,
  minOpacity: 0.3,
  maxOpacity: 0.8,
  // FIXME: revise if these *can* become ratios of width/height step
  minSize: 9,
  minStrokeWidth: 1,
  maxStrokeWidth: 4,
  quantileCount: 4,
  quantizeCount: 4,
  zero: !0
};
function isExtendedScheme(_e) {
  return !isString(_e) && !!_e.name;
}
function isParameterDomain(_e) {
  return _e == null ? void 0 : _e.param;
}
function isDomainUnionWith(_e) {
  return _e == null ? void 0 : _e.unionWith;
}
function isFieldRange(_e) {
  return isObject(_e) && "field" in _e;
}
const SCALE_PROPERTY_INDEX = {
  type: 1,
  domain: 1,
  domainMax: 1,
  domainMin: 1,
  domainMid: 1,
  domainRaw: 1,
  align: 1,
  range: 1,
  rangeMax: 1,
  rangeMin: 1,
  scheme: 1,
  bins: 1,
  // Other properties
  reverse: 1,
  round: 1,
  // quantitative / time
  clamp: 1,
  nice: 1,
  // quantitative
  base: 1,
  exponent: 1,
  constant: 1,
  interpolate: 1,
  zero: 1,
  // band/point
  padding: 1,
  paddingInner: 1,
  paddingOuter: 1
}, { type, domain: domain$1, range: range$1, rangeMax, rangeMin, scheme, ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX } = SCALE_PROPERTY_INDEX, NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys$2(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX);
function scaleTypeSupportProperty(_e, Qt) {
  switch (Qt) {
    case "type":
    case "domain":
    case "reverse":
    case "range":
      return !0;
    case "scheme":
    case "interpolate":
      return !["point", "band", "identity"].includes(_e);
    case "bins":
      return !["point", "band", "identity", "ordinal"].includes(_e);
    case "round":
      return isContinuousToContinuous(_e) || _e === "band" || _e === "point";
    case "padding":
    case "rangeMin":
    case "rangeMax":
      return isContinuousToContinuous(_e) || ["point", "band"].includes(_e);
    case "paddingOuter":
    case "align":
      return ["point", "band"].includes(_e);
    case "paddingInner":
      return _e === "band";
    case "domainMax":
    case "domainMid":
    case "domainMin":
    case "domainRaw":
    case "clamp":
      return isContinuousToContinuous(_e);
    case "nice":
      return isContinuousToContinuous(_e) || _e === "quantize" || _e === "threshold";
    case "exponent":
      return _e === "pow";
    case "base":
      return _e === "log";
    case "constant":
      return _e === "symlog";
    case "zero":
      return hasContinuousDomain(_e) && !contains$1([
        "log",
        "time",
        "utc",
        "threshold",
        "quantile"
        // quantile depends on distribution so zero does not matter
      ], _e);
  }
}
function channelScalePropertyIncompatability(_e, Qt) {
  switch (Qt) {
    case "interpolate":
    case "scheme":
    case "domainMid":
      return isColorChannel(_e) ? void 0 : cannotUseScalePropertyWithNonColor(Qt);
    case "align":
    case "type":
    case "bins":
    case "domain":
    case "domainMax":
    case "domainMin":
    case "domainRaw":
    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 scaleTypeSupportDataType(_e, Qt) {
  return contains$1([ORDINAL, NOMINAL], Qt) ? _e === void 0 || hasDiscreteDomain(_e) : Qt === TEMPORAL ? contains$1([ScaleType.TIME, ScaleType.UTC, void 0], _e) : Qt === QUANTITATIVE ? isQuantitative(_e) || isContinuousToDiscrete(_e) || _e === void 0 : !0;
}
function channelSupportScaleType(_e, Qt, Zt = !1) {
  if (!isScaleChannel(_e))
    return !1;
  switch (_e) {
    case X$1:
    case Y$1:
    case XOFFSET:
    case YOFFSET:
    case THETA:
    case RADIUS:
      return isContinuousToContinuous(Qt) || Qt === "band" ? !0 : Qt === "point" ? !Zt : !1;
    case SIZE$1:
    case STROKEWIDTH:
    case OPACITY:
    case FILLOPACITY:
    case STROKEOPACITY:
    case ANGLE:
      return isContinuousToContinuous(Qt) || isContinuousToDiscrete(Qt) || contains$1(["band", "point", "ordinal"], Qt);
    case COLOR:
    case FILL:
    case STROKE:
      return Qt !== "band";
    case STROKEDASH:
    case SHAPE:
      return Qt === "ordinal" || isContinuousToDiscrete(Qt);
  }
}
const Mark = {
  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"
}, ARC = Mark.arc, AREA = Mark.area, BAR = Mark.bar, IMAGE = Mark.image, LINE = Mark.line, POINT = Mark.point, RECT = Mark.rect, RULE = Mark.rule, TEXT = Mark.text, TICK = Mark.tick, TRAIL = Mark.trail, CIRCLE = Mark.circle, SQUARE = Mark.square, GEOSHAPE = Mark.geoshape;
function isPathMark(_e) {
  return ["line", "area", "trail"].includes(_e);
}
function isRectBasedMark(_e) {
  return [
    "rect",
    "bar",
    "image",
    "arc"
    /* arc is rect/interval in polar coordinate */
  ].includes(_e);
}
const PRIMITIVE_MARKS = new Set(keys$2(Mark));
function isMarkDef(_e) {
  return _e.type;
}
const STROKE_CONFIG = [
  "stroke",
  "strokeWidth",
  "strokeDash",
  "strokeDashOffset",
  "strokeOpacity",
  "strokeJoin",
  "strokeMiterLimit"
], FILL_CONFIG = ["fill", "fillOpacity"], FILL_STROKE_CONFIG = [...STROKE_CONFIG, ...FILL_CONFIG], VL_ONLY_MARK_CONFIG_INDEX = {
  color: 1,
  filled: 1,
  invalid: 1,
  order: 1,
  radius2: 1,
  theta2: 1,
  timeUnitBandSize: 1,
  timeUnitBandPosition: 1
}, VL_ONLY_MARK_CONFIG_PROPERTIES = keys$2(VL_ONLY_MARK_CONFIG_INDEX), VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = {
  area: ["line", "point"],
  bar: ["binSpacing", "continuousBandSize", "discreteBandSize", "minBandSize"],
  rect: ["binSpacing", "continuousBandSize", "discreteBandSize", "minBandSize"],
  line: ["point"],
  tick: ["bandSize", "thickness"]
}, defaultMarkConfig = {
  color: "#4c78a8",
  invalid: "filter",
  timeUnitBandSize: 1
}, MARK_CONFIG_INDEX = {
  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
}, MARK_CONFIGS = keys$2(MARK_CONFIG_INDEX);
function isRelativeBandSize(_e) {
  return _e && _e.band != null;
}
const BAR_CORNER_RADIUS_INDEX = {
  horizontal: ["cornerRadiusTopRight", "cornerRadiusBottomRight"],
  vertical: ["cornerRadiusTopLeft", "cornerRadiusTopRight"]
}, DEFAULT_RECT_BAND_SIZE = 5, defaultBarConfig = {
  binSpacing: 1,
  continuousBandSize: DEFAULT_RECT_BAND_SIZE,
  minBandSize: 0.25,
  timeUnitBandPosition: 0.5
}, defaultRectConfig = {
  binSpacing: 0,
  continuousBandSize: DEFAULT_RECT_BAND_SIZE,
  minBandSize: 0.25,
  timeUnitBandPosition: 0.5
}, defaultTickConfig = {
  thickness: 1
};
function getMarkType(_e) {
  return isMarkDef(_e) ? _e.type : _e;
}
function midPointRefWithPositionInvalidTest(_e) {
  const { channel: Qt, channelDef: Zt, markDef: $n, scale: Sn, config: kn } = _e, Kn = midPoint(_e);
  return (
    // Only this for field def without counting aggregate (as count wouldn't be null)
    isFieldDef(Zt) && !isCountingAggregateOp(Zt.aggregate) && // and only for continuous scale
    Sn && isContinuousToContinuous(Sn.get("type")) ? wrapPositionInvalidTest({
      fieldDef: Zt,
      channel: Qt,
      markDef: $n,
      ref: Kn,
      config: kn
    }) : Kn
  );
}
function wrapPositionInvalidTest({ fieldDef: _e, channel: Qt, markDef: Zt, ref: $n, config: Sn }) {
  return isPathMark(Zt.type) ? $n : getMarkPropOrConfig("invalid", Zt, Sn) === null ? [fieldInvalidTestValueRef(_e, Qt), $n] : $n;
}
function fieldInvalidTestValueRef(_e, Qt) {
  const Zt = fieldInvalidPredicate(_e, !0), Sn = getMainRangeChannel(Qt) === "y" ? { field: { group: "height" } } : (
    // x / angle / radius can all use 0
    { value: 0 }
  );
  return { test: Zt, ...Sn };
}
function fieldInvalidPredicate(_e, Qt = !0) {
  return fieldValidPredicate(isString(_e) ? _e : vgField(_e, { expr: "datum" }), !Qt);
}
function datumDefToExpr(_e) {
  const { datum: Qt } = _e;
  return isDateTime(Qt) ? dateTimeToExpr(Qt) : `${stringify$2(Qt)}`;
}
function valueRefForFieldOrDatumDef(_e, Qt, Zt, $n) {
  const Sn = {};
  if (Qt && (Sn.scale = Qt), isDatumDef(_e)) {
    const { datum: kn } = _e;
    isDateTime(kn) ? Sn.signal = dateTimeToExpr(kn) : isSignalRef(kn) ? Sn.signal = kn.signal : isExprRef(kn) ? Sn.signal = kn.expr : Sn.value = kn;
  } else
    Sn.field = vgField(_e, Zt);
  if ($n) {
    const { offset: kn, band: Kn } = $n;
    kn && (Sn.offset = kn), Kn && (Sn.band = Kn);
  }
  return Sn;
}
function interpolatedSignalRef({ scaleName: _e, fieldOrDatumDef: Qt, fieldOrDatumDef2: Zt, offset: $n, startSuffix: Sn, bandPosition: kn = 0.5 }) {
  const Kn = 0 < kn && kn < 1 ? "datum" : void 0, er = vgField(Qt, { expr: Kn, suffix: Sn }), Cr = Zt !== void 0 ? vgField(Zt, { expr: Kn }) : vgField(Qt, { suffix: "end", expr: Kn }), kr = {};
  if (kn === 0 || kn === 1) {
    kr.scale = _e;
    const Yr = kn === 0 ? er : Cr;
    kr.field = Yr;
  } else {
    const Yr = isSignalRef(kn) ? `${kn.signal} * ${er} + (1-${kn.signal}) * ${Cr}` : `${kn} * ${er} + ${1 - kn} * ${Cr}`;
    kr.signal = `scale("${_e}", ${Yr})`;
  }
  return $n && (kr.offset = $n), kr;
}
function binSizeExpr({ scaleName: _e, fieldDef: Qt }) {
  const Zt = vgField(Qt, { expr: "datum" }), $n = vgField(Qt, { expr: "datum", suffix: "end" });
  return `abs(scale("${_e}", ${$n}) - scale("${_e}", ${Zt}))`;
}
function midPoint({ channel: _e, channelDef: Qt, channel2Def: Zt, markDef: $n, config: Sn, scaleName: kn, scale: Kn, stack: er, offset: Cr, defaultRef: kr, bandPosition: Yr }) {
  if (Qt) {
    if (isFieldOrDatumDef(Qt)) {
      const Ms = Kn == null ? void 0 : Kn.get("type");
      if (isTypedFieldDef(Qt)) {
        Yr ?? (Yr = getBandPosition({
          fieldDef: Qt,
          fieldDef2: Zt,
          markDef: $n,
          config: Sn
        }));
        const { bin: Ds, timeUnit: Ls, type: js } = Qt;
        if (isBinning(Ds) || Yr && Ls && js === TEMPORAL)
          return er != null && er.impute ? valueRefForFieldOrDatumDef(Qt, kn, { binSuffix: "mid" }, { offset: Cr }) : Yr && !hasDiscreteDomain(Ms) ? interpolatedSignalRef({ scaleName: kn, fieldOrDatumDef: Qt, bandPosition: Yr, offset: Cr }) : valueRefForFieldOrDatumDef(Qt, kn, binRequiresRange(Qt, _e) ? { binSuffix: "range" } : {}, {
            offset: Cr
          });
        if (isBinned(Ds)) {
          if (isFieldDef(Zt))
            return interpolatedSignalRef({
              scaleName: kn,
              fieldOrDatumDef: Qt,
              fieldOrDatumDef2: Zt,
              bandPosition: Yr,
              offset: Cr
            });
          warn$1(channelRequiredForBinned(_e === X$1 ? X2$2 : Y2$2));
        }
      }
      return valueRefForFieldOrDatumDef(
        Qt,
        kn,
        hasDiscreteDomain(Ms) ? { binSuffix: "range" } : {},
        // no need for bin suffix if there is no scale
        {
          offset: Cr,
          // For band, to get mid point, need to offset by half of the band
          band: Ms === "band" ? Yr ?? Qt.bandPosition ?? 0.5 : void 0
        }
      );
    } else if (isValueDef(Qt)) {
      const Ms = Qt.value, Ds = Cr ? { offset: Cr } : {};
      return { ...widthHeightValueOrSignalRef(_e, Ms), ...Ds };
    }
  }
  return isFunction$1(kr) && (kr = kr()), kr && {
    ...kr,
    // only include offset when it is non-zero (zero = no offset)
    ...Cr ? { offset: Cr } : {}
  };
}
function widthHeightValueOrSignalRef(_e, Qt) {
  return contains$1(["x", "x2"], _e) && Qt === "width" ? { field: { group: "width" } } : contains$1(["y", "y2"], _e) && Qt === "height" ? { field: { group: "height" } } : signalOrValueRef(Qt);
}
function isCustomFormatType(_e) {
  return _e && _e !== "number" && _e !== "time";
}
function customFormatExpr(_e, Qt, Zt) {
  return `${_e}(${Qt}${Zt ? `, ${stringify$2(Zt)}` : ""})`;
}
const BIN_RANGE_DELIMITER = " – ";
function formatSignalRef({ fieldOrDatumDef: _e, format: Qt, formatType: Zt, expr: $n, normalizeStack: Sn, config: kn }) {
  var Cr, kr;
  if (isCustomFormatType(Zt))
    return formatCustomType({
      fieldOrDatumDef: _e,
      format: Qt,
      formatType: Zt,
      expr: $n,
      config: kn
    });
  const Kn = fieldToFormat(_e, $n, Sn), er = channelDefType(_e);
  if (Qt === void 0 && Zt === void 0 && kn.customFormatTypes) {
    if (er === "quantitative") {
      if (Sn && kn.normalizedNumberFormatType)
        return formatCustomType({
          fieldOrDatumDef: _e,
          format: kn.normalizedNumberFormat,
          formatType: kn.normalizedNumberFormatType,
          expr: $n,
          config: kn
        });
      if (kn.numberFormatType)
        return formatCustomType({
          fieldOrDatumDef: _e,
          format: kn.numberFormat,
          formatType: kn.numberFormatType,
          expr: $n,
          config: kn
        });
    }
    if (er === "temporal" && kn.timeFormatType && isFieldDef(_e) && _e.timeUnit === void 0)
      return formatCustomType({
        fieldOrDatumDef: _e,
        format: kn.timeFormat,
        formatType: kn.timeFormatType,
        expr: $n,
        config: kn
      });
  }
  if (isFieldOrDatumDefForTimeFormat(_e)) {
    const Yr = timeFormatExpression({
      field: Kn,
      timeUnit: isFieldDef(_e) ? (Cr = normalizeTimeUnit(_e.timeUnit)) == null ? void 0 : Cr.unit : void 0,
      format: Qt,
      formatType: kn.timeFormatType,
      rawTimeFormat: kn.timeFormat,
      isUTCScale: isScaleFieldDef(_e) && ((kr = _e.scale) == null ? void 0 : kr.type) === ScaleType.UTC
    });
    return Yr ? { signal: Yr } : void 0;
  }
  if (Qt = numberFormat({ type: er, specifiedFormat: Qt, config: kn, normalizeStack: Sn }), isFieldDef(_e) && isBinning(_e.bin)) {
    const Yr = vgField(_e, { expr: $n, binSuffix: "end" });
    return {
      signal: binFormatExpression(Kn, Yr, Qt, Zt, kn)
    };
  } else
    return Qt || channelDefType(_e) === "quantitative" ? {
      signal: `${formatExpr(Kn, Qt)}`
    } : { signal: `isValid(${Kn}) ? ${Kn} : ""+${Kn}` };
}
function fieldToFormat(_e, Qt, Zt) {
  return isFieldDef(_e) ? Zt ? `${vgField(_e, { expr: Qt, suffix: "end" })}-${vgField(_e, {
    expr: Qt,
    suffix: "start"
  })}` : vgField(_e, { expr: Qt }) : datumDefToExpr(_e);
}
function formatCustomType({ fieldOrDatumDef: _e, format: Qt, formatType: Zt, expr: $n, normalizeStack: Sn, config: kn, field: Kn }) {
  if (Kn ?? (Kn = fieldToFormat(_e, $n, Sn)), Kn !== "datum.value" && // For axis/legend, we can't correctly know the end of the bin from `datum`
  isFieldDef(_e) && isBinning(_e.bin)) {
    const er = vgField(_e, { expr: $n, binSuffix: "end" });
    return {
      signal: binFormatExpression(Kn, er, Qt, Zt, kn)
    };
  }
  return { signal: customFormatExpr(Zt, Kn, Qt) };
}
function guideFormat(_e, Qt, Zt, $n, Sn, kn) {
  var Kn;
  if (!(isString($n) && isCustomFormatType($n)) && !(Zt === void 0 && $n === void 0 && Sn.customFormatTypes && channelDefType(_e) === "quantitative" && (Sn.normalizedNumberFormatType && isPositionFieldOrDatumDef(_e) && _e.stack === "normalize" || Sn.numberFormatType))) {
    if (isPositionFieldOrDatumDef(_e) && _e.stack === "normalize" && Sn.normalizedNumberFormat)
      return numberFormat({
        type: "quantitative",
        config: Sn,
        normalizeStack: !0
      });
    if (isFieldOrDatumDefForTimeFormat(_e)) {
      const er = isFieldDef(_e) ? (Kn = normalizeTimeUnit(_e.timeUnit)) == null ? void 0 : Kn.unit : void 0;
      return er === void 0 && Sn.customFormatTypes && Sn.timeFormatType ? void 0 : timeFormat({ specifiedFormat: Zt, timeUnit: er, config: Sn, omitTimeFormatConfig: kn });
    }
    return numberFormat({ type: Qt, specifiedFormat: Zt, config: Sn });
  }
}
function guideFormatType(_e, Qt, Zt) {
  var $n;
  if (_e && (isSignalRef(_e) || _e === "number" || _e === "time"))
    return _e;
  if (isFieldOrDatumDefForTimeFormat(Qt) && Zt !== "time" && Zt !== "utc")
    return isFieldDef(Qt) && (($n = normalizeTimeUnit(Qt == null ? void 0 : Qt.timeUnit)) != null && $n.utc) ? "utc" : "time";
}
function numberFormat({ type: _e, specifiedFormat: Qt, config: Zt, normalizeStack: $n }) {
  if (isString(Qt))
    return Qt;
  if (_e === QUANTITATIVE)
    return $n ? Zt.normalizedNumberFormat : Zt.numberFormat;
}
function timeFormat({ specifiedFormat: _e, timeUnit: Qt, config: Zt, omitTimeFormatConfig: $n }) {
  return _e || (Qt ? {
    signal: timeUnitSpecifierExpression(Qt)
  } : $n ? void 0 : Zt.timeFormat);
}
function formatExpr(_e, Qt) {
  return `format(${_e}, "${Qt || ""}")`;
}
function binNumberFormatExpr(_e, Qt, Zt, $n) {
  return isCustomFormatType(Zt) ? customFormatExpr(Zt, _e, Qt) : formatExpr(_e, (isString(Qt) ? Qt : void 0) ?? $n.numberFormat);
}
function binFormatExpression(_e, Qt, Zt, $n, Sn) {
  if (Zt === void 0 && $n === void 0 && Sn.customFormatTypes && Sn.numberFormatType)
    return binFormatExpression(_e, Qt, Sn.numberFormat, Sn.numberFormatType, Sn);
  const kn = binNumberFormatExpr(_e, Zt, $n, Sn), Kn = binNumberFormatExpr(Qt, Zt, $n, Sn);
  return `${fieldValidPredicate(_e, !1)} ? "null" : ${kn} + "${BIN_RANGE_DELIMITER}" + ${Kn}`;
}
function timeFormatExpression({ field: _e, timeUnit: Qt, format: Zt, formatType: $n, rawTimeFormat: Sn, isUTCScale: kn }) {
  return !Qt || Zt ? !Qt && $n ? `${$n}(${_e}, '${Zt}')` : (Zt = isString(Zt) ? Zt : Sn, `${kn ? "utc" : "time"}Format(${_e}, '${Zt}')`) : formatExpression(Qt, _e, kn);
}
const DEFAULT_SORT_OP = "min", SORT_BY_CHANNEL_INDEX = {
  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 isSortByChannel(_e) {
  return _e in SORT_BY_CHANNEL_INDEX;
}
function isSortByEncoding(_e) {
  return !!(_e != null && _e.encoding);
}
function isSortField(_e) {
  return _e && (_e.op === "count" || !!_e.field);
}
function isSortArray(_e) {
  return _e && isArray(_e);
}
function isFacetMapping(_e) {
  return "row" in _e || "column" in _e;
}
function isFacetFieldDef(_e) {
  return !!_e && "header" in _e;
}
function isFacetSpec(_e) {
  return "facet" in _e;
}
function isConditionalParameter(_e) {
  return _e.param;
}
function isRepeatRef(_e) {
  return _e && !isString(_e) && "repeat" in _e;
}
function toFieldDefBase(_e) {
  const { field: Qt, timeUnit: Zt, bin: $n, aggregate: Sn } = _e;
  return {
    ...Zt ? { timeUnit: Zt } : {},
    ...$n ? { bin: $n } : {},
    ...Sn ? { aggregate: Sn } : {},
    field: Qt
  };
}
function isSortableFieldDef(_e) {
  return "sort" in _e;
}
function getBandPosition({ fieldDef: _e, fieldDef2: Qt, markDef: Zt, config: $n }) {
  if (isFieldOrDatumDef(_e) && _e.bandPosition !== void 0)
    return _e.bandPosition;
  if (isFieldDef(_e)) {
    const { timeUnit: Sn, bin: kn } = _e;
    if (Sn && !Qt)
      return isRectBasedMark(Zt.type) ? 0 : getMarkConfig("timeUnitBandPosition", Zt, $n);
    if (isBinning(kn))
      return 0.5;
  }
}
function getBandSize({ channel: _e, fieldDef: Qt, fieldDef2: Zt, markDef: $n, config: Sn, scaleType: kn, useVlSizeChannel: Kn }) {
  var kr, Yr, Ms;
  const er = getSizeChannel(_e), Cr = getMarkPropOrConfig(Kn ? "size" : er, $n, Sn, {
    vgChannel: er
  });
  if (Cr !== void 0)
    return Cr;
  if (isFieldDef(Qt)) {
    const { timeUnit: Ds, bin: Ls } = Qt;
    if (Ds && !Zt)
      return { band: getMarkConfig("timeUnitBandSize", $n, Sn) };
    if (isBinning(Ls) && !hasDiscreteDomain(kn))
      return { band: 1 };
  }
  if (isRectBasedMark($n.type))
    return kn ? hasDiscreteDomain(kn) ? ((kr = Sn[$n.type]) == null ? void 0 : kr.discreteBandSize) || { band: 1 } : (Yr = Sn[$n.type]) == null ? void 0 : Yr.continuousBandSize : (Ms = Sn[$n.type]) == null ? void 0 : Ms.discreteBandSize;
}
function hasBandEnd(_e, Qt, Zt, $n) {
  return isBinning(_e.bin) || _e.timeUnit && isTypedFieldDef(_e) && _e.type === "temporal" ? getBandPosition({ fieldDef: _e, fieldDef2: Qt, markDef: Zt, config: $n }) !== void 0 : !1;
}
function isOrderOnlyDef(_e) {
  return _e && !!_e.sort && !_e.field;
}
function isConditionalDef(_e) {
  return _e && "condition" in _e;
}
function hasConditionalFieldDef(_e) {
  const Qt = _e == null ? void 0 : _e.condition;
  return !!Qt && !isArray(Qt) && isFieldDef(Qt);
}
function hasConditionalFieldOrDatumDef(_e) {
  const Qt = _e == null ? void 0 : _e.condition;
  return !!Qt && !isArray(Qt) && isFieldOrDatumDef(Qt);
}
function hasConditionalValueDef(_e) {
  const Qt = _e == null ? void 0 : _e.condition;
  return !!Qt && (isArray(Qt) || isValueDef(Qt));
}
function isFieldDef(_e) {
  return _e && (!!_e.field || _e.aggregate === "count");
}
function channelDefType(_e) {
  return _e == null ? void 0 : _e.type;
}
function isDatumDef(_e) {
  return _e && "datum" in _e;
}
function isContinuousFieldOrDatumDef(_e) {
  return isTypedFieldDef(_e) && !isDiscrete(_e) || isNumericDataDef(_e);
}
function isUnbinnedQuantitativeFieldOrDatumDef(_e) {
  return isTypedFieldDef(_e) && _e.type === "quantitative" && !_e.bin || isNumericDataDef(_e);
}
function isNumericDataDef(_e) {
  return isDatumDef(_e) && isNumber$1(_e.datum);
}
function isFieldOrDatumDef(_e) {
  return isFieldDef(_e) || isDatumDef(_e);
}
function isTypedFieldDef(_e) {
  return _e && ("field" in _e || _e.aggregate === "count") && "type" in _e;
}
function isValueDef(_e) {
  return _e && "value" in _e && "value" in _e;
}
function isScaleFieldDef(_e) {
  return _e && ("scale" in _e || "sort" in _e);
}
function isPositionFieldOrDatumDef(_e) {
  return _e && ("axis" in _e || "stack" in _e || "impute" in _e);
}
function isMarkPropFieldOrDatumDef(_e) {
  return _e && "legend" in _e;
}
function isStringFieldOrDatumDef(_e) {
  return _e && ("format" in _e || "formatType" in _e);
}
function toStringFieldDef(_e) {
  return omit(_e, ["legend", "axis", "header", "scale"]);
}
function isOpFieldDef(_e) {
  return "op" in _e;
}
function vgField(_e, Qt = {}) {
  let Zt = _e.field;
  const $n = Qt.prefix;
  let Sn = Qt.suffix, kn = "";
  if (isCount(_e))
    Zt = internalField("count");
  else {
    let Kn;
    if (!Qt.nofn)
      if (isOpFieldDef(_e))
        Kn = _e.op;
      else {
        const { bin: er, aggregate: Cr, timeUnit: kr } = _e;
        isBinning(er) ? (Kn = binToString(er), Sn = (Qt.binSuffix ?? "") + (Qt.suffix ?? "")) : Cr ? isArgmaxDef(Cr) ? (kn = `["${Zt}"]`, Zt = `argmax_${Cr.argmax}`) : isArgminDef(Cr) ? (kn = `["${Zt}"]`, Zt = `argmin_${Cr.argmin}`) : Kn = String(Cr) : kr && !isBinnedTimeUnit(kr) && (Kn = timeUnitToString(kr), Sn = (!["range", "mid"].includes(Qt.binSuffix) && Qt.binSuffix || "") + (Qt.suffix ?? ""));
      }
    Kn && (Zt = Zt ? `${Kn}_${Zt}` : Kn);
  }
  return Sn && (Zt = `${Zt}_${Sn}`), $n && (Zt = `${$n}_${Zt}`), Qt.forAs ? removePathFromField(Zt) : Qt.expr ? flatAccessWithDatum(Zt, Qt.expr) + kn : replacePathInField(Zt) + kn;
}
function isDiscrete(_e) {
  switch (_e.type) {
    case "nominal":
    case "ordinal":
    case "geojson":
      return !0;
    case "quantitative":
      return isFieldDef(_e) && !!_e.bin;
    case "temporal":
      return !1;
  }
  throw new Error(invalidFieldType(_e.type));
}
function isDiscretizing(_e) {
  var Qt;
  return isScaleFieldDef(_e) && isContinuousToDiscrete((Qt = _e.scale) == null ? void 0 : Qt.type);
}
function isCount(_e) {
  return _e.aggregate === "count";
}
function verbalTitleFormatter(_e, Qt) {
  var Kn;
  const { field: Zt, bin: $n, timeUnit: Sn, aggregate: kn } = _e;
  if (kn === "count")
    return Qt.countTitle;
  if (isBinning($n))
    return `${Zt} (binned)`;
  if (Sn && !isBinnedTimeUnit(Sn)) {
    const er = (Kn = normalizeTimeUnit(Sn)) == null ? void 0 : Kn.unit;
    if (er)
      return `${Zt} (${getTimeUnitParts(er).join("-")})`;
  } else if (kn)
    return isArgmaxDef(kn) ? `${Zt} for max ${kn.argmax}` : isArgminDef(kn) ? `${Zt} for min ${kn.argmin}` : `${titleCase(kn)} of ${Zt}`;
  return Zt;
}
function functionalTitleFormatter(_e) {
  const { aggregate: Qt, bin: Zt, timeUnit: $n, field: Sn } = _e;
  if (isArgmaxDef(Qt))
    return `${Sn} for argmax(${Qt.argmax})`;
  if (isArgminDef(Qt))
    return `${Sn} for argmin(${Qt.argmin})`;
  const kn = $n && !isBinnedTimeUnit($n) ? normalizeTimeUnit($n) : void 0, Kn = Qt || (kn == null ? void 0 : kn.unit) || (kn == null ? void 0 : kn.maxbins) && "timeunit" || isBinning(Zt) && "bin";
  return Kn ? `${Kn.toUpperCase()}(${Sn})` : Sn;
}
const defaultTitleFormatter = (_e, Qt) => {
  switch (Qt.fieldTitle) {
    case "plain":
      return _e.field;
    case "functional":
      return functionalTitleFormatter(_e);
    default:
      return verbalTitleFormatter(_e, Qt);
  }
};
let titleFormatter = defaultTitleFormatter;
function setTitleFormatter(_e) {
  titleFormatter = _e;
}
function resetTitleFormatter() {
  setTitleFormatter(defaultTitleFormatter);
}
function title(_e, Qt, { allowDisabling: Zt, includeDefault: $n = !0 }) {
  var er;
  const Sn = (er = getGuide(_e)) == null ? void 0 : er.title;
  if (!isFieldDef(_e))
    return Sn ?? _e.title;
  const kn = _e, Kn = $n ? defaultTitle(kn, Qt) : void 0;
  return Zt ? getFirstDefined(Sn, kn.title, Kn) : Sn ?? kn.title ?? Kn;
}
function getGuide(_e) {
  if (isPositionFieldOrDatumDef(_e) && _e.axis)
    return _e.axis;
  if (isMarkPropFieldOrDatumDef(_e) && _e.legend)
    return _e.legend;
  if (isFacetFieldDef(_e) && _e.header)
    return _e.header;
}
function defaultTitle(_e, Qt) {
  return titleFormatter(_e, Qt);
}
function getFormatMixins(_e) {
  if (isStringFieldOrDatumDef(_e)) {
    const { format: Qt, formatType: Zt } = _e;
    return { format: Qt, formatType: Zt };
  } else {
    const Qt = getGuide(_e) ?? {}, { format: Zt, formatType: $n } = Qt;
    return { format: Zt, formatType: $n };
  }
}
function defaultType$2(_e, Qt) {
  var kn;
  switch (Qt) {
    case "latitude":
    case "longitude":
      return "quantitative";
    case "row":
    case "column":
    case "facet":
    case "shape":
    case "strokeDash":
      return "nominal";
    case "order":
      return "ordinal";
  }
  if (isSortableFieldDef(_e) && isArray(_e.sort))
    return "ordinal";
  const { aggregate: Zt, bin: $n, timeUnit: Sn } = _e;
  if (Sn)
    return "temporal";
  if ($n || Zt && !isArgmaxDef(Zt) && !isArgminDef(Zt))
    return "quantitative";
  if (isScaleFieldDef(_e) && ((kn = _e.scale) != null && kn.type))
    switch (SCALE_CATEGORY_INDEX[_e.scale.type]) {
      case "numeric":
      case "discretizing":
        return "quantitative";
      case "time":
        return "temporal";
    }
  return "nominal";
}
function getFieldDef(_e) {
  if (isFieldDef(_e))
    return _e;
  if (hasConditionalFieldDef(_e))
    return _e.condition;
}
function getFieldOrDatumDef(_e) {
  if (isFieldOrDatumDef(_e))
    return _e;
  if (hasConditionalFieldOrDatumDef(_e))
    return _e.condition;
}
function initChannelDef(_e, Qt, Zt, $n = {}) {
  if (isString(_e) || isNumber$1(_e) || isBoolean$2(_e)) {
    const Sn = isString(_e) ? "string" : isNumber$1(_e) ? "number" : "boolean";
    return warn$1(primitiveChannelDef(Qt, Sn, _e)), { value: _e };
  }
  return isFieldOrDatumDef(_e) ? initFieldOrDatumDef(_e, Qt, Zt, $n) : hasConditionalFieldOrDatumDef(_e) ? {
    ..._e,
    // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition<FieldDef>
    condition: initFieldOrDatumDef(_e.condition, Qt, Zt, $n)
  } : _e;
}
function initFieldOrDatumDef(_e, Qt, Zt, $n) {
  if (isStringFieldOrDatumDef(_e)) {
    const { format: Sn, formatType: kn, ...Kn } = _e;
    if (isCustomFormatType(kn) && !Zt.customFormatTypes)
      return warn$1(customFormatTypeNotAllowed(Qt)), initFieldOrDatumDef(Kn, Qt, Zt, $n);
  } else {
    const Sn = isPositionFieldOrDatumDef(_e) ? "axis" : isMarkPropFieldOrDatumDef(_e) ? "legend" : isFacetFieldDef(_e) ? "header" : null;
    if (Sn && _e[Sn]) {
      const { format: kn, formatType: Kn, ...er } = _e[Sn];
      if (isCustomFormatType(Kn) && !Zt.customFormatTypes)
        return warn$1(customFormatTypeNotAllowed(Qt)), initFieldOrDatumDef({ ..._e, [Sn]: er }, Qt, Zt, $n);
    }
  }
  return isFieldDef(_e) ? initFieldDef(_e, Qt, $n) : initDatumDef(_e);
}
function initDatumDef(_e) {
  let Qt = _e.type;
  if (Qt)
    return _e;
  const { datum: Zt } = _e;
  return Qt = isNumber$1(Zt) ? "quantitative" : isString(Zt) ? "nominal" : isDateTime(Zt) ? "temporal" : void 0, { ..._e, type: Qt };
}
function initFieldDef(_e, Qt, { compositeMark: Zt = !1 } = {}) {
  const { aggregate: $n, timeUnit: Sn, bin: kn, field: Kn } = _e, er = { ..._e };
  if (!Zt && $n && !isAggregateOp($n) && !isArgmaxDef($n) && !isArgminDef($n) && (warn$1(invalidAggregate($n)), delete er.aggregate), Sn && (er.timeUnit = normalizeTimeUnit(Sn)), Kn && (er.field = `${Kn}`), isBinning(kn) && (er.bin = normalizeBin(kn, Qt)), isBinned(kn) && !isXorY(Qt) && warn$1(channelShouldNotBeUsedForBinned(Qt)), isTypedFieldDef(er)) {
    const { type: Cr } = er, kr = getFullName(Cr);
    Cr !== kr && (er.type = kr), Cr !== "quantitative" && isCountingAggregateOp($n) && (warn$1(invalidFieldTypeForCountAggregate(Cr, $n)), er.type = "quantitative");
  } else if (!isSecondaryRangeChannel(Qt)) {
    const Cr = defaultType$2(er, Qt);
    er.type = Cr;
  }
  if (isTypedFieldDef(er)) {
    const { compatible: Cr, warning: kr } = channelCompatibility(er, Qt) || {};
    Cr === !1 && warn$1(kr);
  }
  if (isSortableFieldDef(er) && isString(er.sort)) {
    const { sort: Cr } = er;
    if (isSortByChannel(Cr))
      return {
        ...er,
        sort: { encoding: Cr }
      };
    const kr = Cr.substr(1);
    if (Cr.charAt(0) === "-" && isSortByChannel(kr))
      return {
        ...er,
        sort: { encoding: kr, order: "descending" }
      };
  }
  if (isFacetFieldDef(er)) {
    const { header: Cr } = er;
    if (Cr) {
      const { orient: kr, ...Yr } = Cr;
      if (kr)
        return {
          ...er,
          header: {
            ...Yr,
            labelOrient: Cr.labelOrient || kr,
            titleOrient: Cr.titleOrient || kr
          }
        };
    }
  }
  return er;
}
function normalizeBin(_e, Qt) {
  return isBoolean$2(_e) ? { maxbins: autoMaxBins(Qt) } : _e === "binned" ? {
    binned: !0
  } : !_e.maxbins && !_e.step ? { ..._e, maxbins: autoMaxBins(Qt) } : _e;
}
const COMPATIBLE = { compatible: !0 };
function channelCompatibility(_e, Qt) {
  const Zt = _e.type;
  if (Zt === "geojson" && Qt !== "shape")
    return {
      compatible: !1,
      warning: `Channel ${Qt} should not be used with a geojson data.`
    };
  switch (Qt) {
    case ROW:
    case COLUMN:
    case FACET:
      return isDiscrete(_e) ? COMPATIBLE : {
        compatible: !1,
        warning: channelShouldBeDiscrete(Qt)
      };
    case X$1:
    case Y$1:
    case XOFFSET:
    case YOFFSET:
    case COLOR:
    case FILL:
    case STROKE:
    case TEXT$1:
    case DETAIL:
    case KEY:
    case TOOLTIP:
    case HREF:
    case URL$1:
    case ANGLE:
    case THETA:
    case RADIUS:
    case DESCRIPTION:
      return COMPATIBLE;
    case LONGITUDE:
    case LONGITUDE2:
    case LATITUDE:
    case LATITUDE2:
      return Zt !== QUANTITATIVE ? {
        compatible: !1,
        warning: `Channel ${Qt} should be used with a quantitative field only, not ${_e.type} field.`
      } : COMPATIBLE;
    case OPACITY:
    case FILLOPACITY:
    case STROKEOPACITY:
    case STROKEWIDTH:
    case SIZE$1:
    case THETA2:
    case RADIUS2:
    case X2$2:
    case Y2$2:
      return Zt === "nominal" && !_e.sort ? {
        compatible: !1,
        warning: `Channel ${Qt} should not be used with an unsorted discrete field.`
      } : COMPATIBLE;
    case SHAPE:
    case STROKEDASH:
      return !isDiscrete(_e) && !isDiscretizing(_e) ? {
        compatible: !1,
        warning: channelShouldBeDiscreteOrDiscretizing(Qt)
      } : COMPATIBLE;
    case ORDER:
      return _e.type === "nominal" && !("sort" in _e) ? {
        compatible: !1,
        warning: "Channel order is inappropriate for nominal field, which has no inherent order."
      } : COMPATIBLE;
  }
}
function isFieldOrDatumDefForTimeFormat(_e) {
  const { formatType: Qt } = getFormatMixins(_e);
  return Qt === "time" || !Qt && isTimeFieldDef(_e);
}
function isTimeFieldDef(_e) {
  return _e && (_e.type === "temporal" || isFieldDef(_e) && !!_e.timeUnit);
}
function valueExpr(_e, { timeUnit: Qt, type: Zt, wrapTime: $n, undefinedIfExprNotRequired: Sn }) {
  var Cr;
  const kn = Qt && ((Cr = normalizeTimeUnit(Qt)) == null ? void 0 : Cr.unit);
  let Kn = kn || Zt === "temporal", er;
  return isExprRef(_e) ? er = _e.expr : isSignalRef(_e) ? er = _e.signal : isDateTime(_e) ? (Kn = !0, er = dateTimeToExpr(_e)) : (isString(_e) || isNumber$1(_e)) && Kn && (er = `datetime(${stringify$2(_e)})`, isLocalSingleTimeUnit(kn) && (isNumber$1(_e) && _e < 1e4 || isString(_e) && isNaN(Date.parse(_e))) && (er = dateTimeToExpr({ [kn]: _e }))), er ? $n && Kn ? `time(${er})` : er : Sn ? void 0 : stringify$2(_e);
}
function valueArray(_e, Qt) {
  const { type: Zt } = _e;
  return Qt.map(($n) => {
    const Sn = isFieldDef(_e) && !isBinnedTimeUnit(_e.timeUnit) ? _e.timeUnit : void 0, kn = valueExpr($n, {
      timeUnit: Sn,
      type: Zt,
      undefinedIfExprNotRequired: !0
    });
    return kn !== void 0 ? { signal: kn } : $n;
  });
}
function binRequiresRange(_e, Qt) {
  return isBinning(_e.bin) ? isScaleChannel(Qt) && ["ordinal", "nominal"].includes(_e.type) : (console.warn("Only call this method for binned field defs."), !1);
}
const CONDITIONAL_AXIS_PROP_INDEX = {
  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 isConditionalAxisValue(_e) {
  return _e == null ? void 0 : _e.condition;
}
const AXIS_PARTS = ["domain", "grid", "labels", "ticks", "title"], AXIS_PROPERTY_TYPE = {
  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: "both",
  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"
  // this is actually set afterward, so it doesn't matter
}, COMMON_AXIS_PROPERTIES_INDEX = {
  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
}, AXIS_PROPERTIES_INDEX = {
  ...COMMON_AXIS_PROPERTIES_INDEX,
  style: 1,
  labelExpr: 1,
  encoding: 1
};
function isAxisProperty(_e) {
  return !!AXIS_PROPERTIES_INDEX[_e];
}
const AXIS_CONFIGS_INDEX = {
  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
}, AXIS_CONFIGS = keys$2(AXIS_CONFIGS_INDEX);
function isUnitSpec(_e) {
  return "mark" in _e;
}
class CompositeMarkNormalizer {
  constructor(Qt, Zt) {
    this.name = Qt, this.run = Zt;
  }
  hasMatchingType(Qt) {
    return isUnitSpec(Qt) ? getMarkType(Qt.mark) === this.name : !1;
  }
}
function channelHasField(_e, Qt) {
  const Zt = _e && _e[Qt];
  return Zt ? isArray(Zt) ? some(Zt, ($n) => !!$n.field) : isFieldDef(Zt) || hasConditionalFieldDef(Zt) : !1;
}
function channelHasFieldOrDatum(_e, Qt) {
  const Zt = _e && _e[Qt];
  return Zt ? isArray(Zt) ? some(Zt, ($n) => !!$n.field) : isFieldDef(Zt) || isDatumDef(Zt) || hasConditionalFieldOrDatumDef(Zt) : !1;
}
function channelHasNestedOffsetScale(_e, Qt) {
  if (isXorY(Qt)) {
    const Zt = _e[Qt];
    if ((isFieldDef(Zt) || isDatumDef(Zt)) && (isDiscrete$1(Zt.type) || isFieldDef(Zt) && Zt.timeUnit)) {
      const $n = getOffsetScaleChannel(Qt);
      return channelHasFieldOrDatum(_e, $n);
    }
  }
  return !1;
}
function isAggregate$1(_e) {
  return some(CHANNELS, (Qt) => {
    if (channelHasField(_e, Qt)) {
      const Zt = _e[Qt];
      if (isArray(Zt))
        return some(Zt, ($n) => !!$n.aggregate);
      {
        const $n = getFieldDef(Zt);
        return $n && !!$n.aggregate;
      }
    }
    return !1;
  });
}
function extractTransformsFromEncoding(_e, Qt) {
  const Zt = [], $n = [], Sn = [], kn = [], Kn = {};
  return forEach(_e, (er, Cr) => {
    if (isFieldDef(er)) {
      const { field: kr, aggregate: Yr, bin: Ms, timeUnit: Ds, ...Ls } = er;
      if (Yr || Ds || Ms) {
        const js = getGuide(er), zs = js == null ? void 0 : js.title;
        let Fs = vgField(er, { forAs: !0 });
        const Bs = {
          // Only add title if it doesn't exist
          ...zs ? [] : { title: title(er, Qt, { allowDisabling: !0 }) },
          ...Ls,
          // Always overwrite field
          field: Fs
        };
        if (Yr) {
          let Hs;
          if (isArgmaxDef(Yr) ? (Hs = "argmax", Fs = vgField({ op: "argmax", field: Yr.argmax }, { forAs: !0 }), Bs.field = `${Fs}.${kr}`) : isArgminDef(Yr) ? (Hs = "argmin", Fs = vgField({ op: "argmin", field: Yr.argmin }, { forAs: !0 }), Bs.field = `${Fs}.${kr}`) : Yr !== "boxplot" && Yr !== "errorbar" && Yr !== "errorband" && (Hs = Yr), Hs) {
            const Ws = {
              op: Hs,
              as: Fs
            };
            kr && (Ws.field = kr), kn.push(Ws);
          }
        } else if (Zt.push(Fs), isTypedFieldDef(er) && isBinning(Ms)) {
          if ($n.push({ bin: Ms, field: kr, as: Fs }), Zt.push(vgField(er, { binSuffix: "end" })), binRequiresRange(er, Cr) && Zt.push(vgField(er, { binSuffix: "range" })), isXorY(Cr)) {
            const Hs = {
              field: `${Fs}_end`
            };
            Kn[`${Cr}2`] = Hs;
          }
          Bs.bin = "binned", isSecondaryRangeChannel(Cr) || (Bs.type = QUANTITATIVE);
        } else if (Ds && !isBinnedTimeUnit(Ds)) {
          Sn.push({
            timeUnit: Ds,
            field: kr,
            as: Fs
          });
          const Hs = isTypedFieldDef(er) && er.type !== TEMPORAL && "time";
          Hs && (Cr === TEXT$1 || Cr === TOOLTIP ? Bs.formatType = Hs : isNonPositionScaleChannel(Cr) ? Bs.legend = {
            formatType: Hs,
            ...Bs.legend
          } : isXorY(Cr) && (Bs.axis = {
            formatType: Hs,
            ...Bs.axis
          }));
        }
        Kn[Cr] = Bs;
      } else
        Zt.push(kr), Kn[Cr] = _e[Cr];
    } else
      Kn[Cr] = _e[Cr];
  }), {
    bins: $n,
    timeUnits: Sn,
    aggregate: kn,
    groupby: Zt,
    encoding: Kn
  };
}
function markChannelCompatible(_e, Qt, Zt) {
  const $n = supportMark(Qt, Zt);
  if ($n) {
    if ($n === "binned") {
      const Sn = _e[Qt === X2$2 ? X$1 : Y$1];
      return !!(isFieldDef(Sn) && isFieldDef(_e[Qt]) && isBinned(Sn.bin));
    }
  } else
    return !1;
  return !0;
}
function initEncoding(_e, Qt, Zt, $n) {
  const Sn = {};
  for (const kn of keys$2(_e))
    isChannel(kn) || warn$1(invalidEncodingChannel(kn));
  for (let kn of UNIT_CHANNELS) {
    if (!_e[kn])
      continue;
    const Kn = _e[kn];
    if (isXorYOffset(kn)) {
      const er = getMainChannelFromOffsetChannel(kn), Cr = Sn[er];
      if (isFieldDef(Cr)) {
        if (isContinuous(Cr.type) && isFieldDef(Kn) && !Cr.timeUnit) {
          warn$1(offsetNestedInsideContinuousPositionScaleDropped(er));
          continue;
        }
      } else
        kn = er, warn$1(replaceOffsetWithMainChannel(er));
    }
    if (kn === "angle" && Qt === "arc" && !_e.theta && (warn$1(REPLACE_ANGLE_WITH_THETA), kn = THETA), !markChannelCompatible(_e, kn, Qt)) {
      warn$1(incompatibleChannel(kn, Qt));
      continue;
    }
    if (kn === SIZE$1 && Qt === "line") {
      const er = getFieldDef(_e[kn]);
      if (er != null && er.aggregate) {
        warn$1(LINE_WITH_VARYING_SIZE);
        continue;
      }
    }
    if (kn === COLOR && (Zt ? "fill" in _e : "stroke" in _e)) {
      warn$1(droppingColor("encoding", { fill: "fill" in _e, stroke: "stroke" in _e }));
      continue;
    }
    if (kn === DETAIL || kn === ORDER && !isArray(Kn) && !isValueDef(Kn) || kn === TOOLTIP && isArray(Kn)) {
      if (Kn) {
        if (kn === ORDER) {
          const er = _e[kn];
          if (isOrderOnlyDef(er)) {
            Sn[kn] = er;
            continue;
          }
        }
        Sn[kn] = array$6(Kn).reduce((er, Cr) => (isFieldDef(Cr) ? er.push(initFieldDef(Cr, kn)) : warn$1(emptyFieldDef(Cr, kn)), er), []);
      }
    } else {
      if (kn === TOOLTIP && Kn === null)
        Sn[kn] = null;
      else if (!isFieldDef(Kn) && !isDatumDef(Kn) && !isValueDef(Kn) && !isConditionalDef(Kn) && !isSignalRef(Kn)) {
        warn$1(emptyFieldDef(Kn, kn));
        continue;
      }
      Sn[kn] = initChannelDef(Kn, kn, $n);
    }
  }
  return Sn;
}
function normalizeEncoding(_e, Qt) {
  const Zt = {};
  for (const $n of keys$2(_e)) {
    const Sn = initChannelDef(_e[$n], $n, Qt, { compositeMark: !0 });
    Zt[$n] = Sn;
  }
  return Zt;
}
function fieldDefs(_e) {
  const Qt = [];
  for (const Zt of keys$2(_e))
    if (channelHasField(_e, Zt)) {
      const $n = _e[Zt], Sn = array$6($n);
      for (const kn of Sn)
        isFieldDef(kn) ? Qt.push(kn) : hasConditionalFieldDef(kn) && Qt.push(kn.condition);
    }
  return Qt;
}
function forEach(_e, Qt, Zt) {
  if (_e)
    for (const $n of keys$2(_e)) {
      const Sn = _e[$n];
      if (isArray(Sn))
        for (const kn of Sn)
          Qt.call(Zt, kn, $n);
      else
        Qt.call(Zt, Sn, $n);
    }
}
function reduce(_e, Qt, Zt, $n) {
  return _e ? keys$2(_e).reduce((Sn, kn) => {
    const Kn = _e[kn];
    return isArray(Kn) ? Kn.reduce((er, Cr) => Qt.call($n, er, Cr, kn), Sn) : Qt.call($n, Sn, Kn, kn);
  }, Zt) : Zt;
}
function pathGroupingFields(_e, Qt) {
  return keys$2(Qt).reduce((Zt, $n) => {
    switch ($n) {
      case X$1:
      case Y$1:
      case HREF:
      case DESCRIPTION:
      case URL$1:
      case X2$2:
      case Y2$2:
      case XOFFSET:
      case YOFFSET:
      case THETA:
      case THETA2:
      case RADIUS:
      case RADIUS2:
      case LATITUDE:
      case LONGITUDE:
      case LATITUDE2:
      case LONGITUDE2:
      case TEXT$1:
      case SHAPE:
      case ANGLE:
      case TOOLTIP:
        return Zt;
      case ORDER:
        if (_e === "line" || _e === "trail")
          return Zt;
      case DETAIL:
      case KEY: {
        const Sn = Qt[$n];
        if (isArray(Sn) || isFieldDef(Sn))
          for (const kn of array$6(Sn))
            kn.aggregate || Zt.push(vgField(kn, {}));
        return Zt;
      }
      case SIZE$1:
        if (_e === "trail")
          return Zt;
      case COLOR:
      case FILL:
      case STROKE:
      case OPACITY:
      case FILLOPACITY:
      case STROKEOPACITY:
      case STROKEDASH:
      case STROKEWIDTH: {
        const Sn = getFieldDef(Qt[$n]);
        return Sn && !Sn.aggregate && Zt.push(vgField(Sn, {})), Zt;
      }
    }
  }, []);
}
function filterTooltipWithAggregatedField(_e) {
  const { tooltip: Qt, ...Zt } = _e;
  if (!Qt)
    return { filteredEncoding: Zt };
  let $n, Sn;
  if (isArray(Qt)) {
    for (const kn of Qt)
      kn.aggregate ? ($n || ($n = []), $n.push(kn)) : (Sn || (Sn = []), Sn.push(kn));
    $n && (Zt.tooltip = $n);
  } else
    Qt.aggregate ? Zt.tooltip = Qt : Sn = Qt;
  return isArray(Sn) && Sn.length === 1 && (Sn = Sn[0]), { customTooltipWithoutAggregatedField: Sn, filteredEncoding: Zt };
}
function getCompositeMarkTooltip(_e, Qt, Zt, $n = !0) {
  if ("tooltip" in Zt)
    return { tooltip: Zt.tooltip };
  const Sn = _e.map(({ fieldPrefix: Kn, titlePrefix: er }) => {
    const Cr = $n ? ` of ${getTitle(Qt)}` : "";
    return {
      field: Kn + Qt.field,
      type: Qt.type,
      title: isSignalRef(er) ? { signal: `${er}"${escape(Cr)}"` } : er + Cr
    };
  }), kn = fieldDefs(Zt).map(toStringFieldDef);
  return {
    tooltip: [
      ...Sn,
      // need to cast because TextFieldDef supports fewer types of bin
      ...unique(kn, hash)
    ]
  };
}
function getTitle(_e) {
  const { title: Qt, field: Zt } = _e;
  return getFirstDefined(Qt, Zt);
}
function makeCompositeAggregatePartFactory(_e, Qt, Zt, $n, Sn) {
  const { scale: kn, axis: Kn } = Zt;
  return ({ partName: er, mark: Cr, positionPrefix: kr, endPositionPrefix: Yr = void 0, extraEncoding: Ms = {} }) => {
    const Ds = getTitle(Zt);
    return partLayerMixins(_e, er, Sn, {
      mark: Cr,
      encoding: {
        [Qt]: {
          field: `${kr}_${Zt.field}`,
          type: Zt.type,
          ...Ds !== void 0 ? { title: Ds } : {},
          ...kn !== void 0 ? { scale: kn } : {},
          ...Kn !== void 0 ? { axis: Kn } : {}
        },
        ...isString(Yr) ? {
          [`${Qt}2`]: {
            field: `${Yr}_${Zt.field}`
          }
        } : {},
        ...$n,
        ...Ms
      }
    });
  };
}
function partLayerMixins(_e, Qt, Zt, $n) {
  const { clip: Sn, color: kn, opacity: Kn } = _e, er = _e.type;
  return _e[Qt] || _e[Qt] === void 0 && Zt[Qt] ? [
    {
      ...$n,
      mark: {
        ...Zt[Qt],
        ...Sn ? { clip: Sn } : {},
        ...kn ? { color: kn } : {},
        ...Kn ? { opacity: Kn } : {},
        ...isMarkDef($n.mark) ? $n.mark : { type: $n.mark },
        style: `${er}-${String(Qt)}`,
        ...isBoolean$2(_e[Qt]) ? {} : _e[Qt]
      }
    }
  ] : [];
}
function compositeMarkContinuousAxis(_e, Qt, Zt) {
  const { encoding: $n } = _e, Sn = Qt === "vertical" ? "y" : "x", kn = $n[Sn], Kn = $n[`${Sn}2`], er = $n[`${Sn}Error`], Cr = $n[`${Sn}Error2`];
  return {
    continuousAxisChannelDef: filterAggregateFromChannelDef(kn, Zt),
    continuousAxisChannelDef2: filterAggregateFromChannelDef(Kn, Zt),
    continuousAxisChannelDefError: filterAggregateFromChannelDef(er, Zt),
    continuousAxisChannelDefError2: filterAggregateFromChannelDef(Cr, Zt),
    continuousAxis: Sn
  };
}
function filterAggregateFromChannelDef(_e, Qt) {
  if (_e != null && _e.aggregate) {
    const { aggregate: Zt, ...$n } = _e;
    return Zt !== Qt && warn$1(errorBarContinuousAxisHasCustomizedAggregate(Zt, Qt)), $n;
  } else
    return _e;
}
function compositeMarkOrient(_e, Qt) {
  const { mark: Zt, encoding: $n } = _e, { x: Sn, y: kn } = $n;
  if (isMarkDef(Zt) && Zt.orient)
    return Zt.orient;
  if (isContinuousFieldOrDatumDef(Sn)) {
    if (isContinuousFieldOrDatumDef(kn)) {
      const Kn = isFieldDef(Sn) && Sn.aggregate, er = isFieldDef(kn) && kn.aggregate;
      if (!Kn && er === Qt)
        return "vertical";
      if (!er && Kn === Qt)
        return "horizontal";
      if (Kn === Qt && er === Qt)
        throw new Error("Both x and y cannot have aggregate");
      return isFieldOrDatumDefForTimeFormat(kn) && !isFieldOrDatumDefForTimeFormat(Sn) ? "horizontal" : "vertical";
    }
    return "horizontal";
  } else {
    if (isContinuousFieldOrDatumDef(kn))
      return "vertical";
    throw new Error(`Need a valid continuous axis for ${Qt}s`);
  }
}
const BOXPLOT = "boxplot", BOXPLOT_PARTS = ["box", "median", "outliers", "rule", "ticks"], boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot);
function getBoxPlotType(_e) {
  return isNumber$1(_e) ? "tukey" : _e;
}
function normalizeBoxPlot(_e, { config: Qt }) {
  _e = {
    ..._e,
    encoding: normalizeEncoding(_e.encoding, Qt)
  };
  const { mark: Zt, encoding: $n, params: Sn, projection: kn, ...Kn } = _e, er = isMarkDef(Zt) ? Zt : { type: Zt };
  Sn && warn$1(selectionNotSupported("boxplot"));
  const Cr = er.extent ?? Qt.boxplot.extent, kr = getMarkPropOrConfig(
    "size",
    er,
    // TODO: https://github.com/vega/vega-lite/issues/6245
    Qt
  ), Yr = er.invalid, Ms = getBoxPlotType(Cr), { bins: Ds, timeUnits: Ls, transform: js, continuousAxisChannelDef: zs, continuousAxis: Fs, groupby: Bs, aggregate: Hs, encodingWithoutContinuousAxis: Ws, ticksOrient: Ys, boxOrient: El, customTooltipWithoutAggregatedField: Mu } = boxParams(_e, Cr, Qt), { color: Pl, size: Iu, ...Tu } = Ws, Au = (h$) => makeCompositeAggregatePartFactory(er, Fs, zs, h$, Qt.boxplot), Nu = Au(Tu), gm = Au(Ws), pm = Au({ ...Tu, ...Iu ? { size: Iu } : {} }), zu = getCompositeMarkTooltip([
    { fieldPrefix: Ms === "min-max" ? "upper_whisker_" : "max_", titlePrefix: "Max" },
    { fieldPrefix: "upper_box_", titlePrefix: "Q3" },
    { fieldPrefix: "mid_box_", titlePrefix: "Median" },
    { fieldPrefix: "lower_box_", titlePrefix: "Q1" },
    { fieldPrefix: Ms === "min-max" ? "lower_whisker_" : "min_", titlePrefix: "Min" }
  ], zs, Ws), Yu = { type: "tick", color: "black", opacity: 1, orient: Ys, invalid: Yr, aria: !1 }, sm = Ms === "min-max" ? zu : (
    // for tukey / k-IQR, just show upper/lower-whisker
    getCompositeMarkTooltip([
      { fieldPrefix: "upper_whisker_", titlePrefix: "Upper Whisker" },
      { fieldPrefix: "lower_whisker_", titlePrefix: "Lower Whisker" }
    ], zs, Ws)
  ), mm = [
    ...Nu({
      partName: "rule",
      mark: { type: "rule", invalid: Yr, aria: !1 },
      positionPrefix: "lower_whisker",
      endPositionPrefix: "lower_box",
      extraEncoding: sm
    }),
    ...Nu({
      partName: "rule",
      mark: { type: "rule", invalid: Yr, aria: !1 },
      positionPrefix: "upper_box",
      endPositionPrefix: "upper_whisker",
      extraEncoding: sm
    }),
    ...Nu({
      partName: "ticks",
      mark: Yu,
      positionPrefix: "lower_whisker",
      extraEncoding: sm
    }),
    ...Nu({
      partName: "ticks",
      mark: Yu,
      positionPrefix: "upper_whisker",
      extraEncoding: sm
    })
  ], hm = [
    ...Ms !== "tukey" ? mm : [],
    ...gm({
      partName: "box",
      mark: {
        type: "bar",
        ...kr ? { size: kr } : {},
        orient: El,
        invalid: Yr,
        ariaRoleDescription: "box"
      },
      positionPrefix: "lower_box",
      endPositionPrefix: "upper_box",
      extraEncoding: zu
    }),
    ...pm({
      partName: "median",
      mark: {
        type: "tick",
        invalid: Yr,
        ...isObject(Qt.boxplot.median) && Qt.boxplot.median.color ? { color: Qt.boxplot.median.color } : {},
        ...kr ? { size: kr } : {},
        orient: Ys,
        aria: !1
      },
      positionPrefix: "mid_box",
      extraEncoding: zu
    })
  ];
  if (Ms === "min-max")
    return {
      ...Kn,
      transform: (Kn.transform ?? []).concat(js),
      layer: hm
    };
  const ym = `datum["lower_box_${zs.field}"]`, _m = `datum["upper_box_${zs.field}"]`, Sm = `(${_m} - ${ym})`, wm = `${ym} - ${Cr} * ${Sm}`, Nm = `${_m} + ${Cr} * ${Sm}`, Cm = `datum["${zs.field}"]`, Im = {
    joinaggregate: boxParamsQuartiles(zs.field),
    groupby: Bs
  }, Am = {
    transform: [
      {
        filter: `(${wm} <= ${Cm}) && (${Cm} <= ${Nm})`
      },
      {
        aggregate: [
          {
            op: "min",
            field: zs.field,
            as: `lower_whisker_${zs.field}`
          },
          {
            op: "max",
            field: zs.field,
            as: `upper_whisker_${zs.field}`
          },
          // preserve lower_box / upper_box
          {
            op: "min",
            field: `lower_box_${zs.field}`,
            as: `lower_box_${zs.field}`
          },
          {
            op: "max",
            field: `upper_box_${zs.field}`,
            as: `upper_box_${zs.field}`
          },
          ...Hs
        ],
        groupby: Bs
      }
    ],
    layer: mm
  }, { tooltip: Vm, ...Rm } = Tu, { scale: Dm, axis: km } = zs, zm = getTitle(zs), Pm = omit(km, ["title"]), i$ = partLayerMixins(er, "outliers", Qt.boxplot, {
    transform: [{ filter: `(${Cm} < ${wm}) || (${Cm} > ${Nm})` }],
    mark: "point",
    encoding: {
      [Fs]: {
        field: zs.field,
        type: zs.type,
        ...zm !== void 0 ? { title: zm } : {},
        ...Dm !== void 0 ? { scale: Dm } : {},
        // add axis without title since we already added the title above
        ...isEmpty(Pm) ? {} : { axis: Pm }
      },
      ...Rm,
      ...Pl ? { color: Pl } : {},
      ...Mu ? { tooltip: Mu } : {}
    }
  })[0];
  let o$;
  const u$ = [...Ds, ...Ls, Im];
  return i$ ? o$ = {
    transform: u$,
    layer: [i$, Am]
  } : (o$ = Am, o$.transform.unshift(...u$)), {
    ...Kn,
    layer: [
      o$,
      {
        // boxplot
        transform: js,
        layer: hm
      }
    ]
  };
}
function boxParamsQuartiles(_e) {
  return [
    {
      op: "q1",
      field: _e,
      as: `lower_box_${_e}`
    },
    {
      op: "q3",
      field: _e,
      as: `upper_box_${_e}`
    }
  ];
}
function boxParams(_e, Qt, Zt) {
  const $n = compositeMarkOrient(_e, BOXPLOT), { continuousAxisChannelDef: Sn, continuousAxis: kn } = compositeMarkContinuousAxis(_e, $n, BOXPLOT), Kn = Sn.field, er = getBoxPlotType(Qt), Cr = [
    ...boxParamsQuartiles(Kn),
    {
      op: "median",
      field: Kn,
      as: `mid_box_${Kn}`
    },
    {
      op: "min",
      field: Kn,
      as: (er === "min-max" ? "lower_whisker_" : "min_") + Kn
    },
    {
      op: "max",
      field: Kn,
      as: (er === "min-max" ? "upper_whisker_" : "max_") + Kn
    }
  ], kr = er === "min-max" || er === "tukey" ? [] : [
    // This is for the  original k-IQR, which we do not expose
    {
      calculate: `datum["upper_box_${Kn}"] - datum["lower_box_${Kn}"]`,
      as: `iqr_${Kn}`
    },
    {
      calculate: `min(datum["upper_box_${Kn}"] + datum["iqr_${Kn}"] * ${Qt}, datum["max_${Kn}"])`,
      as: `upper_whisker_${Kn}`
    },
    {
      calculate: `max(datum["lower_box_${Kn}"] - datum["iqr_${Kn}"] * ${Qt}, datum["min_${Kn}"])`,
      as: `lower_whisker_${Kn}`
    }
  ], { [kn]: Yr, ...Ms } = _e.encoding, { customTooltipWithoutAggregatedField: Ds, filteredEncoding: Ls } = filterTooltipWithAggregatedField(Ms), { bins: js, timeUnits: zs, aggregate: Fs, groupby: Bs, encoding: Hs } = extractTransformsFromEncoding(Ls, Zt), Ws = $n === "vertical" ? "horizontal" : "vertical", Ys = $n, El = [
    ...js,
    ...zs,
    {
      aggregate: [...Fs, ...Cr],
      groupby: Bs
    },
    ...kr
  ];
  return {
    bins: js,
    timeUnits: zs,
    transform: El,
    groupby: Bs,
    aggregate: Fs,
    continuousAxisChannelDef: Sn,
    continuousAxis: kn,
    encodingWithoutContinuousAxis: Hs,
    ticksOrient: Ws,
    boxOrient: Ys,
    customTooltipWithoutAggregatedField: Ds
  };
}
const ERRORBAR = "errorbar", ERRORBAR_PARTS = ["ticks", "rule"], errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar);
function normalizeErrorBar(_e, { config: Qt }) {
  _e = {
    ..._e,
    encoding: normalizeEncoding(_e.encoding, Qt)
  };
  const { transform: Zt, continuousAxisChannelDef: $n, continuousAxis: Sn, encodingWithoutContinuousAxis: kn, ticksOrient: Kn, markDef: er, outerSpec: Cr, tooltipEncoding: kr } = errorBarParams(_e, ERRORBAR, Qt);
  delete kn.size;
  const Yr = makeCompositeAggregatePartFactory(er, Sn, $n, kn, Qt.errorbar), Ms = er.thickness, Ds = er.size, Ls = {
    type: "tick",
    orient: Kn,
    aria: !1,
    ...Ms !== void 0 ? { thickness: Ms } : {},
    ...Ds !== void 0 ? { size: Ds } : {}
  }, js = [
    ...Yr({
      partName: "ticks",
      mark: Ls,
      positionPrefix: "lower",
      extraEncoding: kr
    }),
    ...Yr({
      partName: "ticks",
      mark: Ls,
      positionPrefix: "upper",
      extraEncoding: kr
    }),
    ...Yr({
      partName: "rule",
      mark: {
        type: "rule",
        ariaRoleDescription: "errorbar",
        ...Ms !== void 0 ? { size: Ms } : {}
      },
      positionPrefix: "lower",
      endPositionPrefix: "upper",
      extraEncoding: kr
    })
  ];
  return {
    ...Cr,
    transform: Zt,
    ...js.length > 1 ? { layer: js } : { ...js[0] }
  };
}
function errorBarOrientAndInputType(_e, Qt) {
  const { encoding: Zt } = _e;
  if (errorBarIsInputTypeRaw(Zt))
    return {
      orient: compositeMarkOrient(_e, Qt),
      inputType: "raw"
    };
  const $n = errorBarIsInputTypeAggregatedUpperLower(Zt), Sn = errorBarIsInputTypeAggregatedError(Zt), kn = Zt.x, Kn = Zt.y;
  if ($n) {
    if (Sn)
      throw new Error(`${Qt} cannot be both type aggregated-upper-lower and aggregated-error`);
    const er = Zt.x2, Cr = Zt.y2;
    if (isFieldOrDatumDef(er) && isFieldOrDatumDef(Cr))
      throw new Error(`${Qt} cannot have both x2 and y2`);
    if (isFieldOrDatumDef(er)) {
      if (isContinuousFieldOrDatumDef(kn))
        return { orient: "horizontal", inputType: "aggregated-upper-lower" };
      throw new Error(`Both x and x2 have to be quantitative in ${Qt}`);
    } else if (isFieldOrDatumDef(Cr)) {
      if (isContinuousFieldOrDatumDef(Kn))
        return { orient: "vertical", inputType: "aggregated-upper-lower" };
      throw new Error(`Both y and y2 have to be quantitative in ${Qt}`);
    }
    throw new Error("No ranged axis");
  } else {
    const er = Zt.xError, Cr = Zt.xError2, kr = Zt.yError, Yr = Zt.yError2;
    if (isFieldOrDatumDef(Cr) && !isFieldOrDatumDef(er))
      throw new Error(`${Qt} cannot have xError2 without xError`);
    if (isFieldOrDatumDef(Yr) && !isFieldOrDatumDef(kr))
      throw new Error(`${Qt} cannot have yError2 without yError`);
    if (isFieldOrDatumDef(er) && isFieldOrDatumDef(kr))
      throw new Error(`${Qt} cannot have both xError and yError with both are quantiative`);
    if (isFieldOrDatumDef(er)) {
      if (isContinuousFieldOrDatumDef(kn))
        return { orient: "horizontal", inputType: "aggregated-error" };
      throw new Error("All x, xError, and xError2 (if exist) have to be quantitative");
    } else if (isFieldOrDatumDef(kr)) {
      if (isContinuousFieldOrDatumDef(Kn))
        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 errorBarIsInputTypeRaw(_e) {
  return (isFieldOrDatumDef(_e.x) || isFieldOrDatumDef(_e.y)) && !isFieldOrDatumDef(_e.x2) && !isFieldOrDatumDef(_e.y2) && !isFieldOrDatumDef(_e.xError) && !isFieldOrDatumDef(_e.xError2) && !isFieldOrDatumDef(_e.yError) && !isFieldOrDatumDef(_e.yError2);
}
function errorBarIsInputTypeAggregatedUpperLower(_e) {
  return isFieldOrDatumDef(_e.x2) || isFieldOrDatumDef(_e.y2);
}
function errorBarIsInputTypeAggregatedError(_e) {
  return isFieldOrDatumDef(_e.xError) || isFieldOrDatumDef(_e.xError2) || isFieldOrDatumDef(_e.yError) || isFieldOrDatumDef(_e.yError2);
}
function errorBarParams(_e, Qt, Zt) {
  const { mark: $n, encoding: Sn, params: kn, projection: Kn, ...er } = _e, Cr = isMarkDef($n) ? $n : { type: $n };
  kn && warn$1(selectionNotSupported(Qt));
  const { orient: kr, inputType: Yr } = errorBarOrientAndInputType(_e, Qt), { continuousAxisChannelDef: Ms, continuousAxisChannelDef2: Ds, continuousAxisChannelDefError: Ls, continuousAxisChannelDefError2: js, continuousAxis: zs } = compositeMarkContinuousAxis(_e, kr, Qt), { errorBarSpecificAggregate: Fs, postAggregateCalculates: Bs, tooltipSummary: Hs, tooltipTitleWithFieldName: Ws } = errorBarAggregationAndCalculation(Cr, Ms, Ds, Ls, js, Yr, Qt, Zt), { [zs]: Ys, [zs === "x" ? "x2" : "y2"]: El, [zs === "x" ? "xError" : "yError"]: Mu, [zs === "x" ? "xError2" : "yError2"]: Pl, ...Iu } = Sn, { bins: Tu, timeUnits: Au, aggregate: Nu, groupby: gm, encoding: pm } = extractTransformsFromEncoding(Iu, Zt), zu = [...Nu, ...Fs], Yu = Yr !== "raw" ? [] : gm, sm = getCompositeMarkTooltip(Hs, Ms, pm, Ws);
  return {
    transform: [
      ...er.transform ?? [],
      ...Tu,
      ...Au,
      ...zu.length === 0 ? [] : [{ aggregate: zu, groupby: Yu }],
      ...Bs
    ],
    groupby: Yu,
    continuousAxisChannelDef: Ms,
    continuousAxis: zs,
    encodingWithoutContinuousAxis: pm,
    ticksOrient: kr === "vertical" ? "horizontal" : "vertical",
    markDef: Cr,
    outerSpec: er,
    tooltipEncoding: sm
  };
}
function errorBarAggregationAndCalculation(_e, Qt, Zt, $n, Sn, kn, Kn, er) {
  let Cr = [], kr = [];
  const Yr = Qt.field;
  let Ms, Ds = !1;
  if (kn === "raw") {
    const Ls = _e.center ? _e.center : _e.extent ? _e.extent === "iqr" ? "median" : "mean" : er.errorbar.center, js = _e.extent ? _e.extent : Ls === "mean" ? "stderr" : "iqr";
    if (Ls === "median" != (js === "iqr") && warn$1(errorBarCenterIsUsedWithWrongExtent(Ls, js, Kn)), js === "stderr" || js === "stdev")
      Cr = [
        { op: js, field: Yr, as: `extent_${Yr}` },
        { op: Ls, field: Yr, as: `center_${Yr}` }
      ], kr = [
        {
          calculate: `datum["center_${Yr}"] + datum["extent_${Yr}"]`,
          as: `upper_${Yr}`
        },
        {
          calculate: `datum["center_${Yr}"] - datum["extent_${Yr}"]`,
          as: `lower_${Yr}`
        }
      ], Ms = [
        { fieldPrefix: "center_", titlePrefix: titleCase(Ls) },
        { fieldPrefix: "upper_", titlePrefix: getTitlePrefix(Ls, js, "+") },
        { fieldPrefix: "lower_", titlePrefix: getTitlePrefix(Ls, js, "-") }
      ], Ds = !0;
    else {
      let zs, Fs, Bs;
      js === "ci" ? (zs = "mean", Fs = "ci0", Bs = "ci1") : (zs = "median", Fs = "q1", Bs = "q3"), Cr = [
        { op: Fs, field: Yr, as: `lower_${Yr}` },
        { op: Bs, field: Yr, as: `upper_${Yr}` },
        { op: zs, field: Yr, as: `center_${Yr}` }
      ], Ms = [
        {
          fieldPrefix: "upper_",
          titlePrefix: title({ field: Yr, aggregate: Bs, type: "quantitative" }, er, {
            allowDisabling: !1
          })
        },
        {
          fieldPrefix: "lower_",
          titlePrefix: title({ field: Yr, aggregate: Fs, type: "quantitative" }, er, {
            allowDisabling: !1
          })
        },
        {
          fieldPrefix: "center_",
          titlePrefix: title({ field: Yr, aggregate: zs, type: "quantitative" }, er, {
            allowDisabling: !1
          })
        }
      ];
    }
  } else {
    (_e.center || _e.extent) && warn$1(errorBarCenterAndExtentAreNotNeeded(_e.center, _e.extent)), kn === "aggregated-upper-lower" ? (Ms = [], kr = [
      { calculate: `datum["${Zt.field}"]`, as: `upper_${Yr}` },
      { calculate: `datum["${Yr}"]`, as: `lower_${Yr}` }
    ]) : kn === "aggregated-error" && (Ms = [{ fieldPrefix: "", titlePrefix: Yr }], kr = [
      {
        calculate: `datum["${Yr}"] + datum["${$n.field}"]`,
        as: `upper_${Yr}`
      }
    ], Sn ? kr.push({
      calculate: `datum["${Yr}"] + datum["${Sn.field}"]`,
      as: `lower_${Yr}`
    }) : kr.push({
      calculate: `datum["${Yr}"] - datum["${$n.field}"]`,
      as: `lower_${Yr}`
    }));
    for (const Ls of kr)
      Ms.push({
        fieldPrefix: Ls.as.substring(0, 6),
        titlePrefix: replaceAll(replaceAll(Ls.calculate, 'datum["', ""), '"]', "")
      });
  }
  return { postAggregateCalculates: kr, errorBarSpecificAggregate: Cr, tooltipSummary: Ms, tooltipTitleWithFieldName: Ds };
}
function getTitlePrefix(_e, Qt, Zt) {
  return `${titleCase(_e)} ${Zt} ${Qt}`;
}
const ERRORBAND = "errorband", ERRORBAND_PARTS = ["band", "borders"], errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand);
function normalizeErrorBand(_e, { config: Qt }) {
  _e = {
    ..._e,
    encoding: normalizeEncoding(_e.encoding, Qt)
  };
  const { transform: Zt, continuousAxisChannelDef: $n, continuousAxis: Sn, encodingWithoutContinuousAxis: kn, markDef: Kn, outerSpec: er, tooltipEncoding: Cr } = errorBarParams(_e, ERRORBAND, Qt), kr = Kn, Yr = makeCompositeAggregatePartFactory(kr, Sn, $n, kn, Qt.errorband), Ms = _e.encoding.x !== void 0 && _e.encoding.y !== void 0;
  let Ds = { type: Ms ? "area" : "rect" }, Ls = { type: Ms ? "line" : "rule" };
  const js = {
    ...kr.interpolate ? { interpolate: kr.interpolate } : {},
    ...kr.tension && kr.interpolate ? { tension: kr.tension } : {}
  };
  return Ms ? (Ds = {
    ...Ds,
    ...js,
    ariaRoleDescription: "errorband"
  }, Ls = {
    ...Ls,
    ...js,
    aria: !1
  }) : kr.interpolate ? warn$1(errorBand1DNotSupport("interpolate")) : kr.tension && warn$1(errorBand1DNotSupport("tension")), {
    ...er,
    transform: Zt,
    layer: [
      ...Yr({
        partName: "band",
        mark: Ds,
        positionPrefix: "lower",
        endPositionPrefix: "upper",
        extraEncoding: Cr
      }),
      ...Yr({
        partName: "borders",
        mark: Ls,
        positionPrefix: "lower",
        extraEncoding: Cr
      }),
      ...Yr({
        partName: "borders",
        mark: Ls,
        positionPrefix: "upper",
        extraEncoding: Cr
      })
    ]
  };
}
const compositeMarkRegistry = {};
function add$1(_e, Qt, Zt) {
  const $n = new CompositeMarkNormalizer(_e, Qt);
  compositeMarkRegistry[_e] = { normalizer: $n, parts: Zt };
}
function getAllCompositeMarks() {
  return keys$2(compositeMarkRegistry);
}
add$1(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS);
add$1(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS);
add$1(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS);
const VL_ONLY_LEGEND_CONFIG = [
  "gradientHorizontalMaxLength",
  "gradientHorizontalMinLength",
  "gradientVerticalMaxLength",
  "gradientVerticalMinLength",
  "unselectedOpacity"
], HEADER_TITLE_PROPERTIES_MAP = {
  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"
}, HEADER_LABEL_PROPERTIES_MAP = {
  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"
}, HEADER_TITLE_PROPERTIES = keys$2(HEADER_TITLE_PROPERTIES_MAP), HEADER_LABEL_PROPERTIES = keys$2(HEADER_LABEL_PROPERTIES_MAP), HEADER_CONFIGS_INDEX = {
  header: 1,
  headerRow: 1,
  headerColumn: 1,
  headerFacet: 1
}, HEADER_CONFIGS = keys$2(HEADER_CONFIGS_INDEX), LEGEND_SCALE_CHANNELS = [
  "size",
  "shape",
  "fill",
  "stroke",
  "strokeDash",
  "strokeWidth",
  "opacity"
], defaultLegendConfig = {
  gradientHorizontalMaxLength: 200,
  gradientHorizontalMinLength: 100,
  gradientVerticalMaxLength: 200,
  gradientVerticalMinLength: 64,
  unselectedOpacity: 0.35
}, COMMON_LEGEND_PROPERTY_INDEX = {
  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
}, SELECTION_ID = "_vgsid_", defaultConfig$1 = {
  point: {
    on: "click",
    fields: [SELECTION_ID],
    toggle: "event.shiftKey",
    resolve: "global",
    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 isLegendBinding(_e) {
  return _e === "legend" || !!(_e != null && _e.legend);
}
function isLegendStreamBinding(_e) {
  return isLegendBinding(_e) && isObject(_e);
}
function isSelectionParameter(_e) {
  return !!(_e != null && _e.select);
}
function assembleParameterSignals(_e) {
  const Qt = [];
  for (const Zt of _e || []) {
    if (isSelectionParameter(Zt))
      continue;
    const { expr: $n, bind: Sn, ...kn } = Zt;
    if (Sn && $n) {
      const Kn = {
        ...kn,
        bind: Sn,
        init: $n
      };
      Qt.push(Kn);
    } else {
      const Kn = {
        ...kn,
        ...$n ? { update: $n } : {},
        ...Sn ? { bind: Sn } : {}
      };
      Qt.push(Kn);
    }
  }
  return Qt;
}
function isAnyConcatSpec(_e) {
  return isVConcatSpec(_e) || isHConcatSpec(_e) || isConcatSpec(_e);
}
function isConcatSpec(_e) {
  return "concat" in _e;
}
function isVConcatSpec(_e) {
  return "vconcat" in _e;
}
function isHConcatSpec(_e) {
  return "hconcat" in _e;
}
function getStepFor({ step: _e, offsetIsDiscrete: Qt }) {
  return Qt ? _e.for ?? "offset" : "position";
}
function isStep(_e) {
  return isObject(_e) && _e.step !== void 0;
}
function isFrameMixins(_e) {
  return _e.view || _e.width || _e.height;
}
const DEFAULT_SPACING = 20, COMPOSITION_LAYOUT_INDEX = {
  align: 1,
  bounds: 1,
  center: 1,
  columns: 1,
  spacing: 1
}, COMPOSITION_LAYOUT_PROPERTIES = keys$2(COMPOSITION_LAYOUT_INDEX);
function extractCompositionLayout(_e, Qt, Zt) {
  const $n = Zt[Qt], Sn = {}, { spacing: kn, columns: Kn } = $n;
  kn !== void 0 && (Sn.spacing = kn), Kn !== void 0 && (isFacetSpec(_e) && !isFacetMapping(_e.facet) || isConcatSpec(_e)) && (Sn.columns = Kn), isVConcatSpec(_e) && (Sn.columns = 1);
  for (const er of COMPOSITION_LAYOUT_PROPERTIES)
    if (_e[er] !== void 0)
      if (er === "spacing") {
        const Cr = _e[er];
        Sn[er] = isNumber$1(Cr) ? Cr : {
          row: Cr.row ?? kn,
          column: Cr.column ?? kn
        };
      } else
        Sn[er] = _e[er];
  return Sn;
}
function getViewConfigContinuousSize(_e, Qt) {
  return _e[Qt] ?? _e[Qt === "width" ? "continuousWidth" : "continuousHeight"];
}
function getViewConfigDiscreteStep(_e, Qt) {
  const Zt = getViewConfigDiscreteSize(_e, Qt);
  return isStep(Zt) ? Zt.step : DEFAULT_STEP;
}
function getViewConfigDiscreteSize(_e, Qt) {
  const Zt = _e[Qt] ?? _e[Qt === "width" ? "discreteWidth" : "discreteHeight"];
  return getFirstDefined(Zt, { step: _e.step });
}
const DEFAULT_STEP = 20, defaultViewConfig = {
  continuousWidth: 200,
  continuousHeight: 200,
  step: DEFAULT_STEP
}, defaultConfig = {
  background: "white",
  padding: 5,
  timeFormat: "%b %d, %Y",
  countTitle: "Count of Records",
  view: defaultViewConfig,
  mark: defaultMarkConfig,
  arc: {},
  area: {},
  bar: defaultBarConfig,
  circle: {},
  geoshape: {},
  image: {},
  line: {},
  point: {},
  rect: defaultRectConfig,
  rule: { color: "black" },
  square: {},
  text: { color: "black" },
  tick: defaultTickConfig,
  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: defaultScaleConfig,
  projection: {},
  legend: defaultLegendConfig,
  header: { titlePadding: 10, labelPadding: 10 },
  headerColumn: {},
  headerRow: {},
  headerFacet: {},
  selection: defaultConfig$1,
  style: {},
  title: {},
  facet: { spacing: DEFAULT_SPACING },
  concat: { spacing: DEFAULT_SPACING },
  normalizedNumberFormat: ".0%"
}, tab10 = [
  "#4c78a8",
  "#f58518",
  "#e45756",
  "#72b7b2",
  "#54a24b",
  "#eeca3b",
  "#b279a2",
  "#ff9da6",
  "#9d755d",
  "#bab0ac"
], DEFAULT_FONT_SIZE = {
  text: 11,
  guideLabel: 10,
  guideTitle: 11,
  groupTitle: 13,
  groupSubtitle: 12
}, DEFAULT_COLOR = {
  blue: tab10[0],
  orange: tab10[1],
  red: tab10[2],
  teal: tab10[3],
  green: tab10[4],
  yellow: tab10[5],
  purple: tab10[6],
  pink: tab10[7],
  brown: tab10[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 colorSignalConfig(_e = {}) {
  return {
    signals: [
      {
        name: "color",
        value: isObject(_e) ? { ...DEFAULT_COLOR, ..._e } : DEFAULT_COLOR
      }
    ],
    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 fontSizeSignalConfig(_e) {
  return {
    signals: [
      {
        name: "fontSize",
        value: isObject(_e) ? { ...DEFAULT_FONT_SIZE, ..._e } : DEFAULT_FONT_SIZE
      }
    ],
    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 fontConfig(_e) {
  return {
    text: { font: _e },
    style: {
      "guide-label": { font: _e },
      "guide-title": { font: _e },
      "group-title": { font: _e },
      "group-subtitle": { font: _e }
    }
  };
}
function getAxisConfigInternal(_e) {
  const Qt = keys$2(_e || {}), Zt = {};
  for (const $n of Qt) {
    const Sn = _e[$n];
    Zt[$n] = isConditionalAxisValue(Sn) ? signalOrValueRefWithCondition(Sn) : signalRefOrValue(Sn);
  }
  return Zt;
}
function getStyleConfigInternal(_e) {
  const Qt = keys$2(_e), Zt = {};
  for (const $n of Qt)
    Zt[$n] = getAxisConfigInternal(_e[$n]);
  return Zt;
}
const configPropsWithExpr = [
  ...MARK_CONFIGS,
  ...AXIS_CONFIGS,
  ...HEADER_CONFIGS,
  "background",
  "padding",
  "legend",
  "lineBreak",
  "scale",
  "style",
  "title",
  "view"
];
function initConfig(_e = {}) {
  const { color: Qt, font: Zt, fontSize: $n, selection: Sn, ...kn } = _e, Kn = mergeConfig({}, duplicate(defaultConfig), Zt ? fontConfig(Zt) : {}, Qt ? colorSignalConfig(Qt) : {}, $n ? fontSizeSignalConfig($n) : {}, kn || {});
  Sn && writeConfig(Kn, "selection", Sn, !0);
  const er = omit(Kn, configPropsWithExpr);
  for (const Cr of ["background", "lineBreak", "padding"])
    Kn[Cr] && (er[Cr] = signalRefOrValue(Kn[Cr]));
  for (const Cr of MARK_CONFIGS)
    Kn[Cr] && (er[Cr] = replaceExprRef(Kn[Cr]));
  for (const Cr of AXIS_CONFIGS)
    Kn[Cr] && (er[Cr] = getAxisConfigInternal(Kn[Cr]));
  for (const Cr of HEADER_CONFIGS)
    Kn[Cr] && (er[Cr] = replaceExprRef(Kn[Cr]));
  return Kn.legend && (er.legend = replaceExprRef(Kn.legend)), Kn.scale && (er.scale = replaceExprRef(Kn.scale)), Kn.style && (er.style = getStyleConfigInternal(Kn.style)), Kn.title && (er.title = replaceExprRef(Kn.title)), Kn.view && (er.view = replaceExprRef(Kn.view)), er;
}
const MARK_STYLES = /* @__PURE__ */ new Set(["view", ...PRIMITIVE_MARKS]), VL_ONLY_CONFIG_PROPERTIES = [
  "color",
  "fontSize",
  "background",
  "padding",
  "facet",
  "concat",
  "numberFormat",
  "numberFormatType",
  "normalizedNumberFormat",
  "normalizedNumberFormatType",
  "timeFormat",
  "countTitle",
  "header",
  "axisQuantitative",
  "axisTemporal",
  "axisDiscrete",
  "axisPoint",
  "axisXBand",
  "axisXPoint",
  "axisXDiscrete",
  "axisXQuantitative",
  "axisXTemporal",
  "axisYBand",
  "axisYPoint",
  "axisYDiscrete",
  "axisYQuantitative",
  "axisYTemporal",
  "scale",
  "selection",
  "overlay"
  // FIXME: Redesign and unhide this
], VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = {
  view: ["continuousWidth", "continuousHeight", "discreteWidth", "discreteHeight", "step"],
  ...VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX
};
function stripAndRedirectConfig(_e) {
  _e = duplicate(_e);
  for (const Qt of VL_ONLY_CONFIG_PROPERTIES)
    delete _e[Qt];
  if (_e.axis)
    for (const Qt in _e.axis)
      isConditionalAxisValue(_e.axis[Qt]) && delete _e.axis[Qt];
  if (_e.legend)
    for (const Qt of VL_ONLY_LEGEND_CONFIG)
      delete _e.legend[Qt];
  if (_e.mark) {
    for (const Qt of VL_ONLY_MARK_CONFIG_PROPERTIES)
      delete _e.mark[Qt];
    _e.mark.tooltip && isObject(_e.mark.tooltip) && delete _e.mark.tooltip;
  }
  _e.params && (_e.signals = (_e.signals || []).concat(assembleParameterSignals(_e.params)), delete _e.params);
  for (const Qt of MARK_STYLES) {
    for (const $n of VL_ONLY_MARK_CONFIG_PROPERTIES)
      delete _e[Qt][$n];
    const Zt = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[Qt];
    if (Zt)
      for (const $n of Zt)
        delete _e[Qt][$n];
    redirectConfigToStyleConfig(_e, Qt);
  }
  for (const Qt of getAllCompositeMarks())
    delete _e[Qt];
  redirectTitleConfig(_e);
  for (const Qt in _e)
    isObject(_e[Qt]) && isEmpty(_e[Qt]) && delete _e[Qt];
  return isEmpty(_e) ? void 0 : _e;
}
function redirectTitleConfig(_e) {
  const { titleMarkConfig: Qt, subtitleMarkConfig: Zt, subtitle: $n } = extractTitleConfig(_e.title);
  isEmpty(Qt) || (_e.style["group-title"] = {
    ..._e.style["group-title"],
    ...Qt
    // config.title has higher precedence than config.style.group-title in Vega
  }), isEmpty(Zt) || (_e.style["group-subtitle"] = {
    ..._e.style["group-subtitle"],
    ...Zt
  }), isEmpty($n) ? delete _e.title : _e.title = $n;
}
function redirectConfigToStyleConfig(_e, Qt, Zt, $n) {
  const Sn = $n ? _e[Qt][$n] : _e[Qt];
  Qt === "view" && (Zt = "cell");
  const kn = {
    ...Sn,
    ..._e.style[Zt ?? Qt]
  };
  isEmpty(kn) || (_e.style[Zt ?? Qt] = kn), $n || delete _e[Qt];
}
function isLayerSpec(_e) {
  return "layer" in _e;
}
function isRepeatSpec(_e) {
  return "repeat" in _e;
}
function isLayerRepeatSpec(_e) {
  return !isArray(_e.repeat) && _e.repeat.layer;
}
class SpecMapper {
  map(Qt, Zt) {
    return isFacetSpec(Qt) ? this.mapFacet(Qt, Zt) : isRepeatSpec(Qt) ? this.mapRepeat(Qt, Zt) : isHConcatSpec(Qt) ? this.mapHConcat(Qt, Zt) : isVConcatSpec(Qt) ? this.mapVConcat(Qt, Zt) : isConcatSpec(Qt) ? this.mapConcat(Qt, Zt) : this.mapLayerOrUnit(Qt, Zt);
  }
  mapLayerOrUnit(Qt, Zt) {
    if (isLayerSpec(Qt))
      return this.mapLayer(Qt, Zt);
    if (isUnitSpec(Qt))
      return this.mapUnit(Qt, Zt);
    throw new Error(invalidSpec(Qt));
  }
  mapLayer(Qt, Zt) {
    return {
      ...Qt,
      layer: Qt.layer.map(($n) => this.mapLayerOrUnit($n, Zt))
    };
  }
  mapHConcat(Qt, Zt) {
    return {
      ...Qt,
      hconcat: Qt.hconcat.map(($n) => this.map($n, Zt))
    };
  }
  mapVConcat(Qt, Zt) {
    return {
      ...Qt,
      vconcat: Qt.vconcat.map(($n) => this.map($n, Zt))
    };
  }
  mapConcat(Qt, Zt) {
    const { concat: $n, ...Sn } = Qt;
    return {
      ...Sn,
      concat: $n.map((kn) => this.map(kn, Zt))
    };
  }
  mapFacet(Qt, Zt) {
    return {
      // as any is required here since TS cannot infer that FO may only be FieldName or Field, but not RepeatRef
      ...Qt,
      // TODO: remove "any" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760
      spec: this.map(Qt.spec, Zt)
    };
  }
  mapRepeat(Qt, Zt) {
    return {
      ...Qt,
      // as any is required here since TS cannot infer that the output type satisfies the input type
      spec: this.map(Qt.spec, Zt)
    };
  }
}
const STACK_OFFSET_INDEX = {
  zero: 1,
  center: 1,
  normalize: 1
};
function isStackOffset(_e) {
  return _e in STACK_OFFSET_INDEX;
}
const STACKABLE_MARKS = /* @__PURE__ */ new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]), STACK_BY_DEFAULT_MARKS = /* @__PURE__ */ new Set([BAR, AREA, ARC]);
function isUnbinnedQuantitative(_e) {
  return isFieldDef(_e) && channelDefType(_e) === "quantitative" && !_e.bin;
}
function potentialStackedChannel(_e, Qt, { orient: Zt, type: $n }) {
  const Sn = Qt === "x" ? "y" : "radius", kn = Qt === "x", Kn = _e[Qt], er = _e[Sn];
  if (isFieldDef(Kn) && isFieldDef(er))
    if (isUnbinnedQuantitative(Kn) && isUnbinnedQuantitative(er)) {
      if (Kn.stack)
        return Qt;
      if (er.stack)
        return Sn;
      const Cr = isFieldDef(Kn) && !!Kn.aggregate, kr = isFieldDef(er) && !!er.aggregate;
      if (Cr !== kr)
        return Cr ? Qt : Sn;
      if (kn && ["bar", "area"].includes($n)) {
        if (Zt === "vertical")
          return Sn;
        if (Zt === "horizontal")
          return Qt;
      }
    } else {
      if (isUnbinnedQuantitative(Kn))
        return Qt;
      if (isUnbinnedQuantitative(er))
        return Sn;
    }
  else {
    if (isUnbinnedQuantitative(Kn))
      return Qt;
    if (isUnbinnedQuantitative(er))
      return Sn;
  }
}
function getDimensionChannel(_e) {
  switch (_e) {
    case "x":
      return "y";
    case "y":
      return "x";
    case "theta":
      return "radius";
    case "radius":
      return "theta";
  }
}
function stack(_e, Qt) {
  var Ds, Ls;
  const Zt = isMarkDef(_e) ? _e : { type: _e }, $n = Zt.type;
  if (!STACKABLE_MARKS.has($n))
    return null;
  const Sn = potentialStackedChannel(Qt, "x", Zt) || potentialStackedChannel(Qt, "theta", Zt);
  if (!Sn)
    return null;
  const kn = Qt[Sn], Kn = isFieldDef(kn) ? vgField(kn, {}) : void 0, er = getDimensionChannel(Sn), Cr = [], kr = /* @__PURE__ */ new Set();
  if (Qt[er]) {
    const js = Qt[er], zs = isFieldDef(js) ? vgField(js, {}) : void 0;
    zs && zs !== Kn && (Cr.push(er), kr.add(zs));
    const Fs = er === "x" ? "xOffset" : "yOffset", Bs = Qt[Fs], Hs = isFieldDef(Bs) ? vgField(Bs, {}) : void 0;
    Hs && Hs !== Kn && (Cr.push(Fs), kr.add(Hs));
  }
  const Yr = NONPOSITION_CHANNELS.reduce((js, zs) => {
    if (zs !== "tooltip" && channelHasField(Qt, zs)) {
      const Fs = Qt[zs];
      for (const Bs of array$6(Fs)) {
        const Hs = getFieldDef(Bs);
        if (Hs.aggregate)
          continue;
        const Ws = vgField(Hs, {});
        // if fielddef is a repeat, just include it in the stack by
        (!Ws || // otherwise, the field must be different from the groupBy fields.
        !kr.has(Ws)) && js.push({ channel: zs, fieldDef: Hs });
      }
    }
    return js;
  }, []);
  let Ms;
  return kn.stack !== void 0 ? isBoolean$2(kn.stack) ? Ms = kn.stack ? "zero" : null : Ms = kn.stack : STACK_BY_DEFAULT_MARKS.has($n) && (Ms = "zero"), !Ms || !isStackOffset(Ms) || isAggregate$1(Qt) && Yr.length === 0 ? null : (Ds = kn == null ? void 0 : kn.scale) != null && Ds.type && ((Ls = kn == null ? void 0 : kn.scale) == null ? void 0 : Ls.type) !== ScaleType.LINEAR ? (kn != null && kn.stack && warn$1(cannotStackNonLinearScale(kn.scale.type)), null) : isFieldOrDatumDef(Qt[getSecondaryRangeChannel(Sn)]) ? (kn.stack !== void 0 && warn$1(cannotStackRangedMark(Sn)), null) : (isFieldDef(kn) && kn.aggregate && !SUM_OPS.has(kn.aggregate) && warn$1(stackNonSummativeAggregate(kn.aggregate)), {
    groupbyChannels: Cr,
    groupbyFields: kr,
    fieldChannel: Sn,
    impute: kn.impute === null ? !1 : isPathMark($n),
    stackBy: Yr,
    offset: Ms
  });
}
function initMarkdef(_e, Qt, Zt) {
  const $n = replaceExprRef(_e), Sn = getMarkPropOrConfig("orient", $n, Zt);
  if ($n.orient = orient($n.type, Qt, Sn), Sn !== void 0 && Sn !== $n.orient && warn$1(orientOverridden($n.orient, Sn)), $n.type === "bar" && $n.orient) {
    const er = getMarkPropOrConfig("cornerRadiusEnd", $n, Zt);
    if (er !== void 0) {
      const Cr = $n.orient === "horizontal" && Qt.x2 || $n.orient === "vertical" && Qt.y2 ? ["cornerRadius"] : BAR_CORNER_RADIUS_INDEX[$n.orient];
      for (const kr of Cr)
        $n[kr] = er;
      $n.cornerRadiusEnd !== void 0 && delete $n.cornerRadiusEnd;
    }
  }
  return getMarkPropOrConfig("opacity", $n, Zt) === void 0 && ($n.opacity = opacity($n.type, Qt)), getMarkPropOrConfig("cursor", $n, Zt) === void 0 && ($n.cursor = cursor($n, Qt, Zt)), $n;
}
function cursor(_e, Qt, Zt) {
  return Qt.href || _e.href || getMarkPropOrConfig("href", _e, Zt) ? "pointer" : _e.cursor;
}
function opacity(_e, Qt) {
  if (contains$1([POINT, TICK, CIRCLE, SQUARE], _e) && !isAggregate$1(Qt))
    return 0.7;
}
function defaultFilled(_e, Qt, { graticule: Zt }) {
  if (Zt)
    return !1;
  const $n = getMarkConfig("filled", _e, Qt), Sn = _e.type;
  return getFirstDefined($n, Sn !== POINT && Sn !== LINE && Sn !== RULE);
}
function orient(_e, Qt, Zt) {
  switch (_e) {
    case POINT:
    case CIRCLE:
    case SQUARE:
    case TEXT:
    case RECT:
    case IMAGE:
      return;
  }
  const { x: $n, y: Sn, x2: kn, y2: Kn } = Qt;
  switch (_e) {
    case BAR:
      if (isFieldDef($n) && (isBinned($n.bin) || isFieldDef(Sn) && Sn.aggregate && !$n.aggregate))
        return "vertical";
      if (isFieldDef(Sn) && (isBinned(Sn.bin) || isFieldDef($n) && $n.aggregate && !Sn.aggregate))
        return "horizontal";
      if (Kn || kn) {
        if (Zt)
          return Zt;
        if (!kn)
          return (isFieldDef($n) && $n.type === QUANTITATIVE && !isBinning($n.bin) || isNumericDataDef($n)) && isFieldDef(Sn) && isBinned(Sn.bin) ? "horizontal" : "vertical";
        if (!Kn)
          return (isFieldDef(Sn) && Sn.type === QUANTITATIVE && !isBinning(Sn.bin) || isNumericDataDef(Sn)) && isFieldDef($n) && isBinned($n.bin) ? "vertical" : "horizontal";
      }
    case RULE:
      if (kn && !(isFieldDef($n) && isBinned($n.bin)) && Kn && !(isFieldDef(Sn) && isBinned(Sn.bin)))
        return;
    case AREA:
      if (Kn)
        return isFieldDef(Sn) && isBinned(Sn.bin) ? "horizontal" : "vertical";
      if (kn)
        return isFieldDef($n) && isBinned($n.bin) ? "vertical" : "horizontal";
      if (_e === RULE) {
        if ($n && !Sn)
          return "vertical";
        if (Sn && !$n)
          return "horizontal";
      }
    case LINE:
    case TICK: {
      const er = isUnbinnedQuantitativeFieldOrDatumDef($n), Cr = isUnbinnedQuantitativeFieldOrDatumDef(Sn);
      if (Zt)
        return Zt;
      if (er && !Cr)
        return _e !== "tick" ? "horizontal" : "vertical";
      if (!er && Cr)
        return _e !== "tick" ? "vertical" : "horizontal";
      if (er && Cr)
        return "vertical";
      {
        const kr = isTypedFieldDef($n) && $n.type === TEMPORAL, Yr = isTypedFieldDef(Sn) && Sn.type === TEMPORAL;
        if (kr && !Yr)
          return "vertical";
        if (!kr && Yr)
          return "horizontal";
      }
      return;
    }
  }
  return "vertical";
}
function dropLineAndPoint(_e) {
  const { point: Qt, line: Zt, ...$n } = _e;
  return keys$2($n).length > 1 ? $n : $n.type;
}
function dropLineAndPointFromConfig(_e) {
  for (const Qt of ["line", "area", "rule", "trail"])
    _e[Qt] && (_e = {
      ..._e,
      // TODO: remove as any
      [Qt]: omit(_e[Qt], ["point", "line"])
    });
  return _e;
}
function getPointOverlay(_e, Qt = {}, Zt) {
  return _e.point === "transparent" ? { opacity: 0 } : _e.point ? isObject(_e.point) ? _e.point : {} : _e.point !== void 0 ? null : Qt.point || Zt.shape ? isObject(Qt.point) ? Qt.point : {} : void 0;
}
function getLineOverlay(_e, Qt = {}) {
  return _e.line ? _e.line === !0 ? {} : _e.line : _e.line !== void 0 ? null : Qt.line ? Qt.line === !0 ? {} : Qt.line : void 0;
}
class PathOverlayNormalizer {
  constructor() {
    this.name = "path-overlay";
  }
  hasMatchingType(Qt, Zt) {
    if (isUnitSpec(Qt)) {
      const { mark: $n, encoding: Sn } = Qt, kn = isMarkDef($n) ? $n : { type: $n };
      switch (kn.type) {
        case "line":
        case "rule":
        case "trail":
          return !!getPointOverlay(kn, Zt[kn.type], Sn);
        case "area":
          return (
            // false / null are also included as we want to remove the properties
            !!getPointOverlay(kn, Zt[kn.type], Sn) || !!getLineOverlay(kn, Zt[kn.type])
          );
      }
    }
    return !1;
  }
  run(Qt, Zt, $n) {
    const { config: Sn } = Zt, { params: kn, projection: Kn, mark: er, name: Cr, encoding: kr, ...Yr } = Qt, Ms = normalizeEncoding(kr, Sn), Ds = isMarkDef(er) ? er : { type: er }, Ls = getPointOverlay(Ds, Sn[Ds.type], Ms), js = Ds.type === "area" && getLineOverlay(Ds, Sn[Ds.type]), zs = [
      {
        name: Cr,
        ...kn ? { params: kn } : {},
        mark: dropLineAndPoint({
          // TODO: extract this 0.7 to be shared with default opacity for point/tick/...
          ...Ds.type === "area" && Ds.opacity === void 0 && Ds.fillOpacity === void 0 ? { opacity: 0.7 } : {},
          ...Ds
        }),
        // drop shape from encoding as this might be used to trigger point overlay
        encoding: omit(Ms, ["shape"])
      }
    ], Fs = stack(initMarkdef(Ds, Ms, Sn), Ms);
    let Bs = Ms;
    if (Fs) {
      const { fieldChannel: Hs, offset: Ws } = Fs;
      Bs = {
        ...Ms,
        [Hs]: {
          ...Ms[Hs],
          ...Ws ? { stack: Ws } : {}
        }
      };
    }
    return Bs = omit(Bs, ["y2", "x2"]), js && zs.push({
      ...Kn ? { projection: Kn } : {},
      mark: {
        type: "line",
        ...pick$2(Ds, ["clip", "interpolate", "tension", "tooltip"]),
        ...js
      },
      encoding: Bs
    }), Ls && zs.push({
      ...Kn ? { projection: Kn } : {},
      mark: {
        type: "point",
        opacity: 1,
        filled: !0,
        ...pick$2(Ds, ["clip", "tooltip"]),
        ...Ls
      },
      encoding: Bs
    }), $n({
      ...Yr,
      layer: zs
    }, {
      ...Zt,
      config: dropLineAndPointFromConfig(Sn)
    });
  }
}
function replaceRepeaterInFacet(_e, Qt) {
  return Qt ? isFacetMapping(_e) ? replaceRepeaterInMapping(_e, Qt) : replaceRepeaterInFieldDef(_e, Qt) : _e;
}
function replaceRepeaterInEncoding(_e, Qt) {
  return Qt ? replaceRepeaterInMapping(_e, Qt) : _e;
}
function replaceRepeatInProp(_e, Qt, Zt) {
  const $n = Qt[_e];
  if (isRepeatRef($n)) {
    if ($n.repeat in Zt)
      return { ...Qt, [_e]: Zt[$n.repeat] };
    warn$1(noSuchRepeatedValue($n.repeat));
    return;
  }
  return Qt;
}
function replaceRepeaterInFieldDef(_e, Qt) {
  if (_e = replaceRepeatInProp("field", _e, Qt), _e !== void 0) {
    if (_e === null)
      return null;
    if (isSortableFieldDef(_e) && isSortField(_e.sort)) {
      const Zt = replaceRepeatInProp("field", _e.sort, Qt);
      _e = {
        ..._e,
        ...Zt ? { sort: Zt } : {}
      };
    }
    return _e;
  }
}
function replaceRepeaterInFieldOrDatumDef(_e, Qt) {
  if (isFieldDef(_e))
    return replaceRepeaterInFieldDef(_e, Qt);
  {
    const Zt = replaceRepeatInProp("datum", _e, Qt);
    return Zt !== _e && !Zt.type && (Zt.type = "nominal"), Zt;
  }
}
function replaceRepeaterInChannelDef(_e, Qt) {
  if (isFieldOrDatumDef(_e)) {
    const Zt = replaceRepeaterInFieldOrDatumDef(_e, Qt);
    if (Zt)
      return Zt;
    if (isConditionalDef(_e))
      return { condition: _e.condition };
  } else {
    if (hasConditionalFieldOrDatumDef(_e)) {
      const Zt = replaceRepeaterInFieldOrDatumDef(_e.condition, Qt);
      if (Zt)
        return {
          ..._e,
          condition: Zt
        };
      {
        const { condition: $n, ...Sn } = _e;
        return Sn;
      }
    }
    return _e;
  }
}
function replaceRepeaterInMapping(_e, Qt) {
  const Zt = {};
  for (const $n in _e)
    if (has$1(_e, $n)) {
      const Sn = _e[$n];
      if (isArray(Sn))
        Zt[$n] = Sn.map((kn) => replaceRepeaterInChannelDef(kn, Qt)).filter((kn) => kn);
      else {
        const kn = replaceRepeaterInChannelDef(Sn, Qt);
        kn !== void 0 && (Zt[$n] = kn);
      }
    }
  return Zt;
}
class RuleForRangedLineNormalizer {
  constructor() {
    this.name = "RuleForRangedLine";
  }
  hasMatchingType(Qt) {
    if (isUnitSpec(Qt)) {
      const { encoding: Zt, mark: $n } = Qt;
      if ($n === "line" || isMarkDef($n) && $n.type === "line")
        for (const Sn of SECONDARY_RANGE_CHANNEL) {
          const kn = getMainRangeChannel(Sn), Kn = Zt[kn];
          if (Zt[Sn] && (isFieldDef(Kn) && !isBinned(Kn.bin) || isDatumDef(Kn)))
            return !0;
        }
    }
    return !1;
  }
  run(Qt, Zt, $n) {
    const { encoding: Sn, mark: kn } = Qt;
    return warn$1(lineWithRange(!!Sn.x2, !!Sn.y2)), $n({
      ...Qt,
      mark: isObject(kn) ? { ...kn, type: "rule" } : "rule"
    }, Zt);
  }
}
class CoreNormalizer extends SpecMapper {
  constructor() {
    super(...arguments), this.nonFacetUnitNormalizers = [
      boxPlotNormalizer,
      errorBarNormalizer,
      errorBandNormalizer,
      new PathOverlayNormalizer(),
      new RuleForRangedLineNormalizer()
    ];
  }
  map(Qt, Zt) {
    if (isUnitSpec(Qt)) {
      const $n = channelHasField(Qt.encoding, ROW), Sn = channelHasField(Qt.encoding, COLUMN), kn = channelHasField(Qt.encoding, FACET);
      if ($n || Sn || kn)
        return this.mapFacetedUnit(Qt, Zt);
    }
    return super.map(Qt, Zt);
  }
  // This is for normalizing non-facet unit
  mapUnit(Qt, Zt) {
    const { parentEncoding: $n, parentProjection: Sn } = Zt, kn = replaceRepeaterInEncoding(Qt.encoding, Zt.repeater), Kn = {
      ...Qt,
      ...Qt.name ? { name: [Zt.repeaterPrefix, Qt.name].filter((Cr) => Cr).join("_") } : {},
      ...kn ? { encoding: kn } : {}
    };
    if ($n || Sn)
      return this.mapUnitWithParentEncodingOrProjection(Kn, Zt);
    const er = this.mapLayerOrUnit.bind(this);
    for (const Cr of this.nonFacetUnitNormalizers)
      if (Cr.hasMatchingType(Kn, Zt.config))
        return Cr.run(Kn, Zt, er);
    return Kn;
  }
  mapRepeat(Qt, Zt) {
    return isLayerRepeatSpec(Qt) ? this.mapLayerRepeat(Qt, Zt) : this.mapNonLayerRepeat(Qt, Zt);
  }
  mapLayerRepeat(Qt, Zt) {
    const { repeat: $n, spec: Sn, ...kn } = Qt, { row: Kn, column: er, layer: Cr } = $n, { repeater: kr = {}, repeaterPrefix: Yr = "" } = Zt;
    return Kn || er ? this.mapRepeat({
      ...Qt,
      repeat: {
        ...Kn ? { row: Kn } : {},
        ...er ? { column: er } : {}
      },
      spec: {
        repeat: { layer: Cr },
        spec: Sn
      }
    }, Zt) : {
      ...kn,
      layer: Cr.map((Ms) => {
        const Ds = {
          ...kr,
          layer: Ms
        }, Ls = `${(Sn.name ? `${Sn.name}_` : "") + Yr}child__layer_${varName(Ms)}`, js = this.mapLayerOrUnit(Sn, { ...Zt, repeater: Ds, repeaterPrefix: Ls });
        return js.name = Ls, js;
      })
    };
  }
  mapNonLayerRepeat(Qt, Zt) {
    const { repeat: $n, spec: Sn, data: kn, ...Kn } = Qt;
    !isArray($n) && Qt.columns && (Qt = omit(Qt, ["columns"]), warn$1(columnsNotSupportByRowCol("repeat")));
    const er = [], { repeater: Cr = {}, repeaterPrefix: kr = "" } = Zt, Yr = !isArray($n) && $n.row || [Cr ? Cr.row : null], Ms = !isArray($n) && $n.column || [Cr ? Cr.column : null], Ds = isArray($n) && $n || [Cr ? Cr.repeat : null];
    for (const js of Ds)
      for (const zs of Yr)
        for (const Fs of Ms) {
          const Bs = {
            repeat: js,
            row: zs,
            column: Fs,
            layer: Cr.layer
          }, Hs = (Sn.name ? `${Sn.name}_` : "") + kr + "child__" + (isArray($n) ? `${varName(js)}` : ($n.row ? `row_${varName(zs)}` : "") + ($n.column ? `column_${varName(Fs)}` : "")), Ws = this.map(Sn, { ...Zt, repeater: Bs, repeaterPrefix: Hs });
          Ws.name = Hs, er.push(omit(Ws, ["data"]));
        }
    const Ls = isArray($n) ? Qt.columns : $n.column ? $n.column.length : 1;
    return {
      data: Sn.data ?? kn,
      align: "all",
      ...Kn,
      columns: Ls,
      concat: er
    };
  }
  mapFacet(Qt, Zt) {
    const { facet: $n } = Qt;
    return isFacetMapping($n) && Qt.columns && (Qt = omit(Qt, ["columns"]), warn$1(columnsNotSupportByRowCol("facet"))), super.mapFacet(Qt, Zt);
  }
  mapUnitWithParentEncodingOrProjection(Qt, Zt) {
    const { encoding: $n, projection: Sn } = Qt, { parentEncoding: kn, parentProjection: Kn, config: er } = Zt, Cr = mergeProjection({ parentProjection: Kn, projection: Sn }), kr = mergeEncoding({
      parentEncoding: kn,
      encoding: replaceRepeaterInEncoding($n, Zt.repeater)
    });
    return this.mapUnit({
      ...Qt,
      ...Cr ? { projection: Cr } : {},
      ...kr ? { encoding: kr } : {}
    }, { config: er });
  }
  mapFacetedUnit(Qt, Zt) {
    const { row: $n, column: Sn, facet: kn, ...Kn } = Qt.encoding, { mark: er, width: Cr, projection: kr, height: Yr, view: Ms, params: Ds, encoding: Ls, ...js } = Qt, { facetMapping: zs, layout: Fs } = this.getFacetMappingAndLayout({ row: $n, column: Sn, facet: kn }, Zt), Bs = replaceRepeaterInEncoding(Kn, Zt.repeater);
    return this.mapFacet({
      ...js,
      ...Fs,
      // row / column has higher precedence than facet
      facet: zs,
      spec: {
        ...Cr ? { width: Cr } : {},
        ...Yr ? { height: Yr } : {},
        ...Ms ? { view: Ms } : {},
        ...kr ? { projection: kr } : {},
        mark: er,
        encoding: Bs,
        ...Ds ? { params: Ds } : {}
      }
    }, Zt);
  }
  getFacetMappingAndLayout(Qt, Zt) {
    const { row: $n, column: Sn, facet: kn } = Qt;
    if ($n || Sn) {
      kn && warn$1(facetChannelDropped([...$n ? [ROW] : [], ...Sn ? [COLUMN] : []]));
      const Kn = {}, er = {};
      for (const Cr of [ROW, COLUMN]) {
        const kr = Qt[Cr];
        if (kr) {
          const { align: Yr, center: Ms, spacing: Ds, columns: Ls, ...js } = kr;
          Kn[Cr] = js;
          for (const zs of ["align", "center", "spacing"])
            kr[zs] !== void 0 && (er[zs] ?? (er[zs] = {}), er[zs][Cr] = kr[zs]);
        }
      }
      return { facetMapping: Kn, layout: er };
    } else {
      const { align: Kn, center: er, spacing: Cr, columns: kr, ...Yr } = kn;
      return {
        facetMapping: replaceRepeaterInFacet(Yr, Zt.repeater),
        layout: {
          ...Kn ? { align: Kn } : {},
          ...er ? { center: er } : {},
          ...Cr ? { spacing: Cr } : {},
          ...kr ? { columns: kr } : {}
        }
      };
    }
  }
  mapLayer(Qt, { parentEncoding: Zt, parentProjection: $n, ...Sn }) {
    const { encoding: kn, projection: Kn, ...er } = Qt, Cr = {
      ...Sn,
      parentEncoding: mergeEncoding({ parentEncoding: Zt, encoding: kn, layer: !0 }),
      parentProjection: mergeProjection({ parentProjection: $n, projection: Kn })
    };
    return super.mapLayer({
      ...er,
      ...Qt.name ? { name: [Cr.repeaterPrefix, Qt.name].filter((kr) => kr).join("_") } : {}
    }, Cr);
  }
}
function mergeEncoding({ parentEncoding: _e, encoding: Qt = {}, layer: Zt }) {
  let $n = {};
  if (_e) {
    const Sn = /* @__PURE__ */ new Set([...keys$2(_e), ...keys$2(Qt)]);
    for (const kn of Sn) {
      const Kn = Qt[kn], er = _e[kn];
      if (isFieldOrDatumDef(Kn)) {
        const Cr = {
          ...er,
          ...Kn
        };
        $n[kn] = Cr;
      } else
        hasConditionalFieldOrDatumDef(Kn) ? $n[kn] = {
          ...Kn,
          condition: {
            ...er,
            ...Kn.condition
          }
        } : Kn || Kn === null ? $n[kn] = Kn : (Zt || isValueDef(er) || isSignalRef(er) || isFieldOrDatumDef(er) || isArray(er)) && ($n[kn] = er);
    }
  } else
    $n = Qt;
  return !$n || isEmpty($n) ? void 0 : $n;
}
function mergeProjection(_e) {
  const { parentProjection: Qt, projection: Zt } = _e;
  return Qt && Zt && warn$1(projectionOverridden({ parentProjection: Qt, projection: Zt })), Zt ?? Qt;
}
function isFilter(_e) {
  return "filter" in _e;
}
function isImputeSequence(_e) {
  return (_e == null ? void 0 : _e.stop) !== void 0;
}
function isLookup(_e) {
  return "lookup" in _e;
}
function isLookupData(_e) {
  return "data" in _e;
}
function isLookupSelection(_e) {
  return "param" in _e;
}
function isPivot(_e) {
  return "pivot" in _e;
}
function isDensity(_e) {
  return "density" in _e;
}
function isQuantile(_e) {
  return "quantile" in _e;
}
function isRegression(_e) {
  return "regression" in _e;
}
function isLoess(_e) {
  return "loess" in _e;
}
function isSample(_e) {
  return "sample" in _e;
}
function isWindow(_e) {
  return "window" in _e;
}
function isJoinAggregate(_e) {
  return "joinaggregate" in _e;
}
function isFlatten(_e) {
  return "flatten" in _e;
}
function isCalculate(_e) {
  return "calculate" in _e;
}
function isBin(_e) {
  return "bin" in _e;
}
function isImpute(_e) {
  return "impute" in _e;
}
function isTimeUnit(_e) {
  return "timeUnit" in _e;
}
function isAggregate(_e) {
  return "aggregate" in _e;
}
function isStack(_e) {
  return "stack" in _e;
}
function isFold(_e) {
  return "fold" in _e;
}
function isExtent(_e) {
  return "extent" in _e && !("density" in _e);
}
function normalizeTransform(_e) {
  return _e.map((Qt) => isFilter(Qt) ? {
    filter: normalizeLogicalComposition(Qt.filter, normalizePredicate$1)
  } : Qt);
}
class SelectionCompatibilityNormalizer extends SpecMapper {
  map(Qt, Zt) {
    return Zt.emptySelections ?? (Zt.emptySelections = {}), Zt.selectionPredicates ?? (Zt.selectionPredicates = {}), Qt = normalizeTransforms(Qt, Zt), super.map(Qt, Zt);
  }
  mapLayerOrUnit(Qt, Zt) {
    if (Qt = normalizeTransforms(Qt, Zt), Qt.encoding) {
      const $n = {};
      for (const [Sn, kn] of entries$1(Qt.encoding))
        $n[Sn] = normalizeChannelDef(kn, Zt);
      Qt = { ...Qt, encoding: $n };
    }
    return super.mapLayerOrUnit(Qt, Zt);
  }
  mapUnit(Qt, Zt) {
    const { selection: $n, ...Sn } = Qt;
    return $n ? {
      ...Sn,
      params: entries$1($n).map(([kn, Kn]) => {
        const { init: er, bind: Cr, empty: kr, ...Yr } = Kn;
        Yr.type === "single" ? (Yr.type = "point", Yr.toggle = !1) : Yr.type === "multi" && (Yr.type = "point"), Zt.emptySelections[kn] = kr !== "none";
        for (const Ms of vals(Zt.selectionPredicates[kn] ?? {}))
          Ms.empty = kr !== "none";
        return { name: kn, value: er, select: Yr, bind: Cr };
      })
    } : Qt;
  }
}
function normalizeTransforms(_e, Qt) {
  const { transform: Zt, ...$n } = _e;
  if (Zt) {
    const Sn = Zt.map((kn) => {
      if (isFilter(kn))
        return { filter: normalizePredicate(kn, Qt) };
      if (isBin(kn) && isBinParams(kn.bin))
        return {
          ...kn,
          bin: normalizeBinExtent(kn.bin)
        };
      if (isLookup(kn)) {
        const { selection: Kn, ...er } = kn.from;
        return Kn ? {
          ...kn,
          from: { param: Kn, ...er }
        } : kn;
      }
      return kn;
    });
    return { ...$n, transform: Sn };
  }
  return _e;
}
function normalizeChannelDef(_e, Qt) {
  var $n, Sn;
  const Zt = duplicate(_e);
  if (isFieldDef(Zt) && isBinParams(Zt.bin) && (Zt.bin = normalizeBinExtent(Zt.bin)), isScaleFieldDef(Zt) && ((Sn = ($n = Zt.scale) == null ? void 0 : $n.domain) != null && Sn.selection)) {
    const { selection: kn, ...Kn } = Zt.scale.domain;
    Zt.scale.domain = { ...Kn, ...kn ? { param: kn } : {} };
  }
  if (isConditionalDef(Zt))
    if (isArray(Zt.condition))
      Zt.condition = Zt.condition.map((kn) => {
        const { selection: Kn, param: er, test: Cr, ...kr } = kn;
        return er ? kn : { ...kr, test: normalizePredicate(kn, Qt) };
      });
    else {
      const { selection: kn, param: Kn, test: er, ...Cr } = normalizeChannelDef(Zt.condition, Qt);
      Zt.condition = Kn ? Zt.condition : {
        ...Cr,
        test: normalizePredicate(Zt.condition, Qt)
      };
    }
  return Zt;
}
function normalizeBinExtent(_e) {
  const Qt = _e.extent;
  if (Qt != null && Qt.selection) {
    const { selection: Zt, ...$n } = Qt;
    return { ..._e, extent: { ...$n, param: Zt } };
  }
  return _e;
}
function normalizePredicate(_e, Qt) {
  const Zt = ($n) => normalizeLogicalComposition($n, (Sn) => {
    var kn;
    const Kn = Qt.emptySelections[Sn] ?? !0, er = { param: Sn, empty: Kn };
    return (kn = Qt.selectionPredicates)[Sn] ?? (kn[Sn] = []), Qt.selectionPredicates[Sn].push(er), er;
  });
  return _e.selection ? Zt(_e.selection) : normalizeLogicalComposition(_e.test || _e.filter, ($n) => $n.selection ? Zt($n.selection) : $n);
}
class TopLevelSelectionsNormalizer extends SpecMapper {
  map(Qt, Zt) {
    const $n = Zt.selections ?? [];
    if (Qt.params && !isUnitSpec(Qt)) {
      const Sn = [];
      for (const kn of Qt.params)
        isSelectionParameter(kn) ? $n.push(kn) : Sn.push(kn);
      Qt.params = Sn;
    }
    return Zt.selections = $n, super.map(Qt, Zt);
  }
  mapUnit(Qt, Zt) {
    const $n = Zt.selections;
    if (!$n || !$n.length)
      return Qt;
    const Sn = (Zt.path ?? []).concat(Qt.name), kn = [];
    for (const Kn of $n)
      if (!Kn.views || !Kn.views.length)
        kn.push(Kn);
      else
        for (const er of Kn.views)
          (isString(er) && (er === Qt.name || Sn.includes(er)) || isArray(er) && // logic for backwards compatibility with view paths before we had unique names
          // @ts-ignore
          er.map((Cr) => Sn.indexOf(Cr)).every((Cr, kr, Yr) => Cr !== -1 && (kr === 0 || Cr > Yr[kr - 1]))) && kn.push(Kn);
    return kn.length && (Qt.params = kn), Qt;
  }
}
for (const _e of ["mapFacet", "mapRepeat", "mapHConcat", "mapVConcat", "mapLayer"]) {
  const Qt = TopLevelSelectionsNormalizer.prototype[_e];
  TopLevelSelectionsNormalizer.prototype[_e] = function(Zt, $n) {
    return Qt.call(this, Zt, addSpecNameToParams(Zt, $n));
  };
}
function addSpecNameToParams(_e, Qt) {
  return _e.name ? {
    ...Qt,
    path: (Qt.path ?? []).concat(_e.name)
  } : Qt;
}
function normalize(_e, Qt) {
  Qt === void 0 && (Qt = initConfig(_e.config));
  const Zt = normalizeGenericSpec(_e, Qt), { width: $n, height: Sn } = _e, kn = normalizeAutoSize(Zt, { width: $n, height: Sn, autosize: _e.autosize }, Qt);
  return {
    ...Zt,
    ...kn ? { autosize: kn } : {}
  };
}
const coreNormalizer = new CoreNormalizer(), selectionCompatNormalizer = new SelectionCompatibilityNormalizer(), topLevelSelectionNormalizer = new TopLevelSelectionsNormalizer();
function normalizeGenericSpec(_e, Qt = {}) {
  const Zt = { config: Qt };
  return topLevelSelectionNormalizer.map(coreNormalizer.map(selectionCompatNormalizer.map(_e, Zt), Zt), Zt);
}
function _normalizeAutoSize(_e) {
  return isString(_e) ? { type: _e } : _e ?? {};
}
function normalizeAutoSize(_e, Qt, Zt) {
  let { width: $n, height: Sn } = Qt;
  const kn = isUnitSpec(_e) || isLayerSpec(_e), Kn = {};
  kn ? $n == "container" && Sn == "container" ? (Kn.type = "fit", Kn.contains = "padding") : $n == "container" ? (Kn.type = "fit-x", Kn.contains = "padding") : Sn == "container" && (Kn.type = "fit-y", Kn.contains = "padding") : ($n == "container" && (warn$1(containerSizeNonSingle("width")), $n = void 0), Sn == "container" && (warn$1(containerSizeNonSingle("height")), Sn = void 0));
  const er = {
    type: "pad",
    ...Kn,
    ...Zt ? _normalizeAutoSize(Zt.autosize) : {},
    ..._normalizeAutoSize(_e.autosize)
  };
  if (er.type === "fit" && !kn && (warn$1(FIT_NON_SINGLE), er.type = "pad"), $n == "container" && !(er.type == "fit" || er.type == "fit-x") && warn$1(containerSizeNotCompatibleWithAutosize("width")), Sn == "container" && !(er.type == "fit" || er.type == "fit-y") && warn$1(containerSizeNotCompatibleWithAutosize("height")), !deepEqual(er, { type: "pad" }))
    return er;
}
function isFitType(_e) {
  return _e === "fit" || _e === "fit-x" || _e === "fit-y";
}
function getFitType(_e) {
  return _e ? `fit-${getPositionScaleChannel(_e)}` : "fit";
}
const TOP_LEVEL_PROPERTIES = [
  "background",
  "padding"
  // We do not include "autosize" here as it is supported by only unit and layer specs and thus need to be normalized
];
function extractTopLevelProperties(_e, Qt) {
  const Zt = {};
  for (const $n of TOP_LEVEL_PROPERTIES)
    _e && _e[$n] !== void 0 && (Zt[$n] = signalRefOrValue(_e[$n]));
  return Qt && (Zt.params = _e.params), Zt;
}
class Split {
  constructor(Qt = {}, Zt = {}) {
    this.explicit = Qt, this.implicit = Zt;
  }
  clone() {
    return new Split(duplicate(this.explicit), duplicate(this.implicit));
  }
  combine() {
    return {
      ...this.explicit,
      ...this.implicit
    };
  }
  get(Qt) {
    return getFirstDefined(this.explicit[Qt], this.implicit[Qt]);
  }
  getWithExplicit(Qt) {
    return this.explicit[Qt] !== void 0 ? { explicit: !0, value: this.explicit[Qt] } : this.implicit[Qt] !== void 0 ? { explicit: !1, value: this.implicit[Qt] } : { explicit: !1, value: void 0 };
  }
  setWithExplicit(Qt, { value: Zt, explicit: $n }) {
    Zt !== void 0 && this.set(Qt, Zt, $n);
  }
  set(Qt, Zt, $n) {
    return delete this[$n ? "implicit" : "explicit"][Qt], this[$n ? "explicit" : "implicit"][Qt] = Zt, this;
  }
  copyKeyFromSplit(Qt, { explicit: Zt, implicit: $n }) {
    Zt[Qt] !== void 0 ? this.set(Qt, Zt[Qt], !0) : $n[Qt] !== void 0 && this.set(Qt, $n[Qt], !1);
  }
  copyKeyFromObject(Qt, Zt) {
    Zt[Qt] !== void 0 && this.set(Qt, Zt[Qt], !0);
  }
  /**
   * Merge split object into this split object. Properties from the other split
   * overwrite properties from this split.
   */
  copyAll(Qt) {
    for (const Zt of keys$2(Qt.combine())) {
      const $n = Qt.getWithExplicit(Zt);
      this.setWithExplicit(Zt, $n);
    }
  }
}
function makeExplicit(_e) {
  return {
    explicit: !0,
    value: _e
  };
}
function makeImplicit(_e) {
  return {
    explicit: !1,
    value: _e
  };
}
function tieBreakByComparing(_e) {
  return (Qt, Zt, $n, Sn) => {
    const kn = _e(Qt.value, Zt.value);
    return kn > 0 ? Qt : kn < 0 ? Zt : defaultTieBreaker(Qt, Zt, $n, Sn);
  };
}
function defaultTieBreaker(_e, Qt, Zt, $n) {
  return _e.explicit && Qt.explicit && warn$1(mergeConflictingProperty(Zt, $n, _e.value, Qt.value)), _e;
}
function mergeValuesWithExplicit(_e, Qt, Zt, $n, Sn = defaultTieBreaker) {
  return _e === void 0 || _e.value === void 0 ? Qt : _e.explicit && !Qt.explicit ? _e : Qt.explicit && !_e.explicit ? Qt : deepEqual(_e.value, Qt.value) ? _e : Sn(_e, Qt, Zt, $n);
}
class AncestorParse extends Split {
  constructor(Qt = {}, Zt = {}, $n = !1) {
    super(Qt, Zt), this.explicit = Qt, this.implicit = Zt, this.parseNothing = $n;
  }
  clone() {
    const Qt = super.clone();
    return Qt.parseNothing = this.parseNothing, Qt;
  }
}
function isUrlData(_e) {
  return "url" in _e;
}
function isInlineData(_e) {
  return "values" in _e;
}
function isNamedData(_e) {
  return "name" in _e && !isUrlData(_e) && !isInlineData(_e) && !isGenerator(_e);
}
function isGenerator(_e) {
  return _e && (isSequenceGenerator(_e) || isSphereGenerator(_e) || isGraticuleGenerator(_e));
}
function isSequenceGenerator(_e) {
  return "sequence" in _e;
}
function isSphereGenerator(_e) {
  return "sphere" in _e;
}
function isGraticuleGenerator(_e) {
  return "graticule" in _e;
}
var DataSourceType;
(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";
})(DataSourceType || (DataSourceType = {}));
function assembleProjection(_e) {
  const { signals: Qt, hasLegend: Zt, index: $n, ...Sn } = _e;
  return Sn.field = replacePathInField(Sn.field), Sn;
}
function assembleInit(_e, Qt = !0, Zt = identity$7) {
  if (isArray(_e)) {
    const $n = _e.map((Sn) => assembleInit(Sn, Qt, Zt));
    return Qt ? `[${$n.join(", ")}]` : $n;
  } else if (isDateTime(_e))
    return Zt(Qt ? dateTimeToExpr(_e) : dateTimeToTimestamp(_e));
  return Qt ? Zt(stringify$2(_e)) : _e;
}
function assembleUnitSelectionSignals(_e, Qt) {
  for (const Zt of vals(_e.component.selection ?? {})) {
    const $n = Zt.name;
    let Sn = `${$n}${TUPLE}, ${Zt.resolve === "global" ? "true" : `{unit: ${unitName(_e)}}`}`;
    for (const kn of selectionCompilers)
      kn.defined(Zt) && (kn.signals && (Qt = kn.signals(_e, Zt, Qt)), kn.modifyExpr && (Sn = kn.modifyExpr(_e, Zt, Sn)));
    Qt.push({
      name: $n + MODIFY,
      on: [
        {
          events: { signal: Zt.name + TUPLE },
          update: `modify(${$(Zt.name + STORE)}, ${Sn})`
        }
      ]
    });
  }
  return cleanupEmptyOnArray(Qt);
}
function assembleFacetSignals(_e, Qt) {
  if (_e.component.selection && keys$2(_e.component.selection).length) {
    const Zt = $(_e.getName("cell"));
    Qt.unshift({
      name: "facet",
      value: {},
      on: [
        {
          events: eventSelector("mousemove", "scope"),
          update: `isTuple(facet) ? facet : group(${Zt}).datum`
        }
      ]
    });
  }
  return cleanupEmptyOnArray(Qt);
}
function assembleTopLevelSignals(_e, Qt) {
  let Zt = !1;
  for (const $n of vals(_e.component.selection ?? {})) {
    const Sn = $n.name, kn = $(Sn + STORE);
    if (Qt.filter((er) => er.name === Sn).length === 0) {
      const er = $n.resolve === "global" ? "union" : $n.resolve, Cr = $n.type === "point" ? ", true, true)" : ")";
      Qt.push({
        name: $n.name,
        update: `${VL_SELECTION_RESOLVE}(${kn}, ${$(er)}${Cr}`
      });
    }
    Zt = !0;
    for (const er of selectionCompilers)
      er.defined($n) && er.topLevelSignals && (Qt = er.topLevelSignals(_e, $n, Qt));
  }
  return Zt && Qt.filter((Sn) => Sn.name === "unit").length === 0 && Qt.unshift({
    name: "unit",
    value: {},
    on: [{ events: "mousemove", update: "isTuple(group()) ? group() : unit" }]
  }), cleanupEmptyOnArray(Qt);
}
function assembleUnitSelectionData(_e, Qt) {
  const Zt = [...Qt], $n = unitName(_e, { escape: !1 });
  for (const Sn of vals(_e.component.selection ?? {})) {
    const kn = { name: Sn.name + STORE };
    if (Sn.project.hasSelectionId && (kn.transform = [{ type: "collect", sort: { field: SELECTION_ID } }]), Sn.init) {
      const er = Sn.project.items.map(assembleProjection);
      kn.values = Sn.project.hasSelectionId ? Sn.init.map((Cr) => ({ unit: $n, [SELECTION_ID]: assembleInit(Cr, !1)[0] })) : Sn.init.map((Cr) => ({ unit: $n, fields: er, values: assembleInit(Cr, !1) }));
    }
    Zt.filter((er) => er.name === Sn.name + STORE).length || Zt.push(kn);
  }
  return Zt;
}
function assembleUnitSelectionMarks(_e, Qt) {
  for (const Zt of vals(_e.component.selection ?? {}))
    for (const $n of selectionCompilers)
      $n.defined(Zt) && $n.marks && (Qt = $n.marks(_e, Zt, Qt));
  return Qt;
}
function assembleLayerSelectionMarks(_e, Qt) {
  for (const Zt of _e.children)
    isUnitModel(Zt) && (Qt = assembleUnitSelectionMarks(Zt, Qt));
  return Qt;
}
function assembleSelectionScaleDomain(_e, Qt, Zt, $n) {
  const Sn = parseSelectionExtent(_e, Qt.param, Qt);
  return {
    signal: hasContinuousDomain(Zt.get("type")) && isArray($n) && $n[0] > $n[1] ? `isValid(${Sn}) && reverse(${Sn})` : Sn
  };
}
function cleanupEmptyOnArray(_e) {
  return _e.map((Qt) => (Qt.on && !Qt.on.length && delete Qt.on, Qt));
}
class DataFlowNode {
  constructor(Qt, Zt) {
    this.debugName = Zt, this._children = [], this._parent = null, Qt && (this.parent = Qt);
  }
  /**
   * Clone this node with a deep copy but don't clone links to children or parents.
   */
  clone() {
    throw new Error("Cannot clone node");
  }
  get parent() {
    return this._parent;
  }
  /**
   * Set the parent of the node and also add this node to the parent's children.
   */
  set parent(Qt) {
    this._parent = Qt, Qt && Qt.addChild(this);
  }
  get children() {
    return this._children;
  }
  numChildren() {
    return this._children.length;
  }
  addChild(Qt, Zt) {
    if (this._children.includes(Qt)) {
      warn$1(ADD_SAME_CHILD_TWICE);
      return;
    }
    Zt !== void 0 ? this._children.splice(Zt, 0, Qt) : this._children.push(Qt);
  }
  removeChild(Qt) {
    const Zt = this._children.indexOf(Qt);
    return this._children.splice(Zt, 1), Zt;
  }
  /**
   * Remove node from the dataflow.
   */
  remove() {
    let Qt = this._parent.removeChild(this);
    for (const Zt of this._children)
      Zt._parent = this._parent, this._parent.addChild(Zt, Qt++);
  }
  /**
   * Insert another node as a parent of this node.
   */
  insertAsParentOf(Qt) {
    const Zt = Qt.parent;
    Zt.removeChild(this), this.parent = Zt, Qt.parent = this;
  }
  swapWithParent() {
    const Qt = this._parent, Zt = Qt.parent;
    for (const Sn of this._children)
      Sn.parent = Qt;
    this._children = [], Qt.removeChild(this);
    const $n = Qt.parent.removeChild(Qt);
    this._parent = Zt, Zt.addChild(this, $n), Qt.parent = this;
  }
}
class OutputNode extends DataFlowNode {
  clone() {
    const Qt = new this.constructor();
    return Qt.debugName = `clone_${this.debugName}`, Qt._source = this._source, Qt._name = `clone_${this._name}`, Qt.type = this.type, Qt.refCounts = this.refCounts, Qt.refCounts[Qt._name] = 0, Qt;
  }
  /**
   * @param source The name of the source. Will change in assemble.
   * @param type The type of the output node.
   * @param refCounts A global ref counter map.
   */
  constructor(Qt, Zt, $n, Sn) {
    super(Qt, Zt), this.type = $n, this.refCounts = Sn, this._source = this._name = Zt, this.refCounts && !(this._name in this.refCounts) && (this.refCounts[this._name] = 0);
  }
  dependentFields() {
    return /* @__PURE__ */ new Set();
  }
  producedFields() {
    return /* @__PURE__ */ new Set();
  }
  hash() {
    return this._hash === void 0 && (this._hash = `Output ${uniqueId()}`), this._hash;
  }
  /**
   * Request the datasource name and increase the ref counter.
   *
   * During the parsing phase, this will return the simple name such as 'main' or 'raw'.
   * It is crucial to request the name from an output node to mark it as a required node.
   * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase.
   *
   * In the assemble phase, this will return the correct name.
   */
  getSource() {
    return this.refCounts[this._name]++, this._source;
  }
  isRequired() {
    return !!this.refCounts[this._name];
  }
  setSource(Qt) {
    this._source = Qt;
  }
}
function isTimeUnitTransformComponent(_e) {
  return _e.as !== void 0;
}
function offsetAs(_e) {
  return `${_e}_end`;
}
class TimeUnitNode extends DataFlowNode {
  clone() {
    return new TimeUnitNode(null, duplicate(this.formula));
  }
  constructor(Qt, Zt) {
    super(Qt), this.formula = Zt;
  }
  static makeFromEncoding(Qt, Zt) {
    const $n = Zt.reduceFieldDef((Sn, kn) => {
      const { field: Kn, timeUnit: er } = kn;
      if (er) {
        let Cr;
        if (isBinnedTimeUnit(er)) {
          if (isUnitModel(Zt)) {
            const { mark: kr } = Zt;
            (isRectBasedMark(kr) || kn.bandPosition) && (Cr = {
              timeUnit: normalizeTimeUnit(er),
              field: Kn
            });
          }
        } else
          Cr = {
            as: vgField(kn, { forAs: !0 }),
            field: Kn,
            timeUnit: er
          };
        Cr && (Sn[hash(Cr)] = Cr);
      }
      return Sn;
    }, {});
    return isEmpty($n) ? null : new TimeUnitNode(Qt, $n);
  }
  static makeFromTransform(Qt, Zt) {
    const { timeUnit: $n, ...Sn } = { ...Zt }, kn = normalizeTimeUnit($n), Kn = {
      ...Sn,
      timeUnit: kn
    };
    return new TimeUnitNode(Qt, {
      [hash(Kn)]: Kn
    });
  }
  /**
   * Merge together TimeUnitNodes assigning the children of `other` to `this`
   * and removing `other`.
   */
  merge(Qt) {
    this.formula = { ...this.formula };
    for (const Zt in Qt.formula)
      this.formula[Zt] || (this.formula[Zt] = Qt.formula[Zt]);
    for (const Zt of Qt.children)
      Qt.removeChild(Zt), Zt.parent = this;
    Qt.remove();
  }
  /**
   * Remove time units coming from the other node.
   */
  removeFormulas(Qt) {
    const Zt = {};
    for (const [$n, Sn] of entries$1(this.formula)) {
      const kn = isTimeUnitTransformComponent(Sn) ? Sn.as : `${Sn.field}_end`;
      Qt.has(kn) || (Zt[$n] = Sn);
    }
    this.formula = Zt;
  }
  producedFields() {
    return new Set(vals(this.formula).map((Qt) => isTimeUnitTransformComponent(Qt) ? Qt.as : offsetAs(Qt.field)));
  }
  dependentFields() {
    return new Set(vals(this.formula).map((Qt) => Qt.field));
  }
  hash() {
    return `TimeUnit ${hash(this.formula)}`;
  }
  assemble() {
    const Qt = [];
    for (const Zt of vals(this.formula))
      if (isTimeUnitTransformComponent(Zt)) {
        const { field: $n, as: Sn, timeUnit: kn } = Zt, { unit: Kn, utc: er, ...Cr } = normalizeTimeUnit(kn);
        Qt.push({
          field: replacePathInField($n),
          type: "timeunit",
          ...Kn ? { units: getTimeUnitParts(Kn) } : {},
          ...er ? { timezone: "utc" } : {},
          ...Cr,
          as: [Sn, `${Sn}_end`]
        });
      } else if (Zt) {
        const { field: $n, timeUnit: Sn } = Zt, kn = getSmallestTimeUnitPart(Sn == null ? void 0 : Sn.unit), { part: Kn, step: er } = getDateTimePartAndStep(kn, Sn.step);
        Qt.push({
          type: "formula",
          expr: `timeOffset('${Kn}', datum['${$n}'], ${er})`,
          as: offsetAs($n)
        });
      }
    return Qt;
  }
}
const TUPLE_FIELDS = "_tuple_fields";
class SelectionProjectionComponent {
  constructor(...Qt) {
    this.items = Qt, this.hasChannel = {}, this.hasField = {}, this.hasSelectionId = !1;
  }
}
const project = {
  defined: () => !0,
  parse: (_e, Qt, Zt) => {
    const $n = Qt.name, Sn = Qt.project ?? (Qt.project = new SelectionProjectionComponent()), kn = {}, Kn = {}, er = /* @__PURE__ */ new Set(), Cr = (js, zs) => {
      const Fs = zs === "visual" ? js.channel : js.field;
      let Bs = varName(`${$n}_${Fs}`);
      for (let Hs = 1; er.has(Bs); Hs++)
        Bs = varName(`${$n}_${Fs}_${Hs}`);
      return er.add(Bs), { [zs]: Bs };
    }, kr = Qt.type, Yr = _e.config.selection[kr], Ms = Zt.value !== void 0 ? array$6(Zt.value) : null;
    let { fields: Ds, encodings: Ls } = isObject(Zt.select) ? Zt.select : {};
    if (!Ds && !Ls && Ms) {
      for (const js of Ms)
        if (isObject(js))
          for (const zs of keys$2(js))
            isSingleDefUnitChannel(zs) ? (Ls || (Ls = [])).push(zs) : kr === "interval" ? (warn$1(INTERVAL_INITIALIZED_WITH_POS), Ls = Yr.encodings) : (Ds ?? (Ds = [])).push(zs);
    }
    !Ds && !Ls && (Ls = Yr.encodings, "fields" in Yr && (Ds = Yr.fields));
    for (const js of Ls ?? []) {
      const zs = _e.fieldDef(js);
      if (zs) {
        let Fs = zs.field;
        if (zs.aggregate) {
          warn$1(cannotProjectAggregate(js, zs.aggregate));
          continue;
        } else if (!Fs) {
          warn$1(cannotProjectOnChannelWithoutField(js));
          continue;
        }
        if (zs.timeUnit && !isBinnedTimeUnit(zs.timeUnit)) {
          Fs = _e.vgField(js);
          const Bs = {
            timeUnit: zs.timeUnit,
            as: Fs,
            field: zs.field
          };
          Kn[hash(Bs)] = Bs;
        }
        if (!kn[Fs]) {
          const Bs = kr === "interval" && isScaleChannel(js) && hasContinuousDomain(_e.getScaleComponent(js).get("type")) ? "R" : zs.bin ? "R-RE" : "E", Hs = { field: Fs, channel: js, type: Bs, index: Sn.items.length };
          Hs.signals = { ...Cr(Hs, "data"), ...Cr(Hs, "visual") }, Sn.items.push(kn[Fs] = Hs), Sn.hasField[Fs] = kn[Fs], Sn.hasSelectionId = Sn.hasSelectionId || Fs === SELECTION_ID, isGeoPositionChannel(js) ? (Hs.geoChannel = js, Hs.channel = getPositionChannelFromLatLong(js), Sn.hasChannel[Hs.channel] = kn[Fs]) : Sn.hasChannel[js] = kn[Fs];
        }
      } else
        warn$1(cannotProjectOnChannelWithoutField(js));
    }
    for (const js of Ds ?? []) {
      if (Sn.hasField[js])
        continue;
      const zs = { type: "E", field: js, index: Sn.items.length };
      zs.signals = { ...Cr(zs, "data") }, Sn.items.push(zs), Sn.hasField[js] = zs, Sn.hasSelectionId = Sn.hasSelectionId || js === SELECTION_ID;
    }
    Ms && (Qt.init = Ms.map((js) => Sn.items.map((zs) => isObject(js) ? js[zs.geoChannel || zs.channel] !== void 0 ? js[zs.geoChannel || zs.channel] : js[zs.field] : js))), isEmpty(Kn) || (Sn.timeUnit = new TimeUnitNode(null, Kn));
  },
  signals: (_e, Qt, Zt) => {
    const $n = Qt.name + TUPLE_FIELDS;
    return Zt.filter((kn) => kn.name === $n).length > 0 || Qt.project.hasSelectionId ? Zt : Zt.concat({
      name: $n,
      value: Qt.project.items.map(assembleProjection)
    });
  }
}, scaleBindings = {
  defined: (_e) => _e.type === "interval" && _e.resolve === "global" && _e.bind && _e.bind === "scales",
  parse: (_e, Qt) => {
    const Zt = Qt.scales = [];
    for (const $n of Qt.project.items) {
      const Sn = $n.channel;
      if (!isScaleChannel(Sn))
        continue;
      const kn = _e.getScaleComponent(Sn), Kn = kn ? kn.get("type") : void 0;
      if (!kn || !hasContinuousDomain(Kn)) {
        warn$1(SCALE_BINDINGS_CONTINUOUS);
        continue;
      }
      kn.set("selectionExtent", { param: Qt.name, field: $n.field }, !0), Zt.push($n);
    }
  },
  topLevelSignals: (_e, Qt, Zt) => {
    const $n = Qt.scales.filter((Kn) => Zt.filter((er) => er.name === Kn.signals.data).length === 0);
    if (!_e.parent || isTopLevelLayer(_e) || $n.length === 0)
      return Zt;
    const Sn = Zt.filter((Kn) => Kn.name === Qt.name)[0];
    let kn = Sn.update;
    if (kn.indexOf(VL_SELECTION_RESOLVE) >= 0)
      Sn.update = `{${$n.map((Kn) => `${$(replacePathInField(Kn.field))}: ${Kn.signals.data}`).join(", ")}}`;
    else {
      for (const Kn of $n) {
        const er = `${$(replacePathInField(Kn.field))}: ${Kn.signals.data}`;
        kn.includes(er) || (kn = `${kn.substring(0, kn.length - 1)}, ${er}}`);
      }
      Sn.update = kn;
    }
    return Zt.concat($n.map((Kn) => ({ name: Kn.signals.data })));
  },
  signals: (_e, Qt, Zt) => {
    if (_e.parent && !isTopLevelLayer(_e))
      for (const $n of Qt.scales) {
        const Sn = Zt.filter((kn) => kn.name === $n.signals.data)[0];
        Sn.push = "outer", delete Sn.value, delete Sn.update;
      }
    return Zt;
  }
};
function domain(_e, Qt) {
  return `domain(${$(_e.scaleName(Qt))})`;
}
function isTopLevelLayer(_e) {
  return _e.parent && isLayerModel(_e.parent) && !_e.parent.parent;
}
const BRUSH = "_brush", SCALE_TRIGGER = "_scale_trigger", GEO_INIT_TICK = "geo_interval_init_tick", INIT = "_init", CENTER = "_center", interval = {
  defined: (_e) => _e.type === "interval",
  parse: (_e, Qt, Zt) => {
    var $n;
    if (_e.hasProjection) {
      const Sn = { ...isObject(Zt.select) ? Zt.select : {} };
      Sn.fields = [SELECTION_ID], Sn.encodings || (Sn.encodings = Zt.value ? keys$2(Zt.value) : [LONGITUDE, LATITUDE]), Zt.select = { type: "interval", ...Sn };
    }
    if (Qt.translate && !scaleBindings.defined(Qt)) {
      const Sn = `!event.item || event.item.mark.name !== ${$(Qt.name + BRUSH)}`;
      for (const kn of Qt.events) {
        if (!kn.between) {
          warn$1(`${kn} is not an ordered event stream for interval selections.`);
          continue;
        }
        const Kn = array$6(($n = kn.between[0]).filter ?? ($n.filter = []));
        Kn.indexOf(Sn) < 0 && Kn.push(Sn);
      }
    }
  },
  signals: (_e, Qt, Zt) => {
    const $n = Qt.name, Sn = $n + TUPLE, kn = vals(Qt.project.hasChannel).filter((er) => er.channel === X$1 || er.channel === Y$1), Kn = Qt.init ? Qt.init[0] : null;
    if (Zt.push(...kn.reduce((er, Cr) => er.concat(channelSignals(_e, Qt, Cr, Kn && Kn[Cr.index])), [])), _e.hasProjection) {
      const er = $(_e.projectionName()), Cr = _e.projectionName() + CENTER, { x: kr, y: Yr } = Qt.project.hasChannel, Ms = kr && kr.signals.visual, Ds = Yr && Yr.signals.visual, Ls = kr ? Kn && Kn[kr.index] : `${Cr}[0]`, js = Yr ? Kn && Kn[Yr.index] : `${Cr}[1]`, zs = (El) => _e.getSizeSignalRef(El).signal, Fs = `[[${Ms ? Ms + "[0]" : "0"}, ${Ds ? Ds + "[0]" : "0"}],[${Ms ? Ms + "[1]" : zs("width")}, ${Ds ? Ds + "[1]" : zs("height")}]]`;
      Kn && (Zt.unshift({
        name: $n + INIT,
        init: `[scale(${er}, [${kr ? Ls[0] : Ls}, ${Yr ? js[0] : js}]), scale(${er}, [${kr ? Ls[1] : Ls}, ${Yr ? js[1] : js}])]`
      }), (!kr || !Yr) && (Zt.find((Mu) => Mu.name === Cr) || Zt.unshift({
        name: Cr,
        update: `invert(${er}, [${zs("width")}/2, ${zs("height")}/2])`
      })));
      const Bs = `intersect(${Fs}, {markname: ${$(_e.getName("marks"))}}, unit.mark)`, Hs = `{unit: ${unitName(_e)}}`, Ws = `vlSelectionTuples(${Bs}, ${Hs})`, Ys = kn.map((El) => El.signals.visual);
      return Zt.concat({
        name: Sn,
        on: [
          {
            events: [
              ...Ys.length ? [{ signal: Ys.join(" || ") }] : [],
              ...Kn ? [{ signal: GEO_INIT_TICK }] : []
            ],
            update: Ws
          }
        ]
      });
    } else {
      if (!scaleBindings.defined(Qt)) {
        const kr = $n + SCALE_TRIGGER, Yr = kn.map((Ms) => {
          const Ds = Ms.channel, { data: Ls, visual: js } = Ms.signals, zs = $(_e.scaleName(Ds)), Fs = _e.getScaleComponent(Ds).get("type"), Bs = hasContinuousDomain(Fs) ? "+" : "";
          return `(!isArray(${Ls}) || (${Bs}invert(${zs}, ${js})[0] === ${Bs}${Ls}[0] && ${Bs}invert(${zs}, ${js})[1] === ${Bs}${Ls}[1]))`;
        });
        Yr.length && Zt.push({
          name: kr,
          value: {},
          on: [
            {
              events: kn.map((Ms) => ({ scale: _e.scaleName(Ms.channel) })),
              update: Yr.join(" && ") + ` ? ${kr} : {}`
            }
          ]
        });
      }
      const er = kn.map((kr) => kr.signals.data), Cr = `unit: ${unitName(_e)}, fields: ${$n + TUPLE_FIELDS}, values`;
      return Zt.concat({
        name: Sn,
        ...Kn ? { init: `{${Cr}: ${assembleInit(Kn)}}` } : {},
        ...er.length ? {
          on: [
            {
              events: [{ signal: er.join(" || ") }],
              update: `${er.join(" && ")} ? {${Cr}: [${er}]} : null`
            }
          ]
        } : {}
      });
    }
  },
  topLevelSignals: (_e, Qt, Zt) => (isUnitModel(_e) && _e.hasProjection && Qt.init && (Zt.filter((Sn) => Sn.name === GEO_INIT_TICK).length || Zt.unshift({
    name: GEO_INIT_TICK,
    value: null,
    on: [
      {
        events: "timer{1}",
        update: `${GEO_INIT_TICK} === null ? {} : ${GEO_INIT_TICK}`
      }
    ]
  })), Zt),
  marks: (_e, Qt, Zt) => {
    const $n = Qt.name, { x: Sn, y: kn } = Qt.project.hasChannel, Kn = Sn == null ? void 0 : Sn.signals.visual, er = kn == null ? void 0 : kn.signals.visual, Cr = `data(${$(Qt.name + STORE)})`;
    if (scaleBindings.defined(Qt) || !Sn && !kn)
      return Zt;
    const kr = {
      x: Sn !== void 0 ? { signal: `${Kn}[0]` } : { value: 0 },
      y: kn !== void 0 ? { signal: `${er}[0]` } : { value: 0 },
      x2: Sn !== void 0 ? { signal: `${Kn}[1]` } : { field: { group: "width" } },
      y2: kn !== void 0 ? { signal: `${er}[1]` } : { field: { group: "height" } }
    };
    if (Qt.resolve === "global")
      for (const zs of keys$2(kr))
        kr[zs] = [
          {
            test: `${Cr}.length && ${Cr}[0].unit === ${unitName(_e)}`,
            ...kr[zs]
          },
          { value: 0 }
        ];
    const { fill: Yr, fillOpacity: Ms, cursor: Ds, ...Ls } = Qt.mark, js = keys$2(Ls).reduce((zs, Fs) => (zs[Fs] = [
      {
        test: [Sn !== void 0 && `${Kn}[0] !== ${Kn}[1]`, kn !== void 0 && `${er}[0] !== ${er}[1]`].filter((Bs) => Bs).join(" && "),
        value: Ls[Fs]
      },
      { value: null }
    ], zs), {});
    return [
      {
        name: `${$n + BRUSH}_bg`,
        type: "rect",
        clip: !0,
        encode: {
          enter: {
            fill: { value: Yr },
            fillOpacity: { value: Ms }
          },
          update: kr
        }
      },
      ...Zt,
      {
        name: $n + BRUSH,
        type: "rect",
        clip: !0,
        encode: {
          enter: {
            ...Ds ? { cursor: { value: Ds } } : {},
            fill: { value: "transparent" }
          },
          update: { ...kr, ...js }
        }
      }
    ];
  }
};
function channelSignals(_e, Qt, Zt, $n) {
  const Sn = !_e.hasProjection, kn = Zt.channel, Kn = Zt.signals.visual, er = $(Sn ? _e.scaleName(kn) : _e.projectionName()), Cr = (Ds) => `scale(${er}, ${Ds})`, kr = _e.getSizeSignalRef(kn === X$1 ? "width" : "height").signal, Yr = `${kn}(unit)`, Ms = Qt.events.reduce((Ds, Ls) => [
    ...Ds,
    { events: Ls.between[0], update: `[${Yr}, ${Yr}]` },
    { events: Ls, update: `[${Kn}[0], clamp(${Yr}, 0, ${kr})]` }
    // Brush End
  ], []);
  if (Sn) {
    const Ds = Zt.signals.data, Ls = scaleBindings.defined(Qt), js = _e.getScaleComponent(kn), zs = js ? js.get("type") : void 0, Fs = $n ? { init: assembleInit($n, !0, Cr) } : { value: [] };
    return Ms.push({
      events: { signal: Qt.name + SCALE_TRIGGER },
      update: hasContinuousDomain(zs) ? `[${Cr(`${Ds}[0]`)}, ${Cr(`${Ds}[1]`)}]` : "[0, 0]"
    }), Ls ? [{ name: Ds, on: [] }] : [
      { name: Kn, ...Fs, on: Ms },
      {
        name: Ds,
        ...$n ? { init: assembleInit($n) } : {},
        on: [
          {
            events: { signal: Kn },
            update: `${Kn}[0] === ${Kn}[1] ? null : invert(${er}, ${Kn})`
          }
        ]
      }
    ];
  } else {
    const Ds = kn === X$1 ? 0 : 1, Ls = Qt.name + INIT, js = $n ? { init: `[${Ls}[0][${Ds}], ${Ls}[1][${Ds}]]` } : { value: [] };
    return [{ name: Kn, ...js, on: Ms }];
  }
}
const point$1 = {
  defined: (_e) => _e.type === "point",
  signals: (_e, Qt, Zt) => {
    const $n = Qt.name, Sn = $n + TUPLE_FIELDS, kn = Qt.project, Kn = "(item().isVoronoi ? datum.datum : datum)", er = vals(_e.component.selection ?? {}).reduce((Ms, Ds) => Ds.type === "interval" ? Ms.concat(Ds.name + BRUSH) : Ms, []).map((Ms) => `indexof(item().mark.name, '${Ms}') < 0`).join(" && "), Cr = `datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${er ? ` && ${er}` : ""}`;
    let kr = `unit: ${unitName(_e)}, `;
    if (Qt.project.hasSelectionId)
      kr += `${SELECTION_ID}: ${Kn}[${$(SELECTION_ID)}]`;
    else {
      const Ms = kn.items.map((Ds) => {
        const Ls = _e.fieldDef(Ds.channel);
        return Ls != null && Ls.bin ? `[${Kn}[${$(_e.vgField(Ds.channel, {}))}], ${Kn}[${$(_e.vgField(Ds.channel, { binSuffix: "end" }))}]]` : `${Kn}[${$(Ds.field)}]`;
      }).join(", ");
      kr += `fields: ${Sn}, values: [${Ms}]`;
    }
    const Yr = Qt.events;
    return Zt.concat([
      {
        name: $n + TUPLE,
        on: Yr ? [
          {
            events: Yr,
            update: `${Cr} ? {${kr}} : null`,
            force: !0
          }
        ] : []
      }
    ]);
  }
};
function wrapCondition(_e, Qt, Zt, $n) {
  const Sn = isConditionalDef(Qt) && Qt.condition, kn = $n(Qt);
  if (Sn) {
    const er = array$6(Sn).map((Cr) => {
      const kr = $n(Cr);
      if (isConditionalParameter(Cr)) {
        const { param: Yr, empty: Ms } = Cr;
        return { test: parseSelectionPredicate(_e, { param: Yr, empty: Ms }), ...kr };
      } else
        return { test: expression$1(_e, Cr.test), ...kr };
    });
    return {
      [Zt]: [...er, ...kn !== void 0 ? [kn] : []]
    };
  } else
    return kn !== void 0 ? { [Zt]: kn } : {};
}
function text$1(_e, Qt = "text") {
  const Zt = _e.encoding[Qt];
  return wrapCondition(_e, Zt, Qt, ($n) => textRef($n, _e.config));
}
function textRef(_e, Qt, Zt = "datum") {
  if (_e) {
    if (isValueDef(_e))
      return signalOrValueRef(_e.value);
    if (isFieldOrDatumDef(_e)) {
      const { format: $n, formatType: Sn } = getFormatMixins(_e);
      return formatSignalRef({ fieldOrDatumDef: _e, format: $n, formatType: Sn, expr: Zt, config: Qt });
    }
  }
}
function tooltip(_e, Qt = {}) {
  const { encoding: Zt, markDef: $n, config: Sn, stack: kn } = _e, Kn = Zt.tooltip;
  if (isArray(Kn))
    return { tooltip: tooltipRefForEncoding({ tooltip: Kn }, kn, Sn, Qt) };
  {
    const er = Qt.reactiveGeom ? "datum.datum" : "datum";
    return wrapCondition(_e, Kn, "tooltip", (Cr) => {
      const kr = textRef(Cr, Sn, er);
      if (kr)
        return kr;
      if (Cr === null)
        return;
      let Yr = getMarkPropOrConfig("tooltip", $n, Sn);
      if (Yr === !0 && (Yr = { content: "encoding" }), isString(Yr))
        return { value: Yr };
      if (isObject(Yr))
        return isSignalRef(Yr) ? Yr : Yr.content === "encoding" ? tooltipRefForEncoding(Zt, kn, Sn, Qt) : { signal: er };
    });
  }
}
function tooltipData(_e, Qt, Zt, { reactiveGeom: $n } = {}) {
  const Sn = { ...Zt, ...Zt.tooltipFormat }, kn = {}, Kn = $n ? "datum.datum" : "datum", er = [];
  function Cr(Yr, Ms) {
    const Ds = getMainRangeChannel(Ms), Ls = isTypedFieldDef(Yr) ? Yr : {
      ...Yr,
      type: _e[Ds].type
      // for secondary field def, copy type from main channel
    }, js = Ls.title || defaultTitle(Ls, Sn), zs = array$6(js).join(", ").replaceAll(/"/g, '\\"');
    let Fs;
    if (isXorY(Ms)) {
      const Bs = Ms === "x" ? "x2" : "y2", Hs = getFieldDef(_e[Bs]);
      if (isBinned(Ls.bin) && Hs) {
        const Ws = vgField(Ls, { expr: Kn }), Ys = vgField(Hs, { expr: Kn }), { format: El, formatType: Mu } = getFormatMixins(Ls);
        Fs = binFormatExpression(Ws, Ys, El, Mu, Sn), kn[Bs] = !0;
      }
    }
    if ((isXorY(Ms) || Ms === THETA || Ms === RADIUS) && Qt && Qt.fieldChannel === Ms && Qt.offset === "normalize") {
      const { format: Bs, formatType: Hs } = getFormatMixins(Ls);
      Fs = formatSignalRef({
        fieldOrDatumDef: Ls,
        format: Bs,
        formatType: Hs,
        expr: Kn,
        config: Sn,
        normalizeStack: !0
      }).signal;
    }
    Fs ?? (Fs = textRef(Ls, Sn, Kn).signal), er.push({ channel: Ms, key: zs, value: Fs });
  }
  forEach(_e, (Yr, Ms) => {
    isFieldDef(Yr) ? Cr(Yr, Ms) : hasConditionalFieldDef(Yr) && Cr(Yr.condition, Ms);
  });
  const kr = {};
  for (const { channel: Yr, key: Ms, value: Ds } of er)
    !kn[Yr] && !kr[Ms] && (kr[Ms] = Ds);
  return kr;
}
function tooltipRefForEncoding(_e, Qt, Zt, { reactiveGeom: $n } = {}) {
  const Sn = tooltipData(_e, Qt, Zt, { reactiveGeom: $n }), kn = entries$1(Sn).map(([Kn, er]) => `"${Kn}": ${er}`);
  return kn.length > 0 ? { signal: `{${kn.join(", ")}}` } : void 0;
}
function aria(_e) {
  const { markDef: Qt, config: Zt } = _e, $n = getMarkPropOrConfig("aria", Qt, Zt);
  return $n === !1 ? {} : {
    ...$n ? { aria: $n } : {},
    ...ariaRoleDescription(_e),
    ...description$1(_e)
  };
}
function ariaRoleDescription(_e) {
  const { mark: Qt, markDef: Zt, config: $n } = _e;
  if ($n.aria === !1)
    return {};
  const Sn = getMarkPropOrConfig("ariaRoleDescription", Zt, $n);
  return Sn != null ? { ariaRoleDescription: { value: Sn } } : Qt in VG_MARK_INDEX ? {} : { ariaRoleDescription: { value: Qt } };
}
function description$1(_e) {
  const { encoding: Qt, markDef: Zt, config: $n, stack: Sn } = _e, kn = Qt.description;
  if (kn)
    return wrapCondition(_e, kn, "description", (Cr) => textRef(Cr, _e.config));
  const Kn = getMarkPropOrConfig("description", Zt, $n);
  if (Kn != null)
    return {
      description: signalOrValueRef(Kn)
    };
  if ($n.aria === !1)
    return {};
  const er = tooltipData(Qt, Sn, $n);
  if (!isEmpty(er))
    return {
      description: {
        signal: entries$1(er).map(([Cr, kr], Yr) => `"${Yr > 0 ? "; " : ""}${Cr}: " + (${kr})`).join(" + ")
      }
    };
}
function nonPosition(_e, Qt, Zt = {}) {
  const { markDef: $n, encoding: Sn, config: kn } = Qt, { vgChannel: Kn } = Zt;
  let { defaultRef: er, defaultValue: Cr } = Zt;
  er === void 0 && (Cr ?? (Cr = getMarkPropOrConfig(_e, $n, kn, { vgChannel: Kn, ignoreVgConfig: !0 })), Cr !== void 0 && (er = signalOrValueRef(Cr)));
  const kr = Sn[_e];
  return wrapCondition(Qt, kr, Kn ?? _e, (Yr) => midPoint({
    channel: _e,
    channelDef: Yr,
    markDef: $n,
    config: kn,
    scaleName: Qt.scaleName(_e),
    scale: Qt.getScaleComponent(_e),
    stack: null,
    defaultRef: er
  }));
}
function color(_e, Qt = { filled: void 0 }) {
  const { markDef: Zt, encoding: $n, config: Sn } = _e, { type: kn } = Zt, Kn = Qt.filled ?? getMarkPropOrConfig("filled", Zt, Sn), er = contains$1(["bar", "point", "circle", "square", "geoshape"], kn) ? "transparent" : void 0, Cr = getMarkPropOrConfig(Kn === !0 ? "color" : void 0, Zt, Sn, { vgChannel: "fill" }) ?? // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified
  Sn.mark[Kn === !0 && "color"] ?? // If there is no fill, always fill symbols, bar, geoshape
  // with transparent fills https://github.com/vega/vega-lite/issues/1316
  er, kr = getMarkPropOrConfig(Kn === !1 ? "color" : void 0, Zt, Sn, { vgChannel: "stroke" }) ?? // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified
  Sn.mark[Kn === !1 && "color"], Yr = Kn ? "fill" : "stroke", Ms = {
    ...Cr ? { fill: signalOrValueRef(Cr) } : {},
    ...kr ? { stroke: signalOrValueRef(kr) } : {}
  };
  return Zt.color && (Kn ? Zt.fill : Zt.stroke) && warn$1(droppingColor("property", { fill: "fill" in Zt, stroke: "stroke" in Zt })), {
    ...Ms,
    ...nonPosition("color", _e, {
      vgChannel: Yr,
      defaultValue: Kn ? Cr : kr
    }),
    ...nonPosition("fill", _e, {
      // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding
      defaultValue: $n.fill ? Cr : void 0
    }),
    ...nonPosition("stroke", _e, {
      // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding
      defaultValue: $n.stroke ? kr : void 0
    })
  };
}
function zindex(_e) {
  const { encoding: Qt, mark: Zt } = _e, $n = Qt.order;
  return !isPathMark(Zt) && isValueDef($n) ? wrapCondition(_e, $n, "zindex", (Sn) => signalOrValueRef(Sn.value)) : {};
}
function positionOffset({ channel: _e, markDef: Qt, encoding: Zt = {}, model: $n, bandPosition: Sn }) {
  const kn = `${_e}Offset`, Kn = Qt[kn], er = Zt[kn];
  if ((kn === "xOffset" || kn === "yOffset") && er)
    return { offsetType: "encoding", offset: midPoint({
      channel: kn,
      channelDef: er,
      markDef: Qt,
      config: $n == null ? void 0 : $n.config,
      scaleName: $n.scaleName(kn),
      scale: $n.getScaleComponent(kn),
      stack: null,
      defaultRef: signalOrValueRef(Kn),
      bandPosition: Sn
    }) };
  const Cr = Qt[kn];
  return Cr ? { offsetType: "visual", offset: Cr } : {};
}
function pointPosition(_e, Qt, { defaultPos: Zt, vgChannel: $n }) {
  const { encoding: Sn, markDef: kn, config: Kn, stack: er } = Qt, Cr = Sn[_e], kr = Sn[getSecondaryRangeChannel(_e)], Yr = Qt.scaleName(_e), Ms = Qt.getScaleComponent(_e), { offset: Ds, offsetType: Ls } = positionOffset({
    channel: _e,
    markDef: kn,
    encoding: Sn,
    model: Qt,
    bandPosition: 0.5
  }), js = pointPositionDefaultRef({
    model: Qt,
    defaultPos: Zt,
    channel: _e,
    scaleName: Yr,
    scale: Ms
  }), zs = !Cr && isXorY(_e) && (Sn.latitude || Sn.longitude) ? (
    // use geopoint output if there are lat/long and there is no point position overriding lat/long.
    { field: Qt.getName(_e) }
  ) : positionRef({
    channel: _e,
    channelDef: Cr,
    channel2Def: kr,
    markDef: kn,
    config: Kn,
    scaleName: Yr,
    scale: Ms,
    stack: er,
    offset: Ds,
    defaultRef: js,
    bandPosition: Ls === "encoding" ? 0 : void 0
  });
  return zs ? { [$n || _e]: zs } : void 0;
}
function positionRef(_e) {
  const { channel: Qt, channelDef: Zt, scaleName: $n, stack: Sn, offset: kn, markDef: Kn } = _e;
  if (isFieldOrDatumDef(Zt) && Sn && Qt === Sn.fieldChannel) {
    if (isFieldDef(Zt)) {
      let er = Zt.bandPosition;
      if (er === void 0 && Kn.type === "text" && (Qt === "radius" || Qt === "theta") && (er = 0.5), er !== void 0)
        return interpolatedSignalRef({
          scaleName: $n,
          fieldOrDatumDef: Zt,
          startSuffix: "start",
          bandPosition: er,
          offset: kn
        });
    }
    return valueRefForFieldOrDatumDef(Zt, $n, { suffix: "end" }, { offset: kn });
  }
  return midPointRefWithPositionInvalidTest(_e);
}
function pointPositionDefaultRef({ model: _e, defaultPos: Qt, channel: Zt, scaleName: $n, scale: Sn }) {
  const { markDef: kn, config: Kn } = _e;
  return () => {
    const er = getMainRangeChannel(Zt), Cr = getVgPositionChannel(Zt), kr = getMarkPropOrConfig(Zt, kn, Kn, { vgChannel: Cr });
    if (kr !== void 0)
      return widthHeightValueOrSignalRef(Zt, kr);
    switch (Qt) {
      case "zeroOrMin":
      case "zeroOrMax":
        if ($n) {
          const Yr = Sn.get("type");
          if (!contains$1([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], Yr)) {
            if (Sn.domainDefinitelyIncludesZero())
              return {
                scale: $n,
                value: 0
              };
          }
        }
        if (Qt === "zeroOrMin")
          return er === "y" ? { field: { group: "height" } } : { value: 0 };
        switch (er) {
          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":
        return { ..._e[getSizeChannel(Zt)], mult: 0.5 };
    }
  };
}
const ALIGNED_X_CHANNEL = {
  left: "x",
  center: "xc",
  right: "x2"
}, BASELINED_Y_CHANNEL = {
  top: "y",
  middle: "yc",
  bottom: "y2"
};
function vgAlignedPositionChannel(_e, Qt, Zt, $n = "middle") {
  if (_e === "radius" || _e === "theta")
    return getVgPositionChannel(_e);
  const Sn = _e === "x" ? "align" : "baseline", kn = getMarkPropOrConfig(Sn, Qt, Zt);
  let Kn;
  return isSignalRef(kn) ? (warn$1(rangeMarkAlignmentCannotBeExpression(Sn)), Kn = void 0) : Kn = kn, _e === "x" ? ALIGNED_X_CHANNEL[Kn || ($n === "top" ? "left" : "center")] : BASELINED_Y_CHANNEL[Kn || $n];
}
function pointOrRangePosition(_e, Qt, { defaultPos: Zt, defaultPos2: $n, range: Sn }) {
  return Sn ? rangePosition(_e, Qt, { defaultPos: Zt, defaultPos2: $n }) : pointPosition(_e, Qt, { defaultPos: Zt });
}
function rangePosition(_e, Qt, { defaultPos: Zt, defaultPos2: $n }) {
  const { markDef: Sn, config: kn } = Qt, Kn = getSecondaryRangeChannel(_e), er = getSizeChannel(_e), Cr = pointPosition2OrSize(Qt, $n, Kn), kr = Cr[er] ? (
    // If there is width/height, we need to position the marks based on the alignment.
    vgAlignedPositionChannel(_e, Sn, kn)
  ) : (
    // Otherwise, make sure to apply to the right Vg Channel (for arc mark)
    getVgPositionChannel(_e)
  );
  return {
    ...pointPosition(_e, Qt, { defaultPos: Zt, vgChannel: kr }),
    ...Cr
  };
}
function pointPosition2OrSize(_e, Qt, Zt) {
  const { encoding: $n, mark: Sn, markDef: kn, stack: Kn, config: er } = _e, Cr = getMainRangeChannel(Zt), kr = getSizeChannel(Zt), Yr = getVgPositionChannel(Zt), Ms = $n[Cr], Ds = _e.scaleName(Cr), Ls = _e.getScaleComponent(Cr), { offset: js } = Zt in $n || Zt in kn ? positionOffset({ channel: Zt, markDef: kn, encoding: $n, model: _e }) : positionOffset({ channel: Cr, markDef: kn, encoding: $n, model: _e });
  if (!Ms && (Zt === "x2" || Zt === "y2") && ($n.latitude || $n.longitude)) {
    const Fs = getSizeChannel(Zt), Bs = _e.markDef[Fs];
    return Bs != null ? {
      [Fs]: { value: Bs }
    } : {
      [Yr]: { field: _e.getName(Zt) }
    };
  }
  const zs = position2Ref({
    channel: Zt,
    channelDef: Ms,
    channel2Def: $n[Zt],
    markDef: kn,
    config: er,
    scaleName: Ds,
    scale: Ls,
    stack: Kn,
    offset: js,
    defaultRef: void 0
  });
  return zs !== void 0 ? { [Yr]: zs } : position2orSize(Zt, kn) || position2orSize(Zt, {
    [Zt]: getMarkStyleConfig(Zt, kn, er.style),
    [kr]: getMarkStyleConfig(kr, kn, er.style)
  }) || position2orSize(Zt, er[Sn]) || position2orSize(Zt, er.mark) || {
    [Yr]: pointPositionDefaultRef({
      model: _e,
      defaultPos: Qt,
      channel: Zt,
      scaleName: Ds,
      scale: Ls
    })()
  };
}
function position2Ref({ channel: _e, channelDef: Qt, channel2Def: Zt, markDef: $n, config: Sn, scaleName: kn, scale: Kn, stack: er, offset: Cr, defaultRef: kr }) {
  return isFieldOrDatumDef(Qt) && er && // If fieldChannel is X and channel is X2 (or Y and Y2)
  _e.charAt(0) === er.fieldChannel.charAt(0) ? valueRefForFieldOrDatumDef(Qt, kn, { suffix: "start" }, { offset: Cr }) : midPointRefWithPositionInvalidTest({
    channel: _e,
    channelDef: Zt,
    scaleName: kn,
    scale: Kn,
    stack: er,
    markDef: $n,
    config: Sn,
    offset: Cr,
    defaultRef: kr
  });
}
function position2orSize(_e, Qt) {
  const Zt = getSizeChannel(_e), $n = getVgPositionChannel(_e);
  if (Qt[$n] !== void 0)
    return { [$n]: widthHeightValueOrSignalRef(_e, Qt[$n]) };
  if (Qt[_e] !== void 0)
    return { [$n]: widthHeightValueOrSignalRef(_e, Qt[_e]) };
  if (Qt[Zt]) {
    const Sn = Qt[Zt];
    if (isRelativeBandSize(Sn))
      warn$1(relativeBandSizeNotSupported(Zt));
    else
      return { [Zt]: widthHeightValueOrSignalRef(_e, Sn) };
  }
}
function rectPosition(_e, Qt) {
  const { config: Zt, encoding: $n, markDef: Sn } = _e, kn = Sn.type, Kn = getSecondaryRangeChannel(Qt), er = getSizeChannel(Qt), Cr = $n[Qt], kr = $n[Kn], Yr = _e.getScaleComponent(Qt), Ms = Yr ? Yr.get("type") : void 0, Ds = Sn.orient, Ls = $n[er] ?? $n.size ?? getMarkPropOrConfig("size", Sn, Zt, { vgChannel: er }), js = getOffsetChannel(Qt), zs = kn === "bar" && (Qt === "x" ? Ds === "vertical" : Ds === "horizontal");
  return isFieldDef(Cr) && (isBinning(Cr.bin) || isBinned(Cr.bin) || Cr.timeUnit && !kr) && !(Ls && !isRelativeBandSize(Ls)) && !$n[js] && !hasDiscreteDomain(Ms) ? rectBinPosition({
    fieldDef: Cr,
    fieldDef2: kr,
    channel: Qt,
    model: _e
  }) : (isFieldOrDatumDef(Cr) && hasDiscreteDomain(Ms) || zs) && !kr ? positionAndSize(Cr, Qt, _e) : rangePosition(Qt, _e, { defaultPos: "zeroOrMax", defaultPos2: "zeroOrMin" });
}
function defaultSizeRef(_e, Qt, Zt, $n, Sn, kn, Kn) {
  if (isRelativeBandSize(Sn))
    if (Zt) {
      const Cr = Zt.get("type");
      if (Cr === "band") {
        let kr = `bandwidth('${Qt}')`;
        Sn.band !== 1 && (kr = `${Sn.band} * ${kr}`);
        const Yr = getMarkConfig("minBandSize", { type: Kn }, $n);
        return { signal: Yr ? `max(${signalOrStringValue(Yr)}, ${kr})` : kr };
      } else
        Sn.band !== 1 && (warn$1(cannotUseRelativeBandSizeWithNonBandScale(Cr)), Sn = void 0);
    } else
      return {
        mult: Sn.band,
        field: { group: _e }
      };
  else {
    if (isSignalRef(Sn))
      return Sn;
    if (Sn)
      return { value: Sn };
  }
  if (Zt) {
    const Cr = Zt.get("range");
    if (isVgRangeStep(Cr) && isNumber$1(Cr.step))
      return { value: Cr.step - 2 };
  }
  if (!kn) {
    const { bandPaddingInner: Cr, barBandPaddingInner: kr, rectBandPaddingInner: Yr } = $n.scale, Ms = getFirstDefined(Cr, Kn === "bar" ? kr : Yr);
    if (isSignalRef(Ms))
      return { signal: `(1 - (${Ms.signal})) * ${_e}` };
    if (isNumber$1(Ms))
      return { signal: `${1 - Ms} * ${_e}` };
  }
  return { value: getViewConfigDiscreteStep($n.view, _e) - 2 };
}
function positionAndSize(_e, Qt, Zt) {
  const { markDef: $n, encoding: Sn, config: kn, stack: Kn } = Zt, er = $n.orient, Cr = Zt.scaleName(Qt), kr = Zt.getScaleComponent(Qt), Yr = getSizeChannel(Qt), Ms = getSecondaryRangeChannel(Qt), Ds = getOffsetChannel(Qt), Ls = Zt.scaleName(Ds), js = Zt.getScaleComponent(getOffsetScaleChannel(Qt)), zs = er === "horizontal" && Qt === "y" || er === "vertical" && Qt === "x";
  let Fs;
  (Sn.size || $n.size) && (zs ? Fs = nonPosition("size", Zt, {
    vgChannel: Yr,
    defaultRef: signalOrValueRef($n.size)
  }) : warn$1(cannotApplySizeToNonOrientedMark($n.type)));
  const Bs = !!Fs, Hs = getBandSize({ channel: Qt, fieldDef: _e, markDef: $n, config: kn, scaleType: kr == null ? void 0 : kr.get("type"), useVlSizeChannel: zs });
  Fs = Fs || {
    [Yr]: defaultSizeRef(Yr, Ls || Cr, js || kr, kn, Hs, !!_e, $n.type)
  };
  const Ws = (kr == null ? void 0 : kr.get("type")) === "band" && isRelativeBandSize(Hs) && !Bs ? "top" : "middle", Ys = vgAlignedPositionChannel(Qt, $n, kn, Ws), El = Ys === "xc" || Ys === "yc", { offset: Mu, offsetType: Pl } = positionOffset({ channel: Qt, markDef: $n, encoding: Sn, model: Zt, bandPosition: El ? 0.5 : 0 }), Iu = midPointRefWithPositionInvalidTest({
    channel: Qt,
    channelDef: _e,
    markDef: $n,
    config: kn,
    scaleName: Cr,
    scale: kr,
    stack: Kn,
    offset: Mu,
    defaultRef: pointPositionDefaultRef({ model: Zt, defaultPos: "mid", channel: Qt, scaleName: Cr, scale: kr }),
    bandPosition: El ? Pl === "encoding" ? 0 : 0.5 : isSignalRef(Hs) ? { signal: `(1-${Hs})/2` } : isRelativeBandSize(Hs) ? (1 - Hs.band) / 2 : 0
  });
  if (Yr)
    return { [Ys]: Iu, ...Fs };
  {
    const Tu = getVgPositionChannel(Ms), Au = Fs[Yr], Nu = Mu ? { ...Au, offset: Mu } : Au;
    return {
      [Ys]: Iu,
      // posRef might be an array that wraps position invalid test
      [Tu]: isArray(Iu) ? [Iu[0], { ...Iu[1], offset: Nu }] : {
        ...Iu,
        offset: Nu
      }
    };
  }
}
function getBinSpacing(_e, Qt, Zt, $n, Sn, kn, Kn) {
  if (isPolarPositionChannel(_e))
    return 0;
  const er = _e === "x" || _e === "y2", Cr = er ? -Qt / 2 : Qt / 2;
  if (isSignalRef(Zt) || isSignalRef(Sn) || isSignalRef($n) || kn) {
    const kr = signalOrStringValue(Zt), Yr = signalOrStringValue(Sn), Ms = signalOrStringValue($n), Ds = signalOrStringValue(kn), js = kn ? `(${Kn} < ${Ds} ? ${er ? "" : "-"}0.5 * (${Ds} - (${Kn})) : ${Cr})` : Cr, zs = Ms ? `${Ms} + ` : "", Fs = kr ? `(${kr} ? -1 : 1) * ` : "", Bs = Yr ? `(${Yr} + ${js})` : js;
    return {
      signal: zs + Fs + Bs
    };
  } else
    return Sn = Sn || 0, $n + (Zt ? -Sn - Cr : +Sn + Cr);
}
function rectBinPosition({ fieldDef: _e, fieldDef2: Qt, channel: Zt, model: $n }) {
  var Tu;
  const { config: Sn, markDef: kn, encoding: Kn } = $n, er = $n.getScaleComponent(Zt), Cr = $n.scaleName(Zt), kr = er ? er.get("type") : void 0, Yr = er.get("reverse"), Ms = getBandSize({ channel: Zt, fieldDef: _e, markDef: kn, config: Sn, scaleType: kr }), Ds = (Tu = $n.component.axes[Zt]) == null ? void 0 : Tu[0], Ls = (Ds == null ? void 0 : Ds.get("translate")) ?? 0.5, js = isXorY(Zt) ? getMarkPropOrConfig("binSpacing", kn, Sn) ?? 0 : 0, zs = getSecondaryRangeChannel(Zt), Fs = getVgPositionChannel(Zt), Bs = getVgPositionChannel(zs), Hs = getMarkConfig("minBandSize", kn, Sn), { offset: Ws } = positionOffset({ channel: Zt, markDef: kn, encoding: Kn, model: $n, bandPosition: 0 }), { offset: Ys } = positionOffset({ channel: zs, markDef: kn, encoding: Kn, model: $n, bandPosition: 0 }), El = binSizeExpr({ fieldDef: _e, scaleName: Cr }), Mu = getBinSpacing(Zt, js, Yr, Ls, Ws, Hs, El), Pl = getBinSpacing(zs, js, Yr, Ls, Ys ?? Ws, Hs, El), Iu = isSignalRef(Ms) ? { signal: `(1-${Ms.signal})/2` } : isRelativeBandSize(Ms) ? (1 - Ms.band) / 2 : 0.5;
  if (isBinning(_e.bin) || _e.timeUnit)
    return {
      [Bs]: rectBinRef({
        fieldDef: _e,
        scaleName: Cr,
        bandPosition: Iu,
        offset: Pl
      }),
      [Fs]: rectBinRef({
        fieldDef: _e,
        scaleName: Cr,
        bandPosition: isSignalRef(Iu) ? { signal: `1-${Iu.signal}` } : 1 - Iu,
        offset: Mu
      })
    };
  if (isBinned(_e.bin)) {
    const Au = valueRefForFieldOrDatumDef(_e, Cr, {}, { offset: Pl });
    if (isFieldDef(Qt))
      return {
        [Bs]: Au,
        [Fs]: valueRefForFieldOrDatumDef(Qt, Cr, {}, { offset: Mu })
      };
    if (isBinParams(_e.bin) && _e.bin.step)
      return {
        [Bs]: Au,
        [Fs]: {
          signal: `scale("${Cr}", ${vgField(_e, { expr: "datum" })} + ${_e.bin.step})`,
          offset: Mu
        }
      };
  }
  warn$1(channelRequiredForBinned(zs));
}
function rectBinRef({ fieldDef: _e, scaleName: Qt, bandPosition: Zt, offset: $n }) {
  return interpolatedSignalRef({
    scaleName: Qt,
    fieldOrDatumDef: _e,
    bandPosition: Zt,
    offset: $n
  });
}
const ALWAYS_IGNORE = /* @__PURE__ */ new Set(["aria", "width", "height"]);
function baseEncodeEntry(_e, Qt) {
  const { fill: Zt = void 0, stroke: $n = void 0 } = Qt.color === "include" ? color(_e) : {};
  return {
    ...markDefProperties(_e.markDef, Qt),
    ...wrapAllFieldsInvalid(_e, "fill", Zt),
    ...wrapAllFieldsInvalid(_e, "stroke", $n),
    ...nonPosition("opacity", _e),
    ...nonPosition("fillOpacity", _e),
    ...nonPosition("strokeOpacity", _e),
    ...nonPosition("strokeWidth", _e),
    ...nonPosition("strokeDash", _e),
    ...zindex(_e),
    ...tooltip(_e),
    ...text$1(_e, "href"),
    ...aria(_e)
  };
}
function wrapAllFieldsInvalid(_e, Qt, Zt) {
  const { config: $n, mark: Sn, markDef: kn } = _e;
  if (getMarkPropOrConfig("invalid", kn, $n) === "hide" && Zt && !isPathMark(Sn)) {
    const er = allFieldsInvalidPredicate$1(_e, { invalid: !0, channels: SCALE_CHANNELS });
    if (er)
      return {
        [Qt]: [
          // prepend the invalid case
          // TODO: support custom value
          { test: er, value: null },
          ...array$6(Zt)
        ]
      };
  }
  return Zt ? { [Qt]: Zt } : {};
}
function markDefProperties(_e, Qt) {
  return VG_MARK_CONFIGS.reduce((Zt, $n) => (!ALWAYS_IGNORE.has($n) && _e[$n] !== void 0 && Qt[$n] !== "ignore" && (Zt[$n] = signalOrValueRef(_e[$n])), Zt), {});
}
function allFieldsInvalidPredicate$1(_e, { invalid: Qt = !1, channels: Zt }) {
  const $n = Zt.reduce((kn, Kn) => {
    const er = _e.getScaleComponent(Kn);
    if (er) {
      const Cr = er.get("type"), kr = _e.vgField(Kn, { expr: "datum" });
      kr && hasContinuousDomain(Cr) && (kn[kr] = !0);
    }
    return kn;
  }, {}), Sn = keys$2($n);
  if (Sn.length > 0) {
    const kn = Qt ? "||" : "&&";
    return Sn.map((Kn) => fieldInvalidPredicate(Kn, Qt)).join(` ${kn} `);
  }
}
function defined(_e) {
  const { config: Qt, markDef: Zt } = _e;
  if (getMarkPropOrConfig("invalid", Zt, Qt)) {
    const Sn = allFieldsInvalidPredicate(_e, { channels: POSITION_SCALE_CHANNELS });
    if (Sn)
      return { defined: { signal: Sn } };
  }
  return {};
}
function allFieldsInvalidPredicate(_e, { invalid: Qt = !1, channels: Zt }) {
  const $n = Zt.reduce((kn, Kn) => {
    var Cr;
    const er = _e.getScaleComponent(Kn);
    if (er) {
      const kr = er.get("type"), Yr = _e.vgField(Kn, { expr: "datum", binSuffix: (Cr = _e.stack) != null && Cr.impute ? "mid" : void 0 });
      Yr && hasContinuousDomain(kr) && (kn[Yr] = !0);
    }
    return kn;
  }, {}), Sn = keys$2($n);
  if (Sn.length > 0) {
    const kn = Qt ? "||" : "&&";
    return Sn.map((Kn) => fieldInvalidPredicate(Kn, Qt)).join(` ${kn} `);
  }
}
function valueIfDefined(_e, Qt) {
  if (Qt !== void 0)
    return { [_e]: signalOrValueRef(Qt) };
}
const VORONOI = "voronoi", nearest = {
  defined: (_e) => _e.type === "point" && _e.nearest,
  parse: (_e, Qt) => {
    if (Qt.events)
      for (const Zt of Qt.events)
        Zt.markname = _e.getName(VORONOI);
  },
  marks: (_e, Qt, Zt) => {
    const { x: $n, y: Sn } = Qt.project.hasChannel, kn = _e.mark;
    if (isPathMark(kn))
      return warn$1(nearestNotSupportForContinuous(kn)), Zt;
    const Kn = {
      name: _e.getName(VORONOI),
      type: "path",
      interactive: !0,
      from: { data: _e.getName("marks") },
      encode: {
        update: {
          fill: { value: "transparent" },
          strokeWidth: { value: 0.35 },
          stroke: { value: "transparent" },
          isVoronoi: { value: !0 },
          ...tooltip(_e, { reactiveGeom: !0 })
        }
      },
      transform: [
        {
          type: "voronoi",
          x: { expr: $n || !Sn ? "datum.datum.x || 0" : "0" },
          y: { expr: Sn || !$n ? "datum.datum.y || 0" : "0" },
          size: [_e.getSizeSignalRef("width"), _e.getSizeSignalRef("height")]
        }
      ]
    };
    let er = 0, Cr = !1;
    return Zt.forEach((kr, Yr) => {
      const Ms = kr.name ?? "";
      Ms === _e.component.mark[0].name ? er = Yr : Ms.indexOf(VORONOI) >= 0 && (Cr = !0);
    }), Cr || Zt.splice(er + 1, 0, Kn), Zt;
  }
}, inputBindings = {
  defined: (_e) => _e.type === "point" && _e.resolve === "global" && _e.bind && _e.bind !== "scales" && !isLegendBinding(_e.bind),
  parse: (_e, Qt, Zt) => disableDirectManipulation(Qt, Zt),
  topLevelSignals: (_e, Qt, Zt) => {
    const $n = Qt.name, Sn = Qt.project, kn = Qt.bind, Kn = Qt.init && Qt.init[0], er = nearest.defined(Qt) ? "(item().isVoronoi ? datum.datum : datum)" : "datum";
    return Sn.items.forEach((Cr, kr) => {
      const Yr = varName(`${$n}_${Cr.field}`);
      Zt.filter((Ds) => Ds.name === Yr).length || Zt.unshift({
        name: Yr,
        ...Kn ? { init: assembleInit(Kn[kr]) } : { value: null },
        on: Qt.events ? [
          {
            events: Qt.events,
            update: `datum && item().mark.marktype !== 'group' ? ${er}[${$(Cr.field)}] : null`
          }
        ] : [],
        bind: kn[Cr.field] ?? kn[Cr.channel] ?? kn
      });
    }), Zt;
  },
  signals: (_e, Qt, Zt) => {
    const $n = Qt.name, Sn = Qt.project, kn = Zt.filter((kr) => kr.name === $n + TUPLE)[0], Kn = $n + TUPLE_FIELDS, er = Sn.items.map((kr) => varName(`${$n}_${kr.field}`)), Cr = er.map((kr) => `${kr} !== null`).join(" && ");
    return er.length && (kn.update = `${Cr} ? {fields: ${Kn}, values: [${er.join(", ")}]} : null`), delete kn.value, delete kn.on, Zt;
  }
}, TOGGLE = "_toggle", toggle = {
  defined: (_e) => _e.type === "point" && !!_e.toggle,
  signals: (_e, Qt, Zt) => Zt.concat({
    name: Qt.name + TOGGLE,
    value: !1,
    on: [{ events: Qt.events, update: Qt.toggle }]
  }),
  modifyExpr: (_e, Qt) => {
    const Zt = Qt.name + TUPLE, $n = Qt.name + TOGGLE;
    return `${$n} ? null : ${Zt}, ` + (Qt.resolve === "global" ? `${$n} ? null : true, ` : `${$n} ? null : {unit: ${unitName(_e)}}, `) + `${$n} ? ${Zt} : null`;
  }
}, clear = {
  defined: (_e) => _e.clear !== void 0 && _e.clear !== !1,
  parse: (_e, Qt) => {
    Qt.clear && (Qt.clear = isString(Qt.clear) ? eventSelector(Qt.clear, "view") : Qt.clear);
  },
  topLevelSignals: (_e, Qt, Zt) => {
    if (inputBindings.defined(Qt))
      for (const $n of Qt.project.items) {
        const Sn = Zt.findIndex((kn) => kn.name === varName(`${Qt.name}_${$n.field}`));
        Sn !== -1 && Zt[Sn].on.push({ events: Qt.clear, update: "null" });
      }
    return Zt;
  },
  signals: (_e, Qt, Zt) => {
    function $n(Sn, kn) {
      Sn !== -1 && Zt[Sn].on && Zt[Sn].on.push({ events: Qt.clear, update: kn });
    }
    if (Qt.type === "interval")
      for (const Sn of Qt.project.items) {
        const kn = Zt.findIndex((Kn) => Kn.name === Sn.signals.visual);
        if ($n(kn, "[0, 0]"), kn === -1) {
          const Kn = Zt.findIndex((er) => er.name === Sn.signals.data);
          $n(Kn, "null");
        }
      }
    else {
      let Sn = Zt.findIndex((kn) => kn.name === Qt.name + TUPLE);
      $n(Sn, "null"), toggle.defined(Qt) && (Sn = Zt.findIndex((kn) => kn.name === Qt.name + TOGGLE), $n(Sn, "false"));
    }
    return Zt;
  }
}, legendBindings = {
  defined: (_e) => {
    const Qt = _e.resolve === "global" && _e.bind && isLegendBinding(_e.bind), Zt = _e.project.items.length === 1 && _e.project.items[0].field !== SELECTION_ID;
    return Qt && !Zt && warn$1(LEGEND_BINDINGS_MUST_HAVE_PROJECTION), Qt && Zt;
  },
  parse: (_e, Qt, Zt) => {
    const $n = duplicate(Zt);
    if ($n.select = isString($n.select) ? { type: $n.select, toggle: Qt.toggle } : { ...$n.select, toggle: Qt.toggle }, disableDirectManipulation(Qt, $n), isObject(Zt.select) && (Zt.select.on || Zt.select.clear)) {
      const Kn = 'event.item && indexof(event.item.mark.role, "legend") < 0';
      for (const er of Qt.events)
        er.filter = array$6(er.filter ?? []), er.filter.includes(Kn) || er.filter.push(Kn);
    }
    const Sn = isLegendStreamBinding(Qt.bind) ? Qt.bind.legend : "click", kn = isString(Sn) ? eventSelector(Sn, "view") : array$6(Sn);
    Qt.bind = { legend: { merge: kn } };
  },
  topLevelSignals: (_e, Qt, Zt) => {
    const $n = Qt.name, Sn = isLegendStreamBinding(Qt.bind) && Qt.bind.legend, kn = (Kn) => (er) => {
      const Cr = duplicate(er);
      return Cr.markname = Kn, Cr;
    };
    for (const Kn of Qt.project.items) {
      if (!Kn.hasLegend)
        continue;
      const er = `${varName(Kn.field)}_legend`, Cr = `${$n}_${er}`;
      if (Zt.filter((Yr) => Yr.name === Cr).length === 0) {
        const Yr = Sn.merge.map(kn(`${er}_symbols`)).concat(Sn.merge.map(kn(`${er}_labels`))).concat(Sn.merge.map(kn(`${er}_entries`)));
        Zt.unshift({
          name: Cr,
          ...Qt.init ? {} : { value: null },
          on: [
            // Legend entries do not store values, so we need to walk the scenegraph to the symbol datum.
            {
              events: Yr,
              update: "isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",
              force: !0
            },
            { events: Sn.merge, update: `!event.item || !datum ? null : ${Cr}`, force: !0 }
          ]
        });
      }
    }
    return Zt;
  },
  signals: (_e, Qt, Zt) => {
    const $n = Qt.name, Sn = Qt.project, kn = Zt.find((Ds) => Ds.name === $n + TUPLE), Kn = $n + TUPLE_FIELDS, er = Sn.items.filter((Ds) => Ds.hasLegend).map((Ds) => varName(`${$n}_${varName(Ds.field)}_legend`)), kr = `${er.map((Ds) => `${Ds} !== null`).join(" && ")} ? {fields: ${Kn}, values: [${er.join(", ")}]} : null`;
    Qt.events && er.length > 0 ? kn.on.push({
      events: er.map((Ds) => ({ signal: Ds })),
      update: kr
    }) : er.length > 0 && (kn.update = kr, delete kn.value, delete kn.on);
    const Yr = Zt.find((Ds) => Ds.name === $n + TOGGLE), Ms = isLegendStreamBinding(Qt.bind) && Qt.bind.legend;
    return Yr && (Qt.events ? Yr.on.push({ ...Yr.on[0], events: Ms }) : Yr.on[0].events = Ms), Zt;
  }
};
function parseInteractiveLegend(_e, Qt, Zt) {
  var Sn;
  const $n = (Sn = _e.fieldDef(Qt)) == null ? void 0 : Sn.field;
  for (const kn of vals(_e.component.selection ?? {})) {
    const Kn = kn.project.hasField[$n] ?? kn.project.hasChannel[Qt];
    if (Kn && legendBindings.defined(kn)) {
      const er = Zt.get("selections") ?? [];
      er.push(kn.name), Zt.set("selections", er, !1), Kn.hasLegend = !0;
    }
  }
}
const ANCHOR$1 = "_translate_anchor", DELTA$1 = "_translate_delta", translate = {
  defined: (_e) => _e.type === "interval" && _e.translate,
  signals: (_e, Qt, Zt) => {
    const $n = Qt.name, Sn = scaleBindings.defined(Qt), kn = $n + ANCHOR$1, { x: Kn, y: er } = Qt.project.hasChannel;
    let Cr = eventSelector(Qt.translate, "scope");
    return Sn || (Cr = Cr.map((kr) => (kr.between[0].markname = $n + BRUSH, kr))), Zt.push({
      name: kn,
      value: {},
      on: [
        {
          events: Cr.map((kr) => kr.between[0]),
          update: "{x: x(unit), y: y(unit)" + (Kn !== void 0 ? `, extent_x: ${Sn ? domain(_e, X$1) : `slice(${Kn.signals.visual})`}` : "") + (er !== void 0 ? `, extent_y: ${Sn ? domain(_e, Y$1) : `slice(${er.signals.visual})`}` : "") + "}"
        }
      ]
    }, {
      name: $n + DELTA$1,
      value: {},
      on: [
        {
          events: Cr,
          update: `{x: ${kn}.x - x(unit), y: ${kn}.y - y(unit)}`
        }
      ]
    }), Kn !== void 0 && onDelta$1(_e, Qt, Kn, "width", Zt), er !== void 0 && onDelta$1(_e, Qt, er, "height", Zt), Zt;
  }
};
function onDelta$1(_e, Qt, Zt, $n, Sn) {
  const kn = Qt.name, Kn = kn + ANCHOR$1, er = kn + DELTA$1, Cr = Zt.channel, kr = scaleBindings.defined(Qt), Yr = Sn.filter((El) => El.name === Zt.signals[kr ? "data" : "visual"])[0], Ms = _e.getSizeSignalRef($n).signal, Ds = _e.getScaleComponent(Cr), Ls = Ds && Ds.get("type"), js = Ds && Ds.get("reverse"), zs = kr ? Cr === X$1 ? js ? "" : "-" : js ? "-" : "" : "", Fs = `${Kn}.extent_${Cr}`, Bs = `${zs}${er}.${Cr} / ${kr ? `${Ms}` : `span(${Fs})`}`, Hs = !kr || !Ds ? "panLinear" : Ls === "log" ? "panLog" : Ls === "symlog" ? "panSymlog" : Ls === "pow" ? "panPow" : "panLinear", Ws = kr ? Ls === "pow" ? `, ${Ds.get("exponent") ?? 1}` : Ls === "symlog" ? `, ${Ds.get("constant") ?? 1}` : "" : "", Ys = `${Hs}(${Fs}, ${Bs}${Ws})`;
  Yr.on.push({
    events: { signal: er },
    update: kr ? Ys : `clampRange(${Ys}, 0, ${Ms})`
  });
}
const ANCHOR = "_zoom_anchor", DELTA = "_zoom_delta", zoom$1 = {
  defined: (_e) => _e.type === "interval" && _e.zoom,
  signals: (_e, Qt, Zt) => {
    const $n = Qt.name, Sn = scaleBindings.defined(Qt), kn = $n + DELTA, { x: Kn, y: er } = Qt.project.hasChannel, Cr = $(_e.scaleName(X$1)), kr = $(_e.scaleName(Y$1));
    let Yr = eventSelector(Qt.zoom, "scope");
    return Sn || (Yr = Yr.map((Ms) => (Ms.markname = $n + BRUSH, Ms))), Zt.push({
      name: $n + ANCHOR,
      on: [
        {
          events: Yr,
          update: Sn ? "{" + [Cr ? `x: invert(${Cr}, x(unit))` : "", kr ? `y: invert(${kr}, y(unit))` : ""].filter((Ms) => Ms).join(", ") + "}" : "{x: x(unit), y: y(unit)}"
        }
      ]
    }, {
      name: kn,
      on: [
        {
          events: Yr,
          force: !0,
          update: "pow(1.001, event.deltaY * pow(16, event.deltaMode))"
        }
      ]
    }), Kn !== void 0 && onDelta(_e, Qt, Kn, "width", Zt), er !== void 0 && onDelta(_e, Qt, er, "height", Zt), Zt;
  }
};
function onDelta(_e, Qt, Zt, $n, Sn) {
  const kn = Qt.name, Kn = Zt.channel, er = scaleBindings.defined(Qt), Cr = Sn.filter((Hs) => Hs.name === Zt.signals[er ? "data" : "visual"])[0], kr = _e.getSizeSignalRef($n).signal, Yr = _e.getScaleComponent(Kn), Ms = Yr && Yr.get("type"), Ds = er ? domain(_e, Kn) : Cr.name, Ls = kn + DELTA, js = `${kn}${ANCHOR}.${Kn}`, zs = !er || !Yr ? "zoomLinear" : Ms === "log" ? "zoomLog" : Ms === "symlog" ? "zoomSymlog" : Ms === "pow" ? "zoomPow" : "zoomLinear", Fs = er ? Ms === "pow" ? `, ${Yr.get("exponent") ?? 1}` : Ms === "symlog" ? `, ${Yr.get("constant") ?? 1}` : "" : "", Bs = `${zs}(${Ds}, ${js}, ${Ls}${Fs})`;
  Cr.on.push({
    events: { signal: Ls },
    update: er ? Bs : `clampRange(${Bs}, 0, ${kr})`
  });
}
const STORE = "_store", TUPLE = "_tuple", MODIFY = "_modify", VL_SELECTION_RESOLVE = "vlSelectionResolve", selectionCompilers = [
  point$1,
  interval,
  project,
  toggle,
  // Bindings may disable direct manipulation.
  inputBindings,
  scaleBindings,
  legendBindings,
  clear,
  translate,
  zoom$1,
  nearest
];
function getFacetModel(_e) {
  let Qt = _e.parent;
  for (; Qt && !isFacetModel(Qt); )
    Qt = Qt.parent;
  return Qt;
}
function unitName(_e, { escape: Qt } = { escape: !0 }) {
  let Zt = Qt ? $(_e.name) : _e.name;
  const $n = getFacetModel(_e);
  if ($n) {
    const { facet: Sn } = $n;
    for (const kn of FACET_CHANNELS)
      Sn[kn] && (Zt += ` + '__facet_${kn}_' + (facet[${$($n.vgField(kn))}])`);
  }
  return Zt;
}
function requiresSelectionId(_e) {
  return vals(_e.component.selection ?? {}).reduce((Qt, Zt) => Qt || Zt.project.hasSelectionId, !1);
}
function disableDirectManipulation(_e, Qt) {
  (isString(Qt.select) || !Qt.select.on) && delete _e.events, (isString(Qt.select) || !Qt.select.clear) && delete _e.clear, (isString(Qt.select) || !Qt.select.toggle) && delete _e.toggle;
}
function getName(_e) {
  const Qt = [];
  return _e.type === "Identifier" ? [_e.name] : _e.type === "Literal" ? [_e.value] : (_e.type === "MemberExpression" && (Qt.push(...getName(_e.object)), Qt.push(...getName(_e.property))), Qt);
}
function startsWithDatum(_e) {
  return _e.object.type === "MemberExpression" ? startsWithDatum(_e.object) : _e.object.name === "datum";
}
function getDependentFields(_e) {
  const Qt = parser$1(_e), Zt = /* @__PURE__ */ new Set();
  return Qt.visit(($n) => {
    $n.type === "MemberExpression" && startsWithDatum($n) && Zt.add(getName($n).slice(1).join("."));
  }), Zt;
}
class FilterNode extends DataFlowNode {
  clone() {
    return new FilterNode(null, this.model, duplicate(this.filter));
  }
  constructor(Qt, Zt, $n) {
    super(Qt), this.model = Zt, this.filter = $n, this.expr = expression$1(this.model, this.filter, this), this._dependentFields = getDependentFields(this.expr);
  }
  dependentFields() {
    return this._dependentFields;
  }
  producedFields() {
    return /* @__PURE__ */ new Set();
  }
  assemble() {
    return {
      type: "filter",
      expr: this.expr
    };
  }
  hash() {
    return `Filter ${this.expr}`;
  }
}
function parseUnitSelection(_e, Qt) {
  const Zt = {}, $n = _e.config.selection;
  if (!Qt || !Qt.length)
    return Zt;
  for (const Sn of Qt) {
    const kn = varName(Sn.name), Kn = Sn.select, er = isString(Kn) ? Kn : Kn.type, Cr = isObject(Kn) ? duplicate(Kn) : { type: er }, kr = $n[er];
    for (const Ds in kr)
      Ds === "fields" || Ds === "encodings" || (Ds === "mark" && (Cr[Ds] = { ...kr[Ds], ...Cr[Ds] }), (Cr[Ds] === void 0 || Cr[Ds] === !0) && (Cr[Ds] = duplicate(kr[Ds] ?? Cr[Ds])));
    const Yr = Zt[kn] = {
      ...Cr,
      name: kn,
      type: er,
      init: Sn.value,
      bind: Sn.bind,
      events: isString(Cr.on) ? eventSelector(Cr.on, "scope") : array$6(duplicate(Cr.on))
    }, Ms = duplicate(Sn);
    for (const Ds of selectionCompilers)
      Ds.defined(Yr) && Ds.parse && Ds.parse(_e, Yr, Ms);
  }
  return Zt;
}
function parseSelectionPredicate(_e, Qt, Zt, $n = "datum") {
  const Sn = isString(Qt) ? Qt : Qt.param, kn = varName(Sn), Kn = $(kn + STORE);
  let er;
  try {
    er = _e.getSelectionComponent(kn, Sn);
  } catch {
    return `!!${kn}`;
  }
  if (er.project.timeUnit) {
    const Ds = Zt ?? _e.component.data.raw, Ls = er.project.timeUnit.clone();
    Ds.parent ? Ls.insertAsParentOf(Ds) : Ds.parent = Ls;
  }
  const Cr = er.project.hasSelectionId ? "vlSelectionIdTest(" : "vlSelectionTest(", kr = er.resolve === "global" ? ")" : `, ${$(er.resolve)})`, Yr = `${Cr}${Kn}, ${$n}${kr}`, Ms = `length(data(${Kn}))`;
  return Qt.empty === !1 ? `${Ms} && ${Yr}` : `!${Ms} || ${Yr}`;
}
function parseSelectionExtent(_e, Qt, Zt) {
  const $n = varName(Qt), Sn = Zt.encoding;
  let kn = Zt.field, Kn;
  try {
    Kn = _e.getSelectionComponent($n, Qt);
  } catch {
    return $n;
  }
  if (!Sn && !kn)
    kn = Kn.project.items[0].field, Kn.project.items.length > 1 && warn$1(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${$(kn)}.`);
  else if (Sn && !kn) {
    const er = Kn.project.items.filter((Cr) => Cr.channel === Sn);
    !er.length || er.length > 1 ? (kn = Kn.project.items[0].field, warn$1((er.length ? "Multiple " : "No ") + `matching ${$(Sn)} encoding found for selection ${$(Zt.param)}. Using "field": ${$(kn)}.`)) : kn = er[0].field;
  }
  return `${Kn.name}[${$(replacePathInField(kn))}]`;
}
function materializeSelections(_e, Qt) {
  for (const [Zt, $n] of entries$1(_e.component.selection ?? {})) {
    const Sn = _e.getName(`lookup_${Zt}`);
    _e.component.data.outputNodes[Sn] = $n.materialized = new OutputNode(new FilterNode(Qt, _e, { param: Zt }), Sn, DataSourceType.Lookup, _e.component.data.outputNodeRefCounts);
  }
}
function expression$1(_e, Qt, Zt) {
  return logicalExpr(Qt, ($n) => isString($n) ? $n : isSelectionPredicate($n) ? parseSelectionPredicate(_e, $n, Zt) : fieldFilterExpression($n));
}
function assembleTitle(_e, Qt) {
  if (_e)
    return isArray(_e) && !isText(_e) ? _e.map((Zt) => defaultTitle(Zt, Qt)).join(", ") : _e;
}
function setAxisEncode(_e, Qt, Zt, $n) {
  var Sn, kn;
  _e.encode ?? (_e.encode = {}), (Sn = _e.encode)[Qt] ?? (Sn[Qt] = {}), (kn = _e.encode[Qt]).update ?? (kn.update = {}), _e.encode[Qt].update[Zt] = $n;
}
function assembleAxis(_e, Qt, Zt, $n = { header: !1 }) {
  var Ms, Ds;
  const { disable: Sn, orient: kn, scale: Kn, labelExpr: er, title: Cr, zindex: kr, ...Yr } = _e.combine();
  if (!Sn) {
    for (const Ls in Yr) {
      const js = AXIS_PROPERTY_TYPE[Ls], zs = Yr[Ls];
      if (js && js !== Qt && js !== "both")
        delete Yr[Ls];
      else if (isConditionalAxisValue(zs)) {
        const { condition: Fs, ...Bs } = zs, Hs = array$6(Fs), Ws = CONDITIONAL_AXIS_PROP_INDEX[Ls];
        if (Ws) {
          const { vgProp: Ys, part: El } = Ws, Mu = [
            ...Hs.map((Pl) => {
              const { test: Iu, ...Tu } = Pl;
              return {
                test: expression$1(null, Iu),
                ...Tu
              };
            }),
            Bs
          ];
          setAxisEncode(Yr, El, Ys, Mu), delete Yr[Ls];
        } else if (Ws === null) {
          const Ys = {
            signal: Hs.map((El) => {
              const { test: Mu, ...Pl } = El;
              return `${expression$1(null, Mu)} ? ${exprFromValueRefOrSignalRef(Pl)} : `;
            }).join("") + exprFromValueRefOrSignalRef(Bs)
          };
          Yr[Ls] = Ys;
        }
      } else if (isSignalRef(zs)) {
        const Fs = CONDITIONAL_AXIS_PROP_INDEX[Ls];
        if (Fs) {
          const { vgProp: Bs, part: Hs } = Fs;
          setAxisEncode(Yr, Hs, Bs, zs), delete Yr[Ls];
        }
      }
      contains$1(["labelAlign", "labelBaseline"], Ls) && Yr[Ls] === null && delete Yr[Ls];
    }
    if (Qt === "grid") {
      if (!Yr.grid)
        return;
      if (Yr.encode) {
        const { grid: Ls } = Yr.encode;
        Yr.encode = {
          ...Ls ? { grid: Ls } : {}
        }, isEmpty(Yr.encode) && delete Yr.encode;
      }
      return {
        scale: Kn,
        orient: kn,
        ...Yr,
        domain: !1,
        labels: !1,
        aria: !1,
        // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent`
        // would not affect gridAxis
        maxExtent: 0,
        minExtent: 0,
        ticks: !1,
        zindex: getFirstDefined(kr, 0)
        // put grid behind marks by default
      };
    } else {
      if (!$n.header && _e.mainExtracted)
        return;
      if (er !== void 0) {
        let js = er;
        (Ds = (Ms = Yr.encode) == null ? void 0 : Ms.labels) != null && Ds.update && isSignalRef(Yr.encode.labels.update.text) && (js = replaceAll(er, "datum.label", Yr.encode.labels.update.text.signal)), setAxisEncode(Yr, "labels", "text", { signal: js });
      }
      if (Yr.labelAlign === null && delete Yr.labelAlign, Yr.encode) {
        for (const js of AXIS_PARTS)
          _e.hasAxisPart(js) || delete Yr.encode[js];
        isEmpty(Yr.encode) && delete Yr.encode;
      }
      const Ls = assembleTitle(Cr, Zt);
      return {
        scale: Kn,
        orient: kn,
        grid: !1,
        ...Ls ? { title: Ls } : {},
        ...Yr,
        ...Zt.aria === !1 ? { aria: !1 } : {},
        zindex: getFirstDefined(kr, 0)
        // put axis line above marks by default
      };
    }
  }
}
function assembleAxisSignals(_e) {
  const { axes: Qt } = _e.component, Zt = [];
  for (const $n of POSITION_SCALE_CHANNELS)
    if (Qt[$n]) {
      for (const Sn of Qt[$n])
        if (!Sn.get("disable") && !Sn.get("gridScale")) {
          const kn = $n === "x" ? "height" : "width", Kn = _e.getSizeSignalRef(kn).signal;
          kn !== Kn && Zt.push({
            name: kn,
            update: Kn
          });
        }
    }
  return Zt;
}
function assembleAxes(_e, Qt) {
  const { x: Zt = [], y: $n = [] } = _e;
  return [
    ...Zt.map((Sn) => assembleAxis(Sn, "grid", Qt)),
    ...$n.map((Sn) => assembleAxis(Sn, "grid", Qt)),
    ...Zt.map((Sn) => assembleAxis(Sn, "main", Qt)),
    ...$n.map((Sn) => assembleAxis(Sn, "main", Qt))
  ].filter((Sn) => Sn);
}
function getAxisConfigFromConfigTypes(_e, Qt, Zt, $n) {
  return Object.assign.apply(null, [
    {},
    ..._e.map((Sn) => {
      if (Sn === "axisOrient") {
        const kn = Zt === "x" ? "bottom" : "left", Kn = Qt[Zt === "x" ? "axisBottom" : "axisLeft"] || {}, er = Qt[Zt === "x" ? "axisTop" : "axisRight"] || {}, Cr = /* @__PURE__ */ new Set([...keys$2(Kn), ...keys$2(er)]), kr = {};
        for (const Yr of Cr.values())
          kr[Yr] = {
            // orient is surely signal in this case
            signal: `${$n.signal} === "${kn}" ? ${signalOrStringValue(Kn[Yr])} : ${signalOrStringValue(er[Yr])}`
          };
        return kr;
      }
      return Qt[Sn];
    })
  ]);
}
function getAxisConfigs(_e, Qt, Zt, $n) {
  const Sn = Qt === "band" ? ["axisDiscrete", "axisBand"] : Qt === "point" ? ["axisDiscrete", "axisPoint"] : isQuantitative(Qt) ? ["axisQuantitative"] : Qt === "time" || Qt === "utc" ? ["axisTemporal"] : [], kn = _e === "x" ? "axisX" : "axisY", Kn = isSignalRef(Zt) ? "axisOrient" : `axis${titleCase(Zt)}`, er = [
    // technically Vega does have axisBand, but if we make another separation here,
    // it will further introduce complexity in the code
    ...Sn,
    ...Sn.map((kr) => kn + kr.substr(4))
  ], Cr = ["axis", Kn, kn];
  return {
    vlOnlyAxisConfig: getAxisConfigFromConfigTypes(er, $n, _e, Zt),
    vgAxisConfig: getAxisConfigFromConfigTypes(Cr, $n, _e, Zt),
    axisConfigStyle: getAxisConfigStyle([...Cr, ...er], $n)
  };
}
function getAxisConfigStyle(_e, Qt) {
  var $n;
  const Zt = [{}];
  for (const Sn of _e) {
    let kn = ($n = Qt[Sn]) == null ? void 0 : $n.style;
    if (kn) {
      kn = array$6(kn);
      for (const Kn of kn)
        Zt.push(Qt.style[Kn]);
    }
  }
  return Object.assign.apply(null, Zt);
}
function getAxisConfig(_e, Qt, Zt, $n = {}) {
  var kn;
  const Sn = getStyleConfig(_e, Zt, Qt);
  if (Sn !== void 0)
    return {
      configFrom: "style",
      configValue: Sn
    };
  for (const Kn of ["vlOnlyAxisConfig", "vgAxisConfig", "axisConfigStyle"])
    if (((kn = $n[Kn]) == null ? void 0 : kn[_e]) !== void 0)
      return { configFrom: Kn, configValue: $n[Kn][_e] };
  return {};
}
const axisRules = {
  scale: ({ model: _e, channel: Qt }) => _e.scaleName(Qt),
  format: ({ format: _e }) => _e,
  formatType: ({ formatType: _e }) => _e,
  grid: ({ fieldOrDatumDef: _e, axis: Qt, scaleType: Zt }) => Qt.grid ?? defaultGrid(Zt, _e),
  gridScale: ({ model: _e, channel: Qt }) => gridScale(_e, Qt),
  labelAlign: ({ axis: _e, labelAngle: Qt, orient: Zt, channel: $n }) => _e.labelAlign || defaultLabelAlign(Qt, Zt, $n),
  labelAngle: ({ labelAngle: _e }) => _e,
  labelBaseline: ({ axis: _e, labelAngle: Qt, orient: Zt, channel: $n }) => _e.labelBaseline || defaultLabelBaseline(Qt, Zt, $n),
  labelFlush: ({ axis: _e, fieldOrDatumDef: Qt, channel: Zt }) => _e.labelFlush ?? defaultLabelFlush(Qt.type, Zt),
  labelOverlap: ({ axis: _e, fieldOrDatumDef: Qt, scaleType: Zt }) => _e.labelOverlap ?? defaultLabelOverlap$1(Qt.type, Zt, isFieldDef(Qt) && !!Qt.timeUnit, isFieldDef(Qt) ? Qt.sort : void 0),
  // we already calculate orient in parse
  orient: ({ orient: _e }) => _e,
  tickCount: ({ channel: _e, model: Qt, axis: Zt, fieldOrDatumDef: $n, scaleType: Sn }) => {
    const kn = _e === "x" ? "width" : _e === "y" ? "height" : void 0, Kn = kn ? Qt.getSizeSignalRef(kn) : void 0;
    return Zt.tickCount ?? defaultTickCount({ fieldOrDatumDef: $n, scaleType: Sn, size: Kn, values: Zt.values });
  },
  tickMinStep: defaultTickMinStep,
  title: ({ axis: _e, model: Qt, channel: Zt }) => {
    if (_e.title !== void 0)
      return _e.title;
    const $n = getFieldDefTitle(Qt, Zt);
    if ($n !== void 0)
      return $n;
    const Sn = Qt.typedFieldDef(Zt), kn = Zt === "x" ? "x2" : "y2", Kn = Qt.fieldDef(kn);
    return mergeTitleFieldDefs(Sn ? [toFieldDefBase(Sn)] : [], isFieldDef(Kn) ? [toFieldDefBase(Kn)] : []);
  },
  values: ({ axis: _e, fieldOrDatumDef: Qt }) => values$1(_e, Qt),
  zindex: ({ axis: _e, fieldOrDatumDef: Qt, mark: Zt }) => _e.zindex ?? defaultZindex(Zt, Qt)
};
function defaultGrid(_e, Qt) {
  return !hasDiscreteDomain(_e) && isFieldDef(Qt) && !isBinning(Qt == null ? void 0 : Qt.bin) && !isBinned(Qt == null ? void 0 : Qt.bin);
}
function gridScale(_e, Qt) {
  const Zt = Qt === "x" ? "y" : "x";
  if (_e.getScaleComponent(Zt))
    return _e.scaleName(Zt);
}
function getLabelAngle(_e, Qt, Zt, $n, Sn) {
  const kn = Qt == null ? void 0 : Qt.labelAngle;
  if (kn !== void 0)
    return isSignalRef(kn) ? kn : normalizeAngle(kn);
  {
    const { configValue: Kn } = getAxisConfig("labelAngle", $n, Qt == null ? void 0 : Qt.style, Sn);
    return Kn !== void 0 ? normalizeAngle(Kn) : Zt === X$1 && contains$1([NOMINAL, ORDINAL], _e.type) && !(isFieldDef(_e) && _e.timeUnit) ? 270 : void 0;
  }
}
function normalizeAngleExpr(_e) {
  return `(((${_e.signal} % 360) + 360) % 360)`;
}
function defaultLabelBaseline(_e, Qt, Zt, $n) {
  if (_e !== void 0)
    if (Zt === "x") {
      if (isSignalRef(_e)) {
        const Sn = normalizeAngleExpr(_e), kn = isSignalRef(Qt) ? `(${Qt.signal} === "top")` : Qt === "top";
        return {
          signal: `(45 < ${Sn} && ${Sn} < 135) || (225 < ${Sn} && ${Sn} < 315) ? "middle" :(${Sn} <= 45 || 315 <= ${Sn}) === ${kn} ? "bottom" : "top"`
        };
      }
      if (45 < _e && _e < 135 || 225 < _e && _e < 315)
        return "middle";
      if (isSignalRef(Qt)) {
        const Sn = _e <= 45 || 315 <= _e ? "===" : "!==";
        return { signal: `${Qt.signal} ${Sn} "top" ? "bottom" : "top"` };
      }
      return (_e <= 45 || 315 <= _e) == (Qt === "top") ? "bottom" : "top";
    } else {
      if (isSignalRef(_e)) {
        const Sn = normalizeAngleExpr(_e), kn = isSignalRef(Qt) ? `(${Qt.signal} === "left")` : Qt === "left";
        return {
          signal: `${Sn} <= 45 || 315 <= ${Sn} || (135 <= ${Sn} && ${Sn} <= 225) ? ${$n ? '"middle"' : "null"} : (45 <= ${Sn} && ${Sn} <= 135) === ${kn} ? "top" : "bottom"`
        };
      }
      if (_e <= 45 || 315 <= _e || 135 <= _e && _e <= 225)
        return $n ? "middle" : null;
      if (isSignalRef(Qt)) {
        const Sn = 45 <= _e && _e <= 135 ? "===" : "!==";
        return { signal: `${Qt.signal} ${Sn} "left" ? "top" : "bottom"` };
      }
      return (45 <= _e && _e <= 135) == (Qt === "left") ? "top" : "bottom";
    }
}
function defaultLabelAlign(_e, Qt, Zt) {
  if (_e === void 0)
    return;
  const $n = Zt === "x", Sn = $n ? 0 : 90, kn = $n ? "bottom" : "left";
  if (isSignalRef(_e)) {
    const Kn = normalizeAngleExpr(_e), er = isSignalRef(Qt) ? `(${Qt.signal} === "${kn}")` : Qt === kn;
    return {
      signal: `(${Sn ? `(${Kn} + 90)` : Kn} % 180 === 0) ? ${$n ? null : '"center"'} :(${Sn} < ${Kn} && ${Kn} < ${180 + Sn}) === ${er} ? "left" : "right"`
    };
  }
  if ((_e + Sn) % 180 === 0)
    return $n ? null : "center";
  if (isSignalRef(Qt)) {
    const Kn = Sn < _e && _e < 180 + Sn ? "===" : "!==";
    return {
      signal: `${`${Qt.signal} ${Kn} "${kn}"`} ? "left" : "right"`
    };
  }
  return (Sn < _e && _e < 180 + Sn) == (Qt === kn) ? "left" : "right";
}
function defaultLabelFlush(_e, Qt) {
  if (Qt === "x" && contains$1(["quantitative", "temporal"], _e))
    return !0;
}
function defaultLabelOverlap$1(_e, Qt, Zt, $n) {
  if (Zt && !isObject($n) || _e !== "nominal" && _e !== "ordinal")
    return Qt === "log" || Qt === "symlog" ? "greedy" : !0;
}
function defaultOrient(_e) {
  return _e === "x" ? "bottom" : "left";
}
function defaultTickCount({ fieldOrDatumDef: _e, scaleType: Qt, size: Zt, values: $n }) {
  var Sn;
  if (!$n && !hasDiscreteDomain(Qt) && Qt !== "log") {
    if (isFieldDef(_e)) {
      if (isBinning(_e.bin))
        return { signal: `ceil(${Zt.signal}/10)` };
      if (_e.timeUnit && contains$1(["month", "hours", "day", "quarter"], (Sn = normalizeTimeUnit(_e.timeUnit)) == null ? void 0 : Sn.unit))
        return;
    }
    return { signal: `ceil(${Zt.signal}/40)` };
  }
}
function defaultTickMinStep({ format: _e, fieldOrDatumDef: Qt }) {
  if (_e === "d")
    return 1;
  if (isFieldDef(Qt)) {
    const { timeUnit: Zt } = Qt;
    if (Zt) {
      const $n = durationExpr(Zt);
      if ($n)
        return { signal: $n };
    }
  }
}
function getFieldDefTitle(_e, Qt) {
  const Zt = Qt === "x" ? "x2" : "y2", $n = _e.fieldDef(Qt), Sn = _e.fieldDef(Zt), kn = $n ? $n.title : void 0, Kn = Sn ? Sn.title : void 0;
  if (kn && Kn)
    return mergeTitle(kn, Kn);
  if (kn)
    return kn;
  if (Kn)
    return Kn;
  if (kn !== void 0)
    return kn;
  if (Kn !== void 0)
    return Kn;
}
function values$1(_e, Qt) {
  const Zt = _e.values;
  if (isArray(Zt))
    return valueArray(Qt, Zt);
  if (isSignalRef(Zt))
    return Zt;
}
function defaultZindex(_e, Qt) {
  return _e === "rect" && isDiscrete(Qt) ? 1 : 0;
}
class CalculateNode extends DataFlowNode {
  clone() {
    return new CalculateNode(null, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt, this._dependentFields = getDependentFields(this.transform.calculate);
  }
  static parseAllForSortIndex(Qt, Zt) {
    return Zt.forEachFieldDef(($n, Sn) => {
      if (isScaleFieldDef($n) && isSortArray($n.sort)) {
        const { field: kn, timeUnit: Kn } = $n, er = $n.sort, Cr = er.map((kr, Yr) => `${fieldFilterExpression({ field: kn, timeUnit: Kn, equal: kr })} ? ${Yr} : `).join("") + er.length;
        Qt = new CalculateNode(Qt, {
          calculate: Cr,
          as: sortArrayIndexField($n, Sn, { forAs: !0 })
        });
      }
    }), Qt;
  }
  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 ${hash(this.transform)}`;
  }
}
function sortArrayIndexField(_e, Qt, Zt) {
  return vgField(_e, { prefix: Qt, suffix: "sort_index", ...Zt ?? {} });
}
function getHeaderChannel(_e, Qt) {
  return contains$1(["top", "bottom"], Qt) ? "column" : contains$1(["left", "right"], Qt) || _e === "row" ? "row" : "column";
}
function getHeaderProperty(_e, Qt, Zt, $n) {
  const Sn = $n === "row" ? Zt.headerRow : $n === "column" ? Zt.headerColumn : Zt.headerFacet;
  return getFirstDefined((Qt || {})[_e], Sn[_e], Zt.header[_e]);
}
function getHeaderProperties(_e, Qt, Zt, $n) {
  const Sn = {};
  for (const kn of _e) {
    const Kn = getHeaderProperty(kn, Qt || {}, Zt, $n);
    Kn !== void 0 && (Sn[kn] = Kn);
  }
  return Sn;
}
const HEADER_CHANNELS = ["row", "column"], HEADER_TYPES = ["header", "footer"];
function assembleTitleGroup(_e, Qt) {
  const Zt = _e.component.layoutHeaders[Qt].title, $n = _e.config ? _e.config : void 0, Sn = _e.component.layoutHeaders[Qt].facetFieldDef ? _e.component.layoutHeaders[Qt].facetFieldDef : void 0, { titleAnchor: kn, titleAngle: Kn, titleOrient: er } = getHeaderProperties(["titleAnchor", "titleAngle", "titleOrient"], Sn.header, $n, Qt), Cr = getHeaderChannel(Qt, er), kr = normalizeAngle(Kn);
  return {
    name: `${Qt}-title`,
    type: "group",
    role: `${Cr}-title`,
    title: {
      text: Zt,
      ...Qt === "row" ? { orient: "left" } : {},
      style: "guide-title",
      ...defaultHeaderGuideBaseline(kr, Cr),
      ...defaultHeaderGuideAlign(Cr, kr, kn),
      ...assembleHeaderProperties($n, Sn, Qt, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP)
    }
  };
}
function defaultHeaderGuideAlign(_e, Qt, Zt = "middle") {
  switch (Zt) {
    case "start":
      return { align: "left" };
    case "end":
      return { align: "right" };
  }
  const $n = defaultLabelAlign(Qt, _e === "row" ? "left" : "top", _e === "row" ? "y" : "x");
  return $n ? { align: $n } : {};
}
function defaultHeaderGuideBaseline(_e, Qt) {
  const Zt = defaultLabelBaseline(_e, Qt === "row" ? "left" : "top", Qt === "row" ? "y" : "x", !0);
  return Zt ? { baseline: Zt } : {};
}
function assembleHeaderGroups(_e, Qt) {
  const Zt = _e.component.layoutHeaders[Qt], $n = [];
  for (const Sn of HEADER_TYPES)
    if (Zt[Sn])
      for (const kn of Zt[Sn]) {
        const Kn = assembleHeaderGroup(_e, Qt, Sn, Zt, kn);
        Kn != null && $n.push(Kn);
      }
  return $n;
}
function getSort$1(_e, Qt) {
  const { sort: Zt } = _e;
  return isSortField(Zt) ? {
    field: vgField(Zt, { expr: "datum" }),
    order: Zt.order ?? "ascending"
  } : isArray(Zt) ? {
    field: sortArrayIndexField(_e, Qt, { expr: "datum" }),
    order: "ascending"
  } : {
    field: vgField(_e, { expr: "datum" }),
    order: Zt ?? "ascending"
  };
}
function assembleLabelTitle(_e, Qt, Zt) {
  const { format: $n, formatType: Sn, labelAngle: kn, labelAnchor: Kn, labelOrient: er, labelExpr: Cr } = getHeaderProperties(["format", "formatType", "labelAngle", "labelAnchor", "labelOrient", "labelExpr"], _e.header, Zt, Qt), kr = formatSignalRef({
    fieldOrDatumDef: _e,
    format: $n,
    formatType: Sn,
    expr: "parent",
    config: Zt
  }).signal, Yr = getHeaderChannel(Qt, er);
  return {
    text: {
      signal: Cr ? replaceAll(replaceAll(Cr, "datum.label", kr), "datum.value", vgField(_e, { expr: "parent" })) : kr
    },
    ...Qt === "row" ? { orient: "left" } : {},
    style: "guide-label",
    frame: "group",
    ...defaultHeaderGuideBaseline(kn, Yr),
    ...defaultHeaderGuideAlign(Yr, kn, Kn),
    ...assembleHeaderProperties(Zt, _e, Qt, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP)
  };
}
function assembleHeaderGroup(_e, Qt, Zt, $n, Sn) {
  if (Sn) {
    let kn = null;
    const { facetFieldDef: Kn } = $n, er = _e.config ? _e.config : void 0;
    if (Kn && Sn.labels) {
      const { labelOrient: Ms } = getHeaderProperties(["labelOrient"], Kn.header, er, Qt);
      (Qt === "row" && !contains$1(["top", "bottom"], Ms) || Qt === "column" && !contains$1(["left", "right"], Ms)) && (kn = assembleLabelTitle(Kn, Qt, er));
    }
    const Cr = isFacetModel(_e) && !isFacetMapping(_e.facet), kr = Sn.axes, Yr = (kr == null ? void 0 : kr.length) > 0;
    if (kn || Yr) {
      const Ms = Qt === "row" ? "height" : "width";
      return {
        name: _e.getName(`${Qt}_${Zt}`),
        type: "group",
        role: `${Qt}-${Zt}`,
        ...$n.facetFieldDef ? {
          from: { data: _e.getName(`${Qt}_domain`) },
          sort: getSort$1(Kn, Qt)
        } : {},
        ...Yr && Cr ? {
          from: { data: _e.getName(`facet_domain_${Qt}`) }
        } : {},
        ...kn ? { title: kn } : {},
        ...Sn.sizeSignal ? {
          encode: {
            update: {
              [Ms]: Sn.sizeSignal
            }
          }
        } : {},
        ...Yr ? { axes: kr } : {}
      };
    }
  }
  return null;
}
const LAYOUT_TITLE_BAND = {
  column: {
    start: 0,
    end: 1
  },
  row: {
    start: 1,
    end: 0
  }
};
function getLayoutTitleBand(_e, Qt) {
  return LAYOUT_TITLE_BAND[Qt][_e];
}
function assembleLayoutTitleBand(_e, Qt) {
  const Zt = {};
  for (const $n of FACET_CHANNELS) {
    const Sn = _e[$n];
    if (Sn != null && Sn.facetFieldDef) {
      const { titleAnchor: kn, titleOrient: Kn } = getHeaderProperties(["titleAnchor", "titleOrient"], Sn.facetFieldDef.header, Qt, $n), er = getHeaderChannel($n, Kn), Cr = getLayoutTitleBand(kn, er);
      Cr !== void 0 && (Zt[er] = Cr);
    }
  }
  return isEmpty(Zt) ? void 0 : Zt;
}
function assembleHeaderProperties(_e, Qt, Zt, $n, Sn) {
  const kn = {};
  for (const Kn of $n) {
    if (!Sn[Kn])
      continue;
    const er = getHeaderProperty(Kn, Qt == null ? void 0 : Qt.header, _e, Zt);
    er !== void 0 && (kn[Sn[Kn]] = er);
  }
  return kn;
}
function assembleLayoutSignals(_e) {
  return [
    ...sizeSignals(_e, "width"),
    ...sizeSignals(_e, "height"),
    ...sizeSignals(_e, "childWidth"),
    ...sizeSignals(_e, "childHeight")
  ];
}
function sizeSignals(_e, Qt) {
  const Zt = Qt === "width" ? "x" : "y", $n = _e.component.layoutSize.get(Qt);
  if (!$n || $n === "merged")
    return [];
  const Sn = _e.getSizeSignalRef(Qt).signal;
  if ($n === "step") {
    const kn = _e.getScaleComponent(Zt);
    if (kn) {
      const Kn = kn.get("type"), er = kn.get("range");
      if (hasDiscreteDomain(Kn) && isVgRangeStep(er)) {
        const Cr = _e.scaleName(Zt);
        return isFacetModel(_e.parent) && _e.parent.component.resolve.scale[Zt] === "independent" ? [stepSignal(Cr, er)] : [
          stepSignal(Cr, er),
          {
            name: Sn,
            update: sizeExpr(Cr, kn, `domain('${Cr}').length`)
          }
        ];
      }
    }
    throw new Error("layout size is step although width/height is not step.");
  } else if ($n == "container") {
    const kn = Sn.endsWith("width"), Kn = kn ? "containerSize()[0]" : "containerSize()[1]", er = getViewConfigContinuousSize(_e.config.view, kn ? "width" : "height"), Cr = `isFinite(${Kn}) ? ${Kn} : ${er}`;
    return [{ name: Sn, init: Cr, on: [{ update: Cr, events: "window:resize" }] }];
  } else
    return [
      {
        name: Sn,
        value: $n
      }
    ];
}
function stepSignal(_e, Qt) {
  const Zt = `${_e}_step`;
  return isSignalRef(Qt.step) ? { name: Zt, update: Qt.step.signal } : { name: Zt, value: Qt.step };
}
function sizeExpr(_e, Qt, Zt) {
  const $n = Qt.get("type"), Sn = Qt.get("padding"), kn = getFirstDefined(Qt.get("paddingOuter"), Sn);
  let Kn = Qt.get("paddingInner");
  return Kn = $n === "band" ? (
    // only band has real paddingInner
    Kn !== void 0 ? Kn : Sn
  ) : (
    // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128,
    // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points.
    1
  ), `bandspace(${Zt}, ${signalOrStringValue(Kn)}, ${signalOrStringValue(kn)}) * ${_e}_step`;
}
function getSizeTypeFromLayoutSizeType(_e) {
  return _e === "childWidth" ? "width" : _e === "childHeight" ? "height" : _e;
}
function guideEncodeEntry(_e, Qt) {
  return keys$2(_e).reduce((Zt, $n) => {
    const Sn = _e[$n];
    return {
      ...Zt,
      ...wrapCondition(Qt, Sn, $n, (kn) => signalOrValueRef(kn.value))
    };
  }, {});
}
function defaultScaleResolve(_e, Qt) {
  if (isFacetModel(Qt))
    return _e === "theta" ? "independent" : "shared";
  if (isLayerModel(Qt))
    return "shared";
  if (isConcatModel(Qt))
    return isXorY(_e) || _e === "theta" || _e === "radius" ? "independent" : "shared";
  throw new Error("invalid model type for resolve");
}
function parseGuideResolve(_e, Qt) {
  const Zt = _e.scale[Qt], $n = isXorY(Qt) ? "axis" : "legend";
  return Zt === "independent" ? (_e[$n][Qt] === "shared" && warn$1(independentScaleMeansIndependentGuide(Qt)), "independent") : _e[$n][Qt] || "shared";
}
const LEGEND_COMPONENT_PROPERTY_INDEX = {
  ...COMMON_LEGEND_PROPERTY_INDEX,
  disable: 1,
  labelExpr: 1,
  selections: 1,
  // channel scales
  opacity: 1,
  shape: 1,
  stroke: 1,
  fill: 1,
  size: 1,
  strokeWidth: 1,
  strokeDash: 1,
  // encode
  encode: 1
}, LEGEND_COMPONENT_PROPERTIES = keys$2(LEGEND_COMPONENT_PROPERTY_INDEX);
class LegendComponent extends Split {
}
const legendEncodeRules = {
  symbols,
  gradient,
  labels: labels$1,
  entries
};
function symbols(_e, { fieldOrDatumDef: Qt, model: Zt, channel: $n, legendCmpt: Sn, legendType: kn }) {
  if (kn !== "symbol")
    return;
  const { markDef: Kn, encoding: er, config: Cr, mark: kr } = Zt, Yr = Kn.filled && kr !== "trail";
  let Ms = {
    ...applyMarkConfig({}, Zt, FILL_STROKE_CONFIG),
    ...color(Zt, { filled: Yr })
  };
  const Ds = Sn.get("symbolOpacity") ?? Cr.legend.symbolOpacity, Ls = Sn.get("symbolFillColor") ?? Cr.legend.symbolFillColor, js = Sn.get("symbolStrokeColor") ?? Cr.legend.symbolStrokeColor, zs = Ds === void 0 ? getMaxValue(er.opacity) ?? Kn.opacity : void 0;
  if (Ms.fill) {
    if ($n === "fill" || Yr && $n === COLOR)
      delete Ms.fill;
    else if (Ms.fill.field)
      Ls ? delete Ms.fill : (Ms.fill = signalOrValueRef(Cr.legend.symbolBaseFillColor ?? "black"), Ms.fillOpacity = signalOrValueRef(zs ?? 1));
    else if (isArray(Ms.fill)) {
      const Fs = getFirstConditionValue(er.fill ?? er.color) ?? Kn.fill ?? (Yr && Kn.color);
      Fs && (Ms.fill = signalOrValueRef(Fs));
    }
  }
  if (Ms.stroke) {
    if ($n === "stroke" || !Yr && $n === COLOR)
      delete Ms.stroke;
    else if (Ms.stroke.field || js)
      delete Ms.stroke;
    else if (isArray(Ms.stroke)) {
      const Fs = getFirstDefined(getFirstConditionValue(er.stroke || er.color), Kn.stroke, Yr ? Kn.color : void 0);
      Fs && (Ms.stroke = { value: Fs });
    }
  }
  if ($n !== OPACITY) {
    const Fs = isFieldDef(Qt) && selectedCondition(Zt, Sn, Qt);
    Fs ? Ms.opacity = [
      { test: Fs, ...signalOrValueRef(zs ?? 1) },
      signalOrValueRef(Cr.legend.unselectedOpacity)
    ] : zs && (Ms.opacity = signalOrValueRef(zs));
  }
  return Ms = { ...Ms, ..._e }, isEmpty(Ms) ? void 0 : Ms;
}
function gradient(_e, { model: Qt, legendType: Zt, legendCmpt: $n }) {
  if (Zt !== "gradient")
    return;
  const { config: Sn, markDef: kn, encoding: Kn } = Qt;
  let er = {};
  const kr = ($n.get("gradientOpacity") ?? Sn.legend.gradientOpacity) === void 0 ? getMaxValue(Kn.opacity) || kn.opacity : void 0;
  return kr && (er.opacity = signalOrValueRef(kr)), er = { ...er, ..._e }, isEmpty(er) ? void 0 : er;
}
function labels$1(_e, { fieldOrDatumDef: Qt, model: Zt, channel: $n, legendCmpt: Sn }) {
  const kn = Zt.legend($n) || {}, Kn = Zt.config, er = isFieldDef(Qt) ? selectedCondition(Zt, Sn, Qt) : void 0, Cr = er ? [{ test: er, value: 1 }, { value: Kn.legend.unselectedOpacity }] : void 0, { format: kr, formatType: Yr } = kn;
  let Ms;
  isCustomFormatType(Yr) ? Ms = formatCustomType({
    fieldOrDatumDef: Qt,
    field: "datum.value",
    format: kr,
    formatType: Yr,
    config: Kn
  }) : kr === void 0 && Yr === void 0 && Kn.customFormatTypes && (Qt.type === "quantitative" && Kn.numberFormatType ? Ms = formatCustomType({
    fieldOrDatumDef: Qt,
    field: "datum.value",
    format: Kn.numberFormat,
    formatType: Kn.numberFormatType,
    config: Kn
  }) : Qt.type === "temporal" && Kn.timeFormatType && isFieldDef(Qt) && Qt.timeUnit === void 0 && (Ms = formatCustomType({
    fieldOrDatumDef: Qt,
    field: "datum.value",
    format: Kn.timeFormat,
    formatType: Kn.timeFormatType,
    config: Kn
  })));
  const Ds = {
    ...Cr ? { opacity: Cr } : {},
    ...Ms ? { text: Ms } : {},
    ..._e
  };
  return isEmpty(Ds) ? void 0 : Ds;
}
function entries(_e, { legendCmpt: Qt }) {
  const Zt = Qt.get("selections");
  return Zt != null && Zt.length ? { ..._e, fill: { value: "transparent" } } : _e;
}
function getMaxValue(_e) {
  return getConditionValue(_e, (Qt, Zt) => Math.max(Qt, Zt.value));
}
function getFirstConditionValue(_e) {
  return getConditionValue(_e, (Qt, Zt) => getFirstDefined(Qt, Zt.value));
}
function getConditionValue(_e, Qt) {
  if (hasConditionalValueDef(_e))
    return array$6(_e.condition).reduce(Qt, _e.value);
  if (isValueDef(_e))
    return _e.value;
}
function selectedCondition(_e, Qt, Zt) {
  const $n = Qt.get("selections");
  if (!($n != null && $n.length))
    return;
  const Sn = $(Zt.field);
  return $n.map((kn) => `(!length(data(${$(varName(kn) + STORE)})) || (${kn}[${Sn}] && indexof(${kn}[${Sn}], datum.value) >= 0))`).join(" || ");
}
const legendRules = {
  direction: ({ direction: _e }) => _e,
  format: ({ fieldOrDatumDef: _e, legend: Qt, config: Zt }) => {
    const { format: $n, formatType: Sn } = Qt;
    return guideFormat(_e, _e.type, $n, Sn, Zt, !1);
  },
  formatType: ({ legend: _e, fieldOrDatumDef: Qt, scaleType: Zt }) => {
    const { formatType: $n } = _e;
    return guideFormatType($n, Qt, Zt);
  },
  gradientLength: (_e) => {
    const { legend: Qt, legendConfig: Zt } = _e;
    return Qt.gradientLength ?? Zt.gradientLength ?? defaultGradientLength(_e);
  },
  labelOverlap: ({ legend: _e, legendConfig: Qt, scaleType: Zt }) => _e.labelOverlap ?? Qt.labelOverlap ?? defaultLabelOverlap(Zt),
  symbolType: ({ legend: _e, markDef: Qt, channel: Zt, encoding: $n }) => _e.symbolType ?? defaultSymbolType(Qt.type, Zt, $n.shape, Qt.shape),
  title: ({ fieldOrDatumDef: _e, config: Qt }) => title(_e, Qt, { allowDisabling: !0 }),
  type: ({ legendType: _e, scaleType: Qt, channel: Zt }) => {
    if (isColorChannel(Zt) && isContinuousToContinuous(Qt)) {
      if (_e === "gradient")
        return;
    } else if (_e === "symbol")
      return;
    return _e;
  },
  values: ({ fieldOrDatumDef: _e, legend: Qt }) => values(Qt, _e)
};
function values(_e, Qt) {
  const Zt = _e.values;
  if (isArray(Zt))
    return valueArray(Qt, Zt);
  if (isSignalRef(Zt))
    return Zt;
}
function defaultSymbolType(_e, Qt, Zt, $n) {
  if (Qt !== "shape") {
    const Sn = getFirstConditionValue(Zt) ?? $n;
    if (Sn)
      return Sn;
  }
  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 getLegendType(_e) {
  const { legend: Qt } = _e;
  return getFirstDefined(Qt.type, defaultType$1(_e));
}
function defaultType$1({ channel: _e, timeUnit: Qt, scaleType: Zt }) {
  if (isColorChannel(_e)) {
    if (contains$1(["quarter", "month", "day"], Qt))
      return "symbol";
    if (isContinuousToContinuous(Zt))
      return "gradient";
  }
  return "symbol";
}
function getDirection({ legendConfig: _e, legendType: Qt, orient: Zt, legend: $n }) {
  return $n.direction ?? _e[Qt ? "gradientDirection" : "symbolDirection"] ?? defaultDirection(Zt, Qt);
}
function defaultDirection(_e, Qt) {
  switch (_e) {
    case "top":
    case "bottom":
      return "horizontal";
    case "left":
    case "right":
    case "none":
    case void 0:
      return;
    default:
      return Qt === "gradient" ? "horizontal" : void 0;
  }
}
function defaultGradientLength({ legendConfig: _e, model: Qt, direction: Zt, orient: $n, scaleType: Sn }) {
  const { gradientHorizontalMaxLength: kn, gradientHorizontalMinLength: Kn, gradientVerticalMaxLength: er, gradientVerticalMinLength: Cr } = _e;
  if (isContinuousToContinuous(Sn))
    return Zt === "horizontal" ? $n === "top" || $n === "bottom" ? gradientLengthSignal(Qt, "width", Kn, kn) : Kn : gradientLengthSignal(Qt, "height", Cr, er);
}
function gradientLengthSignal(_e, Qt, Zt, $n) {
  return { signal: `clamp(${_e.getSizeSignalRef(Qt).signal}, ${Zt}, ${$n})` };
}
function defaultLabelOverlap(_e) {
  if (contains$1(["quantile", "threshold", "log", "symlog"], _e))
    return "greedy";
}
function parseLegend(_e) {
  const Qt = isUnitModel(_e) ? parseUnitLegend(_e) : parseNonUnitLegend(_e);
  return _e.component.legends = Qt, Qt;
}
function parseUnitLegend(_e) {
  const { encoding: Qt } = _e, Zt = {};
  for (const $n of [COLOR, ...LEGEND_SCALE_CHANNELS]) {
    const Sn = getFieldOrDatumDef(Qt[$n]);
    !Sn || !_e.getScaleComponent($n) || $n === SHAPE && isFieldDef(Sn) && Sn.type === GEOJSON || (Zt[$n] = parseLegendForChannel(_e, $n));
  }
  return Zt;
}
function getLegendDefWithScale(_e, Qt) {
  const Zt = _e.scaleName(Qt);
  if (_e.mark === "trail") {
    if (Qt === "color")
      return { stroke: Zt };
    if (Qt === "size")
      return { strokeWidth: Zt };
  }
  return Qt === "color" ? _e.markDef.filled ? { fill: Zt } : { stroke: Zt } : { [Qt]: Zt };
}
function isExplicit$1(_e, Qt, Zt, $n) {
  switch (Qt) {
    case "disable":
      return Zt !== void 0;
    case "values":
      return !!(Zt != null && Zt.values);
    case "title":
      if (Qt === "title" && _e === ($n == null ? void 0 : $n.title))
        return !0;
  }
  return _e === (Zt || {})[Qt];
}
function parseLegendForChannel(_e, Qt) {
  var Ys;
  let Zt = _e.legend(Qt);
  const { markDef: $n, encoding: Sn, config: kn } = _e, Kn = kn.legend, er = new LegendComponent({}, getLegendDefWithScale(_e, Qt));
  parseInteractiveLegend(_e, Qt, er);
  const Cr = Zt !== void 0 ? !Zt : Kn.disable;
  if (er.set("disable", Cr, Zt !== void 0), Cr)
    return er;
  Zt = Zt || {};
  const kr = _e.getScaleComponent(Qt).get("type"), Yr = getFieldOrDatumDef(Sn[Qt]), Ms = isFieldDef(Yr) ? (Ys = normalizeTimeUnit(Yr.timeUnit)) == null ? void 0 : Ys.unit : void 0, Ds = Zt.orient || kn.legend.orient || "right", Ls = getLegendType({ legend: Zt, channel: Qt, timeUnit: Ms, scaleType: kr }), js = getDirection({ legend: Zt, legendType: Ls, orient: Ds, legendConfig: Kn }), zs = {
    legend: Zt,
    channel: Qt,
    model: _e,
    markDef: $n,
    encoding: Sn,
    fieldOrDatumDef: Yr,
    legendConfig: Kn,
    config: kn,
    scaleType: kr,
    orient: Ds,
    legendType: Ls,
    direction: js
  };
  for (const El of LEGEND_COMPONENT_PROPERTIES) {
    if (Ls === "gradient" && El.startsWith("symbol") || Ls === "symbol" && El.startsWith("gradient"))
      continue;
    const Mu = El in legendRules ? legendRules[El](zs) : Zt[El];
    if (Mu !== void 0) {
      const Pl = isExplicit$1(Mu, El, Zt, _e.fieldDef(Qt));
      (Pl || kn.legend[El] === void 0) && er.set(El, Mu, Pl);
    }
  }
  const Fs = (Zt == null ? void 0 : Zt.encoding) ?? {}, Bs = er.get("selections"), Hs = {}, Ws = { fieldOrDatumDef: Yr, model: _e, channel: Qt, legendCmpt: er, legendType: Ls };
  for (const El of ["labels", "legend", "title", "symbols", "gradient", "entries"]) {
    const Mu = guideEncodeEntry(Fs[El] ?? {}, _e), Pl = El in legendEncodeRules ? legendEncodeRules[El](Mu, Ws) : Mu;
    Pl !== void 0 && !isEmpty(Pl) && (Hs[El] = {
      ...Bs != null && Bs.length && isFieldDef(Yr) ? { name: `${varName(Yr.field)}_legend_${El}` } : {},
      ...Bs != null && Bs.length ? { interactive: !!Bs } : {},
      update: Pl
    });
  }
  return isEmpty(Hs) || er.set("encode", Hs, !!(Zt != null && Zt.encoding)), er;
}
function parseNonUnitLegend(_e) {
  const { legends: Qt, resolve: Zt } = _e.component;
  for (const $n of _e.children) {
    parseLegend($n);
    for (const Sn of keys$2($n.component.legends))
      Zt.legend[Sn] = parseGuideResolve(_e.component.resolve, Sn), Zt.legend[Sn] === "shared" && (Qt[Sn] = mergeLegendComponent(Qt[Sn], $n.component.legends[Sn]), Qt[Sn] || (Zt.legend[Sn] = "independent", delete Qt[Sn]));
  }
  for (const $n of keys$2(Qt))
    for (const Sn of _e.children)
      Sn.component.legends[$n] && Zt.legend[$n] === "shared" && delete Sn.component.legends[$n];
  return Qt;
}
function mergeLegendComponent(_e, Qt) {
  var kn, Kn, er, Cr;
  if (!_e)
    return Qt.clone();
  const Zt = _e.getWithExplicit("orient"), $n = Qt.getWithExplicit("orient");
  if (Zt.explicit && $n.explicit && Zt.value !== $n.value)
    return;
  let Sn = !1;
  for (const kr of LEGEND_COMPONENT_PROPERTIES) {
    const Yr = mergeValuesWithExplicit(
      _e.getWithExplicit(kr),
      Qt.getWithExplicit(kr),
      kr,
      "legend",
      // Tie breaker function
      (Ms, Ds) => {
        switch (kr) {
          case "symbolType":
            return mergeSymbolType(Ms, Ds);
          case "title":
            return mergeTitleComponent(Ms, Ds);
          case "type":
            return Sn = !0, makeImplicit("symbol");
        }
        return defaultTieBreaker(Ms, Ds, kr, "legend");
      }
    );
    _e.setWithExplicit(kr, Yr);
  }
  return Sn && ((Kn = (kn = _e.implicit) == null ? void 0 : kn.encode) != null && Kn.gradient && deleteNestedProperty(_e.implicit, ["encode", "gradient"]), (Cr = (er = _e.explicit) == null ? void 0 : er.encode) != null && Cr.gradient && deleteNestedProperty(_e.explicit, ["encode", "gradient"])), _e;
}
function mergeSymbolType(_e, Qt) {
  return Qt.value === "circle" ? Qt : _e;
}
function setLegendEncode(_e, Qt, Zt, $n) {
  var Sn, kn;
  _e.encode ?? (_e.encode = {}), (Sn = _e.encode)[Qt] ?? (Sn[Qt] = {}), (kn = _e.encode[Qt]).update ?? (kn.update = {}), _e.encode[Qt].update[Zt] = $n;
}
function assembleLegends(_e) {
  const Qt = _e.component.legends, Zt = {};
  for (const Sn of keys$2(Qt)) {
    const kn = _e.getScaleComponent(Sn), Kn = stringify$2(kn.get("domains"));
    if (Zt[Kn])
      for (const er of Zt[Kn])
        mergeLegendComponent(er, Qt[Sn]) || Zt[Kn].push(Qt[Sn]);
    else
      Zt[Kn] = [Qt[Sn].clone()];
  }
  return vals(Zt).flat().map((Sn) => assembleLegend(Sn, _e.config)).filter((Sn) => Sn !== void 0);
}
function assembleLegend(_e, Qt) {
  var Kn, er, Cr;
  const { disable: Zt, labelExpr: $n, selections: Sn, ...kn } = _e.combine();
  if (!Zt) {
    if (Qt.aria === !1 && kn.aria == null && (kn.aria = !1), (Kn = kn.encode) != null && Kn.symbols) {
      const kr = kn.encode.symbols.update;
      kr.fill && kr.fill.value !== "transparent" && !kr.stroke && !kn.stroke && (kr.stroke = { value: "transparent" });
      for (const Yr of LEGEND_SCALE_CHANNELS)
        kn[Yr] && delete kr[Yr];
    }
    if (kn.title || delete kn.title, $n !== void 0) {
      let kr = $n;
      (Cr = (er = kn.encode) == null ? void 0 : er.labels) != null && Cr.update && isSignalRef(kn.encode.labels.update.text) && (kr = replaceAll($n, "datum.label", kn.encode.labels.update.text.signal)), setLegendEncode(kn, "labels", "text", { signal: kr });
    }
    return kn;
  }
}
function assembleProjections(_e) {
  return isLayerModel(_e) || isConcatModel(_e) ? assembleProjectionsForModelAndChildren(_e) : assembleProjectionForModel(_e);
}
function assembleProjectionsForModelAndChildren(_e) {
  return _e.children.reduce((Qt, Zt) => Qt.concat(Zt.assembleProjections()), assembleProjectionForModel(_e));
}
function assembleProjectionForModel(_e) {
  const Qt = _e.component.projection;
  if (!Qt || Qt.merged)
    return [];
  const Zt = Qt.combine(), { name: $n } = Zt;
  if (Qt.data) {
    const Sn = {
      signal: `[${Qt.size.map((Kn) => Kn.signal).join(", ")}]`
    }, kn = Qt.data.reduce((Kn, er) => {
      const Cr = isSignalRef(er) ? er.signal : `data('${_e.lookupDataSource(er)}')`;
      return contains$1(Kn, Cr) || Kn.push(Cr), Kn;
    }, []);
    if (kn.length <= 0)
      throw new Error("Projection's fit didn't find any data sources");
    return [
      {
        name: $n,
        size: Sn,
        fit: {
          signal: kn.length > 1 ? `[${kn.join(", ")}]` : kn[0]
        },
        ...Zt
      }
    ];
  } else
    return [
      {
        name: $n,
        translate: { signal: "[width / 2, height / 2]" },
        // parameters, overwrite default translate if specified
        ...Zt
      }
    ];
}
const PROJECTION_PROPERTIES = [
  "type",
  "clipAngle",
  "clipExtent",
  "center",
  "rotate",
  "precision",
  "reflectX",
  "reflectY",
  "coefficient",
  "distance",
  "fraction",
  "lobes",
  "parallel",
  "radius",
  "ratio",
  "spacing",
  "tilt"
];
class ProjectionComponent extends Split {
  constructor(Qt, Zt, $n, Sn) {
    super(
      { ...Zt },
      // all explicit properties of projection
      { name: Qt }
      // name as initial implicit property
    ), this.specifiedProjection = Zt, this.size = $n, this.data = Sn, this.merged = !1;
  }
  /**
   * Whether the projection parameters should fit provided data.
   */
  get isFit() {
    return !!this.data;
  }
}
function parseProjection(_e) {
  _e.component.projection = isUnitModel(_e) ? parseUnitProjection(_e) : parseNonUnitProjections(_e);
}
function parseUnitProjection(_e) {
  if (_e.hasProjection) {
    const Qt = replaceExprRef(_e.specifiedProjection), Zt = !(Qt && (Qt.scale != null || Qt.translate != null)), $n = Zt ? [_e.getSizeSignalRef("width"), _e.getSizeSignalRef("height")] : void 0, Sn = Zt ? gatherFitData(_e) : void 0, kn = new ProjectionComponent(_e.projectionName(!0), {
      ...replaceExprRef(_e.config.projection) ?? {},
      ...Qt ?? {}
    }, $n, Sn);
    return kn.get("type") || kn.set("type", "equalEarth", !1), kn;
  }
}
function gatherFitData(_e) {
  const Qt = [], { encoding: Zt } = _e;
  for (const $n of [
    [LONGITUDE, LATITUDE],
    [LONGITUDE2, LATITUDE2]
  ])
    (getFieldOrDatumDef(Zt[$n[0]]) || getFieldOrDatumDef(Zt[$n[1]])) && Qt.push({
      signal: _e.getName(`geojson_${Qt.length}`)
    });
  return _e.channelHasField(SHAPE) && _e.typedFieldDef(SHAPE).type === GEOJSON && Qt.push({
    signal: _e.getName(`geojson_${Qt.length}`)
  }), Qt.length === 0 && Qt.push(_e.requestDataName(DataSourceType.Main)), Qt;
}
function mergeIfNoConflict(_e, Qt) {
  const Zt = every(PROJECTION_PROPERTIES, (Sn) => !!(!has$1(_e.explicit, Sn) && !has$1(Qt.explicit, Sn) || has$1(_e.explicit, Sn) && has$1(Qt.explicit, Sn) && // some properties might be signals or objects and require hashing for comparison
  deepEqual(_e.get(Sn), Qt.get(Sn))));
  if (deepEqual(_e.size, Qt.size)) {
    if (Zt)
      return _e;
    if (deepEqual(_e.explicit, {}))
      return Qt;
    if (deepEqual(Qt.explicit, {}))
      return _e;
  }
  return null;
}
function parseNonUnitProjections(_e) {
  if (_e.children.length === 0)
    return;
  let Qt;
  for (const $n of _e.children)
    parseProjection($n);
  const Zt = every(_e.children, ($n) => {
    const Sn = $n.component.projection;
    if (Sn)
      if (Qt) {
        const kn = mergeIfNoConflict(Qt, Sn);
        return kn && (Qt = kn), !!kn;
      } else
        return Qt = Sn, !0;
    else
      return !0;
  });
  if (Qt && Zt) {
    const $n = _e.projectionName(!0), Sn = new ProjectionComponent($n, Qt.specifiedProjection, Qt.size, duplicate(Qt.data));
    for (const kn of _e.children) {
      const Kn = kn.component.projection;
      Kn && (Kn.isFit && Sn.data.push(...kn.component.projection.data), kn.renameProjection(Kn.get("name"), $n), Kn.merged = !0);
    }
    return Sn;
  }
}
function rangeFormula(_e, Qt, Zt, $n) {
  if (binRequiresRange(Qt, Zt)) {
    const Sn = isUnitModel(_e) ? _e.axis(Zt) ?? _e.legend(Zt) ?? {} : {}, kn = vgField(Qt, { expr: "datum" }), Kn = vgField(Qt, { expr: "datum", binSuffix: "end" });
    return {
      formulaAs: vgField(Qt, { binSuffix: "range", forAs: !0 }),
      formula: binFormatExpression(kn, Kn, Sn.format, Sn.formatType, $n)
    };
  }
  return {};
}
function binKey(_e, Qt) {
  return `${binToString(_e)}_${Qt}`;
}
function getSignalsFromModel(_e, Qt) {
  return {
    signal: _e.getName(`${Qt}_bins`),
    extentSignal: _e.getName(`${Qt}_extent`)
  };
}
function getBinSignalName(_e, Qt, Zt) {
  const $n = normalizeBin(Zt, void 0) ?? {}, Sn = binKey($n, Qt);
  return _e.getName(`${Sn}_bins`);
}
function isBinTransform(_e) {
  return "as" in _e;
}
function createBinComponent(_e, Qt, Zt) {
  let $n, Sn;
  isBinTransform(_e) ? $n = isString(_e.as) ? [_e.as, `${_e.as}_end`] : [_e.as[0], _e.as[1]] : $n = [vgField(_e, { forAs: !0 }), vgField(_e, { binSuffix: "end", forAs: !0 })];
  const kn = { ...normalizeBin(Qt, void 0) }, Kn = binKey(kn, _e.field), { signal: er, extentSignal: Cr } = getSignalsFromModel(Zt, Kn);
  if (isParameterExtent(kn.extent)) {
    const Yr = kn.extent;
    Sn = parseSelectionExtent(Zt, Yr.param, Yr), delete kn.extent;
  }
  const kr = {
    bin: kn,
    field: _e.field,
    as: [$n],
    ...er ? { signal: er } : {},
    ...Cr ? { extentSignal: Cr } : {},
    ...Sn ? { span: Sn } : {}
  };
  return { key: Kn, binComponent: kr };
}
class BinNode extends DataFlowNode {
  clone() {
    return new BinNode(null, duplicate(this.bins));
  }
  constructor(Qt, Zt) {
    super(Qt), this.bins = Zt;
  }
  static makeFromEncoding(Qt, Zt) {
    const $n = Zt.reduceFieldDef((Sn, kn, Kn) => {
      if (isTypedFieldDef(kn) && isBinning(kn.bin)) {
        const { key: er, binComponent: Cr } = createBinComponent(kn, kn.bin, Zt);
        Sn[er] = {
          ...Cr,
          ...Sn[er],
          ...rangeFormula(Zt, kn, Kn, Zt.config)
        };
      }
      return Sn;
    }, {});
    return isEmpty($n) ? null : new BinNode(Qt, $n);
  }
  /**
   * Creates a bin node from BinTransform.
   * The optional parameter should provide
   */
  static makeFromTransform(Qt, Zt, $n) {
    const { key: Sn, binComponent: kn } = createBinComponent(Zt, Zt.bin, $n);
    return new BinNode(Qt, {
      [Sn]: kn
    });
  }
  /**
   * Merge bin nodes. This method either integrates the bin config from the other node
   * or if this node already has a bin config, renames the corresponding signal in the model.
   */
  merge(Qt, Zt) {
    for (const $n of keys$2(Qt.bins))
      $n in this.bins ? (Zt(Qt.bins[$n].signal, this.bins[$n].signal), this.bins[$n].as = unique([...this.bins[$n].as, ...Qt.bins[$n].as], hash)) : this.bins[$n] = Qt.bins[$n];
    for (const $n of Qt.children)
      Qt.removeChild($n), $n.parent = this;
    Qt.remove();
  }
  producedFields() {
    return new Set(vals(this.bins).map((Qt) => Qt.as).flat(2));
  }
  dependentFields() {
    return new Set(vals(this.bins).map((Qt) => Qt.field));
  }
  hash() {
    return `Bin ${hash(this.bins)}`;
  }
  assemble() {
    return vals(this.bins).flatMap((Qt) => {
      const Zt = [], [$n, ...Sn] = Qt.as, { extent: kn, ...Kn } = Qt.bin, er = {
        type: "bin",
        field: replacePathInField(Qt.field),
        as: $n,
        signal: Qt.signal,
        ...isParameterExtent(kn) ? { extent: null } : { extent: kn },
        ...Qt.span ? { span: { signal: `span(${Qt.span})` } } : {},
        ...Kn
      };
      !kn && Qt.extentSignal && (Zt.push({
        type: "extent",
        field: replacePathInField(Qt.field),
        signal: Qt.extentSignal
      }), er.extent = { signal: Qt.extentSignal }), Zt.push(er);
      for (const Cr of Sn)
        for (let kr = 0; kr < 2; kr++)
          Zt.push({
            type: "formula",
            expr: vgField({ field: $n[kr] }, { expr: "datum" }),
            as: Cr[kr]
          });
      return Qt.formula && Zt.push({
        type: "formula",
        expr: Qt.formula,
        as: Qt.formulaAs
      }), Zt;
    });
  }
}
function addDimension(_e, Qt, Zt, $n) {
  var kn;
  const Sn = isUnitModel($n) ? $n.encoding[getSecondaryRangeChannel(Qt)] : void 0;
  if (isTypedFieldDef(Zt) && isUnitModel($n) && hasBandEnd(Zt, Sn, $n.markDef, $n.config))
    _e.add(vgField(Zt, {})), _e.add(vgField(Zt, { suffix: "end" })), Zt.bin && binRequiresRange(Zt, Qt) && _e.add(vgField(Zt, { binSuffix: "range" }));
  else if (isGeoPositionChannel(Qt)) {
    const Kn = getPositionChannelFromLatLong(Qt);
    _e.add($n.getName(Kn));
  } else
    _e.add(vgField(Zt));
  return isScaleFieldDef(Zt) && isFieldRange((kn = Zt.scale) == null ? void 0 : kn.range) && _e.add(Zt.scale.range.field), _e;
}
function mergeMeasures(_e, Qt) {
  for (const Zt of keys$2(Qt)) {
    const $n = Qt[Zt];
    for (const Sn of keys$2($n))
      Zt in _e ? _e[Zt][Sn] = /* @__PURE__ */ new Set([..._e[Zt][Sn] ?? [], ...$n[Sn]]) : _e[Zt] = { [Sn]: $n[Sn] };
  }
}
class AggregateNode extends DataFlowNode {
  clone() {
    return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures));
  }
  /**
   * @param dimensions string set for dimensions
   * @param measures dictionary mapping field name => dict of aggregation functions and names to use
   */
  constructor(Qt, Zt, $n) {
    super(Qt), this.dimensions = Zt, this.measures = $n;
  }
  get groupBy() {
    return this.dimensions;
  }
  static makeFromEncoding(Qt, Zt) {
    let $n = !1;
    Zt.forEachFieldDef((Kn) => {
      Kn.aggregate && ($n = !0);
    });
    const Sn = {}, kn = /* @__PURE__ */ new Set();
    return !$n || (Zt.forEachFieldDef((Kn, er) => {
      const { aggregate: Cr, field: kr } = Kn;
      if (Cr)
        if (Cr === "count")
          Sn["*"] ?? (Sn["*"] = {}), Sn["*"].count = /* @__PURE__ */ new Set([vgField(Kn, { forAs: !0 })]);
        else {
          if (isArgminDef(Cr) || isArgmaxDef(Cr)) {
            const Yr = isArgminDef(Cr) ? "argmin" : "argmax", Ms = Cr[Yr];
            Sn[Ms] ?? (Sn[Ms] = {}), Sn[Ms][Yr] = /* @__PURE__ */ new Set([vgField({ op: Yr, field: Ms }, { forAs: !0 })]);
          } else
            Sn[kr] ?? (Sn[kr] = {}), Sn[kr][Cr] = /* @__PURE__ */ new Set([vgField(Kn, { forAs: !0 })]);
          isScaleChannel(er) && Zt.scaleDomain(er) === "unaggregated" && (Sn[kr] ?? (Sn[kr] = {}), Sn[kr].min = /* @__PURE__ */ new Set([vgField({ field: kr, aggregate: "min" }, { forAs: !0 })]), Sn[kr].max = /* @__PURE__ */ new Set([vgField({ field: kr, aggregate: "max" }, { forAs: !0 })]));
        }
      else
        addDimension(kn, er, Kn, Zt);
    }), kn.size + keys$2(Sn).length === 0) ? null : new AggregateNode(Qt, kn, Sn);
  }
  static makeFromTransform(Qt, Zt) {
    const $n = /* @__PURE__ */ new Set(), Sn = {};
    for (const kn of Zt.aggregate) {
      const { op: Kn, field: er, as: Cr } = kn;
      Kn && (Kn === "count" ? (Sn["*"] ?? (Sn["*"] = {}), Sn["*"].count = /* @__PURE__ */ new Set([Cr || vgField(kn, { forAs: !0 })])) : (Sn[er] ?? (Sn[er] = {}), Sn[er][Kn] = /* @__PURE__ */ new Set([Cr || vgField(kn, { forAs: !0 })])));
    }
    for (const kn of Zt.groupby ?? [])
      $n.add(kn);
    return $n.size + keys$2(Sn).length === 0 ? null : new AggregateNode(Qt, $n, Sn);
  }
  merge(Qt) {
    return setEqual(this.dimensions, Qt.dimensions) ? (mergeMeasures(this.measures, Qt.measures), !0) : (debug$3("different dimensions, cannot merge"), !1);
  }
  addDimensions(Qt) {
    Qt.forEach(this.dimensions.add, this.dimensions);
  }
  dependentFields() {
    return /* @__PURE__ */ new Set([...this.dimensions, ...keys$2(this.measures)]);
  }
  producedFields() {
    const Qt = /* @__PURE__ */ new Set();
    for (const Zt of keys$2(this.measures))
      for (const $n of keys$2(this.measures[Zt])) {
        const Sn = this.measures[Zt][$n];
        Sn.size === 0 ? Qt.add(`${$n}_${Zt}`) : Sn.forEach(Qt.add, Qt);
      }
    return Qt;
  }
  hash() {
    return `Aggregate ${hash({ dimensions: this.dimensions, measures: this.measures })}`;
  }
  assemble() {
    const Qt = [], Zt = [], $n = [];
    for (const kn of keys$2(this.measures))
      for (const Kn of keys$2(this.measures[kn]))
        for (const er of this.measures[kn][Kn])
          $n.push(er), Qt.push(Kn), Zt.push(kn === "*" ? null : replacePathInField(kn));
    return {
      type: "aggregate",
      groupby: [...this.dimensions].map(replacePathInField),
      ops: Qt,
      fields: Zt,
      as: $n
    };
  }
}
class FacetNode extends DataFlowNode {
  /**
   * @param model The facet model.
   * @param name The name that this facet source will have.
   * @param data The source data for this facet data.
   */
  constructor(Qt, Zt, $n, Sn) {
    super(Qt), this.model = Zt, this.name = $n, this.data = Sn;
    for (const kn of FACET_CHANNELS) {
      const Kn = Zt.facet[kn];
      if (Kn) {
        const { bin: er, sort: Cr } = Kn;
        this[kn] = {
          name: Zt.getName(`${kn}_domain`),
          fields: [vgField(Kn), ...isBinning(er) ? [vgField(Kn, { binSuffix: "end" })] : []],
          ...isSortField(Cr) ? { sortField: Cr } : isArray(Cr) ? { sortIndexField: sortArrayIndexField(Kn, kn) } : {}
        };
      }
    }
    this.childModel = Zt.child;
  }
  hash() {
    let Qt = "Facet";
    for (const Zt of FACET_CHANNELS)
      this[Zt] && (Qt += ` ${Zt.charAt(0)}:${hash(this[Zt])}`);
    return Qt;
  }
  get fields() {
    var Zt;
    const Qt = [];
    for (const $n of FACET_CHANNELS)
      (Zt = this[$n]) != null && Zt.fields && Qt.push(...this[$n].fields);
    return Qt;
  }
  dependentFields() {
    const Qt = new Set(this.fields);
    for (const Zt of FACET_CHANNELS)
      this[Zt] && (this[Zt].sortField && Qt.add(this[Zt].sortField.field), this[Zt].sortIndexField && Qt.add(this[Zt].sortIndexField));
    return Qt;
  }
  producedFields() {
    return /* @__PURE__ */ new Set();
  }
  /**
   * The name to reference this source is its name.
   */
  getSource() {
    return this.name;
  }
  getChildIndependentFieldsWithStep() {
    const Qt = {};
    for (const Zt of POSITION_SCALE_CHANNELS) {
      const $n = this.childModel.component.scales[Zt];
      if ($n && !$n.merged) {
        const Sn = $n.get("type"), kn = $n.get("range");
        if (hasDiscreteDomain(Sn) && isVgRangeStep(kn)) {
          const Kn = assembleDomain(this.childModel, Zt), er = getFieldFromDomain(Kn);
          er ? Qt[Zt] = er : warn$1(unknownField(Zt));
        }
      }
    }
    return Qt;
  }
  assembleRowColumnHeaderData(Qt, Zt, $n) {
    const Sn = { row: "y", column: "x", facet: void 0 }[Qt], kn = [], Kn = [], er = [];
    Sn && $n && $n[Sn] && (Zt ? (kn.push(`distinct_${$n[Sn]}`), Kn.push("max")) : (kn.push($n[Sn]), Kn.push("distinct")), er.push(`distinct_${$n[Sn]}`));
    const { sortField: Cr, sortIndexField: kr } = this[Qt];
    if (Cr) {
      const { op: Yr = DEFAULT_SORT_OP, field: Ms } = Cr;
      kn.push(Ms), Kn.push(Yr), er.push(vgField(Cr, { forAs: !0 }));
    } else
      kr && (kn.push(kr), Kn.push("max"), er.push(kr));
    return {
      name: this[Qt].name,
      // Use data from the crossed one if it exist
      source: Zt ?? this.data,
      transform: [
        {
          type: "aggregate",
          groupby: this[Qt].fields,
          ...kn.length ? {
            fields: kn,
            ops: Kn,
            as: er
          } : {}
        }
      ]
    };
  }
  assembleFacetHeaderData(Qt) {
    var Cr;
    const { columns: Zt } = this.model.layout, { layoutHeaders: $n } = this.model.component, Sn = [], kn = {};
    for (const kr of HEADER_CHANNELS) {
      for (const Yr of HEADER_TYPES) {
        const Ms = ($n[kr] && $n[kr][Yr]) ?? [];
        for (const Ds of Ms)
          if (((Cr = Ds.axes) == null ? void 0 : Cr.length) > 0) {
            kn[kr] = !0;
            break;
          }
      }
      if (kn[kr]) {
        const Yr = `length(data("${this.facet.name}"))`, Ms = kr === "row" ? Zt ? { signal: `ceil(${Yr} / ${Zt})` } : 1 : Zt ? { signal: `min(${Yr}, ${Zt})` } : { signal: Yr };
        Sn.push({
          name: `${this.facet.name}_${kr}`,
          transform: [
            {
              type: "sequence",
              start: 0,
              stop: Ms
            }
          ]
        });
      }
    }
    const { row: Kn, column: er } = kn;
    return (Kn || er) && Sn.unshift(this.assembleRowColumnHeaderData("facet", null, Qt)), Sn;
  }
  assemble() {
    const Qt = [];
    let Zt = null;
    const $n = this.getChildIndependentFieldsWithStep(), { column: Sn, row: kn, facet: Kn } = this;
    if (Sn && kn && ($n.x || $n.y)) {
      Zt = `cross_${this.column.name}_${this.row.name}`;
      const er = [].concat($n.x ?? [], $n.y ?? []), Cr = er.map(() => "distinct");
      Qt.push({
        name: Zt,
        source: this.data,
        transform: [
          {
            type: "aggregate",
            groupby: this.fields,
            fields: er,
            ops: Cr
          }
        ]
      });
    }
    for (const er of [COLUMN, ROW])
      this[er] && Qt.push(this.assembleRowColumnHeaderData(er, Zt, $n));
    if (Kn) {
      const er = this.assembleFacetHeaderData($n);
      er && Qt.push(...er);
    }
    return Qt;
  }
}
function unquote(_e) {
  return _e.startsWith("'") && _e.endsWith("'") || _e.startsWith('"') && _e.endsWith('"') ? _e.slice(1, -1) : _e;
}
function parseExpression(_e, Qt) {
  const Zt = accessPathWithDatum(_e);
  if (Qt === "number")
    return `toNumber(${Zt})`;
  if (Qt === "boolean")
    return `toBoolean(${Zt})`;
  if (Qt === "string")
    return `toString(${Zt})`;
  if (Qt === "date")
    return `toDate(${Zt})`;
  if (Qt === "flatten")
    return Zt;
  if (Qt.startsWith("date:")) {
    const $n = unquote(Qt.slice(5, Qt.length));
    return `timeParse(${Zt},'${$n}')`;
  } else if (Qt.startsWith("utc:")) {
    const $n = unquote(Qt.slice(4, Qt.length));
    return `utcParse(${Zt},'${$n}')`;
  } else
    return warn$1(unrecognizedParse(Qt)), null;
}
function getImplicitFromFilterTransform(_e) {
  const Qt = {};
  return forEachLeaf(_e.filter, (Zt) => {
    if (isFieldPredicate(Zt)) {
      let $n = null;
      isFieldEqualPredicate(Zt) ? $n = signalRefOrValue(Zt.equal) : isFieldLTEPredicate(Zt) ? $n = signalRefOrValue(Zt.lte) : isFieldLTPredicate(Zt) ? $n = signalRefOrValue(Zt.lt) : isFieldGTPredicate(Zt) ? $n = signalRefOrValue(Zt.gt) : isFieldGTEPredicate(Zt) ? $n = signalRefOrValue(Zt.gte) : isFieldRangePredicate(Zt) ? $n = Zt.range[0] : isFieldOneOfPredicate(Zt) && ($n = (Zt.oneOf ?? Zt.in)[0]), $n && (isDateTime($n) ? Qt[Zt.field] = "date" : isNumber$1($n) ? Qt[Zt.field] = "number" : isString($n) && (Qt[Zt.field] = "string")), Zt.timeUnit && (Qt[Zt.field] = "date");
    }
  }), Qt;
}
function getImplicitFromEncoding(_e) {
  const Qt = {};
  function Zt($n) {
    isFieldOrDatumDefForTimeFormat($n) ? Qt[$n.field] = "date" : $n.type === "quantitative" && isMinMaxOp($n.aggregate) ? Qt[$n.field] = "number" : accessPathDepth($n.field) > 1 ? $n.field in Qt || (Qt[$n.field] = "flatten") : isScaleFieldDef($n) && isSortField($n.sort) && accessPathDepth($n.sort.field) > 1 && ($n.sort.field in Qt || (Qt[$n.sort.field] = "flatten"));
  }
  if ((isUnitModel(_e) || isFacetModel(_e)) && _e.forEachFieldDef(($n, Sn) => {
    if (isTypedFieldDef($n))
      Zt($n);
    else {
      const kn = getMainRangeChannel(Sn), Kn = _e.fieldDef(kn);
      Zt({
        ...$n,
        type: Kn.type
      });
    }
  }), isUnitModel(_e)) {
    const { mark: $n, markDef: Sn, encoding: kn } = _e;
    if (isPathMark($n) && // No need to sort by dimension if we have a connected scatterplot (order channel is present)
    !_e.encoding.order) {
      const Kn = Sn.orient === "horizontal" ? "y" : "x", er = kn[Kn];
      isFieldDef(er) && er.type === "quantitative" && !(er.field in Qt) && (Qt[er.field] = "number");
    }
  }
  return Qt;
}
function getImplicitFromSelection(_e) {
  const Qt = {};
  if (isUnitModel(_e) && _e.component.selection)
    for (const Zt of keys$2(_e.component.selection)) {
      const $n = _e.component.selection[Zt];
      for (const Sn of $n.project.items)
        !Sn.channel && accessPathDepth(Sn.field) > 1 && (Qt[Sn.field] = "flatten");
    }
  return Qt;
}
class ParseNode extends DataFlowNode {
  clone() {
    return new ParseNode(null, duplicate(this._parse));
  }
  constructor(Qt, Zt) {
    super(Qt), this._parse = Zt;
  }
  hash() {
    return `Parse ${hash(this._parse)}`;
  }
  /**
   * Creates a parse node from a data.format.parse and updates ancestorParse.
   */
  static makeExplicit(Qt, Zt, $n) {
    var Kn;
    let Sn = {};
    const kn = Zt.data;
    return !isGenerator(kn) && ((Kn = kn == null ? void 0 : kn.format) != null && Kn.parse) && (Sn = kn.format.parse), this.makeWithAncestors(Qt, Sn, {}, $n);
  }
  /**
   * Creates a parse node from "explicit" parse and "implicit" parse and updates ancestorParse.
   */
  static makeWithAncestors(Qt, Zt, $n, Sn) {
    for (const er of keys$2($n)) {
      const Cr = Sn.getWithExplicit(er);
      Cr.value !== void 0 && (Cr.explicit || Cr.value === $n[er] || Cr.value === "derived" || $n[er] === "flatten" ? delete $n[er] : warn$1(differentParse(er, $n[er], Cr.value)));
    }
    for (const er of keys$2(Zt)) {
      const Cr = Sn.get(er);
      Cr !== void 0 && (Cr === Zt[er] ? delete Zt[er] : warn$1(differentParse(er, Zt[er], Cr)));
    }
    const kn = new Split(Zt, $n);
    Sn.copyAll(kn);
    const Kn = {};
    for (const er of keys$2(kn.combine())) {
      const Cr = kn.get(er);
      Cr !== null && (Kn[er] = Cr);
    }
    return keys$2(Kn).length === 0 || Sn.parseNothing ? null : new ParseNode(Qt, Kn);
  }
  get parse() {
    return this._parse;
  }
  merge(Qt) {
    this._parse = { ...this._parse, ...Qt.parse }, Qt.remove();
  }
  /**
   * Assemble an object for Vega's format.parse property.
   */
  assembleFormatParse() {
    const Qt = {};
    for (const Zt of keys$2(this._parse)) {
      const $n = this._parse[Zt];
      accessPathDepth(Zt) === 1 && (Qt[Zt] = $n);
    }
    return Qt;
  }
  // format parse depends and produces all fields in its parse
  producedFields() {
    return new Set(keys$2(this._parse));
  }
  dependentFields() {
    return new Set(keys$2(this._parse));
  }
  assembleTransforms(Qt = !1) {
    return keys$2(this._parse).filter((Zt) => Qt ? accessPathDepth(Zt) > 1 : !0).map((Zt) => {
      const $n = parseExpression(Zt, this._parse[Zt]);
      return $n ? {
        type: "formula",
        expr: $n,
        as: removePathFromField(Zt)
        // Vega output is always flattened
      } : null;
    }).filter((Zt) => Zt !== null);
  }
}
class IdentifierNode extends DataFlowNode {
  clone() {
    return new IdentifierNode(null);
  }
  constructor(Qt) {
    super(Qt);
  }
  dependentFields() {
    return /* @__PURE__ */ new Set();
  }
  producedFields() {
    return /* @__PURE__ */ new Set([SELECTION_ID]);
  }
  hash() {
    return "Identifier";
  }
  assemble() {
    return { type: "identifier", as: SELECTION_ID };
  }
}
class GraticuleNode extends DataFlowNode {
  clone() {
    return new GraticuleNode(null, this.params);
  }
  constructor(Qt, Zt) {
    super(Qt), this.params = Zt;
  }
  dependentFields() {
    return /* @__PURE__ */ new Set();
  }
  producedFields() {
  }
  hash() {
    return `Graticule ${hash(this.params)}`;
  }
  assemble() {
    return {
      type: "graticule",
      ...this.params === !0 ? {} : this.params
    };
  }
}
class SequenceNode extends DataFlowNode {
  clone() {
    return new SequenceNode(null, this.params);
  }
  constructor(Qt, Zt) {
    super(Qt), this.params = Zt;
  }
  dependentFields() {
    return /* @__PURE__ */ new Set();
  }
  producedFields() {
    return /* @__PURE__ */ new Set([this.params.as ?? "data"]);
  }
  hash() {
    return `Hash ${hash(this.params)}`;
  }
  assemble() {
    return {
      type: "sequence",
      ...this.params
    };
  }
}
class SourceNode extends DataFlowNode {
  constructor(Qt) {
    super(null), Qt ?? (Qt = { name: "source" });
    let Zt;
    if (isGenerator(Qt) || (Zt = Qt.format ? { ...omit(Qt.format, ["parse"]) } : {}), isInlineData(Qt))
      this._data = { values: Qt.values };
    else if (isUrlData(Qt)) {
      if (this._data = { url: Qt.url }, !Zt.type) {
        let $n = /(?:\.([^.]+))?$/.exec(Qt.url)[1];
        contains$1(["json", "csv", "tsv", "dsv", "topojson"], $n) || ($n = "json"), Zt.type = $n;
      }
    } else
      isSphereGenerator(Qt) ? this._data = { values: [{ type: "Sphere" }] } : (isNamedData(Qt) || isGenerator(Qt)) && (this._data = {});
    this._generator = isGenerator(Qt), Qt.name && (this._name = Qt.name), Zt && !isEmpty(Zt) && (this._data.format = Zt);
  }
  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(Qt) {
    this._name = Qt;
  }
  set parent(Qt) {
    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 {
      name: this._name,
      ...this._data,
      transform: []
    };
  }
}
var __classPrivateFieldSet = globalThis && globalThis.__classPrivateFieldSet || function(_e, Qt, Zt, $n, Sn) {
  if ($n === "m")
    throw new TypeError("Private method is not writable");
  if ($n === "a" && !Sn)
    throw new TypeError("Private accessor was defined without a setter");
  if (typeof Qt == "function" ? _e !== Qt || !Sn : !Qt.has(_e))
    throw new TypeError("Cannot write private member to an object whose class did not declare it");
  return $n === "a" ? Sn.call(_e, Zt) : Sn ? Sn.value = Zt : Qt.set(_e, Zt), Zt;
}, __classPrivateFieldGet = globalThis && globalThis.__classPrivateFieldGet || function(_e, Qt, Zt, $n) {
  if (Zt === "a" && !$n)
    throw new TypeError("Private accessor was defined without a getter");
  if (typeof Qt == "function" ? _e !== Qt || !$n : !Qt.has(_e))
    throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return Zt === "m" ? $n : Zt === "a" ? $n.call(_e) : $n ? $n.value : Qt.get(_e);
}, _Optimizer_modified;
function isDataSourceNode(_e) {
  return _e instanceof SourceNode || _e instanceof GraticuleNode || _e instanceof SequenceNode;
}
class Optimizer {
  constructor() {
    _Optimizer_modified.set(this, void 0), __classPrivateFieldSet(this, _Optimizer_modified, !1, "f");
  }
  // Once true, #modified is never set to false
  setModified() {
    __classPrivateFieldSet(this, _Optimizer_modified, !0, "f");
  }
  get modifiedFlag() {
    return __classPrivateFieldGet(this, _Optimizer_modified, "f");
  }
}
_Optimizer_modified = /* @__PURE__ */ new WeakMap();
class BottomUpOptimizer extends Optimizer {
  /**
   * Compute a map of node depths that we can use to determine a topological sort order.
   */
  getNodeDepths(Qt, Zt, $n) {
    $n.set(Qt, Zt);
    for (const Sn of Qt.children)
      this.getNodeDepths(Sn, Zt + 1, $n);
    return $n;
  }
  /**
   * Run the optimizer on all nodes starting from the leaves.
   */
  optimize(Qt) {
    const $n = [...this.getNodeDepths(Qt, 0, /* @__PURE__ */ new Map()).entries()].sort((Sn, kn) => kn[1] - Sn[1]);
    for (const Sn of $n)
      this.run(Sn[0]);
    return this.modifiedFlag;
  }
}
class TopDownOptimizer extends Optimizer {
  /**
   * Run the optimizer depth first on all nodes starting from the roots.
   */
  optimize(Qt) {
    this.run(Qt);
    for (const Zt of Qt.children)
      this.optimize(Zt);
    return this.modifiedFlag;
  }
}
class MergeIdenticalNodes extends TopDownOptimizer {
  mergeNodes(Qt, Zt) {
    const $n = Zt.shift();
    for (const Sn of Zt)
      Qt.removeChild(Sn), Sn.parent = $n, Sn.remove();
  }
  run(Qt) {
    const Zt = Qt.children.map((Sn) => Sn.hash()), $n = {};
    for (let Sn = 0; Sn < Zt.length; Sn++)
      $n[Zt[Sn]] === void 0 ? $n[Zt[Sn]] = [Qt.children[Sn]] : $n[Zt[Sn]].push(Qt.children[Sn]);
    for (const Sn of keys$2($n))
      $n[Sn].length > 1 && (this.setModified(), this.mergeNodes(Qt, $n[Sn]));
  }
}
class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer {
  constructor(Qt) {
    super(), this.requiresSelectionId = Qt && requiresSelectionId(Qt);
  }
  run(Qt) {
    Qt instanceof IdentifierNode && (this.requiresSelectionId && (isDataSourceNode(Qt.parent) || Qt.parent instanceof AggregateNode || Qt.parent instanceof ParseNode) || (this.setModified(), Qt.remove()));
  }
}
class RemoveDuplicateTimeUnits extends Optimizer {
  optimize(Qt) {
    return this.run(Qt, /* @__PURE__ */ new Set()), this.modifiedFlag;
  }
  run(Qt, Zt) {
    let $n = /* @__PURE__ */ new Set();
    Qt instanceof TimeUnitNode && ($n = Qt.producedFields(), hasIntersection($n, Zt) && (this.setModified(), Qt.removeFormulas(Zt), Qt.producedFields.length === 0 && Qt.remove()));
    for (const Sn of Qt.children)
      this.run(Sn, /* @__PURE__ */ new Set([...Zt, ...$n]));
  }
}
class RemoveUnnecessaryOutputNodes extends TopDownOptimizer {
  constructor() {
    super();
  }
  run(Qt) {
    Qt instanceof OutputNode && !Qt.isRequired() && (this.setModified(), Qt.remove());
  }
}
class MoveParseUp extends BottomUpOptimizer {
  run(Qt) {
    if (!isDataSourceNode(Qt) && !(Qt.numChildren() > 1)) {
      for (const Zt of Qt.children)
        if (Zt instanceof ParseNode)
          if (Qt instanceof ParseNode)
            this.setModified(), Qt.merge(Zt);
          else {
            if (fieldIntersection(Qt.producedFields(), Zt.dependentFields()))
              continue;
            this.setModified(), Zt.swapWithParent();
          }
    }
  }
}
class MergeParse extends BottomUpOptimizer {
  run(Qt) {
    const Zt = [...Qt.children], $n = Qt.children.filter((Sn) => Sn instanceof ParseNode);
    if (Qt.numChildren() > 1 && $n.length >= 1) {
      const Sn = {}, kn = /* @__PURE__ */ new Set();
      for (const Kn of $n) {
        const er = Kn.parse;
        for (const Cr of keys$2(er))
          Cr in Sn ? Sn[Cr] !== er[Cr] && kn.add(Cr) : Sn[Cr] = er[Cr];
      }
      for (const Kn of kn)
        delete Sn[Kn];
      if (!isEmpty(Sn)) {
        this.setModified();
        const Kn = new ParseNode(Qt, Sn);
        for (const er of Zt) {
          if (er instanceof ParseNode)
            for (const Cr of keys$2(Sn))
              delete er.parse[Cr];
          Qt.removeChild(er), er.parent = Kn, er instanceof ParseNode && keys$2(er.parse).length === 0 && er.remove();
        }
      }
    }
  }
}
class RemoveUnusedSubtrees extends BottomUpOptimizer {
  run(Qt) {
    Qt instanceof OutputNode || Qt.numChildren() > 0 || Qt instanceof FacetNode || Qt instanceof SourceNode || (this.setModified(), Qt.remove());
  }
}
class MergeTimeUnits extends BottomUpOptimizer {
  run(Qt) {
    const Zt = Qt.children.filter((Sn) => Sn instanceof TimeUnitNode), $n = Zt.pop();
    for (const Sn of Zt)
      this.setModified(), $n.merge(Sn);
  }
}
class MergeAggregates extends BottomUpOptimizer {
  run(Qt) {
    const Zt = Qt.children.filter((Sn) => Sn instanceof AggregateNode), $n = {};
    for (const Sn of Zt) {
      const kn = hash(Sn.groupBy);
      kn in $n || ($n[kn] = []), $n[kn].push(Sn);
    }
    for (const Sn of keys$2($n)) {
      const kn = $n[Sn];
      if (kn.length > 1) {
        const Kn = kn.pop();
        for (const er of kn)
          Kn.merge(er) && (Qt.removeChild(er), er.parent = Kn, er.remove(), this.setModified());
      }
    }
  }
}
class MergeBins extends BottomUpOptimizer {
  constructor(Qt) {
    super(), this.model = Qt;
  }
  run(Qt) {
    const Zt = !(isDataSourceNode(Qt) || Qt instanceof FilterNode || Qt instanceof ParseNode || Qt instanceof IdentifierNode), $n = [], Sn = [];
    for (const kn of Qt.children)
      kn instanceof BinNode && (Zt && !fieldIntersection(Qt.producedFields(), kn.dependentFields()) ? $n.push(kn) : Sn.push(kn));
    if ($n.length > 0) {
      const kn = $n.pop();
      for (const Kn of $n)
        kn.merge(Kn, this.model.renameSignal.bind(this.model));
      this.setModified(), Qt instanceof BinNode ? Qt.merge(kn, this.model.renameSignal.bind(this.model)) : kn.swapWithParent();
    }
    if (Sn.length > 1) {
      const kn = Sn.pop();
      for (const Kn of Sn)
        kn.merge(Kn, this.model.renameSignal.bind(this.model));
      this.setModified();
    }
  }
}
class MergeOutputs extends BottomUpOptimizer {
  run(Qt) {
    const Zt = [...Qt.children];
    if (!some(Zt, (Kn) => Kn instanceof OutputNode) || Qt.numChildren() <= 1)
      return;
    const Sn = [];
    let kn;
    for (const Kn of Zt)
      if (Kn instanceof OutputNode) {
        let er = Kn;
        for (; er.numChildren() === 1; ) {
          const [Cr] = er.children;
          if (Cr instanceof OutputNode)
            er = Cr;
          else
            break;
        }
        Sn.push(...er.children), kn ? (Qt.removeChild(Kn), Kn.parent = kn.parent, kn.parent.removeChild(kn), kn.parent = er, this.setModified()) : kn = er;
      } else
        Sn.push(Kn);
    if (Sn.length) {
      this.setModified();
      for (const Kn of Sn)
        Kn.parent.removeChild(Kn), Kn.parent = kn;
    }
  }
}
class JoinAggregateTransformNode extends DataFlowNode {
  clone() {
    return new JoinAggregateTransformNode(null, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt;
  }
  addDimensions(Qt) {
    this.transform.groupby = unique(this.transform.groupby.concat(Qt), (Zt) => Zt);
  }
  dependentFields() {
    const Qt = /* @__PURE__ */ new Set();
    return this.transform.groupby && this.transform.groupby.forEach(Qt.add, Qt), this.transform.joinaggregate.map((Zt) => Zt.field).filter((Zt) => Zt !== void 0).forEach(Qt.add, Qt), Qt;
  }
  producedFields() {
    return new Set(this.transform.joinaggregate.map(this.getDefaultName));
  }
  getDefaultName(Qt) {
    return Qt.as ?? vgField(Qt);
  }
  hash() {
    return `JoinAggregateTransform ${hash(this.transform)}`;
  }
  assemble() {
    const Qt = [], Zt = [], $n = [];
    for (const kn of this.transform.joinaggregate)
      Zt.push(kn.op), $n.push(this.getDefaultName(kn)), Qt.push(kn.field === void 0 ? null : kn.field);
    const Sn = this.transform.groupby;
    return {
      type: "joinaggregate",
      as: $n,
      ops: Zt,
      fields: Qt,
      ...Sn !== void 0 ? { groupby: Sn } : {}
    };
  }
}
function getStackByFields(_e) {
  return _e.stack.stackBy.reduce((Qt, Zt) => {
    const $n = Zt.fieldDef, Sn = vgField($n);
    return Sn && Qt.push(Sn), Qt;
  }, []);
}
function isValidAsArray(_e) {
  return isArray(_e) && _e.every((Qt) => isString(Qt)) && _e.length > 1;
}
class StackNode extends DataFlowNode {
  clone() {
    return new StackNode(null, duplicate(this._stack));
  }
  constructor(Qt, Zt) {
    super(Qt), this._stack = Zt;
  }
  static makeFromTransform(Qt, Zt) {
    const { stack: $n, groupby: Sn, as: kn, offset: Kn = "zero" } = Zt, er = [], Cr = [];
    if (Zt.sort !== void 0)
      for (const Ms of Zt.sort)
        er.push(Ms.field), Cr.push(getFirstDefined(Ms.order, "ascending"));
    const kr = {
      field: er,
      order: Cr
    };
    let Yr;
    return isValidAsArray(kn) ? Yr = kn : isString(kn) ? Yr = [kn, `${kn}_end`] : Yr = [`${Zt.stack}_start`, `${Zt.stack}_end`], new StackNode(Qt, {
      dimensionFieldDefs: [],
      stackField: $n,
      groupby: Sn,
      offset: Kn,
      sort: kr,
      facetby: [],
      as: Yr
    });
  }
  static makeFromEncoding(Qt, Zt) {
    const $n = Zt.stack, { encoding: Sn } = Zt;
    if (!$n)
      return null;
    const { groupbyChannels: kn, fieldChannel: Kn, offset: er, impute: Cr } = $n, kr = kn.map((Ls) => {
      const js = Sn[Ls];
      return getFieldDef(js);
    }).filter((Ls) => !!Ls), Yr = getStackByFields(Zt), Ms = Zt.encoding.order;
    let Ds;
    if (isArray(Ms) || isFieldDef(Ms))
      Ds = sortParams(Ms);
    else {
      const Ls = isOrderOnlyDef(Ms) ? Ms.sort : Kn === "y" ? "descending" : "ascending";
      Ds = Yr.reduce((js, zs) => (js.field.push(zs), js.order.push(Ls), js), { field: [], order: [] });
    }
    return new StackNode(Qt, {
      dimensionFieldDefs: kr,
      stackField: Zt.vgField(Kn),
      facetby: [],
      stackby: Yr,
      sort: Ds,
      offset: er,
      impute: Cr,
      as: [
        Zt.vgField(Kn, { suffix: "start", forAs: !0 }),
        Zt.vgField(Kn, { suffix: "end", forAs: !0 })
      ]
    });
  }
  get stack() {
    return this._stack;
  }
  addDimensions(Qt) {
    this._stack.facetby.push(...Qt);
  }
  dependentFields() {
    const Qt = /* @__PURE__ */ new Set();
    return Qt.add(this._stack.stackField), this.getGroupbyFields().forEach(Qt.add, Qt), this._stack.facetby.forEach(Qt.add, Qt), this._stack.sort.field.forEach(Qt.add, Qt), Qt;
  }
  producedFields() {
    return new Set(this._stack.as);
  }
  hash() {
    return `Stack ${hash(this._stack)}`;
  }
  getGroupbyFields() {
    const { dimensionFieldDefs: Qt, impute: Zt, groupby: $n } = this._stack;
    return Qt.length > 0 ? Qt.map((Sn) => Sn.bin ? Zt ? [vgField(Sn, { binSuffix: "mid" })] : [
      // For binned group by field without impute, we need both bin (start) and bin_end
      vgField(Sn, {}),
      vgField(Sn, { binSuffix: "end" })
    ] : [vgField(Sn)]).flat() : $n ?? [];
  }
  assemble() {
    const Qt = [], { facetby: Zt, dimensionFieldDefs: $n, stackField: Sn, stackby: kn, sort: Kn, offset: er, impute: Cr, as: kr } = this._stack;
    if (Cr)
      for (const Yr of $n) {
        const { bandPosition: Ms = 0.5, bin: Ds } = Yr;
        if (Ds) {
          const Ls = vgField(Yr, { expr: "datum" }), js = vgField(Yr, { expr: "datum", binSuffix: "end" });
          Qt.push({
            type: "formula",
            expr: `${Ms}*${Ls}+${1 - Ms}*${js}`,
            as: vgField(Yr, { binSuffix: "mid", forAs: !0 })
          });
        }
        Qt.push({
          type: "impute",
          field: Sn,
          groupby: [...kn, ...Zt],
          key: vgField(Yr, { binSuffix: "mid" }),
          method: "value",
          value: 0
        });
      }
    return Qt.push({
      type: "stack",
      groupby: [...this.getGroupbyFields(), ...Zt],
      field: Sn,
      sort: Kn,
      as: kr,
      offset: er
    }), Qt;
  }
}
class WindowTransformNode extends DataFlowNode {
  clone() {
    return new WindowTransformNode(null, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt;
  }
  addDimensions(Qt) {
    this.transform.groupby = unique(this.transform.groupby.concat(Qt), (Zt) => Zt);
  }
  dependentFields() {
    const Qt = /* @__PURE__ */ new Set();
    return (this.transform.groupby ?? []).forEach(Qt.add, Qt), (this.transform.sort ?? []).forEach((Zt) => Qt.add(Zt.field)), this.transform.window.map((Zt) => Zt.field).filter((Zt) => Zt !== void 0).forEach(Qt.add, Qt), Qt;
  }
  producedFields() {
    return new Set(this.transform.window.map(this.getDefaultName));
  }
  getDefaultName(Qt) {
    return Qt.as ?? vgField(Qt);
  }
  hash() {
    return `WindowTransform ${hash(this.transform)}`;
  }
  assemble() {
    const Qt = [], Zt = [], $n = [], Sn = [];
    for (const Ms of this.transform.window)
      Zt.push(Ms.op), $n.push(this.getDefaultName(Ms)), Sn.push(Ms.param === void 0 ? null : Ms.param), Qt.push(Ms.field === void 0 ? null : Ms.field);
    const kn = this.transform.frame, Kn = this.transform.groupby;
    if (kn && kn[0] === null && kn[1] === null && Zt.every((Ms) => isAggregateOp(Ms)))
      return {
        type: "joinaggregate",
        as: $n,
        ops: Zt,
        fields: Qt,
        ...Kn !== void 0 ? { groupby: Kn } : {}
      };
    const er = [], Cr = [];
    if (this.transform.sort !== void 0)
      for (const Ms of this.transform.sort)
        er.push(Ms.field), Cr.push(Ms.order ?? "ascending");
    const kr = {
      field: er,
      order: Cr
    }, Yr = this.transform.ignorePeers;
    return {
      type: "window",
      params: Sn,
      as: $n,
      ops: Zt,
      fields: Qt,
      sort: kr,
      ...Yr !== void 0 ? { ignorePeers: Yr } : {},
      ...Kn !== void 0 ? { groupby: Kn } : {},
      ...kn !== void 0 ? { frame: kn } : {}
    };
  }
}
function cloneSubtree(_e) {
  function Qt(Zt) {
    if (!(Zt instanceof FacetNode)) {
      const $n = Zt.clone();
      if ($n instanceof OutputNode) {
        const Sn = FACET_SCALE_PREFIX + $n.getSource();
        $n.setSource(Sn), _e.model.component.data.outputNodes[Sn] = $n;
      } else
        ($n instanceof AggregateNode || $n instanceof StackNode || $n instanceof WindowTransformNode || $n instanceof JoinAggregateTransformNode) && $n.addDimensions(_e.fields);
      for (const Sn of Zt.children.flatMap(Qt))
        Sn.parent = $n;
      return [$n];
    }
    return Zt.children.flatMap(Qt);
  }
  return Qt;
}
function moveFacetDown(_e) {
  if (_e instanceof FacetNode)
    if (_e.numChildren() === 1 && !(_e.children[0] instanceof OutputNode)) {
      const Qt = _e.children[0];
      (Qt instanceof AggregateNode || Qt instanceof StackNode || Qt instanceof WindowTransformNode || Qt instanceof JoinAggregateTransformNode) && Qt.addDimensions(_e.fields), Qt.swapWithParent(), moveFacetDown(_e);
    } else {
      const Qt = _e.model.component.data.main;
      moveMainDownToFacet(Qt);
      const Zt = cloneSubtree(_e), $n = _e.children.map(Zt).flat();
      for (const Sn of $n)
        Sn.parent = Qt;
    }
  else
    _e.children.map(moveFacetDown);
}
function moveMainDownToFacet(_e) {
  if (_e instanceof OutputNode && _e.type === DataSourceType.Main && _e.numChildren() === 1) {
    const Qt = _e.children[0];
    Qt instanceof FacetNode || (Qt.swapWithParent(), moveMainDownToFacet(_e));
  }
}
const FACET_SCALE_PREFIX = "scale_", MAX_OPTIMIZATION_RUNS = 5;
function checkLinks(_e) {
  for (const Qt of _e) {
    for (const Zt of Qt.children)
      if (Zt.parent !== Qt)
        return !1;
    if (!checkLinks(Qt.children))
      return !1;
  }
  return !0;
}
function runOptimizer(_e, Qt) {
  let Zt = !1;
  for (const $n of Qt)
    Zt = _e.optimize($n) || Zt;
  return Zt;
}
function optimizationDataflowHelper(_e, Qt, Zt) {
  let $n = _e.sources, Sn = !1;
  return Sn = runOptimizer(new RemoveUnnecessaryOutputNodes(), $n) || Sn, Sn = runOptimizer(new RemoveUnnecessaryIdentifierNodes(Qt), $n) || Sn, $n = $n.filter((kn) => kn.numChildren() > 0), Sn = runOptimizer(new RemoveUnusedSubtrees(), $n) || Sn, $n = $n.filter((kn) => kn.numChildren() > 0), Zt || (Sn = runOptimizer(new MoveParseUp(), $n) || Sn, Sn = runOptimizer(new MergeBins(Qt), $n) || Sn, Sn = runOptimizer(new RemoveDuplicateTimeUnits(), $n) || Sn, Sn = runOptimizer(new MergeParse(), $n) || Sn, Sn = runOptimizer(new MergeAggregates(), $n) || Sn, Sn = runOptimizer(new MergeTimeUnits(), $n) || Sn, Sn = runOptimizer(new MergeIdenticalNodes(), $n) || Sn, Sn = runOptimizer(new MergeOutputs(), $n) || Sn), _e.sources = $n, Sn;
}
function optimizeDataflow(_e, Qt) {
  checkLinks(_e.sources);
  let Zt = 0, $n = 0;
  for (let Sn = 0; Sn < MAX_OPTIMIZATION_RUNS && optimizationDataflowHelper(_e, Qt, !0); Sn++)
    Zt++;
  _e.sources.map(moveFacetDown);
  for (let Sn = 0; Sn < MAX_OPTIMIZATION_RUNS && optimizationDataflowHelper(_e, Qt, !1); Sn++)
    $n++;
  checkLinks(_e.sources), Math.max(Zt, $n) === MAX_OPTIMIZATION_RUNS && warn$1(`Maximum optimization runs(${MAX_OPTIMIZATION_RUNS}) reached.`);
}
class SignalRefWrapper {
  constructor(Qt) {
    Object.defineProperty(this, "signal", {
      enumerable: !0,
      get: Qt
    });
  }
  static fromName(Qt, Zt) {
    return new SignalRefWrapper(() => Qt(Zt));
  }
}
function parseScaleDomain(_e) {
  isUnitModel(_e) ? parseUnitScaleDomain(_e) : parseNonUnitScaleDomain(_e);
}
function parseUnitScaleDomain(_e) {
  const Qt = _e.component.scales;
  for (const Zt of keys$2(Qt)) {
    const $n = parseDomainForChannel(_e, Zt);
    if (Qt[Zt].setWithExplicit("domains", $n), parseSelectionDomain(_e, Zt), _e.component.data.isFaceted) {
      let kn = _e;
      for (; !isFacetModel(kn) && kn.parent; )
        kn = kn.parent;
      if (kn.component.resolve.scale[Zt] === "shared")
        for (const er of $n.value)
          isDataRefDomain(er) && (er.data = FACET_SCALE_PREFIX + er.data.replace(FACET_SCALE_PREFIX, ""));
    }
  }
}
function parseNonUnitScaleDomain(_e) {
  for (const Zt of _e.children)
    parseScaleDomain(Zt);
  const Qt = _e.component.scales;
  for (const Zt of keys$2(Qt)) {
    let $n, Sn = null;
    for (const kn of _e.children) {
      const Kn = kn.component.scales[Zt];
      if (Kn) {
        $n === void 0 ? $n = Kn.getWithExplicit("domains") : $n = mergeValuesWithExplicit($n, Kn.getWithExplicit("domains"), "domains", "scale", domainsTieBreaker);
        const er = Kn.get("selectionExtent");
        Sn && er && Sn.param !== er.param && warn$1(NEEDS_SAME_SELECTION), Sn = er;
      }
    }
    Qt[Zt].setWithExplicit("domains", $n), Sn && Qt[Zt].set("selectionExtent", Sn, !0);
  }
}
function normalizeUnaggregatedDomain(_e, Qt, Zt, $n) {
  if (_e === "unaggregated") {
    const { valid: Sn, reason: kn } = canUseUnaggregatedDomain(Qt, Zt);
    if (!Sn) {
      warn$1(kn);
      return;
    }
  } else if (_e === void 0 && $n.useUnaggregatedDomain) {
    const { valid: Sn } = canUseUnaggregatedDomain(Qt, Zt);
    if (Sn)
      return "unaggregated";
  }
  return _e;
}
function parseDomainForChannel(_e, Qt) {
  const Zt = _e.getScaleComponent(Qt).get("type"), { encoding: $n } = _e, Sn = normalizeUnaggregatedDomain(_e.scaleDomain(Qt), _e.typedFieldDef(Qt), Zt, _e.config.scale);
  return Sn !== _e.scaleDomain(Qt) && (_e.specifiedScales[Qt] = {
    ..._e.specifiedScales[Qt],
    domain: Sn
  }), Qt === "x" && getFieldOrDatumDef($n.x2) ? getFieldOrDatumDef($n.x) ? mergeValuesWithExplicit(parseSingleChannelDomain(Zt, Sn, _e, "x"), parseSingleChannelDomain(Zt, Sn, _e, "x2"), "domain", "scale", domainsTieBreaker) : parseSingleChannelDomain(Zt, Sn, _e, "x2") : Qt === "y" && getFieldOrDatumDef($n.y2) ? getFieldOrDatumDef($n.y) ? mergeValuesWithExplicit(parseSingleChannelDomain(Zt, Sn, _e, "y"), parseSingleChannelDomain(Zt, Sn, _e, "y2"), "domain", "scale", domainsTieBreaker) : parseSingleChannelDomain(Zt, Sn, _e, "y2") : parseSingleChannelDomain(Zt, Sn, _e, Qt);
}
function mapDomainToDataSignal(_e, Qt, Zt) {
  return _e.map(($n) => ({ signal: `{data: ${valueExpr($n, { timeUnit: Zt, type: Qt })}}` }));
}
function convertDomainIfItIsDateTime(_e, Qt, Zt) {
  var Sn;
  const $n = (Sn = normalizeTimeUnit(Zt)) == null ? void 0 : Sn.unit;
  return Qt === "temporal" || $n ? mapDomainToDataSignal(_e, Qt, $n) : [_e];
}
function parseSingleChannelDomain(_e, Qt, Zt, $n) {
  const { encoding: Sn } = Zt, kn = getFieldOrDatumDef(Sn[$n]), { type: Kn } = kn, er = kn.timeUnit;
  if (isDomainUnionWith(Qt)) {
    const Ms = parseSingleChannelDomain(_e, void 0, Zt, $n), Ds = convertDomainIfItIsDateTime(Qt.unionWith, Kn, er);
    return makeExplicit([...Ds, ...Ms.value]);
  } else {
    if (isSignalRef(Qt))
      return makeExplicit([Qt]);
    if (Qt && Qt !== "unaggregated" && !isParameterDomain(Qt))
      return makeExplicit(convertDomainIfItIsDateTime(Qt, Kn, er));
  }
  const Cr = Zt.stack;
  if (Cr && $n === Cr.fieldChannel) {
    if (Cr.offset === "normalize")
      return makeImplicit([[0, 1]]);
    const Ms = Zt.requestDataName(DataSourceType.Main);
    return makeImplicit([
      {
        data: Ms,
        field: Zt.vgField($n, { suffix: "start" })
      },
      {
        data: Ms,
        field: Zt.vgField($n, { suffix: "end" })
      }
    ]);
  }
  const kr = isScaleChannel($n) && isFieldDef(kn) ? domainSort(Zt, $n, _e) : void 0;
  if (isDatumDef(kn)) {
    const Ms = convertDomainIfItIsDateTime([kn.datum], Kn, er);
    return makeImplicit(Ms);
  }
  const Yr = kn;
  if (Qt === "unaggregated") {
    const Ms = Zt.requestDataName(DataSourceType.Main), { field: Ds } = kn;
    return makeImplicit([
      {
        data: Ms,
        field: vgField({ field: Ds, aggregate: "min" })
      },
      {
        data: Ms,
        field: vgField({ field: Ds, aggregate: "max" })
      }
    ]);
  } else if (isBinning(Yr.bin)) {
    if (hasDiscreteDomain(_e))
      return makeImplicit(_e === "bin-ordinal" ? [] : [
        {
          // If sort by aggregation of a specified sort field, we need to use RAW table,
          // so we can aggregate values for the scale independently from the main aggregation.
          data: isBoolean$1(kr) ? Zt.requestDataName(DataSourceType.Main) : Zt.requestDataName(DataSourceType.Raw),
          // Use range if we added it and the scale does not support computing a range as a signal.
          field: Zt.vgField($n, binRequiresRange(Yr, $n) ? { binSuffix: "range" } : {}),
          // we have to use a sort object if sort = true to make the sort correct by bin start
          sort: kr === !0 || !isObject(kr) ? {
            field: Zt.vgField($n, {}),
            op: "min"
            // min or max doesn't matter since we sort by the start of the bin range
          } : kr
        }
      ]);
    {
      const { bin: Ms } = Yr;
      if (isBinning(Ms)) {
        const Ds = getBinSignalName(Zt, Yr.field, Ms);
        return makeImplicit([
          new SignalRefWrapper(() => {
            const Ls = Zt.getSignalName(Ds);
            return `[${Ls}.start, ${Ls}.stop]`;
          })
        ]);
      } else
        return makeImplicit([
          {
            data: Zt.requestDataName(DataSourceType.Main),
            field: Zt.vgField($n, {})
          }
        ]);
    }
  } else if (Yr.timeUnit && contains$1(["time", "utc"], _e) && hasBandEnd(Yr, isUnitModel(Zt) ? Zt.encoding[getSecondaryRangeChannel($n)] : void 0, Zt.markDef, Zt.config)) {
    const Ms = Zt.requestDataName(DataSourceType.Main);
    return makeImplicit([
      {
        data: Ms,
        field: Zt.vgField($n)
      },
      {
        data: Ms,
        field: Zt.vgField($n, { suffix: "end" })
      }
    ]);
  } else
    return makeImplicit(kr ? [
      {
        // If sort by aggregation of a specified sort field, we need to use RAW table,
        // so we can aggregate values for the scale independently from the main aggregation.
        data: isBoolean$1(kr) ? Zt.requestDataName(DataSourceType.Main) : Zt.requestDataName(DataSourceType.Raw),
        field: Zt.vgField($n),
        sort: kr
      }
    ] : [
      {
        data: Zt.requestDataName(DataSourceType.Main),
        field: Zt.vgField($n)
      }
    ]);
}
function normalizeSortField(_e, Qt) {
  const { op: Zt, field: $n, order: Sn } = _e;
  return {
    // Apply default op
    op: Zt ?? (Qt ? "sum" : DEFAULT_SORT_OP),
    // flatten nested fields
    ...$n ? { field: replacePathInField($n) } : {},
    ...Sn ? { order: Sn } : {}
  };
}
function parseSelectionDomain(_e, Qt) {
  var er;
  const Zt = _e.component.scales[Qt], $n = _e.specifiedScales[Qt].domain, Sn = (er = _e.fieldDef(Qt)) == null ? void 0 : er.bin, kn = isParameterDomain($n) && $n, Kn = isBinParams(Sn) && isParameterExtent(Sn.extent) && Sn.extent;
  (kn || Kn) && Zt.set("selectionExtent", kn ?? Kn, !0);
}
function domainSort(_e, Qt, Zt) {
  if (!hasDiscreteDomain(Zt))
    return;
  const $n = _e.fieldDef(Qt), Sn = $n.sort;
  if (isSortArray(Sn))
    return {
      op: "min",
      field: sortArrayIndexField($n, Qt),
      order: "ascending"
    };
  const { stack: kn } = _e, Kn = kn ? /* @__PURE__ */ new Set([...kn.groupbyFields, ...kn.stackBy.map((er) => er.fieldDef.field)]) : void 0;
  if (isSortField(Sn)) {
    const er = kn && !Kn.has(Sn.field);
    return normalizeSortField(Sn, er);
  } else if (isSortByEncoding(Sn)) {
    const { encoding: er, order: Cr } = Sn, kr = _e.fieldDef(er), { aggregate: Yr, field: Ms } = kr, Ds = kn && !Kn.has(Ms);
    if (isArgminDef(Yr) || isArgmaxDef(Yr))
      return normalizeSortField({
        field: vgField(kr),
        order: Cr
      }, Ds);
    if (isAggregateOp(Yr) || !Yr)
      return normalizeSortField({
        op: Yr,
        field: Ms,
        order: Cr
      }, Ds);
  } else {
    if (Sn === "descending")
      return {
        op: "min",
        field: _e.vgField(Qt),
        order: "descending"
      };
    if (contains$1([
      "ascending",
      void 0
      /* default =ascending*/
    ], Sn))
      return !0;
  }
}
function canUseUnaggregatedDomain(_e, Qt) {
  const { aggregate: Zt, type: $n } = _e;
  return Zt ? isString(Zt) && !SHARED_DOMAIN_OPS.has(Zt) ? {
    valid: !1,
    reason: unaggregateDomainWithNonSharedDomainOp(Zt)
  } : $n === "quantitative" && Qt === "log" ? {
    valid: !1,
    reason: unaggregatedDomainWithLogScale(_e)
  } : { valid: !0 } : {
    valid: !1,
    reason: unaggregateDomainHasNoEffectForRawField(_e)
  };
}
function domainsTieBreaker(_e, Qt, Zt, $n) {
  return _e.explicit && Qt.explicit && warn$1(mergeConflictingDomainProperty(Zt, $n, _e.value, Qt.value)), { explicit: _e.explicit, value: [..._e.value, ...Qt.value] };
}
function mergeDomains(_e) {
  const Qt = unique(_e.map((Kn) => {
    if (isDataRefDomain(Kn)) {
      const { sort: er, ...Cr } = Kn;
      return Cr;
    }
    return Kn;
  }), hash), Zt = unique(_e.map((Kn) => {
    if (isDataRefDomain(Kn)) {
      const er = Kn.sort;
      return er !== void 0 && !isBoolean$1(er) && ("op" in er && er.op === "count" && delete er.field, er.order === "ascending" && delete er.order), er;
    }
  }).filter((Kn) => Kn !== void 0), hash);
  if (Qt.length === 0)
    return;
  if (Qt.length === 1) {
    const Kn = _e[0];
    if (isDataRefDomain(Kn) && Zt.length > 0) {
      let er = Zt[0];
      if (Zt.length > 1) {
        warn$1(MORE_THAN_ONE_SORT);
        const Cr = Zt.filter((kr) => isObject(kr) && "op" in kr && kr.op !== "min");
        Zt.every((kr) => isObject(kr) && "op" in kr) && Cr.length === 1 ? er = Cr[0] : er = !0;
      } else if (isObject(er) && "field" in er) {
        const Cr = er.field;
        Kn.field === Cr && (er = er.order ? { order: er.order } : !0);
      }
      return {
        ...Kn,
        sort: er
      };
    }
    return Kn;
  }
  const $n = unique(Zt.map((Kn) => isBoolean$1(Kn) || !("op" in Kn) || isString(Kn.op) && Kn.op in MULTIDOMAIN_SORT_OP_INDEX ? Kn : (warn$1(domainSortDropped(Kn)), !0)), hash);
  let Sn;
  $n.length === 1 ? Sn = $n[0] : $n.length > 1 && (warn$1(MORE_THAN_ONE_SORT), Sn = !0);
  const kn = unique(_e.map((Kn) => isDataRefDomain(Kn) ? Kn.data : null), (Kn) => Kn);
  return kn.length === 1 && kn[0] !== null ? {
    data: kn[0],
    fields: Qt.map((er) => er.field),
    ...Sn ? { sort: Sn } : {}
  } : { fields: Qt, ...Sn ? { sort: Sn } : {} };
}
function getFieldFromDomain(_e) {
  if (isDataRefDomain(_e) && isString(_e.field))
    return _e.field;
  if (isDataRefUnionedDomain(_e)) {
    let Qt;
    for (const Zt of _e.fields)
      if (isDataRefDomain(Zt) && isString(Zt.field)) {
        if (!Qt)
          Qt = Zt.field;
        else if (Qt !== Zt.field)
          return warn$1(FACETED_INDEPENDENT_DIFFERENT_SOURCES), Qt;
      }
    return warn$1(FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES), Qt;
  } else if (isFieldRefUnionDomain(_e)) {
    warn$1(FACETED_INDEPENDENT_SAME_SOURCE);
    const Qt = _e.fields[0];
    return isString(Qt) ? Qt : void 0;
  }
}
function assembleDomain(_e, Qt) {
  const $n = _e.component.scales[Qt].get("domains").map((Sn) => (isDataRefDomain(Sn) && (Sn.data = _e.lookupDataSource(Sn.data)), Sn));
  return mergeDomains($n);
}
function assembleScales(_e) {
  return isLayerModel(_e) || isConcatModel(_e) ? _e.children.reduce((Qt, Zt) => Qt.concat(assembleScales(Zt)), assembleScalesForModel(_e)) : assembleScalesForModel(_e);
}
function assembleScalesForModel(_e) {
  return keys$2(_e.component.scales).reduce((Qt, Zt) => {
    const $n = _e.component.scales[Zt];
    if ($n.merged)
      return Qt;
    const Sn = $n.combine(), { name: kn, type: Kn, selectionExtent: er, domains: Cr, range: kr, reverse: Yr, ...Ms } = Sn, Ds = assembleScaleRange(Sn.range, kn, Zt, _e), Ls = assembleDomain(_e, Zt), js = er ? assembleSelectionScaleDomain(_e, er, $n, Ls) : null;
    return Qt.push({
      name: kn,
      type: Kn,
      ...Ls ? { domain: Ls } : {},
      ...js ? { domainRaw: js } : {},
      range: Ds,
      ...Yr !== void 0 ? { reverse: Yr } : {},
      ...Ms
    }), Qt;
  }, []);
}
function assembleScaleRange(_e, Qt, Zt, $n) {
  if (isXorY(Zt)) {
    if (isVgRangeStep(_e))
      return {
        step: { signal: `${Qt}_step` }
      };
  } else if (isObject(_e) && isDataRefDomain(_e))
    return {
      ..._e,
      data: $n.lookupDataSource(_e.data)
    };
  return _e;
}
class ScaleComponent extends Split {
  constructor(Qt, Zt) {
    super(
      {},
      // no initial explicit property
      { name: Qt }
      // name as initial implicit property
    ), this.merged = !1, this.setWithExplicit("type", Zt);
  }
  /**
   * Whether the scale definitely includes zero in the domain
   */
  domainDefinitelyIncludesZero() {
    return this.get("zero") !== !1 ? !0 : some(this.get("domains"), (Qt) => isArray(Qt) && Qt.length === 2 && Qt[0] <= 0 && Qt[1] >= 0);
  }
}
const RANGE_PROPERTIES = ["range", "scheme"];
function parseUnitScaleRange(_e) {
  const Qt = _e.component.scales;
  for (const Zt of SCALE_CHANNELS) {
    const $n = Qt[Zt];
    if (!$n)
      continue;
    const Sn = parseRangeForChannel(Zt, _e);
    $n.setWithExplicit("range", Sn);
  }
}
function getBinStepSignal(_e, Qt) {
  const Zt = _e.fieldDef(Qt);
  if (Zt != null && Zt.bin) {
    const { bin: $n, field: Sn } = Zt, kn = getSizeChannel(Qt), Kn = _e.getName(kn);
    if (isObject($n) && $n.binned && $n.step !== void 0)
      return new SignalRefWrapper(() => {
        const er = _e.scaleName(Qt), Cr = `(domain("${er}")[1] - domain("${er}")[0]) / ${$n.step}`;
        return `${_e.getSignalName(Kn)} / (${Cr})`;
      });
    if (isBinning($n)) {
      const er = getBinSignalName(_e, Sn, $n);
      return new SignalRefWrapper(() => {
        const Cr = _e.getSignalName(er), kr = `(${Cr}.stop - ${Cr}.start) / ${Cr}.step`;
        return `${_e.getSignalName(Kn)} / (${kr})`;
      });
    }
  }
}
function parseRangeForChannel(_e, Qt) {
  const Zt = Qt.specifiedScales[_e], { size: $n } = Qt, kn = Qt.getScaleComponent(_e).get("type");
  for (const Ms of RANGE_PROPERTIES)
    if (Zt[Ms] !== void 0) {
      const Ds = scaleTypeSupportProperty(kn, Ms), Ls = channelScalePropertyIncompatability(_e, Ms);
      if (!Ds)
        warn$1(scalePropertyNotWorkWithScaleType(kn, Ms, _e));
      else if (Ls)
        warn$1(Ls);
      else
        switch (Ms) {
          case "range": {
            const js = Zt.range;
            if (isArray(js)) {
              if (isXorY(_e))
                return makeExplicit(js.map((zs) => {
                  if (zs === "width" || zs === "height") {
                    const Fs = Qt.getName(zs), Bs = Qt.getSignalName.bind(Qt);
                    return SignalRefWrapper.fromName(Bs, Fs);
                  }
                  return zs;
                }));
            } else if (isObject(js))
              return makeExplicit({
                data: Qt.requestDataName(DataSourceType.Main),
                field: js.field,
                sort: { op: "min", field: Qt.vgField(_e) }
              });
            return makeExplicit(js);
          }
          case "scheme":
            return makeExplicit(parseScheme(Zt[Ms]));
        }
    }
  const Kn = _e === X$1 || _e === "xOffset" ? "width" : "height", er = $n[Kn];
  if (isStep(er)) {
    if (isXorY(_e))
      if (hasDiscreteDomain(kn)) {
        const Ms = getPositionStep(er, Qt, _e);
        if (Ms)
          return makeExplicit({ step: Ms });
      } else
        warn$1(stepDropped(Kn));
    else if (isXorYOffset(_e)) {
      const Ms = _e === XOFFSET ? "x" : "y";
      if (Qt.getScaleComponent(Ms).get("type") === "band") {
        const js = getOffsetStep(er, kn);
        if (js)
          return makeExplicit(js);
      }
    }
  }
  const { rangeMin: Cr, rangeMax: kr } = Zt, Yr = defaultRange(_e, Qt);
  return (Cr !== void 0 || kr !== void 0) && // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same
  scaleTypeSupportProperty(kn, "rangeMin") && isArray(Yr) && Yr.length === 2 ? makeExplicit([Cr ?? Yr[0], kr ?? Yr[1]]) : makeImplicit(Yr);
}
function parseScheme(_e) {
  return isExtendedScheme(_e) ? {
    scheme: _e.name,
    ...omit(_e, ["name"])
  } : { scheme: _e };
}
function defaultRange(_e, Qt) {
  const { size: Zt, config: $n, mark: Sn, encoding: kn } = Qt, Kn = Qt.getSignalName.bind(Qt), { type: er } = getFieldOrDatumDef(kn[_e]), kr = Qt.getScaleComponent(_e).get("type"), { domain: Yr, domainMid: Ms } = Qt.specifiedScales[_e];
  switch (_e) {
    case X$1:
    case Y$1: {
      if (contains$1(["point", "band"], kr)) {
        const js = getDiscretePositionSize(_e, Zt, $n.view);
        if (isStep(js))
          return { step: getPositionStep(js, Qt, _e) };
      }
      const Ds = getSizeChannel(_e), Ls = Qt.getName(Ds);
      return _e === Y$1 && hasContinuousDomain(kr) ? [SignalRefWrapper.fromName(Kn, Ls), 0] : [0, SignalRefWrapper.fromName(Kn, Ls)];
    }
    case XOFFSET:
    case YOFFSET:
      return getOffsetRange(_e, Qt, kr);
    case SIZE$1: {
      const Ds = Qt.component.scales[_e].get("zero"), Ls = sizeRangeMin(Sn, Ds, $n), js = sizeRangeMax(Sn, Zt, Qt, $n);
      return isContinuousToDiscrete(kr) ? interpolateRange(Ls, js, defaultContinuousToDiscreteCount(kr, $n, Yr, _e)) : [Ls, js];
    }
    case THETA:
      return [0, Math.PI * 2];
    case ANGLE:
      return [0, 360];
    case RADIUS:
      return [
        0,
        new SignalRefWrapper(() => {
          const Ds = Qt.getSignalName("width"), Ls = Qt.getSignalName("height");
          return `min(${Ds},${Ls})/2`;
        })
      ];
    case STROKEWIDTH:
      return [$n.scale.minStrokeWidth, $n.scale.maxStrokeWidth];
    case STROKEDASH:
      return [
        // TODO: add this to Vega's config.range?
        [1, 0],
        [4, 2],
        [2, 1],
        [1, 1],
        [1, 2, 4, 2]
      ];
    case SHAPE:
      return "symbol";
    case COLOR:
    case FILL:
    case STROKE:
      return kr === "ordinal" ? er === "nominal" ? "category" : "ordinal" : Ms !== void 0 ? "diverging" : Sn === "rect" || Sn === "geoshape" ? "heatmap" : "ramp";
    case OPACITY:
    case FILLOPACITY:
    case STROKEOPACITY:
      return [$n.scale.minOpacity, $n.scale.maxOpacity];
  }
}
function getPositionStep(_e, Qt, Zt) {
  const { encoding: $n } = Qt, Sn = Qt.getScaleComponent(Zt), kn = getOffsetScaleChannel(Zt), Kn = $n[kn];
  if (getStepFor({ step: _e, offsetIsDiscrete: isFieldOrDatumDef(Kn) && isDiscrete$1(Kn.type) }) === "offset" && channelHasFieldOrDatum($n, kn)) {
    const Cr = Qt.getScaleComponent(kn);
    let Yr = `domain('${Qt.scaleName(kn)}').length`;
    if (Cr.get("type") === "band") {
      const Ds = Cr.get("paddingInner") ?? Cr.get("padding") ?? 0, Ls = Cr.get("paddingOuter") ?? Cr.get("padding") ?? 0;
      Yr = `bandspace(${Yr}, ${Ds}, ${Ls})`;
    }
    const Ms = Sn.get("paddingInner") ?? Sn.get("padding");
    return {
      signal: `${_e.step} * ${Yr} / (1-${exprFromSignalRefOrValue(Ms)})`
    };
  } else
    return _e.step;
}
function getOffsetStep(_e, Qt) {
  if (getStepFor({ step: _e, offsetIsDiscrete: hasDiscreteDomain(Qt) }) === "offset")
    return { step: _e.step };
}
function getOffsetRange(_e, Qt, Zt) {
  const $n = _e === XOFFSET ? "x" : "y", kn = Qt.getScaleComponent($n).get("type"), Kn = Qt.scaleName($n);
  if (kn === "band") {
    const er = getDiscretePositionSize($n, Qt.size, Qt.config.view);
    if (isStep(er)) {
      const Cr = getOffsetStep(er, Zt);
      if (Cr)
        return Cr;
    }
    return [0, { signal: `bandwidth('${Kn}')` }];
  } else {
    const er = Qt.encoding[$n];
    if (isFieldDef(er) && er.timeUnit) {
      const Cr = durationExpr(er.timeUnit, (Yr) => `scale('${Kn}', ${Yr})`), kr = Qt.config.scale.bandWithNestedOffsetPaddingInner;
      if (kr) {
        const Yr = isSignalRef(kr) ? `${kr.signal}/2` : `${kr / 2}`, Ms = isSignalRef(kr) ? `(1 - ${kr.signal}/2)` : `${1 - kr / 2}`;
        return [{ signal: `${Yr} * (${Cr})` }, { signal: `${Ms} * (${Cr})` }];
      }
      return [0, { signal: Cr }];
    }
    return never(`Cannot use ${_e} scale if ${$n} scale is not discrete.`);
  }
}
function getDiscretePositionSize(_e, Qt, Zt) {
  const $n = _e === X$1 ? "width" : "height", Sn = Qt[$n];
  return Sn || getViewConfigDiscreteSize(Zt, $n);
}
function defaultContinuousToDiscreteCount(_e, Qt, Zt, $n) {
  switch (_e) {
    case "quantile":
      return Qt.scale.quantileCount;
    case "quantize":
      return Qt.scale.quantizeCount;
    case "threshold":
      return Zt !== void 0 && isArray(Zt) ? Zt.length + 1 : (warn$1(domainRequiredForThresholdScale($n)), 3);
  }
}
function interpolateRange(_e, Qt, Zt) {
  const $n = () => {
    const Sn = signalOrStringValue(Qt), kn = signalOrStringValue(_e), Kn = `(${Sn} - ${kn}) / (${Zt} - 1)`;
    return `sequence(${kn}, ${Sn} + ${Kn}, ${Kn})`;
  };
  return isSignalRef(Qt) ? new SignalRefWrapper($n) : { signal: $n() };
}
function sizeRangeMin(_e, Qt, Zt) {
  if (Qt)
    return isSignalRef(Qt) ? { signal: `${Qt.signal} ? 0 : ${sizeRangeMin(_e, !1, Zt)}` } : 0;
  switch (_e) {
    case "bar":
    case "tick":
      return Zt.scale.minBandSize;
    case "line":
    case "trail":
    case "rule":
      return Zt.scale.minStrokeWidth;
    case "text":
      return Zt.scale.minFontSize;
    case "point":
    case "square":
    case "circle":
      return Zt.scale.minSize;
  }
  throw new Error(incompatibleChannel("size", _e));
}
const MAX_SIZE_RANGE_STEP_RATIO = 0.95;
function sizeRangeMax(_e, Qt, Zt, $n) {
  const Sn = {
    x: getBinStepSignal(Zt, "x"),
    y: getBinStepSignal(Zt, "y")
  };
  switch (_e) {
    case "bar":
    case "tick": {
      if ($n.scale.maxBandSize !== void 0)
        return $n.scale.maxBandSize;
      const kn = minXYStep(Qt, Sn, $n.view);
      return isNumber$1(kn) ? kn - 1 : new SignalRefWrapper(() => `${kn.signal} - 1`);
    }
    case "line":
    case "trail":
    case "rule":
      return $n.scale.maxStrokeWidth;
    case "text":
      return $n.scale.maxFontSize;
    case "point":
    case "square":
    case "circle": {
      if ($n.scale.maxSize)
        return $n.scale.maxSize;
      const kn = minXYStep(Qt, Sn, $n.view);
      return isNumber$1(kn) ? Math.pow(MAX_SIZE_RANGE_STEP_RATIO * kn, 2) : new SignalRefWrapper(() => `pow(${MAX_SIZE_RANGE_STEP_RATIO} * ${kn.signal}, 2)`);
    }
  }
  throw new Error(incompatibleChannel("size", _e));
}
function minXYStep(_e, Qt, Zt) {
  const $n = isStep(_e.width) ? _e.width.step : getViewConfigDiscreteStep(Zt, "width"), Sn = isStep(_e.height) ? _e.height.step : getViewConfigDiscreteStep(Zt, "height");
  return Qt.x || Qt.y ? new SignalRefWrapper(() => `min(${[
    Qt.x ? Qt.x.signal : $n,
    Qt.y ? Qt.y.signal : Sn
  ].join(", ")})`) : Math.min($n, Sn);
}
function parseScaleProperty(_e, Qt) {
  isUnitModel(_e) ? parseUnitScaleProperty(_e, Qt) : parseNonUnitScaleProperty(_e, Qt);
}
function parseUnitScaleProperty(_e, Qt) {
  const Zt = _e.component.scales, { config: $n, encoding: Sn, markDef: kn, specifiedScales: Kn } = _e;
  for (const er of keys$2(Zt)) {
    const Cr = Kn[er], kr = Zt[er], Yr = _e.getScaleComponent(er), Ms = getFieldOrDatumDef(Sn[er]), Ds = Cr[Qt], Ls = Yr.get("type"), js = Yr.get("padding"), zs = Yr.get("paddingInner"), Fs = scaleTypeSupportProperty(Ls, Qt), Bs = channelScalePropertyIncompatability(er, Qt);
    if (Ds !== void 0 && (Fs ? Bs && warn$1(Bs) : warn$1(scalePropertyNotWorkWithScaleType(Ls, Qt, er))), Fs && Bs === void 0)
      if (Ds !== void 0) {
        const Hs = Ms.timeUnit, Ws = Ms.type;
        switch (Qt) {
          case "domainMax":
          case "domainMin":
            isDateTime(Cr[Qt]) || Ws === "temporal" || Hs ? kr.set(Qt, { signal: valueExpr(Cr[Qt], { type: Ws, timeUnit: Hs }) }, !0) : kr.set(Qt, Cr[Qt], !0);
            break;
          default:
            kr.copyKeyFromObject(Qt, Cr);
        }
      } else {
        const Hs = Qt in scaleRules ? scaleRules[Qt]({
          model: _e,
          channel: er,
          fieldOrDatumDef: Ms,
          scaleType: Ls,
          scalePadding: js,
          scalePaddingInner: zs,
          domain: Cr.domain,
          domainMin: Cr.domainMin,
          domainMax: Cr.domainMax,
          markDef: kn,
          config: $n,
          hasNestedOffsetScale: channelHasNestedOffsetScale(Sn, er),
          hasSecondaryRangeChannel: !!Sn[getSecondaryRangeChannel(er)]
        }) : $n.scale[Qt];
        Hs !== void 0 && kr.set(Qt, Hs, !1);
      }
  }
}
const scaleRules = {
  bins: ({ model: _e, fieldOrDatumDef: Qt }) => isFieldDef(Qt) ? bins(_e, Qt) : void 0,
  interpolate: ({ channel: _e, fieldOrDatumDef: Qt }) => interpolate$1(_e, Qt.type),
  nice: ({ scaleType: _e, channel: Qt, domain: Zt, domainMin: $n, domainMax: Sn, fieldOrDatumDef: kn }) => nice(_e, Qt, Zt, $n, Sn, kn),
  padding: ({ channel: _e, scaleType: Qt, fieldOrDatumDef: Zt, markDef: $n, config: Sn }) => padding(_e, Qt, Sn.scale, Zt, $n, Sn.bar),
  paddingInner: ({ scalePadding: _e, channel: Qt, markDef: Zt, scaleType: $n, config: Sn, hasNestedOffsetScale: kn }) => paddingInner(_e, Qt, Zt.type, $n, Sn.scale, kn),
  paddingOuter: ({ scalePadding: _e, channel: Qt, scaleType: Zt, scalePaddingInner: $n, config: Sn, hasNestedOffsetScale: kn }) => paddingOuter(_e, Qt, Zt, $n, Sn.scale, kn),
  reverse: ({ fieldOrDatumDef: _e, scaleType: Qt, channel: Zt, config: $n }) => {
    const Sn = isFieldDef(_e) ? _e.sort : void 0;
    return reverse(Qt, Sn, Zt, $n.scale);
  },
  zero: ({ channel: _e, fieldOrDatumDef: Qt, domain: Zt, markDef: $n, scaleType: Sn, config: kn, hasSecondaryRangeChannel: Kn }) => zero(_e, Qt, Zt, $n, Sn, kn.scale, Kn)
};
function parseScaleRange(_e) {
  isUnitModel(_e) ? parseUnitScaleRange(_e) : parseNonUnitScaleProperty(_e, "range");
}
function parseNonUnitScaleProperty(_e, Qt) {
  const Zt = _e.component.scales;
  for (const $n of _e.children)
    Qt === "range" ? parseScaleRange($n) : parseScaleProperty($n, Qt);
  for (const $n of keys$2(Zt)) {
    let Sn;
    for (const kn of _e.children) {
      const Kn = kn.component.scales[$n];
      if (Kn) {
        const er = Kn.getWithExplicit(Qt);
        Sn = mergeValuesWithExplicit(Sn, er, Qt, "scale", tieBreakByComparing((Cr, kr) => {
          switch (Qt) {
            case "range":
              return Cr.step && kr.step ? Cr.step - kr.step : 0;
          }
          return 0;
        }));
      }
    }
    Zt[$n].setWithExplicit(Qt, Sn);
  }
}
function bins(_e, Qt) {
  const Zt = Qt.bin;
  if (isBinning(Zt)) {
    const $n = getBinSignalName(_e, Qt.field, Zt);
    return new SignalRefWrapper(() => _e.getSignalName($n));
  } else if (isBinned(Zt) && isBinParams(Zt) && Zt.step !== void 0)
    return {
      step: Zt.step
    };
}
function interpolate$1(_e, Qt) {
  if (contains$1([COLOR, FILL, STROKE], _e) && Qt !== "nominal")
    return "hcl";
}
function nice(_e, Qt, Zt, $n, Sn, kn) {
  var Kn;
  if (!((Kn = getFieldDef(kn)) != null && Kn.bin || isArray(Zt) || Sn != null || $n != null || contains$1([ScaleType.TIME, ScaleType.UTC], _e)))
    return isXorY(Qt) ? !0 : void 0;
}
function padding(_e, Qt, Zt, $n, Sn, kn) {
  if (isXorY(_e)) {
    if (isContinuousToContinuous(Qt)) {
      if (Zt.continuousPadding !== void 0)
        return Zt.continuousPadding;
      const { type: Kn, orient: er } = Sn;
      if (Kn === "bar" && !(isFieldDef($n) && ($n.bin || $n.timeUnit)) && (er === "vertical" && _e === "x" || er === "horizontal" && _e === "y"))
        return kn.continuousBandSize;
    }
    if (Qt === ScaleType.POINT)
      return Zt.pointPadding;
  }
}
function paddingInner(_e, Qt, Zt, $n, Sn, kn = !1) {
  if (_e === void 0) {
    if (isXorY(Qt)) {
      const { bandPaddingInner: Kn, barBandPaddingInner: er, rectBandPaddingInner: Cr, bandWithNestedOffsetPaddingInner: kr } = Sn;
      return kn ? kr : getFirstDefined(Kn, Zt === "bar" ? er : Cr);
    } else if (isXorYOffset(Qt) && $n === ScaleType.BAND)
      return Sn.offsetBandPaddingInner;
  }
}
function paddingOuter(_e, Qt, Zt, $n, Sn, kn = !1) {
  if (_e === void 0) {
    if (isXorY(Qt)) {
      const { bandPaddingOuter: Kn, bandWithNestedOffsetPaddingOuter: er } = Sn;
      if (kn)
        return er;
      if (Zt === ScaleType.BAND)
        return getFirstDefined(
          Kn,
          /* By default, paddingOuter is paddingInner / 2. The reason is that
            size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter).
            and we want the width/height to be integer by default.
            Note that step (by default) and cardinality are integers.) */
          isSignalRef($n) ? { signal: `${$n.signal}/2` } : $n / 2
        );
    } else if (isXorYOffset(Qt)) {
      if (Zt === ScaleType.POINT)
        return 0.5;
      if (Zt === ScaleType.BAND)
        return Sn.offsetBandPaddingOuter;
    }
  }
}
function reverse(_e, Qt, Zt, $n) {
  if (Zt === "x" && $n.xReverse !== void 0)
    return hasContinuousDomain(_e) && Qt === "descending" ? isSignalRef($n.xReverse) ? { signal: `!${$n.xReverse.signal}` } : !$n.xReverse : $n.xReverse;
  if (hasContinuousDomain(_e) && Qt === "descending")
    return !0;
}
function zero(_e, Qt, Zt, $n, Sn, kn, Kn) {
  if (!!Zt && Zt !== "unaggregated" && hasContinuousDomain(Sn)) {
    if (isArray(Zt)) {
      const Cr = Zt[0], kr = Zt[Zt.length - 1];
      if (Cr <= 0 && kr >= 0)
        return !0;
    }
    return !1;
  }
  if (_e === "size" && Qt.type === "quantitative" && !isContinuousToDiscrete(Sn))
    return !0;
  if (!(isFieldDef(Qt) && Qt.bin) && contains$1([...POSITION_SCALE_CHANNELS, ...POLAR_POSITION_SCALE_CHANNELS], _e)) {
    const { orient: Cr, type: kr } = $n;
    return contains$1(["bar", "area", "line", "trail"], kr) && (Cr === "horizontal" && _e === "y" || Cr === "vertical" && _e === "x") ? !1 : contains$1(["bar", "area"], kr) && !Kn ? !0 : kn == null ? void 0 : kn.zero;
  }
  return !1;
}
function scaleType(_e, Qt, Zt, $n, Sn = !1) {
  const kn = defaultType(Qt, Zt, $n, Sn), { type: Kn } = _e;
  return isScaleChannel(Qt) ? Kn !== void 0 ? channelSupportScaleType(Qt, Kn) ? isFieldDef(Zt) && !scaleTypeSupportDataType(Kn, Zt.type) ? (warn$1(scaleTypeNotWorkWithFieldDef(Kn, kn)), kn) : Kn : (warn$1(scaleTypeNotWorkWithChannel(Qt, Kn, kn)), kn) : kn : null;
}
function defaultType(_e, Qt, Zt, $n) {
  var Sn;
  switch (Qt.type) {
    case "nominal":
    case "ordinal": {
      if (isColorChannel(_e) || rangeType(_e) === "discrete")
        return _e === "shape" && Qt.type === "ordinal" && warn$1(discreteChannelCannotEncode(_e, "ordinal")), "ordinal";
      if (isXorY(_e) || isXorYOffset(_e)) {
        if (contains$1(["rect", "bar", "image", "rule"], Zt.type) || $n)
          return "band";
      } else if (Zt.type === "arc" && _e in POLAR_POSITION_SCALE_CHANNEL_INDEX)
        return "band";
      const kn = Zt[getSizeChannel(_e)];
      return isRelativeBandSize(kn) || isPositionFieldOrDatumDef(Qt) && ((Sn = Qt.axis) != null && Sn.tickBand) ? "band" : "point";
    }
    case "temporal":
      return isColorChannel(_e) ? "time" : rangeType(_e) === "discrete" ? (warn$1(discreteChannelCannotEncode(_e, "temporal")), "ordinal") : isFieldDef(Qt) && Qt.timeUnit && normalizeTimeUnit(Qt.timeUnit).utc ? "utc" : "time";
    case "quantitative":
      return isColorChannel(_e) ? isFieldDef(Qt) && isBinning(Qt.bin) ? "bin-ordinal" : "linear" : rangeType(_e) === "discrete" ? (warn$1(discreteChannelCannotEncode(_e, "quantitative")), "ordinal") : "linear";
    case "geojson":
      return;
  }
  throw new Error(invalidFieldType(Qt.type));
}
function parseScales(_e, { ignoreRange: Qt } = {}) {
  parseScaleCore(_e), parseScaleDomain(_e);
  for (const Zt of NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES)
    parseScaleProperty(_e, Zt);
  Qt || parseScaleRange(_e);
}
function parseScaleCore(_e) {
  isUnitModel(_e) ? _e.component.scales = parseUnitScaleCore(_e) : _e.component.scales = parseNonUnitScaleCore(_e);
}
function parseUnitScaleCore(_e) {
  const { encoding: Qt, mark: Zt, markDef: $n } = _e, Sn = {};
  for (const kn of SCALE_CHANNELS) {
    const Kn = getFieldOrDatumDef(Qt[kn]);
    if (Kn && Zt === GEOSHAPE && kn === SHAPE && Kn.type === GEOJSON)
      continue;
    let er = Kn && Kn.scale;
    if (isXorYOffset(kn)) {
      const Cr = getMainChannelFromOffsetChannel(kn);
      if (!channelHasNestedOffsetScale(Qt, Cr)) {
        er && warn$1(offsetEncodingScaleIgnored(kn));
        continue;
      }
    }
    if (Kn && er !== null && er !== !1) {
      er ?? (er = {});
      const Cr = channelHasNestedOffsetScale(Qt, kn), kr = scaleType(er, kn, Kn, $n, Cr);
      Sn[kn] = new ScaleComponent(_e.scaleName(`${kn}`, !0), {
        value: kr,
        explicit: er.type === kr
      });
    }
  }
  return Sn;
}
const scaleTypeTieBreaker = tieBreakByComparing((_e, Qt) => scaleTypePrecedence(_e) - scaleTypePrecedence(Qt));
function parseNonUnitScaleCore(_e) {
  var Qt;
  const Zt = _e.component.scales = {}, $n = {}, Sn = _e.component.resolve;
  for (const kn of _e.children) {
    parseScaleCore(kn);
    for (const Kn of keys$2(kn.component.scales))
      if ((Qt = Sn.scale)[Kn] ?? (Qt[Kn] = defaultScaleResolve(Kn, _e)), Sn.scale[Kn] === "shared") {
        const er = $n[Kn], Cr = kn.component.scales[Kn].getWithExplicit("type");
        er ? scaleCompatible(er.value, Cr.value) ? $n[Kn] = mergeValuesWithExplicit(er, Cr, "type", "scale", scaleTypeTieBreaker) : (Sn.scale[Kn] = "independent", delete $n[Kn]) : $n[Kn] = Cr;
      }
  }
  for (const kn of keys$2($n)) {
    const Kn = _e.scaleName(kn, !0), er = $n[kn];
    Zt[kn] = new ScaleComponent(Kn, er);
    for (const Cr of _e.children) {
      const kr = Cr.component.scales[kn];
      kr && (Cr.renameScale(kr.get("name"), Kn), kr.merged = !0);
    }
  }
  return Zt;
}
class NameMap {
  constructor() {
    this.nameMap = {};
  }
  rename(Qt, Zt) {
    this.nameMap[Qt] = Zt;
  }
  has(Qt) {
    return this.nameMap[Qt] !== void 0;
  }
  get(Qt) {
    for (; this.nameMap[Qt] && Qt !== this.nameMap[Qt]; )
      Qt = this.nameMap[Qt];
    return Qt;
  }
}
function isUnitModel(_e) {
  return (_e == null ? void 0 : _e.type) === "unit";
}
function isFacetModel(_e) {
  return (_e == null ? void 0 : _e.type) === "facet";
}
function isConcatModel(_e) {
  return (_e == null ? void 0 : _e.type) === "concat";
}
function isLayerModel(_e) {
  return (_e == null ? void 0 : _e.type) === "layer";
}
class Model {
  constructor(Qt, Zt, $n, Sn, kn, Kn, er) {
    this.type = Zt, this.parent = $n, this.config = kn, this.correctDataNames = (Cr) => {
      var kr, Yr, Ms;
      return (kr = Cr.from) != null && kr.data && (Cr.from.data = this.lookupDataSource(Cr.from.data)), (Ms = (Yr = Cr.from) == null ? void 0 : Yr.facet) != null && Ms.data && (Cr.from.facet.data = this.lookupDataSource(Cr.from.facet.data)), Cr;
    }, this.parent = $n, this.config = kn, this.view = replaceExprRef(er), this.name = Qt.name ?? Sn, this.title = isText(Qt.title) ? { text: Qt.title } : Qt.title ? replaceExprRef(Qt.title) : void 0, this.scaleNameMap = $n ? $n.scaleNameMap : new NameMap(), this.projectionNameMap = $n ? $n.projectionNameMap : new NameMap(), this.signalNameMap = $n ? $n.signalNameMap : new NameMap(), this.data = Qt.data, this.description = Qt.description, this.transforms = normalizeTransform(Qt.transform ?? []), this.layout = Zt === "layer" || Zt === "unit" ? {} : extractCompositionLayout(Qt, Zt, kn), this.component = {
      data: {
        sources: $n ? $n.component.data.sources : [],
        outputNodes: $n ? $n.component.data.outputNodes : {},
        outputNodeRefCounts: $n ? $n.component.data.outputNodeRefCounts : {},
        // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined
        isFaceted: isFacetSpec(Qt) || ($n == null ? void 0 : $n.component.data.isFaceted) && Qt.data === void 0
      },
      layoutSize: new Split(),
      layoutHeaders: { row: {}, column: {}, facet: {} },
      mark: null,
      resolve: {
        scale: {},
        axis: {},
        legend: {},
        ...Kn ? duplicate(Kn) : {}
      },
      selection: null,
      scales: null,
      projection: null,
      axes: {},
      legends: {}
    };
  }
  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() {
    parseScales(this);
  }
  parseProjection() {
    parseProjection(this);
  }
  /**
   * Rename top-level spec's size to be just width / height, ignoring model name.
   * This essentially merges the top-level spec's width/height signals with the width/height signals
   * to help us reduce redundant signals declaration.
   */
  renameTopLevelLayoutSizeSignal() {
    this.getName("width") !== "width" && this.renameSignal(this.getName("width"), "width"), this.getName("height") !== "height" && this.renameSignal(this.getName("height"), "height");
  }
  parseLegends() {
    parseLegend(this);
  }
  assembleEncodeFromView(Qt) {
    const { style: Zt, ...$n } = Qt, Sn = {};
    for (const kn of keys$2($n)) {
      const Kn = $n[kn];
      Kn !== void 0 && (Sn[kn] = signalOrValueRef(Kn));
    }
    return Sn;
  }
  assembleGroupEncodeEntry(Qt) {
    let Zt = {};
    return this.view && (Zt = this.assembleEncodeFromView(this.view)), !Qt && (this.description && (Zt.description = signalOrValueRef(this.description)), this.type === "unit" || this.type === "layer") ? {
      width: this.getSizeSignalRef("width"),
      height: this.getSizeSignalRef("height"),
      ...Zt ?? {}
    } : isEmpty(Zt) ? void 0 : Zt;
  }
  assembleLayout() {
    if (!this.layout)
      return;
    const { spacing: Qt, ...Zt } = this.layout, { component: $n, config: Sn } = this, kn = assembleLayoutTitleBand($n.layoutHeaders, Sn);
    return {
      padding: Qt,
      ...this.assembleDefaultLayout(),
      ...Zt,
      ...kn ? { titleBand: kn } : {}
    };
  }
  assembleDefaultLayout() {
    return {};
  }
  assembleHeaderMarks() {
    const { layoutHeaders: Qt } = this.component;
    let Zt = [];
    for (const $n of FACET_CHANNELS)
      Qt[$n].title && Zt.push(assembleTitleGroup(this, $n));
    for (const $n of HEADER_CHANNELS)
      Zt = Zt.concat(assembleHeaderGroups(this, $n));
    return Zt;
  }
  assembleAxes() {
    return assembleAxes(this.component.axes, this.config);
  }
  assembleLegends() {
    return assembleLegends(this);
  }
  assembleProjections() {
    return assembleProjections(this);
  }
  assembleTitle() {
    const { encoding: Qt, ...Zt } = this.title ?? {}, $n = {
      ...extractTitleConfig(this.config.title).nonMarkTitleProperties,
      ...Zt,
      ...Qt ? { encode: { update: Qt } } : {}
    };
    if ($n.text)
      return contains$1(["unit", "layer"], this.type) ? contains$1(["middle", void 0], $n.anchor) && ($n.frame ?? ($n.frame = "group")) : $n.anchor ?? ($n.anchor = "start"), isEmpty($n) ? void 0 : $n;
  }
  /**
   * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals.
   */
  assembleGroup(Qt = []) {
    const Zt = {};
    Qt = Qt.concat(this.assembleSignals()), Qt.length > 0 && (Zt.signals = Qt);
    const $n = this.assembleLayout();
    $n && (Zt.layout = $n), Zt.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks());
    const Sn = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : [];
    Sn.length > 0 && (Zt.scales = Sn);
    const kn = this.assembleAxes();
    kn.length > 0 && (Zt.axes = kn);
    const Kn = this.assembleLegends();
    return Kn.length > 0 && (Zt.legends = Kn), Zt;
  }
  getName(Qt) {
    return varName((this.name ? `${this.name}_` : "") + Qt);
  }
  getDataName(Qt) {
    return this.getName(DataSourceType[Qt].toLowerCase());
  }
  /**
   * Request a data source name for the given data source type and mark that data source as required.
   * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData().
   * You can lookup the correct dataset name in assemble with `lookupDataSource`.
   */
  requestDataName(Qt) {
    const Zt = this.getDataName(Qt), $n = this.component.data.outputNodeRefCounts;
    return $n[Zt] = ($n[Zt] || 0) + 1, Zt;
  }
  getSizeSignalRef(Qt) {
    if (isFacetModel(this.parent)) {
      const Zt = getSizeTypeFromLayoutSizeType(Qt), $n = getPositionScaleChannel(Zt), Sn = this.component.scales[$n];
      if (Sn && !Sn.merged) {
        const kn = Sn.get("type"), Kn = Sn.get("range");
        if (hasDiscreteDomain(kn) && isVgRangeStep(Kn)) {
          const er = Sn.get("name"), Cr = assembleDomain(this, $n), kr = getFieldFromDomain(Cr);
          if (kr) {
            const Yr = vgField({ aggregate: "distinct", field: kr }, { expr: "datum" });
            return {
              signal: sizeExpr(er, Sn, Yr)
            };
          } else
            return warn$1(unknownField($n)), null;
        }
      }
    }
    return {
      signal: this.signalNameMap.get(this.getName(Qt))
    };
  }
  /**
   * Lookup the name of the datasource for an output node. You probably want to call this in assemble.
   */
  lookupDataSource(Qt) {
    const Zt = this.component.data.outputNodes[Qt];
    return Zt ? Zt.getSource() : Qt;
  }
  getSignalName(Qt) {
    return this.signalNameMap.get(Qt);
  }
  renameSignal(Qt, Zt) {
    this.signalNameMap.rename(Qt, Zt);
  }
  renameScale(Qt, Zt) {
    this.scaleNameMap.rename(Qt, Zt);
  }
  renameProjection(Qt, Zt) {
    this.projectionNameMap.rename(Qt, Zt);
  }
  /**
   * @return scale name for a given channel after the scale has been parsed and named.
   */
  scaleName(Qt, Zt) {
    if (Zt)
      return this.getName(Qt);
    if (
      // If there is a scale for the channel, there should be a local scale component for it
      isChannel(Qt) && isScaleChannel(Qt) && this.component.scales[Qt] || // in the scale name map (the scale get merged by its parent)
      this.scaleNameMap.has(this.getName(Qt))
    )
      return this.scaleNameMap.get(this.getName(Qt));
  }
  /**
   * @return projection name after the projection has been parsed and named.
   */
  projectionName(Qt) {
    if (Qt)
      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"));
  }
  /**
   * Traverse a model's hierarchy to get the scale component for a particular channel.
   */
  getScaleComponent(Qt) {
    if (!this.component.scales)
      throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");
    const Zt = this.component.scales[Qt];
    return Zt && !Zt.merged ? Zt : this.parent ? this.parent.getScaleComponent(Qt) : void 0;
  }
  /**
   * Traverse a model's hierarchy to get a particular selection component.
   */
  getSelectionComponent(Qt, Zt) {
    let $n = this.component.selection[Qt];
    if (!$n && this.parent && ($n = this.parent.getSelectionComponent(Qt, Zt)), !$n)
      throw new Error(selectionNotFound(Zt));
    return $n;
  }
  /**
   * Returns true if the model has a signalRef for an axis orient.
   */
  hasAxisOrientSignalRef() {
    var Qt, Zt;
    return ((Qt = this.component.axes.x) == null ? void 0 : Qt.some(($n) => $n.hasOrientSignalRef())) || ((Zt = this.component.axes.y) == null ? void 0 : Zt.some(($n) => $n.hasOrientSignalRef()));
  }
}
class ModelWithField extends Model {
  /** Get "field" reference for Vega */
  vgField(Qt, Zt = {}) {
    const $n = this.fieldDef(Qt);
    if ($n)
      return vgField($n, Zt);
  }
  reduceFieldDef(Qt, Zt) {
    return reduce(this.getMapping(), ($n, Sn, kn) => {
      const Kn = getFieldDef(Sn);
      return Kn ? Qt($n, Kn, kn) : $n;
    }, Zt);
  }
  forEachFieldDef(Qt, Zt) {
    forEach(this.getMapping(), ($n, Sn) => {
      const kn = getFieldDef($n);
      kn && Qt(kn, Sn);
    }, Zt);
  }
}
class DensityTransformNode extends DataFlowNode {
  clone() {
    return new DensityTransformNode(null, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt, this.transform = duplicate(Zt);
    const $n = this.transform.as ?? [void 0, void 0];
    this.transform.as = [$n[0] ?? "value", $n[1] ?? "density"], Zt.groupby && Zt.minsteps == null && Zt.maxsteps == null && Zt.steps == null && (this.transform.steps = 200);
  }
  dependentFields() {
    return /* @__PURE__ */ new Set([this.transform.density, ...this.transform.groupby ?? []]);
  }
  producedFields() {
    return new Set(this.transform.as);
  }
  hash() {
    return `DensityTransform ${hash(this.transform)}`;
  }
  assemble() {
    const { density: Qt, ...Zt } = this.transform;
    return {
      type: "kde",
      field: Qt,
      ...Zt
    };
  }
}
class ExtentTransformNode extends DataFlowNode {
  clone() {
    return new ExtentTransformNode(null, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt, this.transform = duplicate(Zt);
  }
  dependentFields() {
    return /* @__PURE__ */ new Set([this.transform.extent]);
  }
  producedFields() {
    return /* @__PURE__ */ new Set([]);
  }
  hash() {
    return `ExtentTransform ${hash(this.transform)}`;
  }
  assemble() {
    const { extent: Qt, param: Zt } = this.transform;
    return {
      type: "extent",
      field: Qt,
      signal: Zt
    };
  }
}
class FilterInvalidNode extends DataFlowNode {
  clone() {
    return new FilterInvalidNode(null, { ...this.filter });
  }
  constructor(Qt, Zt) {
    super(Qt), this.filter = Zt;
  }
  static make(Qt, Zt) {
    const { config: $n, mark: Sn, markDef: kn } = Zt;
    if (getMarkPropOrConfig("invalid", kn, $n) !== "filter")
      return null;
    const er = Zt.reduceFieldDef((Cr, kr, Yr) => {
      const Ms = isScaleChannel(Yr) && Zt.getScaleComponent(Yr);
      if (Ms) {
        const Ds = Ms.get("type");
        hasContinuousDomain(Ds) && kr.aggregate !== "count" && !isPathMark(Sn) && (Cr[kr.field] = kr);
      }
      return Cr;
    }, {});
    return keys$2(er).length ? new FilterInvalidNode(Qt, er) : null;
  }
  dependentFields() {
    return new Set(keys$2(this.filter));
  }
  producedFields() {
    return /* @__PURE__ */ new Set();
  }
  hash() {
    return `FilterInvalid ${hash(this.filter)}`;
  }
  /**
   * Create the VgTransforms for each of the filtered fields.
   */
  assemble() {
    const Qt = keys$2(this.filter).reduce((Zt, $n) => {
      const Sn = this.filter[$n], kn = vgField(Sn, { expr: "datum" });
      return Sn !== null && (Sn.type === "temporal" ? Zt.push(`(isDate(${kn}) || (isValid(${kn}) && isFinite(+${kn})))`) : Sn.type === "quantitative" && (Zt.push(`isValid(${kn})`), Zt.push(`isFinite(+${kn})`))), Zt;
    }, []);
    return Qt.length > 0 ? {
      type: "filter",
      expr: Qt.join(" && ")
    } : null;
  }
}
class FlattenTransformNode extends DataFlowNode {
  clone() {
    return new FlattenTransformNode(this.parent, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt, this.transform = duplicate(Zt);
    const { flatten: $n, as: Sn = [] } = this.transform;
    this.transform.as = $n.map((kn, Kn) => Sn[Kn] ?? kn);
  }
  dependentFields() {
    return new Set(this.transform.flatten);
  }
  producedFields() {
    return new Set(this.transform.as);
  }
  hash() {
    return `FlattenTransform ${hash(this.transform)}`;
  }
  assemble() {
    const { flatten: Qt, as: Zt } = this.transform;
    return {
      type: "flatten",
      fields: Qt,
      as: Zt
    };
  }
}
class FoldTransformNode extends DataFlowNode {
  clone() {
    return new FoldTransformNode(null, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt, this.transform = duplicate(Zt);
    const $n = this.transform.as ?? [void 0, void 0];
    this.transform.as = [$n[0] ?? "key", $n[1] ?? "value"];
  }
  dependentFields() {
    return new Set(this.transform.fold);
  }
  producedFields() {
    return new Set(this.transform.as);
  }
  hash() {
    return `FoldTransform ${hash(this.transform)}`;
  }
  assemble() {
    const { fold: Qt, as: Zt } = this.transform;
    return {
      type: "fold",
      fields: Qt,
      as: Zt
    };
  }
}
class GeoJSONNode extends DataFlowNode {
  clone() {
    return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal);
  }
  static parseAll(Qt, Zt) {
    if (Zt.component.projection && !Zt.component.projection.isFit)
      return Qt;
    let $n = 0;
    for (const Sn of [
      [LONGITUDE, LATITUDE],
      [LONGITUDE2, LATITUDE2]
    ]) {
      const kn = Sn.map((Kn) => {
        const er = getFieldOrDatumDef(Zt.encoding[Kn]);
        return isFieldDef(er) ? er.field : isDatumDef(er) ? { expr: `${er.datum}` } : isValueDef(er) ? { expr: `${er.value}` } : void 0;
      });
      (kn[0] || kn[1]) && (Qt = new GeoJSONNode(Qt, kn, null, Zt.getName(`geojson_${$n++}`)));
    }
    if (Zt.channelHasField(SHAPE)) {
      const Sn = Zt.typedFieldDef(SHAPE);
      Sn.type === GEOJSON && (Qt = new GeoJSONNode(Qt, null, Sn.field, Zt.getName(`geojson_${$n++}`)));
    }
    return Qt;
  }
  constructor(Qt, Zt, $n, Sn) {
    super(Qt), this.fields = Zt, this.geojson = $n, this.signal = Sn;
  }
  dependentFields() {
    const Qt = (this.fields ?? []).filter(isString);
    return /* @__PURE__ */ new Set([...this.geojson ? [this.geojson] : [], ...Qt]);
  }
  producedFields() {
    return /* @__PURE__ */ new Set();
  }
  hash() {
    return `GeoJSON ${this.geojson} ${this.signal} ${hash(this.fields)}`;
  }
  assemble() {
    return [
      ...this.geojson ? [
        {
          type: "filter",
          expr: `isValid(datum["${this.geojson}"])`
        }
      ] : [],
      {
        type: "geojson",
        ...this.fields ? { fields: this.fields } : {},
        ...this.geojson ? { geojson: this.geojson } : {},
        signal: this.signal
      }
    ];
  }
}
class GeoPointNode extends DataFlowNode {
  clone() {
    return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as));
  }
  constructor(Qt, Zt, $n, Sn) {
    super(Qt), this.projection = Zt, this.fields = $n, this.as = Sn;
  }
  static parseAll(Qt, Zt) {
    if (!Zt.projectionName())
      return Qt;
    for (const $n of [
      [LONGITUDE, LATITUDE],
      [LONGITUDE2, LATITUDE2]
    ]) {
      const Sn = $n.map((Kn) => {
        const er = getFieldOrDatumDef(Zt.encoding[Kn]);
        return isFieldDef(er) ? er.field : isDatumDef(er) ? { expr: `${er.datum}` } : isValueDef(er) ? { expr: `${er.value}` } : void 0;
      }), kn = $n[0] === LONGITUDE2 ? "2" : "";
      (Sn[0] || Sn[1]) && (Qt = new GeoPointNode(Qt, Zt.projectionName(), Sn, [
        Zt.getName(`x${kn}`),
        Zt.getName(`y${kn}`)
      ]));
    }
    return Qt;
  }
  dependentFields() {
    return new Set(this.fields.filter(isString));
  }
  producedFields() {
    return new Set(this.as);
  }
  hash() {
    return `Geopoint ${this.projection} ${hash(this.fields)} ${hash(this.as)}`;
  }
  assemble() {
    return {
      type: "geopoint",
      projection: this.projection,
      fields: this.fields,
      as: this.as
    };
  }
}
class ImputeNode extends DataFlowNode {
  clone() {
    return new ImputeNode(null, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt;
  }
  dependentFields() {
    return /* @__PURE__ */ new Set([this.transform.impute, this.transform.key, ...this.transform.groupby ?? []]);
  }
  producedFields() {
    return /* @__PURE__ */ new Set([this.transform.impute]);
  }
  processSequence(Qt) {
    const { start: Zt = 0, stop: $n, step: Sn } = Qt;
    return { signal: `sequence(${[Zt, $n, ...Sn ? [Sn] : []].join(",")})` };
  }
  static makeFromTransform(Qt, Zt) {
    return new ImputeNode(Qt, Zt);
  }
  static makeFromEncoding(Qt, Zt) {
    const $n = Zt.encoding, Sn = $n.x, kn = $n.y;
    if (isFieldDef(Sn) && isFieldDef(kn)) {
      const Kn = Sn.impute ? Sn : kn.impute ? kn : void 0;
      if (Kn === void 0)
        return;
      const er = Sn.impute ? kn : kn.impute ? Sn : void 0, { method: Cr, value: kr, frame: Yr, keyvals: Ms } = Kn.impute, Ds = pathGroupingFields(Zt.mark, $n);
      return new ImputeNode(Qt, {
        impute: Kn.field,
        key: er.field,
        ...Cr ? { method: Cr } : {},
        ...kr !== void 0 ? { value: kr } : {},
        ...Yr ? { frame: Yr } : {},
        ...Ms !== void 0 ? { keyvals: Ms } : {},
        ...Ds.length ? { groupby: Ds } : {}
      });
    }
    return null;
  }
  hash() {
    return `Impute ${hash(this.transform)}`;
  }
  assemble() {
    const { impute: Qt, key: Zt, keyvals: $n, method: Sn, groupby: kn, value: Kn, frame: er = [null, null] } = this.transform, Cr = {
      type: "impute",
      field: Qt,
      key: Zt,
      ...$n ? { keyvals: isImputeSequence($n) ? this.processSequence($n) : $n } : {},
      method: "value",
      ...kn ? { groupby: kn } : {},
      value: !Sn || Sn === "value" ? Kn : null
    };
    if (Sn && Sn !== "value") {
      const kr = {
        type: "window",
        as: [`imputed_${Qt}_value`],
        ops: [Sn],
        fields: [Qt],
        frame: er,
        ignorePeers: !1,
        ...kn ? { groupby: kn } : {}
      }, Yr = {
        type: "formula",
        expr: `datum.${Qt} === null ? datum.imputed_${Qt}_value : datum.${Qt}`,
        as: Qt
      };
      return [Cr, kr, Yr];
    } else
      return [Cr];
  }
}
class LoessTransformNode extends DataFlowNode {
  clone() {
    return new LoessTransformNode(null, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt, this.transform = duplicate(Zt);
    const $n = this.transform.as ?? [void 0, void 0];
    this.transform.as = [$n[0] ?? Zt.on, $n[1] ?? Zt.loess];
  }
  dependentFields() {
    return /* @__PURE__ */ new Set([this.transform.loess, this.transform.on, ...this.transform.groupby ?? []]);
  }
  producedFields() {
    return new Set(this.transform.as);
  }
  hash() {
    return `LoessTransform ${hash(this.transform)}`;
  }
  assemble() {
    const { loess: Qt, on: Zt, ...$n } = this.transform;
    return {
      type: "loess",
      x: Zt,
      y: Qt,
      ...$n
    };
  }
}
class LookupNode extends DataFlowNode {
  clone() {
    return new LookupNode(null, duplicate(this.transform), this.secondary);
  }
  constructor(Qt, Zt, $n) {
    super(Qt), this.transform = Zt, this.secondary = $n;
  }
  static make(Qt, Zt, $n, Sn) {
    const kn = Zt.component.data.sources, { from: Kn } = $n;
    let er = null;
    if (isLookupData(Kn)) {
      let Cr = findSource(Kn.data, kn);
      Cr || (Cr = new SourceNode(Kn.data), kn.push(Cr));
      const kr = Zt.getName(`lookup_${Sn}`);
      er = new OutputNode(Cr, kr, DataSourceType.Lookup, Zt.component.data.outputNodeRefCounts), Zt.component.data.outputNodes[kr] = er;
    } else if (isLookupSelection(Kn)) {
      const Cr = Kn.param;
      $n = { as: Cr, ...$n };
      let kr;
      try {
        kr = Zt.getSelectionComponent(varName(Cr), Cr);
      } catch {
        throw new Error(cannotLookupVariableParameter(Cr));
      }
      if (er = kr.materialized, !er)
        throw new Error(noSameUnitLookup(Cr));
    }
    return new LookupNode(Qt, $n, er.getSource());
  }
  dependentFields() {
    return /* @__PURE__ */ new Set([this.transform.lookup]);
  }
  producedFields() {
    return new Set(this.transform.as ? array$6(this.transform.as) : this.transform.from.fields);
  }
  hash() {
    return `Lookup ${hash({ transform: this.transform, secondary: this.secondary })}`;
  }
  assemble() {
    let Qt;
    if (this.transform.from.fields)
      Qt = {
        values: this.transform.from.fields,
        ...this.transform.as ? { as: array$6(this.transform.as) } : {}
      };
    else {
      let Zt = this.transform.as;
      isString(Zt) || (warn$1(NO_FIELDS_NEEDS_AS), Zt = "_lookup"), Qt = {
        as: [Zt]
      };
    }
    return {
      type: "lookup",
      from: this.secondary,
      key: this.transform.from.key,
      fields: [this.transform.lookup],
      ...Qt,
      ...this.transform.default ? { default: this.transform.default } : {}
    };
  }
}
class QuantileTransformNode extends DataFlowNode {
  clone() {
    return new QuantileTransformNode(null, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt, this.transform = duplicate(Zt);
    const $n = this.transform.as ?? [void 0, void 0];
    this.transform.as = [$n[0] ?? "prob", $n[1] ?? "value"];
  }
  dependentFields() {
    return /* @__PURE__ */ new Set([this.transform.quantile, ...this.transform.groupby ?? []]);
  }
  producedFields() {
    return new Set(this.transform.as);
  }
  hash() {
    return `QuantileTransform ${hash(this.transform)}`;
  }
  assemble() {
    const { quantile: Qt, ...Zt } = this.transform;
    return {
      type: "quantile",
      field: Qt,
      ...Zt
    };
  }
}
class RegressionTransformNode extends DataFlowNode {
  clone() {
    return new RegressionTransformNode(null, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt, this.transform = duplicate(Zt);
    const $n = this.transform.as ?? [void 0, void 0];
    this.transform.as = [$n[0] ?? Zt.on, $n[1] ?? Zt.regression];
  }
  dependentFields() {
    return /* @__PURE__ */ new Set([this.transform.regression, this.transform.on, ...this.transform.groupby ?? []]);
  }
  producedFields() {
    return new Set(this.transform.as);
  }
  hash() {
    return `RegressionTransform ${hash(this.transform)}`;
  }
  assemble() {
    const { regression: Qt, on: Zt, ...$n } = this.transform;
    return {
      type: "regression",
      x: Zt,
      y: Qt,
      ...$n
    };
  }
}
class PivotTransformNode extends DataFlowNode {
  clone() {
    return new PivotTransformNode(null, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt;
  }
  addDimensions(Qt) {
    this.transform.groupby = unique((this.transform.groupby ?? []).concat(Qt), (Zt) => Zt);
  }
  producedFields() {
  }
  dependentFields() {
    return /* @__PURE__ */ new Set([this.transform.pivot, this.transform.value, ...this.transform.groupby ?? []]);
  }
  hash() {
    return `PivotTransform ${hash(this.transform)}`;
  }
  assemble() {
    const { pivot: Qt, value: Zt, groupby: $n, limit: Sn, op: kn } = this.transform;
    return {
      type: "pivot",
      field: Qt,
      value: Zt,
      ...Sn !== void 0 ? { limit: Sn } : {},
      ...kn !== void 0 ? { op: kn } : {},
      ...$n !== void 0 ? { groupby: $n } : {}
    };
  }
}
class SampleTransformNode extends DataFlowNode {
  clone() {
    return new SampleTransformNode(null, duplicate(this.transform));
  }
  constructor(Qt, Zt) {
    super(Qt), this.transform = Zt;
  }
  dependentFields() {
    return /* @__PURE__ */ new Set();
  }
  producedFields() {
    return /* @__PURE__ */ new Set();
  }
  hash() {
    return `SampleTransform ${hash(this.transform)}`;
  }
  assemble() {
    return {
      type: "sample",
      size: this.transform.sample
    };
  }
}
function makeWalkTree(_e) {
  let Qt = 0;
  function Zt($n, Sn) {
    if ($n instanceof SourceNode && !$n.isGenerator && !isUrlData($n.data) && (_e.push(Sn), Sn = {
      name: null,
      source: Sn.name,
      transform: []
    }), $n instanceof ParseNode && ($n.parent instanceof SourceNode && !Sn.source ? (Sn.format = {
      ...Sn.format ?? {},
      parse: $n.assembleFormatParse()
    }, Sn.transform.push(...$n.assembleTransforms(!0))) : Sn.transform.push(...$n.assembleTransforms())), $n instanceof FacetNode) {
      Sn.name || (Sn.name = `data_${Qt++}`), !Sn.source || Sn.transform.length > 0 ? (_e.push(Sn), $n.data = Sn.name) : $n.data = Sn.source, _e.push(...$n.assemble());
      return;
    }
    switch (($n instanceof GraticuleNode || $n instanceof SequenceNode || $n instanceof FilterInvalidNode || $n instanceof FilterNode || $n instanceof CalculateNode || $n instanceof GeoPointNode || $n instanceof AggregateNode || $n instanceof LookupNode || $n instanceof WindowTransformNode || $n instanceof JoinAggregateTransformNode || $n instanceof FoldTransformNode || $n instanceof FlattenTransformNode || $n instanceof DensityTransformNode || $n instanceof LoessTransformNode || $n instanceof QuantileTransformNode || $n instanceof RegressionTransformNode || $n instanceof IdentifierNode || $n instanceof SampleTransformNode || $n instanceof PivotTransformNode || $n instanceof ExtentTransformNode) && Sn.transform.push($n.assemble()), ($n instanceof BinNode || $n instanceof TimeUnitNode || $n instanceof ImputeNode || $n instanceof StackNode || $n instanceof GeoJSONNode) && Sn.transform.push(...$n.assemble()), $n instanceof OutputNode && (Sn.source && Sn.transform.length === 0 ? $n.setSource(Sn.source) : $n.parent instanceof OutputNode ? $n.setSource(Sn.name) : (Sn.name || (Sn.name = `data_${Qt++}`), $n.setSource(Sn.name), $n.numChildren() === 1 && (_e.push(Sn), Sn = {
      name: null,
      source: Sn.name,
      transform: []
    }))), $n.numChildren()) {
      case 0:
        $n instanceof OutputNode && (!Sn.source || Sn.transform.length > 0) && _e.push(Sn);
        break;
      case 1:
        Zt($n.children[0], Sn);
        break;
      default: {
        Sn.name || (Sn.name = `data_${Qt++}`);
        let kn = Sn.name;
        !Sn.source || Sn.transform.length > 0 ? _e.push(Sn) : kn = Sn.source;
        for (const Kn of $n.children)
          Zt(Kn, {
            name: null,
            source: kn,
            transform: []
          });
        break;
      }
    }
  }
  return Zt;
}
function assembleFacetData(_e) {
  const Qt = [], Zt = makeWalkTree(Qt);
  for (const $n of _e.children)
    Zt($n, {
      source: _e.name,
      name: null,
      transform: []
    });
  return Qt;
}
function assembleRootData(_e, Qt) {
  const Zt = [], $n = makeWalkTree(Zt);
  let Sn = 0;
  for (const Kn of _e.sources) {
    Kn.hasName() || (Kn.dataName = `source_${Sn++}`);
    const er = Kn.assemble();
    $n(Kn, er);
  }
  for (const Kn of Zt)
    Kn.transform.length === 0 && delete Kn.transform;
  let kn = 0;
  for (const [Kn, er] of Zt.entries())
    (er.transform ?? []).length === 0 && !er.source && Zt.splice(kn++, 0, Zt.splice(Kn, 1)[0]);
  for (const Kn of Zt)
    for (const er of Kn.transform ?? [])
      er.type === "lookup" && (er.from = _e.outputNodes[er.from].getSource());
  for (const Kn of Zt)
    Kn.name in Qt && (Kn.values = Qt[Kn.name]);
  return Zt;
}
function getHeaderType(_e) {
  return _e === "top" || _e === "left" || isSignalRef(_e) ? "header" : "footer";
}
function parseFacetHeaders(_e) {
  for (const Qt of FACET_CHANNELS)
    parseFacetHeader(_e, Qt);
  mergeChildAxis(_e, "x"), mergeChildAxis(_e, "y");
}
function parseFacetHeader(_e, Qt) {
  var Kn;
  const { facet: Zt, config: $n, child: Sn, component: kn } = _e;
  if (_e.channelHasField(Qt)) {
    const er = Zt[Qt], Cr = getHeaderProperty("title", null, $n, Qt);
    let kr = title(er, $n, {
      allowDisabling: !0,
      includeDefault: Cr === void 0 || !!Cr
    });
    Sn.component.layoutHeaders[Qt].title && (kr = isArray(kr) ? kr.join(", ") : kr, kr += ` / ${Sn.component.layoutHeaders[Qt].title}`, Sn.component.layoutHeaders[Qt].title = null);
    const Yr = getHeaderProperty("labelOrient", er.header, $n, Qt), Ms = er.header !== null ? getFirstDefined((Kn = er.header) == null ? void 0 : Kn.labels, $n.header.labels, !0) : !1, Ds = contains$1(["bottom", "right"], Yr) ? "footer" : "header";
    kn.layoutHeaders[Qt] = {
      title: er.header !== null ? kr : null,
      facetFieldDef: er,
      [Ds]: Qt === "facet" ? [] : [makeHeaderComponent(_e, Qt, Ms)]
    };
  }
}
function makeHeaderComponent(_e, Qt, Zt) {
  const $n = Qt === "row" ? "height" : "width";
  return {
    labels: Zt,
    sizeSignal: _e.child.component.layoutSize.get($n) ? _e.child.getSizeSignalRef($n) : void 0,
    axes: []
  };
}
function mergeChildAxis(_e, Qt) {
  const { child: Zt } = _e;
  if (Zt.component.axes[Qt]) {
    const { layoutHeaders: $n, resolve: Sn } = _e.component;
    if (Sn.axis[Qt] = parseGuideResolve(Sn, Qt), Sn.axis[Qt] === "shared") {
      const kn = Qt === "x" ? "column" : "row", Kn = $n[kn];
      for (const er of Zt.component.axes[Qt]) {
        const Cr = getHeaderType(er.get("orient"));
        Kn[Cr] ?? (Kn[Cr] = [makeHeaderComponent(_e, kn, !1)]);
        const kr = assembleAxis(er, "main", _e.config, { header: !0 });
        kr && Kn[Cr][0].axes.push(kr), er.mainExtracted = !0;
      }
    }
  }
}
function parseLayerLayoutSize(_e) {
  parseChildrenLayoutSize(_e), parseNonUnitLayoutSizeForChannel(_e, "width"), parseNonUnitLayoutSizeForChannel(_e, "height");
}
function parseConcatLayoutSize(_e) {
  parseChildrenLayoutSize(_e);
  const Qt = _e.layout.columns === 1 ? "width" : "childWidth", Zt = _e.layout.columns === void 0 ? "height" : "childHeight";
  parseNonUnitLayoutSizeForChannel(_e, Qt), parseNonUnitLayoutSizeForChannel(_e, Zt);
}
function parseChildrenLayoutSize(_e) {
  for (const Qt of _e.children)
    Qt.parseLayoutSize();
}
function parseNonUnitLayoutSizeForChannel(_e, Qt) {
  const Zt = getSizeTypeFromLayoutSizeType(Qt), $n = getPositionScaleChannel(Zt), Sn = _e.component.resolve, kn = _e.component.layoutSize;
  let Kn;
  for (const er of _e.children) {
    const Cr = er.component.layoutSize.getWithExplicit(Zt), kr = Sn.scale[$n] ?? defaultScaleResolve($n, _e);
    if (kr === "independent" && Cr.value === "step") {
      Kn = void 0;
      break;
    }
    if (Kn) {
      if (kr === "independent" && Kn.value !== Cr.value) {
        Kn = void 0;
        break;
      }
      Kn = mergeValuesWithExplicit(Kn, Cr, Zt, "");
    } else
      Kn = Cr;
  }
  if (Kn) {
    for (const er of _e.children)
      _e.renameSignal(er.getName(Zt), _e.getName(Qt)), er.component.layoutSize.set(Zt, "merged", !1);
    kn.setWithExplicit(Qt, Kn);
  } else
    kn.setWithExplicit(Qt, {
      explicit: !1,
      value: void 0
    });
}
function parseUnitLayoutSize(_e) {
  const { size: Qt, component: Zt } = _e;
  for (const $n of POSITION_SCALE_CHANNELS) {
    const Sn = getSizeChannel($n);
    if (Qt[Sn]) {
      const kn = Qt[Sn];
      Zt.layoutSize.set(Sn, isStep(kn) ? "step" : kn, !0);
    } else {
      const kn = defaultUnitSize(_e, Sn);
      Zt.layoutSize.set(Sn, kn, !1);
    }
  }
}
function defaultUnitSize(_e, Qt) {
  const Zt = Qt === "width" ? "x" : "y", $n = _e.config, Sn = _e.getScaleComponent(Zt);
  if (Sn) {
    const kn = Sn.get("type"), Kn = Sn.get("range");
    if (hasDiscreteDomain(kn)) {
      const er = getViewConfigDiscreteSize($n.view, Qt);
      return isVgRangeStep(Kn) || isStep(er) ? "step" : er;
    } else
      return getViewConfigContinuousSize($n.view, Qt);
  } else {
    if (_e.hasProjection || _e.mark === "arc")
      return getViewConfigContinuousSize($n.view, Qt);
    {
      const kn = getViewConfigDiscreteSize($n.view, Qt);
      return isStep(kn) ? kn.step : kn;
    }
  }
}
function facetSortFieldName(_e, Qt, Zt) {
  return vgField(Qt, { suffix: `by_${vgField(_e)}`, ...Zt ?? {} });
}
class FacetModel extends ModelWithField {
  constructor(Qt, Zt, $n, Sn) {
    super(Qt, "facet", Zt, $n, Sn, Qt.resolve), this.child = buildModel(Qt.spec, this, this.getName("child"), void 0, Sn), this.children = [this.child], this.facet = this.initFacet(Qt.facet);
  }
  initFacet(Qt) {
    if (!isFacetMapping(Qt))
      return { facet: this.initFacetFieldDef(Qt, "facet") };
    const Zt = keys$2(Qt), $n = {};
    for (const Sn of Zt) {
      if (![ROW, COLUMN].includes(Sn)) {
        warn$1(incompatibleChannel(Sn, "facet"));
        break;
      }
      const kn = Qt[Sn];
      if (kn.field === void 0) {
        warn$1(emptyFieldDef(kn, Sn));
        break;
      }
      $n[Sn] = this.initFacetFieldDef(kn, Sn);
    }
    return $n;
  }
  initFacetFieldDef(Qt, Zt) {
    const $n = initFieldDef(Qt, Zt);
    return $n.header ? $n.header = replaceExprRef($n.header) : $n.header === null && ($n.header = null), $n;
  }
  channelHasField(Qt) {
    return !!this.facet[Qt];
  }
  fieldDef(Qt) {
    return this.facet[Qt];
  }
  parseData() {
    this.component.data = parseData(this), this.child.parseData();
  }
  parseLayoutSize() {
    parseChildrenLayoutSize(this);
  }
  parseSelections() {
    this.child.parseSelections(), this.component.selection = this.child.component.selection;
  }
  parseMarkGroup() {
    this.child.parseMarkGroup();
  }
  parseAxesAndHeaders() {
    this.child.parseAxesAndHeaders(), parseFacetHeaders(this);
  }
  assembleSelectionTopLevelSignals(Qt) {
    return this.child.assembleSelectionTopLevelSignals(Qt);
  }
  assembleSignals() {
    return this.child.assembleSignals(), [];
  }
  assembleSelectionData(Qt) {
    return this.child.assembleSelectionData(Qt);
  }
  getHeaderLayoutMixins() {
    const Qt = {};
    for (const Zt of FACET_CHANNELS)
      for (const $n of HEADER_TYPES) {
        const Sn = this.component.layoutHeaders[Zt], kn = Sn[$n], { facetFieldDef: Kn } = Sn;
        if (Kn) {
          const er = getHeaderProperty("titleOrient", Kn.header, this.config, Zt);
          if (["right", "bottom"].includes(er)) {
            const Cr = getHeaderChannel(Zt, er);
            Qt.titleAnchor ?? (Qt.titleAnchor = {}), Qt.titleAnchor[Cr] = "end";
          }
        }
        if (kn != null && kn[0]) {
          const er = Zt === "row" ? "height" : "width", Cr = $n === "header" ? "headerBand" : "footerBand";
          Zt !== "facet" && !this.child.component.layoutSize.get(er) && (Qt[Cr] ?? (Qt[Cr] = {}), Qt[Cr][Zt] = 0.5), Sn.title && (Qt.offset ?? (Qt.offset = {}), Qt.offset[Zt === "row" ? "rowTitle" : "columnTitle"] = 10);
        }
      }
    return Qt;
  }
  assembleDefaultLayout() {
    const { column: Qt, row: Zt } = this.facet, $n = Qt ? this.columnDistinctSignal() : Zt ? 1 : void 0;
    let Sn = "all";
    return (!Zt && this.component.resolve.scale.x === "independent" || !Qt && this.component.resolve.scale.y === "independent") && (Sn = "none"), {
      ...this.getHeaderLayoutMixins(),
      ...$n ? { columns: $n } : {},
      bounds: "full",
      align: Sn
    };
  }
  assembleLayoutSignals() {
    return this.child.assembleLayoutSignals();
  }
  columnDistinctSignal() {
    if (!(this.parent && this.parent instanceof FacetModel))
      return { signal: `length(data('${this.getName("column_domain")}'))` };
  }
  assembleGroupStyle() {
  }
  assembleGroup(Qt) {
    return this.parent && this.parent instanceof FacetModel ? {
      ...this.channelHasField("column") ? {
        encode: {
          update: {
            // TODO(https://github.com/vega/vega-lite/issues/2759):
            // Correct the signal for facet of concat of facet_column
            columns: { field: vgField(this.facet.column, { prefix: "distinct" }) }
          }
        }
      } : {},
      ...super.assembleGroup(Qt)
    } : super.assembleGroup(Qt);
  }
  /**
   * Aggregate cardinality for calculating size
   */
  getCardinalityAggregateForChild() {
    const Qt = [], Zt = [], $n = [];
    if (this.child instanceof FacetModel) {
      if (this.child.channelHasField("column")) {
        const Sn = vgField(this.child.facet.column);
        Qt.push(Sn), Zt.push("distinct"), $n.push(`distinct_${Sn}`);
      }
    } else
      for (const Sn of POSITION_SCALE_CHANNELS) {
        const kn = this.child.component.scales[Sn];
        if (kn && !kn.merged) {
          const Kn = kn.get("type"), er = kn.get("range");
          if (hasDiscreteDomain(Kn) && isVgRangeStep(er)) {
            const Cr = assembleDomain(this.child, Sn), kr = getFieldFromDomain(Cr);
            kr ? (Qt.push(kr), Zt.push("distinct"), $n.push(`distinct_${kr}`)) : warn$1(unknownField(Sn));
          }
        }
      }
    return { fields: Qt, ops: Zt, as: $n };
  }
  assembleFacet() {
    const { name: Qt, data: Zt } = this.component.data.facetRoot, { row: $n, column: Sn } = this.facet, { fields: kn, ops: Kn, as: er } = this.getCardinalityAggregateForChild(), Cr = [];
    for (const Yr of FACET_CHANNELS) {
      const Ms = this.facet[Yr];
      if (Ms) {
        Cr.push(vgField(Ms));
        const { bin: Ds, sort: Ls } = Ms;
        if (isBinning(Ds) && Cr.push(vgField(Ms, { binSuffix: "end" })), isSortField(Ls)) {
          const { field: js, op: zs = DEFAULT_SORT_OP } = Ls, Fs = facetSortFieldName(Ms, Ls);
          $n && Sn ? (kn.push(Fs), Kn.push("max"), er.push(Fs)) : (kn.push(js), Kn.push(zs), er.push(Fs));
        } else if (isArray(Ls)) {
          const js = sortArrayIndexField(Ms, Yr);
          kn.push(js), Kn.push("max"), er.push(js);
        }
      }
    }
    const kr = !!$n && !!Sn;
    return {
      name: Qt,
      data: Zt,
      groupby: Cr,
      ...kr || kn.length > 0 ? {
        aggregate: {
          ...kr ? { cross: kr } : {},
          ...kn.length ? { fields: kn, ops: Kn, as: er } : {}
        }
      } : {}
    };
  }
  facetSortFields(Qt) {
    const { facet: Zt } = this, $n = Zt[Qt];
    return $n ? isSortField($n.sort) ? [facetSortFieldName($n, $n.sort, { expr: "datum" })] : isArray($n.sort) ? [sortArrayIndexField($n, Qt, { expr: "datum" })] : [vgField($n, { expr: "datum" })] : [];
  }
  facetSortOrder(Qt) {
    const { facet: Zt } = this, $n = Zt[Qt];
    if ($n) {
      const { sort: Sn } = $n;
      return [(isSortField(Sn) ? Sn.order : !isArray(Sn) && Sn) || "ascending"];
    }
    return [];
  }
  assembleLabelTitle() {
    var Sn;
    const { facet: Qt, config: Zt } = this;
    if (Qt.facet)
      return assembleLabelTitle(Qt.facet, "facet", Zt);
    const $n = {
      row: ["top", "bottom"],
      column: ["left", "right"]
    };
    for (const kn of HEADER_CHANNELS)
      if (Qt[kn]) {
        const Kn = getHeaderProperty("labelOrient", (Sn = Qt[kn]) == null ? void 0 : Sn.header, Zt, kn);
        if ($n[kn].includes(Kn))
          return assembleLabelTitle(Qt[kn], kn, Zt);
      }
  }
  assembleMarks() {
    const { child: Qt } = this, Zt = this.component.data.facetRoot, $n = assembleFacetData(Zt), Sn = Qt.assembleGroupEncodeEntry(!1), kn = this.assembleLabelTitle() || Qt.assembleTitle(), Kn = Qt.assembleGroupStyle();
    return [{
      name: this.getName("cell"),
      type: "group",
      ...kn ? { title: kn } : {},
      ...Kn ? { style: Kn } : {},
      from: {
        facet: this.assembleFacet()
      },
      // TODO: move this to after data
      sort: {
        field: FACET_CHANNELS.map((Cr) => this.facetSortFields(Cr)).flat(),
        order: FACET_CHANNELS.map((Cr) => this.facetSortOrder(Cr)).flat()
      },
      ...$n.length > 0 ? { data: $n } : {},
      ...Sn ? { encode: { update: Sn } } : {},
      ...Qt.assembleGroup(assembleFacetSignals(this, []))
    }];
  }
  getMapping() {
    return this.facet;
  }
}
function makeJoinAggregateFromFacet(_e, Qt) {
  const { row: Zt, column: $n } = Qt;
  if (Zt && $n) {
    let Sn = null;
    for (const kn of [Zt, $n])
      if (isSortField(kn.sort)) {
        const { field: Kn, op: er = DEFAULT_SORT_OP } = kn.sort;
        _e = Sn = new JoinAggregateTransformNode(_e, {
          joinaggregate: [
            {
              op: er,
              field: Kn,
              as: facetSortFieldName(kn, kn.sort, { forAs: !0 })
            }
          ],
          groupby: [vgField(kn)]
        });
      }
    return Sn;
  }
  return null;
}
function findSource(_e, Qt) {
  var Zt, $n, Sn, kn;
  for (const Kn of Qt) {
    const er = Kn.data;
    if (_e.name && Kn.hasName() && _e.name !== Kn.dataName)
      continue;
    const Cr = (Zt = _e.format) == null ? void 0 : Zt.mesh, kr = ($n = er.format) == null ? void 0 : $n.feature;
    if (Cr && kr)
      continue;
    const Yr = (Sn = _e.format) == null ? void 0 : Sn.feature;
    if ((Yr || kr) && Yr !== kr)
      continue;
    const Ms = (kn = er.format) == null ? void 0 : kn.mesh;
    if (!((Cr || Ms) && Cr !== Ms)) {
      if (isInlineData(_e) && isInlineData(er)) {
        if (deepEqual(_e.values, er.values))
          return Kn;
      } else if (isUrlData(_e) && isUrlData(er)) {
        if (_e.url === er.url)
          return Kn;
      } else if (isNamedData(_e) && _e.name === Kn.dataName)
        return Kn;
    }
  }
  return null;
}
function parseRoot(_e, Qt) {
  if (_e.data || !_e.parent) {
    if (_e.data === null) {
      const $n = new SourceNode({ values: [] });
      return Qt.push($n), $n;
    }
    const Zt = findSource(_e.data, Qt);
    if (Zt)
      return isGenerator(_e.data) || (Zt.data.format = mergeDeep$1({}, _e.data.format, Zt.data.format)), !Zt.hasName() && _e.data.name && (Zt.dataName = _e.data.name), Zt;
    {
      const $n = new SourceNode(_e.data);
      return Qt.push($n), $n;
    }
  } else
    return _e.parent.component.data.facetRoot ? _e.parent.component.data.facetRoot : _e.parent.component.data.main;
}
function parseTransformArray(_e, Qt, Zt) {
  let $n = 0;
  for (const Sn of Qt.transforms) {
    let kn, Kn;
    if (isCalculate(Sn))
      Kn = _e = new CalculateNode(_e, Sn), kn = "derived";
    else if (isFilter(Sn)) {
      const er = getImplicitFromFilterTransform(Sn);
      Kn = _e = ParseNode.makeWithAncestors(_e, {}, er, Zt) ?? _e, _e = new FilterNode(_e, Qt, Sn.filter);
    } else if (isBin(Sn))
      Kn = _e = BinNode.makeFromTransform(_e, Sn, Qt), kn = "number";
    else if (isTimeUnit(Sn))
      kn = "date", Zt.getWithExplicit(Sn.field).value === void 0 && (_e = new ParseNode(_e, { [Sn.field]: kn }), Zt.set(Sn.field, kn, !1)), Kn = _e = TimeUnitNode.makeFromTransform(_e, Sn);
    else if (isAggregate(Sn))
      Kn = _e = AggregateNode.makeFromTransform(_e, Sn), kn = "number", requiresSelectionId(Qt) && (_e = new IdentifierNode(_e));
    else if (isLookup(Sn))
      Kn = _e = LookupNode.make(_e, Qt, Sn, $n++), kn = "derived";
    else if (isWindow(Sn))
      Kn = _e = new WindowTransformNode(_e, Sn), kn = "number";
    else if (isJoinAggregate(Sn))
      Kn = _e = new JoinAggregateTransformNode(_e, Sn), kn = "number";
    else if (isStack(Sn))
      Kn = _e = StackNode.makeFromTransform(_e, Sn), kn = "derived";
    else if (isFold(Sn))
      Kn = _e = new FoldTransformNode(_e, Sn), kn = "derived";
    else if (isExtent(Sn))
      Kn = _e = new ExtentTransformNode(_e, Sn), kn = "derived";
    else if (isFlatten(Sn))
      Kn = _e = new FlattenTransformNode(_e, Sn), kn = "derived";
    else if (isPivot(Sn))
      Kn = _e = new PivotTransformNode(_e, Sn), kn = "derived";
    else if (isSample(Sn))
      _e = new SampleTransformNode(_e, Sn);
    else if (isImpute(Sn))
      Kn = _e = ImputeNode.makeFromTransform(_e, Sn), kn = "derived";
    else if (isDensity(Sn))
      Kn = _e = new DensityTransformNode(_e, Sn), kn = "derived";
    else if (isQuantile(Sn))
      Kn = _e = new QuantileTransformNode(_e, Sn), kn = "derived";
    else if (isRegression(Sn))
      Kn = _e = new RegressionTransformNode(_e, Sn), kn = "derived";
    else if (isLoess(Sn))
      Kn = _e = new LoessTransformNode(_e, Sn), kn = "derived";
    else {
      warn$1(invalidTransformIgnored(Sn));
      continue;
    }
    if (Kn && kn !== void 0)
      for (const er of Kn.producedFields() ?? [])
        Zt.set(er, kn, !1);
  }
  return _e;
}
function parseData(_e) {
  var zs;
  let Qt = parseRoot(_e, _e.component.data.sources);
  const { outputNodes: Zt, outputNodeRefCounts: $n } = _e.component.data, Sn = _e.data, Kn = !(Sn && (isGenerator(Sn) || isUrlData(Sn) || isInlineData(Sn))) && _e.parent ? _e.parent.component.data.ancestorParse.clone() : new AncestorParse();
  isGenerator(Sn) ? (isSequenceGenerator(Sn) ? Qt = new SequenceNode(Qt, Sn.sequence) : isGraticuleGenerator(Sn) && (Qt = new GraticuleNode(Qt, Sn.graticule)), Kn.parseNothing = !0) : ((zs = Sn == null ? void 0 : Sn.format) == null ? void 0 : zs.parse) === null && (Kn.parseNothing = !0), Qt = ParseNode.makeExplicit(Qt, _e, Kn) ?? Qt, Qt = new IdentifierNode(Qt);
  const er = _e.parent && isLayerModel(_e.parent);
  (isUnitModel(_e) || isFacetModel(_e)) && er && (Qt = BinNode.makeFromEncoding(Qt, _e) ?? Qt), _e.transforms.length > 0 && (Qt = parseTransformArray(Qt, _e, Kn));
  const Cr = getImplicitFromSelection(_e), kr = getImplicitFromEncoding(_e);
  Qt = ParseNode.makeWithAncestors(Qt, {}, { ...Cr, ...kr }, Kn) ?? Qt, isUnitModel(_e) && (Qt = GeoJSONNode.parseAll(Qt, _e), Qt = GeoPointNode.parseAll(Qt, _e)), (isUnitModel(_e) || isFacetModel(_e)) && (er || (Qt = BinNode.makeFromEncoding(Qt, _e) ?? Qt), Qt = TimeUnitNode.makeFromEncoding(Qt, _e) ?? Qt, Qt = CalculateNode.parseAllForSortIndex(Qt, _e));
  const Yr = _e.getDataName(DataSourceType.Raw), Ms = new OutputNode(Qt, Yr, DataSourceType.Raw, $n);
  if (Zt[Yr] = Ms, Qt = Ms, isUnitModel(_e)) {
    const Fs = AggregateNode.makeFromEncoding(Qt, _e);
    Fs && (Qt = Fs, requiresSelectionId(_e) && (Qt = new IdentifierNode(Qt))), Qt = ImputeNode.makeFromEncoding(Qt, _e) ?? Qt, Qt = StackNode.makeFromEncoding(Qt, _e) ?? Qt;
  }
  isUnitModel(_e) && (Qt = FilterInvalidNode.make(Qt, _e) ?? Qt);
  const Ds = _e.getDataName(DataSourceType.Main), Ls = new OutputNode(Qt, Ds, DataSourceType.Main, $n);
  Zt[Ds] = Ls, Qt = Ls, isUnitModel(_e) && materializeSelections(_e, Ls);
  let js = null;
  if (isFacetModel(_e)) {
    const Fs = _e.getName("facet");
    Qt = makeJoinAggregateFromFacet(Qt, _e.facet) ?? Qt, js = new FacetNode(Qt, _e, Fs, Ls.getSource()), Zt[Fs] = js;
  }
  return {
    ..._e.component.data,
    outputNodes: Zt,
    outputNodeRefCounts: $n,
    raw: Ms,
    main: Ls,
    facetRoot: js,
    ancestorParse: Kn
  };
}
class ConcatModel extends Model {
  constructor(Qt, Zt, $n, Sn) {
    var kn, Kn, er, Cr;
    super(Qt, "concat", Zt, $n, Sn, Qt.resolve), (((Kn = (kn = Qt.resolve) == null ? void 0 : kn.axis) == null ? void 0 : Kn.x) === "shared" || ((Cr = (er = Qt.resolve) == null ? void 0 : er.axis) == null ? void 0 : Cr.y) === "shared") && warn$1(CONCAT_CANNOT_SHARE_AXIS), this.children = this.getChildren(Qt).map((kr, Yr) => buildModel(kr, this, this.getName(`concat_${Yr}`), void 0, Sn));
  }
  parseData() {
    this.component.data = parseData(this);
    for (const Qt of this.children)
      Qt.parseData();
  }
  parseSelections() {
    this.component.selection = {};
    for (const Qt of this.children) {
      Qt.parseSelections();
      for (const Zt of keys$2(Qt.component.selection))
        this.component.selection[Zt] = Qt.component.selection[Zt];
    }
  }
  parseMarkGroup() {
    for (const Qt of this.children)
      Qt.parseMarkGroup();
  }
  parseAxesAndHeaders() {
    for (const Qt of this.children)
      Qt.parseAxesAndHeaders();
  }
  getChildren(Qt) {
    return isVConcatSpec(Qt) ? Qt.vconcat : isHConcatSpec(Qt) ? Qt.hconcat : Qt.concat;
  }
  parseLayoutSize() {
    parseConcatLayoutSize(this);
  }
  parseAxisGroup() {
    return null;
  }
  assembleSelectionTopLevelSignals(Qt) {
    return this.children.reduce((Zt, $n) => $n.assembleSelectionTopLevelSignals(Zt), Qt);
  }
  assembleSignals() {
    return this.children.forEach((Qt) => Qt.assembleSignals()), [];
  }
  assembleLayoutSignals() {
    const Qt = assembleLayoutSignals(this);
    for (const Zt of this.children)
      Qt.push(...Zt.assembleLayoutSignals());
    return Qt;
  }
  assembleSelectionData(Qt) {
    return this.children.reduce((Zt, $n) => $n.assembleSelectionData(Zt), Qt);
  }
  assembleMarks() {
    return this.children.map((Qt) => {
      const Zt = Qt.assembleTitle(), $n = Qt.assembleGroupStyle(), Sn = Qt.assembleGroupEncodeEntry(!1);
      return {
        type: "group",
        name: Qt.getName("group"),
        ...Zt ? { title: Zt } : {},
        ...$n ? { style: $n } : {},
        ...Sn ? { encode: { update: Sn } } : {},
        ...Qt.assembleGroup()
      };
    });
  }
  assembleGroupStyle() {
  }
  assembleDefaultLayout() {
    const Qt = this.layout.columns;
    return {
      ...Qt != null ? { columns: Qt } : {},
      bounds: "full",
      // Use align each so it can work with multiple plots with different size
      align: "each"
    };
  }
}
function isFalseOrNull(_e) {
  return _e === !1 || _e === null;
}
const AXIS_COMPONENT_PROPERTIES_INDEX = {
  disable: 1,
  gridScale: 1,
  scale: 1,
  ...COMMON_AXIS_PROPERTIES_INDEX,
  labelExpr: 1,
  encode: 1
}, AXIS_COMPONENT_PROPERTIES = keys$2(AXIS_COMPONENT_PROPERTIES_INDEX);
class AxisComponent extends Split {
  constructor(Qt = {}, Zt = {}, $n = !1) {
    super(), this.explicit = Qt, this.implicit = Zt, this.mainExtracted = $n;
  }
  clone() {
    return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted);
  }
  hasAxisPart(Qt) {
    return Qt === "axis" ? !0 : Qt === "grid" || Qt === "title" ? !!this.get(Qt) : !isFalseOrNull(this.get(Qt));
  }
  hasOrientSignalRef() {
    return isSignalRef(this.explicit.orient);
  }
}
function labels(_e, Qt, Zt) {
  const { encoding: $n, config: Sn } = _e, kn = getFieldOrDatumDef($n[Qt]) ?? getFieldOrDatumDef($n[getSecondaryRangeChannel(Qt)]), Kn = _e.axis(Qt) || {}, { format: er, formatType: Cr } = Kn;
  if (isCustomFormatType(Cr))
    return {
      text: formatCustomType({
        fieldOrDatumDef: kn,
        field: "datum.value",
        format: er,
        formatType: Cr,
        config: Sn
      }),
      ...Zt
    };
  if (er === void 0 && Cr === void 0 && Sn.customFormatTypes) {
    if (channelDefType(kn) === "quantitative") {
      if (isPositionFieldOrDatumDef(kn) && kn.stack === "normalize" && Sn.normalizedNumberFormatType)
        return {
          text: formatCustomType({
            fieldOrDatumDef: kn,
            field: "datum.value",
            format: Sn.normalizedNumberFormat,
            formatType: Sn.normalizedNumberFormatType,
            config: Sn
          }),
          ...Zt
        };
      if (Sn.numberFormatType)
        return {
          text: formatCustomType({
            fieldOrDatumDef: kn,
            field: "datum.value",
            format: Sn.numberFormat,
            formatType: Sn.numberFormatType,
            config: Sn
          }),
          ...Zt
        };
    }
    if (channelDefType(kn) === "temporal" && Sn.timeFormatType && isFieldDef(kn) && !kn.timeUnit)
      return {
        text: formatCustomType({
          fieldOrDatumDef: kn,
          field: "datum.value",
          format: Sn.timeFormat,
          formatType: Sn.timeFormatType,
          config: Sn
        }),
        ...Zt
      };
  }
  return Zt;
}
function parseUnitAxes(_e) {
  return POSITION_SCALE_CHANNELS.reduce((Qt, Zt) => (_e.component.scales[Zt] && (Qt[Zt] = [parseAxis(Zt, _e)]), Qt), {});
}
const OPPOSITE_ORIENT = {
  bottom: "top",
  top: "bottom",
  left: "right",
  right: "left"
};
function parseLayerAxes(_e) {
  const { axes: Qt, resolve: Zt } = _e.component, $n = { top: 0, bottom: 0, right: 0, left: 0 };
  for (const Sn of _e.children) {
    Sn.parseAxesAndHeaders();
    for (const kn of keys$2(Sn.component.axes))
      Zt.axis[kn] = parseGuideResolve(_e.component.resolve, kn), Zt.axis[kn] === "shared" && (Qt[kn] = mergeAxisComponents(Qt[kn], Sn.component.axes[kn]), Qt[kn] || (Zt.axis[kn] = "independent", delete Qt[kn]));
  }
  for (const Sn of POSITION_SCALE_CHANNELS) {
    for (const kn of _e.children)
      if (kn.component.axes[Sn]) {
        if (Zt.axis[Sn] === "independent") {
          Qt[Sn] = (Qt[Sn] ?? []).concat(kn.component.axes[Sn]);
          for (const Kn of kn.component.axes[Sn]) {
            const { value: er, explicit: Cr } = Kn.getWithExplicit("orient");
            if (!isSignalRef(er)) {
              if ($n[er] > 0 && !Cr) {
                const kr = OPPOSITE_ORIENT[er];
                $n[er] > $n[kr] && Kn.set("orient", kr, !1);
              }
              $n[er]++;
            }
          }
        }
        delete kn.component.axes[Sn];
      }
    if (Zt.axis[Sn] === "independent" && Qt[Sn] && Qt[Sn].length > 1)
      for (const [kn, Kn] of (Qt[Sn] || []).entries())
        kn > 0 && Kn.get("grid") && !Kn.explicit.grid && (Kn.implicit.grid = !1);
  }
}
function mergeAxisComponents(_e, Qt) {
  if (_e) {
    if (_e.length !== Qt.length)
      return;
    const Zt = _e.length;
    for (let $n = 0; $n < Zt; $n++) {
      const Sn = _e[$n], kn = Qt[$n];
      if (!!Sn != !!kn)
        return;
      if (Sn && kn) {
        const Kn = Sn.getWithExplicit("orient"), er = kn.getWithExplicit("orient");
        if (Kn.explicit && er.explicit && Kn.value !== er.value)
          return;
        _e[$n] = mergeAxisComponent(Sn, kn);
      }
    }
  } else
    return Qt.map((Zt) => Zt.clone());
  return _e;
}
function mergeAxisComponent(_e, Qt) {
  for (const Zt of AXIS_COMPONENT_PROPERTIES) {
    const $n = mergeValuesWithExplicit(
      _e.getWithExplicit(Zt),
      Qt.getWithExplicit(Zt),
      Zt,
      "axis",
      // Tie breaker function
      (Sn, kn) => {
        switch (Zt) {
          case "title":
            return mergeTitleComponent(Sn, kn);
          case "gridScale":
            return {
              explicit: Sn.explicit,
              value: getFirstDefined(Sn.value, kn.value)
            };
        }
        return defaultTieBreaker(Sn, kn, Zt, "axis");
      }
    );
    _e.setWithExplicit(Zt, $n);
  }
  return _e;
}
function isExplicit(_e, Qt, Zt, $n, Sn) {
  if (Qt === "disable")
    return Zt !== void 0;
  switch (Zt = Zt || {}, Qt) {
    case "titleAngle":
    case "labelAngle":
      return _e === (isSignalRef(Zt.labelAngle) ? Zt.labelAngle : normalizeAngle(Zt.labelAngle));
    case "values":
      return !!Zt.values;
    case "encode":
      return !!Zt.encoding || !!Zt.labelAngle;
    case "title":
      if (_e === getFieldDefTitle($n, Sn))
        return !0;
  }
  return _e === Zt[Qt];
}
const propsToAlwaysIncludeConfig = /* @__PURE__ */ new Set([
  "grid",
  "translate",
  // the rest are not axis configs in Vega, but are in VL, so we need to set too.
  "format",
  "formatType",
  "orient",
  "labelExpr",
  "tickCount",
  "position",
  "tickMinStep"
]);
function parseAxis(_e, Qt) {
  var Bs, Hs;
  let Zt = Qt.axis(_e);
  const $n = new AxisComponent(), Sn = getFieldOrDatumDef(Qt.encoding[_e]), { mark: kn, config: Kn } = Qt, er = (Zt == null ? void 0 : Zt.orient) || ((Bs = Kn[_e === "x" ? "axisX" : "axisY"]) == null ? void 0 : Bs.orient) || ((Hs = Kn.axis) == null ? void 0 : Hs.orient) || defaultOrient(_e), Cr = Qt.getScaleComponent(_e).get("type"), kr = getAxisConfigs(_e, Cr, er, Qt.config), Yr = Zt !== void 0 ? !Zt : getAxisConfig("disable", Kn.style, Zt == null ? void 0 : Zt.style, kr).configValue;
  if ($n.set("disable", Yr, Zt !== void 0), Yr)
    return $n;
  Zt = Zt || {};
  const Ms = getLabelAngle(Sn, Zt, _e, Kn.style, kr), Ds = guideFormatType(Zt.formatType, Sn, Cr), Ls = guideFormat(Sn, Sn.type, Zt.format, Zt.formatType, Kn, !0), js = {
    fieldOrDatumDef: Sn,
    axis: Zt,
    channel: _e,
    model: Qt,
    scaleType: Cr,
    orient: er,
    labelAngle: Ms,
    format: Ls,
    formatType: Ds,
    mark: kn,
    config: Kn
  };
  for (const Ws of AXIS_COMPONENT_PROPERTIES) {
    const Ys = Ws in axisRules ? axisRules[Ws](js) : isAxisProperty(Ws) ? Zt[Ws] : void 0, El = Ys !== void 0, Mu = isExplicit(Ys, Ws, Zt, Qt, _e);
    if (El && Mu)
      $n.set(Ws, Ys, Mu);
    else {
      const { configValue: Pl = void 0, configFrom: Iu = void 0 } = isAxisProperty(Ws) && Ws !== "values" ? getAxisConfig(Ws, Kn.style, Zt.style, kr) : {}, Tu = Pl !== void 0;
      El && !Tu ? $n.set(Ws, Ys, Mu) : (
        // Cases need implicit values
        // 1. Axis config that aren't available in Vega
        (Iu !== "vgAxisConfig" || // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details)
        propsToAlwaysIncludeConfig.has(Ws) && Tu || // 3. Conditional axis values and signals
        isConditionalAxisValue(Pl) || isSignalRef(Pl)) && $n.set(Ws, Pl, !1)
      );
    }
  }
  const zs = Zt.encoding ?? {}, Fs = AXIS_PARTS.reduce((Ws, Ys) => {
    if (!$n.hasAxisPart(Ys))
      return Ws;
    const El = guideEncodeEntry(zs[Ys] ?? {}, Qt), Mu = Ys === "labels" ? labels(Qt, _e, El) : El;
    return Mu !== void 0 && !isEmpty(Mu) && (Ws[Ys] = { update: Mu }), Ws;
  }, {});
  return isEmpty(Fs) || $n.set("encode", Fs, !!Zt.encoding || Zt.labelAngle !== void 0), $n;
}
function initLayoutSize({ encoding: _e, size: Qt }) {
  for (const Zt of POSITION_SCALE_CHANNELS) {
    const $n = getSizeChannel(Zt);
    isStep(Qt[$n]) && isContinuousFieldOrDatumDef(_e[Zt]) && (delete Qt[$n], warn$1(stepDropped($n)));
  }
  return Qt;
}
const arc = {
  vgMark: "arc",
  encodeEntry: (_e) => ({
    ...baseEncodeEntry(_e, {
      align: "ignore",
      baseline: "ignore",
      color: "include",
      size: "ignore",
      orient: "ignore",
      theta: "ignore"
    }),
    ...pointPosition("x", _e, { defaultPos: "mid" }),
    ...pointPosition("y", _e, { defaultPos: "mid" }),
    // arcs are rectangles in polar coordinates
    ...rectPosition(_e, "radius"),
    ...rectPosition(_e, "theta")
  })
}, area = {
  vgMark: "area",
  encodeEntry: (_e) => ({
    ...baseEncodeEntry(_e, {
      align: "ignore",
      baseline: "ignore",
      color: "include",
      orient: "include",
      size: "ignore",
      theta: "ignore"
    }),
    ...pointOrRangePosition("x", _e, {
      defaultPos: "zeroOrMin",
      defaultPos2: "zeroOrMin",
      range: _e.markDef.orient === "horizontal"
    }),
    ...pointOrRangePosition("y", _e, {
      defaultPos: "zeroOrMin",
      defaultPos2: "zeroOrMin",
      range: _e.markDef.orient === "vertical"
    }),
    ...defined(_e)
  })
}, bar = {
  vgMark: "rect",
  encodeEntry: (_e) => ({
    ...baseEncodeEntry(_e, {
      align: "ignore",
      baseline: "ignore",
      color: "include",
      orient: "ignore",
      size: "ignore",
      theta: "ignore"
    }),
    ...rectPosition(_e, "x"),
    ...rectPosition(_e, "y")
  })
}, geoshape = {
  vgMark: "shape",
  encodeEntry: (_e) => ({
    ...baseEncodeEntry(_e, {
      align: "ignore",
      baseline: "ignore",
      color: "include",
      size: "ignore",
      orient: "ignore",
      theta: "ignore"
    })
  }),
  postEncodingTransform: (_e) => {
    const { encoding: Qt } = _e, Zt = Qt.shape;
    return [{
      type: "geoshape",
      projection: _e.projectionName(),
      // as: 'shape',
      ...Zt && isFieldDef(Zt) && Zt.type === GEOJSON ? { field: vgField(Zt, { expr: "datum" }) } : {}
    }];
  }
}, image = {
  vgMark: "image",
  encodeEntry: (_e) => ({
    ...baseEncodeEntry(_e, {
      align: "ignore",
      baseline: "ignore",
      color: "ignore",
      orient: "ignore",
      size: "ignore",
      theta: "ignore"
    }),
    ...rectPosition(_e, "x"),
    ...rectPosition(_e, "y"),
    ...text$1(_e, "url")
  })
}, line = {
  vgMark: "line",
  encodeEntry: (_e) => ({
    ...baseEncodeEntry(_e, {
      align: "ignore",
      baseline: "ignore",
      color: "include",
      size: "ignore",
      orient: "ignore",
      theta: "ignore"
    }),
    ...pointPosition("x", _e, { defaultPos: "mid" }),
    ...pointPosition("y", _e, { defaultPos: "mid" }),
    ...nonPosition("size", _e, {
      vgChannel: "strokeWidth"
      // VL's line size is strokeWidth
    }),
    ...defined(_e)
  })
}, trail = {
  vgMark: "trail",
  encodeEntry: (_e) => ({
    ...baseEncodeEntry(_e, {
      align: "ignore",
      baseline: "ignore",
      color: "include",
      size: "include",
      orient: "ignore",
      theta: "ignore"
    }),
    ...pointPosition("x", _e, { defaultPos: "mid" }),
    ...pointPosition("y", _e, { defaultPos: "mid" }),
    ...nonPosition("size", _e),
    ...defined(_e)
  })
};
function encodeEntry(_e, Qt) {
  const { config: Zt } = _e;
  return {
    ...baseEncodeEntry(_e, {
      align: "ignore",
      baseline: "ignore",
      color: "include",
      size: "include",
      orient: "ignore",
      theta: "ignore"
    }),
    ...pointPosition("x", _e, { defaultPos: "mid" }),
    ...pointPosition("y", _e, { defaultPos: "mid" }),
    ...nonPosition("size", _e),
    ...nonPosition("angle", _e),
    ...shapeMixins(_e, Zt, Qt)
  };
}
function shapeMixins(_e, Qt, Zt) {
  return Zt ? { shape: { value: Zt } } : nonPosition("shape", _e);
}
const point = {
  vgMark: "symbol",
  encodeEntry: (_e) => encodeEntry(_e)
}, circle = {
  vgMark: "symbol",
  encodeEntry: (_e) => encodeEntry(_e, "circle")
}, square = {
  vgMark: "symbol",
  encodeEntry: (_e) => encodeEntry(_e, "square")
}, rect = {
  vgMark: "rect",
  encodeEntry: (_e) => ({
    ...baseEncodeEntry(_e, {
      align: "ignore",
      baseline: "ignore",
      color: "include",
      orient: "ignore",
      size: "ignore",
      theta: "ignore"
    }),
    ...rectPosition(_e, "x"),
    ...rectPosition(_e, "y")
  })
}, rule = {
  vgMark: "rule",
  encodeEntry: (_e) => {
    const { markDef: Qt } = _e, Zt = Qt.orient;
    return !_e.encoding.x && !_e.encoding.y && !_e.encoding.latitude && !_e.encoding.longitude ? {} : {
      ...baseEncodeEntry(_e, {
        align: "ignore",
        baseline: "ignore",
        color: "include",
        orient: "ignore",
        size: "ignore",
        theta: "ignore"
      }),
      ...pointOrRangePosition("x", _e, {
        defaultPos: Zt === "horizontal" ? "zeroOrMax" : "mid",
        defaultPos2: "zeroOrMin",
        range: Zt !== "vertical"
        // include x2 for horizontal or line segment rule
      }),
      ...pointOrRangePosition("y", _e, {
        defaultPos: Zt === "vertical" ? "zeroOrMax" : "mid",
        defaultPos2: "zeroOrMin",
        range: Zt !== "horizontal"
        // include y2 for vertical or line segment rule
      }),
      ...nonPosition("size", _e, {
        vgChannel: "strokeWidth"
        // VL's rule size is strokeWidth
      })
    };
  }
}, text = {
  vgMark: "text",
  encodeEntry: (_e) => {
    const { config: Qt, encoding: Zt } = _e;
    return {
      ...baseEncodeEntry(_e, {
        align: "include",
        baseline: "include",
        color: "include",
        size: "ignore",
        orient: "ignore",
        theta: "include"
      }),
      ...pointPosition("x", _e, { defaultPos: "mid" }),
      ...pointPosition("y", _e, { defaultPos: "mid" }),
      ...text$1(_e),
      ...nonPosition("size", _e, {
        vgChannel: "fontSize"
        // VL's text size is fontSize
      }),
      ...nonPosition("angle", _e),
      ...valueIfDefined("align", align(_e.markDef, Zt, Qt)),
      ...valueIfDefined("baseline", baseline(_e.markDef, Zt, Qt)),
      ...pointPosition("radius", _e, { defaultPos: null }),
      ...pointPosition("theta", _e, { defaultPos: null })
    };
  }
};
function align(_e, Qt, Zt) {
  if (getMarkPropOrConfig("align", _e, Zt) === void 0)
    return "center";
}
function baseline(_e, Qt, Zt) {
  if (getMarkPropOrConfig("baseline", _e, Zt) === void 0)
    return "middle";
}
const tick = {
  vgMark: "rect",
  encodeEntry: (_e) => {
    const { config: Qt, markDef: Zt } = _e, $n = Zt.orient, Sn = $n === "horizontal" ? "width" : "height", kn = $n === "horizontal" ? "height" : "width";
    return {
      ...baseEncodeEntry(_e, {
        align: "ignore",
        baseline: "ignore",
        color: "include",
        orient: "ignore",
        size: "ignore",
        theta: "ignore"
      }),
      ...pointPosition("x", _e, { defaultPos: "mid", vgChannel: "xc" }),
      ...pointPosition("y", _e, { defaultPos: "mid", vgChannel: "yc" }),
      // size / thickness => width / height
      ...nonPosition("size", _e, {
        defaultValue: defaultSize(_e),
        vgChannel: Sn
      }),
      [kn]: signalOrValueRef(getMarkPropOrConfig("thickness", Zt, Qt))
    };
  }
};
function defaultSize(_e) {
  const { config: Qt, markDef: Zt } = _e, { orient: $n } = Zt, Sn = $n === "horizontal" ? "width" : "height", kn = _e.getScaleComponent($n === "horizontal" ? "x" : "y"), Kn = getMarkPropOrConfig("size", Zt, Qt, { vgChannel: Sn }) ?? Qt.tick.bandSize;
  if (Kn !== void 0)
    return Kn;
  {
    const er = kn ? kn.get("range") : void 0;
    return er && isVgRangeStep(er) && isNumber$1(er.step) ? er.step * 3 / 4 : getViewConfigDiscreteStep(Qt.view, Sn) * 3 / 4;
  }
}
const markCompiler = {
  arc,
  area,
  bar,
  circle,
  geoshape,
  image,
  line,
  point,
  rect,
  rule,
  square,
  text,
  tick,
  trail
};
function parseMarkGroups(_e) {
  if (contains$1([LINE, AREA, TRAIL], _e.mark)) {
    const Qt = pathGroupingFields(_e.mark, _e.encoding);
    if (Qt.length > 0)
      return getPathGroups(_e, Qt);
  } else if (_e.mark === BAR) {
    const Qt = VG_CORNERRADIUS_CHANNELS.some((Zt) => getMarkPropOrConfig(Zt, _e.markDef, _e.config));
    if (_e.stack && !_e.fieldDef("size") && Qt)
      return getGroupsForStackedBarWithCornerRadius(_e);
  }
  return getMarkGroup(_e);
}
const FACETED_PATH_PREFIX = "faceted_path_";
function getPathGroups(_e, Qt) {
  return [
    {
      name: _e.getName("pathgroup"),
      type: "group",
      from: {
        facet: {
          name: FACETED_PATH_PREFIX + _e.requestDataName(DataSourceType.Main),
          data: _e.requestDataName(DataSourceType.Main),
          groupby: Qt
        }
      },
      encode: {
        update: {
          width: { field: { group: "width" } },
          height: { field: { group: "height" } }
        }
      },
      // With subfacet for line/area group, need to use faceted data from above.
      marks: getMarkGroup(_e, { fromPrefix: FACETED_PATH_PREFIX })
    }
  ];
}
const STACK_GROUP_PREFIX = "stack_group_";
function getGroupsForStackedBarWithCornerRadius(_e) {
  var kr;
  const [Qt] = getMarkGroup(_e, { fromPrefix: STACK_GROUP_PREFIX }), Zt = _e.scaleName(_e.stack.fieldChannel), $n = (Yr = {}) => _e.vgField(_e.stack.fieldChannel, Yr), Sn = (Yr, Ms) => {
    const Ds = [
      $n({ prefix: "min", suffix: "start", expr: Ms }),
      $n({ prefix: "max", suffix: "start", expr: Ms }),
      $n({ prefix: "min", suffix: "end", expr: Ms }),
      $n({ prefix: "max", suffix: "end", expr: Ms })
    ];
    return `${Yr}(${Ds.map((Ls) => `scale('${Zt}',${Ls})`).join(",")})`;
  };
  let kn, Kn;
  _e.stack.fieldChannel === "x" ? (kn = {
    ...pick$2(Qt.encode.update, ["y", "yc", "y2", "height", ...VG_CORNERRADIUS_CHANNELS]),
    x: { signal: Sn("min", "datum") },
    x2: { signal: Sn("max", "datum") },
    clip: { value: !0 }
  }, Kn = {
    x: { field: { group: "x" }, mult: -1 },
    height: { field: { group: "height" } }
  }, Qt.encode.update = {
    ...omit(Qt.encode.update, ["y", "yc", "y2"]),
    height: { field: { group: "height" } }
  }) : (kn = {
    ...pick$2(Qt.encode.update, ["x", "xc", "x2", "width"]),
    y: { signal: Sn("min", "datum") },
    y2: { signal: Sn("max", "datum") },
    clip: { value: !0 }
  }, Kn = {
    y: { field: { group: "y" }, mult: -1 },
    width: { field: { group: "width" } }
  }, Qt.encode.update = {
    ...omit(Qt.encode.update, ["x", "xc", "x2"]),
    width: { field: { group: "width" } }
  });
  for (const Yr of VG_CORNERRADIUS_CHANNELS) {
    const Ms = getMarkConfig(Yr, _e.markDef, _e.config);
    Qt.encode.update[Yr] ? (kn[Yr] = Qt.encode.update[Yr], delete Qt.encode.update[Yr]) : Ms && (kn[Yr] = signalOrValueRef(Ms)), Ms && (Qt.encode.update[Yr] = { value: 0 });
  }
  const er = [];
  if (((kr = _e.stack.groupbyChannels) == null ? void 0 : kr.length) > 0)
    for (const Yr of _e.stack.groupbyChannels) {
      const Ms = _e.fieldDef(Yr), Ds = vgField(Ms);
      Ds && er.push(Ds), (Ms != null && Ms.bin || Ms != null && Ms.timeUnit) && er.push(vgField(Ms, { binSuffix: "end" }));
    }
  return kn = [
    "stroke",
    "strokeWidth",
    "strokeJoin",
    "strokeCap",
    "strokeDash",
    "strokeDashOffset",
    "strokeMiterLimit",
    "strokeOpacity"
  ].reduce((Yr, Ms) => {
    if (Qt.encode.update[Ms])
      return { ...Yr, [Ms]: Qt.encode.update[Ms] };
    {
      const Ds = getMarkConfig(Ms, _e.markDef, _e.config);
      return Ds !== void 0 ? { ...Yr, [Ms]: signalOrValueRef(Ds) } : Yr;
    }
  }, kn), kn.stroke && (kn.strokeForeground = { value: !0 }, kn.strokeOffset = { value: 0 }), [
    {
      type: "group",
      from: {
        facet: {
          data: _e.requestDataName(DataSourceType.Main),
          name: STACK_GROUP_PREFIX + _e.requestDataName(DataSourceType.Main),
          groupby: er,
          aggregate: {
            fields: [
              $n({ suffix: "start" }),
              $n({ suffix: "start" }),
              $n({ suffix: "end" }),
              $n({ suffix: "end" })
            ],
            ops: ["min", "max", "min", "max"]
          }
        }
      },
      encode: {
        update: kn
      },
      marks: [
        {
          type: "group",
          encode: { update: Kn },
          marks: [Qt]
        }
      ]
    }
  ];
}
function getSort(_e) {
  var er;
  const { encoding: Qt, stack: Zt, mark: $n, markDef: Sn, config: kn } = _e, Kn = Qt.order;
  if (!(!isArray(Kn) && isValueDef(Kn) && isNullOrFalse(Kn.value) || !Kn && isNullOrFalse(getMarkPropOrConfig("order", Sn, kn)))) {
    if ((isArray(Kn) || isFieldDef(Kn)) && !Zt)
      return sortParams(Kn, { expr: "datum" });
    if (isPathMark($n)) {
      const Cr = Sn.orient === "horizontal" ? "y" : "x", kr = Qt[Cr];
      if (isFieldDef(kr)) {
        const Yr = kr.sort;
        if (isArray(Yr))
          return {
            field: vgField(kr, { prefix: Cr, suffix: "sort_index", expr: "datum" })
          };
        if (isSortField(Yr))
          return {
            field: vgField({
              // FIXME: this op might not already exist?
              // FIXME: what if dimensionChannel (x or y) contains custom domain?
              aggregate: isAggregate$1(_e.encoding) ? Yr.op : void 0,
              field: Yr.field
            }, { expr: "datum" })
          };
        if (isSortByEncoding(Yr)) {
          const Ms = _e.fieldDef(Yr.encoding);
          return {
            field: vgField(Ms, { expr: "datum" }),
            order: Yr.order
          };
        } else
          return Yr === null ? void 0 : {
            field: vgField(kr, {
              // For stack with imputation, we only have bin_mid
              binSuffix: (er = _e.stack) != null && er.impute ? "mid" : void 0,
              expr: "datum"
            })
          };
      }
      return;
    }
  }
}
function getMarkGroup(_e, Qt = { fromPrefix: "" }) {
  const { mark: Zt, markDef: $n, encoding: Sn, config: kn } = _e, Kn = getFirstDefined($n.clip, scaleClip(_e), projectionClip(_e)), er = getStyles$2($n), Cr = Sn.key, kr = getSort(_e), Yr = interactiveFlag(_e), Ms = getMarkPropOrConfig("aria", $n, kn), Ds = markCompiler[Zt].postEncodingTransform ? markCompiler[Zt].postEncodingTransform(_e) : null;
  return [
    {
      name: _e.getName("marks"),
      type: markCompiler[Zt].vgMark,
      ...Kn ? { clip: !0 } : {},
      ...er ? { style: er } : {},
      ...Cr ? { key: Cr.field } : {},
      ...kr ? { sort: kr } : {},
      ...Yr || {},
      ...Ms === !1 ? { aria: Ms } : {},
      from: { data: Qt.fromPrefix + _e.requestDataName(DataSourceType.Main) },
      encode: {
        update: markCompiler[Zt].encodeEntry(_e)
      },
      ...Ds ? {
        transform: Ds
      } : {}
    }
  ];
}
function scaleClip(_e) {
  const Qt = _e.getScaleComponent("x"), Zt = _e.getScaleComponent("y");
  return Qt != null && Qt.get("selectionExtent") || Zt != null && Zt.get("selectionExtent") ? !0 : void 0;
}
function projectionClip(_e) {
  const Qt = _e.component.projection;
  return Qt && !Qt.isFit ? !0 : void 0;
}
function interactiveFlag(_e) {
  if (!_e.component.selection)
    return null;
  const Qt = keys$2(_e.component.selection).length;
  let Zt = Qt, $n = _e.parent;
  for (; $n && Zt === 0; )
    Zt = keys$2($n.component.selection).length, $n = $n.parent;
  return Zt ? {
    interactive: Qt > 0 || _e.mark === "geoshape" || !!_e.encoding.tooltip
  } : null;
}
class UnitModel extends ModelWithField {
  constructor(Qt, Zt, $n, Sn = {}, kn) {
    super(Qt, "unit", Zt, $n, kn, void 0, isFrameMixins(Qt) ? Qt.view : void 0), this.specifiedScales = {}, this.specifiedAxes = {}, this.specifiedLegends = {}, this.specifiedProjection = {}, this.selection = [], this.children = [];
    const Kn = isMarkDef(Qt.mark) ? { ...Qt.mark } : { type: Qt.mark }, er = Kn.type;
    Kn.filled === void 0 && (Kn.filled = defaultFilled(Kn, kn, {
      graticule: Qt.data && isGraticuleGenerator(Qt.data)
    }));
    const Cr = this.encoding = initEncoding(Qt.encoding || {}, er, Kn.filled, kn);
    this.markDef = initMarkdef(Kn, Cr, kn), this.size = initLayoutSize({
      encoding: Cr,
      size: isFrameMixins(Qt) ? {
        ...Sn,
        ...Qt.width ? { width: Qt.width } : {},
        ...Qt.height ? { height: Qt.height } : {}
      } : Sn
    }), this.stack = stack(this.markDef, Cr), this.specifiedScales = this.initScales(er, Cr), this.specifiedAxes = this.initAxes(Cr), this.specifiedLegends = this.initLegends(Cr), this.specifiedProjection = Qt.projection, this.selection = (Qt.params ?? []).filter((kr) => isSelectionParameter(kr));
  }
  get hasProjection() {
    const { encoding: Qt } = this, Zt = this.mark === GEOSHAPE, $n = Qt && GEOPOSITION_CHANNELS.some((Sn) => isFieldOrDatumDef(Qt[Sn]));
    return Zt || $n;
  }
  /**
   * Return specified Vega-Lite scale domain for a particular channel
   * @param channel
   */
  scaleDomain(Qt) {
    const Zt = this.specifiedScales[Qt];
    return Zt ? Zt.domain : void 0;
  }
  axis(Qt) {
    return this.specifiedAxes[Qt];
  }
  legend(Qt) {
    return this.specifiedLegends[Qt];
  }
  initScales(Qt, Zt) {
    return SCALE_CHANNELS.reduce(($n, Sn) => {
      const kn = getFieldOrDatumDef(Zt[Sn]);
      return kn && ($n[Sn] = this.initScale(kn.scale ?? {})), $n;
    }, {});
  }
  initScale(Qt) {
    const { domain: Zt, range: $n } = Qt, Sn = replaceExprRef(Qt);
    return isArray(Zt) && (Sn.domain = Zt.map(signalRefOrValue)), isArray($n) && (Sn.range = $n.map(signalRefOrValue)), Sn;
  }
  initAxes(Qt) {
    return POSITION_SCALE_CHANNELS.reduce((Zt, $n) => {
      const Sn = Qt[$n];
      if (isFieldOrDatumDef(Sn) || $n === X$1 && isFieldOrDatumDef(Qt.x2) || $n === Y$1 && isFieldOrDatumDef(Qt.y2)) {
        const kn = isFieldOrDatumDef(Sn) ? Sn.axis : void 0;
        Zt[$n] = kn && this.initAxis({ ...kn });
      }
      return Zt;
    }, {});
  }
  initAxis(Qt) {
    const Zt = keys$2(Qt), $n = {};
    for (const Sn of Zt) {
      const kn = Qt[Sn];
      $n[Sn] = isConditionalAxisValue(kn) ? signalOrValueRefWithCondition(kn) : signalRefOrValue(kn);
    }
    return $n;
  }
  initLegends(Qt) {
    return NONPOSITION_SCALE_CHANNELS.reduce((Zt, $n) => {
      const Sn = getFieldOrDatumDef(Qt[$n]);
      if (Sn && supportLegend($n)) {
        const kn = Sn.legend;
        Zt[$n] = kn && replaceExprRef(kn);
      }
      return Zt;
    }, {});
  }
  parseData() {
    this.component.data = parseData(this);
  }
  parseLayoutSize() {
    parseUnitLayoutSize(this);
  }
  parseSelections() {
    this.component.selection = parseUnitSelection(this, this.selection);
  }
  parseMarkGroup() {
    this.component.mark = parseMarkGroups(this);
  }
  parseAxesAndHeaders() {
    this.component.axes = parseUnitAxes(this);
  }
  assembleSelectionTopLevelSignals(Qt) {
    return assembleTopLevelSignals(this, Qt);
  }
  assembleSignals() {
    return [...assembleAxisSignals(this), ...assembleUnitSelectionSignals(this, [])];
  }
  assembleSelectionData(Qt) {
    return assembleUnitSelectionData(this, Qt);
  }
  assembleLayout() {
    return null;
  }
  assembleLayoutSignals() {
    return assembleLayoutSignals(this);
  }
  assembleMarks() {
    let Qt = this.component.mark ?? [];
    return (!this.parent || !isLayerModel(this.parent)) && (Qt = assembleUnitSelectionMarks(this, Qt)), Qt.map(this.correctDataNames);
  }
  assembleGroupStyle() {
    const { style: Qt } = this.view || {};
    return Qt !== void 0 ? Qt : this.encoding.x || this.encoding.y ? "cell" : "view";
  }
  getMapping() {
    return this.encoding;
  }
  get mark() {
    return this.markDef.type;
  }
  channelHasField(Qt) {
    return channelHasField(this.encoding, Qt);
  }
  fieldDef(Qt) {
    const Zt = this.encoding[Qt];
    return getFieldDef(Zt);
  }
  typedFieldDef(Qt) {
    const Zt = this.fieldDef(Qt);
    return isTypedFieldDef(Zt) ? Zt : null;
  }
}
class LayerModel extends Model {
  constructor(Qt, Zt, $n, Sn, kn) {
    super(Qt, "layer", Zt, $n, kn, Qt.resolve, Qt.view);
    const Kn = {
      ...Sn,
      ...Qt.width ? { width: Qt.width } : {},
      ...Qt.height ? { height: Qt.height } : {}
    };
    this.children = Qt.layer.map((er, Cr) => {
      if (isLayerSpec(er))
        return new LayerModel(er, this, this.getName(`layer_${Cr}`), Kn, kn);
      if (isUnitSpec(er))
        return new UnitModel(er, this, this.getName(`layer_${Cr}`), Kn, kn);
      throw new Error(invalidSpec(er));
    });
  }
  parseData() {
    this.component.data = parseData(this);
    for (const Qt of this.children)
      Qt.parseData();
  }
  parseLayoutSize() {
    parseLayerLayoutSize(this);
  }
  parseSelections() {
    this.component.selection = {};
    for (const Qt of this.children) {
      Qt.parseSelections();
      for (const Zt of keys$2(Qt.component.selection))
        this.component.selection[Zt] = Qt.component.selection[Zt];
    }
  }
  parseMarkGroup() {
    for (const Qt of this.children)
      Qt.parseMarkGroup();
  }
  parseAxesAndHeaders() {
    parseLayerAxes(this);
  }
  assembleSelectionTopLevelSignals(Qt) {
    return this.children.reduce((Zt, $n) => $n.assembleSelectionTopLevelSignals(Zt), Qt);
  }
  // TODO: Support same named selections across children.
  assembleSignals() {
    return this.children.reduce((Qt, Zt) => Qt.concat(Zt.assembleSignals()), assembleAxisSignals(this));
  }
  assembleLayoutSignals() {
    return this.children.reduce((Qt, Zt) => Qt.concat(Zt.assembleLayoutSignals()), assembleLayoutSignals(this));
  }
  assembleSelectionData(Qt) {
    return this.children.reduce((Zt, $n) => $n.assembleSelectionData(Zt), Qt);
  }
  assembleGroupStyle() {
    const Qt = /* @__PURE__ */ new Set();
    for (const $n of this.children)
      for (const Sn of array$6($n.assembleGroupStyle()))
        Qt.add(Sn);
    const Zt = Array.from(Qt);
    return Zt.length > 1 ? Zt : Zt.length === 1 ? Zt[0] : void 0;
  }
  assembleTitle() {
    let Qt = super.assembleTitle();
    if (Qt)
      return Qt;
    for (const Zt of this.children)
      if (Qt = Zt.assembleTitle(), Qt)
        return Qt;
  }
  assembleLayout() {
    return null;
  }
  assembleMarks() {
    return assembleLayerSelectionMarks(this, this.children.flatMap((Qt) => Qt.assembleMarks()));
  }
  assembleLegends() {
    return this.children.reduce((Qt, Zt) => Qt.concat(Zt.assembleLegends()), assembleLegends(this));
  }
}
function buildModel(_e, Qt, Zt, $n, Sn) {
  if (isFacetSpec(_e))
    return new FacetModel(_e, Qt, Zt, Sn);
  if (isLayerSpec(_e))
    return new LayerModel(_e, Qt, Zt, $n, Sn);
  if (isUnitSpec(_e))
    return new UnitModel(_e, Qt, Zt, $n, Sn);
  if (isAnyConcatSpec(_e))
    return new ConcatModel(_e, Qt, Zt, Sn);
  throw new Error(invalidSpec(_e));
}
function compile(_e, Qt = {}) {
  Qt.logger && set$6(Qt.logger), Qt.fieldTitle && setTitleFormatter(Qt.fieldTitle);
  try {
    const Zt = initConfig(mergeConfig(Qt.config, _e.config)), $n = normalize(_e, Zt), Sn = buildModel($n, null, "", void 0, Zt);
    return Sn.parse(), optimizeDataflow(Sn.component.data, Sn), {
      spec: assembleTopLevelModel(Sn, getTopLevelProperties(_e, $n.autosize, Zt, Sn), _e.datasets, _e.usermeta),
      normalized: $n
    };
  } finally {
    Qt.logger && reset$1(), Qt.fieldTitle && resetTitleFormatter();
  }
}
function getTopLevelProperties(_e, Qt, Zt, $n) {
  const Sn = $n.component.layoutSize.get("width"), kn = $n.component.layoutSize.get("height");
  if (Qt === void 0 ? (Qt = { type: "pad" }, $n.hasAxisOrientSignalRef() && (Qt.resize = !0)) : isString(Qt) && (Qt = { type: Qt }), Sn && kn && isFitType(Qt.type)) {
    if (Sn === "step" && kn === "step")
      warn$1(droppingFit()), Qt.type = "pad";
    else if (Sn === "step" || kn === "step") {
      const Kn = Sn === "step" ? "width" : "height";
      warn$1(droppingFit(getPositionScaleChannel(Kn)));
      const er = Kn === "width" ? "height" : "width";
      Qt.type = getFitType(er);
    }
  }
  return {
    ...keys$2(Qt).length === 1 && Qt.type ? Qt.type === "pad" ? {} : { autosize: Qt.type } : { autosize: Qt },
    ...extractTopLevelProperties(Zt, !1),
    ...extractTopLevelProperties(_e, !0)
  };
}
function assembleTopLevelModel(_e, Qt, Zt = {}, $n) {
  const Sn = _e.config ? stripAndRedirectConfig(_e.config) : void 0, kn = [].concat(
    _e.assembleSelectionData([]),
    // only assemble data in the root
    assembleRootData(_e.component.data, Zt)
  ), Kn = _e.assembleProjections(), er = _e.assembleTitle(), Cr = _e.assembleGroupStyle(), kr = _e.assembleGroupEncodeEntry(!0);
  let Yr = _e.assembleLayoutSignals();
  Yr = Yr.filter((Ls) => (Ls.name === "width" || Ls.name === "height") && Ls.value !== void 0 ? (Qt[Ls.name] = +Ls.value, !1) : !0);
  const { params: Ms, ...Ds } = Qt;
  return {
    $schema: "https://vega.github.io/schema/vega/v5.json",
    ..._e.description ? { description: _e.description } : {},
    ...Ds,
    ...er ? { title: er } : {},
    ...Cr ? { style: Cr } : {},
    ...kr ? { encode: { update: kr } } : {},
    data: kn,
    ...Kn.length > 0 ? { projections: Kn } : {},
    ..._e.assembleGroup([
      ...Yr,
      ..._e.assembleSelectionTopLevelSignals([]),
      ...assembleParameterSignals(Ms)
    ]),
    ...Sn ? { config: Sn } : {},
    ...$n ? { usermeta: $n } : {}
  };
}
const version$2 = pkg$1.version, vegaLiteImport = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  accessPathDepth,
  accessPathWithDatum,
  compile,
  contains: contains$1,
  deepEqual,
  deleteNestedProperty,
  duplicate,
  entries: entries$1,
  every,
  fieldIntersection,
  flatAccessWithDatum,
  getFirstDefined,
  hasIntersection,
  hash,
  internalField,
  isBoolean: isBoolean$1,
  isEmpty,
  isEqual: isEqual$3,
  isInternalField,
  isNullOrFalse,
  isNumeric,
  keys: keys$2,
  logicalExpr,
  mergeDeep: mergeDeep$1,
  never,
  normalize,
  normalizeAngle,
  omit,
  pick: pick$2,
  prefixGenerator,
  removePathFromField,
  replaceAll,
  replacePathInField,
  resetIdCounter,
  setEqual,
  some,
  stringify: stringify$2,
  titleCase,
  unique,
  uniqueId,
  vals,
  varName,
  version: version$2
}, Symbol.toStringTag, { value: "Module" }));
function getInteractionsFromRoot(_e, Qt = _e.current.id) {
  const Zt = [], $n = _e.graph.backend.nodes;
  let Sn = $n[Qt];
  for (; !Mt$1(Sn); )
    Zt.push(Sn.id), Sn = $n[Sn.parent];
  return Zt.push(_e.root.id), Zt.reverse(), Zt.map((kn) => $n[kn]).map((kn) => _e.getState(kn));
}
function postCreationAction(_e, Qt) {
  Qt === "copy" ? window.Persist.Commands.execute(PersistCommands.copyDataframe, { record: _e }) : Qt === "insert" && window.Persist.Commands.execute(PersistCommands.insertCellWithDataframe, {
    record: _e
  });
}
function getRecord(_e, Qt, Zt) {
  return {
    dfName: _e,
    root_id: Qt.root.id,
    current_node_id: Qt.current.id,
    interactions: getInteractionsFromRoot(Qt),
    isDynamic: Zt
  };
}
var PersistCommands;
((_e) => {
  _e.resetTrrack = "persist:trrack:reset", _e.pointSelection = "persist:selection:point", _e.intervalSelection = "persist:selection:interval", _e.intentSelection = "persist:selection:intent", _e.invertSelection = "persist:selection:invert", _e.clearSelection = "persist:selection:clear", _e.categorize = "persist:category:assign", _e.filterOut = "persist:filter:out", _e.filterIn = "persist:filter:in", _e.sortByColumn = "persist:column:sort", _e.reorderColumns = "persist:column:order", _e.renameColumns = "persist:column:rename", _e.dropColumns = "persist:column:drop", _e.changeColumnDataType = "persist:column:changetype", _e.annotate = "persist:annotate", _e.editCell = "persist:data:edit", _e.createDataframe = "persist:dataframe:create", _e.copyDataframe = "persist:dataframe:copy", _e.insertCellWithDataframe = "persist:dataframe:insert-cell", _e.deleteDataframe = "persist:dataframe:delete";
})(PersistCommands || (PersistCommands = {}));
const PERSIST_MANTINE_FONT_SIZE = "xs", PERSIST_ICON_SIZE = "1.3em", pandasDTypes = [
  "Int64",
  "Float64",
  "string",
  "boolean",
  "datetime64[ns]",
  "category"
], pandasDTypesLabels = {
  string: "string",
  boolean: "boolean",
  Float64: "float",
  Int64: "integer",
  category: "category",
  "datetime64[ns]": "datetime"
}, DateFormatOptions = {
  EpochTime: {
    value: "EpochTime",
    label: "Epoch Time (e.g. 1698861600000)"
  },
  ISO8601DateTime: {
    value: "ISO8601",
    label: 'ISO 8601 Date and Time (e.g., "2023-01-01T12:00:00")'
  },
  ShortDate: { value: "%m/%d/%y", label: 'Short Date (e.g., "01/01/23")' },
  LongDate: { value: "%d, %Y", label: 'Long Date (e.g., "01, 2023")' },
  TimeWithSeconds: {
    value: "%H:%M:%S",
    label: '24-Hour Time with Seconds (e.g., "12:00:00")'
  },
  Time12HourWithAMPM: {
    value: "%I:%M %p",
    label: '12-Hour Time with AM/PM (e.g., "12:00 PM")'
  },
  RFC822Date: {
    value: "%d %b %y %H:%M:%S UTC",
    label: 'RFC 822 Date (e.g., "01 Jan 23 12:00:00 UTC")'
  },
  YearMonth: { value: "%Y-%m", label: 'Year-Month (e.g., "2023-01")' },
  YearMonthDay: {
    value: "%Y-%m-%d",
    label: 'Year-Month-Day (e.g., "2023-01-01")'
  },
  TimeOnly: { value: "%H:%M", label: 'Time Only (e.g., "12:00")' },
  YearOnly: { value: "%Y", label: 'Year Only (e.g., "2023")' }
};
function DTypeContextMenu({ cell: _e, column: Qt }) {
  const [Zt] = useModelState("df_column_types"), [$n, Sn] = reactExports.useState(
    DateFormatOptions.ShortDate.value
  );
  return /* @__PURE__ */ React.createElement(Menu.Item, { icon: /* @__PURE__ */ React.createElement(IconDatabase, null), closeMenuOnClick: !1 }, /* @__PURE__ */ React.createElement(
    Menu,
    {
      shadow: "xl",
      position: "right-start",
      offset: 15,
      withArrow: !0,
      closeDelay: 400
    },
    /* @__PURE__ */ React.createElement(Menu.Target, null, /* @__PURE__ */ React.createElement(Group$1, { position: "apart" }, /* @__PURE__ */ React.createElement("span", null, "Change column '", Qt.id, "' data type"), /* @__PURE__ */ React.createElement(IconPlayerPlayFilled, { size: "1em" }))),
    /* @__PURE__ */ React.createElement(Menu.Dropdown, null, pandasDTypes.map((kn) => /* @__PURE__ */ React.createElement(
      Menu.Item,
      {
        icon: /* @__PURE__ */ React.createElement(IconCheck, { opacity: Zt[Qt.id] === kn ? 1 : 0 }),
        closeMenuOnClick: kn !== "datetime64[ns]",
        key: kn,
        disabled: Zt[Qt.id] === kn,
        onClick: (Kn) => {
          Kn.preventDefault(), Kn.stopPropagation(), kn !== "datetime64[ns]" && Zt[Qt.id] !== kn && window.Persist.Commands.execute(
            PersistCommands.changeColumnDataType,
            {
              cell: _e,
              columnDataTypes: {
                [Qt.id]: {
                  type: kn
                }
              }
            }
          );
        }
      },
      kn !== "datetime64[ns]" ? pandasDTypesLabels[kn] : /* @__PURE__ */ React.createElement(
        Popover,
        {
          shadow: "xl",
          position: "right-start",
          offset: 15,
          withArrow: !0
        },
        /* @__PURE__ */ React.createElement(Popover.Target, null, /* @__PURE__ */ React.createElement(Group$1, { position: "apart" }, /* @__PURE__ */ React.createElement("span", null, pandasDTypesLabels[kn]), /* @__PURE__ */ React.createElement(IconPlayerPlayFilled, { size: "1em" }))),
        /* @__PURE__ */ React.createElement(Popover.Dropdown, null, /* @__PURE__ */ React.createElement(Stack$1, null, /* @__PURE__ */ React.createElement(
          Select,
          {
            miw: "300px",
            value: $n,
            onChange: Sn,
            size: "xs",
            label: "Select a datetime format",
            data: Object.values(DateFormatOptions)
          }
        ), /* @__PURE__ */ React.createElement(
          Button,
          {
            size: "xs",
            variant: "light",
            color: "green",
            disabled: !$n,
            onClick: () => {
              $n && window.Persist.Commands.execute(
                PersistCommands.changeColumnDataType,
                {
                  cell: _e,
                  columnDataTypes: {
                    [Qt.id]: {
                      type: kn,
                      format: $n
                    }
                  }
                }
              );
            }
          },
          "Confirm"
        )))
      )
    )))
  ));
}
function RenameTableColumnPopover({
  cell: _e,
  column: Qt,
  allColumnNames: Zt
}) {
  const [$n, Sn] = reactExports.useState(!1), [kn, Kn] = useValidatedState(
    Qt.id,
    (er) => er.length > 0 && !Zt.includes(er),
    !0
  );
  return /* @__PURE__ */ React.createElement(
    Popover,
    {
      opened: $n,
      position: "right-start",
      trapFocus: !0,
      withArrow: !0,
      withinPortal: !1,
      shadow: "md",
      onClose: () => Sn(!1)
    },
    /* @__PURE__ */ React.createElement(Popover.Target, null, /* @__PURE__ */ React.createElement(
      Menu.Item,
      {
        onClick: (er) => {
          Sn(!0), er.stopPropagation(), er.preventDefault();
        },
        icon: /* @__PURE__ */ React.createElement(IconEdit, null)
      },
      "Rename column '",
      Qt.id,
      "'"
    )),
    /* @__PURE__ */ React.createElement(Popover.Dropdown, null, /* @__PURE__ */ React.createElement(Center$2, { w: 250, mt: "sm", mb: "md" }, /* @__PURE__ */ React.createElement(Stack$1, { spacing: "xs" }, /* @__PURE__ */ React.createElement(
      TextInput,
      {
        w: 250,
        error: !kn.valid,
        placeholder: `Enter new column name for ${Qt.id}`,
        value: kn.value,
        onChange: (er) => Kn(er.target.value)
      }
    ), !kn.valid && kn.value.length > 0 && /* @__PURE__ */ React.createElement(Text, { size: "sm", mt: "md", style: { overflowWrap: "normal" } }, "Column name ", kn.value, " already exists in the dataset."), /* @__PURE__ */ React.createElement(
      Button,
      {
        disabled: !kn.valid || kn.value === Qt.id,
        onClick: () => {
          window.Persist.Commands.execute(PersistCommands.renameColumns, {
            cell: _e,
            renameColumnMap: {
              [Qt.id]: kn.value
            }
          });
        }
      },
      "Rename"
    ))))
  );
}
const MRT_Row_Selection = "mrt-row-select", MRT_Row_Actions = "mrt-row-actions", MRT_Row_Drag = "mrt-row-drag", MRT_Row_Expand = "mrt-row-expand", MRT_Row_Numbers = "mrt-row-numbers", MRT_DisplayColumns = [
  MRT_Row_Selection,
  MRT_Row_Actions,
  MRT_Row_Drag,
  MRT_Row_Expand,
  MRT_Row_Numbers
];
function useSyncedState(_e, Qt = lodashExports.isEqual) {
  const [Zt] = useModelState(_e), [$n, Sn] = reactExports.useState(Zt);
  return reactExports.useEffect(() => {
    Sn((kn) => Qt(kn, Zt) ? kn : Zt);
  }, [Zt]), [$n, Sn];
}
function DatatableComponent({ cell: _e }) {
  const [Qt] = useModelState("data_values"), [Zt] = useModelState(
    "df_columns_non_meta_with_annotations"
  ), [$n] = useModelState("id_column"), [Sn, kn] = useSyncedState(
    "df_row_selection_state"
  ), [Kn, er] = reactExports.useState(!0), [Cr, kr] = useSyncedState("df_sorting_state"), [Yr] = useModelState("df_column_types"), Ms = useColumnDefs(Zt, $n, Qt, [], Yr), Ds = reactExports.useMemo(() => [MRT_Row_Selection, ...Zt], [Zt]), Ls = useMantineReactTable({
    columns: Ms,
    data: Qt,
    enableDensityToggle: !1,
    enableColumnResizing: !0,
    columnResizeMode: "onChange",
    state: {
      rowSelection: Sn,
      columnOrder: Ds,
      sorting: Cr
    },
    initialState: {
      density: "xs",
      columnOrder: Ds,
      columnPinning: {
        left: [MRT_Row_Selection]
      },
      showGlobalFilter: !0
    },
    // Non Trrack
    mantineTableProps: {
      striped: !0
    },
    enablePinning: !0,
    mantinePaginationProps: {
      fz: PERSIST_MANTINE_FONT_SIZE,
      size: "xs"
    },
    displayColumnDefOptions: {
      "mrt-row-select": {
        size: 1
      }
    },
    renderToolbarInternalActions: ({ table: js }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
      MRT_ToggleFiltersButton,
      {
        table: js,
        fz: PERSIST_MANTINE_FONT_SIZE
      }
    ), /* @__PURE__ */ React.createElement(MRT_ShowHideColumnsButton, { table: js }), /* @__PURE__ */ React.createElement(MRT_ToggleFullScreenButton, { table: js })),
    //
    // Filtering table
    filterFns: {
      containsWithNullHandling: (js, zs, Fs) => {
        const Bs = js.getValue(zs);
        return Bs ? Bs.toString().includes(Fs) : !1;
      }
    },
    globalFilterFn: "containsWithNullHandling",
    positionGlobalFilter: "left",
    mantineSearchTextInputProps: {
      size: "xs"
    },
    // enableGlobalFilterModes: true,
    // globalFilterModeOptions: [
    //   'fuzzy',
    //   'equals',
    //   'startsWith',
    //   'contains',
    //   'notEmpty',
    //   'notEquals'
    // ],
    //
    // Selections
    // Seelct all is for page
    enableRowSelection: !0,
    getRowId: (js) => js[$n],
    positionToolbarAlertBanner: "bottom",
    mantineSelectCheckboxProps: {
      size: "xs",
      width: "100%",
      opacity: 1
    },
    onRowSelectionChange: (js) => {
      const zs = typeof js == "function" ? js(Sn) : js, Fs = Object.entries(zs).filter(([Hs, Ws]) => Ws).map(([Hs, Ws]) => Hs), Bs = {};
      Fs.forEach((Hs) => {
        Bs[Hs] = !0;
      }), kn(Bs), window.Persist.Commands.execute(PersistCommands.pointSelection, {
        cell: _e,
        name: $n,
        store: [],
        value: Fs,
        brush_type: "non-vega"
      });
    },
    // Column reordering
    enableColumnDragging: !0,
    enableColumnOrdering: !0,
    onColumnOrderChange: (js) => {
      const Fs = (typeof js == "function" ? js(Zt) : js).filter(
        (Hs) => !MRT_DisplayColumns.includes(Hs)
      );
      let Bs = 0;
      for (; (Zt[Bs] === Fs[Bs] || Zt[Bs] === Fs[Bs + 1]) && Bs < Zt.length; )
        Bs += 1;
      window.Persist.Commands.execute(PersistCommands.reorderColumns, {
        cell: _e,
        columns: Fs,
        overrideLabel: `Moved column '${Zt[Bs]}' moved to position '${Fs.indexOf(
          Zt[Bs]
        )}'`
      });
    },
    // Column Delete
    renderColumnActionsMenuItems: ({ internalColumnMenuItems: js, column: zs }) => /* @__PURE__ */ React.createElement(React.Fragment, null, zs.id !== $n && /* @__PURE__ */ React.createElement(DTypeContextMenu, { column: zs, cell: _e }), zs.id !== $n && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
      Menu.Item,
      {
        icon: /* @__PURE__ */ React.createElement(IconTrash, null),
        onClick: () => {
          zs.id !== $n && window.Persist.Commands.execute(PersistCommands.dropColumns, {
            cell: _e,
            columns: [zs.id]
          });
        }
      },
      "Drop column '",
      zs.id,
      "'"
    )), ![$n].includes(zs.id) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
      RenameTableColumnPopover,
      {
        open: Kn,
        onClose: () => er(!1),
        cell: _e,
        column: zs,
        allColumnNames: Zt
      }
    )), zs.id !== $n && /* @__PURE__ */ React.createElement(Divider, null), js),
    // Edit Cell
    enableEditing: !0,
    editDisplayMode: "cell",
    mantineEditTextInputProps: (js) => ({
      onBlur: (zs) => {
        const Fs = js.cell.column.id;
        if (zs.target.value.length === 0)
          return;
        const Bs = applyDTypeToValue(zs.target.value, Yr[Fs]), Hs = js.cell.row.index, Ws = Qt[Hs];
        if (typeof Bs == "number" && isNaN(Bs) || applyDTypeToValue(Ws[Fs], Yr[Fs]) === Bs)
          return;
        const Ys = Ws[$n];
        window.Persist.Commands.execute(PersistCommands.editCell, {
          cell: _e,
          columnName: Fs,
          idx: Ys,
          value: Bs
        });
      }
    }),
    // Sorting
    manualSorting: !0,
    enableMultiSort: !0,
    maxMultiSortColCount: 3,
    onSortingChange: (js) => {
      const zs = typeof js == "function" ? js(Cr) : js;
      kr(zs), window.Persist.Commands.execute(PersistCommands.sortByColumn, {
        cell: _e,
        sortStatus: zs
      });
    }
    // end
  });
  return /* @__PURE__ */ React.createElement(Box, { p: "1em" }, /* @__PURE__ */ React.createElement(MantineReactTable, { table: Ls }));
}
const HeaderActionIcon = reactExports.forwardRef(
  (_e, Qt) => {
    const { children: Zt, ...$n } = _e;
    return /* @__PURE__ */ React.createElement(
      ActionIcon,
      {
        ref: Qt,
        color: "grey",
        ...$n,
        style: {
          backgroundColor: $n.disabled ? "transparent" : "default"
        },
        variant: "subtle",
        radius: "xs"
      },
      Zt
    );
  }
), _PersistActionIconButton = reactExports.forwardRef((_e, Qt) => {
  const { children: Zt, tooltipProps: $n, ...Sn } = _e, kn = /* @__PURE__ */ React.createElement(ActionIcon, { ref: Qt, size: "xs", ...Sn }, Zt);
  return $n ? /* @__PURE__ */ React.createElement(Tooltip, { ...$n }, kn) : kn;
}), PersistActionIconButton = _PersistActionIconButton;
function CommandButton({
  cell: _e,
  commandId: Qt,
  commandRegistry: Zt,
  commandArgs: $n,
  icon: Sn,
  isDisabled: kn = void 0
}) {
  return !Zt || !Zt.hasCommand(Qt) ? (console.warn(Zt ? `Command ${Qt} not found in registry` : "Command registry not found"), null) : /* @__PURE__ */ React.createElement(UseSignal, { signal: Zt.commandChanged }, () => {
    const Kn = $n ? { ...$n, cell: _e } : { cell: _e }, er = kn === void 0 ? Zt.isEnabled(Qt, Kn) : !kn, Cr = Zt.label(Qt, Kn) || Qt;
    return /* @__PURE__ */ React.createElement(
      HeaderActionIcon,
      {
        variant: er ? "subtle" : "transparent",
        disabled: !er,
        onClick: () => Zt.execute(Qt, Kn)
      },
      /* @__PURE__ */ React.createElement(Tooltip.Floating, { label: Cr, offset: 20 }, Sn)
    );
  });
}
function Annotate({ cell: _e, isDisabled: Qt = !1 }) {
  const [Zt, $n] = useDisclosure(!1), [Sn, kn] = useInputState(""), Kn = {
    cell: _e,
    text: Sn
  }, er = !Qt;
  return /* @__PURE__ */ React.createElement(
    Popover,
    {
      opened: Zt,
      onChange: $n.toggle,
      withinPortal: !0,
      withArrow: !0,
      shadow: "xl"
    },
    /* @__PURE__ */ React.createElement(Popover.Target, null, /* @__PURE__ */ React.createElement(
      HeaderActionIcon,
      {
        onClick: () => $n.toggle(),
        variant: er ? "subtle" : "transparent",
        disabled: !er
      },
      /* @__PURE__ */ React.createElement(Tooltip.Floating, { label: "Annotate", offset: 20 }, /* @__PURE__ */ React.createElement(IconNotes, null))
    )),
    /* @__PURE__ */ React.createElement(Popover.Dropdown, null, /* @__PURE__ */ React.createElement(Stack$1, null, /* @__PURE__ */ React.createElement(Title, { size: "xs", order: 4 }, "Annotate selected items"), /* @__PURE__ */ React.createElement(
      Textarea,
      {
        size: "xs",
        value: Sn,
        onChange: kn,
        placeholder: "Enter your notes here...",
        label: "Your annotations:",
        autosize: !0,
        minRows: 3
      }
    ), /* @__PURE__ */ React.createElement(
      Button,
      {
        size: "xs",
        disabled: !Sn.length,
        onClick: () => {
          window.Persist.Commands.registry.execute(
            PersistCommands.annotate,
            Kn
          ), kn(""), $n.close();
        }
      },
      "Annotate"
    )))
  );
}
function RenameColumnPopover({ cell: _e }) {
  const [Qt, Zt] = useDisclosure(!1), [$n, Sn] = reactExports.useState(null), [kn = []] = useModelState("df_columns_non_meta"), [Kn, er] = useValidatedState(
    "",
    (kr) => !kn.includes(kr),
    !0
  );
  reactExports.useEffect(() => {
    Qt || (Sn(null), er(""));
  }, [Qt]);
  const Cr = kn.map((kr) => ({
    label: kr,
    value: kr
  }));
  return /* @__PURE__ */ React.createElement(
    Popover,
    {
      opened: Qt,
      onChange: Zt.toggle,
      withinPortal: !0,
      withArrow: !0,
      shadow: "xl"
    },
    /* @__PURE__ */ React.createElement(Popover.Target, null, /* @__PURE__ */ React.createElement(
      HeaderActionIcon,
      {
        variant: "subtle",
        onClick: () => Zt.toggle()
      },
      /* @__PURE__ */ React.createElement(Tooltip.Floating, { label: "Rename Column", offset: 20 }, /* @__PURE__ */ React.createElement(IconEdit, null))
    )),
    /* @__PURE__ */ React.createElement(Popover.Dropdown, null, /* @__PURE__ */ React.createElement(Center$2, { mt: "sm", mb: "md" }, /* @__PURE__ */ React.createElement(Stack$1, null, /* @__PURE__ */ React.createElement(Title, { size: "xs", order: 4 }, "Rename Column"), /* @__PURE__ */ React.createElement(
      Select,
      {
        size: "xs",
        data: Cr,
        value: $n,
        onChange: Sn,
        placeholder: "Select a column to rename",
        searchable: !0
      }
    ), /* @__PURE__ */ React.createElement(
      TextInput,
      {
        size: "xs",
        disabled: !$n || !kn.includes($n),
        error: !Kn.valid,
        placeholder: `Enter new column name (no spaces) for ${$n}`,
        value: Kn.value,
        onChange: (kr) => er(kr.currentTarget.value.replace(" ", "_"))
      }
    ), !Kn.valid && Kn.value.length > 0 && /* @__PURE__ */ React.createElement(Text, { size: "sm", mt: "md", style: { overflowWrap: "normal" } }, "Column name ", Kn.value, " already exists in the dataset."), /* @__PURE__ */ React.createElement(
      Button,
      {
        size: "xs",
        disabled: !$n || !Kn.valid || Kn.value.length === 0,
        onClick: async () => {
          if (!$n || !Kn.valid || Kn.value.length === 0)
            return;
          const kr = {
            cell: _e,
            renameColumnMap: {
              [$n]: Kn.value
            }
          };
          window.Persist.Commands.registry.execute(
            PersistCommands.renameColumns,
            kr
          ), Sn(null), er(""), Zt.close();
        }
      },
      "Rename"
    ))))
  );
}
function DropColumnPopover({ cell: _e }) {
  const [Qt, Zt] = useDisclosure(!1), [$n, Sn] = reactExports.useState([]), [kn = []] = useModelState("df_columns_non_meta");
  return /* @__PURE__ */ React.createElement(
    Popover,
    {
      opened: Qt,
      onChange: Zt.toggle,
      withinPortal: !0,
      withArrow: !0,
      shadow: "xl"
    },
    /* @__PURE__ */ React.createElement(Popover.Target, null, /* @__PURE__ */ React.createElement(
      HeaderActionIcon,
      {
        variant: "subtle",
        onClick: () => Zt.toggle()
      },
      /* @__PURE__ */ React.createElement(Tooltip.Floating, { label: "Drop Column", offset: 20 }, /* @__PURE__ */ React.createElement(IconColumnRemove, null))
    )),
    /* @__PURE__ */ React.createElement(Popover.Dropdown, null, /* @__PURE__ */ React.createElement(Center$2, { w: 300, mt: "sm", mb: "md" }, /* @__PURE__ */ React.createElement(Stack$1, null, /* @__PURE__ */ React.createElement(Title, { size: "xs", order: 4 }, "Drop Columns"), /* @__PURE__ */ React.createElement(
      Checkbox.Group,
      {
        value: $n,
        onChange: Sn
      },
      /* @__PURE__ */ React.createElement(Group$1, { mt: "xs" }, kn.map((Kn) => /* @__PURE__ */ React.createElement(Checkbox, { size: "xs", key: Kn, value: Kn, label: Kn })))
    ), /* @__PURE__ */ React.createElement(
      Button,
      {
        size: "xs",
        disabled: $n.length === 0,
        onClick: async () => {
          const Kn = {
            cell: _e,
            columns: $n
          };
          window.Persist.Commands.execute(
            PersistCommands.dropColumns,
            Kn
          ), Sn([]), Zt.close();
        }
      },
      "Drop selected"
    ))))
  );
}
var shim = { exports: {} }, useSyncExternalStoreShim_production_min = {};
/**
 * @license React
 * use-sync-external-store-shim.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var e$1 = reactExports;
function h$1(_e, Qt) {
  return _e === Qt && (_e !== 0 || 1 / _e === 1 / Qt) || _e !== _e && Qt !== Qt;
}
var k = typeof Object.is == "function" ? Object.is : h$1, l = e$1.useState, m = e$1.useEffect, n$1 = e$1.useLayoutEffect, p$1 = e$1.useDebugValue;
function q$1(_e, Qt) {
  var Zt = Qt(), $n = l({ inst: { value: Zt, getSnapshot: Qt } }), Sn = $n[0].inst, kn = $n[1];
  return n$1(function() {
    Sn.value = Zt, Sn.getSnapshot = Qt, r$1(Sn) && kn({ inst: Sn });
  }, [_e, Zt, Qt]), m(function() {
    return r$1(Sn) && kn({ inst: Sn }), _e(function() {
      r$1(Sn) && kn({ inst: Sn });
    });
  }, [_e]), p$1(Zt), Zt;
}
function r$1(_e) {
  var Qt = _e.getSnapshot;
  _e = _e.value;
  try {
    var Zt = Qt();
    return !k(_e, Zt);
  } catch {
    return !0;
  }
}
function t$2(_e, Qt) {
  return Qt();
}
var u$1 = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? t$2 : q$1;
useSyncExternalStoreShim_production_min.useSyncExternalStore = e$1.useSyncExternalStore !== void 0 ? e$1.useSyncExternalStore : u$1;
shim.exports = useSyncExternalStoreShim_production_min;
var shimExports = shim.exports, withSelector_production_min = {};
/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var h = reactExports, n = shimExports;
function p(_e, Qt) {
  return _e === Qt && (_e !== 0 || 1 / _e === 1 / Qt) || _e !== _e && Qt !== Qt;
}
var q = typeof Object.is == "function" ? Object.is : p, r = n.useSyncExternalStore, t$1 = h.useRef, u = h.useEffect, v = h.useMemo, w$1 = h.useDebugValue;
withSelector_production_min.useSyncExternalStoreWithSelector = function(_e, Qt, Zt, $n, Sn) {
  var kn = t$1(null);
  if (kn.current === null) {
    var Kn = { hasValue: !1, value: null };
    kn.current = Kn;
  } else
    Kn = kn.current;
  kn = v(function() {
    function Cr(Ls) {
      if (!kr) {
        if (kr = !0, Yr = Ls, Ls = $n(Ls), Sn !== void 0 && Kn.hasValue) {
          var js = Kn.value;
          if (Sn(js, Ls))
            return Ms = js;
        }
        return Ms = Ls;
      }
      if (js = Ms, q(Yr, Ls))
        return js;
      var zs = $n(Ls);
      return Sn !== void 0 && Sn(js, zs) ? js : (Yr = Ls, Ms = zs);
    }
    var kr = !1, Yr, Ms, Ds = Zt === void 0 ? null : Zt;
    return [function() {
      return Cr(Qt());
    }, Ds === null ? void 0 : function() {
      return Cr(Ds());
    }];
  }, [Qt, Zt, $n, Sn]);
  var er = r(_e, kn[0], kn[1]);
  return u(function() {
    Kn.hasValue = !0, Kn.value = er;
  }, [er]), w$1(er), er;
};
function defaultNoopBatch(_e) {
  _e();
}
let batch = defaultNoopBatch;
const setBatch = (_e) => batch = _e, getBatch = () => batch, ContextKey = Symbol.for("react-redux-context"), gT = typeof globalThis < "u" ? globalThis : (
  /* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
  {}
);
function getContext() {
  var _e;
  if (!reactExports.createContext)
    return {};
  const Qt = (_e = gT[ContextKey]) != null ? _e : gT[ContextKey] = /* @__PURE__ */ new Map();
  let Zt = Qt.get(reactExports.createContext);
  return Zt || (Zt = reactExports.createContext(null), Qt.set(reactExports.createContext, Zt)), Zt;
}
const ReactReduxContext = /* @__PURE__ */ getContext(), notInitialized = () => {
  throw new Error("uSES not initialized!");
};
function _extends$3() {
  return _extends$3 = Object.assign ? Object.assign.bind() : function(_e) {
    for (var Qt = 1; Qt < arguments.length; Qt++) {
      var Zt = arguments[Qt];
      for (var $n in Zt)
        Object.prototype.hasOwnProperty.call(Zt, $n) && (_e[$n] = Zt[$n]);
    }
    return _e;
  }, _extends$3.apply(this, arguments);
}
function _objectWithoutPropertiesLoose$1(_e, Qt) {
  if (_e == null)
    return {};
  var Zt = {}, $n = Object.keys(_e), Sn, kn;
  for (kn = 0; kn < $n.length; kn++)
    Sn = $n[kn], !(Qt.indexOf(Sn) >= 0) && (Zt[Sn] = _e[Sn]);
  return Zt;
}
const _excluded$2 = ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"];
function pureFinalPropsSelectorFactory(_e, Qt, Zt, $n, {
  areStatesEqual: Sn,
  areOwnPropsEqual: kn,
  areStatePropsEqual: Kn
}) {
  let er = !1, Cr, kr, Yr, Ms, Ds;
  function Ls(Hs, Ws) {
    return Cr = Hs, kr = Ws, Yr = _e(Cr, kr), Ms = Qt($n, kr), Ds = Zt(Yr, Ms, kr), er = !0, Ds;
  }
  function js() {
    return Yr = _e(Cr, kr), Qt.dependsOnOwnProps && (Ms = Qt($n, kr)), Ds = Zt(Yr, Ms, kr), Ds;
  }
  function zs() {
    return _e.dependsOnOwnProps && (Yr = _e(Cr, kr)), Qt.dependsOnOwnProps && (Ms = Qt($n, kr)), Ds = Zt(Yr, Ms, kr), Ds;
  }
  function Fs() {
    const Hs = _e(Cr, kr), Ws = !Kn(Hs, Yr);
    return Yr = Hs, Ws && (Ds = Zt(Yr, Ms, kr)), Ds;
  }
  function Bs(Hs, Ws) {
    const Ys = !kn(Ws, kr), El = !Sn(Hs, Cr, Ws, kr);
    return Cr = Hs, kr = Ws, Ys && El ? js() : Ys ? zs() : El ? Fs() : Ds;
  }
  return function(Ws, Ys) {
    return er ? Bs(Ws, Ys) : Ls(Ws, Ys);
  };
}
function finalPropsSelectorFactory(_e, Qt) {
  let {
    initMapStateToProps: Zt,
    initMapDispatchToProps: $n,
    initMergeProps: Sn
  } = Qt, kn = _objectWithoutPropertiesLoose$1(Qt, _excluded$2);
  const Kn = Zt(_e, kn), er = $n(_e, kn), Cr = Sn(_e, kn);
  return pureFinalPropsSelectorFactory(Kn, er, Cr, _e, kn);
}
function bindActionCreators(_e, Qt) {
  const Zt = {};
  for (const $n in _e) {
    const Sn = _e[$n];
    typeof Sn == "function" && (Zt[$n] = (...kn) => Qt(Sn(...kn)));
  }
  return Zt;
}
function wrapMapToPropsConstant(_e) {
  return function(Zt) {
    const $n = _e(Zt);
    function Sn() {
      return $n;
    }
    return Sn.dependsOnOwnProps = !1, Sn;
  };
}
function getDependsOnOwnProps(_e) {
  return _e.dependsOnOwnProps ? !!_e.dependsOnOwnProps : _e.length !== 1;
}
function wrapMapToPropsFunc(_e, Qt) {
  return function($n, {
    displayName: Sn
  }) {
    const kn = function(er, Cr) {
      return kn.dependsOnOwnProps ? kn.mapToProps(er, Cr) : kn.mapToProps(er, void 0);
    };
    return kn.dependsOnOwnProps = !0, kn.mapToProps = function(er, Cr) {
      kn.mapToProps = _e, kn.dependsOnOwnProps = getDependsOnOwnProps(_e);
      let kr = kn(er, Cr);
      return typeof kr == "function" && (kn.mapToProps = kr, kn.dependsOnOwnProps = getDependsOnOwnProps(kr), kr = kn(er, Cr)), kr;
    }, kn;
  };
}
function createInvalidArgFactory(_e, Qt) {
  return (Zt, $n) => {
    throw new Error(`Invalid value of type ${typeof _e} for ${Qt} argument when connecting component ${$n.wrappedComponentName}.`);
  };
}
function mapDispatchToPropsFactory(_e) {
  return _e && typeof _e == "object" ? wrapMapToPropsConstant((Qt) => (
    // @ts-ignore
    bindActionCreators(_e, Qt)
  )) : _e ? typeof _e == "function" ? (
    // @ts-ignore
    wrapMapToPropsFunc(_e)
  ) : createInvalidArgFactory(_e, "mapDispatchToProps") : wrapMapToPropsConstant((Qt) => ({
    dispatch: Qt
  }));
}
function mapStateToPropsFactory(_e) {
  return _e ? typeof _e == "function" ? (
    // @ts-ignore
    wrapMapToPropsFunc(_e)
  ) : createInvalidArgFactory(_e, "mapStateToProps") : wrapMapToPropsConstant(() => ({}));
}
function defaultMergeProps(_e, Qt, Zt) {
  return _extends$3({}, Zt, _e, Qt);
}
function wrapMergePropsFunc(_e) {
  return function(Zt, {
    displayName: $n,
    areMergedPropsEqual: Sn
  }) {
    let kn = !1, Kn;
    return function(Cr, kr, Yr) {
      const Ms = _e(Cr, kr, Yr);
      return kn ? Sn(Ms, Kn) || (Kn = Ms) : (kn = !0, Kn = Ms), Kn;
    };
  };
}
function mergePropsFactory(_e) {
  return _e ? typeof _e == "function" ? wrapMergePropsFunc(_e) : createInvalidArgFactory(_e, "mergeProps") : () => defaultMergeProps;
}
function createListenerCollection() {
  const _e = getBatch();
  let Qt = null, Zt = null;
  return {
    clear() {
      Qt = null, Zt = null;
    },
    notify() {
      _e(() => {
        let $n = Qt;
        for (; $n; )
          $n.callback(), $n = $n.next;
      });
    },
    get() {
      let $n = [], Sn = Qt;
      for (; Sn; )
        $n.push(Sn), Sn = Sn.next;
      return $n;
    },
    subscribe($n) {
      let Sn = !0, kn = Zt = {
        callback: $n,
        next: null,
        prev: Zt
      };
      return kn.prev ? kn.prev.next = kn : Qt = kn, function() {
        !Sn || Qt === null || (Sn = !1, kn.next ? kn.next.prev = kn.prev : Zt = kn.prev, kn.prev ? kn.prev.next = kn.next : Qt = kn.next);
      };
    }
  };
}
const nullListeners = {
  notify() {
  },
  get: () => []
};
function createSubscription(_e, Qt) {
  let Zt, $n = nullListeners, Sn = 0, kn = !1;
  function Kn(zs) {
    Yr();
    const Fs = $n.subscribe(zs);
    let Bs = !1;
    return () => {
      Bs || (Bs = !0, Fs(), Ms());
    };
  }
  function er() {
    $n.notify();
  }
  function Cr() {
    js.onStateChange && js.onStateChange();
  }
  function kr() {
    return kn;
  }
  function Yr() {
    Sn++, Zt || (Zt = Qt ? Qt.addNestedSub(Cr) : _e.subscribe(Cr), $n = createListenerCollection());
  }
  function Ms() {
    Sn--, Zt && Sn === 0 && (Zt(), Zt = void 0, $n.clear(), $n = nullListeners);
  }
  function Ds() {
    kn || (kn = !0, Yr());
  }
  function Ls() {
    kn && (kn = !1, Ms());
  }
  const js = {
    addNestedSub: Kn,
    notifyNestedSubs: er,
    handleChangeWrapper: Cr,
    isSubscribed: kr,
    trySubscribe: Ds,
    tryUnsubscribe: Ls,
    getListeners: () => $n
  };
  return js;
}
const canUseDOM = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", useIsomorphicLayoutEffect$1 = canUseDOM ? reactExports.useLayoutEffect : reactExports.useEffect;
function is$1(_e, Qt) {
  return _e === Qt ? _e !== 0 || Qt !== 0 || 1 / _e === 1 / Qt : _e !== _e && Qt !== Qt;
}
function shallowEqual$1(_e, Qt) {
  if (is$1(_e, Qt))
    return !0;
  if (typeof _e != "object" || _e === null || typeof Qt != "object" || Qt === null)
    return !1;
  const Zt = Object.keys(_e), $n = Object.keys(Qt);
  if (Zt.length !== $n.length)
    return !1;
  for (let Sn = 0; Sn < Zt.length; Sn++)
    if (!Object.prototype.hasOwnProperty.call(Qt, Zt[Sn]) || !is$1(_e[Zt[Sn]], Qt[Zt[Sn]]))
      return !1;
  return !0;
}
const _excluded$1 = ["reactReduxForwardedRef"];
let useSyncExternalStore = notInitialized;
const initializeConnect = (_e) => {
  useSyncExternalStore = _e;
}, NO_SUBSCRIPTION_ARRAY = [null, null];
function useIsomorphicLayoutEffectWithArgs(_e, Qt, Zt) {
  useIsomorphicLayoutEffect$1(() => _e(...Qt), Zt);
}
function captureWrapperProps(_e, Qt, Zt, $n, Sn, kn) {
  _e.current = $n, Zt.current = !1, Sn.current && (Sn.current = null, kn());
}
function subscribeUpdates(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr, kr, Yr) {
  if (!_e)
    return () => {
    };
  let Ms = !1, Ds = null;
  const Ls = () => {
    if (Ms || !er.current)
      return;
    const zs = Qt.getState();
    let Fs, Bs;
    try {
      Fs = $n(zs, Sn.current);
    } catch (Hs) {
      Bs = Hs, Ds = Hs;
    }
    Bs || (Ds = null), Fs === kn.current ? Kn.current || kr() : (kn.current = Fs, Cr.current = Fs, Kn.current = !0, Yr());
  };
  return Zt.onStateChange = Ls, Zt.trySubscribe(), Ls(), () => {
    if (Ms = !0, Zt.tryUnsubscribe(), Zt.onStateChange = null, Ds)
      throw Ds;
  };
}
function strictEqual(_e, Qt) {
  return _e === Qt;
}
function connect(_e, Qt, Zt, {
  // The `pure` option has been removed, so TS doesn't like us destructuring this to check its existence.
  // @ts-ignore
  pure: $n,
  areStatesEqual: Sn = strictEqual,
  areOwnPropsEqual: kn = shallowEqual$1,
  areStatePropsEqual: Kn = shallowEqual$1,
  areMergedPropsEqual: er = shallowEqual$1,
  // use React's forwardRef to expose a ref of the wrapped component
  forwardRef: Cr = !1,
  // the context consumer to use
  context: kr = ReactReduxContext
} = {}) {
  const Yr = kr, Ms = mapStateToPropsFactory(_e), Ds = mapDispatchToPropsFactory(Qt), Ls = mergePropsFactory(Zt), js = !!_e;
  return (Fs) => {
    const Bs = Fs.displayName || Fs.name || "Component", Hs = `Connect(${Bs})`, Ws = {
      shouldHandleStateChanges: js,
      displayName: Hs,
      wrappedComponentName: Bs,
      WrappedComponent: Fs,
      // @ts-ignore
      initMapStateToProps: Ms,
      // @ts-ignore
      initMapDispatchToProps: Ds,
      initMergeProps: Ls,
      areStatesEqual: Sn,
      areStatePropsEqual: Kn,
      areOwnPropsEqual: kn,
      areMergedPropsEqual: er
    };
    function Ys(Pl) {
      const [Iu, Tu, Au] = reactExports.useMemo(() => {
        const {
          reactReduxForwardedRef: Pm
        } = Pl, i$ = _objectWithoutPropertiesLoose$1(Pl, _excluded$1);
        return [Pl.context, Pm, i$];
      }, [Pl]), Nu = reactExports.useMemo(() => Iu && Iu.Consumer && // @ts-ignore
      reactIsExports$1.isContextConsumer(/* @__PURE__ */ reactExports.createElement(Iu.Consumer, null)) ? Iu : Yr, [Iu, Yr]), gm = reactExports.useContext(Nu), pm = !!Pl.store && !!Pl.store.getState && !!Pl.store.dispatch, zu = !!gm && !!gm.store, Yu = pm ? Pl.store : gm.store, sm = zu ? gm.getServerState : Yu.getState, mm = reactExports.useMemo(() => finalPropsSelectorFactory(Yu.dispatch, Ws), [Yu]), [hm, ym] = reactExports.useMemo(() => {
        if (!js)
          return NO_SUBSCRIPTION_ARRAY;
        const Pm = createSubscription(Yu, pm ? void 0 : gm.subscription), i$ = Pm.notifyNestedSubs.bind(Pm);
        return [Pm, i$];
      }, [Yu, pm, gm]), _m = reactExports.useMemo(() => pm ? gm : _extends$3({}, gm, {
        subscription: hm
      }), [pm, gm, hm]), Sm = reactExports.useRef(), wm = reactExports.useRef(Au), Nm = reactExports.useRef(), Cm = reactExports.useRef(!1);
      reactExports.useRef(!1);
      const Im = reactExports.useRef(!1), Am = reactExports.useRef();
      useIsomorphicLayoutEffect$1(() => (Im.current = !0, () => {
        Im.current = !1;
      }), []);
      const Vm = reactExports.useMemo(() => () => Nm.current && Au === wm.current ? Nm.current : mm(Yu.getState(), Au), [Yu, Au]), Rm = reactExports.useMemo(() => (i$) => hm ? subscribeUpdates(
        js,
        Yu,
        hm,
        // @ts-ignore
        mm,
        wm,
        Sm,
        Cm,
        Im,
        Nm,
        ym,
        i$
      ) : () => {
      }, [hm]);
      useIsomorphicLayoutEffectWithArgs(captureWrapperProps, [wm, Sm, Cm, Au, Nm, ym]);
      let Dm;
      try {
        Dm = useSyncExternalStore(
          // TODO We're passing through a big wrapper that does a bunch of extra side effects besides subscribing
          Rm,
          // TODO This is incredibly hacky. We've already processed the store update and calculated new child props,
          // TODO and we're just passing that through so it triggers a re-render for us rather than relying on `uSES`.
          Vm,
          sm ? () => mm(sm(), Au) : Vm
        );
      } catch (Pm) {
        throw Am.current && (Pm.message += `
The error may be correlated with this previous error:
${Am.current.stack}

`), Pm;
      }
      useIsomorphicLayoutEffect$1(() => {
        Am.current = void 0, Nm.current = void 0, Sm.current = Dm;
      });
      const km = reactExports.useMemo(() => (
        // @ts-ignore
        /* @__PURE__ */ reactExports.createElement(Fs, _extends$3({}, Dm, {
          ref: Tu
        }))
      ), [Tu, Fs, Dm]);
      return reactExports.useMemo(() => js ? /* @__PURE__ */ reactExports.createElement(Nu.Provider, {
        value: _m
      }, km) : km, [Nu, km, _m]);
    }
    const Mu = reactExports.memo(Ys);
    if (Mu.WrappedComponent = Fs, Mu.displayName = Ys.displayName = Hs, Cr) {
      const Iu = reactExports.forwardRef(function(Au, Nu) {
        return /* @__PURE__ */ reactExports.createElement(Mu, _extends$3({}, Au, {
          reactReduxForwardedRef: Nu
        }));
      });
      return Iu.displayName = Hs, Iu.WrappedComponent = Fs, hoistStatics(Iu, Fs);
    }
    return hoistStatics(Mu, Fs);
  };
}
function Provider({
  store: _e,
  context: Qt,
  children: Zt,
  serverState: $n,
  stabilityCheck: Sn = "once",
  noopCheck: kn = "once"
}) {
  const Kn = reactExports.useMemo(() => {
    const kr = createSubscription(_e);
    return {
      store: _e,
      subscription: kr,
      getServerState: $n ? () => $n : void 0,
      stabilityCheck: Sn,
      noopCheck: kn
    };
  }, [_e, $n, Sn, kn]), er = reactExports.useMemo(() => _e.getState(), [_e]);
  useIsomorphicLayoutEffect$1(() => {
    const {
      subscription: kr
    } = Kn;
    return kr.onStateChange = kr.notifyNestedSubs, kr.trySubscribe(), er !== _e.getState() && kr.notifyNestedSubs(), () => {
      kr.tryUnsubscribe(), kr.onStateChange = void 0;
    };
  }, [Kn, er]);
  const Cr = Qt || ReactReduxContext;
  return /* @__PURE__ */ reactExports.createElement(Cr.Provider, {
    value: Kn
  }, Zt);
}
initializeConnect(shimExports.useSyncExternalStore);
setBatch(reactDomExports.unstable_batchedUpdates);
function areInputsEqual$1(_e, Qt) {
  if (_e.length !== Qt.length)
    return !1;
  for (var Zt = 0; Zt < _e.length; Zt++)
    if (_e[Zt] !== Qt[Zt])
      return !1;
  return !0;
}
function useMemoOne(_e, Qt) {
  var Zt = reactExports.useState(function() {
    return {
      inputs: Qt,
      result: _e()
    };
  })[0], $n = reactExports.useRef(!0), Sn = reactExports.useRef(Zt), kn = $n.current || !!(Qt && Sn.current.inputs && areInputsEqual$1(Qt, Sn.current.inputs)), Kn = kn ? Sn.current : {
    inputs: Qt,
    result: _e()
  };
  return reactExports.useEffect(function() {
    $n.current = !1, Sn.current = Kn;
  }, [Kn]), Kn.result;
}
function useCallbackOne(_e, Qt) {
  return useMemoOne(function() {
    return _e;
  }, Qt);
}
var useMemo = useMemoOne, useCallback = useCallbackOne, isProduction = !0, prefix$2 = "Invariant failed";
function invariant$1(_e, Qt) {
  if (!_e) {
    if (isProduction)
      throw new Error(prefix$2);
    var Zt = typeof Qt == "function" ? Qt() : Qt, $n = Zt ? "".concat(prefix$2, ": ").concat(Zt) : prefix$2;
    throw new Error($n);
  }
}
var getRect = function _e(Qt) {
  var Zt = Qt.top, $n = Qt.right, Sn = Qt.bottom, kn = Qt.left, Kn = $n - kn, er = Sn - Zt, Cr = {
    top: Zt,
    right: $n,
    bottom: Sn,
    left: kn,
    width: Kn,
    height: er,
    x: kn,
    y: Zt,
    center: {
      x: ($n + kn) / 2,
      y: (Sn + Zt) / 2
    }
  };
  return Cr;
}, expand = function _e(Qt, Zt) {
  return {
    top: Qt.top - Zt.top,
    left: Qt.left - Zt.left,
    bottom: Qt.bottom + Zt.bottom,
    right: Qt.right + Zt.right
  };
}, shrink = function _e(Qt, Zt) {
  return {
    top: Qt.top + Zt.top,
    left: Qt.left + Zt.left,
    bottom: Qt.bottom - Zt.bottom,
    right: Qt.right - Zt.right
  };
}, shift = function _e(Qt, Zt) {
  return {
    top: Qt.top + Zt.y,
    left: Qt.left + Zt.x,
    bottom: Qt.bottom + Zt.y,
    right: Qt.right + Zt.x
  };
}, noSpacing$1 = {
  top: 0,
  right: 0,
  bottom: 0,
  left: 0
}, createBox = function _e(Qt) {
  var Zt = Qt.borderBox, $n = Qt.margin, Sn = $n === void 0 ? noSpacing$1 : $n, kn = Qt.border, Kn = kn === void 0 ? noSpacing$1 : kn, er = Qt.padding, Cr = er === void 0 ? noSpacing$1 : er, kr = getRect(expand(Zt, Sn)), Yr = getRect(shrink(Zt, Kn)), Ms = getRect(shrink(Yr, Cr));
  return {
    marginBox: kr,
    borderBox: getRect(Zt),
    paddingBox: Yr,
    contentBox: Ms,
    margin: Sn,
    border: Kn,
    padding: Cr
  };
}, parse = function _e(Qt) {
  var Zt = Qt.slice(0, -2), $n = Qt.slice(-2);
  if ($n !== "px")
    return 0;
  var Sn = Number(Zt);
  return isNaN(Sn) && invariant$1(!1), Sn;
}, getWindowScroll$1 = function _e() {
  return {
    x: window.pageXOffset,
    y: window.pageYOffset
  };
}, offset = function _e(Qt, Zt) {
  var $n = Qt.borderBox, Sn = Qt.border, kn = Qt.margin, Kn = Qt.padding, er = shift($n, Zt);
  return createBox({
    borderBox: er,
    border: Sn,
    margin: kn,
    padding: Kn
  });
}, withScroll = function _e(Qt, Zt) {
  return Zt === void 0 && (Zt = getWindowScroll$1()), offset(Qt, Zt);
}, calculateBox = function _e(Qt, Zt) {
  var $n = {
    top: parse(Zt.marginTop),
    right: parse(Zt.marginRight),
    bottom: parse(Zt.marginBottom),
    left: parse(Zt.marginLeft)
  }, Sn = {
    top: parse(Zt.paddingTop),
    right: parse(Zt.paddingRight),
    bottom: parse(Zt.paddingBottom),
    left: parse(Zt.paddingLeft)
  }, kn = {
    top: parse(Zt.borderTopWidth),
    right: parse(Zt.borderRightWidth),
    bottom: parse(Zt.borderBottomWidth),
    left: parse(Zt.borderLeftWidth)
  };
  return createBox({
    borderBox: Qt,
    margin: $n,
    padding: Sn,
    border: kn
  });
}, getBox = function _e(Qt) {
  var Zt = Qt.getBoundingClientRect(), $n = window.getComputedStyle(Qt);
  return calculateBox(Zt, $n);
}, safeIsNaN = Number.isNaN || function _e(Qt) {
  return typeof Qt == "number" && Qt !== Qt;
};
function isEqual$2(_e, Qt) {
  return !!(_e === Qt || safeIsNaN(_e) && safeIsNaN(Qt));
}
function areInputsEqual(_e, Qt) {
  if (_e.length !== Qt.length)
    return !1;
  for (var Zt = 0; Zt < _e.length; Zt++)
    if (!isEqual$2(_e[Zt], Qt[Zt]))
      return !1;
  return !0;
}
function memoizeOne(_e, Qt) {
  Qt === void 0 && (Qt = areInputsEqual);
  var Zt = null;
  function $n() {
    for (var Sn = [], kn = 0; kn < arguments.length; kn++)
      Sn[kn] = arguments[kn];
    if (Zt && Zt.lastThis === this && Qt(Sn, Zt.lastArgs))
      return Zt.lastResult;
    var Kn = _e.apply(this, Sn);
    return Zt = {
      lastResult: Kn,
      lastArgs: Sn,
      lastThis: this
    }, Kn;
  }
  return $n.clear = function() {
    Zt = null;
  }, $n;
}
var rafSchd = function _e(Qt) {
  var Zt = [], $n = null, Sn = function() {
    for (var Kn = arguments.length, er = new Array(Kn), Cr = 0; Cr < Kn; Cr++)
      er[Cr] = arguments[Cr];
    Zt = er, !$n && ($n = requestAnimationFrame(function() {
      $n = null, Qt.apply(void 0, Zt);
    }));
  };
  return Sn.cancel = function() {
    $n && (cancelAnimationFrame($n), $n = null);
  }, Sn;
};
const rafSchd$1 = rafSchd;
function _extends$2() {
  return _extends$2 = Object.assign ? Object.assign.bind() : function(_e) {
    for (var Qt = 1; Qt < arguments.length; Qt++) {
      var Zt = arguments[Qt];
      for (var $n in Zt)
        Object.prototype.hasOwnProperty.call(Zt, $n) && (_e[$n] = Zt[$n]);
    }
    return _e;
  }, _extends$2.apply(this, arguments);
}
function log(_e, Qt) {
}
log.bind(null, "warn");
log.bind(null, "error");
function noop$2() {
}
function getOptions(_e, Qt) {
  return {
    ..._e,
    ...Qt
  };
}
function bindEvents(_e, Qt, Zt) {
  const $n = Qt.map((Sn) => {
    const kn = getOptions(Zt, Sn.options);
    return _e.addEventListener(Sn.eventName, Sn.fn, kn), function() {
      _e.removeEventListener(Sn.eventName, Sn.fn, kn);
    };
  });
  return function() {
    $n.forEach((kn) => {
      kn();
    });
  };
}
const prefix$1 = "Invariant failed";
class RbdInvariant extends Error {
}
RbdInvariant.prototype.toString = function _e() {
  return this.message;
};
function invariant(_e, Qt) {
  if (!_e)
    throw new RbdInvariant(prefix$1);
}
class ErrorBoundary extends React.Component {
  constructor() {
    super(...arguments), this.callbacks = null, this.unbind = noop$2, this.onWindowError = (Qt) => {
      const Zt = this.getCallbacks();
      Zt.isDragging() && Zt.tryAbort(), Qt.error instanceof RbdInvariant && Qt.preventDefault();
    }, this.getCallbacks = () => {
      if (!this.callbacks)
        throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");
      return this.callbacks;
    }, this.setCallbacks = (Qt) => {
      this.callbacks = Qt;
    };
  }
  componentDidMount() {
    this.unbind = bindEvents(window, [{
      eventName: "error",
      fn: this.onWindowError
    }]);
  }
  componentDidCatch(Qt) {
    if (Qt instanceof RbdInvariant) {
      this.setState({});
      return;
    }
    throw Qt;
  }
  componentWillUnmount() {
    this.unbind();
  }
  render() {
    return this.props.children(this.setCallbacks);
  }
}
const dragHandleUsageInstructions = `
  Press space bar to start a drag.
  When dragging you can use the arrow keys to move the item around and escape to cancel.
  Some screen readers may require you to be in focus mode or to use your pass through key
`, position = (_e) => _e + 1, onDragStart = (_e) => `
  You have lifted an item in position ${position(_e.source.index)}
`, withLocation = (_e, Qt) => {
  const Zt = _e.droppableId === Qt.droppableId, $n = position(_e.index), Sn = position(Qt.index);
  return Zt ? `
      You have moved the item from position ${$n}
      to position ${Sn}
    ` : `
    You have moved the item from position ${$n}
    in list ${_e.droppableId}
    to list ${Qt.droppableId}
    in position ${Sn}
  `;
}, withCombine = (_e, Qt, Zt) => Qt.droppableId === Zt.droppableId ? `
      The item ${_e}
      has been combined with ${Zt.draggableId}` : `
      The item ${_e}
      in list ${Qt.droppableId}
      has been combined with ${Zt.draggableId}
      in list ${Zt.droppableId}
    `, onDragUpdate = (_e) => {
  const Qt = _e.destination;
  if (Qt)
    return withLocation(_e.source, Qt);
  const Zt = _e.combine;
  return Zt ? withCombine(_e.draggableId, _e.source, Zt) : "You are over an area that cannot be dropped on";
}, returnedToStart = (_e) => `
  The item has returned to its starting position
  of ${position(_e.index)}
`, onDragEnd = (_e) => {
  if (_e.reason === "CANCEL")
    return `
      Movement cancelled.
      ${returnedToStart(_e.source)}
    `;
  const Qt = _e.destination, Zt = _e.combine;
  return Qt ? `
      You have dropped the item.
      ${withLocation(_e.source, Qt)}
    ` : Zt ? `
      You have dropped the item.
      ${withCombine(_e.draggableId, _e.source, Zt)}
    ` : `
    The item has been dropped while not over a drop area.
    ${returnedToStart(_e.source)}
  `;
}, preset = {
  dragHandleUsageInstructions,
  onDragStart,
  onDragUpdate,
  onDragEnd
};
var preset$1 = preset;
const origin = {
  x: 0,
  y: 0
}, add = (_e, Qt) => ({
  x: _e.x + Qt.x,
  y: _e.y + Qt.y
}), subtract = (_e, Qt) => ({
  x: _e.x - Qt.x,
  y: _e.y - Qt.y
}), isEqual$1 = (_e, Qt) => _e.x === Qt.x && _e.y === Qt.y, negate = (_e) => ({
  x: _e.x !== 0 ? -_e.x : 0,
  y: _e.y !== 0 ? -_e.y : 0
}), patch = function(_e, Qt, Zt) {
  return Zt === void 0 && (Zt = 0), _e === "x" ? {
    x: Qt,
    y: Zt
  } : {
    x: Zt,
    y: Qt
  };
}, distance = (_e, Qt) => Math.sqrt((Qt.x - _e.x) ** 2 + (Qt.y - _e.y) ** 2), closest$1 = (_e, Qt) => Math.min(...Qt.map((Zt) => distance(_e, Zt))), apply$1 = (_e) => (Qt) => ({
  x: _e(Qt.x),
  y: _e(Qt.y)
});
var executeClip = (_e, Qt) => {
  const Zt = getRect({
    top: Math.max(Qt.top, _e.top),
    right: Math.min(Qt.right, _e.right),
    bottom: Math.min(Qt.bottom, _e.bottom),
    left: Math.max(Qt.left, _e.left)
  });
  return Zt.width <= 0 || Zt.height <= 0 ? null : Zt;
};
const offsetByPosition = (_e, Qt) => ({
  top: _e.top + Qt.y,
  left: _e.left + Qt.x,
  bottom: _e.bottom + Qt.y,
  right: _e.right + Qt.x
}), getCorners = (_e) => [{
  x: _e.left,
  y: _e.top
}, {
  x: _e.right,
  y: _e.top
}, {
  x: _e.left,
  y: _e.bottom
}, {
  x: _e.right,
  y: _e.bottom
}], noSpacing = {
  top: 0,
  right: 0,
  bottom: 0,
  left: 0
}, scroll$1 = (_e, Qt) => Qt ? offsetByPosition(_e, Qt.scroll.diff.displacement) : _e, increase = (_e, Qt, Zt) => Zt && Zt.increasedBy ? {
  ..._e,
  [Qt.end]: _e[Qt.end] + Zt.increasedBy[Qt.line]
} : _e, clip = (_e, Qt) => Qt && Qt.shouldClipSubject ? executeClip(Qt.pageMarginBox, _e) : getRect(_e);
var getSubject = (_e) => {
  let {
    page: Qt,
    withPlaceholder: Zt,
    axis: $n,
    frame: Sn
  } = _e;
  const kn = scroll$1(Qt.marginBox, Sn), Kn = increase(kn, $n, Zt), er = clip(Kn, Sn);
  return {
    page: Qt,
    withPlaceholder: Zt,
    active: er
  };
}, scrollDroppable = (_e, Qt) => {
  _e.frame || invariant(!1);
  const Zt = _e.frame, $n = subtract(Qt, Zt.scroll.initial), Sn = negate($n), kn = {
    ...Zt,
    scroll: {
      initial: Zt.scroll.initial,
      current: Qt,
      diff: {
        value: $n,
        displacement: Sn
      },
      max: Zt.scroll.max
    }
  }, Kn = getSubject({
    page: _e.subject.page,
    withPlaceholder: _e.subject.withPlaceholder,
    axis: _e.axis,
    frame: kn
  });
  return {
    ..._e,
    frame: kn,
    subject: Kn
  };
};
const toDroppableMap = memoizeOne((_e) => _e.reduce((Qt, Zt) => (Qt[Zt.descriptor.id] = Zt, Qt), {})), toDraggableMap = memoizeOne((_e) => _e.reduce((Qt, Zt) => (Qt[Zt.descriptor.id] = Zt, Qt), {})), toDroppableList = memoizeOne((_e) => Object.values(_e)), toDraggableList = memoizeOne((_e) => Object.values(_e));
var getDraggablesInsideDroppable = memoizeOne((_e, Qt) => toDraggableList(Qt).filter(($n) => _e === $n.descriptor.droppableId).sort(($n, Sn) => $n.descriptor.index - Sn.descriptor.index));
function tryGetDestination(_e) {
  return _e.at && _e.at.type === "REORDER" ? _e.at.destination : null;
}
function tryGetCombine(_e) {
  return _e.at && _e.at.type === "COMBINE" ? _e.at.combine : null;
}
var removeDraggableFromList = memoizeOne((_e, Qt) => Qt.filter((Zt) => Zt.descriptor.id !== _e.descriptor.id)), moveToNextCombine = (_e) => {
  let {
    isMovingForward: Qt,
    draggable: Zt,
    destination: $n,
    insideDestination: Sn,
    previousImpact: kn
  } = _e;
  if (!$n.isCombineEnabled || !tryGetDestination(kn))
    return null;
  function er(js) {
    const zs = {
      type: "COMBINE",
      combine: {
        draggableId: js,
        droppableId: $n.descriptor.id
      }
    };
    return {
      ...kn,
      at: zs
    };
  }
  const Cr = kn.displaced.all, kr = Cr.length ? Cr[0] : null;
  if (Qt)
    return kr ? er(kr) : null;
  const Yr = removeDraggableFromList(Zt, Sn);
  if (!kr) {
    if (!Yr.length)
      return null;
    const js = Yr[Yr.length - 1];
    return er(js.descriptor.id);
  }
  const Ms = Yr.findIndex((js) => js.descriptor.id === kr);
  Ms === -1 && invariant(!1);
  const Ds = Ms - 1;
  if (Ds < 0)
    return null;
  const Ls = Yr[Ds];
  return er(Ls.descriptor.id);
}, isHomeOf = (_e, Qt) => _e.descriptor.droppableId === Qt.descriptor.id;
const noDisplacedBy = {
  point: origin,
  value: 0
}, emptyGroups = {
  invisible: {},
  visible: {},
  all: []
}, noImpact = {
  displaced: emptyGroups,
  displacedBy: noDisplacedBy,
  at: null
};
var noImpact$1 = noImpact, isWithin = (_e, Qt) => (Zt) => _e <= Zt && Zt <= Qt, isPartiallyVisibleThroughFrame = (_e) => {
  const Qt = isWithin(_e.top, _e.bottom), Zt = isWithin(_e.left, _e.right);
  return ($n) => {
    if (Qt($n.top) && Qt($n.bottom) && Zt($n.left) && Zt($n.right))
      return !0;
    const kn = Qt($n.top) || Qt($n.bottom), Kn = Zt($n.left) || Zt($n.right);
    if (kn && Kn)
      return !0;
    const Cr = $n.top < _e.top && $n.bottom > _e.bottom, kr = $n.left < _e.left && $n.right > _e.right;
    return Cr && kr ? !0 : Cr && Kn || kr && kn;
  };
}, isTotallyVisibleThroughFrame = (_e) => {
  const Qt = isWithin(_e.top, _e.bottom), Zt = isWithin(_e.left, _e.right);
  return ($n) => Qt($n.top) && Qt($n.bottom) && Zt($n.left) && Zt($n.right);
};
const vertical = {
  direction: "vertical",
  line: "y",
  crossAxisLine: "x",
  start: "top",
  end: "bottom",
  size: "height",
  crossAxisStart: "left",
  crossAxisEnd: "right",
  crossAxisSize: "width"
}, horizontal = {
  direction: "horizontal",
  line: "x",
  crossAxisLine: "y",
  start: "left",
  end: "right",
  size: "width",
  crossAxisStart: "top",
  crossAxisEnd: "bottom",
  crossAxisSize: "height"
};
var isTotallyVisibleThroughFrameOnAxis = (_e) => (Qt) => {
  const Zt = isWithin(Qt.top, Qt.bottom), $n = isWithin(Qt.left, Qt.right);
  return (Sn) => _e === vertical ? Zt(Sn.top) && Zt(Sn.bottom) : $n(Sn.left) && $n(Sn.right);
};
const getDroppableDisplaced = (_e, Qt) => {
  const Zt = Qt.frame ? Qt.frame.scroll.diff.displacement : origin;
  return offsetByPosition(_e, Zt);
}, isVisibleInDroppable = (_e, Qt, Zt) => Qt.subject.active ? Zt(Qt.subject.active)(_e) : !1, isVisibleInViewport = (_e, Qt, Zt) => Zt(Qt)(_e), isVisible$1 = (_e) => {
  let {
    target: Qt,
    destination: Zt,
    viewport: $n,
    withDroppableDisplacement: Sn,
    isVisibleThroughFrameFn: kn
  } = _e;
  const Kn = Sn ? getDroppableDisplaced(Qt, Zt) : Qt;
  return isVisibleInDroppable(Kn, Zt, kn) && isVisibleInViewport(Kn, $n, kn);
}, isPartiallyVisible = (_e) => isVisible$1({
  ..._e,
  isVisibleThroughFrameFn: isPartiallyVisibleThroughFrame
}), isTotallyVisible = (_e) => isVisible$1({
  ..._e,
  isVisibleThroughFrameFn: isTotallyVisibleThroughFrame
}), isTotallyVisibleOnAxis = (_e) => isVisible$1({
  ..._e,
  isVisibleThroughFrameFn: isTotallyVisibleThroughFrameOnAxis(_e.destination.axis)
}), getShouldAnimate = (_e, Qt, Zt) => {
  if (typeof Zt == "boolean")
    return Zt;
  if (!Qt)
    return !0;
  const {
    invisible: $n,
    visible: Sn
  } = Qt;
  if ($n[_e])
    return !1;
  const kn = Sn[_e];
  return kn ? kn.shouldAnimate : !0;
};
function getTarget(_e, Qt) {
  const Zt = _e.page.marginBox, $n = {
    top: Qt.point.y,
    right: 0,
    bottom: 0,
    left: Qt.point.x
  };
  return getRect(expand(Zt, $n));
}
function getDisplacementGroups(_e) {
  let {
    afterDragging: Qt,
    destination: Zt,
    displacedBy: $n,
    viewport: Sn,
    forceShouldAnimate: kn,
    last: Kn
  } = _e;
  return Qt.reduce(function(Cr, kr) {
    const Yr = getTarget(kr, $n), Ms = kr.descriptor.id;
    if (Cr.all.push(Ms), !isPartiallyVisible({
      target: Yr,
      destination: Zt,
      viewport: Sn,
      withDroppableDisplacement: !0
    }))
      return Cr.invisible[kr.descriptor.id] = !0, Cr;
    const Ls = getShouldAnimate(Ms, Kn, kn), js = {
      draggableId: Ms,
      shouldAnimate: Ls
    };
    return Cr.visible[Ms] = js, Cr;
  }, {
    all: [],
    visible: {},
    invisible: {}
  });
}
function getIndexOfLastItem(_e, Qt) {
  if (!_e.length)
    return 0;
  const Zt = _e[_e.length - 1].descriptor.index;
  return Qt.inHomeList ? Zt : Zt + 1;
}
function goAtEnd(_e) {
  let {
    insideDestination: Qt,
    inHomeList: Zt,
    displacedBy: $n,
    destination: Sn
  } = _e;
  const kn = getIndexOfLastItem(Qt, {
    inHomeList: Zt
  });
  return {
    displaced: emptyGroups,
    displacedBy: $n,
    at: {
      type: "REORDER",
      destination: {
        droppableId: Sn.descriptor.id,
        index: kn
      }
    }
  };
}
function calculateReorderImpact(_e) {
  let {
    draggable: Qt,
    insideDestination: Zt,
    destination: $n,
    viewport: Sn,
    displacedBy: kn,
    last: Kn,
    index: er,
    forceShouldAnimate: Cr
  } = _e;
  const kr = isHomeOf(Qt, $n);
  if (er == null)
    return goAtEnd({
      insideDestination: Zt,
      inHomeList: kr,
      displacedBy: kn,
      destination: $n
    });
  const Yr = Zt.find((zs) => zs.descriptor.index === er);
  if (!Yr)
    return goAtEnd({
      insideDestination: Zt,
      inHomeList: kr,
      displacedBy: kn,
      destination: $n
    });
  const Ms = removeDraggableFromList(Qt, Zt), Ds = Zt.indexOf(Yr), Ls = Ms.slice(Ds);
  return {
    displaced: getDisplacementGroups({
      afterDragging: Ls,
      destination: $n,
      displacedBy: kn,
      last: Kn,
      viewport: Sn.frame,
      forceShouldAnimate: Cr
    }),
    displacedBy: kn,
    at: {
      type: "REORDER",
      destination: {
        droppableId: $n.descriptor.id,
        index: er
      }
    }
  };
}
function didStartAfterCritical(_e, Qt) {
  return !!Qt.effected[_e];
}
var fromCombine = (_e) => {
  let {
    isMovingForward: Qt,
    destination: Zt,
    draggables: $n,
    combine: Sn,
    afterCritical: kn
  } = _e;
  if (!Zt.isCombineEnabled)
    return null;
  const Kn = Sn.draggableId, Cr = $n[Kn].descriptor.index;
  return didStartAfterCritical(Kn, kn) ? Qt ? Cr : Cr - 1 : Qt ? Cr + 1 : Cr;
}, fromReorder = (_e) => {
  let {
    isMovingForward: Qt,
    isInHomeList: Zt,
    insideDestination: $n,
    location: Sn
  } = _e;
  if (!$n.length)
    return null;
  const kn = Sn.index, Kn = Qt ? kn + 1 : kn - 1, er = $n[0].descriptor.index, Cr = $n[$n.length - 1].descriptor.index, kr = Zt ? Cr : Cr + 1;
  return Kn < er || Kn > kr ? null : Kn;
}, moveToNextIndex = (_e) => {
  let {
    isMovingForward: Qt,
    isInHomeList: Zt,
    draggable: $n,
    draggables: Sn,
    destination: kn,
    insideDestination: Kn,
    previousImpact: er,
    viewport: Cr,
    afterCritical: kr
  } = _e;
  const Yr = er.at;
  if (Yr || invariant(!1), Yr.type === "REORDER") {
    const Ds = fromReorder({
      isMovingForward: Qt,
      isInHomeList: Zt,
      location: Yr.destination,
      insideDestination: Kn
    });
    return Ds == null ? null : calculateReorderImpact({
      draggable: $n,
      insideDestination: Kn,
      destination: kn,
      viewport: Cr,
      last: er.displaced,
      displacedBy: er.displacedBy,
      index: Ds
    });
  }
  const Ms = fromCombine({
    isMovingForward: Qt,
    destination: kn,
    displaced: er.displaced,
    draggables: Sn,
    combine: Yr.combine,
    afterCritical: kr
  });
  return Ms == null ? null : calculateReorderImpact({
    draggable: $n,
    insideDestination: Kn,
    destination: kn,
    viewport: Cr,
    last: er.displaced,
    displacedBy: er.displacedBy,
    index: Ms
  });
}, getCombinedItemDisplacement = (_e) => {
  let {
    displaced: Qt,
    afterCritical: Zt,
    combineWith: $n,
    displacedBy: Sn
  } = _e;
  const kn = !!(Qt.visible[$n] || Qt.invisible[$n]);
  return didStartAfterCritical($n, Zt) ? kn ? origin : negate(Sn.point) : kn ? Sn.point : origin;
}, whenCombining = (_e) => {
  let {
    afterCritical: Qt,
    impact: Zt,
    draggables: $n
  } = _e;
  const Sn = tryGetCombine(Zt);
  Sn || invariant(!1);
  const kn = Sn.draggableId, Kn = $n[kn].page.borderBox.center, er = getCombinedItemDisplacement({
    displaced: Zt.displaced,
    afterCritical: Qt,
    combineWith: kn,
    displacedBy: Zt.displacedBy
  });
  return add(Kn, er);
};
const distanceFromStartToBorderBoxCenter = (_e, Qt) => Qt.margin[_e.start] + Qt.borderBox[_e.size] / 2, distanceFromEndToBorderBoxCenter = (_e, Qt) => Qt.margin[_e.end] + Qt.borderBox[_e.size] / 2, getCrossAxisBorderBoxCenter = (_e, Qt, Zt) => Qt[_e.crossAxisStart] + Zt.margin[_e.crossAxisStart] + Zt.borderBox[_e.crossAxisSize] / 2, goAfter = (_e) => {
  let {
    axis: Qt,
    moveRelativeTo: Zt,
    isMoving: $n
  } = _e;
  return patch(Qt.line, Zt.marginBox[Qt.end] + distanceFromStartToBorderBoxCenter(Qt, $n), getCrossAxisBorderBoxCenter(Qt, Zt.marginBox, $n));
}, goBefore = (_e) => {
  let {
    axis: Qt,
    moveRelativeTo: Zt,
    isMoving: $n
  } = _e;
  return patch(Qt.line, Zt.marginBox[Qt.start] - distanceFromEndToBorderBoxCenter(Qt, $n), getCrossAxisBorderBoxCenter(Qt, Zt.marginBox, $n));
}, goIntoStart = (_e) => {
  let {
    axis: Qt,
    moveInto: Zt,
    isMoving: $n
  } = _e;
  return patch(Qt.line, Zt.contentBox[Qt.start] + distanceFromStartToBorderBoxCenter(Qt, $n), getCrossAxisBorderBoxCenter(Qt, Zt.contentBox, $n));
};
var whenReordering = (_e) => {
  let {
    impact: Qt,
    draggable: Zt,
    draggables: $n,
    droppable: Sn,
    afterCritical: kn
  } = _e;
  const Kn = getDraggablesInsideDroppable(Sn.descriptor.id, $n), er = Zt.page, Cr = Sn.axis;
  if (!Kn.length)
    return goIntoStart({
      axis: Cr,
      moveInto: Sn.page,
      isMoving: er
    });
  const {
    displaced: kr,
    displacedBy: Yr
  } = Qt, Ms = kr.all[0];
  if (Ms) {
    const Ls = $n[Ms];
    if (didStartAfterCritical(Ms, kn))
      return goBefore({
        axis: Cr,
        moveRelativeTo: Ls.page,
        isMoving: er
      });
    const js = offset(Ls.page, Yr.point);
    return goBefore({
      axis: Cr,
      moveRelativeTo: js,
      isMoving: er
    });
  }
  const Ds = Kn[Kn.length - 1];
  if (Ds.descriptor.id === Zt.descriptor.id)
    return er.borderBox.center;
  if (didStartAfterCritical(Ds.descriptor.id, kn)) {
    const Ls = offset(Ds.page, negate(kn.displacedBy.point));
    return goAfter({
      axis: Cr,
      moveRelativeTo: Ls,
      isMoving: er
    });
  }
  return goAfter({
    axis: Cr,
    moveRelativeTo: Ds.page,
    isMoving: er
  });
}, withDroppableDisplacement = (_e, Qt) => {
  const Zt = _e.frame;
  return Zt ? add(Qt, Zt.scroll.diff.displacement) : Qt;
};
const getResultWithoutDroppableDisplacement = (_e) => {
  let {
    impact: Qt,
    draggable: Zt,
    droppable: $n,
    draggables: Sn,
    afterCritical: kn
  } = _e;
  const Kn = Zt.page.borderBox.center, er = Qt.at;
  return !$n || !er ? Kn : er.type === "REORDER" ? whenReordering({
    impact: Qt,
    draggable: Zt,
    draggables: Sn,
    droppable: $n,
    afterCritical: kn
  }) : whenCombining({
    impact: Qt,
    draggables: Sn,
    afterCritical: kn
  });
};
var getPageBorderBoxCenterFromImpact = (_e) => {
  const Qt = getResultWithoutDroppableDisplacement(_e), Zt = _e.droppable;
  return Zt ? withDroppableDisplacement(Zt, Qt) : Qt;
}, scrollViewport = (_e, Qt) => {
  const Zt = subtract(Qt, _e.scroll.initial), $n = negate(Zt);
  return {
    frame: getRect({
      top: Qt.y,
      bottom: Qt.y + _e.frame.height,
      left: Qt.x,
      right: Qt.x + _e.frame.width
    }),
    scroll: {
      initial: _e.scroll.initial,
      max: _e.scroll.max,
      current: Qt,
      diff: {
        value: Zt,
        displacement: $n
      }
    }
  };
};
function getDraggables$1(_e, Qt) {
  return _e.map((Zt) => Qt[Zt]);
}
function tryGetVisible(_e, Qt) {
  for (let Zt = 0; Zt < Qt.length; Zt++) {
    const $n = Qt[Zt].visible[_e];
    if ($n)
      return $n;
  }
  return null;
}
var speculativelyIncrease = (_e) => {
  let {
    impact: Qt,
    viewport: Zt,
    destination: $n,
    draggables: Sn,
    maxScrollChange: kn
  } = _e;
  const Kn = scrollViewport(Zt, add(Zt.scroll.current, kn)), er = $n.frame ? scrollDroppable($n, add($n.frame.scroll.current, kn)) : $n, Cr = Qt.displaced, kr = getDisplacementGroups({
    afterDragging: getDraggables$1(Cr.all, Sn),
    destination: $n,
    displacedBy: Qt.displacedBy,
    viewport: Kn.frame,
    last: Cr,
    forceShouldAnimate: !1
  }), Yr = getDisplacementGroups({
    afterDragging: getDraggables$1(Cr.all, Sn),
    destination: er,
    displacedBy: Qt.displacedBy,
    viewport: Zt.frame,
    last: Cr,
    forceShouldAnimate: !1
  }), Ms = {}, Ds = {}, Ls = [Cr, kr, Yr];
  return Cr.all.forEach((zs) => {
    const Fs = tryGetVisible(zs, Ls);
    if (Fs) {
      Ds[zs] = Fs;
      return;
    }
    Ms[zs] = !0;
  }), {
    ...Qt,
    displaced: {
      all: Cr.all,
      invisible: Ms,
      visible: Ds
    }
  };
}, withViewportDisplacement = (_e, Qt) => add(_e.scroll.diff.displacement, Qt), getClientFromPageBorderBoxCenter = (_e) => {
  let {
    pageBorderBoxCenter: Qt,
    draggable: Zt,
    viewport: $n
  } = _e;
  const Sn = withViewportDisplacement($n, Qt), kn = subtract(Sn, Zt.page.borderBox.center);
  return add(Zt.client.borderBox.center, kn);
}, isTotallyVisibleInNewLocation = (_e) => {
  let {
    draggable: Qt,
    destination: Zt,
    newPageBorderBoxCenter: $n,
    viewport: Sn,
    withDroppableDisplacement: kn,
    onlyOnMainAxis: Kn = !1
  } = _e;
  const er = subtract($n, Qt.page.borderBox.center), kr = {
    target: offsetByPosition(Qt.page.borderBox, er),
    destination: Zt,
    withDroppableDisplacement: kn,
    viewport: Sn
  };
  return Kn ? isTotallyVisibleOnAxis(kr) : isTotallyVisible(kr);
}, moveToNextPlace = (_e) => {
  let {
    isMovingForward: Qt,
    draggable: Zt,
    destination: $n,
    draggables: Sn,
    previousImpact: kn,
    viewport: Kn,
    previousPageBorderBoxCenter: er,
    previousClientSelection: Cr,
    afterCritical: kr
  } = _e;
  if (!$n.isEnabled)
    return null;
  const Yr = getDraggablesInsideDroppable($n.descriptor.id, Sn), Ms = isHomeOf(Zt, $n), Ds = moveToNextCombine({
    isMovingForward: Qt,
    draggable: Zt,
    destination: $n,
    insideDestination: Yr,
    previousImpact: kn
  }) || moveToNextIndex({
    isMovingForward: Qt,
    isInHomeList: Ms,
    draggable: Zt,
    draggables: Sn,
    destination: $n,
    insideDestination: Yr,
    previousImpact: kn,
    viewport: Kn,
    afterCritical: kr
  });
  if (!Ds)
    return null;
  const Ls = getPageBorderBoxCenterFromImpact({
    impact: Ds,
    draggable: Zt,
    droppable: $n,
    draggables: Sn,
    afterCritical: kr
  });
  if (isTotallyVisibleInNewLocation({
    draggable: Zt,
    destination: $n,
    newPageBorderBoxCenter: Ls,
    viewport: Kn.frame,
    withDroppableDisplacement: !1,
    onlyOnMainAxis: !0
  }))
    return {
      clientSelection: getClientFromPageBorderBoxCenter({
        pageBorderBoxCenter: Ls,
        draggable: Zt,
        viewport: Kn
      }),
      impact: Ds,
      scrollJumpRequest: null
    };
  const zs = subtract(Ls, er), Fs = speculativelyIncrease({
    impact: Ds,
    viewport: Kn,
    destination: $n,
    draggables: Sn,
    maxScrollChange: zs
  });
  return {
    clientSelection: Cr,
    impact: Fs,
    scrollJumpRequest: zs
  };
};
const getKnownActive = (_e) => {
  const Qt = _e.subject.active;
  return Qt || invariant(!1), Qt;
};
var getBestCrossAxisDroppable = (_e) => {
  let {
    isMovingForward: Qt,
    pageBorderBoxCenter: Zt,
    source: $n,
    droppables: Sn,
    viewport: kn
  } = _e;
  const Kn = $n.subject.active;
  if (!Kn)
    return null;
  const er = $n.axis, Cr = isWithin(Kn[er.start], Kn[er.end]), kr = toDroppableList(Sn).filter((Ms) => Ms !== $n).filter((Ms) => Ms.isEnabled).filter((Ms) => !!Ms.subject.active).filter((Ms) => isPartiallyVisibleThroughFrame(kn.frame)(getKnownActive(Ms))).filter((Ms) => {
    const Ds = getKnownActive(Ms);
    return Qt ? Kn[er.crossAxisEnd] < Ds[er.crossAxisEnd] : Ds[er.crossAxisStart] < Kn[er.crossAxisStart];
  }).filter((Ms) => {
    const Ds = getKnownActive(Ms), Ls = isWithin(Ds[er.start], Ds[er.end]);
    return Cr(Ds[er.start]) || Cr(Ds[er.end]) || Ls(Kn[er.start]) || Ls(Kn[er.end]);
  }).sort((Ms, Ds) => {
    const Ls = getKnownActive(Ms)[er.crossAxisStart], js = getKnownActive(Ds)[er.crossAxisStart];
    return Qt ? Ls - js : js - Ls;
  }).filter((Ms, Ds, Ls) => getKnownActive(Ms)[er.crossAxisStart] === getKnownActive(Ls[0])[er.crossAxisStart]);
  if (!kr.length)
    return null;
  if (kr.length === 1)
    return kr[0];
  const Yr = kr.filter((Ms) => isWithin(getKnownActive(Ms)[er.start], getKnownActive(Ms)[er.end])(Zt[er.line]));
  return Yr.length === 1 ? Yr[0] : Yr.length > 1 ? Yr.sort((Ms, Ds) => getKnownActive(Ms)[er.start] - getKnownActive(Ds)[er.start])[0] : kr.sort((Ms, Ds) => {
    const Ls = closest$1(Zt, getCorners(getKnownActive(Ms))), js = closest$1(Zt, getCorners(getKnownActive(Ds)));
    return Ls !== js ? Ls - js : getKnownActive(Ms)[er.start] - getKnownActive(Ds)[er.start];
  })[0];
};
const getCurrentPageBorderBoxCenter = (_e, Qt) => {
  const Zt = _e.page.borderBox.center;
  return didStartAfterCritical(_e.descriptor.id, Qt) ? subtract(Zt, Qt.displacedBy.point) : Zt;
}, getCurrentPageBorderBox = (_e, Qt) => {
  const Zt = _e.page.borderBox;
  return didStartAfterCritical(_e.descriptor.id, Qt) ? offsetByPosition(Zt, negate(Qt.displacedBy.point)) : Zt;
};
var getClosestDraggable = (_e) => {
  let {
    pageBorderBoxCenter: Qt,
    viewport: Zt,
    destination: $n,
    insideDestination: Sn,
    afterCritical: kn
  } = _e;
  return Sn.filter((er) => isTotallyVisible({
    target: getCurrentPageBorderBox(er, kn),
    destination: $n,
    viewport: Zt.frame,
    withDroppableDisplacement: !0
  })).sort((er, Cr) => {
    const kr = distance(Qt, withDroppableDisplacement($n, getCurrentPageBorderBoxCenter(er, kn))), Yr = distance(Qt, withDroppableDisplacement($n, getCurrentPageBorderBoxCenter(Cr, kn)));
    return kr < Yr ? -1 : Yr < kr ? 1 : er.descriptor.index - Cr.descriptor.index;
  })[0] || null;
}, getDisplacedBy = memoizeOne(function _e(Qt, Zt) {
  const $n = Zt[Qt.line];
  return {
    value: $n,
    point: patch(Qt.line, $n)
  };
});
const getRequiredGrowthForPlaceholder = (_e, Qt, Zt) => {
  const $n = _e.axis;
  if (_e.descriptor.mode === "virtual")
    return patch($n.line, Qt[$n.line]);
  const Sn = _e.subject.page.contentBox[$n.size], Cr = getDraggablesInsideDroppable(_e.descriptor.id, Zt).reduce((kr, Yr) => kr + Yr.client.marginBox[$n.size], 0) + Qt[$n.line] - Sn;
  return Cr <= 0 ? null : patch($n.line, Cr);
}, withMaxScroll = (_e, Qt) => ({
  ..._e,
  scroll: {
    ..._e.scroll,
    max: Qt
  }
}), addPlaceholder = (_e, Qt, Zt) => {
  const $n = _e.frame;
  isHomeOf(Qt, _e) && invariant(!1), _e.subject.withPlaceholder && invariant(!1);
  const Sn = getDisplacedBy(_e.axis, Qt.displaceBy).point, kn = getRequiredGrowthForPlaceholder(_e, Sn, Zt), Kn = {
    placeholderSize: Sn,
    increasedBy: kn,
    oldFrameMaxScroll: _e.frame ? _e.frame.scroll.max : null
  };
  if (!$n) {
    const Yr = getSubject({
      page: _e.subject.page,
      withPlaceholder: Kn,
      axis: _e.axis,
      frame: _e.frame
    });
    return {
      ..._e,
      subject: Yr
    };
  }
  const er = kn ? add($n.scroll.max, kn) : $n.scroll.max, Cr = withMaxScroll($n, er), kr = getSubject({
    page: _e.subject.page,
    withPlaceholder: Kn,
    axis: _e.axis,
    frame: Cr
  });
  return {
    ..._e,
    subject: kr,
    frame: Cr
  };
}, removePlaceholder = (_e) => {
  const Qt = _e.subject.withPlaceholder;
  Qt || invariant(!1);
  const Zt = _e.frame;
  if (!Zt) {
    const Kn = getSubject({
      page: _e.subject.page,
      axis: _e.axis,
      frame: null,
      withPlaceholder: null
    });
    return {
      ..._e,
      subject: Kn
    };
  }
  const $n = Qt.oldFrameMaxScroll;
  $n || invariant(!1);
  const Sn = withMaxScroll(Zt, $n), kn = getSubject({
    page: _e.subject.page,
    axis: _e.axis,
    frame: Sn,
    withPlaceholder: null
  });
  return {
    ..._e,
    subject: kn,
    frame: Sn
  };
};
var moveToNewDroppable = (_e) => {
  let {
    previousPageBorderBoxCenter: Qt,
    moveRelativeTo: Zt,
    insideDestination: $n,
    draggable: Sn,
    draggables: kn,
    destination: Kn,
    viewport: er,
    afterCritical: Cr
  } = _e;
  if (!Zt) {
    if ($n.length)
      return null;
    const Ds = {
      displaced: emptyGroups,
      displacedBy: noDisplacedBy,
      at: {
        type: "REORDER",
        destination: {
          droppableId: Kn.descriptor.id,
          index: 0
        }
      }
    }, Ls = getPageBorderBoxCenterFromImpact({
      impact: Ds,
      draggable: Sn,
      droppable: Kn,
      draggables: kn,
      afterCritical: Cr
    }), js = isHomeOf(Sn, Kn) ? Kn : addPlaceholder(Kn, Sn, kn);
    return isTotallyVisibleInNewLocation({
      draggable: Sn,
      destination: js,
      newPageBorderBoxCenter: Ls,
      viewport: er.frame,
      withDroppableDisplacement: !1,
      onlyOnMainAxis: !0
    }) ? Ds : null;
  }
  const kr = Qt[Kn.axis.line] <= Zt.page.borderBox.center[Kn.axis.line], Yr = (() => {
    const Ds = Zt.descriptor.index;
    return Zt.descriptor.id === Sn.descriptor.id || kr ? Ds : Ds + 1;
  })(), Ms = getDisplacedBy(Kn.axis, Sn.displaceBy);
  return calculateReorderImpact({
    draggable: Sn,
    insideDestination: $n,
    destination: Kn,
    viewport: er,
    displacedBy: Ms,
    last: emptyGroups,
    index: Yr
  });
}, moveCrossAxis = (_e) => {
  let {
    isMovingForward: Qt,
    previousPageBorderBoxCenter: Zt,
    draggable: $n,
    isOver: Sn,
    draggables: kn,
    droppables: Kn,
    viewport: er,
    afterCritical: Cr
  } = _e;
  const kr = getBestCrossAxisDroppable({
    isMovingForward: Qt,
    pageBorderBoxCenter: Zt,
    source: Sn,
    droppables: Kn,
    viewport: er
  });
  if (!kr)
    return null;
  const Yr = getDraggablesInsideDroppable(kr.descriptor.id, kn), Ms = getClosestDraggable({
    pageBorderBoxCenter: Zt,
    viewport: er,
    destination: kr,
    insideDestination: Yr,
    afterCritical: Cr
  }), Ds = moveToNewDroppable({
    previousPageBorderBoxCenter: Zt,
    destination: kr,
    draggable: $n,
    draggables: kn,
    moveRelativeTo: Ms,
    insideDestination: Yr,
    viewport: er,
    afterCritical: Cr
  });
  if (!Ds)
    return null;
  const Ls = getPageBorderBoxCenterFromImpact({
    impact: Ds,
    draggable: $n,
    droppable: kr,
    draggables: kn,
    afterCritical: Cr
  });
  return {
    clientSelection: getClientFromPageBorderBoxCenter({
      pageBorderBoxCenter: Ls,
      draggable: $n,
      viewport: er
    }),
    impact: Ds,
    scrollJumpRequest: null
  };
}, whatIsDraggedOver = (_e) => {
  const Qt = _e.at;
  return Qt ? Qt.type === "REORDER" ? Qt.destination.droppableId : Qt.combine.droppableId : null;
};
const getDroppableOver$1 = (_e, Qt) => {
  const Zt = whatIsDraggedOver(_e);
  return Zt ? Qt[Zt] : null;
};
var moveInDirection = (_e) => {
  let {
    state: Qt,
    type: Zt
  } = _e;
  const $n = getDroppableOver$1(Qt.impact, Qt.dimensions.droppables), Sn = !!$n, kn = Qt.dimensions.droppables[Qt.critical.droppable.id], Kn = $n || kn, er = Kn.axis.direction, Cr = er === "vertical" && (Zt === "MOVE_UP" || Zt === "MOVE_DOWN") || er === "horizontal" && (Zt === "MOVE_LEFT" || Zt === "MOVE_RIGHT");
  if (Cr && !Sn)
    return null;
  const kr = Zt === "MOVE_DOWN" || Zt === "MOVE_RIGHT", Yr = Qt.dimensions.draggables[Qt.critical.draggable.id], Ms = Qt.current.page.borderBoxCenter, {
    draggables: Ds,
    droppables: Ls
  } = Qt.dimensions;
  return Cr ? moveToNextPlace({
    isMovingForward: kr,
    previousPageBorderBoxCenter: Ms,
    draggable: Yr,
    destination: Kn,
    draggables: Ds,
    viewport: Qt.viewport,
    previousClientSelection: Qt.current.client.selection,
    previousImpact: Qt.impact,
    afterCritical: Qt.afterCritical
  }) : moveCrossAxis({
    isMovingForward: kr,
    previousPageBorderBoxCenter: Ms,
    draggable: Yr,
    isOver: Kn,
    draggables: Ds,
    droppables: Ls,
    viewport: Qt.viewport,
    afterCritical: Qt.afterCritical
  });
};
function isMovementAllowed(_e) {
  return _e.phase === "DRAGGING" || _e.phase === "COLLECTING";
}
function isPositionInFrame(_e) {
  const Qt = isWithin(_e.top, _e.bottom), Zt = isWithin(_e.left, _e.right);
  return function(Sn) {
    return Qt(Sn.y) && Zt(Sn.x);
  };
}
function getHasOverlap(_e, Qt) {
  return _e.left < Qt.right && _e.right > Qt.left && _e.top < Qt.bottom && _e.bottom > Qt.top;
}
function getFurthestAway(_e) {
  let {
    pageBorderBox: Qt,
    draggable: Zt,
    candidates: $n
  } = _e;
  const Sn = Zt.page.borderBox.center, kn = $n.map((Kn) => {
    const er = Kn.axis, Cr = patch(Kn.axis.line, Qt.center[er.line], Kn.page.borderBox.center[er.crossAxisLine]);
    return {
      id: Kn.descriptor.id,
      distance: distance(Sn, Cr)
    };
  }).sort((Kn, er) => er.distance - Kn.distance);
  return kn[0] ? kn[0].id : null;
}
function getDroppableOver(_e) {
  let {
    pageBorderBox: Qt,
    draggable: Zt,
    droppables: $n
  } = _e;
  const Sn = toDroppableList($n).filter((kn) => {
    if (!kn.isEnabled)
      return !1;
    const Kn = kn.subject.active;
    if (!Kn || !getHasOverlap(Qt, Kn))
      return !1;
    if (isPositionInFrame(Kn)(Qt.center))
      return !0;
    const er = kn.axis, Cr = Kn.center[er.crossAxisLine], kr = Qt[er.crossAxisStart], Yr = Qt[er.crossAxisEnd], Ms = isWithin(Kn[er.crossAxisStart], Kn[er.crossAxisEnd]), Ds = Ms(kr), Ls = Ms(Yr);
    return !Ds && !Ls ? !0 : Ds ? kr < Cr : Yr > Cr;
  });
  return Sn.length ? Sn.length === 1 ? Sn[0].descriptor.id : getFurthestAway({
    pageBorderBox: Qt,
    draggable: Zt,
    candidates: Sn
  }) : null;
}
const offsetRectByPosition = (_e, Qt) => getRect(offsetByPosition(_e, Qt));
var withDroppableScroll = (_e, Qt) => {
  const Zt = _e.frame;
  return Zt ? offsetRectByPosition(Qt, Zt.scroll.diff.value) : Qt;
};
function getIsDisplaced(_e) {
  let {
    displaced: Qt,
    id: Zt
  } = _e;
  return !!(Qt.visible[Zt] || Qt.invisible[Zt]);
}
function atIndex(_e) {
  let {
    draggable: Qt,
    closest: Zt,
    inHomeList: $n
  } = _e;
  return Zt ? $n && Zt.descriptor.index > Qt.descriptor.index ? Zt.descriptor.index - 1 : Zt.descriptor.index : null;
}
var getReorderImpact = (_e) => {
  let {
    pageBorderBoxWithDroppableScroll: Qt,
    draggable: Zt,
    destination: $n,
    insideDestination: Sn,
    last: kn,
    viewport: Kn,
    afterCritical: er
  } = _e;
  const Cr = $n.axis, kr = getDisplacedBy($n.axis, Zt.displaceBy), Yr = kr.value, Ms = Qt[Cr.start], Ds = Qt[Cr.end], js = removeDraggableFromList(Zt, Sn).find((Fs) => {
    const Bs = Fs.descriptor.id, Hs = Fs.page.borderBox.center[Cr.line], Ws = didStartAfterCritical(Bs, er), Ys = getIsDisplaced({
      displaced: kn,
      id: Bs
    });
    return Ws ? Ys ? Ds <= Hs : Ms < Hs - Yr : Ys ? Ds <= Hs + Yr : Ms < Hs;
  }) || null, zs = atIndex({
    draggable: Zt,
    closest: js,
    inHomeList: isHomeOf(Zt, $n)
  });
  return calculateReorderImpact({
    draggable: Zt,
    insideDestination: Sn,
    destination: $n,
    viewport: Kn,
    last: kn,
    displacedBy: kr,
    index: zs
  });
};
const combineThresholdDivisor = 4;
var getCombineImpact = (_e) => {
  let {
    draggable: Qt,
    pageBorderBoxWithDroppableScroll: Zt,
    previousImpact: $n,
    destination: Sn,
    insideDestination: kn,
    afterCritical: Kn
  } = _e;
  if (!Sn.isCombineEnabled)
    return null;
  const er = Sn.axis, Cr = getDisplacedBy(Sn.axis, Qt.displaceBy), kr = Cr.value, Yr = Zt[er.start], Ms = Zt[er.end], Ls = removeDraggableFromList(Qt, kn).find((zs) => {
    const Fs = zs.descriptor.id, Bs = zs.page.borderBox, Ws = Bs[er.size] / combineThresholdDivisor, Ys = didStartAfterCritical(Fs, Kn), El = getIsDisplaced({
      displaced: $n.displaced,
      id: Fs
    });
    return Ys ? El ? Ms > Bs[er.start] + Ws && Ms < Bs[er.end] - Ws : Yr > Bs[er.start] - kr + Ws && Yr < Bs[er.end] - kr - Ws : El ? Ms > Bs[er.start] + kr + Ws && Ms < Bs[er.end] + kr - Ws : Yr > Bs[er.start] + Ws && Yr < Bs[er.end] - Ws;
  });
  return Ls ? {
    displacedBy: Cr,
    displaced: $n.displaced,
    at: {
      type: "COMBINE",
      combine: {
        draggableId: Ls.descriptor.id,
        droppableId: Sn.descriptor.id
      }
    }
  } : null;
}, getDragImpact = (_e) => {
  let {
    pageOffset: Qt,
    draggable: Zt,
    draggables: $n,
    droppables: Sn,
    previousImpact: kn,
    viewport: Kn,
    afterCritical: er
  } = _e;
  const Cr = offsetRectByPosition(Zt.page.borderBox, Qt), kr = getDroppableOver({
    pageBorderBox: Cr,
    draggable: Zt,
    droppables: Sn
  });
  if (!kr)
    return noImpact$1;
  const Yr = Sn[kr], Ms = getDraggablesInsideDroppable(Yr.descriptor.id, $n), Ds = withDroppableScroll(Yr, Cr);
  return getCombineImpact({
    pageBorderBoxWithDroppableScroll: Ds,
    draggable: Zt,
    previousImpact: kn,
    destination: Yr,
    insideDestination: Ms,
    afterCritical: er
  }) || getReorderImpact({
    pageBorderBoxWithDroppableScroll: Ds,
    draggable: Zt,
    destination: Yr,
    insideDestination: Ms,
    last: kn.displaced,
    viewport: Kn,
    afterCritical: er
  });
}, patchDroppableMap = (_e, Qt) => ({
  ..._e,
  [Qt.descriptor.id]: Qt
});
const clearUnusedPlaceholder = (_e) => {
  let {
    previousImpact: Qt,
    impact: Zt,
    droppables: $n
  } = _e;
  const Sn = whatIsDraggedOver(Qt), kn = whatIsDraggedOver(Zt);
  if (!Sn || Sn === kn)
    return $n;
  const Kn = $n[Sn];
  if (!Kn.subject.withPlaceholder)
    return $n;
  const er = removePlaceholder(Kn);
  return patchDroppableMap($n, er);
};
var recomputePlaceholders = (_e) => {
  let {
    draggable: Qt,
    draggables: Zt,
    droppables: $n,
    previousImpact: Sn,
    impact: kn
  } = _e;
  const Kn = clearUnusedPlaceholder({
    previousImpact: Sn,
    impact: kn,
    droppables: $n
  }), er = whatIsDraggedOver(kn);
  if (!er)
    return Kn;
  const Cr = $n[er];
  if (isHomeOf(Qt, Cr) || Cr.subject.withPlaceholder)
    return Kn;
  const kr = addPlaceholder(Cr, Qt, Zt);
  return patchDroppableMap(Kn, kr);
}, update = (_e) => {
  let {
    state: Qt,
    clientSelection: Zt,
    dimensions: $n,
    viewport: Sn,
    impact: kn,
    scrollJumpRequest: Kn
  } = _e;
  const er = Sn || Qt.viewport, Cr = $n || Qt.dimensions, kr = Zt || Qt.current.client.selection, Yr = subtract(kr, Qt.initial.client.selection), Ms = {
    offset: Yr,
    selection: kr,
    borderBoxCenter: add(Qt.initial.client.borderBoxCenter, Yr)
  }, Ds = {
    selection: add(Ms.selection, er.scroll.current),
    borderBoxCenter: add(Ms.borderBoxCenter, er.scroll.current),
    offset: add(Ms.offset, er.scroll.diff.value)
  }, Ls = {
    client: Ms,
    page: Ds
  };
  if (Qt.phase === "COLLECTING")
    return {
      ...Qt,
      dimensions: Cr,
      viewport: er,
      current: Ls
    };
  const js = Cr.draggables[Qt.critical.draggable.id], zs = kn || getDragImpact({
    pageOffset: Ds.offset,
    draggable: js,
    draggables: Cr.draggables,
    droppables: Cr.droppables,
    previousImpact: Qt.impact,
    viewport: er,
    afterCritical: Qt.afterCritical
  }), Fs = recomputePlaceholders({
    draggable: js,
    impact: zs,
    previousImpact: Qt.impact,
    draggables: Cr.draggables,
    droppables: Cr.droppables
  });
  return {
    ...Qt,
    current: Ls,
    dimensions: {
      draggables: Cr.draggables,
      droppables: Fs
    },
    impact: zs,
    viewport: er,
    scrollJumpRequest: Kn || null,
    forceShouldAnimate: Kn ? !1 : null
  };
};
function getDraggables(_e, Qt) {
  return _e.map((Zt) => Qt[Zt]);
}
var recompute = (_e) => {
  let {
    impact: Qt,
    viewport: Zt,
    draggables: $n,
    destination: Sn,
    forceShouldAnimate: kn
  } = _e;
  const Kn = Qt.displaced, er = getDraggables(Kn.all, $n), Cr = getDisplacementGroups({
    afterDragging: er,
    destination: Sn,
    displacedBy: Qt.displacedBy,
    viewport: Zt.frame,
    forceShouldAnimate: kn,
    last: Kn
  });
  return {
    ...Qt,
    displaced: Cr
  };
}, getClientBorderBoxCenter = (_e) => {
  let {
    impact: Qt,
    draggable: Zt,
    droppable: $n,
    draggables: Sn,
    viewport: kn,
    afterCritical: Kn
  } = _e;
  const er = getPageBorderBoxCenterFromImpact({
    impact: Qt,
    draggable: Zt,
    draggables: Sn,
    droppable: $n,
    afterCritical: Kn
  });
  return getClientFromPageBorderBoxCenter({
    pageBorderBoxCenter: er,
    draggable: Zt,
    viewport: kn
  });
}, refreshSnap = (_e) => {
  let {
    state: Qt,
    dimensions: Zt,
    viewport: $n
  } = _e;
  Qt.movementMode !== "SNAP" && invariant(!1);
  const Sn = Qt.impact, kn = $n || Qt.viewport, Kn = Zt || Qt.dimensions, {
    draggables: er,
    droppables: Cr
  } = Kn, kr = er[Qt.critical.draggable.id], Yr = whatIsDraggedOver(Sn);
  Yr || invariant(!1);
  const Ms = Cr[Yr], Ds = recompute({
    impact: Sn,
    viewport: kn,
    destination: Ms,
    draggables: er
  }), Ls = getClientBorderBoxCenter({
    impact: Ds,
    draggable: kr,
    droppable: Ms,
    draggables: er,
    viewport: kn,
    afterCritical: Qt.afterCritical
  });
  return update({
    impact: Ds,
    clientSelection: Ls,
    state: Qt,
    dimensions: Kn,
    viewport: kn
  });
}, getHomeLocation = (_e) => ({
  index: _e.index,
  droppableId: _e.droppableId
}), getLiftEffect = (_e) => {
  let {
    draggable: Qt,
    home: Zt,
    draggables: $n,
    viewport: Sn
  } = _e;
  const kn = getDisplacedBy(Zt.axis, Qt.displaceBy), Kn = getDraggablesInsideDroppable(Zt.descriptor.id, $n), er = Kn.indexOf(Qt);
  er === -1 && invariant(!1);
  const Cr = Kn.slice(er + 1), kr = Cr.reduce((Ls, js) => (Ls[js.descriptor.id] = !0, Ls), {}), Yr = {
    inVirtualList: Zt.descriptor.mode === "virtual",
    displacedBy: kn,
    effected: kr
  };
  return {
    impact: {
      displaced: getDisplacementGroups({
        afterDragging: Cr,
        destination: Zt,
        displacedBy: kn,
        last: null,
        viewport: Sn.frame,
        forceShouldAnimate: !1
      }),
      displacedBy: kn,
      at: {
        type: "REORDER",
        destination: getHomeLocation(Qt.descriptor)
      }
    },
    afterCritical: Yr
  };
}, patchDimensionMap = (_e, Qt) => ({
  draggables: _e.draggables,
  droppables: patchDroppableMap(_e.droppables, Qt)
}), offsetDraggable = (_e) => {
  let {
    draggable: Qt,
    offset: Zt,
    initialWindowScroll: $n
  } = _e;
  const Sn = offset(Qt.client, Zt), kn = withScroll(Sn, $n);
  return {
    ...Qt,
    placeholder: {
      ...Qt.placeholder,
      client: Sn
    },
    client: Sn,
    page: kn
  };
}, getFrame = (_e) => {
  const Qt = _e.frame;
  return Qt || invariant(!1), Qt;
}, adjustAdditionsForScrollChanges = (_e) => {
  let {
    additions: Qt,
    updatedDroppables: Zt,
    viewport: $n
  } = _e;
  const Sn = $n.scroll.diff.value;
  return Qt.map((kn) => {
    const Kn = kn.descriptor.droppableId, er = Zt[Kn], kr = getFrame(er).scroll.diff.value, Yr = add(Sn, kr);
    return offsetDraggable({
      draggable: kn,
      offset: Yr,
      initialWindowScroll: $n.scroll.initial
    });
  });
}, publishWhileDraggingInVirtual = (_e) => {
  let {
    state: Qt,
    published: Zt
  } = _e;
  const $n = Zt.modified.map((Hs) => {
    const Ws = Qt.dimensions.droppables[Hs.droppableId];
    return scrollDroppable(Ws, Hs.scroll);
  }), Sn = {
    ...Qt.dimensions.droppables,
    ...toDroppableMap($n)
  }, kn = toDraggableMap(adjustAdditionsForScrollChanges({
    additions: Zt.additions,
    updatedDroppables: Sn,
    viewport: Qt.viewport
  })), Kn = {
    ...Qt.dimensions.draggables,
    ...kn
  };
  Zt.removals.forEach((Hs) => {
    delete Kn[Hs];
  });
  const er = {
    droppables: Sn,
    draggables: Kn
  }, Cr = whatIsDraggedOver(Qt.impact), kr = Cr ? er.droppables[Cr] : null, Yr = er.draggables[Qt.critical.draggable.id], Ms = er.droppables[Qt.critical.droppable.id], {
    impact: Ds,
    afterCritical: Ls
  } = getLiftEffect({
    draggable: Yr,
    home: Ms,
    draggables: Kn,
    viewport: Qt.viewport
  }), js = kr && kr.isCombineEnabled ? Qt.impact : Ds, zs = getDragImpact({
    pageOffset: Qt.current.page.offset,
    draggable: er.draggables[Qt.critical.draggable.id],
    draggables: er.draggables,
    droppables: er.droppables,
    previousImpact: js,
    viewport: Qt.viewport,
    afterCritical: Ls
  }), Fs = {
    ...Qt,
    phase: "DRAGGING",
    impact: zs,
    onLiftImpact: Ds,
    dimensions: er,
    afterCritical: Ls,
    forceShouldAnimate: !1
  };
  return Qt.phase === "COLLECTING" ? Fs : {
    ...Fs,
    phase: "DROP_PENDING",
    reason: Qt.reason,
    isWaiting: !1
  };
};
const isSnapping = (_e) => _e.movementMode === "SNAP", postDroppableChange = (_e, Qt, Zt) => {
  const $n = patchDimensionMap(_e.dimensions, Qt);
  return !isSnapping(_e) || Zt ? update({
    state: _e,
    dimensions: $n
  }) : refreshSnap({
    state: _e,
    dimensions: $n
  });
};
function removeScrollJumpRequest(_e) {
  return _e.isDragging && _e.movementMode === "SNAP" ? {
    ..._e,
    scrollJumpRequest: null
  } : _e;
}
const idle$2 = {
  phase: "IDLE",
  completed: null,
  shouldFlush: !1
};
var reducer = function(_e, Qt) {
  if (_e === void 0 && (_e = idle$2), Qt.type === "FLUSH")
    return {
      ...idle$2,
      shouldFlush: !0
    };
  if (Qt.type === "INITIAL_PUBLISH") {
    _e.phase !== "IDLE" && invariant(!1);
    const {
      critical: Zt,
      clientSelection: $n,
      viewport: Sn,
      dimensions: kn,
      movementMode: Kn
    } = Qt.payload, er = kn.draggables[Zt.draggable.id], Cr = kn.droppables[Zt.droppable.id], kr = {
      selection: $n,
      borderBoxCenter: er.client.borderBox.center,
      offset: origin
    }, Yr = {
      client: kr,
      page: {
        selection: add(kr.selection, Sn.scroll.initial),
        borderBoxCenter: add(kr.selection, Sn.scroll.initial),
        offset: add(kr.selection, Sn.scroll.diff.value)
      }
    }, Ms = toDroppableList(kn.droppables).every((zs) => !zs.isFixedOnPage), {
      impact: Ds,
      afterCritical: Ls
    } = getLiftEffect({
      draggable: er,
      home: Cr,
      draggables: kn.draggables,
      viewport: Sn
    });
    return {
      phase: "DRAGGING",
      isDragging: !0,
      critical: Zt,
      movementMode: Kn,
      dimensions: kn,
      initial: Yr,
      current: Yr,
      isWindowScrollAllowed: Ms,
      impact: Ds,
      afterCritical: Ls,
      onLiftImpact: Ds,
      viewport: Sn,
      scrollJumpRequest: null,
      forceShouldAnimate: null
    };
  }
  if (Qt.type === "COLLECTION_STARTING")
    return _e.phase === "COLLECTING" || _e.phase === "DROP_PENDING" ? _e : (_e.phase !== "DRAGGING" && invariant(!1), {
      ..._e,
      phase: "COLLECTING"
    });
  if (Qt.type === "PUBLISH_WHILE_DRAGGING")
    return _e.phase === "COLLECTING" || _e.phase === "DROP_PENDING" || invariant(!1), publishWhileDraggingInVirtual({
      state: _e,
      published: Qt.payload
    });
  if (Qt.type === "MOVE") {
    if (_e.phase === "DROP_PENDING")
      return _e;
    isMovementAllowed(_e) || invariant(!1);
    const {
      client: Zt
    } = Qt.payload;
    return isEqual$1(Zt, _e.current.client.selection) ? _e : update({
      state: _e,
      clientSelection: Zt,
      impact: isSnapping(_e) ? _e.impact : null
    });
  }
  if (Qt.type === "UPDATE_DROPPABLE_SCROLL") {
    if (_e.phase === "DROP_PENDING" || _e.phase === "COLLECTING")
      return removeScrollJumpRequest(_e);
    isMovementAllowed(_e) || invariant(!1);
    const {
      id: Zt,
      newScroll: $n
    } = Qt.payload, Sn = _e.dimensions.droppables[Zt];
    if (!Sn)
      return _e;
    const kn = scrollDroppable(Sn, $n);
    return postDroppableChange(_e, kn, !1);
  }
  if (Qt.type === "UPDATE_DROPPABLE_IS_ENABLED") {
    if (_e.phase === "DROP_PENDING")
      return _e;
    isMovementAllowed(_e) || invariant(!1);
    const {
      id: Zt,
      isEnabled: $n
    } = Qt.payload, Sn = _e.dimensions.droppables[Zt];
    Sn || invariant(!1), Sn.isEnabled === $n && invariant(!1);
    const kn = {
      ...Sn,
      isEnabled: $n
    };
    return postDroppableChange(_e, kn, !0);
  }
  if (Qt.type === "UPDATE_DROPPABLE_IS_COMBINE_ENABLED") {
    if (_e.phase === "DROP_PENDING")
      return _e;
    isMovementAllowed(_e) || invariant(!1);
    const {
      id: Zt,
      isCombineEnabled: $n
    } = Qt.payload, Sn = _e.dimensions.droppables[Zt];
    Sn || invariant(!1), Sn.isCombineEnabled === $n && invariant(!1);
    const kn = {
      ...Sn,
      isCombineEnabled: $n
    };
    return postDroppableChange(_e, kn, !0);
  }
  if (Qt.type === "MOVE_BY_WINDOW_SCROLL") {
    if (_e.phase === "DROP_PENDING" || _e.phase === "DROP_ANIMATING")
      return _e;
    isMovementAllowed(_e) || invariant(!1), _e.isWindowScrollAllowed || invariant(!1);
    const Zt = Qt.payload.newScroll;
    if (isEqual$1(_e.viewport.scroll.current, Zt))
      return removeScrollJumpRequest(_e);
    const $n = scrollViewport(_e.viewport, Zt);
    return isSnapping(_e) ? refreshSnap({
      state: _e,
      viewport: $n
    }) : update({
      state: _e,
      viewport: $n
    });
  }
  if (Qt.type === "UPDATE_VIEWPORT_MAX_SCROLL") {
    if (!isMovementAllowed(_e))
      return _e;
    const Zt = Qt.payload.maxScroll;
    if (isEqual$1(Zt, _e.viewport.scroll.max))
      return _e;
    const $n = {
      ..._e.viewport,
      scroll: {
        ..._e.viewport.scroll,
        max: Zt
      }
    };
    return {
      ..._e,
      viewport: $n
    };
  }
  if (Qt.type === "MOVE_UP" || Qt.type === "MOVE_DOWN" || Qt.type === "MOVE_LEFT" || Qt.type === "MOVE_RIGHT") {
    if (_e.phase === "COLLECTING" || _e.phase === "DROP_PENDING")
      return _e;
    _e.phase !== "DRAGGING" && invariant(!1);
    const Zt = moveInDirection({
      state: _e,
      type: Qt.type
    });
    return Zt ? update({
      state: _e,
      impact: Zt.impact,
      clientSelection: Zt.clientSelection,
      scrollJumpRequest: Zt.scrollJumpRequest
    }) : _e;
  }
  if (Qt.type === "DROP_PENDING") {
    const Zt = Qt.payload.reason;
    return _e.phase !== "COLLECTING" && invariant(!1), {
      ..._e,
      phase: "DROP_PENDING",
      isWaiting: !0,
      reason: Zt
    };
  }
  if (Qt.type === "DROP_ANIMATE") {
    const {
      completed: Zt,
      dropDuration: $n,
      newHomeClientOffset: Sn
    } = Qt.payload;
    return _e.phase === "DRAGGING" || _e.phase === "DROP_PENDING" || invariant(!1), {
      phase: "DROP_ANIMATING",
      completed: Zt,
      dropDuration: $n,
      newHomeClientOffset: Sn,
      dimensions: _e.dimensions
    };
  }
  if (Qt.type === "DROP_COMPLETE") {
    const {
      completed: Zt
    } = Qt.payload;
    return {
      phase: "IDLE",
      completed: Zt,
      shouldFlush: !1
    };
  }
  return _e;
};
const beforeInitialCapture = (_e) => ({
  type: "BEFORE_INITIAL_CAPTURE",
  payload: _e
}), lift$1 = (_e) => ({
  type: "LIFT",
  payload: _e
}), initialPublish = (_e) => ({
  type: "INITIAL_PUBLISH",
  payload: _e
}), publishWhileDragging = (_e) => ({
  type: "PUBLISH_WHILE_DRAGGING",
  payload: _e
}), collectionStarting = () => ({
  type: "COLLECTION_STARTING",
  payload: null
}), updateDroppableScroll = (_e) => ({
  type: "UPDATE_DROPPABLE_SCROLL",
  payload: _e
}), updateDroppableIsEnabled = (_e) => ({
  type: "UPDATE_DROPPABLE_IS_ENABLED",
  payload: _e
}), updateDroppableIsCombineEnabled = (_e) => ({
  type: "UPDATE_DROPPABLE_IS_COMBINE_ENABLED",
  payload: _e
}), move = (_e) => ({
  type: "MOVE",
  payload: _e
}), moveByWindowScroll = (_e) => ({
  type: "MOVE_BY_WINDOW_SCROLL",
  payload: _e
}), updateViewportMaxScroll = (_e) => ({
  type: "UPDATE_VIEWPORT_MAX_SCROLL",
  payload: _e
}), moveUp = () => ({
  type: "MOVE_UP",
  payload: null
}), moveDown = () => ({
  type: "MOVE_DOWN",
  payload: null
}), moveRight = () => ({
  type: "MOVE_RIGHT",
  payload: null
}), moveLeft = () => ({
  type: "MOVE_LEFT",
  payload: null
}), flush = () => ({
  type: "FLUSH",
  payload: null
}), animateDrop = (_e) => ({
  type: "DROP_ANIMATE",
  payload: _e
}), completeDrop = (_e) => ({
  type: "DROP_COMPLETE",
  payload: _e
}), drop$1 = (_e) => ({
  type: "DROP",
  payload: _e
}), dropPending = (_e) => ({
  type: "DROP_PENDING",
  payload: _e
}), dropAnimationFinished = () => ({
  type: "DROP_ANIMATION_FINISHED",
  payload: null
});
var lift = (_e) => (Qt) => {
  let {
    getState: Zt,
    dispatch: $n
  } = Qt;
  return (Sn) => (kn) => {
    if (kn.type !== "LIFT") {
      Sn(kn);
      return;
    }
    const {
      id: Kn,
      clientSelection: er,
      movementMode: Cr
    } = kn.payload, kr = Zt();
    kr.phase === "DROP_ANIMATING" && $n(completeDrop({
      completed: kr.completed
    })), Zt().phase !== "IDLE" && invariant(!1), $n(flush()), $n(beforeInitialCapture({
      draggableId: Kn,
      movementMode: Cr
    }));
    const Ms = {
      draggableId: Kn,
      scrollOptions: {
        shouldPublishImmediately: Cr === "SNAP"
      }
    }, {
      critical: Ds,
      dimensions: Ls,
      viewport: js
    } = _e.startPublishing(Ms);
    $n(initialPublish({
      critical: Ds,
      dimensions: Ls,
      clientSelection: er,
      movementMode: Cr,
      viewport: js
    }));
  };
}, style = (_e) => () => (Qt) => (Zt) => {
  Zt.type === "INITIAL_PUBLISH" && _e.dragging(), Zt.type === "DROP_ANIMATE" && _e.dropping(Zt.payload.completed.result.reason), (Zt.type === "FLUSH" || Zt.type === "DROP_COMPLETE") && _e.resting(), Qt(Zt);
};
const curves = {
  outOfTheWay: "cubic-bezier(0.2, 0, 0, 1)",
  drop: "cubic-bezier(.2,1,.1,1)"
}, combine = {
  opacity: {
    drop: 0,
    combining: 0.7
  },
  scale: {
    drop: 0.75
  }
}, timings = {
  outOfTheWay: 0.2,
  minDropTime: 0.33,
  maxDropTime: 0.55
}, outOfTheWayTiming = `${timings.outOfTheWay}s ${curves.outOfTheWay}`, transitions = {
  fluid: `opacity ${outOfTheWayTiming}`,
  snap: `transform ${outOfTheWayTiming}, opacity ${outOfTheWayTiming}`,
  drop: (_e) => {
    const Qt = `${_e}s ${curves.drop}`;
    return `transform ${Qt}, opacity ${Qt}`;
  },
  outOfTheWay: `transform ${outOfTheWayTiming}`,
  placeholder: `height ${outOfTheWayTiming}, width ${outOfTheWayTiming}, margin ${outOfTheWayTiming}`
}, moveTo = (_e) => isEqual$1(_e, origin) ? void 0 : `translate(${_e.x}px, ${_e.y}px)`, transforms = {
  moveTo,
  drop: (_e, Qt) => {
    const Zt = moveTo(_e);
    if (Zt)
      return Qt ? `${Zt} scale(${combine.scale.drop})` : Zt;
  }
}, {
  minDropTime,
  maxDropTime
} = timings, dropTimeRange = maxDropTime - minDropTime, maxDropTimeAtDistance = 1500, cancelDropModifier = 0.6;
var getDropDuration = (_e) => {
  let {
    current: Qt,
    destination: Zt,
    reason: $n
  } = _e;
  const Sn = distance(Qt, Zt);
  if (Sn <= 0)
    return minDropTime;
  if (Sn >= maxDropTimeAtDistance)
    return maxDropTime;
  const kn = Sn / maxDropTimeAtDistance, Kn = minDropTime + dropTimeRange * kn, er = $n === "CANCEL" ? Kn * cancelDropModifier : Kn;
  return Number(er.toFixed(2));
}, getNewHomeClientOffset = (_e) => {
  let {
    impact: Qt,
    draggable: Zt,
    dimensions: $n,
    viewport: Sn,
    afterCritical: kn
  } = _e;
  const {
    draggables: Kn,
    droppables: er
  } = $n, Cr = whatIsDraggedOver(Qt), kr = Cr ? er[Cr] : null, Yr = er[Zt.descriptor.droppableId], Ms = getClientBorderBoxCenter({
    impact: Qt,
    draggable: Zt,
    draggables: Kn,
    afterCritical: kn,
    droppable: kr || Yr,
    viewport: Sn
  });
  return subtract(Ms, Zt.client.borderBox.center);
}, getDropImpact = (_e) => {
  let {
    draggables: Qt,
    reason: Zt,
    lastImpact: $n,
    home: Sn,
    viewport: kn,
    onLiftImpact: Kn
  } = _e;
  return !$n.at || Zt !== "DROP" ? {
    impact: recompute({
      draggables: Qt,
      impact: Kn,
      destination: Sn,
      viewport: kn,
      forceShouldAnimate: !0
    }),
    didDropInsideDroppable: !1
  } : $n.at.type === "REORDER" ? {
    impact: $n,
    didDropInsideDroppable: !0
  } : {
    impact: {
      ...$n,
      displaced: emptyGroups
    },
    didDropInsideDroppable: !0
  };
};
const dropMiddleware = (_e) => {
  let {
    getState: Qt,
    dispatch: Zt
  } = _e;
  return ($n) => (Sn) => {
    if (Sn.type !== "DROP") {
      $n(Sn);
      return;
    }
    const kn = Qt(), Kn = Sn.payload.reason;
    if (kn.phase === "COLLECTING") {
      Zt(dropPending({
        reason: Kn
      }));
      return;
    }
    if (kn.phase === "IDLE")
      return;
    kn.phase === "DROP_PENDING" && kn.isWaiting && invariant(!1), kn.phase === "DRAGGING" || kn.phase === "DROP_PENDING" || invariant(!1);
    const Cr = kn.critical, kr = kn.dimensions, Yr = kr.draggables[kn.critical.draggable.id], {
      impact: Ms,
      didDropInsideDroppable: Ds
    } = getDropImpact({
      reason: Kn,
      lastImpact: kn.impact,
      afterCritical: kn.afterCritical,
      onLiftImpact: kn.onLiftImpact,
      home: kn.dimensions.droppables[kn.critical.droppable.id],
      viewport: kn.viewport,
      draggables: kn.dimensions.draggables
    }), Ls = Ds ? tryGetDestination(Ms) : null, js = Ds ? tryGetCombine(Ms) : null, zs = {
      index: Cr.draggable.index,
      droppableId: Cr.droppable.id
    }, Fs = {
      draggableId: Yr.descriptor.id,
      type: Yr.descriptor.type,
      source: zs,
      reason: Kn,
      mode: kn.movementMode,
      destination: Ls,
      combine: js
    }, Bs = getNewHomeClientOffset({
      impact: Ms,
      draggable: Yr,
      dimensions: kr,
      viewport: kn.viewport,
      afterCritical: kn.afterCritical
    }), Hs = {
      critical: kn.critical,
      afterCritical: kn.afterCritical,
      result: Fs,
      impact: Ms
    };
    if (!(!isEqual$1(kn.current.client.offset, Bs) || !!Fs.combine)) {
      Zt(completeDrop({
        completed: Hs
      }));
      return;
    }
    const Ys = getDropDuration({
      current: kn.current.client.offset,
      destination: Bs,
      reason: Kn
    });
    Zt(animateDrop({
      newHomeClientOffset: Bs,
      dropDuration: Ys,
      completed: Hs
    }));
  };
};
var drop = dropMiddleware, getWindowScroll = () => ({
  x: window.pageXOffset,
  y: window.pageYOffset
});
function getWindowScrollBinding(_e) {
  return {
    eventName: "scroll",
    options: {
      passive: !0,
      capture: !1
    },
    fn: (Qt) => {
      Qt.target !== window && Qt.target !== window.document || _e();
    }
  };
}
function getScrollListener(_e) {
  let {
    onWindowScroll: Qt
  } = _e;
  function Zt() {
    Qt(getWindowScroll());
  }
  const $n = rafSchd$1(Zt), Sn = getWindowScrollBinding($n);
  let kn = noop$2;
  function Kn() {
    return kn !== noop$2;
  }
  function er() {
    Kn() && invariant(!1), kn = bindEvents(window, [Sn]);
  }
  function Cr() {
    Kn() || invariant(!1), $n.cancel(), kn(), kn = noop$2;
  }
  return {
    start: er,
    stop: Cr,
    isActive: Kn
  };
}
const shouldEnd = (_e) => _e.type === "DROP_COMPLETE" || _e.type === "DROP_ANIMATE" || _e.type === "FLUSH", scrollListener = (_e) => {
  const Qt = getScrollListener({
    onWindowScroll: (Zt) => {
      _e.dispatch(moveByWindowScroll({
        newScroll: Zt
      }));
    }
  });
  return (Zt) => ($n) => {
    !Qt.isActive() && $n.type === "INITIAL_PUBLISH" && Qt.start(), Qt.isActive() && shouldEnd($n) && Qt.stop(), Zt($n);
  };
};
var scrollListener$1 = scrollListener, getExpiringAnnounce = (_e) => {
  let Qt = !1, Zt = !1;
  const $n = setTimeout(() => {
    Zt = !0;
  }), Sn = (kn) => {
    Qt || Zt || (Qt = !0, _e(kn), clearTimeout($n));
  };
  return Sn.wasCalled = () => Qt, Sn;
}, getAsyncMarshal = () => {
  const _e = [], Qt = (Sn) => {
    const kn = _e.findIndex((er) => er.timerId === Sn);
    kn === -1 && invariant(!1);
    const [Kn] = _e.splice(kn, 1);
    Kn.callback();
  };
  return {
    add: (Sn) => {
      const kn = setTimeout(() => Qt(kn)), Kn = {
        timerId: kn,
        callback: Sn
      };
      _e.push(Kn);
    },
    flush: () => {
      if (!_e.length)
        return;
      const Sn = [..._e];
      _e.length = 0, Sn.forEach((kn) => {
        clearTimeout(kn.timerId), kn.callback();
      });
    }
  };
};
const areLocationsEqual = (_e, Qt) => _e == null && Qt == null ? !0 : _e == null || Qt == null ? !1 : _e.droppableId === Qt.droppableId && _e.index === Qt.index, isCombineEqual = (_e, Qt) => _e == null && Qt == null ? !0 : _e == null || Qt == null ? !1 : _e.draggableId === Qt.draggableId && _e.droppableId === Qt.droppableId, isCriticalEqual = (_e, Qt) => {
  if (_e === Qt)
    return !0;
  const Zt = _e.draggable.id === Qt.draggable.id && _e.draggable.droppableId === Qt.draggable.droppableId && _e.draggable.type === Qt.draggable.type && _e.draggable.index === Qt.draggable.index, $n = _e.droppable.id === Qt.droppable.id && _e.droppable.type === Qt.droppable.type;
  return Zt && $n;
}, withTimings = (_e, Qt) => {
  Qt();
}, getDragStart = (_e, Qt) => ({
  draggableId: _e.draggable.id,
  type: _e.droppable.type,
  source: {
    droppableId: _e.droppable.id,
    index: _e.draggable.index
  },
  mode: Qt
});
function execute(_e, Qt, Zt, $n) {
  if (!_e) {
    Zt($n(Qt));
    return;
  }
  const Sn = getExpiringAnnounce(Zt);
  _e(Qt, {
    announce: Sn
  }), Sn.wasCalled() || Zt($n(Qt));
}
var getPublisher = (_e, Qt) => {
  const Zt = getAsyncMarshal();
  let $n = null;
  const Sn = (Ms, Ds) => {
    $n && invariant(!1), withTimings("onBeforeCapture", () => {
      const Ls = _e().onBeforeCapture;
      Ls && Ls({
        draggableId: Ms,
        mode: Ds
      });
    });
  }, kn = (Ms, Ds) => {
    $n && invariant(!1), withTimings("onBeforeDragStart", () => {
      const Ls = _e().onBeforeDragStart;
      Ls && Ls(getDragStart(Ms, Ds));
    });
  }, Kn = (Ms, Ds) => {
    $n && invariant(!1);
    const Ls = getDragStart(Ms, Ds);
    $n = {
      mode: Ds,
      lastCritical: Ms,
      lastLocation: Ls.source,
      lastCombine: null
    }, Zt.add(() => {
      withTimings("onDragStart", () => execute(_e().onDragStart, Ls, Qt, preset$1.onDragStart));
    });
  }, er = (Ms, Ds) => {
    const Ls = tryGetDestination(Ds), js = tryGetCombine(Ds);
    $n || invariant(!1);
    const zs = !isCriticalEqual(Ms, $n.lastCritical);
    zs && ($n.lastCritical = Ms);
    const Fs = !areLocationsEqual($n.lastLocation, Ls);
    Fs && ($n.lastLocation = Ls);
    const Bs = !isCombineEqual($n.lastCombine, js);
    if (Bs && ($n.lastCombine = js), !zs && !Fs && !Bs)
      return;
    const Hs = {
      ...getDragStart(Ms, $n.mode),
      combine: js,
      destination: Ls
    };
    Zt.add(() => {
      withTimings("onDragUpdate", () => execute(_e().onDragUpdate, Hs, Qt, preset$1.onDragUpdate));
    });
  }, Cr = () => {
    $n || invariant(!1), Zt.flush();
  }, kr = (Ms) => {
    $n || invariant(!1), $n = null, withTimings("onDragEnd", () => execute(_e().onDragEnd, Ms, Qt, preset$1.onDragEnd));
  };
  return {
    beforeCapture: Sn,
    beforeStart: kn,
    start: Kn,
    update: er,
    flush: Cr,
    drop: kr,
    abort: () => {
      if (!$n)
        return;
      const Ms = {
        ...getDragStart($n.lastCritical, $n.mode),
        combine: null,
        destination: null,
        reason: "CANCEL"
      };
      kr(Ms);
    }
  };
}, responders = (_e, Qt) => {
  const Zt = getPublisher(_e, Qt);
  return ($n) => (Sn) => (kn) => {
    if (kn.type === "BEFORE_INITIAL_CAPTURE") {
      Zt.beforeCapture(kn.payload.draggableId, kn.payload.movementMode);
      return;
    }
    if (kn.type === "INITIAL_PUBLISH") {
      const er = kn.payload.critical;
      Zt.beforeStart(er, kn.payload.movementMode), Sn(kn), Zt.start(er, kn.payload.movementMode);
      return;
    }
    if (kn.type === "DROP_COMPLETE") {
      const er = kn.payload.completed.result;
      Zt.flush(), Sn(kn), Zt.drop(er);
      return;
    }
    if (Sn(kn), kn.type === "FLUSH") {
      Zt.abort();
      return;
    }
    const Kn = $n.getState();
    Kn.phase === "DRAGGING" && Zt.update(Kn.critical, Kn.impact);
  };
};
const dropAnimationFinishMiddleware = (_e) => (Qt) => (Zt) => {
  if (Zt.type !== "DROP_ANIMATION_FINISHED") {
    Qt(Zt);
    return;
  }
  const $n = _e.getState();
  $n.phase !== "DROP_ANIMATING" && invariant(!1), _e.dispatch(completeDrop({
    completed: $n.completed
  }));
};
var dropAnimationFinish = dropAnimationFinishMiddleware;
const dropAnimationFlushOnScrollMiddleware = (_e) => {
  let Qt = null, Zt = null;
  function $n() {
    Zt && (cancelAnimationFrame(Zt), Zt = null), Qt && (Qt(), Qt = null);
  }
  return (Sn) => (kn) => {
    if ((kn.type === "FLUSH" || kn.type === "DROP_COMPLETE" || kn.type === "DROP_ANIMATION_FINISHED") && $n(), Sn(kn), kn.type !== "DROP_ANIMATE")
      return;
    const Kn = {
      eventName: "scroll",
      options: {
        capture: !0,
        passive: !1,
        once: !0
      },
      fn: function() {
        _e.getState().phase === "DROP_ANIMATING" && _e.dispatch(dropAnimationFinished());
      }
    };
    Zt = requestAnimationFrame(() => {
      Zt = null, Qt = bindEvents(window, [Kn]);
    });
  };
};
var dropAnimationFlushOnScroll = dropAnimationFlushOnScrollMiddleware, dimensionMarshalStopper = (_e) => () => (Qt) => (Zt) => {
  (Zt.type === "DROP_COMPLETE" || Zt.type === "FLUSH" || Zt.type === "DROP_ANIMATE") && _e.stopPublishing(), Qt(Zt);
}, focus = (_e) => {
  let Qt = !1;
  return () => (Zt) => ($n) => {
    if ($n.type === "INITIAL_PUBLISH") {
      Qt = !0, _e.tryRecordFocus($n.payload.critical.draggable.id), Zt($n), _e.tryRestoreFocusRecorded();
      return;
    }
    if (Zt($n), !!Qt) {
      if ($n.type === "FLUSH") {
        Qt = !1, _e.tryRestoreFocusRecorded();
        return;
      }
      if ($n.type === "DROP_COMPLETE") {
        Qt = !1;
        const Sn = $n.payload.completed.result;
        Sn.combine && _e.tryShiftRecord(Sn.draggableId, Sn.combine.draggableId), _e.tryRestoreFocusRecorded();
      }
    }
  };
};
const shouldStop = (_e) => _e.type === "DROP_COMPLETE" || _e.type === "DROP_ANIMATE" || _e.type === "FLUSH";
var autoScroll = (_e) => (Qt) => (Zt) => ($n) => {
  if (shouldStop($n)) {
    _e.stop(), Zt($n);
    return;
  }
  if ($n.type === "INITIAL_PUBLISH") {
    Zt($n);
    const Sn = Qt.getState();
    Sn.phase !== "DRAGGING" && invariant(!1), _e.start(Sn);
    return;
  }
  Zt($n), _e.scroll(Qt.getState());
};
const pendingDrop = (_e) => (Qt) => (Zt) => {
  if (Qt(Zt), Zt.type !== "PUBLISH_WHILE_DRAGGING")
    return;
  const $n = _e.getState();
  $n.phase === "DROP_PENDING" && ($n.isWaiting || _e.dispatch(drop$1({
    reason: $n.reason
  })));
};
var pendingDrop$1 = pendingDrop;
const composeEnhancers = compose$1;
var createStore = (_e) => {
  let {
    dimensionMarshal: Qt,
    focusMarshal: Zt,
    styleMarshal: $n,
    getResponders: Sn,
    announce: kn,
    autoScroller: Kn
  } = _e;
  return createStore$1(reducer, composeEnhancers(applyMiddleware(style($n), dimensionMarshalStopper(Qt), lift(Qt), drop, dropAnimationFinish, dropAnimationFlushOnScroll, pendingDrop$1, autoScroll(Kn), scrollListener$1, focus(Zt), responders(Sn, kn))));
};
const clean$1 = () => ({
  additions: {},
  removals: {},
  modified: {}
});
function createPublisher(_e) {
  let {
    registry: Qt,
    callbacks: Zt
  } = _e, $n = clean$1(), Sn = null;
  const kn = () => {
    Sn || (Zt.collectionStarting(), Sn = requestAnimationFrame(() => {
      Sn = null;
      const {
        additions: kr,
        removals: Yr,
        modified: Ms
      } = $n, Ds = Object.keys(kr).map((zs) => Qt.draggable.getById(zs).getDimension(origin)).sort((zs, Fs) => zs.descriptor.index - Fs.descriptor.index), Ls = Object.keys(Ms).map((zs) => {
        const Bs = Qt.droppable.getById(zs).callbacks.getScrollWhileDragging();
        return {
          droppableId: zs,
          scroll: Bs
        };
      }), js = {
        additions: Ds,
        removals: Object.keys(Yr),
        modified: Ls
      };
      $n = clean$1(), Zt.publish(js);
    }));
  };
  return {
    add: (kr) => {
      const Yr = kr.descriptor.id;
      $n.additions[Yr] = kr, $n.modified[kr.descriptor.droppableId] = !0, $n.removals[Yr] && delete $n.removals[Yr], kn();
    },
    remove: (kr) => {
      const Yr = kr.descriptor;
      $n.removals[Yr.id] = !0, $n.modified[Yr.droppableId] = !0, $n.additions[Yr.id] && delete $n.additions[Yr.id], kn();
    },
    stop: () => {
      Sn && (cancelAnimationFrame(Sn), Sn = null, $n = clean$1());
    }
  };
}
var getMaxScroll = (_e) => {
  let {
    scrollHeight: Qt,
    scrollWidth: Zt,
    height: $n,
    width: Sn
  } = _e;
  const kn = subtract({
    x: Zt,
    y: Qt
  }, {
    x: Sn,
    y: $n
  });
  return {
    x: Math.max(0, kn.x),
    y: Math.max(0, kn.y)
  };
}, getDocumentElement = () => {
  const _e = document.documentElement;
  return _e || invariant(!1), _e;
}, getMaxWindowScroll = () => {
  const _e = getDocumentElement();
  return getMaxScroll({
    scrollHeight: _e.scrollHeight,
    scrollWidth: _e.scrollWidth,
    width: _e.clientWidth,
    height: _e.clientHeight
  });
}, getViewport = () => {
  const _e = getWindowScroll(), Qt = getMaxWindowScroll(), Zt = _e.y, $n = _e.x, Sn = getDocumentElement(), kn = Sn.clientWidth, Kn = Sn.clientHeight, er = $n + kn, Cr = Zt + Kn;
  return {
    frame: getRect({
      top: Zt,
      left: $n,
      right: er,
      bottom: Cr
    }),
    scroll: {
      initial: _e,
      current: _e,
      max: Qt,
      diff: {
        value: origin,
        displacement: origin
      }
    }
  };
}, getInitialPublish = (_e) => {
  let {
    critical: Qt,
    scrollOptions: Zt,
    registry: $n
  } = _e;
  const Sn = getViewport(), kn = Sn.scroll.current, Kn = Qt.droppable, er = $n.droppable.getAllByType(Kn.type).map((Ms) => Ms.callbacks.getDimensionAndWatchScroll(kn, Zt)), Cr = $n.draggable.getAllByType(Qt.draggable.type).map((Ms) => Ms.getDimension(kn));
  return {
    dimensions: {
      draggables: toDraggableMap(Cr),
      droppables: toDroppableMap(er)
    },
    critical: Qt,
    viewport: Sn
  };
};
function shouldPublishUpdate(_e, Qt, Zt) {
  return !(Zt.descriptor.id === Qt.id || Zt.descriptor.type !== Qt.type || _e.droppable.getById(Zt.descriptor.droppableId).descriptor.mode !== "virtual");
}
var createDimensionMarshal = (_e, Qt) => {
  let Zt = null;
  const $n = createPublisher({
    callbacks: {
      publish: Qt.publishWhileDragging,
      collectionStarting: Qt.collectionStarting
    },
    registry: _e
  }), Sn = (Ds, Ls) => {
    _e.droppable.exists(Ds) || invariant(!1), Zt && Qt.updateDroppableIsEnabled({
      id: Ds,
      isEnabled: Ls
    });
  }, kn = (Ds, Ls) => {
    Zt && (_e.droppable.exists(Ds) || invariant(!1), Qt.updateDroppableIsCombineEnabled({
      id: Ds,
      isCombineEnabled: Ls
    }));
  }, Kn = (Ds, Ls) => {
    Zt && (_e.droppable.exists(Ds) || invariant(!1), Qt.updateDroppableScroll({
      id: Ds,
      newScroll: Ls
    }));
  }, er = (Ds, Ls) => {
    Zt && _e.droppable.getById(Ds).callbacks.scroll(Ls);
  }, Cr = () => {
    if (!Zt)
      return;
    $n.stop();
    const Ds = Zt.critical.droppable;
    _e.droppable.getAllByType(Ds.type).forEach((Ls) => Ls.callbacks.dragStopped()), Zt.unsubscribe(), Zt = null;
  }, kr = (Ds) => {
    Zt || invariant(!1);
    const Ls = Zt.critical.draggable;
    Ds.type === "ADDITION" && shouldPublishUpdate(_e, Ls, Ds.value) && $n.add(Ds.value), Ds.type === "REMOVAL" && shouldPublishUpdate(_e, Ls, Ds.value) && $n.remove(Ds.value);
  };
  return {
    updateDroppableIsEnabled: Sn,
    updateDroppableIsCombineEnabled: kn,
    scrollDroppable: er,
    updateDroppableScroll: Kn,
    startPublishing: (Ds) => {
      Zt && invariant(!1);
      const Ls = _e.draggable.getById(Ds.draggableId), js = _e.droppable.getById(Ls.descriptor.droppableId), zs = {
        draggable: Ls.descriptor,
        droppable: js.descriptor
      }, Fs = _e.subscribe(kr);
      return Zt = {
        critical: zs,
        unsubscribe: Fs
      }, getInitialPublish({
        critical: zs,
        registry: _e,
        scrollOptions: Ds.scrollOptions
      });
    },
    stopPublishing: Cr
  };
}, canStartDrag = (_e, Qt) => _e.phase === "IDLE" ? !0 : _e.phase !== "DROP_ANIMATING" || _e.completed.result.draggableId === Qt ? !1 : _e.completed.result.reason === "DROP", scrollWindow = (_e) => {
  window.scrollBy(_e.x, _e.y);
};
const getScrollableDroppables = memoizeOne((_e) => toDroppableList(_e).filter((Qt) => !(!Qt.isEnabled || !Qt.frame))), getScrollableDroppableOver = (_e, Qt) => getScrollableDroppables(Qt).find(($n) => ($n.frame || invariant(!1), isPositionInFrame($n.frame.pageMarginBox)(_e))) || null;
var getBestScrollableDroppable = (_e) => {
  let {
    center: Qt,
    destination: Zt,
    droppables: $n
  } = _e;
  if (Zt) {
    const kn = $n[Zt];
    return kn.frame ? kn : null;
  }
  return getScrollableDroppableOver(Qt, $n);
};
const defaultAutoScrollerOptions = {
  startFromPercentage: 0.25,
  maxScrollAtPercentage: 0.05,
  maxPixelScroll: 28,
  ease: (_e) => _e ** 2,
  durationDampening: {
    stopDampeningAt: 1200,
    accelerateAt: 360
  },
  disabled: !1
};
var getDistanceThresholds = function(_e, Qt, Zt) {
  Zt === void 0 && (Zt = () => defaultAutoScrollerOptions);
  const $n = Zt(), Sn = _e[Qt.size] * $n.startFromPercentage, kn = _e[Qt.size] * $n.maxScrollAtPercentage;
  return {
    startScrollingFrom: Sn,
    maxScrollValueAt: kn
  };
}, getPercentage = (_e) => {
  let {
    startOfRange: Qt,
    endOfRange: Zt,
    current: $n
  } = _e;
  const Sn = Zt - Qt;
  return Sn === 0 ? 0 : ($n - Qt) / Sn;
}, minScroll = 1, getValueFromDistance = function(_e, Qt, Zt) {
  Zt === void 0 && (Zt = () => defaultAutoScrollerOptions);
  const $n = Zt();
  if (_e > Qt.startScrollingFrom)
    return 0;
  if (_e <= Qt.maxScrollValueAt)
    return $n.maxPixelScroll;
  if (_e === Qt.startScrollingFrom)
    return minScroll;
  const kn = 1 - getPercentage({
    startOfRange: Qt.maxScrollValueAt,
    endOfRange: Qt.startScrollingFrom,
    current: _e
  }), Kn = $n.maxPixelScroll * $n.ease(kn);
  return Math.ceil(Kn);
}, dampenValueByTime = (_e, Qt, Zt) => {
  const $n = Zt(), Sn = $n.durationDampening.accelerateAt, kn = $n.durationDampening.stopDampeningAt, Kn = Qt, er = kn, kr = Date.now() - Kn;
  if (kr >= kn)
    return _e;
  if (kr < Sn)
    return minScroll;
  const Yr = getPercentage({
    startOfRange: Sn,
    endOfRange: er,
    current: kr
  }), Ms = _e * $n.ease(Yr);
  return Math.ceil(Ms);
}, getValue = (_e) => {
  let {
    distanceToEdge: Qt,
    thresholds: Zt,
    dragStartTime: $n,
    shouldUseTimeDampening: Sn,
    getAutoScrollerOptions: kn
  } = _e;
  const Kn = getValueFromDistance(Qt, Zt, kn);
  return Kn === 0 ? 0 : Sn ? Math.max(dampenValueByTime(Kn, $n, kn), minScroll) : Kn;
}, getScrollOnAxis = (_e) => {
  let {
    container: Qt,
    distanceToEdges: Zt,
    dragStartTime: $n,
    axis: Sn,
    shouldUseTimeDampening: kn,
    getAutoScrollerOptions: Kn
  } = _e;
  const er = getDistanceThresholds(Qt, Sn, Kn);
  return Zt[Sn.end] < Zt[Sn.start] ? getValue({
    distanceToEdge: Zt[Sn.end],
    thresholds: er,
    dragStartTime: $n,
    shouldUseTimeDampening: kn,
    getAutoScrollerOptions: Kn
  }) : -1 * getValue({
    distanceToEdge: Zt[Sn.start],
    thresholds: er,
    dragStartTime: $n,
    shouldUseTimeDampening: kn,
    getAutoScrollerOptions: Kn
  });
}, adjustForSizeLimits = (_e) => {
  let {
    container: Qt,
    subject: Zt,
    proposedScroll: $n
  } = _e;
  const Sn = Zt.height > Qt.height, kn = Zt.width > Qt.width;
  return !kn && !Sn ? $n : kn && Sn ? null : {
    x: kn ? 0 : $n.x,
    y: Sn ? 0 : $n.y
  };
};
const clean = apply$1((_e) => _e === 0 ? 0 : _e);
var getScroll$1 = (_e) => {
  let {
    dragStartTime: Qt,
    container: Zt,
    subject: $n,
    center: Sn,
    shouldUseTimeDampening: kn,
    getAutoScrollerOptions: Kn
  } = _e;
  const er = {
    top: Sn.y - Zt.top,
    right: Zt.right - Sn.x,
    bottom: Zt.bottom - Sn.y,
    left: Sn.x - Zt.left
  }, Cr = getScrollOnAxis({
    container: Zt,
    distanceToEdges: er,
    dragStartTime: Qt,
    axis: vertical,
    shouldUseTimeDampening: kn,
    getAutoScrollerOptions: Kn
  }), kr = getScrollOnAxis({
    container: Zt,
    distanceToEdges: er,
    dragStartTime: Qt,
    axis: horizontal,
    shouldUseTimeDampening: kn,
    getAutoScrollerOptions: Kn
  }), Yr = clean({
    x: kr,
    y: Cr
  });
  if (isEqual$1(Yr, origin))
    return null;
  const Ms = adjustForSizeLimits({
    container: Zt,
    subject: $n,
    proposedScroll: Yr
  });
  return Ms ? isEqual$1(Ms, origin) ? null : Ms : null;
};
const smallestSigned = apply$1((_e) => _e === 0 ? 0 : _e > 0 ? 1 : -1), getOverlap = (() => {
  const _e = (Qt, Zt) => Qt < 0 ? Qt : Qt > Zt ? Qt - Zt : 0;
  return (Qt) => {
    let {
      current: Zt,
      max: $n,
      change: Sn
    } = Qt;
    const kn = add(Zt, Sn), Kn = {
      x: _e(kn.x, $n.x),
      y: _e(kn.y, $n.y)
    };
    return isEqual$1(Kn, origin) ? null : Kn;
  };
})(), canPartiallyScroll = (_e) => {
  let {
    max: Qt,
    current: Zt,
    change: $n
  } = _e;
  const Sn = {
    x: Math.max(Zt.x, Qt.x),
    y: Math.max(Zt.y, Qt.y)
  }, kn = smallestSigned($n), Kn = getOverlap({
    max: Sn,
    current: Zt,
    change: kn
  });
  return !Kn || kn.x !== 0 && Kn.x === 0 || kn.y !== 0 && Kn.y === 0;
}, canScrollWindow = (_e, Qt) => canPartiallyScroll({
  current: _e.scroll.current,
  max: _e.scroll.max,
  change: Qt
}), getWindowOverlap = (_e, Qt) => {
  if (!canScrollWindow(_e, Qt))
    return null;
  const Zt = _e.scroll.max, $n = _e.scroll.current;
  return getOverlap({
    current: $n,
    max: Zt,
    change: Qt
  });
}, canScrollDroppable = (_e, Qt) => {
  const Zt = _e.frame;
  return Zt ? canPartiallyScroll({
    current: Zt.scroll.current,
    max: Zt.scroll.max,
    change: Qt
  }) : !1;
}, getDroppableOverlap = (_e, Qt) => {
  const Zt = _e.frame;
  return !Zt || !canScrollDroppable(_e, Qt) ? null : getOverlap({
    current: Zt.scroll.current,
    max: Zt.scroll.max,
    change: Qt
  });
};
var getWindowScrollChange = (_e) => {
  let {
    viewport: Qt,
    subject: Zt,
    center: $n,
    dragStartTime: Sn,
    shouldUseTimeDampening: kn,
    getAutoScrollerOptions: Kn
  } = _e;
  const er = getScroll$1({
    dragStartTime: Sn,
    container: Qt.frame,
    subject: Zt,
    center: $n,
    shouldUseTimeDampening: kn,
    getAutoScrollerOptions: Kn
  });
  return er && canScrollWindow(Qt, er) ? er : null;
}, getDroppableScrollChange = (_e) => {
  let {
    droppable: Qt,
    subject: Zt,
    center: $n,
    dragStartTime: Sn,
    shouldUseTimeDampening: kn,
    getAutoScrollerOptions: Kn
  } = _e;
  const er = Qt.frame;
  if (!er)
    return null;
  const Cr = getScroll$1({
    dragStartTime: Sn,
    container: er.pageMarginBox,
    subject: Zt,
    center: $n,
    shouldUseTimeDampening: kn,
    getAutoScrollerOptions: Kn
  });
  return Cr && canScrollDroppable(Qt, Cr) ? Cr : null;
}, scroll = (_e) => {
  let {
    state: Qt,
    dragStartTime: Zt,
    shouldUseTimeDampening: $n,
    scrollWindow: Sn,
    scrollDroppable: kn,
    getAutoScrollerOptions: Kn
  } = _e;
  const er = Qt.current.page.borderBoxCenter, kr = Qt.dimensions.draggables[Qt.critical.draggable.id].page.marginBox;
  if (Qt.isWindowScrollAllowed) {
    const Ds = Qt.viewport, Ls = getWindowScrollChange({
      dragStartTime: Zt,
      viewport: Ds,
      subject: kr,
      center: er,
      shouldUseTimeDampening: $n,
      getAutoScrollerOptions: Kn
    });
    if (Ls) {
      Sn(Ls);
      return;
    }
  }
  const Yr = getBestScrollableDroppable({
    center: er,
    destination: whatIsDraggedOver(Qt.impact),
    droppables: Qt.dimensions.droppables
  });
  if (!Yr)
    return;
  const Ms = getDroppableScrollChange({
    dragStartTime: Zt,
    droppable: Yr,
    subject: kr,
    center: er,
    shouldUseTimeDampening: $n,
    getAutoScrollerOptions: Kn
  });
  Ms && kn(Yr.descriptor.id, Ms);
}, createFluidScroller = (_e) => {
  let {
    scrollWindow: Qt,
    scrollDroppable: Zt,
    getAutoScrollerOptions: $n = () => defaultAutoScrollerOptions
  } = _e;
  const Sn = rafSchd$1(Qt), kn = rafSchd$1(Zt);
  let Kn = null;
  const er = (Yr) => {
    Kn || invariant(!1);
    const {
      shouldUseTimeDampening: Ms,
      dragStartTime: Ds
    } = Kn;
    scroll({
      state: Yr,
      scrollWindow: Sn,
      scrollDroppable: kn,
      dragStartTime: Ds,
      shouldUseTimeDampening: Ms,
      getAutoScrollerOptions: $n
    });
  };
  return {
    start: (Yr) => {
      Kn && invariant(!1);
      const Ms = Date.now();
      let Ds = !1;
      const Ls = () => {
        Ds = !0;
      };
      scroll({
        state: Yr,
        dragStartTime: 0,
        shouldUseTimeDampening: !1,
        scrollWindow: Ls,
        scrollDroppable: Ls,
        getAutoScrollerOptions: $n
      }), Kn = {
        dragStartTime: Ms,
        shouldUseTimeDampening: Ds
      }, Ds && er(Yr);
    },
    stop: () => {
      Kn && (Sn.cancel(), kn.cancel(), Kn = null);
    },
    scroll: er
  };
}, createJumpScroller = (_e) => {
  let {
    move: Qt,
    scrollDroppable: Zt,
    scrollWindow: $n
  } = _e;
  const Sn = (Cr, kr) => {
    const Yr = add(Cr.current.client.selection, kr);
    Qt({
      client: Yr
    });
  }, kn = (Cr, kr) => {
    if (!canScrollDroppable(Cr, kr))
      return kr;
    const Yr = getDroppableOverlap(Cr, kr);
    if (!Yr)
      return Zt(Cr.descriptor.id, kr), null;
    const Ms = subtract(kr, Yr);
    return Zt(Cr.descriptor.id, Ms), subtract(kr, Ms);
  }, Kn = (Cr, kr, Yr) => {
    if (!Cr || !canScrollWindow(kr, Yr))
      return Yr;
    const Ms = getWindowOverlap(kr, Yr);
    if (!Ms)
      return $n(Yr), null;
    const Ds = subtract(Yr, Ms);
    return $n(Ds), subtract(Yr, Ds);
  };
  return (Cr) => {
    const kr = Cr.scrollJumpRequest;
    if (!kr)
      return;
    const Yr = whatIsDraggedOver(Cr.impact);
    Yr || invariant(!1);
    const Ms = kn(Cr.dimensions.droppables[Yr], kr);
    if (!Ms)
      return;
    const Ds = Cr.viewport, Ls = Kn(Cr.isWindowScrollAllowed, Ds, Ms);
    Ls && Sn(Cr, Ls);
  };
}, createAutoScroller = (_e) => {
  let {
    scrollDroppable: Qt,
    scrollWindow: Zt,
    move: $n,
    getAutoScrollerOptions: Sn
  } = _e;
  const kn = createFluidScroller({
    scrollWindow: Zt,
    scrollDroppable: Qt,
    getAutoScrollerOptions: Sn
  }), Kn = createJumpScroller({
    move: $n,
    scrollWindow: Zt,
    scrollDroppable: Qt
  });
  return {
    scroll: (kr) => {
      if (!(Sn().disabled || kr.phase !== "DRAGGING")) {
        if (kr.movementMode === "FLUID") {
          kn.scroll(kr);
          return;
        }
        kr.scrollJumpRequest && Kn(kr);
      }
    },
    start: kn.start,
    stop: kn.stop
  };
};
const prefix = "data-rfd", dragHandle = (() => {
  const _e = `${prefix}-drag-handle`;
  return {
    base: _e,
    draggableId: `${_e}-draggable-id`,
    contextId: `${_e}-context-id`
  };
})(), draggable = (() => {
  const _e = `${prefix}-draggable`;
  return {
    base: _e,
    contextId: `${_e}-context-id`,
    id: `${_e}-id`
  };
})(), droppable = (() => {
  const _e = `${prefix}-droppable`;
  return {
    base: _e,
    contextId: `${_e}-context-id`,
    id: `${_e}-id`
  };
})(), scrollContainer = {
  contextId: `${prefix}-scroll-container-context-id`
}, makeGetSelector = (_e) => (Qt) => `[${Qt}="${_e}"]`, getStyles = (_e, Qt) => _e.map((Zt) => {
  const $n = Zt.styles[Qt];
  return $n ? `${Zt.selector} { ${$n} }` : "";
}).join(" "), noPointerEvents = "pointer-events: none;";
var getStyles$1 = (_e) => {
  const Qt = makeGetSelector(_e), Zt = (() => {
    const er = `
      cursor: -webkit-grab;
      cursor: grab;
    `;
    return {
      selector: Qt(dragHandle.contextId),
      styles: {
        always: `
          -webkit-touch-callout: none;
          -webkit-tap-highlight-color: rgba(0,0,0,0);
          touch-action: manipulation;
        `,
        resting: er,
        dragging: noPointerEvents,
        dropAnimating: er
      }
    };
  })(), $n = (() => {
    const er = `
      transition: ${transitions.outOfTheWay};
    `;
    return {
      selector: Qt(draggable.contextId),
      styles: {
        dragging: er,
        dropAnimating: er,
        userCancel: er
      }
    };
  })(), Sn = {
    selector: Qt(droppable.contextId),
    styles: {
      always: "overflow-anchor: none;"
    }
  }, Kn = [$n, Zt, Sn, {
    selector: "body",
    styles: {
      dragging: `
        cursor: grabbing;
        cursor: -webkit-grabbing;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        overflow-anchor: none;
      `
    }
  }];
  return {
    always: getStyles(Kn, "always"),
    resting: getStyles(Kn, "resting"),
    dragging: getStyles(Kn, "dragging"),
    dropAnimating: getStyles(Kn, "dropAnimating"),
    userCancel: getStyles(Kn, "userCancel")
  };
};
const useIsomorphicLayoutEffect = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? reactExports.useLayoutEffect : reactExports.useEffect;
var useLayoutEffect = useIsomorphicLayoutEffect;
const getHead = () => {
  const _e = document.querySelector("head");
  return _e || invariant(!1), _e;
}, createStyleEl = (_e) => {
  const Qt = document.createElement("style");
  return _e && Qt.setAttribute("nonce", _e), Qt.type = "text/css", Qt;
};
function useStyleMarshal(_e, Qt) {
  const Zt = useMemo(() => getStyles$1(_e), [_e]), $n = reactExports.useRef(null), Sn = reactExports.useRef(null), kn = useCallback(memoizeOne((Ms) => {
    const Ds = Sn.current;
    Ds || invariant(!1), Ds.textContent = Ms;
  }), []), Kn = useCallback((Ms) => {
    const Ds = $n.current;
    Ds || invariant(!1), Ds.textContent = Ms;
  }, []);
  useLayoutEffect(() => {
    !$n.current && !Sn.current || invariant(!1);
    const Ms = createStyleEl(Qt), Ds = createStyleEl(Qt);
    return $n.current = Ms, Sn.current = Ds, Ms.setAttribute(`${prefix}-always`, _e), Ds.setAttribute(`${prefix}-dynamic`, _e), getHead().appendChild(Ms), getHead().appendChild(Ds), Kn(Zt.always), kn(Zt.resting), () => {
      const Ls = (js) => {
        const zs = js.current;
        zs || invariant(!1), getHead().removeChild(zs), js.current = null;
      };
      Ls($n), Ls(Sn);
    };
  }, [Qt, Kn, kn, Zt.always, Zt.resting, _e]);
  const er = useCallback(() => kn(Zt.dragging), [kn, Zt.dragging]), Cr = useCallback((Ms) => {
    if (Ms === "DROP") {
      kn(Zt.dropAnimating);
      return;
    }
    kn(Zt.userCancel);
  }, [kn, Zt.dropAnimating, Zt.userCancel]), kr = useCallback(() => {
    Sn.current && kn(Zt.resting);
  }, [kn, Zt.resting]);
  return useMemo(() => ({
    dragging: er,
    dropping: Cr,
    resting: kr
  }), [er, Cr, kr]);
}
function querySelectorAll(_e, Qt) {
  return Array.from(_e.querySelectorAll(Qt));
}
var getWindowFromEl = (_e) => {
  var Qt;
  return ((Qt = _e == null ? void 0 : _e.ownerDocument) == null ? void 0 : Qt.defaultView) || window;
};
function isHtmlElement(_e) {
  return _e instanceof getWindowFromEl(_e).HTMLElement;
}
function findDragHandle(_e, Qt) {
  const Zt = `[${dragHandle.contextId}="${_e}"]`, $n = querySelectorAll(document, Zt);
  if (!$n.length)
    return null;
  const Sn = $n.find((kn) => kn.getAttribute(dragHandle.draggableId) === Qt);
  return !Sn || !isHtmlElement(Sn) ? null : Sn;
}
function useFocusMarshal(_e) {
  const Qt = reactExports.useRef({}), Zt = reactExports.useRef(null), $n = reactExports.useRef(null), Sn = reactExports.useRef(!1), kn = useCallback(function(Ds, Ls) {
    const js = {
      id: Ds,
      focus: Ls
    };
    return Qt.current[Ds] = js, function() {
      const Fs = Qt.current;
      Fs[Ds] !== js && delete Fs[Ds];
    };
  }, []), Kn = useCallback(function(Ds) {
    const Ls = findDragHandle(_e, Ds);
    Ls && Ls !== document.activeElement && Ls.focus();
  }, [_e]), er = useCallback(function(Ds, Ls) {
    Zt.current === Ds && (Zt.current = Ls);
  }, []), Cr = useCallback(function() {
    $n.current || Sn.current && ($n.current = requestAnimationFrame(() => {
      $n.current = null;
      const Ds = Zt.current;
      Ds && Kn(Ds);
    }));
  }, [Kn]), kr = useCallback(function(Ds) {
    Zt.current = null;
    const Ls = document.activeElement;
    Ls && Ls.getAttribute(dragHandle.draggableId) === Ds && (Zt.current = Ds);
  }, []);
  return useLayoutEffect(() => (Sn.current = !0, function() {
    Sn.current = !1;
    const Ds = $n.current;
    Ds && cancelAnimationFrame(Ds);
  }), []), useMemo(() => ({
    register: kn,
    tryRecordFocus: kr,
    tryRestoreFocusRecorded: Cr,
    tryShiftRecord: er
  }), [kn, kr, Cr, er]);
}
function createRegistry() {
  const _e = {
    draggables: {},
    droppables: {}
  }, Qt = [];
  function Zt(Ms) {
    return Qt.push(Ms), function() {
      const Ls = Qt.indexOf(Ms);
      Ls !== -1 && Qt.splice(Ls, 1);
    };
  }
  function $n(Ms) {
    Qt.length && Qt.forEach((Ds) => Ds(Ms));
  }
  function Sn(Ms) {
    return _e.draggables[Ms] || null;
  }
  function kn(Ms) {
    const Ds = Sn(Ms);
    return Ds || invariant(!1), Ds;
  }
  const Kn = {
    register: (Ms) => {
      _e.draggables[Ms.descriptor.id] = Ms, $n({
        type: "ADDITION",
        value: Ms
      });
    },
    update: (Ms, Ds) => {
      const Ls = _e.draggables[Ds.descriptor.id];
      Ls && Ls.uniqueId === Ms.uniqueId && (delete _e.draggables[Ds.descriptor.id], _e.draggables[Ms.descriptor.id] = Ms);
    },
    unregister: (Ms) => {
      const Ds = Ms.descriptor.id, Ls = Sn(Ds);
      Ls && Ms.uniqueId === Ls.uniqueId && (delete _e.draggables[Ds], _e.droppables[Ms.descriptor.droppableId] && $n({
        type: "REMOVAL",
        value: Ms
      }));
    },
    getById: kn,
    findById: Sn,
    exists: (Ms) => !!Sn(Ms),
    getAllByType: (Ms) => Object.values(_e.draggables).filter((Ds) => Ds.descriptor.type === Ms)
  };
  function er(Ms) {
    return _e.droppables[Ms] || null;
  }
  function Cr(Ms) {
    const Ds = er(Ms);
    return Ds || invariant(!1), Ds;
  }
  const kr = {
    register: (Ms) => {
      _e.droppables[Ms.descriptor.id] = Ms;
    },
    unregister: (Ms) => {
      const Ds = er(Ms.descriptor.id);
      Ds && Ms.uniqueId === Ds.uniqueId && delete _e.droppables[Ms.descriptor.id];
    },
    getById: Cr,
    findById: er,
    exists: (Ms) => !!er(Ms),
    getAllByType: (Ms) => Object.values(_e.droppables).filter((Ds) => Ds.descriptor.type === Ms)
  };
  function Yr() {
    _e.draggables = {}, _e.droppables = {}, Qt.length = 0;
  }
  return {
    draggable: Kn,
    droppable: kr,
    subscribe: Zt,
    clean: Yr
  };
}
function useRegistry() {
  const _e = useMemo(createRegistry, []);
  return reactExports.useEffect(() => function() {
    React.version.startsWith("16") || React.version.startsWith("17") ? requestAnimationFrame(_e.clean) : _e.clean();
  }, [_e]), _e;
}
var StoreContext = React.createContext(null), getBodyElement = () => {
  const _e = document.body;
  return _e || invariant(!1), _e;
};
const visuallyHidden = {
  position: "absolute",
  width: "1px",
  height: "1px",
  margin: "-1px",
  border: "0",
  padding: "0",
  overflow: "hidden",
  clip: "rect(0 0 0 0)",
  "clip-path": "inset(100%)"
};
var visuallyHidden$1 = visuallyHidden;
const getId = (_e) => `rfd-announcement-${_e}`;
function useAnnouncer(_e) {
  const Qt = useMemo(() => getId(_e), [_e]), Zt = reactExports.useRef(null);
  return reactExports.useEffect(function() {
    const kn = document.createElement("div");
    return Zt.current = kn, kn.id = Qt, kn.setAttribute("aria-live", "assertive"), kn.setAttribute("aria-atomic", "true"), _extends$2(kn.style, visuallyHidden$1), getBodyElement().appendChild(kn), function() {
      setTimeout(function() {
        const Cr = getBodyElement();
        Cr.contains(kn) && Cr.removeChild(kn), kn === Zt.current && (Zt.current = null);
      });
    };
  }, [Qt]), useCallback((Sn) => {
    const kn = Zt.current;
    if (kn) {
      kn.textContent = Sn;
      return;
    }
  }, []);
}
let count$1 = 0;
const defaults = {
  separator: "::"
};
function useDeprecatedUniqueId(_e, Qt) {
  return Qt === void 0 && (Qt = defaults), useMemo(() => `${_e}${Qt.separator}${count$1++}`, [Qt.separator, _e]);
}
function useUniqueId(_e, Qt) {
  Qt === void 0 && (Qt = defaults);
  const Zt = React.useId();
  return useMemo(() => `${_e}${Qt.separator}${Zt}`, [Qt.separator, _e, Zt]);
}
var useUniqueId$1 = "useId" in React ? useUniqueId : useDeprecatedUniqueId;
function getElementId(_e) {
  let {
    contextId: Qt,
    uniqueId: Zt
  } = _e;
  return `rfd-hidden-text-${Qt}-${Zt}`;
}
function useHiddenTextElement(_e) {
  let {
    contextId: Qt,
    text: Zt
  } = _e;
  const $n = useUniqueId$1("hidden-text", {
    separator: "-"
  }), Sn = useMemo(() => getElementId({
    contextId: Qt,
    uniqueId: $n
  }), [$n, Qt]);
  return reactExports.useEffect(function() {
    const Kn = document.createElement("div");
    return Kn.id = Sn, Kn.textContent = Zt, Kn.style.display = "none", getBodyElement().appendChild(Kn), function() {
      const Cr = getBodyElement();
      Cr.contains(Kn) && Cr.removeChild(Kn);
    };
  }, [Sn, Zt]), Sn;
}
var AppContext = React.createContext(null);
function usePrevious(_e) {
  const Qt = reactExports.useRef(_e);
  return reactExports.useEffect(() => {
    Qt.current = _e;
  }), Qt;
}
function create$1() {
  let _e = null;
  function Qt() {
    return !!_e;
  }
  function Zt(Kn) {
    return Kn === _e;
  }
  function $n(Kn) {
    _e && invariant(!1);
    const er = {
      abandon: Kn
    };
    return _e = er, er;
  }
  function Sn() {
    _e || invariant(!1), _e = null;
  }
  function kn() {
    _e && (_e.abandon(), Sn());
  }
  return {
    isClaimed: Qt,
    isActive: Zt,
    claim: $n,
    release: Sn,
    tryAbandon: kn
  };
}
function isDragging(_e) {
  return _e.phase === "IDLE" || _e.phase === "DROP_ANIMATING" ? !1 : _e.isDragging;
}
const tab = 9, enter = 13, escape$1 = 27, space = 32, pageUp = 33, pageDown = 34, end = 35, home = 36, arrowLeft = 37, arrowUp = 38, arrowRight = 39, arrowDown = 40, preventedKeys = {
  [enter]: !0,
  [tab]: !0
};
var preventStandardKeyEvents = (_e) => {
  preventedKeys[_e.keyCode] && _e.preventDefault();
};
const supportedEventName = (() => {
  const _e = "visibilitychange";
  return typeof document > "u" ? _e : [_e, `ms${_e}`, `webkit${_e}`, `moz${_e}`, `o${_e}`].find(($n) => `on${$n}` in document) || _e;
})();
var supportedPageVisibilityEventName = supportedEventName;
const primaryButton = 0, sloppyClickThreshold = 5;
function isSloppyClickThresholdExceeded(_e, Qt) {
  return Math.abs(Qt.x - _e.x) >= sloppyClickThreshold || Math.abs(Qt.y - _e.y) >= sloppyClickThreshold;
}
const idle$1 = {
  type: "IDLE"
};
function getCaptureBindings(_e) {
  let {
    cancel: Qt,
    completed: Zt,
    getPhase: $n,
    setPhase: Sn
  } = _e;
  return [{
    eventName: "mousemove",
    fn: (kn) => {
      const {
        button: Kn,
        clientX: er,
        clientY: Cr
      } = kn;
      if (Kn !== primaryButton)
        return;
      const kr = {
        x: er,
        y: Cr
      }, Yr = $n();
      if (Yr.type === "DRAGGING") {
        kn.preventDefault(), Yr.actions.move(kr);
        return;
      }
      Yr.type !== "PENDING" && invariant(!1);
      const Ms = Yr.point;
      if (!isSloppyClickThresholdExceeded(Ms, kr))
        return;
      kn.preventDefault();
      const Ds = Yr.actions.fluidLift(kr);
      Sn({
        type: "DRAGGING",
        actions: Ds
      });
    }
  }, {
    eventName: "mouseup",
    fn: (kn) => {
      const Kn = $n();
      if (Kn.type !== "DRAGGING") {
        Qt();
        return;
      }
      kn.preventDefault(), Kn.actions.drop({
        shouldBlockNextClick: !0
      }), Zt();
    }
  }, {
    eventName: "mousedown",
    fn: (kn) => {
      $n().type === "DRAGGING" && kn.preventDefault(), Qt();
    }
  }, {
    eventName: "keydown",
    fn: (kn) => {
      if ($n().type === "PENDING") {
        Qt();
        return;
      }
      if (kn.keyCode === escape$1) {
        kn.preventDefault(), Qt();
        return;
      }
      preventStandardKeyEvents(kn);
    }
  }, {
    eventName: "resize",
    fn: Qt
  }, {
    eventName: "scroll",
    options: {
      passive: !0,
      capture: !1
    },
    fn: () => {
      $n().type === "PENDING" && Qt();
    }
  }, {
    eventName: "webkitmouseforcedown",
    fn: (kn) => {
      const Kn = $n();
      if (Kn.type === "IDLE" && invariant(!1), Kn.actions.shouldRespectForcePress()) {
        Qt();
        return;
      }
      kn.preventDefault();
    }
  }, {
    eventName: supportedPageVisibilityEventName,
    fn: Qt
  }];
}
function useMouseSensor(_e) {
  const Qt = reactExports.useRef(idle$1), Zt = reactExports.useRef(noop$2), $n = useMemo(() => ({
    eventName: "mousedown",
    fn: function(Ms) {
      if (Ms.defaultPrevented || Ms.button !== primaryButton || Ms.ctrlKey || Ms.metaKey || Ms.shiftKey || Ms.altKey)
        return;
      const Ds = _e.findClosestDraggableId(Ms);
      if (!Ds)
        return;
      const Ls = _e.tryGetLock(Ds, Kn, {
        sourceEvent: Ms
      });
      if (!Ls)
        return;
      Ms.preventDefault();
      const js = {
        x: Ms.clientX,
        y: Ms.clientY
      };
      Zt.current(), kr(Ls, js);
    }
  }), [_e]), Sn = useMemo(() => ({
    eventName: "webkitmouseforcewillbegin",
    fn: (Yr) => {
      if (Yr.defaultPrevented)
        return;
      const Ms = _e.findClosestDraggableId(Yr);
      if (!Ms)
        return;
      const Ds = _e.findOptionsForDraggable(Ms);
      Ds && (Ds.shouldRespectForcePress || _e.canGetLock(Ms) && Yr.preventDefault());
    }
  }), [_e]), kn = useCallback(function() {
    const Ms = {
      passive: !1,
      capture: !0
    };
    Zt.current = bindEvents(window, [Sn, $n], Ms);
  }, [Sn, $n]), Kn = useCallback(() => {
    Qt.current.type !== "IDLE" && (Qt.current = idle$1, Zt.current(), kn());
  }, [kn]), er = useCallback(() => {
    const Yr = Qt.current;
    Kn(), Yr.type === "DRAGGING" && Yr.actions.cancel({
      shouldBlockNextClick: !0
    }), Yr.type === "PENDING" && Yr.actions.abort();
  }, [Kn]), Cr = useCallback(function() {
    const Ms = {
      capture: !0,
      passive: !1
    }, Ds = getCaptureBindings({
      cancel: er,
      completed: Kn,
      getPhase: () => Qt.current,
      setPhase: (Ls) => {
        Qt.current = Ls;
      }
    });
    Zt.current = bindEvents(window, Ds, Ms);
  }, [er, Kn]), kr = useCallback(function(Ms, Ds) {
    Qt.current.type !== "IDLE" && invariant(!1), Qt.current = {
      type: "PENDING",
      point: Ds,
      actions: Ms
    }, Cr();
  }, [Cr]);
  useLayoutEffect(function() {
    return kn(), function() {
      Zt.current();
    };
  }, [kn]);
}
function noop$1() {
}
const scrollJumpKeys = {
  [pageDown]: !0,
  [pageUp]: !0,
  [home]: !0,
  [end]: !0
};
function getDraggingBindings(_e, Qt) {
  function Zt() {
    Qt(), _e.cancel();
  }
  function $n() {
    Qt(), _e.drop();
  }
  return [{
    eventName: "keydown",
    fn: (Sn) => {
      if (Sn.keyCode === escape$1) {
        Sn.preventDefault(), Zt();
        return;
      }
      if (Sn.keyCode === space) {
        Sn.preventDefault(), $n();
        return;
      }
      if (Sn.keyCode === arrowDown) {
        Sn.preventDefault(), _e.moveDown();
        return;
      }
      if (Sn.keyCode === arrowUp) {
        Sn.preventDefault(), _e.moveUp();
        return;
      }
      if (Sn.keyCode === arrowRight) {
        Sn.preventDefault(), _e.moveRight();
        return;
      }
      if (Sn.keyCode === arrowLeft) {
        Sn.preventDefault(), _e.moveLeft();
        return;
      }
      if (scrollJumpKeys[Sn.keyCode]) {
        Sn.preventDefault();
        return;
      }
      preventStandardKeyEvents(Sn);
    }
  }, {
    eventName: "mousedown",
    fn: Zt
  }, {
    eventName: "mouseup",
    fn: Zt
  }, {
    eventName: "click",
    fn: Zt
  }, {
    eventName: "touchstart",
    fn: Zt
  }, {
    eventName: "resize",
    fn: Zt
  }, {
    eventName: "wheel",
    fn: Zt,
    options: {
      passive: !0
    }
  }, {
    eventName: supportedPageVisibilityEventName,
    fn: Zt
  }];
}
function useKeyboardSensor(_e) {
  const Qt = reactExports.useRef(noop$1), Zt = useMemo(() => ({
    eventName: "keydown",
    fn: function(kn) {
      if (kn.defaultPrevented || kn.keyCode !== space)
        return;
      const Kn = _e.findClosestDraggableId(kn);
      if (!Kn)
        return;
      const er = _e.tryGetLock(Kn, Yr, {
        sourceEvent: kn
      });
      if (!er)
        return;
      kn.preventDefault();
      let Cr = !0;
      const kr = er.snapLift();
      Qt.current();
      function Yr() {
        Cr || invariant(!1), Cr = !1, Qt.current(), $n();
      }
      Qt.current = bindEvents(window, getDraggingBindings(kr, Yr), {
        capture: !0,
        passive: !1
      });
    }
  }), [_e]), $n = useCallback(function() {
    const kn = {
      passive: !1,
      capture: !0
    };
    Qt.current = bindEvents(window, [Zt], kn);
  }, [Zt]);
  useLayoutEffect(function() {
    return $n(), function() {
      Qt.current();
    };
  }, [$n]);
}
const idle = {
  type: "IDLE"
}, timeForLongPress = 120, forcePressThreshold = 0.15;
function getWindowBindings(_e) {
  let {
    cancel: Qt,
    getPhase: Zt
  } = _e;
  return [{
    eventName: "orientationchange",
    fn: Qt
  }, {
    eventName: "resize",
    fn: Qt
  }, {
    eventName: "contextmenu",
    fn: ($n) => {
      $n.preventDefault();
    }
  }, {
    eventName: "keydown",
    fn: ($n) => {
      if (Zt().type !== "DRAGGING") {
        Qt();
        return;
      }
      $n.keyCode === escape$1 && $n.preventDefault(), Qt();
    }
  }, {
    eventName: supportedPageVisibilityEventName,
    fn: Qt
  }];
}
function getHandleBindings(_e) {
  let {
    cancel: Qt,
    completed: Zt,
    getPhase: $n
  } = _e;
  return [{
    eventName: "touchmove",
    options: {
      capture: !1
    },
    fn: (Sn) => {
      const kn = $n();
      if (kn.type !== "DRAGGING") {
        Qt();
        return;
      }
      kn.hasMoved = !0;
      const {
        clientX: Kn,
        clientY: er
      } = Sn.touches[0], Cr = {
        x: Kn,
        y: er
      };
      Sn.preventDefault(), kn.actions.move(Cr);
    }
  }, {
    eventName: "touchend",
    fn: (Sn) => {
      const kn = $n();
      if (kn.type !== "DRAGGING") {
        Qt();
        return;
      }
      Sn.preventDefault(), kn.actions.drop({
        shouldBlockNextClick: !0
      }), Zt();
    }
  }, {
    eventName: "touchcancel",
    fn: (Sn) => {
      if ($n().type !== "DRAGGING") {
        Qt();
        return;
      }
      Sn.preventDefault(), Qt();
    }
  }, {
    eventName: "touchforcechange",
    fn: (Sn) => {
      const kn = $n();
      kn.type === "IDLE" && invariant(!1);
      const Kn = Sn.touches[0];
      if (!Kn || !(Kn.force >= forcePressThreshold))
        return;
      const Cr = kn.actions.shouldRespectForcePress();
      if (kn.type === "PENDING") {
        Cr && Qt();
        return;
      }
      if (Cr) {
        if (kn.hasMoved) {
          Sn.preventDefault();
          return;
        }
        Qt();
        return;
      }
      Sn.preventDefault();
    }
  }, {
    eventName: supportedPageVisibilityEventName,
    fn: Qt
  }];
}
function useTouchSensor(_e) {
  const Qt = reactExports.useRef(idle), Zt = reactExports.useRef(noop$2), $n = useCallback(function() {
    return Qt.current;
  }, []), Sn = useCallback(function(Ls) {
    Qt.current = Ls;
  }, []), kn = useMemo(() => ({
    eventName: "touchstart",
    fn: function(Ls) {
      if (Ls.defaultPrevented)
        return;
      const js = _e.findClosestDraggableId(Ls);
      if (!js)
        return;
      const zs = _e.tryGetLock(js, er, {
        sourceEvent: Ls
      });
      if (!zs)
        return;
      const Fs = Ls.touches[0], {
        clientX: Bs,
        clientY: Hs
      } = Fs, Ws = {
        x: Bs,
        y: Hs
      };
      Zt.current(), Ms(zs, Ws);
    }
  }), [_e]), Kn = useCallback(function() {
    const Ls = {
      capture: !0,
      passive: !1
    };
    Zt.current = bindEvents(window, [kn], Ls);
  }, [kn]), er = useCallback(() => {
    const Ds = Qt.current;
    Ds.type !== "IDLE" && (Ds.type === "PENDING" && clearTimeout(Ds.longPressTimerId), Sn(idle), Zt.current(), Kn());
  }, [Kn, Sn]), Cr = useCallback(() => {
    const Ds = Qt.current;
    er(), Ds.type === "DRAGGING" && Ds.actions.cancel({
      shouldBlockNextClick: !0
    }), Ds.type === "PENDING" && Ds.actions.abort();
  }, [er]), kr = useCallback(function() {
    const Ls = {
      capture: !0,
      passive: !1
    }, js = {
      cancel: Cr,
      completed: er,
      getPhase: $n
    }, zs = bindEvents(window, getHandleBindings(js), Ls), Fs = bindEvents(window, getWindowBindings(js), Ls);
    Zt.current = function() {
      zs(), Fs();
    };
  }, [Cr, $n, er]), Yr = useCallback(function() {
    const Ls = $n();
    Ls.type !== "PENDING" && invariant(!1);
    const js = Ls.actions.fluidLift(Ls.point);
    Sn({
      type: "DRAGGING",
      actions: js,
      hasMoved: !1
    });
  }, [$n, Sn]), Ms = useCallback(function(Ls, js) {
    $n().type !== "IDLE" && invariant(!1);
    const zs = setTimeout(Yr, timeForLongPress);
    Sn({
      type: "PENDING",
      point: js,
      actions: Ls,
      longPressTimerId: zs
    }), kr();
  }, [kr, $n, Sn, Yr]);
  useLayoutEffect(function() {
    return Kn(), function() {
      Zt.current();
      const js = $n();
      js.type === "PENDING" && (clearTimeout(js.longPressTimerId), Sn(idle));
    };
  }, [$n, Kn, Sn]), useLayoutEffect(function() {
    return bindEvents(window, [{
      eventName: "touchmove",
      fn: () => {
      },
      options: {
        capture: !1,
        passive: !1
      }
    }]);
  }, []);
}
const interactiveTagNames = ["input", "button", "textarea", "select", "option", "optgroup", "video", "audio"];
function isAnInteractiveElement(_e, Qt) {
  if (Qt == null)
    return !1;
  if (interactiveTagNames.includes(Qt.tagName.toLowerCase()))
    return !0;
  const $n = Qt.getAttribute("contenteditable");
  return $n === "true" || $n === "" ? !0 : Qt === _e ? !1 : isAnInteractiveElement(_e, Qt.parentElement);
}
function isEventInInteractiveElement(_e, Qt) {
  const Zt = Qt.target;
  return isHtmlElement(Zt) ? isAnInteractiveElement(_e, Zt) : !1;
}
var getBorderBoxCenterPosition = (_e) => getRect(_e.getBoundingClientRect()).center;
function isElement(_e) {
  return _e instanceof getWindowFromEl(_e).Element;
}
const supportedMatchesName = (() => {
  const _e = "matches";
  return typeof document > "u" ? _e : [_e, "msMatchesSelector", "webkitMatchesSelector"].find(($n) => $n in Element.prototype) || _e;
})();
function closestPonyfill(_e, Qt) {
  return _e == null ? null : _e[supportedMatchesName](Qt) ? _e : closestPonyfill(_e.parentElement, Qt);
}
function closest(_e, Qt) {
  return _e.closest ? _e.closest(Qt) : closestPonyfill(_e, Qt);
}
function getSelector(_e) {
  return `[${dragHandle.contextId}="${_e}"]`;
}
function findClosestDragHandleFromEvent(_e, Qt) {
  const Zt = Qt.target;
  if (!isElement(Zt))
    return null;
  const $n = getSelector(_e), Sn = closest(Zt, $n);
  return !Sn || !isHtmlElement(Sn) ? null : Sn;
}
function tryGetClosestDraggableIdFromEvent(_e, Qt) {
  const Zt = findClosestDragHandleFromEvent(_e, Qt);
  return Zt ? Zt.getAttribute(dragHandle.draggableId) : null;
}
function findDraggable(_e, Qt) {
  const Zt = `[${draggable.contextId}="${_e}"]`, Sn = querySelectorAll(document, Zt).find((kn) => kn.getAttribute(draggable.id) === Qt);
  return !Sn || !isHtmlElement(Sn) ? null : Sn;
}
function preventDefault(_e) {
  _e.preventDefault();
}
function isActive(_e) {
  let {
    expected: Qt,
    phase: Zt,
    isLockActive: $n,
    shouldWarn: Sn
  } = _e;
  return !(!$n() || Qt !== Zt);
}
function canStart(_e) {
  let {
    lockAPI: Qt,
    store: Zt,
    registry: $n,
    draggableId: Sn
  } = _e;
  if (Qt.isClaimed())
    return !1;
  const kn = $n.draggable.findById(Sn);
  return !(!kn || !kn.options.isEnabled || !canStartDrag(Zt.getState(), Sn));
}
function tryStart(_e) {
  let {
    lockAPI: Qt,
    contextId: Zt,
    store: $n,
    registry: Sn,
    draggableId: kn,
    forceSensorStop: Kn,
    sourceEvent: er
  } = _e;
  if (!canStart({
    lockAPI: Qt,
    store: $n,
    registry: Sn,
    draggableId: kn
  }))
    return null;
  const kr = Sn.draggable.getById(kn), Yr = findDraggable(Zt, kr.descriptor.id);
  if (!Yr || er && !kr.options.canDragInteractiveElements && isEventInInteractiveElement(Yr, er))
    return null;
  const Ms = Qt.claim(Kn || noop$2);
  let Ds = "PRE_DRAG";
  function Ls() {
    return kr.options.shouldRespectForcePress;
  }
  function js() {
    return Qt.isActive(Ms);
  }
  function zs(Mu, Pl) {
    isActive({
      expected: Mu,
      phase: Ds,
      isLockActive: js,
      shouldWarn: !0
    }) && $n.dispatch(Pl());
  }
  const Fs = zs.bind(null, "DRAGGING");
  function Bs(Mu) {
    function Pl() {
      Qt.release(), Ds = "COMPLETED";
    }
    Ds !== "PRE_DRAG" && (Pl(), invariant(!1)), $n.dispatch(lift$1(Mu.liftActionArgs)), Ds = "DRAGGING";
    function Iu(Tu, Au) {
      if (Au === void 0 && (Au = {
        shouldBlockNextClick: !1
      }), Mu.cleanup(), Au.shouldBlockNextClick) {
        const Nu = bindEvents(window, [{
          eventName: "click",
          fn: preventDefault,
          options: {
            once: !0,
            passive: !1,
            capture: !0
          }
        }]);
        setTimeout(Nu);
      }
      Pl(), $n.dispatch(drop$1({
        reason: Tu
      }));
    }
    return {
      isActive: () => isActive({
        expected: "DRAGGING",
        phase: Ds,
        isLockActive: js,
        shouldWarn: !1
      }),
      shouldRespectForcePress: Ls,
      drop: (Tu) => Iu("DROP", Tu),
      cancel: (Tu) => Iu("CANCEL", Tu),
      ...Mu.actions
    };
  }
  function Hs(Mu) {
    const Pl = rafSchd$1((Tu) => {
      Fs(() => move({
        client: Tu
      }));
    });
    return {
      ...Bs({
        liftActionArgs: {
          id: kn,
          clientSelection: Mu,
          movementMode: "FLUID"
        },
        cleanup: () => Pl.cancel(),
        actions: {
          move: Pl
        }
      }),
      move: Pl
    };
  }
  function Ws() {
    const Mu = {
      moveUp: () => Fs(moveUp),
      moveRight: () => Fs(moveRight),
      moveDown: () => Fs(moveDown),
      moveLeft: () => Fs(moveLeft)
    };
    return Bs({
      liftActionArgs: {
        id: kn,
        clientSelection: getBorderBoxCenterPosition(Yr),
        movementMode: "SNAP"
      },
      cleanup: noop$2,
      actions: Mu
    });
  }
  function Ys() {
    isActive({
      expected: "PRE_DRAG",
      phase: Ds,
      isLockActive: js,
      shouldWarn: !0
    }) && Qt.release();
  }
  return {
    isActive: () => isActive({
      expected: "PRE_DRAG",
      phase: Ds,
      isLockActive: js,
      shouldWarn: !1
    }),
    shouldRespectForcePress: Ls,
    fluidLift: Hs,
    snapLift: Ws,
    abort: Ys
  };
}
const defaultSensors = [useMouseSensor, useKeyboardSensor, useTouchSensor];
function useSensorMarshal(_e) {
  let {
    contextId: Qt,
    store: Zt,
    registry: $n,
    customSensors: Sn,
    enableDefaultSensors: kn
  } = _e;
  const Kn = [...kn ? defaultSensors : [], ...Sn || []], er = reactExports.useState(() => create$1())[0], Cr = useCallback(function(Bs, Hs) {
    isDragging(Bs) && !isDragging(Hs) && er.tryAbandon();
  }, [er]);
  useLayoutEffect(function() {
    let Bs = Zt.getState();
    return Zt.subscribe(() => {
      const Ws = Zt.getState();
      Cr(Bs, Ws), Bs = Ws;
    });
  }, [er, Zt, Cr]), useLayoutEffect(() => er.tryAbandon, [er.tryAbandon]);
  const kr = useCallback((Fs) => canStart({
    lockAPI: er,
    registry: $n,
    store: Zt,
    draggableId: Fs
  }), [er, $n, Zt]), Yr = useCallback((Fs, Bs, Hs) => tryStart({
    lockAPI: er,
    registry: $n,
    contextId: Qt,
    store: Zt,
    draggableId: Fs,
    forceSensorStop: Bs || null,
    sourceEvent: Hs && Hs.sourceEvent ? Hs.sourceEvent : null
  }), [Qt, er, $n, Zt]), Ms = useCallback((Fs) => tryGetClosestDraggableIdFromEvent(Qt, Fs), [Qt]), Ds = useCallback((Fs) => {
    const Bs = $n.draggable.findById(Fs);
    return Bs ? Bs.options : null;
  }, [$n.draggable]), Ls = useCallback(function() {
    er.isClaimed() && (er.tryAbandon(), Zt.getState().phase !== "IDLE" && Zt.dispatch(flush()));
  }, [er, Zt]), js = useCallback(() => er.isClaimed(), [er]), zs = useMemo(() => ({
    canGetLock: kr,
    tryGetLock: Yr,
    findClosestDraggableId: Ms,
    findOptionsForDraggable: Ds,
    tryReleaseLock: Ls,
    isLockClaimed: js
  }), [kr, Yr, Ms, Ds, Ls, js]);
  for (let Fs = 0; Fs < Kn.length; Fs++)
    Kn[Fs](zs);
}
const createResponders = (_e) => ({
  onBeforeCapture: (Qt) => {
    const Zt = () => {
      _e.onBeforeCapture && _e.onBeforeCapture(Qt);
    };
    React.version.startsWith("16") || React.version.startsWith("17") ? Zt() : reactDomExports.flushSync(Zt);
  },
  onBeforeDragStart: _e.onBeforeDragStart,
  onDragStart: _e.onDragStart,
  onDragEnd: _e.onDragEnd,
  onDragUpdate: _e.onDragUpdate
}), createAutoScrollerOptions = (_e) => ({
  ...defaultAutoScrollerOptions,
  ..._e.autoScrollerOptions,
  durationDampening: {
    ...defaultAutoScrollerOptions.durationDampening,
    ..._e.autoScrollerOptions
  }
});
function getStore(_e) {
  return _e.current || invariant(!1), _e.current;
}
function App(_e) {
  const {
    contextId: Qt,
    setCallbacks: Zt,
    sensors: $n,
    nonce: Sn,
    dragHandleUsageInstructions: kn
  } = _e, Kn = reactExports.useRef(null), er = usePrevious(_e), Cr = useCallback(() => createResponders(er.current), [er]), kr = useCallback(() => createAutoScrollerOptions(er.current), [er]), Yr = useAnnouncer(Qt), Ms = useHiddenTextElement({
    contextId: Qt,
    text: kn
  }), Ds = useStyleMarshal(Qt, Sn), Ls = useCallback((Au) => {
    getStore(Kn).dispatch(Au);
  }, []), js = useMemo(() => bindActionCreators$1({
    publishWhileDragging,
    updateDroppableScroll,
    updateDroppableIsEnabled,
    updateDroppableIsCombineEnabled,
    collectionStarting
  }, Ls), [Ls]), zs = useRegistry(), Fs = useMemo(() => createDimensionMarshal(zs, js), [zs, js]), Bs = useMemo(() => createAutoScroller({
    scrollWindow,
    scrollDroppable: Fs.scrollDroppable,
    getAutoScrollerOptions: kr,
    ...bindActionCreators$1({
      move
    }, Ls)
  }), [Fs.scrollDroppable, Ls, kr]), Hs = useFocusMarshal(Qt), Ws = useMemo(() => createStore({
    announce: Yr,
    autoScroller: Bs,
    dimensionMarshal: Fs,
    focusMarshal: Hs,
    getResponders: Cr,
    styleMarshal: Ds
  }), [Yr, Bs, Fs, Hs, Cr, Ds]);
  Kn.current = Ws;
  const Ys = useCallback(() => {
    const Au = getStore(Kn);
    Au.getState().phase !== "IDLE" && Au.dispatch(flush());
  }, []), El = useCallback(() => {
    const Au = getStore(Kn).getState();
    return Au.phase === "DROP_ANIMATING" ? !0 : Au.phase === "IDLE" ? !1 : Au.isDragging;
  }, []), Mu = useMemo(() => ({
    isDragging: El,
    tryAbort: Ys
  }), [El, Ys]);
  Zt(Mu);
  const Pl = useCallback((Au) => canStartDrag(getStore(Kn).getState(), Au), []), Iu = useCallback(() => isMovementAllowed(getStore(Kn).getState()), []), Tu = useMemo(() => ({
    marshal: Fs,
    focus: Hs,
    contextId: Qt,
    canLift: Pl,
    isMovementAllowed: Iu,
    dragHandleUsageInstructionsId: Ms,
    registry: zs
  }), [Qt, Fs, Ms, Hs, Pl, Iu, zs]);
  return useSensorMarshal({
    contextId: Qt,
    store: Ws,
    registry: zs,
    customSensors: $n || null,
    enableDefaultSensors: _e.enableDefaultSensors !== !1
  }), reactExports.useEffect(() => Ys, [Ys]), React.createElement(AppContext.Provider, {
    value: Tu
  }, React.createElement(Provider, {
    context: StoreContext,
    store: Ws
  }, _e.children));
}
let count = 0;
function useDeprecatedUniqueContextId() {
  return useMemo(() => `${count++}`, []);
}
function useUniqueContextId() {
  return React.useId();
}
var useUniqueContextId$1 = "useId" in React ? useUniqueContextId : useDeprecatedUniqueContextId;
function DragDropContext(_e) {
  const Qt = useUniqueContextId$1(), Zt = _e.dragHandleUsageInstructions || preset$1.dragHandleUsageInstructions;
  return React.createElement(ErrorBoundary, null, ($n) => React.createElement(App, {
    nonce: _e.nonce,
    contextId: Qt,
    setCallbacks: $n,
    dragHandleUsageInstructions: Zt,
    enableDefaultSensors: _e.enableDefaultSensors,
    sensors: _e.sensors,
    onBeforeCapture: _e.onBeforeCapture,
    onBeforeDragStart: _e.onBeforeDragStart,
    onDragStart: _e.onDragStart,
    onDragUpdate: _e.onDragUpdate,
    onDragEnd: _e.onDragEnd,
    autoScrollerOptions: _e.autoScrollerOptions
  }, _e.children));
}
const zIndexOptions = {
  dragging: 5e3,
  dropAnimating: 4500
}, getDraggingTransition = (_e, Qt) => Qt ? transitions.drop(Qt.duration) : _e ? transitions.snap : transitions.fluid, getDraggingOpacity = (_e, Qt) => {
  if (_e)
    return Qt ? combine.opacity.drop : combine.opacity.combining;
}, getShouldDraggingAnimate = (_e) => _e.forceShouldAnimate != null ? _e.forceShouldAnimate : _e.mode === "SNAP";
function getDraggingStyle(_e) {
  const Zt = _e.dimension.client, {
    offset: $n,
    combineWith: Sn,
    dropping: kn
  } = _e, Kn = !!Sn, er = getShouldDraggingAnimate(_e), Cr = !!kn, kr = Cr ? transforms.drop($n, Kn) : transforms.moveTo($n);
  return {
    position: "fixed",
    top: Zt.marginBox.top,
    left: Zt.marginBox.left,
    boxSizing: "border-box",
    width: Zt.borderBox.width,
    height: Zt.borderBox.height,
    transition: getDraggingTransition(er, kn),
    transform: kr,
    opacity: getDraggingOpacity(Kn, Cr),
    zIndex: Cr ? zIndexOptions.dropAnimating : zIndexOptions.dragging,
    pointerEvents: "none"
  };
}
function getSecondaryStyle(_e) {
  return {
    transform: transforms.moveTo(_e.offset),
    transition: _e.shouldAnimateDisplacement ? void 0 : "none"
  };
}
function getStyle$1(_e) {
  return _e.type === "DRAGGING" ? getDraggingStyle(_e) : getSecondaryStyle(_e);
}
function getDimension$1(_e, Qt, Zt) {
  Zt === void 0 && (Zt = origin);
  const $n = window.getComputedStyle(Qt), Sn = Qt.getBoundingClientRect(), kn = calculateBox(Sn, $n), Kn = withScroll(kn, Zt), er = {
    client: kn,
    tagName: Qt.tagName.toLowerCase(),
    display: $n.display
  }, Cr = {
    x: kn.marginBox.width,
    y: kn.marginBox.height
  };
  return {
    descriptor: _e,
    placeholder: er,
    displaceBy: Cr,
    client: kn,
    page: Kn
  };
}
function useDraggablePublisher(_e) {
  const Qt = useUniqueId$1("draggable"), {
    descriptor: Zt,
    registry: $n,
    getDraggableRef: Sn,
    canDragInteractiveElements: kn,
    shouldRespectForcePress: Kn,
    isEnabled: er
  } = _e, Cr = useMemo(() => ({
    canDragInteractiveElements: kn,
    shouldRespectForcePress: Kn,
    isEnabled: er
  }), [kn, er, Kn]), kr = useCallback((Ls) => {
    const js = Sn();
    return js || invariant(!1), getDimension$1(Zt, js, Ls);
  }, [Zt, Sn]), Yr = useMemo(() => ({
    uniqueId: Qt,
    descriptor: Zt,
    options: Cr,
    getDimension: kr
  }), [Zt, kr, Cr, Qt]), Ms = reactExports.useRef(Yr), Ds = reactExports.useRef(!0);
  useLayoutEffect(() => ($n.draggable.register(Ms.current), () => $n.draggable.unregister(Ms.current)), [$n.draggable]), useLayoutEffect(() => {
    if (Ds.current) {
      Ds.current = !1;
      return;
    }
    const Ls = Ms.current;
    Ms.current = Yr, $n.draggable.update(Yr, Ls);
  }, [Yr, $n.draggable]);
}
var DroppableContext = React.createContext(null);
function useRequiredContext(_e) {
  const Qt = reactExports.useContext(_e);
  return Qt || invariant(!1), Qt;
}
function preventHtml5Dnd(_e) {
  _e.preventDefault();
}
const Draggable = (_e) => {
  const Qt = reactExports.useRef(null), Zt = useCallback(function(Mu) {
    Mu === void 0 && (Mu = null), Qt.current = Mu;
  }, []), $n = useCallback(() => Qt.current, []), {
    contextId: Sn,
    dragHandleUsageInstructionsId: kn,
    registry: Kn
  } = useRequiredContext(AppContext), {
    type: er,
    droppableId: Cr
  } = useRequiredContext(DroppableContext), kr = useMemo(() => ({
    id: _e.draggableId,
    index: _e.index,
    type: er,
    droppableId: Cr
  }), [_e.draggableId, _e.index, er, Cr]), {
    children: Yr,
    draggableId: Ms,
    isEnabled: Ds,
    shouldRespectForcePress: Ls,
    canDragInteractiveElements: js,
    isClone: zs,
    mapped: Fs,
    dropAnimationFinished: Bs
  } = _e;
  if (!zs) {
    const Mu = useMemo(() => ({
      descriptor: kr,
      registry: Kn,
      getDraggableRef: $n,
      canDragInteractiveElements: js,
      shouldRespectForcePress: Ls,
      isEnabled: Ds
    }), [kr, Kn, $n, js, Ls, Ds]);
    useDraggablePublisher(Mu);
  }
  const Hs = useMemo(() => Ds ? {
    tabIndex: 0,
    role: "button",
    "aria-describedby": kn,
    "data-rfd-drag-handle-draggable-id": Ms,
    "data-rfd-drag-handle-context-id": Sn,
    draggable: !1,
    onDragStart: preventHtml5Dnd
  } : null, [Sn, kn, Ms, Ds]), Ws = useCallback((Mu) => {
    Fs.type === "DRAGGING" && Fs.dropping && Mu.propertyName === "transform" && (React.version.startsWith("16") || React.version.startsWith("17") ? Bs() : reactDomExports.flushSync(Bs));
  }, [Bs, Fs]), Ys = useMemo(() => {
    const Mu = getStyle$1(Fs), Pl = Fs.type === "DRAGGING" && Fs.dropping ? Ws : void 0;
    return {
      innerRef: Zt,
      draggableProps: {
        "data-rfd-draggable-context-id": Sn,
        "data-rfd-draggable-id": Ms,
        style: Mu,
        onTransitionEnd: Pl
      },
      dragHandleProps: Hs
    };
  }, [Sn, Hs, Ms, Fs, Ws, Zt]), El = useMemo(() => ({
    draggableId: kr.id,
    type: kr.type,
    source: {
      index: kr.index,
      droppableId: kr.droppableId
    }
  }), [kr.droppableId, kr.id, kr.index, kr.type]);
  return React.createElement(React.Fragment, null, Yr(Ys, Fs.snapshot, El));
};
var Draggable$1 = Draggable, isStrictEqual = (_e, Qt) => _e === Qt, whatIsDraggedOverFromResult = (_e) => {
  const {
    combine: Qt,
    destination: Zt
  } = _e;
  return Zt ? Zt.droppableId : Qt ? Qt.droppableId : null;
};
const getCombineWithFromResult = (_e) => _e.combine ? _e.combine.draggableId : null, getCombineWithFromImpact = (_e) => _e.at && _e.at.type === "COMBINE" ? _e.at.combine.draggableId : null;
function getDraggableSelector() {
  const _e = memoizeOne((Sn, kn) => ({
    x: Sn,
    y: kn
  })), Qt = memoizeOne(function(Sn, kn, Kn, er, Cr) {
    return Kn === void 0 && (Kn = null), er === void 0 && (er = null), Cr === void 0 && (Cr = null), {
      isDragging: !0,
      isClone: kn,
      isDropAnimating: !!Cr,
      dropAnimation: Cr,
      mode: Sn,
      draggingOver: Kn,
      combineWith: er,
      combineTargetFor: null
    };
  }), Zt = memoizeOne(function(Sn, kn, Kn, er, Cr, kr, Yr) {
    return Cr === void 0 && (Cr = null), kr === void 0 && (kr = null), Yr === void 0 && (Yr = null), {
      mapped: {
        type: "DRAGGING",
        dropping: null,
        draggingOver: Cr,
        combineWith: kr,
        mode: kn,
        offset: Sn,
        dimension: Kn,
        forceShouldAnimate: Yr,
        snapshot: Qt(kn, er, Cr, kr, null)
      }
    };
  });
  return (Sn, kn) => {
    if (isDragging(Sn)) {
      if (Sn.critical.draggable.id !== kn.draggableId)
        return null;
      const Kn = Sn.current.client.offset, er = Sn.dimensions.draggables[kn.draggableId], Cr = whatIsDraggedOver(Sn.impact), kr = getCombineWithFromImpact(Sn.impact), Yr = Sn.forceShouldAnimate;
      return Zt(_e(Kn.x, Kn.y), Sn.movementMode, er, kn.isClone, Cr, kr, Yr);
    }
    if (Sn.phase === "DROP_ANIMATING") {
      const Kn = Sn.completed;
      if (Kn.result.draggableId !== kn.draggableId)
        return null;
      const er = kn.isClone, Cr = Sn.dimensions.draggables[kn.draggableId], kr = Kn.result, Yr = kr.mode, Ms = whatIsDraggedOverFromResult(kr), Ds = getCombineWithFromResult(kr), js = {
        duration: Sn.dropDuration,
        curve: curves.drop,
        moveTo: Sn.newHomeClientOffset,
        opacity: Ds ? combine.opacity.drop : null,
        scale: Ds ? combine.scale.drop : null
      };
      return {
        mapped: {
          type: "DRAGGING",
          offset: Sn.newHomeClientOffset,
          dimension: Cr,
          dropping: js,
          draggingOver: Ms,
          combineWith: Ds,
          mode: Yr,
          forceShouldAnimate: null,
          snapshot: Qt(Yr, er, Ms, Ds, js)
        }
      };
    }
    return null;
  };
}
function getSecondarySnapshot(_e) {
  return _e === void 0 && (_e = null), {
    isDragging: !1,
    isDropAnimating: !1,
    isClone: !1,
    dropAnimation: null,
    mode: null,
    draggingOver: null,
    combineTargetFor: _e,
    combineWith: null
  };
}
const atRest = {
  mapped: {
    type: "SECONDARY",
    offset: origin,
    combineTargetFor: null,
    shouldAnimateDisplacement: !0,
    snapshot: getSecondarySnapshot(null)
  }
};
function getSecondarySelector() {
  const _e = memoizeOne((Kn, er) => ({
    x: Kn,
    y: er
  })), Qt = memoizeOne(getSecondarySnapshot), Zt = memoizeOne(function(Kn, er, Cr) {
    return er === void 0 && (er = null), {
      mapped: {
        type: "SECONDARY",
        offset: Kn,
        combineTargetFor: er,
        shouldAnimateDisplacement: Cr,
        snapshot: Qt(er)
      }
    };
  }), $n = (Kn) => Kn ? Zt(origin, Kn, !0) : null, Sn = (Kn, er, Cr, kr) => {
    const Yr = Cr.displaced.visible[Kn], Ms = !!(kr.inVirtualList && kr.effected[Kn]), Ds = tryGetCombine(Cr), Ls = Ds && Ds.draggableId === Kn ? er : null;
    if (!Yr) {
      if (!Ms)
        return $n(Ls);
      if (Cr.displaced.invisible[Kn])
        return null;
      const Fs = negate(kr.displacedBy.point), Bs = _e(Fs.x, Fs.y);
      return Zt(Bs, Ls, !0);
    }
    if (Ms)
      return $n(Ls);
    const js = Cr.displacedBy.point, zs = _e(js.x, js.y);
    return Zt(zs, Ls, Yr.shouldAnimate);
  };
  return (Kn, er) => {
    if (isDragging(Kn))
      return Kn.critical.draggable.id === er.draggableId ? null : Sn(er.draggableId, Kn.critical.draggable.id, Kn.impact, Kn.afterCritical);
    if (Kn.phase === "DROP_ANIMATING") {
      const Cr = Kn.completed;
      return Cr.result.draggableId === er.draggableId ? null : Sn(er.draggableId, Cr.result.draggableId, Cr.impact, Cr.afterCritical);
    }
    return null;
  };
}
const makeMapStateToProps$1 = () => {
  const _e = getDraggableSelector(), Qt = getSecondarySelector();
  return ($n, Sn) => _e($n, Sn) || Qt($n, Sn) || atRest;
}, mapDispatchToProps$1 = {
  dropAnimationFinished
}, ConnectedDraggable = connect(makeMapStateToProps$1, mapDispatchToProps$1, null, {
  context: StoreContext,
  areStatePropsEqual: isStrictEqual
})(Draggable$1);
var ConnectedDraggable$1 = ConnectedDraggable;
function PrivateDraggable(_e) {
  return useRequiredContext(DroppableContext).isUsingCloneFor === _e.draggableId && !_e.isClone ? null : React.createElement(ConnectedDraggable$1, _e);
}
function PublicDraggable(_e) {
  const Qt = typeof _e.isDragDisabled == "boolean" ? !_e.isDragDisabled : !0, Zt = !!_e.disableInteractiveElementBlocking, $n = !!_e.shouldRespectForcePress;
  return React.createElement(PrivateDraggable, _extends$2({}, _e, {
    isClone: !1,
    isEnabled: Qt,
    canDragInteractiveElements: Zt,
    shouldRespectForcePress: $n
  }));
}
const isEqual = (_e) => (Qt) => _e === Qt, isScroll = isEqual("scroll"), isAuto = isEqual("auto"), isEither = (_e, Qt) => Qt(_e.overflowX) || Qt(_e.overflowY), isElementScrollable = (_e) => {
  const Qt = window.getComputedStyle(_e), Zt = {
    overflowX: Qt.overflowX,
    overflowY: Qt.overflowY
  };
  return isEither(Zt, isScroll) || isEither(Zt, isAuto);
}, isBodyScrollable = () => !1, getClosestScrollable = (_e) => _e == null ? null : _e === document.body ? isBodyScrollable() ? _e : null : _e === document.documentElement ? null : isElementScrollable(_e) ? _e : getClosestScrollable(_e.parentElement);
var getClosestScrollable$1 = getClosestScrollable, getScroll = (_e) => ({
  x: _e.scrollLeft,
  y: _e.scrollTop
});
const getIsFixed = (_e) => _e ? window.getComputedStyle(_e).position === "fixed" ? !0 : getIsFixed(_e.parentElement) : !1;
var getEnv = (_e) => {
  const Qt = getClosestScrollable$1(_e), Zt = getIsFixed(_e);
  return {
    closestScrollable: Qt,
    isFixedOnPage: Zt
  };
}, getDroppableDimension = (_e) => {
  let {
    descriptor: Qt,
    isEnabled: Zt,
    isCombineEnabled: $n,
    isFixedOnPage: Sn,
    direction: kn,
    client: Kn,
    page: er,
    closest: Cr
  } = _e;
  const kr = (() => {
    if (!Cr)
      return null;
    const {
      scrollSize: Ls,
      client: js
    } = Cr, zs = getMaxScroll({
      scrollHeight: Ls.scrollHeight,
      scrollWidth: Ls.scrollWidth,
      height: js.paddingBox.height,
      width: js.paddingBox.width
    });
    return {
      pageMarginBox: Cr.page.marginBox,
      frameClient: js,
      scrollSize: Ls,
      shouldClipSubject: Cr.shouldClipSubject,
      scroll: {
        initial: Cr.scroll,
        current: Cr.scroll,
        max: zs,
        diff: {
          value: origin,
          displacement: origin
        }
      }
    };
  })(), Yr = kn === "vertical" ? vertical : horizontal, Ms = getSubject({
    page: er,
    withPlaceholder: null,
    axis: Yr,
    frame: kr
  });
  return {
    descriptor: Qt,
    isCombineEnabled: $n,
    isFixedOnPage: Sn,
    axis: Yr,
    isEnabled: Zt,
    client: Kn,
    page: er,
    frame: kr,
    subject: Ms
  };
};
const getClient = (_e, Qt) => {
  const Zt = getBox(_e);
  if (!Qt || _e !== Qt)
    return Zt;
  const $n = Zt.paddingBox.top - Qt.scrollTop, Sn = Zt.paddingBox.left - Qt.scrollLeft, kn = $n + Qt.scrollHeight, Kn = Sn + Qt.scrollWidth, Cr = expand({
    top: $n,
    right: Kn,
    bottom: kn,
    left: Sn
  }, Zt.border);
  return createBox({
    borderBox: Cr,
    margin: Zt.margin,
    border: Zt.border,
    padding: Zt.padding
  });
};
var getDimension = (_e) => {
  let {
    ref: Qt,
    descriptor: Zt,
    env: $n,
    windowScroll: Sn,
    direction: kn,
    isDropDisabled: Kn,
    isCombineEnabled: er,
    shouldClipSubject: Cr
  } = _e;
  const kr = $n.closestScrollable, Yr = getClient(Qt, kr), Ms = withScroll(Yr, Sn), Ds = (() => {
    if (!kr)
      return null;
    const js = getBox(kr), zs = {
      scrollHeight: kr.scrollHeight,
      scrollWidth: kr.scrollWidth
    };
    return {
      client: js,
      page: withScroll(js, Sn),
      scroll: getScroll(kr),
      scrollSize: zs,
      shouldClipSubject: Cr
    };
  })();
  return getDroppableDimension({
    descriptor: Zt,
    isEnabled: !Kn,
    isCombineEnabled: er,
    isFixedOnPage: $n.isFixedOnPage,
    direction: kn,
    client: Yr,
    page: Ms,
    closest: Ds
  });
};
const immediate = {
  passive: !1
}, delayed = {
  passive: !0
};
var getListenerOptions = (_e) => _e.shouldPublishImmediately ? immediate : delayed;
const getClosestScrollableFromDrag = (_e) => _e && _e.env.closestScrollable || null;
function useDroppablePublisher(_e) {
  const Qt = reactExports.useRef(null), Zt = useRequiredContext(AppContext), $n = useUniqueId$1("droppable"), {
    registry: Sn,
    marshal: kn
  } = Zt, Kn = usePrevious(_e), er = useMemo(() => ({
    id: _e.droppableId,
    type: _e.type,
    mode: _e.mode
  }), [_e.droppableId, _e.mode, _e.type]), Cr = reactExports.useRef(er), kr = useMemo(() => memoizeOne((Ys, El) => {
    Qt.current || invariant(!1);
    const Mu = {
      x: Ys,
      y: El
    };
    kn.updateDroppableScroll(er.id, Mu);
  }), [er.id, kn]), Yr = useCallback(() => {
    const Ys = Qt.current;
    return !Ys || !Ys.env.closestScrollable ? origin : getScroll(Ys.env.closestScrollable);
  }, []), Ms = useCallback(() => {
    const Ys = Yr();
    kr(Ys.x, Ys.y);
  }, [Yr, kr]), Ds = useMemo(() => rafSchd$1(Ms), [Ms]), Ls = useCallback(() => {
    const Ys = Qt.current, El = getClosestScrollableFromDrag(Ys);
    if (Ys && El || invariant(!1), Ys.scrollOptions.shouldPublishImmediately) {
      Ms();
      return;
    }
    Ds();
  }, [Ds, Ms]), js = useCallback((Ys, El) => {
    Qt.current && invariant(!1);
    const Mu = Kn.current, Pl = Mu.getDroppableRef();
    Pl || invariant(!1);
    const Iu = getEnv(Pl), Tu = {
      ref: Pl,
      descriptor: er,
      env: Iu,
      scrollOptions: El
    };
    Qt.current = Tu;
    const Au = getDimension({
      ref: Pl,
      descriptor: er,
      env: Iu,
      windowScroll: Ys,
      direction: Mu.direction,
      isDropDisabled: Mu.isDropDisabled,
      isCombineEnabled: Mu.isCombineEnabled,
      shouldClipSubject: !Mu.ignoreContainerClipping
    }), Nu = Iu.closestScrollable;
    return Nu && (Nu.setAttribute(scrollContainer.contextId, Zt.contextId), Nu.addEventListener("scroll", Ls, getListenerOptions(Tu.scrollOptions))), Au;
  }, [Zt.contextId, er, Ls, Kn]), zs = useCallback(() => {
    const Ys = Qt.current, El = getClosestScrollableFromDrag(Ys);
    return Ys && El || invariant(!1), getScroll(El);
  }, []), Fs = useCallback(() => {
    const Ys = Qt.current;
    Ys || invariant(!1);
    const El = getClosestScrollableFromDrag(Ys);
    Qt.current = null, El && (Ds.cancel(), El.removeAttribute(scrollContainer.contextId), El.removeEventListener("scroll", Ls, getListenerOptions(Ys.scrollOptions)));
  }, [Ls, Ds]), Bs = useCallback((Ys) => {
    const El = Qt.current;
    El || invariant(!1);
    const Mu = getClosestScrollableFromDrag(El);
    Mu || invariant(!1), Mu.scrollTop += Ys.y, Mu.scrollLeft += Ys.x;
  }, []), Hs = useMemo(() => ({
    getDimensionAndWatchScroll: js,
    getScrollWhileDragging: zs,
    dragStopped: Fs,
    scroll: Bs
  }), [Fs, js, zs, Bs]), Ws = useMemo(() => ({
    uniqueId: $n,
    descriptor: er,
    callbacks: Hs
  }), [Hs, er, $n]);
  useLayoutEffect(() => (Cr.current = Ws.descriptor, Sn.droppable.register(Ws), () => {
    Qt.current && Fs(), Sn.droppable.unregister(Ws);
  }), [Hs, er, Fs, Ws, kn, Sn.droppable]), useLayoutEffect(() => {
    Qt.current && kn.updateDroppableIsEnabled(Cr.current.id, !_e.isDropDisabled);
  }, [_e.isDropDisabled, kn]), useLayoutEffect(() => {
    Qt.current && kn.updateDroppableIsCombineEnabled(Cr.current.id, _e.isCombineEnabled);
  }, [_e.isCombineEnabled, kn]);
}
function noop() {
}
const empty$1 = {
  width: 0,
  height: 0,
  margin: noSpacing
}, getSize = (_e) => {
  let {
    isAnimatingOpenOnMount: Qt,
    placeholder: Zt,
    animate: $n
  } = _e;
  return Qt || $n === "close" ? empty$1 : {
    height: Zt.client.borderBox.height,
    width: Zt.client.borderBox.width,
    margin: Zt.client.margin
  };
}, getStyle = (_e) => {
  let {
    isAnimatingOpenOnMount: Qt,
    placeholder: Zt,
    animate: $n
  } = _e;
  const Sn = getSize({
    isAnimatingOpenOnMount: Qt,
    placeholder: Zt,
    animate: $n
  });
  return {
    display: Zt.display,
    boxSizing: "border-box",
    width: Sn.width,
    height: Sn.height,
    marginTop: Sn.margin.top,
    marginRight: Sn.margin.right,
    marginBottom: Sn.margin.bottom,
    marginLeft: Sn.margin.left,
    flexShrink: "0",
    flexGrow: "0",
    pointerEvents: "none",
    transition: $n !== "none" ? transitions.placeholder : null
  };
}, Placeholder = (_e) => {
  const Qt = reactExports.useRef(null), Zt = useCallback(() => {
    Qt.current && (clearTimeout(Qt.current), Qt.current = null);
  }, []), {
    animate: $n,
    onTransitionEnd: Sn,
    onClose: kn,
    contextId: Kn
  } = _e, [er, Cr] = reactExports.useState(_e.animate === "open");
  reactExports.useEffect(() => er ? $n !== "open" ? (Zt(), Cr(!1), noop) : Qt.current ? noop : (Qt.current = setTimeout(() => {
    Qt.current = null, Cr(!1);
  }), Zt) : noop, [$n, er, Zt]);
  const kr = useCallback((Ms) => {
    Ms.propertyName === "height" && (Sn(), $n === "close" && kn());
  }, [$n, kn, Sn]), Yr = getStyle({
    isAnimatingOpenOnMount: er,
    animate: _e.animate,
    placeholder: _e.placeholder
  });
  return React.createElement(_e.placeholder.tagName, {
    style: Yr,
    "data-rfd-placeholder-context-id": Kn,
    onTransitionEnd: kr,
    ref: _e.innerRef
  });
};
var Placeholder$1 = React.memo(Placeholder);
class AnimateInOut extends React.PureComponent {
  constructor() {
    super(...arguments), this.state = {
      isVisible: !!this.props.on,
      data: this.props.on,
      animate: this.props.shouldAnimate && this.props.on ? "open" : "none"
    }, this.onClose = () => {
      this.state.animate === "close" && this.setState({
        isVisible: !1
      });
    };
  }
  static getDerivedStateFromProps(Qt, Zt) {
    return Qt.shouldAnimate ? Qt.on ? {
      isVisible: !0,
      data: Qt.on,
      animate: "open"
    } : Zt.isVisible ? {
      isVisible: !0,
      data: Zt.data,
      animate: "close"
    } : {
      isVisible: !1,
      animate: "close",
      data: null
    } : {
      isVisible: !!Qt.on,
      data: Qt.on,
      animate: "none"
    };
  }
  render() {
    if (!this.state.isVisible)
      return null;
    const Qt = {
      onClose: this.onClose,
      data: this.state.data,
      animate: this.state.animate
    };
    return this.props.children(Qt);
  }
}
const Droppable = (_e) => {
  const Qt = reactExports.useContext(AppContext);
  Qt || invariant(!1);
  const {
    contextId: Zt,
    isMovementAllowed: $n
  } = Qt, Sn = reactExports.useRef(null), kn = reactExports.useRef(null), {
    children: Kn,
    droppableId: er,
    type: Cr,
    mode: kr,
    direction: Yr,
    ignoreContainerClipping: Ms,
    isDropDisabled: Ds,
    isCombineEnabled: Ls,
    snapshot: js,
    useClone: zs,
    updateViewportMaxScroll: Fs,
    getContainerForClone: Bs
  } = _e, Hs = useCallback(() => Sn.current, []), Ws = useCallback(function(Nu) {
    Nu === void 0 && (Nu = null), Sn.current = Nu;
  }, []);
  useCallback(() => kn.current, []);
  const Ys = useCallback(function(Nu) {
    Nu === void 0 && (Nu = null), kn.current = Nu;
  }, []), El = useCallback(() => {
    $n() && Fs({
      maxScroll: getMaxWindowScroll()
    });
  }, [$n, Fs]);
  useDroppablePublisher({
    droppableId: er,
    type: Cr,
    mode: kr,
    direction: Yr,
    isDropDisabled: Ds,
    isCombineEnabled: Ls,
    ignoreContainerClipping: Ms,
    getDroppableRef: Hs
  });
  const Mu = useMemo(() => React.createElement(AnimateInOut, {
    on: _e.placeholder,
    shouldAnimate: _e.shouldAnimatePlaceholder
  }, (Nu) => {
    let {
      onClose: gm,
      data: pm,
      animate: zu
    } = Nu;
    return React.createElement(Placeholder$1, {
      placeholder: pm,
      onClose: gm,
      innerRef: Ys,
      animate: zu,
      contextId: Zt,
      onTransitionEnd: El
    });
  }), [Zt, El, _e.placeholder, _e.shouldAnimatePlaceholder, Ys]), Pl = useMemo(() => ({
    innerRef: Ws,
    placeholder: Mu,
    droppableProps: {
      "data-rfd-droppable-id": er,
      "data-rfd-droppable-context-id": Zt
    }
  }), [Zt, er, Mu, Ws]), Iu = zs ? zs.dragging.draggableId : null, Tu = useMemo(() => ({
    droppableId: er,
    type: Cr,
    isUsingCloneFor: Iu
  }), [er, Iu, Cr]);
  function Au() {
    if (!zs)
      return null;
    const {
      dragging: Nu,
      render: gm
    } = zs, pm = React.createElement(PrivateDraggable, {
      draggableId: Nu.draggableId,
      index: Nu.source.index,
      isClone: !0,
      isEnabled: !0,
      shouldRespectForcePress: !1,
      canDragInteractiveElements: !0
    }, (zu, Yu) => gm(zu, Yu, Nu));
    return Vu.createPortal(pm, Bs());
  }
  return React.createElement(DroppableContext.Provider, {
    value: Tu
  }, Kn(Pl, js), Au());
};
var Droppable$1 = Droppable;
function getBody() {
  return document.body || invariant(!1), document.body;
}
const defaultProps = {
  mode: "standard",
  type: "DEFAULT",
  direction: "vertical",
  isDropDisabled: !1,
  isCombineEnabled: !1,
  ignoreContainerClipping: !1,
  renderClone: null,
  getContainerForClone: getBody
}, attachDefaultPropsToOwnProps = (_e) => {
  let Qt = {
    ..._e
  }, Zt;
  for (Zt in defaultProps)
    _e[Zt] === void 0 && (Qt = {
      ...Qt,
      [Zt]: defaultProps[Zt]
    });
  return Qt;
}, isMatchingType = (_e, Qt) => _e === Qt.droppable.type, getDraggable = (_e, Qt) => Qt.draggables[_e.draggable.id], makeMapStateToProps = () => {
  const _e = {
    placeholder: null,
    shouldAnimatePlaceholder: !0,
    snapshot: {
      isDraggingOver: !1,
      draggingOverWith: null,
      draggingFromThisWith: null,
      isUsingPlaceholder: !1
    },
    useClone: null
  }, Qt = {
    ..._e,
    shouldAnimatePlaceholder: !1
  }, Zt = memoizeOne((kn) => ({
    draggableId: kn.id,
    type: kn.type,
    source: {
      index: kn.index,
      droppableId: kn.droppableId
    }
  })), $n = memoizeOne((kn, Kn, er, Cr, kr, Yr) => {
    const Ms = kr.descriptor.id;
    if (kr.descriptor.droppableId === kn) {
      const js = Yr ? {
        render: Yr,
        dragging: Zt(kr.descriptor)
      } : null, zs = {
        isDraggingOver: er,
        draggingOverWith: er ? Ms : null,
        draggingFromThisWith: Ms,
        isUsingPlaceholder: !0
      };
      return {
        placeholder: kr.placeholder,
        shouldAnimatePlaceholder: !1,
        snapshot: zs,
        useClone: js
      };
    }
    if (!Kn)
      return Qt;
    if (!Cr)
      return _e;
    const Ls = {
      isDraggingOver: er,
      draggingOverWith: Ms,
      draggingFromThisWith: null,
      isUsingPlaceholder: !0
    };
    return {
      placeholder: kr.placeholder,
      shouldAnimatePlaceholder: !0,
      snapshot: Ls,
      useClone: null
    };
  });
  return (kn, Kn) => {
    const er = attachDefaultPropsToOwnProps(Kn), Cr = er.droppableId, kr = er.type, Yr = !er.isDropDisabled, Ms = er.renderClone;
    if (isDragging(kn)) {
      const Ds = kn.critical;
      if (!isMatchingType(kr, Ds))
        return Qt;
      const Ls = getDraggable(Ds, kn.dimensions), js = whatIsDraggedOver(kn.impact) === Cr;
      return $n(Cr, Yr, js, js, Ls, Ms);
    }
    if (kn.phase === "DROP_ANIMATING") {
      const Ds = kn.completed;
      if (!isMatchingType(kr, Ds.critical))
        return Qt;
      const Ls = getDraggable(Ds.critical, kn.dimensions);
      return $n(Cr, Yr, whatIsDraggedOverFromResult(Ds.result) === Cr, whatIsDraggedOver(Ds.impact) === Cr, Ls, Ms);
    }
    if (kn.phase === "IDLE" && kn.completed && !kn.shouldFlush) {
      const Ds = kn.completed;
      if (!isMatchingType(kr, Ds.critical))
        return Qt;
      const Ls = whatIsDraggedOver(Ds.impact) === Cr, js = !!(Ds.impact.at && Ds.impact.at.type === "COMBINE"), zs = Ds.critical.droppable.id === Cr;
      return Ls ? js ? _e : Qt : zs ? _e : Qt;
    }
    return Qt;
  };
}, mapDispatchToProps = {
  updateViewportMaxScroll
}, ConnectedDroppable = connect(makeMapStateToProps, mapDispatchToProps, (_e, Qt, Zt) => ({
  ...attachDefaultPropsToOwnProps(Zt),
  ..._e,
  ...Qt
}), {
  context: StoreContext,
  areStatePropsEqual: isStrictEqual
})(Droppable$1);
var ConnectedDroppable$1 = ConnectedDroppable;
const NONE_CATEGORY_OPTION = "No Assignment";
function useCategories(_e) {
  return reactExports.useMemo(() => Object.keys(_e), [_e]);
}
function useSelectedCategory(_e) {
  const Qt = useCategories(_e), [Zt, $n] = useSessionStorage({
    key: "__persist_edit_category_selected",
    defaultValue: null,
    getInitialValueInEffect: !0
  });
  return reactExports.useEffect(() => {
    $n(
      (Sn) => Sn && Qt.includes(Sn) ? Sn : Qt.length > 0 ? Qt[0] : null
    );
  }, [Qt]), { selectedCategory: Zt, setSelectedCategory: $n, categories: Qt };
}
function useCategoryOptions(_e, Qt = !1) {
  const { selectedCategory: Zt, setSelectedCategory: $n, categories: Sn } = useSelectedCategory(_e), kn = reactExports.useRef(!1), Kn = reactExports.useMemo(() => Zt && _e[Zt] ? _e[Zt].options : [], [Zt, _e]), [er, Cr] = useListState(Kn);
  reactExports.useEffect(() => {
    if (!Qt) {
      if (kn.current) {
        kn.current = !1;
        return;
      }
      Kn !== er && Cr.setState(Kn);
    }
  }, [Kn, er]);
  const kr = reactExports.useMemo(() => {
    var Yr;
    return Zt ? (Yr = _e[Zt]) == null ? void 0 : Yr.ordered : null;
  }, [_e, Zt]);
  return {
    options: er,
    opts: Kn,
    optionsHandlers: Cr,
    ordered: kr,
    skipOptionsSyncRef: kn,
    selectedCategory: Zt,
    setSelectedCategory: $n,
    categories: Sn
  };
}
const useStyles$2 = createStyles((_e) => ({
  hoverItem: {
    transition: "border 0.3s ease",
    border: "1px solid rgba(0,0,0,0)",
    "&:hover": {
      border: "1px solid rgba(0,0,0,0.3)"
    }
  },
  hoverScale: {
    "&:hover": {
      //
    }
  },
  itemDragging: {
    boxShadow: _e.shadows.sm,
    border: "1px solid rgba(0,0,0,0.3)",
    cursor: "grabbing"
  },
  dragHandle: {
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    height: "100%",
    color: _e.colors.gray[6],
    cursor: "grab"
  },
  hideDragHandle: {
    opacity: 0.3,
    pointerEvents: "none"
  }
}));
function EditCategoryPopover({ cell: _e }) {
  const { classes: Qt, cx: Zt } = useStyles$2(), [$n, Sn] = useDisclosure(!1), [kn, Kn] = reactExports.useState(!1), [er, Cr] = useValidatedState(
    "",
    (Ws) => Ws.trim().length > 0
  ), [kr] = useModelState(
    "df_category_columns"
  ), {
    categories: Yr,
    selectedCategory: Ms,
    setSelectedCategory: Ds,
    options: Ls,
    optionsHandlers: js,
    ordered: zs,
    skipOptionsSyncRef: Fs
  } = useCategoryOptions(kr), Bs = reactExports.useCallback((Ws, Ys) => {
    window.Persist.Commands.execute(PersistCommands.categorize, {
      cell: _e,
      action: {
        op: "add",
        scope: "option",
        category: Ws,
        option: Ys
      },
      overrideLabel: `Add new option '${Ys}' to category '${Ws}'`
    }), Cr("");
  }, []);
  reactExports.useEffect(() => {
    $n || Cr("");
  }, [$n]);
  const Hs = /* @__PURE__ */ React.createElement(
    Select,
    {
      label: /* @__PURE__ */ React.createElement(Group$1, { spacing: "xs", position: "left" }, /* @__PURE__ */ React.createElement(Text, { fz: PERSIST_MANTINE_FONT_SIZE }, "Select category to edit"), /* @__PURE__ */ React.createElement(HoverCard, { withArrow: !0, shadow: "xl", openDelay: 300 }, /* @__PURE__ */ React.createElement(HoverCard.Target, null, /* @__PURE__ */ React.createElement(IconHelp, { color: "gray", size: PERSIST_ICON_SIZE })), /* @__PURE__ */ React.createElement(HoverCard.Dropdown, null, /* @__PURE__ */ React.createElement("p", null, "Start typing to search for categorical column and select it. You can also add a new one if you can't find one."), /* @__PURE__ */ React.createElement("p", null, "For the selected column you can add/remove options, mark the column as ordered and change the order of the options.")))),
      size: "xs",
      placeholder: "Search for a category...",
      data: Yr,
      clearButtonProps: {
        title: "Clear selected category"
      },
      searchable: !0,
      clearable: !0,
      creatable: !0,
      getCreateLabel: (Ws) => `+ Add category '${Ws}'`,
      onCreate: (Ws) => (window.Persist.Commands.execute(PersistCommands.categorize, {
        cell: _e,
        action: {
          op: "add",
          scope: "category",
          category: Ws
        },
        overrideLabel: `Add new category '${Ws}'`
      }), Ws),
      value: Ms,
      onChange: Ds
    }
  );
  return /* @__PURE__ */ React.createElement(
    Popover,
    {
      opened: $n,
      onChange: Sn.toggle,
      withinPortal: !0,
      withArrow: !0,
      shadow: "xl"
    },
    /* @__PURE__ */ React.createElement(Popover.Target, null, /* @__PURE__ */ React.createElement(
      HeaderActionIcon,
      {
        variant: "subtle",
        onClick: () => Sn.toggle()
      },
      /* @__PURE__ */ React.createElement(Tooltip.Floating, { label: "Edit categories", offset: 20 }, /* @__PURE__ */ React.createElement(IconCategoryPlus, null))
    )),
    /* @__PURE__ */ React.createElement(Popover.Dropdown, null, /* @__PURE__ */ React.createElement(Center$2, { mt: "sm", mb: "md" }, /* @__PURE__ */ React.createElement(Stack$1, null, /* @__PURE__ */ React.createElement(Title, { size: "xs", order: 3 }, "Edit Categories"), Hs, Ms && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(Title, { size: "sx" }, "Manage options for '", Ms, "'"), zs != null && /* @__PURE__ */ React.createElement(
      Switch,
      {
        checked: zs,
        size: "xs",
        label: "Order options",
        onChange: () => {
          window.Persist.Commands.execute(
            PersistCommands.categorize,
            {
              cell: _e,
              action: {
                op: "reorder",
                scope: "options",
                category: Ms,
                option: !zs
              },
              overrideLabel: `Make category '${Ms}' ${zs ? "unordered" : "ordered"}`
            }
          );
        }
      }
    ), Ls.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
      DragDropContext,
      {
        onDragEnd: ({ destination: Ws, source: Ys }) => {
          const El = Ys.index, Mu = (Ws == null ? void 0 : Ws.index) || 0;
          if (El === Mu)
            return;
          Fs.current = !0;
          const Pl = [...Ls], [Iu] = Pl.splice(El, 1);
          Pl.splice(Mu, 0, Iu), js.setState(Pl), window.Persist.Commands.execute(
            PersistCommands.categorize,
            {
              cell: _e,
              action: {
                op: "reorder",
                scope: "options",
                category: Ms,
                option: Pl
              },
              overrideLabel: `Reorder options for '${Ms}'`
            }
          );
        }
      },
      /* @__PURE__ */ React.createElement(ConnectedDroppable$1, { droppableId: "dnd-list", direction: "vertical" }, (Ws) => /* @__PURE__ */ React.createElement(
        Stack$1,
        {
          mah: "500px",
          sx: {
            overflow: "auto"
          },
          spacing: "xs",
          ref: Ws.innerRef,
          ...Ws.droppableProps
        },
        Ls.filter((Ys) => Ys !== NONE_CATEGORY_OPTION).map((Ys, El) => /* @__PURE__ */ React.createElement(
          PublicDraggable,
          {
            key: Ys,
            draggableId: Ys,
            index: El
          },
          (Mu, Pl) => /* @__PURE__ */ React.createElement(
            Paper,
            {
              shadow: Pl.isDragging ? "xl" : "none",
              className: Zt(Qt.hoverItem, {
                [Qt.itemDragging]: Pl.isDragging
              }),
              ref: Mu.innerRef,
              ...Mu.draggableProps
            },
            /* @__PURE__ */ React.createElement(Group$1, { position: "apart" }, /* @__PURE__ */ React.createElement(
              ActionIcon,
              {
                disabled: Ys === NONE_CATEGORY_OPTION,
                radius: "lg",
                className: Zt(Qt.dragHandle, {
                  [Qt.hideDragHandle]: !zs
                }),
                variant: Ys === NONE_CATEGORY_OPTION ? "transparent" : "subtle",
                sx: {
                  border: "none"
                },
                ...Mu.dragHandleProps
              },
              /* @__PURE__ */ React.createElement(IconGripVertical, { size: "1rem" })
            ), Ys, /* @__PURE__ */ React.createElement(
              ActionIcon,
              {
                disabled: Ys === NONE_CATEGORY_OPTION,
                color: "red",
                variant: "transparent",
                className: Qt.hoverScale,
                onClick: () => {
                  window.Persist.Commands.execute(
                    PersistCommands.categorize,
                    {
                      cell: _e,
                      action: {
                        op: "remove",
                        scope: "option",
                        category: Ms,
                        option: Ys
                      },
                      overrideLabel: `Remove option '${Ys}' from category '${Ms}'`
                    }
                  );
                }
              },
              /* @__PURE__ */ React.createElement(IconMinus, { size: rem$1(10) })
            ))
          )
        )),
        Ws.placeholder
      ))
    )), kn ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
      TextInput,
      {
        size: "xs",
        placeholder: "New option value",
        label: "Enter value for new option here",
        value: er.value,
        onChange: (Ws) => Cr(Ws.currentTarget.value),
        onKeyDown: getHotkeyHandler([
          [
            "Enter",
            () => er.valid && Bs(
              Ms,
              er.lastValidValue
            )
          ]
        ])
      }
    ), /* @__PURE__ */ React.createElement(Group$1, { position: "center" }, /* @__PURE__ */ React.createElement(
      Button,
      {
        size: "xs",
        variant: "light",
        disabled: !er.valid,
        leftIcon: /* @__PURE__ */ React.createElement(IconPlus, { size: PERSIST_ICON_SIZE }),
        onClick: () => Bs(
          Ms,
          er.lastValidValue
        )
      },
      "Add"
    ), /* @__PURE__ */ React.createElement(
      Button,
      {
        size: "xs",
        variant: "light",
        color: "red",
        leftIcon: /* @__PURE__ */ React.createElement(IconX, { size: PERSIST_ICON_SIZE }),
        onClick: () => {
          Kn(!1), Cr("");
        }
      },
      "Cancel"
    ))) : /* @__PURE__ */ React.createElement(
      Button,
      {
        size: "xs",
        variant: "subtle",
        color: "gray",
        onClick: () => Kn(!0)
      },
      "+ Add Option"
    ), /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(
      Button,
      {
        color: "red",
        size: "xs",
        onClick: () => {
          window.Persist.Commands.execute(
            PersistCommands.categorize,
            {
              cell: _e,
              action: {
                op: "remove",
                scope: "category",
                category: Ms
              },
              overrideLabel: `Delete category '${Ms}'`
            }
          );
        },
        leftIcon: /* @__PURE__ */ React.createElement(IconTrash, { size: PERSIST_ICON_SIZE })
      },
      "Delete category '",
      Ms,
      "'"
    )))))
  );
}
function AssignCategoryPopover({ cell: _e }) {
  const [Qt, Zt] = useDisclosure(!1), [$n] = useModelState("df_has_selections"), [Sn] = useModelState(
    "df_category_columns"
  ), { categories: kn, selectedCategory: Kn, setSelectedCategory: er, opts: Cr } = useCategoryOptions(Sn, !0);
  return /* @__PURE__ */ React.createElement(
    Popover,
    {
      opened: Qt,
      onChange: Zt.toggle,
      withinPortal: !0,
      withArrow: !0,
      shadow: "xl"
    },
    /* @__PURE__ */ React.createElement(Popover.Target, null, /* @__PURE__ */ React.createElement(
      HeaderActionIcon,
      {
        onClick: () => Zt.toggle(),
        variant: $n ? "subtle" : "transparent",
        disabled: !$n
      },
      /* @__PURE__ */ React.createElement(Tooltip.Floating, { label: "Assign Category", offset: 20 }, /* @__PURE__ */ React.createElement(IconCategory, null))
    )),
    /* @__PURE__ */ React.createElement(Popover.Dropdown, null, /* @__PURE__ */ React.createElement(Stack$1, null, /* @__PURE__ */ React.createElement(
      Select,
      {
        label: /* @__PURE__ */ React.createElement(Group$1, { spacing: "xs", position: "left" }, /* @__PURE__ */ React.createElement(Text, { fz: PERSIST_MANTINE_FONT_SIZE }, "Select a category"), /* @__PURE__ */ React.createElement(HoverCard, { withArrow: !0, shadow: "xl", openDelay: 300 }, /* @__PURE__ */ React.createElement(HoverCard.Target, null, /* @__PURE__ */ React.createElement(IconHelp, { color: "gray", size: PERSIST_ICON_SIZE })), /* @__PURE__ */ React.createElement(HoverCard.Dropdown, null, /* @__PURE__ */ React.createElement("p", null, "Start typing to search for categorical column and select it. You can also add a new one if you can't find one."), /* @__PURE__ */ React.createElement("p", null, "For the selected column you can add/remove options, mark the column as ordered and change the order of the options.")))),
        size: "xs",
        placeholder: "Search for a category...",
        data: kn,
        clearButtonProps: {
          title: "Clear selected category"
        },
        clearable: !0,
        value: Kn,
        onChange: er
      }
    ), /* @__PURE__ */ React.createElement(Divider, null), Kn && Cr.length > 0 && /* @__PURE__ */ React.createElement(Stack$1, { spacing: "xs" }, Cr.map((kr) => /* @__PURE__ */ React.createElement(
      Button,
      {
        size: "xs",
        variant: "subtle",
        color: "gray",
        key: kr,
        onClick: () => {
          window.Persist.Commands.execute(
            PersistCommands.categorize,
            {
              cell: _e,
              action: {
                op: "assign",
                scope: "option",
                category: Kn,
                option: kr
              },
              overrideLabel: `Assign ${Kn} (${kr}) to selected items`
            }
          );
        }
      },
      kr
    )))))
  );
}
function Header({ cell: _e }) {
  const [Qt] = useModelState("df_has_selections"), [Zt, $n] = useModelState("gdr_record"), Sn = reactExports.useCallback((kn) => {
    const Kn = {};
    Object.values(kn).forEach((er) => {
      er.isDynamic && (Kn[er.dfName] = er);
    }), $n(Kn);
  }, []);
  return /* @__PURE__ */ React.createElement(
    Group$1,
    {
      style: {
        borderBottom: "2px solid rgb(0, 0, 0, 10%)",
        padding: "1em"
      }
    },
    /* @__PURE__ */ React.createElement(RenameColumnPopover, { cell: _e }),
    /* @__PURE__ */ React.createElement(DropColumnPopover, { cell: _e }),
    /* @__PURE__ */ React.createElement(Divider, { orientation: "vertical" }),
    /* @__PURE__ */ React.createElement(EditCategoryPopover, { cell: _e }),
    /* @__PURE__ */ React.createElement(AssignCategoryPopover, { cell: _e }),
    /* @__PURE__ */ React.createElement(Divider, { orientation: "vertical" }),
    /* @__PURE__ */ React.createElement(
      CommandButton,
      {
        cell: _e,
        commandRegistry: window.Persist.Commands.registry,
        commandId: PersistCommands.filterOut,
        icon: /* @__PURE__ */ React.createElement(IconFilterMinus, null),
        isDisabled: !Qt,
        commandArgs: {
          direction: "out"
        }
      }
    ),
    /* @__PURE__ */ React.createElement(
      CommandButton,
      {
        cell: _e,
        commandRegistry: window.Persist.Commands.registry,
        commandId: PersistCommands.filterIn,
        icon: /* @__PURE__ */ React.createElement(IconFilterPlus, null),
        isDisabled: !Qt,
        commandArgs: {
          direction: "in"
        }
      }
    ),
    /* @__PURE__ */ React.createElement(Divider, { orientation: "vertical" }),
    /* @__PURE__ */ React.createElement(UseSignal, { signal: window.Persist.Commands.registry.commandChanged }, () => /* @__PURE__ */ React.createElement(Annotate, { cell: _e, isDisabled: !Qt })),
    /* @__PURE__ */ React.createElement(Divider, { orientation: "vertical" }),
    /* @__PURE__ */ React.createElement(Button.Group, null, /* @__PURE__ */ React.createElement(
      Button,
      {
        px: "0.3em",
        size: "xs",
        variant: "subtle",
        onClick: () => {
          Sn(Zt), window.Persist.Commands.execute(PersistCommands.resetTrrack, {
            cell: _e
          });
        }
      },
      "Reset Trrack"
    ), /* @__PURE__ */ React.createElement(
      Button,
      {
        px: "0.3em",
        size: "xs",
        variant: "subtle",
        onClick: () => Sn(Zt)
      },
      "Delete datasets"
    ))
  );
}
const useStyles$1 = createStyles(() => ({
  dataframeBadgeRoot: {
    textTransform: "unset"
  },
  actionButtons: {
    fontWeight: "normal",
    paddingLeft: "0.5em",
    marginRight: "-0.5em"
  }
}));
function DataframeNameBadge({
  cell: _e,
  dfRecord: Qt,
  onDelete: Zt,
  tooltip: $n = !1,
  actions: Sn = {}
}) {
  const { classes: kn } = useStyles$1(), {
    copyToClipboard: Kn = !0,
    insertInNewCell: er = !0,
    deleteEntry: Cr = !Qt.isDynamic,
    goToNode: kr = !Qt.isDynamic
  } = Sn, Yr = /* @__PURE__ */ React.createElement(
    Badge,
    {
      size: "md",
      classNames: {
        root: kn.dataframeBadgeRoot,
        rightSection: kn.actionButtons
      },
      variant: "outline",
      leftSection: Qt.isDynamic ? /* @__PURE__ */ React.createElement(Group$1, null, /* @__PURE__ */ React.createElement(ThemeIcon, { size: "xs", radius: "xl", variant: "subtle" }, /* @__PURE__ */ React.createElement(IconPinFilled, null))) : null,
      rightSection: /* @__PURE__ */ React.createElement(Button.Group, null, Kn && /* @__PURE__ */ React.createElement(
        PersistActionIconButton,
        {
          color: "blue",
          sx: { fontWeight: "unset" },
          tooltipProps: {
            label: "Copy dataframe to clipboard"
          },
          onClick: () => {
            postCreationAction(Qt, "copy");
          }
        },
        /* @__PURE__ */ React.createElement(IconCopy, null)
      ), er && /* @__PURE__ */ React.createElement(
        PersistActionIconButton,
        {
          color: "blue",
          tooltipProps: {
            label: "Insert dataframe in new cell"
          },
          onClick: () => {
            postCreationAction(Qt, "insert");
          }
        },
        /* @__PURE__ */ React.createElement(IconRowInsertTop, null)
      ), kr && /* @__PURE__ */ React.createElement(
        PersistActionIconButton,
        {
          color: "blue",
          tooltipProps: {
            label: "Go to node"
          },
          onClick: () => {
            _e.trrackManager.trrack.to(
              Qt.current_node_id || _e.trrackManager.trrack.root.id
            );
          }
        },
        /* @__PURE__ */ React.createElement(IconExternalLink, null)
      ), Cr && /* @__PURE__ */ React.createElement(
        PersistActionIconButton,
        {
          color: "blue",
          tooltipProps: {
            label: "Delete dataframe"
          },
          onClick: () => {
            Zt && Zt(Qt);
          }
        },
        /* @__PURE__ */ React.createElement(IconTrash, null)
      ))
    },
    Qt.dfName
  );
  return $n ? /* @__PURE__ */ React.createElement(Tooltip, { zIndex: 1e7, label: Qt.dfName }, Yr) : Yr;
}
const VALID_PYTHON_VAR = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
function isValidPythonVar(_e) {
  return VALID_PYTHON_VAR.test(_e);
}
function useGeneratedDf(_e) {
  const Qt = useModel(), [Zt, $n] = useModelState("gdr_record"), [Sn] = useModelState("gdr_has_synced"), [kn] = useModelState("gdr_dynamic_name");
  return reactExports.useEffect(() => {
    Sn || $n(_e.generatedDataframes);
  }, [_e, kn, Sn]), reactExports.useEffect(() => {
    Sn && (lodashExports.isEqual(_e.generatedDataframes, Zt) || _e.generatedDataframesState.set(Zt));
  }, [_e, Zt, Sn]), { generatedDfModel: Zt, setGeneratedDfModel: $n, model: Qt };
}
function DataframeFooter({ cell: _e }) {
  const { generatedDfModel: Qt, model: Zt, setGeneratedDfModel: $n } = useGeneratedDf(_e), [Sn, kn] = useValidatedState(
    "",
    (er) => er.length === 0 ? !0 : isValidPythonVar(er),
    !0
  );
  reactExports.useEffect(() => {
    function er({ msg: Cr }) {
      if (!Cr)
        return;
      const { type: kr, record: Yr, post: Ms = void 0 } = Cr;
      kr === "df_created" && postCreationAction(Yr, Ms);
    }
    return Zt.on("msg:custom", er), () => {
      Zt.off("msg:custom", er);
    };
  }, [Zt]);
  const Kn = reactExports.useCallback(
    (er) => {
      window.Persist.Commands.execute(PersistCommands.createDataframe, {
        cell: _e,
        model: Zt,
        record: getRecord(
          Sn.lastValidValue,
          _e.trrackManager.trrack,
          !1
        ),
        post: er
      }), kn("");
    },
    [_e, Zt, Sn]
  );
  return /* @__PURE__ */ React.createElement(Paper, { shadow: "lg", withBorder: !0, p: "md", mx: "xs" }, /* @__PURE__ */ React.createElement(Title, { size: "h4" }, "Datasets"), /* @__PURE__ */ React.createElement(Divider, { size: "xs", my: "md" }), /* @__PURE__ */ React.createElement(Text, { fz: PERSIST_ICON_SIZE, fw: "bold" }, "Create new dataset:"), /* @__PURE__ */ React.createElement(Group$1, { align: "flex-start" }, /* @__PURE__ */ React.createElement(
    TextInput,
    {
      size: "xs",
      miw: "250px",
      placeholder: "Enter a valid python variable name...",
      value: Sn.value,
      onChange: (er) => kn(er.target.value),
      error: Sn.valid ? null : "Please enter a valid python variable name",
      rightSection: Sn.value.length > 0 && /* @__PURE__ */ React.createElement(ActionIcon, { size: "xs", onClick: () => kn("") }, /* @__PURE__ */ React.createElement(IconX, null))
    }
  ), /* @__PURE__ */ React.createElement(Button.Group, null, /* @__PURE__ */ React.createElement(Tooltip, { label: "Create dataframe and copy to clipboard", color: "gray" }, /* @__PURE__ */ React.createElement(
    ActionIcon,
    {
      color: "green",
      radius: "xl",
      variant: Sn.value.length === 0 || !Sn.valid ? "transparent" : "subtle",
      disabled: Sn.value.length === 0 || !Sn.valid,
      onClick: () => {
        Kn("copy");
      }
    },
    /* @__PURE__ */ React.createElement(IconCopy, null)
  )), /* @__PURE__ */ React.createElement(
    Tooltip,
    {
      label: "Create dataframe and insert new cell below",
      color: "gray"
    },
    /* @__PURE__ */ React.createElement(
      ActionIcon,
      {
        radius: "xl",
        color: "green",
        variant: Sn.value.length === 0 || !Sn.valid ? "transparent" : "subtle",
        disabled: Sn.value.length === 0 || !Sn.valid,
        onClick: () => {
          Kn("insert");
        }
      },
      /* @__PURE__ */ React.createElement(IconRowInsertTop, null)
    )
  ))), /* @__PURE__ */ React.createElement(Group$1, { mt: "1em", p: "1em" }, Object.keys(Qt || {}).map((er) => /* @__PURE__ */ React.createElement(
    DataframeNameBadge,
    {
      cell: _e,
      key: er,
      dfRecord: Qt[er],
      onDelete: (Cr) => {
        const kr = { ...Qt };
        kr[Cr.dfName] && delete kr[Cr.dfName], $n(kr);
      }
    }
  ))));
}
var xhtml = "http://www.w3.org/1999/xhtml";
const namespaces = {
  svg: "http://www.w3.org/2000/svg",
  xhtml,
  xlink: "http://www.w3.org/1999/xlink",
  xml: "http://www.w3.org/XML/1998/namespace",
  xmlns: "http://www.w3.org/2000/xmlns/"
};
function namespace(_e) {
  var Qt = _e += "", Zt = Qt.indexOf(":");
  return Zt >= 0 && (Qt = _e.slice(0, Zt)) !== "xmlns" && (_e = _e.slice(Zt + 1)), namespaces.hasOwnProperty(Qt) ? { space: namespaces[Qt], local: _e } : _e;
}
function creatorInherit(_e) {
  return function() {
    var Qt = this.ownerDocument, Zt = this.namespaceURI;
    return Zt === xhtml && Qt.documentElement.namespaceURI === xhtml ? Qt.createElement(_e) : Qt.createElementNS(Zt, _e);
  };
}
function creatorFixed(_e) {
  return function() {
    return this.ownerDocument.createElementNS(_e.space, _e.local);
  };
}
function creator(_e) {
  var Qt = namespace(_e);
  return (Qt.local ? creatorFixed : creatorInherit)(Qt);
}
function none() {
}
function selector(_e) {
  return _e == null ? none : function() {
    return this.querySelector(_e);
  };
}
function selection_select(_e) {
  typeof _e != "function" && (_e = selector(_e));
  for (var Qt = this._groups, Zt = Qt.length, $n = new Array(Zt), Sn = 0; Sn < Zt; ++Sn)
    for (var kn = Qt[Sn], Kn = kn.length, er = $n[Sn] = new Array(Kn), Cr, kr, Yr = 0; Yr < Kn; ++Yr)
      (Cr = kn[Yr]) && (kr = _e.call(Cr, Cr.__data__, Yr, kn)) && ("__data__" in Cr && (kr.__data__ = Cr.__data__), er[Yr] = kr);
  return new Selection$1($n, this._parents);
}
function array(_e) {
  return _e == null ? [] : Array.isArray(_e) ? _e : Array.from(_e);
}
function empty() {
  return [];
}
function selectorAll(_e) {
  return _e == null ? empty : function() {
    return this.querySelectorAll(_e);
  };
}
function arrayAll(_e) {
  return function() {
    return array(_e.apply(this, arguments));
  };
}
function selection_selectAll(_e) {
  typeof _e == "function" ? _e = arrayAll(_e) : _e = selectorAll(_e);
  for (var Qt = this._groups, Zt = Qt.length, $n = [], Sn = [], kn = 0; kn < Zt; ++kn)
    for (var Kn = Qt[kn], er = Kn.length, Cr, kr = 0; kr < er; ++kr)
      (Cr = Kn[kr]) && ($n.push(_e.call(Cr, Cr.__data__, kr, Kn)), Sn.push(Cr));
  return new Selection$1($n, Sn);
}
function matcher(_e) {
  return function() {
    return this.matches(_e);
  };
}
function childMatcher(_e) {
  return function(Qt) {
    return Qt.matches(_e);
  };
}
var find = Array.prototype.find;
function childFind(_e) {
  return function() {
    return find.call(this.children, _e);
  };
}
function childFirst() {
  return this.firstElementChild;
}
function selection_selectChild(_e) {
  return this.select(_e == null ? childFirst : childFind(typeof _e == "function" ? _e : childMatcher(_e)));
}
var filter = Array.prototype.filter;
function children() {
  return Array.from(this.children);
}
function childrenFilter(_e) {
  return function() {
    return filter.call(this.children, _e);
  };
}
function selection_selectChildren(_e) {
  return this.selectAll(_e == null ? children : childrenFilter(typeof _e == "function" ? _e : childMatcher(_e)));
}
function selection_filter(_e) {
  typeof _e != "function" && (_e = matcher(_e));
  for (var Qt = this._groups, Zt = Qt.length, $n = new Array(Zt), Sn = 0; Sn < Zt; ++Sn)
    for (var kn = Qt[Sn], Kn = kn.length, er = $n[Sn] = [], Cr, kr = 0; kr < Kn; ++kr)
      (Cr = kn[kr]) && _e.call(Cr, Cr.__data__, kr, kn) && er.push(Cr);
  return new Selection$1($n, this._parents);
}
function sparse(_e) {
  return new Array(_e.length);
}
function selection_enter() {
  return new Selection$1(this._enter || this._groups.map(sparse), this._parents);
}
function EnterNode(_e, Qt) {
  this.ownerDocument = _e.ownerDocument, this.namespaceURI = _e.namespaceURI, this._next = null, this._parent = _e, this.__data__ = Qt;
}
EnterNode.prototype = {
  constructor: EnterNode,
  appendChild: function(_e) {
    return this._parent.insertBefore(_e, this._next);
  },
  insertBefore: function(_e, Qt) {
    return this._parent.insertBefore(_e, Qt);
  },
  querySelector: function(_e) {
    return this._parent.querySelector(_e);
  },
  querySelectorAll: function(_e) {
    return this._parent.querySelectorAll(_e);
  }
};
function constant$1(_e) {
  return function() {
    return _e;
  };
}
function bindIndex(_e, Qt, Zt, $n, Sn, kn) {
  for (var Kn = 0, er, Cr = Qt.length, kr = kn.length; Kn < kr; ++Kn)
    (er = Qt[Kn]) ? (er.__data__ = kn[Kn], $n[Kn] = er) : Zt[Kn] = new EnterNode(_e, kn[Kn]);
  for (; Kn < Cr; ++Kn)
    (er = Qt[Kn]) && (Sn[Kn] = er);
}
function bindKey(_e, Qt, Zt, $n, Sn, kn, Kn) {
  var er, Cr, kr = /* @__PURE__ */ new Map(), Yr = Qt.length, Ms = kn.length, Ds = new Array(Yr), Ls;
  for (er = 0; er < Yr; ++er)
    (Cr = Qt[er]) && (Ds[er] = Ls = Kn.call(Cr, Cr.__data__, er, Qt) + "", kr.has(Ls) ? Sn[er] = Cr : kr.set(Ls, Cr));
  for (er = 0; er < Ms; ++er)
    Ls = Kn.call(_e, kn[er], er, kn) + "", (Cr = kr.get(Ls)) ? ($n[er] = Cr, Cr.__data__ = kn[er], kr.delete(Ls)) : Zt[er] = new EnterNode(_e, kn[er]);
  for (er = 0; er < Yr; ++er)
    (Cr = Qt[er]) && kr.get(Ds[er]) === Cr && (Sn[er] = Cr);
}
function datum(_e) {
  return _e.__data__;
}
function selection_data(_e, Qt) {
  if (!arguments.length)
    return Array.from(this, datum);
  var Zt = Qt ? bindKey : bindIndex, $n = this._parents, Sn = this._groups;
  typeof _e != "function" && (_e = constant$1(_e));
  for (var kn = Sn.length, Kn = new Array(kn), er = new Array(kn), Cr = new Array(kn), kr = 0; kr < kn; ++kr) {
    var Yr = $n[kr], Ms = Sn[kr], Ds = Ms.length, Ls = arraylike(_e.call(Yr, Yr && Yr.__data__, kr, $n)), js = Ls.length, zs = er[kr] = new Array(js), Fs = Kn[kr] = new Array(js), Bs = Cr[kr] = new Array(Ds);
    Zt(Yr, Ms, zs, Fs, Bs, Ls, Qt);
    for (var Hs = 0, Ws = 0, Ys, El; Hs < js; ++Hs)
      if (Ys = zs[Hs]) {
        for (Hs >= Ws && (Ws = Hs + 1); !(El = Fs[Ws]) && ++Ws < js; )
          ;
        Ys._next = El || null;
      }
  }
  return Kn = new Selection$1(Kn, $n), Kn._enter = er, Kn._exit = Cr, Kn;
}
function arraylike(_e) {
  return typeof _e == "object" && "length" in _e ? _e : Array.from(_e);
}
function selection_exit() {
  return new Selection$1(this._exit || this._groups.map(sparse), this._parents);
}
function selection_join(_e, Qt, Zt) {
  var $n = this.enter(), Sn = this, kn = this.exit();
  return typeof _e == "function" ? ($n = _e($n), $n && ($n = $n.selection())) : $n = $n.append(_e + ""), Qt != null && (Sn = Qt(Sn), Sn && (Sn = Sn.selection())), Zt == null ? kn.remove() : Zt(kn), $n && Sn ? $n.merge(Sn).order() : Sn;
}
function selection_merge(_e) {
  for (var Qt = _e.selection ? _e.selection() : _e, Zt = this._groups, $n = Qt._groups, Sn = Zt.length, kn = $n.length, Kn = Math.min(Sn, kn), er = new Array(Sn), Cr = 0; Cr < Kn; ++Cr)
    for (var kr = Zt[Cr], Yr = $n[Cr], Ms = kr.length, Ds = er[Cr] = new Array(Ms), Ls, js = 0; js < Ms; ++js)
      (Ls = kr[js] || Yr[js]) && (Ds[js] = Ls);
  for (; Cr < Sn; ++Cr)
    er[Cr] = Zt[Cr];
  return new Selection$1(er, this._parents);
}
function selection_order() {
  for (var _e = this._groups, Qt = -1, Zt = _e.length; ++Qt < Zt; )
    for (var $n = _e[Qt], Sn = $n.length - 1, kn = $n[Sn], Kn; --Sn >= 0; )
      (Kn = $n[Sn]) && (kn && Kn.compareDocumentPosition(kn) ^ 4 && kn.parentNode.insertBefore(Kn, kn), kn = Kn);
  return this;
}
function selection_sort(_e) {
  _e || (_e = ascending);
  function Qt(Ms, Ds) {
    return Ms && Ds ? _e(Ms.__data__, Ds.__data__) : !Ms - !Ds;
  }
  for (var Zt = this._groups, $n = Zt.length, Sn = new Array($n), kn = 0; kn < $n; ++kn) {
    for (var Kn = Zt[kn], er = Kn.length, Cr = Sn[kn] = new Array(er), kr, Yr = 0; Yr < er; ++Yr)
      (kr = Kn[Yr]) && (Cr[Yr] = kr);
    Cr.sort(Qt);
  }
  return new Selection$1(Sn, this._parents).order();
}
function ascending(_e, Qt) {
  return _e < Qt ? -1 : _e > Qt ? 1 : _e >= Qt ? 0 : NaN;
}
function selection_call() {
  var _e = arguments[0];
  return arguments[0] = this, _e.apply(null, arguments), this;
}
function selection_nodes() {
  return Array.from(this);
}
function selection_node() {
  for (var _e = this._groups, Qt = 0, Zt = _e.length; Qt < Zt; ++Qt)
    for (var $n = _e[Qt], Sn = 0, kn = $n.length; Sn < kn; ++Sn) {
      var Kn = $n[Sn];
      if (Kn)
        return Kn;
    }
  return null;
}
function selection_size() {
  let _e = 0;
  for (const Qt of this)
    ++_e;
  return _e;
}
function selection_empty() {
  return !this.node();
}
function selection_each(_e) {
  for (var Qt = this._groups, Zt = 0, $n = Qt.length; Zt < $n; ++Zt)
    for (var Sn = Qt[Zt], kn = 0, Kn = Sn.length, er; kn < Kn; ++kn)
      (er = Sn[kn]) && _e.call(er, er.__data__, kn, Sn);
  return this;
}
function attrRemove$1(_e) {
  return function() {
    this.removeAttribute(_e);
  };
}
function attrRemoveNS$1(_e) {
  return function() {
    this.removeAttributeNS(_e.space, _e.local);
  };
}
function attrConstant$1(_e, Qt) {
  return function() {
    this.setAttribute(_e, Qt);
  };
}
function attrConstantNS$1(_e, Qt) {
  return function() {
    this.setAttributeNS(_e.space, _e.local, Qt);
  };
}
function attrFunction$1(_e, Qt) {
  return function() {
    var Zt = Qt.apply(this, arguments);
    Zt == null ? this.removeAttribute(_e) : this.setAttribute(_e, Zt);
  };
}
function attrFunctionNS$1(_e, Qt) {
  return function() {
    var Zt = Qt.apply(this, arguments);
    Zt == null ? this.removeAttributeNS(_e.space, _e.local) : this.setAttributeNS(_e.space, _e.local, Zt);
  };
}
function selection_attr(_e, Qt) {
  var Zt = namespace(_e);
  if (arguments.length < 2) {
    var $n = this.node();
    return Zt.local ? $n.getAttributeNS(Zt.space, Zt.local) : $n.getAttribute(Zt);
  }
  return this.each((Qt == null ? Zt.local ? attrRemoveNS$1 : attrRemove$1 : typeof Qt == "function" ? Zt.local ? attrFunctionNS$1 : attrFunction$1 : Zt.local ? attrConstantNS$1 : attrConstant$1)(Zt, Qt));
}
function defaultView(_e) {
  return _e.ownerDocument && _e.ownerDocument.defaultView || _e.document && _e || _e.defaultView;
}
function styleRemove$1(_e) {
  return function() {
    this.style.removeProperty(_e);
  };
}
function styleConstant$1(_e, Qt, Zt) {
  return function() {
    this.style.setProperty(_e, Qt, Zt);
  };
}
function styleFunction$1(_e, Qt, Zt) {
  return function() {
    var $n = Qt.apply(this, arguments);
    $n == null ? this.style.removeProperty(_e) : this.style.setProperty(_e, $n, Zt);
  };
}
function selection_style(_e, Qt, Zt) {
  return arguments.length > 1 ? this.each((Qt == null ? styleRemove$1 : typeof Qt == "function" ? styleFunction$1 : styleConstant$1)(_e, Qt, Zt ?? "")) : styleValue(this.node(), _e);
}
function styleValue(_e, Qt) {
  return _e.style.getPropertyValue(Qt) || defaultView(_e).getComputedStyle(_e, null).getPropertyValue(Qt);
}
function propertyRemove(_e) {
  return function() {
    delete this[_e];
  };
}
function propertyConstant(_e, Qt) {
  return function() {
    this[_e] = Qt;
  };
}
function propertyFunction(_e, Qt) {
  return function() {
    var Zt = Qt.apply(this, arguments);
    Zt == null ? delete this[_e] : this[_e] = Zt;
  };
}
function selection_property(_e, Qt) {
  return arguments.length > 1 ? this.each((Qt == null ? propertyRemove : typeof Qt == "function" ? propertyFunction : propertyConstant)(_e, Qt)) : this.node()[_e];
}
function classArray(_e) {
  return _e.trim().split(/^|\s+/);
}
function classList(_e) {
  return _e.classList || new ClassList(_e);
}
function ClassList(_e) {
  this._node = _e, this._names = classArray(_e.getAttribute("class") || "");
}
ClassList.prototype = {
  add: function(_e) {
    var Qt = this._names.indexOf(_e);
    Qt < 0 && (this._names.push(_e), this._node.setAttribute("class", this._names.join(" ")));
  },
  remove: function(_e) {
    var Qt = this._names.indexOf(_e);
    Qt >= 0 && (this._names.splice(Qt, 1), this._node.setAttribute("class", this._names.join(" ")));
  },
  contains: function(_e) {
    return this._names.indexOf(_e) >= 0;
  }
};
function classedAdd(_e, Qt) {
  for (var Zt = classList(_e), $n = -1, Sn = Qt.length; ++$n < Sn; )
    Zt.add(Qt[$n]);
}
function classedRemove(_e, Qt) {
  for (var Zt = classList(_e), $n = -1, Sn = Qt.length; ++$n < Sn; )
    Zt.remove(Qt[$n]);
}
function classedTrue(_e) {
  return function() {
    classedAdd(this, _e);
  };
}
function classedFalse(_e) {
  return function() {
    classedRemove(this, _e);
  };
}
function classedFunction(_e, Qt) {
  return function() {
    (Qt.apply(this, arguments) ? classedAdd : classedRemove)(this, _e);
  };
}
function selection_classed(_e, Qt) {
  var Zt = classArray(_e + "");
  if (arguments.length < 2) {
    for (var $n = classList(this.node()), Sn = -1, kn = Zt.length; ++Sn < kn; )
      if (!$n.contains(Zt[Sn]))
        return !1;
    return !0;
  }
  return this.each((typeof Qt == "function" ? classedFunction : Qt ? classedTrue : classedFalse)(Zt, Qt));
}
function textRemove() {
  this.textContent = "";
}
function textConstant$1(_e) {
  return function() {
    this.textContent = _e;
  };
}
function textFunction$1(_e) {
  return function() {
    var Qt = _e.apply(this, arguments);
    this.textContent = Qt ?? "";
  };
}
function selection_text(_e) {
  return arguments.length ? this.each(_e == null ? textRemove : (typeof _e == "function" ? textFunction$1 : textConstant$1)(_e)) : this.node().textContent;
}
function htmlRemove() {
  this.innerHTML = "";
}
function htmlConstant(_e) {
  return function() {
    this.innerHTML = _e;
  };
}
function htmlFunction(_e) {
  return function() {
    var Qt = _e.apply(this, arguments);
    this.innerHTML = Qt ?? "";
  };
}
function selection_html(_e) {
  return arguments.length ? this.each(_e == null ? htmlRemove : (typeof _e == "function" ? htmlFunction : htmlConstant)(_e)) : this.node().innerHTML;
}
function raise() {
  this.nextSibling && this.parentNode.appendChild(this);
}
function selection_raise() {
  return this.each(raise);
}
function lower() {
  this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
function selection_lower() {
  return this.each(lower);
}
function selection_append(_e) {
  var Qt = typeof _e == "function" ? _e : creator(_e);
  return this.select(function() {
    return this.appendChild(Qt.apply(this, arguments));
  });
}
function constantNull() {
  return null;
}
function selection_insert(_e, Qt) {
  var Zt = typeof _e == "function" ? _e : creator(_e), $n = Qt == null ? constantNull : typeof Qt == "function" ? Qt : selector(Qt);
  return this.select(function() {
    return this.insertBefore(Zt.apply(this, arguments), $n.apply(this, arguments) || null);
  });
}
function remove() {
  var _e = this.parentNode;
  _e && _e.removeChild(this);
}
function selection_remove() {
  return this.each(remove);
}
function selection_cloneShallow() {
  var _e = this.cloneNode(!1), Qt = this.parentNode;
  return Qt ? Qt.insertBefore(_e, this.nextSibling) : _e;
}
function selection_cloneDeep() {
  var _e = this.cloneNode(!0), Qt = this.parentNode;
  return Qt ? Qt.insertBefore(_e, this.nextSibling) : _e;
}
function selection_clone(_e) {
  return this.select(_e ? selection_cloneDeep : selection_cloneShallow);
}
function selection_datum(_e) {
  return arguments.length ? this.property("__data__", _e) : this.node().__data__;
}
function contextListener(_e) {
  return function(Qt) {
    _e.call(this, Qt, this.__data__);
  };
}
function parseTypenames(_e) {
  return _e.trim().split(/^|\s+/).map(function(Qt) {
    var Zt = "", $n = Qt.indexOf(".");
    return $n >= 0 && (Zt = Qt.slice($n + 1), Qt = Qt.slice(0, $n)), { type: Qt, name: Zt };
  });
}
function onRemove(_e) {
  return function() {
    var Qt = this.__on;
    if (Qt) {
      for (var Zt = 0, $n = -1, Sn = Qt.length, kn; Zt < Sn; ++Zt)
        kn = Qt[Zt], (!_e.type || kn.type === _e.type) && kn.name === _e.name ? this.removeEventListener(kn.type, kn.listener, kn.options) : Qt[++$n] = kn;
      ++$n ? Qt.length = $n : delete this.__on;
    }
  };
}
function onAdd(_e, Qt, Zt) {
  return function() {
    var $n = this.__on, Sn, kn = contextListener(Qt);
    if ($n) {
      for (var Kn = 0, er = $n.length; Kn < er; ++Kn)
        if ((Sn = $n[Kn]).type === _e.type && Sn.name === _e.name) {
          this.removeEventListener(Sn.type, Sn.listener, Sn.options), this.addEventListener(Sn.type, Sn.listener = kn, Sn.options = Zt), Sn.value = Qt;
          return;
        }
    }
    this.addEventListener(_e.type, kn, Zt), Sn = { type: _e.type, name: _e.name, value: Qt, listener: kn, options: Zt }, $n ? $n.push(Sn) : this.__on = [Sn];
  };
}
function selection_on(_e, Qt, Zt) {
  var $n = parseTypenames(_e + ""), Sn, kn = $n.length, Kn;
  if (arguments.length < 2) {
    var er = this.node().__on;
    if (er) {
      for (var Cr = 0, kr = er.length, Yr; Cr < kr; ++Cr)
        for (Sn = 0, Yr = er[Cr]; Sn < kn; ++Sn)
          if ((Kn = $n[Sn]).type === Yr.type && Kn.name === Yr.name)
            return Yr.value;
    }
    return;
  }
  for (er = Qt ? onAdd : onRemove, Sn = 0; Sn < kn; ++Sn)
    this.each(er($n[Sn], Qt, Zt));
  return this;
}
function dispatchEvent(_e, Qt, Zt) {
  var $n = defaultView(_e), Sn = $n.CustomEvent;
  typeof Sn == "function" ? Sn = new Sn(Qt, Zt) : (Sn = $n.document.createEvent("Event"), Zt ? (Sn.initEvent(Qt, Zt.bubbles, Zt.cancelable), Sn.detail = Zt.detail) : Sn.initEvent(Qt, !1, !1)), _e.dispatchEvent(Sn);
}
function dispatchConstant(_e, Qt) {
  return function() {
    return dispatchEvent(this, _e, Qt);
  };
}
function dispatchFunction(_e, Qt) {
  return function() {
    return dispatchEvent(this, _e, Qt.apply(this, arguments));
  };
}
function selection_dispatch(_e, Qt) {
  return this.each((typeof Qt == "function" ? dispatchFunction : dispatchConstant)(_e, Qt));
}
function* selection_iterator() {
  for (var _e = this._groups, Qt = 0, Zt = _e.length; Qt < Zt; ++Qt)
    for (var $n = _e[Qt], Sn = 0, kn = $n.length, Kn; Sn < kn; ++Sn)
      (Kn = $n[Sn]) && (yield Kn);
}
var root = [null];
function Selection$1(_e, Qt) {
  this._groups = _e, this._parents = Qt;
}
function selection() {
  return new Selection$1([[document.documentElement]], root);
}
function selection_selection() {
  return this;
}
Selection$1.prototype = selection.prototype = {
  constructor: Selection$1,
  select: selection_select,
  selectAll: selection_selectAll,
  selectChild: selection_selectChild,
  selectChildren: selection_selectChildren,
  filter: selection_filter,
  data: selection_data,
  enter: selection_enter,
  exit: selection_exit,
  join: selection_join,
  merge: selection_merge,
  selection: selection_selection,
  order: selection_order,
  sort: selection_sort,
  call: selection_call,
  nodes: selection_nodes,
  node: selection_node,
  size: selection_size,
  empty: selection_empty,
  each: selection_each,
  attr: selection_attr,
  style: selection_style,
  property: selection_property,
  classed: selection_classed,
  text: selection_text,
  html: selection_html,
  raise: selection_raise,
  lower: selection_lower,
  append: selection_append,
  insert: selection_insert,
  remove: selection_remove,
  clone: selection_clone,
  datum: selection_datum,
  on: selection_on,
  dispatch: selection_dispatch,
  [Symbol.iterator]: selection_iterator
};
function select(_e) {
  return typeof _e == "string" ? new Selection$1([[document.querySelector(_e)]], [document.documentElement]) : new Selection$1([[_e]], root);
}
function sourceEvent(_e) {
  let Qt;
  for (; Qt = _e.sourceEvent; )
    _e = Qt;
  return _e;
}
function pointer(_e, Qt) {
  if (_e = sourceEvent(_e), Qt === void 0 && (Qt = _e.currentTarget), Qt) {
    var Zt = Qt.ownerSVGElement || Qt;
    if (Zt.createSVGPoint) {
      var $n = Zt.createSVGPoint();
      return $n.x = _e.clientX, $n.y = _e.clientY, $n = $n.matrixTransform(Qt.getScreenCTM().inverse()), [$n.x, $n.y];
    }
    if (Qt.getBoundingClientRect) {
      var Sn = Qt.getBoundingClientRect();
      return [_e.clientX - Sn.left - Qt.clientLeft, _e.clientY - Sn.top - Qt.clientTop];
    }
  }
  return [_e.pageX, _e.pageY];
}
const nonpassivecapture = { capture: !0, passive: !1 };
function noevent$1(_e) {
  _e.preventDefault(), _e.stopImmediatePropagation();
}
function dragDisable(_e) {
  var Qt = _e.document.documentElement, Zt = select(_e).on("dragstart.drag", noevent$1, nonpassivecapture);
  "onselectstart" in Qt ? Zt.on("selectstart.drag", noevent$1, nonpassivecapture) : (Qt.__noselect = Qt.style.MozUserSelect, Qt.style.MozUserSelect = "none");
}
function yesdrag(_e, Qt) {
  var Zt = _e.document.documentElement, $n = select(_e).on("dragstart.drag", null);
  Qt && ($n.on("click.drag", noevent$1, nonpassivecapture), setTimeout(function() {
    $n.on("click.drag", null);
  }, 0)), "onselectstart" in Zt ? $n.on("selectstart.drag", null) : (Zt.style.MozUserSelect = Zt.__noselect, delete Zt.__noselect);
}
var emptyOn = dispatch("start", "end", "cancel", "interrupt"), emptyTween = [], CREATED = 0, SCHEDULED = 1, STARTING = 2, STARTED = 3, RUNNING = 4, ENDING = 5, ENDED = 6;
function schedule(_e, Qt, Zt, $n, Sn, kn) {
  var Kn = _e.__transition;
  if (!Kn)
    _e.__transition = {};
  else if (Zt in Kn)
    return;
  create(_e, Zt, {
    name: Qt,
    index: $n,
    // For context during callback.
    group: Sn,
    // For context during callback.
    on: emptyOn,
    tween: emptyTween,
    time: kn.time,
    delay: kn.delay,
    duration: kn.duration,
    ease: kn.ease,
    timer: null,
    state: CREATED
  });
}
function init(_e, Qt) {
  var Zt = get$1(_e, Qt);
  if (Zt.state > CREATED)
    throw new Error("too late; already scheduled");
  return Zt;
}
function set(_e, Qt) {
  var Zt = get$1(_e, Qt);
  if (Zt.state > STARTED)
    throw new Error("too late; already running");
  return Zt;
}
function get$1(_e, Qt) {
  var Zt = _e.__transition;
  if (!Zt || !(Zt = Zt[Qt]))
    throw new Error("transition not found");
  return Zt;
}
function create(_e, Qt, Zt) {
  var $n = _e.__transition, Sn;
  $n[Qt] = Zt, Zt.timer = timer$1(kn, 0, Zt.time);
  function kn(kr) {
    Zt.state = SCHEDULED, Zt.timer.restart(Kn, Zt.delay, Zt.time), Zt.delay <= kr && Kn(kr - Zt.delay);
  }
  function Kn(kr) {
    var Yr, Ms, Ds, Ls;
    if (Zt.state !== SCHEDULED)
      return Cr();
    for (Yr in $n)
      if (Ls = $n[Yr], Ls.name === Zt.name) {
        if (Ls.state === STARTED)
          return timeout(Kn);
        Ls.state === RUNNING ? (Ls.state = ENDED, Ls.timer.stop(), Ls.on.call("interrupt", _e, _e.__data__, Ls.index, Ls.group), delete $n[Yr]) : +Yr < Qt && (Ls.state = ENDED, Ls.timer.stop(), Ls.on.call("cancel", _e, _e.__data__, Ls.index, Ls.group), delete $n[Yr]);
      }
    if (timeout(function() {
      Zt.state === STARTED && (Zt.state = RUNNING, Zt.timer.restart(er, Zt.delay, Zt.time), er(kr));
    }), Zt.state = STARTING, Zt.on.call("start", _e, _e.__data__, Zt.index, Zt.group), Zt.state === STARTING) {
      for (Zt.state = STARTED, Sn = new Array(Ds = Zt.tween.length), Yr = 0, Ms = -1; Yr < Ds; ++Yr)
        (Ls = Zt.tween[Yr].value.call(_e, _e.__data__, Zt.index, Zt.group)) && (Sn[++Ms] = Ls);
      Sn.length = Ms + 1;
    }
  }
  function er(kr) {
    for (var Yr = kr < Zt.duration ? Zt.ease.call(null, kr / Zt.duration) : (Zt.timer.restart(Cr), Zt.state = ENDING, 1), Ms = -1, Ds = Sn.length; ++Ms < Ds; )
      Sn[Ms].call(_e, Yr);
    Zt.state === ENDING && (Zt.on.call("end", _e, _e.__data__, Zt.index, Zt.group), Cr());
  }
  function Cr() {
    Zt.state = ENDED, Zt.timer.stop(), delete $n[Qt];
    for (var kr in $n)
      return;
    delete _e.__transition;
  }
}
function interrupt(_e, Qt) {
  var Zt = _e.__transition, $n, Sn, kn = !0, Kn;
  if (Zt) {
    Qt = Qt == null ? null : Qt + "";
    for (Kn in Zt) {
      if (($n = Zt[Kn]).name !== Qt) {
        kn = !1;
        continue;
      }
      Sn = $n.state > STARTING && $n.state < ENDING, $n.state = ENDED, $n.timer.stop(), $n.on.call(Sn ? "interrupt" : "cancel", _e, _e.__data__, $n.index, $n.group), delete Zt[Kn];
    }
    kn && delete _e.__transition;
  }
}
function selection_interrupt(_e) {
  return this.each(function() {
    interrupt(this, _e);
  });
}
function tweenRemove(_e, Qt) {
  var Zt, $n;
  return function() {
    var Sn = set(this, _e), kn = Sn.tween;
    if (kn !== Zt) {
      $n = Zt = kn;
      for (var Kn = 0, er = $n.length; Kn < er; ++Kn)
        if ($n[Kn].name === Qt) {
          $n = $n.slice(), $n.splice(Kn, 1);
          break;
        }
    }
    Sn.tween = $n;
  };
}
function tweenFunction(_e, Qt, Zt) {
  var $n, Sn;
  if (typeof Zt != "function")
    throw new Error();
  return function() {
    var kn = set(this, _e), Kn = kn.tween;
    if (Kn !== $n) {
      Sn = ($n = Kn).slice();
      for (var er = { name: Qt, value: Zt }, Cr = 0, kr = Sn.length; Cr < kr; ++Cr)
        if (Sn[Cr].name === Qt) {
          Sn[Cr] = er;
          break;
        }
      Cr === kr && Sn.push(er);
    }
    kn.tween = Sn;
  };
}
function transition_tween(_e, Qt) {
  var Zt = this._id;
  if (_e += "", arguments.length < 2) {
    for (var $n = get$1(this.node(), Zt).tween, Sn = 0, kn = $n.length, Kn; Sn < kn; ++Sn)
      if ((Kn = $n[Sn]).name === _e)
        return Kn.value;
    return null;
  }
  return this.each((Qt == null ? tweenRemove : tweenFunction)(Zt, _e, Qt));
}
function tweenValue(_e, Qt, Zt) {
  var $n = _e._id;
  return _e.each(function() {
    var Sn = set(this, $n);
    (Sn.value || (Sn.value = {}))[Qt] = Zt.apply(this, arguments);
  }), function(Sn) {
    return get$1(Sn, $n).value[Qt];
  };
}
function interpolate(_e, Qt) {
  var Zt;
  return (typeof Qt == "number" ? interpolateNumber : Qt instanceof color$3 ? interpolateRgb : (Zt = color$3(Qt)) ? (Qt = Zt, interpolateRgb) : interpolateString)(_e, Qt);
}
function attrRemove(_e) {
  return function() {
    this.removeAttribute(_e);
  };
}
function attrRemoveNS(_e) {
  return function() {
    this.removeAttributeNS(_e.space, _e.local);
  };
}
function attrConstant(_e, Qt, Zt) {
  var $n, Sn = Zt + "", kn;
  return function() {
    var Kn = this.getAttribute(_e);
    return Kn === Sn ? null : Kn === $n ? kn : kn = Qt($n = Kn, Zt);
  };
}
function attrConstantNS(_e, Qt, Zt) {
  var $n, Sn = Zt + "", kn;
  return function() {
    var Kn = this.getAttributeNS(_e.space, _e.local);
    return Kn === Sn ? null : Kn === $n ? kn : kn = Qt($n = Kn, Zt);
  };
}
function attrFunction(_e, Qt, Zt) {
  var $n, Sn, kn;
  return function() {
    var Kn, er = Zt(this), Cr;
    return er == null ? void this.removeAttribute(_e) : (Kn = this.getAttribute(_e), Cr = er + "", Kn === Cr ? null : Kn === $n && Cr === Sn ? kn : (Sn = Cr, kn = Qt($n = Kn, er)));
  };
}
function attrFunctionNS(_e, Qt, Zt) {
  var $n, Sn, kn;
  return function() {
    var Kn, er = Zt(this), Cr;
    return er == null ? void this.removeAttributeNS(_e.space, _e.local) : (Kn = this.getAttributeNS(_e.space, _e.local), Cr = er + "", Kn === Cr ? null : Kn === $n && Cr === Sn ? kn : (Sn = Cr, kn = Qt($n = Kn, er)));
  };
}
function transition_attr(_e, Qt) {
  var Zt = namespace(_e), $n = Zt === "transform" ? interpolateTransformSvg : interpolate;
  return this.attrTween(_e, typeof Qt == "function" ? (Zt.local ? attrFunctionNS : attrFunction)(Zt, $n, tweenValue(this, "attr." + _e, Qt)) : Qt == null ? (Zt.local ? attrRemoveNS : attrRemove)(Zt) : (Zt.local ? attrConstantNS : attrConstant)(Zt, $n, Qt));
}
function attrInterpolate(_e, Qt) {
  return function(Zt) {
    this.setAttribute(_e, Qt.call(this, Zt));
  };
}
function attrInterpolateNS(_e, Qt) {
  return function(Zt) {
    this.setAttributeNS(_e.space, _e.local, Qt.call(this, Zt));
  };
}
function attrTweenNS(_e, Qt) {
  var Zt, $n;
  function Sn() {
    var kn = Qt.apply(this, arguments);
    return kn !== $n && (Zt = ($n = kn) && attrInterpolateNS(_e, kn)), Zt;
  }
  return Sn._value = Qt, Sn;
}
function attrTween(_e, Qt) {
  var Zt, $n;
  function Sn() {
    var kn = Qt.apply(this, arguments);
    return kn !== $n && (Zt = ($n = kn) && attrInterpolate(_e, kn)), Zt;
  }
  return Sn._value = Qt, Sn;
}
function transition_attrTween(_e, Qt) {
  var Zt = "attr." + _e;
  if (arguments.length < 2)
    return (Zt = this.tween(Zt)) && Zt._value;
  if (Qt == null)
    return this.tween(Zt, null);
  if (typeof Qt != "function")
    throw new Error();
  var $n = namespace(_e);
  return this.tween(Zt, ($n.local ? attrTweenNS : attrTween)($n, Qt));
}
function delayFunction(_e, Qt) {
  return function() {
    init(this, _e).delay = +Qt.apply(this, arguments);
  };
}
function delayConstant(_e, Qt) {
  return Qt = +Qt, function() {
    init(this, _e).delay = Qt;
  };
}
function transition_delay(_e) {
  var Qt = this._id;
  return arguments.length ? this.each((typeof _e == "function" ? delayFunction : delayConstant)(Qt, _e)) : get$1(this.node(), Qt).delay;
}
function durationFunction(_e, Qt) {
  return function() {
    set(this, _e).duration = +Qt.apply(this, arguments);
  };
}
function durationConstant(_e, Qt) {
  return Qt = +Qt, function() {
    set(this, _e).duration = Qt;
  };
}
function transition_duration(_e) {
  var Qt = this._id;
  return arguments.length ? this.each((typeof _e == "function" ? durationFunction : durationConstant)(Qt, _e)) : get$1(this.node(), Qt).duration;
}
function easeConstant(_e, Qt) {
  if (typeof Qt != "function")
    throw new Error();
  return function() {
    set(this, _e).ease = Qt;
  };
}
function transition_ease(_e) {
  var Qt = this._id;
  return arguments.length ? this.each(easeConstant(Qt, _e)) : get$1(this.node(), Qt).ease;
}
function easeVarying(_e, Qt) {
  return function() {
    var Zt = Qt.apply(this, arguments);
    if (typeof Zt != "function")
      throw new Error();
    set(this, _e).ease = Zt;
  };
}
function transition_easeVarying(_e) {
  if (typeof _e != "function")
    throw new Error();
  return this.each(easeVarying(this._id, _e));
}
function transition_filter(_e) {
  typeof _e != "function" && (_e = matcher(_e));
  for (var Qt = this._groups, Zt = Qt.length, $n = new Array(Zt), Sn = 0; Sn < Zt; ++Sn)
    for (var kn = Qt[Sn], Kn = kn.length, er = $n[Sn] = [], Cr, kr = 0; kr < Kn; ++kr)
      (Cr = kn[kr]) && _e.call(Cr, Cr.__data__, kr, kn) && er.push(Cr);
  return new Transition($n, this._parents, this._name, this._id);
}
function transition_merge(_e) {
  if (_e._id !== this._id)
    throw new Error();
  for (var Qt = this._groups, Zt = _e._groups, $n = Qt.length, Sn = Zt.length, kn = Math.min($n, Sn), Kn = new Array($n), er = 0; er < kn; ++er)
    for (var Cr = Qt[er], kr = Zt[er], Yr = Cr.length, Ms = Kn[er] = new Array(Yr), Ds, Ls = 0; Ls < Yr; ++Ls)
      (Ds = Cr[Ls] || kr[Ls]) && (Ms[Ls] = Ds);
  for (; er < $n; ++er)
    Kn[er] = Qt[er];
  return new Transition(Kn, this._parents, this._name, this._id);
}
function start(_e) {
  return (_e + "").trim().split(/^|\s+/).every(function(Qt) {
    var Zt = Qt.indexOf(".");
    return Zt >= 0 && (Qt = Qt.slice(0, Zt)), !Qt || Qt === "start";
  });
}
function onFunction(_e, Qt, Zt) {
  var $n, Sn, kn = start(Qt) ? init : set;
  return function() {
    var Kn = kn(this, _e), er = Kn.on;
    er !== $n && (Sn = ($n = er).copy()).on(Qt, Zt), Kn.on = Sn;
  };
}
function transition_on(_e, Qt) {
  var Zt = this._id;
  return arguments.length < 2 ? get$1(this.node(), Zt).on.on(_e) : this.each(onFunction(Zt, _e, Qt));
}
function removeFunction(_e) {
  return function() {
    var Qt = this.parentNode;
    for (var Zt in this.__transition)
      if (+Zt !== _e)
        return;
    Qt && Qt.removeChild(this);
  };
}
function transition_remove() {
  return this.on("end.remove", removeFunction(this._id));
}
function transition_select(_e) {
  var Qt = this._name, Zt = this._id;
  typeof _e != "function" && (_e = selector(_e));
  for (var $n = this._groups, Sn = $n.length, kn = new Array(Sn), Kn = 0; Kn < Sn; ++Kn)
    for (var er = $n[Kn], Cr = er.length, kr = kn[Kn] = new Array(Cr), Yr, Ms, Ds = 0; Ds < Cr; ++Ds)
      (Yr = er[Ds]) && (Ms = _e.call(Yr, Yr.__data__, Ds, er)) && ("__data__" in Yr && (Ms.__data__ = Yr.__data__), kr[Ds] = Ms, schedule(kr[Ds], Qt, Zt, Ds, kr, get$1(Yr, Zt)));
  return new Transition(kn, this._parents, Qt, Zt);
}
function transition_selectAll(_e) {
  var Qt = this._name, Zt = this._id;
  typeof _e != "function" && (_e = selectorAll(_e));
  for (var $n = this._groups, Sn = $n.length, kn = [], Kn = [], er = 0; er < Sn; ++er)
    for (var Cr = $n[er], kr = Cr.length, Yr, Ms = 0; Ms < kr; ++Ms)
      if (Yr = Cr[Ms]) {
        for (var Ds = _e.call(Yr, Yr.__data__, Ms, Cr), Ls, js = get$1(Yr, Zt), zs = 0, Fs = Ds.length; zs < Fs; ++zs)
          (Ls = Ds[zs]) && schedule(Ls, Qt, Zt, zs, Ds, js);
        kn.push(Ds), Kn.push(Yr);
      }
  return new Transition(kn, Kn, Qt, Zt);
}
var Selection = selection.prototype.constructor;
function transition_selection() {
  return new Selection(this._groups, this._parents);
}
function styleNull(_e, Qt) {
  var Zt, $n, Sn;
  return function() {
    var kn = styleValue(this, _e), Kn = (this.style.removeProperty(_e), styleValue(this, _e));
    return kn === Kn ? null : kn === Zt && Kn === $n ? Sn : Sn = Qt(Zt = kn, $n = Kn);
  };
}
function styleRemove(_e) {
  return function() {
    this.style.removeProperty(_e);
  };
}
function styleConstant(_e, Qt, Zt) {
  var $n, Sn = Zt + "", kn;
  return function() {
    var Kn = styleValue(this, _e);
    return Kn === Sn ? null : Kn === $n ? kn : kn = Qt($n = Kn, Zt);
  };
}
function styleFunction(_e, Qt, Zt) {
  var $n, Sn, kn;
  return function() {
    var Kn = styleValue(this, _e), er = Zt(this), Cr = er + "";
    return er == null && (Cr = er = (this.style.removeProperty(_e), styleValue(this, _e))), Kn === Cr ? null : Kn === $n && Cr === Sn ? kn : (Sn = Cr, kn = Qt($n = Kn, er));
  };
}
function styleMaybeRemove(_e, Qt) {
  var Zt, $n, Sn, kn = "style." + Qt, Kn = "end." + kn, er;
  return function() {
    var Cr = set(this, _e), kr = Cr.on, Yr = Cr.value[kn] == null ? er || (er = styleRemove(Qt)) : void 0;
    (kr !== Zt || Sn !== Yr) && ($n = (Zt = kr).copy()).on(Kn, Sn = Yr), Cr.on = $n;
  };
}
function transition_style(_e, Qt, Zt) {
  var $n = (_e += "") == "transform" ? interpolateTransformCss : interpolate;
  return Qt == null ? this.styleTween(_e, styleNull(_e, $n)).on("end.style." + _e, styleRemove(_e)) : typeof Qt == "function" ? this.styleTween(_e, styleFunction(_e, $n, tweenValue(this, "style." + _e, Qt))).each(styleMaybeRemove(this._id, _e)) : this.styleTween(_e, styleConstant(_e, $n, Qt), Zt).on("end.style." + _e, null);
}
function styleInterpolate(_e, Qt, Zt) {
  return function($n) {
    this.style.setProperty(_e, Qt.call(this, $n), Zt);
  };
}
function styleTween(_e, Qt, Zt) {
  var $n, Sn;
  function kn() {
    var Kn = Qt.apply(this, arguments);
    return Kn !== Sn && ($n = (Sn = Kn) && styleInterpolate(_e, Kn, Zt)), $n;
  }
  return kn._value = Qt, kn;
}
function transition_styleTween(_e, Qt, Zt) {
  var $n = "style." + (_e += "");
  if (arguments.length < 2)
    return ($n = this.tween($n)) && $n._value;
  if (Qt == null)
    return this.tween($n, null);
  if (typeof Qt != "function")
    throw new Error();
  return this.tween($n, styleTween(_e, Qt, Zt ?? ""));
}
function textConstant(_e) {
  return function() {
    this.textContent = _e;
  };
}
function textFunction(_e) {
  return function() {
    var Qt = _e(this);
    this.textContent = Qt ?? "";
  };
}
function transition_text(_e) {
  return this.tween("text", typeof _e == "function" ? textFunction(tweenValue(this, "text", _e)) : textConstant(_e == null ? "" : _e + ""));
}
function textInterpolate(_e) {
  return function(Qt) {
    this.textContent = _e.call(this, Qt);
  };
}
function textTween(_e) {
  var Qt, Zt;
  function $n() {
    var Sn = _e.apply(this, arguments);
    return Sn !== Zt && (Qt = (Zt = Sn) && textInterpolate(Sn)), Qt;
  }
  return $n._value = _e, $n;
}
function transition_textTween(_e) {
  var Qt = "text";
  if (arguments.length < 1)
    return (Qt = this.tween(Qt)) && Qt._value;
  if (_e == null)
    return this.tween(Qt, null);
  if (typeof _e != "function")
    throw new Error();
  return this.tween(Qt, textTween(_e));
}
function transition_transition() {
  for (var _e = this._name, Qt = this._id, Zt = newId(), $n = this._groups, Sn = $n.length, kn = 0; kn < Sn; ++kn)
    for (var Kn = $n[kn], er = Kn.length, Cr, kr = 0; kr < er; ++kr)
      if (Cr = Kn[kr]) {
        var Yr = get$1(Cr, Qt);
        schedule(Cr, _e, Zt, kr, Kn, {
          time: Yr.time + Yr.delay + Yr.duration,
          delay: 0,
          duration: Yr.duration,
          ease: Yr.ease
        });
      }
  return new Transition($n, this._parents, _e, Zt);
}
function transition_end() {
  var _e, Qt, Zt = this, $n = Zt._id, Sn = Zt.size();
  return new Promise(function(kn, Kn) {
    var er = { value: Kn }, Cr = { value: function() {
      --Sn === 0 && kn();
    } };
    Zt.each(function() {
      var kr = set(this, $n), Yr = kr.on;
      Yr !== _e && (Qt = (_e = Yr).copy(), Qt._.cancel.push(er), Qt._.interrupt.push(er), Qt._.end.push(Cr)), kr.on = Qt;
    }), Sn === 0 && kn();
  });
}
var id$1 = 0;
function Transition(_e, Qt, Zt, $n) {
  this._groups = _e, this._parents = Qt, this._name = Zt, this._id = $n;
}
function newId() {
  return ++id$1;
}
var selection_prototype = selection.prototype;
Transition.prototype = {
  constructor: Transition,
  select: transition_select,
  selectAll: transition_selectAll,
  selectChild: selection_prototype.selectChild,
  selectChildren: selection_prototype.selectChildren,
  filter: transition_filter,
  merge: transition_merge,
  selection: transition_selection,
  transition: transition_transition,
  call: selection_prototype.call,
  nodes: selection_prototype.nodes,
  node: selection_prototype.node,
  size: selection_prototype.size,
  empty: selection_prototype.empty,
  each: selection_prototype.each,
  on: transition_on,
  attr: transition_attr,
  attrTween: transition_attrTween,
  style: transition_style,
  styleTween: transition_styleTween,
  text: transition_text,
  textTween: transition_textTween,
  remove: transition_remove,
  tween: transition_tween,
  delay: transition_delay,
  duration: transition_duration,
  ease: transition_ease,
  easeVarying: transition_easeVarying,
  end: transition_end,
  [Symbol.iterator]: selection_prototype[Symbol.iterator]
};
function cubicInOut(_e) {
  return ((_e *= 2) <= 1 ? _e * _e * _e : (_e -= 2) * _e * _e + 2) / 2;
}
var defaultTiming = {
  time: null,
  // Set on use.
  delay: 0,
  duration: 250,
  ease: cubicInOut
};
function inherit(_e, Qt) {
  for (var Zt; !(Zt = _e.__transition) || !(Zt = Zt[Qt]); )
    if (!(_e = _e.parentNode))
      throw new Error(`transition ${Qt} not found`);
  return Zt;
}
function selection_transition(_e) {
  var Qt, Zt;
  _e instanceof Transition ? (Qt = _e._id, _e = _e._name) : (Qt = newId(), (Zt = defaultTiming).time = now(), _e = _e == null ? null : _e + "");
  for (var $n = this._groups, Sn = $n.length, kn = 0; kn < Sn; ++kn)
    for (var Kn = $n[kn], er = Kn.length, Cr, kr = 0; kr < er; ++kr)
      (Cr = Kn[kr]) && schedule(Cr, _e, Qt, kr, Kn, Zt || inherit(Cr, Qt));
  return new Transition($n, this._parents, _e, Qt);
}
selection.prototype.interrupt = selection_interrupt;
selection.prototype.transition = selection_transition;
const constant = (_e) => () => _e;
function ZoomEvent(_e, {
  sourceEvent: Qt,
  target: Zt,
  transform: $n,
  dispatch: Sn
}) {
  Object.defineProperties(this, {
    type: { value: _e, enumerable: !0, configurable: !0 },
    sourceEvent: { value: Qt, enumerable: !0, configurable: !0 },
    target: { value: Zt, enumerable: !0, configurable: !0 },
    transform: { value: $n, enumerable: !0, configurable: !0 },
    _: { value: Sn }
  });
}
function Transform(_e, Qt, Zt) {
  this.k = _e, this.x = Qt, this.y = Zt;
}
Transform.prototype = {
  constructor: Transform,
  scale: function(_e) {
    return _e === 1 ? this : new Transform(this.k * _e, this.x, this.y);
  },
  translate: function(_e, Qt) {
    return _e === 0 & Qt === 0 ? this : new Transform(this.k, this.x + this.k * _e, this.y + this.k * Qt);
  },
  apply: function(_e) {
    return [_e[0] * this.k + this.x, _e[1] * this.k + this.y];
  },
  applyX: function(_e) {
    return _e * this.k + this.x;
  },
  applyY: function(_e) {
    return _e * this.k + this.y;
  },
  invert: function(_e) {
    return [(_e[0] - this.x) / this.k, (_e[1] - this.y) / this.k];
  },
  invertX: function(_e) {
    return (_e - this.x) / this.k;
  },
  invertY: function(_e) {
    return (_e - this.y) / this.k;
  },
  rescaleX: function(_e) {
    return _e.copy().domain(_e.range().map(this.invertX, this).map(_e.invert, _e));
  },
  rescaleY: function(_e) {
    return _e.copy().domain(_e.range().map(this.invertY, this).map(_e.invert, _e));
  },
  toString: function() {
    return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
  }
};
var identity = new Transform(1, 0, 0);
Transform.prototype;
function nopropagation(_e) {
  _e.stopImmediatePropagation();
}
function noevent(_e) {
  _e.preventDefault(), _e.stopImmediatePropagation();
}
function defaultFilter(_e) {
  return (!_e.ctrlKey || _e.type === "wheel") && !_e.button;
}
function defaultExtent() {
  var _e = this;
  return _e instanceof SVGElement ? (_e = _e.ownerSVGElement || _e, _e.hasAttribute("viewBox") ? (_e = _e.viewBox.baseVal, [[_e.x, _e.y], [_e.x + _e.width, _e.y + _e.height]]) : [[0, 0], [_e.width.baseVal.value, _e.height.baseVal.value]]) : [[0, 0], [_e.clientWidth, _e.clientHeight]];
}
function defaultTransform() {
  return this.__zoom || identity;
}
function defaultWheelDelta(_e) {
  return -_e.deltaY * (_e.deltaMode === 1 ? 0.05 : _e.deltaMode ? 1 : 2e-3) * (_e.ctrlKey ? 10 : 1);
}
function defaultTouchable() {
  return navigator.maxTouchPoints || "ontouchstart" in this;
}
function defaultConstrain(_e, Qt, Zt) {
  var $n = _e.invertX(Qt[0][0]) - Zt[0][0], Sn = _e.invertX(Qt[1][0]) - Zt[1][0], kn = _e.invertY(Qt[0][1]) - Zt[0][1], Kn = _e.invertY(Qt[1][1]) - Zt[1][1];
  return _e.translate(
    Sn > $n ? ($n + Sn) / 2 : Math.min(0, $n) || Math.max(0, Sn),
    Kn > kn ? (kn + Kn) / 2 : Math.min(0, kn) || Math.max(0, Kn)
  );
}
function zoom() {
  var _e = defaultFilter, Qt = defaultExtent, Zt = defaultConstrain, $n = defaultWheelDelta, Sn = defaultTouchable, kn = [0, 1 / 0], Kn = [[-1 / 0, -1 / 0], [1 / 0, 1 / 0]], er = 250, Cr = interpolateZoom, kr = dispatch("start", "zoom", "end"), Yr, Ms, Ds, Ls = 500, js = 150, zs = 0, Fs = 10;
  function Bs(zu) {
    zu.property("__zoom", defaultTransform).on("wheel.zoom", Iu, { passive: !1 }).on("mousedown.zoom", Tu).on("dblclick.zoom", Au).filter(Sn).on("touchstart.zoom", Nu).on("touchmove.zoom", gm).on("touchend.zoom touchcancel.zoom", pm).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
  }
  Bs.transform = function(zu, Yu, sm, mm) {
    var hm = zu.selection ? zu.selection() : zu;
    hm.property("__zoom", defaultTransform), zu !== hm ? El(zu, Yu, sm, mm) : hm.interrupt().each(function() {
      Mu(this, arguments).event(mm).start().zoom(null, typeof Yu == "function" ? Yu.apply(this, arguments) : Yu).end();
    });
  }, Bs.scaleBy = function(zu, Yu, sm, mm) {
    Bs.scaleTo(zu, function() {
      var hm = this.__zoom.k, ym = typeof Yu == "function" ? Yu.apply(this, arguments) : Yu;
      return hm * ym;
    }, sm, mm);
  }, Bs.scaleTo = function(zu, Yu, sm, mm) {
    Bs.transform(zu, function() {
      var hm = Qt.apply(this, arguments), ym = this.__zoom, _m = sm == null ? Ys(hm) : typeof sm == "function" ? sm.apply(this, arguments) : sm, Sm = ym.invert(_m), wm = typeof Yu == "function" ? Yu.apply(this, arguments) : Yu;
      return Zt(Ws(Hs(ym, wm), _m, Sm), hm, Kn);
    }, sm, mm);
  }, Bs.translateBy = function(zu, Yu, sm, mm) {
    Bs.transform(zu, function() {
      return Zt(this.__zoom.translate(
        typeof Yu == "function" ? Yu.apply(this, arguments) : Yu,
        typeof sm == "function" ? sm.apply(this, arguments) : sm
      ), Qt.apply(this, arguments), Kn);
    }, null, mm);
  }, Bs.translateTo = function(zu, Yu, sm, mm, hm) {
    Bs.transform(zu, function() {
      var ym = Qt.apply(this, arguments), _m = this.__zoom, Sm = mm == null ? Ys(ym) : typeof mm == "function" ? mm.apply(this, arguments) : mm;
      return Zt(identity.translate(Sm[0], Sm[1]).scale(_m.k).translate(
        typeof Yu == "function" ? -Yu.apply(this, arguments) : -Yu,
        typeof sm == "function" ? -sm.apply(this, arguments) : -sm
      ), ym, Kn);
    }, mm, hm);
  };
  function Hs(zu, Yu) {
    return Yu = Math.max(kn[0], Math.min(kn[1], Yu)), Yu === zu.k ? zu : new Transform(Yu, zu.x, zu.y);
  }
  function Ws(zu, Yu, sm) {
    var mm = Yu[0] - sm[0] * zu.k, hm = Yu[1] - sm[1] * zu.k;
    return mm === zu.x && hm === zu.y ? zu : new Transform(zu.k, mm, hm);
  }
  function Ys(zu) {
    return [(+zu[0][0] + +zu[1][0]) / 2, (+zu[0][1] + +zu[1][1]) / 2];
  }
  function El(zu, Yu, sm, mm) {
    zu.on("start.zoom", function() {
      Mu(this, arguments).event(mm).start();
    }).on("interrupt.zoom end.zoom", function() {
      Mu(this, arguments).event(mm).end();
    }).tween("zoom", function() {
      var hm = this, ym = arguments, _m = Mu(hm, ym).event(mm), Sm = Qt.apply(hm, ym), wm = sm == null ? Ys(Sm) : typeof sm == "function" ? sm.apply(hm, ym) : sm, Nm = Math.max(Sm[1][0] - Sm[0][0], Sm[1][1] - Sm[0][1]), Cm = hm.__zoom, Im = typeof Yu == "function" ? Yu.apply(hm, ym) : Yu, Am = Cr(Cm.invert(wm).concat(Nm / Cm.k), Im.invert(wm).concat(Nm / Im.k));
      return function(Vm) {
        if (Vm === 1)
          Vm = Im;
        else {
          var Rm = Am(Vm), Dm = Nm / Rm[2];
          Vm = new Transform(Dm, wm[0] - Rm[0] * Dm, wm[1] - Rm[1] * Dm);
        }
        _m.zoom(null, Vm);
      };
    });
  }
  function Mu(zu, Yu, sm) {
    return !sm && zu.__zooming || new Pl(zu, Yu);
  }
  function Pl(zu, Yu) {
    this.that = zu, this.args = Yu, this.active = 0, this.sourceEvent = null, this.extent = Qt.apply(zu, Yu), this.taps = 0;
  }
  Pl.prototype = {
    event: function(zu) {
      return zu && (this.sourceEvent = zu), this;
    },
    start: function() {
      return ++this.active === 1 && (this.that.__zooming = this, this.emit("start")), this;
    },
    zoom: function(zu, Yu) {
      return this.mouse && zu !== "mouse" && (this.mouse[1] = Yu.invert(this.mouse[0])), this.touch0 && zu !== "touch" && (this.touch0[1] = Yu.invert(this.touch0[0])), this.touch1 && zu !== "touch" && (this.touch1[1] = Yu.invert(this.touch1[0])), this.that.__zoom = Yu, this.emit("zoom"), this;
    },
    end: function() {
      return --this.active === 0 && (delete this.that.__zooming, this.emit("end")), this;
    },
    emit: function(zu) {
      var Yu = select(this.that).datum();
      kr.call(
        zu,
        this.that,
        new ZoomEvent(zu, {
          sourceEvent: this.sourceEvent,
          target: Bs,
          type: zu,
          transform: this.that.__zoom,
          dispatch: kr
        }),
        Yu
      );
    }
  };
  function Iu(zu, ...Yu) {
    if (!_e.apply(this, arguments))
      return;
    var sm = Mu(this, Yu).event(zu), mm = this.__zoom, hm = Math.max(kn[0], Math.min(kn[1], mm.k * Math.pow(2, $n.apply(this, arguments)))), ym = pointer(zu);
    if (sm.wheel)
      (sm.mouse[0][0] !== ym[0] || sm.mouse[0][1] !== ym[1]) && (sm.mouse[1] = mm.invert(sm.mouse[0] = ym)), clearTimeout(sm.wheel);
    else {
      if (mm.k === hm)
        return;
      sm.mouse = [ym, mm.invert(ym)], interrupt(this), sm.start();
    }
    noevent(zu), sm.wheel = setTimeout(_m, js), sm.zoom("mouse", Zt(Ws(Hs(mm, hm), sm.mouse[0], sm.mouse[1]), sm.extent, Kn));
    function _m() {
      sm.wheel = null, sm.end();
    }
  }
  function Tu(zu, ...Yu) {
    if (Ds || !_e.apply(this, arguments))
      return;
    var sm = zu.currentTarget, mm = Mu(this, Yu, !0).event(zu), hm = select(zu.view).on("mousemove.zoom", wm, !0).on("mouseup.zoom", Nm, !0), ym = pointer(zu, sm), _m = zu.clientX, Sm = zu.clientY;
    dragDisable(zu.view), nopropagation(zu), mm.mouse = [ym, this.__zoom.invert(ym)], interrupt(this), mm.start();
    function wm(Cm) {
      if (noevent(Cm), !mm.moved) {
        var Im = Cm.clientX - _m, Am = Cm.clientY - Sm;
        mm.moved = Im * Im + Am * Am > zs;
      }
      mm.event(Cm).zoom("mouse", Zt(Ws(mm.that.__zoom, mm.mouse[0] = pointer(Cm, sm), mm.mouse[1]), mm.extent, Kn));
    }
    function Nm(Cm) {
      hm.on("mousemove.zoom mouseup.zoom", null), yesdrag(Cm.view, mm.moved), noevent(Cm), mm.event(Cm).end();
    }
  }
  function Au(zu, ...Yu) {
    if (_e.apply(this, arguments)) {
      var sm = this.__zoom, mm = pointer(zu.changedTouches ? zu.changedTouches[0] : zu, this), hm = sm.invert(mm), ym = sm.k * (zu.shiftKey ? 0.5 : 2), _m = Zt(Ws(Hs(sm, ym), mm, hm), Qt.apply(this, Yu), Kn);
      noevent(zu), er > 0 ? select(this).transition().duration(er).call(El, _m, mm, zu) : select(this).call(Bs.transform, _m, mm, zu);
    }
  }
  function Nu(zu, ...Yu) {
    if (_e.apply(this, arguments)) {
      var sm = zu.touches, mm = sm.length, hm = Mu(this, Yu, zu.changedTouches.length === mm).event(zu), ym, _m, Sm, wm;
      for (nopropagation(zu), _m = 0; _m < mm; ++_m)
        Sm = sm[_m], wm = pointer(Sm, this), wm = [wm, this.__zoom.invert(wm), Sm.identifier], hm.touch0 ? !hm.touch1 && hm.touch0[2] !== wm[2] && (hm.touch1 = wm, hm.taps = 0) : (hm.touch0 = wm, ym = !0, hm.taps = 1 + !!Yr);
      Yr && (Yr = clearTimeout(Yr)), ym && (hm.taps < 2 && (Ms = wm[0], Yr = setTimeout(function() {
        Yr = null;
      }, Ls)), interrupt(this), hm.start());
    }
  }
  function gm(zu, ...Yu) {
    if (this.__zooming) {
      var sm = Mu(this, Yu).event(zu), mm = zu.changedTouches, hm = mm.length, ym, _m, Sm, wm;
      for (noevent(zu), ym = 0; ym < hm; ++ym)
        _m = mm[ym], Sm = pointer(_m, this), sm.touch0 && sm.touch0[2] === _m.identifier ? sm.touch0[0] = Sm : sm.touch1 && sm.touch1[2] === _m.identifier && (sm.touch1[0] = Sm);
      if (_m = sm.that.__zoom, sm.touch1) {
        var Nm = sm.touch0[0], Cm = sm.touch0[1], Im = sm.touch1[0], Am = sm.touch1[1], Vm = (Vm = Im[0] - Nm[0]) * Vm + (Vm = Im[1] - Nm[1]) * Vm, Rm = (Rm = Am[0] - Cm[0]) * Rm + (Rm = Am[1] - Cm[1]) * Rm;
        _m = Hs(_m, Math.sqrt(Vm / Rm)), Sm = [(Nm[0] + Im[0]) / 2, (Nm[1] + Im[1]) / 2], wm = [(Cm[0] + Am[0]) / 2, (Cm[1] + Am[1]) / 2];
      } else if (sm.touch0)
        Sm = sm.touch0[0], wm = sm.touch0[1];
      else
        return;
      sm.zoom("touch", Zt(Ws(_m, Sm, wm), sm.extent, Kn));
    }
  }
  function pm(zu, ...Yu) {
    if (this.__zooming) {
      var sm = Mu(this, Yu).event(zu), mm = zu.changedTouches, hm = mm.length, ym, _m;
      for (nopropagation(zu), Ds && clearTimeout(Ds), Ds = setTimeout(function() {
        Ds = null;
      }, Ls), ym = 0; ym < hm; ++ym)
        _m = mm[ym], sm.touch0 && sm.touch0[2] === _m.identifier ? delete sm.touch0 : sm.touch1 && sm.touch1[2] === _m.identifier && delete sm.touch1;
      if (sm.touch1 && !sm.touch0 && (sm.touch0 = sm.touch1, delete sm.touch1), sm.touch0)
        sm.touch0[1] = this.__zoom.invert(sm.touch0[0]);
      else if (sm.end(), sm.taps === 2 && (_m = pointer(_m, this), Math.hypot(Ms[0] - _m[0], Ms[1] - _m[1]) < Fs)) {
        var Sm = select(this).on("dblclick.zoom");
        Sm && Sm.apply(this, arguments);
      }
    }
  }
  return Bs.wheelDelta = function(zu) {
    return arguments.length ? ($n = typeof zu == "function" ? zu : constant(+zu), Bs) : $n;
  }, Bs.filter = function(zu) {
    return arguments.length ? (_e = typeof zu == "function" ? zu : constant(!!zu), Bs) : _e;
  }, Bs.touchable = function(zu) {
    return arguments.length ? (Sn = typeof zu == "function" ? zu : constant(!!zu), Bs) : Sn;
  }, Bs.extent = function(zu) {
    return arguments.length ? (Qt = typeof zu == "function" ? zu : constant([[+zu[0][0], +zu[0][1]], [+zu[1][0], +zu[1][1]]]), Bs) : Qt;
  }, Bs.scaleExtent = function(zu) {
    return arguments.length ? (kn[0] = +zu[0], kn[1] = +zu[1], Bs) : [kn[0], kn[1]];
  }, Bs.translateExtent = function(zu) {
    return arguments.length ? (Kn[0][0] = +zu[0][0], Kn[1][0] = +zu[1][0], Kn[0][1] = +zu[0][1], Kn[1][1] = +zu[1][1], Bs) : [[Kn[0][0], Kn[0][1]], [Kn[1][0], Kn[1][1]]];
  }, Bs.constrain = function(zu) {
    return arguments.length ? (Zt = zu, Bs) : Zt;
  }, Bs.duration = function(zu) {
    return arguments.length ? (er = +zu, Bs) : er;
  }, Bs.interpolate = function(zu) {
    return arguments.length ? (Cr = zu, Bs) : Cr;
  }, Bs.on = function() {
    var zu = kr.on.apply(kr, arguments);
    return zu === kr ? Bs : zu;
  }, Bs.clickDistance = function(zu) {
    return arguments.length ? (zs = (zu = +zu) * zu, Bs) : Math.sqrt(zs);
  }, Bs.tapDistance = function(zu) {
    return arguments.length ? (Fs = +zu, Bs) : Fs;
  }, Bs;
}
function Fm(_e) {
  return _e && _e.__esModule && Object.prototype.hasOwnProperty.call(_e, "default") ? _e.default : _e;
}
var Ki = { exports: {} }, Rr = {};
/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var Us;
function Wm() {
  if (Us)
    return Rr;
  Us = 1;
  var _e = React, Qt = Symbol.for("react.element"), Zt = Symbol.for("react.fragment"), $n = Object.prototype.hasOwnProperty, Sn = _e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, kn = { key: !0, ref: !0, __self: !0, __source: !0 };
  function Kn(er, Cr, kr) {
    var Yr, Ms = {}, Ds = null, Ls = null;
    kr !== void 0 && (Ds = "" + kr), Cr.key !== void 0 && (Ds = "" + Cr.key), Cr.ref !== void 0 && (Ls = Cr.ref);
    for (Yr in Cr)
      $n.call(Cr, Yr) && !kn.hasOwnProperty(Yr) && (Ms[Yr] = Cr[Yr]);
    if (er && er.defaultProps)
      for (Yr in Cr = er.defaultProps, Cr)
        Ms[Yr] === void 0 && (Ms[Yr] = Cr[Yr]);
    return { $$typeof: Qt, type: er, key: Ds, ref: Ls, props: Ms, _owner: Sn.current };
  }
  return Rr.Fragment = Zt, Rr.jsx = Kn, Rr.jsxs = Kn, Rr;
}
Ki.exports = Wm();
var Bu = Ki.exports;
const oe = Bu.jsx, lt$2 = Bu.jsxs;
var jo = yn(), ae = (_e) => gn(_e, jo), Mo = yn();
ae.write = (_e) => gn(_e, Mo);
var qa = yn();
ae.onStart = (_e) => gn(_e, qa);
var Do = yn();
ae.onFrame = (_e) => gn(_e, Do);
var zo = yn();
ae.onFinish = (_e) => gn(_e, zo);
var lr = [];
ae.setTimeout = (_e, Qt) => {
  let Zt = ae.now() + Qt, $n = () => {
    let kn = lr.findIndex((Kn) => Kn.cancel == $n);
    ~kn && lr.splice(kn, 1), kt -= ~kn ? 1 : 0;
  }, Sn = { time: Zt, handler: _e, cancel: $n };
  return lr.splice(Hu(Zt), 0, Sn), kt += 1, Uu(), Sn;
};
var Hu = (_e) => ~(~lr.findIndex((Qt) => Qt.time > _e) || ~lr.length);
ae.cancel = (_e) => {
  qa.delete(_e), Do.delete(_e), zo.delete(_e), jo.delete(_e), Mo.delete(_e);
};
ae.sync = (_e) => {
  Qi = !0, ae.batchedUpdates(_e), Qi = !1;
};
ae.throttle = (_e) => {
  let Qt;
  function Zt() {
    try {
      _e(...Qt);
    } finally {
      Qt = null;
    }
  }
  function $n(...Sn) {
    Qt = Sn, ae.onStart(Zt);
  }
  return $n.handler = _e, $n.cancel = () => {
    qa.delete(Zt), Qt = null;
  }, $n;
};
var Lo = typeof window < "u" ? window.requestAnimationFrame : () => {
};
ae.use = (_e) => Lo = _e;
ae.now = typeof performance < "u" ? () => performance.now() : Date.now;
ae.batchedUpdates = (_e) => _e();
ae.catch = console.error;
ae.frameLoop = "always";
ae.advance = () => {
  ae.frameLoop !== "demand" ? console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand") : Gu();
};
var $t = -1, kt = 0, Qi = !1;
function gn(_e, Qt) {
  Qi ? (Qt.delete(_e), _e(0)) : (Qt.add(_e), Uu());
}
function Uu() {
  $t < 0 && ($t = 0, ae.frameLoop !== "demand" && Lo(qu));
}
function Ym() {
  $t = -1;
}
function qu() {
  ~$t && (Lo(qu), ae.batchedUpdates(Gu));
}
function Gu() {
  let _e = $t;
  $t = ae.now();
  let Qt = Hu($t);
  if (Qt && (Xu(lr.splice(0, Qt), (Zt) => Zt.handler()), kt -= Qt), !kt) {
    Ym();
    return;
  }
  qa.flush(), jo.flush(_e ? Math.min(64, $t - _e) : 16.667), Do.flush(), Mo.flush(), zo.flush();
}
function yn() {
  let _e = /* @__PURE__ */ new Set(), Qt = _e;
  return { add(Zt) {
    kt += Qt == _e && !_e.has(Zt) ? 1 : 0, _e.add(Zt);
  }, delete(Zt) {
    return kt -= Qt == _e && _e.has(Zt) ? 1 : 0, _e.delete(Zt);
  }, flush(Zt) {
    Qt.size && (_e = /* @__PURE__ */ new Set(), kt -= Qt.size, Xu(Qt, ($n) => $n(Zt) && _e.add($n)), kt += _e.size, Qt = _e);
  } };
}
function Xu(_e, Qt) {
  _e.forEach((Zt) => {
    try {
      Qt(Zt);
    } catch ($n) {
      ae.catch($n);
    }
  });
}
var Bm = Object.defineProperty, Hm = (_e, Qt) => {
  for (var Zt in Qt)
    Bm(_e, Zt, { get: Qt[Zt], enumerable: !0 });
}, rt = {};
Hm(rt, { assign: () => qm, colors: () => Tt, createStringInterpolator: () => Wo, skipAnimation: () => Qu, to: () => Ku, willAdvance: () => Vo });
function Ji() {
}
var Um = (_e, Qt, Zt) => Object.defineProperty(_e, Qt, { value: Zt, writable: !0, configurable: !0 }), C = { arr: Array.isArray, obj: (_e) => !!_e && _e.constructor.name === "Object", fun: (_e) => typeof _e == "function", str: (_e) => typeof _e == "string", num: (_e) => typeof _e == "number", und: (_e) => _e === void 0 };
function vt(_e, Qt) {
  if (C.arr(_e)) {
    if (!C.arr(Qt) || _e.length !== Qt.length)
      return !1;
    for (let Zt = 0; Zt < _e.length; Zt++)
      if (_e[Zt] !== Qt[Zt])
        return !1;
    return !0;
  }
  return _e === Qt;
}
var ne = (_e, Qt) => _e.forEach(Qt);
function dt(_e, Qt, Zt) {
  if (C.arr(_e)) {
    for (let $n = 0; $n < _e.length; $n++)
      Qt.call(Zt, _e[$n], `${$n}`);
    return;
  }
  for (let $n in _e)
    _e.hasOwnProperty($n) && Qt.call(Zt, _e[$n], $n);
}
var Ne = (_e) => C.und(_e) ? [] : C.arr(_e) ? _e : [_e];
function Br(_e, Qt) {
  if (_e.size) {
    let Zt = Array.from(_e);
    _e.clear(), ne(Zt, Qt);
  }
}
var Wr = (_e, ...Qt) => Br(_e, (Zt) => Zt(...Qt)), Fo = () => typeof window > "u" || !window.navigator || /ServerSideRendering|^Deno\//.test(window.navigator.userAgent), Wo, Ku, Tt = null, Qu = !1, Vo = Ji, qm = (_e) => {
  _e.to && (Ku = _e.to), _e.now && (ae.now = _e.now), _e.colors !== void 0 && (Tt = _e.colors), _e.skipAnimation != null && (Qu = _e.skipAnimation), _e.createStringInterpolator && (Wo = _e.createStringInterpolator), _e.requestAnimationFrame && ae.use(_e.requestAnimationFrame), _e.batchedUpdates && (ae.batchedUpdates = _e.batchedUpdates), _e.willAdvance && (Vo = _e.willAdvance), _e.frameLoop && (ae.frameLoop = _e.frameLoop);
}, Hr = /* @__PURE__ */ new Set(), Xe = [], bi = [], sa = 0, Ga = { get idle() {
  return !Hr.size && !Xe.length;
}, start(_e) {
  sa > _e.priority ? (Hr.add(_e), ae.onStart(Gm)) : (Ju(_e), ae(Zi));
}, advance: Zi, sort(_e) {
  if (sa)
    ae.onFrame(() => Ga.sort(_e));
  else {
    let Qt = Xe.indexOf(_e);
    ~Qt && (Xe.splice(Qt, 1), Zu(_e));
  }
}, clear() {
  Xe = [], Hr.clear();
} };
function Gm() {
  Hr.forEach(Ju), Hr.clear(), ae(Zi);
}
function Ju(_e) {
  Xe.includes(_e) || Zu(_e);
}
function Zu(_e) {
  Xe.splice(Xm(Xe, (Qt) => Qt.priority > _e.priority), 0, _e);
}
function Zi(_e) {
  let Qt = bi;
  for (let Zt = 0; Zt < Xe.length; Zt++) {
    let $n = Xe[Zt];
    sa = $n.priority, $n.idle || (Vo($n), $n.advance(_e), $n.idle || Qt.push($n));
  }
  return sa = 0, bi = Xe, bi.length = 0, Xe = Qt, Xe.length > 0;
}
function Xm(_e, Qt) {
  let Zt = _e.findIndex(Qt);
  return Zt < 0 ? _e.length : Zt;
}
var Km = (_e, Qt, Zt) => Math.min(Math.max(Zt, _e), Qt), Qm = { transparent: 0, aliceblue: 4042850303, antiquewhite: 4209760255, aqua: 16777215, aquamarine: 2147472639, azure: 4043309055, beige: 4126530815, bisque: 4293182719, black: 255, blanchedalmond: 4293643775, blue: 65535, blueviolet: 2318131967, brown: 2771004159, burlywood: 3736635391, burntsienna: 3934150143, cadetblue: 1604231423, chartreuse: 2147418367, chocolate: 3530104575, coral: 4286533887, cornflowerblue: 1687547391, cornsilk: 4294499583, crimson: 3692313855, cyan: 16777215, darkblue: 35839, darkcyan: 9145343, darkgoldenrod: 3095792639, darkgray: 2846468607, darkgreen: 6553855, darkgrey: 2846468607, darkkhaki: 3182914559, darkmagenta: 2332068863, darkolivegreen: 1433087999, darkorange: 4287365375, darkorchid: 2570243327, darkred: 2332033279, darksalmon: 3918953215, darkseagreen: 2411499519, darkslateblue: 1211993087, darkslategray: 793726975, darkslategrey: 793726975, darkturquoise: 13554175, darkviolet: 2483082239, deeppink: 4279538687, deepskyblue: 12582911, dimgray: 1768516095, dimgrey: 1768516095, dodgerblue: 512819199, firebrick: 2988581631, floralwhite: 4294635775, forestgreen: 579543807, fuchsia: 4278255615, gainsboro: 3705462015, ghostwhite: 4177068031, gold: 4292280575, goldenrod: 3668254975, gray: 2155905279, green: 8388863, greenyellow: 2919182335, grey: 2155905279, honeydew: 4043305215, hotpink: 4285117695, indianred: 3445382399, indigo: 1258324735, ivory: 4294963455, khaki: 4041641215, lavender: 3873897215, lavenderblush: 4293981695, lawngreen: 2096890111, lemonchiffon: 4294626815, lightblue: 2916673279, lightcoral: 4034953471, lightcyan: 3774873599, lightgoldenrodyellow: 4210742015, lightgray: 3553874943, lightgreen: 2431553791, lightgrey: 3553874943, lightpink: 4290167295, lightsalmon: 4288707327, lightseagreen: 548580095, lightskyblue: 2278488831, lightslategray: 2005441023, lightslategrey: 2005441023, lightsteelblue: 2965692159, lightyellow: 4294959359, lime: 16711935, limegreen: 852308735, linen: 4210091775, magenta: 4278255615, maroon: 2147483903, mediumaquamarine: 1724754687, mediumblue: 52735, mediumorchid: 3126187007, mediumpurple: 2473647103, mediumseagreen: 1018393087, mediumslateblue: 2070474495, mediumspringgreen: 16423679, mediumturquoise: 1221709055, mediumvioletred: 3340076543, midnightblue: 421097727, mintcream: 4127193855, mistyrose: 4293190143, moccasin: 4293178879, navajowhite: 4292783615, navy: 33023, oldlace: 4260751103, olive: 2155872511, olivedrab: 1804477439, orange: 4289003775, orangered: 4282712319, orchid: 3664828159, palegoldenrod: 4008225535, palegreen: 2566625535, paleturquoise: 2951671551, palevioletred: 3681588223, papayawhip: 4293907967, peachpuff: 4292524543, peru: 3448061951, pink: 4290825215, plum: 3718307327, powderblue: 2967529215, purple: 2147516671, rebeccapurple: 1714657791, red: 4278190335, rosybrown: 3163525119, royalblue: 1097458175, saddlebrown: 2336560127, salmon: 4202722047, sandybrown: 4104413439, seagreen: 780883967, seashell: 4294307583, sienna: 2689740287, silver: 3233857791, skyblue: 2278484991, slateblue: 1784335871, slategray: 1887473919, slategrey: 1887473919, snow: 4294638335, springgreen: 16744447, steelblue: 1182971135, tan: 3535047935, teal: 8421631, thistle: 3636451583, tomato: 4284696575, turquoise: 1088475391, violet: 4001558271, wheat: 4125012991, white: 4294967295, whitesmoke: 4126537215, yellow: 4294902015, yellowgreen: 2597139199 }, Je = "[-+]?\\d*\\.?\\d+", la = Je + "%";
function Xa(..._e) {
  return "\\(\\s*(" + _e.join(")\\s*,\\s*(") + ")\\s*\\)";
}
var Jm = new RegExp("rgb" + Xa(Je, Je, Je)), Zm = new RegExp("rgba" + Xa(Je, Je, Je, Je)), eh = new RegExp("hsl" + Xa(Je, la, la)), th = new RegExp("hsla" + Xa(Je, la, la, Je)), rh = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, nh = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, ah = /^#([0-9a-fA-F]{6})$/, ih = /^#([0-9a-fA-F]{8})$/;
function oh(_e) {
  let Qt;
  return typeof _e == "number" ? _e >>> 0 === _e && _e >= 0 && _e <= 4294967295 ? _e : null : (Qt = ah.exec(_e)) ? parseInt(Qt[1] + "ff", 16) >>> 0 : Tt && Tt[_e] !== void 0 ? Tt[_e] : (Qt = Jm.exec(_e)) ? (tr(Qt[1]) << 24 | tr(Qt[2]) << 16 | tr(Qt[3]) << 8 | 255) >>> 0 : (Qt = Zm.exec(_e)) ? (tr(Qt[1]) << 24 | tr(Qt[2]) << 16 | tr(Qt[3]) << 8 | Ks(Qt[4])) >>> 0 : (Qt = rh.exec(_e)) ? parseInt(Qt[1] + Qt[1] + Qt[2] + Qt[2] + Qt[3] + Qt[3] + "ff", 16) >>> 0 : (Qt = ih.exec(_e)) ? parseInt(Qt[1], 16) >>> 0 : (Qt = nh.exec(_e)) ? parseInt(Qt[1] + Qt[1] + Qt[2] + Qt[2] + Qt[3] + Qt[3] + Qt[4] + Qt[4], 16) >>> 0 : (Qt = eh.exec(_e)) ? (Gs(Xs(Qt[1]), Rn(Qt[2]), Rn(Qt[3])) | 255) >>> 0 : (Qt = th.exec(_e)) ? (Gs(Xs(Qt[1]), Rn(Qt[2]), Rn(Qt[3])) | Ks(Qt[4])) >>> 0 : null;
}
function wi(_e, Qt, Zt) {
  return Zt < 0 && (Zt += 1), Zt > 1 && (Zt -= 1), Zt < 1 / 6 ? _e + (Qt - _e) * 6 * Zt : Zt < 1 / 2 ? Qt : Zt < 2 / 3 ? _e + (Qt - _e) * (2 / 3 - Zt) * 6 : _e;
}
function Gs(_e, Qt, Zt) {
  let $n = Zt < 0.5 ? Zt * (1 + Qt) : Zt + Qt - Zt * Qt, Sn = 2 * Zt - $n, kn = wi(Sn, $n, _e + 1 / 3), Kn = wi(Sn, $n, _e), er = wi(Sn, $n, _e - 1 / 3);
  return Math.round(kn * 255) << 24 | Math.round(Kn * 255) << 16 | Math.round(er * 255) << 8;
}
function tr(_e) {
  let Qt = parseInt(_e, 10);
  return Qt < 0 ? 0 : Qt > 255 ? 255 : Qt;
}
function Xs(_e) {
  return (parseFloat(_e) % 360 + 360) % 360 / 360;
}
function Ks(_e) {
  let Qt = parseFloat(_e);
  return Qt < 0 ? 0 : Qt > 1 ? 255 : Math.round(Qt * 255);
}
function Rn(_e) {
  let Qt = parseFloat(_e);
  return Qt < 0 ? 0 : Qt > 100 ? 1 : Qt / 100;
}
function Qs(_e) {
  let Qt = oh(_e);
  if (Qt === null)
    return _e;
  Qt = Qt || 0;
  let Zt = (Qt & 4278190080) >>> 24, $n = (Qt & 16711680) >>> 16, Sn = (Qt & 65280) >>> 8, kn = (Qt & 255) / 255;
  return `rgba(${Zt}, ${$n}, ${Sn}, ${kn})`;
}
var Jr = (_e, Qt, Zt) => {
  if (C.fun(_e))
    return _e;
  if (C.arr(_e))
    return Jr({ range: _e, output: Qt, extrapolate: Zt });
  if (C.str(_e.output[0]))
    return Wo(_e);
  let $n = _e, Sn = $n.output, kn = $n.range || [0, 1], Kn = $n.extrapolateLeft || $n.extrapolate || "extend", er = $n.extrapolateRight || $n.extrapolate || "extend", Cr = $n.easing || ((kr) => kr);
  return (kr) => {
    let Yr = lh(kr, kn);
    return sh(kr, kn[Yr], kn[Yr + 1], Sn[Yr], Sn[Yr + 1], Cr, Kn, er, $n.map);
  };
};
function sh(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr) {
  let kr = Cr ? Cr(_e) : _e;
  if (kr < Qt) {
    if (Kn === "identity")
      return kr;
    Kn === "clamp" && (kr = Qt);
  }
  if (kr > Zt) {
    if (er === "identity")
      return kr;
    er === "clamp" && (kr = Zt);
  }
  return $n === Sn ? $n : Qt === Zt ? _e <= Qt ? $n : Sn : (Qt === -1 / 0 ? kr = -kr : Zt === 1 / 0 ? kr = kr - Qt : kr = (kr - Qt) / (Zt - Qt), kr = kn(kr), $n === -1 / 0 ? kr = -kr : Sn === 1 / 0 ? kr = kr + $n : kr = kr * (Sn - $n) + $n, kr);
}
function lh(_e, Qt) {
  for (var Zt = 1; Zt < Qt.length - 1 && !(Qt[Zt] >= _e); ++Zt)
    ;
  return Zt - 1;
}
var ch = (_e, Qt = "end") => (Zt) => {
  Zt = Qt === "end" ? Math.min(Zt, 0.999) : Math.max(Zt, 1e-3);
  let $n = Zt * _e, Sn = Qt === "end" ? Math.floor($n) : Math.ceil($n);
  return Km(0, 1, Sn / _e);
}, ca = 1.70158, Cn = ca * 1.525, Js = ca + 1, Zs = 2 * Math.PI / 3, el = 2 * Math.PI / 4.5, Tn = (_e) => _e < 1 / 2.75 ? 7.5625 * _e * _e : _e < 2 / 2.75 ? 7.5625 * (_e -= 1.5 / 2.75) * _e + 0.75 : _e < 2.5 / 2.75 ? 7.5625 * (_e -= 2.25 / 2.75) * _e + 0.9375 : 7.5625 * (_e -= 2.625 / 2.75) * _e + 0.984375, At = { linear: (_e) => _e, easeInQuad: (_e) => _e * _e, easeOutQuad: (_e) => 1 - (1 - _e) * (1 - _e), easeInOutQuad: (_e) => _e < 0.5 ? 2 * _e * _e : 1 - Math.pow(-2 * _e + 2, 2) / 2, easeInCubic: (_e) => _e * _e * _e, easeOutCubic: (_e) => 1 - Math.pow(1 - _e, 3), easeInOutCubic: (_e) => _e < 0.5 ? 4 * _e * _e * _e : 1 - Math.pow(-2 * _e + 2, 3) / 2, easeInQuart: (_e) => _e * _e * _e * _e, easeOutQuart: (_e) => 1 - Math.pow(1 - _e, 4), easeInOutQuart: (_e) => _e < 0.5 ? 8 * _e * _e * _e * _e : 1 - Math.pow(-2 * _e + 2, 4) / 2, easeInQuint: (_e) => _e * _e * _e * _e * _e, easeOutQuint: (_e) => 1 - Math.pow(1 - _e, 5), easeInOutQuint: (_e) => _e < 0.5 ? 16 * _e * _e * _e * _e * _e : 1 - Math.pow(-2 * _e + 2, 5) / 2, easeInSine: (_e) => 1 - Math.cos(_e * Math.PI / 2), easeOutSine: (_e) => Math.sin(_e * Math.PI / 2), easeInOutSine: (_e) => -(Math.cos(Math.PI * _e) - 1) / 2, easeInExpo: (_e) => _e === 0 ? 0 : Math.pow(2, 10 * _e - 10), easeOutExpo: (_e) => _e === 1 ? 1 : 1 - Math.pow(2, -10 * _e), easeInOutExpo: (_e) => _e === 0 ? 0 : _e === 1 ? 1 : _e < 0.5 ? Math.pow(2, 20 * _e - 10) / 2 : (2 - Math.pow(2, -20 * _e + 10)) / 2, easeInCirc: (_e) => 1 - Math.sqrt(1 - Math.pow(_e, 2)), easeOutCirc: (_e) => Math.sqrt(1 - Math.pow(_e - 1, 2)), easeInOutCirc: (_e) => _e < 0.5 ? (1 - Math.sqrt(1 - Math.pow(2 * _e, 2))) / 2 : (Math.sqrt(1 - Math.pow(-2 * _e + 2, 2)) + 1) / 2, easeInBack: (_e) => Js * _e * _e * _e - ca * _e * _e, easeOutBack: (_e) => 1 + Js * Math.pow(_e - 1, 3) + ca * Math.pow(_e - 1, 2), easeInOutBack: (_e) => _e < 0.5 ? Math.pow(2 * _e, 2) * ((Cn + 1) * 2 * _e - Cn) / 2 : (Math.pow(2 * _e - 2, 2) * ((Cn + 1) * (_e * 2 - 2) + Cn) + 2) / 2, easeInElastic: (_e) => _e === 0 ? 0 : _e === 1 ? 1 : -Math.pow(2, 10 * _e - 10) * Math.sin((_e * 10 - 10.75) * Zs), easeOutElastic: (_e) => _e === 0 ? 0 : _e === 1 ? 1 : Math.pow(2, -10 * _e) * Math.sin((_e * 10 - 0.75) * Zs) + 1, easeInOutElastic: (_e) => _e === 0 ? 0 : _e === 1 ? 1 : _e < 0.5 ? -(Math.pow(2, 20 * _e - 10) * Math.sin((20 * _e - 11.125) * el)) / 2 : Math.pow(2, -20 * _e + 10) * Math.sin((20 * _e - 11.125) * el) / 2 + 1, easeInBounce: (_e) => 1 - Tn(1 - _e), easeOutBounce: Tn, easeInOutBounce: (_e) => _e < 0.5 ? (1 - Tn(1 - 2 * _e)) / 2 : (1 + Tn(2 * _e - 1)) / 2, steps: ch }, mr = Symbol.for("FluidValue.get"), Ut = Symbol.for("FluidValue.observers"), Ge = (_e) => !!(_e && _e[mr]), Me = (_e) => _e && _e[mr] ? _e[mr]() : _e, tl = (_e) => _e[Ut] || null;
function uh(_e, Qt) {
  _e.eventObserved ? _e.eventObserved(Qt) : _e(Qt);
}
function Zr(_e, Qt) {
  let Zt = _e[Ut];
  Zt && Zt.forEach(($n) => {
    uh($n, Qt);
  });
}
var ez, tz, RD, ef = (RD = class {
  constructor(_e) {
    p$(this, ez);
    p$(this, tz);
    if (!_e && !(_e = this.get))
      throw Error("Unknown getter");
    fh(this, _e);
  }
}, ez = mr, tz = Ut, RD), fh = (_e, Qt) => tf(_e, mr, Qt);
function Or(_e, Qt) {
  if (_e[mr]) {
    let Zt = _e[Ut];
    Zt || tf(_e, Ut, Zt = /* @__PURE__ */ new Set()), Zt.has(Qt) || (Zt.add(Qt), _e.observerAdded && _e.observerAdded(Zt.size, Qt));
  }
  return Qt;
}
function en(_e, Qt) {
  let Zt = _e[Ut];
  if (Zt && Zt.has(Qt)) {
    let $n = Zt.size - 1;
    $n ? Zt.delete(Qt) : _e[Ut] = null, _e.observerRemoved && _e.observerRemoved($n, Qt);
  }
}
var tf = (_e, Qt, Zt) => Object.defineProperty(_e, Qt, { value: Zt, writable: !0, configurable: !0 }), Qn = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, dh = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi, rl = new RegExp(`(${Qn.source})(%|[a-z]+)`, "i"), ph = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi, Ka = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/, rf = (_e) => {
  let [Qt, Zt] = mh(_e);
  if (!Qt || Fo())
    return _e;
  let $n = window.getComputedStyle(document.documentElement).getPropertyValue(Qt);
  return $n ? $n.trim() : Zt && Zt.startsWith("--") ? window.getComputedStyle(document.documentElement).getPropertyValue(Zt) || _e : Zt && Ka.test(Zt) ? rf(Zt) : Zt || _e;
}, mh = (_e) => {
  let Qt = Ka.exec(_e);
  if (!Qt)
    return [,];
  let [, Zt, $n] = Qt;
  return [Zt, $n];
}, _i, hh = (_e, Qt, Zt, $n, Sn) => `rgba(${Math.round(Qt)}, ${Math.round(Zt)}, ${Math.round($n)}, ${Sn})`, nf = (_e) => {
  _i || (_i = Tt ? new RegExp(`(${Object.keys(Tt).join("|")})(?!\\w)`, "g") : /^\b$/);
  let Qt = _e.output.map((Sn) => Me(Sn).replace(Ka, rf).replace(dh, Qs).replace(_i, Qs)), Zt = Qt.map((Sn) => Sn.match(Qn).map(Number)), $n = Zt[0].map((Sn, kn) => Zt.map((Kn) => {
    if (!(kn in Kn))
      throw Error('The arity of each "output" value must be equal');
    return Kn[kn];
  })).map((Sn) => Jr({ ..._e, output: Sn }));
  return (Sn) => {
    var er;
    let kn = !rl.test(Qt[0]) && ((er = Qt.find((Cr) => rl.test(Cr))) == null ? void 0 : er.replace(Qn, "")), Kn = 0;
    return Qt[0].replace(Qn, () => `${$n[Kn++](Sn)}${kn || ""}`).replace(ph, hh);
  };
}, Yo = "react-spring: ", af = (_e) => {
  let Qt = _e, Zt = !1;
  if (typeof Qt != "function")
    throw new TypeError(`${Yo}once requires a function parameter`);
  return (...$n) => {
    Zt || (Qt(...$n), Zt = !0);
  };
}, vh = af(console.warn);
function gh() {
  vh(`${Yo}The "interpolate" function is deprecated in v9 (use "to" instead)`);
}
var yh = af(console.warn);
function bh() {
  yh(`${Yo}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`);
}
function Qa(_e) {
  return C.str(_e) && (_e[0] == "#" || /\d/.test(_e) || !Fo() && Ka.test(_e) || _e in (Tt || {}));
}
var Vt = Fo() ? reactExports.useEffect : reactExports.useLayoutEffect, wh = () => {
  let _e = reactExports.useRef(!1);
  return Vt(() => (_e.current = !0, () => {
    _e.current = !1;
  }), []), _e;
};
function Bo() {
  let _e = reactExports.useState()[1], Qt = wh();
  return () => {
    Qt.current && _e(Math.random());
  };
}
function _h(_e, Qt) {
  let [Zt] = reactExports.useState(() => ({ inputs: Qt, result: _e() })), $n = reactExports.useRef(), Sn = $n.current, kn = Sn;
  return kn ? Qt && kn.inputs && xh(Qt, kn.inputs) || (kn = { inputs: Qt, result: _e() }) : kn = Zt, reactExports.useEffect(() => {
    $n.current = kn, Sn == Zt && (Zt.inputs = Zt.result = void 0);
  }, [kn]), kn.result;
}
function xh(_e, Qt) {
  if (_e.length !== Qt.length)
    return !1;
  for (let Zt = 0; Zt < _e.length; Zt++)
    if (_e[Zt] !== Qt[Zt])
      return !1;
  return !0;
}
var Ho = (_e) => reactExports.useEffect(_e, Oh), Oh = [];
function eo(_e) {
  let Qt = reactExports.useRef();
  return reactExports.useEffect(() => {
    Qt.current = _e;
  }), Qt.current;
}
var tn = Symbol.for("Animated:node"), Ph = (_e) => !!_e && _e[tn] === _e, it = (_e) => _e && _e[tn], Uo = (_e, Qt) => Um(_e, tn, Qt), Ja = (_e) => _e && _e[tn] && _e[tn].getPayload(), of = class {
  constructor() {
    p$(this, "payload");
    Uo(this, this);
  }
  getPayload() {
    return this.payload || [];
  }
}, bn = class extends of {
  constructor(Qt) {
    super();
    p$(this, "done", !0);
    p$(this, "elapsedTime");
    p$(this, "lastPosition");
    p$(this, "lastVelocity");
    p$(this, "v0");
    p$(this, "durationProgress", 0);
    this._value = Qt, C.num(this._value) && (this.lastPosition = this._value);
  }
  static create(Qt) {
    return new bn(Qt);
  }
  getPayload() {
    return [this];
  }
  getValue() {
    return this._value;
  }
  setValue(Qt, Zt) {
    return C.num(Qt) && (this.lastPosition = Qt, Zt && (Qt = Math.round(Qt / Zt) * Zt, this.done && (this.lastPosition = Qt))), this._value === Qt ? !1 : (this._value = Qt, !0);
  }
  reset() {
    let { done: Qt } = this;
    this.done = !1, C.num(this._value) && (this.elapsedTime = 0, this.durationProgress = 0, this.lastPosition = this._value, Qt && (this.lastVelocity = null), this.v0 = null);
  }
}, rn = class extends bn {
  constructor(Qt) {
    super(0);
    p$(this, "_string", null);
    p$(this, "_toString");
    this._toString = Jr({ output: [Qt, Qt] });
  }
  static create(Qt) {
    return new rn(Qt);
  }
  getValue() {
    return this._string ?? (this._string = this._toString(this._value));
  }
  setValue(Qt) {
    if (C.str(Qt)) {
      if (Qt == this._string)
        return !1;
      this._string = Qt, this._value = 1;
    } else if (super.setValue(Qt))
      this._string = null;
    else
      return !1;
    return !0;
  }
  reset(Qt) {
    Qt && (this._toString = Jr({ output: [this.getValue(), Qt] })), this._value = 0, super.reset();
  }
}, ua = { dependencies: null }, Za = class extends of {
  constructor(_e) {
    super(), this.source = _e, this.setValue(_e);
  }
  getValue(_e) {
    let Qt = {};
    return dt(this.source, (Zt, $n) => {
      Ph(Zt) ? Qt[$n] = Zt.getValue(_e) : Ge(Zt) ? Qt[$n] = Me(Zt) : _e || (Qt[$n] = Zt);
    }), Qt;
  }
  setValue(_e) {
    this.source = _e, this.payload = this._makePayload(_e);
  }
  reset() {
    this.payload && ne(this.payload, (_e) => _e.reset());
  }
  _makePayload(_e) {
    if (_e) {
      let Qt = /* @__PURE__ */ new Set();
      return dt(_e, this._addToPayload, Qt), Array.from(Qt);
    }
  }
  _addToPayload(_e) {
    ua.dependencies && Ge(_e) && ua.dependencies.add(_e);
    let Qt = Ja(_e);
    Qt && ne(Qt, (Zt) => this.add(Zt));
  }
}, sf = class extends Za {
  constructor(_e) {
    super(_e);
  }
  static create(_e) {
    return new sf(_e);
  }
  getValue() {
    return this.source.map((_e) => _e.getValue());
  }
  setValue(_e) {
    let Qt = this.getPayload();
    return _e.length == Qt.length ? Qt.map((Zt, $n) => Zt.setValue(_e[$n])).some(Boolean) : (super.setValue(_e.map(Eh)), !0);
  }
};
function Eh(_e) {
  return (Qa(_e) ? rn : bn).create(_e);
}
function to(_e) {
  let Qt = it(_e);
  return Qt ? Qt.constructor : C.arr(_e) ? sf : Qa(_e) ? rn : bn;
}
var nl = (_e, Qt) => {
  let Zt = !C.fun(_e) || _e.prototype && _e.prototype.isReactComponent;
  return reactExports.forwardRef(($n, Sn) => {
    let kn = reactExports.useRef(null), Kn = Zt && reactExports.useCallback((js) => {
      kn.current = kh(Sn, js);
    }, [Sn]), [er, Cr] = $h($n, Qt), kr = Bo(), Yr = () => {
      let js = kn.current;
      Zt && !js || (js ? Qt.applyAnimatedValues(js, er.getValue(!0)) : !1) === !1 && kr();
    }, Ms = new Sh(Yr, Cr), Ds = reactExports.useRef();
    Vt(() => (Ds.current = Ms, ne(Cr, (js) => Or(js, Ms)), () => {
      Ds.current && (ne(Ds.current.deps, (js) => en(js, Ds.current)), ae.cancel(Ds.current.update));
    })), reactExports.useEffect(Yr, []), Ho(() => () => {
      let js = Ds.current;
      ne(js.deps, (zs) => en(zs, js));
    });
    let Ls = Qt.getComponentProps(er.getValue());
    return reactExports.createElement(_e, { ...Ls, ref: Kn });
  });
}, Sh = class {
  constructor(_e, Qt) {
    this.update = _e, this.deps = Qt;
  }
  eventObserved(_e) {
    _e.type == "change" && ae.write(this.update);
  }
};
function $h(_e, Qt) {
  let Zt = /* @__PURE__ */ new Set();
  return ua.dependencies = Zt, _e.style && (_e = { ..._e, style: Qt.createAnimatedStyle(_e.style) }), _e = new Za(_e), ua.dependencies = null, [_e, Zt];
}
function kh(_e, Qt) {
  return _e && (C.fun(_e) ? _e(Qt) : _e.current = Qt), Qt;
}
var al = Symbol.for("AnimatedComponent"), Rh = (_e, { applyAnimatedValues: Qt = () => !1, createAnimatedStyle: Zt = (Sn) => new Za(Sn), getComponentProps: $n = (Sn) => Sn } = {}) => {
  let Sn = { applyAnimatedValues: Qt, createAnimatedStyle: Zt, getComponentProps: $n }, kn = (Kn) => {
    let er = il(Kn) || "Anonymous";
    return C.str(Kn) ? Kn = kn[Kn] || (kn[Kn] = nl(Kn, Sn)) : Kn = Kn[al] || (Kn[al] = nl(Kn, Sn)), Kn.displayName = `Animated(${er})`, Kn;
  };
  return dt(_e, (Kn, er) => {
    C.arr(_e) && (er = il(Kn)), kn[er] = kn(Kn);
  }), { animated: kn };
}, il = (_e) => C.str(_e) ? _e : _e && C.str(_e.displayName) ? _e.displayName : C.fun(_e) && _e.name || null;
function De(_e, ...Qt) {
  return C.fun(_e) ? _e(...Qt) : _e;
}
var Ur = (_e, Qt) => _e === !0 || !!(Qt && _e && (C.fun(_e) ? _e(Qt) : Ne(_e).includes(Qt))), lf = (_e, Qt) => C.obj(_e) ? Qt && _e[Qt] : _e, cf = (_e, Qt) => _e.default === !0 ? _e[Qt] : _e.default ? _e.default[Qt] : void 0, Ch = (_e) => _e, ei = (_e, Qt = Ch) => {
  let Zt = Th;
  _e.default && _e.default !== !0 && (_e = _e.default, Zt = Object.keys(_e));
  let $n = {};
  for (let Sn of Zt) {
    let kn = Qt(_e[Sn], Sn);
    C.und(kn) || ($n[Sn] = kn);
  }
  return $n;
}, Th = ["config", "onProps", "onStart", "onChange", "onPause", "onResume", "onRest"], Ah = { config: 1, from: 1, to: 1, ref: 1, loop: 1, reset: 1, pause: 1, cancel: 1, reverse: 1, immediate: 1, default: 1, delay: 1, onProps: 1, onStart: 1, onChange: 1, onPause: 1, onResume: 1, onRest: 1, onResolve: 1, items: 1, trail: 1, sort: 1, expires: 1, initial: 1, enter: 1, update: 1, leave: 1, children: 1, onDestroyed: 1, keys: 1, callId: 1, parentId: 1 };
function Ih(_e) {
  let Qt = {}, Zt = 0;
  if (dt(_e, ($n, Sn) => {
    Ah[Sn] || (Qt[Sn] = $n, Zt++);
  }), Zt)
    return Qt;
}
function qo(_e) {
  let Qt = Ih(_e);
  if (Qt) {
    let Zt = { to: Qt };
    return dt(_e, ($n, Sn) => Sn in Qt || (Zt[Sn] = $n)), Zt;
  }
  return { ..._e };
}
function nn(_e) {
  return _e = Me(_e), C.arr(_e) ? _e.map(nn) : Qa(_e) ? rt.createStringInterpolator({ range: [0, 1], output: [_e, _e] })(1) : _e;
}
function uf(_e) {
  for (let Qt in _e)
    return !0;
  return !1;
}
function ro(_e) {
  return C.fun(_e) || C.arr(_e) && C.obj(_e[0]);
}
function no(_e, Qt) {
  var Zt;
  (Zt = _e.ref) == null || Zt.delete(_e), Qt == null || Qt.delete(_e);
}
function ff(_e, Qt) {
  var Zt;
  Qt && _e.ref !== Qt && ((Zt = _e.ref) == null || Zt.delete(_e), Qt.add(_e), _e.ref = Qt);
}
var Nh = { default: { tension: 170, friction: 26 }, gentle: { tension: 120, friction: 14 }, wobbly: { tension: 180, friction: 12 }, stiff: { tension: 210, friction: 20 }, slow: { tension: 280, friction: 60 }, molasses: { tension: 280, friction: 120 } }, ao = { ...Nh.default, mass: 1, damping: 1, easing: At.linear, clamp: !1 }, jh = class {
  constructor() {
    p$(this, "tension");
    p$(this, "friction");
    p$(this, "frequency");
    p$(this, "damping");
    p$(this, "mass");
    p$(this, "velocity", 0);
    p$(this, "restVelocity");
    p$(this, "precision");
    p$(this, "progress");
    p$(this, "duration");
    p$(this, "easing");
    p$(this, "clamp");
    p$(this, "bounce");
    p$(this, "decay");
    p$(this, "round");
    Object.assign(this, ao);
  }
};
function Mh(_e, Qt, Zt) {
  Zt && (Zt = { ...Zt }, ol(Zt, Qt), Qt = { ...Zt, ...Qt }), ol(_e, Qt), Object.assign(_e, Qt);
  for (let Kn in ao)
    _e[Kn] == null && (_e[Kn] = ao[Kn]);
  let { frequency: $n, damping: Sn } = _e, { mass: kn } = _e;
  return C.und($n) || ($n < 0.01 && ($n = 0.01), Sn < 0 && (Sn = 0), _e.tension = Math.pow(2 * Math.PI / $n, 2) * kn, _e.friction = 4 * Math.PI * Sn * kn / $n), _e;
}
function ol(_e, Qt) {
  if (!C.und(Qt.decay))
    _e.duration = void 0;
  else {
    let Zt = !C.und(Qt.tension) || !C.und(Qt.friction);
    (Zt || !C.und(Qt.frequency) || !C.und(Qt.damping) || !C.und(Qt.mass)) && (_e.duration = void 0, _e.decay = void 0), Zt && (_e.frequency = void 0);
  }
}
var sl = [], Dh = class {
  constructor() {
    p$(this, "changed", !1);
    p$(this, "values", sl);
    p$(this, "toValues", null);
    p$(this, "fromValues", sl);
    p$(this, "to");
    p$(this, "from");
    p$(this, "config", new jh());
    p$(this, "immediate", !1);
  }
};
function df(_e, { key: Qt, props: Zt, defaultProps: $n, state: Sn, actions: kn }) {
  return new Promise((Kn, er) => {
    let Cr, kr, Yr = Ur(Zt.cancel ?? ($n == null ? void 0 : $n.cancel), Qt);
    if (Yr)
      Ls();
    else {
      C.und(Zt.pause) || (Sn.paused = Ur(Zt.pause, Qt));
      let js = $n == null ? void 0 : $n.pause;
      js !== !0 && (js = Sn.paused || Ur(js, Qt)), Cr = De(Zt.delay || 0, Qt), js ? (Sn.resumeQueue.add(Ds), kn.pause()) : (kn.resume(), Ds());
    }
    function Ms() {
      Sn.resumeQueue.add(Ds), Sn.timeouts.delete(kr), kr.cancel(), Cr = kr.time - ae.now();
    }
    function Ds() {
      Cr > 0 && !rt.skipAnimation ? (Sn.delayed = !0, kr = ae.setTimeout(Ls, Cr), Sn.pauseQueue.add(Ms), Sn.timeouts.add(kr)) : Ls();
    }
    function Ls() {
      Sn.delayed && (Sn.delayed = !1), Sn.pauseQueue.delete(Ms), Sn.timeouts.delete(kr), _e <= (Sn.cancelId || 0) && (Yr = !0);
      try {
        kn.start({ ...Zt, callId: _e, cancel: Yr }, Kn);
      } catch (js) {
        er(js);
      }
    }
  });
}
var Go = (_e, Qt) => Qt.length == 1 ? Qt[0] : Qt.some((Zt) => Zt.cancelled) ? cr(_e.get()) : Qt.every((Zt) => Zt.noop) ? pf(_e.get()) : Ke(_e.get(), Qt.every((Zt) => Zt.finished)), pf = (_e) => ({ value: _e, noop: !0, finished: !0, cancelled: !1 }), Ke = (_e, Qt, Zt = !1) => ({ value: _e, finished: Qt, cancelled: Zt }), cr = (_e) => ({ value: _e, cancelled: !0, finished: !1 });
function mf(_e, Qt, Zt, $n) {
  let { callId: Sn, parentId: kn, onRest: Kn } = Qt, { asyncTo: er, promise: Cr } = Zt;
  return !kn && _e === er && !Qt.reset ? Cr : Zt.promise = (async () => {
    Zt.asyncId = Sn, Zt.asyncTo = _e;
    let kr = ei(Qt, (Fs, Bs) => Bs === "onRest" ? void 0 : Fs), Yr, Ms, Ds = new Promise((Fs, Bs) => (Yr = Fs, Ms = Bs)), Ls = (Fs) => {
      let Bs = Sn <= (Zt.cancelId || 0) && cr($n) || Sn !== Zt.asyncId && Ke($n, !1);
      if (Bs)
        throw Fs.result = Bs, Ms(Fs), Fs;
    }, js = (Fs, Bs) => {
      let Hs = new ll(), Ws = new cl();
      return (async () => {
        if (rt.skipAnimation)
          throw an(Zt), Ws.result = Ke($n, !1), Ms(Ws), Ws;
        Ls(Hs);
        let Ys = C.obj(Fs) ? { ...Fs } : { ...Bs, to: Fs };
        Ys.parentId = Sn, dt(kr, (Mu, Pl) => {
          C.und(Ys[Pl]) && (Ys[Pl] = Mu);
        });
        let El = await $n.start(Ys);
        return Ls(Hs), Zt.paused && await new Promise((Mu) => {
          Zt.resumeQueue.add(Mu);
        }), El;
      })();
    }, zs;
    if (rt.skipAnimation)
      return an(Zt), Ke($n, !1);
    try {
      let Fs;
      C.arr(_e) ? Fs = (async (Bs) => {
        for (let Hs of Bs)
          await js(Hs);
      })(_e) : Fs = Promise.resolve(_e(js, $n.stop.bind($n))), await Promise.all([Fs.then(Yr), Ds]), zs = Ke($n.get(), !0, !1);
    } catch (Fs) {
      if (Fs instanceof ll)
        zs = Fs.result;
      else if (Fs instanceof cl)
        zs = Fs.result;
      else
        throw Fs;
    } finally {
      Sn == Zt.asyncId && (Zt.asyncId = kn, Zt.asyncTo = kn ? er : void 0, Zt.promise = kn ? Cr : void 0);
    }
    return C.fun(Kn) && ae.batchedUpdates(() => {
      Kn(zs, $n, $n.item);
    }), zs;
  })();
}
function an(_e, Qt) {
  Br(_e.timeouts, (Zt) => Zt.cancel()), _e.pauseQueue.clear(), _e.resumeQueue.clear(), _e.asyncId = _e.asyncTo = _e.promise = void 0, Qt && (_e.cancelId = Qt);
}
var ll = class extends Error {
  constructor() {
    super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.");
    p$(this, "result");
  }
}, cl = class extends Error {
  constructor() {
    super("SkipAnimationSignal");
    p$(this, "result");
  }
}, io = (_e) => _e instanceof Xo, zh = 1, Xo = class extends ef {
  constructor() {
    super(...arguments);
    p$(this, "id", zh++);
    p$(this, "_priority", 0);
  }
  get priority() {
    return this._priority;
  }
  set priority(Qt) {
    this._priority != Qt && (this._priority = Qt, this._onPriorityChange(Qt));
  }
  get() {
    let Qt = it(this);
    return Qt && Qt.getValue();
  }
  to(...Qt) {
    return rt.to(this, Qt);
  }
  interpolate(...Qt) {
    return gh(), rt.to(this, Qt);
  }
  toJSON() {
    return this.get();
  }
  observerAdded(Qt) {
    Qt == 1 && this._attach();
  }
  observerRemoved(Qt) {
    Qt == 0 && this._detach();
  }
  _attach() {
  }
  _detach() {
  }
  _onChange(Qt, Zt = !1) {
    Zr(this, { type: "change", parent: this, value: Qt, idle: Zt });
  }
  _onPriorityChange(Qt) {
    this.idle || Ga.sort(this), Zr(this, { type: "priority", parent: this, priority: Qt });
  }
}, qt = Symbol.for("SpringPhase"), hf = 1, oo = 2, so = 4, xi = (_e) => (_e[qt] & hf) > 0, Ot = (_e) => (_e[qt] & oo) > 0, Tr = (_e) => (_e[qt] & so) > 0, ul = (_e, Qt) => Qt ? _e[qt] |= oo | hf : _e[qt] &= ~oo, fl = (_e, Qt) => Qt ? _e[qt] |= so : _e[qt] &= ~so, Lh = class extends Xo {
  constructor(Qt, Zt) {
    super();
    p$(this, "key");
    p$(this, "animation", new Dh());
    p$(this, "queue");
    p$(this, "defaultProps", {});
    p$(this, "_state", { paused: !1, delayed: !1, pauseQueue: /* @__PURE__ */ new Set(), resumeQueue: /* @__PURE__ */ new Set(), timeouts: /* @__PURE__ */ new Set() });
    p$(this, "_pendingCalls", /* @__PURE__ */ new Set());
    p$(this, "_lastCallId", 0);
    p$(this, "_lastToId", 0);
    p$(this, "_memoizedDuration", 0);
    if (!C.und(Qt) || !C.und(Zt)) {
      let $n = C.obj(Qt) ? { ...Qt } : { ...Zt, from: Qt };
      C.und($n.default) && ($n.default = !0), this.start($n);
    }
  }
  get idle() {
    return !(Ot(this) || this._state.asyncTo) || Tr(this);
  }
  get goal() {
    return Me(this.animation.to);
  }
  get velocity() {
    let Qt = it(this);
    return Qt instanceof bn ? Qt.lastVelocity || 0 : Qt.getPayload().map((Zt) => Zt.lastVelocity || 0);
  }
  get hasAnimated() {
    return xi(this);
  }
  get isAnimating() {
    return Ot(this);
  }
  get isPaused() {
    return Tr(this);
  }
  get isDelayed() {
    return this._state.delayed;
  }
  advance(Qt) {
    let Zt = !0, $n = !1, Sn = this.animation, { toValues: kn } = Sn, { config: Kn } = Sn, er = Ja(Sn.to);
    !er && Ge(Sn.to) && (kn = Ne(Me(Sn.to))), Sn.values.forEach((Yr, Ms) => {
      if (Yr.done)
        return;
      let Ds = Yr.constructor == rn ? 1 : er ? er[Ms].lastPosition : kn[Ms], Ls = Sn.immediate, js = Ds;
      if (!Ls) {
        if (js = Yr.lastPosition, Kn.tension <= 0) {
          Yr.done = !0;
          return;
        }
        let zs = Yr.elapsedTime += Qt, Fs = Sn.fromValues[Ms], Bs = Yr.v0 != null ? Yr.v0 : Yr.v0 = C.arr(Kn.velocity) ? Kn.velocity[Ms] : Kn.velocity, Hs, Ws = Kn.precision || (Fs == Ds ? 5e-3 : Math.min(1, Math.abs(Ds - Fs) * 1e-3));
        if (C.und(Kn.duration))
          if (Kn.decay) {
            let Ys = Kn.decay === !0 ? 0.998 : Kn.decay, El = Math.exp(-(1 - Ys) * zs);
            js = Fs + Bs / (1 - Ys) * (1 - El), Ls = Math.abs(Yr.lastPosition - js) <= Ws, Hs = Bs * El;
          } else {
            Hs = Yr.lastVelocity == null ? Bs : Yr.lastVelocity;
            let Ys = Kn.restVelocity || Ws / 10, El = Kn.clamp ? 0 : Kn.bounce, Mu = !C.und(El), Pl = Fs == Ds ? Yr.v0 > 0 : Fs < Ds, Iu, Tu = !1, Au = 1, Nu = Math.ceil(Qt / Au);
            for (let gm = 0; gm < Nu && (Iu = Math.abs(Hs) > Ys, !(!Iu && (Ls = Math.abs(Ds - js) <= Ws, Ls))); ++gm) {
              Mu && (Tu = js == Ds || js > Ds == Pl, Tu && (Hs = -Hs * El, js = Ds));
              let pm = -Kn.tension * 1e-6 * (js - Ds), zu = -Kn.friction * 1e-3 * Hs, Yu = (pm + zu) / Kn.mass;
              Hs = Hs + Yu * Au, js = js + Hs * Au;
            }
          }
        else {
          let Ys = 1;
          Kn.duration > 0 && (this._memoizedDuration !== Kn.duration && (this._memoizedDuration = Kn.duration, Yr.durationProgress > 0 && (Yr.elapsedTime = Kn.duration * Yr.durationProgress, zs = Yr.elapsedTime += Qt)), Ys = (Kn.progress || 0) + zs / this._memoizedDuration, Ys = Ys > 1 ? 1 : Ys < 0 ? 0 : Ys, Yr.durationProgress = Ys), js = Fs + Kn.easing(Ys) * (Ds - Fs), Hs = (js - Yr.lastPosition) / Qt, Ls = Ys == 1;
        }
        Yr.lastVelocity = Hs, Number.isNaN(js) && (console.warn("Got NaN while animating:", this), Ls = !0);
      }
      er && !er[Ms].done && (Ls = !1), Ls ? Yr.done = !0 : Zt = !1, Yr.setValue(js, Kn.round) && ($n = !0);
    });
    let Cr = it(this), kr = Cr.getValue();
    if (Zt) {
      let Yr = Me(Sn.to);
      (kr !== Yr || $n) && !Kn.decay ? (Cr.setValue(Yr), this._onChange(Yr)) : $n && Kn.decay && this._onChange(kr), this._stop();
    } else
      $n && this._onChange(kr);
  }
  set(Qt) {
    return ae.batchedUpdates(() => {
      this._stop(), this._focus(Qt), this._set(Qt);
    }), this;
  }
  pause() {
    this._update({ pause: !0 });
  }
  resume() {
    this._update({ pause: !1 });
  }
  finish() {
    if (Ot(this)) {
      let { to: Qt, config: Zt } = this.animation;
      ae.batchedUpdates(() => {
        this._onStart(), Zt.decay || this._set(Qt, !1), this._stop();
      });
    }
    return this;
  }
  update(Qt) {
    return (this.queue || (this.queue = [])).push(Qt), this;
  }
  start(Qt, Zt) {
    let $n;
    return C.und(Qt) ? ($n = this.queue || [], this.queue = []) : $n = [C.obj(Qt) ? Qt : { ...Zt, to: Qt }], Promise.all($n.map((Sn) => this._update(Sn))).then((Sn) => Go(this, Sn));
  }
  stop(Qt) {
    let { to: Zt } = this.animation;
    return this._focus(this.get()), an(this._state, Qt && this._lastCallId), ae.batchedUpdates(() => this._stop(Zt, Qt)), this;
  }
  reset() {
    this._update({ reset: !0 });
  }
  eventObserved(Qt) {
    Qt.type == "change" ? this._start() : Qt.type == "priority" && (this.priority = Qt.priority + 1);
  }
  _prepareNode(Qt) {
    let Zt = this.key || "", { to: $n, from: Sn } = Qt;
    $n = C.obj($n) ? $n[Zt] : $n, ($n == null || ro($n)) && ($n = void 0), Sn = C.obj(Sn) ? Sn[Zt] : Sn, Sn == null && (Sn = void 0);
    let kn = { to: $n, from: Sn };
    return xi(this) || (Qt.reverse && ([$n, Sn] = [Sn, $n]), Sn = Me(Sn), C.und(Sn) ? it(this) || this._set($n) : this._set(Sn)), kn;
  }
  _update({ ...Qt }, Zt) {
    let { key: $n, defaultProps: Sn } = this;
    Qt.default && Object.assign(Sn, ei(Qt, (er, Cr) => /^on/.test(Cr) ? lf(er, $n) : er)), pl(this, Qt, "onProps"), Ir(this, "onProps", Qt, this);
    let kn = this._prepareNode(Qt);
    if (Object.isFrozen(this))
      throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");
    let Kn = this._state;
    return df(++this._lastCallId, { key: $n, props: Qt, defaultProps: Sn, state: Kn, actions: { pause: () => {
      Tr(this) || (fl(this, !0), Wr(Kn.pauseQueue), Ir(this, "onPause", Ke(this, Ar(this, this.animation.to)), this));
    }, resume: () => {
      Tr(this) && (fl(this, !1), Ot(this) && this._resume(), Wr(Kn.resumeQueue), Ir(this, "onResume", Ke(this, Ar(this, this.animation.to)), this));
    }, start: this._merge.bind(this, kn) } }).then((er) => {
      if (Qt.loop && er.finished && !(Zt && er.noop)) {
        let Cr = vf(Qt);
        if (Cr)
          return this._update(Cr, !0);
      }
      return er;
    });
  }
  _merge(Qt, Zt, $n) {
    if (Zt.cancel)
      return this.stop(!0), $n(cr(this));
    let Sn = !C.und(Qt.to), kn = !C.und(Qt.from);
    if (Sn || kn)
      if (Zt.callId > this._lastToId)
        this._lastToId = Zt.callId;
      else
        return $n(cr(this));
    let { key: Kn, defaultProps: er, animation: Cr } = this, { to: kr, from: Yr } = Cr, { to: Ms = kr, from: Ds = Yr } = Qt;
    kn && !Sn && (!Zt.default || C.und(Ms)) && (Ms = Ds), Zt.reverse && ([Ms, Ds] = [Ds, Ms]);
    let Ls = !vt(Ds, Yr);
    Ls && (Cr.from = Ds), Ds = Me(Ds);
    let js = !vt(Ms, kr);
    js && this._focus(Ms);
    let zs = ro(Zt.to), { config: Fs } = Cr, { decay: Bs, velocity: Hs } = Fs;
    (Sn || kn) && (Fs.velocity = 0), Zt.config && !zs && Mh(Fs, De(Zt.config, Kn), Zt.config !== er.config ? De(er.config, Kn) : void 0);
    let Ws = it(this);
    if (!Ws || C.und(Ms))
      return $n(Ke(this, !0));
    let Ys = C.und(Zt.reset) ? kn && !Zt.default : !C.und(Ds) && Ur(Zt.reset, Kn), El = Ys ? Ds : this.get(), Mu = nn(Ms), Pl = C.num(Mu) || C.arr(Mu) || Qa(Mu), Iu = !zs && (!Pl || Ur(er.immediate || Zt.immediate, Kn));
    if (js) {
      let gm = to(Ms);
      if (gm !== Ws.constructor)
        if (Iu)
          Ws = this._set(Mu);
        else
          throw Error(`Cannot animate between ${Ws.constructor.name} and ${gm.name}, as the "to" prop suggests`);
    }
    let Tu = Ws.constructor, Au = Ge(Ms), Nu = !1;
    if (!Au) {
      let gm = Ys || !xi(this) && Ls;
      (js || gm) && (Nu = vt(nn(El), Mu), Au = !Nu), (!vt(Cr.immediate, Iu) && !Iu || !vt(Fs.decay, Bs) || !vt(Fs.velocity, Hs)) && (Au = !0);
    }
    if (Nu && Ot(this) && (Cr.changed && !Ys ? Au = !0 : Au || this._stop(kr)), !zs && ((Au || Ge(kr)) && (Cr.values = Ws.getPayload(), Cr.toValues = Ge(Ms) ? null : Tu == rn ? [1] : Ne(Mu)), Cr.immediate != Iu && (Cr.immediate = Iu, !Iu && !Ys && this._set(kr)), Au)) {
      let { onRest: gm } = Cr;
      ne(Wh, (zu) => pl(this, Zt, zu));
      let pm = Ke(this, Ar(this, kr));
      Wr(this._pendingCalls, pm), this._pendingCalls.add($n), Cr.changed && ae.batchedUpdates(() => {
        var zu;
        Cr.changed = !Ys, gm == null || gm(pm, this), Ys ? De(er.onRest, pm) : (zu = Cr.onStart) == null || zu.call(Cr, pm, this);
      });
    }
    Ys && this._set(El), zs ? $n(mf(Zt.to, Zt, this._state, this)) : Au ? this._start() : Ot(this) && !js ? this._pendingCalls.add($n) : $n(pf(El));
  }
  _focus(Qt) {
    let Zt = this.animation;
    Qt !== Zt.to && (tl(this) && this._detach(), Zt.to = Qt, tl(this) && this._attach());
  }
  _attach() {
    let Qt = 0, { to: Zt } = this.animation;
    Ge(Zt) && (Or(Zt, this), io(Zt) && (Qt = Zt.priority + 1)), this.priority = Qt;
  }
  _detach() {
    let { to: Qt } = this.animation;
    Ge(Qt) && en(Qt, this);
  }
  _set(Qt, Zt = !0) {
    let $n = Me(Qt);
    if (!C.und($n)) {
      let Sn = it(this);
      if (!Sn || !vt($n, Sn.getValue())) {
        let kn = to($n);
        !Sn || Sn.constructor != kn ? Uo(this, kn.create($n)) : Sn.setValue($n), Sn && ae.batchedUpdates(() => {
          this._onChange($n, Zt);
        });
      }
    }
    return it(this);
  }
  _onStart() {
    let Qt = this.animation;
    Qt.changed || (Qt.changed = !0, Ir(this, "onStart", Ke(this, Ar(this, Qt.to)), this));
  }
  _onChange(Qt, Zt) {
    Zt || (this._onStart(), De(this.animation.onChange, Qt, this)), De(this.defaultProps.onChange, Qt, this), super._onChange(Qt, Zt);
  }
  _start() {
    let Qt = this.animation;
    it(this).reset(Me(Qt.to)), Qt.immediate || (Qt.fromValues = Qt.values.map((Zt) => Zt.lastPosition)), Ot(this) || (ul(this, !0), Tr(this) || this._resume());
  }
  _resume() {
    rt.skipAnimation ? this.finish() : Ga.start(this);
  }
  _stop(Qt, Zt) {
    if (Ot(this)) {
      ul(this, !1);
      let $n = this.animation;
      ne($n.values, (kn) => {
        kn.done = !0;
      }), $n.toValues && ($n.onChange = $n.onPause = $n.onResume = void 0), Zr(this, { type: "idle", parent: this });
      let Sn = Zt ? cr(this.get()) : Ke(this.get(), Ar(this, Qt ?? $n.to));
      Wr(this._pendingCalls, Sn), $n.changed && ($n.changed = !1, Ir(this, "onRest", Sn, this));
    }
  }
};
function Ar(_e, Qt) {
  let Zt = nn(Qt), $n = nn(_e.get());
  return vt($n, Zt);
}
function vf(_e, Qt = _e.loop, Zt = _e.to) {
  let $n = De(Qt);
  if ($n) {
    let Sn = $n !== !0 && qo($n), kn = (Sn || _e).reverse, Kn = !Sn || Sn.reset;
    return on({ ..._e, loop: Qt, default: !1, pause: void 0, to: !kn || ro(Zt) ? Zt : void 0, from: Kn ? _e.from : void 0, reset: Kn, ...Sn });
  }
}
function on(_e) {
  let { to: Qt, from: Zt } = _e = qo(_e), $n = /* @__PURE__ */ new Set();
  return C.obj(Qt) && dl(Qt, $n), C.obj(Zt) && dl(Zt, $n), _e.keys = $n.size ? Array.from($n) : null, _e;
}
function Fh(_e) {
  let Qt = on(_e);
  return C.und(Qt.default) && (Qt.default = ei(Qt)), Qt;
}
function dl(_e, Qt) {
  dt(_e, (Zt, $n) => Zt != null && Qt.add($n));
}
var Wh = ["onStart", "onRest", "onChange", "onPause", "onResume"];
function pl(_e, Qt, Zt) {
  _e.animation[Zt] = Qt[Zt] !== cf(Qt, Zt) ? lf(Qt[Zt], _e.key) : void 0;
}
function Ir(_e, Qt, ...Zt) {
  var $n, Sn, kn, Kn;
  (Sn = ($n = _e.animation)[Qt]) == null || Sn.call($n, ...Zt), (Kn = (kn = _e.defaultProps)[Qt]) == null || Kn.call(kn, ...Zt);
}
var Vh = ["onStart", "onChange", "onRest"], Yh = 1, gf = class {
  constructor(_e, Qt) {
    p$(this, "id", Yh++);
    p$(this, "springs", {});
    p$(this, "queue", []);
    p$(this, "ref");
    p$(this, "_flush");
    p$(this, "_initialProps");
    p$(this, "_lastAsyncId", 0);
    p$(this, "_active", /* @__PURE__ */ new Set());
    p$(this, "_changed", /* @__PURE__ */ new Set());
    p$(this, "_started", !1);
    p$(this, "_item");
    p$(this, "_state", { paused: !1, pauseQueue: /* @__PURE__ */ new Set(), resumeQueue: /* @__PURE__ */ new Set(), timeouts: /* @__PURE__ */ new Set() });
    p$(this, "_events", { onStart: /* @__PURE__ */ new Map(), onChange: /* @__PURE__ */ new Map(), onRest: /* @__PURE__ */ new Map() });
    this._onFrame = this._onFrame.bind(this), Qt && (this._flush = Qt), _e && this.start({ default: !0, ..._e });
  }
  get idle() {
    return !this._state.asyncTo && Object.values(this.springs).every((_e) => _e.idle && !_e.isDelayed && !_e.isPaused);
  }
  get item() {
    return this._item;
  }
  set item(_e) {
    this._item = _e;
  }
  get() {
    let _e = {};
    return this.each((Qt, Zt) => _e[Zt] = Qt.get()), _e;
  }
  set(_e) {
    for (let Qt in _e) {
      let Zt = _e[Qt];
      C.und(Zt) || this.springs[Qt].set(Zt);
    }
  }
  update(_e) {
    return _e && this.queue.push(on(_e)), this;
  }
  start(_e) {
    let { queue: Qt } = this;
    return _e ? Qt = Ne(_e).map(on) : this.queue = [], this._flush ? this._flush(this, Qt) : (xf(this, Qt), lo(this, Qt));
  }
  stop(_e, Qt) {
    if (_e !== !!_e && (Qt = _e), Qt) {
      let Zt = this.springs;
      ne(Ne(Qt), ($n) => Zt[$n].stop(!!_e));
    } else
      an(this._state, this._lastAsyncId), this.each((Zt) => Zt.stop(!!_e));
    return this;
  }
  pause(_e) {
    if (C.und(_e))
      this.start({ pause: !0 });
    else {
      let Qt = this.springs;
      ne(Ne(_e), (Zt) => Qt[Zt].pause());
    }
    return this;
  }
  resume(_e) {
    if (C.und(_e))
      this.start({ pause: !1 });
    else {
      let Qt = this.springs;
      ne(Ne(_e), (Zt) => Qt[Zt].resume());
    }
    return this;
  }
  each(_e) {
    dt(this.springs, _e);
  }
  _onFrame() {
    let { onStart: _e, onChange: Qt, onRest: Zt } = this._events, $n = this._active.size > 0, Sn = this._changed.size > 0;
    ($n && !this._started || Sn && !this._started) && (this._started = !0, Br(_e, ([er, Cr]) => {
      Cr.value = this.get(), er(Cr, this, this._item);
    }));
    let kn = !$n && this._started, Kn = Sn || kn && Zt.size ? this.get() : null;
    Sn && Qt.size && Br(Qt, ([er, Cr]) => {
      Cr.value = Kn, er(Cr, this, this._item);
    }), kn && (this._started = !1, Br(Zt, ([er, Cr]) => {
      Cr.value = Kn, er(Cr, this, this._item);
    }));
  }
  eventObserved(_e) {
    if (_e.type == "change")
      this._changed.add(_e.parent), _e.idle || this._active.add(_e.parent);
    else if (_e.type == "idle")
      this._active.delete(_e.parent);
    else
      return;
    ae.onFrame(this._onFrame);
  }
};
function lo(_e, Qt) {
  return Promise.all(Qt.map((Zt) => yf(_e, Zt))).then((Zt) => Go(_e, Zt));
}
async function yf(_e, Qt, Zt) {
  let { keys: $n, to: Sn, from: kn, loop: Kn, onRest: er, onResolve: Cr } = Qt, kr = C.obj(Qt.default) && Qt.default;
  Kn && (Qt.loop = !1), Sn === !1 && (Qt.to = null), kn === !1 && (Qt.from = null);
  let Yr = C.arr(Sn) || C.fun(Sn) ? Sn : void 0;
  Yr ? (Qt.to = void 0, Qt.onRest = void 0, kr && (kr.onRest = void 0)) : ne(Vh, (zs) => {
    let Fs = Qt[zs];
    if (C.fun(Fs)) {
      let Bs = _e._events[zs];
      Qt[zs] = ({ finished: Hs, cancelled: Ws }) => {
        let Ys = Bs.get(Fs);
        Ys ? (Hs || (Ys.finished = !1), Ws && (Ys.cancelled = !0)) : Bs.set(Fs, { value: null, finished: Hs || !1, cancelled: Ws || !1 });
      }, kr && (kr[zs] = Qt[zs]);
    }
  });
  let Ms = _e._state;
  Qt.pause === !Ms.paused ? (Ms.paused = Qt.pause, Wr(Qt.pause ? Ms.pauseQueue : Ms.resumeQueue)) : Ms.paused && (Qt.pause = !0);
  let Ds = ($n || Object.keys(_e.springs)).map((zs) => _e.springs[zs].start(Qt)), Ls = Qt.cancel === !0 || cf(Qt, "cancel") === !0;
  (Yr || Ls && Ms.asyncId) && Ds.push(df(++_e._lastAsyncId, { props: Qt, state: Ms, actions: { pause: Ji, resume: Ji, start(zs, Fs) {
    Ls ? (an(Ms, _e._lastAsyncId), Fs(cr(_e))) : (zs.onRest = er, Fs(mf(Yr, zs, Ms, _e)));
  } } })), Ms.paused && await new Promise((zs) => {
    Ms.resumeQueue.add(zs);
  });
  let js = Go(_e, await Promise.all(Ds));
  if (Kn && js.finished && !(Zt && js.noop)) {
    let zs = vf(Qt, Kn, Sn);
    if (zs)
      return xf(_e, [zs]), yf(_e, zs, !0);
  }
  return Cr && ae.batchedUpdates(() => Cr(js, _e, _e.item)), js;
}
function co(_e, Qt) {
  let Zt = { ..._e.springs };
  return Qt && ne(Ne(Qt), ($n) => {
    C.und($n.keys) && ($n = on($n)), C.obj($n.to) || ($n = { ...$n, to: void 0 }), _f(Zt, $n, (Sn) => wf(Sn));
  }), bf(_e, Zt), Zt;
}
function bf(_e, Qt) {
  dt(Qt, (Zt, $n) => {
    _e.springs[$n] || (_e.springs[$n] = Zt, Or(Zt, _e));
  });
}
function wf(_e, Qt) {
  let Zt = new Lh();
  return Zt.key = _e, Qt && Or(Zt, Qt), Zt;
}
function _f(_e, Qt, Zt) {
  Qt.keys && ne(Qt.keys, ($n) => {
    (_e[$n] || (_e[$n] = Zt($n)))._prepareNode(Qt);
  });
}
function xf(_e, Qt) {
  ne(Qt, (Zt) => {
    _f(_e.springs, Zt, ($n) => wf($n, _e));
  });
}
var wn = ({ children: _e, ...Qt }) => {
  let Zt = reactExports.useContext(fa), $n = Qt.pause || !!Zt.pause, Sn = Qt.immediate || !!Zt.immediate;
  Qt = _h(() => ({ pause: $n, immediate: Sn }), [$n, Sn]);
  let { Provider: kn } = fa;
  return reactExports.createElement(kn, { value: Qt }, _e);
}, fa = Bh(wn, {});
wn.Provider = fa.Provider;
wn.Consumer = fa.Consumer;
function Bh(_e, Qt) {
  return Object.assign(_e, reactExports.createContext(Qt)), _e.Provider._context = _e, _e.Consumer._context = _e, _e;
}
var Of = () => {
  let _e = [], Qt = function($n) {
    bh();
    let Sn = [];
    return ne(_e, (kn, Kn) => {
      if (C.und($n))
        Sn.push(kn.start());
      else {
        let er = Zt($n, kn, Kn);
        er && Sn.push(kn.start(er));
      }
    }), Sn;
  };
  Qt.current = _e, Qt.add = function($n) {
    _e.includes($n) || _e.push($n);
  }, Qt.delete = function($n) {
    let Sn = _e.indexOf($n);
    ~Sn && _e.splice(Sn, 1);
  }, Qt.pause = function() {
    return ne(_e, ($n) => $n.pause(...arguments)), this;
  }, Qt.resume = function() {
    return ne(_e, ($n) => $n.resume(...arguments)), this;
  }, Qt.set = function($n) {
    ne(_e, (Sn, kn) => {
      let Kn = C.fun($n) ? $n(kn, Sn) : $n;
      Kn && Sn.set(Kn);
    });
  }, Qt.start = function($n) {
    let Sn = [];
    return ne(_e, (kn, Kn) => {
      if (C.und($n))
        Sn.push(kn.start());
      else {
        let er = this._getProps($n, kn, Kn);
        er && Sn.push(kn.start(er));
      }
    }), Sn;
  }, Qt.stop = function() {
    return ne(_e, ($n) => $n.stop(...arguments)), this;
  }, Qt.update = function($n) {
    return ne(_e, (Sn, kn) => Sn.update(this._getProps($n, Sn, kn))), this;
  };
  let Zt = function($n, Sn, kn) {
    return C.fun($n) ? $n(kn, Sn) : $n;
  };
  return Qt._getProps = Zt, Qt;
};
function Hh(_e, Qt, Zt) {
  let $n = C.fun(Qt) && Qt;
  $n && !Zt && (Zt = []);
  let Sn = reactExports.useMemo(() => $n || arguments.length == 3 ? Of() : void 0, []), kn = reactExports.useRef(0), Kn = Bo(), er = reactExports.useMemo(() => ({ ctrls: [], queue: [], flush(Bs, Hs) {
    let Ws = co(Bs, Hs);
    return kn.current > 0 && !er.queue.length && !Object.keys(Ws).some((Ys) => !Bs.springs[Ys]) ? lo(Bs, Hs) : new Promise((Ys) => {
      bf(Bs, Ws), er.queue.push(() => {
        Ys(lo(Bs, Hs));
      }), Kn();
    });
  } }), []), Cr = reactExports.useRef([...er.ctrls]), kr = [], Yr = eo(_e) || 0;
  reactExports.useMemo(() => {
    ne(Cr.current.slice(_e, Yr), (Bs) => {
      no(Bs, Sn), Bs.stop(!0);
    }), Cr.current.length = _e, Ms(Yr, _e);
  }, [_e]), reactExports.useMemo(() => {
    Ms(0, Math.min(Yr, _e));
  }, Zt);
  function Ms(Bs, Hs) {
    for (let Ws = Bs; Ws < Hs; Ws++) {
      let Ys = Cr.current[Ws] || (Cr.current[Ws] = new gf(null, er.flush)), El = $n ? $n(Ws, Ys) : Qt[Ws];
      El && (kr[Ws] = Fh(El));
    }
  }
  let Ds = Cr.current.map((Bs, Hs) => co(Bs, kr[Hs])), Ls = reactExports.useContext(wn), js = eo(Ls), zs = Ls !== js && uf(Ls);
  Vt(() => {
    kn.current++, er.ctrls = Cr.current;
    let { queue: Bs } = er;
    Bs.length && (er.queue = [], ne(Bs, (Hs) => Hs())), ne(Cr.current, (Hs, Ws) => {
      Sn == null || Sn.add(Hs), zs && Hs.start({ default: Ls });
      let Ys = kr[Ws];
      Ys && (ff(Hs, Ys.ref), Hs.ref ? Hs.queue.push(Ys) : Hs.start(Ys));
    });
  }), Ho(() => () => {
    ne(er.ctrls, (Bs) => Bs.stop(!0));
  });
  let Fs = Ds.map((Bs) => ({ ...Bs }));
  return Sn ? [Fs, Sn] : Fs;
}
function qr(_e, Qt) {
  let Zt = C.fun(_e), [[$n], Sn] = Hh(1, Zt ? _e : [_e], Zt ? Qt || [] : Qt);
  return Zt || arguments.length == 2 ? [$n, Sn] : $n;
}
function Pf(_e, Qt, Zt) {
  let $n = C.fun(Qt) && Qt, { reset: Sn, sort: kn, trail: Kn = 0, expires: er = !0, exitBeforeEnter: Cr = !1, onDestroyed: kr, ref: Yr, config: Ms } = $n ? $n() : Qt, Ds = reactExports.useMemo(() => $n || arguments.length == 3 ? Of() : void 0, []), Ls = Ne(_e), js = [], zs = reactExports.useRef(null), Fs = Sn ? null : zs.current;
  Vt(() => {
    zs.current = js;
  }), Ho(() => (ne(js, (zu) => {
    Ds == null || Ds.add(zu.ctrl), zu.ctrl.ref = Ds;
  }), () => {
    ne(zs.current, (zu) => {
      zu.expired && clearTimeout(zu.expirationId), no(zu.ctrl, Ds), zu.ctrl.stop(!0);
    });
  }));
  let Bs = qh(Ls, $n ? $n() : Qt, Fs), Hs = Sn && zs.current || [];
  Vt(() => ne(Hs, ({ ctrl: zu, item: Yu, key: sm }) => {
    no(zu, Ds), De(kr, Yu, sm);
  }));
  let Ws = [];
  if (Fs && ne(Fs, (zu, Yu) => {
    zu.expired ? (clearTimeout(zu.expirationId), Hs.push(zu)) : (Yu = Ws[Yu] = Bs.indexOf(zu.key), ~Yu && (js[Yu] = zu));
  }), ne(Ls, (zu, Yu) => {
    js[Yu] || (js[Yu] = { key: Bs[Yu], item: zu, phase: "mount", ctrl: new gf() }, js[Yu].ctrl.item = zu);
  }), Ws.length) {
    let zu = -1, { leave: Yu } = $n ? $n() : Qt;
    ne(Ws, (sm, mm) => {
      let hm = Fs[mm];
      ~sm ? (zu = js.indexOf(hm), js[zu] = { ...hm, item: Ls[sm] }) : Yu && js.splice(++zu, 0, hm);
    });
  }
  C.fun(kn) && js.sort((zu, Yu) => kn(zu.item, Yu.item));
  let Ys = -Kn, El = Bo(), Mu = ei(Qt), Pl = /* @__PURE__ */ new Map(), Iu = reactExports.useRef(/* @__PURE__ */ new Map()), Tu = reactExports.useRef(!1);
  ne(js, (zu, Yu) => {
    let sm = zu.key, mm = zu.phase, hm = $n ? $n() : Qt, ym, _m, Sm = De(hm.delay || 0, sm);
    if (mm == "mount")
      ym = hm.enter, _m = "enter";
    else {
      let Im = Bs.indexOf(sm) < 0;
      if (mm != "leave")
        if (Im)
          ym = hm.leave, _m = "leave";
        else if (ym = hm.update)
          _m = "update";
        else
          return;
      else if (!Im)
        ym = hm.enter, _m = "enter";
      else
        return;
    }
    if (ym = De(ym, zu.item, Yu), ym = C.obj(ym) ? qo(ym) : { to: ym }, !ym.config) {
      let Im = Ms || Mu.config;
      ym.config = De(Im, zu.item, Yu, _m);
    }
    Ys += Kn;
    let wm = { ...Mu, delay: Sm + Ys, ref: Yr, immediate: hm.immediate, reset: !1, ...ym };
    if (_m == "enter" && C.und(wm.from)) {
      let Im = $n ? $n() : Qt, Am = C.und(Im.initial) || Fs ? Im.from : Im.initial;
      wm.from = De(Am, zu.item, Yu);
    }
    let { onResolve: Nm } = wm;
    wm.onResolve = (Im) => {
      De(Nm, Im);
      let Am = zs.current, Vm = Am.find((Rm) => Rm.key === sm);
      if (Vm && !(Im.cancelled && Vm.phase != "update") && Vm.ctrl.idle) {
        let Rm = Am.every((Dm) => Dm.ctrl.idle);
        if (Vm.phase == "leave") {
          let Dm = De(er, Vm.item);
          if (Dm !== !1) {
            let km = Dm === !0 ? 0 : Dm;
            if (Vm.expired = !0, !Rm && km > 0) {
              km <= 2147483647 && (Vm.expirationId = setTimeout(El, km));
              return;
            }
          }
        }
        Rm && Am.some((Dm) => Dm.expired) && (Iu.current.delete(Vm), Cr && (Tu.current = !0), El());
      }
    };
    let Cm = co(zu.ctrl, wm);
    _m === "leave" && Cr ? Iu.current.set(zu, { phase: _m, springs: Cm, payload: wm }) : Pl.set(zu, { phase: _m, springs: Cm, payload: wm });
  });
  let Au = reactExports.useContext(wn), Nu = eo(Au), gm = Au !== Nu && uf(Au);
  Vt(() => {
    gm && ne(js, (zu) => {
      zu.ctrl.start({ default: Au });
    });
  }, [Au]), ne(Pl, (zu, Yu) => {
    if (Iu.current.size) {
      let sm = js.findIndex((mm) => mm.key === Yu.key);
      js.splice(sm, 1);
    }
  }), Vt(() => {
    ne(Iu.current.size ? Iu.current : Pl, ({ phase: zu, payload: Yu }, sm) => {
      let { ctrl: mm } = sm;
      sm.phase = zu, Ds == null || Ds.add(mm), gm && zu == "enter" && mm.start({ default: Au }), Yu && (ff(mm, Yu.ref), (mm.ref || Ds) && !Tu.current ? mm.update(Yu) : (mm.start(Yu), Tu.current && (Tu.current = !1)));
    });
  }, Sn ? void 0 : Zt);
  let pm = (zu) => reactExports.createElement(reactExports.Fragment, null, js.map((Yu, sm) => {
    let { springs: mm } = Pl.get(Yu) || Yu.ctrl, hm = zu({ ...mm }, Yu.item, Yu, sm);
    return hm && hm.type ? reactExports.createElement(hm.type, { ...hm.props, key: C.str(Yu.key) || C.num(Yu.key) ? Yu.key : Yu.ctrl.id, ref: hm.ref }) : hm;
  }));
  return Ds ? [pm, Ds] : pm;
}
var Uh = 1;
function qh(_e, { key: Qt, keys: Zt = Qt }, $n) {
  if (Zt === null) {
    let Sn = /* @__PURE__ */ new Set();
    return _e.map((kn) => {
      let Kn = $n && $n.find((er) => er.item === kn && er.phase !== "leave" && !Sn.has(er));
      return Kn ? (Sn.add(Kn), Kn.key) : Uh++;
    });
  }
  return C.und(Zt) ? _e : C.fun(Zt) ? _e.map(Zt) : Ne(Zt);
}
var Gh = class extends Xo {
  constructor(Qt, Zt) {
    super();
    p$(this, "key");
    p$(this, "idle", !0);
    p$(this, "calc");
    p$(this, "_active", /* @__PURE__ */ new Set());
    this.source = Qt, this.calc = Jr(...Zt);
    let $n = this._get(), Sn = to($n);
    Uo(this, Sn.create($n));
  }
  advance(Qt) {
    let Zt = this._get(), $n = this.get();
    vt(Zt, $n) || (it(this).setValue(Zt), this._onChange(Zt, this.idle)), !this.idle && ml(this._active) && Oi(this);
  }
  _get() {
    let Qt = C.arr(this.source) ? this.source.map(Me) : Ne(Me(this.source));
    return this.calc(...Qt);
  }
  _start() {
    this.idle && !ml(this._active) && (this.idle = !1, ne(Ja(this), (Qt) => {
      Qt.done = !1;
    }), rt.skipAnimation ? (ae.batchedUpdates(() => this.advance()), Oi(this)) : Ga.start(this));
  }
  _attach() {
    let Qt = 1;
    ne(Ne(this.source), (Zt) => {
      Ge(Zt) && Or(Zt, this), io(Zt) && (Zt.idle || this._active.add(Zt), Qt = Math.max(Qt, Zt.priority + 1));
    }), this.priority = Qt, this._start();
  }
  _detach() {
    ne(Ne(this.source), (Qt) => {
      Ge(Qt) && en(Qt, this);
    }), this._active.clear(), Oi(this);
  }
  eventObserved(Qt) {
    Qt.type == "change" ? Qt.idle ? this.advance() : (this._active.add(Qt.parent), this._start()) : Qt.type == "idle" ? this._active.delete(Qt.parent) : Qt.type == "priority" && (this.priority = Ne(this.source).reduce((Zt, $n) => Math.max(Zt, (io($n) ? $n.priority : 0) + 1), 0));
  }
};
function Xh(_e) {
  return _e.idle !== !1;
}
function ml(_e) {
  return !_e.size || Array.from(_e).every(Xh);
}
function Oi(_e) {
  _e.idle || (_e.idle = !0, ne(Ja(_e), (Qt) => {
    Qt.done = !0;
  }), Zr(_e, { type: "idle", parent: _e }));
}
rt.assign({ createStringInterpolator: nf, to: (_e, Qt) => new Gh(_e, Qt) });
var Ef = /^--/;
function Kh(_e, Qt) {
  return Qt == null || typeof Qt == "boolean" || Qt === "" ? "" : typeof Qt == "number" && Qt !== 0 && !Ef.test(_e) && !(Gr.hasOwnProperty(_e) && Gr[_e]) ? Qt + "px" : ("" + Qt).trim();
}
var hl = {};
function Qh(_e, Qt) {
  if (!_e.nodeType || !_e.setAttribute)
    return !1;
  let Zt = _e.nodeName === "filter" || _e.parentNode && _e.parentNode.nodeName === "filter", { style: $n, children: Sn, scrollTop: kn, scrollLeft: Kn, viewBox: er, ...Cr } = Qt, kr = Object.values(Cr), Yr = Object.keys(Cr).map((Ms) => Zt || _e.hasAttribute(Ms) ? Ms : hl[Ms] || (hl[Ms] = Ms.replace(/([A-Z])/g, (Ds) => "-" + Ds.toLowerCase())));
  Sn !== void 0 && (_e.textContent = Sn);
  for (let Ms in $n)
    if ($n.hasOwnProperty(Ms)) {
      let Ds = Kh(Ms, $n[Ms]);
      Ef.test(Ms) ? _e.style.setProperty(Ms, Ds) : _e.style[Ms] = Ds;
    }
  Yr.forEach((Ms, Ds) => {
    _e.setAttribute(Ms, kr[Ds]);
  }), kn !== void 0 && (_e.scrollTop = kn), Kn !== void 0 && (_e.scrollLeft = Kn), er !== void 0 && _e.setAttribute("viewBox", er);
}
var Gr = { animationIterationCount: !0, borderImageOutset: !0, borderImageSlice: !0, borderImageWidth: !0, boxFlex: !0, boxFlexGroup: !0, boxOrdinalGroup: !0, columnCount: !0, columns: !0, flex: !0, flexGrow: !0, flexPositive: !0, flexShrink: !0, flexNegative: !0, flexOrder: !0, gridRow: !0, gridRowEnd: !0, gridRowSpan: !0, gridRowStart: !0, gridColumn: !0, gridColumnEnd: !0, gridColumnSpan: !0, gridColumnStart: !0, fontWeight: !0, lineClamp: !0, lineHeight: !0, opacity: !0, order: !0, orphans: !0, tabSize: !0, widows: !0, zIndex: !0, zoom: !0, fillOpacity: !0, floodOpacity: !0, stopOpacity: !0, strokeDasharray: !0, strokeDashoffset: !0, strokeMiterlimit: !0, strokeOpacity: !0, strokeWidth: !0 }, Jh = (_e, Qt) => _e + Qt.charAt(0).toUpperCase() + Qt.substring(1), Zh = ["Webkit", "Ms", "Moz", "O"];
Gr = Object.keys(Gr).reduce((_e, Qt) => (Zh.forEach((Zt) => _e[Jh(Zt, Qt)] = _e[Qt]), _e), Gr);
var ev = /^(matrix|translate|scale|rotate|skew)/, tv = /^(translate)/, rv = /^(rotate|skew)/, Pi = (_e, Qt) => C.num(_e) && _e !== 0 ? _e + Qt : _e, Jn = (_e, Qt) => C.arr(_e) ? _e.every((Zt) => Jn(Zt, Qt)) : C.num(_e) ? _e === Qt : parseFloat(_e) === Qt, nv = class extends Za {
  constructor({ x: _e, y: Qt, z: Zt, ...$n }) {
    let Sn = [], kn = [];
    (_e || Qt || Zt) && (Sn.push([_e || 0, Qt || 0, Zt || 0]), kn.push((Kn) => [`translate3d(${Kn.map((er) => Pi(er, "px")).join(",")})`, Jn(Kn, 0)])), dt($n, (Kn, er) => {
      if (er === "transform")
        Sn.push([Kn || ""]), kn.push((Cr) => [Cr, Cr === ""]);
      else if (ev.test(er)) {
        if (delete $n[er], C.und(Kn))
          return;
        let Cr = tv.test(er) ? "px" : rv.test(er) ? "deg" : "";
        Sn.push(Ne(Kn)), kn.push(er === "rotate3d" ? ([kr, Yr, Ms, Ds]) => [`rotate3d(${kr},${Yr},${Ms},${Pi(Ds, Cr)})`, Jn(Ds, 0)] : (kr) => [`${er}(${kr.map((Yr) => Pi(Yr, Cr)).join(",")})`, Jn(kr, er.startsWith("scale") ? 1 : 0)]);
      }
    }), Sn.length && ($n.transform = new av(Sn, kn)), super($n);
  }
}, av = class extends ef {
  constructor(Qt, Zt) {
    super();
    p$(this, "_value", null);
    this.inputs = Qt, this.transforms = Zt;
  }
  get() {
    return this._value || (this._value = this._get());
  }
  _get() {
    let Qt = "", Zt = !0;
    return ne(this.inputs, ($n, Sn) => {
      let kn = Me($n[0]), [Kn, er] = this.transforms[Sn](C.arr(kn) ? kn : $n.map(Me));
      Qt += " " + Kn, Zt = Zt && er;
    }), Zt ? "none" : Qt;
  }
  observerAdded(Qt) {
    Qt == 1 && ne(this.inputs, (Zt) => ne(Zt, ($n) => Ge($n) && Or($n, this)));
  }
  observerRemoved(Qt) {
    Qt == 0 && ne(this.inputs, (Zt) => ne(Zt, ($n) => Ge($n) && en($n, this)));
  }
  eventObserved(Qt) {
    Qt.type == "change" && (this._value = null), Zr(this, Qt);
  }
}, iv = ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"];
rt.assign({ batchedUpdates: reactDomExports.unstable_batchedUpdates, createStringInterpolator: nf, colors: Qm });
var ov = Rh(iv, { applyAnimatedValues: Qh, createAnimatedStyle: (_e) => new nv(_e), getComponentProps: ({ scrollTop: _e, scrollLeft: Qt, ...Zt }) => Zt }), Ht = ov.animated;
function sv(_e) {
  const Qt = reactExports.createContext(null);
  return [({ children: Zt, value: $n }) => /* @__PURE__ */ React.createElement(Qt.Provider, {
    value: $n
  }, Zt), () => {
    const Zt = reactExports.useContext(Qt);
    if (Zt === null)
      throw new Error(_e);
    return Zt;
  }];
}
function lv(_e) {
  return Array.isArray(_e) ? _e : [_e];
}
const cv = () => {
};
function uv(_e, Qt = { active: !0 }) {
  return typeof _e != "function" || !Qt.active ? Qt.onKeyDown || cv : (Zt) => {
    var $n;
    Zt.key === "Escape" && (_e(Zt), ($n = Qt.onTrigger) == null || $n.call(Qt));
  };
}
function ti(_e) {
  return Array.isArray(_e) || _e === null ? !1 : typeof _e == "object" ? _e.type !== React.Fragment : !1;
}
function Sf(_e) {
  var Qt, Zt, $n = "";
  if (typeof _e == "string" || typeof _e == "number")
    $n += _e;
  else if (typeof _e == "object")
    if (Array.isArray(_e))
      for (Qt = 0; Qt < _e.length; Qt++)
        _e[Qt] && (Zt = Sf(_e[Qt])) && ($n && ($n += " "), $n += Zt);
    else
      for (Qt in _e)
        _e[Qt] && ($n && ($n += " "), $n += Qt);
  return $n;
}
function $f() {
  for (var _e = 0, Qt, Zt, $n = ""; _e < arguments.length; )
    (Qt = arguments[_e++]) && (Zt = Sf(Qt)) && ($n && ($n += " "), $n += Zt);
  return $n;
}
const fv = {
  dark: [
    "#C1C2C5",
    "#A6A7AB",
    "#909296",
    "#5c5f66",
    "#373A40",
    "#2C2E33",
    "#25262b",
    "#1A1B1E",
    "#141517",
    "#101113"
  ],
  gray: [
    "#f8f9fa",
    "#f1f3f5",
    "#e9ecef",
    "#dee2e6",
    "#ced4da",
    "#adb5bd",
    "#868e96",
    "#495057",
    "#343a40",
    "#212529"
  ],
  red: [
    "#fff5f5",
    "#ffe3e3",
    "#ffc9c9",
    "#ffa8a8",
    "#ff8787",
    "#ff6b6b",
    "#fa5252",
    "#f03e3e",
    "#e03131",
    "#c92a2a"
  ],
  pink: [
    "#fff0f6",
    "#ffdeeb",
    "#fcc2d7",
    "#faa2c1",
    "#f783ac",
    "#f06595",
    "#e64980",
    "#d6336c",
    "#c2255c",
    "#a61e4d"
  ],
  grape: [
    "#f8f0fc",
    "#f3d9fa",
    "#eebefa",
    "#e599f7",
    "#da77f2",
    "#cc5de8",
    "#be4bdb",
    "#ae3ec9",
    "#9c36b5",
    "#862e9c"
  ],
  violet: [
    "#f3f0ff",
    "#e5dbff",
    "#d0bfff",
    "#b197fc",
    "#9775fa",
    "#845ef7",
    "#7950f2",
    "#7048e8",
    "#6741d9",
    "#5f3dc4"
  ],
  indigo: [
    "#edf2ff",
    "#dbe4ff",
    "#bac8ff",
    "#91a7ff",
    "#748ffc",
    "#5c7cfa",
    "#4c6ef5",
    "#4263eb",
    "#3b5bdb",
    "#364fc7"
  ],
  blue: [
    "#e7f5ff",
    "#d0ebff",
    "#a5d8ff",
    "#74c0fc",
    "#4dabf7",
    "#339af0",
    "#228be6",
    "#1c7ed6",
    "#1971c2",
    "#1864ab"
  ],
  cyan: [
    "#e3fafc",
    "#c5f6fa",
    "#99e9f2",
    "#66d9e8",
    "#3bc9db",
    "#22b8cf",
    "#15aabf",
    "#1098ad",
    "#0c8599",
    "#0b7285"
  ],
  teal: [
    "#e6fcf5",
    "#c3fae8",
    "#96f2d7",
    "#63e6be",
    "#38d9a9",
    "#20c997",
    "#12b886",
    "#0ca678",
    "#099268",
    "#087f5b"
  ],
  green: [
    "#ebfbee",
    "#d3f9d8",
    "#b2f2bb",
    "#8ce99a",
    "#69db7c",
    "#51cf66",
    "#40c057",
    "#37b24d",
    "#2f9e44",
    "#2b8a3e"
  ],
  lime: [
    "#f4fce3",
    "#e9fac8",
    "#d8f5a2",
    "#c0eb75",
    "#a9e34b",
    "#94d82d",
    "#82c91e",
    "#74b816",
    "#66a80f",
    "#5c940d"
  ],
  yellow: [
    "#fff9db",
    "#fff3bf",
    "#ffec99",
    "#ffe066",
    "#ffd43b",
    "#fcc419",
    "#fab005",
    "#f59f00",
    "#f08c00",
    "#e67700"
  ],
  orange: [
    "#fff4e6",
    "#ffe8cc",
    "#ffd8a8",
    "#ffc078",
    "#ffa94d",
    "#ff922b",
    "#fd7e14",
    "#f76707",
    "#e8590c",
    "#d9480f"
  ]
};
function dv(_e) {
  return () => ({ fontFamily: _e.fontFamily || "sans-serif" });
}
var pv = Object.defineProperty, vl = Object.getOwnPropertySymbols, mv = Object.prototype.hasOwnProperty, hv = Object.prototype.propertyIsEnumerable, gl = (_e, Qt, Zt) => Qt in _e ? pv(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, yl = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    mv.call(Qt, Zt) && gl(_e, Zt, Qt[Zt]);
  if (vl)
    for (var Zt of vl(Qt))
      hv.call(Qt, Zt) && gl(_e, Zt, Qt[Zt]);
  return _e;
};
function vv(_e) {
  return (Qt) => ({
    WebkitTapHighlightColor: "transparent",
    [Qt || "&:focus"]: yl({}, _e.focusRing === "always" || _e.focusRing === "auto" ? _e.focusRingStyles.styles(_e) : _e.focusRingStyles.resetStyles(_e)),
    [Qt ? Qt.replace(":focus", ":focus:not(:focus-visible)") : "&:focus:not(:focus-visible)"]: yl({}, _e.focusRing === "auto" || _e.focusRing === "never" ? _e.focusRingStyles.resetStyles(_e) : null)
  });
}
function _n(_e) {
  return (Qt) => typeof _e.primaryShade == "number" ? _e.primaryShade : _e.primaryShade[Qt || _e.colorScheme];
}
function Ko(_e) {
  const Qt = _n(_e);
  return (Zt, $n, Sn = !0, kn = !0) => {
    if (typeof Zt == "string" && Zt.includes(".")) {
      const [er, Cr] = Zt.split("."), kr = parseInt(Cr, 10);
      if (er in _e.colors && kr >= 0 && kr < 10)
        return _e.colors[er][typeof $n == "number" && !kn ? $n : kr];
    }
    const Kn = typeof $n == "number" ? $n : Qt();
    return Zt in _e.colors ? _e.colors[Zt][Kn] : Sn ? _e.colors[_e.primaryColor][Kn] : Zt;
  };
}
function kf(_e) {
  let Qt = "";
  for (let Zt = 1; Zt < _e.length - 1; Zt += 1)
    Qt += `${_e[Zt]} ${Zt / (_e.length - 1) * 100}%, `;
  return `${_e[0]} 0%, ${Qt}${_e[_e.length - 1]} 100%`;
}
function gv(_e, ...Qt) {
  return `linear-gradient(${_e}deg, ${kf(Qt)})`;
}
function yv(..._e) {
  return `radial-gradient(circle, ${kf(_e)})`;
}
function Rf(_e) {
  const Qt = Ko(_e), Zt = _n(_e);
  return ($n) => {
    const Sn = {
      from: ($n == null ? void 0 : $n.from) || _e.defaultGradient.from,
      to: ($n == null ? void 0 : $n.to) || _e.defaultGradient.to,
      deg: ($n == null ? void 0 : $n.deg) || _e.defaultGradient.deg
    };
    return `linear-gradient(${Sn.deg}deg, ${Qt(Sn.from, Zt(), !1)} 0%, ${Qt(Sn.to, Zt(), !1)} 100%)`;
  };
}
function Qo(_e) {
  if (typeof _e.size == "number")
    return _e.size;
  const Qt = _e.sizes[_e.size];
  return Qt !== void 0 ? Qt : _e.size || _e.sizes.md;
}
function bv(_e) {
  return (Qt) => `@media (min-width: ${Qo({ size: Qt, sizes: _e.breakpoints })}px)`;
}
function wv(_e) {
  return (Qt) => `@media (max-width: ${Qo({ size: Qt, sizes: _e.breakpoints }) - 1}px)`;
}
function _v(_e) {
  return /^#?([0-9A-F]{3}){1,2}$/i.test(_e);
}
function xv(_e) {
  let Qt = _e.replace("#", "");
  if (Qt.length === 3) {
    const Kn = Qt.split("");
    Qt = [
      Kn[0],
      Kn[0],
      Kn[1],
      Kn[1],
      Kn[2],
      Kn[2]
    ].join("");
  }
  const Zt = parseInt(Qt, 16), $n = Zt >> 16 & 255, Sn = Zt >> 8 & 255, kn = Zt & 255;
  return {
    r: $n,
    g: Sn,
    b: kn,
    a: 1
  };
}
function Ov(_e) {
  const [Qt, Zt, $n, Sn] = _e.replace(/[^0-9,.]/g, "").split(",").map(Number);
  return { r: Qt, g: Zt, b: $n, a: Sn || 1 };
}
function Jo(_e) {
  return _v(_e) ? xv(_e) : _e.startsWith("rgb") ? Ov(_e) : {
    r: 0,
    g: 0,
    b: 0,
    a: 1
  };
}
function ar(_e, Qt) {
  if (typeof _e != "string" || Qt > 1 || Qt < 0)
    return "rgba(0, 0, 0, 1)";
  const { r: Zt, g: $n, b: Sn } = Jo(_e);
  return `rgba(${Zt}, ${$n}, ${Sn}, ${Qt})`;
}
function Pv(_e = 0) {
  return {
    position: "absolute",
    top: _e,
    right: _e,
    left: _e,
    bottom: _e
  };
}
function Ev(_e, Qt) {
  const { r: Zt, g: $n, b: Sn, a: kn } = Jo(_e), Kn = 1 - Qt, er = (Cr) => Math.round(Cr * Kn);
  return `rgba(${er(Zt)}, ${er($n)}, ${er(Sn)}, ${kn})`;
}
function Sv(_e, Qt) {
  const { r: Zt, g: $n, b: Sn, a: kn } = Jo(_e), Kn = (er) => Math.round(er + (255 - er) * Qt);
  return `rgba(${Kn(Zt)}, ${Kn($n)}, ${Kn(Sn)}, ${kn})`;
}
function $v(_e) {
  return (Qt) => {
    if (typeof Qt == "number")
      return Qt;
    const Zt = typeof _e.defaultRadius == "number" ? _e.defaultRadius : _e.radius[_e.defaultRadius] || _e.defaultRadius;
    return _e.radius[Qt] || Qt || Zt;
  };
}
function kv(_e, Qt) {
  if (typeof _e == "string" && _e.includes(".")) {
    const [Zt, $n] = _e.split("."), Sn = parseInt($n, 10);
    if (Zt in Qt.colors && Sn >= 0 && Sn < 10)
      return { isSplittedColor: !0, key: Zt, shade: Sn };
  }
  return { isSplittedColor: !1 };
}
function Rv(_e) {
  const Qt = Ko(_e), Zt = _n(_e), $n = Rf(_e);
  return ({ variant: Sn, color: kn, gradient: Kn, primaryFallback: er }) => {
    const Cr = kv(kn, _e);
    switch (Sn) {
      case "light":
        return {
          border: "transparent",
          background: ar(Qt(kn, _e.colorScheme === "dark" ? 8 : 0, er, !1), _e.colorScheme === "dark" ? 0.2 : 1),
          color: kn === "dark" ? _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.colors.dark[9] : Qt(kn, _e.colorScheme === "dark" ? 2 : Zt("light")),
          hover: ar(Qt(kn, _e.colorScheme === "dark" ? 7 : 1, er, !1), _e.colorScheme === "dark" ? 0.25 : 0.65)
        };
      case "subtle":
        return {
          border: "transparent",
          background: "transparent",
          color: kn === "dark" ? _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.colors.dark[9] : Qt(kn, _e.colorScheme === "dark" ? 2 : Zt("light")),
          hover: ar(Qt(kn, _e.colorScheme === "dark" ? 8 : 0, er, !1), _e.colorScheme === "dark" ? 0.2 : 1)
        };
      case "outline":
        return {
          border: Qt(kn, _e.colorScheme === "dark" ? 5 : Zt("light")),
          background: "transparent",
          color: Qt(kn, _e.colorScheme === "dark" ? 5 : Zt("light")),
          hover: _e.colorScheme === "dark" ? ar(Qt(kn, 5, er, !1), 0.05) : ar(Qt(kn, 0, er, !1), 0.35)
        };
      case "default":
        return {
          border: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[4],
          background: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.white,
          color: _e.colorScheme === "dark" ? _e.white : _e.black,
          hover: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[0]
        };
      case "white":
        return {
          border: "transparent",
          background: _e.white,
          color: Qt(kn, Zt()),
          hover: null
        };
      case "transparent":
        return {
          border: "transparent",
          color: kn === "dark" ? _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.colors.dark[9] : Qt(kn, _e.colorScheme === "dark" ? 2 : Zt("light")),
          background: "transparent",
          hover: null
        };
      case "gradient":
        return {
          background: $n(Kn),
          color: _e.white,
          border: "transparent",
          hover: null
        };
      default: {
        const kr = Zt(), Yr = Cr.isSplittedColor ? Cr.shade : kr, Ms = Cr.isSplittedColor ? Cr.key : kn;
        return {
          border: "transparent",
          background: Qt(Ms, Yr, er),
          color: _e.white,
          hover: Qt(Ms, Yr === 9 ? 8 : Yr + 1)
        };
      }
    }
  };
}
function Cv(_e) {
  return (Qt) => {
    const Zt = _n(_e)(Qt);
    return _e.colors[_e.primaryColor][Zt];
  };
}
function Tv(_e) {
  return {
    "@media (hover: hover)": {
      "&:hover": _e
    },
    "@media (hover: none)": {
      "&:active": _e
    }
  };
}
function Av(_e) {
  return () => ({
    userSelect: "none",
    color: _e.colorScheme === "dark" ? _e.colors.dark[3] : _e.colors.gray[5]
  });
}
const Se = {
  fontStyles: dv,
  themeColor: Ko,
  focusStyles: vv,
  linearGradient: gv,
  radialGradient: yv,
  smallerThan: wv,
  largerThan: bv,
  rgba: ar,
  size: Qo,
  cover: Pv,
  darken: Ev,
  lighten: Sv,
  radius: $v,
  variant: Rv,
  primaryShade: _n,
  hover: Tv,
  gradient: Rf,
  primaryColor: Cv,
  placeholderStyles: Av
};
var Iv = Object.defineProperty, Nv = Object.defineProperties, jv = Object.getOwnPropertyDescriptors, bl = Object.getOwnPropertySymbols, Mv = Object.prototype.hasOwnProperty, Dv = Object.prototype.propertyIsEnumerable, wl = (_e, Qt, Zt) => Qt in _e ? Iv(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, zv = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Mv.call(Qt, Zt) && wl(_e, Zt, Qt[Zt]);
  if (bl)
    for (var Zt of bl(Qt))
      Dv.call(Qt, Zt) && wl(_e, Zt, Qt[Zt]);
  return _e;
}, Lv = (_e, Qt) => Nv(_e, jv(Qt));
function Fv(_e) {
  return Lv(zv({}, _e), {
    fn: {
      fontStyles: Se.fontStyles(_e),
      themeColor: Se.themeColor(_e),
      focusStyles: Se.focusStyles(_e),
      largerThan: Se.largerThan(_e),
      smallerThan: Se.smallerThan(_e),
      radialGradient: Se.radialGradient,
      linearGradient: Se.linearGradient,
      gradient: Se.gradient(_e),
      rgba: Se.rgba,
      size: Se.size,
      cover: Se.cover,
      lighten: Se.lighten,
      darken: Se.darken,
      primaryShade: Se.primaryShade(_e),
      radius: Se.radius(_e),
      variant: Se.variant(_e),
      hover: Se.hover,
      primaryColor: Se.primaryColor(_e),
      placeholderStyles: Se.placeholderStyles(_e)
    }
  });
}
const Wv = {
  dir: "ltr",
  primaryShade: {
    light: 6,
    dark: 8
  },
  focusRing: "auto",
  loader: "oval",
  dateFormat: "MMMM D, YYYY",
  colorScheme: "light",
  white: "#fff",
  black: "#000",
  defaultRadius: "sm",
  transitionTimingFunction: "ease",
  colors: fv,
  lineHeight: 1.55,
  fontFamily: "-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",
  fontFamilyMonospace: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",
  primaryColor: "blue",
  respectReducedMotion: !0,
  cursorType: "default",
  defaultGradient: {
    from: "indigo",
    to: "cyan",
    deg: 45
  },
  shadows: {
    xs: "0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1)",
    sm: "0 1px 3px rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0px 10px 15px -5px, rgba(0, 0, 0, 0.04) 0px 7px 7px -5px",
    md: "0 1px 3px rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0px 20px 25px -5px, rgba(0, 0, 0, 0.04) 0px 10px 10px -5px",
    lg: "0 1px 3px rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0px 28px 23px -7px, rgba(0, 0, 0, 0.04) 0px 12px 12px -7px",
    xl: "0 1px 3px rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0px 36px 28px -7px, rgba(0, 0, 0, 0.04) 0px 17px 17px -7px"
  },
  fontSizes: {
    xs: 12,
    sm: 14,
    md: 16,
    lg: 18,
    xl: 20
  },
  radius: {
    xs: 2,
    sm: 4,
    md: 8,
    lg: 16,
    xl: 32
  },
  spacing: {
    xs: 10,
    sm: 12,
    md: 16,
    lg: 20,
    xl: 24
  },
  breakpoints: {
    xs: 576,
    sm: 768,
    md: 992,
    lg: 1200,
    xl: 1400
  },
  headings: {
    fontFamily: "-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",
    fontWeight: 700,
    sizes: {
      h1: { fontSize: 34, lineHeight: 1.3, fontWeight: void 0 },
      h2: { fontSize: 26, lineHeight: 1.35, fontWeight: void 0 },
      h3: { fontSize: 22, lineHeight: 1.4, fontWeight: void 0 },
      h4: { fontSize: 18, lineHeight: 1.45, fontWeight: void 0 },
      h5: { fontSize: 16, lineHeight: 1.5, fontWeight: void 0 },
      h6: { fontSize: 14, lineHeight: 1.5, fontWeight: void 0 }
    }
  },
  other: {},
  components: {},
  activeStyles: { transform: "translateY(1px)" },
  datesLocale: "en",
  globalStyles: void 0,
  focusRingStyles: {
    styles: (_e) => ({
      outlineOffset: 2,
      outline: `2px solid ${_e.colors[_e.primaryColor][_e.colorScheme === "dark" ? 7 : 5]}`
    }),
    resetStyles: () => ({ outline: "none" }),
    inputStyles: (_e) => ({
      outline: "none",
      borderColor: _e.colors[_e.primaryColor][typeof _e.primaryShade == "object" ? _e.primaryShade[_e.colorScheme] : _e.primaryShade]
    })
  }
}, Cf = Fv(Wv);
function Vv(_e) {
  if (_e.sheet)
    return _e.sheet;
  for (var Qt = 0; Qt < document.styleSheets.length; Qt++)
    if (document.styleSheets[Qt].ownerNode === _e)
      return document.styleSheets[Qt];
}
function Yv(_e) {
  var Qt = document.createElement("style");
  return Qt.setAttribute("data-emotion", _e.key), _e.nonce !== void 0 && Qt.setAttribute("nonce", _e.nonce), Qt.appendChild(document.createTextNode("")), Qt.setAttribute("data-s", ""), Qt;
}
var Bv = /* @__PURE__ */ function() {
  function _e(Zt) {
    var $n = this;
    this._insertTag = function(Sn) {
      var kn;
      $n.tags.length === 0 ? $n.insertionPoint ? kn = $n.insertionPoint.nextSibling : $n.prepend ? kn = $n.container.firstChild : kn = $n.before : kn = $n.tags[$n.tags.length - 1].nextSibling, $n.container.insertBefore(Sn, kn), $n.tags.push(Sn);
    }, this.isSpeedy = Zt.speedy === void 0 ? !0 : Zt.speedy, this.tags = [], this.ctr = 0, this.nonce = Zt.nonce, this.key = Zt.key, this.container = Zt.container, this.prepend = Zt.prepend, this.insertionPoint = Zt.insertionPoint, this.before = null;
  }
  var Qt = _e.prototype;
  return Qt.hydrate = function(Zt) {
    Zt.forEach(this._insertTag);
  }, Qt.insert = function(Zt) {
    this.ctr % (this.isSpeedy ? 65e3 : 1) === 0 && this._insertTag(Yv(this));
    var $n = this.tags[this.tags.length - 1];
    if (this.isSpeedy) {
      var Sn = Vv($n);
      try {
        Sn.insertRule(Zt, Sn.cssRules.length);
      } catch {
      }
    } else
      $n.appendChild(document.createTextNode(Zt));
    this.ctr++;
  }, Qt.flush = function() {
    this.tags.forEach(function(Zt) {
      return Zt.parentNode && Zt.parentNode.removeChild(Zt);
    }), this.tags = [], this.ctr = 0;
  }, _e;
}(), Te = "-ms-", da = "-moz-", ue = "-webkit-", Zo = "comm", es = "rule", ts = "decl", Hv = "@import", Tf = "@keyframes", Uv = "@layer", qv = Math.abs, ri = String.fromCharCode, Gv = Object.assign;
function Xv(_e, Qt) {
  return Ce(_e, 0) ^ 45 ? (((Qt << 2 ^ Ce(_e, 0)) << 2 ^ Ce(_e, 1)) << 2 ^ Ce(_e, 2)) << 2 ^ Ce(_e, 3) : 0;
}
function Af(_e) {
  return _e.trim();
}
function Kv(_e, Qt) {
  return (_e = Qt.exec(_e)) ? _e[0] : _e;
}
function fe(_e, Qt, Zt) {
  return _e.replace(Qt, Zt);
}
function uo(_e, Qt) {
  return _e.indexOf(Qt);
}
function Ce(_e, Qt) {
  return _e.charCodeAt(Qt) | 0;
}
function sn(_e, Qt, Zt) {
  return _e.slice(Qt, Zt);
}
function ot(_e) {
  return _e.length;
}
function rs(_e) {
  return _e.length;
}
function An(_e, Qt) {
  return Qt.push(_e), _e;
}
function Qv(_e, Qt) {
  return _e.map(Qt).join("");
}
var ni = 1, hr = 1, If = 0, ze = 0, xe = 0, Pr = "";
function ai(_e, Qt, Zt, $n, Sn, kn, Kn) {
  return { value: _e, root: Qt, parent: Zt, type: $n, props: Sn, children: kn, line: ni, column: hr, length: Kn, return: "" };
}
function Nr(_e, Qt) {
  return Gv(ai("", null, null, "", null, null, 0), _e, { length: -_e.length }, Qt);
}
function Jv() {
  return xe;
}
function Zv() {
  return xe = ze > 0 ? Ce(Pr, --ze) : 0, hr--, xe === 10 && (hr = 1, ni--), xe;
}
function Be() {
  return xe = ze < If ? Ce(Pr, ze++) : 0, hr++, xe === 10 && (hr = 1, ni++), xe;
}
function ft() {
  return Ce(Pr, ze);
}
function Zn() {
  return ze;
}
function xn(_e, Qt) {
  return sn(Pr, _e, Qt);
}
function ln(_e) {
  switch (_e) {
    case 0:
    case 9:
    case 10:
    case 13:
    case 32:
      return 5;
    case 33:
    case 43:
    case 44:
    case 47:
    case 62:
    case 64:
    case 126:
    case 59:
    case 123:
    case 125:
      return 4;
    case 58:
      return 3;
    case 34:
    case 39:
    case 40:
    case 91:
      return 2;
    case 41:
    case 93:
      return 1;
  }
  return 0;
}
function Nf(_e) {
  return ni = hr = 1, If = ot(Pr = _e), ze = 0, [];
}
function jf(_e) {
  return Pr = "", _e;
}
function ea(_e) {
  return Af(xn(ze - 1, fo(_e === 91 ? _e + 2 : _e === 40 ? _e + 1 : _e)));
}
function eg(_e) {
  for (; (xe = ft()) && xe < 33; )
    Be();
  return ln(_e) > 2 || ln(xe) > 3 ? "" : " ";
}
function tg(_e, Qt) {
  for (; --Qt && Be() && !(xe < 48 || xe > 102 || xe > 57 && xe < 65 || xe > 70 && xe < 97); )
    ;
  return xn(_e, Zn() + (Qt < 6 && ft() == 32 && Be() == 32));
}
function fo(_e) {
  for (; Be(); )
    switch (xe) {
      case _e:
        return ze;
      case 34:
      case 39:
        _e !== 34 && _e !== 39 && fo(xe);
        break;
      case 40:
        _e === 41 && fo(_e);
        break;
      case 92:
        Be();
        break;
    }
  return ze;
}
function rg(_e, Qt) {
  for (; Be() && _e + xe !== 47 + 10 && !(_e + xe === 42 + 42 && ft() === 47); )
    ;
  return "/*" + xn(Qt, ze - 1) + "*" + ri(_e === 47 ? _e : Be());
}
function ng(_e) {
  for (; !ln(ft()); )
    Be();
  return xn(_e, ze);
}
function ag(_e) {
  return jf(ta("", null, null, null, [""], _e = Nf(_e), 0, [0], _e));
}
function ta(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr) {
  for (var kr = 0, Yr = 0, Ms = Kn, Ds = 0, Ls = 0, js = 0, zs = 1, Fs = 1, Bs = 1, Hs = 0, Ws = "", Ys = Sn, El = kn, Mu = $n, Pl = Ws; Fs; )
    switch (js = Hs, Hs = Be()) {
      case 40:
        if (js != 108 && Ce(Pl, Ms - 1) == 58) {
          uo(Pl += fe(ea(Hs), "&", "&\f"), "&\f") != -1 && (Bs = -1);
          break;
        }
      case 34:
      case 39:
      case 91:
        Pl += ea(Hs);
        break;
      case 9:
      case 10:
      case 13:
      case 32:
        Pl += eg(js);
        break;
      case 92:
        Pl += tg(Zn() - 1, 7);
        continue;
      case 47:
        switch (ft()) {
          case 42:
          case 47:
            An(ig(rg(Be(), Zn()), Qt, Zt), Cr);
            break;
          default:
            Pl += "/";
        }
        break;
      case 123 * zs:
        er[kr++] = ot(Pl) * Bs;
      case 125 * zs:
      case 59:
      case 0:
        switch (Hs) {
          case 0:
          case 125:
            Fs = 0;
          case 59 + Yr:
            Bs == -1 && (Pl = fe(Pl, /\f/g, "")), Ls > 0 && ot(Pl) - Ms && An(Ls > 32 ? xl(Pl + ";", $n, Zt, Ms - 1) : xl(fe(Pl, " ", "") + ";", $n, Zt, Ms - 2), Cr);
            break;
          case 59:
            Pl += ";";
          default:
            if (An(Mu = _l(Pl, Qt, Zt, kr, Yr, Sn, er, Ws, Ys = [], El = [], Ms), kn), Hs === 123)
              if (Yr === 0)
                ta(Pl, Qt, Mu, Mu, Ys, kn, Ms, er, El);
              else
                switch (Ds === 99 && Ce(Pl, 3) === 110 ? 100 : Ds) {
                  case 100:
                  case 108:
                  case 109:
                  case 115:
                    ta(_e, Mu, Mu, $n && An(_l(_e, Mu, Mu, 0, 0, Sn, er, Ws, Sn, Ys = [], Ms), El), Sn, El, Ms, er, $n ? Ys : El);
                    break;
                  default:
                    ta(Pl, Mu, Mu, Mu, [""], El, 0, er, El);
                }
        }
        kr = Yr = Ls = 0, zs = Bs = 1, Ws = Pl = "", Ms = Kn;
        break;
      case 58:
        Ms = 1 + ot(Pl), Ls = js;
      default:
        if (zs < 1) {
          if (Hs == 123)
            --zs;
          else if (Hs == 125 && zs++ == 0 && Zv() == 125)
            continue;
        }
        switch (Pl += ri(Hs), Hs * zs) {
          case 38:
            Bs = Yr > 0 ? 1 : (Pl += "\f", -1);
            break;
          case 44:
            er[kr++] = (ot(Pl) - 1) * Bs, Bs = 1;
            break;
          case 64:
            ft() === 45 && (Pl += ea(Be())), Ds = ft(), Yr = Ms = ot(Ws = Pl += ng(Zn())), Hs++;
            break;
          case 45:
            js === 45 && ot(Pl) == 2 && (zs = 0);
        }
    }
  return kn;
}
function _l(_e, Qt, Zt, $n, Sn, kn, Kn, er, Cr, kr, Yr) {
  for (var Ms = Sn - 1, Ds = Sn === 0 ? kn : [""], Ls = rs(Ds), js = 0, zs = 0, Fs = 0; js < $n; ++js)
    for (var Bs = 0, Hs = sn(_e, Ms + 1, Ms = qv(zs = Kn[js])), Ws = _e; Bs < Ls; ++Bs)
      (Ws = Af(zs > 0 ? Ds[Bs] + " " + Hs : fe(Hs, /&\f/g, Ds[Bs]))) && (Cr[Fs++] = Ws);
  return ai(_e, Qt, Zt, Sn === 0 ? es : er, Cr, kr, Yr);
}
function ig(_e, Qt, Zt) {
  return ai(_e, Qt, Zt, Zo, ri(Jv()), sn(_e, 2, -2), 0);
}
function xl(_e, Qt, Zt, $n) {
  return ai(_e, Qt, Zt, ts, sn(_e, 0, $n), sn(_e, $n + 1, -1), $n);
}
function ur(_e, Qt) {
  for (var Zt = "", $n = rs(_e), Sn = 0; Sn < $n; Sn++)
    Zt += Qt(_e[Sn], Sn, _e, Qt) || "";
  return Zt;
}
function og(_e, Qt, Zt, $n) {
  switch (_e.type) {
    case Uv:
      if (_e.children.length)
        break;
    case Hv:
    case ts:
      return _e.return = _e.return || _e.value;
    case Zo:
      return "";
    case Tf:
      return _e.return = _e.value + "{" + ur(_e.children, $n) + "}";
    case es:
      _e.value = _e.props.join(",");
  }
  return ot(Zt = ur(_e.children, $n)) ? _e.return = _e.value + "{" + Zt + "}" : "";
}
function sg(_e) {
  var Qt = rs(_e);
  return function(Zt, $n, Sn, kn) {
    for (var Kn = "", er = 0; er < Qt; er++)
      Kn += _e[er](Zt, $n, Sn, kn) || "";
    return Kn;
  };
}
function lg(_e) {
  return function(Qt) {
    Qt.root || (Qt = Qt.return) && _e(Qt);
  };
}
function cg(_e) {
  var Qt = /* @__PURE__ */ Object.create(null);
  return function(Zt) {
    return Qt[Zt] === void 0 && (Qt[Zt] = _e(Zt)), Qt[Zt];
  };
}
var ug = function(_e, Qt, Zt) {
  for (var $n = 0, Sn = 0; $n = Sn, Sn = ft(), $n === 38 && Sn === 12 && (Qt[Zt] = 1), !ln(Sn); )
    Be();
  return xn(_e, ze);
}, fg = function(_e, Qt) {
  var Zt = -1, $n = 44;
  do
    switch (ln($n)) {
      case 0:
        $n === 38 && ft() === 12 && (Qt[Zt] = 1), _e[Zt] += ug(ze - 1, Qt, Zt);
        break;
      case 2:
        _e[Zt] += ea($n);
        break;
      case 4:
        if ($n === 44) {
          _e[++Zt] = ft() === 58 ? "&\f" : "", Qt[Zt] = _e[Zt].length;
          break;
        }
      default:
        _e[Zt] += ri($n);
    }
  while ($n = Be());
  return _e;
}, dg = function(_e, Qt) {
  return jf(fg(Nf(_e), Qt));
}, Ol = /* @__PURE__ */ new WeakMap(), pg = function(_e) {
  if (!(_e.type !== "rule" || !_e.parent || // positive .length indicates that this rule contains pseudo
  // negative .length indicates that this rule has been already prefixed
  _e.length < 1)) {
    for (var Qt = _e.value, Zt = _e.parent, $n = _e.column === Zt.column && _e.line === Zt.line; Zt.type !== "rule"; )
      if (Zt = Zt.parent, !Zt)
        return;
    if (!(_e.props.length === 1 && Qt.charCodeAt(0) !== 58 && !Ol.get(Zt)) && !$n) {
      Ol.set(_e, !0);
      for (var Sn = [], kn = dg(Qt, Sn), Kn = Zt.props, er = 0, Cr = 0; er < kn.length; er++)
        for (var kr = 0; kr < Kn.length; kr++, Cr++)
          _e.props[Cr] = Sn[er] ? kn[er].replace(/&\f/g, Kn[kr]) : Kn[kr] + " " + kn[er];
    }
  }
}, mg = function(_e) {
  if (_e.type === "decl") {
    var Qt = _e.value;
    Qt.charCodeAt(0) === 108 && // charcode for b
    Qt.charCodeAt(2) === 98 && (_e.return = "", _e.value = "");
  }
};
function Df(_e, Qt) {
  switch (Xv(_e, Qt)) {
    case 5103:
      return ue + "print-" + _e + _e;
    case 5737:
    case 4201:
    case 3177:
    case 3433:
    case 1641:
    case 4457:
    case 2921:
    case 5572:
    case 6356:
    case 5844:
    case 3191:
    case 6645:
    case 3005:
    case 6391:
    case 5879:
    case 5623:
    case 6135:
    case 4599:
    case 4855:
    case 4215:
    case 6389:
    case 5109:
    case 5365:
    case 5621:
    case 3829:
      return ue + _e + _e;
    case 5349:
    case 4246:
    case 4810:
    case 6968:
    case 2756:
      return ue + _e + da + _e + Te + _e + _e;
    case 6828:
    case 4268:
      return ue + _e + Te + _e + _e;
    case 6165:
      return ue + _e + Te + "flex-" + _e + _e;
    case 5187:
      return ue + _e + fe(_e, /(\w+).+(:[^]+)/, ue + "box-$1$2" + Te + "flex-$1$2") + _e;
    case 5443:
      return ue + _e + Te + "flex-item-" + fe(_e, /flex-|-self/, "") + _e;
    case 4675:
      return ue + _e + Te + "flex-line-pack" + fe(_e, /align-content|flex-|-self/, "") + _e;
    case 5548:
      return ue + _e + Te + fe(_e, "shrink", "negative") + _e;
    case 5292:
      return ue + _e + Te + fe(_e, "basis", "preferred-size") + _e;
    case 6060:
      return ue + "box-" + fe(_e, "-grow", "") + ue + _e + Te + fe(_e, "grow", "positive") + _e;
    case 4554:
      return ue + fe(_e, /([^-])(transform)/g, "$1" + ue + "$2") + _e;
    case 6187:
      return fe(fe(fe(_e, /(zoom-|grab)/, ue + "$1"), /(image-set)/, ue + "$1"), _e, "") + _e;
    case 5495:
    case 3959:
      return fe(_e, /(image-set\([^]*)/, ue + "$1$`$1");
    case 4968:
      return fe(fe(_e, /(.+:)(flex-)?(.*)/, ue + "box-pack:$3" + Te + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + ue + _e + _e;
    case 4095:
    case 3583:
    case 4068:
    case 2532:
      return fe(_e, /(.+)-inline(.+)/, ue + "$1$2") + _e;
    case 8116:
    case 7059:
    case 5753:
    case 5535:
    case 5445:
    case 5701:
    case 4933:
    case 4677:
    case 5533:
    case 5789:
    case 5021:
    case 4765:
      if (ot(_e) - 1 - Qt > 6)
        switch (Ce(_e, Qt + 1)) {
          case 109:
            if (Ce(_e, Qt + 4) !== 45)
              break;
          case 102:
            return fe(_e, /(.+:)(.+)-([^]+)/, "$1" + ue + "$2-$3$1" + da + (Ce(_e, Qt + 3) == 108 ? "$3" : "$2-$3")) + _e;
          case 115:
            return ~uo(_e, "stretch") ? Df(fe(_e, "stretch", "fill-available"), Qt) + _e : _e;
        }
      break;
    case 4949:
      if (Ce(_e, Qt + 1) !== 115)
        break;
    case 6444:
      switch (Ce(_e, ot(_e) - 3 - (~uo(_e, "!important") && 10))) {
        case 107:
          return fe(_e, ":", ":" + ue) + _e;
        case 101:
          return fe(_e, /(.+:)([^;!]+)(;|!.+)?/, "$1" + ue + (Ce(_e, 14) === 45 ? "inline-" : "") + "box$3$1" + ue + "$2$3$1" + Te + "$2box$3") + _e;
      }
      break;
    case 5936:
      switch (Ce(_e, Qt + 11)) {
        case 114:
          return ue + _e + Te + fe(_e, /[svh]\w+-[tblr]{2}/, "tb") + _e;
        case 108:
          return ue + _e + Te + fe(_e, /[svh]\w+-[tblr]{2}/, "tb-rl") + _e;
        case 45:
          return ue + _e + Te + fe(_e, /[svh]\w+-[tblr]{2}/, "lr") + _e;
      }
      return ue + _e + Te + _e + _e;
  }
  return _e;
}
var wg = function(_e, Qt, Zt, $n) {
  if (_e.length > -1 && !_e.return)
    switch (_e.type) {
      case ts:
        _e.return = Df(_e.value, _e.length);
        break;
      case Tf:
        return ur([Nr(_e, {
          value: fe(_e.value, "@", "@" + ue)
        })], $n);
      case es:
        if (_e.length)
          return Qv(_e.props, function(Sn) {
            switch (Kv(Sn, /(::plac\w+|:read-\w+)/)) {
              case ":read-only":
              case ":read-write":
                return ur([Nr(_e, {
                  props: [fe(Sn, /:(read-\w+)/, ":" + da + "$1")]
                })], $n);
              case "::placeholder":
                return ur([Nr(_e, {
                  props: [fe(Sn, /:(plac\w+)/, ":" + ue + "input-$1")]
                }), Nr(_e, {
                  props: [fe(Sn, /:(plac\w+)/, ":" + da + "$1")]
                }), Nr(_e, {
                  props: [fe(Sn, /:(plac\w+)/, Te + "input-$1")]
                })], $n);
            }
            return "";
          });
    }
}, _g = [wg], xg = function(_e) {
  var Qt = _e.key;
  if (Qt === "css") {
    var Zt = document.querySelectorAll("style[data-emotion]:not([data-s])");
    Array.prototype.forEach.call(Zt, function(js) {
      var zs = js.getAttribute("data-emotion");
      zs.indexOf(" ") !== -1 && (document.head.appendChild(js), js.setAttribute("data-s", ""));
    });
  }
  var $n = _e.stylisPlugins || _g, Sn = {}, kn, Kn = [];
  kn = _e.container || document.head, Array.prototype.forEach.call(
    // this means we will ignore elements which don't have a space in them which
    // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
    document.querySelectorAll('style[data-emotion^="' + Qt + ' "]'),
    function(js) {
      for (var zs = js.getAttribute("data-emotion").split(" "), Fs = 1; Fs < zs.length; Fs++)
        Sn[zs[Fs]] = !0;
      Kn.push(js);
    }
  );
  var er, Cr = [pg, mg];
  {
    var kr, Yr = [og, lg(function(js) {
      kr.insert(js);
    })], Ms = sg(Cr.concat($n, Yr)), Ds = function(js) {
      return ur(ag(js), Ms);
    };
    er = function(js, zs, Fs, Bs) {
      kr = Fs, Ds(js ? js + "{" + zs.styles + "}" : zs.styles), Bs && (Ls.inserted[zs.name] = !0);
    };
  }
  var Ls = {
    key: Qt,
    sheet: new Bv({
      key: Qt,
      container: kn,
      nonce: _e.nonce,
      speedy: _e.speedy,
      prepend: _e.prepend,
      insertionPoint: _e.insertionPoint
    }),
    nonce: _e.nonce,
    inserted: Sn,
    registered: {},
    insert: er
  };
  return Ls.sheet.hydrate(Kn), Ls;
};
function po() {
  return po = Object.assign ? Object.assign.bind() : function(_e) {
    for (var Qt = 1; Qt < arguments.length; Qt++) {
      var Zt = arguments[Qt];
      for (var $n in Zt)
        Object.prototype.hasOwnProperty.call(Zt, $n) && (_e[$n] = Zt[$n]);
    }
    return _e;
  }, po.apply(this, arguments);
}
var Og = !0;
function Pg(_e, Qt, Zt) {
  var $n = "";
  return Zt.split(" ").forEach(function(Sn) {
    _e[Sn] !== void 0 ? Qt.push(_e[Sn] + ";") : $n += Sn + " ";
  }), $n;
}
var Eg = function(_e, Qt, Zt) {
  var $n = _e.key + "-" + Qt.name;
  (Zt === !1 || // we need to always store it if we're in compat mode and
  // in node since emotion-server relies on whether a style is in
  // the registered cache to know whether a style is global or not
  // also, note that this check will be dead code eliminated in the browser
  Og === !1) && _e.registered[$n] === void 0 && (_e.registered[$n] = Qt.styles);
}, Sg = function(_e, Qt, Zt) {
  Eg(_e, Qt, Zt);
  var $n = _e.key + "-" + Qt.name;
  if (_e.inserted[Qt.name] === void 0) {
    var Sn = Qt;
    do
      _e.insert(Qt === Sn ? "." + $n : "", Sn, _e.sheet, !0), Sn = Sn.next;
    while (Sn !== void 0);
  }
};
function $g(_e) {
  for (var Qt = 0, Zt, $n = 0, Sn = _e.length; Sn >= 4; ++$n, Sn -= 4)
    Zt = _e.charCodeAt($n) & 255 | (_e.charCodeAt(++$n) & 255) << 8 | (_e.charCodeAt(++$n) & 255) << 16 | (_e.charCodeAt(++$n) & 255) << 24, Zt = /* Math.imul(k, m): */
    (Zt & 65535) * 1540483477 + ((Zt >>> 16) * 59797 << 16), Zt ^= /* k >>> r: */
    Zt >>> 24, Qt = /* Math.imul(k, m): */
    (Zt & 65535) * 1540483477 + ((Zt >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
    (Qt & 65535) * 1540483477 + ((Qt >>> 16) * 59797 << 16);
  switch (Sn) {
    case 3:
      Qt ^= (_e.charCodeAt($n + 2) & 255) << 16;
    case 2:
      Qt ^= (_e.charCodeAt($n + 1) & 255) << 8;
    case 1:
      Qt ^= _e.charCodeAt($n) & 255, Qt = /* Math.imul(h, m): */
      (Qt & 65535) * 1540483477 + ((Qt >>> 16) * 59797 << 16);
  }
  return Qt ^= Qt >>> 13, Qt = /* Math.imul(h, m): */
  (Qt & 65535) * 1540483477 + ((Qt >>> 16) * 59797 << 16), ((Qt ^ Qt >>> 15) >>> 0).toString(36);
}
var kg = {
  animationIterationCount: 1,
  aspectRatio: 1,
  borderImageOutset: 1,
  borderImageSlice: 1,
  borderImageWidth: 1,
  boxFlex: 1,
  boxFlexGroup: 1,
  boxOrdinalGroup: 1,
  columnCount: 1,
  columns: 1,
  flex: 1,
  flexGrow: 1,
  flexPositive: 1,
  flexShrink: 1,
  flexNegative: 1,
  flexOrder: 1,
  gridRow: 1,
  gridRowEnd: 1,
  gridRowSpan: 1,
  gridRowStart: 1,
  gridColumn: 1,
  gridColumnEnd: 1,
  gridColumnSpan: 1,
  gridColumnStart: 1,
  msGridRow: 1,
  msGridRowSpan: 1,
  msGridColumn: 1,
  msGridColumnSpan: 1,
  fontWeight: 1,
  lineHeight: 1,
  opacity: 1,
  order: 1,
  orphans: 1,
  tabSize: 1,
  widows: 1,
  zIndex: 1,
  zoom: 1,
  WebkitLineClamp: 1,
  // SVG-related properties
  fillOpacity: 1,
  floodOpacity: 1,
  stopOpacity: 1,
  strokeDasharray: 1,
  strokeDashoffset: 1,
  strokeMiterlimit: 1,
  strokeOpacity: 1,
  strokeWidth: 1
}, Cg = /[A-Z]|^ms/g, zf = /_EMO_([^_]+?)_([^]*?)_EMO_/g, ns = function(_e) {
  return _e.charCodeAt(1) === 45;
}, Sl = function(_e) {
  return _e != null && typeof _e != "boolean";
}, Ei = /* @__PURE__ */ cg(function(_e) {
  return ns(_e) ? _e : _e.replace(Cg, "-$&").toLowerCase();
}), pa = function(_e, Qt) {
  switch (_e) {
    case "animation":
    case "animationName":
      if (typeof Qt == "string")
        return Qt.replace(zf, function(Zt, $n, Sn) {
          return Qe = {
            name: $n,
            styles: Sn,
            next: Qe
          }, $n;
        });
  }
  return kg[_e] !== 1 && !ns(_e) && typeof Qt == "number" && Qt !== 0 ? Qt + "px" : Qt;
}, Lf = "Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";
function cn(_e, Qt, Zt) {
  if (Zt == null)
    return "";
  if (Zt.__emotion_styles !== void 0)
    return Zt;
  switch (typeof Zt) {
    case "boolean":
      return "";
    case "object": {
      if (Zt.anim === 1)
        return Qe = {
          name: Zt.name,
          styles: Zt.styles,
          next: Qe
        }, Zt.name;
      if (Zt.styles !== void 0) {
        var $n = Zt.next;
        if ($n !== void 0)
          for (; $n !== void 0; )
            Qe = {
              name: $n.name,
              styles: $n.styles,
              next: Qe
            }, $n = $n.next;
        var Sn = Zt.styles + ";";
        return Sn;
      }
      return Mg(_e, Qt, Zt);
    }
    case "function": {
      if (_e !== void 0) {
        var kn = Qe, Kn = Zt(_e);
        return Qe = kn, cn(_e, Qt, Kn);
      }
      break;
    }
  }
  if (Qt == null)
    return Zt;
  var er = Qt[Zt];
  return er !== void 0 ? er : Zt;
}
function Mg(_e, Qt, Zt) {
  var $n = "";
  if (Array.isArray(Zt))
    for (var Sn = 0; Sn < Zt.length; Sn++)
      $n += cn(_e, Qt, Zt[Sn]) + ";";
  else
    for (var kn in Zt) {
      var Kn = Zt[kn];
      if (typeof Kn != "object")
        Qt != null && Qt[Kn] !== void 0 ? $n += kn + "{" + Qt[Kn] + "}" : Sl(Kn) && ($n += Ei(kn) + ":" + pa(kn, Kn) + ";");
      else if (Array.isArray(Kn) && typeof Kn[0] == "string" && (Qt == null || Qt[Kn[0]] === void 0))
        for (var er = 0; er < Kn.length; er++)
          Sl(Kn[er]) && ($n += Ei(kn) + ":" + pa(kn, Kn[er]) + ";");
      else {
        var Cr = cn(_e, Qt, Kn);
        switch (kn) {
          case "animation":
          case "animationName": {
            $n += Ei(kn) + ":" + Cr + ";";
            break;
          }
          default:
            $n += kn + "{" + Cr + "}";
        }
      }
    }
  return $n;
}
var kl = /label:\s*([^\s;\n{]+)\s*(;|$)/g, Qe, Dg = function(_e, Qt, Zt) {
  if (_e.length === 1 && typeof _e[0] == "object" && _e[0] !== null && _e[0].styles !== void 0)
    return _e[0];
  var $n = !0, Sn = "";
  Qe = void 0;
  var kn = _e[0];
  kn == null || kn.raw === void 0 ? ($n = !1, Sn += cn(Zt, Qt, kn)) : Sn += kn[0];
  for (var Kn = 1; Kn < _e.length; Kn++)
    Sn += cn(Zt, Qt, _e[Kn]), $n && (Sn += kn[Kn]);
  kl.lastIndex = 0;
  for (var er = "", Cr; (Cr = kl.exec(Sn)) !== null; )
    er += "-" + // $FlowFixMe we know it's not null
    Cr[1];
  var kr = $g(Sn) + er;
  return {
    name: kr,
    styles: Sn,
    next: Qe
  };
};
function Wf(_e) {
  return Object.keys(_e).reduce((Qt, Zt) => (_e[Zt] !== void 0 && (Qt[Zt] = _e[Zt]), Qt), {});
}
var zg = Object.defineProperty, Rl = Object.getOwnPropertySymbols, Lg = Object.prototype.hasOwnProperty, Fg = Object.prototype.propertyIsEnumerable, Cl = (_e, Qt, Zt) => Qt in _e ? zg(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Si = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Lg.call(Qt, Zt) && Cl(_e, Zt, Qt[Zt]);
  if (Rl)
    for (var Zt of Rl(Qt))
      Fg.call(Qt, Zt) && Cl(_e, Zt, Qt[Zt]);
  return _e;
};
const Vf = reactExports.createContext({
  theme: Cf
});
function _t() {
  var _e;
  return ((_e = reactExports.useContext(Vf)) == null ? void 0 : _e.theme) || Cf;
}
function Wg(_e) {
  const Qt = _t(), Zt = ($n) => {
    var Sn, kn;
    return {
      styles: ((Sn = Qt.components[$n]) == null ? void 0 : Sn.styles) || {},
      classNames: ((kn = Qt.components[$n]) == null ? void 0 : kn.classNames) || {}
    };
  };
  return Array.isArray(_e) ? _e.map(Zt) : [Zt(_e)];
}
function Yf() {
  var _e;
  return (_e = reactExports.useContext(Vf)) == null ? void 0 : _e.emotionCache;
}
function Pe(_e, Qt, Zt) {
  var $n;
  const Sn = _t(), kn = ($n = Sn.components[_e]) == null ? void 0 : $n.defaultProps, Kn = typeof kn == "function" ? kn(Sn) : kn;
  return Si(Si(Si({}, Qt), Kn), Wf(Zt));
}
const Vg = {
  app: 100,
  modal: 200,
  popover: 300,
  overlay: 400,
  max: 9999
};
function as(_e) {
  return Vg[_e];
}
function Yg(_e, Qt) {
  const Zt = reactExports.useRef();
  return (!Zt.current || Qt.length !== Zt.current.prevDeps.length || Zt.current.prevDeps.map(($n, Sn) => $n === Qt[Sn]).indexOf(!1) >= 0) && (Zt.current = {
    v: _e(),
    prevDeps: [...Qt]
  }), Zt.current.v;
}
const Bg = xg({ key: "mantine", prepend: !0 });
function Hg() {
  return Yf() || Bg;
}
var Ug = Object.defineProperty, Tl = Object.getOwnPropertySymbols, qg = Object.prototype.hasOwnProperty, Gg = Object.prototype.propertyIsEnumerable, Al = (_e, Qt, Zt) => Qt in _e ? Ug(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Xg = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    qg.call(Qt, Zt) && Al(_e, Zt, Qt[Zt]);
  if (Tl)
    for (var Zt of Tl(Qt))
      Gg.call(Qt, Zt) && Al(_e, Zt, Qt[Zt]);
  return _e;
};
const $i = "ref";
function Kg(_e) {
  let Qt;
  if (_e.length !== 1)
    return { args: _e, ref: Qt };
  const [Zt] = _e;
  if (!(Zt instanceof Object))
    return { args: _e, ref: Qt };
  if (!($i in Zt))
    return { args: _e, ref: Qt };
  Qt = Zt[$i];
  const $n = Xg({}, Zt);
  return delete $n[$i], { args: [$n], ref: Qt };
}
const { cssFactory: Qg } = (() => {
  function _e(Zt, $n, Sn) {
    const kn = [], Kn = Pg(Zt, kn, Sn);
    return kn.length < 2 ? Sn : Kn + $n(kn);
  }
  function Qt(Zt) {
    const { cache: $n } = Zt, Sn = (...kn) => {
      const { ref: Kn, args: er } = Kg(kn), Cr = Dg(er, $n.registered);
      return Sg($n, Cr, !1), `${$n.key}-${Cr.name}${Kn === void 0 ? "" : ` ${Kn}`}`;
    };
    return { css: Sn, cx: (...kn) => _e($n.registered, Sn, $f(kn)) };
  }
  return { cssFactory: Qt };
})();
function Bf() {
  const _e = Hg();
  return Yg(() => Qg({ cache: _e }), [_e]);
}
function Jg({
  cx: _e,
  classes: Qt,
  context: Zt,
  classNames: $n,
  name: Sn,
  cache: kn
}) {
  const Kn = Zt.reduce((er, Cr) => (Object.keys(Cr.classNames).forEach((kr) => {
    typeof er[kr] != "string" ? er[kr] = `${Cr.classNames[kr]}` : er[kr] = `${er[kr]} ${Cr.classNames[kr]}`;
  }), er), {});
  return Object.keys(Qt).reduce((er, Cr) => (er[Cr] = _e(Qt[Cr], Kn[Cr], $n != null && $n[Cr], Array.isArray(Sn) ? Sn.filter(Boolean).map((kr) => `${(kn == null ? void 0 : kn.key) || "mantine"}-${kr}-${Cr}`).join(" ") : Sn ? `${(kn == null ? void 0 : kn.key) || "mantine"}-${Sn}-${Cr}` : null), er), {});
}
var Zg = Object.defineProperty, Il = Object.getOwnPropertySymbols, ey = Object.prototype.hasOwnProperty, ty = Object.prototype.propertyIsEnumerable, Nl = (_e, Qt, Zt) => Qt in _e ? Zg(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, ki = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    ey.call(Qt, Zt) && Nl(_e, Zt, Qt[Zt]);
  if (Il)
    for (var Zt of Il(Qt))
      ty.call(Qt, Zt) && Nl(_e, Zt, Qt[Zt]);
  return _e;
};
function ry(_e) {
  return `__mantine-ref-${_e || ""}`;
}
function jl(_e, Qt, Zt) {
  const $n = (Sn) => typeof Sn == "function" ? Sn(Qt, Zt || {}) : Sn || {};
  return Array.isArray(_e) ? _e.map((Sn) => $n(Sn.styles)).reduce((Sn, kn) => (Object.keys(kn).forEach((Kn) => {
    Sn[Kn] ? Sn[Kn] = ki(ki({}, Sn[Kn]), kn[Kn]) : Sn[Kn] = ki({}, kn[Kn]);
  }), Sn), {}) : $n(_e);
}
function Fe(_e) {
  const Qt = typeof _e == "function" ? _e : () => _e;
  function Zt($n, Sn) {
    const kn = _t(), Kn = Wg(Sn == null ? void 0 : Sn.name), er = Yf(), { css: Cr, cx: kr } = Bf(), Yr = Qt(kn, $n, ry), Ms = jl(Sn == null ? void 0 : Sn.styles, kn, $n), Ds = jl(Kn, kn, $n), Ls = Object.fromEntries(Object.keys(Yr).map((js) => {
      const zs = kr({ [Cr(Yr[js])]: !(Sn != null && Sn.unstyled) }, Cr(Ds[js]), Cr(Ms[js]));
      return [js, zs];
    }));
    return {
      classes: Jg({
        cx: kr,
        classes: Ls,
        context: Kn,
        classNames: Sn == null ? void 0 : Sn.classNames,
        name: Sn == null ? void 0 : Sn.name,
        cache: er
      }),
      cx: kr,
      theme: kn
    };
  }
  return Zt;
}
var ny = Object.defineProperty, ay = Object.defineProperties, iy = Object.getOwnPropertyDescriptors, Ml = Object.getOwnPropertySymbols, oy = Object.prototype.hasOwnProperty, sy = Object.prototype.propertyIsEnumerable, Dl = (_e, Qt, Zt) => Qt in _e ? ny(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, jr = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    oy.call(Qt, Zt) && Dl(_e, Zt, Qt[Zt]);
  if (Ml)
    for (var Zt of Ml(Qt))
      sy.call(Qt, Zt) && Dl(_e, Zt, Qt[Zt]);
  return _e;
}, Mr = (_e, Qt) => ay(_e, iy(Qt));
const Dr = {
  in: { opacity: 1, transform: "scale(1)" },
  out: { opacity: 0, transform: "scale(.9) translateY(10px)" },
  transitionProperty: "transform, opacity"
}, In = {
  fade: {
    in: { opacity: 1 },
    out: { opacity: 0 },
    transitionProperty: "opacity"
  },
  scale: {
    in: { opacity: 1, transform: "scale(1)" },
    out: { opacity: 0, transform: "scale(0)" },
    common: { transformOrigin: "top" },
    transitionProperty: "transform, opacity"
  },
  "scale-y": {
    in: { opacity: 1, transform: "scaleY(1)" },
    out: { opacity: 0, transform: "scaleY(0)" },
    common: { transformOrigin: "top" },
    transitionProperty: "transform, opacity"
  },
  "scale-x": {
    in: { opacity: 1, transform: "scaleX(1)" },
    out: { opacity: 0, transform: "scaleX(0)" },
    common: { transformOrigin: "left" },
    transitionProperty: "transform, opacity"
  },
  "skew-up": {
    in: { opacity: 1, transform: "translateY(0) skew(0deg, 0deg)" },
    out: { opacity: 0, transform: "translateY(-20px) skew(-10deg, -5deg)" },
    common: { transformOrigin: "top" },
    transitionProperty: "transform, opacity"
  },
  "skew-down": {
    in: { opacity: 1, transform: "translateY(0) skew(0deg, 0deg)" },
    out: { opacity: 0, transform: "translateY(20px) skew(-10deg, -5deg)" },
    common: { transformOrigin: "bottom" },
    transitionProperty: "transform, opacity"
  },
  "rotate-left": {
    in: { opacity: 1, transform: "translateY(0) rotate(0deg)" },
    out: { opacity: 0, transform: "translateY(20px) rotate(-5deg)" },
    common: { transformOrigin: "bottom" },
    transitionProperty: "transform, opacity"
  },
  "rotate-right": {
    in: { opacity: 1, transform: "translateY(0) rotate(0deg)" },
    out: { opacity: 0, transform: "translateY(20px) rotate(5deg)" },
    common: { transformOrigin: "top" },
    transitionProperty: "transform, opacity"
  },
  "slide-down": {
    in: { opacity: 1, transform: "translateY(0)" },
    out: { opacity: 0, transform: "translateY(-100%)" },
    common: { transformOrigin: "top" },
    transitionProperty: "transform, opacity"
  },
  "slide-up": {
    in: { opacity: 1, transform: "translateY(0)" },
    out: { opacity: 0, transform: "translateY(100%)" },
    common: { transformOrigin: "bottom" },
    transitionProperty: "transform, opacity"
  },
  "slide-left": {
    in: { opacity: 1, transform: "translateX(0)" },
    out: { opacity: 0, transform: "translateX(100%)" },
    common: { transformOrigin: "left" },
    transitionProperty: "transform, opacity"
  },
  "slide-right": {
    in: { opacity: 1, transform: "translateX(0)" },
    out: { opacity: 0, transform: "translateX(-100%)" },
    common: { transformOrigin: "right" },
    transitionProperty: "transform, opacity"
  },
  pop: Mr(jr({}, Dr), {
    common: { transformOrigin: "center center" }
  }),
  "pop-bottom-left": Mr(jr({}, Dr), {
    common: { transformOrigin: "bottom left" }
  }),
  "pop-bottom-right": Mr(jr({}, Dr), {
    common: { transformOrigin: "bottom right" }
  }),
  "pop-top-left": Mr(jr({}, Dr), {
    common: { transformOrigin: "top left" }
  }),
  "pop-top-right": Mr(jr({}, Dr), {
    common: { transformOrigin: "top right" }
  })
}, zl = ["mousedown", "touchstart"];
function ly(_e, Qt, Zt) {
  const $n = reactExports.useRef();
  return reactExports.useEffect(() => {
    const Sn = (kn) => {
      const { target: Kn } = kn ?? {};
      if (Array.isArray(Zt)) {
        const er = (Kn == null ? void 0 : Kn.hasAttribute("data-ignore-outside-clicks")) || !document.body.contains(Kn) && Kn.tagName !== "HTML";
        Zt.every((Cr) => !!Cr && !kn.composedPath().includes(Cr)) && !er && _e();
      } else
        $n.current && !$n.current.contains(Kn) && _e();
    };
    return (Qt || zl).forEach((kn) => document.addEventListener(kn, Sn)), () => {
      (Qt || zl).forEach((kn) => document.removeEventListener(kn, Sn));
    };
  }, [$n, _e, Zt]), $n;
}
function cy(_e, Qt) {
  try {
    return _e.addEventListener("change", Qt), () => _e.removeEventListener("change", Qt);
  } catch {
    return _e.addListener(Qt), () => _e.removeListener(Qt);
  }
}
function uy(_e, Qt) {
  return typeof Qt == "boolean" ? Qt : typeof window < "u" && "matchMedia" in window ? window.matchMedia(_e).matches : !1;
}
function fy(_e, Qt, { getInitialValueInEffect: Zt } = {
  getInitialValueInEffect: !0
}) {
  const [$n, Sn] = reactExports.useState(Zt ? Qt : uy(_e, Qt)), kn = reactExports.useRef();
  return reactExports.useEffect(() => {
    if ("matchMedia" in window)
      return kn.current = window.matchMedia(_e), Sn(kn.current.matches), cy(kn.current, (Kn) => Sn(Kn.matches));
  }, [_e]), $n;
}
const Hf = typeof document < "u" ? reactExports.useLayoutEffect : reactExports.useEffect;
function vr(_e, Qt) {
  const Zt = reactExports.useRef(!1);
  reactExports.useEffect(() => () => {
    Zt.current = !1;
  }, []), reactExports.useEffect(() => {
    if (Zt.current)
      return _e();
    Zt.current = !0;
  }, Qt);
}
function dy({ opened: _e, shouldReturnFocus: Qt = !0 }) {
  const Zt = reactExports.useRef(), $n = () => {
    var Sn;
    Zt.current && "focus" in Zt.current && typeof Zt.current.focus == "function" && ((Sn = Zt.current) == null || Sn.focus({ preventScroll: !0 }));
  };
  return vr(() => {
    let Sn = -1;
    const kn = (Kn) => {
      Kn.key === "Tab" && window.clearTimeout(Sn);
    };
    return document.addEventListener("keydown", kn), _e ? Zt.current = document.activeElement : Qt && (Sn = window.setTimeout($n, 10)), () => {
      window.clearTimeout(Sn), document.removeEventListener("keydown", kn);
    };
  }, [_e, Qt]), $n;
}
const py = /input|select|textarea|button|object/, Uf = "a, input, select, textarea, button, object, [tabindex]";
function my(_e) {
  return _e.style.display === "none";
}
function hy(_e) {
  if (_e.getAttribute("aria-hidden") || _e.getAttribute("hidden") || _e.getAttribute("type") === "hidden")
    return !1;
  let Qt = _e;
  for (; Qt && !(Qt === document.body || Qt.nodeType === 11); ) {
    if (my(Qt))
      return !1;
    Qt = Qt.parentNode;
  }
  return !0;
}
function qf(_e) {
  let Qt = _e.getAttribute("tabindex");
  return Qt === null && (Qt = void 0), parseInt(Qt, 10);
}
function mo(_e) {
  const Qt = _e.nodeName.toLowerCase(), Zt = !Number.isNaN(qf(_e));
  return (py.test(Qt) && !_e.disabled || _e instanceof HTMLAnchorElement && _e.href || Zt) && hy(_e);
}
function Gf(_e) {
  const Qt = qf(_e);
  return (Number.isNaN(Qt) || Qt >= 0) && mo(_e);
}
function vy(_e) {
  return Array.from(_e.querySelectorAll(Uf)).filter(Gf);
}
function gy(_e, Qt) {
  const Zt = vy(_e);
  if (!Zt.length) {
    Qt.preventDefault();
    return;
  }
  const $n = Zt[Qt.shiftKey ? 0 : Zt.length - 1], Sn = _e.getRootNode();
  if (!($n === Sn.activeElement || _e === Sn.activeElement))
    return;
  Qt.preventDefault();
  const kn = Zt[Qt.shiftKey ? Zt.length - 1 : 0];
  kn && kn.focus();
}
function yy(_e, Qt = "body > :not(script)") {
  const Zt = Array.from(document.querySelectorAll(Qt)).map(($n) => {
    var Sn;
    if ((Sn = $n == null ? void 0 : $n.shadowRoot) != null && Sn.contains(_e) || $n.contains(_e))
      return;
    const kn = $n.getAttribute("aria-hidden");
    return (kn === null || kn === "false") && $n.setAttribute("aria-hidden", "true"), { node: $n, ariaHidden: kn };
  });
  return () => {
    Zt.forEach(($n) => {
      $n && ($n.ariaHidden === null ? $n.node.removeAttribute("aria-hidden") : $n.node.setAttribute("aria-hidden", $n.ariaHidden));
    });
  };
}
function by(_e = !0) {
  const Qt = reactExports.useRef(), Zt = reactExports.useRef(null), $n = reactExports.useCallback((Sn) => {
    if (_e) {
      if (Sn === null) {
        Zt.current && (Zt.current(), Zt.current = null);
        return;
      }
      if (Zt.current = yy(Sn), Qt.current !== Sn)
        if (Sn) {
          const kn = () => {
            let Kn = Sn.querySelector("[data-autofocus]");
            if (!Kn) {
              const er = Array.from(Sn.querySelectorAll(Uf));
              Kn = er.find(Gf) || er.find(mo) || null, !Kn && mo(Sn) && (Kn = Sn);
            }
            Kn && Kn.focus({ preventScroll: !0 });
          };
          setTimeout(() => {
            Sn.getRootNode() && kn();
          }), Qt.current = Sn;
        } else
          Qt.current = null;
    }
  }, [_e]);
  return reactExports.useEffect(() => {
    if (!_e)
      return;
    const Sn = (kn) => {
      kn.key === "Tab" && Qt.current && gy(Qt.current, kn);
    };
    return document.addEventListener("keydown", Sn), () => {
      document.removeEventListener("keydown", Sn), Zt.current && Zt.current();
    };
  }, [_e]), $n;
}
const wy = () => `mantine-${Math.random().toString(36).slice(2, 11)}`, _y = React["useId".toString()] || (() => {
});
function xy() {
  const [_e, Qt] = reactExports.useState("");
  return Hf(() => {
    Qt(wy());
  }, []), _e;
}
function Oy() {
  const _e = _y();
  return _e ? `mantine-${_e.replace(/:/g, "")}` : "";
}
function is(_e) {
  return typeof _e == "string" ? _e : Oy() || xy();
}
function Py(_e, Qt) {
  typeof _e == "function" ? _e(Qt) : typeof _e == "object" && _e !== null && "current" in _e && (_e.current = Qt);
}
function Ey(..._e) {
  return (Qt) => {
    _e.forEach((Zt) => Py(Zt, Qt));
  };
}
function ii(..._e) {
  return reactExports.useCallback(Ey(..._e), _e);
}
function Sy({
  value: _e,
  defaultValue: Qt,
  finalValue: Zt,
  onChange: $n = () => {
  }
}) {
  const [Sn, kn] = reactExports.useState(Qt !== void 0 ? Qt : Zt);
  return _e !== void 0 ? [_e, $n, !0] : [Sn, (er) => {
    kn(er), $n == null || $n(er);
  }, !1];
}
function $y(_e, Qt) {
  return fy("(prefers-reduced-motion: reduce)", _e, Qt);
}
const ky = {
  x: 0,
  y: 0,
  width: 0,
  height: 0,
  top: 0,
  left: 0,
  bottom: 0,
  right: 0
};
function Ry() {
  const _e = reactExports.useRef(0), Qt = reactExports.useRef(null), [Zt, $n] = reactExports.useState(ky), Sn = reactExports.useMemo(() => typeof window < "u" ? new ResizeObserver((kn) => {
    const Kn = kn[0];
    Kn && (cancelAnimationFrame(_e.current), _e.current = requestAnimationFrame(() => {
      Qt.current && $n(Kn.contentRect);
    }));
  }) : null, []);
  return reactExports.useEffect(() => (Qt.current && Sn.observe(Qt.current), () => {
    Sn.disconnect(), _e.current && cancelAnimationFrame(_e.current);
  }), [Qt.current]), [Qt, Zt];
}
var Ll = Object.getOwnPropertySymbols, Cy = Object.prototype.hasOwnProperty, Ty = Object.prototype.propertyIsEnumerable, Ay = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    Cy.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Ll)
    for (var $n of Ll(_e))
      Qt.indexOf($n) < 0 && Ty.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function os(_e) {
  const Qt = _e, {
    m: Zt,
    mx: $n,
    my: Sn,
    mt: kn,
    mb: Kn,
    ml: er,
    mr: Cr,
    p: kr,
    px: Yr,
    py: Ms,
    pt: Ds,
    pb: Ls,
    pl: js,
    pr: zs,
    bg: Fs,
    c: Bs,
    opacity: Hs,
    ff: Ws,
    fz: Ys,
    fw: El,
    lts: Mu,
    ta: Pl,
    lh: Iu,
    fs: Tu,
    tt: Au,
    td: Nu,
    w: gm,
    miw: pm,
    maw: zu,
    h: Yu,
    mih: sm,
    mah: mm,
    bgsz: hm,
    bgp: ym,
    bgr: _m,
    bga: Sm,
    pos: wm,
    top: Nm,
    left: Cm,
    bottom: Im,
    right: Am,
    inset: Vm,
    display: Rm
  } = Qt, Dm = Ay(Qt, [
    "m",
    "mx",
    "my",
    "mt",
    "mb",
    "ml",
    "mr",
    "p",
    "px",
    "py",
    "pt",
    "pb",
    "pl",
    "pr",
    "bg",
    "c",
    "opacity",
    "ff",
    "fz",
    "fw",
    "lts",
    "ta",
    "lh",
    "fs",
    "tt",
    "td",
    "w",
    "miw",
    "maw",
    "h",
    "mih",
    "mah",
    "bgsz",
    "bgp",
    "bgr",
    "bga",
    "pos",
    "top",
    "left",
    "bottom",
    "right",
    "inset",
    "display"
  ]);
  return { systemStyles: Wf({
    m: Zt,
    mx: $n,
    my: Sn,
    mt: kn,
    mb: Kn,
    ml: er,
    mr: Cr,
    p: kr,
    px: Yr,
    py: Ms,
    pt: Ds,
    pb: Ls,
    pl: js,
    pr: zs,
    bg: Fs,
    c: Bs,
    opacity: Hs,
    ff: Ws,
    fz: Ys,
    fw: El,
    lts: Mu,
    ta: Pl,
    lh: Iu,
    fs: Tu,
    tt: Au,
    td: Nu,
    w: gm,
    miw: pm,
    maw: zu,
    h: Yu,
    mih: sm,
    mah: mm,
    bgsz: hm,
    bgp: ym,
    bgr: _m,
    bga: Sm,
    pos: wm,
    top: Nm,
    left: Cm,
    bottom: Im,
    right: Am,
    inset: Vm,
    display: Rm
  }), rest: Dm };
}
function Iy(_e, Qt) {
  const Zt = Object.keys(_e).filter(($n) => $n !== "base").sort(($n, Sn) => Qt.fn.size({ size: $n, sizes: Qt.breakpoints }) - Qt.fn.size({ size: Sn, sizes: Qt.breakpoints }));
  return "base" in _e ? ["base", ...Zt] : Zt;
}
function Ny({ value: _e, theme: Qt, getValue: Zt, property: $n }) {
  if (_e == null)
    return;
  if (typeof _e == "object")
    return Iy(_e, Qt).reduce((kn, Kn) => {
      if (Kn === "base" && _e.base !== void 0) {
        const Cr = Zt(_e.base, Qt);
        return Array.isArray($n) ? ($n.forEach((kr) => {
          kn[kr] = Cr;
        }), kn) : (kn[$n] = Cr, kn);
      }
      const er = Zt(_e[Kn], Qt);
      return Array.isArray($n) ? (kn[Qt.fn.largerThan(Kn)] = {}, $n.forEach((Cr) => {
        kn[Qt.fn.largerThan(Kn)][Cr] = er;
      }), kn) : (kn[Qt.fn.largerThan(Kn)] = {
        [$n]: er
      }, kn);
    }, {});
  const Sn = Zt(_e, Qt);
  return Array.isArray($n) ? $n.reduce((kn, Kn) => (kn[Kn] = Sn, kn), {}) : { [$n]: Sn };
}
function jy(_e, Qt) {
  return _e === "dimmed" ? Qt.colorScheme === "dark" ? Qt.colors.dark[2] : Qt.colors.gray[6] : Qt.fn.variant({ variant: "filled", color: _e, primaryFallback: !1 }).background;
}
function My(_e) {
  return _e;
}
function Dy(_e, Qt) {
  return Qt.fn.size({ size: _e, sizes: Qt.fontSizes });
}
const zy = ["-xs", "-sm", "-md", "-lg", "-xl"];
function Ly(_e, Qt) {
  return zy.includes(_e) ? Qt.fn.size({ size: _e.replace("-", ""), sizes: Qt.spacing }) * -1 : Qt.fn.size({ size: _e, sizes: Qt.spacing });
}
const Fy = {
  color: jy,
  default: My,
  fontSize: Dy,
  spacing: Ly
}, Wy = {
  m: { type: "spacing", property: "margin" },
  mt: { type: "spacing", property: "marginTop" },
  mb: { type: "spacing", property: "marginBottom" },
  ml: { type: "spacing", property: "marginLeft" },
  mr: { type: "spacing", property: "marginRight" },
  mx: { type: "spacing", property: ["marginRight", "marginLeft"] },
  my: { type: "spacing", property: ["marginTop", "marginBottom"] },
  p: { type: "spacing", property: "padding" },
  pt: { type: "spacing", property: "paddingTop" },
  pb: { type: "spacing", property: "paddingBottom" },
  pl: { type: "spacing", property: "paddingLeft" },
  pr: { type: "spacing", property: "paddingRight" },
  px: { type: "spacing", property: ["paddingRight", "paddingLeft"] },
  py: { type: "spacing", property: ["paddingTop", "paddingBottom"] },
  bg: { type: "color", property: "background" },
  c: { type: "color", property: "color" },
  opacity: { type: "default", property: "opacity" },
  ff: { type: "default", property: "fontFamily" },
  fz: { type: "fontSize", property: "fontSize" },
  fw: { type: "default", property: "fontWeight" },
  lts: { type: "default", property: "letterSpacing" },
  ta: { type: "default", property: "textAlign" },
  lh: { type: "default", property: "lineHeight" },
  fs: { type: "default", property: "fontStyle" },
  tt: { type: "default", property: "textTransform" },
  td: { type: "default", property: "textDecoration" },
  w: { type: "spacing", property: "width" },
  miw: { type: "spacing", property: "minWidth" },
  maw: { type: "spacing", property: "maxWidth" },
  h: { type: "spacing", property: "height" },
  mih: { type: "spacing", property: "minHeight" },
  mah: { type: "spacing", property: "maxHeight" },
  bgsz: { type: "default", property: "background-size" },
  bgp: { type: "default", property: "background-position" },
  bgr: { type: "default", property: "background-repeat" },
  bga: { type: "default", property: "background-attachment" },
  pos: { type: "default", property: "position" },
  top: { type: "default", property: "top" },
  left: { type: "default", property: "left" },
  bottom: { type: "default", property: "bottom" },
  right: { type: "default", property: "right" },
  inset: { type: "default", property: "inset" },
  display: { type: "default", property: "display" }
};
var Vy = Object.defineProperty, Fl = Object.getOwnPropertySymbols, Yy = Object.prototype.hasOwnProperty, By = Object.prototype.propertyIsEnumerable, Wl = (_e, Qt, Zt) => Qt in _e ? Vy(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Vl = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Yy.call(Qt, Zt) && Wl(_e, Zt, Qt[Zt]);
  if (Fl)
    for (var Zt of Fl(Qt))
      By.call(Qt, Zt) && Wl(_e, Zt, Qt[Zt]);
  return _e;
};
function Yl(_e, Qt, Zt = Wy) {
  return Object.keys(Zt).reduce(($n, Sn) => (Sn in _e && _e[Sn] !== void 0 && $n.push(Ny({
    value: _e[Sn],
    getValue: Fy[Zt[Sn].type],
    property: Zt[Sn].property,
    theme: Qt
  })), $n), []).reduce(($n, Sn) => (Object.keys(Sn).forEach((kn) => {
    typeof Sn[kn] == "object" && Sn[kn] !== null && kn in $n ? $n[kn] = Vl(Vl({}, $n[kn]), Sn[kn]) : $n[kn] = Sn[kn];
  }), $n), {});
}
function Bl(_e, Qt) {
  return typeof _e == "function" ? _e(Qt) : _e;
}
function Hy(_e, Qt, Zt) {
  const $n = _t(), { css: Sn, cx: kn } = Bf();
  return Array.isArray(_e) ? kn(Zt, Sn(Yl(Qt, $n)), _e.map((Kn) => Sn(Bl(Kn, $n)))) : kn(Zt, Sn(Bl(_e, $n)), Sn(Yl(Qt, $n)));
}
var Uy = Object.defineProperty, ma = Object.getOwnPropertySymbols, Xf = Object.prototype.hasOwnProperty, Kf = Object.prototype.propertyIsEnumerable, Hl = (_e, Qt, Zt) => Qt in _e ? Uy(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, qy = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Xf.call(Qt, Zt) && Hl(_e, Zt, Qt[Zt]);
  if (ma)
    for (var Zt of ma(Qt))
      Kf.call(Qt, Zt) && Hl(_e, Zt, Qt[Zt]);
  return _e;
}, Gy = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    Xf.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && ma)
    for (var $n of ma(_e))
      Qt.indexOf($n) < 0 && Kf.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const Qf = reactExports.forwardRef((_e, Qt) => {
  var Zt = _e, { className: $n, component: Sn, style: kn, sx: Kn } = Zt, er = Gy(Zt, ["className", "component", "style", "sx"]);
  const { systemStyles: Cr, rest: kr } = os(er), Yr = Sn || "div";
  return /* @__PURE__ */ React.createElement(Yr, qy({
    ref: Qt,
    className: Hy(Kn, Cr, $n),
    style: kn
  }, kr));
});
Qf.displayName = "@mantine/core/Box";
const Le = Qf;
var Xy = Object.defineProperty, Ky = Object.defineProperties, Qy = Object.getOwnPropertyDescriptors, Ul = Object.getOwnPropertySymbols, Jy = Object.prototype.hasOwnProperty, Zy = Object.prototype.propertyIsEnumerable, ql = (_e, Qt, Zt) => Qt in _e ? Xy(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Gl = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Jy.call(Qt, Zt) && ql(_e, Zt, Qt[Zt]);
  if (Ul)
    for (var Zt of Ul(Qt))
      Zy.call(Qt, Zt) && ql(_e, Zt, Qt[Zt]);
  return _e;
}, eb = (_e, Qt) => Ky(_e, Qy(Qt)), tb = Fe((_e) => ({
  root: eb(Gl(Gl({}, _e.fn.focusStyles()), _e.fn.fontStyles()), {
    cursor: "pointer",
    border: 0,
    padding: 0,
    appearance: "none",
    fontSize: _e.fontSizes.md,
    backgroundColor: "transparent",
    textAlign: "left",
    color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
    textDecoration: "none",
    boxSizing: "border-box"
  })
}));
const rb = tb;
var nb = Object.defineProperty, ha = Object.getOwnPropertySymbols, Jf = Object.prototype.hasOwnProperty, Zf = Object.prototype.propertyIsEnumerable, Xl = (_e, Qt, Zt) => Qt in _e ? nb(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, ab = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Jf.call(Qt, Zt) && Xl(_e, Zt, Qt[Zt]);
  if (ha)
    for (var Zt of ha(Qt))
      Zf.call(Qt, Zt) && Xl(_e, Zt, Qt[Zt]);
  return _e;
}, ib = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    Jf.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && ha)
    for (var $n of ha(_e))
      Qt.indexOf($n) < 0 && Zf.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const ed = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("UnstyledButton", {}, _e), {
    className: $n,
    component: Sn = "button",
    unstyled: kn
  } = Zt, Kn = ib(Zt, [
    "className",
    "component",
    "unstyled"
  ]), { classes: er, cx: Cr } = rb(null, { name: "UnstyledButton", unstyled: kn });
  return /* @__PURE__ */ React.createElement(Le, ab({
    component: Sn,
    ref: Qt,
    className: Cr(er.root, $n),
    type: Sn === "button" ? "button" : void 0
  }, Kn));
});
ed.displayName = "@mantine/core/UnstyledButton";
const ob = ed;
var sb = Object.defineProperty, va = Object.getOwnPropertySymbols, td = Object.prototype.hasOwnProperty, rd = Object.prototype.propertyIsEnumerable, Kl = (_e, Qt, Zt) => Qt in _e ? sb(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, lb = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    td.call(Qt, Zt) && Kl(_e, Zt, Qt[Zt]);
  if (va)
    for (var Zt of va(Qt))
      rd.call(Qt, Zt) && Kl(_e, Zt, Qt[Zt]);
  return _e;
}, cb = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    td.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && va)
    for (var $n of va(_e))
      Qt.indexOf($n) < 0 && rd.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function ub(_e) {
  var Qt = _e, { size: Zt, color: $n } = Qt, Sn = cb(Qt, ["size", "color"]);
  return /* @__PURE__ */ React.createElement("svg", lb({
    viewBox: "0 0 135 140",
    xmlns: "http://www.w3.org/2000/svg",
    fill: $n,
    width: `${Zt}px`
  }, Sn), /* @__PURE__ */ React.createElement("rect", {
    y: "10",
    width: "15",
    height: "120",
    rx: "6"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "height",
    begin: "0.5s",
    dur: "1s",
    values: "120;110;100;90;80;70;60;50;40;140;120",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "y",
    begin: "0.5s",
    dur: "1s",
    values: "10;15;20;25;30;35;40;45;50;0;10",
    calcMode: "linear",
    repeatCount: "indefinite"
  })), /* @__PURE__ */ React.createElement("rect", {
    x: "30",
    y: "10",
    width: "15",
    height: "120",
    rx: "6"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "height",
    begin: "0.25s",
    dur: "1s",
    values: "120;110;100;90;80;70;60;50;40;140;120",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "y",
    begin: "0.25s",
    dur: "1s",
    values: "10;15;20;25;30;35;40;45;50;0;10",
    calcMode: "linear",
    repeatCount: "indefinite"
  })), /* @__PURE__ */ React.createElement("rect", {
    x: "60",
    width: "15",
    height: "140",
    rx: "6"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "height",
    begin: "0s",
    dur: "1s",
    values: "120;110;100;90;80;70;60;50;40;140;120",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "y",
    begin: "0s",
    dur: "1s",
    values: "10;15;20;25;30;35;40;45;50;0;10",
    calcMode: "linear",
    repeatCount: "indefinite"
  })), /* @__PURE__ */ React.createElement("rect", {
    x: "90",
    y: "10",
    width: "15",
    height: "120",
    rx: "6"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "height",
    begin: "0.25s",
    dur: "1s",
    values: "120;110;100;90;80;70;60;50;40;140;120",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "y",
    begin: "0.25s",
    dur: "1s",
    values: "10;15;20;25;30;35;40;45;50;0;10",
    calcMode: "linear",
    repeatCount: "indefinite"
  })), /* @__PURE__ */ React.createElement("rect", {
    x: "120",
    y: "10",
    width: "15",
    height: "120",
    rx: "6"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "height",
    begin: "0.5s",
    dur: "1s",
    values: "120;110;100;90;80;70;60;50;40;140;120",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "y",
    begin: "0.5s",
    dur: "1s",
    values: "10;15;20;25;30;35;40;45;50;0;10",
    calcMode: "linear",
    repeatCount: "indefinite"
  })));
}
var fb = Object.defineProperty, ga = Object.getOwnPropertySymbols, nd = Object.prototype.hasOwnProperty, ad = Object.prototype.propertyIsEnumerable, Ql = (_e, Qt, Zt) => Qt in _e ? fb(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, db = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    nd.call(Qt, Zt) && Ql(_e, Zt, Qt[Zt]);
  if (ga)
    for (var Zt of ga(Qt))
      ad.call(Qt, Zt) && Ql(_e, Zt, Qt[Zt]);
  return _e;
}, pb = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    nd.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && ga)
    for (var $n of ga(_e))
      Qt.indexOf($n) < 0 && ad.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function mb(_e) {
  var Qt = _e, { size: Zt, color: $n } = Qt, Sn = pb(Qt, ["size", "color"]);
  return /* @__PURE__ */ React.createElement("svg", db({
    width: `${Zt}px`,
    height: `${Zt}px`,
    viewBox: "0 0 38 38",
    xmlns: "http://www.w3.org/2000/svg",
    stroke: $n
  }, Sn), /* @__PURE__ */ React.createElement("g", {
    fill: "none",
    fillRule: "evenodd"
  }, /* @__PURE__ */ React.createElement("g", {
    transform: "translate(2.5 2.5)",
    strokeWidth: "5"
  }, /* @__PURE__ */ React.createElement("circle", {
    strokeOpacity: ".5",
    cx: "16",
    cy: "16",
    r: "16"
  }), /* @__PURE__ */ React.createElement("path", {
    d: "M32 16c0-9.94-8.06-16-16-16"
  }, /* @__PURE__ */ React.createElement("animateTransform", {
    attributeName: "transform",
    type: "rotate",
    from: "0 16 16",
    to: "360 16 16",
    dur: "1s",
    repeatCount: "indefinite"
  })))));
}
var hb = Object.defineProperty, ya = Object.getOwnPropertySymbols, id = Object.prototype.hasOwnProperty, od = Object.prototype.propertyIsEnumerable, Jl = (_e, Qt, Zt) => Qt in _e ? hb(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, vb = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    id.call(Qt, Zt) && Jl(_e, Zt, Qt[Zt]);
  if (ya)
    for (var Zt of ya(Qt))
      od.call(Qt, Zt) && Jl(_e, Zt, Qt[Zt]);
  return _e;
}, gb = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    id.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && ya)
    for (var $n of ya(_e))
      Qt.indexOf($n) < 0 && od.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function yb(_e) {
  var Qt = _e, { size: Zt, color: $n } = Qt, Sn = gb(Qt, ["size", "color"]);
  return /* @__PURE__ */ React.createElement("svg", vb({
    width: `${Zt}px`,
    height: `${Zt / 4}px`,
    viewBox: "0 0 120 30",
    xmlns: "http://www.w3.org/2000/svg",
    fill: $n
  }, Sn), /* @__PURE__ */ React.createElement("circle", {
    cx: "15",
    cy: "15",
    r: "15"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "r",
    from: "15",
    to: "15",
    begin: "0s",
    dur: "0.8s",
    values: "15;9;15",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "fill-opacity",
    from: "1",
    to: "1",
    begin: "0s",
    dur: "0.8s",
    values: "1;.5;1",
    calcMode: "linear",
    repeatCount: "indefinite"
  })), /* @__PURE__ */ React.createElement("circle", {
    cx: "60",
    cy: "15",
    r: "9",
    fillOpacity: "0.3"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "r",
    from: "9",
    to: "9",
    begin: "0s",
    dur: "0.8s",
    values: "9;15;9",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "fill-opacity",
    from: "0.5",
    to: "0.5",
    begin: "0s",
    dur: "0.8s",
    values: ".5;1;.5",
    calcMode: "linear",
    repeatCount: "indefinite"
  })), /* @__PURE__ */ React.createElement("circle", {
    cx: "105",
    cy: "15",
    r: "15"
  }, /* @__PURE__ */ React.createElement("animate", {
    attributeName: "r",
    from: "15",
    to: "15",
    begin: "0s",
    dur: "0.8s",
    values: "15;9;15",
    calcMode: "linear",
    repeatCount: "indefinite"
  }), /* @__PURE__ */ React.createElement("animate", {
    attributeName: "fill-opacity",
    from: "1",
    to: "1",
    begin: "0s",
    dur: "0.8s",
    values: "1;.5;1",
    calcMode: "linear",
    repeatCount: "indefinite"
  })));
}
var bb = Object.defineProperty, ba = Object.getOwnPropertySymbols, sd = Object.prototype.hasOwnProperty, ld = Object.prototype.propertyIsEnumerable, Zl = (_e, Qt, Zt) => Qt in _e ? bb(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, wb = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    sd.call(Qt, Zt) && Zl(_e, Zt, Qt[Zt]);
  if (ba)
    for (var Zt of ba(Qt))
      ld.call(Qt, Zt) && Zl(_e, Zt, Qt[Zt]);
  return _e;
}, _b = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    sd.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && ba)
    for (var $n of ba(_e))
      Qt.indexOf($n) < 0 && ld.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const Ri = {
  bars: ub,
  oval: mb,
  dots: yb
}, xb = {
  xs: 18,
  sm: 22,
  md: 36,
  lg: 44,
  xl: 58
}, Ob = {
  size: "md"
};
function cd(_e) {
  const Qt = Pe("Loader", Ob, _e), { size: Zt, color: $n, variant: Sn } = Qt, kn = _b(Qt, ["size", "color", "variant"]), Kn = _t(), er = Sn in Ri ? Sn : Kn.loader;
  return /* @__PURE__ */ React.createElement(Le, wb({
    role: "presentation",
    component: Ri[er] || Ri.bars,
    size: Kn.fn.size({ size: Zt, sizes: xb }),
    color: Kn.fn.variant({
      variant: "filled",
      primaryFallback: !1,
      color: $n || Kn.primaryColor
    }).background
  }, kn));
}
cd.displayName = "@mantine/core/Loader";
function ud(_e) {
  const { children: Qt, target: Zt, className: $n } = Pe("Portal", {}, _e), Sn = _t(), [kn, Kn] = reactExports.useState(!1), er = reactExports.useRef();
  return Hf(() => (Kn(!0), er.current = Zt ? typeof Zt == "string" ? document.querySelector(Zt) : Zt : document.createElement("div"), Zt || document.body.appendChild(er.current), () => {
    !Zt && document.body.removeChild(er.current);
  }), [Zt]), kn ? reactDomExports.createPortal(/* @__PURE__ */ React.createElement("div", {
    className: $n,
    dir: Sn.dir
  }, Qt), er.current) : null;
}
ud.displayName = "@mantine/core/Portal";
var Pb = Object.defineProperty, wa = Object.getOwnPropertySymbols, fd = Object.prototype.hasOwnProperty, dd = Object.prototype.propertyIsEnumerable, ec = (_e, Qt, Zt) => Qt in _e ? Pb(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Eb = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    fd.call(Qt, Zt) && ec(_e, Zt, Qt[Zt]);
  if (wa)
    for (var Zt of wa(Qt))
      dd.call(Qt, Zt) && ec(_e, Zt, Qt[Zt]);
  return _e;
}, Sb = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    fd.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && wa)
    for (var $n of wa(_e))
      Qt.indexOf($n) < 0 && dd.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
function oi(_e) {
  var Qt = _e, { withinPortal: Zt = !0, children: $n } = Qt, Sn = Sb(Qt, ["withinPortal", "children"]);
  return Zt ? /* @__PURE__ */ React.createElement(ud, Eb({}, Sn), $n) : /* @__PURE__ */ React.createElement(React.Fragment, null, $n);
}
oi.displayName = "@mantine/core/OptionalPortal";
var $b = Object.defineProperty, kb = Object.defineProperties, Rb = Object.getOwnPropertyDescriptors, tc = Object.getOwnPropertySymbols, Cb = Object.prototype.hasOwnProperty, Tb = Object.prototype.propertyIsEnumerable, rc = (_e, Qt, Zt) => Qt in _e ? $b(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, zr = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Cb.call(Qt, Zt) && rc(_e, Zt, Qt[Zt]);
  if (tc)
    for (var Zt of tc(Qt))
      Tb.call(Qt, Zt) && rc(_e, Zt, Qt[Zt]);
  return _e;
}, Ab = (_e, Qt) => kb(_e, Rb(Qt));
function Ib({
  underline: _e,
  strikethrough: Qt
}) {
  const Zt = [];
  return _e && Zt.push("underline"), Qt && Zt.push("line-through"), Zt.length > 0 ? Zt.join(" ") : "none";
}
function Nb({ theme: _e, color: Qt, variant: Zt }) {
  return Qt === "dimmed" ? _e.colorScheme === "dark" ? _e.colors.dark[2] : _e.colors.gray[6] : typeof Qt == "string" && (Qt in _e.colors || Qt.split(".")[0] in _e.colors) ? _e.fn.variant({ variant: "filled", color: Qt }).background : Zt === "link" ? _e.colors[_e.primaryColor][_e.colorScheme === "dark" ? 4 : 7] : Qt || "inherit";
}
function jb(_e) {
  return typeof _e == "number" ? {
    overflow: "hidden",
    textOverflow: "ellipsis",
    display: "-webkit-box",
    WebkitLineClamp: _e,
    WebkitBoxOrient: "vertical"
  } : null;
}
function Mb({ theme: _e, truncate: Qt }) {
  return Qt === "start" ? {
    overflow: "hidden",
    textOverflow: "ellipsis",
    whiteSpace: "nowrap",
    direction: _e.dir === "ltr" ? "rtl" : "ltr",
    textAlign: _e.dir === "ltr" ? "right" : "left"
  } : Qt ? {
    overflow: "hidden",
    textOverflow: "ellipsis",
    whiteSpace: "nowrap"
  } : null;
}
var Db = Fe((_e, {
  color: Qt,
  variant: Zt,
  size: $n,
  lineClamp: Sn,
  truncate: kn,
  inline: Kn,
  inherit: er,
  underline: Cr,
  gradient: kr,
  weight: Yr,
  transform: Ms,
  align: Ds,
  strikethrough: Ls,
  italic: js
}) => {
  const zs = _e.fn.variant({ variant: "gradient", gradient: kr });
  return {
    root: zr(Ab(zr(zr(zr(zr({}, _e.fn.fontStyles()), _e.fn.focusStyles()), jb(Sn)), Mb({ theme: _e, truncate: kn })), {
      color: Nb({ color: Qt, theme: _e, variant: Zt }),
      fontFamily: er ? "inherit" : _e.fontFamily,
      fontSize: er || $n === void 0 ? "inherit" : _e.fn.size({ size: $n, sizes: _e.fontSizes }),
      lineHeight: er ? "inherit" : Kn ? 1 : _e.lineHeight,
      textDecoration: Ib({ underline: Cr, strikethrough: Ls }),
      WebkitTapHighlightColor: "transparent",
      fontWeight: er ? "inherit" : Yr,
      textTransform: Ms,
      textAlign: Ds,
      fontStyle: js ? "italic" : void 0
    }), _e.fn.hover(Zt === "link" && Cr === void 0 ? {
      textDecoration: "underline"
    } : void 0)),
    gradient: {
      backgroundImage: zs.background,
      WebkitBackgroundClip: "text",
      WebkitTextFillColor: "transparent"
    }
  };
});
const zb = Db;
var Lb = Object.defineProperty, _a = Object.getOwnPropertySymbols, pd = Object.prototype.hasOwnProperty, md = Object.prototype.propertyIsEnumerable, nc = (_e, Qt, Zt) => Qt in _e ? Lb(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Fb = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    pd.call(Qt, Zt) && nc(_e, Zt, Qt[Zt]);
  if (_a)
    for (var Zt of _a(Qt))
      md.call(Qt, Zt) && nc(_e, Zt, Qt[Zt]);
  return _e;
}, Wb = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    pd.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && _a)
    for (var $n of _a(_e))
      Qt.indexOf($n) < 0 && md.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const Vb = {
  variant: "text"
}, hd = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("Text", Vb, _e), {
    className: $n,
    size: Sn,
    weight: kn,
    transform: Kn,
    color: er,
    align: Cr,
    variant: kr,
    lineClamp: Yr,
    truncate: Ms,
    gradient: Ds,
    inline: Ls,
    inherit: js,
    underline: zs,
    strikethrough: Fs,
    italic: Bs,
    classNames: Hs,
    styles: Ws,
    unstyled: Ys,
    span: El
  } = Zt, Mu = Wb(Zt, [
    "className",
    "size",
    "weight",
    "transform",
    "color",
    "align",
    "variant",
    "lineClamp",
    "truncate",
    "gradient",
    "inline",
    "inherit",
    "underline",
    "strikethrough",
    "italic",
    "classNames",
    "styles",
    "unstyled",
    "span"
  ]), { classes: Pl, cx: Iu } = zb({
    variant: kr,
    color: er,
    size: Sn,
    lineClamp: Yr,
    truncate: Ms,
    inline: Ls,
    inherit: js,
    underline: zs,
    strikethrough: Fs,
    italic: Bs,
    weight: kn,
    transform: Kn,
    align: Cr,
    gradient: Ds
  }, { unstyled: Ys, name: "Text" });
  return /* @__PURE__ */ React.createElement(Le, Fb({
    ref: Qt,
    className: Iu(Pl.root, { [Pl.gradient]: kr === "gradient" }, $n),
    component: El ? "span" : "div"
  }, Mu));
});
hd.displayName = "@mantine/core/Text";
const gr = hd;
function Er(_e) {
  return _e.split("-")[1];
}
function ss(_e) {
  return _e === "y" ? "height" : "width";
}
function et(_e) {
  return _e.split("-")[0];
}
function Ft(_e) {
  return ["top", "bottom"].includes(et(_e)) ? "x" : "y";
}
function ac(_e, Qt, Zt) {
  let { reference: $n, floating: Sn } = _e;
  const kn = $n.x + $n.width / 2 - Sn.width / 2, Kn = $n.y + $n.height / 2 - Sn.height / 2, er = Ft(Qt), Cr = ss(er), kr = $n[Cr] / 2 - Sn[Cr] / 2, Yr = er === "x";
  let Ms;
  switch (et(Qt)) {
    case "top":
      Ms = { x: kn, y: $n.y - Sn.height };
      break;
    case "bottom":
      Ms = { x: kn, y: $n.y + $n.height };
      break;
    case "right":
      Ms = { x: $n.x + $n.width, y: Kn };
      break;
    case "left":
      Ms = { x: $n.x - Sn.width, y: Kn };
      break;
    default:
      Ms = { x: $n.x, y: $n.y };
  }
  switch (Er(Qt)) {
    case "start":
      Ms[er] -= kr * (Zt && Yr ? -1 : 1);
      break;
    case "end":
      Ms[er] += kr * (Zt && Yr ? -1 : 1);
  }
  return Ms;
}
const Yb = async (_e, Qt, Zt) => {
  const { placement: $n = "bottom", strategy: Sn = "absolute", middleware: kn = [], platform: Kn } = Zt, er = kn.filter(Boolean), Cr = await (Kn.isRTL == null ? void 0 : Kn.isRTL(Qt));
  let kr = await Kn.getElementRects({ reference: _e, floating: Qt, strategy: Sn }), { x: Yr, y: Ms } = ac(kr, $n, Cr), Ds = $n, Ls = {}, js = 0;
  for (let zs = 0; zs < er.length; zs++) {
    const { name: Fs, fn: Bs } = er[zs], { x: Hs, y: Ws, data: Ys, reset: El } = await Bs({ x: Yr, y: Ms, initialPlacement: $n, placement: Ds, strategy: Sn, middlewareData: Ls, rects: kr, platform: Kn, elements: { reference: _e, floating: Qt } });
    Yr = Hs ?? Yr, Ms = Ws ?? Ms, Ls = { ...Ls, [Fs]: { ...Ls[Fs], ...Ys } }, El && js <= 50 && (js++, typeof El == "object" && (El.placement && (Ds = El.placement), El.rects && (kr = El.rects === !0 ? await Kn.getElementRects({ reference: _e, floating: Qt, strategy: Sn }) : El.rects), { x: Yr, y: Ms } = ac(kr, Ds, Cr)), zs = -1);
  }
  return { x: Yr, y: Ms, placement: Ds, strategy: Sn, middlewareData: Ls };
};
function ls(_e) {
  return typeof _e != "number" ? function(Qt) {
    return { top: 0, right: 0, bottom: 0, left: 0, ...Qt };
  }(_e) : { top: _e, right: _e, bottom: _e, left: _e };
}
function yr(_e) {
  return { ..._e, top: _e.y, left: _e.x, right: _e.x + _e.width, bottom: _e.y + _e.height };
}
async function cs(_e, Qt) {
  var Zt;
  Qt === void 0 && (Qt = {});
  const { x: $n, y: Sn, platform: kn, rects: Kn, elements: er, strategy: Cr } = _e, { boundary: kr = "clippingAncestors", rootBoundary: Yr = "viewport", elementContext: Ms = "floating", altBoundary: Ds = !1, padding: Ls = 0 } = Qt, js = ls(Ls), zs = er[Ds ? Ms === "floating" ? "reference" : "floating" : Ms], Fs = yr(await kn.getClippingRect({ element: (Zt = await (kn.isElement == null ? void 0 : kn.isElement(zs))) == null || Zt ? zs : zs.contextElement || await (kn.getDocumentElement == null ? void 0 : kn.getDocumentElement(er.floating)), boundary: kr, rootBoundary: Yr, strategy: Cr })), Bs = Ms === "floating" ? { ...Kn.floating, x: $n, y: Sn } : Kn.reference, Hs = await (kn.getOffsetParent == null ? void 0 : kn.getOffsetParent(er.floating)), Ws = await (kn.isElement == null ? void 0 : kn.isElement(Hs)) && await (kn.getScale == null ? void 0 : kn.getScale(Hs)) || { x: 1, y: 1 }, Ys = yr(kn.convertOffsetParentRelativeRectToViewportRelativeRect ? await kn.convertOffsetParentRelativeRectToViewportRelativeRect({ rect: Bs, offsetParent: Hs, strategy: Cr }) : Bs);
  return { top: (Fs.top - Ys.top + js.top) / Ws.y, bottom: (Ys.bottom - Fs.bottom + js.bottom) / Ws.y, left: (Fs.left - Ys.left + js.left) / Ws.x, right: (Ys.right - Fs.right + js.right) / Ws.x };
}
const br = Math.min, st = Math.max;
function ho(_e, Qt, Zt) {
  return st(_e, br(Qt, Zt));
}
const ic = (_e) => ({ name: "arrow", options: _e, async fn(Qt) {
  const { element: Zt, padding: $n = 0 } = _e || {}, { x: Sn, y: kn, placement: Kn, rects: er, platform: Cr, elements: kr } = Qt;
  if (Zt == null)
    return {};
  const Yr = ls($n), Ms = { x: Sn, y: kn }, Ds = Ft(Kn), Ls = ss(Ds), js = await Cr.getDimensions(Zt), zs = Ds === "y", Fs = zs ? "top" : "left", Bs = zs ? "bottom" : "right", Hs = zs ? "clientHeight" : "clientWidth", Ws = er.reference[Ls] + er.reference[Ds] - Ms[Ds] - er.floating[Ls], Ys = Ms[Ds] - er.reference[Ds], El = await (Cr.getOffsetParent == null ? void 0 : Cr.getOffsetParent(Zt));
  let Mu = El ? El[Hs] : 0;
  Mu && await (Cr.isElement == null ? void 0 : Cr.isElement(El)) || (Mu = kr.floating[Hs] || er.floating[Ls]);
  const Pl = Ws / 2 - Ys / 2, Iu = Yr[Fs], Tu = Mu - js[Ls] - Yr[Bs], Au = Mu / 2 - js[Ls] / 2 + Pl, Nu = ho(Iu, Au, Tu), gm = Er(Kn) != null && Au != Nu && er.reference[Ls] / 2 - (Au < Iu ? Yr[Fs] : Yr[Bs]) - js[Ls] / 2 < 0;
  return { [Ds]: Ms[Ds] - (gm ? Au < Iu ? Iu - Au : Tu - Au : 0), data: { [Ds]: Nu, centerOffset: Au - Nu } };
} }), Bb = ["top", "right", "bottom", "left"];
Bb.reduce((_e, Qt) => _e.concat(Qt, Qt + "-start", Qt + "-end"), []);
const Hb = { left: "right", right: "left", bottom: "top", top: "bottom" };
function xa(_e) {
  return _e.replace(/left|right|bottom|top/g, (Qt) => Hb[Qt]);
}
function Ub(_e, Qt, Zt) {
  Zt === void 0 && (Zt = !1);
  const $n = Er(_e), Sn = Ft(_e), kn = ss(Sn);
  let Kn = Sn === "x" ? $n === (Zt ? "end" : "start") ? "right" : "left" : $n === "start" ? "bottom" : "top";
  return Qt.reference[kn] > Qt.floating[kn] && (Kn = xa(Kn)), { main: Kn, cross: xa(Kn) };
}
const qb = { start: "end", end: "start" };
function Ci(_e) {
  return _e.replace(/start|end/g, (Qt) => qb[Qt]);
}
const vd = function(_e) {
  return _e === void 0 && (_e = {}), { name: "flip", options: _e, async fn(Qt) {
    var Zt;
    const { placement: $n, middlewareData: Sn, rects: kn, initialPlacement: Kn, platform: er, elements: Cr } = Qt, { mainAxis: kr = !0, crossAxis: Yr = !0, fallbackPlacements: Ms, fallbackStrategy: Ds = "bestFit", fallbackAxisSideDirection: Ls = "none", flipAlignment: js = !0, ...zs } = _e, Fs = et($n), Bs = et(Kn) === Kn, Hs = await (er.isRTL == null ? void 0 : er.isRTL(Cr.floating)), Ws = Ms || (Bs || !js ? [xa(Kn)] : function(Nu) {
      const gm = xa(Nu);
      return [Ci(Nu), gm, Ci(gm)];
    }(Kn));
    Ms || Ls === "none" || Ws.push(...function(Nu, gm, pm, zu) {
      const Yu = Er(Nu);
      let sm = function(mm, hm, ym) {
        const _m = ["left", "right"], Sm = ["right", "left"], wm = ["top", "bottom"], Nm = ["bottom", "top"];
        switch (mm) {
          case "top":
          case "bottom":
            return ym ? hm ? Sm : _m : hm ? _m : Sm;
          case "left":
          case "right":
            return hm ? wm : Nm;
          default:
            return [];
        }
      }(et(Nu), pm === "start", zu);
      return Yu && (sm = sm.map((mm) => mm + "-" + Yu), gm && (sm = sm.concat(sm.map(Ci)))), sm;
    }(Kn, js, Ls, Hs));
    const Ys = [Kn, ...Ws], El = await cs(Qt, zs), Mu = [];
    let Pl = ((Zt = Sn.flip) == null ? void 0 : Zt.overflows) || [];
    if (kr && Mu.push(El[Fs]), Yr) {
      const { main: Nu, cross: gm } = Ub($n, kn, Hs);
      Mu.push(El[Nu], El[gm]);
    }
    if (Pl = [...Pl, { placement: $n, overflows: Mu }], !Mu.every((Nu) => Nu <= 0)) {
      var Iu, Tu;
      const Nu = (((Iu = Sn.flip) == null ? void 0 : Iu.index) || 0) + 1, gm = Ys[Nu];
      if (gm)
        return { data: { index: Nu, overflows: Pl }, reset: { placement: gm } };
      let pm = (Tu = Pl.filter((zu) => zu.overflows[0] <= 0).sort((zu, Yu) => zu.overflows[1] - Yu.overflows[1])[0]) == null ? void 0 : Tu.placement;
      if (!pm)
        switch (Ds) {
          case "bestFit": {
            var Au;
            const zu = (Au = Pl.map((Yu) => [Yu.placement, Yu.overflows.filter((sm) => sm > 0).reduce((sm, mm) => sm + mm, 0)]).sort((Yu, sm) => Yu[1] - sm[1])[0]) == null ? void 0 : Au[0];
            zu && (pm = zu);
            break;
          }
          case "initialPlacement":
            pm = Kn;
        }
      if ($n !== pm)
        return { reset: { placement: pm } };
    }
    return {};
  } };
};
function oc(_e) {
  const Qt = br(..._e.map(($n) => $n.left)), Zt = br(..._e.map(($n) => $n.top));
  return { x: Qt, y: Zt, width: st(..._e.map(($n) => $n.right)) - Qt, height: st(..._e.map(($n) => $n.bottom)) - Zt };
}
const gd = function(_e) {
  return _e === void 0 && (_e = {}), { name: "inline", options: _e, async fn(Qt) {
    const { placement: Zt, elements: $n, rects: Sn, platform: kn, strategy: Kn } = Qt, { padding: er = 2, x: Cr, y: kr } = _e, Yr = Array.from(await (kn.getClientRects == null ? void 0 : kn.getClientRects($n.reference)) || []), Ms = function(zs) {
      const Fs = zs.slice().sort((Ws, Ys) => Ws.y - Ys.y), Bs = [];
      let Hs = null;
      for (let Ws = 0; Ws < Fs.length; Ws++) {
        const Ys = Fs[Ws];
        !Hs || Ys.y - Hs.y > Hs.height / 2 ? Bs.push([Ys]) : Bs[Bs.length - 1].push(Ys), Hs = Ys;
      }
      return Bs.map((Ws) => yr(oc(Ws)));
    }(Yr), Ds = yr(oc(Yr)), Ls = ls(er), js = await kn.getElementRects({ reference: { getBoundingClientRect: function() {
      if (Ms.length === 2 && Ms[0].left > Ms[1].right && Cr != null && kr != null)
        return Ms.find((zs) => Cr > zs.left - Ls.left && Cr < zs.right + Ls.right && kr > zs.top - Ls.top && kr < zs.bottom + Ls.bottom) || Ds;
      if (Ms.length >= 2) {
        if (Ft(Zt) === "x") {
          const El = Ms[0], Mu = Ms[Ms.length - 1], Pl = et(Zt) === "top", Iu = El.top, Tu = Mu.bottom, Au = Pl ? El.left : Mu.left, Nu = Pl ? El.right : Mu.right;
          return { top: Iu, bottom: Tu, left: Au, right: Nu, width: Nu - Au, height: Tu - Iu, x: Au, y: Iu };
        }
        const zs = et(Zt) === "left", Fs = st(...Ms.map((El) => El.right)), Bs = br(...Ms.map((El) => El.left)), Hs = Ms.filter((El) => zs ? El.left === Bs : El.right === Fs), Ws = Hs[0].top, Ys = Hs[Hs.length - 1].bottom;
        return { top: Ws, bottom: Ys, left: Bs, right: Fs, width: Fs - Bs, height: Ys - Ws, x: Bs, y: Ws };
      }
      return Ds;
    } }, floating: $n.floating, strategy: Kn });
    return Sn.reference.x !== js.reference.x || Sn.reference.y !== js.reference.y || Sn.reference.width !== js.reference.width || Sn.reference.height !== js.reference.height ? { reset: { rects: js } } : {};
  } };
}, yd = function(_e) {
  return _e === void 0 && (_e = 0), { name: "offset", options: _e, async fn(Qt) {
    const { x: Zt, y: $n } = Qt, Sn = await async function(kn, Kn) {
      const { placement: er, platform: Cr, elements: kr } = kn, Yr = await (Cr.isRTL == null ? void 0 : Cr.isRTL(kr.floating)), Ms = et(er), Ds = Er(er), Ls = Ft(er) === "x", js = ["left", "top"].includes(Ms) ? -1 : 1, zs = Yr && Ls ? -1 : 1, Fs = typeof Kn == "function" ? Kn(kn) : Kn;
      let { mainAxis: Bs, crossAxis: Hs, alignmentAxis: Ws } = typeof Fs == "number" ? { mainAxis: Fs, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...Fs };
      return Ds && typeof Ws == "number" && (Hs = Ds === "end" ? -1 * Ws : Ws), Ls ? { x: Hs * zs, y: Bs * js } : { x: Bs * js, y: Hs * zs };
    }(Qt, _e);
    return { x: Zt + Sn.x, y: $n + Sn.y, data: Sn };
  } };
};
function bd(_e) {
  return _e === "x" ? "y" : "x";
}
const us = function(_e) {
  return _e === void 0 && (_e = {}), { name: "shift", options: _e, async fn(Qt) {
    const { x: Zt, y: $n, placement: Sn } = Qt, { mainAxis: kn = !0, crossAxis: Kn = !1, limiter: er = { fn: (Fs) => {
      let { x: Bs, y: Hs } = Fs;
      return { x: Bs, y: Hs };
    } }, ...Cr } = _e, kr = { x: Zt, y: $n }, Yr = await cs(Qt, Cr), Ms = Ft(et(Sn)), Ds = bd(Ms);
    let Ls = kr[Ms], js = kr[Ds];
    if (kn) {
      const Fs = Ms === "y" ? "bottom" : "right";
      Ls = ho(Ls + Yr[Ms === "y" ? "top" : "left"], Ls, Ls - Yr[Fs]);
    }
    if (Kn) {
      const Fs = Ds === "y" ? "bottom" : "right";
      js = ho(js + Yr[Ds === "y" ? "top" : "left"], js, js - Yr[Fs]);
    }
    const zs = er.fn({ ...Qt, [Ms]: Ls, [Ds]: js });
    return { ...zs, data: { x: zs.x - Zt, y: zs.y - $n } };
  } };
}, Gb = function(_e) {
  return _e === void 0 && (_e = {}), { options: _e, fn(Qt) {
    const { x: Zt, y: $n, placement: Sn, rects: kn, middlewareData: Kn } = Qt, { offset: er = 0, mainAxis: Cr = !0, crossAxis: kr = !0 } = _e, Yr = { x: Zt, y: $n }, Ms = Ft(Sn), Ds = bd(Ms);
    let Ls = Yr[Ms], js = Yr[Ds];
    const zs = typeof er == "function" ? er(Qt) : er, Fs = typeof zs == "number" ? { mainAxis: zs, crossAxis: 0 } : { mainAxis: 0, crossAxis: 0, ...zs };
    if (Cr) {
      const Ws = Ms === "y" ? "height" : "width", Ys = kn.reference[Ms] - kn.floating[Ws] + Fs.mainAxis, El = kn.reference[Ms] + kn.reference[Ws] - Fs.mainAxis;
      Ls < Ys ? Ls = Ys : Ls > El && (Ls = El);
    }
    if (kr) {
      var Bs, Hs;
      const Ws = Ms === "y" ? "width" : "height", Ys = ["top", "left"].includes(et(Sn)), El = kn.reference[Ds] - kn.floating[Ws] + (Ys && ((Bs = Kn.offset) == null ? void 0 : Bs[Ds]) || 0) + (Ys ? 0 : Fs.crossAxis), Mu = kn.reference[Ds] + kn.reference[Ws] + (Ys ? 0 : ((Hs = Kn.offset) == null ? void 0 : Hs[Ds]) || 0) - (Ys ? Fs.crossAxis : 0);
      js < El ? js = El : js > Mu && (js = Mu);
    }
    return { [Ms]: Ls, [Ds]: js };
  } };
}, Xb = function(_e) {
  return _e === void 0 && (_e = {}), { name: "size", options: _e, async fn(Qt) {
    const { placement: Zt, rects: $n, platform: Sn, elements: kn } = Qt, { apply: Kn = () => {
    }, ...er } = _e, Cr = await cs(Qt, er), kr = et(Zt), Yr = Er(Zt), Ms = Ft(Zt) === "x", { width: Ds, height: Ls } = $n.floating;
    let js, zs;
    kr === "top" || kr === "bottom" ? (js = kr, zs = Yr === (await (Sn.isRTL == null ? void 0 : Sn.isRTL(kn.floating)) ? "start" : "end") ? "left" : "right") : (zs = kr, js = Yr === "end" ? "top" : "bottom");
    const Fs = Ls - Cr[js], Bs = Ds - Cr[zs], Hs = !Qt.middlewareData.shift;
    let Ws = Fs, Ys = Bs;
    if (Ms) {
      const Mu = Ds - Cr.left - Cr.right;
      Ys = Yr || Hs ? br(Bs, Mu) : Mu;
    } else {
      const Mu = Ls - Cr.top - Cr.bottom;
      Ws = Yr || Hs ? br(Fs, Mu) : Mu;
    }
    if (Hs && !Yr) {
      const Mu = st(Cr.left, 0), Pl = st(Cr.right, 0), Iu = st(Cr.top, 0), Tu = st(Cr.bottom, 0);
      Ms ? Ys = Ds - 2 * (Mu !== 0 || Pl !== 0 ? Mu + Pl : st(Cr.left, Cr.right)) : Ws = Ls - 2 * (Iu !== 0 || Tu !== 0 ? Iu + Tu : st(Cr.top, Cr.bottom));
    }
    await Kn({ ...Qt, availableWidth: Ys, availableHeight: Ws });
    const El = await Sn.getDimensions(kn.floating);
    return Ds !== El.width || Ls !== El.height ? { reset: { rects: !0 } } : {};
  } };
};
function Ve(_e) {
  var Qt;
  return ((Qt = _e.ownerDocument) == null ? void 0 : Qt.defaultView) || window;
}
function tt(_e) {
  return Ve(_e).getComputedStyle(_e);
}
function wd(_e) {
  return _e instanceof Ve(_e).Node;
}
function jt(_e) {
  return wd(_e) ? (_e.nodeName || "").toLowerCase() : "";
}
let Nn;
function _d() {
  if (Nn)
    return Nn;
  const _e = navigator.userAgentData;
  return _e && Array.isArray(_e.brands) ? (Nn = _e.brands.map((Qt) => Qt.brand + "/" + Qt.version).join(" "), Nn) : navigator.userAgent;
}
function nt(_e) {
  return _e instanceof Ve(_e).HTMLElement;
}
function Ye(_e) {
  return _e instanceof Ve(_e).Element;
}
function sc(_e) {
  return typeof ShadowRoot > "u" ? !1 : _e instanceof Ve(_e).ShadowRoot || _e instanceof ShadowRoot;
}
function un(_e) {
  const { overflow: Qt, overflowX: Zt, overflowY: $n, display: Sn } = tt(_e);
  return /auto|scroll|overlay|hidden|clip/.test(Qt + $n + Zt) && !["inline", "contents"].includes(Sn);
}
function Kb(_e) {
  return ["table", "td", "th"].includes(jt(_e));
}
function vo(_e) {
  const Qt = /firefox/i.test(_d()), Zt = tt(_e), $n = Zt.backdropFilter || Zt.WebkitBackdropFilter;
  return Zt.transform !== "none" || Zt.perspective !== "none" || !!$n && $n !== "none" || Qt && Zt.willChange === "filter" || Qt && !!Zt.filter && Zt.filter !== "none" || ["transform", "perspective"].some((Sn) => Zt.willChange.includes(Sn)) || ["paint", "layout", "strict", "content"].some((Sn) => {
    const kn = Zt.contain;
    return kn != null && kn.includes(Sn);
  });
}
function go() {
  return /^((?!chrome|android).)*safari/i.test(_d());
}
function si(_e) {
  return ["html", "body", "#document"].includes(jt(_e));
}
const lc = Math.min, Xr = Math.max, Oa = Math.round;
function xd(_e) {
  const Qt = tt(_e);
  let Zt = parseFloat(Qt.width) || 0, $n = parseFloat(Qt.height) || 0;
  const Sn = nt(_e), kn = Sn ? _e.offsetWidth : Zt, Kn = Sn ? _e.offsetHeight : $n, er = Oa(Zt) !== kn || Oa($n) !== Kn;
  return er && (Zt = kn, $n = Kn), { width: Zt, height: $n, fallback: er };
}
function Od(_e) {
  return Ye(_e) ? _e : _e.contextElement;
}
const Pd = { x: 1, y: 1 };
function fr(_e) {
  const Qt = Od(_e);
  if (!nt(Qt))
    return Pd;
  const Zt = Qt.getBoundingClientRect(), { width: $n, height: Sn, fallback: kn } = xd(Qt);
  let Kn = (kn ? Oa(Zt.width) : Zt.width) / $n, er = (kn ? Oa(Zt.height) : Zt.height) / Sn;
  return Kn && Number.isFinite(Kn) || (Kn = 1), er && Number.isFinite(er) || (er = 1), { x: Kn, y: er };
}
function Gt(_e, Qt, Zt, $n) {
  var Sn, kn;
  Qt === void 0 && (Qt = !1), Zt === void 0 && (Zt = !1);
  const Kn = _e.getBoundingClientRect(), er = Od(_e);
  let Cr = Pd;
  Qt && ($n ? Ye($n) && (Cr = fr($n)) : Cr = fr(_e));
  const kr = er ? Ve(er) : window, Yr = go() && Zt;
  let Ms = (Kn.left + (Yr && ((Sn = kr.visualViewport) == null ? void 0 : Sn.offsetLeft) || 0)) / Cr.x, Ds = (Kn.top + (Yr && ((kn = kr.visualViewport) == null ? void 0 : kn.offsetTop) || 0)) / Cr.y, Ls = Kn.width / Cr.x, js = Kn.height / Cr.y;
  if (er) {
    const zs = Ve(er), Fs = $n && Ye($n) ? Ve($n) : $n;
    let Bs = zs.frameElement;
    for (; Bs && $n && Fs !== zs; ) {
      const Hs = fr(Bs), Ws = Bs.getBoundingClientRect(), Ys = getComputedStyle(Bs);
      Ws.x += (Bs.clientLeft + parseFloat(Ys.paddingLeft)) * Hs.x, Ws.y += (Bs.clientTop + parseFloat(Ys.paddingTop)) * Hs.y, Ms *= Hs.x, Ds *= Hs.y, Ls *= Hs.x, js *= Hs.y, Ms += Ws.x, Ds += Ws.y, Bs = Ve(Bs).frameElement;
    }
  }
  return yr({ width: Ls, height: js, x: Ms, y: Ds });
}
function It(_e) {
  return ((wd(_e) ? _e.ownerDocument : _e.document) || window.document).documentElement;
}
function li(_e) {
  return Ye(_e) ? { scrollLeft: _e.scrollLeft, scrollTop: _e.scrollTop } : { scrollLeft: _e.pageXOffset, scrollTop: _e.pageYOffset };
}
function Ed(_e) {
  return Gt(It(_e)).left + li(_e).scrollLeft;
}
function wr(_e) {
  if (jt(_e) === "html")
    return _e;
  const Qt = _e.assignedSlot || _e.parentNode || sc(_e) && _e.host || It(_e);
  return sc(Qt) ? Qt.host : Qt;
}
function Sd(_e) {
  const Qt = wr(_e);
  return si(Qt) ? Qt.ownerDocument.body : nt(Qt) && un(Qt) ? Qt : Sd(Qt);
}
function gt$2(_e, Qt) {
  var Zt;
  Qt === void 0 && (Qt = []);
  const $n = Sd(_e), Sn = $n === ((Zt = _e.ownerDocument) == null ? void 0 : Zt.body), kn = Ve($n);
  return Sn ? Qt.concat(kn, kn.visualViewport || [], un($n) ? $n : []) : Qt.concat($n, gt$2($n));
}
function cc(_e, Qt, Zt) {
  let $n;
  if (Qt === "viewport")
    $n = function(Kn, er) {
      const Cr = Ve(Kn), kr = It(Kn), Yr = Cr.visualViewport;
      let Ms = kr.clientWidth, Ds = kr.clientHeight, Ls = 0, js = 0;
      if (Yr) {
        Ms = Yr.width, Ds = Yr.height;
        const zs = go();
        (!zs || zs && er === "fixed") && (Ls = Yr.offsetLeft, js = Yr.offsetTop);
      }
      return { width: Ms, height: Ds, x: Ls, y: js };
    }(_e, Zt);
  else if (Qt === "document")
    $n = function(Kn) {
      const er = It(Kn), Cr = li(Kn), kr = Kn.ownerDocument.body, Yr = Xr(er.scrollWidth, er.clientWidth, kr.scrollWidth, kr.clientWidth), Ms = Xr(er.scrollHeight, er.clientHeight, kr.scrollHeight, kr.clientHeight);
      let Ds = -Cr.scrollLeft + Ed(Kn);
      const Ls = -Cr.scrollTop;
      return tt(kr).direction === "rtl" && (Ds += Xr(er.clientWidth, kr.clientWidth) - Yr), { width: Yr, height: Ms, x: Ds, y: Ls };
    }(It(_e));
  else if (Ye(Qt))
    $n = function(Kn, er) {
      const Cr = Gt(Kn, !0, er === "fixed"), kr = Cr.top + Kn.clientTop, Yr = Cr.left + Kn.clientLeft, Ms = nt(Kn) ? fr(Kn) : { x: 1, y: 1 };
      return { width: Kn.clientWidth * Ms.x, height: Kn.clientHeight * Ms.y, x: Yr * Ms.x, y: kr * Ms.y };
    }(Qt, Zt);
  else {
    const Kn = { ...Qt };
    if (go()) {
      var Sn, kn;
      const er = Ve(_e);
      Kn.x -= ((Sn = er.visualViewport) == null ? void 0 : Sn.offsetLeft) || 0, Kn.y -= ((kn = er.visualViewport) == null ? void 0 : kn.offsetTop) || 0;
    }
    $n = Kn;
  }
  return yr($n);
}
function $d(_e, Qt) {
  const Zt = wr(_e);
  return !(Zt === Qt || !Ye(Zt) || si(Zt)) && (tt(Zt).position === "fixed" || $d(Zt, Qt));
}
function uc(_e, Qt) {
  return nt(_e) && tt(_e).position !== "fixed" ? Qt ? Qt(_e) : _e.offsetParent : null;
}
function fc(_e, Qt) {
  const Zt = Ve(_e);
  if (!nt(_e))
    return Zt;
  let $n = uc(_e, Qt);
  for (; $n && Kb($n) && tt($n).position === "static"; )
    $n = uc($n, Qt);
  return $n && (jt($n) === "html" || jt($n) === "body" && tt($n).position === "static" && !vo($n)) ? Zt : $n || function(Sn) {
    let kn = wr(Sn);
    for (; nt(kn) && !si(kn); ) {
      if (vo(kn))
        return kn;
      kn = wr(kn);
    }
    return null;
  }(_e) || Zt;
}
function Qb(_e, Qt, Zt) {
  const $n = nt(Qt), Sn = It(Qt), kn = Gt(_e, !0, Zt === "fixed", Qt);
  let Kn = { scrollLeft: 0, scrollTop: 0 };
  const er = { x: 0, y: 0 };
  if ($n || !$n && Zt !== "fixed")
    if ((jt(Qt) !== "body" || un(Sn)) && (Kn = li(Qt)), nt(Qt)) {
      const Cr = Gt(Qt, !0);
      er.x = Cr.x + Qt.clientLeft, er.y = Cr.y + Qt.clientTop;
    } else
      Sn && (er.x = Ed(Sn));
  return { x: kn.left + Kn.scrollLeft - er.x, y: kn.top + Kn.scrollTop - er.y, width: kn.width, height: kn.height };
}
const Jb = { getClippingRect: function(_e) {
  let { element: Qt, boundary: Zt, rootBoundary: $n, strategy: Sn } = _e;
  const kn = Zt === "clippingAncestors" ? function(kr, Yr) {
    const Ms = Yr.get(kr);
    if (Ms)
      return Ms;
    let Ds = gt$2(kr).filter((Fs) => Ye(Fs) && jt(Fs) !== "body"), Ls = null;
    const js = tt(kr).position === "fixed";
    let zs = js ? wr(kr) : kr;
    for (; Ye(zs) && !si(zs); ) {
      const Fs = tt(zs), Bs = vo(zs);
      Bs || Fs.position !== "fixed" || (Ls = null), (js ? !Bs && !Ls : !Bs && Fs.position === "static" && Ls && ["absolute", "fixed"].includes(Ls.position) || un(zs) && !Bs && $d(kr, zs)) ? Ds = Ds.filter((Hs) => Hs !== zs) : Ls = Fs, zs = wr(zs);
    }
    return Yr.set(kr, Ds), Ds;
  }(Qt, this._c) : [].concat(Zt), Kn = [...kn, $n], er = Kn[0], Cr = Kn.reduce((kr, Yr) => {
    const Ms = cc(Qt, Yr, Sn);
    return kr.top = Xr(Ms.top, kr.top), kr.right = lc(Ms.right, kr.right), kr.bottom = lc(Ms.bottom, kr.bottom), kr.left = Xr(Ms.left, kr.left), kr;
  }, cc(Qt, er, Sn));
  return { width: Cr.right - Cr.left, height: Cr.bottom - Cr.top, x: Cr.left, y: Cr.top };
}, convertOffsetParentRelativeRectToViewportRelativeRect: function(_e) {
  let { rect: Qt, offsetParent: Zt, strategy: $n } = _e;
  const Sn = nt(Zt), kn = It(Zt);
  if (Zt === kn)
    return Qt;
  let Kn = { scrollLeft: 0, scrollTop: 0 }, er = { x: 1, y: 1 };
  const Cr = { x: 0, y: 0 };
  if ((Sn || !Sn && $n !== "fixed") && ((jt(Zt) !== "body" || un(kn)) && (Kn = li(Zt)), nt(Zt))) {
    const kr = Gt(Zt);
    er = fr(Zt), Cr.x = kr.x + Zt.clientLeft, Cr.y = kr.y + Zt.clientTop;
  }
  return { width: Qt.width * er.x, height: Qt.height * er.y, x: Qt.x * er.x - Kn.scrollLeft * er.x + Cr.x, y: Qt.y * er.y - Kn.scrollTop * er.y + Cr.y };
}, isElement: Ye, getDimensions: function(_e) {
  return xd(_e);
}, getOffsetParent: fc, getDocumentElement: It, getScale: fr, async getElementRects(_e) {
  let { reference: Qt, floating: Zt, strategy: $n } = _e;
  const Sn = this.getOffsetParent || fc, kn = this.getDimensions;
  return { reference: Qb(Qt, await Sn(Zt), $n), floating: { x: 0, y: 0, ...await kn(Zt) } };
}, getClientRects: (_e) => Array.from(_e.getClientRects()), isRTL: (_e) => tt(_e).direction === "rtl" };
function Zb(_e, Qt, Zt, $n) {
  $n === void 0 && ($n = {});
  const { ancestorScroll: Sn = !0, ancestorResize: kn = !0, elementResize: Kn = !0, animationFrame: er = !1 } = $n, Cr = Sn || kn ? [...Ye(_e) ? gt$2(_e) : _e.contextElement ? gt$2(_e.contextElement) : [], ...gt$2(Qt)] : [];
  Cr.forEach((Ds) => {
    const Ls = !Ye(Ds) && Ds.toString().includes("V");
    !Sn || er && !Ls || Ds.addEventListener("scroll", Zt, { passive: !0 }), kn && Ds.addEventListener("resize", Zt);
  });
  let kr, Yr = null;
  Kn && (Yr = new ResizeObserver(() => {
    Zt();
  }), Ye(_e) && !er && Yr.observe(_e), Ye(_e) || !_e.contextElement || er || Yr.observe(_e.contextElement), Yr.observe(Qt));
  let Ms = er ? Gt(_e) : null;
  return er && function Ds() {
    const Ls = Gt(_e);
    !Ms || Ls.x === Ms.x && Ls.y === Ms.y && Ls.width === Ms.width && Ls.height === Ms.height || Zt(), Ms = Ls, kr = requestAnimationFrame(Ds);
  }(), Zt(), () => {
    var Ds;
    Cr.forEach((Ls) => {
      Sn && Ls.removeEventListener("scroll", Zt), kn && Ls.removeEventListener("resize", Zt);
    }), (Ds = Yr) == null || Ds.disconnect(), Yr = null, er && cancelAnimationFrame(kr);
  };
}
const e0 = (_e, Qt, Zt) => {
  const $n = /* @__PURE__ */ new Map(), Sn = { platform: Jb, ...Zt }, kn = { ...Sn.platform, _c: $n };
  return Yb(_e, Qt, { ...Sn, platform: kn });
}, kd = (_e) => {
  const {
    element: Qt,
    padding: Zt
  } = _e;
  function $n(Sn) {
    return Object.prototype.hasOwnProperty.call(Sn, "current");
  }
  return {
    name: "arrow",
    options: _e,
    fn(Sn) {
      return $n(Qt) ? Qt.current != null ? ic({
        element: Qt.current,
        padding: Zt
      }).fn(Sn) : {} : Qt ? ic({
        element: Qt,
        padding: Zt
      }).fn(Sn) : {};
    }
  };
};
var ra = typeof document < "u" ? reactExports.useLayoutEffect : reactExports.useEffect;
function Pa(_e, Qt) {
  if (_e === Qt)
    return !0;
  if (typeof _e != typeof Qt)
    return !1;
  if (typeof _e == "function" && _e.toString() === Qt.toString())
    return !0;
  let Zt, $n, Sn;
  if (_e && Qt && typeof _e == "object") {
    if (Array.isArray(_e)) {
      if (Zt = _e.length, Zt != Qt.length)
        return !1;
      for ($n = Zt; $n-- !== 0; )
        if (!Pa(_e[$n], Qt[$n]))
          return !1;
      return !0;
    }
    if (Sn = Object.keys(_e), Zt = Sn.length, Zt !== Object.keys(Qt).length)
      return !1;
    for ($n = Zt; $n-- !== 0; )
      if (!Object.prototype.hasOwnProperty.call(Qt, Sn[$n]))
        return !1;
    for ($n = Zt; $n-- !== 0; ) {
      const kn = Sn[$n];
      if (!(kn === "_owner" && _e.$$typeof) && !Pa(_e[kn], Qt[kn]))
        return !1;
    }
    return !0;
  }
  return _e !== _e && Qt !== Qt;
}
function dc(_e) {
  const Qt = reactExports.useRef(_e);
  return ra(() => {
    Qt.current = _e;
  }), Qt;
}
function t0(_e) {
  _e === void 0 && (_e = {});
  const {
    placement: Qt = "bottom",
    strategy: Zt = "absolute",
    middleware: $n = [],
    platform: Sn,
    whileElementsMounted: kn,
    open: Kn
  } = _e, [er, Cr] = reactExports.useState({
    x: null,
    y: null,
    strategy: Zt,
    placement: Qt,
    middlewareData: {},
    isPositioned: !1
  }), [kr, Yr] = reactExports.useState($n);
  Pa(kr, $n) || Yr($n);
  const Ms = reactExports.useRef(null), Ds = reactExports.useRef(null), Ls = reactExports.useRef(er), js = dc(kn), zs = dc(Sn), [Fs, Bs] = reactExports.useState(null), [Hs, Ws] = reactExports.useState(null), Ys = reactExports.useCallback((Au) => {
    Ms.current !== Au && (Ms.current = Au, Bs(Au));
  }, []), El = reactExports.useCallback((Au) => {
    Ds.current !== Au && (Ds.current = Au, Ws(Au));
  }, []), Mu = reactExports.useCallback(() => {
    if (!Ms.current || !Ds.current)
      return;
    const Au = {
      placement: Qt,
      strategy: Zt,
      middleware: kr
    };
    zs.current && (Au.platform = zs.current), e0(Ms.current, Ds.current, Au).then((Nu) => {
      const gm = {
        ...Nu,
        isPositioned: !0
      };
      Pl.current && !Pa(Ls.current, gm) && (Ls.current = gm, reactDomExports.flushSync(() => {
        Cr(gm);
      }));
    });
  }, [kr, Qt, Zt, zs]);
  ra(() => {
    Kn === !1 && Ls.current.isPositioned && (Ls.current.isPositioned = !1, Cr((Au) => ({
      ...Au,
      isPositioned: !1
    })));
  }, [Kn]);
  const Pl = reactExports.useRef(!1);
  ra(() => (Pl.current = !0, () => {
    Pl.current = !1;
  }), []), ra(() => {
    if (Fs && Hs) {
      if (js.current)
        return js.current(Fs, Hs, Mu);
      Mu();
    }
  }, [Fs, Hs, Mu, js]);
  const Iu = reactExports.useMemo(() => ({
    reference: Ms,
    floating: Ds,
    setReference: Ys,
    setFloating: El
  }), [Ys, El]), Tu = reactExports.useMemo(() => ({
    reference: Fs,
    floating: Hs
  }), [Fs, Hs]);
  return reactExports.useMemo(() => ({
    ...er,
    update: Mu,
    refs: Iu,
    elements: Tu,
    reference: Ys,
    floating: El
  }), [er, Mu, Iu, Tu, Ys, El]);
}
var _r = typeof document < "u" ? reactExports.useLayoutEffect : reactExports.useEffect;
let Ti = !1, r0 = 0;
const pc = () => "floating-ui-" + r0++;
function n0() {
  const [_e, Qt] = reactExports.useState(() => Ti ? pc() : void 0);
  return _r(() => {
    _e == null && Qt(pc());
  }, []), reactExports.useEffect(() => {
    Ti || (Ti = !0);
  }, []), _e;
}
const a0 = A$4[/* @__PURE__ */ "useId".toString()], mc = a0 || n0;
function i0() {
  const _e = /* @__PURE__ */ new Map();
  return {
    emit(Qt, Zt) {
      var $n;
      ($n = _e.get(Qt)) == null || $n.forEach((Sn) => Sn(Zt));
    },
    on(Qt, Zt) {
      _e.set(Qt, [..._e.get(Qt) || [], Zt]);
    },
    off(Qt, Zt) {
      _e.set(Qt, (_e.get(Qt) || []).filter(($n) => $n !== Zt));
    }
  };
}
const o0 = /* @__PURE__ */ reactExports.createContext(null), s0 = /* @__PURE__ */ reactExports.createContext(null), Rd = () => {
  var _e;
  return ((_e = reactExports.useContext(o0)) == null ? void 0 : _e.id) || null;
}, fs = () => reactExports.useContext(s0);
function Rt(_e) {
  return (_e == null ? void 0 : _e.ownerDocument) || document;
}
function l0() {
  const _e = navigator.userAgentData;
  return _e != null && _e.platform ? _e.platform : navigator.platform;
}
function c0() {
  const _e = navigator.userAgentData;
  return _e && Array.isArray(_e.brands) ? _e.brands.map((Qt) => {
    let {
      brand: Zt,
      version: $n
    } = Qt;
    return Zt + "/" + $n;
  }).join(" ") : navigator.userAgent;
}
function ds(_e) {
  return Rt(_e).defaultView || window;
}
function ct(_e) {
  return _e ? _e instanceof ds(_e).Element : !1;
}
function Cd(_e) {
  return _e ? _e instanceof ds(_e).HTMLElement : !1;
}
function u0(_e) {
  if (typeof ShadowRoot > "u")
    return !1;
  const Qt = ds(_e).ShadowRoot;
  return _e instanceof Qt || _e instanceof ShadowRoot;
}
function f0(_e) {
  if (_e.mozInputSource === 0 && _e.isTrusted)
    return !0;
  const Qt = /Android/i;
  return (Qt.test(l0()) || Qt.test(c0())) && _e.pointerType ? _e.type === "click" && _e.buttons === 1 : _e.detail === 0 && !_e.pointerType;
}
function d0(_e) {
  return _e.width === 0 && _e.height === 0 || _e.width === 1 && _e.height === 1 && _e.pressure === 0 && _e.detail === 0 && _e.pointerType !== "mouse" || // iOS VoiceOver returns 0.333• for width/height.
  _e.width < 1 && _e.height < 1 && _e.pressure === 0 && _e.detail === 0;
}
function Td(_e, Qt) {
  const Zt = ["mouse", "pen"];
  return Qt || Zt.push("", void 0), Zt.includes(_e);
}
function hc(_e) {
  const Qt = reactExports.useRef(_e);
  return _r(() => {
    Qt.current = _e;
  }), Qt;
}
const vc = "data-floating-ui-safe-polygon";
function na(_e, Qt, Zt) {
  return Zt && !Td(Zt) ? 0 : typeof _e == "number" ? _e : _e == null ? void 0 : _e[Qt];
}
const p0 = function(_e, Qt) {
  let {
    enabled: Zt = !0,
    delay: $n = 0,
    handleClose: Sn = null,
    mouseOnly: kn = !1,
    restMs: Kn = 0,
    move: er = !0
  } = Qt === void 0 ? {} : Qt;
  const {
    open: Cr,
    onOpenChange: kr,
    dataRef: Yr,
    events: Ms,
    elements: {
      domReference: Ds,
      floating: Ls
    },
    refs: js
  } = _e, zs = fs(), Fs = Rd(), Bs = hc(Sn), Hs = hc($n), Ws = reactExports.useRef(), Ys = reactExports.useRef(), El = reactExports.useRef(), Mu = reactExports.useRef(), Pl = reactExports.useRef(!0), Iu = reactExports.useRef(!1), Tu = reactExports.useRef(() => {
  }), Au = reactExports.useCallback(() => {
    var zu;
    const Yu = (zu = Yr.current.openEvent) == null ? void 0 : zu.type;
    return (Yu == null ? void 0 : Yu.includes("mouse")) && Yu !== "mousedown";
  }, [Yr]);
  reactExports.useEffect(() => {
    if (!Zt)
      return;
    function zu() {
      clearTimeout(Ys.current), clearTimeout(Mu.current), Pl.current = !0;
    }
    return Ms.on("dismiss", zu), () => {
      Ms.off("dismiss", zu);
    };
  }, [Zt, Ms]), reactExports.useEffect(() => {
    if (!Zt || !Bs.current || !Cr)
      return;
    function zu() {
      Au() && kr(!1);
    }
    const Yu = Rt(Ls).documentElement;
    return Yu.addEventListener("mouseleave", zu), () => {
      Yu.removeEventListener("mouseleave", zu);
    };
  }, [Ls, Cr, kr, Zt, Bs, Yr, Au]);
  const Nu = reactExports.useCallback(function(zu) {
    zu === void 0 && (zu = !0);
    const Yu = na(Hs.current, "close", Ws.current);
    Yu && !El.current ? (clearTimeout(Ys.current), Ys.current = setTimeout(() => kr(!1), Yu)) : zu && (clearTimeout(Ys.current), kr(!1));
  }, [Hs, kr]), gm = reactExports.useCallback(() => {
    Tu.current(), El.current = void 0;
  }, []), pm = reactExports.useCallback(() => {
    if (Iu.current) {
      const zu = Rt(js.floating.current).body;
      zu.style.pointerEvents = "", zu.removeAttribute(vc), Iu.current = !1;
    }
  }, [js]);
  return reactExports.useEffect(() => {
    if (!Zt)
      return;
    function zu() {
      return Yr.current.openEvent ? ["click", "mousedown"].includes(Yr.current.openEvent.type) : !1;
    }
    function Yu(hm) {
      if (clearTimeout(Ys.current), Pl.current = !1, kn && !Td(Ws.current) || Kn > 0 && na(Hs.current, "open") === 0)
        return;
      Yr.current.openEvent = hm;
      const ym = na(Hs.current, "open", Ws.current);
      ym ? Ys.current = setTimeout(() => {
        kr(!0);
      }, ym) : kr(!0);
    }
    function sm(hm) {
      if (zu())
        return;
      Tu.current();
      const ym = Rt(Ls);
      if (clearTimeout(Mu.current), Bs.current) {
        Cr || clearTimeout(Ys.current), El.current = Bs.current({
          ..._e,
          tree: zs,
          x: hm.clientX,
          y: hm.clientY,
          onClose() {
            pm(), gm(), Nu();
          }
        });
        const _m = El.current;
        ym.addEventListener("mousemove", _m), Tu.current = () => {
          ym.removeEventListener("mousemove", _m);
        };
        return;
      }
      Nu();
    }
    function mm(hm) {
      zu() || Bs.current == null || Bs.current({
        ..._e,
        tree: zs,
        x: hm.clientX,
        y: hm.clientY,
        onClose() {
          pm(), gm(), Nu();
        }
      })(hm);
    }
    if (ct(Ds)) {
      const hm = Ds;
      return Cr && hm.addEventListener("mouseleave", mm), Ls == null || Ls.addEventListener("mouseleave", mm), er && hm.addEventListener("mousemove", Yu, {
        once: !0
      }), hm.addEventListener("mouseenter", Yu), hm.addEventListener("mouseleave", sm), () => {
        Cr && hm.removeEventListener("mouseleave", mm), Ls == null || Ls.removeEventListener("mouseleave", mm), er && hm.removeEventListener("mousemove", Yu), hm.removeEventListener("mouseenter", Yu), hm.removeEventListener("mouseleave", sm);
      };
    }
  }, [Ds, Ls, Zt, _e, kn, Kn, er, Nu, gm, pm, kr, Cr, zs, Hs, Bs, Yr]), _r(() => {
    var zu;
    if (Zt && Cr && (zu = Bs.current) != null && zu.__options.blockPointerEvents && Au()) {
      const mm = Rt(Ls).body;
      if (mm.setAttribute(vc, ""), mm.style.pointerEvents = "none", Iu.current = !0, ct(Ds) && Ls) {
        var Yu, sm;
        const hm = Ds, ym = zs == null || (Yu = zs.nodesRef.current.find((_m) => _m.id === Fs)) == null || (sm = Yu.context) == null ? void 0 : sm.elements.floating;
        return ym && (ym.style.pointerEvents = ""), hm.style.pointerEvents = "auto", Ls.style.pointerEvents = "auto", () => {
          hm.style.pointerEvents = "", Ls.style.pointerEvents = "";
        };
      }
    }
  }, [Zt, Cr, Fs, Ls, Ds, zs, Bs, Yr, Au]), _r(() => {
    Cr || (Ws.current = void 0, gm(), pm());
  }, [Cr, gm, pm]), reactExports.useEffect(() => () => {
    gm(), clearTimeout(Ys.current), clearTimeout(Mu.current), pm();
  }, [Zt, gm, pm]), reactExports.useMemo(() => {
    if (!Zt)
      return {};
    function zu(Yu) {
      Ws.current = Yu.pointerType;
    }
    return {
      reference: {
        onPointerDown: zu,
        onPointerEnter: zu,
        onMouseMove() {
          Cr || Kn === 0 || (clearTimeout(Mu.current), Mu.current = setTimeout(() => {
            Pl.current || kr(!0);
          }, Kn));
        }
      },
      floating: {
        onMouseEnter() {
          clearTimeout(Ys.current);
        },
        onMouseLeave() {
          Ms.emit("dismiss", {
            type: "mouseLeave",
            data: {
              returnFocus: !1
            }
          }), Nu(!1);
        }
      }
    };
  }, [Ms, Zt, Kn, Cr, kr, Nu]);
}, Ad = /* @__PURE__ */ reactExports.createContext({
  delay: 0,
  initialDelay: 0,
  timeoutMs: 0,
  currentId: null,
  setCurrentId: () => {
  },
  setState: () => {
  },
  isInstantPhase: !1
}), Id = () => reactExports.useContext(Ad), m0 = (_e) => {
  let {
    children: Qt,
    delay: Zt,
    timeoutMs: $n = 0
  } = _e;
  const [Sn, kn] = reactExports.useReducer((Cr, kr) => ({
    ...Cr,
    ...kr
  }), {
    delay: Zt,
    timeoutMs: $n,
    initialDelay: Zt,
    currentId: null,
    isInstantPhase: !1
  }), Kn = reactExports.useRef(null), er = reactExports.useCallback((Cr) => {
    kn({
      currentId: Cr
    });
  }, []);
  return _r(() => {
    Sn.currentId ? Kn.current === null ? Kn.current = Sn.currentId : kn({
      isInstantPhase: !0
    }) : (kn({
      isInstantPhase: !1
    }), Kn.current = null);
  }, [Sn.currentId]), /* @__PURE__ */ reactExports.createElement(Ad.Provider, {
    value: reactExports.useMemo(() => ({
      ...Sn,
      setState: kn,
      setCurrentId: er
    }), [Sn, kn, er])
  }, Qt);
}, h0 = (_e, Qt) => {
  let {
    open: Zt,
    onOpenChange: $n
  } = _e, {
    id: Sn
  } = Qt;
  const {
    currentId: kn,
    setCurrentId: Kn,
    initialDelay: er,
    setState: Cr,
    timeoutMs: kr
  } = Id();
  reactExports.useEffect(() => {
    kn && (Cr({
      delay: {
        open: 1,
        close: na(er, "close")
      }
    }), kn !== Sn && $n(!1));
  }, [Sn, $n, Cr, kn, er]), reactExports.useEffect(() => {
    function Yr() {
      $n(!1), Cr({
        delay: er,
        currentId: null
      });
    }
    if (!Zt && kn === Sn)
      if (kr) {
        const Ms = window.setTimeout(Yr, kr);
        return () => {
          clearTimeout(Ms);
        };
      } else
        Yr();
  }, [Zt, Cr, kn, Sn, $n, er, kr]), reactExports.useEffect(() => {
    Zt && Kn(Sn);
  }, [Zt, Kn, Sn]);
};
function v0(_e) {
  let Qt = _e.activeElement;
  for (; ((Zt = Qt) == null || ($n = Zt.shadowRoot) == null ? void 0 : $n.activeElement) != null; ) {
    var Zt, $n;
    Qt = Qt.shadowRoot.activeElement;
  }
  return Qt;
}
function gc(_e, Qt) {
  if (!_e || !Qt)
    return !1;
  const Zt = Qt.getRootNode && Qt.getRootNode();
  if (_e.contains(Qt))
    return !0;
  if (Zt && u0(Zt)) {
    let $n = Qt;
    do {
      if ($n && _e === $n)
        return !0;
      $n = $n.parentNode || $n.host;
    } while ($n);
  }
  return !1;
}
function Ai(_e, Qt) {
  let Zt = _e.filter((Sn) => {
    var kn;
    return Sn.parentId === Qt && ((kn = Sn.context) == null ? void 0 : kn.open);
  }) || [], $n = Zt;
  for (; $n.length; )
    $n = _e.filter((Sn) => {
      var kn;
      return (kn = $n) == null ? void 0 : kn.some((Kn) => {
        var er;
        return Sn.parentId === Kn.id && ((er = Sn.context) == null ? void 0 : er.open);
      });
    }) || [], Zt = Zt.concat($n);
  return Zt;
}
function g0(_e) {
  return "composedPath" in _e ? _e.composedPath()[0] : _e.target;
}
const y0 = A$4[/* @__PURE__ */ "useInsertionEffect".toString()], b0 = y0 || ((_e) => _e());
function Nd(_e) {
  const Qt = reactExports.useRef(() => {
  });
  return b0(() => {
    Qt.current = _e;
  }), reactExports.useCallback(function() {
    for (var Zt = arguments.length, $n = new Array(Zt), Sn = 0; Sn < Zt; Sn++)
      $n[Sn] = arguments[Sn];
    return Qt.current == null ? void 0 : Qt.current(...$n);
  }, []);
}
function aa(_e, Qt) {
  if (Qt == null)
    return !1;
  if ("composedPath" in _e)
    return _e.composedPath().includes(Qt);
  const Zt = _e;
  return Zt.target != null && Qt.contains(Zt.target);
}
const w0 = {
  pointerdown: "onPointerDown",
  mousedown: "onMouseDown",
  click: "onClick"
}, _0 = {
  pointerdown: "onPointerDownCapture",
  mousedown: "onMouseDownCapture",
  click: "onClickCapture"
}, x0 = function(_e) {
  var Qt, Zt;
  return _e === void 0 && (_e = !0), {
    escapeKeyBubbles: typeof _e == "boolean" ? _e : (Qt = _e.escapeKey) != null ? Qt : !0,
    outsidePressBubbles: typeof _e == "boolean" ? _e : (Zt = _e.outsidePress) != null ? Zt : !0
  };
}, O0 = function(_e, Qt) {
  let {
    open: Zt,
    onOpenChange: $n,
    events: Sn,
    nodeId: kn,
    elements: {
      reference: Kn,
      domReference: er,
      floating: Cr
    },
    dataRef: kr
  } = _e, {
    enabled: Yr = !0,
    escapeKey: Ms = !0,
    outsidePress: Ds = !0,
    outsidePressEvent: Ls = "pointerdown",
    referencePress: js = !1,
    referencePressEvent: zs = "pointerdown",
    ancestorScroll: Fs = !1,
    bubbles: Bs = !0
  } = Qt === void 0 ? {} : Qt;
  const Hs = fs(), Ws = Rd() != null, Ys = Nd(typeof Ds == "function" ? Ds : () => !1), El = typeof Ds == "function" ? Ys : Ds, Mu = reactExports.useRef(!1), {
    escapeKeyBubbles: Pl,
    outsidePressBubbles: Iu
  } = x0(Bs);
  return reactExports.useEffect(() => {
    if (!Zt || !Yr)
      return;
    kr.current.__escapeKeyBubbles = Pl, kr.current.__outsidePressBubbles = Iu;
    function Tu(zu) {
      if (zu.key === "Escape") {
        const Yu = Hs ? Ai(Hs.nodesRef.current, kn) : [];
        if (Yu.length > 0) {
          let sm = !0;
          if (Yu.forEach((mm) => {
            var hm;
            if ((hm = mm.context) != null && hm.open && !mm.context.dataRef.current.__escapeKeyBubbles) {
              sm = !1;
              return;
            }
          }), !sm)
            return;
        }
        Sn.emit("dismiss", {
          type: "escapeKey",
          data: {
            returnFocus: {
              preventScroll: !1
            }
          }
        }), $n(!1);
      }
    }
    function Au(zu) {
      const Yu = Mu.current;
      if (Mu.current = !1, Yu || typeof El == "function" && !El(zu))
        return;
      const sm = g0(zu);
      if (Cd(sm) && Cr) {
        const ym = Cr.ownerDocument.defaultView || window, _m = sm.scrollWidth > sm.clientWidth, Sm = sm.scrollHeight > sm.clientHeight;
        let wm = Sm && zu.offsetX > sm.clientWidth;
        if (Sm && ym.getComputedStyle(sm).direction === "rtl" && (wm = zu.offsetX <= sm.offsetWidth - sm.clientWidth), wm || _m && zu.offsetY > sm.clientHeight)
          return;
      }
      const mm = Hs && Ai(Hs.nodesRef.current, kn).some((ym) => {
        var _m;
        return aa(zu, (_m = ym.context) == null ? void 0 : _m.elements.floating);
      });
      if (aa(zu, Cr) || aa(zu, er) || mm)
        return;
      const hm = Hs ? Ai(Hs.nodesRef.current, kn) : [];
      if (hm.length > 0) {
        let ym = !0;
        if (hm.forEach((_m) => {
          var Sm;
          if ((Sm = _m.context) != null && Sm.open && !_m.context.dataRef.current.__outsidePressBubbles) {
            ym = !1;
            return;
          }
        }), !ym)
          return;
      }
      Sn.emit("dismiss", {
        type: "outsidePress",
        data: {
          returnFocus: Ws ? {
            preventScroll: !0
          } : f0(zu) || d0(zu)
        }
      }), $n(!1);
    }
    function Nu() {
      $n(!1);
    }
    const gm = Rt(Cr);
    Ms && gm.addEventListener("keydown", Tu), El && gm.addEventListener(Ls, Au);
    let pm = [];
    return Fs && (ct(er) && (pm = gt$2(er)), ct(Cr) && (pm = pm.concat(gt$2(Cr))), !ct(Kn) && Kn && Kn.contextElement && (pm = pm.concat(gt$2(Kn.contextElement)))), pm = pm.filter((zu) => {
      var Yu;
      return zu !== ((Yu = gm.defaultView) == null ? void 0 : Yu.visualViewport);
    }), pm.forEach((zu) => {
      zu.addEventListener("scroll", Nu, {
        passive: !0
      });
    }), () => {
      Ms && gm.removeEventListener("keydown", Tu), El && gm.removeEventListener(Ls, Au), pm.forEach((zu) => {
        zu.removeEventListener("scroll", Nu);
      });
    };
  }, [kr, Cr, er, Kn, Ms, El, Ls, Sn, Hs, kn, Zt, $n, Fs, Yr, Pl, Iu, Ws]), reactExports.useEffect(() => {
    Mu.current = !1;
  }, [El, Ls]), reactExports.useMemo(() => Yr ? {
    reference: {
      [w0[zs]]: () => {
        js && (Sn.emit("dismiss", {
          type: "referencePress",
          data: {
            returnFocus: !1
          }
        }), $n(!1));
      }
    },
    floating: {
      [_0[Ls]]: () => {
        Mu.current = !0;
      }
    }
  } : {}, [Yr, Sn, js, Ls, zs, $n]);
}, P0 = function(_e, Qt) {
  let {
    open: Zt,
    onOpenChange: $n,
    dataRef: Sn,
    events: kn,
    refs: Kn,
    elements: {
      floating: er,
      domReference: Cr
    }
  } = _e, {
    enabled: kr = !0,
    keyboardOnly: Yr = !0
  } = Qt === void 0 ? {} : Qt;
  const Ms = reactExports.useRef(""), Ds = reactExports.useRef(!1), Ls = reactExports.useRef();
  return reactExports.useEffect(() => {
    if (!kr)
      return;
    const js = Rt(er).defaultView || window;
    function zs() {
      !Zt && Cd(Cr) && Cr === v0(Rt(Cr)) && (Ds.current = !0);
    }
    return js.addEventListener("blur", zs), () => {
      js.removeEventListener("blur", zs);
    };
  }, [er, Cr, Zt, kr]), reactExports.useEffect(() => {
    if (!kr)
      return;
    function js(zs) {
      (zs.type === "referencePress" || zs.type === "escapeKey") && (Ds.current = !0);
    }
    return kn.on("dismiss", js), () => {
      kn.off("dismiss", js);
    };
  }, [kn, kr]), reactExports.useEffect(() => () => {
    clearTimeout(Ls.current);
  }, []), reactExports.useMemo(() => kr ? {
    reference: {
      onPointerDown(js) {
        let {
          pointerType: zs
        } = js;
        Ms.current = zs, Ds.current = !!(zs && Yr);
      },
      onMouseLeave() {
        Ds.current = !1;
      },
      onFocus(js) {
        var zs;
        Ds.current || js.type === "focus" && ((zs = Sn.current.openEvent) == null ? void 0 : zs.type) === "mousedown" && Sn.current.openEvent && aa(Sn.current.openEvent, Cr) || (Sn.current.openEvent = js.nativeEvent, $n(!0));
      },
      onBlur(js) {
        Ds.current = !1;
        const zs = js.relatedTarget, Fs = ct(zs) && zs.hasAttribute("data-floating-ui-focus-guard") && zs.getAttribute("data-type") === "outside";
        Ls.current = setTimeout(() => {
          gc(Kn.floating.current, zs) || gc(Cr, zs) || Fs || $n(!1);
        });
      }
    }
  } : {}, [kr, Yr, Cr, Kn, Sn, $n]);
}, E0 = function(_e, Qt) {
  let {
    open: Zt
  } = _e, {
    enabled: $n = !0,
    role: Sn = "dialog"
  } = Qt === void 0 ? {} : Qt;
  const kn = mc(), Kn = mc();
  return reactExports.useMemo(() => {
    const er = {
      id: kn,
      role: Sn
    };
    return $n ? Sn === "tooltip" ? {
      reference: {
        "aria-describedby": Zt ? kn : void 0
      },
      floating: er
    } : {
      reference: {
        "aria-expanded": Zt ? "true" : "false",
        "aria-haspopup": Sn === "alertdialog" ? "dialog" : Sn,
        "aria-controls": Zt ? kn : void 0,
        ...Sn === "listbox" && {
          role: "combobox"
        },
        ...Sn === "menu" && {
          id: Kn
        }
      },
      floating: {
        ...er,
        ...Sn === "menu" && {
          "aria-labelledby": Kn
        }
      }
    } : {};
  }, [$n, Sn, Zt, kn, Kn]);
};
function ps(_e) {
  _e === void 0 && (_e = {});
  const {
    open: Qt = !1,
    onOpenChange: Zt,
    nodeId: $n
  } = _e, Sn = t0(_e), kn = fs(), Kn = reactExports.useRef(null), er = reactExports.useRef({}), Cr = reactExports.useState(() => i0())[0], [kr, Yr] = reactExports.useState(null), Ms = reactExports.useCallback((Bs) => {
    const Hs = ct(Bs) ? {
      getBoundingClientRect: () => Bs.getBoundingClientRect(),
      contextElement: Bs
    } : Bs;
    Sn.refs.setReference(Hs);
  }, [Sn.refs]), Ds = reactExports.useCallback((Bs) => {
    (ct(Bs) || Bs === null) && (Kn.current = Bs, Yr(Bs)), (ct(Sn.refs.reference.current) || Sn.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
    // `null` to support `positionReference` + an unstable `reference`
    // callback ref.
    Bs !== null && !ct(Bs)) && Sn.refs.setReference(Bs);
  }, [Sn.refs]), Ls = reactExports.useMemo(() => ({
    ...Sn.refs,
    setReference: Ds,
    setPositionReference: Ms,
    domReference: Kn
  }), [Sn.refs, Ds, Ms]), js = reactExports.useMemo(() => ({
    ...Sn.elements,
    domReference: kr
  }), [Sn.elements, kr]), zs = Nd(Zt), Fs = reactExports.useMemo(() => ({
    ...Sn,
    refs: Ls,
    elements: js,
    dataRef: er,
    nodeId: $n,
    events: Cr,
    open: Qt,
    onOpenChange: zs
  }), [Sn, $n, Cr, Qt, zs, Ls, js]);
  return _r(() => {
    const Bs = kn == null ? void 0 : kn.nodesRef.current.find((Hs) => Hs.id === $n);
    Bs && (Bs.context = Fs);
  }), reactExports.useMemo(() => ({
    ...Sn,
    context: Fs,
    refs: Ls,
    reference: Ds,
    positionReference: Ms
  }), [Sn, Ls, Fs, Ds, Ms]);
}
function Ii(_e, Qt, Zt) {
  const $n = /* @__PURE__ */ new Map();
  return {
    ...Zt === "floating" && {
      tabIndex: -1
    },
    ..._e,
    ...Qt.map((Sn) => Sn ? Sn[Zt] : null).concat(_e).reduce((Sn, kn) => (kn && Object.entries(kn).forEach((Kn) => {
      let [er, Cr] = Kn;
      if (er.indexOf("on") === 0) {
        if ($n.has(er) || $n.set(er, []), typeof Cr == "function") {
          var kr;
          (kr = $n.get(er)) == null || kr.push(Cr), Sn[er] = function() {
            for (var Yr, Ms = arguments.length, Ds = new Array(Ms), Ls = 0; Ls < Ms; Ls++)
              Ds[Ls] = arguments[Ls];
            (Yr = $n.get(er)) == null || Yr.forEach((js) => js(...Ds));
          };
        }
      } else
        Sn[er] = Cr;
    }), Sn), {})
  };
}
const S0 = function(_e) {
  _e === void 0 && (_e = []);
  const Qt = _e, Zt = reactExports.useCallback(
    (kn) => Ii(kn, _e, "reference"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    Qt
  ), $n = reactExports.useCallback(
    (kn) => Ii(kn, _e, "floating"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    Qt
  ), Sn = reactExports.useCallback(
    (kn) => Ii(kn, _e, "item"),
    // Granularly check for `item` changes, because the `getItemProps` getter
    // should be as referentially stable as possible since it may be passed as
    // a prop to many components. All `item` key values must therefore be
    // memoized.
    // eslint-disable-next-line react-hooks/exhaustive-deps
    _e.map((kn) => kn == null ? void 0 : kn.item)
  );
  return reactExports.useMemo(() => ({
    getReferenceProps: Zt,
    getFloatingProps: $n,
    getItemProps: Sn
  }), [Zt, $n, Sn]);
};
function jd({ opened: _e, floating: Qt, positionDependencies: Zt }) {
  const [$n, Sn] = reactExports.useState(0);
  reactExports.useEffect(() => {
    if (Qt.refs.reference.current && Qt.refs.floating.current)
      return Zb(Qt.refs.reference.current, Qt.refs.floating.current, Qt.update);
  }, [Qt.refs.reference.current, Qt.refs.floating.current, _e, $n]), vr(() => {
    Qt.update();
  }, Zt), vr(() => {
    Sn((kn) => kn + 1);
  }, [_e]);
}
function $0(_e) {
  const Qt = [yd(_e.offset)];
  return _e.middlewares.shift && Qt.push(us({ limiter: Gb() })), _e.middlewares.flip && Qt.push(vd()), _e.middlewares.inline && Qt.push(gd()), Qt.push(kd({ element: _e.arrowRef, padding: _e.arrowOffset })), Qt;
}
function k0(_e) {
  const [Qt, Zt] = Sy({
    value: _e.opened,
    defaultValue: _e.defaultOpened,
    finalValue: !1,
    onChange: _e.onChange
  }), $n = () => {
    var Kn;
    (Kn = _e.onClose) == null || Kn.call(_e), Zt(!1);
  }, Sn = () => {
    var Kn, er;
    Qt ? ((Kn = _e.onClose) == null || Kn.call(_e), Zt(!1)) : ((er = _e.onOpen) == null || er.call(_e), Zt(!0));
  }, kn = ps({
    placement: _e.position,
    middleware: [
      ...$0(_e),
      ..._e.width === "target" ? [
        Xb({
          apply({ rects: Kn }) {
            var er, Cr;
            Object.assign((Cr = (er = kn.refs.floating.current) == null ? void 0 : er.style) != null ? Cr : {}, {
              width: `${Kn.reference.width}px`
            });
          }
        })
      ] : []
    ]
  });
  return jd({
    opened: _e.opened,
    positionDependencies: _e.positionDependencies,
    floating: kn
  }), vr(() => {
    var Kn;
    (Kn = _e.onPositionChange) == null || Kn.call(_e, kn.placement);
  }, [kn.placement]), {
    floating: kn,
    controlled: typeof _e.opened == "boolean",
    opened: Qt,
    onClose: $n,
    onToggle: Sn
  };
}
const Md = {
  context: "Popover component was not found in the tree",
  children: "Popover.Target component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported"
}, [R0, Dd] = sv(Md.context);
var C0 = Object.defineProperty, T0 = Object.defineProperties, A0 = Object.getOwnPropertyDescriptors, Ea = Object.getOwnPropertySymbols, zd = Object.prototype.hasOwnProperty, Ld = Object.prototype.propertyIsEnumerable, yc = (_e, Qt, Zt) => Qt in _e ? C0(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, jn = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    zd.call(Qt, Zt) && yc(_e, Zt, Qt[Zt]);
  if (Ea)
    for (var Zt of Ea(Qt))
      Ld.call(Qt, Zt) && yc(_e, Zt, Qt[Zt]);
  return _e;
}, I0 = (_e, Qt) => T0(_e, A0(Qt)), N0 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    zd.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Ea)
    for (var $n of Ea(_e))
      Qt.indexOf($n) < 0 && Ld.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const j0 = {
  refProp: "ref",
  popupType: "dialog"
}, Fd = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("PopoverTarget", j0, _e), { children: $n, refProp: Sn, popupType: kn } = Zt, Kn = N0(Zt, ["children", "refProp", "popupType"]);
  if (!ti($n))
    throw new Error(Md.children);
  const er = Kn, Cr = Dd(), kr = ii(Cr.reference, $n.ref, Qt), Yr = Cr.withRoles ? {
    "aria-haspopup": kn,
    "aria-expanded": Cr.opened,
    "aria-controls": Cr.getDropdownId(),
    id: Cr.getTargetId()
  } : {};
  return reactExports.cloneElement($n, jn(I0(jn(jn(jn({}, er), Yr), Cr.targetProps), {
    className: $f(Cr.targetProps.className, er.className, $n.props.className),
    [Sn]: kr
  }), Cr.controlled ? null : { onClick: Cr.onToggle }));
});
Fd.displayName = "@mantine/core/PopoverTarget";
var M0 = Fe((_e, { radius: Qt, shadow: Zt }) => ({
  dropdown: {
    position: "absolute",
    backgroundColor: _e.white,
    background: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.white,
    border: `1px solid ${_e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2]}`,
    padding: `${_e.spacing.sm}px ${_e.spacing.md}px`,
    boxShadow: _e.shadows[Zt] || Zt || "none",
    borderRadius: _e.fn.radius(Qt),
    "&:focus": {
      outline: 0
    }
  },
  arrow: {
    backgroundColor: "inherit",
    border: `1px solid ${_e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2]}`,
    zIndex: 1
  }
}));
const D0 = M0;
var z0 = Object.defineProperty, bc = Object.getOwnPropertySymbols, L0 = Object.prototype.hasOwnProperty, F0 = Object.prototype.propertyIsEnumerable, wc = (_e, Qt, Zt) => Qt in _e ? z0(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, rr = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    L0.call(Qt, Zt) && wc(_e, Zt, Qt[Zt]);
  if (bc)
    for (var Zt of bc(Qt))
      F0.call(Qt, Zt) && wc(_e, Zt, Qt[Zt]);
  return _e;
};
const _c = {
  entering: "in",
  entered: "in",
  exiting: "out",
  exited: "out",
  "pre-exiting": "out",
  "pre-entering": "out"
};
function W0({
  transition: _e,
  state: Qt,
  duration: Zt,
  timingFunction: $n
}) {
  const Sn = {
    transitionDuration: `${Zt}ms`,
    transitionTimingFunction: $n
  };
  return typeof _e == "string" ? _e in In ? rr(rr(rr({
    transitionProperty: In[_e].transitionProperty
  }, Sn), In[_e].common), In[_e][_c[Qt]]) : null : rr(rr(rr({
    transitionProperty: _e.transitionProperty
  }, Sn), _e.common), _e[_c[Qt]]);
}
function V0({
  duration: _e,
  exitDuration: Qt,
  timingFunction: Zt,
  mounted: $n,
  onEnter: Sn,
  onExit: kn,
  onEntered: Kn,
  onExited: er
}) {
  const Cr = _t(), kr = $y(), Yr = Cr.respectReducedMotion ? kr : !1, [Ms, Ds] = reactExports.useState($n ? "entered" : "exited");
  let Ls = Yr ? 0 : _e;
  const js = reactExports.useRef(-1), zs = (Fs) => {
    const Bs = Fs ? Sn : kn, Hs = Fs ? Kn : er;
    if (Ds(Fs ? "pre-entering" : "pre-exiting"), window.clearTimeout(js.current), Ls = Yr ? 0 : Fs ? _e : Qt, Ls === 0)
      typeof Bs == "function" && Bs(), typeof Hs == "function" && Hs(), Ds(Fs ? "entered" : "exited");
    else {
      const Ws = window.setTimeout(() => {
        typeof Bs == "function" && Bs(), Ds(Fs ? "entering" : "exiting");
      }, 10);
      js.current = window.setTimeout(() => {
        window.clearTimeout(Ws), typeof Hs == "function" && Hs(), Ds(Fs ? "entered" : "exited");
      }, Ls);
    }
  };
  return vr(() => {
    zs($n);
  }, [$n]), reactExports.useEffect(() => () => window.clearTimeout(js.current), []), {
    transitionDuration: Ls,
    transitionStatus: Ms,
    transitionTimingFunction: Zt || Cr.transitionTimingFunction
  };
}
function ms({
  transition: _e,
  duration: Qt = 250,
  exitDuration: Zt = Qt,
  mounted: $n,
  children: Sn,
  timingFunction: kn,
  onExit: Kn,
  onEntered: er,
  onEnter: Cr,
  onExited: kr
}) {
  const { transitionDuration: Yr, transitionStatus: Ms, transitionTimingFunction: Ds } = V0({
    mounted: $n,
    exitDuration: Zt,
    duration: Qt,
    timingFunction: kn,
    onExit: Kn,
    onEntered: er,
    onEnter: Cr,
    onExited: kr
  });
  return Yr === 0 ? $n ? /* @__PURE__ */ React.createElement(React.Fragment, null, Sn({})) : null : Ms === "exited" ? null : /* @__PURE__ */ React.createElement(React.Fragment, null, Sn(W0({
    transition: _e,
    duration: Yr,
    state: Ms,
    timingFunction: Ds
  })));
}
ms.displayName = "@mantine/core/Transition";
function Wd({
  children: _e,
  active: Qt = !0,
  refProp: Zt = "ref"
}) {
  const $n = by(Qt), Sn = ii($n, _e == null ? void 0 : _e.ref);
  return ti(_e) ? reactExports.cloneElement(_e, { [Zt]: Sn }) : _e;
}
Wd.displayName = "@mantine/core/FocusTrap";
var Y0 = Object.defineProperty, B0 = Object.defineProperties, H0 = Object.getOwnPropertyDescriptors, xc = Object.getOwnPropertySymbols, U0 = Object.prototype.hasOwnProperty, q0 = Object.prototype.propertyIsEnumerable, Oc = (_e, Qt, Zt) => Qt in _e ? Y0(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Pt = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    U0.call(Qt, Zt) && Oc(_e, Zt, Qt[Zt]);
  if (xc)
    for (var Zt of xc(Qt))
      q0.call(Qt, Zt) && Oc(_e, Zt, Qt[Zt]);
  return _e;
}, Mn = (_e, Qt) => B0(_e, H0(Qt));
function Pc(_e, Qt, Zt, $n) {
  return _e === "center" || $n === "center" ? { top: Qt } : _e === "end" ? { bottom: Zt } : _e === "start" ? { top: Zt } : {};
}
function Ec(_e, Qt, Zt, $n, Sn) {
  return _e === "center" || $n === "center" ? { left: Qt } : _e === "end" ? { [Sn === "ltr" ? "right" : "left"]: Zt } : _e === "start" ? { [Sn === "ltr" ? "left" : "right"]: Zt } : {};
}
const G0 = {
  bottom: "borderTopLeftRadius",
  left: "borderTopRightRadius",
  right: "borderBottomLeftRadius",
  top: "borderBottomRightRadius"
};
function X0({
  position: _e,
  withBorder: Qt,
  arrowSize: Zt,
  arrowOffset: $n,
  arrowRadius: Sn,
  arrowPosition: kn,
  arrowX: Kn,
  arrowY: er,
  dir: Cr
}) {
  const [kr, Yr = "center"] = _e.split("-"), Ms = {
    width: Zt,
    height: Zt,
    transform: "rotate(45deg)",
    position: "absolute",
    [G0[kr]]: Sn
  }, Ds = Qt ? -Zt / 2 - 1 : -Zt / 2;
  return kr === "left" ? Mn(Pt(Pt({}, Ms), Pc(Yr, er, $n, kn)), {
    right: Ds,
    borderLeft: 0,
    borderBottom: 0
  }) : kr === "right" ? Mn(Pt(Pt({}, Ms), Pc(Yr, er, $n, kn)), {
    left: Ds,
    borderRight: 0,
    borderTop: 0
  }) : kr === "top" ? Mn(Pt(Pt({}, Ms), Ec(Yr, Kn, $n, kn, Cr)), {
    bottom: Ds,
    borderTop: 0,
    borderLeft: 0
  }) : kr === "bottom" ? Mn(Pt(Pt({}, Ms), Ec(Yr, Kn, $n, kn, Cr)), {
    top: Ds,
    borderBottom: 0,
    borderRight: 0
  }) : {};
}
var K0 = Object.defineProperty, Q0 = Object.defineProperties, J0 = Object.getOwnPropertyDescriptors, Sa = Object.getOwnPropertySymbols, Vd = Object.prototype.hasOwnProperty, Yd = Object.prototype.propertyIsEnumerable, Sc = (_e, Qt, Zt) => Qt in _e ? K0(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Z0 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Vd.call(Qt, Zt) && Sc(_e, Zt, Qt[Zt]);
  if (Sa)
    for (var Zt of Sa(Qt))
      Yd.call(Qt, Zt) && Sc(_e, Zt, Qt[Zt]);
  return _e;
}, e1 = (_e, Qt) => Q0(_e, J0(Qt)), t1 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    Vd.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Sa)
    for (var $n of Sa(_e))
      Qt.indexOf($n) < 0 && Yd.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const hs = reactExports.forwardRef((_e, Qt) => {
  var Zt = _e, {
    withBorder: $n,
    position: Sn,
    arrowSize: kn,
    arrowOffset: Kn,
    arrowRadius: er,
    arrowPosition: Cr,
    visible: kr,
    arrowX: Yr,
    arrowY: Ms
  } = Zt, Ds = t1(Zt, [
    "withBorder",
    "position",
    "arrowSize",
    "arrowOffset",
    "arrowRadius",
    "arrowPosition",
    "visible",
    "arrowX",
    "arrowY"
  ]);
  const Ls = _t();
  return kr ? /* @__PURE__ */ React.createElement("div", e1(Z0({}, Ds), {
    ref: Qt,
    style: X0({
      withBorder: $n,
      position: Sn,
      arrowSize: kn,
      arrowOffset: Kn,
      arrowRadius: er,
      arrowPosition: Cr,
      dir: Ls.dir,
      arrowX: Yr,
      arrowY: Ms
    })
  })) : null;
});
hs.displayName = "@mantine/core/FloatingArrow";
var r1 = Object.defineProperty, n1 = Object.defineProperties, a1 = Object.getOwnPropertyDescriptors, $a = Object.getOwnPropertySymbols, Bd = Object.prototype.hasOwnProperty, Hd = Object.prototype.propertyIsEnumerable, $c = (_e, Qt, Zt) => Qt in _e ? r1(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Dn = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Bd.call(Qt, Zt) && $c(_e, Zt, Qt[Zt]);
  if ($a)
    for (var Zt of $a(Qt))
      Hd.call(Qt, Zt) && $c(_e, Zt, Qt[Zt]);
  return _e;
}, kc = (_e, Qt) => n1(_e, a1(Qt)), i1 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    Bd.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && $a)
    for (var $n of $a(_e))
      Qt.indexOf($n) < 0 && Hd.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const o1 = {};
function Ud(_e) {
  const Qt = Pe("PopoverDropdown", o1, _e), { style: Zt, className: $n, children: Sn, onKeyDownCapture: kn } = Qt, Kn = i1(Qt, ["style", "className", "children", "onKeyDownCapture"]), er = Dd(), { classes: Cr, cx: kr } = D0({ radius: er.radius, shadow: er.shadow }, {
    name: er.__staticSelector,
    classNames: er.classNames,
    styles: er.styles,
    unstyled: er.unstyled
  }), Yr = dy({
    opened: er.opened,
    shouldReturnFocus: er.returnFocus
  }), Ms = er.withRoles ? {
    "aria-labelledby": er.getTargetId(),
    id: er.getDropdownId(),
    role: "dialog"
  } : {};
  return er.disabled ? null : /* @__PURE__ */ React.createElement(oi, {
    withinPortal: er.withinPortal
  }, /* @__PURE__ */ React.createElement(ms, {
    mounted: er.opened,
    transition: er.transition,
    duration: er.transitionDuration,
    exitDuration: typeof er.exitTransitionDuration == "number" ? er.exitTransitionDuration : er.transitionDuration
  }, (Ds) => {
    var Ls, js;
    return /* @__PURE__ */ React.createElement(Wd, {
      active: er.trapFocus
    }, /* @__PURE__ */ React.createElement(Le, Dn(kc(Dn({}, Ms), {
      tabIndex: -1,
      key: er.placement,
      ref: er.floating,
      style: kc(Dn(Dn({}, Zt), Ds), {
        zIndex: er.zIndex,
        top: (Ls = er.y) != null ? Ls : 0,
        left: (js = er.x) != null ? js : 0,
        width: er.width === "target" ? void 0 : er.width
      }),
      className: kr(Cr.dropdown, $n),
      onKeyDownCapture: uv(er.onClose, {
        active: er.closeOnEscape,
        onTrigger: Yr,
        onKeyDown: kn
      }),
      "data-position": er.placement
    }), Kn), Sn, /* @__PURE__ */ React.createElement(hs, {
      ref: er.arrowRef,
      arrowX: er.arrowX,
      arrowY: er.arrowY,
      visible: er.withArrow,
      withBorder: !0,
      position: er.placement,
      arrowSize: er.arrowSize,
      arrowRadius: er.arrowRadius,
      arrowOffset: er.arrowOffset,
      arrowPosition: er.arrowPosition,
      className: Cr.arrow
    })));
  }));
}
Ud.displayName = "@mantine/core/PopoverDropdown";
function qd(_e, Qt) {
  if (_e === "rtl" && (Qt.includes("right") || Qt.includes("left"))) {
    const [Zt, $n] = Qt.split("-"), Sn = Zt === "right" ? "left" : "right";
    return $n === void 0 ? Sn : `${Sn}-${$n}`;
  }
  return Qt;
}
var Rc = Object.getOwnPropertySymbols, s1 = Object.prototype.hasOwnProperty, l1 = Object.prototype.propertyIsEnumerable, c1 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    s1.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Rc)
    for (var $n of Rc(_e))
      Qt.indexOf($n) < 0 && l1.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const u1 = {
  position: "bottom",
  offset: 8,
  positionDependencies: [],
  transition: "fade",
  transitionDuration: 150,
  middlewares: { flip: !0, shift: !0, inline: !1 },
  arrowSize: 7,
  arrowOffset: 5,
  arrowRadius: 0,
  arrowPosition: "side",
  closeOnClickOutside: !0,
  withinPortal: !1,
  closeOnEscape: !0,
  trapFocus: !1,
  withRoles: !0,
  returnFocus: !1,
  clickOutsideEvents: ["mousedown", "touchstart"],
  zIndex: as("popover"),
  __staticSelector: "Popover",
  width: "max-content"
};
function dr(_e) {
  var Qt, Zt, $n, Sn, kn, Kn;
  const er = reactExports.useRef(null), Cr = Pe("Popover", u1, _e), {
    children: kr,
    position: Yr,
    offset: Ms,
    onPositionChange: Ds,
    positionDependencies: Ls,
    opened: js,
    transition: zs,
    transitionDuration: Fs,
    width: Bs,
    middlewares: Hs,
    withArrow: Ws,
    arrowSize: Ys,
    arrowOffset: El,
    arrowRadius: Mu,
    arrowPosition: Pl,
    unstyled: Iu,
    classNames: Tu,
    styles: Au,
    closeOnClickOutside: Nu,
    withinPortal: gm,
    closeOnEscape: pm,
    clickOutsideEvents: zu,
    trapFocus: Yu,
    onClose: sm,
    onOpen: mm,
    onChange: hm,
    zIndex: ym,
    radius: _m,
    shadow: Sm,
    id: wm,
    defaultOpened: Nm,
    exitTransitionDuration: Cm,
    __staticSelector: Im,
    withRoles: Am,
    disabled: Vm,
    returnFocus: Rm
  } = Cr, Dm = c1(Cr, [
    "children",
    "position",
    "offset",
    "onPositionChange",
    "positionDependencies",
    "opened",
    "transition",
    "transitionDuration",
    "width",
    "middlewares",
    "withArrow",
    "arrowSize",
    "arrowOffset",
    "arrowRadius",
    "arrowPosition",
    "unstyled",
    "classNames",
    "styles",
    "closeOnClickOutside",
    "withinPortal",
    "closeOnEscape",
    "clickOutsideEvents",
    "trapFocus",
    "onClose",
    "onOpen",
    "onChange",
    "zIndex",
    "radius",
    "shadow",
    "id",
    "defaultOpened",
    "exitTransitionDuration",
    "__staticSelector",
    "withRoles",
    "disabled",
    "returnFocus"
  ]), [km, zm] = reactExports.useState(null), [Pm, i$] = reactExports.useState(null), o$ = is(wm), u$ = _t(), h$ = k0({
    middlewares: Hs,
    width: Bs,
    position: qd(u$.dir, Yr),
    offset: Ms + (Ws ? Ys / 2 : 0),
    arrowRef: er,
    arrowOffset: El,
    onPositionChange: Ds,
    positionDependencies: Ls,
    opened: js,
    defaultOpened: Nm,
    onChange: hm,
    onOpen: mm,
    onClose: sm
  });
  ly(() => Nu && h$.onClose(), zu, [
    km,
    Pm
  ]);
  const d$ = reactExports.useCallback(($$) => {
    zm($$), h$.floating.reference($$);
  }, [h$.floating.reference]), v$ = reactExports.useCallback(($$) => {
    i$($$), h$.floating.floating($$);
  }, [h$.floating.floating]);
  return /* @__PURE__ */ React.createElement(R0, {
    value: {
      returnFocus: Rm,
      disabled: Vm,
      controlled: h$.controlled,
      reference: d$,
      floating: v$,
      x: h$.floating.x,
      y: h$.floating.y,
      arrowX: ($n = (Zt = (Qt = h$.floating) == null ? void 0 : Qt.middlewareData) == null ? void 0 : Zt.arrow) == null ? void 0 : $n.x,
      arrowY: (Kn = (kn = (Sn = h$.floating) == null ? void 0 : Sn.middlewareData) == null ? void 0 : kn.arrow) == null ? void 0 : Kn.y,
      opened: h$.opened,
      arrowRef: er,
      transition: zs,
      transitionDuration: Fs,
      exitTransitionDuration: Cm,
      width: Bs,
      withArrow: Ws,
      arrowSize: Ys,
      arrowOffset: El,
      arrowRadius: Mu,
      arrowPosition: Pl,
      placement: h$.floating.placement,
      trapFocus: Yu,
      withinPortal: gm,
      zIndex: ym,
      radius: _m,
      shadow: Sm,
      closeOnEscape: pm,
      onClose: h$.onClose,
      onToggle: h$.onToggle,
      getTargetId: () => `${o$}-target`,
      getDropdownId: () => `${o$}-dropdown`,
      withRoles: Am,
      targetProps: Dm,
      __staticSelector: Im,
      classNames: Tu,
      styles: Au,
      unstyled: Iu
    }
  }, kr);
}
dr.Target = Fd;
dr.Dropdown = Ud;
dr.displayName = "@mantine/core/Popover";
var f1 = Fe((_e, { size: Qt }) => ({
  label: {
    display: "inline-block",
    fontSize: _e.fn.size({ size: Qt, sizes: _e.fontSizes }),
    fontWeight: 500,
    color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.colors.gray[9],
    wordBreak: "break-word",
    cursor: "default",
    WebkitTapHighlightColor: "transparent"
  },
  required: {
    color: _e.fn.variant({ variant: "filled", color: "red" }).background
  }
}));
const d1 = f1;
var p1 = Object.defineProperty, ka = Object.getOwnPropertySymbols, Gd = Object.prototype.hasOwnProperty, Xd = Object.prototype.propertyIsEnumerable, Cc = (_e, Qt, Zt) => Qt in _e ? p1(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, m1 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Gd.call(Qt, Zt) && Cc(_e, Zt, Qt[Zt]);
  if (ka)
    for (var Zt of ka(Qt))
      Xd.call(Qt, Zt) && Cc(_e, Zt, Qt[Zt]);
  return _e;
}, h1 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    Gd.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && ka)
    for (var $n of ka(_e))
      Qt.indexOf($n) < 0 && Xd.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const v1 = {
  labelElement: "label",
  size: "sm"
}, vs = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("InputLabel", v1, _e), {
    labelElement: $n,
    children: Sn,
    required: kn,
    size: Kn,
    classNames: er,
    styles: Cr,
    unstyled: kr,
    className: Yr,
    htmlFor: Ms,
    __staticSelector: Ds
  } = Zt, Ls = h1(Zt, [
    "labelElement",
    "children",
    "required",
    "size",
    "classNames",
    "styles",
    "unstyled",
    "className",
    "htmlFor",
    "__staticSelector"
  ]), { classes: js, cx: zs } = d1({ size: Kn }, { name: ["InputWrapper", Ds], classNames: er, styles: Cr, unstyled: kr });
  return /* @__PURE__ */ React.createElement(Le, m1({
    component: $n,
    ref: Qt,
    className: zs(js.label, Yr),
    htmlFor: $n === "label" ? Ms : void 0
  }, Ls), Sn, kn && /* @__PURE__ */ React.createElement("span", {
    className: js.required,
    "aria-hidden": !0
  }, " *"));
});
vs.displayName = "@mantine/core/InputLabel";
var g1 = Fe((_e, { size: Qt }) => ({
  error: {
    wordBreak: "break-word",
    color: _e.fn.variant({ variant: "filled", color: "red" }).background,
    fontSize: _e.fn.size({ size: Qt, sizes: _e.fontSizes }) - 2,
    lineHeight: 1.2,
    display: "block"
  }
}));
const y1 = g1;
var b1 = Object.defineProperty, Ra = Object.getOwnPropertySymbols, Kd = Object.prototype.hasOwnProperty, Qd = Object.prototype.propertyIsEnumerable, Tc = (_e, Qt, Zt) => Qt in _e ? b1(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, w1 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Kd.call(Qt, Zt) && Tc(_e, Zt, Qt[Zt]);
  if (Ra)
    for (var Zt of Ra(Qt))
      Qd.call(Qt, Zt) && Tc(_e, Zt, Qt[Zt]);
  return _e;
}, _1 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    Kd.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Ra)
    for (var $n of Ra(_e))
      Qt.indexOf($n) < 0 && Qd.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const x1 = {
  size: "sm"
}, gs = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("InputError", x1, _e), { children: $n, className: Sn, classNames: kn, styles: Kn, unstyled: er, size: Cr, __staticSelector: kr } = Zt, Yr = _1(Zt, ["children", "className", "classNames", "styles", "unstyled", "size", "__staticSelector"]), { classes: Ms, cx: Ds } = y1({ size: Cr }, { name: ["InputWrapper", kr], classNames: kn, styles: Kn, unstyled: er });
  return /* @__PURE__ */ React.createElement(gr, w1({
    className: Ds(Ms.error, Sn),
    ref: Qt
  }, Yr), $n);
});
gs.displayName = "@mantine/core/InputError";
var O1 = Fe((_e, { size: Qt }) => ({
  description: {
    wordBreak: "break-word",
    color: _e.colorScheme === "dark" ? _e.colors.dark[2] : _e.colors.gray[6],
    fontSize: _e.fn.size({ size: Qt, sizes: _e.fontSizes }) - 2,
    lineHeight: 1.2,
    display: "block"
  }
}));
const P1 = O1;
var E1 = Object.defineProperty, Ca = Object.getOwnPropertySymbols, Jd = Object.prototype.hasOwnProperty, Zd = Object.prototype.propertyIsEnumerable, Ac = (_e, Qt, Zt) => Qt in _e ? E1(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, S1 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Jd.call(Qt, Zt) && Ac(_e, Zt, Qt[Zt]);
  if (Ca)
    for (var Zt of Ca(Qt))
      Zd.call(Qt, Zt) && Ac(_e, Zt, Qt[Zt]);
  return _e;
}, $1 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    Jd.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Ca)
    for (var $n of Ca(_e))
      Qt.indexOf($n) < 0 && Zd.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const k1 = {
  size: "sm"
}, ys = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("InputDescription", k1, _e), { children: $n, className: Sn, classNames: kn, styles: Kn, unstyled: er, size: Cr, __staticSelector: kr } = Zt, Yr = $1(Zt, ["children", "className", "classNames", "styles", "unstyled", "size", "__staticSelector"]), { classes: Ms, cx: Ds } = P1({ size: Cr }, { name: ["InputWrapper", kr], classNames: kn, styles: Kn, unstyled: er });
  return /* @__PURE__ */ React.createElement(gr, S1({
    color: "dimmed",
    className: Ds(Ms.description, Sn),
    ref: Qt,
    unstyled: er
  }, Yr), $n);
});
ys.displayName = "@mantine/core/InputDescription";
const ep = reactExports.createContext({
  offsetBottom: !1,
  offsetTop: !1,
  describedBy: void 0
}), R1 = ep.Provider, C1 = () => reactExports.useContext(ep);
function T1(_e, { hasDescription: Qt, hasError: Zt }) {
  const $n = _e.findIndex((Kn) => Kn === "input"), Sn = _e[$n - 1], kn = _e[$n + 1];
  return { offsetBottom: Qt && kn === "description" || Zt && kn === "error", offsetTop: Qt && Sn === "description" || Zt && Sn === "error" };
}
var A1 = Object.defineProperty, I1 = Object.defineProperties, N1 = Object.getOwnPropertyDescriptors, Ic = Object.getOwnPropertySymbols, j1 = Object.prototype.hasOwnProperty, M1 = Object.prototype.propertyIsEnumerable, Nc = (_e, Qt, Zt) => Qt in _e ? A1(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, D1 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    j1.call(Qt, Zt) && Nc(_e, Zt, Qt[Zt]);
  if (Ic)
    for (var Zt of Ic(Qt))
      M1.call(Qt, Zt) && Nc(_e, Zt, Qt[Zt]);
  return _e;
}, z1 = (_e, Qt) => I1(_e, N1(Qt)), L1 = Fe((_e) => ({
  root: z1(D1({}, _e.fn.fontStyles()), {
    lineHeight: _e.lineHeight
  })
}));
const F1 = L1;
var W1 = Object.defineProperty, V1 = Object.defineProperties, Y1 = Object.getOwnPropertyDescriptors, Ta = Object.getOwnPropertySymbols, tp = Object.prototype.hasOwnProperty, rp = Object.prototype.propertyIsEnumerable, jc = (_e, Qt, Zt) => Qt in _e ? W1(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Et = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    tp.call(Qt, Zt) && jc(_e, Zt, Qt[Zt]);
  if (Ta)
    for (var Zt of Ta(Qt))
      rp.call(Qt, Zt) && jc(_e, Zt, Qt[Zt]);
  return _e;
}, Mc = (_e, Qt) => V1(_e, Y1(Qt)), B1 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    tp.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Ta)
    for (var $n of Ta(_e))
      Qt.indexOf($n) < 0 && rp.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const H1 = {
  labelElement: "label",
  size: "sm",
  inputContainer: (_e) => _e,
  inputWrapperOrder: ["label", "description", "input", "error"]
}, np = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("InputWrapper", H1, _e), {
    className: $n,
    label: Sn,
    children: kn,
    required: Kn,
    id: er,
    error: Cr,
    description: kr,
    labelElement: Yr,
    labelProps: Ms,
    descriptionProps: Ds,
    errorProps: Ls,
    classNames: js,
    styles: zs,
    size: Fs,
    inputContainer: Bs,
    __staticSelector: Hs,
    unstyled: Ws,
    inputWrapperOrder: Ys,
    withAsterisk: El
  } = Zt, Mu = B1(Zt, [
    "className",
    "label",
    "children",
    "required",
    "id",
    "error",
    "description",
    "labelElement",
    "labelProps",
    "descriptionProps",
    "errorProps",
    "classNames",
    "styles",
    "size",
    "inputContainer",
    "__staticSelector",
    "unstyled",
    "inputWrapperOrder",
    "withAsterisk"
  ]), { classes: Pl, cx: Iu } = F1(null, {
    classNames: js,
    styles: zs,
    name: ["InputWrapper", Hs],
    unstyled: Ws
  }), Tu = {
    classNames: js,
    styles: zs,
    unstyled: Ws,
    size: Fs,
    __staticSelector: Hs
  }, Au = typeof El == "boolean" ? El : Kn, Nu = er ? `${er}-error` : Ls == null ? void 0 : Ls.id, gm = er ? `${er}-description` : Ds == null ? void 0 : Ds.id, pm = `${Cr && typeof Cr != "boolean" ? Nu : ""} ${kr ? gm : ""}`, zu = pm.trim().length > 0 ? pm.trim() : void 0, Yu = Sn && /* @__PURE__ */ React.createElement(vs, Et(Et({
    key: "label",
    labelElement: Yr,
    id: er ? `${er}-label` : void 0,
    htmlFor: er,
    required: Au
  }, Tu), Ms), Sn), sm = kr && /* @__PURE__ */ React.createElement(ys, Mc(Et(Et({
    key: "description"
  }, Ds), Tu), {
    size: (Ds == null ? void 0 : Ds.size) || Tu.size,
    id: (Ds == null ? void 0 : Ds.id) || gm
  }), kr), mm = /* @__PURE__ */ React.createElement(reactExports.Fragment, {
    key: "input"
  }, Bs(kn)), hm = typeof Cr != "boolean" && Cr && /* @__PURE__ */ React.createElement(gs, Mc(Et(Et({}, Ls), Tu), {
    size: (Ls == null ? void 0 : Ls.size) || Tu.size,
    key: "error",
    id: (Ls == null ? void 0 : Ls.id) || Nu
  }), Cr), ym = Ys.map((_m) => {
    switch (_m) {
      case "label":
        return Yu;
      case "input":
        return mm;
      case "description":
        return sm;
      case "error":
        return hm;
      default:
        return null;
    }
  });
  return /* @__PURE__ */ React.createElement(R1, {
    value: Et({
      describedBy: zu
    }, T1(Ys, {
      hasDescription: !!sm,
      hasError: !!hm
    }))
  }, /* @__PURE__ */ React.createElement(Le, Et({
    className: Iu(Pl.root, $n),
    ref: Qt
  }, Mu), ym));
});
np.displayName = "@mantine/core/InputWrapper";
var U1 = Object.defineProperty, Aa = Object.getOwnPropertySymbols, ap = Object.prototype.hasOwnProperty, ip = Object.prototype.propertyIsEnumerable, Dc = (_e, Qt, Zt) => Qt in _e ? U1(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, q1 = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    ap.call(Qt, Zt) && Dc(_e, Zt, Qt[Zt]);
  if (Aa)
    for (var Zt of Aa(Qt))
      ip.call(Qt, Zt) && Dc(_e, Zt, Qt[Zt]);
  return _e;
}, G1 = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    ap.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Aa)
    for (var $n of Aa(_e))
      Qt.indexOf($n) < 0 && ip.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const X1 = {}, op = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("InputPlaceholder", X1, _e), { sx: $n } = Zt, Sn = G1(Zt, ["sx"]);
  return /* @__PURE__ */ React.createElement(Le, q1({
    component: "span",
    sx: [(kn) => kn.fn.placeholderStyles(), ...lv($n)],
    ref: Qt
  }, Sn));
});
op.displayName = "@mantine/core/InputPlaceholder";
var K1 = Object.defineProperty, Q1 = Object.defineProperties, J1 = Object.getOwnPropertyDescriptors, zc = Object.getOwnPropertySymbols, Z1 = Object.prototype.hasOwnProperty, ew = Object.prototype.propertyIsEnumerable, Lc = (_e, Qt, Zt) => Qt in _e ? K1(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, zn = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Z1.call(Qt, Zt) && Lc(_e, Zt, Qt[Zt]);
  if (zc)
    for (var Zt of zc(Qt))
      ew.call(Qt, Zt) && Lc(_e, Zt, Qt[Zt]);
  return _e;
}, Ni = (_e, Qt) => Q1(_e, J1(Qt));
const qe = {
  xs: 30,
  sm: 36,
  md: 42,
  lg: 50,
  xl: 60
};
function tw({ theme: _e, variant: Qt }) {
  return Qt === "default" ? {
    border: `1px solid ${_e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[4]}`,
    backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.white,
    transition: "border-color 100ms ease",
    "&:focus, &:focus-within": _e.focusRingStyles.inputStyles(_e)
  } : Qt === "filled" ? {
    border: "1px solid transparent",
    backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[5] : _e.colors.gray[1],
    "&:focus, &:focus-within": _e.focusRingStyles.inputStyles(_e)
  } : {
    borderWidth: 0,
    color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
    backgroundColor: "transparent",
    minHeight: 28,
    outline: 0,
    "&:focus, &:focus-within": {
      outline: "none",
      borderColor: "transparent"
    },
    "&:disabled": {
      backgroundColor: "transparent",
      "&:focus, &:focus-within": {
        outline: "none",
        borderColor: "transparent"
      }
    }
  };
}
var rw = Fe((_e, {
  size: Qt,
  multiline: Zt,
  radius: $n,
  variant: Sn,
  invalid: kn,
  rightSectionWidth: Kn,
  withRightSection: er,
  iconWidth: Cr,
  offsetBottom: kr,
  offsetTop: Yr,
  pointer: Ms
}) => {
  const Ds = _e.fn.variant({ variant: "filled", color: "red" }).background, Ls = Sn === "default" || Sn === "filled" ? {
    minHeight: _e.fn.size({ size: Qt, sizes: qe }),
    paddingLeft: _e.fn.size({ size: Qt, sizes: qe }) / 3,
    paddingRight: er ? Kn : _e.fn.size({ size: Qt, sizes: qe }) / 3,
    borderRadius: _e.fn.radius($n)
  } : null;
  return {
    wrapper: {
      position: "relative",
      marginTop: Yr ? `calc(${_e.spacing.xs}px / 2)` : void 0,
      marginBottom: kr ? `calc(${_e.spacing.xs}px / 2)` : void 0
    },
    input: zn(Ni(zn(Ni(zn({}, _e.fn.fontStyles()), {
      height: Zt ? Sn === "unstyled" ? void 0 : "auto" : _e.fn.size({ size: Qt, sizes: qe }),
      WebkitTapHighlightColor: "transparent",
      lineHeight: Zt ? _e.lineHeight : `${_e.fn.size({ size: Qt, sizes: qe }) - 2}px`,
      appearance: "none",
      resize: "none",
      boxSizing: "border-box",
      fontSize: _e.fn.size({ size: Qt, sizes: _e.fontSizes }),
      width: "100%",
      color: _e.colorScheme === "dark" ? _e.colors.dark[0] : _e.black,
      display: "block",
      textAlign: "left",
      cursor: Ms ? "pointer" : void 0
    }), Ls), {
      "&:disabled": {
        backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[1],
        color: _e.colors.dark[2],
        opacity: 0.6,
        cursor: "not-allowed",
        "&::placeholder": {
          color: _e.colors.dark[2]
        }
      },
      "&::placeholder": Ni(zn({}, _e.fn.placeholderStyles()), {
        opacity: 1
      }),
      "&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration": {
        appearance: "none"
      },
      "&[type=number]": {
        MozAppearance: "textfield"
      }
    }), tw({ theme: _e, variant: Sn })),
    withIcon: {
      paddingLeft: typeof Cr == "number" ? Cr : _e.fn.size({ size: Qt, sizes: qe })
    },
    invalid: {
      color: Ds,
      borderColor: Ds,
      "&::placeholder": {
        opacity: 1,
        color: Ds
      }
    },
    disabled: {
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[1],
      color: _e.colors.dark[2],
      opacity: 0.6,
      cursor: "not-allowed",
      "&::placeholder": {
        color: _e.colors.dark[2]
      }
    },
    icon: {
      pointerEvents: "none",
      position: "absolute",
      zIndex: 1,
      left: 0,
      top: 0,
      bottom: 0,
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      width: typeof Cr == "number" ? Cr : _e.fn.size({ size: Qt, sizes: qe }),
      color: kn ? _e.colors.red[_e.colorScheme === "dark" ? 6 : 7] : _e.colorScheme === "dark" ? _e.colors.dark[2] : _e.colors.gray[5]
    },
    rightSection: {
      position: "absolute",
      top: 0,
      bottom: 0,
      right: 0,
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      width: Kn
    }
  };
});
const nw = rw;
var aw = Object.defineProperty, iw = Object.defineProperties, ow = Object.getOwnPropertyDescriptors, Ia = Object.getOwnPropertySymbols, sp = Object.prototype.hasOwnProperty, lp = Object.prototype.propertyIsEnumerable, Fc = (_e, Qt, Zt) => Qt in _e ? aw(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Ln = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    sp.call(Qt, Zt) && Fc(_e, Zt, Qt[Zt]);
  if (Ia)
    for (var Zt of Ia(Qt))
      lp.call(Qt, Zt) && Fc(_e, Zt, Qt[Zt]);
  return _e;
}, Wc = (_e, Qt) => iw(_e, ow(Qt)), sw = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    sp.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Ia)
    for (var $n of Ia(_e))
      Qt.indexOf($n) < 0 && lp.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const lw = {
  rightSectionWidth: 36,
  size: "sm",
  variant: "default"
}, Jt = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("Input", lw, _e), {
    className: $n,
    invalid: Sn,
    required: kn,
    disabled: Kn,
    variant: er,
    icon: Cr,
    style: kr,
    rightSectionWidth: Yr,
    iconWidth: Ms,
    rightSection: Ds,
    rightSectionProps: Ls,
    radius: js,
    size: zs,
    wrapperProps: Fs,
    classNames: Bs,
    styles: Hs,
    __staticSelector: Ws,
    multiline: Ys,
    sx: El,
    unstyled: Mu,
    pointer: Pl
  } = Zt, Iu = sw(Zt, [
    "className",
    "invalid",
    "required",
    "disabled",
    "variant",
    "icon",
    "style",
    "rightSectionWidth",
    "iconWidth",
    "rightSection",
    "rightSectionProps",
    "radius",
    "size",
    "wrapperProps",
    "classNames",
    "styles",
    "__staticSelector",
    "multiline",
    "sx",
    "unstyled",
    "pointer"
  ]), { offsetBottom: Tu, offsetTop: Au, describedBy: Nu } = C1(), { classes: gm, cx: pm } = nw({
    radius: js,
    size: zs,
    multiline: Ys,
    variant: er,
    invalid: Sn,
    rightSectionWidth: Yr,
    iconWidth: Ms,
    withRightSection: !!Ds,
    offsetBottom: Tu,
    offsetTop: Au,
    pointer: Pl
  }, { classNames: Bs, styles: Hs, name: ["Input", Ws], unstyled: Mu }), { systemStyles: zu, rest: Yu } = os(Iu);
  return /* @__PURE__ */ React.createElement(Le, Ln(Ln({
    className: pm(gm.wrapper, $n),
    sx: El,
    style: kr
  }, zu), Fs), Cr && /* @__PURE__ */ React.createElement("div", {
    className: gm.icon
  }, Cr), /* @__PURE__ */ React.createElement(Le, Wc(Ln({
    component: "input"
  }, Yu), {
    ref: Qt,
    required: kn,
    "aria-invalid": Sn,
    "aria-describedby": Nu,
    disabled: Kn,
    className: pm(gm[`${er}Variant`], gm.input, {
      [gm.withIcon]: Cr,
      [gm.invalid]: Sn,
      [gm.disabled]: Kn
    })
  })), Ds && /* @__PURE__ */ React.createElement("div", Wc(Ln({}, Ls), {
    className: gm.rightSection
  }), Ds));
});
Jt.displayName = "@mantine/core/Input";
Jt.Wrapper = np;
Jt.Label = vs;
Jt.Description = ys;
Jt.Error = gs;
Jt.Placeholder = op;
const ji = Jt;
var cw = Fe((_e, { orientation: Qt, buttonBorderWidth: Zt }) => ({
  root: {
    display: "flex",
    flexDirection: Qt === "vertical" ? "column" : "row",
    "& [data-button]": {
      "&:first-of-type": {
        borderBottomRightRadius: 0,
        [Qt === "vertical" ? "borderBottomLeftRadius" : "borderTopRightRadius"]: 0,
        [Qt === "vertical" ? "borderBottomWidth" : "borderRightWidth"]: Zt / 2
      },
      "&:last-of-type": {
        borderTopLeftRadius: 0,
        [Qt === "vertical" ? "borderTopRightRadius" : "borderBottomLeftRadius"]: 0,
        [Qt === "vertical" ? "borderTopWidth" : "borderLeftWidth"]: Zt / 2
      },
      "&:not(:first-of-type):not(:last-of-type)": {
        borderRadius: 0,
        [Qt === "vertical" ? "borderTopWidth" : "borderLeftWidth"]: Zt / 2,
        [Qt === "vertical" ? "borderBottomWidth" : "borderRightWidth"]: Zt / 2
      },
      "& + [data-button]": {
        [Qt === "vertical" ? "marginTop" : "marginLeft"]: -Zt,
        "@media (min-resolution: 192dpi)": {
          [Qt === "vertical" ? "marginTop" : "marginLeft"]: 0
        }
      }
    }
  }
}));
const uw = cw;
var fw = Object.defineProperty, Na = Object.getOwnPropertySymbols, cp = Object.prototype.hasOwnProperty, up = Object.prototype.propertyIsEnumerable, Vc = (_e, Qt, Zt) => Qt in _e ? fw(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, dw = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    cp.call(Qt, Zt) && Vc(_e, Zt, Qt[Zt]);
  if (Na)
    for (var Zt of Na(Qt))
      up.call(Qt, Zt) && Vc(_e, Zt, Qt[Zt]);
  return _e;
}, pw = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    cp.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Na)
    for (var $n of Na(_e))
      Qt.indexOf($n) < 0 && up.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const mw = {
  orientation: "horizontal",
  buttonBorderWidth: 1
}, fp = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("ButtonGroup", mw, _e), { className: $n, orientation: Sn, buttonBorderWidth: kn, unstyled: Kn } = Zt, er = pw(Zt, ["className", "orientation", "buttonBorderWidth", "unstyled"]), { classes: Cr, cx: kr } = uw({ orientation: Sn, buttonBorderWidth: kn }, { name: "ButtonGroup", unstyled: Kn });
  return /* @__PURE__ */ React.createElement(Le, dw({
    className: kr(Cr.root, $n),
    ref: Qt
  }, er));
});
fp.displayName = "@mantine/core/ButtonGroup";
var hw = Object.defineProperty, vw = Object.defineProperties, gw = Object.getOwnPropertyDescriptors, Yc = Object.getOwnPropertySymbols, yw = Object.prototype.hasOwnProperty, bw = Object.prototype.propertyIsEnumerable, Bc = (_e, Qt, Zt) => Qt in _e ? hw(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Wt = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    yw.call(Qt, Zt) && Bc(_e, Zt, Qt[Zt]);
  if (Yc)
    for (var Zt of Yc(Qt))
      bw.call(Qt, Zt) && Bc(_e, Zt, Qt[Zt]);
  return _e;
}, yo = (_e, Qt) => vw(_e, gw(Qt));
const bo = {
  xs: { height: qe.xs, paddingLeft: 14, paddingRight: 14 },
  sm: { height: qe.sm, paddingLeft: 18, paddingRight: 18 },
  md: { height: qe.md, paddingLeft: 22, paddingRight: 22 },
  lg: { height: qe.lg, paddingLeft: 26, paddingRight: 26 },
  xl: { height: qe.xl, paddingLeft: 32, paddingRight: 32 },
  "compact-xs": { height: 22, paddingLeft: 7, paddingRight: 7 },
  "compact-sm": { height: 26, paddingLeft: 8, paddingRight: 8 },
  "compact-md": { height: 30, paddingLeft: 10, paddingRight: 10 },
  "compact-lg": { height: 34, paddingLeft: 12, paddingRight: 12 },
  "compact-xl": { height: 40, paddingLeft: 14, paddingRight: 14 }
};
function ww({ compact: _e, size: Qt, withLeftIcon: Zt, withRightIcon: $n }) {
  if (_e)
    return bo[`compact-${Qt}`];
  const Sn = bo[Qt];
  return yo(Wt({}, Sn), {
    paddingLeft: Zt ? Sn.paddingLeft / 1.5 : Sn.paddingLeft,
    paddingRight: $n ? Sn.paddingRight / 1.5 : Sn.paddingRight
  });
}
const _w = (_e) => ({
  display: _e ? "block" : "inline-block",
  width: _e ? "100%" : "auto"
});
function xw({ variant: _e, theme: Qt, color: Zt, gradient: $n }) {
  const Sn = Qt.fn.variant({ color: Zt, variant: _e, gradient: $n });
  return _e === "gradient" ? {
    border: 0,
    backgroundImage: Sn.background,
    color: Sn.color,
    "&:hover": Qt.fn.hover({
      backgroundSize: "200%"
    })
  } : Wt({
    border: `1px solid ${Sn.border}`,
    backgroundColor: Sn.background,
    color: Sn.color
  }, Qt.fn.hover({
    backgroundColor: Sn.hover
  }));
}
var Ow = Fe((_e, {
  color: Qt,
  size: Zt,
  radius: $n,
  fullWidth: Sn,
  compact: kn,
  gradient: Kn,
  variant: er,
  withLeftIcon: Cr,
  withRightIcon: kr
}) => ({
  root: yo(Wt(yo(Wt(Wt(Wt(Wt({}, ww({ compact: kn, size: Zt, withLeftIcon: Cr, withRightIcon: kr })), _e.fn.fontStyles()), _e.fn.focusStyles()), _w(Sn)), {
    borderRadius: _e.fn.radius($n),
    fontWeight: 600,
    position: "relative",
    lineHeight: 1,
    fontSize: _e.fn.size({ size: Zt, sizes: _e.fontSizes }),
    userSelect: "none",
    cursor: "pointer"
  }), xw({ variant: er, theme: _e, color: Qt, gradient: Kn })), {
    "&:active": _e.activeStyles,
    "&:disabled, &[data-disabled]": {
      borderColor: "transparent",
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[4] : _e.colors.gray[2],
      color: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[5],
      cursor: "not-allowed",
      backgroundImage: "none",
      pointerEvents: "none",
      "&:active": {
        transform: "none"
      }
    },
    "&[data-loading]": {
      pointerEvents: "none",
      "&::before": {
        content: '""',
        position: "absolute",
        top: -1,
        left: -1,
        right: -1,
        bottom: -1,
        backgroundColor: _e.colorScheme === "dark" ? _e.fn.rgba(_e.colors.dark[7], 0.5) : "rgba(255, 255, 255, .5)",
        borderRadius: _e.fn.radius($n),
        cursor: "not-allowed"
      }
    }
  }),
  icon: {
    display: "flex",
    alignItems: "center"
  },
  leftIcon: {
    marginRight: 10
  },
  rightIcon: {
    marginLeft: 10
  },
  centerLoader: {
    position: "absolute",
    left: "50%",
    transform: "translateX(-50%)",
    opacity: 0.5
  },
  inner: {
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    height: "100%",
    overflow: "visible"
  },
  label: {
    whiteSpace: "nowrap",
    height: "100%",
    overflow: "hidden",
    display: "flex",
    alignItems: "center"
  }
}));
const Pw = Ow;
var Ew = Object.defineProperty, ja = Object.getOwnPropertySymbols, dp = Object.prototype.hasOwnProperty, pp = Object.prototype.propertyIsEnumerable, Hc = (_e, Qt, Zt) => Qt in _e ? Ew(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Uc = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    dp.call(Qt, Zt) && Hc(_e, Zt, Qt[Zt]);
  if (ja)
    for (var Zt of ja(Qt))
      pp.call(Qt, Zt) && Hc(_e, Zt, Qt[Zt]);
  return _e;
}, Sw = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    dp.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && ja)
    for (var $n of ja(_e))
      Qt.indexOf($n) < 0 && pp.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const $w = {
  size: "sm",
  type: "button",
  variant: "filled",
  loaderPosition: "left"
}, bs = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("Button", $w, _e), {
    className: $n,
    size: Sn,
    color: kn,
    type: Kn,
    disabled: er,
    children: Cr,
    leftIcon: kr,
    rightIcon: Yr,
    fullWidth: Ms,
    variant: Ds,
    radius: Ls,
    uppercase: js,
    compact: zs,
    loading: Fs,
    loaderPosition: Bs,
    loaderProps: Hs,
    gradient: Ws,
    classNames: Ys,
    styles: El,
    unstyled: Mu
  } = Zt, Pl = Sw(Zt, [
    "className",
    "size",
    "color",
    "type",
    "disabled",
    "children",
    "leftIcon",
    "rightIcon",
    "fullWidth",
    "variant",
    "radius",
    "uppercase",
    "compact",
    "loading",
    "loaderPosition",
    "loaderProps",
    "gradient",
    "classNames",
    "styles",
    "unstyled"
  ]), { classes: Iu, cx: Tu, theme: Au } = Pw({
    radius: Ls,
    color: kn,
    size: Sn,
    fullWidth: Ms,
    compact: zs,
    gradient: Ws,
    variant: Ds,
    withLeftIcon: !!kr,
    withRightIcon: !!Yr
  }, { name: "Button", unstyled: Mu, classNames: Ys, styles: El }), Nu = Au.fn.variant({ color: kn, variant: Ds }), gm = /* @__PURE__ */ React.createElement(cd, Uc({
    color: Nu.color,
    size: Au.fn.size({ size: Sn, sizes: bo }).height / 2
  }, Hs));
  return /* @__PURE__ */ React.createElement(ob, Uc({
    className: Tu(Iu.root, $n),
    type: Kn,
    disabled: er,
    "data-button": !0,
    "data-disabled": er || void 0,
    "data-loading": Fs || void 0,
    ref: Qt,
    unstyled: Mu
  }, Pl), /* @__PURE__ */ React.createElement("div", {
    className: Iu.inner
  }, (kr || Fs && Bs === "left") && /* @__PURE__ */ React.createElement("span", {
    className: Tu(Iu.icon, Iu.leftIcon)
  }, Fs && Bs === "left" ? gm : kr), Fs && Bs === "center" && /* @__PURE__ */ React.createElement("span", {
    className: Iu.centerLoader
  }, gm), /* @__PURE__ */ React.createElement("span", {
    className: Iu.label,
    style: { textTransform: js ? "uppercase" : void 0 }
  }, Cr), (Yr || Fs && Bs === "right") && /* @__PURE__ */ React.createElement("span", {
    className: Tu(Iu.icon, Iu.rightIcon)
  }, Fs && Bs === "right" ? gm : Yr)));
});
bs.displayName = "@mantine/core/Button";
bs.Group = fp;
const qc = bs;
function kw(_e) {
  return reactExports.Children.toArray(_e).filter(Boolean);
}
const Rw = {
  left: "flex-start",
  center: "center",
  right: "flex-end",
  apart: "space-between"
};
var Cw = Fe((_e, { spacing: Qt, position: Zt, noWrap: $n, grow: Sn, align: kn, count: Kn }) => ({
  root: {
    boxSizing: "border-box",
    display: "flex",
    flexDirection: "row",
    alignItems: kn || "center",
    flexWrap: $n ? "nowrap" : "wrap",
    justifyContent: Rw[Zt],
    gap: _e.fn.size({ size: Qt, sizes: _e.spacing }),
    "& > *": {
      boxSizing: "border-box",
      maxWidth: Sn ? `calc(${100 / Kn}% - ${_e.fn.size({ size: Qt, sizes: _e.spacing }) - _e.fn.size({ size: Qt, sizes: _e.spacing }) / Kn}px)` : void 0,
      flexGrow: Sn ? 1 : 0
    }
  }
}));
const Tw = Cw;
var Aw = Object.defineProperty, Ma = Object.getOwnPropertySymbols, mp = Object.prototype.hasOwnProperty, hp = Object.prototype.propertyIsEnumerable, Gc = (_e, Qt, Zt) => Qt in _e ? Aw(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Iw = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    mp.call(Qt, Zt) && Gc(_e, Zt, Qt[Zt]);
  if (Ma)
    for (var Zt of Ma(Qt))
      hp.call(Qt, Zt) && Gc(_e, Zt, Qt[Zt]);
  return _e;
}, Nw = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    mp.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Ma)
    for (var $n of Ma(_e))
      Qt.indexOf($n) < 0 && hp.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const jw = {
  position: "left",
  spacing: "md"
}, ws = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("Group", jw, _e), { className: $n, position: Sn, align: kn, children: Kn, noWrap: er, grow: Cr, spacing: kr, unstyled: Yr } = Zt, Ms = Nw(Zt, ["className", "position", "align", "children", "noWrap", "grow", "spacing", "unstyled"]), Ds = kw(Kn), { classes: Ls, cx: js } = Tw({
    align: kn,
    grow: Cr,
    noWrap: er,
    spacing: kr,
    position: Sn,
    count: Ds.length
  }, { unstyled: Yr, name: "Group" });
  return /* @__PURE__ */ React.createElement(Le, Iw({
    className: js(Ls.root, $n),
    ref: Qt
  }, Ms), Ds);
});
ws.displayName = "@mantine/core/Group";
var Mw = Fe((_e, { spacing: Qt, align: Zt, justify: $n }) => ({
  root: {
    display: "flex",
    flexDirection: "column",
    alignItems: Zt,
    justifyContent: $n,
    gap: _e.fn.size({ size: Qt, sizes: _e.spacing })
  }
}));
const Dw = Mw;
var zw = Object.defineProperty, Da = Object.getOwnPropertySymbols, vp = Object.prototype.hasOwnProperty, gp = Object.prototype.propertyIsEnumerable, Xc = (_e, Qt, Zt) => Qt in _e ? zw(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Lw = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    vp.call(Qt, Zt) && Xc(_e, Zt, Qt[Zt]);
  if (Da)
    for (var Zt of Da(Qt))
      gp.call(Qt, Zt) && Xc(_e, Zt, Qt[Zt]);
  return _e;
}, Fw = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    vp.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Da)
    for (var $n of Da(_e))
      Qt.indexOf($n) < 0 && gp.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const Ww = {
  spacing: "md",
  align: "stretch",
  justify: "flex-start"
}, fn = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("Stack", Ww, _e), { spacing: $n, className: Sn, align: kn, justify: Kn, unstyled: er } = Zt, Cr = Fw(Zt, ["spacing", "className", "align", "justify", "unstyled"]), { classes: kr, cx: Yr } = Dw({ spacing: $n, align: kn, justify: Kn }, { name: "Stack", unstyled: er });
  return /* @__PURE__ */ React.createElement(Le, Lw({
    className: Yr(kr.root, Sn),
    ref: Qt
  }, Cr));
});
fn.displayName = "@mantine/core/Stack";
function Vw(_e, Qt) {
  if (_e == null)
    return {};
  var Zt = {}, $n = Object.keys(_e), Sn, kn;
  for (kn = 0; kn < $n.length; kn++)
    Sn = $n[kn], !(Qt.indexOf(Sn) >= 0) && (Zt[Sn] = _e[Sn]);
  return Zt;
}
var Yw = reactExports.useLayoutEffect, Bw = function(_e) {
  var Qt = reactExports.useRef(_e);
  return Yw(function() {
    Qt.current = _e;
  }), Qt;
}, Kc = function(_e, Qt) {
  if (typeof _e == "function") {
    _e(Qt);
    return;
  }
  _e.current = Qt;
}, Hw = function(_e, Qt) {
  var Zt = reactExports.useRef();
  return reactExports.useCallback(function($n) {
    _e.current = $n, Zt.current && Kc(Zt.current, null), Zt.current = Qt, Qt && Kc(Qt, $n);
  }, [Qt]);
}, Qc = {
  "min-height": "0",
  "max-height": "none",
  height: "0",
  visibility: "hidden",
  overflow: "hidden",
  position: "absolute",
  "z-index": "-1000",
  top: "0",
  right: "0"
}, Jc = function(_e) {
  Object.keys(Qc).forEach(function(Qt) {
    _e.style.setProperty(Qt, Qc[Qt], "important");
  });
}, We = null, Uw = function(_e, Qt) {
  var Zt = _e.scrollHeight;
  return Qt.sizingStyle.boxSizing === "border-box" ? Zt + Qt.borderSize : Zt - Qt.paddingSize;
};
function qw(_e, Qt, Zt, $n) {
  Zt === void 0 && (Zt = 1), $n === void 0 && ($n = 1 / 0), We || (We = document.createElement("textarea"), We.setAttribute("tabindex", "-1"), We.setAttribute("aria-hidden", "true"), Jc(We)), We.parentNode === null && document.body.appendChild(We);
  var Sn = _e.paddingSize, kn = _e.borderSize, Kn = _e.sizingStyle, er = Kn.boxSizing;
  Object.keys(Kn).forEach(function(Ds) {
    var Ls = Ds;
    We.style[Ls] = Kn[Ls];
  }), Jc(We), We.value = Qt;
  var Cr = Uw(We, _e);
  We.value = "x";
  var kr = We.scrollHeight - Sn, Yr = kr * Zt;
  er === "border-box" && (Yr = Yr + Sn + kn), Cr = Math.max(Yr, Cr);
  var Ms = kr * $n;
  return er === "border-box" && (Ms = Ms + Sn + kn), Cr = Math.min(Ms, Cr), [Cr, kr];
}
var Zc = function() {
}, Gw = function(_e, Qt) {
  return _e.reduce(function(Zt, $n) {
    return Zt[$n] = Qt[$n], Zt;
  }, {});
}, Xw = [
  "borderBottomWidth",
  "borderLeftWidth",
  "borderRightWidth",
  "borderTopWidth",
  "boxSizing",
  "fontFamily",
  "fontSize",
  "fontStyle",
  "fontWeight",
  "letterSpacing",
  "lineHeight",
  "paddingBottom",
  "paddingLeft",
  "paddingRight",
  "paddingTop",
  // non-standard
  "tabSize",
  "textIndent",
  // non-standard
  "textRendering",
  "textTransform",
  "width",
  "wordBreak"
], Kw = !!document.documentElement.currentStyle, Qw = function(_e) {
  var Qt = window.getComputedStyle(_e);
  if (Qt === null)
    return null;
  var Zt = Gw(Xw, Qt), $n = Zt.boxSizing;
  if ($n === "")
    return null;
  Kw && $n === "border-box" && (Zt.width = parseFloat(Zt.width) + parseFloat(Zt.borderRightWidth) + parseFloat(Zt.borderLeftWidth) + parseFloat(Zt.paddingRight) + parseFloat(Zt.paddingLeft) + "px");
  var Sn = parseFloat(Zt.paddingBottom) + parseFloat(Zt.paddingTop), kn = parseFloat(Zt.borderBottomWidth) + parseFloat(Zt.borderTopWidth);
  return {
    sizingStyle: Zt,
    paddingSize: Sn,
    borderSize: kn
  };
}, Jw = function(_e) {
  var Qt = Bw(_e);
  reactExports.useLayoutEffect(function() {
    var Zt = function($n) {
      Qt.current($n);
    };
    return window.addEventListener("resize", Zt), function() {
      window.removeEventListener("resize", Zt);
    };
  }, []);
}, Zw = function(_e, Qt) {
  var Zt = _e.cacheMeasurements, $n = _e.maxRows, Sn = _e.minRows, kn = _e.onChange, Kn = kn === void 0 ? Zc : kn, er = _e.onHeightChange, Cr = er === void 0 ? Zc : er, kr = Vw(_e, ["cacheMeasurements", "maxRows", "minRows", "onChange", "onHeightChange"]), Yr = kr.value !== void 0, Ms = reactExports.useRef(null), Ds = Hw(Ms, Qt), Ls = reactExports.useRef(0), js = reactExports.useRef(), zs = function() {
    var Bs = Ms.current, Hs = Zt && js.current ? js.current : Qw(Bs);
    if (Hs) {
      js.current = Hs;
      var Ws = qw(Hs, Bs.value || Bs.placeholder || "x", Sn, $n), Ys = Ws[0], El = Ws[1];
      Ls.current !== Ys && (Ls.current = Ys, Bs.style.setProperty("height", Ys + "px", "important"), Cr(Ys, {
        rowHeight: El
      }));
    }
  }, Fs = function(Bs) {
    Yr || zs(), Kn(Bs);
  };
  return reactExports.useLayoutEffect(zs), Jw(zs), /* @__PURE__ */ reactExports.createElement("textarea", po({}, kr, {
    onChange: Fs,
    ref: Ds
  }));
}, e_ = /* @__PURE__ */ reactExports.forwardRef(Zw);
const t_ = e_;
var r_ = Fe((_e) => ({
  input: {
    paddingTop: _e.spacing.xs,
    paddingBottom: _e.spacing.xs
  }
}));
const n_ = r_;
var a_ = Object.defineProperty, i_ = Object.defineProperties, o_ = Object.getOwnPropertyDescriptors, za = Object.getOwnPropertySymbols, yp = Object.prototype.hasOwnProperty, bp = Object.prototype.propertyIsEnumerable, eu = (_e, Qt, Zt) => Qt in _e ? a_(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, nr = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    yp.call(Qt, Zt) && eu(_e, Zt, Qt[Zt]);
  if (za)
    for (var Zt of za(Qt))
      bp.call(Qt, Zt) && eu(_e, Zt, Qt[Zt]);
  return _e;
}, Mi = (_e, Qt) => i_(_e, o_(Qt)), s_ = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    yp.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && za)
    for (var $n of za(_e))
      Qt.indexOf($n) < 0 && bp.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const l_ = {
  autosize: !1,
  size: "sm",
  __staticSelector: "Textarea"
}, wp = reactExports.forwardRef((_e, Qt) => {
  const Zt = Pe("Textarea", l_, _e), {
    autosize: $n,
    maxRows: Sn,
    minRows: kn,
    label: Kn,
    error: er,
    description: Cr,
    id: kr,
    className: Yr,
    required: Ms,
    style: Ds,
    wrapperProps: Ls,
    classNames: js,
    styles: zs,
    size: Fs,
    __staticSelector: Bs,
    sx: Hs,
    errorProps: Ws,
    descriptionProps: Ys,
    labelProps: El,
    inputWrapperOrder: Mu,
    inputContainer: Pl,
    unstyled: Iu,
    withAsterisk: Tu
  } = Zt, Au = s_(Zt, [
    "autosize",
    "maxRows",
    "minRows",
    "label",
    "error",
    "description",
    "id",
    "className",
    "required",
    "style",
    "wrapperProps",
    "classNames",
    "styles",
    "size",
    "__staticSelector",
    "sx",
    "errorProps",
    "descriptionProps",
    "labelProps",
    "inputWrapperOrder",
    "inputContainer",
    "unstyled",
    "withAsterisk"
  ]), Nu = is(kr), { classes: gm, cx: pm } = n_(), { systemStyles: zu, rest: Yu } = os(Au), sm = nr({
    required: Ms,
    ref: Qt,
    invalid: !!er,
    id: Nu,
    classNames: Mi(nr({}, js), { input: pm(gm.input, js == null ? void 0 : js.input) }),
    styles: zs,
    __staticSelector: Bs,
    size: Fs,
    multiline: !0,
    unstyled: Iu
  }, Yu);
  return /* @__PURE__ */ React.createElement(ji.Wrapper, nr(nr({
    label: Kn,
    error: er,
    id: Nu,
    description: Cr,
    required: Ms,
    style: Ds,
    className: Yr,
    classNames: js,
    styles: zs,
    size: Fs,
    __staticSelector: Bs,
    sx: Hs,
    errorProps: Ws,
    labelProps: El,
    descriptionProps: Ys,
    inputContainer: Pl,
    inputWrapperOrder: Mu,
    unstyled: Iu,
    withAsterisk: Tu
  }, zu), Ls), $n ? /* @__PURE__ */ React.createElement(ji, Mi(nr({}, sm), {
    component: t_,
    maxRows: Sn,
    minRows: kn
  })) : /* @__PURE__ */ React.createElement(ji, Mi(nr({}, sm), {
    component: "textarea",
    rows: kn
  })));
});
wp.displayName = "@mantine/core/Textarea";
const _p = reactExports.createContext(!1), c_ = _p.Provider, u_ = () => reactExports.useContext(_p);
function xp({ children: _e, openDelay: Qt = 0, closeDelay: Zt = 0 }) {
  return /* @__PURE__ */ React.createElement(c_, {
    value: !0
  }, /* @__PURE__ */ React.createElement(m0, {
    delay: { open: Qt, close: Zt }
  }, _e));
}
xp.displayName = "@mantine/core/TooltipGroup";
var f_ = Object.defineProperty, d_ = Object.defineProperties, p_ = Object.getOwnPropertyDescriptors, tu = Object.getOwnPropertySymbols, m_ = Object.prototype.hasOwnProperty, h_ = Object.prototype.propertyIsEnumerable, ru = (_e, Qt, Zt) => Qt in _e ? f_(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, nu = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    m_.call(Qt, Zt) && ru(_e, Zt, Qt[Zt]);
  if (tu)
    for (var Zt of tu(Qt))
      h_.call(Qt, Zt) && ru(_e, Zt, Qt[Zt]);
  return _e;
}, v_ = (_e, Qt) => d_(_e, p_(Qt));
function g_(_e, Qt) {
  if (!Qt)
    return {
      backgroundColor: _e.colorScheme === "dark" ? _e.colors.dark[6] : _e.colors.gray[9],
      color: _e.white
    };
  const Zt = _e.fn.variant({ variant: "filled", color: Qt, primaryFallback: !1 });
  return {
    backgroundColor: Zt.background,
    color: Zt.color
  };
}
var y_ = Fe((_e, { color: Qt, radius: Zt, width: $n, multiline: Sn }) => ({
  tooltip: v_(nu(nu({}, _e.fn.fontStyles()), g_(_e, Qt)), {
    lineHeight: _e.lineHeight,
    fontSize: _e.fontSizes.sm,
    borderRadius: _e.fn.radius(Zt),
    padding: `calc(${_e.spacing.xs}px / 2) ${_e.spacing.xs}px`,
    position: "absolute",
    whiteSpace: Sn ? "unset" : "nowrap",
    pointerEvents: "none",
    width: $n
  }),
  arrow: {
    backgroundColor: "inherit",
    border: 0,
    zIndex: 1
  }
}));
const Op = y_, Pp = {
  children: "Tooltip component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported"
};
function b_({
  offset: _e,
  position: Qt
}) {
  const [Zt, $n] = reactExports.useState(!1), Sn = reactExports.useRef(), { x: kn, y: Kn, reference: er, floating: Cr, refs: kr, update: Yr, placement: Ms } = ps({
    placement: Qt,
    middleware: [
      us({
        crossAxis: !0,
        padding: 5,
        rootBoundary: "document"
      })
    ]
  }), Ds = Ms.includes("right") ? _e : Qt.includes("left") ? _e * -1 : 0, Ls = Ms.includes("bottom") ? _e : Qt.includes("top") ? _e * -1 : 0, js = reactExports.useCallback(({ clientX: zs, clientY: Fs }) => {
    er({
      getBoundingClientRect() {
        return {
          width: 0,
          height: 0,
          x: zs,
          y: Fs,
          left: zs + Ds,
          top: Fs + Ls,
          right: zs,
          bottom: Fs
        };
      }
    });
  }, [er]);
  return reactExports.useEffect(() => {
    if (kr.floating.current) {
      const zs = Sn.current;
      zs.addEventListener("mousemove", js);
      const Fs = gt$2(kr.floating.current);
      return Fs.forEach((Bs) => {
        Bs.addEventListener("scroll", Yr);
      }), () => {
        zs.removeEventListener("mousemove", js), Fs.forEach((Bs) => {
          Bs.removeEventListener("scroll", Yr);
        });
      };
    }
  }, [er, kr.floating.current, Yr, js, Zt]), { handleMouseMove: js, x: kn, y: Kn, opened: Zt, setOpened: $n, boundaryRef: Sn, floating: Cr };
}
var w_ = Object.defineProperty, __ = Object.defineProperties, x_ = Object.getOwnPropertyDescriptors, La = Object.getOwnPropertySymbols, Ep = Object.prototype.hasOwnProperty, Sp = Object.prototype.propertyIsEnumerable, au = (_e, Qt, Zt) => Qt in _e ? w_(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Di = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    Ep.call(Qt, Zt) && au(_e, Zt, Qt[Zt]);
  if (La)
    for (var Zt of La(Qt))
      Sp.call(Qt, Zt) && au(_e, Zt, Qt[Zt]);
  return _e;
}, zi = (_e, Qt) => __(_e, x_(Qt)), O_ = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    Ep.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && La)
    for (var $n of La(_e))
      Qt.indexOf($n) < 0 && Sp.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const P_ = {
  refProp: "ref",
  withinPortal: !0,
  offset: 10,
  position: "right",
  zIndex: as("popover")
};
function $p(_e) {
  var Qt;
  const Zt = Pe("TooltipFloating", P_, _e), {
    children: $n,
    refProp: Sn,
    withinPortal: kn,
    style: Kn,
    className: er,
    classNames: Cr,
    styles: kr,
    unstyled: Yr,
    radius: Ms,
    color: Ds,
    label: Ls,
    offset: js,
    position: zs,
    multiline: Fs,
    width: Bs,
    zIndex: Hs,
    disabled: Ws
  } = Zt, Ys = O_(Zt, [
    "children",
    "refProp",
    "withinPortal",
    "style",
    "className",
    "classNames",
    "styles",
    "unstyled",
    "radius",
    "color",
    "label",
    "offset",
    "position",
    "multiline",
    "width",
    "zIndex",
    "disabled"
  ]), { handleMouseMove: El, x: Mu, y: Pl, opened: Iu, boundaryRef: Tu, floating: Au, setOpened: Nu } = b_({
    offset: js,
    position: zs
  }), { classes: gm, cx: pm } = Op({ radius: Ms, color: Ds, multiline: Fs, width: Bs }, { name: "TooltipFloating", classNames: Cr, styles: kr, unstyled: Yr });
  if (!ti($n))
    throw new Error(Pp.children);
  const zu = ii(Tu, $n.ref), Yu = (mm) => {
    var hm, ym;
    (ym = (hm = $n.props).onMouseEnter) == null || ym.call(hm, mm), El(mm), Nu(!0);
  }, sm = (mm) => {
    var hm, ym;
    (ym = (hm = $n.props).onMouseLeave) == null || ym.call(hm, mm), Nu(!1);
  };
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(oi, {
    withinPortal: kn
  }, /* @__PURE__ */ React.createElement(Le, zi(Di({}, Ys), {
    ref: Au,
    className: pm(gm.tooltip, er),
    style: zi(Di({}, Kn), {
      zIndex: Hs,
      display: !Ws && Iu ? "block" : "none",
      top: Pl ?? "",
      left: (Qt = Math.round(Mu)) != null ? Qt : ""
    })
  }), Ls)), reactExports.cloneElement($n, zi(Di({}, $n.props), {
    [Sn]: zu,
    onMouseEnter: Yu,
    onMouseLeave: sm
  })));
}
$p.displayName = "@mantine/core/TooltipFloating";
function E_(_e) {
  const [Qt, Zt] = reactExports.useState(!1), $n = typeof _e.opened == "boolean" ? _e.opened : Qt, Sn = u_(), kn = is(), { delay: Kn, currentId: er, setCurrentId: Cr } = Id(), kr = reactExports.useCallback((Mu) => {
    Zt(Mu), Mu && Cr(kn);
  }, [Cr, kn]), {
    x: Yr,
    y: Ms,
    reference: Ds,
    floating: Ls,
    context: js,
    refs: zs,
    update: Fs,
    placement: Bs,
    middlewareData: { arrow: { x: Hs, y: Ws } = {} }
  } = ps({
    placement: _e.position,
    open: $n,
    onOpenChange: kr,
    middleware: [
      yd(_e.offset),
      us({ padding: 8 }),
      vd(),
      kd({ element: _e.arrowRef, padding: _e.arrowOffset }),
      ..._e.inline ? [gd()] : []
    ]
  }), { getReferenceProps: Ys, getFloatingProps: El } = S0([
    p0(js, {
      enabled: _e.events.hover,
      delay: Sn ? Kn : { open: _e.openDelay, close: _e.closeDelay },
      mouseOnly: !_e.events.touch
    }),
    P0(js, { enabled: _e.events.focus, keyboardOnly: !0 }),
    E0(js, { role: "tooltip" }),
    O0(js, { enabled: typeof _e.opened === void 0 }),
    h0(js, { id: kn })
  ]);
  return jd({
    opened: $n,
    positionDependencies: _e.positionDependencies,
    floating: { refs: zs, update: Fs }
  }), vr(() => {
    var Mu;
    (Mu = _e.onPositionChange) == null || Mu.call(_e, Bs);
  }, [Bs]), {
    x: Yr,
    y: Ms,
    arrowX: Hs,
    arrowY: Ws,
    reference: Ds,
    floating: Ls,
    getFloatingProps: El,
    getReferenceProps: Ys,
    isGroupPhase: $n && er && er !== kn,
    opened: $n,
    placement: Bs
  };
}
var S_ = Object.defineProperty, $_ = Object.defineProperties, k_ = Object.getOwnPropertyDescriptors, Fa = Object.getOwnPropertySymbols, kp = Object.prototype.hasOwnProperty, Rp = Object.prototype.propertyIsEnumerable, iu = (_e, Qt, Zt) => Qt in _e ? S_(_e, Qt, { enumerable: !0, configurable: !0, writable: !0, value: Zt }) : _e[Qt] = Zt, Lr = (_e, Qt) => {
  for (var Zt in Qt || (Qt = {}))
    kp.call(Qt, Zt) && iu(_e, Zt, Qt[Zt]);
  if (Fa)
    for (var Zt of Fa(Qt))
      Rp.call(Qt, Zt) && iu(_e, Zt, Qt[Zt]);
  return _e;
}, R_ = (_e, Qt) => $_(_e, k_(Qt)), C_ = (_e, Qt) => {
  var Zt = {};
  for (var $n in _e)
    kp.call(_e, $n) && Qt.indexOf($n) < 0 && (Zt[$n] = _e[$n]);
  if (_e != null && Fa)
    for (var $n of Fa(_e))
      Qt.indexOf($n) < 0 && Rp.call(_e, $n) && (Zt[$n] = _e[$n]);
  return Zt;
};
const T_ = {
  position: "top",
  refProp: "ref",
  withinPortal: !1,
  inline: !1,
  arrowSize: 4,
  arrowOffset: 5,
  arrowRadius: 0,
  arrowPosition: "side",
  offset: 5,
  transition: "fade",
  transitionDuration: 100,
  width: "auto",
  events: { hover: !0, focus: !1, touch: !1 },
  zIndex: as("popover"),
  positionDependencies: []
}, ci = reactExports.forwardRef((_e, Qt) => {
  const Zt = reactExports.useRef(null), $n = Pe("Tooltip", T_, _e), {
    children: Sn,
    position: kn,
    refProp: Kn,
    label: er,
    openDelay: Cr,
    closeDelay: kr,
    onPositionChange: Yr,
    opened: Ms,
    withinPortal: Ds,
    radius: Ls,
    color: js,
    classNames: zs,
    styles: Fs,
    unstyled: Bs,
    style: Hs,
    className: Ws,
    withArrow: Ys,
    arrowSize: El,
    arrowOffset: Mu,
    arrowRadius: Pl,
    arrowPosition: Iu,
    offset: Tu,
    transition: Au,
    transitionDuration: Nu,
    multiline: gm,
    width: pm,
    events: zu,
    zIndex: Yu,
    disabled: sm,
    positionDependencies: mm,
    onClick: hm,
    onMouseEnter: ym,
    onMouseLeave: _m,
    inline: Sm
  } = $n, wm = C_($n, [
    "children",
    "position",
    "refProp",
    "label",
    "openDelay",
    "closeDelay",
    "onPositionChange",
    "opened",
    "withinPortal",
    "radius",
    "color",
    "classNames",
    "styles",
    "unstyled",
    "style",
    "className",
    "withArrow",
    "arrowSize",
    "arrowOffset",
    "arrowRadius",
    "arrowPosition",
    "offset",
    "transition",
    "transitionDuration",
    "multiline",
    "width",
    "events",
    "zIndex",
    "disabled",
    "positionDependencies",
    "onClick",
    "onMouseEnter",
    "onMouseLeave",
    "inline"
  ]), { classes: Nm, cx: Cm, theme: Im } = Op({ radius: Ls, color: js, width: pm, multiline: gm }, { name: "Tooltip", classNames: zs, styles: Fs, unstyled: Bs }), Am = E_({
    position: qd(Im.dir, kn),
    closeDelay: kr,
    openDelay: Cr,
    onPositionChange: Yr,
    opened: Ms,
    events: zu,
    arrowRef: Zt,
    arrowOffset: Mu,
    offset: Tu + (Ys ? El / 2 : 0),
    positionDependencies: [...mm, Sn],
    inline: Sm
  });
  if (!ti(Sn))
    throw new Error(Pp.children);
  const Vm = ii(Am.reference, Sn.ref, Qt);
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(oi, {
    withinPortal: Ds
  }, /* @__PURE__ */ React.createElement(ms, {
    mounted: !sm && Am.opened,
    transition: Au,
    duration: Am.isGroupPhase ? 10 : Nu
  }, (Rm) => {
    var Dm, km;
    return /* @__PURE__ */ React.createElement(Le, Lr(Lr({}, wm), Am.getFloatingProps({
      ref: Am.floating,
      className: Nm.tooltip,
      style: R_(Lr(Lr({}, Hs), Rm), {
        zIndex: Yu,
        top: (Dm = Am.y) != null ? Dm : 0,
        left: (km = Am.x) != null ? km : 0
      })
    })), er, /* @__PURE__ */ React.createElement(hs, {
      ref: Zt,
      arrowX: Am.arrowX,
      arrowY: Am.arrowY,
      visible: Ys,
      withBorder: !1,
      position: Am.placement,
      arrowSize: El,
      arrowOffset: Mu,
      arrowRadius: Pl,
      arrowPosition: Iu,
      className: Nm.arrow
    }));
  })), reactExports.cloneElement(Sn, Am.getReferenceProps(Lr({
    onClick: hm,
    onMouseEnter: ym,
    onMouseLeave: _m,
    onMouseMove: _e.onMouseMove,
    onPointerDown: _e.onPointerDown,
    onPointerEnter: _e.onPointerEnter,
    [Kn]: Vm,
    className: Cm(Ws, Sn.props.className)
  }, Sn.props))));
});
ci.Group = xp;
ci.Floating = $p;
ci.displayName = "@mantine/core/Tooltip";
const Cp = ci;
function A_(_e) {
  return {
    glyph: () => /* @__PURE__ */ oe("circle", { r: 5, fill: "white", stroke: _e, strokeWidth: 2 }),
    currentGlyph: () => /* @__PURE__ */ oe("circle", { r: 5, fill: _e, stroke: _e, strokeWidth: 2 }),
    backboneGlyph: () => /* @__PURE__ */ oe("circle", { r: 5, fill: "white", stroke: _e, strokeWidth: 2 }),
    bundleGlyph: () => /* @__PURE__ */ oe("circle", { r: 5, fill: "white", stroke: _e, strokeWidth: 2 }),
    hoverGlyph: () => /* @__PURE__ */ oe("circle", { r: 6, fill: "white", stroke: _e, strokeWidth: 2 })
  };
}
function I_({
  width: _e,
  depth: Qt,
  yOffset: Zt,
  onClick: $n,
  config: Sn,
  node: kn,
  currentNode: Kn,
  nodes: er,
  isHover: Cr,
  setHover: kr,
  colorMap: Yr,
  xOffset: Ms,
  extraHeight: Ds
}) {
  var zs;
  const Ls = Pf([kn], {
    config: {
      duration: Sn.animationDuration,
      easing: At.easeInOutSine
    },
    keys: [kn.id],
    from: {
      opacity: 0,
      transform: `translate(${-_e * Sn.gutter + Ms} , ${(Qt - 1) * Sn.verticalSpace + Zt})`
    },
    enter: {
      delay: (
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        ((zs = er[kn.id].parent) == null ? void 0 : zs.children.length) > 1 ? Sn.animationDuration / 3 : 0
      ),
      opacity: 1,
      transform: `translate(${-_e * Sn.gutter + Ms} , ${Qt * Sn.verticalSpace + Zt})`
    },
    update: {
      opacity: 1,
      transform: `translate(${-_e * Sn.gutter + Ms} , ${Qt * Sn.verticalSpace + Zt + Ds})`
    }
  }), js = reactExports.useMemo(() => {
    var Hs;
    const Fs = (Hs = Sn.iconConfig) == null ? void 0 : Hs[kn.event], Bs = A_(Yr[kn.event]);
    return Fs && Fs.glyph ? kn.id === Kn && Fs.currentGlyph ? Fs.currentGlyph(kn) : Cr && Fs.hoverGlyph ? Fs.hoverGlyph(kn) : _e === 0 && Fs.backboneGlyph ? Fs.backboneGlyph(kn) : Fs.glyph(kn) : kn.id === Kn ? Bs.currentGlyph(kn) : Cr ? Bs.hoverGlyph(kn) : _e === 0 ? Bs.backboneGlyph(kn) : Bs.glyph(kn);
  }, [Sn.iconConfig, Kn, Cr, _e, Yr, kn]);
  return Ls((Fs) => /* @__PURE__ */ oe(
    Ht.g,
    {
      ...Fs,
      cursor: "pointer",
      onClick: $n,
      className: "provenance-node",
      "data-node-id": kn.id,
      onMouseOver: () => {
        Fs.transform.isAnimating || kr(kn.id);
      },
      onMouseOut: () => kr(null),
      children: /* @__PURE__ */ oe(
        Cp,
        {
          position: "top-start",
          openDelay: 200,
          withinPortal: !0,
          withArrow: !0,
          color: "gray",
          multiline: !0,
          sx: { maxWidth: "200px" },
          label: /* @__PURE__ */ lt$2(fn, { spacing: 0, children: [
            /* @__PURE__ */ oe(gr, { weight: 600, children: kn.label }),
            Sn.getAnnotation(kn.id).length > 0 ? /* @__PURE__ */ oe(gr, { size: "xs", children: Sn.getAnnotation(kn.id) }) : null
          ] }),
          children: js
        }
      )
    }
  ));
}
function N_({
  x1Width: _e,
  x2Width: Qt,
  y1Depth: Zt,
  y2Depth: $n,
  y1Offset: Sn,
  y2Offset: kn,
  config: Kn,
  xOffset: er,
  uniqueKey: Cr,
  nodes: kr,
  parentNode: Yr
}) {
  return Pf([Cr], {
    config: {
      duration: Kn.animationDuration,
      easing: At.easeInOutSine
    },
    keys: [Cr],
    from: {
      opacity: 0,
      y1: (Zt - 1) * Kn.verticalSpace + Sn,
      y2: ($n - 1) * Kn.verticalSpace + kn
    },
    enter: {
      delay: (
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        kr[Yr.id].children.length > 1 ? Kn.animationDuration / 3 : 0
      ),
      opacity: 1,
      x1: -_e * Kn.gutter + er,
      x2: -Qt * Kn.gutter + er,
      y1: Zt * Kn.verticalSpace + Sn,
      y2: $n * Kn.verticalSpace + kn
    },
    update: {
      opacity: 1,
      x1: -_e * Kn.gutter + er,
      x2: -Qt * Kn.gutter + er,
      y1: Zt * Kn.verticalSpace + Sn,
      y2: $n * Kn.verticalSpace + kn
    }
  })((Ms) => /* @__PURE__ */ oe(Ht.line, { ...Ms, stroke: "black", pointerEvents: "none" }));
}
var Tp = {}, Ap = {};
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 });
  var Qt = "fas", Zt = "pen-to-square", $n = 512, Sn = 512, kn = ["edit"], Kn = "f044", er = "M471.6 21.7c-21.9-21.9-57.3-21.9-79.2 0L362.3 51.7l97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2L471.6 21.7zm-299.2 220c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.7 15.7-7.4 21.9-13.5L437.7 172.3 339.7 74.3 172.4 241.7zM96 64C43 64 0 107 0 160V416c0 53 43 96 96 96H352c53 0 96-43 96-96V320c0-17.7-14.3-32-32-32s-32 14.3-32 32v96c0 17.7-14.3 32-32 32H96c-17.7 0-32-14.3-32-32V160c0-17.7 14.3-32 32-32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H96z";
  _e.definition = {
    prefix: Qt,
    iconName: Zt,
    icon: [
      $n,
      Sn,
      kn,
      Kn,
      er
    ]
  }, _e.faPenToSquare = _e.definition, _e.prefix = Qt, _e.iconName = Zt, _e.width = $n, _e.height = Sn, _e.ligatures = kn, _e.unicode = Kn, _e.svgPathData = er, _e.aliases = kn;
})(Ap);
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 });
  var Qt = Ap;
  _e.definition = {
    prefix: Qt.prefix,
    iconName: Qt.iconName,
    icon: [
      Qt.width,
      Qt.height,
      Qt.aliases,
      Qt.unicode,
      Qt.svgPathData
    ]
  }, _e.faEdit = _e.definition, _e.prefix = Qt.prefix, _e.iconName = Qt.iconName, _e.width = Qt.width, _e.height = Qt.height, _e.ligatures = Qt.aliases, _e.unicode = Qt.unicode, _e.svgPathData = Qt.svgPathData, _e.aliases = Qt.aliases;
})(Tp);
function ou(_e, Qt) {
  var Zt = Object.keys(_e);
  if (Object.getOwnPropertySymbols) {
    var $n = Object.getOwnPropertySymbols(_e);
    Qt && ($n = $n.filter(function(Sn) {
      return Object.getOwnPropertyDescriptor(_e, Sn).enumerable;
    })), Zt.push.apply(Zt, $n);
  }
  return Zt;
}
function V(_e) {
  for (var Qt = 1; Qt < arguments.length; Qt++) {
    var Zt = arguments[Qt] != null ? arguments[Qt] : {};
    Qt % 2 ? ou(Object(Zt), !0).forEach(function($n) {
      $e(_e, $n, Zt[$n]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(_e, Object.getOwnPropertyDescriptors(Zt)) : ou(Object(Zt)).forEach(function($n) {
      Object.defineProperty(_e, $n, Object.getOwnPropertyDescriptor(Zt, $n));
    });
  }
  return _e;
}
function Wa(_e) {
  "@babel/helpers - typeof";
  return Wa = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(Qt) {
    return typeof Qt;
  } : function(Qt) {
    return Qt && typeof Symbol == "function" && Qt.constructor === Symbol && Qt !== Symbol.prototype ? "symbol" : typeof Qt;
  }, Wa(_e);
}
function j_(_e, Qt) {
  if (!(_e instanceof Qt))
    throw new TypeError("Cannot call a class as a function");
}
function su(_e, Qt) {
  for (var Zt = 0; Zt < Qt.length; Zt++) {
    var $n = Qt[Zt];
    $n.enumerable = $n.enumerable || !1, $n.configurable = !0, "value" in $n && ($n.writable = !0), Object.defineProperty(_e, $n.key, $n);
  }
}
function M_(_e, Qt, Zt) {
  return Qt && su(_e.prototype, Qt), Zt && su(_e, Zt), Object.defineProperty(_e, "prototype", {
    writable: !1
  }), _e;
}
function $e(_e, Qt, Zt) {
  return Qt in _e ? Object.defineProperty(_e, Qt, {
    value: Zt,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : _e[Qt] = Zt, _e;
}
function _s(_e, Qt) {
  return z_(_e) || F_(_e, Qt) || Ip(_e, Qt) || V_();
}
function On(_e) {
  return D_(_e) || L_(_e) || Ip(_e) || W_();
}
function D_(_e) {
  if (Array.isArray(_e))
    return wo(_e);
}
function z_(_e) {
  if (Array.isArray(_e))
    return _e;
}
function L_(_e) {
  if (typeof Symbol < "u" && _e[Symbol.iterator] != null || _e["@@iterator"] != null)
    return Array.from(_e);
}
function F_(_e, Qt) {
  var Zt = _e == null ? null : typeof Symbol < "u" && _e[Symbol.iterator] || _e["@@iterator"];
  if (Zt != null) {
    var $n = [], Sn = !0, kn = !1, Kn, er;
    try {
      for (Zt = Zt.call(_e); !(Sn = (Kn = Zt.next()).done) && ($n.push(Kn.value), !(Qt && $n.length === Qt)); Sn = !0)
        ;
    } catch (Cr) {
      kn = !0, er = Cr;
    } finally {
      try {
        !Sn && Zt.return != null && Zt.return();
      } finally {
        if (kn)
          throw er;
      }
    }
    return $n;
  }
}
function Ip(_e, Qt) {
  if (_e) {
    if (typeof _e == "string")
      return wo(_e, Qt);
    var Zt = Object.prototype.toString.call(_e).slice(8, -1);
    if (Zt === "Object" && _e.constructor && (Zt = _e.constructor.name), Zt === "Map" || Zt === "Set")
      return Array.from(_e);
    if (Zt === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Zt))
      return wo(_e, Qt);
  }
}
function wo(_e, Qt) {
  (Qt == null || Qt > _e.length) && (Qt = _e.length);
  for (var Zt = 0, $n = new Array(Qt); Zt < Qt; Zt++)
    $n[Zt] = _e[Zt];
  return $n;
}
function W_() {
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function V_() {
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
var lu = function() {
}, xs = {}, Np = {}, jp = null, Mp = {
  mark: lu,
  measure: lu
};
try {
  typeof window < "u" && (xs = window), typeof document < "u" && (Np = document), typeof MutationObserver < "u" && (jp = MutationObserver), typeof performance < "u" && (Mp = performance);
} catch {
}
var Y_ = xs.navigator || {}, cu = Y_.userAgent, uu = cu === void 0 ? "" : cu, Mt = xs, ge = Np, fu = jp, Fn = Mp;
Mt.document;
var xt = !!ge.documentElement && !!ge.head && typeof ge.addEventListener == "function" && typeof ge.createElement == "function", Dp = ~uu.indexOf("MSIE") || ~uu.indexOf("Trident/"), Wn, Vn, Yn, Bn, Hn, yt = "___FONT_AWESOME___", _o = 16, zp = "fa", Lp = "svg-inline--fa", Xt = "data-fa-i2svg", xo = "data-fa-pseudo-element", B_ = "data-fa-pseudo-element-pending", Os = "data-prefix", Ps = "data-icon", du = "fontawesome-i2svg", H_ = "async", U_ = ["HTML", "HEAD", "STYLE", "SCRIPT"], Fp = function() {
  try {
    return !0;
  } catch {
    return !1;
  }
}(), ve = "classic", ye = "sharp", Es = [ve, ye];
function Pn(_e) {
  return new Proxy(_e, {
    get: function(Qt, Zt) {
      return Zt in Qt ? Qt[Zt] : Qt[ve];
    }
  });
}
var dn = Pn((Wn = {}, $e(Wn, ve, {
  fa: "solid",
  fas: "solid",
  "fa-solid": "solid",
  far: "regular",
  "fa-regular": "regular",
  fal: "light",
  "fa-light": "light",
  fat: "thin",
  "fa-thin": "thin",
  fad: "duotone",
  "fa-duotone": "duotone",
  fab: "brands",
  "fa-brands": "brands",
  fak: "kit",
  "fa-kit": "kit"
}), $e(Wn, ye, {
  fa: "solid",
  fass: "solid",
  "fa-solid": "solid",
  fasr: "regular",
  "fa-regular": "regular",
  fasl: "light",
  "fa-light": "light"
}), Wn)), pn = Pn((Vn = {}, $e(Vn, ve, {
  solid: "fas",
  regular: "far",
  light: "fal",
  thin: "fat",
  duotone: "fad",
  brands: "fab",
  kit: "fak"
}), $e(Vn, ye, {
  solid: "fass",
  regular: "fasr",
  light: "fasl"
}), Vn)), mn = Pn((Yn = {}, $e(Yn, ve, {
  fab: "fa-brands",
  fad: "fa-duotone",
  fak: "fa-kit",
  fal: "fa-light",
  far: "fa-regular",
  fas: "fa-solid",
  fat: "fa-thin"
}), $e(Yn, ye, {
  fass: "fa-solid",
  fasr: "fa-regular",
  fasl: "fa-light"
}), Yn)), q_ = Pn((Bn = {}, $e(Bn, ve, {
  "fa-brands": "fab",
  "fa-duotone": "fad",
  "fa-kit": "fak",
  "fa-light": "fal",
  "fa-regular": "far",
  "fa-solid": "fas",
  "fa-thin": "fat"
}), $e(Bn, ye, {
  "fa-solid": "fass",
  "fa-regular": "fasr",
  "fa-light": "fasl"
}), Bn)), G_ = /fa(s|r|l|t|d|b|k|ss|sr|sl)?[\-\ ]/, Wp = "fa-layers-text", X_ = /Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp|Kit)?.*/i, K_ = Pn((Hn = {}, $e(Hn, ve, {
  900: "fas",
  400: "far",
  normal: "far",
  300: "fal",
  100: "fat"
}), $e(Hn, ye, {
  900: "fass",
  400: "fasr",
  300: "fasl"
}), Hn)), Vp = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], Q_ = Vp.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]), J_ = ["class", "data-prefix", "data-icon", "data-fa-transform", "data-fa-mask"], Yt = {
  GROUP: "duotone-group",
  SWAP_OPACITY: "swap-opacity",
  PRIMARY: "primary",
  SECONDARY: "secondary"
}, hn = /* @__PURE__ */ new Set();
Object.keys(pn[ve]).map(hn.add.bind(hn));
Object.keys(pn[ye]).map(hn.add.bind(hn));
var Z_ = [].concat(Es, On(hn), ["2xs", "xs", "sm", "lg", "xl", "2xl", "beat", "border", "fade", "beat-fade", "bounce", "flip-both", "flip-horizontal", "flip-vertical", "flip", "fw", "inverse", "layers-counter", "layers-text", "layers", "li", "pull-left", "pull-right", "pulse", "rotate-180", "rotate-270", "rotate-90", "rotate-by", "shake", "spin-pulse", "spin-reverse", "spin", "stack-1x", "stack-2x", "stack", "ul", Yt.GROUP, Yt.SWAP_OPACITY, Yt.PRIMARY, Yt.SECONDARY]).concat(Vp.map(function(_e) {
  return "".concat(_e, "x");
})).concat(Q_.map(function(_e) {
  return "w-".concat(_e);
})), Kr = Mt.FontAwesomeConfig || {};
function ex(_e) {
  var Qt = ge.querySelector("script[" + _e + "]");
  if (Qt)
    return Qt.getAttribute(_e);
}
function tx(_e) {
  return _e === "" ? !0 : _e === "false" ? !1 : _e === "true" ? !0 : _e;
}
if (ge && typeof ge.querySelector == "function") {
  var rx = [["data-family-prefix", "familyPrefix"], ["data-css-prefix", "cssPrefix"], ["data-family-default", "familyDefault"], ["data-style-default", "styleDefault"], ["data-replacement-class", "replacementClass"], ["data-auto-replace-svg", "autoReplaceSvg"], ["data-auto-add-css", "autoAddCss"], ["data-auto-a11y", "autoA11y"], ["data-search-pseudo-elements", "searchPseudoElements"], ["data-observe-mutations", "observeMutations"], ["data-mutate-approach", "mutateApproach"], ["data-keep-original-source", "keepOriginalSource"], ["data-measure-performance", "measurePerformance"], ["data-show-missing-icons", "showMissingIcons"]];
  rx.forEach(function(_e) {
    var Qt = _s(_e, 2), Zt = Qt[0], $n = Qt[1], Sn = tx(ex(Zt));
    Sn != null && (Kr[$n] = Sn);
  });
}
var Yp = {
  styleDefault: "solid",
  familyDefault: "classic",
  cssPrefix: zp,
  replacementClass: Lp,
  autoReplaceSvg: !0,
  autoAddCss: !0,
  autoA11y: !0,
  searchPseudoElements: !1,
  observeMutations: !0,
  mutateApproach: "async",
  keepOriginalSource: !0,
  measurePerformance: !1,
  showMissingIcons: !0
};
Kr.familyPrefix && (Kr.cssPrefix = Kr.familyPrefix);
var xr = V(V({}, Yp), Kr);
xr.autoReplaceSvg || (xr.observeMutations = !1);
var H = {};
Object.keys(Yp).forEach(function(_e) {
  Object.defineProperty(H, _e, {
    enumerable: !0,
    set: function(Qt) {
      xr[_e] = Qt, Qr.forEach(function(Zt) {
        return Zt(H);
      });
    },
    get: function() {
      return xr[_e];
    }
  });
});
Object.defineProperty(H, "familyPrefix", {
  enumerable: !0,
  set: function(_e) {
    xr.cssPrefix = _e, Qr.forEach(function(Qt) {
      return Qt(H);
    });
  },
  get: function() {
    return xr.cssPrefix;
  }
});
Mt.FontAwesomeConfig = H;
var Qr = [];
function nx(_e) {
  return Qr.push(_e), function() {
    Qr.splice(Qr.indexOf(_e), 1);
  };
}
var St = _o, ut = {
  size: 16,
  x: 0,
  y: 0,
  rotate: 0,
  flipX: !1,
  flipY: !1
};
function ax(_e) {
  if (!(!_e || !xt)) {
    var Qt = ge.createElement("style");
    Qt.setAttribute("type", "text/css"), Qt.innerHTML = _e;
    for (var Zt = ge.head.childNodes, $n = null, Sn = Zt.length - 1; Sn > -1; Sn--) {
      var kn = Zt[Sn], Kn = (kn.tagName || "").toUpperCase();
      ["STYLE", "LINK"].indexOf(Kn) > -1 && ($n = kn);
    }
    return ge.head.insertBefore(Qt, $n), _e;
  }
}
var ix = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
function vn() {
  for (var _e = 12, Qt = ""; _e-- > 0; )
    Qt += ix[Math.random() * 62 | 0];
  return Qt;
}
function Sr(_e) {
  for (var Qt = [], Zt = (_e || []).length >>> 0; Zt--; )
    Qt[Zt] = _e[Zt];
  return Qt;
}
function Ss(_e) {
  return _e.classList ? Sr(_e.classList) : (_e.getAttribute("class") || "").split(" ").filter(function(Qt) {
    return Qt;
  });
}
function Bp(_e) {
  return "".concat(_e).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
}
function ox(_e) {
  return Object.keys(_e || {}).reduce(function(Qt, Zt) {
    return Qt + "".concat(Zt, '="').concat(Bp(_e[Zt]), '" ');
  }, "").trim();
}
function ui(_e) {
  return Object.keys(_e || {}).reduce(function(Qt, Zt) {
    return Qt + "".concat(Zt, ": ").concat(_e[Zt].trim(), ";");
  }, "");
}
function $s(_e) {
  return _e.size !== ut.size || _e.x !== ut.x || _e.y !== ut.y || _e.rotate !== ut.rotate || _e.flipX || _e.flipY;
}
function sx(_e) {
  var Qt = _e.transform, Zt = _e.containerWidth, $n = _e.iconWidth, Sn = {
    transform: "translate(".concat(Zt / 2, " 256)")
  }, kn = "translate(".concat(Qt.x * 32, ", ").concat(Qt.y * 32, ") "), Kn = "scale(".concat(Qt.size / 16 * (Qt.flipX ? -1 : 1), ", ").concat(Qt.size / 16 * (Qt.flipY ? -1 : 1), ") "), er = "rotate(".concat(Qt.rotate, " 0 0)"), Cr = {
    transform: "".concat(kn, " ").concat(Kn, " ").concat(er)
  }, kr = {
    transform: "translate(".concat($n / 2 * -1, " -256)")
  };
  return {
    outer: Sn,
    inner: Cr,
    path: kr
  };
}
function lx(_e) {
  var Qt = _e.transform, Zt = _e.width, $n = Zt === void 0 ? _o : Zt, Sn = _e.height, kn = Sn === void 0 ? _o : Sn, Kn = _e.startCentered, er = Kn === void 0 ? !1 : Kn, Cr = "";
  return er && Dp ? Cr += "translate(".concat(Qt.x / St - $n / 2, "em, ").concat(Qt.y / St - kn / 2, "em) ") : er ? Cr += "translate(calc(-50% + ".concat(Qt.x / St, "em), calc(-50% + ").concat(Qt.y / St, "em)) ") : Cr += "translate(".concat(Qt.x / St, "em, ").concat(Qt.y / St, "em) "), Cr += "scale(".concat(Qt.size / St * (Qt.flipX ? -1 : 1), ", ").concat(Qt.size / St * (Qt.flipY ? -1 : 1), ") "), Cr += "rotate(".concat(Qt.rotate, "deg) "), Cr;
}
var cx = `:root, :host {
  --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Solid";
  --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Regular";
  --fa-font-light: normal 300 1em/1 "Font Awesome 6 Light";
  --fa-font-thin: normal 100 1em/1 "Font Awesome 6 Thin";
  --fa-font-duotone: normal 900 1em/1 "Font Awesome 6 Duotone";
  --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 6 Sharp";
  --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 6 Sharp";
  --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 6 Sharp";
  --fa-font-brands: normal 400 1em/1 "Font Awesome 6 Brands";
}

svg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {
  overflow: visible;
  box-sizing: content-box;
}

.svg-inline--fa {
  display: var(--fa-display, inline-block);
  height: 1em;
  overflow: visible;
  vertical-align: -0.125em;
}
.svg-inline--fa.fa-2xs {
  vertical-align: 0.1em;
}
.svg-inline--fa.fa-xs {
  vertical-align: 0em;
}
.svg-inline--fa.fa-sm {
  vertical-align: -0.0714285705em;
}
.svg-inline--fa.fa-lg {
  vertical-align: -0.2em;
}
.svg-inline--fa.fa-xl {
  vertical-align: -0.25em;
}
.svg-inline--fa.fa-2xl {
  vertical-align: -0.3125em;
}
.svg-inline--fa.fa-pull-left {
  margin-right: var(--fa-pull-margin, 0.3em);
  width: auto;
}
.svg-inline--fa.fa-pull-right {
  margin-left: var(--fa-pull-margin, 0.3em);
  width: auto;
}
.svg-inline--fa.fa-li {
  width: var(--fa-li-width, 2em);
  top: 0.25em;
}
.svg-inline--fa.fa-fw {
  width: var(--fa-fw-width, 1.25em);
}

.fa-layers svg.svg-inline--fa {
  bottom: 0;
  left: 0;
  margin: auto;
  position: absolute;
  right: 0;
  top: 0;
}

.fa-layers-counter, .fa-layers-text {
  display: inline-block;
  position: absolute;
  text-align: center;
}

.fa-layers {
  display: inline-block;
  height: 1em;
  position: relative;
  text-align: center;
  vertical-align: -0.125em;
  width: 1em;
}
.fa-layers svg.svg-inline--fa {
  -webkit-transform-origin: center center;
          transform-origin: center center;
}

.fa-layers-text {
  left: 50%;
  top: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  -webkit-transform-origin: center center;
          transform-origin: center center;
}

.fa-layers-counter {
  background-color: var(--fa-counter-background-color, #ff253a);
  border-radius: var(--fa-counter-border-radius, 1em);
  box-sizing: border-box;
  color: var(--fa-inverse, #fff);
  line-height: var(--fa-counter-line-height, 1);
  max-width: var(--fa-counter-max-width, 5em);
  min-width: var(--fa-counter-min-width, 1.5em);
  overflow: hidden;
  padding: var(--fa-counter-padding, 0.25em 0.5em);
  right: var(--fa-right, 0);
  text-overflow: ellipsis;
  top: var(--fa-top, 0);
  -webkit-transform: scale(var(--fa-counter-scale, 0.25));
          transform: scale(var(--fa-counter-scale, 0.25));
  -webkit-transform-origin: top right;
          transform-origin: top right;
}

.fa-layers-bottom-right {
  bottom: var(--fa-bottom, 0);
  right: var(--fa-right, 0);
  top: auto;
  -webkit-transform: scale(var(--fa-layers-scale, 0.25));
          transform: scale(var(--fa-layers-scale, 0.25));
  -webkit-transform-origin: bottom right;
          transform-origin: bottom right;
}

.fa-layers-bottom-left {
  bottom: var(--fa-bottom, 0);
  left: var(--fa-left, 0);
  right: auto;
  top: auto;
  -webkit-transform: scale(var(--fa-layers-scale, 0.25));
          transform: scale(var(--fa-layers-scale, 0.25));
  -webkit-transform-origin: bottom left;
          transform-origin: bottom left;
}

.fa-layers-top-right {
  top: var(--fa-top, 0);
  right: var(--fa-right, 0);
  -webkit-transform: scale(var(--fa-layers-scale, 0.25));
          transform: scale(var(--fa-layers-scale, 0.25));
  -webkit-transform-origin: top right;
          transform-origin: top right;
}

.fa-layers-top-left {
  left: var(--fa-left, 0);
  right: auto;
  top: var(--fa-top, 0);
  -webkit-transform: scale(var(--fa-layers-scale, 0.25));
          transform: scale(var(--fa-layers-scale, 0.25));
  -webkit-transform-origin: top left;
          transform-origin: top left;
}

.fa-1x {
  font-size: 1em;
}

.fa-2x {
  font-size: 2em;
}

.fa-3x {
  font-size: 3em;
}

.fa-4x {
  font-size: 4em;
}

.fa-5x {
  font-size: 5em;
}

.fa-6x {
  font-size: 6em;
}

.fa-7x {
  font-size: 7em;
}

.fa-8x {
  font-size: 8em;
}

.fa-9x {
  font-size: 9em;
}

.fa-10x {
  font-size: 10em;
}

.fa-2xs {
  font-size: 0.625em;
  line-height: 0.1em;
  vertical-align: 0.225em;
}

.fa-xs {
  font-size: 0.75em;
  line-height: 0.0833333337em;
  vertical-align: 0.125em;
}

.fa-sm {
  font-size: 0.875em;
  line-height: 0.0714285718em;
  vertical-align: 0.0535714295em;
}

.fa-lg {
  font-size: 1.25em;
  line-height: 0.05em;
  vertical-align: -0.075em;
}

.fa-xl {
  font-size: 1.5em;
  line-height: 0.0416666682em;
  vertical-align: -0.125em;
}

.fa-2xl {
  font-size: 2em;
  line-height: 0.03125em;
  vertical-align: -0.1875em;
}

.fa-fw {
  text-align: center;
  width: 1.25em;
}

.fa-ul {
  list-style-type: none;
  margin-left: var(--fa-li-margin, 2.5em);
  padding-left: 0;
}
.fa-ul > li {
  position: relative;
}

.fa-li {
  left: calc(var(--fa-li-width, 2em) * -1);
  position: absolute;
  text-align: center;
  width: var(--fa-li-width, 2em);
  line-height: inherit;
}

.fa-border {
  border-color: var(--fa-border-color, #eee);
  border-radius: var(--fa-border-radius, 0.1em);
  border-style: var(--fa-border-style, solid);
  border-width: var(--fa-border-width, 0.08em);
  padding: var(--fa-border-padding, 0.2em 0.25em 0.15em);
}

.fa-pull-left {
  float: left;
  margin-right: var(--fa-pull-margin, 0.3em);
}

.fa-pull-right {
  float: right;
  margin-left: var(--fa-pull-margin, 0.3em);
}

.fa-beat {
  -webkit-animation-name: fa-beat;
          animation-name: fa-beat;
  -webkit-animation-delay: var(--fa-animation-delay, 0s);
          animation-delay: var(--fa-animation-delay, 0s);
  -webkit-animation-direction: var(--fa-animation-direction, normal);
          animation-direction: var(--fa-animation-direction, normal);
  -webkit-animation-duration: var(--fa-animation-duration, 1s);
          animation-duration: var(--fa-animation-duration, 1s);
  -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
          animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  -webkit-animation-timing-function: var(--fa-animation-timing, ease-in-out);
          animation-timing-function: var(--fa-animation-timing, ease-in-out);
}

.fa-bounce {
  -webkit-animation-name: fa-bounce;
          animation-name: fa-bounce;
  -webkit-animation-delay: var(--fa-animation-delay, 0s);
          animation-delay: var(--fa-animation-delay, 0s);
  -webkit-animation-direction: var(--fa-animation-direction, normal);
          animation-direction: var(--fa-animation-direction, normal);
  -webkit-animation-duration: var(--fa-animation-duration, 1s);
          animation-duration: var(--fa-animation-duration, 1s);
  -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
          animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  -webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));
          animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));
}

.fa-fade {
  -webkit-animation-name: fa-fade;
          animation-name: fa-fade;
  -webkit-animation-delay: var(--fa-animation-delay, 0s);
          animation-delay: var(--fa-animation-delay, 0s);
  -webkit-animation-direction: var(--fa-animation-direction, normal);
          animation-direction: var(--fa-animation-direction, normal);
  -webkit-animation-duration: var(--fa-animation-duration, 1s);
          animation-duration: var(--fa-animation-duration, 1s);
  -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
          animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  -webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
          animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
}

.fa-beat-fade {
  -webkit-animation-name: fa-beat-fade;
          animation-name: fa-beat-fade;
  -webkit-animation-delay: var(--fa-animation-delay, 0s);
          animation-delay: var(--fa-animation-delay, 0s);
  -webkit-animation-direction: var(--fa-animation-direction, normal);
          animation-direction: var(--fa-animation-direction, normal);
  -webkit-animation-duration: var(--fa-animation-duration, 1s);
          animation-duration: var(--fa-animation-duration, 1s);
  -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
          animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  -webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
          animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
}

.fa-flip {
  -webkit-animation-name: fa-flip;
          animation-name: fa-flip;
  -webkit-animation-delay: var(--fa-animation-delay, 0s);
          animation-delay: var(--fa-animation-delay, 0s);
  -webkit-animation-direction: var(--fa-animation-direction, normal);
          animation-direction: var(--fa-animation-direction, normal);
  -webkit-animation-duration: var(--fa-animation-duration, 1s);
          animation-duration: var(--fa-animation-duration, 1s);
  -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
          animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  -webkit-animation-timing-function: var(--fa-animation-timing, ease-in-out);
          animation-timing-function: var(--fa-animation-timing, ease-in-out);
}

.fa-shake {
  -webkit-animation-name: fa-shake;
          animation-name: fa-shake;
  -webkit-animation-delay: var(--fa-animation-delay, 0s);
          animation-delay: var(--fa-animation-delay, 0s);
  -webkit-animation-direction: var(--fa-animation-direction, normal);
          animation-direction: var(--fa-animation-direction, normal);
  -webkit-animation-duration: var(--fa-animation-duration, 1s);
          animation-duration: var(--fa-animation-duration, 1s);
  -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
          animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  -webkit-animation-timing-function: var(--fa-animation-timing, linear);
          animation-timing-function: var(--fa-animation-timing, linear);
}

.fa-spin {
  -webkit-animation-name: fa-spin;
          animation-name: fa-spin;
  -webkit-animation-delay: var(--fa-animation-delay, 0s);
          animation-delay: var(--fa-animation-delay, 0s);
  -webkit-animation-direction: var(--fa-animation-direction, normal);
          animation-direction: var(--fa-animation-direction, normal);
  -webkit-animation-duration: var(--fa-animation-duration, 2s);
          animation-duration: var(--fa-animation-duration, 2s);
  -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
          animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  -webkit-animation-timing-function: var(--fa-animation-timing, linear);
          animation-timing-function: var(--fa-animation-timing, linear);
}

.fa-spin-reverse {
  --fa-animation-direction: reverse;
}

.fa-pulse,
.fa-spin-pulse {
  -webkit-animation-name: fa-spin;
          animation-name: fa-spin;
  -webkit-animation-direction: var(--fa-animation-direction, normal);
          animation-direction: var(--fa-animation-direction, normal);
  -webkit-animation-duration: var(--fa-animation-duration, 1s);
          animation-duration: var(--fa-animation-duration, 1s);
  -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);
          animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  -webkit-animation-timing-function: var(--fa-animation-timing, steps(8));
          animation-timing-function: var(--fa-animation-timing, steps(8));
}

@media (prefers-reduced-motion: reduce) {
  .fa-beat,
.fa-bounce,
.fa-fade,
.fa-beat-fade,
.fa-flip,
.fa-pulse,
.fa-shake,
.fa-spin,
.fa-spin-pulse {
    -webkit-animation-delay: -1ms;
            animation-delay: -1ms;
    -webkit-animation-duration: 1ms;
            animation-duration: 1ms;
    -webkit-animation-iteration-count: 1;
            animation-iteration-count: 1;
    -webkit-transition-delay: 0s;
            transition-delay: 0s;
    -webkit-transition-duration: 0s;
            transition-duration: 0s;
  }
}
@-webkit-keyframes fa-beat {
  0%, 90% {
    -webkit-transform: scale(1);
            transform: scale(1);
  }
  45% {
    -webkit-transform: scale(var(--fa-beat-scale, 1.25));
            transform: scale(var(--fa-beat-scale, 1.25));
  }
}
@keyframes fa-beat {
  0%, 90% {
    -webkit-transform: scale(1);
            transform: scale(1);
  }
  45% {
    -webkit-transform: scale(var(--fa-beat-scale, 1.25));
            transform: scale(var(--fa-beat-scale, 1.25));
  }
}
@-webkit-keyframes fa-bounce {
  0% {
    -webkit-transform: scale(1, 1) translateY(0);
            transform: scale(1, 1) translateY(0);
  }
  10% {
    -webkit-transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);
            transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);
  }
  30% {
    -webkit-transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));
            transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));
  }
  50% {
    -webkit-transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);
            transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);
  }
  57% {
    -webkit-transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));
            transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));
  }
  64% {
    -webkit-transform: scale(1, 1) translateY(0);
            transform: scale(1, 1) translateY(0);
  }
  100% {
    -webkit-transform: scale(1, 1) translateY(0);
            transform: scale(1, 1) translateY(0);
  }
}
@keyframes fa-bounce {
  0% {
    -webkit-transform: scale(1, 1) translateY(0);
            transform: scale(1, 1) translateY(0);
  }
  10% {
    -webkit-transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);
            transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);
  }
  30% {
    -webkit-transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));
            transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));
  }
  50% {
    -webkit-transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);
            transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);
  }
  57% {
    -webkit-transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));
            transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));
  }
  64% {
    -webkit-transform: scale(1, 1) translateY(0);
            transform: scale(1, 1) translateY(0);
  }
  100% {
    -webkit-transform: scale(1, 1) translateY(0);
            transform: scale(1, 1) translateY(0);
  }
}
@-webkit-keyframes fa-fade {
  50% {
    opacity: var(--fa-fade-opacity, 0.4);
  }
}
@keyframes fa-fade {
  50% {
    opacity: var(--fa-fade-opacity, 0.4);
  }
}
@-webkit-keyframes fa-beat-fade {
  0%, 100% {
    opacity: var(--fa-beat-fade-opacity, 0.4);
    -webkit-transform: scale(1);
            transform: scale(1);
  }
  50% {
    opacity: 1;
    -webkit-transform: scale(var(--fa-beat-fade-scale, 1.125));
            transform: scale(var(--fa-beat-fade-scale, 1.125));
  }
}
@keyframes fa-beat-fade {
  0%, 100% {
    opacity: var(--fa-beat-fade-opacity, 0.4);
    -webkit-transform: scale(1);
            transform: scale(1);
  }
  50% {
    opacity: 1;
    -webkit-transform: scale(var(--fa-beat-fade-scale, 1.125));
            transform: scale(var(--fa-beat-fade-scale, 1.125));
  }
}
@-webkit-keyframes fa-flip {
  50% {
    -webkit-transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));
            transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));
  }
}
@keyframes fa-flip {
  50% {
    -webkit-transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));
            transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));
  }
}
@-webkit-keyframes fa-shake {
  0% {
    -webkit-transform: rotate(-15deg);
            transform: rotate(-15deg);
  }
  4% {
    -webkit-transform: rotate(15deg);
            transform: rotate(15deg);
  }
  8%, 24% {
    -webkit-transform: rotate(-18deg);
            transform: rotate(-18deg);
  }
  12%, 28% {
    -webkit-transform: rotate(18deg);
            transform: rotate(18deg);
  }
  16% {
    -webkit-transform: rotate(-22deg);
            transform: rotate(-22deg);
  }
  20% {
    -webkit-transform: rotate(22deg);
            transform: rotate(22deg);
  }
  32% {
    -webkit-transform: rotate(-12deg);
            transform: rotate(-12deg);
  }
  36% {
    -webkit-transform: rotate(12deg);
            transform: rotate(12deg);
  }
  40%, 100% {
    -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
  }
}
@keyframes fa-shake {
  0% {
    -webkit-transform: rotate(-15deg);
            transform: rotate(-15deg);
  }
  4% {
    -webkit-transform: rotate(15deg);
            transform: rotate(15deg);
  }
  8%, 24% {
    -webkit-transform: rotate(-18deg);
            transform: rotate(-18deg);
  }
  12%, 28% {
    -webkit-transform: rotate(18deg);
            transform: rotate(18deg);
  }
  16% {
    -webkit-transform: rotate(-22deg);
            transform: rotate(-22deg);
  }
  20% {
    -webkit-transform: rotate(22deg);
            transform: rotate(22deg);
  }
  32% {
    -webkit-transform: rotate(-12deg);
            transform: rotate(-12deg);
  }
  36% {
    -webkit-transform: rotate(12deg);
            transform: rotate(12deg);
  }
  40%, 100% {
    -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
  }
}
@-webkit-keyframes fa-spin {
  0% {
    -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
  }
}
@keyframes fa-spin {
  0% {
    -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
  }
}
.fa-rotate-90 {
  -webkit-transform: rotate(90deg);
          transform: rotate(90deg);
}

.fa-rotate-180 {
  -webkit-transform: rotate(180deg);
          transform: rotate(180deg);
}

.fa-rotate-270 {
  -webkit-transform: rotate(270deg);
          transform: rotate(270deg);
}

.fa-flip-horizontal {
  -webkit-transform: scale(-1, 1);
          transform: scale(-1, 1);
}

.fa-flip-vertical {
  -webkit-transform: scale(1, -1);
          transform: scale(1, -1);
}

.fa-flip-both,
.fa-flip-horizontal.fa-flip-vertical {
  -webkit-transform: scale(-1, -1);
          transform: scale(-1, -1);
}

.fa-rotate-by {
  -webkit-transform: rotate(var(--fa-rotate-angle, none));
          transform: rotate(var(--fa-rotate-angle, none));
}

.fa-stack {
  display: inline-block;
  vertical-align: middle;
  height: 2em;
  position: relative;
  width: 2.5em;
}

.fa-stack-1x,
.fa-stack-2x {
  bottom: 0;
  left: 0;
  margin: auto;
  position: absolute;
  right: 0;
  top: 0;
  z-index: var(--fa-stack-z-index, auto);
}

.svg-inline--fa.fa-stack-1x {
  height: 1em;
  width: 1.25em;
}
.svg-inline--fa.fa-stack-2x {
  height: 2em;
  width: 2.5em;
}

.fa-inverse {
  color: var(--fa-inverse, #fff);
}

.sr-only,
.fa-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-only-focusable:not(:focus),
.fa-sr-only-focusable:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.svg-inline--fa .fa-primary {
  fill: var(--fa-primary-color, currentColor);
  opacity: var(--fa-primary-opacity, 1);
}

.svg-inline--fa .fa-secondary {
  fill: var(--fa-secondary-color, currentColor);
  opacity: var(--fa-secondary-opacity, 0.4);
}

.svg-inline--fa.fa-swap-opacity .fa-primary {
  opacity: var(--fa-secondary-opacity, 0.4);
}

.svg-inline--fa.fa-swap-opacity .fa-secondary {
  opacity: var(--fa-primary-opacity, 1);
}

.svg-inline--fa mask .fa-primary,
.svg-inline--fa mask .fa-secondary {
  fill: black;
}

.fad.fa-inverse,
.fa-duotone.fa-inverse {
  color: var(--fa-inverse, #fff);
}`;
function Hp() {
  var _e = zp, Qt = Lp, Zt = H.cssPrefix, $n = H.replacementClass, Sn = cx;
  if (Zt !== _e || $n !== Qt) {
    var kn = new RegExp("\\.".concat(_e, "\\-"), "g"), Kn = new RegExp("\\--".concat(_e, "\\-"), "g"), er = new RegExp("\\.".concat(Qt), "g");
    Sn = Sn.replace(kn, ".".concat(Zt, "-")).replace(Kn, "--".concat(Zt, "-")).replace(er, ".".concat($n));
  }
  return Sn;
}
var pu = !1;
function Li() {
  H.autoAddCss && !pu && (ax(Hp()), pu = !0);
}
var ux = {
  mixout: function() {
    return {
      dom: {
        css: Hp,
        insertCss: Li
      }
    };
  },
  hooks: function() {
    return {
      beforeDOMElementCreation: function() {
        Li();
      },
      beforeI2svg: function() {
        Li();
      }
    };
  }
}, bt = Mt || {};
bt[yt] || (bt[yt] = {});
bt[yt].styles || (bt[yt].styles = {});
bt[yt].hooks || (bt[yt].hooks = {});
bt[yt].shims || (bt[yt].shims = []);
var Ze = bt[yt], Up = [], fx = function _e() {
  ge.removeEventListener("DOMContentLoaded", _e), Va = 1, Up.map(function(Qt) {
    return Qt();
  });
}, Va = !1;
xt && (Va = (ge.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(ge.readyState), Va || ge.addEventListener("DOMContentLoaded", fx));
function dx(_e) {
  xt && (Va ? setTimeout(_e, 0) : Up.push(_e));
}
function En(_e) {
  var Qt = _e.tag, Zt = _e.attributes, $n = Zt === void 0 ? {} : Zt, Sn = _e.children, kn = Sn === void 0 ? [] : Sn;
  return typeof _e == "string" ? Bp(_e) : "<".concat(Qt, " ").concat(ox($n), ">").concat(kn.map(En).join(""), "</").concat(Qt, ">");
}
function mu(_e, Qt, Zt) {
  if (_e && _e[Qt] && _e[Qt][Zt])
    return {
      prefix: Qt,
      iconName: Zt,
      icon: _e[Qt][Zt]
    };
}
var px = function(_e, Qt) {
  return function(Zt, $n, Sn, kn) {
    return _e.call(Qt, Zt, $n, Sn, kn);
  };
}, Fi = function(_e, Qt, Zt, $n) {
  var Sn = Object.keys(_e), kn = Sn.length, Kn = $n !== void 0 ? px(Qt, $n) : Qt, er, Cr, kr;
  for (Zt === void 0 ? (er = 1, kr = _e[Sn[0]]) : (er = 0, kr = Zt); er < kn; er++)
    Cr = Sn[er], kr = Kn(kr, _e[Cr], Cr, _e);
  return kr;
};
function mx(_e) {
  for (var Qt = [], Zt = 0, $n = _e.length; Zt < $n; ) {
    var Sn = _e.charCodeAt(Zt++);
    if (Sn >= 55296 && Sn <= 56319 && Zt < $n) {
      var kn = _e.charCodeAt(Zt++);
      (kn & 64512) == 56320 ? Qt.push(((Sn & 1023) << 10) + (kn & 1023) + 65536) : (Qt.push(Sn), Zt--);
    } else
      Qt.push(Sn);
  }
  return Qt;
}
function Oo(_e) {
  var Qt = mx(_e);
  return Qt.length === 1 ? Qt[0].toString(16) : null;
}
function hx(_e, Qt) {
  var Zt = _e.length, $n = _e.charCodeAt(Qt), Sn;
  return $n >= 55296 && $n <= 56319 && Zt > Qt + 1 && (Sn = _e.charCodeAt(Qt + 1), Sn >= 56320 && Sn <= 57343) ? ($n - 55296) * 1024 + Sn - 56320 + 65536 : $n;
}
function hu(_e) {
  return Object.keys(_e).reduce(function(Qt, Zt) {
    var $n = _e[Zt], Sn = !!$n.icon;
    return Sn ? Qt[$n.iconName] = $n.icon : Qt[Zt] = $n, Qt;
  }, {});
}
function Po(_e, Qt) {
  var Zt = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, $n = Zt.skipHooks, Sn = $n === void 0 ? !1 : $n, kn = hu(Qt);
  typeof Ze.hooks.addPack == "function" && !Sn ? Ze.hooks.addPack(_e, hu(Qt)) : Ze.styles[_e] = V(V({}, Ze.styles[_e] || {}), kn), _e === "fas" && Po("fa", Qt);
}
var Un, qn, Gn, ir = Ze.styles, vx = Ze.shims, gx = (Un = {}, $e(Un, ve, Object.values(mn[ve])), $e(Un, ye, Object.values(mn[ye])), Un), ks = null, qp = {}, Gp = {}, Xp = {}, Kp = {}, Qp = {}, yx = (qn = {}, $e(qn, ve, Object.keys(dn[ve])), $e(qn, ye, Object.keys(dn[ye])), qn);
function bx(_e) {
  return ~Z_.indexOf(_e);
}
function wx(_e, Qt) {
  var Zt = Qt.split("-"), $n = Zt[0], Sn = Zt.slice(1).join("-");
  return $n === _e && Sn !== "" && !bx(Sn) ? Sn : null;
}
var Jp = function() {
  var _e = function($n) {
    return Fi(ir, function(Sn, kn, Kn) {
      return Sn[Kn] = Fi(kn, $n, {}), Sn;
    }, {});
  };
  qp = _e(function($n, Sn, kn) {
    if (Sn[3] && ($n[Sn[3]] = kn), Sn[2]) {
      var Kn = Sn[2].filter(function(er) {
        return typeof er == "number";
      });
      Kn.forEach(function(er) {
        $n[er.toString(16)] = kn;
      });
    }
    return $n;
  }), Gp = _e(function($n, Sn, kn) {
    if ($n[kn] = kn, Sn[2]) {
      var Kn = Sn[2].filter(function(er) {
        return typeof er == "string";
      });
      Kn.forEach(function(er) {
        $n[er] = kn;
      });
    }
    return $n;
  }), Qp = _e(function($n, Sn, kn) {
    var Kn = Sn[2];
    return $n[kn] = kn, Kn.forEach(function(er) {
      $n[er] = kn;
    }), $n;
  });
  var Qt = "far" in ir || H.autoFetchSvg, Zt = Fi(vx, function($n, Sn) {
    var kn = Sn[0], Kn = Sn[1], er = Sn[2];
    return Kn === "far" && !Qt && (Kn = "fas"), typeof kn == "string" && ($n.names[kn] = {
      prefix: Kn,
      iconName: er
    }), typeof kn == "number" && ($n.unicodes[kn.toString(16)] = {
      prefix: Kn,
      iconName: er
    }), $n;
  }, {
    names: {},
    unicodes: {}
  });
  Xp = Zt.names, Kp = Zt.unicodes, ks = fi(H.styleDefault, {
    family: H.familyDefault
  });
};
nx(function(_e) {
  ks = fi(_e.styleDefault, {
    family: H.familyDefault
  });
});
Jp();
function Rs(_e, Qt) {
  return (qp[_e] || {})[Qt];
}
function _x(_e, Qt) {
  return (Gp[_e] || {})[Qt];
}
function Bt(_e, Qt) {
  return (Qp[_e] || {})[Qt];
}
function Zp(_e) {
  return Xp[_e] || {
    prefix: null,
    iconName: null
  };
}
function xx(_e) {
  var Qt = Kp[_e], Zt = Rs("fas", _e);
  return Qt || (Zt ? {
    prefix: "fas",
    iconName: Zt
  } : null) || {
    prefix: null,
    iconName: null
  };
}
function Dt() {
  return ks;
}
var Cs = function() {
  return {
    prefix: null,
    iconName: null,
    rest: []
  };
};
function fi(_e) {
  var Qt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, Zt = Qt.family, $n = Zt === void 0 ? ve : Zt, Sn = dn[$n][_e], kn = pn[$n][_e] || pn[$n][Sn], Kn = _e in Ze.styles ? _e : null;
  return kn || Kn || null;
}
var vu = (Gn = {}, $e(Gn, ve, Object.keys(mn[ve])), $e(Gn, ye, Object.keys(mn[ye])), Gn);
function di(_e) {
  var Qt, Zt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, $n = Zt.skipLookups, Sn = $n === void 0 ? !1 : $n, kn = (Qt = {}, $e(Qt, ve, "".concat(H.cssPrefix, "-").concat(ve)), $e(Qt, ye, "".concat(H.cssPrefix, "-").concat(ye)), Qt), Kn = null, er = ve;
  (_e.includes(kn[ve]) || _e.some(function(kr) {
    return vu[ve].includes(kr);
  })) && (er = ve), (_e.includes(kn[ye]) || _e.some(function(kr) {
    return vu[ye].includes(kr);
  })) && (er = ye);
  var Cr = _e.reduce(function(kr, Yr) {
    var Ms = wx(H.cssPrefix, Yr);
    if (ir[Yr] ? (Yr = gx[er].includes(Yr) ? q_[er][Yr] : Yr, Kn = Yr, kr.prefix = Yr) : yx[er].indexOf(Yr) > -1 ? (Kn = Yr, kr.prefix = fi(Yr, {
      family: er
    })) : Ms ? kr.iconName = Ms : Yr !== H.replacementClass && Yr !== kn[ve] && Yr !== kn[ye] && kr.rest.push(Yr), !Sn && kr.prefix && kr.iconName) {
      var Ds = Kn === "fa" ? Zp(kr.iconName) : {}, Ls = Bt(kr.prefix, kr.iconName);
      Ds.prefix && (Kn = null), kr.iconName = Ds.iconName || Ls || kr.iconName, kr.prefix = Ds.prefix || kr.prefix, kr.prefix === "far" && !ir.far && ir.fas && !H.autoFetchSvg && (kr.prefix = "fas");
    }
    return kr;
  }, Cs());
  return (_e.includes("fa-brands") || _e.includes("fab")) && (Cr.prefix = "fab"), (_e.includes("fa-duotone") || _e.includes("fad")) && (Cr.prefix = "fad"), !Cr.prefix && er === ye && (ir.fass || H.autoFetchSvg) && (Cr.prefix = "fass", Cr.iconName = Bt(Cr.prefix, Cr.iconName) || Cr.iconName), (Cr.prefix === "fa" || Kn === "fa") && (Cr.prefix = Dt() || "fas"), Cr;
}
var Ox = /* @__PURE__ */ function() {
  function _e() {
    j_(this, _e), this.definitions = {};
  }
  return M_(_e, [{
    key: "add",
    value: function() {
      for (var Qt = this, Zt = arguments.length, $n = new Array(Zt), Sn = 0; Sn < Zt; Sn++)
        $n[Sn] = arguments[Sn];
      var kn = $n.reduce(this._pullDefinitions, {});
      Object.keys(kn).forEach(function(Kn) {
        Qt.definitions[Kn] = V(V({}, Qt.definitions[Kn] || {}), kn[Kn]), Po(Kn, kn[Kn]);
        var er = mn[ve][Kn];
        er && Po(er, kn[Kn]), Jp();
      });
    }
  }, {
    key: "reset",
    value: function() {
      this.definitions = {};
    }
  }, {
    key: "_pullDefinitions",
    value: function(Qt, Zt) {
      var $n = Zt.prefix && Zt.iconName && Zt.icon ? {
        0: Zt
      } : Zt;
      return Object.keys($n).map(function(Sn) {
        var kn = $n[Sn], Kn = kn.prefix, er = kn.iconName, Cr = kn.icon, kr = Cr[2];
        Qt[Kn] || (Qt[Kn] = {}), kr.length > 0 && kr.forEach(function(Yr) {
          typeof Yr == "string" && (Qt[Kn][Yr] = Cr);
        }), Qt[Kn][er] = Cr;
      }), Qt;
    }
  }]), _e;
}(), gu = [], or = {}, pr = {}, Px = Object.keys(pr);
function Ex(_e, Qt) {
  var Zt = Qt.mixoutsTo;
  return gu = _e, or = {}, Object.keys(pr).forEach(function($n) {
    Px.indexOf($n) === -1 && delete pr[$n];
  }), gu.forEach(function($n) {
    var Sn = $n.mixout ? $n.mixout() : {};
    if (Object.keys(Sn).forEach(function(Kn) {
      typeof Sn[Kn] == "function" && (Zt[Kn] = Sn[Kn]), Wa(Sn[Kn]) === "object" && Object.keys(Sn[Kn]).forEach(function(er) {
        Zt[Kn] || (Zt[Kn] = {}), Zt[Kn][er] = Sn[Kn][er];
      });
    }), $n.hooks) {
      var kn = $n.hooks();
      Object.keys(kn).forEach(function(Kn) {
        or[Kn] || (or[Kn] = []), or[Kn].push(kn[Kn]);
      });
    }
    $n.provides && $n.provides(pr);
  }), Zt;
}
function Eo(_e, Qt) {
  for (var Zt = arguments.length, $n = new Array(Zt > 2 ? Zt - 2 : 0), Sn = 2; Sn < Zt; Sn++)
    $n[Sn - 2] = arguments[Sn];
  var kn = or[_e] || [];
  return kn.forEach(function(Kn) {
    Qt = Kn.apply(null, [Qt].concat($n));
  }), Qt;
}
function Kt(_e) {
  for (var Qt = arguments.length, Zt = new Array(Qt > 1 ? Qt - 1 : 0), $n = 1; $n < Qt; $n++)
    Zt[$n - 1] = arguments[$n];
  var Sn = or[_e] || [];
  Sn.forEach(function(kn) {
    kn.apply(null, Zt);
  });
}
function wt() {
  var _e = arguments[0], Qt = Array.prototype.slice.call(arguments, 1);
  return pr[_e] ? pr[_e].apply(null, Qt) : void 0;
}
function So(_e) {
  _e.prefix === "fa" && (_e.prefix = "fas");
  var Qt = _e.iconName, Zt = _e.prefix || Dt();
  if (Qt)
    return Qt = Bt(Zt, Qt) || Qt, mu(em.definitions, Zt, Qt) || mu(Ze.styles, Zt, Qt);
}
var em = new Ox(), Sx = function() {
  H.autoReplaceSvg = !1, H.observeMutations = !1, Kt("noAuto");
}, $x = {
  i2svg: function() {
    var _e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    return xt ? (Kt("beforeI2svg", _e), wt("pseudoElements2svg", _e), wt("i2svg", _e)) : Promise.reject("Operation requires a DOM of some kind.");
  },
  watch: function() {
    var _e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, Qt = _e.autoReplaceSvgRoot;
    H.autoReplaceSvg === !1 && (H.autoReplaceSvg = !0), H.observeMutations = !0, dx(function() {
      Rx({
        autoReplaceSvgRoot: Qt
      }), Kt("watch", _e);
    });
  }
}, kx = {
  icon: function(_e) {
    if (_e === null)
      return null;
    if (Wa(_e) === "object" && _e.prefix && _e.iconName)
      return {
        prefix: _e.prefix,
        iconName: Bt(_e.prefix, _e.iconName) || _e.iconName
      };
    if (Array.isArray(_e) && _e.length === 2) {
      var Qt = _e[1].indexOf("fa-") === 0 ? _e[1].slice(3) : _e[1], Zt = fi(_e[0]);
      return {
        prefix: Zt,
        iconName: Bt(Zt, Qt) || Qt
      };
    }
    if (typeof _e == "string" && (_e.indexOf("".concat(H.cssPrefix, "-")) > -1 || _e.match(G_))) {
      var $n = di(_e.split(" "), {
        skipLookups: !0
      });
      return {
        prefix: $n.prefix || Dt(),
        iconName: Bt($n.prefix, $n.iconName) || $n.iconName
      };
    }
    if (typeof _e == "string") {
      var Sn = Dt();
      return {
        prefix: Sn,
        iconName: Bt(Sn, _e) || _e
      };
    }
  }
}, He = {
  noAuto: Sx,
  config: H,
  dom: $x,
  parse: kx,
  library: em,
  findIconDefinition: So,
  toHtml: En
}, Rx = function() {
  var _e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, Qt = _e.autoReplaceSvgRoot, Zt = Qt === void 0 ? ge : Qt;
  (Object.keys(Ze.styles).length > 0 || H.autoFetchSvg) && xt && H.autoReplaceSvg && He.dom.i2svg({
    node: Zt
  });
};
function pi(_e, Qt) {
  return Object.defineProperty(_e, "abstract", {
    get: Qt
  }), Object.defineProperty(_e, "html", {
    get: function() {
      return _e.abstract.map(function(Zt) {
        return En(Zt);
      });
    }
  }), Object.defineProperty(_e, "node", {
    get: function() {
      if (xt) {
        var Zt = ge.createElement("div");
        return Zt.innerHTML = _e.html, Zt.children;
      }
    }
  }), _e;
}
function Cx(_e) {
  var Qt = _e.children, Zt = _e.main, $n = _e.mask, Sn = _e.attributes, kn = _e.styles, Kn = _e.transform;
  if ($s(Kn) && Zt.found && !$n.found) {
    var er = Zt.width, Cr = Zt.height, kr = {
      x: er / Cr / 2,
      y: 0.5
    };
    Sn.style = ui(V(V({}, kn), {}, {
      "transform-origin": "".concat(kr.x + Kn.x / 16, "em ").concat(kr.y + Kn.y / 16, "em")
    }));
  }
  return [{
    tag: "svg",
    attributes: Sn,
    children: Qt
  }];
}
function Tx(_e) {
  var Qt = _e.prefix, Zt = _e.iconName, $n = _e.children, Sn = _e.attributes, kn = _e.symbol, Kn = kn === !0 ? "".concat(Qt, "-").concat(H.cssPrefix, "-").concat(Zt) : kn;
  return [{
    tag: "svg",
    attributes: {
      style: "display: none;"
    },
    children: [{
      tag: "symbol",
      attributes: V(V({}, Sn), {}, {
        id: Kn
      }),
      children: $n
    }]
  }];
}
function Ts(_e) {
  var Qt = _e.icons, Zt = Qt.main, $n = Qt.mask, Sn = _e.prefix, kn = _e.iconName, Kn = _e.transform, er = _e.symbol, Cr = _e.title, kr = _e.maskId, Yr = _e.titleId, Ms = _e.extra, Ds = _e.watchable, Ls = Ds === void 0 ? !1 : Ds, js = $n.found ? $n : Zt, zs = js.width, Fs = js.height, Bs = Sn === "fak", Hs = [H.replacementClass, kn ? "".concat(H.cssPrefix, "-").concat(kn) : ""].filter(function(Tu) {
    return Ms.classes.indexOf(Tu) === -1;
  }).filter(function(Tu) {
    return Tu !== "" || !!Tu;
  }).concat(Ms.classes).join(" "), Ws = {
    children: [],
    attributes: V(V({}, Ms.attributes), {}, {
      "data-prefix": Sn,
      "data-icon": kn,
      class: Hs,
      role: Ms.attributes.role || "img",
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 ".concat(zs, " ").concat(Fs)
    })
  }, Ys = Bs && !~Ms.classes.indexOf("fa-fw") ? {
    width: "".concat(zs / Fs * 16 * 0.0625, "em")
  } : {};
  Ls && (Ws.attributes[Xt] = ""), Cr && (Ws.children.push({
    tag: "title",
    attributes: {
      id: Ws.attributes["aria-labelledby"] || "title-".concat(Yr || vn())
    },
    children: [Cr]
  }), delete Ws.attributes.title);
  var El = V(V({}, Ws), {}, {
    prefix: Sn,
    iconName: kn,
    main: Zt,
    mask: $n,
    maskId: kr,
    transform: Kn,
    symbol: er,
    styles: V(V({}, Ys), Ms.styles)
  }), Mu = $n.found && Zt.found ? wt("generateAbstractMask", El) || {
    children: [],
    attributes: {}
  } : wt("generateAbstractIcon", El) || {
    children: [],
    attributes: {}
  }, Pl = Mu.children, Iu = Mu.attributes;
  return El.children = Pl, El.attributes = Iu, er ? Tx(El) : Cx(El);
}
function yu(_e) {
  var Qt = _e.content, Zt = _e.width, $n = _e.height, Sn = _e.transform, kn = _e.title, Kn = _e.extra, er = _e.watchable, Cr = er === void 0 ? !1 : er, kr = V(V(V({}, Kn.attributes), kn ? {
    title: kn
  } : {}), {}, {
    class: Kn.classes.join(" ")
  });
  Cr && (kr[Xt] = "");
  var Yr = V({}, Kn.styles);
  $s(Sn) && (Yr.transform = lx({
    transform: Sn,
    startCentered: !0,
    width: Zt,
    height: $n
  }), Yr["-webkit-transform"] = Yr.transform);
  var Ms = ui(Yr);
  Ms.length > 0 && (kr.style = Ms);
  var Ds = [];
  return Ds.push({
    tag: "span",
    attributes: kr,
    children: [Qt]
  }), kn && Ds.push({
    tag: "span",
    attributes: {
      class: "sr-only"
    },
    children: [kn]
  }), Ds;
}
function Ax(_e) {
  var Qt = _e.content, Zt = _e.title, $n = _e.extra, Sn = V(V(V({}, $n.attributes), Zt ? {
    title: Zt
  } : {}), {}, {
    class: $n.classes.join(" ")
  }), kn = ui($n.styles);
  kn.length > 0 && (Sn.style = kn);
  var Kn = [];
  return Kn.push({
    tag: "span",
    attributes: Sn,
    children: [Qt]
  }), Zt && Kn.push({
    tag: "span",
    attributes: {
      class: "sr-only"
    },
    children: [Zt]
  }), Kn;
}
var Wi = Ze.styles;
function $o(_e) {
  var Qt = _e[0], Zt = _e[1], $n = _e.slice(4), Sn = _s($n, 1), kn = Sn[0], Kn = null;
  return Array.isArray(kn) ? Kn = {
    tag: "g",
    attributes: {
      class: "".concat(H.cssPrefix, "-").concat(Yt.GROUP)
    },
    children: [{
      tag: "path",
      attributes: {
        class: "".concat(H.cssPrefix, "-").concat(Yt.SECONDARY),
        fill: "currentColor",
        d: kn[0]
      }
    }, {
      tag: "path",
      attributes: {
        class: "".concat(H.cssPrefix, "-").concat(Yt.PRIMARY),
        fill: "currentColor",
        d: kn[1]
      }
    }]
  } : Kn = {
    tag: "path",
    attributes: {
      fill: "currentColor",
      d: kn
    }
  }, {
    found: !0,
    width: Qt,
    height: Zt,
    icon: Kn
  };
}
var Ix = {
  found: !1,
  width: 512,
  height: 512
};
function Nx(_e, Qt) {
  !Fp && !H.showMissingIcons && _e && console.error('Icon with name "'.concat(_e, '" and prefix "').concat(Qt, '" is missing.'));
}
function ko(_e, Qt) {
  var Zt = Qt;
  return Qt === "fa" && H.styleDefault !== null && (Qt = Dt()), new Promise(function($n, Sn) {
    if (wt("missingIconAbstract"), Zt === "fa") {
      var kn = Zp(_e) || {};
      _e = kn.iconName || _e, Qt = kn.prefix || Qt;
    }
    if (_e && Qt && Wi[Qt] && Wi[Qt][_e]) {
      var Kn = Wi[Qt][_e];
      return $n($o(Kn));
    }
    Nx(_e, Qt), $n(V(V({}, Ix), {}, {
      icon: H.showMissingIcons && _e ? wt("missingIconAbstract") || {} : {}
    }));
  });
}
var bu = function() {
}, Ro = H.measurePerformance && Fn && Fn.mark && Fn.measure ? Fn : {
  mark: bu,
  measure: bu
}, Vr = 'FA "6.4.0"', jx = function(_e) {
  return Ro.mark("".concat(Vr, " ").concat(_e, " begins")), function() {
    return tm(_e);
  };
}, tm = function(_e) {
  Ro.mark("".concat(Vr, " ").concat(_e, " ends")), Ro.measure("".concat(Vr, " ").concat(_e), "".concat(Vr, " ").concat(_e, " begins"), "".concat(Vr, " ").concat(_e, " ends"));
}, As = {
  begin: jx,
  end: tm
}, ia = function() {
};
function wu(_e) {
  var Qt = _e.getAttribute ? _e.getAttribute(Xt) : null;
  return typeof Qt == "string";
}
function Mx(_e) {
  var Qt = _e.getAttribute ? _e.getAttribute(Os) : null, Zt = _e.getAttribute ? _e.getAttribute(Ps) : null;
  return Qt && Zt;
}
function Dx(_e) {
  return _e && _e.classList && _e.classList.contains && _e.classList.contains(H.replacementClass);
}
function zx() {
  if (H.autoReplaceSvg === !0)
    return oa.replace;
  var _e = oa[H.autoReplaceSvg];
  return _e || oa.replace;
}
function Lx(_e) {
  return ge.createElementNS("http://www.w3.org/2000/svg", _e);
}
function Fx(_e) {
  return ge.createElement(_e);
}
function rm(_e) {
  var Qt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, Zt = Qt.ceFn, $n = Zt === void 0 ? _e.tag === "svg" ? Lx : Fx : Zt;
  if (typeof _e == "string")
    return ge.createTextNode(_e);
  var Sn = $n(_e.tag);
  Object.keys(_e.attributes || []).forEach(function(Kn) {
    Sn.setAttribute(Kn, _e.attributes[Kn]);
  });
  var kn = _e.children || [];
  return kn.forEach(function(Kn) {
    Sn.appendChild(rm(Kn, {
      ceFn: $n
    }));
  }), Sn;
}
function Wx(_e) {
  var Qt = " ".concat(_e.outerHTML, " ");
  return Qt = "".concat(Qt, "Font Awesome fontawesome.com "), Qt;
}
var oa = {
  replace: function(_e) {
    var Qt = _e[0];
    if (Qt.parentNode)
      if (_e[1].forEach(function($n) {
        Qt.parentNode.insertBefore(rm($n), Qt);
      }), Qt.getAttribute(Xt) === null && H.keepOriginalSource) {
        var Zt = ge.createComment(Wx(Qt));
        Qt.parentNode.replaceChild(Zt, Qt);
      } else
        Qt.remove();
  },
  nest: function(_e) {
    var Qt = _e[0], Zt = _e[1];
    if (~Ss(Qt).indexOf(H.replacementClass))
      return oa.replace(_e);
    var $n = new RegExp("".concat(H.cssPrefix, "-.*"));
    if (delete Zt[0].attributes.id, Zt[0].attributes.class) {
      var Sn = Zt[0].attributes.class.split(" ").reduce(function(Kn, er) {
        return er === H.replacementClass || er.match($n) ? Kn.toSvg.push(er) : Kn.toNode.push(er), Kn;
      }, {
        toNode: [],
        toSvg: []
      });
      Zt[0].attributes.class = Sn.toSvg.join(" "), Sn.toNode.length === 0 ? Qt.removeAttribute("class") : Qt.setAttribute("class", Sn.toNode.join(" "));
    }
    var kn = Zt.map(function(Kn) {
      return En(Kn);
    }).join(`
`);
    Qt.setAttribute(Xt, ""), Qt.innerHTML = kn;
  }
};
function _u(_e) {
  _e();
}
function nm(_e, Qt) {
  var Zt = typeof Qt == "function" ? Qt : ia;
  if (_e.length === 0)
    Zt();
  else {
    var $n = _u;
    H.mutateApproach === H_ && ($n = Mt.requestAnimationFrame || _u), $n(function() {
      var Sn = zx(), kn = As.begin("mutate");
      _e.map(Sn), kn(), Zt();
    });
  }
}
var Is = !1;
function am() {
  Is = !0;
}
function Co() {
  Is = !1;
}
var Ya = null;
function xu(_e) {
  if (fu && H.observeMutations) {
    var Qt = _e.treeCallback, Zt = Qt === void 0 ? ia : Qt, $n = _e.nodeCallback, Sn = $n === void 0 ? ia : $n, kn = _e.pseudoElementsCallback, Kn = kn === void 0 ? ia : kn, er = _e.observeMutationsRoot, Cr = er === void 0 ? ge : er;
    Ya = new fu(function(kr) {
      if (!Is) {
        var Yr = Dt();
        Sr(kr).forEach(function(Ms) {
          if (Ms.type === "childList" && Ms.addedNodes.length > 0 && !wu(Ms.addedNodes[0]) && (H.searchPseudoElements && Kn(Ms.target), Zt(Ms.target)), Ms.type === "attributes" && Ms.target.parentNode && H.searchPseudoElements && Kn(Ms.target.parentNode), Ms.type === "attributes" && wu(Ms.target) && ~J_.indexOf(Ms.attributeName))
            if (Ms.attributeName === "class" && Mx(Ms.target)) {
              var Ds = di(Ss(Ms.target)), Ls = Ds.prefix, js = Ds.iconName;
              Ms.target.setAttribute(Os, Ls || Yr), js && Ms.target.setAttribute(Ps, js);
            } else
              Dx(Ms.target) && Sn(Ms.target);
        });
      }
    }), xt && Ya.observe(Cr, {
      childList: !0,
      attributes: !0,
      characterData: !0,
      subtree: !0
    });
  }
}
function Vx() {
  Ya && Ya.disconnect();
}
function Yx(_e) {
  var Qt = _e.getAttribute("style"), Zt = [];
  return Qt && (Zt = Qt.split(";").reduce(function($n, Sn) {
    var kn = Sn.split(":"), Kn = kn[0], er = kn.slice(1);
    return Kn && er.length > 0 && ($n[Kn] = er.join(":").trim()), $n;
  }, {})), Zt;
}
function Bx(_e) {
  var Qt = _e.getAttribute("data-prefix"), Zt = _e.getAttribute("data-icon"), $n = _e.innerText !== void 0 ? _e.innerText.trim() : "", Sn = di(Ss(_e));
  return Sn.prefix || (Sn.prefix = Dt()), Qt && Zt && (Sn.prefix = Qt, Sn.iconName = Zt), Sn.iconName && Sn.prefix || (Sn.prefix && $n.length > 0 && (Sn.iconName = _x(Sn.prefix, _e.innerText) || Rs(Sn.prefix, Oo(_e.innerText))), !Sn.iconName && H.autoFetchSvg && _e.firstChild && _e.firstChild.nodeType === Node.TEXT_NODE && (Sn.iconName = _e.firstChild.data)), Sn;
}
function Hx(_e) {
  var Qt = Sr(_e.attributes).reduce(function(Sn, kn) {
    return Sn.name !== "class" && Sn.name !== "style" && (Sn[kn.name] = kn.value), Sn;
  }, {}), Zt = _e.getAttribute("title"), $n = _e.getAttribute("data-fa-title-id");
  return H.autoA11y && (Zt ? Qt["aria-labelledby"] = "".concat(H.replacementClass, "-title-").concat($n || vn()) : (Qt["aria-hidden"] = "true", Qt.focusable = "false")), Qt;
}
function Ux() {
  return {
    iconName: null,
    title: null,
    titleId: null,
    prefix: null,
    transform: ut,
    symbol: !1,
    mask: {
      iconName: null,
      prefix: null,
      rest: []
    },
    maskId: null,
    extra: {
      classes: [],
      styles: {},
      attributes: {}
    }
  };
}
function Ou(_e) {
  var Qt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
    styleParser: !0
  }, Zt = Bx(_e), $n = Zt.iconName, Sn = Zt.prefix, kn = Zt.rest, Kn = Hx(_e), er = Eo("parseNodeAttributes", {}, _e), Cr = Qt.styleParser ? Yx(_e) : [];
  return V({
    iconName: $n,
    title: _e.getAttribute("title"),
    titleId: _e.getAttribute("data-fa-title-id"),
    prefix: Sn,
    transform: ut,
    mask: {
      iconName: null,
      prefix: null,
      rest: []
    },
    maskId: null,
    symbol: !1,
    extra: {
      classes: kn,
      styles: Cr,
      attributes: Kn
    }
  }, er);
}
var qx = Ze.styles;
function im(_e) {
  var Qt = H.autoReplaceSvg === "nest" ? Ou(_e, {
    styleParser: !1
  }) : Ou(_e);
  return ~Qt.extra.classes.indexOf(Wp) ? wt("generateLayersText", _e, Qt) : wt("generateSvgReplacementMutation", _e, Qt);
}
var zt = /* @__PURE__ */ new Set();
Es.map(function(_e) {
  zt.add("fa-".concat(_e));
});
Object.keys(dn[ve]).map(zt.add.bind(zt));
Object.keys(dn[ye]).map(zt.add.bind(zt));
zt = On(zt);
function Pu(_e) {
  var Qt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
  if (!xt)
    return Promise.resolve();
  var Zt = ge.documentElement.classList, $n = function(Yr) {
    return Zt.add("".concat(du, "-").concat(Yr));
  }, Sn = function(Yr) {
    return Zt.remove("".concat(du, "-").concat(Yr));
  }, kn = H.autoFetchSvg ? zt : Es.map(function(Yr) {
    return "fa-".concat(Yr);
  }).concat(Object.keys(qx));
  kn.includes("fa") || kn.push("fa");
  var Kn = [".".concat(Wp, ":not([").concat(Xt, "])")].concat(kn.map(function(Yr) {
    return ".".concat(Yr, ":not([").concat(Xt, "])");
  })).join(", ");
  if (Kn.length === 0)
    return Promise.resolve();
  var er = [];
  try {
    er = Sr(_e.querySelectorAll(Kn));
  } catch {
  }
  if (er.length > 0)
    $n("pending"), Sn("complete");
  else
    return Promise.resolve();
  var Cr = As.begin("onTree"), kr = er.reduce(function(Yr, Ms) {
    try {
      var Ds = im(Ms);
      Ds && Yr.push(Ds);
    } catch (Ls) {
      Fp || Ls.name === "MissingIcon" && console.error(Ls);
    }
    return Yr;
  }, []);
  return new Promise(function(Yr, Ms) {
    Promise.all(kr).then(function(Ds) {
      nm(Ds, function() {
        $n("active"), $n("complete"), Sn("pending"), typeof Qt == "function" && Qt(), Cr(), Yr();
      });
    }).catch(function(Ds) {
      Cr(), Ms(Ds);
    });
  });
}
function Gx(_e) {
  var Qt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
  im(_e).then(function(Zt) {
    Zt && nm([Zt], Qt);
  });
}
function Xx(_e) {
  return function(Qt) {
    var Zt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, $n = (Qt || {}).icon ? Qt : So(Qt || {}), Sn = Zt.mask;
    return Sn && (Sn = (Sn || {}).icon ? Sn : So(Sn || {})), _e($n, V(V({}, Zt), {}, {
      mask: Sn
    }));
  };
}
var Kx = function(_e) {
  var Qt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, Zt = Qt.transform, $n = Zt === void 0 ? ut : Zt, Sn = Qt.symbol, kn = Sn === void 0 ? !1 : Sn, Kn = Qt.mask, er = Kn === void 0 ? null : Kn, Cr = Qt.maskId, kr = Cr === void 0 ? null : Cr, Yr = Qt.title, Ms = Yr === void 0 ? null : Yr, Ds = Qt.titleId, Ls = Ds === void 0 ? null : Ds, js = Qt.classes, zs = js === void 0 ? [] : js, Fs = Qt.attributes, Bs = Fs === void 0 ? {} : Fs, Hs = Qt.styles, Ws = Hs === void 0 ? {} : Hs;
  if (_e) {
    var Ys = _e.prefix, El = _e.iconName, Mu = _e.icon;
    return pi(V({
      type: "icon"
    }, _e), function() {
      return Kt("beforeDOMElementCreation", {
        iconDefinition: _e,
        params: Qt
      }), H.autoA11y && (Ms ? Bs["aria-labelledby"] = "".concat(H.replacementClass, "-title-").concat(Ls || vn()) : (Bs["aria-hidden"] = "true", Bs.focusable = "false")), Ts({
        icons: {
          main: $o(Mu),
          mask: er ? $o(er.icon) : {
            found: !1,
            width: null,
            height: null,
            icon: {}
          }
        },
        prefix: Ys,
        iconName: El,
        transform: V(V({}, ut), $n),
        symbol: kn,
        title: Ms,
        maskId: kr,
        titleId: Ls,
        extra: {
          attributes: Bs,
          styles: Ws,
          classes: zs
        }
      });
    });
  }
}, Qx = {
  mixout: function() {
    return {
      icon: Xx(Kx)
    };
  },
  hooks: function() {
    return {
      mutationObserverCallbacks: function(_e) {
        return _e.treeCallback = Pu, _e.nodeCallback = Gx, _e;
      }
    };
  },
  provides: function(_e) {
    _e.i2svg = function(Qt) {
      var Zt = Qt.node, $n = Zt === void 0 ? ge : Zt, Sn = Qt.callback, kn = Sn === void 0 ? function() {
      } : Sn;
      return Pu($n, kn);
    }, _e.generateSvgReplacementMutation = function(Qt, Zt) {
      var $n = Zt.iconName, Sn = Zt.title, kn = Zt.titleId, Kn = Zt.prefix, er = Zt.transform, Cr = Zt.symbol, kr = Zt.mask, Yr = Zt.maskId, Ms = Zt.extra;
      return new Promise(function(Ds, Ls) {
        Promise.all([ko($n, Kn), kr.iconName ? ko(kr.iconName, kr.prefix) : Promise.resolve({
          found: !1,
          width: 512,
          height: 512,
          icon: {}
        })]).then(function(js) {
          var zs = _s(js, 2), Fs = zs[0], Bs = zs[1];
          Ds([Qt, Ts({
            icons: {
              main: Fs,
              mask: Bs
            },
            prefix: Kn,
            iconName: $n,
            transform: er,
            symbol: Cr,
            maskId: Yr,
            title: Sn,
            titleId: kn,
            extra: Ms,
            watchable: !0
          })]);
        }).catch(Ls);
      });
    }, _e.generateAbstractIcon = function(Qt) {
      var Zt = Qt.children, $n = Qt.attributes, Sn = Qt.main, kn = Qt.transform, Kn = Qt.styles, er = ui(Kn);
      er.length > 0 && ($n.style = er);
      var Cr;
      return $s(kn) && (Cr = wt("generateAbstractTransformGrouping", {
        main: Sn,
        transform: kn,
        containerWidth: Sn.width,
        iconWidth: Sn.width
      })), Zt.push(Cr || Sn.icon), {
        children: Zt,
        attributes: $n
      };
    };
  }
}, Jx = {
  mixout: function() {
    return {
      layer: function(_e) {
        var Qt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, Zt = Qt.classes, $n = Zt === void 0 ? [] : Zt;
        return pi({
          type: "layer"
        }, function() {
          Kt("beforeDOMElementCreation", {
            assembler: _e,
            params: Qt
          });
          var Sn = [];
          return _e(function(kn) {
            Array.isArray(kn) ? kn.map(function(Kn) {
              Sn = Sn.concat(Kn.abstract);
            }) : Sn = Sn.concat(kn.abstract);
          }), [{
            tag: "span",
            attributes: {
              class: ["".concat(H.cssPrefix, "-layers")].concat(On($n)).join(" ")
            },
            children: Sn
          }];
        });
      }
    };
  }
}, Zx = {
  mixout: function() {
    return {
      counter: function(_e) {
        var Qt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, Zt = Qt.title, $n = Zt === void 0 ? null : Zt, Sn = Qt.classes, kn = Sn === void 0 ? [] : Sn, Kn = Qt.attributes, er = Kn === void 0 ? {} : Kn, Cr = Qt.styles, kr = Cr === void 0 ? {} : Cr;
        return pi({
          type: "counter",
          content: _e
        }, function() {
          return Kt("beforeDOMElementCreation", {
            content: _e,
            params: Qt
          }), Ax({
            content: _e.toString(),
            title: $n,
            extra: {
              attributes: er,
              styles: kr,
              classes: ["".concat(H.cssPrefix, "-layers-counter")].concat(On(kn))
            }
          });
        });
      }
    };
  }
}, eO = {
  mixout: function() {
    return {
      text: function(_e) {
        var Qt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, Zt = Qt.transform, $n = Zt === void 0 ? ut : Zt, Sn = Qt.title, kn = Sn === void 0 ? null : Sn, Kn = Qt.classes, er = Kn === void 0 ? [] : Kn, Cr = Qt.attributes, kr = Cr === void 0 ? {} : Cr, Yr = Qt.styles, Ms = Yr === void 0 ? {} : Yr;
        return pi({
          type: "text",
          content: _e
        }, function() {
          return Kt("beforeDOMElementCreation", {
            content: _e,
            params: Qt
          }), yu({
            content: _e,
            transform: V(V({}, ut), $n),
            title: kn,
            extra: {
              attributes: kr,
              styles: Ms,
              classes: ["".concat(H.cssPrefix, "-layers-text")].concat(On(er))
            }
          });
        });
      }
    };
  },
  provides: function(_e) {
    _e.generateLayersText = function(Qt, Zt) {
      var $n = Zt.title, Sn = Zt.transform, kn = Zt.extra, Kn = null, er = null;
      if (Dp) {
        var Cr = parseInt(getComputedStyle(Qt).fontSize, 10), kr = Qt.getBoundingClientRect();
        Kn = kr.width / Cr, er = kr.height / Cr;
      }
      return H.autoA11y && !$n && (kn.attributes["aria-hidden"] = "true"), Promise.resolve([Qt, yu({
        content: Qt.innerHTML,
        width: Kn,
        height: er,
        transform: Sn,
        title: $n,
        extra: kn,
        watchable: !0
      })]);
    };
  }
}, tO = new RegExp('"', "ug"), Eu = [1105920, 1112319];
function rO(_e) {
  var Qt = _e.replace(tO, ""), Zt = hx(Qt, 0), $n = Zt >= Eu[0] && Zt <= Eu[1], Sn = Qt.length === 2 ? Qt[0] === Qt[1] : !1;
  return {
    value: Oo(Sn ? Qt[0] : Qt),
    isSecondary: $n || Sn
  };
}
function Su(_e, Qt) {
  var Zt = "".concat(B_).concat(Qt.replace(":", "-"));
  return new Promise(function($n, Sn) {
    if (_e.getAttribute(Zt) !== null)
      return $n();
    var kn = Sr(_e.children), Kn = kn.filter(function(Pl) {
      return Pl.getAttribute(xo) === Qt;
    })[0], er = Mt.getComputedStyle(_e, Qt), Cr = er.getPropertyValue("font-family").match(X_), kr = er.getPropertyValue("font-weight"), Yr = er.getPropertyValue("content");
    if (Kn && !Cr)
      return _e.removeChild(Kn), $n();
    if (Cr && Yr !== "none" && Yr !== "") {
      var Ms = er.getPropertyValue("content"), Ds = ~["Sharp"].indexOf(Cr[2]) ? ye : ve, Ls = ~["Solid", "Regular", "Light", "Thin", "Duotone", "Brands", "Kit"].indexOf(Cr[2]) ? pn[Ds][Cr[2].toLowerCase()] : K_[Ds][kr], js = rO(Ms), zs = js.value, Fs = js.isSecondary, Bs = Cr[0].startsWith("FontAwesome"), Hs = Rs(Ls, zs), Ws = Hs;
      if (Bs) {
        var Ys = xx(zs);
        Ys.iconName && Ys.prefix && (Hs = Ys.iconName, Ls = Ys.prefix);
      }
      if (Hs && !Fs && (!Kn || Kn.getAttribute(Os) !== Ls || Kn.getAttribute(Ps) !== Ws)) {
        _e.setAttribute(Zt, Ws), Kn && _e.removeChild(Kn);
        var El = Ux(), Mu = El.extra;
        Mu.attributes[xo] = Qt, ko(Hs, Ls).then(function(Pl) {
          var Iu = Ts(V(V({}, El), {}, {
            icons: {
              main: Pl,
              mask: Cs()
            },
            prefix: Ls,
            iconName: Ws,
            extra: Mu,
            watchable: !0
          })), Tu = ge.createElement("svg");
          Qt === "::before" ? _e.insertBefore(Tu, _e.firstChild) : _e.appendChild(Tu), Tu.outerHTML = Iu.map(function(Au) {
            return En(Au);
          }).join(`
`), _e.removeAttribute(Zt), $n();
        }).catch(Sn);
      } else
        $n();
    } else
      $n();
  });
}
function nO(_e) {
  return Promise.all([Su(_e, "::before"), Su(_e, "::after")]);
}
function aO(_e) {
  return _e.parentNode !== document.head && !~U_.indexOf(_e.tagName.toUpperCase()) && !_e.getAttribute(xo) && (!_e.parentNode || _e.parentNode.tagName !== "svg");
}
function $u(_e) {
  if (xt)
    return new Promise(function(Qt, Zt) {
      var $n = Sr(_e.querySelectorAll("*")).filter(aO).map(nO), Sn = As.begin("searchPseudoElements");
      am(), Promise.all($n).then(function() {
        Sn(), Co(), Qt();
      }).catch(function() {
        Sn(), Co(), Zt();
      });
    });
}
var iO = {
  hooks: function() {
    return {
      mutationObserverCallbacks: function(_e) {
        return _e.pseudoElementsCallback = $u, _e;
      }
    };
  },
  provides: function(_e) {
    _e.pseudoElements2svg = function(Qt) {
      var Zt = Qt.node, $n = Zt === void 0 ? ge : Zt;
      H.searchPseudoElements && $u($n);
    };
  }
}, ku = !1, oO = {
  mixout: function() {
    return {
      dom: {
        unwatch: function() {
          am(), ku = !0;
        }
      }
    };
  },
  hooks: function() {
    return {
      bootstrap: function() {
        xu(Eo("mutationObserverCallbacks", {}));
      },
      noAuto: function() {
        Vx();
      },
      watch: function(_e) {
        var Qt = _e.observeMutationsRoot;
        ku ? Co() : xu(Eo("mutationObserverCallbacks", {
          observeMutationsRoot: Qt
        }));
      }
    };
  }
}, Ru = function(_e) {
  var Qt = {
    size: 16,
    x: 0,
    y: 0,
    flipX: !1,
    flipY: !1,
    rotate: 0
  };
  return _e.toLowerCase().split(" ").reduce(function(Zt, $n) {
    var Sn = $n.toLowerCase().split("-"), kn = Sn[0], Kn = Sn.slice(1).join("-");
    if (kn && Kn === "h")
      return Zt.flipX = !0, Zt;
    if (kn && Kn === "v")
      return Zt.flipY = !0, Zt;
    if (Kn = parseFloat(Kn), isNaN(Kn))
      return Zt;
    switch (kn) {
      case "grow":
        Zt.size = Zt.size + Kn;
        break;
      case "shrink":
        Zt.size = Zt.size - Kn;
        break;
      case "left":
        Zt.x = Zt.x - Kn;
        break;
      case "right":
        Zt.x = Zt.x + Kn;
        break;
      case "up":
        Zt.y = Zt.y - Kn;
        break;
      case "down":
        Zt.y = Zt.y + Kn;
        break;
      case "rotate":
        Zt.rotate = Zt.rotate + Kn;
        break;
    }
    return Zt;
  }, Qt);
}, sO = {
  mixout: function() {
    return {
      parse: {
        transform: function(_e) {
          return Ru(_e);
        }
      }
    };
  },
  hooks: function() {
    return {
      parseNodeAttributes: function(_e, Qt) {
        var Zt = Qt.getAttribute("data-fa-transform");
        return Zt && (_e.transform = Ru(Zt)), _e;
      }
    };
  },
  provides: function(_e) {
    _e.generateAbstractTransformGrouping = function(Qt) {
      var Zt = Qt.main, $n = Qt.transform, Sn = Qt.containerWidth, kn = Qt.iconWidth, Kn = {
        transform: "translate(".concat(Sn / 2, " 256)")
      }, er = "translate(".concat($n.x * 32, ", ").concat($n.y * 32, ") "), Cr = "scale(".concat($n.size / 16 * ($n.flipX ? -1 : 1), ", ").concat($n.size / 16 * ($n.flipY ? -1 : 1), ") "), kr = "rotate(".concat($n.rotate, " 0 0)"), Yr = {
        transform: "".concat(er, " ").concat(Cr, " ").concat(kr)
      }, Ms = {
        transform: "translate(".concat(kn / 2 * -1, " -256)")
      }, Ds = {
        outer: Kn,
        inner: Yr,
        path: Ms
      };
      return {
        tag: "g",
        attributes: V({}, Ds.outer),
        children: [{
          tag: "g",
          attributes: V({}, Ds.inner),
          children: [{
            tag: Zt.icon.tag,
            children: Zt.icon.children,
            attributes: V(V({}, Zt.icon.attributes), Ds.path)
          }]
        }]
      };
    };
  }
}, Vi = {
  x: 0,
  y: 0,
  width: "100%",
  height: "100%"
};
function Cu(_e) {
  var Qt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
  return _e.attributes && (_e.attributes.fill || Qt) && (_e.attributes.fill = "black"), _e;
}
function lO(_e) {
  return _e.tag === "g" ? _e.children : [_e];
}
var cO = {
  hooks: function() {
    return {
      parseNodeAttributes: function(_e, Qt) {
        var Zt = Qt.getAttribute("data-fa-mask"), $n = Zt ? di(Zt.split(" ").map(function(Sn) {
          return Sn.trim();
        })) : Cs();
        return $n.prefix || ($n.prefix = Dt()), _e.mask = $n, _e.maskId = Qt.getAttribute("data-fa-mask-id"), _e;
      }
    };
  },
  provides: function(_e) {
    _e.generateAbstractMask = function(Qt) {
      var Zt = Qt.children, $n = Qt.attributes, Sn = Qt.main, kn = Qt.mask, Kn = Qt.maskId, er = Qt.transform, Cr = Sn.width, kr = Sn.icon, Yr = kn.width, Ms = kn.icon, Ds = sx({
        transform: er,
        containerWidth: Yr,
        iconWidth: Cr
      }), Ls = {
        tag: "rect",
        attributes: V(V({}, Vi), {}, {
          fill: "white"
        })
      }, js = kr.children ? {
        children: kr.children.map(Cu)
      } : {}, zs = {
        tag: "g",
        attributes: V({}, Ds.inner),
        children: [Cu(V({
          tag: kr.tag,
          attributes: V(V({}, kr.attributes), Ds.path)
        }, js))]
      }, Fs = {
        tag: "g",
        attributes: V({}, Ds.outer),
        children: [zs]
      }, Bs = "mask-".concat(Kn || vn()), Hs = "clip-".concat(Kn || vn()), Ws = {
        tag: "mask",
        attributes: V(V({}, Vi), {}, {
          id: Bs,
          maskUnits: "userSpaceOnUse",
          maskContentUnits: "userSpaceOnUse"
        }),
        children: [Ls, Fs]
      }, Ys = {
        tag: "defs",
        children: [{
          tag: "clipPath",
          attributes: {
            id: Hs
          },
          children: lO(Ms)
        }, Ws]
      };
      return Zt.push(Ys, {
        tag: "rect",
        attributes: V({
          fill: "currentColor",
          "clip-path": "url(#".concat(Hs, ")"),
          mask: "url(#".concat(Bs, ")")
        }, Vi)
      }), {
        children: Zt,
        attributes: $n
      };
    };
  }
}, uO = {
  provides: function(_e) {
    var Qt = !1;
    Mt.matchMedia && (Qt = Mt.matchMedia("(prefers-reduced-motion: reduce)").matches), _e.missingIconAbstract = function() {
      var Zt = [], $n = {
        fill: "currentColor"
      }, Sn = {
        attributeType: "XML",
        repeatCount: "indefinite",
        dur: "2s"
      };
      Zt.push({
        tag: "path",
        attributes: V(V({}, $n), {}, {
          d: "M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"
        })
      });
      var kn = V(V({}, Sn), {}, {
        attributeName: "opacity"
      }), Kn = {
        tag: "circle",
        attributes: V(V({}, $n), {}, {
          cx: "256",
          cy: "364",
          r: "28"
        }),
        children: []
      };
      return Qt || Kn.children.push({
        tag: "animate",
        attributes: V(V({}, Sn), {}, {
          attributeName: "r",
          values: "28;14;28;28;14;28;"
        })
      }, {
        tag: "animate",
        attributes: V(V({}, kn), {}, {
          values: "1;0;1;1;0;1;"
        })
      }), Zt.push(Kn), Zt.push({
        tag: "path",
        attributes: V(V({}, $n), {}, {
          opacity: "1",
          d: "M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"
        }),
        children: Qt ? [] : [{
          tag: "animate",
          attributes: V(V({}, kn), {}, {
            values: "1;0;0;0;0;1;"
          })
        }]
      }), Qt || Zt.push({
        tag: "path",
        attributes: V(V({}, $n), {}, {
          opacity: "0",
          d: "M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"
        }),
        children: [{
          tag: "animate",
          attributes: V(V({}, kn), {}, {
            values: "0;0;1;1;0;0;"
          })
        }]
      }), {
        tag: "g",
        attributes: {
          class: "missing"
        },
        children: Zt
      };
    };
  }
}, fO = {
  hooks: function() {
    return {
      parseNodeAttributes: function(_e, Qt) {
        var Zt = Qt.getAttribute("data-fa-symbol"), $n = Zt === null ? !1 : Zt === "" ? !0 : Zt;
        return _e.symbol = $n, _e;
      }
    };
  }
}, dO = [ux, Qx, Jx, Zx, eO, iO, oO, sO, cO, uO, fO];
Ex(dO, {
  mixoutsTo: He
});
He.noAuto;
He.config;
He.library;
He.dom;
var To = He.parse;
He.findIconDefinition;
He.toHtml;
var pO = He.icon;
He.layer;
He.text;
He.counter;
var Ao = { exports: {} }, Bi, ju;
function Ns() {
  if (ju)
    return Bi;
  ju = 1;
  var _e = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
  return Bi = _e, Bi;
}
var Gi, Lu;
function bO() {
  if (Lu)
    return Gi;
  Lu = 1;
  var _e = Ns();
  function Qt() {
  }
  function Zt() {
  }
  return Zt.resetWarningCache = Qt, Gi = function() {
    function $n(Kn, er, Cr, kr, Yr, Ms) {
      if (Ms !== _e) {
        var Ds = new Error(
          "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
        );
        throw Ds.name = "Invariant Violation", Ds;
      }
    }
    $n.isRequired = $n;
    function Sn() {
      return $n;
    }
    var kn = {
      array: $n,
      bigint: $n,
      bool: $n,
      func: $n,
      number: $n,
      object: $n,
      string: $n,
      symbol: $n,
      any: $n,
      arrayOf: Sn,
      element: $n,
      elementType: $n,
      instanceOf: Sn,
      node: $n,
      objectOf: Sn,
      oneOf: Sn,
      oneOfType: Sn,
      shape: Sn,
      exact: Sn,
      checkPropTypes: Zt,
      resetWarningCache: Qt
    };
    return kn.PropTypes = kn, kn;
  }, Gi;
}
Ao.exports = bO()();
var xO = Ao.exports;
const ie = /* @__PURE__ */ Fm(xO);
function Fu(_e, Qt) {
  var Zt = Object.keys(_e);
  if (Object.getOwnPropertySymbols) {
    var $n = Object.getOwnPropertySymbols(_e);
    Qt && ($n = $n.filter(function(Sn) {
      return Object.getOwnPropertyDescriptor(_e, Sn).enumerable;
    })), Zt.push.apply(Zt, $n);
  }
  return Zt;
}
function Ct(_e) {
  for (var Qt = 1; Qt < arguments.length; Qt++) {
    var Zt = arguments[Qt] != null ? arguments[Qt] : {};
    Qt % 2 ? Fu(Object(Zt), !0).forEach(function($n) {
      sr(_e, $n, Zt[$n]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(_e, Object.getOwnPropertyDescriptors(Zt)) : Fu(Object(Zt)).forEach(function($n) {
      Object.defineProperty(_e, $n, Object.getOwnPropertyDescriptor(Zt, $n));
    });
  }
  return _e;
}
function Ba(_e) {
  "@babel/helpers - typeof";
  return Ba = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(Qt) {
    return typeof Qt;
  } : function(Qt) {
    return Qt && typeof Symbol == "function" && Qt.constructor === Symbol && Qt !== Symbol.prototype ? "symbol" : typeof Qt;
  }, Ba(_e);
}
function sr(_e, Qt, Zt) {
  return Qt in _e ? Object.defineProperty(_e, Qt, {
    value: Zt,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : _e[Qt] = Zt, _e;
}
function OO(_e, Qt) {
  if (_e == null)
    return {};
  var Zt = {}, $n = Object.keys(_e), Sn, kn;
  for (kn = 0; kn < $n.length; kn++)
    Sn = $n[kn], !(Qt.indexOf(Sn) >= 0) && (Zt[Sn] = _e[Sn]);
  return Zt;
}
function PO(_e, Qt) {
  if (_e == null)
    return {};
  var Zt = OO(_e, Qt), $n, Sn;
  if (Object.getOwnPropertySymbols) {
    var kn = Object.getOwnPropertySymbols(_e);
    for (Sn = 0; Sn < kn.length; Sn++)
      $n = kn[Sn], !(Qt.indexOf($n) >= 0) && Object.prototype.propertyIsEnumerable.call(_e, $n) && (Zt[$n] = _e[$n]);
  }
  return Zt;
}
function Io(_e) {
  return EO(_e) || SO(_e) || $O(_e) || kO();
}
function EO(_e) {
  if (Array.isArray(_e))
    return No(_e);
}
function SO(_e) {
  if (typeof Symbol < "u" && _e[Symbol.iterator] != null || _e["@@iterator"] != null)
    return Array.from(_e);
}
function $O(_e, Qt) {
  if (_e) {
    if (typeof _e == "string")
      return No(_e, Qt);
    var Zt = Object.prototype.toString.call(_e).slice(8, -1);
    if (Zt === "Object" && _e.constructor && (Zt = _e.constructor.name), Zt === "Map" || Zt === "Set")
      return Array.from(_e);
    if (Zt === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Zt))
      return No(_e, Qt);
  }
}
function No(_e, Qt) {
  (Qt == null || Qt > _e.length) && (Qt = _e.length);
  for (var Zt = 0, $n = new Array(Qt); Zt < Qt; Zt++)
    $n[Zt] = _e[Zt];
  return $n;
}
function kO() {
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function RO(_e) {
  var Qt, Zt = _e.beat, $n = _e.fade, Sn = _e.beatFade, kn = _e.bounce, Kn = _e.shake, er = _e.flash, Cr = _e.spin, kr = _e.spinPulse, Yr = _e.spinReverse, Ms = _e.pulse, Ds = _e.fixedWidth, Ls = _e.inverse, js = _e.border, zs = _e.listItem, Fs = _e.flip, Bs = _e.size, Hs = _e.rotation, Ws = _e.pull, Ys = (Qt = {
    "fa-beat": Zt,
    "fa-fade": $n,
    "fa-beat-fade": Sn,
    "fa-bounce": kn,
    "fa-shake": Kn,
    "fa-flash": er,
    "fa-spin": Cr,
    "fa-spin-reverse": Yr,
    "fa-spin-pulse": kr,
    "fa-pulse": Ms,
    "fa-fw": Ds,
    "fa-inverse": Ls,
    "fa-border": js,
    "fa-li": zs,
    "fa-flip": Fs === !0,
    "fa-flip-horizontal": Fs === "horizontal" || Fs === "both",
    "fa-flip-vertical": Fs === "vertical" || Fs === "both"
  }, sr(Qt, "fa-".concat(Bs), typeof Bs < "u" && Bs !== null), sr(Qt, "fa-rotate-".concat(Hs), typeof Hs < "u" && Hs !== null && Hs !== 0), sr(Qt, "fa-pull-".concat(Ws), typeof Ws < "u" && Ws !== null), sr(Qt, "fa-swap-opacity", _e.swapOpacity), Qt);
  return Object.keys(Ys).map(function(El) {
    return Ys[El] ? El : null;
  }).filter(function(El) {
    return El;
  });
}
function CO(_e) {
  return _e = _e - 0, _e === _e;
}
function lm(_e) {
  return CO(_e) ? _e : (_e = _e.replace(/[\-_\s]+(.)?/g, function(Qt, Zt) {
    return Zt ? Zt.toUpperCase() : "";
  }), _e.substr(0, 1).toLowerCase() + _e.substr(1));
}
var TO = ["style"];
function AO(_e) {
  return _e.charAt(0).toUpperCase() + _e.slice(1);
}
function IO(_e) {
  return _e.split(";").map(function(Qt) {
    return Qt.trim();
  }).filter(function(Qt) {
    return Qt;
  }).reduce(function(Qt, Zt) {
    var $n = Zt.indexOf(":"), Sn = lm(Zt.slice(0, $n)), kn = Zt.slice($n + 1).trim();
    return Sn.startsWith("webkit") ? Qt[AO(Sn)] = kn : Qt[Sn] = kn, Qt;
  }, {});
}
function cm(_e, Qt) {
  var Zt = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  if (typeof Qt == "string")
    return Qt;
  var $n = (Qt.children || []).map(function(Cr) {
    return cm(_e, Cr);
  }), Sn = Object.keys(Qt.attributes || {}).reduce(function(Cr, kr) {
    var Yr = Qt.attributes[kr];
    switch (kr) {
      case "class":
        Cr.attrs.className = Yr, delete Qt.attributes.class;
        break;
      case "style":
        Cr.attrs.style = IO(Yr);
        break;
      default:
        kr.indexOf("aria-") === 0 || kr.indexOf("data-") === 0 ? Cr.attrs[kr.toLowerCase()] = Yr : Cr.attrs[lm(kr)] = Yr;
    }
    return Cr;
  }, {
    attrs: {}
  }), kn = Zt.style, Kn = kn === void 0 ? {} : kn, er = PO(Zt, TO);
  return Sn.attrs.style = Ct(Ct({}, Sn.attrs.style), Kn), _e.apply(void 0, [Qt.tag, Ct(Ct({}, Sn.attrs), er)].concat(Io($n)));
}
var um = !1;
try {
  um = !0;
} catch {
}
function NO() {
  if (!um && console && typeof console.error == "function") {
    var _e;
    (_e = console).error.apply(_e, arguments);
  }
}
function Wu(_e) {
  if (_e && Ba(_e) === "object" && _e.prefix && _e.iconName && _e.icon)
    return _e;
  if (To.icon)
    return To.icon(_e);
  if (_e === null)
    return null;
  if (_e && Ba(_e) === "object" && _e.prefix && _e.iconName)
    return _e;
  if (Array.isArray(_e) && _e.length === 2)
    return {
      prefix: _e[0],
      iconName: _e[1]
    };
  if (typeof _e == "string")
    return {
      prefix: "fas",
      iconName: _e
    };
}
function Xi(_e, Qt) {
  return Array.isArray(Qt) && Qt.length > 0 || !Array.isArray(Qt) && Qt ? sr({}, _e, Qt) : {};
}
var $r = /* @__PURE__ */ React.forwardRef(function(_e, Qt) {
  var Zt = _e.icon, $n = _e.mask, Sn = _e.symbol, kn = _e.className, Kn = _e.title, er = _e.titleId, Cr = _e.maskId, kr = Wu(Zt), Yr = Xi("classes", [].concat(Io(RO(_e)), Io(kn.split(" ")))), Ms = Xi("transform", typeof _e.transform == "string" ? To.transform(_e.transform) : _e.transform), Ds = Xi("mask", Wu($n)), Ls = pO(kr, Ct(Ct(Ct(Ct({}, Yr), Ms), Ds), {}, {
    symbol: Sn,
    title: Kn,
    titleId: er,
    maskId: Cr
  }));
  if (!Ls)
    return NO("Could not find icon", kr), null;
  var js = Ls.abstract, zs = {
    ref: Qt
  };
  return Object.keys(_e).forEach(function(Fs) {
    $r.defaultProps.hasOwnProperty(Fs) || (zs[Fs] = _e[Fs]);
  }), jO(js[0], zs);
});
$r.displayName = "FontAwesomeIcon";
$r.propTypes = {
  beat: ie.bool,
  border: ie.bool,
  beatFade: ie.bool,
  bounce: ie.bool,
  className: ie.string,
  fade: ie.bool,
  flash: ie.bool,
  mask: ie.oneOfType([ie.object, ie.array, ie.string]),
  maskId: ie.string,
  fixedWidth: ie.bool,
  inverse: ie.bool,
  flip: ie.oneOf([!0, !1, "horizontal", "vertical", "both"]),
  icon: ie.oneOfType([ie.object, ie.array, ie.string]),
  listItem: ie.bool,
  pull: ie.oneOf(["right", "left"]),
  pulse: ie.bool,
  rotation: ie.oneOf([0, 90, 180, 270]),
  shake: ie.bool,
  size: ie.oneOf(["2xs", "xs", "sm", "lg", "xl", "2xl", "1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x", "9x", "10x"]),
  spin: ie.bool,
  spinPulse: ie.bool,
  spinReverse: ie.bool,
  symbol: ie.oneOfType([ie.bool, ie.string]),
  title: ie.string,
  titleId: ie.string,
  transform: ie.oneOfType([ie.string, ie.object]),
  swapOpacity: ie.bool
};
$r.defaultProps = {
  border: !1,
  className: "",
  mask: null,
  maskId: null,
  fixedWidth: !1,
  inverse: !1,
  flip: !1,
  icon: null,
  listItem: !1,
  pull: null,
  pulse: !1,
  rotation: null,
  size: null,
  spin: !1,
  spinPulse: !1,
  spinReverse: !1,
  beat: !1,
  fade: !1,
  beatFade: !1,
  bounce: !1,
  shake: !1,
  symbol: !1,
  title: "",
  titleId: null,
  transform: null,
  swapOpacity: !1
};
var jO = cm.bind(null, React.createElement);
function MO({
  color: _e,
  annotation: Qt,
  setAnnotation: Zt,
  setAnnotationOpen: $n,
  annotationOpen: Sn
}) {
  const [kn, Kn] = reactExports.useState(!1), [er, Cr] = reactExports.useState(Qt);
  return /* @__PURE__ */ oe(
    "div",
    {
      style: {
        marginRight: "5px",
        color: Sn || kn ? _e : "lightgray"
      },
      onClick: (kr) => kr.stopPropagation(),
      onMouseEnter: () => Kn(!0),
      onMouseLeave: () => Kn(!1),
      children: /* @__PURE__ */ lt$2(
        dr,
        {
          width: 150,
          trapFocus: !0,
          position: "bottom",
          withArrow: !0,
          arrowSize: 10,
          shadow: "md",
          onChange: $n,
          opened: Sn,
          children: [
            /* @__PURE__ */ oe(dr.Target, { children: /* @__PURE__ */ oe(
              $r,
              {
                icon: Tp.faEdit,
                onClick: (kr) => {
                  kr.stopPropagation(), $n(!Sn);
                }
              }
            ) }),
            /* @__PURE__ */ oe(
              dr.Dropdown,
              {
                sx: (kr) => ({
                  background: kr.colorScheme === "dark" ? kr.colors.dark[7] : kr.white
                }),
                children: /* @__PURE__ */ lt$2(fn, { spacing: 4, children: [
                  /* @__PURE__ */ oe(
                    wp,
                    {
                      autosize: !0,
                      maxRows: 10,
                      label: "Annotation",
                      value: er,
                      size: "xs",
                      mt: 0,
                      onChange: (kr) => Cr(kr.currentTarget.value)
                    }
                  ),
                  /* @__PURE__ */ lt$2(ws, { position: "right", spacing: 4, children: [
                    /* @__PURE__ */ oe(
                      qc,
                      {
                        compact: !0,
                        onClick: (kr) => {
                          kr.stopPropagation(), $n(!1);
                        },
                        size: "xs",
                        variant: "outline",
                        children: "Close"
                      }
                    ),
                    /* @__PURE__ */ oe(
                      qc,
                      {
                        compact: !0,
                        onClick: (kr) => {
                          kr.stopPropagation(), Zt(er), $n(!1);
                        },
                        size: "xs",
                        children: "Save"
                      }
                    )
                  ] })
                ] })
              }
            )
          ]
        }
      )
    }
  );
}
var fm = {};
(function(_e) {
  Object.defineProperty(_e, "__esModule", { value: !0 });
  var Qt = "fas", Zt = "bookmark", $n = 384, Sn = 512, kn = [128278, 61591], Kn = "f02e", er = "M0 48V487.7C0 501.1 10.9 512 24.3 512c5 0 9.9-1.5 14-4.4L192 400 345.7 507.6c4.1 2.9 9 4.4 14 4.4c13.4 0 24.3-10.9 24.3-24.3V48c0-26.5-21.5-48-48-48H48C21.5 0 0 21.5 0 48z";
  _e.definition = {
    prefix: Qt,
    iconName: Zt,
    icon: [
      $n,
      Sn,
      kn,
      Kn,
      er
    ]
  }, _e.faBookmark = _e.definition, _e.prefix = Qt, _e.iconName = Zt, _e.width = $n, _e.height = Sn, _e.ligatures = kn, _e.unicode = Kn, _e.svgPathData = er, _e.aliases = kn;
})(fm);
function DO({
  onClick: _e,
  isBookmarked: Qt,
  color: Zt
}) {
  const [$n, Sn] = reactExports.useState(!1);
  return /* @__PURE__ */ oe(
    "div",
    {
      style: {
        marginRight: "5px",
        color: Qt || $n ? Zt : "lightgray"
      },
      onClick: (kn) => {
        kn.stopPropagation(), _e();
      },
      onMouseEnter: () => Sn(!0),
      onMouseLeave: () => Sn(!1),
      children: /* @__PURE__ */ oe($r, { icon: fm.faBookmark })
    }
  );
}
function zO({
  depth: _e,
  yOffset: Qt,
  node: Zt,
  config: $n,
  onClick: Sn,
  isHover: kn,
  setHover: Kn,
  colorMap: er,
  isCurrent: Cr,
  extraHeight: kr,
  setExtraHeight: Yr
}) {
  const [Ms, { width: Ds, height: Ls }] = Ry(), js = qr({
    config: {
      duration: $n.animationDuration,
      easing: At.easeInOutSine
    },
    top: _e * $n.verticalSpace + $n.marginTop + Qt - $n.verticalSpace / 2 + kr
  }), zs = qr({
    config: {
      duration: $n.animationDuration,
      easing: At.easeInOutSine
    },
    opacity: Cr ? 1 : 0
  });
  reactExports.useEffect(() => {
    Cr && Yr(Ls);
  }, [Ls, Cr, Yr]);
  const [Fs, Bs] = reactExports.useState(!1);
  return /* @__PURE__ */ oe(
    Ht.div,
    {
      style: {
        ...js,
        cursor: "pointer",
        position: "absolute",
        height: $n.verticalSpace * 2,
        flexWrap: "wrap",
        width: "100%"
      },
      className: "node-description",
      onClick: Sn,
      "data-node-id": Zt.id,
      onMouseEnter: () => Kn(Zt.id),
      onMouseLeave: () => Kn(null),
      children: /* @__PURE__ */ lt$2(fn, { style: { height: "100%" }, spacing: 0, children: [
        /* @__PURE__ */ lt$2(ws, { noWrap: !0, style: { height: $n.verticalSpace }, children: [
          /* @__PURE__ */ oe(
            Cp,
            {
              position: "top-start",
              openDelay: 200,
              withinPortal: !0,
              withArrow: !0,
              color: "gray",
              multiline: !0,
              sx: { maxWidth: "200px" },
              label: /* @__PURE__ */ lt$2(fn, { spacing: 0, children: [
                /* @__PURE__ */ oe(gr, { weight: 600, children: Zt.label }),
                $n.getAnnotation(Zt.id).length > 0 ? /* @__PURE__ */ oe(gr, { size: "xs", children: $n.getAnnotation(Zt.id) }) : null
              ] }),
              children: /* @__PURE__ */ oe(
                "div",
                {
                  style: {
                    width: `calc(100% - ${$n.marginRight}px)`,
                    display: "flex",
                    flexDirection: "row"
                  },
                  children: /* @__PURE__ */ lt$2(
                    "div",
                    {
                      style: {
                        alignItems: "start",
                        justifyContent: "center",
                        display: "flex",
                        flexDirection: "column",
                        marginRight: "auto",
                        width: "100%"
                      },
                      children: [
                        /* @__PURE__ */ oe(
                          "p",
                          {
                            style: {
                              maxWidth: "100%",
                              margin: 0,
                              overflow: "hidden",
                              textOverflow: "ellipsis",
                              whiteSpace: "nowrap"
                            },
                            children: Zt.label
                          }
                        ),
                        P(Zt) ? /* @__PURE__ */ oe(
                          "p",
                          {
                            style: {
                              maxWidth: `${$n.labelWidth}px`,
                              margin: 0,
                              overflow: "hidden",
                              textOverflow: "ellipsis",
                              whiteSpace: "nowrap",
                              color: "gray",
                              fontSize: 10
                            },
                            children: $n.getAnnotation(Zt.id)
                          }
                        ) : null
                      ]
                    }
                  )
                }
              )
            }
          ),
          $n.bookmarkNode !== null && (kn || Fs || $n.isBookmarked(Zt.id)) ? /* @__PURE__ */ oe(
            DO,
            {
              color: er[Zt.event],
              isBookmarked: $n.isBookmarked(Zt.id),
              onClick: () => {
                var Hs;
                return (Hs = $n.bookmarkNode) == null ? void 0 : Hs.call($n, Zt.id);
              }
            }
          ) : null,
          $n.annotateNode !== null && (kn || Fs) ? /* @__PURE__ */ oe(
            MO,
            {
              color: "cornflowerblue",
              annotationOpen: Fs,
              setAnnotationOpen: (Hs) => Bs(Hs),
              setAnnotation: (Hs) => {
                var Ws;
                return (Ws = $n.annotateNode) == null ? void 0 : Ws.call($n, Zt.id, Hs);
              },
              annotation: $n.getAnnotation(Zt.id)
            }
          ) : null
        ] }),
        Cr ? /* @__PURE__ */ oe(Ht.div, { style: { ...zs }, ref: Ms, children: $n.nodeExtra[Zt.event] || $n.nodeExtra["*"] }) : null
      ] })
    }
  );
}
function LO({
  nodes: _e,
  links: Qt,
  currentNode: Zt,
  config: $n
}) {
  const [Sn, kn] = reactExports.useState(null), [Kn, er] = reactExports.useState(0), [Cr, kr] = reactExports.useState(0), Yr = reactExports.useRef(null);
  reactExports.useEffect(() => {
    er(0);
  }, [Zt]);
  const Ms = reactExports.useMemo(() => Math.max(
    ...Object.values(_e).map((El) => El.width ? El.width : 0)
    // config.nodeWidthShown
  ), [_e]), Ds = reactExports.useMemo(() => Math.max(
    ...Object.values(_e).map(
      (El) => El.height ? El.height : 0
    )
  ), [_e]), Ls = qr({
    config: {
      duration: $n.animationDuration,
      easing: At.easeInOutSine
    },
    width: `${$n.labelWidth + $n.marginRight + ($n.nodeWidthShown - Ms > 0 ? ($n.nodeWidthShown - Ms) * $n.gutter : 0)}px`
  }), js = qr({
    config: {
      duration: $n.animationDuration,
      easing: At.easeInOutSine
    },
    width: `${(Ms > $n.nodeWidthShown ? $n.nodeWidthShown : Ms) * $n.gutter + $n.marginLeft + $n.nodeAndLabelGap}px`
  }), zs = qr({
    config: {
      duration: $n.animationDuration,
      easing: At.easeInOutSine
    },
    immediate: Kn !== 0,
    transform: `translate(${$n.marginLeft + Kn}, ${$n.marginTop})`
  }), Fs = reactExports.useMemo(() => {
    const El = [
      "#1F77B4",
      "#FF7F0E",
      "#2CA02C",
      "#D62728",
      "#9467BD",
      "#8C564B",
      "#CFECF9",
      "#7F7F7F",
      "#BCBD22",
      "#17BECF"
    ];
    let Mu = 0;
    const Pl = {};
    return Pl.Root = "black", Object.values(_e).forEach((Iu) => {
      Pl[Iu.data.event] || (Pl[Iu.data.event] = El[Mu % 10], Mu += 1);
    }), Pl;
  }, [_e]), Bs = reactExports.useMemo(() => Object.values(_e).filter((El) => El.width === 0).map((El) => /* @__PURE__ */ oe(
    zO,
    {
      isCurrent: El.id === Zt,
      extraHeight: El.depth > _e[Zt].depth ? Cr : 0,
      setExtraHeight: kr,
      config: $n,
      depth: El.depth,
      node: El.data,
      currentNode: Zt,
      onClick: () => $n.changeCurrent(El.id),
      isHover: El.id === Sn,
      setHover: (Mu) => kn(Mu),
      colorMap: Fs,
      yOffset: 0
    },
    El.id
  )), [_e, Zt, Cr, $n, Sn, Fs]), Hs = reactExports.useMemo(() => Qt.map((El) => {
    const Mu = El.source.width, Pl = El.target.width;
    return /* @__PURE__ */ oe(
      N_,
      {
        uniqueKey: El.source.id + El.target.id,
        parentNode: El.source,
        nodes: _e,
        x1Width: Mu,
        x2Width: Pl,
        y1Depth: El.source.depth,
        y2Depth: El.target.depth,
        config: $n,
        xOffset: (Ms > $n.nodeWidthShown ? $n.nodeWidthShown : Ms) * $n.gutter,
        y1Offset: El.source.depth > _e[Zt].depth ? Cr : 0,
        y2Offset: El.target.depth > _e[Zt].depth ? Cr : 0
      },
      El.source.id + El.target.id
    );
  }), [Qt, _e, $n, Ms, Zt, Cr]), Ws = reactExports.useMemo(() => Object.values(_e).map((El) => /* @__PURE__ */ oe(
    I_,
    {
      width: El.width,
      depth: El.depth,
      onClick: () => {
        El.width !== 0 && kn(null), $n.changeCurrent(El.id);
      },
      nodes: _e,
      extraHeight: El.depth > _e[Zt].depth ? Cr : 0,
      config: $n,
      node: El.data,
      currentNode: Zt,
      isHover: El.id === Sn,
      setHover: (Mu) => kn(Mu),
      colorMap: Fs,
      xOffset: (Ms > $n.nodeWidthShown ? $n.nodeWidthShown : Ms) * $n.gutter,
      yOffset: 0
    },
    El.id
  )), [
    _e,
    Zt,
    Cr,
    $n,
    Sn,
    Fs,
    Ms
  ]);
  reactExports.useEffect(() => {
    const El = zoom().scaleExtent([1, 1]).translateExtent([
      [($n.nodeWidthShown - Ms) * $n.gutter, 0],
      [
        (Ms > $n.nodeWidthShown ? $n.nodeWidthShown : Ms) * $n.gutter + $n.marginLeft + $n.nodeAndLabelGap,
        0
      ]
    ]);
    El.on("zoom", (Pl) => {
      const { transform: Iu } = Pl;
      er(Iu.x);
    });
    const Mu = select("#panLayer");
    El.transform(Mu, identity), select("#panLayer").call(El);
  }, [Ms, $n, Zt]);
  const Ys = Object.keys(_e).length;
  return reactExports.useEffect(() => {
    if (!Yr.current)
      return;
    const El = _e[Zt].depth * $n.verticalSpace, Mu = Yr.current.scrollTop, Pl = Yr.current.clientHeight;
    Yr.current && El > Mu + Pl - $n.verticalSpace && Yr.current.scrollTo(
      0,
      El - Pl + $n.verticalSpace + $n.marginTop
    );
  }, [Ys, $n.marginTop, $n.verticalSpace, _e, Zt]), /* @__PURE__ */ lt$2(
    "div",
    {
      ref: Yr,
      style: {
        display: "flex",
        height: "100%",
        gap: "0px",
        overflowY: "auto",
        overflowX: "hidden"
      },
      children: [
        /* @__PURE__ */ oe(
          Ht.div,
          {
            style: {
              height: "100%",
              ...js
            },
            children: /* @__PURE__ */ oe(
              "svg",
              {
                id: "panLayer",
                style: {
                  overflow: "hidden",
                  height: `${(Ds + 1) * $n.verticalSpace + $n.marginTop + Cr}px`,
                  width: `${$n.nodeWidthShown * $n.gutter + $n.marginLeft + $n.nodeAndLabelGap}px`
                },
                cursor: Ms > $n.nodeWidthShown ? "ew-resize" : "default",
                children: /* @__PURE__ */ lt$2(Ht.g, { ...zs, children: [
                  Hs,
                  Ws
                ] })
              }
            )
          }
        ),
        /* @__PURE__ */ oe(
          Ht.div,
          {
            style: {
              position: "relative",
              ...Ls
            },
            children: Bs
          }
        )
      ]
    }
  );
}
function FO(_e, Qt, Zt, $n) {
  const Sn = /* @__PURE__ */ new Set(), kn = [];
  let Kn = 0;
  for (kn.push(_e[Qt]); kn.length > 0; ) {
    const er = kn.pop();
    Sn.has(er.id) ? er.width = Zt[er.id] : (er.width = Kn, Zt[er.id] = er.width, Sn.add(er.id)), er.children ? kn.push(
      ...er.children.sort((Cr, kr) => {
        const Yr = $n.includes(Cr.id) ? 1 : 0, Ms = $n.includes(kr.id) ? 1 : 0;
        return Yr - Ms;
      })
    ) : Kn += 1;
  }
}
function dm(_e, Qt, Zt, $n) {
  if (!_e[Qt])
    return !1;
  if (Qt === Zt)
    return $n.push(Qt), !0;
  const Sn = _e[Qt].children || [];
  for (const kn of Sn)
    if (dm(_e, kn.id, Zt, $n))
      return $n.push(kn.id), !0;
  return !1;
}
function WO(_e, Qt, Zt) {
  const $n = [];
  return dm(_e, Qt, Zt, $n), [Qt, ...$n.reverse()];
}
function VO(_e, Qt, Zt) {
  const $n = {}, Sn = WO(_e, Zt, Qt);
  return FO(_e, Zt, $n, Sn), Sn;
}
function YO(_e, Qt, Zt) {
  const { stratifiedMap: $n, links: Sn } = reactExports.useMemo(() => {
    const kn = Object.values(_e), Kn = Mm().id((kr) => kr.id).parentId((kr) => kr.id === Zt ? null : P(kr) ? kr.parent : null)(kn), er = Kn.descendants(), Cr = {};
    return er.forEach((kr) => {
      Cr[kr.id] = kr;
    }), VO(Cr, Qt, Zt), { stratifiedMap: Cr, links: Kn.links() };
  }, [Qt, Zt, _e]);
  return { stratifiedMap: $n, links: Sn };
}
const BO = {
  gutter: 25,
  nodeWidthShown: 3,
  verticalSpace: 30,
  marginTop: 50,
  marginRight: 40,
  marginLeft: 50,
  animationDuration: 500,
  annotationHeight: 150,
  nodeAndLabelGap: 20,
  labelWidth: 150,
  iconConfig: null,
  changeCurrent: () => null,
  bookmarkNode: () => null,
  annotateNode: null,
  getAnnotation: () => "",
  isBookmarked: () => !1,
  nodeExtra: {}
};
function HO({
  nodeMap: _e,
  root: Qt,
  currentNode: Zt,
  config: $n
}) {
  const { stratifiedMap: Sn, links: kn } = YO(
    _e,
    Zt,
    Qt
  ), Kn = reactExports.useMemo(() => ({ ...BO, ...$n }), [$n]);
  return /* @__PURE__ */ oe(
    LO,
    {
      nodes: Sn,
      links: kn,
      config: Kn,
      currentNode: Zt
    }
  );
}
var Fr = Vu;
Fr.createRoot, Fr.hydrateRoot;
function Trrack({ cell: _e, setCurrentNodeTarget: Qt, scroll: Zt }) {
  const $n = _e.trrackManager, [Sn, kn] = useModelState("trrack"), [, Kn] = useModelState("interactions"), er = useHookstate($n.trrack.current.id), [Cr] = useModelState("gdr_record"), kr = Cr || _e.generatedDataframes, Yr = useHookstate($n.trrack.root.id);
  useHookstateEffect(() => {
    const Ds = (Sn == null ? void 0 : Sn.root) ?? null;
    function Ls() {
      kn($n.trrack.exportObject());
      const Fs = getInteractionsFromRoot($n.trrack);
      Kn(Fs);
    }
    (!Ds || Ds !== $n.trrack.root.id) && Ls();
    function js() {
      Ls(), setTimeout(() => {
        const Fs = document.querySelector(
          `[data-node-id="${er.value}"]`
        );
        Qt(Fs), Zt();
      }, 200), er.set($n.trrack.current.id);
    }
    function zs() {
      Yr.set($n.trrack.root.id), js();
    }
    return _e.trrackManager.currentChange.connect(js), _e.trrackManager.trrackInstanceChange.connect(zs), () => {
      _e.trrackManager.currentChange.disconnect(js), _e.trrackManager.trrackInstanceChange.disconnect(zs);
    };
  }, [_e, Sn, er, Zt, Qt]);
  const Ms = reactExports.useMemo(() => {
    const Ds = Object.values(
      kr || {}
    ).filter((Ls) => Ls.isDynamic || Ls.current_node_id === er.value);
    return {
      changeCurrent: (Ls) => {
        $n.trrack.to(Ls);
      },
      bookmarkNode: null,
      labelWidth: 100,
      verticalSpace: 25,
      marginTop: 25,
      gutter: 25,
      marginLeft: 15,
      animationDuration: 200,
      annotateNode: null,
      nodeExtra: {
        "*": Ds.length > 0 ? /* @__PURE__ */ React.createElement(Card, { shadow: "xl", withBorder: !0 }, /* @__PURE__ */ React.createElement(Text, { component: "span" }, /* @__PURE__ */ React.createElement("strong", null, "Dataframes: ")), /* @__PURE__ */ React.createElement(Group$1, { spacing: "5px" }, Ds.map((Ls) => /* @__PURE__ */ React.createElement(
          DataframeNameBadge,
          {
            cell: _e,
            dfRecord: Ls,
            actions: {
              goToNode: !1,
              deleteEntry: !1
            }
          }
        )))) : null
      }
    };
  }, [er.value, $n, kr]);
  return /* @__PURE__ */ React.createElement(
    HO,
    {
      root: $n.trrack.root.id,
      currentNode: er.value,
      nodeMap: $n.trrack.exportObject().nodes,
      config: Ms
    }
  );
}
function Summary({ trrack: _e, current: Qt }) {
  const [Zt, $n] = reactExports.useState([]);
  return reactExports.useEffect(() => {
    let Sn = Qt, kn = [];
    for (; Sn !== _e.root.id; ) {
      kn.push(Sn);
      const er = _e.graph.backend.nodes[Sn];
      P(er) && (Sn = er.parent);
    }
    kn.includes(_e.root.id) && (kn = kn.filter((er) => er !== _e.root.id)), kn.reverse();
    const Kn = kn.map((er) => _e.graph.backend.nodes[er]);
    $n(Kn);
  }, [_e, Qt]), /* @__PURE__ */ React.createElement(List, null, Zt.length === 0 && /* @__PURE__ */ React.createElement(Alert, { color: "gray", ta: "center" }, "Start interacting with the output to see a summary of your actions till now."), Zt.map((Sn) => /* @__PURE__ */ React.createElement(List.Item, { key: Sn.id }, Sn.label)));
}
const MAX_SIDEBAR_HEIGHT = "555px", useStyles = createStyles(() => ({
  tabPanelContentContainer: {
    overflow: "auto",
    margin: "0.5em",
    padding: "1em",
    maxHeight: MAX_SIDEBAR_HEIGHT
  },
  border: {
    border: "1px solid rgba(0, 0, 0, 0.2)"
  },
  content: {
    border: "1px solid rgba(100,100,100, 0.3)",
    backgroundColor: "rgba(100,100,100, 0.1)"
  },
  removeOverflow: {
    "& > div:first-of-type": {
      overflow: "hidden !important"
    }
  }
})), TAB_KEYS = {
  TRRACK: { key: "trrack", label: "Trrack" },
  PREDICTIONS: { key: "predictions", label: "Predictions" },
  SUMMARY: { key: "summary", label: "Summary" }
};
function Sidebar({ cell: _e }) {
  const [Qt, Zt] = useLocalStorage({
    key: "_persist_sidebar_active_tab",
    defaultValue: TAB_KEYS.TRRACK.key
  }), { scrollIntoView: $n, targetRef: Sn, scrollableRef: kn } = useScrollIntoView({
    duration: 300,
    isList: !0,
    offset: 40
  }), { ref: Kn, entry: er } = useIntersection({
    root: kn.current
  }), { classes: Cr, cx: kr } = useStyles();
  return /* @__PURE__ */ React.createElement(Tabs, { value: Qt, onTabChange: Zt }, /* @__PURE__ */ React.createElement(Tabs.List, null, /* @__PURE__ */ React.createElement(Tabs.Tab, { value: TAB_KEYS.TRRACK.key, icon: /* @__PURE__ */ React.createElement(IconGitMerge, null) }, TAB_KEYS.TRRACK.label), /* @__PURE__ */ React.createElement(Tabs.Tab, { icon: /* @__PURE__ */ React.createElement(IconListDetails, null), value: TAB_KEYS.SUMMARY.key }, TAB_KEYS.SUMMARY.label), !1), /* @__PURE__ */ React.createElement(Tabs.Panel, { value: TAB_KEYS.TRRACK.key }, /* @__PURE__ */ React.createElement(
    Box,
    {
      ref: kn,
      className: kr(
        Cr.tabPanelContentContainer,
        Cr.removeOverflow
      )
    },
    /* @__PURE__ */ React.createElement(
      Trrack,
      {
        cell: _e,
        setCurrentNodeTarget: (Yr) => {
          Yr && (Sn.current = Yr, Kn(Sn.current));
        },
        scroll: () => {
          er != null && er.isIntersecting || $n({ alignment: "end" });
        }
      }
    )
  )), /* @__PURE__ */ React.createElement(Tabs.Panel, { value: TAB_KEYS.PREDICTIONS.key }, /* @__PURE__ */ React.createElement(Box, { className: Cr.tabPanelContentContainer }, /* @__PURE__ */ React.createElement(Center$2, { className: Cr.content, h: "400px" }, Math.random().toFixed(4)))), /* @__PURE__ */ React.createElement(Tabs.Panel, { value: TAB_KEYS.SUMMARY.key }, /* @__PURE__ */ React.createElement(Box, { className: Cr.tabPanelContentContainer }, /* @__PURE__ */ React.createElement(
    Summary,
    {
      trrack: _e.trrackManager.trrack,
      current: _e.trrackManager.trrack.current.id
    }
  ))));
}
const EMPTY$1 = {};
function shallowEqual(_e, Qt) {
  _e === void 0 && (_e = EMPTY$1), Qt === void 0 && (Qt = EMPTY$1);
  const Zt = Object.keys(_e), $n = Object.keys(Qt);
  return _e === Qt || Zt.length === $n.length && Zt.every((Sn) => _e[Sn] === Qt[Sn]);
}
/*!
 * https://github.com/Starcounter-Jack/JSON-Patch
 * (c) 2017-2022 Joachim Wester
 * MIT licensed
 */
var __extends = globalThis && globalThis.__extends || function() {
  var _e = function(Qt, Zt) {
    return _e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function($n, Sn) {
      $n.__proto__ = Sn;
    } || function($n, Sn) {
      for (var kn in Sn)
        Sn.hasOwnProperty(kn) && ($n[kn] = Sn[kn]);
    }, _e(Qt, Zt);
  };
  return function(Qt, Zt) {
    _e(Qt, Zt);
    function $n() {
      this.constructor = Qt;
    }
    Qt.prototype = Zt === null ? Object.create(Zt) : ($n.prototype = Zt.prototype, new $n());
  };
}(), _hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwnProperty(_e, Qt) {
  return _hasOwnProperty.call(_e, Qt);
}
function _objectKeys(_e) {
  if (Array.isArray(_e)) {
    for (var Qt = new Array(_e.length), Zt = 0; Zt < Qt.length; Zt++)
      Qt[Zt] = "" + Zt;
    return Qt;
  }
  if (Object.keys)
    return Object.keys(_e);
  var $n = [];
  for (var Sn in _e)
    hasOwnProperty(_e, Sn) && $n.push(Sn);
  return $n;
}
function _deepClone(_e) {
  switch (typeof _e) {
    case "object":
      return JSON.parse(JSON.stringify(_e));
    case "undefined":
      return null;
    default:
      return _e;
  }
}
function isInteger(_e) {
  for (var Qt = 0, Zt = _e.length, $n; Qt < Zt; ) {
    if ($n = _e.charCodeAt(Qt), $n >= 48 && $n <= 57) {
      Qt++;
      continue;
    }
    return !1;
  }
  return !0;
}
function escapePathComponent(_e) {
  return _e.indexOf("/") === -1 && _e.indexOf("~") === -1 ? _e : _e.replace(/~/g, "~0").replace(/\//g, "~1");
}
function unescapePathComponent(_e) {
  return _e.replace(/~1/g, "/").replace(/~0/g, "~");
}
function hasUndefined(_e) {
  if (_e === void 0)
    return !0;
  if (_e) {
    if (Array.isArray(_e)) {
      for (var Qt = 0, Zt = _e.length; Qt < Zt; Qt++)
        if (hasUndefined(_e[Qt]))
          return !0;
    } else if (typeof _e == "object") {
      for (var $n = _objectKeys(_e), Sn = $n.length, kn = 0; kn < Sn; kn++)
        if (hasUndefined(_e[$n[kn]]))
          return !0;
    }
  }
  return !1;
}
function patchErrorMessageFormatter(_e, Qt) {
  var Zt = [_e];
  for (var $n in Qt) {
    var Sn = typeof Qt[$n] == "object" ? JSON.stringify(Qt[$n], null, 2) : Qt[$n];
    typeof Sn < "u" && Zt.push($n + ": " + Sn);
  }
  return Zt.join(`
`);
}
var PatchError = (
  /** @class */
  function(_e) {
    __extends(Qt, _e);
    function Qt(Zt, $n, Sn, kn, Kn) {
      var er = this.constructor, Cr = _e.call(this, patchErrorMessageFormatter(Zt, { name: $n, index: Sn, operation: kn, tree: Kn })) || this;
      return Cr.name = $n, Cr.index = Sn, Cr.operation = kn, Cr.tree = Kn, Object.setPrototypeOf(Cr, er.prototype), Cr.message = patchErrorMessageFormatter(Zt, { name: $n, index: Sn, operation: kn, tree: Kn }), Cr;
    }
    return Qt;
  }(Error)
), JsonPatchError = PatchError, deepClone = _deepClone, objOps = {
  add: function(_e, Qt, Zt) {
    return _e[Qt] = this.value, { newDocument: Zt };
  },
  remove: function(_e, Qt, Zt) {
    var $n = _e[Qt];
    return delete _e[Qt], { newDocument: Zt, removed: $n };
  },
  replace: function(_e, Qt, Zt) {
    var $n = _e[Qt];
    return _e[Qt] = this.value, { newDocument: Zt, removed: $n };
  },
  move: function(_e, Qt, Zt) {
    var $n = getValueByPointer(Zt, this.path);
    $n && ($n = _deepClone($n));
    var Sn = applyOperation(Zt, { op: "remove", path: this.from }).removed;
    return applyOperation(Zt, { op: "add", path: this.path, value: Sn }), { newDocument: Zt, removed: $n };
  },
  copy: function(_e, Qt, Zt) {
    var $n = getValueByPointer(Zt, this.from);
    return applyOperation(Zt, { op: "add", path: this.path, value: _deepClone($n) }), { newDocument: Zt };
  },
  test: function(_e, Qt, Zt) {
    return { newDocument: Zt, test: _areEquals(_e[Qt], this.value) };
  },
  _get: function(_e, Qt, Zt) {
    return this.value = _e[Qt], { newDocument: Zt };
  }
}, arrOps = {
  add: function(_e, Qt, Zt) {
    return isInteger(Qt) ? _e.splice(Qt, 0, this.value) : _e[Qt] = this.value, { newDocument: Zt, index: Qt };
  },
  remove: function(_e, Qt, Zt) {
    var $n = _e.splice(Qt, 1);
    return { newDocument: Zt, removed: $n[0] };
  },
  replace: function(_e, Qt, Zt) {
    var $n = _e[Qt];
    return _e[Qt] = this.value, { newDocument: Zt, removed: $n };
  },
  move: objOps.move,
  copy: objOps.copy,
  test: objOps.test,
  _get: objOps._get
};
function getValueByPointer(_e, Qt) {
  if (Qt == "")
    return _e;
  var Zt = { op: "_get", path: Qt };
  return applyOperation(_e, Zt), Zt.value;
}
function applyOperation(_e, Qt, Zt, $n, Sn, kn) {
  if (Zt === void 0 && (Zt = !1), $n === void 0 && ($n = !0), Sn === void 0 && (Sn = !0), kn === void 0 && (kn = 0), Zt && (typeof Zt == "function" ? Zt(Qt, 0, _e, Qt.path) : validator(Qt, 0)), Qt.path === "") {
    var Kn = { newDocument: _e };
    if (Qt.op === "add")
      return Kn.newDocument = Qt.value, Kn;
    if (Qt.op === "replace")
      return Kn.newDocument = Qt.value, Kn.removed = _e, Kn;
    if (Qt.op === "move" || Qt.op === "copy")
      return Kn.newDocument = getValueByPointer(_e, Qt.from), Qt.op === "move" && (Kn.removed = _e), Kn;
    if (Qt.op === "test") {
      if (Kn.test = _areEquals(_e, Qt.value), Kn.test === !1)
        throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", kn, Qt, _e);
      return Kn.newDocument = _e, Kn;
    } else {
      if (Qt.op === "remove")
        return Kn.removed = _e, Kn.newDocument = null, Kn;
      if (Qt.op === "_get")
        return Qt.value = _e, Kn;
      if (Zt)
        throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", kn, Qt, _e);
      return Kn;
    }
  } else {
    $n || (_e = _deepClone(_e));
    var er = Qt.path || "", Cr = er.split("/"), kr = _e, Yr = 1, Ms = Cr.length, Ds = void 0, Ls = void 0, js = void 0;
    for (typeof Zt == "function" ? js = Zt : js = validator; ; ) {
      if (Ls = Cr[Yr], Ls && Ls.indexOf("~") != -1 && (Ls = unescapePathComponent(Ls)), Sn && (Ls == "__proto__" || Ls == "prototype" && Yr > 0 && Cr[Yr - 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 (Zt && Ds === void 0 && (kr[Ls] === void 0 ? Ds = Cr.slice(0, Yr).join("/") : Yr == Ms - 1 && (Ds = Qt.path), Ds !== void 0 && js(Qt, 0, _e, Ds)), Yr++, Array.isArray(kr)) {
        if (Ls === "-")
          Ls = kr.length;
        else {
          if (Zt && !isInteger(Ls))
            throw new JsonPatchError("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", kn, Qt, _e);
          isInteger(Ls) && (Ls = ~~Ls);
        }
        if (Yr >= Ms) {
          if (Zt && Qt.op === "add" && Ls > kr.length)
            throw new JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", kn, Qt, _e);
          var Kn = arrOps[Qt.op].call(Qt, kr, Ls, _e);
          if (Kn.test === !1)
            throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", kn, Qt, _e);
          return Kn;
        }
      } else if (Yr >= Ms) {
        var Kn = objOps[Qt.op].call(Qt, kr, Ls, _e);
        if (Kn.test === !1)
          throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", kn, Qt, _e);
        return Kn;
      }
      if (kr = kr[Ls], Zt && Yr < Ms && (!kr || typeof kr != "object"))
        throw new JsonPatchError("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", kn, Qt, _e);
    }
  }
}
function applyPatch(_e, Qt, Zt, $n, Sn) {
  if ($n === void 0 && ($n = !0), Sn === void 0 && (Sn = !0), Zt && !Array.isArray(Qt))
    throw new JsonPatchError("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
  $n || (_e = _deepClone(_e));
  for (var kn = new Array(Qt.length), Kn = 0, er = Qt.length; Kn < er; Kn++)
    kn[Kn] = applyOperation(_e, Qt[Kn], Zt, !0, Sn, Kn), _e = kn[Kn].newDocument;
  return kn.newDocument = _e, kn;
}
function applyReducer(_e, Qt, Zt) {
  var $n = applyOperation(_e, Qt);
  if ($n.test === !1)
    throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", Zt, Qt, _e);
  return $n.newDocument;
}
function validator(_e, Qt, Zt, $n) {
  if (typeof _e != "object" || _e === null || Array.isArray(_e))
    throw new JsonPatchError("Operation is not an object", "OPERATION_NOT_AN_OBJECT", Qt, _e, Zt);
  if (objOps[_e.op]) {
    if (typeof _e.path != "string")
      throw new JsonPatchError("Operation `path` property is not a string", "OPERATION_PATH_INVALID", Qt, _e, Zt);
    if (_e.path.indexOf("/") !== 0 && _e.path.length > 0)
      throw new JsonPatchError('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", Qt, _e, Zt);
    if ((_e.op === "move" || _e.op === "copy") && typeof _e.from != "string")
      throw new JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", Qt, _e, Zt);
    if ((_e.op === "add" || _e.op === "replace" || _e.op === "test") && _e.value === void 0)
      throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", Qt, _e, Zt);
    if ((_e.op === "add" || _e.op === "replace" || _e.op === "test") && hasUndefined(_e.value))
      throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", Qt, _e, Zt);
    if (Zt) {
      if (_e.op == "add") {
        var Sn = _e.path.split("/").length, kn = $n.split("/").length;
        if (Sn !== kn + 1 && Sn !== kn)
          throw new JsonPatchError("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", Qt, _e, Zt);
      } else if (_e.op === "replace" || _e.op === "remove" || _e.op === "_get") {
        if (_e.path !== $n)
          throw new JsonPatchError("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", Qt, _e, Zt);
      } else if (_e.op === "move" || _e.op === "copy") {
        var Kn = { op: "_get", path: _e.from, value: void 0 }, er = validate([Kn], Zt);
        if (er && er.name === "OPERATION_PATH_UNRESOLVABLE")
          throw new JsonPatchError("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", Qt, _e, Zt);
      }
    }
  } else
    throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", Qt, _e, Zt);
}
function validate(_e, Qt, Zt) {
  try {
    if (!Array.isArray(_e))
      throw new JsonPatchError("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
    if (Qt)
      applyPatch(_deepClone(Qt), _deepClone(_e), Zt || !0);
    else {
      Zt = Zt || validator;
      for (var $n = 0; $n < _e.length; $n++)
        Zt(_e[$n], $n, Qt, void 0);
    }
  } catch (Sn) {
    if (Sn instanceof JsonPatchError)
      return Sn;
    throw Sn;
  }
}
function _areEquals(_e, Qt) {
  if (_e === Qt)
    return !0;
  if (_e && Qt && typeof _e == "object" && typeof Qt == "object") {
    var Zt = Array.isArray(_e), $n = Array.isArray(Qt), Sn, kn, Kn;
    if (Zt && $n) {
      if (kn = _e.length, kn != Qt.length)
        return !1;
      for (Sn = kn; Sn-- !== 0; )
        if (!_areEquals(_e[Sn], Qt[Sn]))
          return !1;
      return !0;
    }
    if (Zt != $n)
      return !1;
    var er = Object.keys(_e);
    if (kn = er.length, kn !== Object.keys(Qt).length)
      return !1;
    for (Sn = kn; Sn-- !== 0; )
      if (!Qt.hasOwnProperty(er[Sn]))
        return !1;
    for (Sn = kn; Sn-- !== 0; )
      if (Kn = er[Sn], !_areEquals(_e[Kn], Qt[Kn]))
        return !1;
    return !0;
  }
  return _e !== _e && Qt !== Qt;
}
const core = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  JsonPatchError,
  _areEquals,
  applyOperation,
  applyPatch,
  applyReducer,
  deepClone,
  getValueByPointer,
  validate,
  validator
}, Symbol.toStringTag, { value: "Module" }));
/*!
 * https://github.com/Starcounter-Jack/JSON-Patch
 * (c) 2017-2021 Joachim Wester
 * MIT license
 */
var beforeDict = /* @__PURE__ */ new WeakMap(), Mirror = (
  /** @class */
  function() {
    function _e(Qt) {
      this.observers = /* @__PURE__ */ new Map(), this.obj = Qt;
    }
    return _e;
  }()
), ObserverInfo = (
  /** @class */
  function() {
    function _e(Qt, Zt) {
      this.callback = Qt, this.observer = Zt;
    }
    return _e;
  }()
);
function getMirror(_e) {
  return beforeDict.get(_e);
}
function getObserverFromMirror(_e, Qt) {
  return _e.observers.get(Qt);
}
function removeObserverFromMirror(_e, Qt) {
  _e.observers.delete(Qt.callback);
}
function unobserve(_e, Qt) {
  Qt.unobserve();
}
function observe(_e, Qt) {
  var Zt = [], $n, Sn = getMirror(_e);
  if (!Sn)
    Sn = new Mirror(_e), beforeDict.set(_e, Sn);
  else {
    var kn = getObserverFromMirror(Sn, Qt);
    $n = kn && kn.observer;
  }
  if ($n)
    return $n;
  if ($n = {}, Sn.value = _deepClone(_e), Qt) {
    $n.callback = Qt, $n.next = null;
    var Kn = function() {
      generate($n);
    }, er = function() {
      clearTimeout($n.next), $n.next = setTimeout(Kn);
    };
    typeof window < "u" && (window.addEventListener("mouseup", er), window.addEventListener("keyup", er), window.addEventListener("mousedown", er), window.addEventListener("keydown", er), window.addEventListener("change", er));
  }
  return $n.patches = Zt, $n.object = _e, $n.unobserve = function() {
    generate($n), clearTimeout($n.next), removeObserverFromMirror(Sn, $n), typeof window < "u" && (window.removeEventListener("mouseup", er), window.removeEventListener("keyup", er), window.removeEventListener("mousedown", er), window.removeEventListener("keydown", er), window.removeEventListener("change", er));
  }, Sn.observers.set(Qt, new ObserverInfo(Qt, $n)), $n;
}
function generate(_e, Qt) {
  Qt === void 0 && (Qt = !1);
  var Zt = beforeDict.get(_e.object);
  _generate(Zt.value, _e.object, _e.patches, "", Qt), _e.patches.length && applyPatch(Zt.value, _e.patches);
  var $n = _e.patches;
  return $n.length > 0 && (_e.patches = [], _e.callback && _e.callback($n)), $n;
}
function _generate(_e, Qt, Zt, $n, Sn) {
  if (Qt !== _e) {
    typeof Qt.toJSON == "function" && (Qt = Qt.toJSON());
    for (var kn = _objectKeys(Qt), Kn = _objectKeys(_e), er = !1, Cr = Kn.length - 1; Cr >= 0; Cr--) {
      var kr = Kn[Cr], Yr = _e[kr];
      if (hasOwnProperty(Qt, kr) && !(Qt[kr] === void 0 && Yr !== void 0 && Array.isArray(Qt) === !1)) {
        var Ms = Qt[kr];
        typeof Yr == "object" && Yr != null && typeof Ms == "object" && Ms != null && Array.isArray(Yr) === Array.isArray(Ms) ? _generate(Yr, Ms, Zt, $n + "/" + escapePathComponent(kr), Sn) : Yr !== Ms && (Sn && Zt.push({ op: "test", path: $n + "/" + escapePathComponent(kr), value: _deepClone(Yr) }), Zt.push({ op: "replace", path: $n + "/" + escapePathComponent(kr), value: _deepClone(Ms) }));
      } else
        Array.isArray(_e) === Array.isArray(Qt) ? (Sn && Zt.push({ op: "test", path: $n + "/" + escapePathComponent(kr), value: _deepClone(Yr) }), Zt.push({ op: "remove", path: $n + "/" + escapePathComponent(kr) }), er = !0) : (Sn && Zt.push({ op: "test", path: $n, value: _e }), Zt.push({ op: "replace", path: $n, value: Qt }));
    }
    if (!(!er && kn.length == Kn.length))
      for (var Cr = 0; Cr < kn.length; Cr++) {
        var kr = kn[Cr];
        !hasOwnProperty(_e, kr) && Qt[kr] !== void 0 && Zt.push({ op: "add", path: $n + "/" + escapePathComponent(kr), value: _deepClone(Qt[kr]) });
      }
  }
}
function compare$7(_e, Qt, Zt) {
  Zt === void 0 && (Zt = !1);
  var $n = [];
  return _generate(_e, Qt, $n, "", Zt), $n;
}
const duplex = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  compare: compare$7,
  generate,
  observe,
  unobserve
}, Symbol.toStringTag, { value: "Module" }));
Object.assign({}, core, duplex, {
  JsonPatchError: PatchError,
  deepClone: _deepClone,
  escapePathComponent,
  unescapePathComponent
});
var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,]/g, jsonStringifyPrettyCompact = function _e(Qt, Zt) {
  var $n, Sn, kn;
  return Zt = Zt || {}, $n = JSON.stringify(
    [1],
    void 0,
    Zt.indent === void 0 ? 2 : Zt.indent
  ).slice(2, -3), Sn = $n === "" ? 1 / 0 : Zt.maxLength === void 0 ? 80 : Zt.maxLength, kn = Zt.replacer, function Kn(er, Cr, kr) {
    var Yr, Ms, Ds, Ls, js, zs, Fs, Bs, Hs, Ws, Ys, El;
    if (er && typeof er.toJSON == "function" && (er = er.toJSON()), Ys = JSON.stringify(er, kn), Ys === void 0)
      return Ys;
    if (Fs = Sn - Cr.length - kr, Ys.length <= Fs && (Hs = Ys.replace(
      stringOrChar,
      function(Mu, Pl) {
        return Pl || Mu + " ";
      }
    ), Hs.length <= Fs))
      return Hs;
    if (kn != null && (er = JSON.parse(Ys), kn = void 0), typeof er == "object" && er !== null) {
      if (Bs = Cr + $n, Ds = [], Ms = 0, Array.isArray(er))
        for (Ws = "[", Yr = "]", Fs = er.length; Ms < Fs; Ms++)
          Ds.push(
            Kn(er[Ms], Bs, Ms === Fs - 1 ? 0 : 1) || "null"
          );
      else
        for (Ws = "{", Yr = "}", zs = Object.keys(er), Fs = zs.length; Ms < Fs; Ms++)
          Ls = zs[Ms], js = JSON.stringify(Ls) + ": ", El = Kn(
            er[Ls],
            Bs,
            js.length + (Ms === Fs - 1 ? 0 : 1)
          ), El !== void 0 && Ds.push(js + El);
      if (Ds.length > 0)
        return [Ws, $n + Ds.join(`,
` + Bs), Yr].join(
          `
` + Cr
        );
    }
    return Ys;
  }(Qt, "", 0);
};
const stringify$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(jsonStringifyPrettyCompact);
function adjustSpatial(_e, Qt, Zt) {
  let $n;
  Qt.x2 && (Qt.x ? (Zt && _e.x > _e.x2 && ($n = _e.x, _e.x = _e.x2, _e.x2 = $n), _e.width = _e.x2 - _e.x) : _e.x = _e.x2 - (_e.width || 0)), Qt.xc && (_e.x = _e.xc - (_e.width || 0) / 2), Qt.y2 && (Qt.y ? (Zt && _e.y > _e.y2 && ($n = _e.y, _e.y = _e.y2, _e.y2 = $n), _e.height = _e.y2 - _e.y) : _e.y = _e.y2 - (_e.height || 0)), Qt.yc && (_e.y = _e.yc - (_e.height || 0) / 2);
}
var Constants = {
  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
}, Ops = {
  "*": (_e, Qt) => _e * Qt,
  "+": (_e, Qt) => _e + Qt,
  "-": (_e, Qt) => _e - Qt,
  "/": (_e, Qt) => _e / Qt,
  "%": (_e, Qt) => _e % Qt,
  ">": (_e, Qt) => _e > Qt,
  "<": (_e, Qt) => _e < Qt,
  "<=": (_e, Qt) => _e <= Qt,
  ">=": (_e, Qt) => _e >= Qt,
  "==": (_e, Qt) => _e == Qt,
  "!=": (_e, Qt) => _e != Qt,
  "===": (_e, Qt) => _e === Qt,
  "!==": (_e, Qt) => _e !== Qt,
  "&": (_e, Qt) => _e & Qt,
  "|": (_e, Qt) => _e | Qt,
  "^": (_e, Qt) => _e ^ Qt,
  "<<": (_e, Qt) => _e << Qt,
  ">>": (_e, Qt) => _e >> Qt,
  ">>>": (_e, Qt) => _e >>> Qt
}, Unary = {
  "+": (_e) => +_e,
  "-": (_e) => -_e,
  "~": (_e) => ~_e,
  "!": (_e) => !_e
};
const slice = Array.prototype.slice, apply = (_e, Qt, Zt) => {
  const $n = Zt ? Zt(Qt[0]) : Qt[0];
  return $n[_e].apply($n, slice.call(Qt, 1));
}, datetime = (_e, Qt, Zt, $n, Sn, kn, Kn) => new Date(_e, Qt || 0, Zt ?? 1, $n || 0, Sn || 0, kn || 0, Kn || 0);
var Functions = {
  // math functions
  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, Qt, Zt) => Math.max(Qt, Math.min(Zt, _e)),
  // date functions
  now: Date.now,
  utc: Date.UTC,
  datetime,
  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(),
  // sequence functions
  length: (_e) => _e.length,
  join: function() {
    return apply("join", arguments);
  },
  indexof: function() {
    return apply("indexOf", arguments);
  },
  lastindexof: function() {
    return apply("lastIndexOf", arguments);
  },
  slice: function() {
    return apply("slice", arguments);
  },
  reverse: (_e) => _e.slice().reverse(),
  // string functions
  parseFloat,
  parseInt,
  upper: (_e) => String(_e).toUpperCase(),
  lower: (_e) => String(_e).toLowerCase(),
  substring: function() {
    return apply("substring", arguments, String);
  },
  split: function() {
    return apply("split", arguments, String);
  },
  replace: function() {
    return apply("replace", arguments, String);
  },
  trim: (_e) => String(_e).trim(),
  // regexp functions
  regexp: RegExp,
  test: (_e, Qt) => RegExp(_e).test(Qt)
};
const EventFunctions = ["view", "item", "group", "xy", "x", "y"], DisallowedMethods = /* @__PURE__ */ new Set([Function, eval, setTimeout, setInterval]);
typeof setImmediate == "function" && DisallowedMethods.add(setImmediate);
const Visitors = {
  Literal: (_e, Qt) => Qt.value,
  Identifier: (_e, Qt) => {
    const Zt = Qt.name;
    return _e.memberDepth > 0 ? Zt : Zt === "datum" ? _e.datum : Zt === "event" ? _e.event : Zt === "item" ? _e.item : Constants[Zt] || _e.params["$" + Zt];
  },
  MemberExpression: (_e, Qt) => {
    const Zt = !Qt.computed, $n = _e(Qt.object);
    Zt && (_e.memberDepth += 1);
    const Sn = _e(Qt.property);
    if (Zt && (_e.memberDepth -= 1), DisallowedMethods.has($n[Sn])) {
      console.error(`Prevented interpretation of member "${Sn}" which could lead to insecure code execution`);
      return;
    }
    return $n[Sn];
  },
  CallExpression: (_e, Qt) => {
    const Zt = Qt.arguments;
    let $n = Qt.callee.name;
    return $n.startsWith("_") && ($n = $n.slice(1)), $n === "if" ? _e(Zt[0]) ? _e(Zt[1]) : _e(Zt[2]) : (_e.fn[$n] || Functions[$n]).apply(_e.fn, Zt.map(_e));
  },
  ArrayExpression: (_e, Qt) => Qt.elements.map(_e),
  BinaryExpression: (_e, Qt) => Ops[Qt.operator](_e(Qt.left), _e(Qt.right)),
  UnaryExpression: (_e, Qt) => Unary[Qt.operator](_e(Qt.argument)),
  ConditionalExpression: (_e, Qt) => _e(Qt.test) ? _e(Qt.consequent) : _e(Qt.alternate),
  LogicalExpression: (_e, Qt) => Qt.operator === "&&" ? _e(Qt.left) && _e(Qt.right) : _e(Qt.left) || _e(Qt.right),
  ObjectExpression: (_e, Qt) => Qt.properties.reduce((Zt, $n) => {
    _e.memberDepth += 1;
    const Sn = _e($n.key);
    return _e.memberDepth -= 1, DisallowedMethods.has(_e($n.value)) ? console.error(`Prevented interpretation of property "${Sn}" which could lead to insecure code execution`) : Zt[Sn] = _e($n.value), Zt;
  }, {})
};
function interpret(_e, Qt, Zt, $n, Sn, kn) {
  const Kn = (er) => Visitors[er.type](Kn, er);
  return Kn.memberDepth = 0, Kn.fn = Object.create(Qt), Kn.params = Zt, Kn.datum = $n, Kn.event = Sn, Kn.item = kn, EventFunctions.forEach((er) => Kn.fn[er] = function() {
    return Sn.vega[er](...arguments);
  }), Kn(_e);
}
var expression = {
  /**
   * Parse an expression used to update an operator value.
   */
  operator(_e, Qt) {
    const Zt = Qt.ast, $n = _e.functions;
    return (Sn) => interpret(Zt, $n, Sn);
  },
  /**
   * Parse an expression provided as an operator parameter value.
   */
  parameter(_e, Qt) {
    const Zt = Qt.ast, $n = _e.functions;
    return (Sn, kn) => interpret(Zt, $n, kn, Sn);
  },
  /**
   * Parse an expression applied to an event stream.
   */
  event(_e, Qt) {
    const Zt = Qt.ast, $n = _e.functions;
    return (Sn) => interpret(Zt, $n, void 0, void 0, Sn);
  },
  /**
   * Parse an expression used to handle an event-driven operator update.
   */
  handler(_e, Qt) {
    const Zt = Qt.ast, $n = _e.functions;
    return (Sn, kn) => {
      const Kn = kn.item && kn.item.datum;
      return interpret(Zt, $n, Sn, Kn, kn);
    };
  },
  /**
   * Parse an expression that performs visual encoding.
   */
  encode(_e, Qt) {
    const {
      marktype: Zt,
      channels: $n
    } = Qt, Sn = _e.functions, kn = Zt === "group" || Zt === "image" || Zt === "rect";
    return (Kn, er) => {
      const Cr = Kn.datum;
      let kr = 0, Yr;
      for (const Ms in $n)
        Yr = interpret($n[Ms].ast, Sn, er, Cr, void 0, Kn), Kn[Ms] !== Yr && (Kn[Ms] = Yr, kr = 1);
      return Zt !== "rule" && adjustSpatial(Kn, $n, kn), kr;
    };
  }
};
function e(_e) {
  const [Qt, Zt] = /schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(_e).slice(1, 3);
  return { library: Qt, version: Zt };
}
var name = "vega-themes", version$1 = "2.14.0", description = "Themes for stylized Vega and Vega-Lite visualizations.", keywords = ["vega", "vega-lite", "themes", "style"], license = "BSD-3-Clause", author = {
  name: "UW Interactive Data Lab",
  url: "https://idl.cs.washington.edu"
}, contributors = [{
  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"
}], main = "build/vega-themes.js", module = "build/vega-themes.module.js", unpkg = "build/vega-themes.min.js", jsdelivr = "build/vega-themes.min.js", types = "build/vega-themes.module.d.ts", repository = {
  type: "git",
  url: "https://github.com/vega/vega-themes.git"
}, files = ["src", "build"], scripts = {
  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",
  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'",
  format: "eslint . --fix",
  lint: "eslint .",
  release: "release-it"
}, devDependencies = {
  "@babel/core": "^7.22.9",
  "@babel/plugin-proposal-async-generator-functions": "^7.20.7",
  "@babel/plugin-proposal-json-strings": "^7.18.6",
  "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
  "@babel/plugin-proposal-optional-catch-binding": "^7.18.6",
  "@babel/plugin-transform-runtime": "^7.22.9",
  "@babel/preset-env": "^7.22.9",
  "@babel/preset-typescript": "^7.22.5",
  "@release-it/conventional-changelog": "^7.0.0",
  "@rollup/plugin-json": "^6.0.0",
  "@rollup/plugin-node-resolve": "^15.1.0",
  "@rollup/plugin-terser": "^0.4.3",
  "@typescript-eslint/eslint-plugin": "^6.0.0",
  "@typescript-eslint/parser": "^6.0.0",
  "browser-sync": "^2.29.3",
  concurrently: "^8.2.0",
  eslint: "^8.45.0",
  "eslint-config-prettier": "^8.8.0",
  "eslint-plugin-prettier": "^5.0.0",
  "gh-pages": "^5.0.0",
  prettier: "^3.0.0",
  "release-it": "^16.1.0",
  rollup: "^3.26.2",
  "rollup-plugin-bundle-size": "^1.0.3",
  "rollup-plugin-ts": "^3.2.0",
  typescript: "^5.1.6",
  vega: "^5.25.0",
  "vega-lite": "^5.9.3"
}, peerDependencies = {
  vega: "*",
  "vega-lite": "*"
}, dependencies = {}, pkg = {
  name,
  version: version$1,
  description,
  keywords,
  license,
  author,
  contributors,
  main,
  module,
  unpkg,
  jsdelivr,
  types,
  repository,
  files,
  scripts,
  devDependencies,
  peerDependencies,
  dependencies
};
const lightColor = "#fff", medColor = "#888", darkTheme = {
  background: "#333",
  view: {
    stroke: medColor
  },
  title: {
    color: lightColor,
    subtitleColor: lightColor
  },
  style: {
    "guide-label": {
      fill: lightColor
    },
    "guide-title": {
      fill: lightColor
    }
  },
  axis: {
    domainColor: lightColor,
    gridColor: medColor,
    tickColor: lightColor
  }
}, markColor$7 = "#4572a7", excelTheme = {
  background: "#fff",
  arc: {
    fill: markColor$7
  },
  area: {
    fill: markColor$7
  },
  line: {
    stroke: markColor$7,
    strokeWidth: 2
  },
  path: {
    stroke: markColor$7
  },
  rect: {
    fill: markColor$7
  },
  shape: {
    stroke: markColor$7
  },
  symbol: {
    fill: markColor$7,
    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"]
  }
}, markColor$6 = "#30a2da", axisColor$2 = "#cbcbcb", guideLabelColor = "#999", guideTitleColor = "#333", backgroundColor$2 = "#f0f0f0", blackTitle = "#333", fiveThirtyEightTheme = {
  arc: {
    fill: markColor$6
  },
  area: {
    fill: markColor$6
  },
  axis: {
    domainColor: axisColor$2,
    grid: !0,
    gridColor: axisColor$2,
    gridWidth: 1,
    labelColor: guideLabelColor,
    labelFontSize: 10,
    titleColor: guideTitleColor,
    tickColor: axisColor$2,
    tickSize: 10,
    titleFontSize: 14,
    titlePadding: 10,
    labelPadding: 4
  },
  axisBand: {
    grid: !1
  },
  background: backgroundColor$2,
  group: {
    fill: backgroundColor$2
  },
  legend: {
    labelColor: blackTitle,
    labelFontSize: 11,
    padding: 1,
    symbolSize: 30,
    symbolType: "square",
    titleColor: blackTitle,
    titleFontSize: 14,
    titlePadding: 10
  },
  line: {
    stroke: markColor$6,
    strokeWidth: 2
  },
  path: {
    stroke: markColor$6,
    strokeWidth: 0.5
  },
  rect: {
    fill: markColor$6
  },
  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: markColor$6
  },
  bar: {
    binSpacing: 2,
    fill: markColor$6,
    stroke: null
  },
  title: {
    anchor: "start",
    fontSize: 24,
    fontWeight: 600,
    offset: 20
  }
}, markColor$5 = "#000", ggplot2Theme = {
  group: {
    fill: "#e5e5e5"
  },
  arc: {
    fill: markColor$5
  },
  area: {
    fill: markColor$5
  },
  line: {
    stroke: markColor$5
  },
  path: {
    stroke: markColor$5
  },
  rect: {
    fill: markColor$5
  },
  shape: {
    stroke: markColor$5
  },
  symbol: {
    fill: markColor$5,
    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"]
  }
}, headlineFontSize = 22, headlineFontWeight = "normal", labelFont$1 = "Benton Gothic, sans-serif", labelFontSize = 11.5, labelFontWeight = "normal", markColor$4 = "#82c6df", titleFont = "Benton Gothic Bold, sans-serif", titleFontWeight = "normal", titleFontSize$1 = 13, colorSchemes$1 = {
  "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"]
}, latimesTheme = {
  background: "#ffffff",
  title: {
    anchor: "start",
    color: "#000000",
    font: titleFont,
    fontSize: headlineFontSize,
    fontWeight: headlineFontWeight
  },
  arc: {
    fill: markColor$4
  },
  area: {
    fill: markColor$4
  },
  line: {
    stroke: markColor$4,
    strokeWidth: 2
  },
  path: {
    stroke: markColor$4
  },
  rect: {
    fill: markColor$4
  },
  shape: {
    stroke: markColor$4
  },
  symbol: {
    fill: markColor$4,
    size: 30
  },
  axis: {
    labelFont: labelFont$1,
    labelFontSize,
    labelFontWeight,
    titleFont,
    titleFontSize: titleFontSize$1,
    titleFontWeight
  },
  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: labelFont$1,
    labelFontSize,
    symbolType: "square",
    titleFont,
    titleFontSize: titleFontSize$1,
    titleFontWeight
  },
  range: {
    category: colorSchemes$1["category-6"],
    diverging: colorSchemes$1["fireandice-6"],
    heatmap: colorSchemes$1["fire-7"],
    ordinal: colorSchemes$1["fire-7"],
    ramp: colorSchemes$1["fire-7"]
  }
}, markColor$3 = "#ab5787", axisColor$1 = "#979797", quartzTheme = {
  background: "#f9f9f9",
  arc: {
    fill: markColor$3
  },
  area: {
    fill: markColor$3
  },
  line: {
    stroke: markColor$3
  },
  path: {
    stroke: markColor$3
  },
  rect: {
    fill: markColor$3
  },
  shape: {
    stroke: markColor$3
  },
  symbol: {
    fill: markColor$3,
    size: 30
  },
  axis: {
    domainColor: axisColor$1,
    domainWidth: 0.5,
    gridWidth: 0.2,
    labelColor: axisColor$1,
    tickColor: axisColor$1,
    tickWidth: 0.2,
    titleColor: axisColor$1
  },
  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"]
  }
}, markColor$2 = "#3e5c69", voxTheme = {
  background: "#fff",
  arc: {
    fill: markColor$2
  },
  area: {
    fill: markColor$2
  },
  line: {
    stroke: markColor$2
  },
  path: {
    stroke: markColor$2
  },
  rect: {
    fill: markColor$2
  },
  shape: {
    stroke: markColor$2
  },
  symbol: {
    fill: markColor$2
  },
  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"]
  }
}, markColor$1 = "#1696d2", axisColor = "#000000", backgroundColor$1 = "#FFFFFF", font = "Lato", labelFont = "Lato", sourceFont = "Lato", gridColor$1 = "#DEDDDD", titleFontSize = 18, colorSchemes = {
  "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"]
}, urbanInstituteTheme = {
  background: backgroundColor$1,
  title: {
    anchor: "start",
    fontSize: titleFontSize,
    font
  },
  axisX: {
    domain: !0,
    domainColor: axisColor,
    domainWidth: 1,
    grid: !1,
    labelFontSize: 12,
    labelFont,
    labelAngle: 0,
    tickColor: axisColor,
    tickSize: 5,
    titleFontSize: 12,
    titlePadding: 10,
    titleFont: font
  },
  axisY: {
    domain: !1,
    domainWidth: 1,
    grid: !0,
    gridColor: gridColor$1,
    gridWidth: 1,
    labelFontSize: 12,
    labelFont,
    labelPadding: 8,
    ticks: !1,
    titleFontSize: 12,
    titlePadding: 10,
    titleFont: font,
    titleAngle: 0,
    titleY: -10,
    titleX: 18
  },
  legend: {
    labelFontSize: 12,
    labelFont,
    symbolSize: 100,
    titleFontSize: 12,
    titlePadding: 10,
    titleFont: font,
    orient: "right",
    offset: 10
  },
  view: {
    stroke: "transparent"
  },
  range: {
    category: colorSchemes["six-groups-cat-1"],
    diverging: colorSchemes["diverging-colors"],
    heatmap: colorSchemes["diverging-colors"],
    ordinal: colorSchemes["six-groups-seq"],
    ramp: colorSchemes["shades-blue"]
  },
  area: {
    fill: markColor$1
  },
  rect: {
    fill: markColor$1
  },
  line: {
    color: markColor$1,
    stroke: markColor$1,
    strokeWidth: 5
  },
  trail: {
    color: markColor$1,
    stroke: markColor$1,
    strokeWidth: 0,
    size: 1
  },
  path: {
    stroke: markColor$1,
    strokeWidth: 0.5
  },
  point: {
    filled: !0
  },
  text: {
    font: sourceFont,
    color: markColor$1,
    fontSize: 11,
    align: "center",
    fontWeight: 400,
    size: 11
  },
  style: {
    bar: {
      fill: markColor$1,
      stroke: null
    }
  },
  arc: {
    fill: markColor$1
  },
  shape: {
    stroke: markColor$1
  },
  symbol: {
    fill: markColor$1,
    size: 30
  }
}, markColor = "#3366CC", gridColor = "#ccc", defaultFont$1 = "Arial, sans-serif", googlechartsTheme = {
  arc: {
    fill: markColor
  },
  area: {
    fill: markColor
  },
  path: {
    stroke: markColor
  },
  rect: {
    fill: markColor
  },
  shape: {
    stroke: markColor
  },
  symbol: {
    stroke: markColor
  },
  circle: {
    fill: markColor
  },
  background: "#fff",
  padding: {
    top: 10,
    right: 10,
    bottom: 10,
    left: 10
  },
  style: {
    "guide-label": {
      font: defaultFont$1,
      fontSize: 12
    },
    "guide-title": {
      font: defaultFont$1,
      fontSize: 12
    },
    "group-title": {
      font: defaultFont$1,
      fontSize: 12
    }
  },
  title: {
    font: defaultFont$1,
    fontSize: 14,
    fontWeight: "bold",
    dy: -3,
    anchor: "start"
  },
  axis: {
    gridColor,
    tickColor: gridColor,
    domain: !1,
    grid: !0
  },
  range: {
    category: ["#4285F4", "#DB4437", "#F4B400", "#0F9D58", "#AB47BC", "#00ACC1", "#FF7043", "#9E9D24", "#5C6BC0", "#F06292", "#00796B", "#C2185B"],
    heatmap: ["#c6dafc", "#5e97f6", "#2a56c6"]
  }
}, ptToPx = (_e) => _e * (1 / 3 + 1), fontSmallPx = ptToPx(9), legendFontPx = ptToPx(10), fontLargePx = ptToPx(12), fontStandard = "Segoe UI", fontTitle = "wf_standard-font, helvetica, arial, sans-serif", firstLevelElementColor = "#252423", secondLevelElementColor = "#605E5C", backgroundColor = "transparent", backgroundSecondaryColor = "#C8C6C4", paletteColor1 = "#118DFF", paletteColor2 = "#12239E", paletteColor3 = "#E66C37", paletteColor4 = "#6B007B", paletteColor5 = "#E044A7", paletteColor6 = "#744EC2", paletteColor7 = "#D9B300", paletteColor8 = "#D64550", divergentColorMax = paletteColor1, divergentColorMin = "#DEEFFF", divergentPalette = [divergentColorMin, divergentColorMax], ordinalPalette = [divergentColorMin, "#c7e4ff", "#b0d9ff", "#9aceff", "#83c3ff", "#6cb9ff", "#55aeff", "#3fa3ff", "#2898ff", divergentColorMax], powerbiTheme = {
  view: {
    stroke: backgroundColor
  },
  background: backgroundColor,
  font: fontStandard,
  header: {
    titleFont: fontTitle,
    titleFontSize: fontLargePx,
    titleColor: firstLevelElementColor,
    labelFont: fontStandard,
    labelFontSize: legendFontPx,
    labelColor: secondLevelElementColor
  },
  axis: {
    ticks: !1,
    grid: !1,
    domain: !1,
    labelColor: secondLevelElementColor,
    labelFontSize: fontSmallPx,
    titleFont: fontTitle,
    titleColor: firstLevelElementColor,
    titleFontSize: fontLargePx,
    titleFontWeight: "normal"
  },
  axisQuantitative: {
    tickCount: 3,
    grid: !0,
    gridColor: backgroundSecondaryColor,
    gridDash: [1, 5],
    labelFlush: !1
  },
  axisBand: {
    tickExtra: !0
  },
  axisX: {
    labelPadding: 5
  },
  axisY: {
    labelPadding: 10
  },
  bar: {
    fill: paletteColor1
  },
  line: {
    stroke: paletteColor1,
    strokeWidth: 3,
    strokeCap: "round",
    strokeJoin: "round"
  },
  text: {
    font: fontStandard,
    fontSize: fontSmallPx,
    fill: secondLevelElementColor
  },
  arc: {
    fill: paletteColor1
  },
  area: {
    fill: paletteColor1,
    line: !0,
    opacity: 0.6
  },
  path: {
    stroke: paletteColor1
  },
  rect: {
    fill: paletteColor1
  },
  point: {
    fill: paletteColor1,
    filled: !0,
    size: 75
  },
  shape: {
    stroke: paletteColor1
  },
  symbol: {
    fill: paletteColor1,
    strokeWidth: 1.5,
    size: 50
  },
  legend: {
    titleFont: fontStandard,
    titleFontWeight: "bold",
    titleColor: secondLevelElementColor,
    labelFont: fontStandard,
    labelFontSize: legendFontPx,
    labelColor: secondLevelElementColor,
    symbolType: "circle",
    symbolSize: 75
  },
  range: {
    category: [paletteColor1, paletteColor2, paletteColor3, paletteColor4, paletteColor5, paletteColor6, paletteColor7, paletteColor8],
    diverging: divergentPalette,
    heatmap: divergentPalette,
    ordinal: ordinalPalette
  }
}, defaultFont = 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', fontWeight = 400, darkCategories = ["#8a3ffc", "#33b1ff", "#007d79", "#ff7eb6", "#fa4d56", "#fff1f1", "#6fdc8c", "#4589ff", "#d12771", "#d2a106", "#08bdba", "#bae6ff", "#ba4e00", "#d4bbff"], lightCategories = ["#6929c4", "#1192e8", "#005d5d", "#9f1853", "#fa4d56", "#570408", "#198038", "#002d9c", "#ee538b", "#b28600", "#009d9a", "#012749", "#8a3800", "#a56eff"];
function genCarbonConfig({
  type: _e,
  background: Qt
}) {
  const Zt = _e === "dark" ? "#161616" : "#ffffff", $n = _e === "dark" ? "#f4f4f4" : "#161616", Sn = _e === "dark" ? darkCategories : lightCategories, kn = _e === "dark" ? "#d4bbff" : "#6929c4";
  return {
    background: Qt,
    arc: {
      fill: kn
    },
    area: {
      fill: kn
    },
    path: {
      stroke: kn
    },
    rect: {
      fill: kn
    },
    shape: {
      stroke: kn
    },
    symbol: {
      stroke: kn
    },
    circle: {
      fill: kn
    },
    view: {
      fill: Zt,
      stroke: Zt
    },
    group: {
      fill: Zt
    },
    title: {
      color: $n,
      anchor: "start",
      dy: -15,
      fontSize: 16,
      font: defaultFont,
      fontWeight: 600
    },
    axis: {
      labelColor: $n,
      labelFontSize: 12,
      grid: !0,
      gridColor: "#525252",
      titleColor: $n,
      labelAngle: 0
    },
    style: {
      "guide-label": {
        font: defaultFont,
        fill: $n,
        fontWeight
      },
      "guide-title": {
        font: defaultFont,
        fill: $n,
        fontWeight
      }
    },
    range: {
      category: Sn,
      diverging: ["#750e13", "#a2191f", "#da1e28", "#fa4d56", "#ff8389", "#ffb3b8", "#ffd7d9", "#fff1f1", "#e5f6ff", "#bae6ff", "#82cfff", "#33b1ff", "#1192e8", "#0072c3", "#00539a", "#003a6d"],
      heatmap: ["#f6f2ff", "#e8daff", "#d4bbff", "#be95ff", "#a56eff", "#8a3ffc", "#6929c4", "#491d8b", "#31135e", "#1c0f30"]
    }
  };
}
const carbonwhite = genCarbonConfig({
  type: "light",
  background: "#ffffff"
}), carbong10 = genCarbonConfig({
  type: "light",
  background: "#f4f4f4"
}), carbong90 = genCarbonConfig({
  type: "dark",
  background: "#262626"
}), carbong100 = genCarbonConfig({
  type: "dark",
  background: "#161616"
}), version = pkg.version, themes = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  carbong10,
  carbong100,
  carbong90,
  carbonwhite,
  dark: darkTheme,
  excel: excelTheme,
  fivethirtyeight: fiveThirtyEightTheme,
  ggplot2: ggplot2Theme,
  googlecharts: googlechartsTheme,
  latimes: latimesTheme,
  powerbi: powerbiTheme,
  quartz: quartzTheme,
  urbaninstitute: urbanInstituteTheme,
  version,
  vox: voxTheme
}, Symbol.toStringTag, { value: "Module" }));
function _typeof$1(_e) {
  "@babel/helpers - typeof";
  return _typeof$1 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(Qt) {
    return typeof Qt;
  } : function(Qt) {
    return Qt && typeof Symbol == "function" && Qt.constructor === Symbol && Qt !== Symbol.prototype ? "symbol" : typeof Qt;
  }, _typeof$1(_e);
}
function _toPrimitive$1(_e, Qt) {
  if (_typeof$1(_e) !== "object" || _e === null)
    return _e;
  var Zt = _e[Symbol.toPrimitive];
  if (Zt !== void 0) {
    var $n = Zt.call(_e, Qt || "default");
    if (_typeof$1($n) !== "object")
      return $n;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return (Qt === "string" ? String : Number)(_e);
}
function _toPropertyKey$1(_e) {
  var Qt = _toPrimitive$1(_e, "string");
  return _typeof$1(Qt) === "symbol" ? Qt : String(Qt);
}
function _defineProperty$3(_e, Qt, Zt) {
  return Qt = _toPropertyKey$1(Qt), Qt in _e ? Object.defineProperty(_e, Qt, {
    value: Zt,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : _e[Qt] = Zt, _e;
}
function _objectWithoutPropertiesLoose(_e, Qt) {
  if (_e == null)
    return {};
  var Zt = {}, $n = Object.keys(_e), Sn, kn;
  for (kn = 0; kn < $n.length; kn++)
    Sn = $n[kn], !(Qt.indexOf(Sn) >= 0) && (Zt[Sn] = _e[Sn]);
  return Zt;
}
function _objectWithoutProperties(_e, Qt) {
  if (_e == null)
    return {};
  var Zt = _objectWithoutPropertiesLoose(_e, Qt), $n, Sn;
  if (Object.getOwnPropertySymbols) {
    var kn = Object.getOwnPropertySymbols(_e);
    for (Sn = 0; Sn < kn.length; Sn++)
      $n = kn[Sn], !(Qt.indexOf($n) >= 0) && Object.prototype.propertyIsEnumerable.call(_e, $n) && (Zt[$n] = _e[$n]);
  }
  return Zt;
}
const _excluded = ["title", "image"];
function formatValue(_e, Qt, Zt) {
  if (isArray(_e))
    return `[${_e.map(($n) => Qt(isString($n) ? $n : stringify($n, Zt))).join(", ")}]`;
  if (isObject(_e)) {
    let $n = "";
    const Sn = _e, {
      title: kn,
      image: Kn
    } = Sn, er = _objectWithoutProperties(Sn, _excluded);
    kn && ($n += `<h2>${Qt(kn)}</h2>`), Kn && ($n += `<img src="${Qt(Kn)}">`);
    const Cr = Object.keys(er);
    if (Cr.length > 0) {
      $n += "<table>";
      for (const kr of Cr) {
        let Yr = er[kr];
        Yr !== void 0 && (isObject(Yr) && (Yr = stringify(Yr, Zt)), $n += `<tr><td class="key">${Qt(kr)}:</td><td class="value">${Qt(Yr)}</td></tr>`);
      }
      $n += "</table>";
    }
    return $n || "{}";
  }
  return Qt(_e);
}
function replacer(_e) {
  const Qt = [];
  return function(Zt, $n) {
    if (typeof $n != "object" || $n === null)
      return $n;
    const Sn = Qt.indexOf(this) + 1;
    return Qt.length = Sn, Qt.length > _e ? "[Object]" : Qt.indexOf($n) >= 0 ? "[Circular]" : (Qt.push($n), $n);
  };
}
function stringify(_e, Qt) {
  return JSON.stringify(_e, replacer(Qt));
}
var defaultStyle = `#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 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 EL_ID = "vg-tooltip-element", DEFAULT_OPTIONS = {
  /**
   * X offset.
   */
  offsetX: 10,
  /**
   * Y offset.
   */
  offsetY: 10,
  /**
   * ID of the tooltip element.
   */
  id: EL_ID,
  /**
   * ID of the tooltip CSS style.
   */
  styleId: "vega-tooltip-style",
  /**
   * The name of the theme. You can use the CSS class called [THEME]-theme to style the tooltips.
   *
   * There are two predefined themes: "light" (default) and "dark".
   */
  theme: "light",
  /**
   * Do not use the default styles provided by Vega Tooltip. If you enable this option, you need to use your own styles. It is not necessary to disable the default style when using a custom theme.
   */
  disableDefaultStyle: !1,
  /**
   * HTML sanitizer function that removes dangerous HTML to prevent XSS.
   *
   * This should be a function from string to string. You may replace it with a formatter such as a markdown formatter.
   */
  sanitize: escapeHTML,
  /**
   * The maximum recursion depth when printing objects in the tooltip.
   */
  maxDepth: 2,
  /**
   * A function to customize the rendered HTML of the tooltip.
   * @param value A value string, or object of value strings keyed by field
   * @param sanitize The `sanitize` function from `options.sanitize`
   * @returns {string} The returned string will become the `innerHTML` of the tooltip element
   */
  formatTooltip: formatValue
};
function escapeHTML(_e) {
  return String(_e).replace(/&/g, "&amp;").replace(/</g, "&lt;");
}
function createDefaultStyle(_e) {
  if (!/^[A-Za-z]+[-:.\w]*$/.test(_e))
    throw new Error("Invalid HTML ID");
  return defaultStyle.toString().replace(EL_ID, _e);
}
function calculatePosition(_e, Qt, Zt, $n) {
  let Sn = _e.clientX + Zt;
  Sn + Qt.width > window.innerWidth && (Sn = +_e.clientX - Zt - Qt.width);
  let kn = _e.clientY + $n;
  return kn + Qt.height > window.innerHeight && (kn = +_e.clientY - $n - Qt.height), {
    x: Sn,
    y: kn
  };
}
function ownKeys$1(_e, Qt) {
  var Zt = Object.keys(_e);
  if (Object.getOwnPropertySymbols) {
    var $n = Object.getOwnPropertySymbols(_e);
    Qt && ($n = $n.filter(function(Sn) {
      return Object.getOwnPropertyDescriptor(_e, Sn).enumerable;
    })), Zt.push.apply(Zt, $n);
  }
  return Zt;
}
function _objectSpread$1(_e) {
  for (var Qt = 1; Qt < arguments.length; Qt++) {
    var Zt = arguments[Qt] != null ? arguments[Qt] : {};
    Qt % 2 ? ownKeys$1(Object(Zt), !0).forEach(function($n) {
      _defineProperty$3(_e, $n, Zt[$n]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(_e, Object.getOwnPropertyDescriptors(Zt)) : ownKeys$1(Object(Zt)).forEach(function($n) {
      Object.defineProperty(_e, $n, Object.getOwnPropertyDescriptor(Zt, $n));
    });
  }
  return _e;
}
class Handler {
  /**
   * The handler function. We bind this to this function in the constructor.
   */
  /**
   * Complete tooltip options.
   */
  /**
   * The tooltip html element.
   */
  /**
   * Create the tooltip handler and initialize the element and style.
   *
   * @param options Tooltip Options
   */
  constructor(Qt) {
    this.options = _objectSpread$1(_objectSpread$1({}, DEFAULT_OPTIONS), Qt);
    const Zt = this.options.id;
    if (this.el = null, this.call = this.tooltipHandler.bind(this), !this.options.disableDefaultStyle && !document.getElementById(this.options.styleId)) {
      const $n = document.createElement("style");
      $n.setAttribute("id", this.options.styleId), $n.innerHTML = createDefaultStyle(Zt);
      const Sn = document.head;
      Sn.childNodes.length > 0 ? Sn.insertBefore($n, Sn.childNodes[0]) : Sn.appendChild($n);
    }
  }
  /**
   * The tooltip handler function.
   */
  tooltipHandler(Qt, Zt, $n, Sn) {
    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"), (document.fullscreenElement ?? document.body).appendChild(this.el)), Sn == null || Sn === "") {
      this.el.classList.remove("visible", `${this.options.theme}-theme`);
      return;
    }
    this.el.innerHTML = this.options.formatTooltip(Sn, this.options.sanitize, this.options.maxDepth), this.el.classList.add("visible", `${this.options.theme}-theme`);
    const {
      x: kn,
      y: Kn
    } = calculatePosition(Zt, this.el.getBoundingClientRect(), this.options.offsetX, this.options.offsetY);
    this.el.style.top = `${Kn}px`, this.el.style.left = `${kn}px`;
  }
}
function _typeof(_e) {
  "@babel/helpers - typeof";
  return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(Qt) {
    return typeof Qt;
  } : function(Qt) {
    return Qt && typeof Symbol == "function" && Qt.constructor === Symbol && Qt !== Symbol.prototype ? "symbol" : typeof Qt;
  }, _typeof(_e);
}
function _toPrimitive(_e, Qt) {
  if (_typeof(_e) !== "object" || _e === null)
    return _e;
  var Zt = _e[Symbol.toPrimitive];
  if (Zt !== void 0) {
    var $n = Zt.call(_e, Qt || "default");
    if (_typeof($n) !== "object")
      return $n;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return (Qt === "string" ? String : Number)(_e);
}
function _toPropertyKey(_e) {
  var Qt = _toPrimitive(_e, "string");
  return _typeof(Qt) === "symbol" ? Qt : String(Qt);
}
function _defineProperty$2(_e, Qt, Zt) {
  return Qt = _toPropertyKey(Qt), Qt in _e ? Object.defineProperty(_e, Qt, {
    value: Zt,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : _e[Qt] = Zt, _e;
}
function getDefaultExportFromCjs(_e) {
  return _e && _e.__esModule && Object.prototype.hasOwnProperty.call(_e, "default") ? _e.default : _e;
}
var iterator, hasRequiredIterator;
function requireIterator() {
  return hasRequiredIterator || (hasRequiredIterator = 1, iterator = function(_e) {
    _e.prototype[Symbol.iterator] = function* () {
      for (let Qt = this.head; Qt; Qt = Qt.next)
        yield Qt.value;
    };
  }), iterator;
}
var yallist = Yallist$1;
Yallist$1.Node = Node$1;
Yallist$1.create = Yallist$1;
function Yallist$1(_e) {
  var Qt = this;
  if (Qt instanceof Yallist$1 || (Qt = new Yallist$1()), Qt.tail = null, Qt.head = null, Qt.length = 0, _e && typeof _e.forEach == "function")
    _e.forEach(function(Sn) {
      Qt.push(Sn);
    });
  else if (arguments.length > 0)
    for (var Zt = 0, $n = arguments.length; Zt < $n; Zt++)
      Qt.push(arguments[Zt]);
  return Qt;
}
Yallist$1.prototype.removeNode = function(_e) {
  if (_e.list !== this)
    throw new Error("removing node which does not belong to this list");
  var Qt = _e.next, Zt = _e.prev;
  return Qt && (Qt.prev = Zt), Zt && (Zt.next = Qt), _e === this.head && (this.head = Qt), _e === this.tail && (this.tail = Zt), _e.list.length--, _e.next = null, _e.prev = null, _e.list = null, Qt;
};
Yallist$1.prototype.unshiftNode = function(_e) {
  if (_e !== this.head) {
    _e.list && _e.list.removeNode(_e);
    var Qt = this.head;
    _e.list = this, _e.next = Qt, Qt && (Qt.prev = _e), this.head = _e, this.tail || (this.tail = _e), this.length++;
  }
};
Yallist$1.prototype.pushNode = function(_e) {
  if (_e !== this.tail) {
    _e.list && _e.list.removeNode(_e);
    var Qt = this.tail;
    _e.list = this, _e.prev = Qt, Qt && (Qt.next = _e), this.tail = _e, this.head || (this.head = _e), this.length++;
  }
};
Yallist$1.prototype.push = function() {
  for (var _e = 0, Qt = arguments.length; _e < Qt; _e++)
    push(this, arguments[_e]);
  return this.length;
};
Yallist$1.prototype.unshift = function() {
  for (var _e = 0, Qt = arguments.length; _e < Qt; _e++)
    unshift(this, arguments[_e]);
  return this.length;
};
Yallist$1.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;
  }
};
Yallist$1.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;
  }
};
Yallist$1.prototype.forEach = function(_e, Qt) {
  Qt = Qt || this;
  for (var Zt = this.head, $n = 0; Zt !== null; $n++)
    _e.call(Qt, Zt.value, $n, this), Zt = Zt.next;
};
Yallist$1.prototype.forEachReverse = function(_e, Qt) {
  Qt = Qt || this;
  for (var Zt = this.tail, $n = this.length - 1; Zt !== null; $n--)
    _e.call(Qt, Zt.value, $n, this), Zt = Zt.prev;
};
Yallist$1.prototype.get = function(_e) {
  for (var Qt = 0, Zt = this.head; Zt !== null && Qt < _e; Qt++)
    Zt = Zt.next;
  if (Qt === _e && Zt !== null)
    return Zt.value;
};
Yallist$1.prototype.getReverse = function(_e) {
  for (var Qt = 0, Zt = this.tail; Zt !== null && Qt < _e; Qt++)
    Zt = Zt.prev;
  if (Qt === _e && Zt !== null)
    return Zt.value;
};
Yallist$1.prototype.map = function(_e, Qt) {
  Qt = Qt || this;
  for (var Zt = new Yallist$1(), $n = this.head; $n !== null; )
    Zt.push(_e.call(Qt, $n.value, this)), $n = $n.next;
  return Zt;
};
Yallist$1.prototype.mapReverse = function(_e, Qt) {
  Qt = Qt || this;
  for (var Zt = new Yallist$1(), $n = this.tail; $n !== null; )
    Zt.push(_e.call(Qt, $n.value, this)), $n = $n.prev;
  return Zt;
};
Yallist$1.prototype.reduce = function(_e, Qt) {
  var Zt, $n = this.head;
  if (arguments.length > 1)
    Zt = Qt;
  else if (this.head)
    $n = this.head.next, Zt = this.head.value;
  else
    throw new TypeError("Reduce of empty list with no initial value");
  for (var Sn = 0; $n !== null; Sn++)
    Zt = _e(Zt, $n.value, Sn), $n = $n.next;
  return Zt;
};
Yallist$1.prototype.reduceReverse = function(_e, Qt) {
  var Zt, $n = this.tail;
  if (arguments.length > 1)
    Zt = Qt;
  else if (this.tail)
    $n = this.tail.prev, Zt = this.tail.value;
  else
    throw new TypeError("Reduce of empty list with no initial value");
  for (var Sn = this.length - 1; $n !== null; Sn--)
    Zt = _e(Zt, $n.value, Sn), $n = $n.prev;
  return Zt;
};
Yallist$1.prototype.toArray = function() {
  for (var _e = new Array(this.length), Qt = 0, Zt = this.head; Zt !== null; Qt++)
    _e[Qt] = Zt.value, Zt = Zt.next;
  return _e;
};
Yallist$1.prototype.toArrayReverse = function() {
  for (var _e = new Array(this.length), Qt = 0, Zt = this.tail; Zt !== null; Qt++)
    _e[Qt] = Zt.value, Zt = Zt.prev;
  return _e;
};
Yallist$1.prototype.slice = function(_e, Qt) {
  Qt = Qt || this.length, Qt < 0 && (Qt += this.length), _e = _e || 0, _e < 0 && (_e += this.length);
  var Zt = new Yallist$1();
  if (Qt < _e || Qt < 0)
    return Zt;
  _e < 0 && (_e = 0), Qt > this.length && (Qt = this.length);
  for (var $n = 0, Sn = this.head; Sn !== null && $n < _e; $n++)
    Sn = Sn.next;
  for (; Sn !== null && $n < Qt; $n++, Sn = Sn.next)
    Zt.push(Sn.value);
  return Zt;
};
Yallist$1.prototype.sliceReverse = function(_e, Qt) {
  Qt = Qt || this.length, Qt < 0 && (Qt += this.length), _e = _e || 0, _e < 0 && (_e += this.length);
  var Zt = new Yallist$1();
  if (Qt < _e || Qt < 0)
    return Zt;
  _e < 0 && (_e = 0), Qt > this.length && (Qt = this.length);
  for (var $n = this.length, Sn = this.tail; Sn !== null && $n > Qt; $n--)
    Sn = Sn.prev;
  for (; Sn !== null && $n > _e; $n--, Sn = Sn.prev)
    Zt.push(Sn.value);
  return Zt;
};
Yallist$1.prototype.splice = function(_e, Qt, ...Zt) {
  _e > this.length && (_e = this.length - 1), _e < 0 && (_e = this.length + _e);
  for (var $n = 0, Sn = this.head; Sn !== null && $n < _e; $n++)
    Sn = Sn.next;
  for (var kn = [], $n = 0; Sn && $n < Qt; $n++)
    kn.push(Sn.value), Sn = this.removeNode(Sn);
  Sn === null && (Sn = this.tail), Sn !== this.head && Sn !== this.tail && (Sn = Sn.prev);
  for (var $n = 0; $n < Zt.length; $n++)
    Sn = insert(this, Sn, Zt[$n]);
  return kn;
};
Yallist$1.prototype.reverse = function() {
  for (var _e = this.head, Qt = this.tail, Zt = _e; Zt !== null; Zt = Zt.prev) {
    var $n = Zt.prev;
    Zt.prev = Zt.next, Zt.next = $n;
  }
  return this.head = Qt, this.tail = _e, this;
};
function insert(_e, Qt, Zt) {
  var $n = Qt === _e.head ? new Node$1(Zt, null, Qt, _e) : new Node$1(Zt, Qt, Qt.next, _e);
  return $n.next === null && (_e.tail = $n), $n.prev === null && (_e.head = $n), _e.length++, $n;
}
function push(_e, Qt) {
  _e.tail = new Node$1(Qt, _e.tail, null, _e), _e.head || (_e.head = _e.tail), _e.length++;
}
function unshift(_e, Qt) {
  _e.head = new Node$1(Qt, null, _e.head, _e), _e.tail || (_e.tail = _e.head), _e.length++;
}
function Node$1(_e, Qt, Zt, $n) {
  if (!(this instanceof Node$1))
    return new Node$1(_e, Qt, Zt, $n);
  this.list = $n, this.value = _e, Qt ? (Qt.next = this, this.prev = Qt) : this.prev = null, Zt ? (Zt.prev = this, this.next = Zt) : this.next = null;
}
try {
  requireIterator()(Yallist$1);
} catch (_e) {
}
const Yallist = yallist, MAX = Symbol("max"), LENGTH = Symbol("length"), LENGTH_CALCULATOR = Symbol("lengthCalculator"), ALLOW_STALE = Symbol("allowStale"), MAX_AGE = Symbol("maxAge"), DISPOSE = Symbol("dispose"), NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet"), LRU_LIST = Symbol("lruList"), CACHE = Symbol("cache"), UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet"), naiveLength = () => 1;
class LRUCache {
  constructor(Qt) {
    if (typeof Qt == "number" && (Qt = {
      max: Qt
    }), Qt || (Qt = {}), Qt.max && (typeof Qt.max != "number" || Qt.max < 0))
      throw new TypeError("max must be a non-negative number");
    this[MAX] = Qt.max || 1 / 0;
    const Zt = Qt.length || naiveLength;
    if (this[LENGTH_CALCULATOR] = typeof Zt != "function" ? naiveLength : Zt, this[ALLOW_STALE] = Qt.stale || !1, Qt.maxAge && typeof Qt.maxAge != "number")
      throw new TypeError("maxAge must be a number");
    this[MAX_AGE] = Qt.maxAge || 0, this[DISPOSE] = Qt.dispose, this[NO_DISPOSE_ON_SET] = Qt.noDisposeOnSet || !1, this[UPDATE_AGE_ON_GET] = Qt.updateAgeOnGet || !1, this.reset();
  }
  // resize the cache when the max changes.
  set max(Qt) {
    if (typeof Qt != "number" || Qt < 0)
      throw new TypeError("max must be a non-negative number");
    this[MAX] = Qt || 1 / 0, trim(this);
  }
  get max() {
    return this[MAX];
  }
  set allowStale(Qt) {
    this[ALLOW_STALE] = !!Qt;
  }
  get allowStale() {
    return this[ALLOW_STALE];
  }
  set maxAge(Qt) {
    if (typeof Qt != "number")
      throw new TypeError("maxAge must be a non-negative number");
    this[MAX_AGE] = Qt, trim(this);
  }
  get maxAge() {
    return this[MAX_AGE];
  }
  // resize the cache when the lengthCalculator changes.
  set lengthCalculator(Qt) {
    typeof Qt != "function" && (Qt = naiveLength), Qt !== this[LENGTH_CALCULATOR] && (this[LENGTH_CALCULATOR] = Qt, this[LENGTH] = 0, this[LRU_LIST].forEach((Zt) => {
      Zt.length = this[LENGTH_CALCULATOR](Zt.value, Zt.key), this[LENGTH] += Zt.length;
    })), trim(this);
  }
  get lengthCalculator() {
    return this[LENGTH_CALCULATOR];
  }
  get length() {
    return this[LENGTH];
  }
  get itemCount() {
    return this[LRU_LIST].length;
  }
  rforEach(Qt, Zt) {
    Zt = Zt || this;
    for (let $n = this[LRU_LIST].tail; $n !== null; ) {
      const Sn = $n.prev;
      forEachStep(this, Qt, $n, Zt), $n = Sn;
    }
  }
  forEach(Qt, Zt) {
    Zt = Zt || this;
    for (let $n = this[LRU_LIST].head; $n !== null; ) {
      const Sn = $n.next;
      forEachStep(this, Qt, $n, Zt), $n = Sn;
    }
  }
  keys() {
    return this[LRU_LIST].toArray().map((Qt) => Qt.key);
  }
  values() {
    return this[LRU_LIST].toArray().map((Qt) => Qt.value);
  }
  reset() {
    this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length && this[LRU_LIST].forEach((Qt) => this[DISPOSE](Qt.key, Qt.value)), this[CACHE] = /* @__PURE__ */ new Map(), this[LRU_LIST] = new Yallist(), this[LENGTH] = 0;
  }
  dump() {
    return this[LRU_LIST].map((Qt) => isStale(this, Qt) ? !1 : {
      k: Qt.key,
      v: Qt.value,
      e: Qt.now + (Qt.maxAge || 0)
    }).toArray().filter((Qt) => Qt);
  }
  dumpLru() {
    return this[LRU_LIST];
  }
  set(Qt, Zt, $n) {
    if ($n = $n || this[MAX_AGE], $n && typeof $n != "number")
      throw new TypeError("maxAge must be a number");
    const Sn = $n ? Date.now() : 0, kn = this[LENGTH_CALCULATOR](Zt, Qt);
    if (this[CACHE].has(Qt)) {
      if (kn > this[MAX])
        return del(this, this[CACHE].get(Qt)), !1;
      const Cr = this[CACHE].get(Qt).value;
      return this[DISPOSE] && (this[NO_DISPOSE_ON_SET] || this[DISPOSE](Qt, Cr.value)), Cr.now = Sn, Cr.maxAge = $n, Cr.value = Zt, this[LENGTH] += kn - Cr.length, Cr.length = kn, this.get(Qt), trim(this), !0;
    }
    const Kn = new Entry(Qt, Zt, kn, Sn, $n);
    return Kn.length > this[MAX] ? (this[DISPOSE] && this[DISPOSE](Qt, Zt), !1) : (this[LENGTH] += Kn.length, this[LRU_LIST].unshift(Kn), this[CACHE].set(Qt, this[LRU_LIST].head), trim(this), !0);
  }
  has(Qt) {
    if (!this[CACHE].has(Qt))
      return !1;
    const Zt = this[CACHE].get(Qt).value;
    return !isStale(this, Zt);
  }
  get(Qt) {
    return get(this, Qt, !0);
  }
  peek(Qt) {
    return get(this, Qt, !1);
  }
  pop() {
    const Qt = this[LRU_LIST].tail;
    return Qt ? (del(this, Qt), Qt.value) : null;
  }
  del(Qt) {
    del(this, this[CACHE].get(Qt));
  }
  load(Qt) {
    this.reset();
    const Zt = Date.now();
    for (let $n = Qt.length - 1; $n >= 0; $n--) {
      const Sn = Qt[$n], kn = Sn.e || 0;
      if (kn === 0)
        this.set(Sn.k, Sn.v);
      else {
        const Kn = kn - Zt;
        Kn > 0 && this.set(Sn.k, Sn.v, Kn);
      }
    }
  }
  prune() {
    this[CACHE].forEach((Qt, Zt) => get(this, Zt, !1));
  }
}
const get = (_e, Qt, Zt) => {
  const $n = _e[CACHE].get(Qt);
  if ($n) {
    const Sn = $n.value;
    if (isStale(_e, Sn)) {
      if (del(_e, $n), !_e[ALLOW_STALE])
        return;
    } else
      Zt && (_e[UPDATE_AGE_ON_GET] && ($n.value.now = Date.now()), _e[LRU_LIST].unshiftNode($n));
    return Sn.value;
  }
}, isStale = (_e, Qt) => {
  if (!Qt || !Qt.maxAge && !_e[MAX_AGE])
    return !1;
  const Zt = Date.now() - Qt.now;
  return Qt.maxAge ? Zt > Qt.maxAge : _e[MAX_AGE] && Zt > _e[MAX_AGE];
}, trim = (_e) => {
  if (_e[LENGTH] > _e[MAX])
    for (let Qt = _e[LRU_LIST].tail; _e[LENGTH] > _e[MAX] && Qt !== null; ) {
      const Zt = Qt.prev;
      del(_e, Qt), Qt = Zt;
    }
}, del = (_e, Qt) => {
  if (Qt) {
    const Zt = Qt.value;
    _e[DISPOSE] && _e[DISPOSE](Zt.key, Zt.value), _e[LENGTH] -= Zt.length, _e[CACHE].delete(Zt.key), _e[LRU_LIST].removeNode(Qt);
  }
};
class Entry {
  constructor(Qt, Zt, $n, Sn, kn) {
    this.key = Qt, this.value = Zt, this.length = $n, this.now = Sn, this.maxAge = kn || 0;
  }
}
const forEachStep = (_e, Qt, Zt, $n) => {
  let Sn = Zt.value;
  isStale(_e, Sn) && (del(_e, Zt), _e[ALLOW_STALE] || (Sn = void 0)), Sn && Qt.call($n, Sn.value, Sn.key, _e);
};
var lruCache = LRUCache;
const looseOption = Object.freeze({
  loose: !0
}), emptyOpts = Object.freeze({}), parseOptions$1 = (_e) => _e ? typeof _e != "object" ? looseOption : _e : emptyOpts;
var parseOptions_1 = parseOptions$1, re$1 = { exports: {} };
const SEMVER_SPEC_VERSION = "2.0.0", MAX_LENGTH$1 = 256, MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
9007199254740991, MAX_SAFE_COMPONENT_LENGTH = 16, MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6, RELEASE_TYPES = ["major", "premajor", "minor", "preminor", "patch", "prepatch", "prerelease"];
var constants = {
  MAX_LENGTH: MAX_LENGTH$1,
  MAX_SAFE_COMPONENT_LENGTH,
  MAX_SAFE_BUILD_LENGTH,
  MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
  RELEASE_TYPES,
  SEMVER_SPEC_VERSION,
  FLAG_INCLUDE_PRERELEASE: 1,
  FLAG_LOOSE: 2
};
const debug$1 = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (..._e) => console.error("SEMVER", ..._e) : () => {
};
var debug_1 = debug$1;
(function(_e, Qt) {
  const {
    MAX_SAFE_COMPONENT_LENGTH: Zt,
    MAX_SAFE_BUILD_LENGTH: $n,
    MAX_LENGTH: Sn
  } = constants, kn = debug_1;
  Qt = _e.exports = {};
  const Kn = Qt.re = [], er = Qt.safeRe = [], Cr = Qt.src = [], kr = Qt.t = {};
  let Yr = 0;
  const Ms = "[a-zA-Z0-9-]", Ds = [["\\s", 1], ["\\d", Sn], [Ms, $n]], Ls = (zs) => {
    for (const [Fs, Bs] of Ds)
      zs = zs.split(`${Fs}*`).join(`${Fs}{0,${Bs}}`).split(`${Fs}+`).join(`${Fs}{1,${Bs}}`);
    return zs;
  }, js = (zs, Fs, Bs) => {
    const Hs = Ls(Fs), Ws = Yr++;
    kn(zs, Ws, Fs), kr[zs] = Ws, Cr[Ws] = Fs, Kn[Ws] = new RegExp(Fs, Bs ? "g" : void 0), er[Ws] = new RegExp(Hs, Bs ? "g" : void 0);
  };
  js("NUMERICIDENTIFIER", "0|[1-9]\\d*"), js("NUMERICIDENTIFIERLOOSE", "\\d+"), js("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${Ms}*`), js("MAINVERSION", `(${Cr[kr.NUMERICIDENTIFIER]})\\.(${Cr[kr.NUMERICIDENTIFIER]})\\.(${Cr[kr.NUMERICIDENTIFIER]})`), js("MAINVERSIONLOOSE", `(${Cr[kr.NUMERICIDENTIFIERLOOSE]})\\.(${Cr[kr.NUMERICIDENTIFIERLOOSE]})\\.(${Cr[kr.NUMERICIDENTIFIERLOOSE]})`), js("PRERELEASEIDENTIFIER", `(?:${Cr[kr.NUMERICIDENTIFIER]}|${Cr[kr.NONNUMERICIDENTIFIER]})`), js("PRERELEASEIDENTIFIERLOOSE", `(?:${Cr[kr.NUMERICIDENTIFIERLOOSE]}|${Cr[kr.NONNUMERICIDENTIFIER]})`), js("PRERELEASE", `(?:-(${Cr[kr.PRERELEASEIDENTIFIER]}(?:\\.${Cr[kr.PRERELEASEIDENTIFIER]})*))`), js("PRERELEASELOOSE", `(?:-?(${Cr[kr.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Cr[kr.PRERELEASEIDENTIFIERLOOSE]})*))`), js("BUILDIDENTIFIER", `${Ms}+`), js("BUILD", `(?:\\+(${Cr[kr.BUILDIDENTIFIER]}(?:\\.${Cr[kr.BUILDIDENTIFIER]})*))`), js("FULLPLAIN", `v?${Cr[kr.MAINVERSION]}${Cr[kr.PRERELEASE]}?${Cr[kr.BUILD]}?`), js("FULL", `^${Cr[kr.FULLPLAIN]}$`), js("LOOSEPLAIN", `[v=\\s]*${Cr[kr.MAINVERSIONLOOSE]}${Cr[kr.PRERELEASELOOSE]}?${Cr[kr.BUILD]}?`), js("LOOSE", `^${Cr[kr.LOOSEPLAIN]}$`), js("GTLT", "((?:<|>)?=?)"), js("XRANGEIDENTIFIERLOOSE", `${Cr[kr.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), js("XRANGEIDENTIFIER", `${Cr[kr.NUMERICIDENTIFIER]}|x|X|\\*`), js("XRANGEPLAIN", `[v=\\s]*(${Cr[kr.XRANGEIDENTIFIER]})(?:\\.(${Cr[kr.XRANGEIDENTIFIER]})(?:\\.(${Cr[kr.XRANGEIDENTIFIER]})(?:${Cr[kr.PRERELEASE]})?${Cr[kr.BUILD]}?)?)?`), js("XRANGEPLAINLOOSE", `[v=\\s]*(${Cr[kr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Cr[kr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Cr[kr.XRANGEIDENTIFIERLOOSE]})(?:${Cr[kr.PRERELEASELOOSE]})?${Cr[kr.BUILD]}?)?)?`), js("XRANGE", `^${Cr[kr.GTLT]}\\s*${Cr[kr.XRANGEPLAIN]}$`), js("XRANGELOOSE", `^${Cr[kr.GTLT]}\\s*${Cr[kr.XRANGEPLAINLOOSE]}$`), js("COERCE", `(^|[^\\d])(\\d{1,${Zt}})(?:\\.(\\d{1,${Zt}}))?(?:\\.(\\d{1,${Zt}}))?(?:$|[^\\d])`), js("COERCERTL", Cr[kr.COERCE], !0), js("LONETILDE", "(?:~>?)"), js("TILDETRIM", `(\\s*)${Cr[kr.LONETILDE]}\\s+`, !0), Qt.tildeTrimReplace = "$1~", js("TILDE", `^${Cr[kr.LONETILDE]}${Cr[kr.XRANGEPLAIN]}$`), js("TILDELOOSE", `^${Cr[kr.LONETILDE]}${Cr[kr.XRANGEPLAINLOOSE]}$`), js("LONECARET", "(?:\\^)"), js("CARETTRIM", `(\\s*)${Cr[kr.LONECARET]}\\s+`, !0), Qt.caretTrimReplace = "$1^", js("CARET", `^${Cr[kr.LONECARET]}${Cr[kr.XRANGEPLAIN]}$`), js("CARETLOOSE", `^${Cr[kr.LONECARET]}${Cr[kr.XRANGEPLAINLOOSE]}$`), js("COMPARATORLOOSE", `^${Cr[kr.GTLT]}\\s*(${Cr[kr.LOOSEPLAIN]})$|^$`), js("COMPARATOR", `^${Cr[kr.GTLT]}\\s*(${Cr[kr.FULLPLAIN]})$|^$`), js("COMPARATORTRIM", `(\\s*)${Cr[kr.GTLT]}\\s*(${Cr[kr.LOOSEPLAIN]}|${Cr[kr.XRANGEPLAIN]})`, !0), Qt.comparatorTrimReplace = "$1$2$3", js("HYPHENRANGE", `^\\s*(${Cr[kr.XRANGEPLAIN]})\\s+-\\s+(${Cr[kr.XRANGEPLAIN]})\\s*$`), js("HYPHENRANGELOOSE", `^\\s*(${Cr[kr.XRANGEPLAINLOOSE]})\\s+-\\s+(${Cr[kr.XRANGEPLAINLOOSE]})\\s*$`), js("STAR", "(<|>)?=?\\s*\\*"), js("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), js("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
})(re$1, re$1.exports);
var reExports = re$1.exports;
const numeric = /^[0-9]+$/, compareIdentifiers$1 = (_e, Qt) => {
  const Zt = numeric.test(_e), $n = numeric.test(Qt);
  return Zt && $n && (_e = +_e, Qt = +Qt), _e === Qt ? 0 : Zt && !$n ? -1 : $n && !Zt ? 1 : _e < Qt ? -1 : 1;
}, rcompareIdentifiers = (_e, Qt) => compareIdentifiers$1(Qt, _e);
var identifiers = {
  compareIdentifiers: compareIdentifiers$1,
  rcompareIdentifiers
};
const debug = debug_1, {
  MAX_LENGTH,
  MAX_SAFE_INTEGER
} = constants, {
  safeRe: re,
  t
} = reExports, parseOptions = parseOptions_1, {
  compareIdentifiers
} = identifiers;
let SemVer$1 = class fE {
  constructor(Qt, Zt) {
    if (Zt = parseOptions(Zt), Qt instanceof fE) {
      if (Qt.loose === !!Zt.loose && Qt.includePrerelease === !!Zt.includePrerelease)
        return Qt;
      Qt = Qt.version;
    } else if (typeof Qt != "string")
      throw new TypeError(`Invalid version. Must be a string. Got type "${typeof Qt}".`);
    if (Qt.length > MAX_LENGTH)
      throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
    debug("SemVer", Qt, Zt), this.options = Zt, this.loose = !!Zt.loose, this.includePrerelease = !!Zt.includePrerelease;
    const $n = Qt.trim().match(Zt.loose ? re[t.LOOSE] : re[t.FULL]);
    if (!$n)
      throw new TypeError(`Invalid Version: ${Qt}`);
    if (this.raw = Qt, this.major = +$n[1], this.minor = +$n[2], this.patch = +$n[3], this.major > MAX_SAFE_INTEGER || this.major < 0)
      throw new TypeError("Invalid major version");
    if (this.minor > MAX_SAFE_INTEGER || this.minor < 0)
      throw new TypeError("Invalid minor version");
    if (this.patch > MAX_SAFE_INTEGER || this.patch < 0)
      throw new TypeError("Invalid patch version");
    $n[4] ? this.prerelease = $n[4].split(".").map((Sn) => {
      if (/^[0-9]+$/.test(Sn)) {
        const kn = +Sn;
        if (kn >= 0 && kn < MAX_SAFE_INTEGER)
          return kn;
      }
      return Sn;
    }) : this.prerelease = [], this.build = $n[5] ? $n[5].split(".") : [], this.format();
  }
  format() {
    return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
  }
  toString() {
    return this.version;
  }
  compare(Qt) {
    if (debug("SemVer.compare", this.version, this.options, Qt), !(Qt instanceof fE)) {
      if (typeof Qt == "string" && Qt === this.version)
        return 0;
      Qt = new fE(Qt, this.options);
    }
    return Qt.version === this.version ? 0 : this.compareMain(Qt) || this.comparePre(Qt);
  }
  compareMain(Qt) {
    return Qt instanceof fE || (Qt = new fE(Qt, this.options)), compareIdentifiers(this.major, Qt.major) || compareIdentifiers(this.minor, Qt.minor) || compareIdentifiers(this.patch, Qt.patch);
  }
  comparePre(Qt) {
    if (Qt instanceof fE || (Qt = new fE(Qt, this.options)), this.prerelease.length && !Qt.prerelease.length)
      return -1;
    if (!this.prerelease.length && Qt.prerelease.length)
      return 1;
    if (!this.prerelease.length && !Qt.prerelease.length)
      return 0;
    let Zt = 0;
    do {
      const $n = this.prerelease[Zt], Sn = Qt.prerelease[Zt];
      if (debug("prerelease compare", Zt, $n, Sn), $n === void 0 && Sn === void 0)
        return 0;
      if (Sn === void 0)
        return 1;
      if ($n === void 0)
        return -1;
      if ($n === Sn)
        continue;
      return compareIdentifiers($n, Sn);
    } while (++Zt);
  }
  compareBuild(Qt) {
    Qt instanceof fE || (Qt = new fE(Qt, this.options));
    let Zt = 0;
    do {
      const $n = this.build[Zt], Sn = Qt.build[Zt];
      if (debug("prerelease compare", Zt, $n, Sn), $n === void 0 && Sn === void 0)
        return 0;
      if (Sn === void 0)
        return 1;
      if ($n === void 0)
        return -1;
      if ($n === Sn)
        continue;
      return compareIdentifiers($n, Sn);
    } while (++Zt);
  }
  // preminor will bump the version up to the next minor release, and immediately
  // down to pre-release. premajor and prepatch work the same way.
  inc(Qt, Zt, $n) {
    switch (Qt) {
      case "premajor":
        this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", Zt, $n);
        break;
      case "preminor":
        this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", Zt, $n);
        break;
      case "prepatch":
        this.prerelease.length = 0, this.inc("patch", Zt, $n), this.inc("pre", Zt, $n);
        break;
      case "prerelease":
        this.prerelease.length === 0 && this.inc("patch", Zt, $n), this.inc("pre", Zt, $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": {
        const Sn = Number($n) ? 1 : 0;
        if (!Zt && $n === !1)
          throw new Error("invalid increment argument: identifier is empty");
        if (this.prerelease.length === 0)
          this.prerelease = [Sn];
        else {
          let kn = this.prerelease.length;
          for (; --kn >= 0; )
            typeof this.prerelease[kn] == "number" && (this.prerelease[kn]++, kn = -2);
          if (kn === -1) {
            if (Zt === this.prerelease.join(".") && $n === !1)
              throw new Error("invalid increment argument: identifier already exists");
            this.prerelease.push(Sn);
          }
        }
        if (Zt) {
          let kn = [Zt, Sn];
          $n === !1 && (kn = [Zt]), compareIdentifiers(this.prerelease[0], Zt) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = kn) : this.prerelease = kn;
        }
        break;
      }
      default:
        throw new Error(`invalid increment argument: ${Qt}`);
    }
    return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
  }
};
var semver = SemVer$1;
const SemVer = semver, compare$6 = (_e, Qt, Zt) => new SemVer(_e, Zt).compare(new SemVer(Qt, Zt));
var compare_1 = compare$6;
const compare$5 = compare_1, eq$1 = (_e, Qt, Zt) => compare$5(_e, Qt, Zt) === 0;
var eq_1 = eq$1;
const compare$4 = compare_1, neq$1 = (_e, Qt, Zt) => compare$4(_e, Qt, Zt) !== 0;
var neq_1 = neq$1;
const compare$3 = compare_1, gt$1 = (_e, Qt, Zt) => compare$3(_e, Qt, Zt) > 0;
var gt_1 = gt$1;
const compare$2 = compare_1, gte$1 = (_e, Qt, Zt) => compare$2(_e, Qt, Zt) >= 0;
var gte_1 = gte$1;
const compare$1 = compare_1, lt$1 = (_e, Qt, Zt) => compare$1(_e, Qt, Zt) < 0;
var lt_1 = lt$1;
const compare = compare_1, lte$1 = (_e, Qt, Zt) => compare(_e, Qt, Zt) <= 0;
var lte_1 = lte$1;
const eq = eq_1, neq = neq_1, gt = gt_1, gte = gte_1, lt = lt_1, lte = lte_1, cmp = (_e, Qt, Zt, $n) => {
  switch (Qt) {
    case "===":
      return typeof _e == "object" && (_e = _e.version), typeof Zt == "object" && (Zt = Zt.version), _e === Zt;
    case "!==":
      return typeof _e == "object" && (_e = _e.version), typeof Zt == "object" && (Zt = Zt.version), _e !== Zt;
    case "":
    case "=":
    case "==":
      return eq(_e, Zt, $n);
    case "!=":
      return neq(_e, Zt, $n);
    case ">":
      return gt(_e, Zt, $n);
    case ">=":
      return gte(_e, Zt, $n);
    case "<":
      return lt(_e, Zt, $n);
    case "<=":
      return lte(_e, Zt, $n);
    default:
      throw new TypeError(`Invalid operator: ${Qt}`);
  }
};
var cmp_1 = cmp, comparator, hasRequiredComparator;
function requireComparator() {
  if (hasRequiredComparator)
    return comparator;
  hasRequiredComparator = 1;
  const _e = Symbol("SemVer ANY");
  class Qt {
    static get ANY() {
      return _e;
    }
    constructor(Yr, Ms) {
      if (Ms = Zt(Ms), Yr instanceof Qt) {
        if (Yr.loose === !!Ms.loose)
          return Yr;
        Yr = Yr.value;
      }
      Yr = Yr.trim().split(/\s+/).join(" "), Kn("comparator", Yr, Ms), this.options = Ms, this.loose = !!Ms.loose, this.parse(Yr), this.semver === _e ? this.value = "" : this.value = this.operator + this.semver.version, Kn("comp", this);
    }
    parse(Yr) {
      const Ms = this.options.loose ? $n[Sn.COMPARATORLOOSE] : $n[Sn.COMPARATOR], Ds = Yr.match(Ms);
      if (!Ds)
        throw new TypeError(`Invalid comparator: ${Yr}`);
      this.operator = Ds[1] !== void 0 ? Ds[1] : "", this.operator === "=" && (this.operator = ""), Ds[2] ? this.semver = new er(Ds[2], this.options.loose) : this.semver = _e;
    }
    toString() {
      return this.value;
    }
    test(Yr) {
      if (Kn("Comparator.test", Yr, this.options.loose), this.semver === _e || Yr === _e)
        return !0;
      if (typeof Yr == "string")
        try {
          Yr = new er(Yr, this.options);
        } catch {
          return !1;
        }
      return kn(Yr, this.operator, this.semver, this.options);
    }
    intersects(Yr, Ms) {
      if (!(Yr instanceof Qt))
        throw new TypeError("a Comparator is required");
      return this.operator === "" ? this.value === "" ? !0 : new Cr(Yr.value, Ms).test(this.value) : Yr.operator === "" ? Yr.value === "" ? !0 : new Cr(this.value, Ms).test(Yr.semver) : (Ms = Zt(Ms), Ms.includePrerelease && (this.value === "<0.0.0-0" || Yr.value === "<0.0.0-0") || !Ms.includePrerelease && (this.value.startsWith("<0.0.0") || Yr.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && Yr.operator.startsWith(">") || this.operator.startsWith("<") && Yr.operator.startsWith("<") || this.semver.version === Yr.semver.version && this.operator.includes("=") && Yr.operator.includes("=") || kn(this.semver, "<", Yr.semver, Ms) && this.operator.startsWith(">") && Yr.operator.startsWith("<") || kn(this.semver, ">", Yr.semver, Ms) && this.operator.startsWith("<") && Yr.operator.startsWith(">")));
    }
  }
  comparator = Qt;
  const Zt = parseOptions_1, {
    safeRe: $n,
    t: Sn
  } = reExports, kn = cmp_1, Kn = debug_1, er = semver, Cr = requireRange();
  return comparator;
}
var range, hasRequiredRange;
function requireRange() {
  if (hasRequiredRange)
    return range;
  hasRequiredRange = 1;
  class _e {
    constructor(zu, Yu) {
      if (Yu = $n(Yu), zu instanceof _e)
        return zu.loose === !!Yu.loose && zu.includePrerelease === !!Yu.includePrerelease ? zu : new _e(zu.raw, Yu);
      if (zu instanceof Sn)
        return this.raw = zu.value, this.set = [[zu]], this.format(), this;
      if (this.options = Yu, this.loose = !!Yu.loose, this.includePrerelease = !!Yu.includePrerelease, this.raw = zu.trim().split(/\s+/).join(" "), this.set = this.raw.split("||").map((sm) => this.parseRange(sm.trim())).filter((sm) => sm.length), !this.set.length)
        throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
      if (this.set.length > 1) {
        const sm = this.set[0];
        if (this.set = this.set.filter((mm) => !js(mm[0])), this.set.length === 0)
          this.set = [sm];
        else if (this.set.length > 1) {
          for (const mm of this.set)
            if (mm.length === 1 && zs(mm[0])) {
              this.set = [mm];
              break;
            }
        }
      }
      this.format();
    }
    format() {
      return this.range = this.set.map((zu) => zu.join(" ").trim()).join("||").trim(), this.range;
    }
    toString() {
      return this.range;
    }
    parseRange(zu) {
      const sm = ((this.options.includePrerelease && Ds) | (this.options.loose && Ls)) + ":" + zu, mm = Zt.get(sm);
      if (mm)
        return mm;
      const hm = this.options.loose, ym = hm ? er[Cr.HYPHENRANGELOOSE] : er[Cr.HYPHENRANGE];
      zu = zu.replace(ym, Nu(this.options.includePrerelease)), kn("hyphen replace", zu), zu = zu.replace(er[Cr.COMPARATORTRIM], kr), kn("comparator trim", zu), zu = zu.replace(er[Cr.TILDETRIM], Yr), kn("tilde trim", zu), zu = zu.replace(er[Cr.CARETTRIM], Ms), kn("caret trim", zu);
      let _m = zu.split(" ").map((Cm) => Bs(Cm, this.options)).join(" ").split(/\s+/).map((Cm) => Au(Cm, this.options));
      hm && (_m = _m.filter((Cm) => (kn("loose invalid filter", Cm, this.options), !!Cm.match(er[Cr.COMPARATORLOOSE])))), kn("range list", _m);
      const Sm = /* @__PURE__ */ new Map(), wm = _m.map((Cm) => new Sn(Cm, this.options));
      for (const Cm of wm) {
        if (js(Cm))
          return [Cm];
        Sm.set(Cm.value, Cm);
      }
      Sm.size > 1 && Sm.has("") && Sm.delete("");
      const Nm = [...Sm.values()];
      return Zt.set(sm, Nm), Nm;
    }
    intersects(zu, Yu) {
      if (!(zu instanceof _e))
        throw new TypeError("a Range is required");
      return this.set.some((sm) => Fs(sm, Yu) && zu.set.some((mm) => Fs(mm, Yu) && sm.every((hm) => mm.every((ym) => hm.intersects(ym, Yu)))));
    }
    // if ANY of the sets match ALL of its comparators, then pass
    test(zu) {
      if (!zu)
        return !1;
      if (typeof zu == "string")
        try {
          zu = new Kn(zu, this.options);
        } catch {
          return !1;
        }
      for (let Yu = 0; Yu < this.set.length; Yu++)
        if (gm(this.set[Yu], zu, this.options))
          return !0;
      return !1;
    }
  }
  range = _e;
  const Qt = lruCache, Zt = new Qt({
    max: 1e3
  }), $n = parseOptions_1, Sn = requireComparator(), kn = debug_1, Kn = semver, {
    safeRe: er,
    t: Cr,
    comparatorTrimReplace: kr,
    tildeTrimReplace: Yr,
    caretTrimReplace: Ms
  } = reExports, {
    FLAG_INCLUDE_PRERELEASE: Ds,
    FLAG_LOOSE: Ls
  } = constants, js = (pm) => pm.value === "<0.0.0-0", zs = (pm) => pm.value === "", Fs = (pm, zu) => {
    let Yu = !0;
    const sm = pm.slice();
    let mm = sm.pop();
    for (; Yu && sm.length; )
      Yu = sm.every((hm) => mm.intersects(hm, zu)), mm = sm.pop();
    return Yu;
  }, Bs = (pm, zu) => (kn("comp", pm, zu), pm = El(pm, zu), kn("caret", pm), pm = Ws(pm, zu), kn("tildes", pm), pm = Pl(pm, zu), kn("xrange", pm), pm = Tu(pm, zu), kn("stars", pm), pm), Hs = (pm) => !pm || pm.toLowerCase() === "x" || pm === "*", Ws = (pm, zu) => pm.trim().split(/\s+/).map((Yu) => Ys(Yu, zu)).join(" "), Ys = (pm, zu) => {
    const Yu = zu.loose ? er[Cr.TILDELOOSE] : er[Cr.TILDE];
    return pm.replace(Yu, (sm, mm, hm, ym, _m) => {
      kn("tilde", pm, sm, mm, hm, ym, _m);
      let Sm;
      return Hs(mm) ? Sm = "" : Hs(hm) ? Sm = `>=${mm}.0.0 <${+mm + 1}.0.0-0` : Hs(ym) ? Sm = `>=${mm}.${hm}.0 <${mm}.${+hm + 1}.0-0` : _m ? (kn("replaceTilde pr", _m), Sm = `>=${mm}.${hm}.${ym}-${_m} <${mm}.${+hm + 1}.0-0`) : Sm = `>=${mm}.${hm}.${ym} <${mm}.${+hm + 1}.0-0`, kn("tilde return", Sm), Sm;
    });
  }, El = (pm, zu) => pm.trim().split(/\s+/).map((Yu) => Mu(Yu, zu)).join(" "), Mu = (pm, zu) => {
    kn("caret", pm, zu);
    const Yu = zu.loose ? er[Cr.CARETLOOSE] : er[Cr.CARET], sm = zu.includePrerelease ? "-0" : "";
    return pm.replace(Yu, (mm, hm, ym, _m, Sm) => {
      kn("caret", pm, mm, hm, ym, _m, Sm);
      let wm;
      return Hs(hm) ? wm = "" : Hs(ym) ? wm = `>=${hm}.0.0${sm} <${+hm + 1}.0.0-0` : Hs(_m) ? hm === "0" ? wm = `>=${hm}.${ym}.0${sm} <${hm}.${+ym + 1}.0-0` : wm = `>=${hm}.${ym}.0${sm} <${+hm + 1}.0.0-0` : Sm ? (kn("replaceCaret pr", Sm), hm === "0" ? ym === "0" ? wm = `>=${hm}.${ym}.${_m}-${Sm} <${hm}.${ym}.${+_m + 1}-0` : wm = `>=${hm}.${ym}.${_m}-${Sm} <${hm}.${+ym + 1}.0-0` : wm = `>=${hm}.${ym}.${_m}-${Sm} <${+hm + 1}.0.0-0`) : (kn("no pr"), hm === "0" ? ym === "0" ? wm = `>=${hm}.${ym}.${_m}${sm} <${hm}.${ym}.${+_m + 1}-0` : wm = `>=${hm}.${ym}.${_m}${sm} <${hm}.${+ym + 1}.0-0` : wm = `>=${hm}.${ym}.${_m} <${+hm + 1}.0.0-0`), kn("caret return", wm), wm;
    });
  }, Pl = (pm, zu) => (kn("replaceXRanges", pm, zu), pm.split(/\s+/).map((Yu) => Iu(Yu, zu)).join(" ")), Iu = (pm, zu) => {
    pm = pm.trim();
    const Yu = zu.loose ? er[Cr.XRANGELOOSE] : er[Cr.XRANGE];
    return pm.replace(Yu, (sm, mm, hm, ym, _m, Sm) => {
      kn("xRange", pm, sm, mm, hm, ym, _m, Sm);
      const wm = Hs(hm), Nm = wm || Hs(ym), Cm = Nm || Hs(_m), Im = Cm;
      return mm === "=" && Im && (mm = ""), Sm = zu.includePrerelease ? "-0" : "", wm ? mm === ">" || mm === "<" ? sm = "<0.0.0-0" : sm = "*" : mm && Im ? (Nm && (ym = 0), _m = 0, mm === ">" ? (mm = ">=", Nm ? (hm = +hm + 1, ym = 0, _m = 0) : (ym = +ym + 1, _m = 0)) : mm === "<=" && (mm = "<", Nm ? hm = +hm + 1 : ym = +ym + 1), mm === "<" && (Sm = "-0"), sm = `${mm + hm}.${ym}.${_m}${Sm}`) : Nm ? sm = `>=${hm}.0.0${Sm} <${+hm + 1}.0.0-0` : Cm && (sm = `>=${hm}.${ym}.0${Sm} <${hm}.${+ym + 1}.0-0`), kn("xRange return", sm), sm;
    });
  }, Tu = (pm, zu) => (kn("replaceStars", pm, zu), pm.trim().replace(er[Cr.STAR], "")), Au = (pm, zu) => (kn("replaceGTE0", pm, zu), pm.trim().replace(er[zu.includePrerelease ? Cr.GTE0PRE : Cr.GTE0], "")), Nu = (pm) => (zu, Yu, sm, mm, hm, ym, _m, Sm, wm, Nm, Cm, Im, Am) => (Hs(sm) ? Yu = "" : Hs(mm) ? Yu = `>=${sm}.0.0${pm ? "-0" : ""}` : Hs(hm) ? Yu = `>=${sm}.${mm}.0${pm ? "-0" : ""}` : ym ? Yu = `>=${Yu}` : Yu = `>=${Yu}${pm ? "-0" : ""}`, Hs(wm) ? Sm = "" : Hs(Nm) ? Sm = `<${+wm + 1}.0.0-0` : Hs(Cm) ? Sm = `<${wm}.${+Nm + 1}.0-0` : Im ? Sm = `<=${wm}.${Nm}.${Cm}-${Im}` : pm ? Sm = `<${wm}.${Nm}.${+Cm + 1}-0` : Sm = `<=${Sm}`, `${Yu} ${Sm}`.trim()), gm = (pm, zu, Yu) => {
    for (let sm = 0; sm < pm.length; sm++)
      if (!pm[sm].test(zu))
        return !1;
    if (zu.prerelease.length && !Yu.includePrerelease) {
      for (let sm = 0; sm < pm.length; sm++)
        if (kn(pm[sm].semver), pm[sm].semver !== Sn.ANY && pm[sm].semver.prerelease.length > 0) {
          const mm = pm[sm].semver;
          if (mm.major === zu.major && mm.minor === zu.minor && mm.patch === zu.patch)
            return !0;
        }
      return !1;
    }
    return !0;
  };
  return range;
}
const Range = requireRange(), satisfies = (_e, Qt, Zt) => {
  try {
    Qt = new Range(Qt, Zt);
  } catch {
    return !1;
  }
  return Qt.test(_e);
};
var satisfies_1 = satisfies, satisfies$1 = /* @__PURE__ */ getDefaultExportFromCjs(satisfies_1);
function post(_e, Qt, Zt) {
  const $n = _e.open(Qt), Sn = 1e4, kn = 250, {
    origin: Kn
  } = new URL(Qt);
  let er = ~~(Sn / kn);
  function Cr(Yr) {
    Yr.source === $n && (er = 0, _e.removeEventListener("message", Cr, !1));
  }
  _e.addEventListener("message", Cr, !1);
  function kr() {
    er <= 0 || ($n.postMessage(Zt, Kn), setTimeout(kr, kn), er -= 1);
  }
  setTimeout(kr, kn);
}
var embedStyle = `.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);
  }
}
`;
function mergeDeep(_e, ...Qt) {
  for (const Zt of Qt)
    deepMerge_(_e, Zt);
  return _e;
}
function deepMerge_(_e, Qt) {
  for (const Zt of Object.keys(Qt))
    writeConfig(_e, Zt, Qt[Zt], !0);
}
function ownKeys(_e, Qt) {
  var Zt = Object.keys(_e);
  if (Object.getOwnPropertySymbols) {
    var $n = Object.getOwnPropertySymbols(_e);
    Qt && ($n = $n.filter(function(Sn) {
      return Object.getOwnPropertyDescriptor(_e, Sn).enumerable;
    })), Zt.push.apply(Zt, $n);
  }
  return Zt;
}
function _objectSpread(_e) {
  for (var Qt = 1; Qt < arguments.length; Qt++) {
    var Zt = arguments[Qt] != null ? arguments[Qt] : {};
    Qt % 2 ? ownKeys(Object(Zt), !0).forEach(function($n) {
      _defineProperty$2(_e, $n, Zt[$n]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(_e, Object.getOwnPropertyDescriptors(Zt)) : ownKeys(Object(Zt)).forEach(function($n) {
      Object.defineProperty(_e, $n, Object.getOwnPropertyDescriptor(Zt, $n));
    });
  }
  return _e;
}
const vega = vegaImport;
let vegaLite = vegaLiteImport;
const w = typeof window < "u" ? window : void 0;
var LD;
vegaLite === void 0 && ((LD = w == null ? void 0 : w.vl) != null && LD.compile) && (vegaLite = w.vl);
const DEFAULT_ACTIONS = {
  export: {
    svg: !0,
    png: !0
  },
  source: !0,
  compiled: !0,
  editor: !0
}, I18N = {
  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"
}, NAMES = {
  vega: "Vega",
  "vega-lite": "Vega-Lite"
}, VERSION = {
  vega: vega.version,
  "vega-lite": vegaLite ? vegaLite.version : "not available"
}, PREPROCESSOR = {
  vega: (_e) => _e,
  "vega-lite": (_e, Qt) => vegaLite.compile(_e, {
    config: Qt
  }).spec
}, SVG_CIRCLES = `
<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>`, CHART_WRAPPER_CLASS = "chart-wrapper";
function isTooltipHandler(_e) {
  return typeof _e == "function";
}
function viewSource(_e, Qt, Zt, $n) {
  const Sn = `<html><head>${Qt}</head><body><pre><code class="json">`, kn = `</code></pre>${Zt}</body></html>`, Kn = window.open("");
  Kn.document.write(Sn + _e + kn), Kn.document.title = `${NAMES[$n]} JSON Source`;
}
function guessMode(_e, Qt) {
  if (_e.$schema) {
    const Zt = e(_e.$schema);
    Qt && Qt !== Zt.library && console.warn(`The given visualization spec is written in ${NAMES[Zt.library]}, but mode argument sets ${NAMES[Qt] ?? Qt}.`);
    const $n = Zt.library;
    return satisfies$1(VERSION[$n], `^${Zt.version.slice(1)}`) || console.warn(`The input spec uses ${NAMES[$n]} ${Zt.version}, but the current version of ${NAMES[$n]} is v${VERSION[$n]}.`), $n;
  }
  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" : Qt ?? "vega";
}
function isLoader(_e) {
  return !!(_e && "load" in _e);
}
function createLoader(_e) {
  return isLoader(_e) ? _e : vega.loader(_e);
}
function embedOptionsFromUsermeta(_e) {
  var Zt;
  const Qt = ((Zt = _e.usermeta) == null ? void 0 : Zt.embedOptions) ?? {};
  return isString(Qt.defaultStyle) && (Qt.defaultStyle = !1), Qt;
}
async function embed(_e, Qt, Zt = {}) {
  let $n, Sn;
  isString(Qt) ? (Sn = createLoader(Zt.loader), $n = JSON.parse(await Sn.load(Qt))) : $n = Qt;
  const kn = embedOptionsFromUsermeta($n), Kn = kn.loader;
  (!Sn || Kn) && (Sn = createLoader(Zt.loader ?? Kn));
  const er = await loadOpts(kn, Sn), Cr = await loadOpts(Zt, Sn), kr = _objectSpread(_objectSpread({}, mergeDeep(Cr, er)), {}, {
    config: mergeConfig(Cr.config ?? {}, er.config ?? {})
  });
  return await _embed(_e, $n, kr, Sn);
}
async function loadOpts(_e, Qt) {
  const Zt = isString(_e.config) ? JSON.parse(await Qt.load(_e.config)) : _e.config ?? {}, $n = isString(_e.patch) ? JSON.parse(await Qt.load(_e.patch)) : _e.patch;
  return _objectSpread(_objectSpread(_objectSpread({}, _e), $n ? {
    patch: $n
  } : {}), Zt ? {
    config: Zt
  } : {});
}
function getRoot(_e) {
  const Qt = _e.getRootNode ? _e.getRootNode() : document;
  return Qt instanceof ShadowRoot ? {
    root: Qt,
    rootContainer: Qt
  } : {
    root: document,
    rootContainer: document.head ?? document.body
  };
}
async function _embed(_e, Qt, Zt = {}, $n) {
  const Sn = Zt.theme ? mergeConfig(themes[Zt.theme], Zt.config ?? {}) : Zt.config, kn = isBoolean$2(Zt.actions) ? Zt.actions : mergeDeep({}, DEFAULT_ACTIONS, Zt.actions ?? {}), Kn = _objectSpread(_objectSpread({}, I18N), Zt.i18n), er = Zt.renderer ?? "canvas", Cr = Zt.logLevel ?? vega.Warn, kr = Zt.downloadFileName ?? "visualization", Yr = typeof _e == "string" ? document.querySelector(_e) : _e;
  if (!Yr)
    throw new Error(`${_e} does not exist`);
  if (Zt.defaultStyle !== !1) {
    const El = "vega-embed-style", {
      root: Mu,
      rootContainer: Pl
    } = getRoot(Yr);
    if (!Mu.getElementById(El)) {
      const Iu = document.createElement("style");
      Iu.id = El, Iu.innerHTML = Zt.defaultStyle === void 0 || Zt.defaultStyle === !0 ? embedStyle.toString() : Zt.defaultStyle, Pl.appendChild(Iu);
    }
  }
  const Ms = guessMode(Qt, Zt.mode);
  let Ds = PREPROCESSOR[Ms](Qt, Sn);
  if (Ms === "vega-lite" && Ds.$schema) {
    const El = e(Ds.$schema);
    satisfies$1(VERSION.vega, `^${El.version.slice(1)}`) || console.warn(`The compiled spec uses Vega ${El.version}, but current version is v${VERSION.vega}.`);
  }
  Yr.classList.add("vega-embed"), kn && Yr.classList.add("has-actions"), Yr.innerHTML = "";
  let Ls = Yr;
  if (kn) {
    const El = document.createElement("div");
    El.classList.add(CHART_WRAPPER_CLASS), Yr.appendChild(El), Ls = El;
  }
  const js = Zt.patch;
  if (js && (Ds = js instanceof Function ? js(Ds) : applyPatch(Ds, js, !0, !1).newDocument), Zt.formatLocale && vega.formatLocale(Zt.formatLocale), Zt.timeFormatLocale && vega.timeFormatLocale(Zt.timeFormatLocale), Zt.expressionFunctions)
    for (const El in Zt.expressionFunctions) {
      const Mu = Zt.expressionFunctions[El];
      "fn" in Mu ? vega.expressionFunction(El, Mu.fn, Mu.visitor) : Mu instanceof Function && vega.expressionFunction(El, Mu);
    }
  const {
    ast: zs
  } = Zt, Fs = vega.parse(Ds, Ms === "vega-lite" ? {} : Sn, {
    ast: zs
  }), Bs = new (Zt.viewClass || vega.View)(Fs, _objectSpread({
    loader: $n,
    logLevel: Cr,
    renderer: er
  }, zs ? {
    expr: vega.expressionInterpreter ?? Zt.expr ?? expression
  } : {}));
  if (Bs.addSignalListener("autosize", (El, Mu) => {
    const {
      type: Pl
    } = Mu;
    Pl == "fit-x" ? (Ls.classList.add("fit-x"), Ls.classList.remove("fit-y")) : Pl == "fit-y" ? (Ls.classList.remove("fit-x"), Ls.classList.add("fit-y")) : Pl == "fit" ? Ls.classList.add("fit-x", "fit-y") : Ls.classList.remove("fit-x", "fit-y");
  }), Zt.tooltip !== !1) {
    const El = isTooltipHandler(Zt.tooltip) ? Zt.tooltip : (
      // user provided boolean true or tooltip options
      new Handler(Zt.tooltip === !0 ? {} : Zt.tooltip).call
    );
    Bs.tooltip(El);
  }
  let {
    hover: Hs
  } = Zt;
  if (Hs === void 0 && (Hs = Ms === "vega"), Hs) {
    const {
      hoverSet: El,
      updateSet: Mu
    } = typeof Hs == "boolean" ? {} : Hs;
    Bs.hover(El, Mu);
  }
  Zt && (Zt.width != null && Bs.width(Zt.width), Zt.height != null && Bs.height(Zt.height), Zt.padding != null && Bs.padding(Zt.padding)), await Bs.initialize(Ls, Zt.bind).runAsync();
  let Ws;
  if (kn !== !1) {
    let El = Yr;
    if (Zt.defaultStyle !== !1) {
      const Pl = document.createElement("details");
      Pl.title = Kn.CLICK_TO_VIEW_ACTIONS, Yr.append(Pl), El = Pl;
      const Iu = document.createElement("summary");
      Iu.innerHTML = SVG_CIRCLES, Pl.append(Iu), Ws = (Tu) => {
        Pl.contains(Tu.target) || Pl.removeAttribute("open");
      }, document.addEventListener("click", Ws);
    }
    const Mu = document.createElement("div");
    if (El.append(Mu), Mu.classList.add("vega-actions"), kn === !0 || kn.export !== !1) {
      for (const Pl of ["svg", "png"])
        if (kn === !0 || kn.export === !0 || kn.export[Pl]) {
          const Iu = Kn[`${Pl.toUpperCase()}_ACTION`], Tu = document.createElement("a"), Au = isObject(Zt.scaleFactor) ? Zt.scaleFactor[Pl] : Zt.scaleFactor;
          Tu.text = Iu, Tu.href = "#", Tu.target = "_blank", Tu.download = `${kr}.${Pl}`, Tu.addEventListener("mousedown", async function(Nu) {
            Nu.preventDefault();
            const gm = await Bs.toImageURL(Pl, Au);
            this.href = gm;
          }), Mu.append(Tu);
        }
    }
    if (kn === !0 || kn.source !== !1) {
      const Pl = document.createElement("a");
      Pl.text = Kn.SOURCE_ACTION, Pl.href = "#", Pl.addEventListener("click", function(Iu) {
        viewSource(stringify$1(Qt), Zt.sourceHeader ?? "", Zt.sourceFooter ?? "", Ms), Iu.preventDefault();
      }), Mu.append(Pl);
    }
    if (Ms === "vega-lite" && (kn === !0 || kn.compiled !== !1)) {
      const Pl = document.createElement("a");
      Pl.text = Kn.COMPILED_ACTION, Pl.href = "#", Pl.addEventListener("click", function(Iu) {
        viewSource(stringify$1(Ds), Zt.sourceHeader ?? "", Zt.sourceFooter ?? "", "vega"), Iu.preventDefault();
      }), Mu.append(Pl);
    }
    if (kn === !0 || kn.editor !== !1) {
      const Pl = Zt.editorUrl ?? "https://vega.github.io/editor/", Iu = document.createElement("a");
      Iu.text = Kn.EDITOR_ACTION, Iu.href = "#", Iu.addEventListener("click", function(Tu) {
        post(window, Pl, {
          config: Sn,
          mode: Ms,
          renderer: er,
          spec: stringify$1(Qt)
        }), Tu.preventDefault();
      }), Mu.append(Iu);
    }
  }
  function Ys() {
    Ws && document.removeEventListener("click", Ws), Bs.finalize();
  }
  return {
    view: Bs,
    spec: Qt,
    vgSpec: Ds,
    finalize: Ys,
    embedOptions: Zt
  };
}
function isFunction(_e) {
  return !!_e && {}.toString.call(_e) === "[object Function]";
}
function updateSingleDatasetInView(_e, Qt, Zt) {
  Zt && (isFunction(Zt) ? Zt(_e.data(Qt)) : _e.change(Qt, vega.changeset().remove(() => !0).insert(Zt)));
}
function updateMultipleDatasetsInView(_e, Qt) {
  Object.keys(Qt).forEach((Zt) => {
    updateSingleDatasetInView(_e, Zt, Qt[Zt]);
  });
}
function getUniqueFieldNames(_e) {
  const Qt = /* @__PURE__ */ new Set();
  return _e.forEach((Zt) => {
    Object.keys(Zt).forEach(($n) => {
      Qt.add($n);
    });
  }), Qt;
}
const NOOP = () => {
};
function addSignalListenersToView(_e, Qt) {
  const Zt = Object.keys(Qt);
  return Zt.forEach(($n) => {
    try {
      _e.addSignalListener($n, Qt[$n]);
    } catch (Sn) {
      console.warn("Cannot add invalid signal listener.", Sn);
    }
  }), Zt.length > 0;
}
function computeSpecChanges(_e, Qt) {
  if (_e === Qt)
    return !1;
  const Zt = {
    width: !1,
    height: !1,
    isExpensive: !1
  }, $n = getUniqueFieldNames([_e, Qt]);
  return $n.has("width") && (!("width" in _e) || !("width" in Qt) || _e.width !== Qt.width) && ("width" in _e && typeof _e.width == "number" ? Zt.width = _e.width : Zt.isExpensive = !0), $n.has("height") && (!("height" in _e) || !("height" in Qt) || _e.height !== Qt.height) && ("height" in _e && typeof _e.height == "number" ? Zt.height = _e.height : Zt.isExpensive = !0), $n.delete("width"), $n.delete("height"), [...$n].some((Sn) => !(Sn in _e) || !(Sn in Qt) || !equal$1(_e[Sn], Qt[Sn])) && (Zt.isExpensive = !0), Zt.width !== !1 || Zt.height !== !1 || Zt.isExpensive ? Zt : !1;
}
function removeSignalListenersFromView(_e, Qt) {
  const Zt = Object.keys(Qt);
  return Zt.forEach(($n) => {
    try {
      _e.removeSignalListener($n, Qt[$n]);
    } catch (Sn) {
      console.warn("Cannot remove invalid signal listener.", Sn);
    }
  }), Zt.length > 0;
}
function combineSpecWithDimension(_e) {
  const {
    spec: Qt,
    width: Zt,
    height: $n
  } = _e;
  return typeof Zt < "u" && typeof $n < "u" ? {
    ...Qt,
    width: Zt,
    height: $n
  } : typeof Zt < "u" ? {
    ...Qt,
    width: Zt
  } : typeof $n < "u" ? {
    ...Qt,
    height: $n
  } : Qt;
}
function _defineProperty$1(_e, Qt, Zt) {
  return Qt in _e ? Object.defineProperty(_e, Qt, { value: Zt, enumerable: !0, configurable: !0, writable: !0 }) : _e[Qt] = Zt, _e;
}
class VegaEmbed extends React.PureComponent {
  constructor() {
    super(...arguments), _defineProperty$1(this, "containerRef", /* @__PURE__ */ React.createRef()), _defineProperty$1(this, "resultPromise", void 0), _defineProperty$1(this, "handleError", (Qt) => {
      const {
        onError: Zt = NOOP
      } = this.props;
      Zt(Qt, this.containerRef.current), console.warn(Qt);
    }), _defineProperty$1(this, "modifyView", (Qt) => {
      this.resultPromise && this.resultPromise.then((Zt) => (Zt && Qt(Zt.view), !0)).catch(this.handleError);
    });
  }
  componentDidMount() {
    this.createView();
  }
  componentDidUpdate(Qt) {
    const Zt = getUniqueFieldNames([this.props, Qt]);
    if (Zt.delete("className"), Zt.delete("signalListeners"), Zt.delete("spec"), Zt.delete("style"), Zt.delete("width"), Zt.delete("height"), Array.from(Zt).some(($n) => this.props[$n] !== Qt[$n]))
      this.clearView(), this.createView();
    else {
      const $n = computeSpecChanges(combineSpecWithDimension(this.props), combineSpecWithDimension(Qt)), {
        signalListeners: Sn
      } = this.props, {
        signalListeners: kn
      } = Qt;
      if ($n)
        if ($n.isExpensive)
          this.clearView(), this.createView();
        else {
          const Kn = !shallowEqual(Sn, kn);
          this.modifyView((er) => {
            $n.width !== !1 && er.width($n.width), $n.height !== !1 && er.height($n.height), Kn && (kn && removeSignalListenersFromView(er, kn), Sn && addSignalListenersToView(er, Sn)), er.run();
          });
        }
      else
        shallowEqual(Sn, kn) || this.modifyView((Kn) => {
          kn && removeSignalListenersFromView(Kn, kn), Sn && addSignalListenersToView(Kn, Sn), Kn.run();
        });
    }
  }
  componentWillUnmount() {
    this.clearView();
  }
  createView() {
    const {
      spec: Qt,
      onNewView: Zt,
      signalListeners: $n = {},
      width: Sn,
      height: kn,
      ...Kn
    } = this.props;
    if (this.containerRef.current) {
      const er = combineSpecWithDimension(this.props);
      this.resultPromise = embed(this.containerRef.current, er, Kn).then((Cr) => {
        if (Cr) {
          const {
            view: kr
          } = Cr;
          addSignalListenersToView(kr, $n) && kr.run();
        }
        return Cr;
      }).catch(this.handleError), Zt && this.modifyView(Zt);
    }
  }
  clearView() {
    return this.resultPromise && this.resultPromise.then((Qt) => {
      Qt && Qt.finalize();
    }).catch(this.handleError), this.resultPromise = void 0, this;
  }
  render() {
    const {
      className: Qt,
      style: Zt
    } = this.props;
    return /* @__PURE__ */ React.createElement("div", {
      ref: this.containerRef,
      className: Qt,
      style: Zt
    });
  }
}
_defineProperty$1(VegaEmbed, "propTypes", {
  className: _pt.string,
  onError: _pt.func
});
function _extends$1() {
  return _extends$1 = Object.assign || function(_e) {
    for (var Qt = 1; Qt < arguments.length; Qt++) {
      var Zt = arguments[Qt];
      for (var $n in Zt)
        Object.prototype.hasOwnProperty.call(Zt, $n) && (_e[$n] = Zt[$n]);
    }
    return _e;
  }, _extends$1.apply(this, arguments);
}
function _defineProperty(_e, Qt, Zt) {
  return Qt in _e ? Object.defineProperty(_e, Qt, { value: Zt, enumerable: !0, configurable: !0, writable: !0 }) : _e[Qt] = Zt, _e;
}
const EMPTY = {};
class Vega extends React.PureComponent {
  constructor() {
    super(...arguments), _defineProperty(this, "vegaEmbed", /* @__PURE__ */ React.createRef()), _defineProperty(this, "handleNewView", (Qt) => {
      this.update();
      const {
        onNewView: Zt = NOOP
      } = this.props;
      Zt(Qt);
    });
  }
  componentDidMount() {
    this.update();
  }
  componentDidUpdate(Qt) {
    shallowEqual(this.props.data, Qt.data) || this.update();
  }
  update() {
    const {
      data: Qt
    } = this.props;
    this.vegaEmbed.current && Qt && Object.keys(Qt).length > 0 && this.vegaEmbed.current.modifyView((Zt) => {
      updateMultipleDatasetsInView(Zt, Qt), Zt.resize().run();
    });
  }
  render() {
    const {
      data: Qt,
      ...Zt
    } = this.props;
    return /* @__PURE__ */ React.createElement(VegaEmbed, _extends$1({
      ref: this.vegaEmbed
    }, Zt, {
      onNewView: this.handleNewView
    }));
  }
}
_defineProperty(Vega, "defaultProps", {
  data: EMPTY
});
function _extends() {
  return _extends = Object.assign || function(_e) {
    for (var Qt = 1; Qt < arguments.length; Qt++) {
      var Zt = arguments[Qt];
      for (var $n in Zt)
        Object.prototype.hasOwnProperty.call(Zt, $n) && (_e[$n] = Zt[$n]);
    }
    return _e;
  }, _extends.apply(this, arguments);
}
function VegaLite(_e) {
  return /* @__PURE__ */ React.createElement(Vega, _extends({}, _e, {
    mode: "vega-lite"
  }));
}
function Vegalite({ cell: _e }) {
  const [Qt] = useModelState("spec"), [Zt] = useModelState("selection_names"), [$n] = useModelState("selection_types"), [Sn, kn] = reactExports.useState({}), [Kn] = useLocalStorage({
    key: "_persist_vegalite_debounce_time",
    defaultValue: 200
  }), [er] = useModelState("is_applying"), [Cr] = useDebouncedValue(er, 300), kr = reactExports.useMemo(() => JSON.parse(Qt), [Qt]), Yr = useModel(), Ms = reactExports.useCallback(
    (Ds) => {
      window.Persist.Views.set(_e, Ds);
      const Ls = {};
      Zt.forEach((js) => {
        const zs = `${js}_store`;
        Ls[js] = lodashExports.debounce(
          (Fs, Bs) => {
            window.Persist.Commands.execute(PersistCommands.intervalSelection, {
              cell: _e,
              name: js,
              value: Bs,
              store: Ds.data(zs) || [],
              brush_type: $n[js] || "interval"
            });
          },
          Kn
        );
      }), kn(Ls);
    },
    [_e, Yr, Zt, $n, Kn]
  );
  return /* @__PURE__ */ React.createElement(Group$1, null, /* @__PURE__ */ React.createElement(Stack$1, { pos: "relative" }, /* @__PURE__ */ React.createElement(LoadingOverlay, { visible: Cr }), /* @__PURE__ */ React.createElement(
    VegaLite,
    {
      spec: kr,
      onNewView: Ms,
      signalListeners: Sn
    }
  )));
}
const MAX_SIDEBAR_WIDTH = "350px", MAX_DATAFRAME_TOOLBAR_HEIGHT = "300px";
function PersistOutput({ cell: _e }) {
  const [Qt] = useModelState("is_chart");
  reactExports.useEffect(() => {
    _e.tagAsPersistCell();
  }, [_e]);
  const Zt = Qt ? /* @__PURE__ */ React.createElement(Vegalite, { cell: _e }) : /* @__PURE__ */ React.createElement(DatatableComponent, { cell: _e });
  return /* @__PURE__ */ React.createElement(Stack$1, { justify: "flex-start", spacing: "xs" }, /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Header, { cell: _e })), /* @__PURE__ */ React.createElement(Group$1, { position: "apart", spacing: "xs", align: "flex-start" }, /* @__PURE__ */ React.createElement(Stack$1, { spacing: "xs", sx: { flex: 1, overflow: "hidden" } }, /* @__PURE__ */ React.createElement(Box, { sx: { overflow: "auto" } }, Zt), /* @__PURE__ */ React.createElement(Box, { sx: { overflow: "hidden" } }, /* @__PURE__ */ React.createElement(Box, { mah: MAX_DATAFRAME_TOOLBAR_HEIGHT, sx: { overflow: "auto" } }, /* @__PURE__ */ React.createElement(DataframeFooter, { cell: _e })))), /* @__PURE__ */ React.createElement(Box, { w: MAX_SIDEBAR_WIDTH, sx: { overflow: "hidden" } }, /* @__PURE__ */ React.createElement(Sidebar, { cell: _e }))));
}
const render = createRender(withTrrackableCell(PersistOutput));
export {
  PersistOutput,
  render
};
